akhauriyash/Code-Regression huggingface dataset:
#ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
typedef long long ll;

int main(){
    fastio
    string s ; 
    cin >> s ; 
    int k ; 
    cin >> k ; 
    int n = (int) s.size() ; 
    set<string> ss ; 
    for(int i=0;i<n;i++){
    	ss.insert(s.substr(i,1));
    }
    for(int i=0;i+1<n;i++){
    	ss.insert(s.substr(i,2));
    }
    for(int i=0;i+2<n;i++){
    	ss.insert(s.substr(i,3));
    }
    for(int i=0;i+3<n;i++){
    	ss.insert(s.substr(i,4));
    }
    for(int i=0;i+4<n;i++){
    	ss.insert(s.substr(i,5));
    }
    vector<string> v(ss.begin(),ss.end()) ; 
    cout << v[k-1] << endl;
    debug() << imie(ss) ; 
    return 0 ;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner scan = new Scanner(System.in);
		int i = 0;
		while (true) {

			i = i + 1;
			int x = scan.nextInt();
			if (x == 0) {
				break;
			} else {
				System.out.println("Case " + i + ": " + x);
			}
		}
	}

}

Measured memory_bytes: 41236
#include <iostream>

using namespace std;

int main() {
    int X, Y;
    cin >> X >> Y;

    if (Y % 2 == 0 && X <= Y/2 && 2*X >= Y/2) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3588
# AtCoder
N = int(input())
A = list(map(int, input().split()))  # ダムに溜まった水量

s = sum(A)
X = [0]*N
X[0] = s

# X1を求める
for i in range(1, N, 2):
    X[0] -= 2*A[i]

for i in range(N-1):
    X[i+1] = 2*A[i]-X[i]

print(' '.join(map(str, X)))


Measured memory_bytes: 19148
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <list>
#define rep(i, n) for(int i=0; i<(n); ++i)
#define rep2(i, s, n) for(int i=s; i<(n); ++i)
#define sz(x) int(x.size())

typedef long long ll;

using namespace std;

/*******-c++14 don't include-*******/
template<typename T>
T gcd(T a, T b){if( b == 0)return a; return gcd(b, a%b); }
template<typename T>
T lcm(T a, T b){return a*b/gcd(a,b); }
/*******---------------------*******/

static const int INTINF = (2147483647);
static const ll LLINF = (1ll<<32);
static const int MAX = 100001;

int main(int argc, const char * argv[]) {
    // input from txt
    
    /////////
    //write//
    /////////
    
    int n, k;
    cin >> n >> k;
    int res= 0;
    rep(i, n){
        int a;
        cin >> a;
        if(a>=k)res++;
    }
    
    cout << res << endl;
    
    return 0;
}


Measured memory_bytes: 256
/******************************************
* NICK : nikhilsinghh59 *
******************************************/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define watch(x) cout << (#x) << " is " << (x) << endl
#define endl "\n"

#define PB push_back
#define F first
#define S second
#define all(c) (c).begin(),(c).end()
const int M = 1e9+7;

int main()
{   
    
    string s , t;
    cin >>s >> t;
    if(t.length()-s.length() == 1) {
        ll n = s.length();
        for(ll i=0;i<n;i++){
            if(s[i]!=t[i]) {
                cout << "No";
                return 0;
            }
        }
        cout << "Yes";
    }
    else {
        cout << "No";
    }
    
    return 0;
}

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

vector<int> d;
vector<int> adj[100000];

void bfs(vector<int> v, int k) {
    vector<int> u;
    for (int p : v) {
        for (int q : adj[p]) {
            if (d[q] == -1) {
                u.push_back(q);
                d[q] = k + 1;
            }
        }
    }
    if (u.size() > 0)
        bfs(u, k + 1);
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<pair<int, int>> e(m);
    for (int i = 0; i < m; i++) {
        int ai, bi;
        cin >> ai >> bi;
        adj[ai - 1].push_back(bi - 1);
        adj[bi - 1].push_back(ai - 1);
        e[i] = make_pair(ai - 1, bi - 1);
    }
    
    for (int i = 0; i < n; i++)
        d.push_back(-1);
    d[0] = 0;
    bfs({0}, 0);
    
    vector<int> a(n);
    for (int i = 0; i < m; i++) {
        if (d[e[i].first] == d[e[i].second])
            continue;
        if (d[e[i].first] > d[e[i].second])
            a[e[i].first] = e[i].second;
        else
            a[e[i].second] = e[i].first;        
    }
    
    cout << "Yes" << endl;
    for (int i = 1; i < n; i++)
        cout << a[i] + 1 << endl;
    
    return 0;
}


Measured memory_bytes: 30032
#include <iostream>
#include <algorithm>
#include <climits>
#include <numeric>
#include <iomanip>
#include <cmath>
#include <vector>
#include <set>
#include <unordered_set>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>

#define barsik ios::sync_with_stdio(false)
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)

typedef long long ll;
typedef std::vector<int> vi;
typedef std::pair <int, int> pii;
typedef std::unordered_set <int> u_si;

using namespace std;

void solve(){
    int n;
    cin >> n;
    string a;
    cin >> a;
    int cnt = 1;
    for(int i = 0; i < n - 1; i++){
        if(a[i] != a[i + 1]) cnt++;
    }
    cout << cnt;
}

int main(){
    barsik;
    int q = 1;
    //cin >> q;
    while(q--) solve();
}



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

using namespace std;

using i64 = int64_t;

const i64 MOD = 1e9 + 7;


struct LowLink{
    vector<vector<int>>& edges;
    // 関節点
    vector<int> art;
    vector<pair<int,int>> bridge;

    vector<int> used, ord, low;
    int k;

    void dfs(int idx, int par){
        ord[idx] = k++;
        low[idx] = ord[idx];
        bool is_art = false;
        int cnt = 0;
        for(auto& to : edges[idx]){
            if(ord[to] == -1){
                ++cnt;
                dfs(to, idx);
                low[idx] = min(low[idx], low[to]);
                is_art |= par != -1 && low[to] >= ord[idx];
                if(ord[idx] < low[to])
                    bridge.emplace_back(idx, to);
            }else if(to != par)
                low[idx] = min(low[idx], ord[to]);
        }
        is_art |= (par == -1 && cnt > 1);
        if(is_art)
            art.emplace_back(idx);
    }

    LowLink(vector<vector<int>>& edges) :
        edges(edges),
        ord(edges.size(), -1),
        low(edges.size(), 0),
        k(0)
    {
        for(int i = 0; i < edges.size(); ++i)
            if(ord[i] == -1)
                dfs(i, -1);
        for(auto& b : bridge)
            b = make_pair(min(b.first, b.second), max(b.first, b.second));
        sort(art.begin(), art.end());
        sort(bridge.begin(), bridge.end());
    }
};


signed main(){
    int n, m;
    cin >> n >> m;
    vector<pair<int,int>> v(m);
    vector<vector<int>> edges(n);
    for(int i = 0; i < m; ++i){
        vector<int> l(2);
        for(auto& x : l)
            cin >> x;
        sort(l.begin(), l.end());
        v[i] = make_pair(l.front(), l.back());
        edges[l[0]].emplace_back(l[1]);
        edges[l[1]].emplace_back(l[0]);
    }
    LowLink ll(edges);
    for(auto& x : ll.art)
        cout << x << endl;
}



Measured memory_bytes: 4812
#include<bits/stdc++.h>
using namespace std;
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define pb push_back
#define mp make_pair
#define in auto&it
#define out auto it
#define rep(i,si,n) for(int i=si;i<n;++i)
#define all ar.begin(),ar.end()
#define mod 1000000007
const double pi = acos(-1);
int main() {
	#ifndef ONLINE_JUDGE
		freopen("input.txt", "r", stdin);
		freopen("output.txt", "w", stdout);
		freopen("error.txt", "w", stderr);
	#endif
	fastio
	ll n;
	cin>>n;
	//vector<int>ar;
	//map<int,int>mp;
	ll ar[n];
	for(int i=0;i<n;++i){
		//int a;
		//cin>>a;
		//++mp[a];
		//if(mp[a]==1) ar.push_back(a);
		cin>>ar[i];
	}
	//int n=ar.size();
	ll cnt=0;
	for(int i=0;i<n;++i){
		for(int j=i+1;j<n;++j){
			for(int k=j+1;k<n;++k){
				//cout<<ar[i]<<" "<<ar[j]<<" "<<ar[k]<<'\n';
				if(ar[i]+ar[j]>ar[k] && ar[i]+ar[k]>ar[j] && ar[j]+ar[k]>ar[i] && ar[i]!=ar[j] && ar[i]!=ar[k] && ar[j]!=ar[k]){
					++cnt;
					//cout<<ar[i]<<" "<<ar[j]<<" "<<ar[k]<<'\n';
					//cout<<i+1<<" "<<j+1<<" "<<k+1<<'\n';
				}
			}
		}
	}
	cout<<cnt;
	cerr<<"time:  "<<(float)clock()/CLOCKS_PER_SEC<<"secs"<<'\n';
	return 0;
}

Measured memory_bytes: 3800
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <algorithm>
#include <complex>
#include <array>
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)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()
 
typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int,int> P;
typedef pair<ll,ll> PL;
typedef vector<double> VD;
typedef vector<VD> VVD;

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

int in() { int x; scanf("%d", &x); return x; }
ll lin() { ll x; scanf("%lld", &x); return x; }

int main() {
    int n;
    cin >> n;
    VI a(n);
    REP(i,n) a[i] = in();
    reverse(ALL(a));
    FOR(i,1,n-1){
        if (a[i] > a[i - 1] + 1){
            cout << "No" << endl;
            return 0;
        }else if (a[i] == a[i - 1] + 1){
            a[i]--;
        }
    }
    cout << "Yes" << endl;

    return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;

int main() {
    int n;
    cin >> n;
    if(n == 5 || n == 7 || n == 3){
        cout << "YES";
    } else{
        cout << "NO";
    }
    return 0;
}

Measured memory_bytes: 3624
#include <stdio.h>

int main() {
	int A, B;
	scanf("%d%d",&A,&B);
	for (int i = B * 10; i < (B + 1) * 10; i++) {
		if (i * 2 / 25 == A) {
			printf("%d",i);
			return 0;
		}
	}
	printf("-1");
	return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <algorithm>
#include <bitset>
#include <cstdlib>
#include <cmath>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int
using namespace std;



int main(){
  ll N; cin>>N;
  vector <ll> A; A.resize(N+1,0);
  vector <ll> dp; dp.resize(N+1,0); dp[0] = 0;
  vector <ll> rp; rp.resize(N+1,0); rp[0] = 0;
  for(int i=0;i<N;i++) cin>>A[i+1];
  dp[1] = (A[1]);
  rp[1] = -(A[1]);

  //cout<<1<<endl;
  //cout<<dp[1]<<"   "<<rp[1]<<endl;
  if(N == 2){
    cout<<max(dp[1] + A[2] , rp[1] - A[2]);
    return 0;
  }

  for(int i=2;i<=N-1;i++){ // 漸化式
//  ll a = A[i-1];
 // ll b = A[i];

  ll dp1,dp2,dp3,dp4;
  ll rp1,rp2,rp3,rp4;

  

  dp1 = max(dp[i-2] + A[i-1] + A[i], dp[i-2] - A[i-1] - A[i]); 
  //cout<<dp1<<endl;
  dp2 = dp[i-1] + A[i];
  dp3 = max(rp[i-2] - A[i-1] + A[i] , rp[i-2] + A[i-1] - A[i]);
  //if(i==2) dp3 = 0;
  //cout<<dp2<<endl;
  //cout<<dp3<<endl;
  dp4 = rp[i-1] - A[i];
  //cout<<dp4<<endl;

  rp1 = max(rp[i-2] - A[i-1] - A[i] , rp[i-2] + A[i-1] + A[i]);
  rp2 = rp[i-1] + A[i];
  rp3 = max(dp[i-2] + A[i-1] - A[i] , dp[i-2] - A[i-1] + A[i]);
  //if(i==2) rp3 = 0;
  rp4 = dp[i-1] - A[i];

dp3 = 0;
dp1 = 0;
rp1=0;
rp3 = 0;
  
ll res_dp = max(dp1,dp2);
res_dp = max(res_dp,dp3);
dp[i] = max(res_dp , dp4);

ll res_rp = max(rp1,rp2);
res_rp = max(res_rp,rp3);
rp[i] = max(res_rp , rp4);


//cout<<dp[i]<<"   "<<rp[i]<<endl;


  }


cout<<max(dp[N-1] + A[N] , rp[N-1] - A[N]) <<endl;

  return 0;
}

Measured memory_bytes: 2560
import copy
n = int(input())
l = [list(map(int,input().split())) for i in range(n)]
l1 = copy.deepcopy(l)

for k in range(n):
    for i in range(n):
        for j in range(n):
            if l[i][j] > l[i][k]+l[k][j]:
                print(-1)
                exit()

            elif l[i][j] == l[i][k]+l[k][j]:
                if i != k and k != j :
                    l1[i][j] = 0
ans = 0
for i in l1:
    for j in i:
        ans += j
print(ans//2)


Measured memory_bytes: 56580
#include<stdio.h>
#include<stdlib.h>
#include<math.h>

using namespace std;

#define FOR(i,m,n) for (int i = m; i < n; i++)
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define DEBUG(a) printf("%d\n", a)

int main()
{
  int N, D;

  scanf("%d %d", &N, &D);

  int a[N][D];

  FOR(i, 0, N) {
    FOR(j, 0, D) {
      scanf("%d", &a[i][j]);
    }
  }

  int count = 0;
  FOR(i, 0, N - 1) {
    FOR(k,i+1,N) {
      float ans = 0.0f;
      FOR(j, 0, D) {
        ans += pow((a[i][j] - a[k][j]), 2);
      }
      ans = sqrt(ans);
      //printf("%f\n", ans);
      if (ceil(ans) == floor(ans))
        count++;
    }
  }

  DEBUG(count);


  return 0;
}

Measured memory_bytes: 128
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>

#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif

using namespace std;
typedef long long ll;
//typedef pair<int,int> Pint;
typedef pair<ll, ll> P;
//typedef pair<int, pair<int, int>> P;
//typedef tuple<int,int,int> T;
typedef vector<ll> vec;
typedef vector<vec> mat;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define revrep(i, n) for(ll i = n-1; i >= 0; i--)
ll max(ll a, ll b){return (a > b) ? a : b;}
ll min(ll a, ll b){return (a < b) ? a : b;}

ll INFL = 1000000000000000010;//10^18 = 2^60
int INF = 1000000000;//10^9
ll MOD  = 1000000007;
//vector<int> dy = {0,0,1,-1};
//vector<int> dx = {1,-1,0,0};


int main(void){
  ll W, H, x, y;
  cin >> W >> H >> x >> y;
  cout << (double)W * H / 2 << endl;
  if(2*x == W && 2*y == H){
    cout << 1 << endl;
  }else{
    cout << 0 << endl;
  }
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define fi first
#define se second
#define ll long long
#define dbg(v) cerr<<#v<<" = "<<v<<'\n'
#define vi vector<int>
#define vl vector <ll>
#define pii pair<int,int>
#define vii vector < pii >
#define mp make_pair
#define db long double
#define pb push_back
#define all(s) s.begin(),s.end()
template < class P , class Q > ostream& operator<<(ostream& stream, pair < P , Q > v){ stream << "(" << v.fi << ',' << v.se << ")"; return stream;}
template < class T > ostream& operator<<(ostream& stream, const vector<T> v){ stream << "[ "; for (int i=0; i<(int)v.size(); i++) stream << v[i] << " "; stream << "]"; return stream;}
template < class T > T smin(T &a,T b) {if (a > b) a = b;return a;}
template < class T > T smax(T &a,T b) {if (a < b) a = b;return a;}
int main(void) {
    string str;
    cin>>str;
    int ans = 0;
    for (auto it : str)
        ans += it == 'o';
    ans += 15 - str.length();
    puts(ans >= 8 ? "YES" : "NO");
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int K = sc.nextInt();
        int S = sc.nextInt();
        int count = 0;
        for(int x = 0;x <= K;x++){
            for(int y = 0;y <= K;y++){
                if((S - x - y >= 0) && (S - x - y <= K)){
                    count++;
                }
            }
        }
        System.out.println(count);
    }
}


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

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

const ll INF64 = 1LL << 60;
const int INF32 = 1 << 29;
const int MOD = 1000000007;

const int CASES = 2;

void solve(){
    int H, W, A, B;
    cin >> H >> W >> A>> B;

    vector<string> ans(H);
    for(int i = 0; i < H; ++i){
        for(int j = 0; j < W; ++j){
            if(i < B && j < A) ans[i] += "0";
            else if(i >= B && j >= A) ans[i] += "0";
            else ans[i] += "1";
        }
    }

    for(int i = 0; i < H; ++i){
        cout << ans[i] << '\n';}

    return;
}

int main() {
    #ifdef MYLOCAL
    vector<string> filenames {"input1.txt", "input2.txt", "input3.txt", "input4.txt"};
    cout << "------------\n";
    for(int i = 0; i < CASES; ++i){
        ifstream in(filenames[i]);
        cin.rdbuf(in.rdbuf());
        solve();
        cout << "------------\n";
    }
    #else

    solve();

    #endif
    return 0;
}



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

const double eps = 1e-10;

int dcmp(double x) {
        if(fabs(x) < eps) return 0;
        return x < 0 ? -1 : 1;
}

#define Vector P
struct P {
        double x, y;
        P(double x = 0, double y = 0): x(x), y(y) {}
        P operator + (P b) {return P(x + b.x, y + b.y);}
        P operator - (P b) {return P(x - b.x, y - b.y);}
        P operator * (double b) {return P(x * b, y * b);}
        P operator / (double b) {return P(x / b, y / b);}
        double operator * (P b) {return x * b.x + y * b.y;} // Dot
        double operator ^ (P b) {return x * b.y - y * b.x;} // Cross
        double abs() {return hypot(x, y);}
        P unit() {return *this / abs();}
        P spin(double o) {
                double c = cos(o), s = sin(o);
                return P(c * x - s * y, s * x + c * y);
        }
};

struct Line {
        //ax + by + c = 0
        double a, b, c, theta;
        P pa, pb;
        Line(): a(0), b(0), c(0), theta(0), pa(), pb() {}
        Line(P pa, P pb): a(pa.y - pb.y), b(pb.x - pa.x), c(pa ^ pb), theta(atan2(-a, b)), pa(pa), pb(pb) {}        P projection(P p) {return pa + (pb - pa).unit() * ((pb - pa) * (p - pa) / (pb - pa).abs());}                P reflection(P p) {return p + (projection(p) - p) * 2;}
        double get_ratio(P p) {return (p - pa) * (pb - pa) / ((pb - pa).abs() * (pb - pa).abs());}
        P dis(P p) {return ((pb - pa) ^ (p - pa)) / (pb - pa).abs();} // directed distance
};

struct Circle {
        P c;
        double r;
        Circle(P c, double r = 0): c(c), r(r) {}
};
bool onsegment(P p, P a, P b) {
        return dcmp((a - p) ^ (b - p)) == 0 && dcmp((a - p) * (b - p)) <= 0;
}
bool segment_intersection(P p1, P p2, P p3, P p4) { // end points are not allowed
        return dcmp((p2 - p1) ^ (p3 - p1)) * dcmp((p2 - p1) ^ (p4 - p1)) < 0
                && dcmp((p4 - p3) ^ (p1 - p3)) * dcmp((p4 - p3) ^ (p2 - p3)) < 0;

}

int main() {
        ios_base::sync_with_stdio(false); cin.tie(0);
        int q; cin >> q;
        while(q--) {
                P p0, p1, p2, p3;
                cin >> p0.x >> p0.y >> p1.x >> p1.y >> p2.x >> p2.y >> p3.x >> p3.y;
                Vector v1 = p1 - p0, v2 = p3 - p2;
                if(dcmp(v1 ^ v2) == 0) cout << 2 << '\n';
                else if(dcmp(v1 * v2) == 0) cout << 1 << '\n';
                else cout << 0 << '\n';
        }
        return 0;
}


Measured memory_bytes: 3300
#include<map>
#include<set>
#include<cmath>
#include<queue>
#include<cstdio>
#include<vector>
#include<cctype>
#include<cstdlib>
#include<cstring>
#include<utility>
#include<algorithm>

#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define For(i,x,y) for(int i=((int)x);i<=((int)y);i++)
#define Dep(i,y,x) for(int i=((int)y);i>=((int)x);i--)
#define Rep(i,x) for (int y,i=head[x];i;i=E[i].nxt)
using namespace std;

typedef long long ll;
typedef unsigned int uint;
typedef pair<int,int> pii;

int rd() {
	char c=getchar(); int t=0,f=1;
	while (!isdigit(c)) f=(c=='-')?-1:1,c=getchar();
	while (isdigit(c)) t=t*10+c-48,c=getchar(); return t*f;
}
void wt(int x) {
	if (x<0) putchar('-'),wt(-x);
	else { if (x>9) wt(x/10); putchar(x%10+48); }
}

int n,D,stk[20],top; ll ans,pw[20];

inline int Abs(int x) { return x>0?x:-x; }

void dfs(int x,int y,ll s,ll key) {
	if (s<0 || (s-10ll*pw[x])>D) return;
	if (x==y/2) {
		if (y%2==0) key*=10;
		if (s==D)
			ans+=key;
		return;
	}
	For (i,-9,9) {
		ll new_key;
		if (x!=y || i<0) new_key=key*(10-Abs(i));
		else new_key=key*(10-Abs(i)-1);
		
		stk[++top]=i;
		dfs(x-1,y,s+pw[x]*i-pw[y-x]*i,new_key);
		top--;
	}
}

int main() {
	D=rd(),pw[0]=1;
	for (int i=D;i;i/=10) n++;
	For (i,1,18) pw[i]=10ll*pw[i-1];
	
	For (i,1,17) dfs(i,i,0,1);
	printf("%lld\n",ans);
	
	return 0;
}
/*
999999999

*/





Measured memory_bytes: 128
#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define REPr(i,n) for(int i=(n)-1;i>=0; --i)
#define FORq(i, m, n) for(int i = (m);i <= (n);++i)
#define SCD(n) scanf("%d",&n)
#define SCD2(m,n) scanf("%d%d",&m,&n)
#define SCD3(m,n,k) scanf("%d%d%d",&m,&n,&k)
#define SCLLD(n) scanf("%lld",&n)
#define SCLLD2(m,n) scanf("%lld%lld",&m,&n)
#define SCLLD3(m,n,k) scanf("%lld%lld%lld",&m,&n,&k)
#define PB push_back
#define MP make_pair
#define ARSCD(A,N) REP(i,N){SCD(A[i]);}
#define ARSCD1(A,N) FORq(i,1,N){SCD(A[i]);}
#define VSCD(v,N) REP(i,N){int x; SCD(x); v.PB(x);}
#define VSCLLD(v,N) REP(i,N){long long x; SCLLD(x); v.PB(x);}
#define PRINTD(n) printf("%d\n",n)
#define PRINTLLD(n) printf("%lld\n",n)
#define DEBUG printf("%s\n","debug")
#define fst first
#define snd second
#define SIN(x,S) (S.count(x) != 0)
using namespace std;
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector < VI > VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
////////////////////////////////////////////////////////////////////
int main(){
    int N,T;
    SCD2(N,T);
    int cost = 10000;
    REP(i,N){
        int c,t; SCD2(c,t);
        if (t > T) continue;
        cost = min(cost,c);
    }

    if (cost == 10000) printf("TLE\n");
    else PRINTD(cost);
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    string a; cin >> a;
    string s = "Sunny", c = "Cloudy", r = "Rainy";
    if (a == s) {
        cout << c;
    } else if (a == c) {
        cout << r;
    } else {
        cout << s;
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include<string>
#include<iostream>
#include <algorithm>
#include<vector>
#include<functional>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#define ll long long
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
using namespace std;

int main() {
	ll N = 0, g = 0, f = 0;
	string S, T;
	cin >> N >> S >> T;
	vector<char> ANS(N * 2);
	for (int j = 0; j < N * 5; j += 2) {
		ANS[j] += S[g];
		g++;
		if (g == N) break;
	}
	for (int k = 1; k < N * 5; k += 2) {
		ANS[k] += T[f];
		f++;
		if (f == N) break;
	}
	
	rep(i, N * 2) cout << ANS[i];
	cout << endl;

	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
int main() {
  int N, i, max, count;
  max = count = 0;
  scanf("%d", &N);
  int H[N];
  scanf("%d", &H[0]);
  for (i = 1; i < N; ++i) {
    scanf("%d", &H[i]);
    if (H[i-1] >= H[i]) {
      ++count;
    } else {
      if (max < count) {
        max = count;
      }
      count = 0;
    }
  }
  if (max < count) {
    max = count;
  }
  printf("%d\n", max);
  return 0;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int64_t i = 0; i < (int64_t)(n); i++)
using vi = vector<int64_t>;
using vvi = vector<vi>;
using ll = int64_t;
using P = pair<ll,ll>;
ll INF = 1000000007;
// ll INF = 9223372036854775807;
// ll INF = 998244353;

int main() {
    // fasten cin
    cin.tie(0);
    ios::sync_with_stdio(false);
    // implement
    ll a,b,c,k;
    cin >> a >> b >> c >> k;
    rep(i,k){
        if(b<=a){
            b *= 2;
        }else{
            c *= 2;
        }
    }
    string res = "No";
    if(c>b && b>a) res = "Yes";
    cout << res << endl;
}

Measured memory_bytes: 3648
N,M = map(int,input().split())
switch = [list(map(int,input().split())) for i in range(M)]
P = list(map(int,input().split()))
ans = 0

for i in range(2**N):
    switch_flag=[0]*N
    for j in range(N):
        flag = 0
        switch_flag[j]=(i>>j)&1
    for k in range(M):
        total = 0
        for l in range(switch[k][0]):
            if switch_flag[switch[k][l+1]-1] == 1:
                total += 1
        if total%2 == P[k]:
            flag += 1
    if flag == M:
        ans += 1

print(ans)


Measured memory_bytes: 3188
#include<iostream>
#include <algorithm>
using namespace std;
int main()
{
	int n,h,a;
	cin>>h>>a;
	if(a>=h)
	{
		cout<<1;
		return 0;
	}
	for(int i=1;i<10010;i++)
		if(a*i>=h)
		{
			cout<<i;
			break;
		}
	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int swh(int n)
{int s=0;
 while(n>0)
   {s+=n%10;
    n/=10;
   }
 return s;
}
int main()
{int n,a,b,s=0;
 cin>>n>>a>>b;
 for(int i=1;i<=n;i++)
    {if(swh(i)>=a&&swh(i)<=b)
       s+=i;
	}
 cout<<s<<endl;
}

Measured memory_bytes: 256
import java.util.*;
import java.io.*;

class Main{
  public static void main(String[] args){
   	Scanner sc = new Scanner(System.in);
    int n = sc.nextInt();
    Integer p[] = new Integer[n];
    for(int i=0;i<n;i++){
      p[i] = sc.nextInt();
    }
    int d = 0;
    Integer q[] = new Integer[n];
    for(int i=0;i<n;i++){
      q[i] = i+1;
    }



    for(int i=0;i < n ;i++){
      if(p[i] != q[i]){
        d ++;
      }
    }
    if(d == 2 || d == 0){
      System.out.println("YES");
    }else{
      System.out.println("NO");
    }

    }

  }


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

int main(){
    int N;
    cin >> N;
    int P[N];
    int Q[N];

    for(int i = 0; i < N; i++){
        int A;
        cin >> A;
        P[i] = A;
        Q[i] = A;
    }

    sort(Q, Q+N);
    int diff = 0;
    for(int i = 0; i < N; i++){
        if(P[i] != Q[i]) diff++;
    }

    if(diff <= 2){
        cout << "YES" << endl;
    }else{
        cout << "NO" << endl;
    }
}


Measured memory_bytes: 256
big=10**9+7

n,m = map(int, input().split())

a = set([int(input()) for _ in range(m)])
  

cho = [0]*(n+1)
if 0 not in a:
  cho[0] = 1
if 1 not in a:
  cho[1] = 1

for i in range(2,n+1):
  if i not in a:
    cho[i] = (cho[i-1]+cho[i-2])%big


print(cho[-1])

Measured memory_bytes: 13212
#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"
using namespace std;
using Graph = vector<vector<int>>;

typedef long long ll;
typedef long double ld;


#define int long long
#define rep(i, n) for(long long i = 0; i < (n); i++)
#define sqrt(d) pow((long double) (d), 0.50)

const ll INF = 2e9;
const ll large_P = 1e9 + 7;





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

    vector<int> A(N);
    vector<vector<int>> x(N, vector<int>(N));
    vector<vector<int>> y(N, vector<int>(N));

    rep(i, N) {
        cin >> A.at(i);
        rep(j, A.at(i)) {
            cin >> x.at(i).at(j) >> y.at(i).at(j);
            x.at(i).at(j)--;
        }
    }

    int res = 0;

    rep(i, pow(2, N)) {
        int bit = pow(2, N) - 1 - i;
        int bitcount = __builtin_popcount(bit);

        bool ok = true;
        rep(j, N) { //j人目の証言について精査
            if(!(bit & (1 << j))) continue;
            else {
                rep(k, A.at(j)) {
                    if (y.at(j).at(k) == 0 && (bit & (1 << x.at(j).at(k)))) {
                        ok = false;
                        break;
                        break;
                    }
                    if (y.at(j).at(k) == 1 && !(bit & (1 << x.at(j).at(k)))) {
                        ok = false;
                        break;
                        break;
                    }
                }
            }
        }
        if (ok) {
            if(res < bitcount) res = bitcount;
            //cout << bit << endl;
        }

    }

    cout << res << endl;

}

Measured memory_bytes: 256
#include<cstdio>
#include<iostream>
#define re register
using namespace std;
inline int read(){
	re int t=0;re char v=getchar();
	while(v<'0')v=getchar();
	while(v>='0')t=(t<<3)+(t<<1)+v-48,v=getchar();
	return t;
}
int n,a[200002],b[200002],k,c[200002];
inline void add(re int x,re int y){
	for(;x<=n;x+=x&(-x))c[x]+=y;
}
inline int ask(re int x){
	re int sum=0;
	for(;x;x-=x&(-x))sum+=c[x];
	return sum;
}
signed main(){
	//freopen("a.in","r",stdin);
	n=read();k=read();
	for(re int i=1;i<=n;++i)a[i]=read();
	for(re int j=1;j<=k;++j){
		for(re int ii=1;ii<=n;++ii)add(max(1,ii-a[ii]),1),add(min(n,ii+a[ii])+1,-1);
		re int xx=1;
		for(re int ii=1;ii<=n;++ii){
			a[ii]=ask(ii);;
			if(a[ii]!=n)xx=0;
		}
		for(re int ii=1;ii<=n;++ii)c[ii]=0;
		if(xx){
			break;
		}}
	for(re int i=1;i<=n;++i)printf("%d ",a[i]);
}

Measured memory_bytes: 5340
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
#define int long long
typedef vector<int> VI;
typedef pair<int, int> pii;
typedef priority_queue<int> PQ;
#define fore(i,a) for(auto &i:a)
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));
//priority_queue<int,vector<int>, greater<int> > q2;



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

	int N;
	cin >> N;
	VI X(N), Y(N);

	int ans = 0;
	
	REP(i, N) {
		cin >> X[i] >> Y[i];
	}
	REP(i, N) {
		REP(j, N) {
			if (i == j)continue;
			int a = X[i] - X[j], b = Y[i] - Y[j];
			int cnt = 0;
			REP(k, N) {
				REP(q, N) {
					if (X[k] - X[q] == a && Y[k] - Y[q] == b) {
						cnt++;
					}
				}
			}
			ans = max(ans, cnt);
		}
	}


//	cout << ans << endl;
	cout << N-ans << endl;

	return 0;
}


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

int h, w;
std::string s;
std::vector<std::string> v;
int dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
int dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

int main(){
	scanf("%d %d", &h, &w);
	for(int i=0; i<h; ++i){
		std::cin >> s;
		v.push_back(s);
	}
	for(int i=0; i<h; ++i){
		for(int j=0; j<w; ++j){
			if(v[i][j] == '#') continue;
			int tmp = 0;
			for(int k=0; k<8; ++k){
				int nx = i + dx[k];
				int ny = j + dy[k];
				if(0 <= nx && nx < h && 0 <= ny && ny < w && v[nx][ny] == '#') ++tmp;
			}
			v[i][j] = '0'+ tmp;
		}
	}
	for(int i=0; i<h; ++i)
		std::cout << v[i] << std::endl;
}

Measured memory_bytes: 256
# coding: utf-8
keta = int(input())
s = input()

total = 0
for i in range(1000):
    str_i = str(i)
    if i < 100:
        str_i = "0" + str_i
    if i < 10:
        str_i = "0" + str_i
    tmp0 = s.find(str_i[0])
    if tmp0 >= 0:
        tmp1 = s[tmp0+1:].find(str_i[1])
        if tmp1 >= 0:
            tmp2 = s[tmp0+1+tmp1+1:].find(str_i[2])
            if tmp2 >= 0:
                total += 1

print(total)


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

int main() {

    string weather;
    cin >> weather;
 
    if(weather == "Sunny") cout << "Cloudy" << endl;
    else if(weather == "Cloudy") cout << "Rainy" << endl;
    else if(weather == "Rainy") cout << "Sunny" << endl;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,a) for(int i = 0; i < (a); i++)
#define ALL(a) (a).begin(),(a).end()
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9;
const int MOD = 1e9 + 7;

signed main(){
    int n;
    cin >> n;
    int ans = 0;
    REP(i,n){
        int num = i + 1, cnt = 0;
        while(num > 0){
            cnt++;
            num /= 10;
        }
        if(cnt % 2 == 1) ans++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pint = pair<int,int>;
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define FORD(i,a,b) for(int i=a;i>=b;i--)
#define FORL(i,x) for(int i=head[x];i;i=nxt[i])
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define PB push_back
#define MP make_pair
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 digitsum;

int dgsum(int n){
  int ref = n;
  while(ref>0){
    digitsum += ref%10;
    ref /= 10;
  }
}

int main() {
  int n; cin >> n;
  int ans = 1001001001;
  FOR(i,1,n-1){
    digitsum = 0;
    dgsum(i); dgsum(n-i);
    chmin(ans,digitsum);
  }

  cout << ans << endl;
  


}



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

using namespace std;

int keta(int);

int main() {

	int a, b = 0;
	cin >> a;

	for (int i = 1; i <= a; i++) {
		if (keta(i) % 2) {
			b++;
		}
	}

	cout << b;

	return 0;

}

int keta(int a = 0) {
	int b = 0;
	for (int i = a; i > 0 ;i /= 10) {
		b++;
	}
	return b;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define forN(i, n) for(int i = 0; i <n ; ++i)
#define endl "\n"
#define noob (main)
typedef long long ll;
using namespace  std;
typedef vector<ll> vi;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const int N = 55 ;

int noob(){
    fastIO;
    int A[3];
    cin>>A[0]>>A[1]>>A[2];
    sort(A,A+3);
    cout<<A[0]+A[1];
}

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

int max(vector<int> k){
  int a=0;
  for(int i=0;i<k.size();i++){
    if(a<k.at(i))a=k.at(i);
  }
  return a;
}

int main(){
  int n,a=0,sum=0;
  cin >> n;
  vector<int> p(n);
  for(int i=0;i<n;i++)cin >> p.at(i);
  for(int i=0;i<n;i++)sum += p.at(i);
  cout << sum-max(p)/2 << endl;
}


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

public class Main {

	static boolean isPrime[] = new boolean[1000005];
	static{
		Arrays.fill(isPrime,true);
		isPrime[0]=isPrime[1]=false;
		for(int i = 2;i*i<=isPrime.length;i++){
			if(isPrime[i]){
				for(int j = i+i;j<isPrime.length;j+=i){
					isPrime[j]=false;
				}
			}
		}
	}
	public static void main(String[] args) {
		Scanner cin = new Scanner(System.in);
		while(true){
			int a =cin.nextInt();
			int d =cin.nextInt();
			int n =cin.nextInt();
			if(a+d+n==0){
				break;
			}
			int count=0;
			for(int i = a;i<isPrime.length;i+=d){
				if(isPrime[i]){
					count++;
				}
				if(count==n){
					System.out.println(i);
					break;
				}
			}
			
			
		}
	}

}

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

int main()
{
  ll N;
  ll x;
  string ans = "";
  char c;
  cin >> N;
  
  while(N > 0){
    x = (N % 26);
    if(x == 0) x = 26;
    c = x + 'a' - 1;
    ans += c;
    N = (N - 1) / 26;
  }
  
  string ans2 = "";
  int ss = ans.size();
  for(int i = 0; i < ss; i++){
    ans2 += ans[ss - i - 1];
  }
  
  cout << ans2 << endl;
  return 0;
  
}



Measured memory_bytes: 3620
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cmath>

using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define rep2(i,n) for(int i=1;i<(n);i++)
typedef long long ll;

ll gcd(ll a, ll b){
    if(a<b) swap(a,b);
    if(a%b == 0) return b;
    else return gcd(b,a%b);
}

ll mod = 998244353;

int main(){
    ll n,k; cin >> n >> k;
vector<ll> l(k), r(k);
    rep(i,k) cin >> l[i] >> r[i];
    vector<ll> dp(n+1,0),dpsum(n+1,0);
    dp[1] = 1;
    dpsum[1] = 1;
    for(ll i = 2; i<=n ; i++){
        rep(j,k){
            int li = i - r[j];
            int ri = i - l[j];
            if(ri<0) continue;
            li = max(li,1);
            dp[i] += dpsum[ri] - dpsum[li-1];
            dp[i] %= mod;
        }
        dpsum[i] = dpsum[i-1] + dp[i];
    }
    cout << dp[n] << endl;
}

Measured memory_bytes: 6440
list = list(map(int,input().split()))
exlist = [list[1] +i for i in range(list[0]) ]
sum = sum(exlist)
if exlist[0] > 0 and exlist[list[0]-1] > 0:
	print(sum-exlist[0])
elif exlist[0] <= 0 and exlist[list[0]-1] >= 0:
	print(sum)
else:
	print(sum-exlist[list[0]-1])

Measured memory_bytes: 3064
A,B,M = list(map(int,input().split()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
XYC = [list(map(int,input().split())) for _ in range(M)]
MIN = min(A)+min(B)
for xyc in XYC:
    MIN = min(MIN,A[xyc[0]-1]+B[xyc[1]-1]-xyc[2])
print(MIN)

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

int main() {
	int A, B, N;
	cin >> A >> B >> N;
  
  	vector<int> F(A);
  	for(int i = 0; i < A; i++) cin >> F.at(i);
  
  	vector<int> R(B);
  	for(int i = 0; i < B; i++) cin >> R.at(i);

    vector<vector<int>> C(N, vector<int>(3));
     for (int i = 0; i < N; i++) {
        for (int j = 0; j < 3; j++) {
          cin >> C.at(i).at(j);
        }
      }
  
  	int ans = 1001001;
  	
  	for(int i = 0; i < N; i++){
      	int price = 0;
		price = F.at(C.at(i).at(0)-1) + R.at(C.at(i).at(1)-1) - C.at(i).at(2);
        ans = min(ans, price);
    }
     
  	sort(F.begin(), F.end());
    sort(R.begin(), R.end());
  
	cout << min (ans, F.at(0)+R.at(0)) << endl;
}

Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define fp(i,k) for(i=0;i<k;i++)
#define fm(i,k) for(i=k;i>=0;i--)
#define fr(i,j,k) for(i=j;i<k;i++)
#define pb push_back
#define vll vector<ll>
#define vst vector<string>
#define vch vector<char>
#define pii pair<ll,ll>
#define psi pair<string,ll>
#define pis pair<ll,string>
#define pci pair<char,ll>
#define pic pair<ll,char>
#define msi map<string,ll>
#define mci map<char,ll>
#define mis map<ll,string>
#define mic map<ll,char>
#define mii map<ll,ll>
#define mp make_pair
#define ld double
#define srt(v) sort(v.begin(),v.end())
#define rsrt(v) sort(v.begin(),v.end(),greater<ll>)
ll arr[1000005];
int main(){
    ios::sync_with_stdio(false);cin.tie(0);
    ll t,n,m,x,y,cnt1=0,a,b,f,cnt2=0,cnt3=0,i,j,k;
    cin>>a>>b;
    k=b-a;
    n=k-1;
    cout<<n*k/2-a<<endl;
    return 0;}


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

int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	int n;
	cin >> n;
	string s;
	cin >> s;
	vector<int> a(n);
	for(int i = 0; i < n; i++) a[i] = s[i] - '1';
	bool has1 = false;
	for(int i = 0; i < n; i++){
		if(a[i] == 1) has1 = true;
	}
	if(!has1){
		for(int i = 0; i < n; i++){
			a[i] /= 2;
		}
	}
	int ans = 0;
	for(int i = 0; i < n; i++){
		int j = (n-1) - i;
		if((i ^ j) == (i + j)){
			ans += a[i];
			ans %= 2;
		}
	}
	if(!has1) ans *= 2;
	cout << ans << '\n';
}

Measured memory_bytes: 5404
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#define lol(i,n) for(int i=0;i<n;i++)
#define mod 1000000007
typedef long long ll;
using namespace std;
#define N 200010
int t[N][2],len[N],ttop=0;
ll n,L,ans=0;
void Ins(int a){
	t[ttop][0]=0,t[ttop][1]=0;
	len[ttop]=a;
	ttop++;
}
ll g(ll k){
	int a=1;
	while(k%2==0)k/=2,a++;
	return a;
}
int main(){
	cin>>n>>L;
	Ins(0);
	lol(u,n){
		string s;cin>>s;
		int now=0;
		lol(i,s.size()){
			if(!t[now][s[i]-'0']){
				t[now][s[i]-'0']=ttop;
				Ins(i+1);
			}
			now=t[now][s[i]-'0'];
		}
	}
	lol(i,ttop){
		if(t[i][0]==0^t[i][1]==0){
			ans^=g(L-len[i]);
		}
	}
	cout<<(ans?"Alice":"Bob")<<endl;
	return 0;
}


Measured memory_bytes: 1664
import java.util.*;
import java.io.*;
import java.text.*;
public class Main{
    //SOLUTION BEGIN
    //This code is not meant for understanding, proceed with caution
    void pre() throws Exception{}
    void solve(int TC) throws Exception{
        int n = ni(), k = ni();
        pn(n-k+1);
    }
    //SOLUTION END
    void hold(boolean b)throws Exception{if(!b)throw new Exception("Hold right there, Sparky!");}
    long mod = (long)998244353, IINF = (long)1e18;
    final int INF = (int)1e9, MX = (int)1e5+1;
    DecimalFormat df = new DecimalFormat("0.00000000000");
    double PI = 3.1415926535897932384626433832792884197169399375105820974944, eps = 1e-8;
    static boolean multipleTC = false, memory = false;
    FastReader in;PrintWriter out;
    void run() throws Exception{
        in = new FastReader();
        out = new PrintWriter(System.out);
        int T = (multipleTC)?ni():1;
        pre();for(int t = 1; t<= T; t++)solve(t);
        out.flush();
        out.close();
    }
    public static void main(String[] args) throws Exception{
        if(memory)new Thread(null, new Runnable() {public void run(){try{new Main().run();}catch(Exception e){e.printStackTrace();}}}, "1", 1 << 28).start();
        else new Main().run();
    }
    long gcd(long a, long b){return (b==0)?a:gcd(b,a%b);}
    int gcd(int a, int b){return (b==0)?a:gcd(b,a%b);}
    int bit(long n){return (n==0)?0:(1+bit(n&(n-1)));}
    void p(Object o){out.print(o);}
    void pn(Object o){out.println(o);}
    void pni(Object o){out.println(o);out.flush();}
    String n()throws Exception{return in.next();}
    String nln()throws Exception{return in.nextLine();}
    int ni()throws Exception{return Integer.parseInt(in.next());}
    long nl()throws Exception{return Long.parseLong(in.next());}
    double nd()throws Exception{return Double.parseDouble(in.next());}

    class FastReader{
        BufferedReader br;
        StringTokenizer st;
        public FastReader(){
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        public FastReader(String s) throws Exception{
            br = new BufferedReader(new FileReader(s));
        }

        String next() throws Exception{
            while (st == null || !st.hasMoreElements()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (IOException  e){
                    throw new Exception(e.toString());
                }
            }
            return st.nextToken();
        }

        String nextLine() throws Exception{
            String str = "";
            try{   
                str = br.readLine();
            }catch (IOException e){
                throw new Exception(e.toString());
            }  
            return str;
        }
    }
}

Measured memory_bytes: 23636
#include <cassert>

#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
//#include <boost/foreach.hpp>
//#include <boost/range/algorithm.hpp>
#define rep(i,j,k) for(int i=(int)j;i<(int)k;i++)
#define ll long long
#define Sort(v) sort(all(v))
#define INF 1000000000
#define END return 0
#define pb push_back
#define se second
#define fi first
#define pb push_back
#define all(v) (v).begin() , (v).end()
#define MP make_pair
#define MOD 1000000007LL
using namespace std;
int day[12]={31,28,31,30,31,30,31,31,30,31,30,31};

int main (){
    int n;cin>>n;
    list<int> v;
    auto it=v.end();
    rep(i,0,n){
        int cmd;
        cin>>cmd;
        if(cmd==0){
            int x;cin>>x;it=v.insert(it,x);
        }else if(cmd==1){
            int x;cin>>x;
            rep(gotutiyan,0,abs(x)){
                if(x>0)it++;
                else it--;
            }
        }else {
            it=v.erase(it);
        }
    }
    for(auto x:v)cout<<x<<endl;
}



/*

*/


Measured memory_bytes: 18636
N,M,K=map(int,input().split())
par=[0]*(N+1)
num=[0]*(N+1)
group = [1]*(N+1)

for i in range(1,N+1): par[i]=i

def root(x):
  if par[x]==x: return x
  return root(par[x])

def union(x,y):
  rx = root(x)
  ry = root(y)
  if rx==ry: return
  par[max(rx,ry)] = min(rx,ry)
  group[min(rx,ry)] += group[max(rx,ry)]

def same(x,y):
  return root(x)==root(y)     

for _ in range(M):
  a,b=map(int,input().split())
  union(a,b)
  num[a]+=1
  num[b]+=1
for _ in range(K):
  c,d=map(int,input().split())
  if same(c,d):
    num[c]+=1
    num[d]+=1

for i in range(1,N+1):
  print(group[root(i)]-num[i]-1,end=" ")

Measured memory_bytes: 86536