akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
#define res register int
#define ll long long
//#define cccgift
//#define getchar()(p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
//char buf[1<<21],*p1=buf,*p2=buf;
template<typename T>
inline void read(T &x)
{
    static char ch;bool f=1;
    for(x=0,ch=getchar();!isdigit(ch);ch=getchar()) if(ch=='-') f=0;
    for(;isdigit(ch);x=(x<<1)+(x<<3)+(ch^48),ch=getchar());x=f?x:-x;
}
template<typename T>
void print(T x)
{
    if (x<0) x=-x,putchar('-');
    if (x>9) print(x/10);
    putchar(x%10+48);
}
template<typename T>
inline void print(T x,char ap) {print(x);if (ap) putchar(ap);}
template<typename T>
inline void chkmax(T &x,const T &y) {x=x<y?y:x;}
template<typename T>
inline void chkmin(T &x,const T &y) {x=x<y?x:y;}
int k,q,d[5001],n,x,m,a[5001];
ll s[5001];
inline int getsum(int n,int x,int m) {
	ll tot=x%m;
	tot+=s[k-1]*(n/k)+((n%k)?s[n%k-1]:0);
	/*
	ll sum=x%m+s[k-1]*(n/k);
	for(res i=n/k*k+1;i<n;++i) sum+=a[(i-1)%k];print(sum,'\n');
	*/
	return tot/m;
}
int main()
{
	read(k),read(q);
	for(res i=0;i<k;++i) read(d[i]);
	while(q--) {
		read(n),read(x),read(m);
		for(res i=0;i<k;++i) a[i]=d[i]%m;
		s[0]=a[0];
		for(res i=1;i<k;++i) s[i]=s[i-1]+a[i];
		int tot=n-2-getsum(n-1,x,m);
		for(res i=0;i<k;++i) if(a[i]==0) {
			tot-=(n-1)/k;
			if(i<(n-1)%k) --tot;
		}
		print(tot+1,'\n');
	}
	return 0;
}
/* stuff you should look for
    * int overflow, array bounds
    * special cases (n=1?), set tle
    * do something instead of nothing and stay organized
*/ 

Measured memory_bytes: 384
// Last Change: 12/05/2019 19:58:26.
#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstdlib>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;
using ll = long long;

void solve(int H) {
  vector<vector<int>> data(H, vector<int>(5));
  for (auto &&e : data) {
    for (auto &&f : e) {
      cin >> f;
    }
  }

  bool flag = true;
  ll res = 0;
  while (flag) {
    flag = false;
    for (auto &&row : data) {
      for (int i = 1; i < 10; ++i) {
        int cnt = 0;
        for (int j = 0; j < 5; ++j) {
          if (row[j] == i) {
            ++cnt;
          } else {
            if (cnt >= 3) {
              for (int k = j - 1; k >= 0 and row[k] == i; --k) {
                row[k] = 0;
                res += i;
                flag = true;
              }
            }
            cnt = 0;
          }
        }
        if (cnt >= 3) {
          for (int k = 4; k >= 0 and row[k] == i; --k) {
            row[k] = 0;
            flag = true;
            res += i;
          }
        }
      }
    }

    /*
    cout << endl;
    for (auto &&e : data) {
      for (auto &&f : e) {
        cout << f << ' ';
      }
      cout << endl;
    }*/

    for (int i = 0; i < 5; ++i) {
      for (int j = 1; j < H; ++j) {
        for (int k = H - 1; k >= j; --k) {
          if (data[k][i] == 0) {
            swap(data[k][i], data[k - 1][i]);
          }
        }
      }
    }

    /*
    cout << endl;
    for (auto &&e : data) {
      for (auto &&f : e) {
        cout << f << ' ';
      }
      cout << endl;
    }
    cout << res << endl;*/
  }

  /*
  cout << endl;
  for (auto &&e : data) {
    for (auto &&f : e) {
      cout << f << ' ';
    }
    cout << endl;
  }*/

  cout << res << endl;
}

int main() {
  int H;
  while (cin >> H and H > 0) {
    solve(H);
  }
}



Measured memory_bytes: 3068
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<cmath>
#include<set>
#include<map>
#include<iomanip>

#define INF 1<<29

using namespace std;

//白いとこを消すのではなく、黒いとこを表示するととらえる。完コピ

int main(void) {
	int h, w;
	cin >> h >> w;
	vector<string>a(h);
	for (int i = 0; i < h; i++) {
		cin >> a[i];
	}
	vector<bool>row(h, false), col(w, false);
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			if (a[i][j] == '#') {
				row[i] = true;
				col[j] = true;
			}
		}
	}
	for (int i = 0; i < h; i++) {
		if (row[i]) {
			for (int j = 0; j < w; j++) {
				if (col[j]) {
					cout << a[i][j];
				}
			}
			cout << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<bitset>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<vector>
using namespace std;
const int MAXN=200000;
int n,m;
bitset<MAXN+10> a,b;
int main()
{
	scanf("%d%d",&n,&m);
	for(int i=1,u,v;i<=m;++i)
	{
		scanf("%d%d",&u,&v);
		if(u>v)swap(u,v);
		if(u==1)a.set(v);
		else if(v==n)b.set(u);
	}
	if((a&b)==0)puts("IMPOSSIBLE");
	else puts("POSSIBLE");
	return 0;
}

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

#define bug(...)                                  __f (#__VA_ARGS__, __VA_ARGS__)
#define rtn                                       if(0)return;
template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { rtn cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{   rtn
    const char* comma = strchr (names + 1, ',');
    cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

const int N = 3e6 + 7, M = 998244353, inf = INT_MAX;
const long long INF = LLONG_MAX;

int arr[N], pos[N], n, k, dp[N];
inline int mul(int a, int b) { return (1ll * a * b) % M; };
inline int add(int a, int b)
{
    if ( a + b < 0 ) return a + b + M;
    if ( a + b >= M) return a + b - M;
    return a + b;
}

void solve()
{
    cin >> n >> k;
    vector<pii> vec;
    lop(i, 0, k)
    {
        int l, r;
        cin >> l >> r;
        vec.pb({l, r});
    }

    sort(all(vec));

    dp[1] = 1;
    lop(i, 2, n + 1)
    {

        lop(j, 0, k)
        {
            int l = i - vec[j].ss, r = i - vec[j].ff;
            // bug(vec[j].ss, vec[j].ff);
            // bug(i, l, r );
            if ( l < 1 ) l = 1;
            if ( r < 1 ) r = 0;
            dp[i] = add(dp[i], add(dp[r], -dp[l - 1]));
        }
        if ( i == n ) cout << dp[n] << endl;
        else dp[i] = add(dp[i], dp[i - 1]);
    }

}

int32_t main()
{
    ios_base::sync_with_stdio(0);   cin.tie(0);   cout.tie(0);

    int test = 1;
    // cin >> test;
    while (test--)solve();


}





















Measured memory_bytes: 5208
#include <iostream>
#include <stdio.h>
using namespace std;

int main(){
    char ch;
    while(1){
        scanf("%c", &ch);

        if ('a' <= ch && ch <= 'z'){
            ch = ch - 32;

        }else if ('A' <= ch && ch <= 'Z'){
            ch = ch + 32;
        }
        printf("%c",ch);


        if ( ch == '\n' ) break;
    }
}



Measured memory_bytes: 3136
#include <iostream>
using namespace std;
int main(void){
  int n;
  cin>>n;
  while(n--){
    int ans=1;
    for(int i=0,a,p=0,q=0;i<10;++i){
      cin>>a;
      if(ans){
	      if(p>=a&&q>=a) ans=0;
	      else{
	      	if(p>q) (p<a)?p=a:q=a;
	      	else (q<a)?q=a:p=a;
	      }
      }
    }
    cout<<(ans?"YES":"NO")<<endl;
  }
  return 0;
}

Measured memory_bytes: 1152
#include<cstdio>
#include<algorithm>
#include<queue>
#include<cmath>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, P> Q;

ll n;
double x[100], y[100], z[100], r[100];

double square(double x) { return x * x; }

class UF {
  ll par[100];
public:
  UF() {
    for (ll i = 0; i < n; i++) par[i] = i;
  }
  ll find(ll x) {
    if (x != par[x]) par[x] = find(par[x]);
    return par[x];
  }
  void merge(ll x, ll y) {
    x = find(x), y = find(y);
    par[x] = y;
  }
  bool same(ll x, ll y) { return find(x) == find(y); }
};

int main() {
  while (scanf("%lld", &n), n) {
    for (ll i = 0; i < n; i++) scanf("%lf%lf%lf%lf", &x[i], &y[i], &z[i], &r[i]);
    priority_queue<Q, vector<Q>, greater<Q>> pq;
    for (ll i = 0; i < n; i++) for (ll j = i+1; j < n; j++) {
      double temp = sqrt(square(x[i]-x[j]) + square(y[i]-y[j]) + square(z[i]-z[j])) - r[i] - r[j];
      pq.push(Q(max(0.0, temp), P(i, j)));
    }
    UF uf;
    double ans = 0.0;
    while (!pq.empty()) {
      Q p = pq.top(); pq.pop();
      ll i = p.second.first, j = p.second.second;
      double c = p.first;
      if (uf.same(i, j)) continue;
      uf.merge(i, j);
      ans += c;
    }
    printf("%.3lf\n", ans);
  }
}


Measured memory_bytes: 2816
N = int(input())
X = list(int(i) for i in input().split())
Y = [int(i) for i in X]

X.sort()

for i in range(N):
    if Y[i] <= X[int(N/2) - 1]:
        print("%d" % X[int(N/2)])
    else:
        print("%d" % X[int(N/2) - 1])

Measured memory_bytes: 26016
#include "bits/stdc++.h"
using namespace std;

#define ASC(vec) vec.begin(), vec.end()		// 昇順ソート 例：sort(ASC(vec));
#define DESC(vec) vec.rbegin(), vec.rend()	// 降順ソート 例:sort(DESC(vec));
#define rep(i, n) for(i = 0; i < n; i++)

const int inf = (int)1e9 + 7;
const long long INF = 1LL << 60;

typedef long long ll;

// 4,8方向に探索する際に用いる配列
//int dx[4] = { 0,  0, 1, -1 };
//int dy[4] = { 1, -1, 0,  0 };
//int dx[8] = { 1, 0, -1,  0, 1, -1, -1,  1 };
//int dy[8] = { 0, 1,  0, -1, 1,  1, -1, -1 };

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

	if (N % 2 == 0)
	{
		cout << N << endl;
	}
	else
	{
		cout << N * 2 << endl;
	}
}


Measured memory_bytes: 256
N, M = map(int, input().split())
H = list(map(int, input().split()))
flag = [False for i in range(N)]

count = N
for i in range(M):
    a, b = map(int, input().split())
    if H[a - 1] <= H[b - 1] and flag[a - 1] is False:
        flag[a - 1] = True
        count -= 1
    if H[a - 1] >= H[b - 1] and flag[b - 1] is False:
        flag[b - 1] = True
        count -= 1

print(count)


Measured memory_bytes: 20124
#include <stdio.h>
//using namespace std;

void trace(int A[], int N) {
  int i;
  for( i = 0; i < N; i++) {
    if(i > 0) printf(" ");
    printf("%d", A[i]);
  }
  printf("\n");
}

void insertionSort(int A[], int N) {
  int j, i, v;
  for(i = 1; i < N; i++) {
    v = A[i];
    j = i - 1;
    while(j >= 0 && A[j] > v) {
      A[j+1] = A[j];
      j--;
    }
    A[j+1] = v;
    trace(A, N);
  }
}

int main() {
  int N, i, j;
  int A[100];

  scanf("%d", &N);
  for(int i = 0; i < N; i++) scanf("%d", &A[i]);
  trace(A, N);
  insertionSort(A, N);
  return 0;
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
using namespace std;
int main () {
  int N, M;
  cin >> N >> M;
  vector<int> data(M, 0);
  int a, b;
  for(int i = 0; i < N; i++) {
    cin >> a;
    for(int j = 0; j < a; j++) {
      cin >> b;
      data.at(b - 1)++;
    }
  }
  cout << count(data.begin(), data.end(), N) << 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++)
#define repr(i, n) for (int i = (int)(n); i >= 0; i--)
#define REP(i, m, n) for (int i = (int)(m); i <= (int)(n); i++)
#define all(v) v.begin(), v.end()
typedef long long ll;

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

const long long INF = 1LL << 60;

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

  cout << ((s[0]==s[1] && s[1]==s[2]) || (s[1]==s[2] && s[2]==s[3]) ? "Yes" : "No") << endl;

  return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(x) ((int)(x).size())
#define ALL(x) (x).begin(),(x).end()
#ifdef _DEBUG_
	#define debug(...) printf(__VA_ARGS__)
#else
	#define debug(...) (void)0
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> PII;
typedef vector<int> VI;

int ans[10];
set<PII> st;

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

int main() {
	int h, w, n;
	scanf("%d%d%d", &h, &w, &n);
	for(int i = 0; i < n; i++) {
		int x, y;
		scanf("%d%d", &x, &y);
		st.insert(MP(x, y));
	}
	for(auto it = st.begin(); it != st.end(); it++) {
		int x = it->F, y = it->S;
		for(int j = 0; j < 9; j++) {
			int tx = x+dx[j], ty = y+dy[j], tmp = 0;
			if(tx <= 1 || tx >= h || ty <= 1 || ty >= w)
				continue;
			for(int k = 0; k < 9; k++)
				if(st.find(MP(tx+dx[k], ty+dy[k])) != st.end())
					tmp++;
			assert(tmp > 0);
			ans[tmp]++;
		}
	}
	
	ll zero = 1ll*(h-2)*(w-2);
	for(int i = 1; i <= 9; i++) {
		assert(ans[i]%i == 0);
		ans[i] /= i;
		zero -= ans[i];
	}
	printf("%lld\n", zero);
	for(int i = 1; i <= 9; i++)
		printf("%d\n", ans[i]);
	return 0;
}


Measured memory_bytes: 4992
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
#define dbg(x...) do { cout << "\033[32;1m" << #x <<" -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<class T, class... Ts> void err(const T& arg,const Ts&... args) { cout << arg << " "; err(args...); }
const int N = 100 + 5;
const int maxp = 105;
typedef double db;
const db eps = 1e-8;
const db pi = acos(-1.0);
int sgn(db x){
    if(fabs(x) < eps) return 0;
    if(x < 0) return -1;
    return 1;
}
struct Point{
    db x, y;
    Point(){}
    Point(db x, db y):x(x), y(y){}
    void input(){
        //如果为longdouble则需要改为Lf
        scanf("%lf%lf",&x, &y);
    }
    Point operator - (const Point &b)const{
        return Point(x - b.x, y - b.y);
    }
    //叉积
    db operator ^ (const Point &b)const{
        return x * b.y - y * b.x;
    }
    //点积
    db operator * (const Point &b)const{
        return x * b.x + y * b.y;
    }
};
struct Line{
    Point s, e;
    Line(){}
    Line(Point s, Point e):s(s),e(e){}
    /*
        求两直线的交点
        要保证两直线不平行或重合
    */
    Point crosspoint(Line v){
        db a1 = (v.e - v.s) ^ (s - v.s);
        db a2 = (v.e - v.s) ^ (e - v.s);
        return Point((s.x * a2 - e.x * a1) / (a2 - a1), (s.y * a2 - e.y * a1) / (a2 - a1));
    }
};
// 多边形
struct polygon{
    int n;
    Point p[maxp];
    Line l[maxp];
    polygon(vector<Point> &ps){
        n = ps.size();
        for(int i=0;i<n;i++)p[i] = ps[i];
    }
    void input(int n){
        this->n=n;
        for(int i=0;i<n;i++) p[i].input();
    }
    // 得到面积
    db getarea(){
        db sum = 0;
        // 以原点为划分点
        for(int i=0;i<n;i++){
            sum += (p[i]^p[(i+1)%n]);
        }
        return fabs(sum)/2;
    }
};
vector<Point> ps;
vector<Point> convexCut(const vector<Point> &ps, Point q1, Point q2){
    vector<Point> qs;
    int n = ps.size();
    for(int i=0;i<n;i++){
        Point p1 = ps[i], p2 = ps[(i+1)%n];
        int d1 = sgn((q2-q1)^(p1-q1)), d2 = sgn((q2-q1)^(p2-q1));
        if(d1 >= 0){
            qs.push_back(p1);
        }
        if(d1 * d2 < 0)
            qs.push_back(Line(p1, p2).crosspoint(Line(q1,q2)));
    }
    return qs;
}
int main(){
    int n;
    scanf("%d", &n);
    Point p;
    for(int i=1;i<=n;i++){
        p.input();
        ps.push_back(p);
    }
    int m;scanf("%d", &m);
    while(m--){
        Point q1, q2;
        q1.input();
        q2.input();
        vector<Point> qs = convexCut(ps, q1, q2);
        printf("%.6f\n", polygon(qs).getarea());
    }

    return 0;
}


Measured memory_bytes: 3256
n = int(input())
t = [list(map(int,input().split())) for _ in range(n)]
ans = [1,1]
for t_ in t:
    k = max(ans[0]//t_[0]+min(ans[0]%t_[0],1),ans[1]//t_[1]+min(ans[1]%t_[1],1))
    ans[0] = t_[0]*k
    ans[1] = t_[1]*k
print(sum(ans))

Measured memory_bytes: 3188
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define UNIQUE(v) v.erase(unique(all(v)), v.end());
#define ZIP(v) sort(all(v)),UNIQUE(v)
#define ADD(a, b) a = (a + b) % mod
#define SUB(a, b) a = (a+mod-b)%mod
#define MUL(a, b) a = (a * b) % mod
#define repi(i,m,n) for(int i = m;i < n;i++)
#define drep(i,n,m) for(int i = n;i >= m;i--)
#define rep(i,n) repi(i,0,n)
#define rrep(i,n) repi(i,1,n+1)
#define chmin(x,y) x = min(x,y)
#define chmax(x,y) x = max(x,y)
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(), v.rend()
#define dmp(x,y) make_pair(x,y)
#define pb(x) push_back(x)
#define fi first
#define se second
typedef pair<int,int> P;
typedef pair<int, P> PP;
typedef vector<int> vi;
typedef deque<int> dq;
const int inf = 1e9+7;
const int INF = 1e18+7;

vector<P> vs;
vector<int> v;
int f[400000];
signed main(){
	int n, m;
	scanf("%lld%lld", &n, &m);
	rep(i,m){
		int x, y;
		scanf("%lld%lld", &x, &y);
		vs.push_back(P(x, i+m));
		vs.push_back(P(y, i));
	}
	sort(all(vs));
	
	int s = 0, ans = 0;
	rep(i,2*m){
		P p = vs[i];
		if(p.se >= m){
			v.pb(p.se-m);
			//if(p.se == 8-1)printf("*%lld* \n", p.fi);
		}else{
			if(f[p.se] == 1)continue;
			rep(j,v.size()){f[v[j]] = 1;}
			v.clear();
			ans++;
		}
	}
	printf("%lld\n", ans);
	return 0;
}






Measured memory_bytes: 6384
import math

a, b, x = map(int, input().split())
g = b * a * a
if x > (g / 2):
    d = math.atan(2 * (g - x)/ a**3)
    print(math.degrees(d))
else:
    d = math.atan(2 * x /(a * b * b))
    print(90 - math.degrees(d))


Measured memory_bytes: 3060
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author LUCIANO.
 */
import java.util.*;

public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        Scanner in = new Scanner(System.in);
        int x = in.nextInt();
        int y = in.nextInt();
        int z = in.nextInt();
        System.out.println(z + " " + x + " " + y);
    }
}

Measured memory_bytes: 21844
#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <queue>
#include <map>
#include <string.h>
#include <math.h>
#include <stdio.h>
#include <deque>
#include <bits/stdc++.h>
//#include "testlib.h"
using namespace std;
#define ll long long
#define pii pair<int,int>
#define qi ios::sync_with_stdio(0)

bool debug=true;

/*    *************************************
	  * Written in New Computer           *
	  * The following code belongs to     *
	  * XiaoGeNintendo of HellHoleStudios *
	  *************************************
*/
template<typename T1,typename T2>ostream& operator<<(ostream& os,pair<T1,T2> ptt){
	os<<ptt.first<<","<<ptt.second;
	return os;
}
template<typename T>ostream& operator<<(ostream& os,vector<T> vt){
	os<<"{";
	for(int i=0;i<vt.size();i++){
		os<<vt[i]<<" ";
	}
	os<<"}";
	return os;
}


string a,b,c;

bool badab[100005],badbc[100005],badac[100005];
const int S=5000;

inline bool ok(char a,char b){
	if(a=='?' || b=='?'){
		return true;
	}
	return a==b;
}

int main(int argc,char* argv[]){
	qi;
	cin>>a>>b>>c;
	
	ll fucka=a.size();
	ll fuckb=b.size();
	ll fuckc=c.size();
	for(int i=0;i<a.size();i++){
		for(int j=0;j<b.size();j++){
			if(!ok(a[i],b[j])){
				badab[i-j+S]=true;
			}
		}
	}
	
	for(int i=0;i<a.size();i++){
		for(int j=0;j<c.size();j++){
			if(!ok(a[i],c[j])){
				badac[i-j+S]=true;
			}
		}
	}
	
	for(int i=0;i<b.size();i++){
		for(int j=0;j<c.size();j++){
			if(!ok(b[i],c[j])){
				badbc[i-j+S]=true;
			}
		}
	}
	
	ll ans=1e9;
	for(int i=-S;i<=S;i++){
		for(int j=-S;j<=S;j++){
			if(badab[i+S] || badac[j+S] || badbc[j-i+S]){
				
			}else{
				
				ll somevar=max(fucka,max(i+fuckb,j+fuckc))-min(0,min(i,j));
//				if(somevar==3){
//					cout<<i<<" "<<j<<" "<<max(a.size(),max(i+b.size(),j+c.size()))<<" "<<min(0,min(i,j))<<endl;
//				}
				ans=min(ans,somevar);
			}
		}
	}
	
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 384
import sys

input = sys.stdin.readline

N = int(input().strip())
As = list(map(int, input().strip().split(' ')))


xs = [0] * N
xs[0] = sum(As[0::2]) - sum(As[1::2])
for n in range(1, N):
    xs[n] = As[n-1] * 2 - xs[n - 1]
print(" ".join(map(str, xs)))

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

string id(int p, int y){
  string ps = to_string(p);
  string ys = to_string(y);
  if(ps.size() < 6) ps = string("000000",6 - ps.size()) + ps;
  if(ys.size() < 6) ys = string("000000",6 - ys.size()) + ys;
  return ps + ys;
}

int main(){
  int n, m; cin >> n >> m;
  vector<tuple<int, int, int>> v(m);
  map<int, vector<int>> mp;

  for(int i = 0; i < m; ++i){
    int a,b; cin >> a >> b;
    v[i] = make_tuple(i, a, b);
    mp[a].push_back(b);
  }

  for(int i = 1; i <= n; ++i)
    if(mp.count(i) != 0) sort(mp[i].begin(), mp[i].end());

  for(int i = 0; i < m; ++i){
    int p = get<1>(v[i]);
    int y = get<2>(v[i]);
    int x = lower_bound(mp[p].begin(), mp[p].end(), y) - mp[p].begin();
    x++;
    cout << id(p, x) << endl;
  }
  return 0;
}


Measured memory_bytes: 13568
#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>
#include <string>
#include <cmath>
#include <map>
#include <queue>
#include <set>

using namespace std;

const long long mod = 1e9 + 7;

long long N;
long long C[200005];
long long last[200005];
long long num[200005];
long long acc[200005];

int main()
{
    cin >> N;
    num[0] = 1;
    C[0] = -1;
    for (long long i = 1; i <= N; i++)
    {
        cin >> C[i];
        long long lpos = last[C[i]];
        num[i] = num[i - 1];
        if (lpos != 0 && C[i] != C[i - 1])
        {
            acc[C[i]] += num[lpos - 1];
            acc[C[i]] %= mod;
            num[i] += acc[C[i]];
            num[i] %= mod;
        }
        if (C[i] != C[i - 1])
        {
            last[C[i]] = i;
        }
    }
    cout << num[N] << endl;
    return 0;
}


Measured memory_bytes: 6528
#include <bits/stdc++.h>
using namespace std;
int main(){
  int n; cin >>n;
  if(n%10==3) cout <<"bon";
  else if(n%10==0||n%10==1||n%10==6||n%10==8) cout <<"pon";
  else cout <<"hon";
return 0;}

Measured memory_bytes: 3596
#include "bits/stdc++.h"
using namespace std;
#ifdef _DEBUG
#include "dump.hpp"
#else
#define dump(...)
#endif

//#define int long long
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)
const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)(1e9 + 7);
template<class T> bool chmax(T &a, const T &b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T &a, const T &b) { if (a > b) { a = b; return true; } return false; }

// v[i] <= x <= v[j] ????????? (i<=j)
// O(N) STL ?????????
int stable_partition(vector<int> &v, int l, int r, int x) {
	int i = l;
	for (int j = l; j < r; j++) {
		if (v[j] <= x) {
			swap(v[i], v[j]);
			i++;
		}
	}
	return i - 1;
}

signed main() {
	int n; cin >> n;
	vector<int> v(n); rep(i, 0, n) { cin >> v[i]; }
	int b = stable_partition(v, 0, n, v[n - 1]);
	dump(b);
	cout << v[0]; rep(i, 1, v.size()) {
		if (b == i)cout << " [" << v[i] << "]";
		else cout << " " << v[i];
	} cout << endl;
	return 0;
}

Measured memory_bytes: 3124
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True # and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

import heapq
BIGDI = 10**18

# N nodes  M arcs  go from S to T (node# starts from 1)
n = inn()
dst = [{} for i in range(n+1)]
for i in range(n-1):
    u,v,a = inm()
    dst[u][v] = a
    dst[v][u] = a

qq,k = inm()

cost = [BIGDI]*(n+1)
q = [(0,k)]
while len(q)>0:
    d,p = heapq.heappop(q)
    if cost[p]<=d:
        continue
    cost[p] = d
    for v in dst[p]:
        heapq.heappush(q,(d+dst[p][v], v))

# cost[t-1] is the answer

for q in range(qq):
    x,y = inm()
    print(cost[x]+cost[y])


Measured memory_bytes: 117536
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL

int main() {
	ll		a,b,c,h,i,j,k,l,m,n,x,y;
	ll		ans = 0;
	string	s;
	cin >> n;
	vector<ll>	aa(n);
	for(i=0;i<n;i++) cin >> aa[i];

	sort(aa.begin(),aa.end());
	reverse(aa.begin(),aa.end());

	a = b = 0;
	for(i=0;i<n;i++) {
		if (i%2==0) {
			a += aa[i];
		} else {
			b += aa[i];
		}
	}
	cout << a-b << endl;
	return 0;
}


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

int main()
{
	int t;
	cin>>t;
	int ac = 0, wa = 0, tle = 0, re = 0;
	while(t--){
		string s;
		cin>>s;
		if(s=="AC"){
			ac++;
		}
		if(s=="RE"){
			re++;
		}
		if(s=="TLE"){
			tle++;
		}
		if(s=="WA"){
			wa++;
		}
	}
	printf("AC x %d\nWA x %d\nTLE x %d\nRE x %d\n", ac, wa, tle, re);
}

Measured memory_bytes: 3724
#pragma GCC optimize("Ofast",3,"inline")
#include<bits/stdc++.h>
using namespace std;
long long n,a,b; 
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
//	freopen(".in","r",stdin);
//	freopen(".out","w",stdout);
	cin>>n>>a>>b;
	if(((b-a)&1)==0)
		cout<<((b-a)/2);
	else{
		long long num1=a;
		b-=a;
		num1+=(b-1)/2;
		b+=a;
		long long num2=n-b+1;
		a+=n-b+1;
		num2+=(n-a)/2;
		a-=n-b+1;
		cout<<min(min(num1,num2),min(b-1,n-a));
	}	
	return 0;
}


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

#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

using namespace std;
typedef long long ll;

int main()
{
    IOS

    int n;
    cin >> n;

    vector<int> dp(n), numeros(n);

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

    dp[0] = 0;
    dp[1] = abs( numeros[1] - numeros[0] );

    for ( int i = 2; i < n; ++i )
    {
        dp[i] = min( ( dp[i-1] + abs( numeros[i] - numeros[i-1] ) ),
                     ( dp[i-2] + abs( numeros[i] - numeros[i-2] ) ) );
    }

    cout << dp[n-1];

    return 0;
}


Measured memory_bytes: 1024
A = ['a','s','d','f','g','h','j','k','l','z','x','c','v','b','n','m','q','w','e','r','t','y','u','i','o','p']
S = list(set(input()))
for i in S:
    A.remove(i)
A.sort()
try:
    print(A[0])
except:
    print("None")

Measured memory_bytes: 3188
from itertools import cycle
while 1:
    n = input()
    if not n:
        break
    A = map(int, raw_input().split())

    rest = 32
    for a in cycle(A):
        rest -= (rest + 4) % 5
        print rest
        rest -= a
        print max(rest, 0)
        if rest <= 0:
            break

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

int main() {

	int n, k;
	cin >> n >> k;

	int s[11] = { 0 };

	int minValue = 1024;
	int u = 0;
	while (1) {

		// calc
		int value = 1;
		for (int i = 0; i < n; i++) {
			if (s[i] == 0) {
				value *= 2;
			}
			else if (s[i] == 1) {
				value += k;
			}
		}

		for (int i = 0; i < n+1; i++) {
			if (i == 0) {
				u = 1;
			}

			s[i] += u;
			if (s[i] == 2) {
				s[i] = 0;
				u = 1;
			}
			else {
				u = 0;
			}
		}

		if (value < minValue) {
			minValue = value;
		}

		if (s[n] == 1) {
			break;
		}
	}
	cout << minValue << endl;
}


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

public class hello
{
    public static void Main()
    {
        while (true)
        {
            var s = Console.ReadLine();
            if (s == null) break;
            string[] line = s.Trim().Split(' ');
            var n = int.Parse(line[0]);
            var cmax = int.Parse(line[1]);
            var a1 = new int[n + 1];
            var a2 = new int[n + 1];
            var a3 = new int[n + 1];
            var c = new int[n + 1];
            readData(c, a1, a2, a3);
            var ans = new int[3];
            ans[0] = goDp(a1, c, cmax, n);
            ans[1] = goDp(a2, c, cmax, n);
            ans[2] = goDp(a3, c, cmax, n);
            Console.WriteLine(ans.Max());
        }
    }
    public static int goDp(int[] a, int[] c, int cmax, int n)
    {
        var dp = new int[n + 1, cmax + 1];
        for (int i = 0; i < n; i++)
            for (int j = 0; j <= cmax; j++)
                if (j < c[i]) dp[i + 1, j] = dp[i, j];
                else dp[i + 1, j] = Math.Max(dp[i, j], dp[i + 1, j - c[i]] + a[i]);
        return dp[n, cmax];
    }
    public static void readData(int[] c, int[] a1, int[] a2, int[] a3)
    {
        for (int i = 0; i < c.Length - 1; i++)
        {
            Console.ReadLine();
            string[] line = Console.ReadLine().Trim().Split(' ');
            c[i] = int.Parse(line[0]);
            a1[i] = int.Parse(line[1]);
            a2[i] = int.Parse(line[2]);
            a3[i] = int.Parse(line[3]);
        }
    }
}


Measured memory_bytes: 36940
#include<bits/stdc++.h>
#ifdef LOCAL
#include "lib/debug.hpp"
#else
#define debug(...) 1
#endif
#define ALL(a) (a).begin(), (a).end()
#define rep(i, n) REP(i, 0, (n))
#define repc(i, n) REPC(i, 0, (n))
#define REP(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define REPC(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define REPCM(i, n, m) for (int i = (int)(n); i >= (int)(m); i--)
using namespace std;
using ll = int_fast64_t;
using pr = pair<ll, ll>;
using vll = vector<ll>;
using vpr = vector<pr>;
template<class T> inline bool chmin(T& a, const T& b) { if (a > b) { a = b; return true; } else return false; }
template<class T> inline bool chmax(T& a, const T& b) { if (a < b) { a = b; return true; } else return false; }
struct mint {
  ll divisor = 1000000007;
  ll val;
  constexpr mint(ll v = 0) noexcept : val(v % divisor) {
    if (val < 0) val += divisor;
  }
  constexpr mint operator + (const mint& rhs) const noexcept {
    return mint(*this) += rhs;
  }
  constexpr mint operator - (const mint& rhs) const noexcept {
    return mint(*this) -= rhs;
  }
  constexpr mint operator * (const mint& rhs) const noexcept {
    return mint(*this) *= rhs;
  }
  constexpr mint operator / (const mint& rhs) const noexcept {
    return mint(*this) /= rhs;
  }
  constexpr mint operator ~ () const noexcept {
    ll a = this->val, b = divisor, u = 1, v = 0;
    while (b > 0) {
      ll t = a / b;
      a -= t * b;
      u -= t * v;
      ll c = a; a = b; b = c;
      ll w = u; u = v; v = w;
    }
    if (u < 0) u += divisor;
    u %= divisor;
    return u;
  }
  constexpr mint& operator += (const mint& rhs) noexcept {
    val += rhs.val;
    if (val >= divisor) val -= divisor;
    return *this;
  }
  constexpr mint& operator -= (const mint& rhs) noexcept {
    if (val < rhs.val) val += divisor;
    val -= rhs.val;
    return *this;
  }
  constexpr mint& operator *= (const mint& rhs) noexcept {
    val = val * rhs.val % divisor;
    return *this;
  }
  constexpr mint& operator /= (const mint& rhs) noexcept {
    val = val * (~(mint(rhs))).val % divisor;
    return *this;
  }
  friend mint modpow (mint a, ll n) noexcept {
    auto res = mint(1);
    while(n > 0) {
      if(n&1) res *= a;
      a *= a;
      n >>= 1;
    }
    return res;
  }
  friend std::ostream& operator << (std::ostream& os, const mint& a) noexcept {
    return os << a.val;
  }
};

void answer() {
  int h, w;
  cin >> h >> w;
  vector<vector<bool> > wall(h, vector<bool>(w, false));
  rep(i, h) {
    string s; cin >> s;
    rep(j, w) {
      if(s[j] == '#') wall[i][j] = true;
    }
  }
  vector<vector<mint> > dp(h+1, vector<mint>(w+1, 0));
  dp[0][1] = 1;
  rep(i, h) rep(j, w) {
    if(wall[i][j]) dp[i+1][j+1] = 0;
    else dp[i+1][j+1] = dp[i][j+1] + dp[i+1][j];
  }
  cout << dp[h][w] << "\n";
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  answer();
  return 0;
}

Measured memory_bytes: 18980
import java.util.*;
import java.io.*;
import java.lang.*;

public class Main {
	public static void main (String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextLine().length();
		sc.close();
		for (int i = 0; i<n; i++) {
			System.out.print("x");
		}
	}
}


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

int main(void){

    int n; cin >> n;
    string s; cin >> s;
    string t = s;
    int num = 0;
    for(int i = 0; i < n; i++){
        if(s[i] == '(') num++;
        else num--;

        if(num == -1){
            t = "(" + t;
            num++;
        }
    }

    if(num > 0){
        for(int i = 0; i < num; i++){
            t = t + ")";
        }
    }

    cout << t << endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <math.h>
#include<bitset>
#include<stdio.h>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
const int INF = 100000000;

bool isOK(int a[],int index,int key){
    if(a[index] >= key){
        return true;
    }else{
        return false;
    }
}

int binary_search(int a[],int n,int key){
    int left = -1;
    int right = n;

    while(right-left>1){
        int mid = left + (right - left)/2;
        if(isOK(a,mid,key)){
            right = mid;
        }else{
            left = mid;
        }
    }
    return right;
}

int factrial(int n){
    if(n==0){
        return 1;
    }else{
        return n*factrial(n-1);
    }
}

int main(void){
    int a,b,c,k;
    cin >> a >> b >> c >> k;
    long long ans=0;

    for(int i=0;i<a;++i){
        if(k==0){
            break;
        }
        ans++;
        k--;
    }

    for(int i=0;i<b;++i){
        if(k==0){
            break;
        }
        k--;
    }

    for(int i=0;i<c;++i){
        if(k==0){
            break;
        }
        ans--;
        k--;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3604
#include<iostream>
#include<cstdio>
#include<cstring>
#define maxn 400
#define inf 1000000000

using namespace std;

struct node
{
    int st,en;
}old[maxn*maxn];

int t,n,m,source,sink,ans;
int c[maxn][maxn];
int pre[maxn];
bool vs[maxn];

void init()
{
    scanf("%d%d",&n,&m);
    memset(c,0,sizeof(c));
    memset(old,0,sizeof(old));
    for(int i=1;i<=m;i++)
    {
        int a,b;
        scanf("%d%d",&a,&b);
        c[a][b]=c[b][a]=1;
        old[i].st=a;
        old[i].en=b;
    }
    scanf("%d%d",&source,&sink);
}

int find()
{
    memset(vs,0,sizeof(vs));
    memset(pre,0,sizeof(pre));
    int zhan[maxn];
    int head=0,tail=1;
    zhan[tail]=source; vs[zhan[1]]=true;
    while(head!=tail)
    {
        int now=zhan[++head];
        for(int i=1;i<=n;i++)
          if(!vs[i] && c[now][i]>0)
          {
              zhan[++tail]=i;
              vs[i]=true;
              pre[i]=now;
              if(i==sink) return 1;
          }
    }
    return 0;
}

void sug()
{
    int now=sink , minflow=inf;
    while(now!=source)
    {
        if(c[pre[now]][now]<minflow) minflow=c[pre[now]][now];
        now=pre[now];
    }
    ans+=minflow;
    now=sink;
    while(now!=source)
    {
        c[pre[now]][now]-=minflow;
        c[now][pre[now]]+=minflow;
        now=pre[now];
    }
}

int main()
{
        init();
        ans=0;
        while(find())
        {
            sug();
        }
        printf("%d\n",ans);
        int tot=0;
        int change[maxn];
        memset(change,0,sizeof(change));
        for(int i=1;i<=m;i++)
        {
            int st=old[i].st,en=old[i].en;
            if(c[en][st]==0) change[++tot]=i;
        }
        printf("%d\n",tot);
        for(int i=1;i<=tot;i++)
            printf("%d\n",change[i]);
    return 0;
}

Measured memory_bytes: 0
#include <stdio.h>

int main (void){

	char s[100000];
	scanf("%s",s);

	int count = 0;
	int i;

	for(i = 0; s[i] != '\0'; i++){

		if(s[i] != s[i + 1]){
			count++;
		}
	}

	printf("%d\n", count - 1);

	return 0;


}

Measured memory_bytes: 256
using System;

class Program
    {
        static void Main(string[] args)
        {
            long money = 100;
            long X = long.Parse(Console.ReadLine());

            int year = 0;
            while (money < X)
            {
                year++;
                money = (long)(money * 1.01);
            }
            Console.WriteLine(year);
        }
    }

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

int main() {
    string s;
    map<char, bool> mp;

    cin >> s;

    int size_ = s.size();
    for (int i = 0; i < size_; ++i) {
        mp[s[i]] = true;
    }

    for (int i = 0; i < 26; ++i) {
        if (!mp['a' + i]) {
            cout << char('a' + i) << endl;
            return 0;
        }
    }

    cout << "None" << endl;

    return 0;
}

Measured memory_bytes: 512
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <time.h>
#include <vector>
#include <set>
#include <map>
#include <algorithm>
#include <queue>
using namespace std;
char s[15][15];
int wayx[10]={-1,0,1,0};
int wayy[10]={0,1,0,-1};
char ss[10]="URDL";
int ck(char c)
{
    for (int i=0;i<4;i++)
        if (ss[i]==c) return i;
    return -1;
}
char p[100];
int n,m;
bool dfs(int x,int y,int id,int now,int ee)
{
    if (now==ee)
    {
        p[ee]=0;
        puts(p);
        return true;
    }
    for (int i=0;i<4;i++)
    {
        if (abs(i-id)==2) continue;
        int xx=x+wayx[i],yy=y+wayy[i];
        bool sol=false;
        while (xx>=0&&xx<n&&yy>=0&&yy<m)
        {
            if (s[xx][yy]=='o')
            {
                p[now]=ss[i];
                sol=true;
                s[x][y]='.';
                if (dfs(xx,yy,i,now+1,ee)) return true;
                s[x][y]='o';
                break;
            }
            xx+=wayx[i];
            yy+=wayy[i];
        }
    }
    return false;
}
int main()
{
    scanf("%d%d",&n,&m);
    for (int i=0;i<n;i++)
        scanf("%s",s[i]);
    int num=0,sx,sy,id;
    for (int i=0;i<n;i++)
        for (int j=0;j<m;j++)
        {
            if (s[i][j]=='o') num++;
            else if (s[i][j]!='.')
            {
                id=ck(s[i][j]);
                s[i][j]='o';
                sx=i;
                sy=j;
            }
        }
    dfs(sx,sy,id,0,num);
    return 0;
}

Measured memory_bytes: 1012
#include<bits/stdc++.h>
using namespace std;
int main() {
	long long a,b;
	cin>>a>>b;
	if(a==b||(a>b&&a%b==0)||b==1){
		cout<<-1<<endl;
		return 0;
	}
	long long c=__gcd(a,b);
	cout<<a<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < n; i++)
#define repp(i, m, n) for(int i = m; i < n; i++)
#define reps(i, n) for(int i = 1; i <= n; i++)
const int    INF = 100000000;
const double EPS = 1e-10;
const int    MOD = 1000000007;
using namespace std;
typedef long long ll;
typedef pair<int, int> pai;
typedef pair<ll,ll> pal;



int main()
{
	string s;
	cin >> s;
	int n=s.size()-8;
	rep(i, n) cout << s[i];
	cout << endl;
	return 0;
}

Measured memory_bytes: 256
s = gets.chomp.to_i
arr = Array.new

arr.push(s)

while true
    if s % 2 == 0
        s = s / 2
    else
        s = 3 * s + 1
    end
    
    if arr.include?(s)
        arr.push(s)
        break
    end
    arr.push(s)
end

puts arr.size

Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
#define REP(i,N) for(i=0;i<N;i++)
#define INF 1e9
typedef long long ll;
typedef pair<int, int> P;
typedef struct{
  int first;
  int second;
  int third;
}T;

//昇順
bool comp_Se(T& l, T& r){
  return l.second < r.second;
}

int N,Q;
string S;
vector<int> point;

//s:mode1 e:mode0
int b_search(int l,int r,int key,int mode){
  int mid = (l+r)/2;
  if(r-l<=1)return l;
  if(point[mid] < key)return b_search(mid,r,key,mode);
  else if(point[mid]>key) return b_search(l,mid,key,mode);
  else return mid-mode;
}

int main(void){
  cin >> N >> Q;
  cin >> S;
  int i;
  point.push_back(-1);
  REP(i,S.length()-1){
    if(S.substr(i,2) == "AC") point.push_back(i+1);
  }
  point.push_back(INF);
  REP(i,Q){
    int s,e;
    cin >> s >> e;
    cout << b_search(0,point.size()-1,e-1,0) - b_search(0,point.size()-1,s,1) << endl;
  }
  return 0;
}


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

int main() {
  int i,N;
  cin >> N;
  
  for(i=0;i<N;i++){
    string S;
    cin >> S;
    if (S =="Y") {
      cout << "Four" << endl;
      break;
    }
    if (i==N-1) {
      if (S =="Y") 
        cout << "Four" << endl;
      else
        cout << "Three" << endl;
  }
}
}
  
    

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define YES cout<<"YES"<<endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl
#define ANS cout << ans << endl
#define all(a) a.begin(),a.end()
#define SORT(a) sort(all(a))
#define REVERSE(a) reverse(all(a))
#define int long long
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define VIin(a) for(int i=0; i<a.size(); i++) cin >> a[i]
#define OUT(a) cout << a << endl
typedef vector<int> VI;
typedef vector<VI> VVI;
const int MOD=1e9+7;
const long long INF = 1LL << 60;
/*最大公約数*/int gcd(int x, int y) { return y ? gcd(y,x%y) : x;}
/*最小公倍数*/int lcm(int a, int b) { int g = gcd(a, b); return a / g * b; }
/*素数判定*/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;}
/*約数列挙*/vector<int> getDivisor(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(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    int n; cin >> n;
    OUT((1+(n-1)/111)*111);
  	
    return 0;
}



Measured memory_bytes: 256
use std::io;
fn main() {
  let mut n = String::new();
  io::stdin().read_line(&mut n);
  let n: u32 = n.trim().parse().expect("input number");
  match n {
    1 => println!("Hello World"),
    2 => {
      let mut a = String::new();
      let mut b = String::new();
      io::stdin().read_line(&mut a);
      io::stdin().read_line(&mut b);
      let a: u32 = a.trim().parse().expect("input number");
      let b: u32 = b.trim().parse().expect("input number");
      println!("{}",a+b);
    },
    _ => {}
  }
}

Measured memory_bytes: 4352
#include <stdio.h>
#define MAX 100000

int A[MAX], n;

int partition(int p, int r){
	int x, i, j, t;
	x = A[r];
	i = p-1;
	for(j=p; j<r; j++){
		if(A[j] <= x)
		{
			i++;
			t = A[i];
			A[i] = A[j];
			A[j] = t;
		}
	}
	t = A[i+1];
	A[i+1] = A[r];
	A[r] = t;
	return i+1;
}


int main(void)
{
	int i, q;
	
	scanf("%d", &n);
	for(i=0; i<n; i++) scanf("%d", &A[i]);
	
	q = partition(0, n-1);
	
	for(i=0; i<n; i++){
		if(i) printf(" ");
		if(i == q) printf("[");
		printf("%d", A[i]);
		if(i == q) printf("]");
	}
	printf("\n");
	
	return 0;
}


Measured memory_bytes: 2144
n, k = map(int , input().split())
A = list(map(int, input().split()))
now = 1
point = [0 for _ in range(n)]
count = 0
step = 0
flag = True
flag2 = True
for i in range(k):
  point[now-1] += 1
  if(point[now-1] == 2):
    if(flag):
      step = 0
      init = i
      flag = False
  if(point[now-1] == 3):
    flag2 = False
    break
      
  now = A[now-1]
  step += 1;
  
  
if(flag2):
  print(now)
else:
  a = k-(init-1)
  k = a%step
  k += (init-1)
  now = 1
  for i in range(k):
    now = A[now-1]
  print(now)



Measured memory_bytes: 32388
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;

int main(){
    ll n, i, count, res = 0;
    cin >> n;
    string mem, s[n];
    for(i=0; i<n; i++){
        cin >> s[i];
        sort(s[i].begin(), s[i].end());
    }
    sort(s, s+n);
    mem = s[0];
    count = 0;
    for(i=0; i<n; i++){
        if(mem == s[i]) count++;
        else{
            res += count * (count - 1) / 2;
            mem = s[i];
            count = 1;
        }
    }
    res += count * (count - 1) / 2;
    cout << res << "\n";
    return 0;
}

Measured memory_bytes: 7296
let z=(-1);;let rec g()=Scanf.scanf"%d %d %d
"(fun m f r->if m>z||f>z||r>z then g(print_endline(if m=z||f=z then"F"else let x=m+f in if x>=80then"A"else if x>=65then"B"else if x>=50||x>=30&&r>=50then"C"else if x>=30then"D"else"F")));;g()

Measured memory_bytes: 2272
#include <bits/stdc++.h>
using namespace std;
#define F(i, s, t) for (int i = (s), _ = (t); i <= _; i ++)
#define LL long long
const int N = 2005;
const int P = 1000000007;
int n, m; LL X;
struct E {
	int x, y, z;
	friend int operator < (E A, E B) { return A.z < B.z; }
}e[N];
LL ans; int f[N], w[N], u[N];
int a, b, c, fin;
namespace Input {
	const int S = 10000000;
	char s[S], *h = s+S, *t = h;
	char nchar() {
		if (h == t) fread(s, 1, S, stdin), h = s;
		return *h ++;
	}
	LL rd() {
		LL x = 0; char c;
		do { c = nchar(); } while (! isdigit(c));
		do { x = x*10+c-'0', c = nchar(); } while (isdigit(c));
		return x;
	}
}
using Input::rd;
int Rot(int x) {
	while (f[x])
		x = f[x];
	return x;
}
void Evert(int x) {
	if (! f[x]) return;
	int t = f[x];
	Evert(t);
	f[t] = x, w[t] = w[x];
	f[x] = w[x] = 0;
}
void Link(int x, int y, int z) {
	Evert(x), f[x] = y, w[x] = z;
}
int Max(int x, int y) {
	Evert(x);
	int mx = 0;
	for (; y != x; y = f[y])
		mx = max(mx, w[y]);
	return mx;
}
int Pow(int x, int t) {
	int m = 1;
	for (; t; t >>= 1, x = (LL)x * x % P)
		if (t & 1)
			m = (LL)m * x % P;
	return m;
}
int main() {
	// freopen("c.in", "r", stdin);
	// freopen("c.out", "w", stdout);
	n = rd(), m = rd(), X = rd();
	F(i, 1, m) {
		int x = rd(), y = rd(), z = rd();
		e[i] = (E){x, y, z};
	}
	sort(e+1, e+m+1);
	F(i, 1, m) {
		int x = e[i].x, y = e[i].y, z = e[i].z;
		if (Rot(x) != Rot(y))
			ans += z, Link(x, y, z), u[i] = 1;
	}
	if (ans > X)
		return puts("0"), 0;
	if (ans == X)
		fin = (LL)(Pow(2, n-1) - 2) * Pow(2, m-n+1) % P;
	F(i, 1, m)
		if (! u[i]) {
			int x = e[i].x, y = e[i].y, z = e[i].z;
			LL t = ans - Max(x, y) + z;
			t < X ? a ++ : t == X ? b ++ : c ++;
		}
	fin = (fin + 2LL * (Pow(2, b) - 1) * Pow(2, c)) % P;
	printf("%d\n", (fin + P) % P);
	return 0;
}

Measured memory_bytes: 384