akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <map>
#include <queue> 
#include <stack>
#include <set>

using namespace std;
typedef long long ll;
#define rep(i, s, e) for (int(i) = (s); (i) <= (e); ++(i))
#define all(x) x.begin(),x.end()


int main()
{
	string s; cin >> s;
	int cnt = 0;
	char now = s[0];
	rep(i, 1, s.size() - 1)
	{
		if (s[i] != now)
		{
			++cnt;
			now = s[i];
		}
	}
	cout << cnt << endl;
}

Measured memory_bytes: 512
n,m = map(int,input().split())
s = []
for i in range(m):
  l = list(map(int,input().split()))[1:]
  s.append([t-1 for t in l])
#print(s)
#quit()
p = list(map(int,input().split()))
ans = 0  
for k in range(2**n):
  f = 1
  b = format(k, '010b')[::-1]
  for i in range(m):
    c = p[i]
    for j in s[i]:
      c += int(b[j])
    if c%2 == 1:
      f = 0
      break
  ans += f
      
print(ans)
  

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

int main(void)
{
    int k, c;
    scanf("%d%d", &k, &c);
    for(int i = c - k + 1; i <= c + k - 1; ++i)
    {
        if(i < -2000000)    continue;
        if(2000000 < i)     continue;
        printf("%d ", i);
    }
    return 0;
}


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


int main(){
  ll n; cin >> n;
  ll k; cin >> k;
  ll m;
  for(int i = 0; i < n; i++){
    int a; cin >> a;
    if(a == 1) m = i;
  }

  ll ans1 = (m + k - 2) / (k - 1) + (n - m + k - 3) / (k - 1);
  for(int i = 1; i < k-1; i++){
    ll ans2 = 1 + (m + k - 2 - i) / (k - 1) + (n - m + k - 3 - k + 1 + i) / (k - 1);
    if(ans2 < ans1){ans1 = ans2;}
  }
  

  cout << ans1 << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#include<iostream>
#include<cstdlib>
#include<cmath>
 
using namespace std;
 
int main() {
  string S;
  cin>>S;
  bool a=S.at(0)==S.at(1)&&S.at(0)==S.at(2);
  bool b=S.at(1)==S.at(2)&&S.at(1)==S.at(3);
  if(a||b)
    cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(void){
    double a , b , c , d , e ;
    scanf("%lf %lf %lf %lf" , &a , &b , &c , &d ) ;
    e = (a - c) * (a - c) + (b - d) * (b - d) ;
    e = sqrt(e) ;
    printf("%f\n" ,e) ;
    return 0 ;
}


Measured memory_bytes: 2112
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200002
#define LIMIT2 500002
typedef long long ll;
typedef long double ld;
typedef const void cv;
#define rep(i,n) for(i=0;i<n;i++)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll nPr(int n,int r){ll i,result=1;rep(i,r){result*=(ll)(n-i);}return result;}
ll nCr(int n,int r){ll i,result=1;if(n<r) return 0;rep(i,min(r,n-r)){result*=(ll)(n-i);result/=(ll)(i+1);}return result;}
#define fact(n) nPr((int)(n),(int)(n))
#define nHr(n,r) nCr((int)((n)+(r)+1),(int)(r))
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1};
int dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(const void *a, const void *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(const void *a, const void *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(const void* left, const void* right) {return strcmp((char *)left,(char *)right);}
int downchar(const void* left, const void* right) {return strcmp((char *)right,(char *)left);}
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}
void initialize(){
    
}
int main(void){
  initialize();
  ll n,m,i,j,k,result=0;
  int d[LIMIT2]={0};
  int a[1000][1000]={0};
  char s[LIMIT1];
  int tr[LIMIT1]={0};
  
  scanf("%lld %lld",&n,&k);
  rep(i,k){
    scanf("%d",&d[i]);
    rep(j,d[i]){
      scanf("%d",&a[i][j]);
      tr[a[i][j]] = 1;
    }
  }
  result=0;
  for(i=1;i<=n;i++){
    if(tr[i]==0) result++;
  }
  printf("%lld",result);
  return 0;
}



Measured memory_bytes: 8376
n=int(input())
p=list(input().split())
p=[int(i) for i in p]
cnt=0
for i in range(1,n-1):
    if p[i]!=max(p[i-1],p[i],p[i+1]) and p[i]!=min(p[i-1],p[i],p[i+1]):
        cnt+=1
print(cnt)


Measured memory_bytes: 3060
from bisect import bisect_left, bisect_right; from collections import Counter, defaultdict, deque, OrderedDict; from copy import deepcopy; from fractions import gcd; from functools import lru_cache, reduce; from math import ceil, floor; from sys import stdin, setrecursionlimit
import heapq as hq; import itertools as its; import operator as op


# globals
inf = float('inf')
input = stdin.readline


def main():
    n = get_int()
    ans = 0
    for i in range(1, n + 1):
        if len(str(i)) % 2 == 1:
            ans += 1
    print(ans)
    return


def get_int():
    return int(input())


def get_float():
    return float(input())


def get_str():
    return input().strip()


def get_li():
    return [int(i) for i in input().split()]


def get_lf():
    return [float(f) for f in input().split()]


def get_lc():
    return list(input().strip())


def gets(n, types, sep=None):
    if len(types) == 1:
        return [types[0](input().strip()) for _ in range(n)]
    return list(zip(*(
        [t(x) for t, x in zip(types, input().strip().split(sep=sep))]
        for _ in range(n)
    )))


if __name__ == '__main__':
    setrecursionlimit(4100000)
    main()


Measured memory_bytes: 65516
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <queue>
#include <set> 
#include <map>
#include <bitset>
#include <cctype>
#include <cmath>
using namespace std;
#define REP(i,n) for(int i=0; i<(n); ++i)
#define FOR(i, a, b) for(int i=(a); i<(b); ++i)
typedef long long ll;
const int INF = 100100100;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

int main () {
    
    string s; cin >> s;
    int k; cin >> k;

    vector<string> ss(26000);

    for (int i = 0; i < s.length(); i++) {
        ss[i*5] = s[i];
        for (int j = 1; j < 5; j++) {
            if(i+j < s.length()) {
                ss[(i*5)+j] = ss[(i*5)+j-1];
                ss[(i*5)+j].push_back(s[i+j]);
            } 
        }    
    }

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

    int ret = 0;

    set<string> res;
    string ans;
    int count = 0;
    while (res.size() < k) {
        ans = ss[count++];
        if(ans != "") {
            res.insert(ans);
        }
    }

    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 1664
# 基本形に追加するのを考える
# [1 2] [2 3] [1 3] の基本形にそれぞれ新しく1つずつ追加するとすると [1 2 4] [2 3 5] [1 3 6] [4 5 6]
# n=10だと
# [1 3 5 7] [1 2 6 8] [2 3 4 9 ] [4 5 6 10] [7 8 9 10]
# これに新しいのを加えるとするとすでにある5つを新規に導入するので 15
# [1 3 5 7 11] [1 2 6 8 12] [2 3 4 9 13] [4 5 6 10 14] [7 8 9 10 15] [11 12 13 14 15]
n = int(input())
if n == 1:  # これマジで理不尽
    print("Yes")
    print(2)
    print("1 1")
    print("1 1")
    exit()
anss = [[1, 2], [2, 3], [1, 3]]
target, length = 3, 3
while target <= n:
    if target == n:
        print("Yes")
        print(length)
        for ans in anss:
            b = " ".join(list(map(str, ans)))
            print(f"{len(ans)} {b}")
        exit()
    nex = list(range(target + 1, target + length + 1))
    for i, ans in enumerate(anss):
        ans.append(nex[i])
    anss.append(nex)
    target += length
    length += 1
print("No")

Measured memory_bytes: 14364
// AOJ 2142: Bitwise Kingdom
// 2017.11.11 bal4u@uu

#include <stdio.h>

long long c[62][62], s[62][62];

int bsch(int n, long long x)
{
	int m, l = 0, r = n+1;

    while (l < r) {
        m = (l + r) >> 1;
        if (s[n][m] < x) l = m + 1; else r = m;
    }
	return l-1;
}

int main()  
{  
	int n, i, j;
	long long m;

	for (c[0][0] = 1, i = 1; i <= 60; i++) {
		s[i][0] = c[i][0] = c[i][i] = 1;
		for (j = 1; j < i; j++) {
			c[i][j] = c[i-1][j-1] + c[i-1][j];
			s[i][j] = s[i][j-1] + c[i][j];
		}
		s[i][i] = s[i][i-1] + 1;
	}

	while (scanf("%d%lld", &n, &m) && n > 0) {
		j = bsch(n, m);
		m -= s[n][j++];
		for (i = 1; i <= n; i++) {
			if (j == 0 || c[n-i][j] >= m) putchar('0');
			else {
				putchar('1');
				m -= c[n-i][j--];
			}
		}
		putchar('\n');
	}
	return 0;
}

Measured memory_bytes: 1812
#include <iostream>
using namespace std;
int main(void){
    int a,b;
    cin>>a>>b;
    if(a==1)a=14;
    if(b==1)b=14;
    
    
    if(a>b){
        cout<<"Alice"<<endl;
    }
    else if(b>a){
        cout<<"Bob"<<endl;
    }
    else if(a==b){
        cout<<"Draw"<<endl;
    }
}


Measured memory_bytes: 256
/**Bismillahir Rahmanir Rahim  *///{
#include <bits/stdc++.h>
using namespace std;
using ll = long long; using ull = unsigned long long; using ld = long double;
const ll llinf = (1ll<<61)-1;
const double eps = 1e-6, ldeps = 1e-9;
#define im(a, b) if (a>=b) a -= b; else if (a<0) a += b;
struct Dbg {
static constexpr auto &os = cout;   // replace by cerr in interactive.
template<class C> static auto dud(C *x)->decltype(os << *x, 0);
template<class C> static char dud(...);
template<class C> typename enable_if<sizeof dud<C>(0)!=1, Dbg&>::type operator<<(const C &x) { os << x; return *this; }
template<class C> typename enable_if<sizeof dud<C>(0)==1, Dbg&>::type operator<<(const C &x) {
    *this << "\n[";
    for (auto &elem : x) *this << elem << ", ";
    return *this << "]";
}
template<class B, class C> Dbg &operator <<(const pair<B, C> &x) {
    return *this << "{" << x.first << ", " << x.second << "}";
}
Dbg &operator<<(ostream&(*x)(std::ostream&)) { os << x; return *this; }
} dbg;
void err(istringstream *iss) { delete iss; }
template<class C, class... Args> void err(istringstream *iss, const C &val, const Args &... args) {
    string name; *iss >> name; if (name.back()==',') name.pop_back();
    dbg << name << " = " << val << "; ", err(iss, args ...);
}
#define bug(args...) dbg << __LINE__ << ": ", err(new istringstream(string(#args)), args), dbg << endl
#define sl(a) int(strlen(a))
#define sz(a) int(a.size())
int n, m, K, T, Q, cn;//}
const int inf = 1000000007, mxn = 2005;

int a[mxn][mxn];

list<int> g[mxn*mxn+mxn];

int node(int x, int y) {
    if (x>y) swap(x, y);
    return x*n+y;
}

int dp[mxn*mxn+mxn], inStack[mxn*mxn+mxn];
bool cycle = 0;

void dfs(int u) {
    dp[u] = 0;
    inStack[u] = 1;
    for (auto &v : g[u]) {
        if (dp[v]==-1) dfs(v);
        else if (inStack[v]) cout << -1 << '\n', exit(0);
        dp[u] = max(dp[u], dp[v]);
    }
    inStack[u] = 0;
    dp[u]++;
}

int dfsAll(int mnNode, int mxNode) {
    memset(dp, -1, sizeof(dp));
    int mx = 0;
    for (int i = mnNode; i <= mxNode; i++) {
        if (dp[i]==-1) dfs(i);
        mx = max(mx, dp[i]);
    }
    return mx;
}

int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); cout.precision(10);
    cin >> n;
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= n-1; j++) {
            cin >> a[i][j];
            if (j>1) g[node(i, a[i][j])].push_back(node(i, a[i][j-1]));
        }
    }
    cout << dfsAll(1, node(n, n)) << '\n';
}

Measured memory_bytes: 123648
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N,M;
    cin >> N >> M;
    vector<int> V(N);
    rep(i,0,N)cin >> V[i];

    vector<ll> sum(N+1);
    map<ll, ll> mp;
    rep(i,0,N){
        sum[i+1] = (sum[i] + V[i]) % M; 
        mp[ sum[i+1] ]++;
    }
    mp[ sum[0] ]++;
    ll ans = 0;
    for(auto p:mp){
        ans += (p.second * (p.second - 1) ) / 2;
        //cout << p.first << " " << p.second << endl;
    }
    cout << ans << endl;
    

}

Measured memory_bytes: 5376
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

class Main {

    public static void main(String[] args) throws Exception {

        try {

            BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

            int currentRating = Integer.parseInt(br.readLine());
            int goalRating = Integer.parseInt(br.readLine());

            int targetRating = 0;
            if (currentRating <= goalRating || (goalRating - currentRating) != 0) {
                targetRating = (goalRating - currentRating) + goalRating;
            } else {
                targetRating = goalRating - currentRating;
            }

            System.out.println(targetRating);
        } catch (IOException | NumberFormatException e) {
            e.printStackTrace();
            System.exit(0);
        } catch (final Exception e) {
            e.printStackTrace();
            System.exit(0);
        }
    }
}

Measured memory_bytes: 21204
import java.util.Arrays;
import java.util.Scanner;

public class Main {
    static final Scanner sc  = new Scanner(System.in);
    static final int     MOD = (int) 1E9 + 7;
    
    public static void main(String[] args) {
        int N = nint();
        int K = nint();
        int[] h = nints(N);
        
        System.out.println(Arrays.stream(h).filter(i -> i >= K).count());
    }
    
    private static int nint() {
        return sc.nextInt();
    }

    private static int[] nints(int n) {
        return nints(n, 0, 0);
    }

    private static int[] nints(int n, int padL, int padR) {
        int[] a = new int[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nint();
        return a;
    }

    private static long nlong() {
        return sc.nextLong();
    }

    private static long[] nlongs(int n) {
        return nlongs(n, 0, 0);
    }

    private static long[] nlongs(int n, int padL, int padR) {
        long[] a = new long[padL + n + padR];
        for (int i = 0; i < n; i++)
            a[padL + i] = nlong();
        return a;
    }

    private static double ndouble() {
        return sc.nextDouble();
    }

    private static double[] ndoubles(int n) {
        return ndoubles(n, 0, 0);
    }

    private static double[] ndoubles(int n, int padL, int padR) {
        double[] d = new double[n + padL + padR];
        for (int i = 0; i < n; i++) {
            d[padL + i] = ndouble();
        }
        return d;
    }

    private static String nstr() {
        return sc.next();
    }

    private static char[] nchars() {
        return sc.next().toCharArray();
    }

    private static char[] nchars(int padL, int padR) {
        char[] temp = sc.next().toCharArray();
        char[] ret = new char[temp.length + padL + padR];
        System.arraycopy(temp, 0, ret, padL, temp.length);
        return ret;
    }

    private static char[][] nchars2(int h, int w) {
        return nchars2(h, w, 0, 0);
    }

    private static char[][] nchars2(int h, int w, int padLU, int padRD) {
        char[][] a2 = new char[h + padLU + padRD][w + padLU + padRD];
        for (int i = 0; i < h; i++)
            System.arraycopy(nchars(), 0, a2[padLU + i], padLU, w);
        return a2;
    }

    private static long min(long... ls) {
        return Arrays.stream(ls).min().getAsLong();
    }

    private static long max(long... ls) {
        return Arrays.stream(ls).max().getAsLong();
    }

    private static long abs(long a, long b) {
        return Math.abs(a - b);
    }
}


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

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

    int w[n], sum = 0;
    rep(i, n){
        cin >> w[i];
        sum += w[i];
    }

    int count = 0, ans = 0;
    int mi = 100;
    rep(i, n){
        ans += w[i];
        mi = min(mi, abs(sum - ans - ans));
    }
    cout << mi << endl;
    return 0;
}


Measured memory_bytes: 256
program main
  implicit none
  integer(8) :: N
  integer(8) :: A(5)
  integer(8) :: Amin
  integer(8) :: out
  integer :: mind(1)
  integer :: i
  
  read(*,*) N
  do i = 1,5
     read(*,*) A(i)
  end do
  Amin = minval( A )
  if ( Amin /=1 ) then
     out = N/Amin +5
  else if (Amin == 1 .and. N /= 1) then
     out = N/Amin -1 +5
  else 
     out = 5
  end if
  write(*,'(i0)') out
  stop
end program main


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std ;
int main()
{
     int a , b , c , k ;
     cin >> a ;
     if(a>= 400 && a < 600)
     {
          cout << 8 << endl ;
     }
     if(a >= 600 && a < 800)
     {
          cout << 7 << endl ;
     }
     if(a>= 800 && a < 1000)
     {
          cout << 6 << endl ;
     }
     if(a>= 1000 && a < 1200)
     {
          cout << 5 << endl ;
     }
     if(a>= 1200 && a < 1400)
     {
          cout << 4 << endl ;
     }
     if(a>= 1400 && a < 1600)
     {
          cout << 3 << endl ;
     }
     if(a>= 1600 && a < 1800)
     {
          cout << 2 << endl ;
     }
     if(a>= 1800 && a < 2000)
     {
          cout << 1 << endl ;
     }
}


Measured memory_bytes: 3632
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <stdlib.h>
#include <string.h>
#include <cstring>
#include <cmath>
#include <map>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <stdio.h>
#include <tuple>
#include <bitset>
#include <cfloat>
#include <fstream>
#include <limits.h>
#include <list>
#include <math.h>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <numeric>
#include <utility>
#include <sstream>

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

using namespace std;
#define int long long
#define ll long long
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define FORR(i,a,b)for(ll i=(a);i<=(b);i++)
#define repr(i,n) for(ll i=n;i>=0;i--)
#define P pair<ll, ll>
#define sz(x) (ll)x.size()
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
#define VE vector<ll>
#define COUT(x) cout<<(x)<<endl
#define MA map<ll,ll>
#define SE set<ll>
#define PQ priority_queue<ll>
#define PQR priority_queue<ll,VE,greater<ll>>
#define COUT(x) cout<<(x)<<endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define EPS (1e-10)


const long long MOD = 1000000007;
//const long long MOD = 998244353;
const long long INF = 1LL << 60;


long long modinv(long long a, long long m) {
	long long b = m, u = 1, v = 0;
	while (b) {
		long long t = a / b;
		a -= t * b; swap(a, b);
		u -= t * v; swap(u, v);
	}
	u %= m;
	if (u < 0) u += m;
	return u;
}
ll gcd(ll a, ll b) {
	if (a < b)swap(a, b);
	if (b == 0) return a;
	unsigned r;
	while ((r = a % b)) {
		a = b;
		b = r;
	}
	return b;
}
ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a * g / b;
}
bool prime(ll n) {
	for (ll i = 2; i <= sqrt(n); i++) {
		if (n%i == 0)return false;
	}
	return n != 1;
}




const long double PI = 3.14159265359;
const int MAX_N = 100010;



signed main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int a, b; cin >> a >> b;
	cout << max({ a + b,a - b,a*b }) << endl;
	return 0;
}

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

    using namespace std;
    int x[51], y[51];

    void BSort(int n)
    {
        int aux, ok = 0;
        while (!ok) {
            ok = 1;
            for (int i = 1; i < n; ++i)
            if (x[i] > x[i + 1]) {
                aux = x[i];
                x[i] = x[i + 1];
                x[i + 1] = aux;
                aux = y[i];
                y[i] = y[i + 1];
                y[i + 1] = aux;
                ok = 0;
            }
        }
    }

    int min_3(int a, int b, int c, int d)
    {
        return min(min(min(a, b), c), d);
    }

    int max_3(int a, int b, int c, int d)
    {
        return max(max(max(a, b), c), d);
    }

    int ind_x(int border, int i, int j, int o, int l)
    {
        if (border == x[i])
            return i;
        if (border == x[j])
            return j;
        if (border == x[o])
            return o;
        if (border == x[l])
            return l;
        return 0;
    }

    int ind_y(int border, int i, int j, int o, int l)
    {
        if (border == y[i])
            return i;
        if (border == y[j])
            return j;
        if (border == y[o])
            return o;
        if (border == y[l])
            return l;
        return 0;
    }

    int main()
    {
        int n, k, first, cell_cnt[51][51] = {0};
        long long small_area, area;

        cin >> n >> k;
        for (int i = 1; i <= n; ++i)
            cin >> x[i] >> y[i];
        BSort(n);

        for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= n; ++j) {
            for (int o = 1; o <= n; ++o)
                if (x[o] <= x[i] && y[o] <= y[j])
                    cell_cnt[i][j]++;
        }

        long long left_m, down_m, right_m, up_m;
        int left_i, down_i, right_i, up_i;
        first = 1;
        for (int i = 1; i <= n; ++i)
        for (int j = 1; j <= n; ++j)
        for (int o = 1; o <= n; ++o)
        for (int l = 1; l <= n; ++l) {
            left_m = min_3(x[i], x[j], x[o], x[l]);
            left_i = ind_x(left_m, i, j, o, l);

            down_m = min_3(y[i], y[j], y[o], y[l]);
            down_i = ind_y(down_m, i, j, o, l);

            right_m = max_3(x[i], x[j], x[o], x[l]);
            right_i = ind_x(right_m, i, j, o, l);

            up_m = max_3(y[i], y[j], y[o], y[l]);
            up_i = ind_y(up_m, i, j, o, l);

            if (cell_cnt[right_i][up_i] - cell_cnt[left_i - 1][up_i] - cell_cnt[right_i][down_i] + cell_cnt[left_i - 1][down_i] + 1 >= k) {
                area = (right_m - left_m) * (up_m - down_m);
                if (first) {
                    small_area = area;
                    first = 0;
                }
                else
                    small_area = min(small_area, area);
            }
        }
        cout << small_area;
        return 0;
    }


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

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <string>
#include <functional>
#include <math.h>
#include <map>
#include <queue>
#include <stack>

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n)   FOR(i,0,n)
#define RREP(i,n)   RFOR(i,0,n)
#define SORT(s) sort(s.begin(), s.end())
#define P pair<int, int>
#define mp make_pair

const double INF = 1e+09;
const int MOD = 1e9+7;

using namespace std;

template <typename _Ty>
ostream& operator << (ostream& ostr, const vector<_Ty>& v) {if (v.empty()) {ostr << "{ }"; return ostr;}
    ostr << "{" << v.front(); for (auto itr = ++v.begin(); itr != v.end(); itr++) {ostr << ", " << *itr;}
    ostr << "}";
    return ostr;}

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

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

int lcm(int a, int b)
{return a * b / gcd(a, b);}

vector<int> uniq(vector<int> vec){
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  return vec;}

vector<ll> divisor(ll n) {
vector<ll> ret;
for(int64_t i = 1; i * i <= n; i++) {
  if(n % i == 0) {
    ret.push_back(i);
    if(i * i != n) ret.push_back(n / i);
  }
}
  sort(begin(ret), end(ret));
  return (ret);
}
void permu(int n){
  vector<int> perm(n);
  REP(i, n) perm[i] = i;
do{
  cout << perm  << endl;
}
while (next_permutation(perm.begin(), perm.end()));
return;}

vector<pair<ll, int>> prime_div(ll n){
  vector<pair<ll, int>> res;
  for (ll i=2; i*i <= n;i++){
    if (n%i == 0){
      int a = 0;
      while(n%i == 0){
        n /= i;
        a++;
      }
      pair<ll, int> tmp;
      tmp.first = i;
      tmp.second = a;
      res.push_back(tmp);
    }
  }
  if (n != 1){
    pair<ll, int> now;
    now.first = n;
    now.second = 1;
    res.push_back(now);}
  return res;
}


// printf("%.10f\n" , ans);
int main(void){
  ios::sync_with_stdio(false);
  ll n, m;
  cin >> n >> m;
  map<ll, ll> mp;
  REP(i, n){
    ll a, b;
    cin >> a >> b;
    mp[a] += b;
  }
  ll ans = 0;
  for (auto v: mp){
    ll buy = min(m, v.second);
    ans += buy * v.first;
    m -= buy;
  }
  cout << ans << endl;
  return 0;
}



Measured memory_bytes: 6528
#include <bits/stdc++.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;

int main(){
    int n;
    string s[100];
    string temp;
    int t;
    int index[100];
    int p[100];

    cin >> n;
    for(int i=0; i<n; i++){
        cin >> s[i] >> p[i];
        index[i]=i+1;
    }
    for(int i=0; i<n; i++){
        for(int j=i+1; j<n; j++){
            if(s[i].compare(s[j])>0){
                temp = s[i];
                s[i] = s[j];
                s[j] = temp;
                t = p[i];
                p[i] = p[j];
                p[j] = t;
                t = index[i];
                index[i] = index[j];
                index[j] = t;
            }else if(s[i].compare(s[j])==0){
                if(p[i]<p[j]){
                    temp = s[i];
                s[i] = s[j];
                s[j] = temp;
                t = p[i];
                p[i] = p[j];
                p[j] = t;
                t = index[i];
                index[i] = index[j];
                index[j] = t;
                }
            }
        }
    }
    for(int i=0; i<n; i++){
        cout << index[i] << endl;
    }
    return 0;
}

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


int main() {
  string S;
  cin >> S;
  vector<int> vec(0);
  
  rep(i, S.size()-2) {
    vec.push_back((S[i]-'0')*100+(S[i+1]-'0')*10+(S[i+2]-'0'));
  }
  
  
  int ans = 754;
  for(int v : vec) {
    if(abs(v-753) < ans) ans = abs(v-753);
  }
  
  
  

  
  cout << ans << endl;
  
}

Measured memory_bytes: 256
#include <stdio.h>

int main() {
	int N, M, L[100000], R[100000], i, j, min = 100000, max = 0;
	scanf("%d %d", &N, &M);
	for (i = 0; i < M; i++) {
		scanf("%d %d", &L[i], &R[i]);
	}
	for (int i = 0; i < M; i++) {
		if (L[i] > max) {
			max = L[i];
		}
		if (R[i] < min) {
			min = R[i];
		}
	}
	printf("%d\n", (min - max + 1 > 0)?min - max + 1:0);
	return 0;
}

Measured memory_bytes: 896
//! 尺卂乃卂.卂ﾌ乇乇ㄒ
#include<bits/stdc++.h>
//#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
//Using namespace __gnu_pbds;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> Ordered_set;

#define ll              long long
#define int             long long
#define ld             long double
#define pb              push_back
#define pii             pair<int,int>
#define vi              vector<int>
#define vii             vector<vi>
#define vip            vector<pii>
#define mii             map<int,int>
#define mip             map<pair<int,int>,int>
#define mic             map<char,int> 
#define all(v)          v.begin(),v.end()  
#define pqb             priority_queue<int>
#define pqs             priority_queue<int,vi,greater<int> >
#define setbits(x)      __builtin_popcountll(x)
#define zrobits(x)      __builtin_ctzll(x)
#define lb(x)           (x&(-x))
#define mod             1000000007
#define inf             1e18
#define ps(x,y)         fixed<<setprecision(y)<<x
#define w(x)            int x; cin>>x; while(x--)
#define itr(it,v)          for(auto it:v)
#define show(arr,n)     for(int i=0;i<n;i++) cout<<arr[i]<<" "; cout<<"\n";
#define fi(i,n)         for(int i=0;i<n;i++)
#define fir(i,k,n)       for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ff               first 
#define ss               second
#define deb(x) cout << #x << "=" << x << endl
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define check(x) (x && cout<<"Yes\n")||(cout<<"No\n");
#define fin(s)          freopen(s,"r",stdin);  
#define fout(s)         freopen(s,"w",stdout);

const ld pi = 3.141592653589793238462643383279502884;
const int xd[]={-1,0,1,0};
const int yd[]={0,-1,0,1};
int XX[] = { -1, -1, -1, 0, 0, 1, 1, 1 };
int YY[] = { -1, 0,  1, -1, 1, -1, 0, 1 };

int expo(int a,int b,int m);
int mmi(int a,int m);
void ipgraph(int m);

const int N=5*(1e5)+10;
vii adj(N);
int a[N];

void  solve(){

}
int dp[3001][3001];
int func(int i,int j,int n){
    int ele=n-(j-i+1);
    if(i==j) {
        if(ele & 1) return 0;
        else return a[i];
    }
    if(dp[i][j]!=-1) return dp[i][j];
    int ans;
    if(ele & 1){
        ans=(min(func(i+1,j,n),func(i,j-1,n)));
    }
    else{
        ans=max(a[i]+func(i+1,j,n),a[j]+func(i,j-1,n));
    }
    return dp[i][j]=ans;
}
int32_t main()
{
    FIO
    int n; cin>>n;
    int s=0;
    fi(i,n) {
        cin>>a[i];
        s+=a[i];
    }
    fi(i,n+1) fi(j,n+1) dp[i][j]=-1;
    cout<<2*func(0,n-1,n)-s<<"\n";
    return 0;

}

void ipgraph(int m){
    int i, u, v;
    while(m--){
          cin>>u>>v;
         u--, v--;
    adj[u].pb(v);
    adj[v].pb(u);
    }
}
int expo(int a,int b,int m){
    if(b==0) return 1;
    if(b==1) return a;
    int val=(expo(a,b/2,m)*expo(a,b/2,m))%m;
    if(b & 1) return (val*a)%m;
    else return val;
}
int mmi(int a,int m){
    return expo(a,m-2,m);
}

Measured memory_bytes: 83840
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>

#define INF 2e9

#define REP(i,n) for(int i = 0; i < n;++i)
#define REPA(i,a,n) for(int i = a; i < n; ++i)
#define ALL(a) a.begin(), a.end()

using namespace std;

int main(void) {

	int N, sum = 1;
	string S;

	cin >> N >> S;

	char c = S[0];

	REPA(i, 1, N){
		if(c != S[i]){
			sum++;
		}
		c = S[i];
	}

	cout << sum << endl;

	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
using namespace std;
int main() {
	char s[6] = { 'A','B','C','D','E','F' };
	int big[6] = { 60,80,100,120,140,160 };
	int h[6] = { 2,5,10,15,20,25 };
	int m[6] = { 600,800,1000,1200,1400,1600 };
	int n;
	while (cin >> n&&n != 0) {
		int sum = 0;
		for (int z = 0; z < n; z++) {
			int k, l, o, p,q=-1,r=-1;
			cin >> k >> l >> o >> p;
			k += (l + o);
			for (int i = 0; i < 6; i++) {
				if (k <= big[i]) {
					q = m[i];
					break;
				}
			}
			for (int i = 0; i < 6; i++) {
				if (p <= h[i]) {
					r = m[i];
					break;
				}
			}
			if (q != -1 && r != -1) {
				sum += max(q, r);
			}
		}
		cout << sum << endl;
	}
}

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    int a, b, c, d;
    a = N / 1000;
    b = (N - a * 1000 ) / 100;
    c = (N - a * 1000 - b * 100) / 10;
    d = (N - a * 1000 - b * 100 - c * 10);
    if(a == b && b == c){
        cout << "Yes" << endl;
    }else if(b == c && c == d){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }

}

Measured memory_bytes: 3624
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
typedef pair<int, int> P;
typedef unsigned int ui;
int main(){
	int n, t, a; int i;
	cin >> n >> t;
	int x[100000]; int mi[100000]; int ma[100000] = {};
	for (i = 0; i < n; i++) {
		cin >> a; x[i] = a;
	}
	mi[0] = x[0]; ma[n - 1] = x[n - 1];
	for (i = 1; i < n; i++) {
		mi[i] = min(mi[i - 1], x[i]);
		ma[n - 1 - i] = max(ma[n - i], x[n - 1 - i]);
	}
	int cma = 0; int memo; int count;
	for (i = 0; i < n; i++) {
		if (cma < ma[i] - mi[i]) {
			cma = ma[i] - mi[i];
			memo = mi[i];
			count = 1;
		}
		else if (cma == ma[i] - mi[i] && mi[i] < memo) {
			memo = mi[i]; count++;
		}
	}
	cout << count << endl;
	return 0;
}

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

struct Point{double x,y;};

void koch(int n,Point a,Point b){
  if(n==0) return;

  Point s,t,u;
  double th = M_PI * 60.0 / 180.0;

  s.x = (2.0*a.x + 1.0*b.x) / 3.0;
  s.y = (2.0*a.y + 1.0*b.y) / 3.0;
  t.x = (1.0*a.x + 2.0*b.x) / 3.0;
  t.y = (1.0*a.y + 2.0*b.y) / 3.0;
  u.x = (t.x-s.x) * cos(th) - (t.y-s.y) * sin(th) + s.x;
  u.y = (t.x-s.x) * sin(th) + (t.y-s.y) * cos(th) + s.y;

  koch(n-1,a,s);
  printf("%.8f %.8f\n",s.x,s.y);
  koch(n-1,s,u);
  printf("%.8f %.8f\n",u.x,u.y);
  koch(n-1,u,t);
  printf("%.8f %.8f\n",t.x,t.y);
  koch(n-1,t,b);
}

int main(){
  Point a,b;
  int n;

  scanf("%d", &n);

  a.x = 0;
  a.y = 0;
  b.x = 100;
  b.y = 0;

  printf("%.8f %.8f\n",a.x,a.y);
  koch(n,a,b);
  printf("%.8f %.8f\n",b.x,b.y);
  return 0;
}



Measured memory_bytes: 3196
//
//  main.cpp
//  Reversi
//
//  Created by Mihozil on 3/24/19.
//  Copyright © 2019 Mihozil. All rights reserved.
//

#include <iostream>
#define maxD 1000000007
using namespace std;
long n;
long pre[200005],a[200005],c[200005],cPre[200005];
long long result;
void solve() {
    c[0] = 1;
    c[1] = 1;
    cPre[a[1]] = 1;
    for (int i=2;i<=n;i++) {
        if (pre[i]!=0 && pre[i]<i-1) {
            c[i] = (cPre[a[i]] + c[i-1])%maxD;
            cPre[a[i]] = (cPre[a[i]] + c[i-1])%maxD;
        } else {
            c[i] = c[i-1];
            cPre[a[i]] = c[i-1];
        }
    }
    cout<<c[n];
}

void read() {
//        freopen("/Users/mihozil/Desktop/CodeJam/input.in", "r", stdin);
//        freopen("/Users/mihozil/Desktop/CodeJam/output.txt", "w", stdout);
    
    cin>>n;
    long pos[200005];
    for (int i=1; i<=200000; i++) {
        pos[i] = 0;
        cPre[i] = 0;
    }
    
    
    for (int i=1; i<=n; i++) {
        long no;
        cin>>no;
        a[i] = no;
        pre[i] = pos[no];
        pos[no] = i;
    }
    
    solve();
}


int main(int argc, const char * argv[]) {
    // insert code here...
    read();
    return 0;
}


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

int main() {
	int a;
	while (cin >> a, a) {
		int b = 0, c = 0;
		for (int d = 0; d < a; d++) {
			int e, f;
			cin >> e >> f;
			if (e < f)c += e+f;
			else if (e > f)b += e+f;
			else { b += e; c += f; }
		}
		cout << b << " " << c << endl;
	}
}

Measured memory_bytes: 3076
/* Author : Aaryan Srivastava ^__^ */ 
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second   
#define rep(i,n) for(int i = 0 ; i < (n) ; i++)
#define repA(i,x,y) for(int i = (x) ; i <= (y) ; i++)
#define repD(i,x,y) for(int i = (x) ; i >= (y) ; i--)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define setval(a,val) memset(a,val,sizeof(a))
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define trav(x , a) for(auto &x : a)
#define sz(a) ((int)a.size())
typedef long long ll ; 

#define int ll

using namespace std;

const int N = 3e5 +5 ;
const int mod = 1e9 + 7 ;
const ll inf = 1e18 ;
const int SZ = 101 ;
const double eps = 1e-9 ;
using namespace __gnu_pbds;
using ordered_set =  tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ;

typedef pair<int, int> pii; 
typedef pair<int , pii> ipii ;
typedef pair<pii , int> piii ; 
typedef unsigned long long ull ;
typedef long double ld;

ll po(ll x,ll y,ll p = mod) {ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}

ld p[6] , q[6];

ld get(ld x){
    ld res = 0;
    rep(i , 6)
        res += max(x * p[i] , (1 - x) * q[i]);
    // cout << res << '\n' ;
    return res;
}

void solve()
{
    rep(i , 6){
        cin >> p[i];
        p[i] /= 100. ;
        // cout << p[i] << ' ' ;
    }

    // cout << '\n';
    rep(i , 6){
        cin >> q[i];
        q[i] /= 100. ;

        // cout << q[i] << ' ' ;
    }
    // cout << '\n';
    
    cout << fixed << setprecision(10);
    ld l = 0 , r = 1; 
    rep(_ , 200){
        ld l1 = l + (r - l) / 3 ;
        ld l2 = r - (r - l) / 3 ;
        if(get(l1) >= get(l2)) l = l1;
        else r = l2 ;
    }
    cout << get(l) ;
}   

     
int32_t main(int32_t argc, char *argv[])
{
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    int TC = 1, t = 0;
    //cin >> TC ;
    while(t++ < TC)
    {
        //cout << "Case #" << t << ": " ;
        solve();
        cout << "\n" ;
    }
    return 0;
}

Measured memory_bytes: 3812
#include<bits/stdc++.h>
using namespace std;
 
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int x, t;
cin >> x >> t;
(x-t < 0) ? cout << 0 << "\n" : cout << x-t << "\n";
return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <queue>
#include <iostream>
#include <bits/stdc++.h>
#include<stdio.h>
#include<string.h>
#include<fstream>

#define F first
#define S second
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
using namespace std;

int main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);
       
    ll i,j,k,p=1,q=1;
    ll n,m,tmp;
    string s[200000];
    string str;
    
    ll sum=0;
    ll strr[200005];
    cin>>str;
    if(str.compare("SUN")==0) cout<<7<<endl;
    if(str.compare("MON")==0) cout<<6<<endl;
    if(str.compare("TUE")==0) cout<<5<<endl;
    if(str.compare("WED")==0) cout<<4<<endl;
    if(str.compare("THU")==0) cout<<3<<endl;
    if(str.compare("FRI")==0) cout<<2<<endl;
    if(str.compare("SAT")==0) cout<<1<<endl;

    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <vector>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
#include <climits>
#include <complex>
#include <numeric>
#include <list>
using namespace std;

#define REP(i,n) for(int i=0; i<(int)(n); i++)
#define RREP(i,n) for(int i=(int)n-1; i>=0; i--)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define RFOR(i,c) for(__typeof((c).rbegin())i=(c).rbegin();i!=(c).rend();++i)
#define ALL(c) (c).begin(), (c).end()

typedef vector<int> vi;
typedef long long int ll;
typedef pair<int, int> pii;
typedef pair<ll, pair<int, int> > pipii;
const ll MOD = 1e9+7;

struct UnionFind {
  vector<int> data;
  UnionFind(int size) : data(size, -1) { }
  bool unionSet(int x, int y) {
    x = root(x); y = root(y);
    if (x != y) {
      if (data[y] < data[x]) swap(x, y);
      data[x] += data[y]; data[y] = x;
    }
    return x != y;
  }
  bool findSet(int x, int y) {
    return root(x) == root(y);
  }
  int root(int x) {
    return data[x] < 0 ? x : data[x] = root(data[x]);
  }
  int size(int x) {
    return -data[root(x)];
  }
};

int main(void) {
	int n, m;
	cin >> n >> m;
	ll x;
	cin >> x; 

	vector<pipii> edge(m), sedge(m);
	REP(i, m){
		int x, y; ll cost;
		cin >> x >> y >> cost;
		x--; y--;
		edge[i] = pipii(cost, pii(x, y));
		sedge[i] = pipii(cost, pii(x, y));
	}
	sort(ALL(sedge));
	vector<pipii> nonUsed;
	UnionFind muf(n);
	ll totalCost = 0L;
	FOR(e, sedge) {
		int x = (*e).second.first, y = (*e).second.second;
		ll cost = (*e).first;
		if(!muf.findSet(x, y)) {
			muf.unionSet(x, y);
			totalCost += cost;
		} else {
			nonUsed.push_back(*e);
		}
	}
	
	ll ans = 0;
	
	if(muf.size(0) == n && totalCost == x) {
		ll res = 1;
		REP(j, nonUsed.size()) res = (res * 2) % MOD;
		ans = 1;
		REP(j, n - 1) ans = (ans * 2) % MOD;
		ans = (((ans - 2 + MOD) % MOD) * res) % MOD;	
	}
	int equal = 0, large = 0;	
	REP(i, nonUsed.size()) {
		int ix = nonUsed[i].second.first, iy = nonUsed[i].second.second;
		//cout << endl << "i ix iy : " << i << " " << ix << " " << iy << endl;
		ll icost = nonUsed[i].first;
		ll totalCost = icost;
		UnionFind uf(n);
		uf.unionSet(ix, iy);
		int ii = 0;
		FOR(e, sedge) {
			int x = (*e).second.first, y = (*e).second.second;
			ll cost = (*e).first;
			if(!uf.findSet(x, y)) {
				uf.unionSet(x, y);
				totalCost += cost;
			}
		}

		//cout << "uf.size " << uf.size(ix) << endl;

		if(uf.size(ix) == n && totalCost == x) {
			equal++;
		} else if(uf.size(ix) == n && totalCost > x) {
			large++;
		}
		//cout << endl;
	}
	ll res = 1;
	REP(i, equal) res = (res * 2) % MOD;
	ll res2 = 1;
	REP(i, large) res2 = (res2 * 2) % MOD;
	res = ((((2 * (res - 1 + MOD) % MOD)) % MOD) * res2) % MOD;
	ans = (ans + res) % MOD;
	cout << (ans % MOD) << endl;
}


Measured memory_bytes: 384
using System;
using System.Linq;
class Program{
	static void Main(){
		long[] s=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
		long[] a=Array.ConvertAll(Console.ReadLine().Split(),long.Parse);
		if(s[0]/2+(s[0]%2)<a.Max()){Console.WriteLine((a.Max()-(s[0]/2+(s[0]%2)))*2-(1-s[0]%2));}
		else{Console.WriteLine(0);}
	}
}

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

using namespace std;
#define _rep(n, a, b) for (int n = (a); n <= (b); ++n)
#define _rev(n, a, b) for (int n = (a); n >= (b); --n)
#define _for(n, a, b) for (int n = (a); n < (b); ++n)
#define _rof(n, a, b) for (int n = (a); n > (b); --n)
#define oo 0x3f3f3f3f3f3f
#define ll long long
#define db double
#define eps 1e-3
#define bin(x) cout << bitset<10>(x) << endl;
#define what_is(x) cerr << #x << " is " << x << endl
#define met(a, b) memset(a, b, sizeof(a))
#define all(x) x.begin(), x.end()
#define pii pair<int, int>
#define pdd pair<db, db>
#define endl "\n"
const int mod = 1e9 + 7;
const int maxn = 2000+10;
vector<int> a, sub;
signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int x;
    cin >> x;
    map<string, int> cc;
    _rep(i, 1, x){
        string s;
        cin >> s;
        cc[s]++;
    }
    cout << "AC x "<< cc["AC"] << endl;
    cout << "WA x "<< cc["WA"] << endl;
    cout << "TLE x "<< cc["TLE"] << endl;
    cout << "RE x "<< cc["RE"] << endl;
}

Measured memory_bytes: 3668
#include <iostream>
using namespace std;
const int aa=100001;
int main(){

    int N,Q,B,C,A;
    cin>>N;
    int ct[aa];
    for(int i=0;i<aa;i++){
        ct[i]=0;
    }
    long long int total=0;
    for(int i=0;i<N;i++){
        cin>>A;
        total+=A;
        ct[A]++;
    }
    cin >>Q;
    for(int i=0;i<Q ;i++){
        cin>>B>>C;
        int temp=C-B;
        total+=temp*ct[B];
        cout<<total<<endl;
        ct[C]+=ct[B];
        ct[B]=0;
    }
}


Measured memory_bytes: 3544
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using Graph = vector<vector<int>>;
#define int ll
#define double long double
#define YES cout<<"YES"<<'\n'
#define NO cout<<"NO"<<'\n'
#define Yes cout<<"Yes"<<'\n'
#define No cout<<"No"<<'\n'
#define yes cout<<"yes"<<'\n'
#define no cout<<"no"<<'\n'
void YN(bool flg) {cout<<(flg?"YES":"NO")<<'\n';}
void Yn(bool flg) {cout<<(flg?"Yes":"No")<<'\n';}
void yn(bool flg) {cout<<(flg?"yes":"no")<<'\n';}
#define SORT(a) sort(a.begin(),a.end())
#define REVERSE(a) reverse(a.begin(),a.end())
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define out(n) cout << n << '\n'
typedef vector<int> VI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<VI> VVI;
const int MOD = 1000000007;
const long long INF = 10e10;
const double PI = acos(-1.0);
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<class T>auto MAX(const T& a) { return *max_element(a.begin(),a.end()); }
template<class T>auto MIN(const T& a) { return *min_element(a.begin(),a.end()); }
template<class T, class U>U SUM(const T& a, const U& v) { return accumulate(a.begin(),a.end(), v); }
template<class T, class U>U COUNT(const T& a, const U& v) { return count(a.begin(),a.end(), v); }
template<class T, class U>int LOWER(const T& a, const U& v) { return lower_bound(a.begin(),a.end(), v) - a.begin(); }
template<class T, class U>int UPPER(const T& a, const U& v) { return upper_bound(a.begin(),a.end(), v) - a.begin(); }
int GCD(int a, int b) { return b ? GCD(b, a%b) : a; }
int LCM(int a, int b) { int g = GCD(a, b); return a / g * b; }
int POW(int a, int n) { int r = 1; while (n > 0) { if (n & 1)r *= a; a *= a; n >>= 1; }return r; }
int isPrime(int n){if(n<2){return 0;}for(int i=2; i*i<=n; i++){if(n%i==0){return 0;}}return 1;}
/*素因数分解*/map< int, int >prime_factor(int n){map< int, int > ret;for(int i = 2; i * i <= n; i++) {while(n % i == 0) {ret[i]++;n /= i;}}if(n != 1) ret[n] = 1;return ret;}
/*約数列挙*/vector<int> divisor(int n){vector<int> v; for(int i=1; i*i<=n; i++){if(n%i==0){v.push_back(i);if(i!=n/i){v.push_back(n/i);}}}sort(v.begin(),v.end()); return v;}
//----------------ライブラリとか----------------

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(15);

    int a,b,k; cin >> a >> b >> k;
    if(a>=k){cout << a-k << ' ' << b << endl;}
    else if(a+b>=k){cout << 0 << ' ' << a+b-k << endl;}
    else {cout << 0 << ' ' << 0 << endl;}

    return 0;
}

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

int L[100000];
int A[100000];
int n;

int LIS() {
    L[0] = A[0];
    int len = 1;
    for (int i = 1; i < n; i++){
        if(L[len-1] < A[i]){
            L[len++] = A[i];
        } else {
            *lower_bound(L, L+len, A[i]) = A[i];
        }
    }
    return len;
}

int main() {
    cin >> n;
    rep(i, n){
        cin >> A[i];
    }

    cout << LIS() << endl;

    return 0;
}


Measured memory_bytes: 3760
#include <bits/stdc++.h>
#include <math.h>
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rrep(i, n) for(int i = (n-1); i >= 0; i--)
using namespace std;
typedef long long ll;
const int MOD = 1000000007;
const ll INF = 1LL<<60;
const int IINF = 1000000000;
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; }

int main(){

    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int a, b; cin >> a >> b;

    if(a+b == 15){
        cout << "+" << endl;
    }
    else if(a*b == 15){
        cout << "*" << endl;
    }
    else{
        cout << "x" << endl;
    }


}

Measured memory_bytes: 3628