akhauriyash/Code-Regression huggingface dataset:
//#include <bits/stdc++.h>
 
#include <iostream>
#include <algorithm>
 
#include <bitset>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <cstring>
#include <string>
#include <utility>
#include <array>
#include <complex>
#include <valarray>
 
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#include <chrono>
#include <random>
#include <numeric>
 
 
using namespace std;
#define int long long
 
typedef long long ll;
typedef unsigned long long ull;
//typedef unsigned __int128 HASH;
typedef pair<int,int> pii;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pullull;
typedef pair<ll,int> plli;
typedef pair<double, int> pdbi;
typedef pair<int,pii> pipii;
typedef pair<ll,pll> plpll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;
typedef vector<vector<int>> mat;
 
#define rep(i,n) for (int i=0;i<(n);i++)
#define rep2(i,a,b) for (int i=(a);i<(b);i++)
#define rrep(i,n) for (int i=(n);i>0;i--)
#define rrep2(i,a,b) for (int i=(a);i>b;i--)
#define pb push_back
#define fi first
#define se second
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
 
const ll hmod1 = 999999937;
const ll hmod2 = 1000000000 + 9;
const int INF = 1<<30;
const ll INFLL = 1LL<<62;
const double EPS = 1e-12;
const ll mod = 1000000000 + 7;
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1, 1, 1, 0, 0, -1, -1, -1};
const int dy8[8] = {0, 1, -1, 1, -1, 0, 1, -1};
const double pi = 3.141592653589793;
 
#define addm(X, Y) (X) = ((X) + ((Y) % mod) + mod) % mod
#define inside(y, x, h, w) (0 <= (y) && (y) < (h) && 0 <= (x) && (x) < (w)) ? true : false

int n, k;
int w[100000 + 5], d[100000 + 5];

signed main() {	
    cin.tie(0);
    ios::sync_with_stdio(false);
	cin >> n >> k;
	rep(i, n) cin >> w[i] >> d[i];
	int l = 0, r = 2 * 1e18;
	while (r - l > 1) {
		int m = (r + l) / 2;
		int cnt = 0;
		rep(i, n) {
			cnt += max(0LL, (m - w[i]) / d[i] + 1);
		}
		if (cnt >= k) r = m;
		else l = m;
	} 
	cout << r << endl;
}


Measured memory_bytes: 1792
#include <cstdio>
#include <algorithm>

using namespace std;

#define REP(i,n)   for(int i=0; i<(int)(n); i++)
#define FOR(i,b,e) for(int i=(b); i<=(int)(e); i++)
#define DUMP(a, n) REP(i, n) printf("%d%c", a[i], i + 1 == n ? '\n' : ' ')

const int N_MAX = 100000;
const int N2_MAX = 200002;


int N, C;
int s[N_MAX];
int t[N_MAX];
int c[N_MAX];

int acc[N2_MAX];
int sum[N2_MAX];

void solve() {
  FOR(i, 1, C) {
    fill(acc, acc + N2_MAX, 0);
    REP(j, N) if (c[j] == i) {
      acc[s[j] * 2 - 1] = 1;
      acc[t[j] * 2] = -1;
    }
    REP(j, N2_MAX - 1) acc[j + 1] += acc[j];
    REP(j, N2_MAX) if (acc[j] > 0) sum[j] += 1;
    // DUMP((acc + 60), 50);
  }
  // DUMP((sum + 60), 50);

  int ans = 0;
  REP(i, N2_MAX) if (ans < sum[i]) ans = sum[i];
  printf("%d\n", ans);
}

void input() {
  scanf("%d%d", &N, &C);
  REP(i, N) scanf("%d%d%d", s + i, t + i, c + i);
}

int main() {
  input();
  solve();
  return 0;
}


Measured memory_bytes: 2944
#include <iostream>
#define REP(i, n) for (int i = 0; i < n; i++)

using namespace std;

int a,b;

int main(){
	cin >> a>> b;
	int sub = b - a;
	int ah = 0;
	for(int i = 0;i < sub;i++){
		ah += i;
	}
	cout << (ah - a) << endl;
}

Measured memory_bytes: 256
a=gets.chomp.split("").map { |e| e.to_i }

def func(a,b,s)
  if s=="1"
    return a+b
  else
    return a-b
  end
end

for i in 0..7 do
  s=i.to_s(2).reverse
  acum = a[0]

  for j in 0..2 do
    acum = func(acum,a[j+1],s[j])
  end
  if acum == 7
    ans=a[0].to_s
    for i in 0..2 do
      if s[i] == "1"
        ans = ans + "+"
      else
        ans = ans + "-"
      end
      ans = ans + a[i+1].to_s
    end
    puts ans + "=7"
    exit
  end
end


Measured memory_bytes: 1788
import javax.print.attribute.SupportedValuesAttribute;
import java.io.*;
import java.lang.reflect.Array;
import java.util.*;
import java.util.function.Predicate;

public class Main{
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskB solver = new TaskB();
        solver.solve(in, out);
        out.close();
    }

    static class TaskB {


        public static int binarySearch(int arr[], int low, int high, int key)
        {
            int mid = (low + high)/2;
            while( low <= high )
            {
                if ( arr[mid] < key )
                {
                    low = mid + 1;
                }
                else if ( arr[mid] == key )
                {
                    return mid;
                }else
                {
                    high = mid - 1;
                }
                mid = (low + high)/2;
            }
            if( low > high )
            {
                return -1;
            }
            return -1;
        }

        public static int[][] maxPos;

        public void solve(InputReader in, PrintWriter out) {
            int N = in.nextInt();


            HashMap<String, Integer> map = new HashMap<>();
            map.put("AC",0);
            map.put("TLE",0);
            map.put("WA",0);
            map.put("RE",0);
            for(int i = 0; i < N; i++)
            {
                String type = in.next();
                map.put(type, map.get(type)+1);
            }

            System.out.println("AC x "+map.get("AC"));
            System.out.println("WA x "+map.get("WA"));
            System.out.println("TLE x "+map.get("TLE"));
            System.out.println("RE x "+map.get("RE"));
        }
    }


    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer tokenizer = new StringTokenizer("");

        public InputReader(InputStream inputStream) {
            this.reader = new BufferedReader(
                    new InputStreamReader(inputStream));
        }

        public String next() {
            while (!tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public int[] nextIntArray(int n) {
            int[] a = new int[n];
            for (int i = 0; i < n; i++)
                a[i] = nextInt();
            return a;
        }

    }
}

Measured memory_bytes: 49424
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <list>
#include <queue>
#include <tuple>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <utility>
#include <complex>
#include <functional>
using namespace std;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<ll, ll> p;
const int INF = (1 << 28);
const int dx[4] = {0, 1, 0, -1}, dy[4] = {-1, 0, 1, 0};
const int Dx[8] = {0, 1, 1, 1, 0, -1, -1, -1}, Dy[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
#define yes cout << "Yes" << endl
#define YES cout << "YES" << endl
#define no cout << "No" << endl
#define NO cout << "NO" << endl
#define REP(i, n) for (int i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
int n, m;
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    cin >> n>>m;
    vector<vector<int> > b;
    vector<int> a;
    for (int i = 0; i < m; i++)
    {
        ll tempa, tempb;
        cin >>tempa>>tempb;
        vector<int> c;
        a.push_back(tempa);
        for(int j=0;j<tempb;j++){
            int tempc;
            cin>>tempc;
            c.push_back(tempc-1);
        }
        b.push_back(c);
    }
    vector<int> dp((1<<n)*2,INF);
    //cout<<pow(2,n)+1<<"\n";
    dp[0]=0;
    for(int i=1;i<=m;i++){
        int open=0;
        
        for(int j=0;j<b[i-1].size();j++){
            open|=(1<<b[i-1][j]);//i個目の鍵で開けられる箱を二進数表現
        }
        for(int j=0;j<(1<<n);j++){
            dp[open|j]=min(dp[open|j],dp[j]+a[i-1]);
        }
    }
    if(dp[(1<<n)-1]==INF)
        return cout<<-1<<"\n",0;
    cout<<dp[(1<<n)-1]<<"\n";
}


Measured memory_bytes: 384
#include<iostream>
#include<string>
#include<math.h>
#include<algorithm>
#include<vector>

#define rep(i,n) for(int i=0;i<n;i++)
#define llint long long int
#define vvint vector<vector<int>>
#define vint vector<int>

using namespace std;

int main() {
	int a, b;
	cin >> a >> b;
	string s[a];
	rep(i, a)cin >> s[i];
	rep(i, a) {
		cout << s[i] << endl;
		cout << s[i] << endl;
	}
	return 0;
}

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

typedef long long int int64;
int a[301][301];
bool b[301][301];
int main()
{
	int n;
	scanf("%d",&n);
	for(int i = 0;i < n;++i) {
		for(int j = 0;j < n;++j) {
			scanf("%d",&a[i][j]);
			b[i][j] = false;
		}
	}
	for(int k = 0;k < n;++k) {
		for(int i = 0;i < n;++i) if(i != k) {
			for(int j = 0;j < n;++j) if(j != k && j != i) {
				if(a[i][k] + a[k][j] < a[i][j]) {
					printf("-1\n");
					return 0;
				}
				if(a[i][k] + a[k][j] == a[i][j]) {
					b[i][j] = true;
				}
			}
		}
	}
	int64 ans = 0;
	for(int i = 0;i < n;++i) {
		for(int j = i + 1;j < n;++j) {
			if(!b[i][j])
				ans += a[i][j];
		}
	}
	cout << ans << endl;
}

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

using namespace std;

string formula;
int idx;

int notop[3]    = {2, 1, 0};
int andop[3][3] = {{0, 0, 0}, {0, 1, 1}, {0, 1, 2}};
int orop[3][3]  = {{0, 1, 2}, {1, 1, 2}, {2, 2, 2}};

int solve()
{
  int ret; char x = formula[idx];
  if(x == '(') {
    idx++, ret = solve();
    char op = formula[idx];
    if(op == '*') idx++, ret = andop[ret][solve()];
    else if(op == '+') idx++, ret = orop[ret][solve()];
    idx++;
  }
  else if(x == ')') idx++;
  else if(x == '-') idx++, ret = notop[solve()];  
  else if(isdigit(x)) ret = x - '0', idx++;
  return ret;
}

int main()
{
  while(cin >> formula, formula != ".") {
    int ans = 0;
    for(int P = '0'; P < '3'; P++) {
      for(int Q = '0'; Q < '3'; Q++) {
	for(int R = '0'; R < '3'; R++) {
	  string temp = formula;
	  replace(formula.begin(), formula.end(), 'P', (char)P);
	  replace(formula.begin(), formula.end(), 'Q', (char)Q);
	  replace(formula.begin(), formula.end(), 'R', (char)R);
	  idx = 0; if(solve() == 2) ans++;
	  formula = temp;
	}
      }
    }
    cout << ans << endl;
  }
  return 0;
}

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

int main(){
  int n;
  int s=0;
  cin >> n;
  vector<int> a(n);
  vector<int> b(n);
  vector<int> c(n-1);
    for(int i;i<n;i++){
      cin >> a[i];
    }
   for(int i;i<n;i++){
      cin >> b[i];
     s+=b[i];
    }
   for(int i;i<n-1;i++){
      cin >> c[i];
    }
  for(int i=1;i<n;i++){
    if(a[i-1]+1==a[i]){
      int k=a[i-1]-1;
      s+=c[k];
    }
  }
  cout << s;
  return 0;
}
  
  
  


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lli long long int
using namespace std;
#define MOD 1000000007
#define mod 1000000037
#define mod1 998244353
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); 
#define INF 2*1e9

int main()
{
    fastio;
    int n,m;
    cin >> n >> m;
    vector<int>v(n);
    int s=0;
    for(int i=0;i<n;i++)
    {
        cin >> v[i];
        s+=v[i];
    }
    float req=s*1.0/(4*m);
    int ans=0;
    for(int i=0;i<n;i++)
    {
        if(v[i]>=req)
            ans+=1;
    }
    if(ans>=m)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>

using namespace std;
typedef long long ll;

const int INF=2000000000;


int n,m,k,s,x,y,w,a,b,c;
int memo[1<<12][1000];
vector<pair<int,int> > way[1000];
int mf[1000],mt[1000];

int main(){
    
    for(int i=0;i<(1<<12);i++){
        for(int j=0;j<1000;j++){
            memo[i][j]=-INF;
        }
    }
    
    scanf("%d%d%d%d",&n,&m,&k,&s);
    
    for(int i=0;i<n;i++){
        mf[i]=-1;
        mt[i]=-1;
    }
    
    s--;
    
    for(int i=0;i<m;i++){
        scanf("%d%d%d",&x,&y,&w);
        
        way[x-1].push_back(make_pair(y-1,w));
        way[y-1].push_back(make_pair(x-1,w));
    }
    
    for(int i=0;i<k;i++){
        scanf("%d%d",&x,&y);
        
        mf[x-1]=i;
        mt[y-1]=i;
    }
    
    priority_queue<pair<int,pair<int,int> > > pq;
    
    pq.push(make_pair(0,make_pair(0,s)));
    memo[0][s]=0;
    
    
    while(!pq.empty()){
        
        pair<int,pair<int,int> > p;
        p=pq.top();
        pq.pop();
        
        if(p.second.first==((1<<(k*2))-1)){
            printf("%d\n",-p.first);
            return 0;
        }
        
        for(int i=0;i<way[p.second.second].size();i++){
            a=p.first-way[p.second.second][i].second;
            b=p.second.first;
            c=way[p.second.second][i].first;
            
            if(mf[c]>=0){
                b|=1<<mf[c];
            }else if(mt[c]>=0){
                if(b&(1<<mt[c])){
                    b|=1<<(mt[c]+k);
                }
            }
            
            if(memo[b][c]<a){
                memo[b][c]=a;
                pq.push(make_pair(a,make_pair(b,c)));
            }
        }
    }
    
    puts("Cannot deliver");
    
    return 0;
}

Measured memory_bytes: 18784
#include<bits/stdc++.h>
using namespace std;
#define rg register
#define ll long long 
inline ll read()
{
    ll x=0,f=1;
    char c=getchar();
    while(c<'0'||c>'9')
    {
        if(c=='-')
        {
            f=-1;
        }
        c=getchar();
    }
    while(c<='9'&&c>='0')
    {
        x=(x<<1)+(x<<3)+(c^48);
        c=getchar();
    }
    return x*f;
}
int n;
struct node
{
	ll num,id;
	ll tot;
}s[100503];
inline bool cmp(node a,node b)
{
	return a.num<b.num;
}
ll ji,ou;
int main()
{
	n=read();
	for(rg int i=1;i<=n;++i)
	{
		s[i].num=read();
		s[i].id=i;
	}
	stable_sort(s+1,s+1+n,cmp);
	for(rg int i=1;i<=n;++i)
	{
		if(s[i].id%2==0)//站的是偶数位置
		{
			if(i%2==0)
			{
				continue;
			}
			else//否则必将使用一次操作1 
			{
				ou++;
			}
		} 
		else 
		{
			if(i%2!=0)
			{
				continue;
			}
			else
			{
				ji++;
			}
		}
	}
//	ll ans=0;
//	for(rg int i=1;i<n;++i)
//	{
//		if(s[s[i].id].tot==0)
//		{
//			continue;
//		}
//		if(s[s[i].id].tot!=0&&s[s[i+1].id].tot!=0)
//		{
//			ans++;
//			s[s[i].id].tot=0;
//			s[s[i+1].id].tot=0;
//		}
//		else if(s[s[i].id].tot!=0&&s[s[i+1].id].tot==0)
//		{
//			ans++;
//		}
//		cout<<i<<" "<<ans<<endl;
//	}
//	cout<<ans;
	ll h=min(ou,ji);
	cout<<h+abs(ou-ji);
}

Measured memory_bytes: 3712
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#define rep(i, start, end) for (int i = (int)start; i < (int)end; ++i)
#define rrep(i, start, end) for (int i = (int)start - 1; i >= end; --i)
#define iter(i, c) for (auto i = (c).begin(); i != (c).end(); ++i)
#define riter(i, c) for (auto i = (c).rbegin(); i != (c).rend(); ++i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
using ll = long long;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int M;
    cin >> M;
    vector<int> D(M);
    vector<ll> C(M);
    rep(i, 0, M) cin >> D[i] >> C[i];
    vector<int> rest;
    ll ans = 0;
    rep(i, 0, M) {
        vector<int> now_rest;
        while (C[i] > 1) {
            ans += C[i] / 2;
            if (D[i] * 2 >= 10) ans += C[i] / 2;
            if (C[i] % 2) now_rest.push_back(D[i]);
            D[i] *= 2;
            if (D[i] >= 10) {
                D[i] = D[i] / 10 + D[i] % 10;
            }
            C[i] /= 2;
        }
        now_rest.push_back(D[i]);
        reverse(all(now_rest));
        rep(j, 0, now_rest.size()) rest.push_back(now_rest[j]);
    }
    int now_num = rest[0];
    rep(i, 1, rest.size()) {
        ++ans;
        now_num = now_num + rest[i];
        if (now_num >= 10) {
            now_num = now_num / 10 + now_num % 10;
            ++ans;
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 20456
#include <bits/stdc++.h>
#include <cassert>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ok() puts(ok?"Yes":"No");
#define chmax(x,y) x = max(x,y)
#define chmin(x,y) x = min(x,y)
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using ii = pair<int, int>;
using vvi = vector<vi>;
using vii = vector<ii>;
using gt = greater<int>;
using minq = priority_queue<int, vector<int>, gt>;
using P = pair<ll,ll>;
const ll LINF = 1e18L + 1;
const int INF = 1e9 + 1;
//clang++ -std=c++11 -stdlib=libc++ 

int main() {
  int n; ll d; cin >> n >> d;
  int ans =0;
  rep(i,n) {
    ll x,y; cin >> x >> y;
    ll sq = x*x + y*y;
    if (sq <= d*d) ans++;
  }
  cout << ans << endl;
  return 0;
}

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

typedef long long ll;
int mod = 1e9 + 7;

int main() {
	string s;
	cin >> s;
	bool d = 1;
	int n = (int)s.size();
	for (int i = 0; i < n; ++i) {
		if (i % 2 == 0 && s[i] == 'L') {
			d = 0;
		}
		if (i % 2 == 1 && s[i] == 'R') {
			d = 0;
		}
	}
	if (d){
		cout << "Yes";
	}else {
		cout << "No";
	}
		
}



















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

#define uni(x)      (x).resize(unique(all(x)) - (x).begin())
#define fprint(v)   for(auto x : v) cout << x << ' '
#define ALL(x)      (x).begin(), (x).end()
#define MP(x, y)    make_pair(x, y)
#define PII         pair<int, int>
#define SZ(x)       int((x).size())
#define PB(x)       push_back(x)
#define ll          long long
#define S           second 
#define F           first
#define nl          '\n'

using namespace std;

mt19937_64 rnd;

const int N = 2e5 + 5;

int main() {
    ios_base::sync_with_stdio(0);cin.tie(0);
    int n, k;
    cin >> n >> k;
    int ans = 0;
    for(int i = 1; i <= n; i++){
        int x;
        cin >> x;
        ans += min(2 * x, 2 * (k - x));
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
 
using namespace std;
 
typedef long long ll;
typedef long double ld;
 
#define int ll
#define ld double
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect

void solve() {
    int n, m; cin >> n >> m;
    cout << n * (n - 1) / 2 + m * (m - 1) / 2;
}
 
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //int t; cin >> t; loop(i, t)
    solve();
    return 0;
}

Measured memory_bytes: 256
class UnionFindNode:
    def __init__(self, group_id, parent=None, value=None):
        self.group_id_ = group_id
        self.parent_ = parent
        self.value = value
        self.rank_ = 1
        self.member_num_ = 1

    def is_root(self):
        return not self.parent_

    def root(self):
        parent = self
        while not parent.is_root():
            parent = parent.parent_
            self.parent_ = parent
        return parent

    def find(self):
        root = self.root()
        return root.group_id_

    def rank(self):
        root = self.root()
        return root.rank_

    def unite(self, unite_node):
        root = self.root()
        unite_root = unite_node.root()

        if root.group_id_ != unite_root.group_id_:
            if root.rank() > unite_root.rank():
                unite_root.parent_ = root
                root.rank_ = max(root.rank_, unite_root.rank_ + 1)
                root.member_num_ = root.member_num_ + unite_root.member_num_
            else:
                root.parent_ = unite_root
                unite_root.rank_ = max(root.rank_ + 1, unite_root.rank_)
                unite_root.member_num_ = root.member_num_ + unite_root.member_num_

N, = map(int, input().split())
X,Y = [],[]
for i in range(1, N+1):
    x, y = map(int, input().split())
    X.append((x,i))
    Y.append((y,i))
X = sorted(X, key=lambda x:x[0])
Y = sorted(Y, key=lambda x:x[0])
G = [set() for _ in range(N+1)]
Es = set()
for i in range(N-1):
    Es.add((tuple(sorted([X[i][1], X[i+1][1]])), abs(X[i][0]-X[i+1][0])))
    Es.add((tuple(sorted([Y[i][1], Y[i+1][1]])), abs(Y[i][0]-Y[i+1][0])))
    G[X[i][1]].add(X[i+1][1])
    G[Y[i][1]].add(Y[i+1][1])
    G[X[i+1][1]].add(X[i][1])
    G[Y[i+1][1]].add(Y[i][1])
node_list = [UnionFindNode(i) for i in range(N+1)]
Es = sorted(Es, key=lambda x:x[1])

r = 0
for (x, y), c in Es:
    if node_list[x].find() == node_list[y].find():
        continue
    r += c
    node_list[x].unite(node_list[y])

print(r)


Measured memory_bytes: 130136
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <stack>
#include <algorithm>
#include <iostream>
#include <string>
#include <map>

using namespace std;


int main() {

    long N;
    long A, B;
    cin >>N>> A >> B;

    cout << (N / (A + B)) * A + min(N % (A + B), A) << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
    int a,b;
    cin >> a >> b;
    //和差積商は英語で　summation difference product quotient 
    int sum,dif,pro;
    sum = a+b;
    dif = a-b;
    pro = a*b;
 /*   cout<<sum<<endl;
    cout<<dif<<endl;
    cout<<pro<<endl;
*/
    int answer = max(max(sum,dif),pro);
    
    cout << answer << endl;

}

Measured memory_bytes: 256
n = int(input())
F = [0] * 45

def fib(n) :
    if n == 0 or n == 1 :
        return 1
    else :
        if F[n] != 0 :
            return F[n]
        else :
            F[n] = fib(n - 1) + fib(n - 2)
            return F[n]
        
print(fib(n))


Measured memory_bytes: 5600
#include<bits/stdc++.h>
using namespace std;
#define maxn 1000005
typedef long long ll;
ll n,a[maxn],num[maxn],maxx,minn,k,ans;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++)
    scanf("%d",&a[i]);
    sort(a+1,a+1+n);
    minn=0x3f3f3f3f;
    for(int i=1;i<=n;i++)
    {
        if(a[i]!=a[i-1])
        {
            k++;
            if(num[i-1]>1)
            {
                minn=min(minn,a[i-1]);
                maxx=max(maxx,a[i-1]);
            }
            num[i]=1;
        }
        else num[i]=num[i-1]+1;
    }
    k=n-k;
    ans=k/2*2;
    if(k%2==1) ans+=2;
    printf("%d\n",n-ans);
}


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

int main(){
  string s;
  cin >> s;
  int ans = 0;
  for (int i = 0; i < s.size()/2; i++){
    if(s.at(i) != s.at(s.size() - i - 1)) ans++;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
x, n = map(int, input().split())
p = list(map(int, input().split()))

if x not in p:
    print(x)
else:
    for i in range(1,200):
        if x - i not in p:
            print(x - i)
            break
        if x + i not in p:
            print(x + i)
            break

Measured memory_bytes: 9176
#include <stdio.h>

int main(void)
{
	int a, b, c, d, ans;
	scanf("%d %d %d %d", &a, &b, &c, &d);

	ans = abs(a - b);
	int ans2 = abs(b - c);

	if ((ans <= d && ans2 <= d) || abs(a - c) <= d)
		printf("Yes\n");

	else printf("No\n");

return 0;
}

Measured memory_bytes: 128
#include <stdio.h>
#include <map>

using namespace std;

int main(){
  while(1){
    int n;
    scanf("%d", &n);
    if(n==0) break;

    int s[n];
    for(int i=0;i<n;i++) scanf("%d", s+i);

    int c = 0;

    int t;
    for(;;c++){
      map<int,int> m;
      for(int i=0;i<n;i++){
        if(m.find(s[i]) == m.end()){
          m.insert(pair<int,int>(s[i], 1));
        }else{
          m[s[i]]++;
        }
      }

      int k = 0;
      for(int i=0;i<n;i++){
        if(s[i] != m[s[i]]) k++;
        s[i] = m[s[i]];
      }
      
      if(k==0) break;
    }
    printf("%d\n", c);
    for(int i=0;i<n;i++){
      printf("%d", s[i]);
      if(i==n-1) printf("\n");
      else printf(" ");
    }
  }
}

Measured memory_bytes: 0
#include<cstdio>
using namespace std;
typedef long long LL;
const int N=5e5+5,mo=998244353;
int n,k,ans;
int f[N],g[N];
inline int ksm(int x,int y)
{
	int s=1;
	while(y)
	{
		if(y&1) s=(LL)s*x%mo;
		x=(LL)x*x%mo;
		y>>=1;
	}
	return s;
}
inline int C(int x,int y)
{
	if(y<0) return 0;
	return (LL)f[x]*g[y]%mo*g[x-y]%mo;
}
int main()
{
	scanf("%d%d",&n,&k);
	f[0]=g[0]=1;
	for(int i=1;i<N;i++) f[i]=(LL)f[i-1]*i%mo;
	g[N-1]=ksm(f[N-1],mo-2);
	for(int i=N-2;i;i--) g[i]=(LL)g[i+1]*(i+1)%mo;
	for(int R=k,B=0;R>B;R--,B++)
	{
		int T=R-n+1;
		if(T<0) break;
		ans=((LL)ans+C(k,R)-C(k,B-T)+mo)%mo;
	}
	if(k%2==0)
	{
		int x=k>>1,T=x-n+1;
		if(T>=0) ans=((LL)ans+C(k-1,x)-C(k-1,x-1-T))%mo;
	}
	printf("%d",ans);
	return 0;
}

Measured memory_bytes: 4096
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
int main()
{
    int m1, d1;
    int m2, d2;
    cin >> m1 >> d1;
    cin >> m2 >> d2;
    if (m1 < m2 || (m1 == 12 && m2 == 1))
        cout << 1 << endl;
    else
    {
        cout << 0 << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

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

    int ans = 0;
    for(int x=0; x<=k; ++x){
        for(int y=0; y<=k; ++y){
            int z = s - x - y;
            if(0 <= z && z <= k)
                ++ ans;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long
#define P pair<int,int>
#define rep(i,n) for(int i = 0; i < (n); i++)
#define asort(x) sort(x.begin(),x.end())
 
int main() {
    int a,b;
    cin>>a>>b;
    cout << a * b << endl;
    return 0;
}

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

int main(){
  int N,K,sum = 0;
  cin >> N >> K;
  vector<int> length (N);
  for (int i = 0;i< N;i++)
    cin >> length.at(i);
  sort(length.begin(),length.end());
  reverse(length.begin(),length.end());
  for (int i = 0;i < K;i++)
    sum += length.at(i);
  cout << sum << endl;
}

Measured memory_bytes: 256
// Aizu 2049: Headstrong Student
// 2017.9.24 bal4u@uu

#include <stdio.h>
#include <string.h>

#define MAX 1000000
int tbl[MAX+2];

int main()
{
	int x, y, k, r;

	while (scanf("%d%d", &x, &y) && x > 0) {
		memset(tbl, -1, sizeof(tbl));
		tbl[x] = 0;
		for (k = 1; ; k++) {
			x *= 10;
			if ((r = x % y) == 0) {
				printf("%d 0\n", k);
				break;
			}
			if (tbl[r] >= 0) {
				printf("%d %d\n", tbl[r], k - tbl[r]);
				break;
			}
			tbl[r] = k, x = r;
		}
	}
	return 0;
}

Measured memory_bytes: 5604
def gcd(m, n):
  x = max(m, n)
  y = min(m, n)
  
  while x % y != 0:
    z = x % y
    x = y
    y = z
  return y

def lcm(m, n):
  return m * n // gcd(m, n)

a, b = map(int, input().split())
print(lcm(a, b))

Measured memory_bytes: 3060
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#define REP(i, n) for(int i = 0;i < n;i++)
#define ll long long
#define INF 114514
using namespace std;




int main(){
	while (1) {
		int n, i, m, x = 0, y = 0, j, k;
		cin >> n;
		if (n == 0) return 0;
		vector<pair<int, int>>va(n + 5);
		//int f[1000][1000] = { 0 };
		for (i = 0; i < n; i++) {
			int a, b;
			cin >> a >> b;
			va[i].first = a;
			va[i].second = b;
		}
		cin >> m;
		vector<pair<int, int>>vb(m + 5);
		for (i = 0; i < m; i++) {
			int a, b;
			cin >> a >> b;
			vb[i].first = a;
			vb[i].second = b;
			//f[a][b] = 1;
		}
		for (i = 0; i < m; i++) {
			x = vb[i].first - va[0].first;
			y = vb[i].second - va[0].second;
			int count = 0;
			for (j = 0; j < n; j++) {
				//if (f[va[j].first + x][va[j].second + y] != 1) bo = false;
				for (k = 0; k < m; k++) {
					if (vb[k].first == va[j].first + x&&vb[k].second == va[j].second + y) {
						count++;
					}
				}

			}
			if (count == n) {
				cout << x << " " << y << endl;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 3020
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define pb push_back
#define M 1000000007
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
const int N = 3e5 + 1;
int n , k , a[N] , dp[N] , seg[4*N];
void update(int c , int l , int r , int id , int val){
	if(id > r || id < l) return;
	if(l == r){
		seg[c] = val;
		return;
	}
	update(2*c+1 , l , (l+r)/2 , id , val);
	update(2*c+2 , (l+r)/2+1 , r , id , val);
	seg[c] = max(seg[2*c+1] , seg[2*c+2]);
}
int get(int c , int l , int r , int s , int e){
	if(s > r || e < l)return 0;
	if(l >= s && r <= e)return seg[c];
	return max(get(2*c+1 , l , (l+r)/2 , s , e) , get(2*c+2 , (l+r)/2+1 , r , s , e));
}
int main(){	
	scanf("%d%d",&n,&k);
	for (int i = 0; i < n; ++i)scanf("%d",&a[i]);
	for (int i = 0; i < n; ++i){
		int val = get(0 , 0 , N-1 , max(0 , a[i] - k) , min(N - 1 , a[i] + k)) + 1;
		//if(a[i] == 3) cout << i << endl;
		//cout << val << endl;
		update(0 , 0 , N-1 , a[i] , val);
	}
	cout << get(0 , 0 , N-1 , 0 , N - 1) << endl;
	
	

	
	
		
}	

Measured memory_bytes: 9036
import java.util.*;
public class Main{
  public static void main (String args[]){
    Scanner sc = new Scanner(System.in);
    
    int ans = 0;
    String a = sc.next();
    boolean flg = true;
    
    for (int i = 0; i < 3; i++){
      String n = a.substring(i, i+1);
      if (n.equals("R") && flg){
        ans++;
      } else if (n.equals("R") && !flg){
        ans = 1;
        flg = true;
      } else {
        flg = false;
      }
    }
    
    System.out.println(ans);
  }
}

Measured memory_bytes: 35460
#include<bits/stdc++.h>
using namespace std;
template<typename T>
inline void read(T &x)
{
	x=0;
	int f=1;
	char ch=getchar();
	while(ch<'0'||ch>'9')
	{
		if(ch=='-') f=-1;
		ch=getchar();
}
	while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=getchar();
	x*=f;
	return;
}	
template<typename T>
void write(T x)
{
	if(x<0) putchar('-'),x=-x;
	if(x>=10) write(x/10);
	putchar(x%10+'0');
	return;
}
int n,m;
int a[110];
int cnt=0;
int tot=0;
int main()
{
    read(n),read(m);
    for(int i=1;i<=n;i++) read(a[i]);
    for(int i=1;i<=n;i++) tot+=a[i];
    for(int i=1;i<=n;i++)
    if(4*m*a[i]>=tot) cnt++;
    if(cnt>=m) printf("Yes\n");
    else printf("No\n");
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
#define repp(i, n, m) for (int i = (int)(n); i < (int)(m); i++)
#define rrep(i, n, m) for (int i = n; i >= m; i--)
#define p(s) cout << s << endl;
typedef long long LL;
template <class T>
bool contain(const std::string &s, const T &v)
{
    return s.find(v) != std::string::npos;
}

int main()
{
    int n; LL a,cnt=0;
    cin>>n;
    rep(i,n){
        cin>>a;
        while(a%2==0){
            cnt++;
            a/=2;
        }
    }
    cout<<cnt<<endl;
}


Measured memory_bytes: 256
#include <cassert>
#include <algorithm>
#include <array>
#include <bitset>
#include <cctype>
#include <cstdint>
#include <cmath>
#include <complex>
#include <chrono>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#include <random>
#include <memory>
#include <utility>
#include <limits>
#include "limits.h"
 
#define rep(i, a, b) for (long long i = (a); (i) < (b); (i)++)
#define all(i) i.begin(), i.end()
#define debug(...) std::cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)

void debug_out(){std::cerr<<std::endl;}

template<typename Head,typename... Tail>
void debug_out(Head h,Tail... t){
  std::cerr<<" "<<h;
  debug_out(t...);
}
 
template <typename T1, typename T2>
std::ostream& operator<<(std::ostream& os, std::pair<T1, T2> pa) {
  return os << pa.first << " " << pa.second;
}
 
template <typename T>
std::ostream& operator<<(std::ostream& os, std::vector<T> vec) {
  for (int i = 0; i < vec.size(); i++)os << vec[i] << (i + 1 == vec.size() ? "" : " ");
  return os;
}
 
template<typename T1,typename T2>
inline bool chmax(T1& a,T2 b){return a<b && (a=b,true);}
 
template<typename T1,typename T2>
inline bool chmin(T1& a,T2 b){return a>b && (a=b,true);}
 
long long pow_mod(long long a, long long b, long long mod=-1) {
  if(b==0)return 1;
  if ((a == 0)||(mod!=-1&&(a+mod)%mod==0)) {
    return 0;
  }
  long long x = 1;
  while (b > 0) {
    if (b & 1) {
      x = (mod!=-1)?(x * a) % mod:x*a;
    }
    a = (mod!=-1)?(a * a) % mod:a*a;
    b >>= 1;
  }
  return x;
}

// const long long MOD = 998244353;
const long long MOD = 1e9 + 7;

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

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

  ll k,q;
  std::cin>>k>>q;

  std::vector<ll> d(k);
  rep(i,0,k)std::cin>>d[i];

  rep(_,0,q){
    ll n,x,m;
    std::cin>>n>>x>>m;

    std::vector<ll> temp(k);
    rep(i,0,k)temp[i]=d[i]%m;
    ll sum=x;
    rep(i,0,k)sum+=(n+k-2-i)/k*temp[i];
    ll ans=n-1;
    ans-=(sum/m) - (x/m);
    rep(i,0,k)if(temp[i]==0)ans-=(n+k-2-i)/k;
    std::cout<<ans<<"\n";
  }

  return 0;
}


Measured memory_bytes: 384
import java.util.*;
import java.util.Arrays;
import java.util.ArrayList;
import java.util.Set;
import java.util.HashSet;
import java.util.Collections;


public class Main{
   
   

    public static void main(String[] args){
        Scanner sc=new Scanner(System.in);
        int N=sc.nextInt();
        int Y=sc.nextInt();
        int x=-1;
        int y=-1;
        int z=-1;
        for(int i=0;i<=Y/10000;i++){
            for(int j=0;j<=(Y-10000*i)/5000;j++){
                if((Y-10000*i-5000*j)/1000==N-i-j){
                    x=i;
                    y=j;
                    z=N-i-j;

                }
            }
        }
        System.out.println(x+" "+y+" "+z);


        
        

    }

        
        
    }


Measured memory_bytes: 23764
n, k = map(int, input().split())
missing = 0
snuke = []
snacks = []
for i in range(k):
    d = int(input())
    a = list(map(int, input().split()))
    for i in a:
        snacks.append(i)

snuke = list(set(snuke))
snacks = list(set(snacks))
print(n - len(snacks))


Measured memory_bytes: 9180
#include<iostream>
#include<algorithm>
using namespace std;
#define REP(i, a, n) for(int i=a; i<n; i++)

int main() {
	int N, W, H;
	int x[100001] = {}, y[100001] = {}, xx, yy, w;
	cin >> N >> W >> H;
	REP(i, 0, N) {
		cin >> xx >> yy >> w;
		
		x[max(0, xx - w)]++;
		x[min(W, xx + w)]--;
		y[max(0, yy - w)]++;
		y[min(H, yy + w)]--;
	}

	int sum = 0;
	bool flag = false;
	REP(i, 0, W) {
		sum += x[i];
		if (sum == 0) flag = true;
	}
	if (flag) {
		sum = 0;
		flag = false;
		REP(i, 0, H) {
			sum += y[i];
			if (sum == 0) flag = true;
		}
	}

	if (flag) cout << "No" << endl;
	else cout << "Yes" << endl;

	return 0;
}

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

int main(){
	int H,W;

	while(1){
		cin >> H >> W;
		if( H==0 && W==0)
			break;
		
		for(int i=0;i<H;i++){
			for(int j=0;j<W;j++){
				if( (i+j)%2==0 ){
					cout << '#';
				}else {
					cout << '.';
				}

			}

			cout << "\n";
		}
	
	cout << "\n";
	}

	return 0;
	
}

Measured memory_bytes: 1120
#include<bits/stdc++.h>
const double PI=3.14159265358979323846;
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) << " "
int main(void){
    int a,n;cin>>a>>n;
    co(max(0, a-2*n));
}



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

using i8  = int8_t;   /* -128 ~ 127 */
using u8  = uint8_t;  /* 0 ~ 255 */
using i16 = int16_t;  /* -32,768 ~ 32,767 */
using u16 = uint16_t; /* 0 ~ 65,535 */
using i32 = int32_t;  /* -2,147,483,648 ~ 2,147,483,647 */
using u32 = uint32_t; /* 0 ~ 4,294,967,295 */
using i64 = int64_t;  /* -9,223,372,036,854,775,808 ~ 9,223,372,036,854,775,807 */
using u64 = uint64_t; /* 0 ~ 18,446,744,073,709,551,615 */
using f32 = float;    /* (-3.4 * 10^38) ~ (3.4 * 10^38) */
using f64 = double;   /* (-1.7 * 10^308) ~ (1.7 * 10^308) */
using f80 = __float80;
template <class T> using Vec = vector<T>;
constexpr i64 INF = 1010000000000000017;
constexpr i64 MOD = 1e9 + 7;
constexpr f64 EPS = 1e-12;
constexpr f64 PI = 3.14159265358979323846;
#define ALL(v) v.begin(), v.end()
#define YN(a, b, c) ((c)? a : b)
#define GCD(a, b) __gcd(a, b) /* 最大公約数 */
#define LCM(a, b) (i64)(a / (f64)__gcd(a, b) * b) /* 最小公倍数 */

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout << fixed << setprecision(15);
    Main();
    return 0;
}

void Main() {
    string s, t;
    cin >> s >> t;
    sort(ALL(s));
    sort(ALL(t), greater<char>());
    cout << YN("Yes", "No", s < t) << endl;
}


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

class Main {
	public static void main(String args[]) throws IOException {
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		Solver solver = new Solver();
		solver.init();
		solver.readHead(in.readLine());
		// for (; solver.hasNext();) {
		// solver.readBody(in.readLine());
		// }
		// solver.solve();
	}
}

class Solver {
	int N;
	int cnt;

	public void init() {
		N = 0;
		cnt = 0;
	}

	public void readHead(String str) {
		String[] strArr = str.split(" ");
		// N = Integer.parseInt(strArr[0]);
		// System.out.println(N);
		int a = Integer.parseInt(strArr[0]);
		int b = Integer.parseInt(strArr[1]);
		int c = Integer.parseInt(strArr[2]);
		if (a + b >= c)
			System.out.println("Yes");
		else
			System.out.println("No");
	}

	public boolean hasNext() {
		return cnt < N;
	}

	public void readBody(String str) {
		// System.out.println(str);
		cnt++;
	}

	public void solve() {

	}
}


Measured memory_bytes: 21076
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define ll long long
#define INF 999999999

const ll mod = 1e9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n;
	cin >> n;
	ll ans = 0;
	ll a;
	REP(i, n){
		cin >> a;
		while(a%2 == 0){
			ans += 1;
			a /= 2;
		}
	}
	cout << ans << endl;
}


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

#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long int
#define endl "\n"     
#define pb push_back
#define mp make_pair
#define ff first
#define ss second

const int N=1e5+5;
int n,h[N],cache[N],k;

int dp(int pos)
{
     if(pos==n)
          return 0;
     if(pos==n-1)
          return abs(h[pos]-h[n]);
     int &ans=cache[pos];
     if(ans!=-1)
          return ans;
     ans=1e15;
     for(int i=pos+1;i<=min(n,(pos+k));i++)
          ans=min(dp(i)+abs(h[pos]-h[i]),ans);
     return ans;     
}

int32_t main()
{
	IOS;

     memset(cache,-1,sizeof cache);
	cin>>n>>k;
	
	for(int i=1;i<=n;i++)
	     cin>>h[i];
	
	cout<<dp(1);
	     
	return 0;
}

Measured memory_bytes: 4992
#include <stdio.h>
#include <string>
#include <algorithm>
#include <iostream>
#include <cmath>
using namespace std;

int x, a, ans;

int main() {
    scanf("%d %d", &x, &a);
    
    if ( x < a ) {
        ans = 0;
    } else {
        ans = 10;
    }

    printf("%d\n", ans);
    return 0;
}


Measured memory_bytes: 256
# coding: utf-8
# Your code here!
line = list(map(int,input().split()))
day = line[0]
work = line[1]
line2 = list(map(int,input().split()))
haveto=0
for i in line2:
    haveto+= i

answer = day - haveto
if answer<0:
    print("-1")
else:
    print(answer)

Measured memory_bytes: 10120
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#define int long long
#define endl '\n'
#define INF 1000000000000000000
#define EPS 1e-10
#define PI 3.141592653589793238
#define all(a) a.begin(),a.end()
#define rep(i, n) for (int i = 0; i < (n); i++)
#define pb push_back
#define double long double
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> PP;
typedef complex<double> com;
template<class T, class S> bool chmax(T &a, const S &b) { if (a < b) { a = b; return 1; } return 0; }
template<class T, class S> bool chmin(T &a, const S &b) { if (a > b) { a = b; return 1; } return 0; }
ll gcd(ll n, ll m) { return (m ? gcd(m, n%m) : n); }
ll lcm(ll n, ll m) { return n / gcd(n, m)*m; }


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

	int n;
	cin >> n;
	int ans = INF;
	for (int i = 1; i*i <= n; i++) {
		if (n%i == 0) {
			chmin(ans, i + n / i - 2);
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
n,_=gets.split.map(&:to_i)
a=$<.map{|s|s.to_i}
r = Array.new(n+1,0)
r[0] = 1
(1..n).each do |t|
  if a[0] == t
    a.shift
    next
  end
  r[t] = r[t-1] + (t > 1 ? r[t-2] : 0)
end

p r.last % (1000000007)


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

const int MAXN = 101;
const int INF = 0x3f3f3f3f;
const int NIL = -1;

int matrix[MAXN][MAXN];
vector<pair<int, int> > edges;
vector<int> length;

int main(){
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	int n, m; cin >> n >> m;
	int u, v, w;
	for (int i = 0; i <= n; i++){
		for (int j = 0; j <= n; j++){
			matrix[i][j] = INF;
			if (i == j){
				matrix[i][j] = 0;
			}
		}
	}
	for (int i = 0; i < m; i++){
		cin >> u >> v >> w;
		matrix[u][v] = w;
		matrix[v][u] = w;
		edges.push_back({u, v});
		length.push_back(w);
	}
	
	for (int k = 1; k <= n; k++){
		for (int i = 1; i <= n; i++){
			for (int j = 1; j <= n; j++){
				matrix[i][j] = min(matrix[i][j], matrix[i][k] + matrix[k][j]);
			}
		}
	}
	
	int ans = m;
	for (int k = 0; k < m; k++){
		bool included = false;
		for (int i = 1; i <= n; i++){
			if (matrix[i][edges[k].first] + length[k] == matrix[i][edges[k].second]){
				included = true;
			}
		}
		if (included){
			ans--;
		}
	}
	cout << ans << endl;
	
	return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
 
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
 
typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<ll> vi;
typedef long double ld; 
typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<ll>::iterator sit;
typedef map<ll,ll>::iterator mit;
int a[500001];
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin>>n;
	for(int i=0;i<n;i++) cin>>a[i];
	vi vec;
	for(int i=n-1;i>=0;i-=2)
	{
		vec.pb(a[i]);
	}
	for(int i=(n&1);i<n;i+=2)
	{
		vec.pb(a[i]);
	}
	for(int i=0;i<vec.size();i++)
	{
		cout<<vec[i];
		if(i+1<vec.size()) cout<<' ';
	}
	cout<<'\n';
}


Measured memory_bytes: 4720
"""
友達でも嫌いでもない人
友達の友達(の友達の...)
-> ok
"""
class UnionFind():
    # コンストラクタ
    def __init__(self, n):
        # 要素数
        self.n = n
        # parents[i]: 要素iの親要素の番号
        # 要素iが根の場合、parents[i] = -(そのグループの要素数)
        self.parents = [-1] * n

    # 要素xが属するグループの根を返す
    # 経路圧縮
    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    # 要素xが属するグループと要素yが属するグループとを併合する
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    # 要素xが属するグループの要素数を返す
    def size(self, x):
        return -self.parents[self.find(x)]

    # 要素x,yが同じグループに属するかどうかを返す
    def same(self, x, y):
        return self.find(x) == self.find(y)

    # 要素xが属するグループに属する要素をリストで返す
    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    # 全ての根の要素をリストで返す
    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    # グループの数を返す
    def group_count(self):
        return len(self.roots())


N,M,K = map(int,input().split())

best = [0] * N

friend = UnionFind(N)
for _ in range(M):
    A,B = map(int,input().split())
    best[A-1] += 1
    best[B-1] += 1
    friend.union(A-1, B-1)

bad = [[] for _ in range(N)]
for _ in range(K):
    C,D = map(int,input().split())
    bad[C-1].append(D-1)
    bad[D-1].append(C-1)


ans = [0] * N
for i in range(N):
    ans[i] = friend.size(i) - best[i] - 1
    for kirai in bad[i]:
        if friend.same(i, kirai):
            ans[i] -= 1

print(*ans, sep=" ")

Measured memory_bytes: 31844
#define _CRT_SECURE_NO_WARNINGS
/*                   وتزودوا فإن خير الزاد التقوى                    */
/*       وما تدري نفس ماذا تکسب غدا وما تدري نفس باي ارض تموت      */
#include <bits/stdc++.h>
#include<unordered_map>
#include<iomanip>
#include<fstream>
using namespace std;
#define endl '\n'
#define ll long long
#define ull unsigned long long
#define dll double
#define PI acos(-1)
#define watch(x) cout<<#x<<" = "<<x<<" \n"
#define sz(n) n.size()
#define M_Sayed fast() 
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define RT(v) return cout<<v,0
#define MP					make_pair
int dx[] = { 0, 1, 0, -1, 1, 1, -1, -1 };
int dy[] = { 1, 0, -1, 0, 1, -1, 1, -1 };
const double EPS = (1e-7);
const ll  mod = (1e9 + 7), OO = 1e9;
ll Ceil(ll x, ll y) { return (x + y - 1) / y; }
void run() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
#else
	//freopen("input", "r", stdin);
	//freopen("output", "w", stdout);
#endif
}
void fast() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); }
// BFS (lenth && all path from an start node
vector<vector<ll>>adjList;
ll  vis[100005];
ll  y;
ll ca = 0, x;
ll dfs(int u) {
	if (vis[u])return vis[u];
	for (auto e : adjList[u])
		vis[u] = max(vis[u], 1 + dfs(e));
	return vis[u];
}
int main()
{
	M_Sayed;
	//run();
	int n, e,k;
	cin >> n >> e;
	adjList.resize(n + 1);
	for (int i = 0; i < e; i++) {
		int from, to;
		cin >> from >> to;
		adjList[from].push_back(to);
	}
	for (int i = 1; i <= n; i++) {
		y = max(y, dfs(i));
	}
	//cout << round(12.3);
	RT(y);
}

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

int main(int argc, char const* argv[])
{
	int a, b, c;
	cin >> a >> b >> c;

	if ( a < b && b < c) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}

	return 0;
}


Measured memory_bytes: 1160
N = int(input())
A = list(map(int, input().split()))
key = 0
for i in range(N):
  if A[i] % 2 == 0:
    if A[i] % 3 != 0 and A[i] % 5 != 0:
      key += 1
if key > 0:
  print('DENIED')
else:
  print('APPROVED')


Measured memory_bytes: 3060
import sys

n = int(input())
h = list(map(int, input().split()))

dp = [sys.maxsize]*n
dp[0] = 0

for i in range(1, n):
  if(i==1):
    dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
  else:
    dp[i] = min(dp[i], dp[i-1] + abs(h[i] - h[i-1]))
    dp[i] = min(dp[i], dp[i-2] + abs(h[i] - h[i-2]))

print(dp[n-1])
    


Measured memory_bytes: 13928