akhauriyash/Code-Regression huggingface dataset:
#include "bits/stdc++.h"

using namespace std;

//using Matrix = vector< vector<int> >;
typedef long long ll;
typedef pair<int, int> P;
const int INF = 1e9 + 10;
//const ll INF = 1e18 + 10LL;
int dx[5] = {0, 0, 1, -1, 0}, dy[5] = {1, -1, 0, 0, 0};
const double EPS = 1e-10;
bool cmp(P a, P b) { return a.second < b.second; } //End sort (Interval scheduling problem)
ll MOD = 1e9 + 7;

string S;
bool unbalance;

int a, b;

int main(void){
	cin>>S;

	for (int i = 0; i + 1 < S.size(); i++) {
		if (S[i] == S[i + 1]) {
			unbalance = true;
			a = i + 1; b = (i + 1) + 1; //0-indexから戻すために１を足す
			break;
		}
	}

	for (int i = 0; i + 2 < S.size(); i++) {
		if (S[i] == S[i + 2] && S[i] != S[i + 1]) {
			unbalance = true;
			a = i + 1; b = (i + 2) + 1; //0-indexから戻すために１を足す
			break;
		}
	}

	if (unbalance) printf("%d %d\n", a, b);
	else printf("%d %d\n", -1, -1);

	return 0;
}

Measured memory_bytes: 512
//#include "bits/stdc++.h"
#include <iostream>
#include <vector>
#include <map>
#include <utility>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <stack>
#include <queue>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <numeric>
#include <complex>
#include <bitset>
#include <functional>
#include <stack>
#include <regex>
#include <tuple>
#include <iomanip>

#define int long long
#define REP(i,l,r) REPEAT(i,l,r,true) // [l, r)
#define rep(i,n) REP(i,0,n)           // [0, n)
#define REPEAT(i,l,r,condition) for(int i=(condition)?l:r-1;(condition)?i<r:i>=l;(condition)?++i:--i) // false<-[l, r)->true
#define all(e) e.begin(),e.end()
#define rall(e) e.rbegin(),e.rend()
#define pb push_back
#define fs first
#define sc second
#define show(...) cerr<<#__VA_ARGS__<<" = ";_DEBUG(__VA_ARGS__)
#define showlr(n,l,r) cerr<<#n<<" = ";for(int i=l;i<r;i++){cerr<<n[i]<<", ";}cerr<<endl // [l, r)

#define YN(condition) puts((condition)?"YES":"NO")
#define Yn(condition) puts((condition)?"Yes":"No")
#define yn(condition) puts((condition)?"yes":"no")
#define YES puts("YES")
#define Yes puts("Yes")
#define yes puts("yes")
#define NO  puts("NO")
#define No  puts("No")
#define no  puts("no")

#define case(i) printf("Case #%lld: ",i)

using namespace std;

using vi=vector<int>;
using pint=pair<int,int>;

struct io{io(){cin.tie(0);ios::sync_with_stdio(false);cout.tie(0);cout<<fixed<<setprecision(20);}}io;

template<class T> istream& operator >>(istream &is, vector<T> &v){for(T &e:v)is>>e;return is;}
template<class T> ostream& operator <<(ostream &os, vector<T> v){os<<"{";for(T &e:v)os<<e<<(v.size()-(int)(&e-&v[0])>1?", ":"");os<<"}";return os;}

void _DEBUG(){}
template<typename H,typename... T> void _DEBUG(H a,T...b){cerr<<a<<(sizeof...(b)?",":"\n");_DEBUG(b...);}

inline void in(){}
template<typename H,typename... T>void in(H &a, T&... b){cin>>a;in(b...);}
inline void out(){}
template<typename H,typename... T> void out(H a, T... b){cout<<a<<(sizeof...(b)?" ":"\n");out(b...);}

template<class T> void resz(int n,T& v){v.resize(n);}
template<class H,class... T> void resz(int n,H& a,T&... b){a.resize(n);resz(n,b...);}

template<typename V,typename H> void resize(vector<V>& v,const H a){v.resize(a);}
template<typename V,typename H,typename... T> void resize(vector<V>& v,const H& a,const T... b){v.resize(a);for(auto &v:v) resize(v,b...);}

const int INF=1LL<<55;
const int MOD=1000000007;
const double EPS=1e-8;

int H,W;
int h,w;

signed main(){

    in(H,W);
    in(h,w);
    out((H-h)*(W-w));

    return 0;
}


Measured memory_bytes: 888
# https://atcoder.jp/contests/abc086/tasks/abc086_b

def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))

a, b = input().split()

i = int(a+b)

if (i ** 0.5) % 1 == 0:
    print("Yes")
else:
    print("No")

    

Measured memory_bytes: 2940
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PI pair<P,int>
#define PP pair<P,P>
#define Yes(f){cout<<(f?"Yes":"No")<<endl;}
#define YES(f){cout<<(f?"YES":"NO")<<endl;}
int Madd(int x,int y) {return (x+y)%M;}
int Msub(int x,int y) {return (x-y+M)%M;}
int Mmul(int x,int y) {return (x*y)%M;}


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

  int n,q;
  cin>>n>>q;
  vi a(n);
  rep(i,n){
    cin>>a[i];
  }

  while(q--){
    int x;
    cin>>x;
    int ans=0;
    int i=0,j=0;
    int s=0;
    while(i<n){
      while(i<n&&s<=x){
        s+=a[i];
        i++;
        if(s<=x){
          ans+=i-j;
        }
      }
      while(s>x){
        s-=a[j];
        j++;
        if(s<=x){
          ans+=i-j;
        }
      }
    }
    cout<<ans<<endl;
  }


}


Measured memory_bytes: 3564
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int a,b,c;
    cin>>a>>b>>c;
    if (a<b){
    	if (c<b){
    		if(a<c){
    			cout<<a<<" "<<c<<" "<<b<<endl;
    		}else{
    			cout<<c<<" "<<a<<" "<<b<<endl;
    		}
    	}else{
    		cout<<a<<" "<<b<<" "<<c<<endl;
    	}
    }else if(b<a){
    	if(b<c){
    		if(c<a){
    			cout<<b<<" "<<c<<" "<<a<<endl;
    		}else{
    			cout<<b<<" "<<a<<" "<<c<<endl;
    		}
    	}else{
    		cout<<c<<" "<<b<<" "<<a<<endl;
    	}
    }
}

Measured memory_bytes: 3080
#include<iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <math.h>
#include <functional>
#include <iomanip>
#include <bitset>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
const long long mod = 1000000007;
typedef long long ll;

int main() {
	
	string str;
	cin >> str;
	
	int N = str.size() - 1;

	for (int i = 0; i < (1 << N); i++) {
		int ans = str.at(0) - '0';
		bitset<8> s(i);

		for (int j = 0; j < N; j++) {
			if (s.test(j)) {
				ans += str.at(j + 1) - '0';
			} 
			else {
				ans -= str.at(j + 1) - '0';
			}
		}
		if (ans == 7) {
			string str2 = "";
			str2 += str.at(0);
			for (int k = 0; k < N; k++) {
				if (s.test(k)) {
					str2 += '+';
					str2 += str.at(k+1);
				}
				else {
					str2 += '-';
					str2 += str.at(k+1);
				}
			}
			cout << str2 + "=7" << endl;
			break;
		}
	}

	
	return 0;
}

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

using namespace std;

const int WHITE = 0, GREY = 1, BLACK = 2;
const int INF = 1000000;

struct BFS {
    int n;
    vector<vector<int>> g;
    vector<int> parent;
    vector<int> distance;
    vector<int> color;
    
    BFS (int n) : n(n) {
        g.assign(n, vector<int>(0));
        parent.assign(n, -2);
        distance.assign(n, INF);
        color.assign(n, WHITE);
    }
    
    void addEdge (int u, int v) {
        g[u].push_back(v);
    }
    
    void bfs (int s) {
        queue<int> q;
        q.push(s);
        parent[s] = -1;
        distance[s] = 0;
        color[s] = GREY;
        while (!q.empty()) { //u = current, v = neighbors
            int u = q.front();
            q.pop();
            for (int v : g[u]) {
                if (color[v] == WHITE) {
                    q.push(v);
                    parent[v] = u;
                    distance[v] = distance[u] + 1;
                    color[v] = GREY;
                }
            }
            color[u] = BLACK;
        }
    }
    
    void printResults () {
        for (int i = 0; i < n; i++) {
            int dist = distance[i];
            if (dist == INF) {
                dist = -1;
            }
            cout << i + 1 << " " << dist << endl;
        }
    }
};

int main() {
    
    int n;
    cin >> n;
    BFS bfs(n);
    
    for (int i = 0; i < n; i++) {
        int u, k;
        cin >> u >> k;
        for (int j = 0; j < k; j++) {
            int v;
            cin >> v;
            bfs.addEdge(u - 1, v - 1);
        }
    }
    
    bfs.bfs(0);
    bfs.printResults();
    
    return 0;
}


Measured memory_bytes: 3172
#include <iostream>
#include <iomanip>
#include <string>
#include <string.h>
#include <math.h>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <algorithm>
#include <utility>
#include <deque>
#include <queue>
#include <functional>

#define rep(i, n) for(int i = 0; i < n; ++i)
#define REP(i, m, n) for(int i = m; i < n; ++i)
#define rrep(i,n) for(int i = n; i >= 0; --i)
#define RREP(i, m, n) for(int i = n; i >= m; --i)
#define llrep(i, n) for(ll i = 0; i < n; ++i)
#define llREP(i, m, n) for(ll i = m; i < n; ++i)
#define llrrep(i,n) for(ll i = n; i >= 0; --i)
#define llRREP(i, m, n) for(ll i = n; i >= m; --i)

using ll = long long;
using ull = unsigned long long;
using pii = std::pair<int, int>;
using pll = std::pair<long long, long long>;
using pli = std::pair<long long, int>;
using plpii = std::pair<long long, std::pair<int, int>>;
using pdd = std::pair<double, double>;

using namespace std;

const long long _MOD = 1000000007;
const long long MOD = 998244353;
const int ALPHABET = 27;
const double pi = 3.14159265358979;

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

	ll n;
	cin >> n;
	map<ll, ll> primes;
	llRREP(number, 1, n) {
		ll quotient = number;
		for (ll i = 2; i*i <= quotient; ++i) {
			if (quotient%i == 0) {
				ll prime = i, power = 1;

				quotient /= i;
				while (quotient%i == 0) {
					++power;
					quotient /= i;
				}

				primes[prime] += power;
			}
		}
		if (quotient != 1) primes[quotient] += 1;
	}

	ll ans = 1;
	for (auto p = primes.begin(); p != primes.end(); ++p) {
		ans *= (*p).second + 1;
		ans %= _MOD;
	}

	cout << ans << "\n";

	return 0;
}



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

class E
{
	static void Main()
	{
		var z = Console.ReadLine().Split().Select(int.Parse).ToArray();
		int h = z[0], w = z[1], k = z[2];
		var s = new int[h].Select(_ => Console.ReadLine()).ToArray();

		var m = 1 << 30;
		var bits = 1 << (h - 1);

		for (int x = 0; x < bits; x++)
			m = Math.Min(m, ForBit(x));
		Console.WriteLine(m);

		int ForBit(int x)
		{
			var c = 0;
			var map = new Dictionary<int, int>();
			var mi = 0;
			for (int i = 0; i < h; i++)
			{
				map[i] = mi;
				if ((x & (1 << i)) != 0) { mi++; c++; }
			}

			// 累積和
			var whites = new int[mi + 1, w + 1];
			for (int j = 0; j < w; j++)
			{
				for (int i = 0; i <= mi; i++)
					whites[i, j + 1] = whites[i, j];
				for (int i = 0; i < h; i++)
					if (s[i][j] == '1') whites[map[i], j + 1]++;
			}

			var tj = 0;
			for (int j = 1; j <= w; j++)
			{
				for (int i = 0; i <= mi; i++)
				{
					if (whites[i, j] - whites[i, tj] <= k) continue;
					if (tj == j - 1) return 1 << 30;
					tj = j - 1;
					c++;
				}
			}
			return c;
		}
	}
}


Measured memory_bytes: 39004
a,b,c,d = map(int, input().split())
ab = [ 1 if a<= i and i < b else 0 for i in range(100)]
cd = [ 1 if c<= i and i < d else 0 for i in range(100)]
cnt = 0

for i in range(100):
    if ab[i] == 1 and cd[i] == 1:
        cnt += 1

print(cnt)

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

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

	long long n1 = 1;
	long long n2 = 1;

	for(int i=0; i<n; i++){
		long long t, a;
		cin >> t >> a;

		long long times = max((n1 + t - 1) / t, (n2 + a -1) / a);
		n1 = t * times;
		n2 = a * times;
	}

	cout << n1 + n2 << endl;

	return 0;
}


Measured memory_bytes: 256
var
	ans,a,b,c,r,s,ax,ay,bx,by,cx,cy:double;
begin
	read(ax,ay,bx,by,cx,cy);
	s:=(bx-ax)*(cy-ay)-(cx-ax)*(by-ay);
	if s<0 then s:=-s;
	a:=sqrt((bx-ax)*(bx-ax)+(by-ay)*(by-ay));
	b:=sqrt((cx-bx)*(cx-bx)+(cy-by)*(cy-by));
	c:=sqrt((ax-cx)*(ax-cx)+(ay-cy)*(ay-cy));
	r:=s/(a+b+c);
	if a<b then a:=b;
	if a<c then a:=c;
	ans:=1/(2/a+1/r);
	writeln(ans:0:9);
end.


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

int main() {
    string s,t;
    cin>>s>>t;
    ll n=s.size();
    ll m=t.size();
    if(n<m)cout<<-1<<endl;
    else
    {
        unordered_set<string> set;
        for(ll i=0;i<=n-m;i++)
        set.insert(s.substr(i,m));
        ll ans=m;
        for(auto it=set.begin();it!=set.end();it++)
        {
            string f=(*it);
            ll v=0;
            for(int i=0;i<m;i++)if(f[i]!=t[i])v++;
            ans=min(ans,v);
        }
        cout<<ans<<endl;
    }
    return 0;
}

Measured memory_bytes: 3576
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ABC90_3
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split(' ');
            long N = long.Parse(s[0]);
            long M = long.Parse(s[1]);
            if (N == 1 && M == 1)
            {
                Console.WriteLine(1);
            }else if(N == 1 && M > 2)
            {
                Console.WriteLine(M - 2);
            }else if(N > 2 && M == 1)
            {
                Console.WriteLine(N - 2);
            }else if(N == 2 || M == 2)
            {
                Console.WriteLine(0);
            }
            else
            {
                Console.WriteLine(N * M - 2 * (N + M - 2));
            }
        }
    }
}


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

using namespace std;

int main()
{
    int n, l;
    cin >> n >> l;

    string s[101] = {};
    for (int i = 0; i < n; ++i) cin >> s[i];
    sort(s, s + n);
    for (int i = 0; i < n; ++i) cout << s[i];
    cout << endl;
}

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

using namespace std;

using ll = long long;

struct UnionFind {
    std::vector<int> data;

    UnionFind() {}
    UnionFind(int size) : data(size, -1) {}

    bool unite(int x, int y) {
        x = root(x); y = root(y);
        if (x != y) {
            if (data[y] < data[x]) std::swap(x, y);
            data[x] += data[y]; data[y] = x;
        }
        return x != y;
    }
    bool find(int x, int y) { return root(x) == root(y); }
    int size(int x) { return -data[root(x)]; }
    int root(int x) { return data[x] < 0 ? x : data[x] = root(data[x]); }
};

ll Solve() {
    int n;
    cin >> n;

    vector<pair<int, int>> x(n), y(n);
    for (int i = 0; i < n; ++i) {
        cin >> x[i].first >> y[i].first;
        x[i].second = y[i].second = i;
    }

    sort(x.begin(), x.end());
    sort(y.begin(), y.end());

    struct Edge {
        int src, dst;
        ll w;
        Edge() {}
        Edge(int _s, int _d, ll _w) : src(_s), dst(_d), w(_w) {}
        bool operator<(const Edge &e) { return w < e.w; }
    };

    vector<Edge> edges;
    for (int i = 1; i < n; ++i)
        edges.emplace_back(Edge(x[i - 1].second, x[i].second,
                                x[i].first - x[i - 1].first));
    for (int i = 1; i < n; ++i)
        edges.emplace_back(Edge(y[i - 1].second, y[i].second,
                                y[i].first - y[i - 1].first));

    ll res = 0;
    UnionFind uf(n);
    sort(edges.begin(), edges.end());
    for (auto e : edges) {
        if (uf.find(e.src, e.dst)) continue;
        res += e.w;
        uf.unite(e.src, e.dst);
    }

    return res;
}

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

    cout << Solve() << endl;

    return 0;
}


Measured memory_bytes: 7920
//Zory-2019
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pr pair<int,int>
#define FR first
#define SE second
#define MP make_pair
#define PB push_back
#define vc vector
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
#define bin(x) (1ll<<(x))
#define fo(i,l,r) for(int i=(l),I=(r);i<=I;i++)
#define fd(i,r,l) for(int i=(r),I=(l);i>=I;i--)
#ifdef DEBUG
    #define GG(x) assert(x)
#else
    #define GG(x) (x)
#endif
namespace mine
{
    ll qread()
    {
        ll ans=0,f=1;char c=getchar();
        while(c<'0' or c>'9') {if(c=='-')f=-1;c=getchar();}
        while('0'<=c and c<='9') ans=ans*10+c-'0',c=getchar();
        return ans*f;
    }
    void write(ll num){if(num<0) putchar('-'),num=-num;if(num>=10) write(num/10);putchar('0'+num%10);}
    void write1(ll num){write(num);putchar(' ');}
    void write2(ll num){write(num);putchar('\n');}
    template<typename T> void chmax(T &x,const T y) {x=(x>y?x:y);}
    template<typename T> void chmin(T &x,const T y) {x=(x<y?x:y);}
    ll gcd(ll x,ll y){return y?gcd(y,x%y):x;}

    const int INF=0x3f3f3f3f;
    const int MOD=1e9+7;
    int mm(const int x){return x>=MOD?x-MOD:x;}
    template<typename T> void add(T &x,const int &y){x=(x+y>=MOD?x+y-MOD:x+y);}
    ll qpower(ll x,ll e,int mod=MOD){ll ans=1;GG(e>=0);while(e){if(e&1)ans=ans*x%mod;x=x*x%mod;e>>=1;}return ans;}
    ll invm(ll x){return qpower(x,MOD-2);}
    const int N=2e5+10;

    int A[N];map<int,int> f[N];
    void upd(int x,int pos,int val){//差分
        if(pos<0 or pos>A[x]) return;
        if(f[x].count(pos))chmin(f[x][pos],val);else f[x][pos]=val;
    }
    void main()
	{
        int n=qread();fo(i,1,n) A[i]=qread();f[0][0]=0;
        fo(i,0,n)
        {
            int lst=f[i].begin()->SE;
            for(map<int,int>::iterator IT=++f[i].begin();IT!=f[i].end();)
                {chmin(IT->SE,lst);if(lst==IT->SE) f[i].erase(IT++); else lst=IT->SE,IT++;}
            for(auto now:f[i])
            {
                int xi=now.FR,val=now.SE;
                if(!xi) upd(i+1,0,val+(A[i+1]-A[i]>0)),upd(i+1,A[i+1]-A[i],val);
                else if(A[i+1]==A[i]) upd(i+1,0,val+2),upd(i+1,xi,val);
                else if(A[i+1]-A[i]+xi>0) upd(i+1,0,val+2),upd(i+1,min(xi,A[i+1]-A[i]+xi),val+1),upd(i+1,max(xi,A[i+1]-A[i]+xi),val);
                else upd(i+1,0,val+1),upd(i+1,xi,val);
            }
        }write(f[n+1][0]);
	}
};//(ans+MOD)%MOD
signed main()
{
    srand(time(0));
    mine::main();
}


Measured memory_bytes: 38528
#include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	int *arr = new int[n];
	for(int i=0;i<n;i++)
		cin>>arr[i];
	int flag=1;
	for(int i=0;i<n;i++)
	{
		if(arr[i]%2==0&&!(arr[i]%3==0||arr[i]%5==0))
			flag=0;
	}
	if(flag)
		cout<<"APPROVED"<<endl;
	else
		cout<<"DENIED"<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i <(n); ++i)
#define ALL(v) v.begin(), v.end()
using namespace std;
using ll = long long;
using P = pair<int,int>;
static const double PI = acos(-1);



int main(){
  int n, m, c;
  cin >> n >> m >> c;
  vector<int> b(m);

  int ans = 0;
  int sum = 0;
  REP(i,m) cin >> b[i];

  REP(i,n){
    sum = c;
    REP(j,m){
      int a;
      cin >> a;
      sum += a*b[j];
    }
    if(sum > 0){
      ++ans;
    }
  }

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

Measured memory_bytes: 3568
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
#include <iomanip>
#include <set>
#include <stdio.h>
#include <ctype.h>
#include <random>
#include <string.h>
#include <cmath>
#include <unordered_map>
#include <cstdio>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long ll;

ll gcd(ll x, ll y) {
	if (y == 0)return x;
	return gcd(y, x%y);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}
ll kai(ll x, ll y, ll m) {
	ll res = 1;
	for (ll i = x - y + 1; i <= x; i++) {
		res *= i; res %= m;
	}
	return res;
}
ll mod_pow(ll x, ll y, ll m) {
	ll res = 1;
	while (y > 0) {
		if (y & 1) {
			res = res * x % m;
		}
		x = x * x % m;
		y >>= 1;
	}
	return res;
}

ll comb(ll x, ll y, ll m) {
	if (y > x)return 0;
	return kai(x, y, m) * mod_pow(kai(y, y, m), m - 2, m) % m;
}

int n;

signed main() {
	cin >> n;
	for (int i = 1000; i <= 10000; i += 1000)if (n <= i) {
		cout << i - n << endl;
		return 0;
	}
}

Measured memory_bytes: 3644
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>

using namespace std;

int64_t F(int64_t A, int64_t B){

    if( A == 0 ){
        if( B%2 == 1 ) return ( (B+1)%4 == 0)? 0:1;
        return (B/2)%2 ^ B;
    }

    return F(0,B) ^ F(0,A-1);
}

int main() {
    int64_t A, B;
    cin >> A >> B;

    cout << F(A, B) << endl;
}

Measured memory_bytes: 256
import sys
import numpy as np

lines = sys.stdin.readlines()
bingo_card = np.zeros([3,3])
for i, l in enumerate(lines):
    if i <= 2:
        bingo_card[i] = [int(num) for num in l.split()]
    else:
        bingo_card[bingo_card == int(l)] = None
        
check_arr = np.isnan(bingo_card)
if check_arr[0].sum() == 3 or check_arr[1].sum() == 3 or check_arr[2].sum() == 3:
    print('Yes')
elif check_arr[:, 0].sum() == 3 or check_arr[:, 1].sum() == 3 or check_arr[:, 2].sum() == 3:
    print('Yes')
elif check_arr[0,0] and check_arr[1,1] and check_arr[2,2]:
    print('Yes')
elif check_arr[0,2] and check_arr[1,1] and check_arr[2,0]:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 12528
#include<stdio.h>

int main(){

    int n,d;
    scanf("%d %d",&n,&d);

    int range = 2*d+1;
    if(n%range==0){
        printf("%d\n",(n/range));
    }else{
        printf("%d\n",(n/range)+1);
    }

    return 0;
}

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

using namespace std;

const int maxn = 3010;

string mx;
int n, last;
int vis[maxn<<1];
char str[maxn<<1];
vector<string> ans;
int sum;

void solve1(int l, int r) {
	string res;
	int cur_a = l, cur_b = l;
	int cnt_a = 0, cnt_b = 0;
	int lastp = l-1;
	for (int i = 1; i <= (r-l+1)/2; i++) {
		while (cnt_a < i) {
			if (str[cur_a] == 'a') ++ cnt_a;
			++ cur_a;
		}
		while (cnt_b < i) {
			if (str[cur_b] == 'b') ++ cnt_b;
			++ cur_b;
		}
		if (cur_a - 1 > lastp) {
			lastp = cur_b - 1;
			res.push_back('a');
			res.push_back('b');
		}
	}
	if (mx.empty() || mx[0] == 'a') {
		mx = res;
		ans.push_back(mx);
	}
}

void solve2(int l, int r) {
	string t_mx;
	int cnt_a = 0, cnt_b = 0;
	int cur_a = r, cur_b = r;
	for (int i = 1; i <= (r-l+1)/2; i++) {
		while (cnt_a < i) {
			if (str[cur_a] == 'a') {
				vis[cur_a] = 1;
				++ cnt_a;
			}
			-- cur_a;
		}
		while (cnt_b < i) {
			if (str[cur_b] == 'b') {
				vis[cur_b] = 1;
				++ cnt_b;
			}
			-- cur_b;
		}
		string tmp;
		for (int j = l; j <= r; j++) if (vis[j]) tmp.push_back(str[j]);
		t_mx = max(t_mx, tmp);
	}
	if (t_mx >= mx) {
		mx = t_mx;
		ans.push_back(mx);
	}
}

void solve(int l, int r) {
	if (str[l] == 'a') solve1(l, r);
	else solve2(l, r);
}

int main() {
	scanf("%d", &n);
	scanf("%s", str+1);
	last = 2*n;
	for (int i = 2*n; i >= 1; i--) {
		if (str[i] == 'a') ++ sum;
		if (str[i] == 'b') -- sum;
		if (sum == 0) {
			solve(i, last);
			last = i-1;
		}
	}
	reverse(ans.begin(), ans.end());
	for (int i = 0; i < ans.size(); i++) printf("%s", ans[i].c_str());	
	puts("");
	return 0;
}

Measured memory_bytes: 384
lines=readlines(chomp: true).map{|line| line.split(' ').map(&:to_i)}
n_q=lines.shift
datas =[]
lines.each do |query|
    if query[0]==0 then#unite selected sets
        elem1=[]
        elem2=[]
        datas.each do |data|
            if !elem1.empty? && !elem2.empty? then
                break
            elsif data.include?(query[1]) then
                elem1 = data
            elsif data.include?(query[2]) then
                elem2 = data
            end
        end
        if elem1.empty? then
            elem1=[query[1]]
        else
            datas.delete(elem1)
        end
        if elem2.empty? then
            elem2=[query[2]]
        else
            datas.delete(elem2)
        end
        datas << elem1.concat(elem2)
    else #query[0]==1, determine whether two selected elements are in the same sets
        is_exist = 0
        datas.each do |data|
            if data.include?(query[1]) || data.include?(query[2]) then
                if data.include?(query[1]) && data.include?(query[2]) then
                    is_exist = 1
                    break
                end
            end
        end
        puts is_exist
    end
end


Measured memory_bytes: 103892
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef pair<int,int> pint;
typedef pair<long long, long long> pll;

#define MP make_pair
#define PB push_back
#define ALL(s) (s).begin(),(s).end()
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P) 
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P) 
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P) 
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s; }


bool ch[40];

int main() {
    memset(ch, 0, sizeof(ch));
    for (int i = 0; i < 28; ++i) {
        int a; cin >> a; ch[a] = 1;
    }
    for (int i = 1; i <= 30; ++i) {
        if (!ch[i]) cout << i << endl;
    }
    
    return 0;
}


Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);i++)
#define ALL(a)  (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define REV(c) reverse((c).begin(),(c).end())

using namespace std;
typedef pair<int,int> P;

// 最大公約数
int64_t gcd(int64_t a, int64_t b) {
  return b != 0 ? gcd(b, a % b) : a;
}

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

int ctoi(char c){
  return c - '0';
}


int n,m;
vector<P> vec(10000);
int rec(int x, auto r){
  int t=0;
  r[x] = true;
  REP(i,m){
    int f = vec.at(i).first;
    int s = vec.at(i).second;
    if (vec.at(i).first == x){
      if (!r[vec.at(i).second]){
        t += rec(vec.at(i).second, r);
      }
    } else if (vec.at(i).second == x){
      if (!r[vec.at(i).first]){
        t += rec(vec.at(i).first, r);
      }
    }
  }
  bool chk=true;
  REP(i,n+1){
    if (i!=0){
      if (!r[i]){
        chk = false;
      }
    }
  }
  if (chk){return 1;}
  return t;
}

int main(){
  cin >> n >> m;
  vector<bool> reached(10);
  REP(i,10){
    reached[i] = false;
  }
  REP(i,m){
    cin >> vec.at(i).first >> vec.at(i).second;
  }
  int t = rec(1,reached);
  cout << t << endl;
  return 0;
}




Measured memory_bytes: 384
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<map> //要学会用map 
using namespace std;
/*如果a大于0且b大于0，但相加得到的却是小于等于0的说明是正溢出，这时肯定比c大（因为c肯定在long long的范围内）。
如果a小于0且b小于0，但相加得到的却是大于等于0的说明是负溢出，这是肯定比c小。*/
const int maxn = 10001;
int prime[maxn],pNum = 0;
bool p[maxn] = {0};
void Find_Prime()
{
	for(int i=2;i<maxn;i++)
	{
		if(p[i] ==false)
		{
			prime[pNum++]=i;
			for(int j=i+i;j<maxn;j+=i)
			{
				p[j] = true;
			}
		}
	}
}
int main(){
	int n,a,b;
	scanf("%d %d %d",&n,&a,&b);
	if(n==1)
	{
		if(a==b) printf("1");
		else printf("0");
	}
	else
	{
		if(a>b) printf("0");
		else printf("%lld",(long long)(b-a)*(n-2)+1);
	}
	return 0;	
}

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

using namespace std;
using ll = long long;

#define REP(i,m,n) for(ll (i)=(m),i##_len=(n);(i)<(i##_len);++(i))
#define FORR(i,v) for(auto (i):v)
#define ALL(x) (x).begin(), (x).end()
#define _PR(x) cout << (x) << endl
#define _PS(x) cout << (x) << " "
#define SZ(x) ((int)(x).size())
#define MAX(a,b) (((a)>(b))?(a):(b))
#define MIN(a,b) (((a)<(b))?(a):(b))
#define pb push_back

int main()
{
    ll r;
    cin >> r;

    _PR(r * r);

    return 0;
}

/*



*/

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<queue>
#include<map>
#include<string>
#include<algorithm>
using namespace std;
typedef pair<string,int> Pa;
map<string,int>MP;
queue<Pa>Q;
Pa temp,t;
int bz[4]={4,-4,1,-1};
void bfs(){
	while(!Q.empty()){
		temp=Q.front();
		Q.pop();
		for(int i=0;i<4;i++){
			int next=bz[i]+temp.second;
			string str=temp.first;
			swap(str[next],str[temp.second]);
			map<string,int>::iterator it=MP.find(str);
			if(next>=0&&next<8&&!(next==3&&temp.second==4)&&!(next==4&&temp.second==3)&&it==MP.end()){
				MP[str]=MP[temp.first]+1;
				t.first=str;t.second=next;
				Q.push(t);
			}
		}
	}
}
int main(){
	string ans;
	Pa t("01234567",0);
	MP["01234567"]=0;
	Q.push(t);
	bfs();
	while(getline(cin,ans)){
		ans.erase(remove(ans.begin(),ans.end(),' '),ans.end());
		printf("%d\n",MP[ans]);
	}
}

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

using namespace std;

int main() {
	int n;
	cin >> n;
	if(n % 2 == 1) {
		cout << "No\n";
		return 0;
	}
	string s;
	cin >> s;
	int hf = n / 2;
	for(int i = 0; i < hf; i++) {
		if(s[i] != s[i + hf]) {
			cout << "No\n";
			return 0;
		}
	}
	cout << "Yes\n";
	return 0;
}

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

int main() {
  long a, b, k;
  cin >> a >> b >> k;
  
  long c, d;
  c = d = 0;
  
  if (a <= k) {
    c = 0;
    if (b <= k - a) {
      d = 0;
    } else {
      d = b - k + a;
    }
  } else {
    c = a - k;
    d = b;
  }
  
  cout << c << " " << d << endl;
  
  return 0;
}

Measured memory_bytes: 256
/*
	Name:
	Author: xiaruize
	Date:
*/

#include<bits/stdc++.h>
using namespace std;
#define ull unsigned long long
#define MOD 1000000007
#define ALL(a) (a).begin(), (a).end()
#define forn(i, n) for (int i = 0; i < int(n); i++)
#define ll long long
#define form(i,j,n) for(int i=int(j);i<=int(n);i++)
#define pb push_back
#define mk make_pair
#define pii pair<int,int>
#define pis pair<int,string>
#define sec second

int main()
{
 	ios::sync_with_stdio(false);
	cin.tie(0);
 	//freopen(".in","r",stdin);
	//freopen(".out","w",stdout);
	int a[10][10];
	for(int i=0;i<3;i++)
	{
		for(int j=0;j<3;j++)
		{
			cin>>a[i][j];
		}
	}
	int n;
	cin>>n;
	int x;
	bool p[10][10]={false};
	for(int k=0;k<n;k++)
	{
		cin>>x;
		for(int i=0;i<3;i++)
		{
			for(int j=0;j<3;j++)
			{
				if(a[i][j]==x)
				{
					p[i][j]=true;
				}
			}
		}
	}
	bool flag=false;
	for(int i=0;i<n;i++)
	{
		if(p[i][0]&&p[i][1]&&p[i][2]||\
		p[0][i]&&p[1][i]&&p[2][i])
		{
			flag=true;
		}
	}
	if(p[0][0]&&p[1][1]&&p[2][2]||p[2][0]&&p[1][1]&&p[0][2])
	{
		flag=true;
	}
	if(flag)
		cout<<"Yes"<<endl;
	else
		cout<<"No"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <functional>

int D, N, T[212], A[212], B[212], C[212];
int dp[212][212], ans = 0;

// dp[i,j] := ?????\??????j??????????????????,
//			  i??\????????§????´??????????????????¶?????????????¨?????????§???

int main(void) {
	scanf("%d%d", &D, &N);
	for (int i = 0; i < D; ++i) { scanf("%d", &T[i]); }
	for (int i = 0; i < N; ++i) { scanf("%d%d%d", &A[i], &B[i], &C[i]); }

	memset(dp, -1, sizeof(dp));
	for (int i = 0; i < N; ++i) {
		if (A[i] <= T[0] && T[0] <= B[i]) { dp[0][i] = 0; }
	}
	for (int i = 1; i < D; ++i) {
		for (int j = 0; j < N; ++j) {
			if (dp[i - 1][j] != -1) {
				for (int k = 0; k < N; ++k) {
					if (A[k] <= T[i] && T[i] <= B[k]) {
						dp[i][k] = std::max(dp[i][k], dp[i - 1][j] + abs(C[k] - C[j]));
					}
				}
			}
		}
	}

	for (int i = 0; i < N; ++i) {
		ans = std::max(ans, dp[D - 1][i]);
	}
	printf("%d\n", ans);
	return 0;
}

Measured memory_bytes: 2872
#[allow(unused_imports)]
use std::char::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;

#[allow(unused_macros)]
macro_rules! debug {($($a:expr),*) => {println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);}}
#[allow(unused_macros)]
macro_rules! input { ( source = $ s : expr , $ ( $ r : tt ) * ) => { let mut iter = $ s . split_whitespace ( ) ; let mut next = || { iter . next ( ) . unwrap ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; ( $ ( $ r : tt ) * ) => { let stdin = std :: io :: stdin ( ) ; let mut bytes = std :: io :: Read :: bytes ( std :: io :: BufReader :: new ( stdin . lock ( ) ) ) ; let mut next = move || -> String { bytes . by_ref ( ) . map ( | r | r . unwrap ( ) as char ) . skip_while ( | c | c . is_whitespace ( ) ) . take_while ( | c |! c . is_whitespace ( ) ) . collect ( ) } ; input_inner ! { next , $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! input_inner { ( $ next : expr ) => { } ; ( $ next : expr , ) => { } ; ( $ next : expr , $ var : ident : $ t : tt $ ( $ r : tt ) * ) => { let $ var = read_value ! ( $ next , $ t ) ; input_inner ! { $ next $ ( $ r ) * } } ; }
#[allow(unused_macros)]
macro_rules! read_value { ( $ next : expr , ( $ ( $ t : tt ) ,* ) ) => { ( $ ( read_value ! ( $ next , $ t ) ) ,* ) } ; ( $ next : expr , [ $ t : tt ; $ len : expr ] ) => { ( 0 ..$ len ) . map ( | _ | read_value ! ( $ next , $ t ) ) . collect ::< Vec < _ >> ( ) } ; ( $ next : expr , chars ) => { read_value ! ( $ next , String ) . chars ( ) . collect ::< Vec < char >> ( ) } ; ( $ next : expr , usize1 ) => { read_value ! ( $ next , usize ) - 1 } ; ( $ next : expr , $ t : ty ) => { $ next ( ) . parse ::<$ t > ( ) . expect ( "Parse error" ) } ; }

#[derive(PartialEq, PartialOrd)]
pub struct Total<T>(pub T);
impl<T: PartialEq> Eq for Total<T> {}
impl<T: PartialOrd> Ord for Total<T> { fn cmp(&self, other: &Total<T>) -> std::cmp::Ordering { self.0.partial_cmp(&other.0).unwrap() }}

#[allow(dead_code)]
const MAX:usize = 100006;
#[allow(dead_code)]
const INF_U32:u32 = 1 << 31;
#[allow(dead_code)]
const INF_I32:i32 = 1 << 30;
#[allow(dead_code)]
const INF_U64:u64 = 1 << 63;
#[allow(dead_code)]
const INF_I64:i64 = 1 << 62;


fn main() {
    input! {a:i32,b:i32,c:i32};

    println!("{}",
        if a == b {c}
        else if b == c {a}
        else {b}
    );

}


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


int main() {
int a,b,h;
cin >> a >> b >> h;
int ans = (a+b) *h /2;
cout << ans << endl;



return 0;
}

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

int main() {
   int N;
   cin >> N;
   vector<int> A(N);
   for(int i=1; i<=N; i++) {
      cin >> A[i];
   }
   int next = 1;
   int count = 0;
   for(int i=0; i<N; i++) {
      if(next == 2) {
         cout << count << endl;
         return 0;
      }
      next = A[next];
      count++;
   }
   cout << -1 << endl;
}

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

int main() {
  int H, A;
  cin >> H >> A;
  int ans = H / A;
  if (H % A != 0) ans++;
  cout << ans << endl;
  return 0;
}


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


public class Main {
	
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		while(true){
			String str = sc.nextLine();
			
			if("0".equals(str)){
				break;
			}
			
			String[] strs = str.split(" ");
			
			int[] cards = new int[14];
			for(int i = 0; i < strs.length; i++){
				cards[Integer.parseInt(strs[i])]++;
			}
			
			int card = 0;
			
			for(int i = 2; i <= 13; i++){
				if(cards[i] != 0){
					card += i > 10 ? 10 * cards[i] : i * cards[i];
				}
			}
			
			
			while (cards[1] > 0) {
				if (card + (cards[1] - 1) < 11) {
					card += 11;
					cards[1]--;
				} else {
					card += 1;
					cards[1]--;
				}
			}
			
			if(card > 21){
				System.out.println(0);
			}else{
				System.out.println(card);
			}
			
			
			
			
		}

	}

}

Measured memory_bytes: 12000
#include<iostream>
#include<cstdio>
#include<cmath>
#include<vector>
int center=0;

using namespace std;

int binarySearch(int* S, int from, int to ,int t ){

	center= (from + to)/2;

//	printf("(from, center, to) = (%d, %d, %d)\n", from, center, to);

	if( from >= to ){
		return t == S[center];
	}else if( t == S[center] ){
		return 1;
	}else if( S[center] < t ){
		return binarySearch(S, center+1, to, t);
	}else if( t < S[center] ){
		return binarySearch(S, from, center-1, t);
	}



}


	


int main(){

	int *S, *T;
	int S_size, T_size, temp;

	scanf("%d", &S_size);
	S=new int[S_size];
	for( int i=0; i<S_size; i++ ){
		scanf("%d", &temp);
		S[i]=temp;
	}
	scanf("%d", &T_size);
	T=new int[T_size];
	for( int i=0; i<T_size; i++ ){
		scanf("%d", &temp);
		T[i]=temp;
	}

	int ans=0;

	
	for( int i=0; i<T_size; i++ ){

		ans +=binarySearch(S, 0, S_size -1,  T[i] );
	}
	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 1796
import java.util.Map;
import java.util.Map.Entry;
import java.util.Scanner;
import java.util.TreeMap;

class Main {

	public static void main(String[] args) {

		Scanner sc = null;
		Map<Integer, Integer> nums = new TreeMap<Integer, Integer>();
		try {
			sc = new Scanner(System.in);
			int maxValue = 0;
			while (sc.hasNextInt()) {
				int num = sc.nextInt();
				nums.put(num, nums.containsKey(num) ? nums.get(num) + 1 : 1);
				if (maxValue < nums.get(num)) {
					maxValue = nums.get(num);
				}
			}
			for (Entry<Integer, Integer> entry : nums.entrySet()) {
				if (maxValue == entry.getValue()) {
					System.out.println(entry.getKey());
				}
			}

		} finally {
			sc.close();
		}
	}
}

Measured memory_bytes: 26052
a, b, c, x, y = map(int, input().split())

c = c * 2

total = 0

minimum = min(x,y)

if a + b > c:
  total += minimum * c
  x -= minimum
  y -= minimum

if x > 0:
  if a > c:
    total += x * c
  else:
    total += x * a

if y > 0:
  if b > c:
    total += y * c
  else:
    total += y * b

print(total)


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

struct c {
	bool three = false;
	bool five = false;
	bool seven = false;
	long value=0;
};
long ans, n;
void dfs(c i) {
	if (n < i.value) {
		return;
	}
	//cout << i.value << endl;
	if (i.three && i.five && i.seven) {
		ans++;
	}
	long v = 10 * i.value;
	c w = i;
	w.value = v + 3;
	w.three = true;
	dfs(w);
	w = i;
	w.value = v + 5;
	w.five = true;
	dfs(w);
	w = i;
	w.value = v + 7;
	w.seven = true;
	dfs(w);
}
int main() {
	cin >> n;
	c q;
	dfs(q);
	cout << ans;
	return 0;
}

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

#define REP(i,num) for(int i=0;i<(num);++i)
#define LOOP(i) while(i--)
#define ALL(c) c.begin(),c.end()
#define PRINTALL(c) for(auto pitr=c.begin();pitr!=c.end();++pitr){cout<<*pitr;if(next(pitr,1)!=c.end())cout<<' ';}cout<<endl;
#define PAIRCOMP(c,comp) [](const pair<ll,ll>& lhs,const pair<ll,ll>& rhs){return lhs.c comp rhs.c;}

using namespace std;
using ll = long long;

constexpr ll atcoder_mod = 1e9+7;

template<typename T=int>
T in(){T x; cin >> x; return (x);}
template<typename T=int,typename C=vector<T>>
C vecin(int N){C x(N);REP(i,N){x[i]=in<T>();}return move(x);}

void vout(){cout << endl;}
template<typename Head,typename... Tail>
void vout(Head&& h,Tail&&... t){cout << ' ' << h;vout(forward<Tail>(t)...);}
void out(){cout << endl;}
template<typename Head,typename... Tail>
void out(Head&& h,Tail&&... t){cout << h;vout(forward<Tail>(t)...);}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout<<fixed<<setprecision(10);
	
	ll X=in(),Y=in();
	ll IX=-X,IY=-Y;
	ll ans = 1LL<<50;
	if(X<=Y){
		ans = min(ans,Y-X);
	}
	if(IX<=Y){
		ans = min(ans,Y-IX+1);
	}
	if(X<=IY){
		ans = min(ans,IY-X+1);
	}
	if(IX<=IY){
		ans = min(ans,IY-IX+2);
	}

	out(ans);
	return 0;
}


Measured memory_bytes: 256
# AOJ 0226: Hit and Blow
# Python3 2018.6.25 bal4u

while 1:
	r, a = input().split()
	if r == '0': break
	h = 0
	for i in range(4):
		if r[i] == a[i]: h += 1
	print(h, len(set(r) & set(a))-h)


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

#include <boost/range/adaptors.hpp>
#include <boost/range/irange.hpp>

using namespace std;
using namespace boost;
using namespace boost::adaptors;

int main() {
    int64_t h, w, k;
    cin >> h >> w >> k;

    int64_t x1, y1, x2, y2;
    cin >> x1 >> y1 >> x2 >> y2;

    vector ok(h + 2, vector(w + 2, false));
    for (auto i : irange(0L, h)) {
        string s;
        cin >> s;
        for (auto j : irange(0L, w)) {
            ok[i + 1][j + 1] = (s[j] == '.');
        }
    }

    array dx{-1L, 1L, 0L, 0L};
    array dy{0L, 0L, -1L, 1L};

    vector costs(h + 2, vector(w + 2, numeric_limits<int64_t>::max()));
    queue<std::tuple<int64_t, int64_t>> q;
    costs[x1][y1] = 0;
    q.emplace(x1, y1);

    while (!q.empty()) {
        auto [x, y] = q.front();
        q.pop();

        if (x == x2 && y == y2) {
            cout << costs[x][y] << endl;
            return 0;
        }

        auto nc = costs[x][y] + 1;
        for (auto d : irange(0L, 4L)) {
            for (auto i : irange(1L, k + 1)) {
                auto nx = x + i * dx[d];
                auto ny = y + i * dy[d];

                if (!ok[nx][ny]) {
                    break;
                }

                if (costs[nx][ny] < nc) {
                    break;
                }

                if (nc < costs[nx][ny]) {
                    costs[nx][ny] = nc;
                    q.emplace(nx, ny);
                }
            }
        }
    }

    cout << -1 << endl;
}

Measured memory_bytes: 35052
using System;


public class A{
	
	public static void Main(){
	
		long r = Int64.Parse( Console.ReadLine() );
		if( r < 1200 ){
			Console.WriteLine("ABC");
		}else if( r < 2800 ){
			Console.WriteLine("ARC");
		}else{
			Console.WriteLine("AGC");
		}
		
	}
	
}

Measured memory_bytes: 13140
#include <iostream>
#include <fstream>
#include <set>
using namespace std;
struct node
{
    int zr,unu,nd;
};
bool operator <(node A,node B)
{
    if(1LL*A.unu*B.zr==1LL*B.unu*A.zr) return A.nd<B.nd;
    return (1LL*A.unu*B.zr<1LL*B.unu*A.zr);
}
const int nmax=200005;
int rg[nmax],tt[nmax],p[nmax],zr[nmax],unu[nmax],rep[nmax];
int n,i,x,oth;
long long ans;
set<node> s;
void unite(int A,int B)
{
    if(rg[A]<rg[B]) swap(A,B);
    tt[B]=A;rg[A]+=rg[B];
    int Z=zr[rep[A]]+zr[rep[B]],U=unu[rep[A]]+unu[rep[B]];
    rep[A]=min(rep[A],rep[B]);
    zr[rep[A]]=Z;unu[rep[A]]=U;
}
int finds(int x)
{
    while(x!=tt[x])
        x=tt[x];
    return x;
}
int main()
{
   // freopen("data.in","r",stdin);
    ios_base::sync_with_stdio(false);
    cin>>n;
    for(i=2;i<=n;i++)
    {
        cin>>p[i];
    }
    //unu(i)*zr(j)<zr(i)*unu(j)
    //pt ca i sa fie in spatele lui j
    for(i=1;i<=n;i++)
    {
        cin>>x;
        if(x) s.insert({0,1,i});
        else s.insert({1,0,i});
        zr[i]=(x==0);
        unu[i]=(x==1);
        tt[i]=i;rg[i]=1;rep[i]=i;
    }
    int merges=0;
    while(s.size())
    {
        x=(*s.begin()).nd;
        s.erase(s.begin());
        if(x!=1)
        {
            oth=rep[finds(p[x])];
            s.erase({zr[oth],unu[oth],oth});
            ans+=(1LL*unu[oth]*zr[x]);
            unite(finds(x),finds(oth));
            x=rep[finds(x)];
            s.insert({zr[x],unu[x],x});
        }
    }
    cout<<ans;
    return 0;
}


Measured memory_bytes: 17408
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
using namespace std;
#ifndef FAST_IO
 #define IOS ios_base::sync_with_stdio(false);cin.tie(nullptr);
#endif

#define FILE_IO freopen("input.txt","r",stdin)
#define int long long
#define f first
#define s second
#define endl '\n'
#define all(c) c.begin(),c.end()
#define bp __builtin_popcount
#define debug(x) cerr << #x << " = " << x << endl;

const int MOD = 1e9 + 7;
const int INF = 1e18;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
template <typename T>void print(T t){for(auto &it : t)cout<<it<<" ";}
inline int powerexp(int a, int b, int m = MOD){ int res = 1;while(b){if(b&1)res = res * a % m;a = a * a % m,b >>= 1;}return res % m;}
inline int modinv(int a){ return powerexp(a,MOD-2,MOD);}
inline int lcm(int a, int b){ int g = __gcd(a,b);return a/g*b;}
inline int add(int x, int y){ x += y; if (x >= MOD) x -=  MOD; return x;}
inline int mul(int x, int y){ return (x * 1ll * y) % MOD;}
inline int sub(int x, int y){ x -= y; if (x<0) x += MOD; return x ;}

//-------------------< start here >-------------------------// 

void solve(){
    int a, b, c;
    int cnt = 0;
    cin >> a >> b >> c;
    for(int i = a; i <=b; i++){
	  cnt += ( c % i == 0);	
   }
   cout << cnt << endl;
}

//-----------------------------
//comment from here for TOPCODER 
int32_t main(){
   IOS;
   solve();
   //find();
   #ifdef LOCAL_DEFINE
   cerr << "time elapsed " << (double)clock()/CLOCKS_PER_SEC << endl;
   #endif
}



Measured memory_bytes: 3204
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pb push_back
#define f first
#define s second
#define MOD 1000000007
 
using namespace std;


void solve(){
	ll r; cin>>r; cout<<r*r;


}


int main()
{ 
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	//cout<<fixed<<setprecision(12);
	
	int t =1; 
	//cin>>t;

	for(int i=1; i<=t; i++){
		solve();
		cout<<"\n";
	}
	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ADD(a, b) a = (a + ll(b)) % mod
#define MUL(a, b) a = (a * ll(b)) % mod
#define MAX(a, b) a = max(a, b)
#define MIN(a, b) a = min(a, b)
#define rep(i, a, b) for(int i = int(a); i < int(b); i++)
#define rer(i, a, b) for(int i = int(a) - 1; i >= int(b); i--)
#define all(a) (a).begin(), (a).end()
#define sz(v) (int)(v).size()
#define pb push_back
#define sec second
#define fst first
#define debug(fmt, ...) Debug(__LINE__, ":", fmt, ##__VA_ARGS__)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef pair<int, pi> ppi;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> mat;
typedef complex<double> comp;
void Debug() {cout << '\n'; }
template<class FIRST, class... REST>void Debug(FIRST arg, REST... rest){
	cout<<arg<<" ";Debug(rest...);}
template<class T>ostream& operator<<(ostream& out,const vector<T>& v) {
	out<<"[";if(!v.empty()){rep(i,0,sz(v)-1)out<<v[i]<<", ";out<<v.back();}out<<"]";return out;}
template<class S, class T>ostream& operator<<(ostream& out,const pair<S, T>& v){
	out<<"("<<v.first<<", "<<v.second<<")";return out;}
const int MAX_N = 200010;
const int MAX_V = 100010;
const double eps = 1e-6;
const ll mod = 1000000007;
const int inf = 1 << 29;
const ll linf = 1LL << 60;
const double PI = 3.14159265358979323846;
///////////////////////////////////////////////////////////////////////////////////////////////////

int N;

void solve() {
	cin >> N;
	cout << 48 - N << "\n";
}

int main() {
#ifndef LOCAL
	ios::sync_with_stdio(false);
    cin.tie(0);
#endif
    cout << fixed;
	cout.precision(20);
#ifdef LOCAL
    freopen("in.txt", "rt", stdin);
#endif	
	solve();
#ifdef LOCAL
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int,int>;
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)

const int INF = 1e9 + 10;
 
int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    ll ans = 0;
    for (int i = 1; i < n; ++i) {
        if (a[i-1] <= a[i]) continue;
        ans += a[i-1] - a[i];
        a[i] = a[i-1];
    }
    cout << ans << endl;
    return 0;
}

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

int main() {
  int H, W, N;
  cin >> H >> W;
  vector<char> sharp(W + 2, '#');
  vector<char> img(W + 2, '#');
  
  for (int i = 0; i < sharp.size(); i++) {
    cout << sharp.at(i);
  }
  
  cout << "\n";
  
  for (int i = 0; i < H; i++) {
    for (int j = 1; j <= W; j++) {
      cin >> img.at(j);
    }
    
    for (int j = 0; j < img.size(); j++) {
      cout << img.at(j);
    }
    cout << "\n";
  }
  
  for (int i = 0; i < sharp.size(); i++) {
    cout << sharp.at(i);
  }
  
  cout << "\n";
}


Measured memory_bytes: 256
N,L=map(int,input().split())
a=list(map(int,input().split()))

x=-1
for i in range(0,N-1):
    if a[i]+a[i+1]>=L:
        x=i
        break
if x==-1:
    print("Impossible")
else:
    print("Possible")
    for i in range(N-1, x+1,-1):
        print(i)
    for i in range(0,x+1):
        print(i+1)

Measured memory_bytes: 14060