akhauriyash/Code-Regression huggingface dataset:
/**
 * Created by hiramekun at 00:38 on 2020-06-21.
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using ld = long double;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for (ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for (auto &i : mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    ll k;
    cin >> k;
    ll n = 50;
    vl a(50);
    rep(i, n) a[i] = i;
    ll res = k % n;
    rep(i, n) a[i] += k / n;
    rep(i, n) {
        if (res-- > 0) {
            a[i] += n;
            rep(j, n) {
                if (i == j) continue;
                a[j]--;
            }
        } else {
            break;
        }
    }
    cout << n << '\n';
    cout << a << '\n';
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

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

#define rep2(x,fr,to) for(int x=(fr);x<(to);x++)
#define rep(x,to) for(int x=0;x<(to);x++)
#define repr(x,fr,to) for(int x=(fr);x>=(to);x--)
#define all(c) c.begin(),c.end()
#define sz(v) (int)v.size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<ll,int> pii;
typedef vector<ll> VL; const int MD = (int)1e9 + 7;
void dbg(){ cerr << "\n"; } template <typename T,typename ...T2> void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T, class T2> void amax(T& a,T2 b){ if(a < b) a = b;}

int main()
{
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n;
	cin >>n;
	set<string> st;
	rep(i, n){
		string s;
		cin >>s;
		st.insert(s);
	}
	cout << sz(st)<<"\n";
	return 0;
}


Measured memory_bytes: 19180
#a = gets.split(" ").map{|x| x.to_i}
=begin
n = gets.to_i
count = 0
n.times do |i|
  if((i + 1) % 2 == 1)
    count += 1
  end
end
p count.to_f / n.to_f
=end

=begin
nk = gets.split(" ").map{|x| x.to_i}
N = nk[0]
K = nk[1]

h = gets.split(" ").map{|x| x.to_i}
count = 0

N.times do |i|
  if(K <= h[i])
    count += 1
  end
end
p count
=end

=begin
N = gets.to_i
a = gets.split(" ").map{|x| x.to_i}

array = Array.new(N)
N.times do |i|
  array[a[i] - 1] = i + 1
end
N.times do |i|
  print "#{array[i]} "
end
=end

require 'prime'

#約数を求めるやつ
class Integer
  def my_divisor_list3
    return [1] if self == 1
    first, *rest = Prime.prime_division(self).map do |p, k|
      (0..k).map{|i| p**i}
    end
    first.product(*rest).map do |a|
      a.inject(&:*)
    end.sort
  end
end

ab = gets.split(" ").map{|x| x.to_i}
A = ab[0]
B = ab[1]
#aとbの約数を求める
a_yakusu = A.my_divisor_list3
b_yakusu = B.my_divisor_list3

#配列の論理積で公約数を出す(なぜ出るかは謎)
koyakusu = a_yakusu & b_yakusu
=begin
ans = Array.new()
koyakusu2 = koyakusu
(koyakusu.size).times do |i|
  #break if(koyakusu[-(i + 1)] < koyakusu[-1]**(0.5))
  hoge = koyakusu[-(i + 1)].my_divisor_list3 & koyakusu
  if hoge.size <= 2
    ans.push(koyakusu[-(i + 1)])
  end
end
p ans
=end
i = 1
while(true)
  list = Array.new()
  for j in (i + 1)..(koyakusu.size - 1) do
    if(koyakusu[j] % koyakusu[i] == 0)
      list.push(koyakusu[j])
    end
  end

  list.each do |item|
    koyakusu.delete(item)
  end
  i += 1
  break if(i >= koyakusu.size)
end
p koyakusu.size


Measured memory_bytes: 4472
#pragma GCC optimize ("O3")
#pragma GCC target ("avx")
//#include<bits/stdc++.h>
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define rep1(i, n) for(int i = 1; i <= (n); i++)
#define co(x) cout << (x) << "\n"
#define cosp(x) cout << (x) << " "
#define ce(x) cerr << (x) << "\n"
#define cesp(x) cerr << (x) << " "
#define pb push_back
#define mp make_pair
#define chmin(x, y) x = min(x, y)
#define chmax(x, y) x = max(x, y)
#define Would
#define you
#define please

const int cm = 1 << 11;
char cn[cm], * ci = cn, ct;
inline int getint() {
	int A = 0;
	while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';
	return A;
}

ll dp[100001];

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


	fread(cn, 1, cm, stdin);
	int N = getint(), W = getint();

	rep(i, N) {
		int w = getint();
		int v = getint();
		rep (j, W - w + 1) {
			chmax(dp[j], dp[j + w] + v);
		}
	}

	printf("%lld", dp[0]);

	Would you please return 0;
}

Measured memory_bytes: 896
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define printVector(v) rep(i, v.size()) cout << v[i] << endl;

int main()
{
  int N, M, R;
  cin >> N >> M >> R;

  vector<int> town(R);
  rep(i, R)
  {
    cin >> town[i];
    town[i]--;
  }
  sort(town.begin(), town.end());

  long long INF = 100000000;
  vector<vector<long long>> d(N, vector<long long>(N, INF));
  rep(i, M)
  {
    int A, B, C;
    cin >> A >> B >> C;
    A--;
    B--;
    d[A][B] = C;
    d[B][A] = C;
  }
  rep(i, N)
  {
    d[i][i] = 0;
  }
  rep(k, N) rep(i, N) rep(j, N) d[i][j] = min(d[i][j], d[i][k] + d[k][j]);

  long long ans = INT32_MAX;
  do
  {
    long long cost = 0;
    rep(i, R - 1)
    {
      cost += d[town[i]][town[i + 1]];
    }
    ans = min(ans, cost);
  } while (next_permutation(town.begin(), town.end()));

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

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

int main()
{
    string a, b;
    cin >> a >> b;

    a += b;

    int val = 0;
    int l = a.size();

    for(int i = 0; i < l; i++){
        val *= 10;
        val += a[i]-'0';
    }

    int sq = sqrt(val);

    if((sq*sq) == val) cout << "Yes" << "\n";
    else cout << "No" << "\n";

    return 0;
}

Measured memory_bytes: 3544
#include <iostream>
#include <algorithm>
#include <utility>
#include <set>
using namespace std;

pair<int, int> r[600009];
multiset<int> st;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n, q; cin >> n >> q;
    for (int i = 0; i < n; i++) {
        int s, t, x; cin >> s >> t >> x;
        r[i * 2] = make_pair(s - x, x); r[i * 2 + 1] = make_pair(t - x, -x);
    }
    for (int i = 0; i < q; i++) {
        int d; cin >> d;
        r[n * 2 + i] = make_pair(d, 1000000009);
    }
    sort(r, r + n * 2 + q);
    for (int i = 0; i < n * 2 + q; i++) {
        if (r[i].second == 1000000009) {
            if (st.empty()) cout << -1 << '\n';
            else cout << *(st.begin()) << '\n';
        }
        else if (r[i].second < 0) st.erase(st.find(-r[i].second));
        else 
            st.insert(r[i].second);
    }
    return 0;
}


Measured memory_bytes: 15360
#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;
const double PI = acos(-1);
const double EPS = 1e-9;
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; }

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int N, T; cin >> N >> T;
	vector<int>v(T + 1, 0);
	rep(i, 0, N) {
		int l, r; cin >> l >> r;
		v[l]++; v[r]--;
	}
	rep(i, 1, T + 1)v[i] += v[i - 1];
	cout << *max_element(all(v)) << endl;
	return 0;
}

Measured memory_bytes: 3348
import sys
from bisect import bisect_left
import numpy as np


def test(a, K):
    from itertools import combinations
    answer = []
    for i, j in combinations(a, 2):
        answer.append(i * j)
    answer.sort()
    print(answer[K - 1])


def main():
    read = sys.stdin.read

    N, K, *A = map(int, read().split())

    if N <= 10:
        test(A, K)
        exit()
    A.sort()
    m = bisect_left(A, 0)
    z = bisect_left(A, 1) - m
    p = N - m - z

    M = m * p
    Z = z * (N - z) + z * (z - 1) // 2
    if m > 0:
    	negative = np.array(A[:m], np.int64)
    else:
      	negative = np.array([], np.int64)
    if p > 0:
    	positive = np.array(A[-p:], np.int64)
    else:
      	positive = np.array([], np.int64)
    negative = -negative[::-1]
    # 負の数の操作(pythonの挙動)は頭がこんがらがるので正の数にして考える

    if K <= M:
        left = 1
        right = -A[0] * A[-1] + 1
        while left + 1 < right:
            mid = (left + right) // 2
            cnt = (p - np.searchsorted(positive, (mid + negative - 1) // negative, side='left')).sum()
            if cnt < K:
                right = mid
            else:
                left = mid
        print(-left)
    elif K <= M + Z:
        print(0)
    else:
        K -= M + Z
        left = 0
        right = max(A[0] * A[1], A[-1] * A[-2])
        positive2 = positive ** 2
        negative2 = negative ** 2
        while left + 1 < right:
            mid = (left + right) // 2
            a = np.searchsorted(negative, mid // negative, side='right').sum() - (mid >= negative2).sum()
            b = np.searchsorted(positive, mid // positive, side='right').sum() - (mid >= positive2).sum()

            if (a + b) // 2 < K:
                left = mid
            else:
                right = mid

        print(right)


if __name__ == '__main__':
    main()


Measured memory_bytes: 32344
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var n=sc.I;
		var a=sc.Arr(n,()=>sc.I);
		int[] h=new int[n];
		h[0]=int.MaxValue;
		int m=1;
		for(int i = 0;i<n;i++) {
			int p=h.Bs(a[i],false,m)+1;
			h[p]=a[i];
			m=Max(m,p+1);
		}
		Console.WriteLine("{0}",m);
	}
}
static class Ex1{
	public static int Bs(this int[] a,int x,bool b){return Bs2(a,x,true,a.Length);}
	public static int Bs(this int[] a,int x,bool b,int ub){return Bs2(a,x,true,ub);}
	private static int Bs2(int[] a,int x,bool b,int ub){
		int lb=-1,mid=0;
		while(ub-lb>1){
			mid=(ub+lb)/2;
			if(a[mid]>=x){ub=mid;}
			else{lb=mid;}
		}
		return b?lb:ub;
	}
}


public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}


Measured memory_bytes: 22344
def main():

    import sys, math
    #from bisect import bisect_left as bl, bisect_right as br, insort
    #from heapq import heapify, heappush, heappop
    #from collections import defaultdict as dd, deque
    def data(): return sys.stdin.readline().strip()
    def mdata(): return list(map(int, data().split()))
    def out(*var, end="\n"): sys.stdout.write(' '.join(map(str, var))+end)
    # sys.setrecursionlimit(100000)
    INF = int(1e9)
    mod = int(1e9)+7

    s=data()
    t=data()
    if s==t[0:len(t)-1]:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()


Measured memory_bytes: 61968
#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <string.h>
#include <cstdio>
#include <tuple>
#include <numeric>
using namespace std; using ll = long long; using ld = long double;  using pll = pair<ll, ll>;
using vl = vector<ll>; using vll = vector<vl>; using vpll = vector<pll>;
using vs = vector<string>; using tll = tuple<ll, ll, ll>; using vtll = vector<tll>;
const ld PI = 3.1415926535897932;
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define co(i) cout << i << endl;
#define co2(i,j) cout << i << " " << j << endl;
#define co3(i) cout << i << " ";
#define po(i) cout << i.first << " " << i.second << endl;
void in() {}
void debug_out() { cerr << endl; }
template<typename Head, typename... Tail>
void debug_out(Head h, Tail... t) {
	cerr << " " << h;
	if (sizeof...(t) > 0) cerr << " :";
	debug_out(t...);
}
template <typename T>
ostream& operator<<(ostream& os, vector<T> vec) {
	for (size_t i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
	return os;
}
ll ctoi(char c) {
	switch (c) {
	case '0': return 0; case '1': return 1; case '2': return 2;
	case '3': return 3; case '4': return 4; case '5': return 5;
	case '6': return 6; case '7': return 7; case '8': return 8;
	case '9': return 9;  default: return 0;
	}
}
bool pairCompare(const pll firstElof, pll secondElof)
{
	return firstElof.first > secondElof.first;
}
//**Snippetリスト**//
//rep, vin, all, iteLoop, bitSearch, bitList, nod, digitDP, treeDP//
//gcdlcm, isPrime, eratos, primeFactorize, Npow, combination, divisor, modinv, doubling//
//dfs, bfs, dijkstra, WarshallFloyd, BellmanFord, UnionFind, Kruskal, RMQ, LCA//
ll i, j, k, l; ll N, M, K, H, W, L, X, Y, Z, R, Q;
ll MOD = 1000000007, INF = 1LL << 60, ans = 0, z = 0, o = 1;
vpll flag, D; vll path;
//***********//
int main() {
	string S, T;
	cin >> S >> T;
	cin >> Q;
	N = S.length();
	M = T.length();
	vl Sa(N + 1), Sb(N + 1), Ta(M + 1), Tb(M + 1);
	for (i = 0; i < N; i++) {
		Sa[i + 1] = Sa[i];
		Sb[i + 1] = Sb[i];
		if (S[i] == 'A') Sa[i + 1]++;
		else Sb[i + 1]++;
	}
	for (i = 0; i < M; i++) {
		Ta[i + 1] = Ta[i];
		Tb[i + 1] = Tb[i];
		if (T[i] == 'A') Ta[i + 1]++;
		else Tb[i + 1]++;
	}
	for (k = 0; k < Q; k++) {
		ll a, b, c, d;
		cin >> a >> b >> c >> d;
		ll Ds = (Sa[b] - Sa[a - 1]) - (Sb[b] - Sb[a - 1]);
		ll Dt = (Ta[d] - Ta[c - 1]) - (Tb[d] - Tb[c - 1]);
		if ((Ds - Dt) % 3 == 0) cout <<"YES"<<endl;
		else cout <<"NO"<<endl;
	}
}

Measured memory_bytes: 6672
# include <cstdio>
# include <algorithm>
using namespace std;
int n;
int a[100010],ji[100010],_ji;
int y[100010],l;
int ans;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	{
		int x;
		scanf("%d",&x);
		if(a[x]==0)
		{
			_ji++;
			ji[_ji]=x;
			ans++;
		}
		a[x]++;
	}
	for(int i=1;i<=_ji;i++)
		if(a[ji[i]]!=1)
		{
			while(a[ji[i]]>2)
			{
				a[ji[i]]-=2;
			}
			if(a[ji[i]]==2)
			{
				l++;
				y[l]=ji[i];
			}
		}
	if(l!=0) 
	{
		if(l%2!=0) ans--;
		else
		{
			sort(y+1,y+l+1);
			int s1=y[l/2],s2=y[l/2+1];
			int pan=0;
			for(int i=s1;i<=s2;i++)
				if(a[i]>0)
				{
					pan=1;
					break;
				}
			if(pan==0) ans-=2;
		}
	}
	printf("%d",ans);
	return 0;
} 

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

if a > 0:
  ans  = "Positive"
elif a == 0:
  ans = "Zero"
elif b >= 0:
  ans = "Zero"
else:
  if abs(a-b)%2 == 0:
    ans = "Negative"
  else:
    ans = "Positive"
print(ans)

Measured memory_bytes: 61852
// APSP 問題とも
// - グラフの各点におけるすべての組み合わせの最短経路を求める
// - グラフ中に負の重みを持つ辺があっても動作する
// - DPで各点の最短距離を更新していく
// - 
#include <bits/stdc++.h>
using namespace std;

#define REP(i, start, count) for (int i = (start); i < (int)(count); ++i)
#define rep(i, count) REP(i, 0, count)
#define ALLOF(c) (c).begin(), (c).end()

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> veci;
typedef vector<long long> vecll;
typedef vector<unsigned long long> vecull;

int V, E;
vector<vecll> G;

constexpr ll INF = (1LL << 32);

int main(void)
{
    cin >> V >> E;

    G.assign(V, vecll(V, INF));

    rep(i, E) {
        ll s, t, d;
        cin >> s >> t >> d;
        G[s][t] = d;
    }

    for (int i = 0; i < V; ++i) {
        G[i][i] = 0; // 自分から自分は距離0
    }

    // 使っていい頂点の数
    for (int k = 0; k < V; ++k) {
        // 始点
        for (int i = 0; i < V; ++i) {
            if (G[i][k] == INF) continue; // まだ道が見つかっていない
            // 終点
            for (int j = 0; j < V; ++j) {
                if (G[k][j] == INF) continue; // まだ道が見つかっていない
                // 新しい頂点を使った場合
                ll a = G[i][k] + G[k][j];

                // 新しい頂点を使わなかった場合
                ll b = G[i][j];
                
                G[i][j] = min(a, b);
            }
        }
    }

    // 自分to自分が0がベストなはずだが、負の閉路がある場合そこを回り続ければ無限にコストを減少させられるので、
    // 最短経路が定義できなくなる
    bool isNegative = false;
    for (int i = 0; i < V; ++i) if (G[i][i] < 0) { isNegative = true;  break; }

    if (isNegative) {
        cout << "NEGATIVE CYCLE" << endl;
        return 0;
    }


    for (int i = 0; i < V; ++i) {
        for (int k = 0; k < V; ++k) {
            if (G[i][k] == INF) cout << "INF";
            else cout << G[i][k];
            if (k != V - 1) cout << ' ';
        }
        cout << endl;
    }
    return 0;
}


Measured memory_bytes: 3228
#include<stdio.h>
#include<stdlib.h>
 
struct node{
  struct node *right;
  struct node *left;
  struct node *parent;
  int key;
};
typedef struct node * Node;
#define NIL NULL
 
Node root;
 
Node treeMinimum(Node x){
  while(x->left!=NIL) x=x->left;
  return x;
 
}
 
Node treeMaximum(Node x){
  while(x->right!=NIL) x=x->right;
  return x;
 
}
 
Node treeSearch(Node u, int k){
  if(u==NIL || k==u->key) return u;
 
  if(k<u->key) return treeSearch(u->left,k);
  else return treeSearch(u->right,k);
 
}
 
Node treeSuccessor(Node x){
  Node y;
  if(x->right!=NIL) return treeMinimum(x->right);
   
  y=x->parent;
  while(y!=NIL && x==y->right){
    x=y;
    y=y->parent;
  }
    return y;
 
}
 
void treeDelete(Node z){
  Node y; // node to be deleted
  Node x; // child of y
 
  if(z->left==NIL || z->right == NIL) y=z;
  else y=treeSuccessor(z);
 
  if(y->left!=NIL) x=y->left;
  else x=y->right;
 
  if(x!=NIL) x->parent = y->parent;
 
  if(y->parent==NIL) root=x;
  else if(y==y->parent->left) y->parent->left = x;
  else y->parent->right = x;
 
  if(y!=z) z->key=y->key;
 
}
 
void insert(int k){
  Node y = NIL;
  Node x = root;
  Node z;
 
  z = malloc(sizeof(struct node));
  z->key = k;
  z->left = NIL;
  z->right = NIL;
 
  while (x!=NIL){
    y=x;
    if(z->key < x->key){
      x=x->left;
    }
    else{
      x=x->right;
    }
  }
  z->parent=y;
  if(y==NIL) root =z;
  else if(z->key<y->key) y->left=z;
  else (y->right = z);
}
 
void inorder(Node u){
  if(u==NIL) return;
  inorder(u->left);
  printf(" %d",u->key);
  inorder(u->right);
}
void preorder(Node u){
  if(u==NIL) return;
  printf(" %d",u->key);
  preorder(u->left);
  preorder(u->right);
}
 
 
int main(){
  int n, i, x;
  char com[20];
  scanf("%d", &n);
 
  for ( i = 0; i < n; i++ ){
    scanf("%s", com);
    if ( com[0] == 'f' ){
      scanf("%d", &x);
      Node t = treeSearch(root, x);
      if ( t != NIL ) printf("yes\n");
      else printf("no\n");
    } else if ( com[0] == 'i' ){
      scanf("%d", &x);
      insert(x);
    } else if ( com[0] == 'p' ){
      inorder(root);
      printf("\n");
      preorder(root);
      printf("\n");
    } else if ( com[0] == 'd' ){
      scanf("%d", &x);
      treeDelete(treeSearch(root, x));
    }
  }
 
  return 0;
}



Measured memory_bytes: 20452
#include <bits/stdc++.h>
using namespace std;
const long long inf = 10000000000000ll;
typedef pair<long long, int> pa;

int V, E, R;
long long dist[100000];
struct edge{ int s, t, d; };
vector<edge> graph[100000];

int main(){

    cin >> V >> E >> R;
    for(int i = 0; i < E; i++){
        edge e;
        cin >> e.s >> e.t >> e.d;
        graph[e.s].push_back(e);
    }

    fill(dist, dist + V, inf);
    dist[R] = 0;
    
    priority_queue<pa, vector<pa>, greater<pa>> que;
    que.push({0, R});

    while(!que.empty()){
        pa p = que.top();
        que.pop();
        int v = p.second, d = p.first;
        if(dist[v] < d)continue;
        for(edge e : graph[v]){
            if(dist[e.t] > d + e.d){
                dist[e.t] = d + e.d;
                que.push({d + e.d, e.t});
            }
        }
    }

    for(int i = 0; i < V; i++){
        if(dist[i] == inf)cout << "INF\n";
        else cout << dist[i] << '\n';
    }

}


Measured memory_bytes: 16992
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using static System.Math;

public static class P
{
    public static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        for (int i = 0; i < 1000; i++)
        {
            var remain = n - i * 100;
            if (remain < 0) continue;
            if (i * 5 < remain) continue;
            Console.WriteLine(1);
            return;
        }
        Console.WriteLine(0);
    }
}

Measured memory_bytes: 13140
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i, n) for(int i = 0; i < n; i++)
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fi first
#define se second
#define pb push_back
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 int INF = (1<<30) - 1;
const ll LINF = (1LL<<60) - 1;

void solve() {
    ll n, d;
    cin >> n >> d;
    int cnt = 0;
    rep(i, n) {
        ll x, y;
        cin >> x >> y;
        if (x*x + y*y <= d*d) cnt++;
    }
    cout << cnt << endl;

}

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

Measured memory_bytes: 3584
program sample
    implicit none
    character(2)::s
    integer(8) :: i,j,m,n,w,p
    integer(8),allocatable :: x(:),y(:)
  
    read(*,*) n,m
    allocate(x(n),y(n))
    x(:)=0
    y(:)=0
    w=0
    if(m==0)then
        write(*,*)0,0
        stop
    end if

    do i=1,m
        read(*,*)p,s
        if(s .eq. 'AC')then
            x(p)=1
        else if(x(p)==0)then
            y(p)=y(p)+1
        end if
    end do
    do i=1,n
        if(x(i)==0)then
            y(i)=0
        endif
    end do



    write(*,*) sum(x),sum(y)
  
    stop
end program sample
  



Measured memory_bytes: 4344
N, A, B, C, D = map(int,input().split())
S = list(input())

switch = 0

S_before_a = S.copy()
S_before_a[B-1] ='#'
A_list = S_before_a[A:C-1]
count1 = 0
for i in range (len(A_list)-1):
    if ''.join(A_list[i:i+2])=='##':
        count1+=1

S_after_a = S.copy()
S_after_a[C-1]='#'

count2 = 0
B_list = S_after_a[B:D-1]
for i in range (len(B_list)-1):
    if ''.join(B_list[i:i+2])=='##':
        count2+=1
    
#count逆
S_before_b = S.copy()
S_before_b[A-1] ='#'
B_list = S_before_b[B:D-1]
count3 = 0
for i in range (len(B_list)-1):
    if ''.join(B_list[i:i+2])=='##':
        count3+=1

S_after_b = S.copy()
S_after_b[D-1]='#'

count4 = 0
A_list = S_after_b[A:C-1]
for i in range (len(A_list)-1):
    if ''.join(A_list[i:i+2])=='##':
        count4+=1
        
change_counter =0
changer = S[max(A,B)-1:min(C,D)]
for i in range(len(changer)-2):
    if ''.join(changer[i:i+3])=='...':
        change_counter+=1
        
if (count1+count2) == 0 or (count3+count4) ==0:
    print('Yes')
elif (count1 == 1 and change_counter>0 ) or (count2 == 1 and change_counter>0 ) or (count3 == 1 and change_counter>0 ) or (count4 == 1 and change_counter>0 ):
    print('Yes')
else:
    print('No')

Measured memory_bytes: 14400
#include <bits/stdc++.h>
using namespace std;
 
int main() {

int a,b;
cin >> a>>b;
int m,n,k;
  m=a/100;
  n=b/100;
k=n-m+1;
  if(m*100+m/10*10-a/10000*100+a/10000<a)
  {k-=1;}
  if(n*100+n/10*10-b/10000*100+b/10000>b)
  {k-=1;}
  cout<< k<<endl;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

N = int(input())
imo = []
xlmin = 0
xlmax = 0
for _ in range(N):
    x,l = map(int,input().split())
    imo.append([x-l,x+l-1])
imo = sorted(imo,key = lambda x: x[1])
cnt = 1
ls = imo[0][1]
for i in range(1,N):
    if imo[i][0]<=ls:
        continue
    else:
        cnt += 1
        ls = imo[i][1]
print(cnt)


Measured memory_bytes: 26280
#include <bits/stdc++.h>
#define eb emplace_back
#define pb push_back
#define all(x) x.begin(), x.end()
#define x first
#define y second
#define sz(x) (int)x.size()
#define mp make_pair
#define pii pair<int,int>
typedef long long ll;

using namespace std;

const int INF=1e9;

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin>>n;
	vector<int>s(1<<n);
	for(int i=0;i<(1<<n);i++){
		cin>>s[i];
	}
	sort(s.rbegin(),s.rend());
	vector<bool>used(1<<n);
	used[0] = true;
	for(int i=0;i<n;i++){
		vector<int>ready;
		vector<int>steady;
		for(int j=0;j<(1<<n);j++) {
			if(used[j]) ready.pb(j);
			else steady.pb(j);
		}
		//~ cout << "ready:\n";
		//~ for (int j = 0; j < sz(ready); j++) {
			//~ cout << s[ready[j]] << " ";
		//~ }
		//~ cout << "\nsteady:\n";
		//~ for (int j = 0; j < sz(steady);j++) {
			//~ cout << s[steady[j]] << " ";
		//~ }
		//~ cout << "\n";
		int l=0;
		for(int j=0;j<sz(ready);j++){
			while(l < sz(steady) && s[steady[l]] >= s[ready[j]]){
				l++;
			}
			if(l==sz(steady)){
				cout<<"No";
				return 0;
			}
			used[steady[l]]=true;
			l++;
		}
	}
	//~ for (int i = 0; i < (1<<n);i++) cout << used[i] << " ";
	
	cout << "Yes";
	return 0;
}


Measured memory_bytes: 3504
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long ll;
const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#define all(v) v.begin(), v.end()
#define repi(i, n, init) for (ll i = init; i < (n); i++)
#define repd(i, n, init) for (ll i = (n); i >= init; i--)
#define repm(i, m) for (auto i = m.begin(); i != m.end(); i++)
#define repb(bit, n, init) for (ll bit = init; bit < (1 << n); ++bit)

int main()
{
    int k, n;
    cin >> k >> n;
    int A[n], D[n];
    repi(i, n, 0)
    {
        cin >> A[i];
        if (i > 0)
        {
            D[i] = min(A[i] - A[i - 1], A[i] + k - A[i-1]);
        }
    }
    D[0] = min(A[0] + k - A[n - 1], abs(A[0] - A[n - 1]));
    sort(D, D + n);
    int ans = 0;
    repi(i, n - 1, 0)
    {
        ans += D[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <functional>
#include <cmath>
#include <set>
#include <queue>
#include <vector>
#include <climits>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
using namespace std;

int main()
{
	int N;
	cin >> N;
	vector<long long> a(3 * N);
	priority_queue<long long, vector<long long>, greater<long long>> f;
	priority_queue<long long> b;
	auto totalF = 0ll;
	auto totalB = 0ll;
	for (auto i = 0; i < 3 * N; ++i)
	{
		auto temp = 0ll;
		cin >> temp;
		a[i] = temp;
		if (i < N)
		{
			f.push(temp);
			totalF += temp;

		}
		if (i >= 2 * N)
		{
			b.push(temp);
			totalB += temp;
		}
	}

	vector<long long> sumF(N + 1);
	vector<long long> sumB(N + 1);
	sumF[0] = totalF;
	sumB[N] = totalB;
	for (auto i = 0; i < N; ++i)
	{
		auto af = a[i + N];
		auto tempF = f.top();
		if (tempF < af)
		{
			totalF -= tempF;
			totalF += af;
			f.pop();
			f.push(af);
		}
		sumF[i + 1] = totalF;

		auto ab = a[2 * N - i - 1];
		auto tempB = b.top();
		if (tempB > ab)
		{
			totalB -= tempB;
			totalB += ab;
			b.pop();
			b.push(ab);
		}
		sumB[N - i - 1] = totalB;
	}

	auto result = LLONG_MIN;
	for (auto i = 0; i <= N; ++i)
	{
		result = max(result, sumF[i] - sumB[i]);
	}
	cout << result << endl;

	return 0;
}

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

int N, bil[101];

int main () {
    cin >> N;
    for(int i=1; i<=N; i++) {
        cin >> bil[i];
    }
    for(int i=N; i>=1; i--) {
        cout << bil[i];
        if (i==1) {
            cout << endl;
        } else {
            cout << " ";
        }
    }
}



Measured memory_bytes: 3072
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_map>
using namespace std;
vector<pair<char,int>> A;
unordered_map<int,vector<char>> chk;

//vector<pair<char,int>> Bubble;

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

void quickSort(int p,int r){
  if (p<r){
    int q=partition(p,r);
    quickSort(p,q-1);
    quickSort(q+1,r);
  }
}

/*void BubbleSort(int n){
  bool flag=false;
  while (!flag){
    flag=true;
    for(int i=n-2;i>=0;i--){
      if (Bubble[i].second>Bubble[i+1].second){
	swap(Bubble[i],Bubble[i+1]);
	flag=false;
      }
    }
  }
  
  }*/

int main(){
  int n;
  cin>>n;
  A.resize(n);
  char c;
  int v;
  for(int i=0;i<n;i++){
    cin>>c>>v;
    A[i]=make_pair(c,v);
    chk[v].push_back(c);
  }
  //  Bubble=A;
  quickSort(0,n-1);
  //BubbleSort(n);
  /*bool flag=true;
  for(int i=0;i<n;i++){
    if (A[i]!=Bubble[i]){
      flag=false;
      break;
    }
  }
  if (flag) cout<<"Stable"<<endl;
  else cout<<"Not stable"<<endl;*/
  bool flag=true;
  for(int i=0;i<n;i++){
    if (chk[A[i].second][0]!=A[i].first){
      flag=false;
      break;
    }else {
      chk[A[i].second].erase(chk[A[i].second].begin());
    }
  }
  if (flag)
    cout<<"Stable"<<endl;
  else
    cout<<"Not stable"<<endl;
  
  for(int i=0;i<n;i++){
    cout << A[i].first << " "<<A[i].second<<endl;
  }
  
  return 0;
}



Measured memory_bytes: 5736
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;
#define whole(f, x, ...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> v(n);
    rep(i, n) cin >> v[i];

    ll total = 0;
    vector<ll> imos0(2 * m);
    vector<ll> imos1(2 * m);
    rep(i, n - 1) {
        int l = v[i] - 1;
        int r = v[i + 1] - 1;
        if (r < l) r += m;
        total += r - l;
        if (r - l <= 1)continue;
        imos0[l + 2] += 1;
        imos0[r + 1] -= 1;
        imos1[r + 1] -= (r + 1) - (l + 2);
    }
    imos1[0] += imos0[0];
    rep(i, 2 * m - 1) {
        imos0[i + 1] += imos0[i];
        imos1[i + 1] += imos1[i] + imos0[i + 1];
    }
    vector<ll> reward(m);
    rep(i, m) reward[i] = imos1[i] + imos1[i + m];
    ll res = total - *whole(max_element, reward);
    cout << res << endl;
}


Measured memory_bytes: 4608
local n, k, l = io.read("*n", "*n", "*n")

local function uf_initialize(n)
  local parent = {}
  for i = 1, n do parent[i] = i end
  return parent
end

local function uf_findroot(idx, parent)
  local idx_update = idx
  while parent[idx] ~= idx do
    idx = parent[idx]
  end
  while parent[idx_update] ~= idx do
    parent[idx_update], idx_update = idx, parent[idx_update]
  end
  return idx
end

local p1 = uf_initialize(n)
for i = 1, k do
  local p, q = io.read("*n", "*n")
  local pr, qr = uf_findroot(p, p1), uf_findroot(q, p1)
  p1[qr], p1[q] = pr, pr
end

local p2 = uf_initialize(n)
for i = 1, l do
  local r, s = io.read("*n", "*n")
  local rr, sr = uf_findroot(r, p2), uf_findroot(s, p2)
  p2[sr], p2[s] = rr, rr
end

local group = {}
for i = 1, n do
  local r1, r2 = uf_findroot(i, p1), uf_findroot(i, p2)
  if not group[r1] then group[r1] = {} end
  if not group[r1][r2] then
    group[r1][r2] = 1
  else
    group[r1][r2] = group[r1][r2] + 1
  end
end
for i = 1, n do
  local r1, r2 = uf_findroot(i, p1), uf_findroot(i, p2)
  io.write(group[r1][r2])
  io.write(i == n and "\n" or " ")
end


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

using namespace std;
using ll = long long;

int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  int count = 0;
  while (1) {
    if (count % 2 == 0) {
      c -= b;
    } else {
      a -= d;
    }
    if (a <= 0) {
      cout << "No" << endl;
      break;
    }
    if (c <= 0) {
      cout << "Yes" << endl;
      break;
    }
    count++;
  }
  return 0;
}

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

// varibable settings
#define int long long
const int INF=1e18;

// define basic macro {{{
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define _rrep(i,n) rrepi(i,0,n)
#define rrepi(i,a,b) for(int i=(int)((b)-1);i>=(int)(a);--i)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(i,a) for (auto&& i : a)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define pb(a) push_back(a)
#define mp(a, b) make_pair(a, b)
#define mt(a, b, c) make_tuple(a, b, c)
#define ub upper_bound
#define lb lower_bound
#define posl(A, x) (lower_bound(all(A), x)-A.begin())
#define posu(A, x) (upper_bound(all(A),x)-A.begin())
template<class T> inline void chmax(T &a, const T &b) { if((a) < (b)) (a) = (b); }
template<class T> inline void chmin(T &a, const T &b) { if((a) > (b)) (a) = (b); }

#define divceil(a,b) ((a)+(b)-1)/(b)
#define is_in(x, a, b) ((a)<=(x) && (x)<(b))
#define uni(x) sort(all(x));x.erase(unique(all(x)),x.end())
#define slice(l, r) substr(l, r-l)

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef long double ld;
typedef pair<int,int> pii;
typedef tuple<int,int,int> iii;

template<typename T> using PQ = priority_queue<T, vector<T>, greater<T>>;
struct Fast { Fast(){ std::cin.tie(0); ios::sync_with_stdio(false); } } fast;

#if defined(PCM) || defined(LOCAL)
    #include "lib/dump.hpp"
#else
    #define dump(...) 42
    #define dump_1d(...) 42
    #define dump_2d(...) 42
    #define cerrendl 42
#endif
//}}}

signed main() {
    int n;cin>>n;
    string s;cin>>s;
    dump(s);

    vector<set<int>> d(26);
    rep(i, n){
        int v = s[i] - 'a';
        d[v].insert(i);
    }
    dump(d);

    int Q;cin>>Q;
    rep(_, Q){
        cerrendl;
        int t;cin>>t;
        dump(t);
        if (t==1){
            int i;cin>>i;
            char c;cin>>c;
            i--;
            dump(i, s[i], s[i]-'a');
            d[s[i]-'a'].erase(i);

            s[i] = c;
            dump(s[i], c, c-'a');
            d[c - 'a'].insert(i);
        }
        if (t==2){
            int l,r;cin>>l>>r;
            l--;r--;
            int ans = 0;
            rep(i, 26){
                auto it = d[i].lower_bound(l);
                if (it!=d[i].end() && *it<=r) ans++;
            }
            cout << ans << endl;
        }
    }

    return 0;
}


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

#define DEBUG(x) cerr << #x << ": " << x << endl;
#define ll long long


int main() {
    int n;
    cin >> n;
    vector<int> a(n), b(n), c(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++) cin >> b[i];
    for (int i = 0; i < n; i++) cin >> c[i];
    sort(a.begin(), a.end());
    sort(b.begin(), b.end());
    sort(c.begin(), c.end());

    ll cnt = 0;
    for (int i = 0; i < n; i++) {
        ll A = lower_bound(a.begin(), a.end(), b[i]) - a.begin();
        ll B = n - ( upper_bound(c.begin(), c.end(), b[i]) - c.begin() );
        cnt += A * B;
    }

    cout << cnt << endl;

    return 0;
}

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

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

const ll INF = 1LL << 62;
#define atcoder(int)1e9+7
#define Endl endl
#define mp make_pair
#define all(v) v.begin(),v.end()
#define pb push_back
#define pr(x) cout << x << endl

ll gcd(ll a, ll b) {//最大公約数
	if (a%b == 0)return b;
	else gcd(b, a%b);
}

ll lcm(ll a, ll b) {//最小公倍数
	return (a / gcd(a, b))*b;
}


int main(){

	ll x, y, sum = 0;
	cin >> x >> y;
	int cnt = 1;

	while (1) {
		x *= 2;
		if (y < x)break;
		cnt++;
	}

	cout << cnt << Endl;

	return 0;
}

Measured memory_bytes: 256
s = input()
t = input()

list(s)
list(t)

if s[0] == t[0] and s[1] == t[1] and s[2] == t[2]:
    print(3)

elif s[0] == t[0] and s[1] == t[1] and s[2] != t[2]:
    print(2)

elif s[0] == t[0] and s[1] != t[1] and s[2] == t[2]:
    print(2)

elif s[0] != t[0] and s[1] == t[1] and s[2] == t[2]:
    print(2)

elif s[0] == t[0] and s[1] != t[1] and s[2] != t[2]:
    print(1)

elif s[0] != t[0] and s[1] != t[1] and s[2] == t[2]:
    print(1)

elif s[0] != t[0] and s[1] == t[1] and s[2] != t[2]:
    print(1)

else:
    print(0)



Measured memory_bytes: 3064
n=int(input())
a=list(map(int,input().split()))
b=[0]*n
b[0]=a[0]
for i in range(1,n):
  b[i]=b[i-1]+a[i]
x=0
for i in range(1,n)[::-1]:
  x+=(b[i-1]*a[i])
  x=x%(10**9+7)
print(x)

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

const double PI = 3.14159265358979;

int main() {
	int R;
	cin >> R;
	double L = 2 * R * PI;
	cout << setprecision(16) << L << endl;

	return 0;
}

Measured memory_bytes: 3232
#include<bits/stdc++.h>
using namespace std;
#define ll long long int 
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define ff(i,n) for(i=0;i<n;i++)
ll bg=1000000007;
ll gcd(ll a,ll b)
{
if(b==0)
   return a;
else
   return gcd(b,a%b);   
}
ll power(ll x,ll y)
{
	if(y==0)
		return 1;
	ll h=power(x,y/2);	
	h=(h*h);
	if(y%2==1)
	  return (x*h);
	else
	  return h;  
}
ll isp(string str) 
{ 
    // Start from leftmost and rightmost corners of str 
    int l = 0; 
    int h = str.length() - 1;
    // Keep comparing characters while they are same 
    while (h > l) 
    { 
        if (str[l++] != str[h--]) 
        {  
            return -1; 
        } 
    } 
    return 1; 
} 
vector<vector<pair<ll,ll> > >adj(300000);
ll dis[300000],vis[300000],p[300000];

int main()
{
	ll t;
	t=1;
	while(t--)
	{	
	    ll i,n;
		string f;
		cin>>f;
		if(f[2]==f[3] && f[4]==f[5])
		    cout<<"Yes";
		else
		    cout<<"No";    
		     	  	   
	}
return 0;
}

Measured memory_bytes: 7296
// C

#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9+7;

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


Measured memory_bytes: 256
using System;
using System.Linq;
class Hello
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        int sum = 0;
        for (int i = 0; i < n; i++)
        {
            var a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            sum += (a[1] - a[0] + 1);
        }
        Console.WriteLine(sum);

    }

}


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

using namespace std;

int main() {
    int n;
    cin >> n;
    vector<int> v;
    for (int i = 1; i <= 2 * n; i++) {
        int x;
        cin >> x;
        v.push_back(x);
    }
    sort(v.rbegin(), v.rend());
    int ans = 0;
    //cout << v.size() << endl;
    for (int i = 0; i + 1 < (int)v.size(); i += 2) {
        ans += v[i + 1];
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3592
#include<stdio.h>
int main(){
	int W, H, x, y, r;
	scanf("%d %d %d %d %d", &W, &H, &x, &y, &r);
	if(W<x+r){
		printf("No\n");
	
	} else if(H<y+r){
		printf("No\n");
	
	} else if(x<r){
		printf("No\n");
	
	} else if(y<r){
		printf("No\n");
	
	} else  printf("Yes\n");		
	
    return 0;
}

Measured memory_bytes: 580
#include <cstdio>
#include <iostream>
using namespace std;
int N, p[100003], K;
long long a[100003], b[100003], c[100003];
int main(){
    scanf("%d %d", &N, &K);
    long long ans = 0;
    for(int i = 1; i <= N; ++i) scanf("%d", &p[i]);
    for(int i = 1; i <= N; ++i) a[i] = a[i-1] + max(p[i], 0);
    for(int i = 1; i <= N; ++i) c[i] = c[i-1] + p[i];
    for(int i = N; i >= 1; --i) b[i] = b[i+1] + max(p[i], 0);
    for(int i = 1; i <= N - K + 1; ++i){
        ans = max(ans, max(0LL, c[i + K - 1] - c[i-1]) + a[i-1] + b[i + K]);
    }
    printf("%lld\n", ans);
}


Measured memory_bytes: 2944
def binarySearch(A,key):
    left=0
    right=len(A)
    while(left < right):
        mid = (left + right)//2
        if(A[mid]==key):
            return mid
        elif(key < A[mid]):
            right = mid
        else:
            left = mid + 1
    return -1

n=int(input())
s=list(map(int,input().split()))
q=int(input())
t=list(map(int,input().split()))

ans=0
for i in range(len(t)):
    ind=binarySearch(s, t[i])
    if(ind!=-1):
        ans+=1
print(ans)



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

int main(void) {
    int x, y;
    cin >> x >> y;
    bool notExist = true;
    for (int i = 0; i <= x; ++i) {
        if (2 * i + 4 * (x - i) == y) {
            cout << "Yes" << endl;
            notExist = false;
            break;
        }
    }
    if (notExist) cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3100
MOD = 1000000007

N = int(input())
A = list(map(int,input().split()))

ans = 0
for i in range(0,60,1):
    zero_count=0
    one_count =0
    for j in range(0,N,1):
        if((A[j]>>i)&1):
            one_count+=1
        else:
            zero_count+=1
    ans =(ans%MOD + (one_count%MOD)*(zero_count%MOD)*pow(2,i,MOD))%MOD

print(ans)

Measured memory_bytes: 122808
#include <bits/stdc++.h>
//#include <boost/functional/hash.hpp>
//example: unordered_set< pair<int,int>,boost::hash< std::pair<int, int> > > used;
//priority_queue< pair<int,pair<int,int> >, vector<pair<int,pair<int,int>>>, greater<pair<int,pair<int,int> > > > pqueue;    //cost, vertex(行き先)
using namespace std;

#define MODULE 1000000007
#define MP make_pair
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second

template<class T,class U>inline void chmin(T &t,U f){if(t>f)t=f;}
template<class T,class U>inline void chmax(T &t,U f){if(t<f)t=f;}

typedef pair<int, int> P;
typedef long long LL;
const int INF = INT_MAX / 2;    //int_max->2*e+9 LLの時はLLONG_MAX
const int MAXN = 100001;

/*struct edge {
    edge(int to, int cost) : to(to), cost(cost) {}
    int to, cost;
};
vector<edge> graph[MAXN];*/


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

//-----Template---------
LL n;
LL t[100001];
LL a[100001];
LL tCount[100001];
LL tMemo[100001];   //最大値を書き込む．tCountが1で最大値がaと食い違えばありえない
LL aCount[100001];
LL aMemo[100001];
LL finalCount[100001];
LL res=1;
int main(){
    ios::sync_with_stdio(false); //cout<< fixed << setprecision(10);
    scanf("%d",&n);
    for (int i = 0; i < n; ++i) {
        scanf("%d",&t[i]);
        if(i==0){
            tCount[0]=1;
        }else{
            tCount[i]=t[i]!=t[i-1]?1:t[i];
        }
    }
    for (int i = 0; i < n; ++i) {
        scanf("%d",&a[i]);
    }
    for (int i = n-1; i >=0; --i) {
        if(i==n-1){
            aCount[n-1]=1;
        }else{
            aCount[i]=a[i]!=a[i+1]?1:a[i];
        }
    }
    bool flag=true;
    for (int i = 0; i < n; ++i) {
        if(tCount[i]==1 && t[i]>a[i]) {
            flag = false;
        }
        if(aCount[i]==1 && a[i]>t[i]){
            flag=false;
        }

        finalCount[i]=min(tCount[i],aCount[i]);
    }
    for (int i = 0; i < n; ++i) {
        res*=finalCount[i];
        res%=MODULE;
    }

    cout<<(flag?res:0)<<endl;




}

Measured memory_bytes: 4224
import math
if __name__ == "__main__":
    while 1:
        d,e = list(map(int,input().strip().split()))
        if d == e == 0:break
        diff = 20000
        for x in range(d + 1):
            y = d-x
            if diff > math.fabs(math.sqrt(x**2 + y**2)-e):diff =math.fabs(math.sqrt(x**2 + y**2)-e)
        print(diff)

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


int main(){
char c;
cin >> c;
if (c > 90) {
  cout << "a" << endl;
} else cout << "A" << endl;



return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
	int a,b,c,s=0,flag=1;
	scanf("%d%d%d",&a,&b,&c);
	while(1){
		int x=a,y=b,z=c;
		if(x%2!=0||y%2!=0||z%2!=0)break;
		if(x==y&&y==z){
			flag=0;break;
		}
		a=(y+z)/2;b=(x+z)/2;c=(x+y)/2;
		s++;
	}
	if(flag==1)printf("%d\n",s);
	else printf("-1\n");
	return 0;
}

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



int main() {
  int n;
  cin >>n;
  int a[n+1];
  int ans=0;
  rep(i,n)cin >> a[i];
  a[n]=-1;
  for(int i=0;i<n;i++){
    if(a[i]==i+1){swap(a[i],a[i+1]);ans++;}
  }
  cout << ans << endl;
}

Measured memory_bytes: 640