akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
  
#define lol long long
#define gcd(x,y) __gcd(x,y)
#define mt make_tuple
#define mp make_pair
#define fi first
#define se second
#define fixed fixed<<setprecision(14)
using namespace std;
using pii=pair<int,int>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
template <class A> inline lol abs(A &a) { return (a < 0 ? -a : a); }
const lol inf=(1LL<<60);
const lol MOD=(1e9)+7;
const lol mod=998244353;
const int dx[]={1,0,-1,0,1,-1,1,-1};
const int dy[]={0,1,0,-1,1,1,-1,-1};
lol n,m,k,r,q;
signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  lol a,b,v,w,t;
  cin >>a>>v>>b>>w>>t;
  lol ans=abs(a-b);
  lol sum=v-w;
  if(sum*t>=ans) cout <<"YES\n";
  else cout <<"NO\n";
  return (0);
}


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


bool isPrime(int n){
    if(n == 2) return true;
    if(n % 2 == 0) return false;

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

int main() {

    int input;
    
    while(cin >> input){
        for (int i = 1; i < 100; ++i)
            if(isPrime(input - i)){
                cout << (input - i) << " ";
                break;
            }

        for (int j = 1; j < 100; ++j)
            if(isPrime(input + j)){
                cout << (input + j) << endl;
                break;
            }

    }
    return 0;
}


Measured memory_bytes: 3064
// https://atcoder.jp/contests/abc068/tasks/abc068_b
"use strict"
function Main(input) {
  const n = Number(input);

  let i = 0;
  while (true) {
    if (Math.pow(2, i) > n) {
      console.log(Math.pow(2, i - 1));
      return;
    }
    i++;
  }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 7500
/*
これを入れて実行
g++ code.cpp
./a.out
 */

#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <algorithm>
#include <utility>
#include <set>
#include <map>
#include <cmath>
#include <tuple>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef long double ld;

int dy4[4] = {-1, 0, +1, 0};
int dx4[4] = {0, +1, 0, -1};
int dy8[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dx8[8] = {0, 1, 1, 1, 0, -1, -1, -1};

const long long INF = 1LL << 60;
const ll MOD = 1e9 + 7;

bool greaterSecond(const pair<int, int>& f, const pair<int, int>& s){
    return f.second > s.second;
}

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

ll nCm(ll n, ll m){
    if(m == 0 || m == n){
        return 1;
    } else if(m == 1){
        return n;
    }
    return (nCm(n - 1, m) + nCm(n - 1, m - 1));
}

//-----------------------ここから-----------

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

Measured memory_bytes: 256
// input: alds1_9_c.in
#include<iostream>
#include<stdlib.h>
using namespace std;

#define NIL -100

void error(const std::string& msg) {
  cout << "error: " << msg << endl;
  exit(1);
}

class Heap {
public:
  Heap() {
    xs = new int[2000000];
    last = -1;
  }
  void insert(int k) {
    last++;
    xs[last] = k;

    int c = last;
    int p = parent(last);
    while(p != c && xs[p] < xs[c]) {
      swap(xs[p], xs[c]);

      p = parent(p);
      c = parent(c);
    }
  }
  int extractMax() {
    if(last < 0) error("heap underflow");
    int max = xs[0];

    swap(xs[0], xs[last]);
    xs[last] = NIL;
    maxHeapify(0);

    last--;
    return max;
  }

  void print() {
    cout << xs[0];
    for(int i=1; i<last+1; i++) {
      cout << ", " << xs[i];
    }
    cout << endl;
  }
private:
  void maxHeapify(int i) {
    int largest = i;
    int l = left(i);
    if(l != -1 && xs[l] > xs[largest]) largest = l;
    int r = right(i);
    if(r != -1 && xs[r] > xs[largest]) largest = r;

    if(largest != i) {
      swap(xs[largest], xs[i]);
      maxHeapify(largest);
    }
  }

  int left(int i) {
    int l = i*2;
    if(l > last) {
      return -1;
    }
    return l;
  }

  int right(int i) {
    int r = i*2+1;
    if(r > last) {
      return -1;
    }
    return r;
  }

  int parent(int i) {
    return i/2;
  }

  int* xs;
  int last;
};

int main() {
  Heap h;

  string order;
  int value;
  while(true) {
    cin >> order;
    if(order.compare("insert") == 0) {
      cin >> value;
      h.insert(value);
    } else if(order.compare("extract") == 0) {
      cout << h.extractMax() << endl;
    } else if(order.compare("end") == 0) {
      return 0;
    }
  }
}

Measured memory_bytes: 7044
// 以下のソースを勉強する.
// zscoder氏.
// https://atcoder.jp/contests/dp/submissions/3941257
#include <bits/stdc++.h>
using namespace std;
using LL = long long;

int dp[11111][111][2];
const int MOD = (1e9 + 7);

int add(int a, int b){
    a += b;
    while(a >= MOD) a -= MOD;
    return a;
}

int main(){
    
    // 1. 入力情報取得.
    char C[11111];
    scanf("%s", C);
    string K(C);
    K = "0" + K;
    int D;
    scanf("%d", &D);
    
    // 2. dp更新.
    int N = K.length();
    dp[0][0][0] = 1;
    for(int i = 0; i + 1 < N; i++){
        for(int j = 0; j < D; j++){
            for(int k = 0; k < 2; k++){
                int v = dp[i][j][k];
                if(v == 0) continue;
                for(int dig = 0; dig < 10; dig++){
                    if(!k && (dig > K[i + 1] - '0')) continue;
                    int newk = k;
                    if(!k && (dig < K[i + 1] - '0')) newk = 1;
                    dp[i + 1][(j + dig) % D][newk] = add(dp[i + 1][(j + dig) % D][newk], v);
                }
            }
        }
    }
    int ans = MOD - 1;
    for(int k = 0; k < 2; k++) ans = add(ans, dp[N - 1][0][k]);
    
    // 3. 出力.
    printf("%lld\n", ans);
    return 0;
}

Measured memory_bytes: 8960
//** aman**/
#include<bits/stdc++.h>
#define ll          long long
#define pb          push_back
#define pii         pair<ll,ll>
#define vi          vector<ll>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define dl          double
#define hell        1000000007
#define endl        '\n'
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define lb lower_bound
#define ub upper_bound
#define bs          binary_search
#define ios         ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
using namespace std;
ll dp[200005]={0},p[200005]={0};
int main(){
	ll n;cin>>n;
	dp[0]=1;
	for(ll i=1;i<=n;i++){
		ll x;cin>>x;
		if(p[x]==0||p[x]==i-1)dp[i]=dp[i-1];
		else dp[i]=(dp[i-1]+dp[p[x]])%hell;
		p[x]=i;
	}
	//for(ll i=0;i<=n;i++)cout<<dp[i]<<" ";cout<<endl;
	cout<<dp[n]%hell<<endl;
}

Measured memory_bytes: 3328
#include <cstdio>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
using namespace std;
int main(){
    string n;
    cin>>n;
    for(int i=0;i<n.length();i++){
        if(n[i]=='1') cout<<"9";
        if(n[i]=='9') cout<<"1";
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <sstream>
#include <functional>
#include <map>
#include <string>
#include <cstring>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <set>
#include <list>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
#define rep(i,n) for(int (i)=0;(i)<(ll)(n);++(i))
#define repd(i,n,d) for(ll (i)=0;(i)<(ll)(n);(i)+=(d))
#define all(v) (v).begin(), (v).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset((m),(v),sizeof(m))
#define chmin(X,Y) ((X)>(Y)?X=(Y),true:false)
#define chmax(X,Y) ((X)<(Y)?X=(Y),true:false)
#define fst first
#define snd second
#define UNIQUE(x) (x).erase(unique(all(x)),(x).end())
template<class T> ostream &operator<<(ostream &os, const vector<T> &v){int n=v.size();rep(i,n)os<<v[i]<<(i==n-1?"":" ");return os;}

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


Measured memory_bytes: 256
N = int(input())
a_list = list(map(int, input().split(' ')))
max_count = 10 ** 9
for i in a_list:
    i, j = divmod(i, 2)
    count = 0
    while j == 0:
        count += 1
        i,j = divmod(i, 2)
    if max_count >= count:
        max_count = count
print(max_count)




Measured memory_bytes: 3060
import java.util.Arrays;
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];
        int[] b = new int[n];
        Pair[] pairs = new Pair[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
            Pair p = new Pair();
            p.from = a[i];
            p.end = b[i];
            pairs[i] = p;
        }

        Arrays.sort(pairs);


        long w = 0;
        for (int i = 0; i < n; i++) {
            w += (long) pairs[i].from;
        }

        if (w > pairs[pairs.length - 1].end) {
            System.out.println("No");
            return;
        }

        int z = 0;
        for (int i = 0 ; i < n ; i++) {
            z += (long) pairs[i].from;
            if (z > pairs[i].end) {
                System.out.println("No");
                return;
            }
        }

        System.out.println("Yes");

    }

}

class Pair implements Comparable {
    int from;
    int end;

    @Override
    public int compareTo(Object other) {
        Pair otherpair = (Pair) other;
        return end - otherpair.end;
    }
}

Measured memory_bytes: 109672
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
#define MP make_pair
#define endl '\n'
const int mod = 1e9 + 7;
const int MAXN = 3e5 + 5;
const int INF = 0x3f3f3f3f;

int main(int argc, char* argv[]) {
#ifdef local
    // freopen("in.txt", "r", stdin);
#endif
    LL a, b, k;
    cin >> a >> b >> k;
    LL tmp = min(a, k);
    a -= tmp, k -= tmp;
    b -= min(b, k);
    cout << a << " " << b << endl;
    return 0;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() {
	ios::sync_with_stdio(false); cin.tie(0);
	int n, ww;
	cin >> n >> ww;
	static long long dp[105][100001] = {};
	for (int i = 1; i <= n; i++) {
		int w, v;
		cin >> w >> v;
		for (int j = 0; j <= ww; j++) {
			if (j < w) dp[i][j] = dp[i - 1][j];
			else {
				dp[i][j] = max(dp[i - 1][j], dp[i - 1][j - w] + v);
			}
		}
	}
	cout << dp[n][ww] << endl;
	return 0;	
}

Measured memory_bytes: 79360
#include <bits/stdc++.h>
 
using namespace std;
 
int c[64][64];
 
void paint(int y, int x) {
  if (y < 0 || y >= 50 || x < 0 || x >= 50) return;
  if (c[y][x] == 0) return;
  c[y][x] = 0;
  for (int dy = -1; dy <= 1; ++dy) {
    for (int dx = -1; dx <= 1; ++dx) {
      paint(y + dy, x + dx);
    }
  }
}
 
int main() {
  int H, W;
  while (cin >> W >> H, H) {
    for (int i = 0; i < H; ++i) {
      for (int j = 0; j < W; ++j) {
        cin >> c[i][j];
      }
    }
    int res = 0;
    for (int y = 0; y < H; ++y) {
      for (int x = 0; x < W; ++x) {
        if (c[y][x] == 1) {
          ++res;
          paint(y, x);
        }
      }
    }
    cout << res << endl;
  }
  return 0;
}


Measured memory_bytes: 3184
N,K = map(int,input().split())
S = list(str(input()))
arr = [0,0]
D = [0,0]
cnt = 0
d = 0

for i in range(len(S)):
  a = int( S[i] )
  if a == 1:
    cnt += 1 + d
    if d > 0:
      D.append(d)
    d = 0
  elif a == 0 and d == 0:
    arr.append(cnt)
    d += 1
  else:
    d += 1
if a == 1:
  arr.append(cnt)
if a == 0:
  arr.append(cnt+d)
arr.sort()

ans = 0
for i in range(len(arr)-K-1):
  a = arr[i+K+1] - arr[i]
  b = D[i]
  ans = max(a-b,ans)
if len(arr) <= K:
  ans =  N
print(ans)

Measured memory_bytes: 49648
n,k=map(int,input().split())
hs=[int(input()) for _ in range(n)]
hs.sort()

psa=float('inf')
for i in range(n-k+1):
  sa=hs[k+i-1]-hs[i]
  if psa>sa:
    psa=sa

print(psa)

Measured memory_bytes: 7384
a,b,m = map(int,input().split())

a = list(map(int,input().split()))
b = list(map(int,input().split()))

mi = min(a) + min(b)

for i in range(m):
    x,y,c = map(int,input().split())
    v = a[x-1] + b[y-1] - c
    mi = min(mi,v)
print(mi)

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

int main() {

	int n, low; scanf("%d%d", &n, &low);
	int ans = low;
	for (int i = 0; i < n - 2; i++) {
		int b; scanf("%d", &b);
		ans += std::min(low, b);
		low = b;
	}

	ans += low;

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

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
    int n;
    cin >> n;
    vector<int>a(n);
    for(int i=0; i<n; i++){
        cin >> a[i];
    }
    long long ans=a[0];
    for(int i=1; i<n; i++){
        if(a[i]-a[i-1]>0){
            ans = ans + a[i] - a[i-1];
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3600
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
    int n[3];
    
    for(int i = 0; i < 3; i++) cin >> n[i];
    
    sort(n, n+3);
    
    for(int i = 0; i < 3; i++) {
        if(i == 2) {
            cout << n[i] << endl;
            break;
        }
        cout << n[i] << " ";
    }
}

Measured memory_bytes: 1180
/*  Source Code By : NIKHIL E S
    Handle : cldflm  */

#include<bits/stdc++.h>

using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);

    char ch;
    cin>>ch;

    if(isupper(ch))
        cout<<'A';
    else
        cout<<'a';

    return 0;
}


Measured memory_bytes: 3636
#include <stdio.h>

int main(void)
{
  int a,b,c;
  scanf("%d %d %d",&a,&b,&c);
  if(a<b){
    if(a<c&&c<b){
      printf("Yes\n");
    }
    else{
      printf("No\n");
    }
  }
  else{if(b<c&&c<a){
      printf("Yes\n");
    }
    else{
      printf("No\n");
    }
  }
}

Measured memory_bytes: 128
#include<bits/stdc++.h>
// #define int long long
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repa(i, s, n) for(int i = s; i < (int)n; i++)
using namespace std;
using ll = long long;
typedef vector<int> vi;


signed main() {
    ll n;
    cin >> n;
    ll ans = n - 1; /* max of ans */
    for(ll i = 2; i*i <= n; i++){
        if(n % i == 0){
            /* y = n / i */
            ans = min(ans, i + n / i - 2);
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3656
//#include <ext/pb_ds/assoc_container.hpp> 
 //#include <ext/pb_ds/tree_policy.hpp>
// #include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstring>
#include <vector>
#include <deque>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <iterator>
#include <functional>
#include <limits>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>
#include <unordered_map>
#include <unordered_set>
#include <stack>
using namespace std;
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define trace(x) cerr << #x << ": " << x << " " << endl;

typedef int64_t ll;
 
#define endl '\n'
#define int ll
ll mod=1e17;
ll mod1=1e9+5;
ll power(ll a,ll b)
{
    if(b==0) return 1;
    else if(b%2==0)
        return power(((((a)%mod)*((a)%mod))%mod),b/2)%mod;
    else return (((a)%mod)*(power(((((a)%mod)*((a)%mod))%mod),b/2)%mod))%mod;
}
inline ll inverse(ll a,ll md) {
  a %= md;
  if (a < 0) a += md;
  ll b = md, u = 0, v = 1;
  while (a) {
    ll t = b / a;
    b -= t * a; swap(a, b);
    u -= t * v; swap(u, v);
  }
  assert(b == 1);
  if (u < 0) u += md;
  return u;
}
  
  
 //using namespace __gnu_pbds;
 //#define ordered_set tree<pair<int,int>, null_type,less<pair<int,int>>, rb_tree_tag,tree_order_statistics_node_update>
//find_by_order(k)  returns iterator to kth element starting from 0;
//order_of_key(k) returns count of elements strictly smaller than k;
//erase,insert same as normal set
// mt19937 mrand(chrono::high_resolution_clock::now().time_since_epoch().count()); for randomized solution
const int ce=1e9+7;
ll fast_mod(ll input)
{
    return input < ce ? input : input%ce;
}
#define pi acos(-1)

int32_t main()
{
    IOS

    
    int x;
    cin>>x;
    for(int i=-1000;i<=1000;i++)
    {
        for(int j=-1000;j<=1000;j++)
        {
            if(i*i*i*i*i-j*j*j*j*j==x)
            {
                cout<<i<<" "<<j;
                return 0;
            }
        }
    }    
}       


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

#define LEN(x) (int)x.size()
#define ALL(x) x.begin(), x.end()

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;

const int MOD = 1000'000'007;
const double EPS = 0.000'000'001;

inline int fcmp(double x, double y)
{ return (x < y + EPS ? (x < y - EPS ? -1 : 0) : 1);}

const ll INF = MOD;
const int N = 105, V = 100005;
int n, ww;
ll dp[V], v[N], w[N];

int main()
{
	mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
	ios_base::sync_with_stdio(false);
	cout.precision(10);

	cin >> n >> ww;

	for(int i = 0; i < n; i++)
		cin >> w[i] >> v[i];

	for(int i = 0; i < V; i++)
		dp[i] = INF;

	dp[0] = 0;

	for(int i = 0; i < n; i++)
	{
		for(int j = V - v[i] - 1; j >= 0; j--)
			dp[j + v[i]] = min(dp[j] + w[i], dp[j + v[i]]);
	}

	int ans = 0;
	for(int i = 0; i < V; i++)
		if(dp[i] <= ww) ans = i;

	cout << ans << endl;

	return 0;
}


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

using namespace std;

#define INF 1000000007
#define LINF (1LL << 60)
#define PI 3.14159265358979

typedef long long i64;
typedef pair<i64,i64> P;

inline i64 mod(i64 a, i64 m) { return (a % m + m) % m; }

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }



i64 a,b,c;
void solve(){
	cin >> a >> b >> c;
	
	if(c-a-b < 0) cout << "No" << endl;
	else if(4*a*b < (c-a-b)*(c-a-b)){
		cout << "Yes" << endl;
	}
	else cout << "No" << endl;
}

int main(){
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	int t = 1;
	//cin >> t;
	while(t--){
		solve();
	}
	
	return 0;
}


Measured memory_bytes: 256
// 以下のソースを勉強する.
// zscoder氏.
// https://atcoder.jp/contests/dp/submissions/3941414
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const int MOD = int(1e9) + 7;
const int DIM = 52;

struct Matrix{
    int a[DIM][DIM];
    int *operator [] (int r) { return a[r]; };
    Matrix(int x = 0){
        memset(a, 0, sizeof a);
        if(x) for(int i = 0; i < DIM; i++) a[i][i] = x;
    }
}const I(1);

Matrix operator *(Matrix A, Matrix B){
    const LL mod2 = LL(MOD) * MOD;
    Matrix C;
    for(int i = 0; i < DIM; i++){
        for(int j = 0; j < DIM; j++){
            LL w = 0;
            for(int k = 0; k < DIM; k++){
                w += LL(A[i][k]) * B[k][j];
                if(w >= mod2) w -= mod2;
            }
            C[i][j] = w % MOD;
        }
    }
    return C;
}

Matrix operator ^(Matrix A, LL b){
    Matrix R = I;
    for(; b > 0; b /= 2){
        if(b % 2) R = R * A;
        A = A * A;
    }
    return R;
}

Matrix M;
int main(){
    
    // 1. 入力情報取得.
    int N;
    LL K;
    scanf("%d %lld", &N, &K);
    for(int i = 0; i < N; i++) for(int j = 0; j < N; j++) scanf("%d", &M[i][j]);
    
    // 2. dp更新.
    M = M ^ K;
    LL ans = 0;
    for(int i = 0; i < N; i++) for(int j = 0; j < N; j++) ans += M[i][j], ans %= MOD;
    ans %= MOD;
    if(ans < 0) ans += MOD;
    // for(int i = 0; i < N; i++){
    //     for(int j = 0; j < N; j++){
    //         printf("%lld ", M[i][j]);
    //     }
    //     printf("\n");
    // }
    
    // 3. 出力.
    printf("%lld\n", ans);
    return 0;
    
}

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

int main() {
    int a,b,c;
    vector<int> vec(3);
    cin>>vec.at(0)>>vec.at(1)>>vec.at(2);
    sort(vec.begin(), vec.end());
    cout<<vec.at(2)-vec.at(0)<<endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int MAX = 510000;
const int MOD = 1000000007;

ll fac[MAX], finv[MAX], inv[MAX];
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}
ll COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main(){
    COMinit();
   ll n,k,ans = 0;
   cin >> n >> k;
   for(int i=0;i<=min(n,k);i++) ans = (ans + (COM(n,i)*COM(n-1,i))%MOD)%MOD;
   cout << ans << endl;
}

Measured memory_bytes: 12160
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main() {
  int k, n;
  ll ans = 0;
  cin >> k >> n;
  vector<int> a(n);
  vector<int> b(n);
  for(int i = 0; i < n; i++) cin >> a.at(i);
  for(int i = 0; i < n-1; i++) {
    b.at(i) = a.at(i+1) - a.at(i);
  }
  b.at(n-1) = k-a.at(n-1) + a.at(0);
  sort(b.begin(), b.end());
  for(int i = 0; i < n-1; i++) ans += b.at(i);
  cout << ans << endl;
  return 0;
}

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

using namespace std;
#define lint long long
#define P pair<lint, int>

int main() {
    int N;
    cin >> N;
    
    int A[N], B[N];
    
    for(int i = 0; i < N; ++i){
        cin >> A[i] >> B[i];
    }
    
    vector<P> L;
    
    for(int i = 0; i < N; ++i){
        P a;
        a.first = A[i] + B[i];
        a.second = i;
        L.push_back(a);
    }
    
    sort(L.begin(), L.end(), greater<P>());
    lint sum = 0;
    
    for(int i = 0; i < N; ++i){
        if(i % 2 == 0){
            sum += A[L[i].second];
        } else {
            sum -= B[L[i].second];
        }
    }
    
    cout << sum << endl;
}


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

int main(){
  int n;
  int i;
  int card[4][13]={{}};
  cin >> n;
  char a;
  int b;
  for(i=0;i<n;i++) {
    cin >> a >> b;
    switch(a){
    case 'S':
      card[0][b-1]=1;
      break;
    case 'H':
      card[1][b-1]=1;
      break;
    case 'C':
      card[2][b-1]=1;
      break;
    case 'D':
      card[3][b-1]=1;
      break;
    }
  }
  for(i=0;i<52;i++) {
    switch(i/13){
    case 0:
      if(card[0][i%13]==0) cout << "S " << i+1 << endl;
      break;
    case 1:
      if(card[1][i%13]==0) cout << "H " << i%13+1 << endl;
      break;
    case 2:
      if(card[2][i%13]==0) cout << "C " << i%13+1 << endl;
      break;
    case 3:
      if(card[3][i%13]==0) cout << "D " << i%13+1 << endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 3092
import java.util.*;

class Main
{
    public static  void main(String[] args)
    {
        Scanner sc = new Scanner(System.in);
        
        int[] distance = new int[3];
        
        for (int i = 0; i < 3; i++) {
            distance[i] = sc.nextInt();
        }
        
        Arrays.sort(distance);
        
        System.out.println(distance[0] + distance[1]);
        
    }
}

Measured memory_bytes: 21844
#include <bits/stdc++.h>
#define fi first
#define se second
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define space putchar(' ')
#define enter putchar('\n')
#define MAXN 200005
#define eps 1e-10
//#define ivorysi
using namespace std;
typedef long long int64;
typedef unsigned int u32;
typedef double db;
template<class T>
void read(T &res) {
	res = 0;T f = 1;char c = getchar();
	while(c < '0' || c > '9') {
		if(c == '-') f = -1;
		c = getchar();
	}
	while(c >= '0' && c <= '9') {
		res = res * 10 + c - '0';
		c = getchar();
	}
	res *= f;
}
template<class T>
void out(T x) {
	if(x < 0) {x = -x;putchar('-');}
	if(x >= 10) {
		out(x / 10);
	}
	putchar('0' + x % 10);
}
char s[55];
int L;
void Solve() {
	scanf("%s",s + 1);
	L = strlen(s + 1);
	for(int i = 1 ; i <= L - 8 ; ++i) {
		putchar(s[i]);
	}
	enter;
}
int main() {
#ifdef ivorysi
	freopen("f1.in","r",stdin);
#endif
	Solve();
}


Measured memory_bytes: 256
import java.util.*;
public class Main {
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
        int z = a*b;
        if( z % 2 == 0){
		System.out.println("No");
        }else{
		System.out.println("Yes");
        }
	}
}

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

int main() {
  int x;
  int i = 1;
  while (1) {
    cin >> x;
    if (x == 0) { break; }
    cout << "Case " << i << ": " << x << endl;
    i++;
  }
  return 0;
}


Measured memory_bytes: 3084
a = [list(map(int, input().split())) for _ in range(3)]
n = int(input())
b = [int(input()) for _ in range(n)]

Size = 3
bingo = False
for row in a:
    if all(item in b for item in row):
        bingo = True
for col in zip(*a):
    if all(item in b for item in col):
        bingo = True
if all(a[i][i] in b for i in range(Size)):
    bingo = True
if all(a[i][Size - 1 - i] in b for i in range(Size)):
    bingo = True
 
print("Yes" if bingo else "No")

Measured memory_bytes: 3064
#include <iostream>
#include <algorithm>
#include <queue>
#include <map>
#include <cstring>
using namespace std;
const int INF = 1<<28;
int memo[110][110];
bool refr[110];
int G[110][110];
int n,m,l;

struct V{
  int id,fr;
  V(int id,int fr):id(id),fr(fr){}
};

bool operator < (const V& a,const V& b){
  return memo[a.id][a.fr] > memo[b.id][b.fr];
}

int dijkstra(int s,int t,int g){
  for(int i=0;i<n;++i)
    for(int j=0;j<=m;++j)
      memo[i][j] = INF;
  memo[s][t] = 0;
  priority_queue<V> Q;
  Q.push(V(s,t));
  while(Q.size()){
    V v = Q.top(); Q.pop();
    for(int i=0;i<n;++i){
      if(G[v.id][i]){
	int nxtid = i;
	int nxtfr = v.fr - G[v.id][i];
	if(nxtfr < 0) continue;
	int nxtcst = memo[v.id][v.fr]+G[v.id][i];
	if(memo[nxtid][nxtfr] <= nxtcst) continue;
	memo[nxtid][nxtfr] = nxtcst;
	Q.push(V(nxtid,nxtfr));
	if(refr[nxtid])
	  for(int j=nxtfr+1;j<=m;++j){
	    if(memo[nxtid][j]<=nxtcst+j-nxtfr) continue;
	    memo[nxtid][j] = nxtcst+j-nxtfr;
	    Q.push(V(nxtid,j));
	  }
      }
    }
  }

  int ret = INF;
  for(int i=0;i<=m;++i) ret = min(ret, memo[g][i]);
  return ret;
}

int main(){
  int k,a,h;
  while(cin>>n>>m>>l>>k>>a>>h,n||m||l||k||a||h){
    memset(refr,0,sizeof(refr));
    memset(G,0,sizeof(G));
    while(l--){
      int u;cin>>u;
      refr[u]=true;
    }
    while(k--){
      int u,v,t;
      cin >> u >> v >> t;
      G[u][v] = G[v][u] = t;
    }
    int ans = dijkstra(a,m,h);
    if(ans==INF) cout << "Help!" << endl;
    else cout << ans << endl;
  }
  
  return 0;
}

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

int main(){
    int n;
    while(cin >> n, n){
        vector<int> pos(n), height(n, 0);
        for(int i = 0; i < n; i++)  pos[i] = i;
        vector<list<int>> v;
        for(int i = 0; i < n; i++){
            list<int> x{i};
            v.push_back(x);
        }
        int a, b;
        while(cin >> a >> b, a+b != 0){
            a--, b--;
            if(a == b)  continue;
            if(pos[a]==pos[b] && height[a] > height[b]) continue;
            if(b == -1 && height[a] == 0)   continue;

            while(v[pos[a]].back() != a){
                int take = v[pos[a]].back();    v[pos[a]].pop_back();
                list<int> x{take};
                v.push_back(x);
                pos[take] = v.size()-1;
                height[take] = 0;
            }

            // take a
            v[pos[a]].pop_back();
            if(b != -1){
                v[pos[b]].push_back(a);
                pos[a] = pos[b];
                height[a] = v[pos[a]].size()-1;
            }else{
                list<int> x{a};
                v.push_back(x);
                pos[a] = v.size()-1;
                height[a] = 0;
            }
        }
        vector<int> ans;
        for(list<int> x : v)    if(!x.empty())  ans.push_back(x.size());
        sort(ans.begin(), ans.end());
        for(int x : ans)    cout << x << endl;
        cout << "end" << endl;
    }
    return 0;
}


Measured memory_bytes: 3176
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    s = str(readline().rstrip().decode('utf-8'))
    t = str(readline().rstrip().decode('utf-8'))
    lt = len(t)
    ans = []
    for i in range(len(s) - len(t), -1, -1):
        ts = s[i:i+lt]
        b = True
        for j in range(lt):
            if ts[j] != "?" and ts[j] != t[j]:
                b = False
                break
        if b:
            for j in range(len(s)):
                if i <= j < i + lt:
                    ans.append(t[j-i])
                else:
                    ans.append(s[j] if s[j] != "?" else "a")
            print("".join(ans))
            exit()
    print("UNRESTORABLE")


if __name__ == '__main__':
    solve()


Measured memory_bytes: 38384
#include<bits/stdc++.h>
using namespace std;
#define ll long long                                    // long long省略
#define pb push_back                                    // push_back省略
#define mp make_pair                                    // make_pair省略
#define fi first                                        // first省略
#define se second                                       // second省略
#define itn int                                         // int誤字保険
#define count cout                                      // cout誤字保険
#define vecotr vector                                   // vector誤字保険
#define ednl endl                                       // endl誤字保険
#define opt() cin.tie(0); ios::sync_with_stdio(false)   // 入出力速度改善

#define rep(i,l,r) for(ll i=(l);i<(r);i++)               // 範囲[l, r)で刻み1のfor文(順方向)
#define repp(i,l,r,k) for(ll i=(l);i<(r);i+=(k))         // 範囲[l, r)で刻みkのfor文(順方向)
#define rrep(i,l,r) for(ll i=(r-1);i>=(l);i--)           // 範囲[l, r)で刻み1のfor文(逆方向)
#define rrepp(i,l,r,k) for(ll i=(r-1);i>=(l);i-=(k))     // 範囲[l, r)で刻みkのfor文(逆方向)
#define all(x) (x).begin(), (x).end()                   // vectorのポインタ位置指定用
#define max(p,q)((p)>(q)?(p):(q))                       // max拡張
#define min(p,q)((p)<(q)?(p):(q))                       // min拡張
#define bit(n,m)(((n)>>(m))&1)                          // 変数nのm番目のbitを取り出す

template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int dy[]={0, 1, 0, -1};                                 // 4方向近傍
int dx[]={1, 0, -1, 0};                                 // 4方向近傍

int main(){
    ll a,b;cin>>a>>b;
    a--;b--;
    cout<<a*b<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string a;
  cin >> a;
  if(a.at(a.length()-1) != 's'){
    a += 's';
    cout << a << endl;
  } else {
    a += "es";
    cout << a << endl;
  }
}


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

typedef long LONG;

LONG memo[10][1001][101];

LONG z;

LONG comb(int *use, int n, int s, int m)
{
	int i;
	LONG c;

// printf("<%d %d %d>\n", n, s, m);
    
	if (memo[n][s][m] != -1){
		return (memo[n][s][m]);
	}
	
	if (n == 1){
    	if (0 <= s && s <= 100 && s >= m && use[s] == 0){
            z++;

//			printf("[");
//			for (i = 0; i <= 100; i++){
//				if (use[i])printf("%d ", i);
//			}
//			printf("%d]", s);

			memo[n][s][m] = 1;
			return (1);
		}
		memo[n][s][m] = 0;
		return (0);
	}
	
	c = 0;
	for (i = m; i <= 100; i++){
		if (use[i] == 0){
			use[i] = 1;
			if (s - i >= 0){
				c += comb(use, n - 1, s - i, i + 1);
			}
			use[i] = 0;
		}
	}
	
	memo[n][s][m] = c;
	return (c);
}

int main(void)
{
	int n, s;
	int use[101];
	int c;
	int i;
	
    
	while (1){
		scanf("%d%d", &n, &s);
		if (n == 0 && s == 0){
			break;
		}
		memset(use, 0, sizeof(use));
		memset(memo, -1, sizeof(memo));
        z = 0;
		
//
		z = comb(use, n, s, 0);
		printf("%ld\n", z);
	}
	
	return (0);
}

Measured memory_bytes: 8504
#include <set>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <functional>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vec;
typedef pair<int, int> P;
#define rep(n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define in(a) cin >> a;
#define out(a) cout << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
#define INF 100000000
int dy[] = { 1,0,-1,0 }, dx[] = { 0,1,0,-1 };



int main() {
	int dp[50005] = { 0 };
	for (int i = 0; i < 50005; i++) dp[i] = INF;
	int n, m, res = 0;
	cin >> n >> m;
	for (int i = 0; i < m; i++) {
		int num;
		cin >> num;
		dp[num] = 1;
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 0; j <= i; j++) {
			dp[i] = min(dp[i], dp[j] + dp[i - j]);
		}
	}
	cout << dp[n] << endl;
	return 0;
}



Measured memory_bytes: 3280
#[allow(unused_imports)]
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}
use std::io::*;
use std::string::*;

fn main() {
let x = 'x';
let two_hearts = '💕';


input! {
    H: i32,
    A: i32,
}
let ans = (H+A-1)/A;
println!("{}",ans);


}




Measured memory_bytes: 4352
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		new Main().run();
	}
	public void run(){
        Scanner scan = new Scanner(System.in);
        int[][] dx = {{0,1,2},{0,3,6},{0,4,8},{1,4,7},{3,4,5},{6,7,8},{2,4,6},{2,5,8}};
        int fl = 0;
        int t = 0;
        while(scan.hasNext()){
            String str = scan.nextLine();
            fl = 0;
            for(int i = 0;i < 8;i++){
                t = 0;
                for(int j = 0;j < 3;j++){
                	switch(str.charAt(dx[i][j])){
                		case 'o': t += 1; break;
                		case 'x': t += 9; break;
                		default: break;
                	}
                }
                if(t == 3){
                    fl = 1;
                    break;
                }else if(t == 27){
                    fl = 2;
                    break;
                }
            }
            System.out.println((fl == 0)?"d":(fl == 1)?"o":"x");
        }
    }
}

Measured memory_bytes: 17140
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ll N, K;
    cin >> N >> K;
    vector<int> A(N);
    vector<bool> seen(N+1);
    for (size_t i = 0; i < N; i++)
    {
        cin >> A[i];
        A[i]--;
    }
    int beforeLoop = 0;
    int now = 0;
    while(!seen[now])
    {
        seen[now] = true;
        now = A[now];
        beforeLoop++;
    } 
    int loopStart = now;
    int loopLength = 0;
    do
    {
        seen[now] = true;
        now = A[now];
        loopLength++;
    } while (loopLength <= N and now != loopStart);
    if(K<beforeLoop)
    {
        int ans = 0;
        for (int i = 0; i < K; i++)
        {
            ans = A[ans];
        }
        cout<<ans+1;
        return 0;
    }
    K -= beforeLoop;
    K %= loopLength;
    int pos = loopStart;

    
    for (int i = 0; i < K; i++)
    {
        pos = A[pos];
    }
    cout << pos + 1;
    return 0;
}

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

#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace __gnu_pbds;
using namespace std;
#define int long long
//for set
// typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;   
// for multiset
typedef tree<
pair<int, int>,
null_type,
less<pair<int, int>>,
rb_tree_tag,
tree_order_statistics_node_update> ordered_multiset;

#define ff first
#define ss second
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#define PI 3.1415926535897932384626433832795
int MOD=1e9+7;
int powmod(int a,int l, int md){int res=1;while(l){if(l&1)res=res*a%md;l/=2;a=a*a%md;}return res;}
int binpow(int a,int l){int res=1;while(l){if(l&1)res=res*a;l/=2;a=a*a;}return res;}
typedef long long ll; typedef vector<ll> vi; typedef pair<ll, ll> ii; typedef vector<ii> vii;
#define pb push_back
int __set(int b, int i) {return b|(1<<i);} //set ith bit
int __unset(int b, int i) {return b&(~(1UL<<i));}
int __check(int b, int i) {return b&(1<<i);} //returns 0 if ith bit is 0
int mulmod(int a, int b, int md) {return ((a%md)*(b%md))%md;}
int addmod(int a, int b, int md) {return (a+b)%md;}
int submod(int a, int b, int md) {return (((a-b)%md)+md)%md;}
int divmod(int a, int b, int md) {return mulmod(a, powmod(b, md-2, md), md);} //if md is prime;
const ll inf = 0xFFFFFFFFFFFFFFFL; //very large number
priority_queue<int, vector<int>, greater<int> > pq; //for min priority_queue
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
clock_t time_p=clock();
void time()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
int dp[100][100000];

int32_t main(void)
{
	IOS;
	string k; int d;
	cin>>k>>d;
	int n = k.length();
	vi a(n+1);
	for(int i = 0; i < n; i++)
		a[i+1]=k[i]-'0';
	for(int i = 0; i < 10; i++) {
		if(n==1 && i==0)
			continue;
		dp[(i%d)][1]++;
	}
	for(int i = 1; i < n; i++) {
		for(int j = 0; j < d; j++) {
			for(int k = 0; k < 10; k++) {
				dp[(j+k)%d][i+1]+=dp[j][i];
				dp[(j+k)%d][i+1]%=MOD;
			}
		}
	}
	int ans=0, rem=0;
	for(int i = 1; i <= n; i++) {
		if(i==n) {
			for(int j = 0; j <= a[i]; j++) {
				if((rem+j)%d==0)
					ans = (ans+1)%MOD;
			}
		}
		else {
			for(int j = 0; j < a[i]; j++) {
				ans += dp[((d-rem-j)%d+d)%d][n-i];
				ans %= MOD;
			}
		}
		rem += a[i];
		rem %= d;
	}
	ans = (ans-1+MOD)%MOD;
	cout<<((ans+MOD)%MOD)<<endl;
	time();
	return 0;
}

Measured memory_bytes: 76416
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#define rep(i,n) for(int i =0; i< n; i++)
#define N 309
using namespace std;
int ans,n,m,a[N][N],idx[N],done[N];
int main(){
	ios::sync_with_stdio(false);
	cin>>n>>m;
	ans = n;
	rep(i,n)
		rep(j,m)
			cin>>a[i][j],a[i][j]--;
	rep(i,m-1)
	{
		int mx = 0,stor=-1;
		int cnt[N] = {0};
		rep(j,n)
		{
			cnt[a[j][idx[j]]]++;
			if(stor==-1) stor = a[j][idx[j]];
			else cnt[a[j][idx[j]]]>cnt[stor]?stor=a[j][idx[j]]:1;
		}
		mx = cnt[stor];
		ans = min(ans, mx);
		done[stor]=1;
		rep(i,n) while(done[a[i][idx[i]]]) idx[i]++;
	}
	cout<<ans<<'\n';
	return 0;
}

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

#ifdef LOCAL
#include "../lib/dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

typedef long long ll;
typedef pair<int, int> P;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

template<typename I>
inline bool next_combination(const I first, I k, const I last)
{
  if ((first == last) || (first == k) || (last == k))
    return false;
  I it1 = first;
  I it2 = last;
  ++it1;
  if (last == it1)
    return false;
  it1 = last;
  --it1;
  it1 = k;
  --it2;
  while (first != it1) {
    if (*--it1 < *it2) {
      I j = k;
      while (!(*it1 < *j))
        ++j;
      std::iter_swap(it1, j);
      ++it1;
      ++j;
      it2 = k;
      std::rotate(it1, j, last);
      while (last != j) {
        ++j;
        ++it2;
      }
      std::rotate(k, it2, last);
      return true;
    }
  }
  std::rotate(first, k, last);
  return false;
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  // freopen("temp.1", "r", stdin);

  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  dumpv(a);
  vector<int> v(N);
  iota(v.begin(), v.end(), 0);
  int ans = 0;
  do {
    dumpv(v, 2);
    int diff = abs(a[v[0]] - a[v[1]]);
    ans = max(ans, diff);
  } while (next_combination(v.begin(), v.begin() + 2, v.end()));
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
#define ll          long long   
#define endl        "\n"
#define pb          push_back
#define PI          3.1415926535897932384626433832795l
#define F           first
#define S           second
#define mp          make_pair
#define f(i,n)      for(int i=0;i<n;i++)
#define fastio      ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define all(v)      (v).begin(),(v).end()
#define rall(v)     (v).rbegin(),(v).rend()
#define gcd(a,b)    __gcd((a),(b))

typedef pair<int,int> pii;
typedef vector<int> vi;
int main() 
{
    fastio;
    long double a;
    long double b;
    cin>>a>>b;
    long double p=(a*b);
    ll ans=(p);
    cout<<ans<<endl;
}


Measured memory_bytes: 3748
N = int(input())
XL = [list(map(int,input().split())) for _ in [0]*N]

LR = [[x-l,x+l] for x,l in XL]
LR.sort(key= lambda x:(x[1],x[0]))

r_max = -10**10
ans = 0
for l,r in LR:
    if l >= r_max:
        r_max = r
        ans += 1
print(ans)

Measured memory_bytes: 48916
import std.stdio;
import std.ascii;
import std.conv;
import std.string;
import std.algorithm;
import std.range;
import std.functional;
import std.math;
import core.bitop;
import std.numeric;

void main()
{
    auto ab = readln.split.to!(long[]);
    (ab[0] - ab[1] + 1).writeln;
}


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

class State {
public:
	double time;
	int now, next, speed;

	State(double _time, int _now, int _next, int _speed) :time(_time), now(_now), next(_next), speed(_speed) {}

	bool operator < (const State& obj) const
	{
		return time < obj.time;
	}

	bool operator > (const State& obj) const
	{
		return time > obj.time;
	}
};

class Edge {
public:
	int to, d, c;

	Edge(int _to, int _d, int _c) :to(_to), d(_d), c(_c) {}
};

const int dsp[3] = { -1,0,1 };
const int MAX = 31;
const int INF = 1 << 29;

int main()
{
	while (true) {
		int n, m;

		cin >> n >> m;

		if (n == 0 && m == 0) {
			break;
		}

		int s, g;

		cin >> s >> g;

		vector<vector<Edge>> path(n);
		double dp[MAX][MAX][MAX];
		bool visited[MAX][MAX][MAX];
		priority_queue<State, vector<State>, greater<State>> pq;
		
		rep(i, m) {
			int x, y, d, c;

			cin >> x >> y >> d >> c;

			path[x - 1].push_back(Edge(y - 1, d, c));
			path[y - 1].push_back(Edge(x - 1, d, c));
		}

		rep(i, MAX) {
			rep(j, MAX) {
				rep(k, MAX) {
					dp[i][j][k] = INF;
				}
			}
		}

		rep(i, MAX) {
			rep(j, MAX) {
				rep(k, MAX) {
					visited[i][j][k] = false;
				}
			}
		}

		pq.push(State(0, s - 1, s - 1, 0));
		dp[s - 1][s - 1][0] = 0;

		while (!pq.empty()) {
			State temp = pq.top();
			pq.pop();

			if (visited[temp.now][temp.next][temp.speed] == true) {
				continue;
			}
			else {
				visited[temp.now][temp.next][temp.speed] = true;
			}

			rep(i, path[temp.next].size()) {
				int next = path[temp.next][i].to;

				if (next == temp.now) {
					continue;
				}

				rep(j, 3) {
					int nsp = temp.speed + dsp[j];

					if (nsp > 0 && nsp <= 30 && nsp <= path[temp.next][i].c&&visited[temp.next][next][nsp] == false) {
						if (dp[temp.next][next][nsp] > temp.time + (double)path[temp.next][i].d / nsp) {
							dp[temp.next][next][nsp] = temp.time + (double)path[temp.next][i].d / nsp;
							pq.push(State(dp[temp.next][next][nsp], temp.next, next, nsp));
						}
					}
				}

			}

		}

		double ans = INF;

		rep(i, MAX) {
			ans = min(ans, dp[i][g - 1][1]);
		}

		if (ans == INF) {
			cout << "unreachable" << endl;
		}
		else {
			cout << ans << endl;
		}
	}

	return 0;
}

Measured memory_bytes: 3880
#include<stdio.h>
#include<bitset>
#include<list>
typedef std::list<std::bitset<5> >L;
typedef L::iterator I;
void V(L&l,int p,int q)
{
	l.insert(l.begin(),p,0);
	I i;
	for(i=l.begin();i!=l.end();++i)
		if((*i)[q])
			break;
	int k;
	for(k=0;k<p;++k)
		(*--i)[q]=1;
	for(k=0;k<p;++k)
	{
		if(i->count()==5)i=l.erase(i);
		else++i;
	}
}
void H(L&l,int p,int q)
{
	l.insert(l.begin(),1,0);
	I i;
	int k;
	for(i=l.begin();i!=l.end();++i)
		for(k=0;k<p;++k)
			if((*i)[k+q])
				goto E;
E:;
	for(--i,k=0;k<p;++k)
		(*i)[k+q]=1;
	if(i->count()==5)l.erase(i);
}
int main()
{
	int n,d,p,q;
	L l;
	while(scanf("%d",&n),n)
	{
		l.clear();
		while(n--)
		{
			scanf("%d%d%d",&d,&p,&q);
			if(d>1)V(l,p,q-1);
			else H(l,p,q-1);
	while(!l.empty()&&l.begin()->count()==0)l.pop_front();
		}
		int r=0;
		for(I i=l.begin();i!=l.end();++i)r+=i->count();
		printf("%d\n",r);
	}
	return 0;
}

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

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

  sum = 0;
    
  for(int i = 0; i < A; i++){
  int L, R;
  cin >> L >> R ;
  sum += ( R - L)  ;
  }
  cout << sum + A << endl;
}
 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<LL, LL> PII;

// chmax, chmin
template <class T>
inline bool chmax(T &a, T b)
{
  if (a < b)
  {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
  if (a > b)
  {
    a = b;
    return 1;
  }
  return 0;
}

template <typename T>
function<T(T, T)> op_max = [](T a, T b) -> T { return max(a, b); };
template <typename T>
function<T(T, T)> op_min = [](T a, T b) -> T { return min(a, b); };

template <typename T>
function<T(T, T)> op_sum = [](T a, T b) -> T { return a + b; };

using namespace std;
//********************  dumps ************************//

template <typename T>
void dump(const T &data, vector<int> &iter)
{
  cout << data << " ";
}
template <typename T>
void dump(const vector<T> &data, vector<int> &iter)
{
  for (auto elem : data)
    dump(elem, iter);
  cout << endl;
}

template <typename T>
void dump(const vector<vector<T>> &data, vector<int> &iter)
{
  for (auto elem : iter)
  {
    cout << "[" << elem << "]";
  }
  cout << endl;
  for (int i = 0; i < data.size(); i++)
  {
    iter.push_back(i);
    dump(data[i], iter);
    iter.pop_back();
  }
  cout << endl;
}

template <typename T>
void dump(const vector<T> &data, int dummy)
{
  for (int i = 0; i < data.size(); i++)
  {
    cout << "[" << i << "] " << data[i] << endl;
  }
}
template <typename T>
void dump(const T &data)
{ // T : data, U = base type val.
  vector<int> iter;
  dump(data, iter);
}
///////////////////////////////////////////////

void solve(long long a, long long b, long long c, long long d)
{
  LL ans = max(a * c, a * d);
  chmax(ans, max(b * d, b * c));
  cout << ans << endl;
}

int main()
{
  cout << setprecision(10);
  long long a;
  scanf("%lld", &a);
  long long b;
  scanf("%lld", &b);
  long long c;
  scanf("%lld", &c);
  long long d;
  scanf("%lld", &d);
  solve(a, b, c, d);
  return 0;
}


Measured memory_bytes: 3648