akhauriyash/Code-Regression huggingface dataset:
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
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);
        TaskA solver = new TaskA();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskA {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int a1 = in.nextInt();
            int a2 = in.nextInt();
            int a3 = in.nextInt();
            if (a1 + a2 + a3 >= 22) {
                out.println("bust");
            } else {
                out.println("win");
            }
        }

    }

    static class InputReader {
        private BufferedReader reader;
        private StringTokenizer stt;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextLine() {
            try {
                return reader.readLine();
            } catch (IOException e) {
                return null;
            }
        }

        public String next() {
            while (stt == null || !stt.hasMoreTokens()) {
                stt = new StringTokenizer(nextLine());
            }
            return stt.nextToken();
        }

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

    }
}



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

typedef long long ll;

#define pb push_back
#define rep(i, a, n) for(int i = (a); i < (n); i++)
#define dep(i, a, n) for(int i = (a); i >= (n); i--)
#define mod 1e9+7

__attribute__((constructor))
void initial() {
  cin.tie(0);
  ios::sync_with_stdio(false);
}

int main() {
  ll h, w, n;
  cin >> h >> w >> n;
  map<pair<ll, ll>, int> mp;
  int a, b;
  rep(i, 0, n) {
    cin >> a >> b;
    rep(j, -2, 1) {
      rep(k, -2, 1) {
        if(a + j > 0 && b + k > 0 && a + j <= h - 2 && b + k <= w - 2) {
          mp[make_pair(a + j, b + k)]++;
        }
      }
    }
  }
  ll ans[10] = {};
  for(map<pair<ll, ll>, int>::iterator it = mp.begin(); it != mp.end(); it++) {
      ans[it->second]++;
  }
  cout << ((h - 2) * (w - 2)) - mp.size() << endl;
  rep(i, 1, 10) {
    cout << ans[i] << endl;
  }
}


Measured memory_bytes: 56576
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(n) begin(n), end(n)
using ll = long long;
using namespace std;

int main(){
	int n;
	cin >> n;
	vector<int> a(n);
	rep(snip_i, n) cin >> a.at(snip_i);
	sort(a.begin(), a.end(), greater<int>());
	ll ans = 0, t = -1, y = -1;
	rep(i, n-1){
		if(a.at(i) == a.at(i+1)){
			if(t == -1) t = a.at(i);
			else{
				y = a.at(i);
				break;
			}
			i++;
		}
	}
	if(y != -1) ans = t*y;
	cout << ans << endl;
	return 0;
}

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

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    string a, b, c;
    cin >> a >> b;
    c = b.substr(0, b.size() - 1);
    cout << (a == c ? "Yes\n" : "No\n");
    return 0;
}

Measured memory_bytes: 3644
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for(ll i=0;i<(n);i++)
const ll INF = 1LL<<60;

int main(){
  ll A,B;
  cin>>A>>B;
  if(A%2==1&&B%2==1){
  cout<<"Yes"<<endl;}
  else{cout<<"No"<<endl;}
}


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

int main(){
  vector<int> a(3);
  rep(i,3) cin >> a.at(i);
  sort(a.begin(),a.end());
  reverse(a.begin(),a.end());
  
  cout <<a.at(0)-a.at(1)+a.at(1)-a.at(2) << endl;
  
  
}

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

int main() {
  using namespace std;
  cin.tie(nullptr);
  ios::sync_with_stdio(false);
  long long A;
  long double B;
  cin >> A >> B;
  long long b = round(B * 100);
  cout << A * b / 100 << endl;
}


Measured memory_bytes: 3812
#include <cmath>
#include <iostream>

using namespace std;

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

    int t[N + 1], x[N + 1], y[N + 1];
    t[0] = x[0] = y[0] = 0;
    for (int i = 1; i <= N; ++i) {
        cin >> t[i] >> x[i] >> y[i];
    }

    for (int i = 0; i < N; ++i) {
        int dt = t[i + 1] - t[i];
        int dx = x[i + 1] - x[i];
        int dy = y[i + 1] - y[i];

        int dis = abs(dx) + abs(dy);
        if (dis > dt || dt % 2 != dis % 2) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-ffloat-store") // to restrict undesirable precision
#pragma GCC optimize ("-fno-defer-pop")// to pop argument of function as soon as it returns
#define all(a) a.begin(),a.end()
#define ll long long int
#define ld long double
ll power(ll a,ll b,ll m){ if(b==0) return 1; if(b==1) return a%m; ll t=power(a,b/2,m)%m; t=(t*t)%m; if(b&1) t=((t%m)*(a%m))%m; return t;}
ll modInverse(ll a, ll m) { return power(a, m-2, m); }
#define ps push_back
#define fs first
#define sc second
#define takeline cin.ignore();
#define iactive cout.flush();
#define N 3000005
#define endl "\n"
#define mod 1000000007
#define PI 3.141592653589793
//((1.0l)*BIG MULTIPLY MAGIC?)
// string to integer stoi()
// string to long long stoll()
// string.substr(position,length);
// integer to string to_string();
//-----------------------------------------------
int main(){

	ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
	
	ll i,j,k,l,n;
	cin>>n;
	ll ar[n+1];
	map<ll,ll> mp;
	for(i=1;i<=n;i++){
		cin>>ar[i];
		mp[ar[i]]++;
	}

	ll an=0;
	for(auto it:mp){
		k=it.fs; ll flg=1;
		for(i=1;i*i<=k;i++){
			if(k%i==0){
				ll a,b;
				a=i; b=(k/i);
				if(mp.find(a)!=mp.end()&&a!=k){
					flg=0; break;
				}
				if(mp.find(b)!=mp.end()&&b!=k){
					flg=0; break;
				}
			}
		}
		if(it.sc==1&&flg==1){
			an++;
		}
	}
	cout<<an;
	return 0;	
}

Measured memory_bytes: 17724
#include<bits/stdc++.h>
using namespace std;
using ll =  long long;
int main()
{
    ll n, ans=0;
    cin >> n;
    if ( n % 2) cout << 0, exit(0);
    for(ll i=5;i<=n;i*=5)
    ans += (n/(2*i));
    cout << ans << endl;

}


Measured memory_bytes: 3620
#include<cstdio>
#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int n, m, a[100005], b[100005], p[100005], beg[100005], ans[100005], q[100005];
bool cmp(int x, int y) {
	return a[x] == a[y] ? b[x] < b[y] : a[x] < a[y];
}
int main() {
	scanf("%d%d", &n, &m);
	for(int i = 1; i <= m; ++i) {
		scanf("%d%d", &a[i], &b[i]);
		p[i] = i;
	}
	sort(p+1, p+m+1, cmp);
	for(int i = 1; i <= n; ++i) beg[i] = m;
	for(int i = 1; i <= m; ++i) beg[a[p[i]]] = min(i, beg[a[p[i]]]), q[p[i]] = i;
	for(int i = 1; i <= m; ++i) printf("%06d%06d\n", a[i], q[i] - beg[a[i]] + 1);
	
	return 0;
}


Measured memory_bytes: 3456
import sys

sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))  #空白なし
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())  #空白あり
def LS2(): return list(sys.stdin.readline().rstrip())  #空白なし


N = I()
A = LI()
s = sum(A)
mod = 10**9+7
s %= mod

a = s**2-sum(A[i]**2 for i in range(N))
a %= mod
a *= pow(2,mod-2,mod)
a %= mod

print(a)


Measured memory_bytes: 104064
import java.util.*;

public class Main {
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int w = sc.nextInt();
        
        String[] s = new String[h];
        
        for(int i = 0; i < h; i++){
            s[i] = sc.next();
        }
        
        for(int i = 0; i < h; i++){
            System.out.println(s[i]);
            System.out.println(s[i]);
        }
    }
}


Measured memory_bytes: 24148
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define FOR(i,x,n) for(int i=x; i<(n); i++)
#define ALL(n) begin(n),end(n)
#define MOD (1000000007)
#define INF (2e9)
#define INFL (2e18)

typedef long long ll;
typedef unsigned int ui;
typedef unsigned long long ull;
template<class T>using arr=vector<vector<T>>;
template<class T>int popcount(T &a){int c=0; rep(i, 8*(int)sizeof(a)){if((a>>i)&1) c++;} return c;}
template<class T>void pr(T x){cout << x << endl;}
template<class T>void prvec(vector<T>& a){rep(i, a.size()-1){cout << a[i] << " ";} pr(a[a.size()-1]);}
template<class T>void prarr(arr<T>& a){rep(i, a.size()) if(a[i].empty()) pr(""); else prvec(a[i]);}
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }

int main()
{
    int n; cin >> n;
    vector<int> a(n);
    rep(i, n) cin >> a[i];
    rep(i, n) a[i]--;
    vector<bool> seen(n, false);
    seen[0] = true;
    int pos = 0;
    rep(i, n){
        pos = a[pos];
        if(pos==1) {pr(i+1); break;}
        if(seen[pos]) {pr(-1); break;}
        seen[pos] = true;
    }
    return 0;}

Measured memory_bytes: 3728
#include "bits/stdc++.h"
#define FOR(i, a, b) for (int i = a; i < b; i++)
#define mFOR(i, a, b) for (int i = a; i > b; i--)
#define MP make_pair
#define PB push_back
#define ALL(v) v.begin(), v.end()
#define N 100007
#define INF 1000000007
using namespace std;

typedef long long ll;

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
ll fceil(ll a, ll b) { return (a % b == 0 ? a / b : a / b + 1); }
int main()
{
   int n, x[100] = {}, ans = INF, tmp = 0;
   cin >> n;
   FOR(i, 0, n)
   {
      cin >> x[i];
   }

   FOR(i, 1, 101)
   {
      tmp = 0;
      FOR(j, 0, n)
      {
         tmp += (x[j] - i) * (x[j] - i);
      }
      ans = min(ans, tmp);
   }

   cout << ans << endl;

   return 0;
}


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

#define rep(i,n) for(ll i = 0; i < (n); i++)
#define REP(i,n) for(ll i = 1; i < (n); i++)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(), (v).rend()
#define yesorno(a) printf(a ? "yes\n" : "no\n")
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define YESorNO(a) printf(a ? "YES\n" : "NO\n")
#define endl "\n"

using ll = long long;
using P = pair<int,int>;
using Pll = pair<ll,ll>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;

const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1; 


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

  int n,m;
  cin >> n >> m;
  int ans = (n-m) * 100 + m * 1900;
  ans *= pow(2, m);
  cout << ans << endl;
}

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


int main(){
  int64_t N,ans=1,x=0,y=0;
  cin >> N;
  vector<int64_t> A(N);
  for(int64_t i=0;i<N;i++){
    cin>>A.at(i);
    if(x==i){
      continue;
    }else if(y==0){
      if(A.at(i)>A.at(i-1)){
        y=1;
      }else if(A.at(i)<A.at(i-1)){
        y=2;
      }
    }else if(y==1){
      if(A.at(i)<A.at(i-1)){
        x=i;
        y=0;
        ans++;
      }
    }else{
      if(A.at(i)>A.at(i-1)){
        x=i;
        y=0;
        ans++;
      }
    }
  }
  cout << ans << endl;
  
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,k,n) for(int i = k; i < n; i++)  
#define repp(i,k,n) for(int i = k; i <= n; i++) 
#define per(i,k,n) for(int i = k; i >= n; i--)

#define int long long
#define all(a) a.begin(),a.end()       

#define pb push_back
typedef long long ll; 
typedef pair<int, int> ii;
typedef pair<int,ii > iii; 
typedef vector<ii> vii;
typedef vector<char> vchar;
typedef vector<int> vi;
#define ff first
#define ss second
#define lb lower_bound
#define ub upper_bound

#define mem(a, b) memset(a, b, sizeof(a));
#define mem0(a) memset(a, 0, sizeof(a));

#define INF 1000000000
//#define mod 998244353
#define mod 1000000007
#define endl "\n"


   //=\/=\/=\/=\/=\/=\/=\/=\/=\/=\        Jai Hind Dosto        /=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\\
  //=\/=\/=\/=\                    ̿̿ ̿̿ ̿̿ ̿'̿'\̵͇̿̿\з= ( ▀ ͜͞ʖ▀) =ε/̵͇̿̿/’̿’̿ ̿ ̿̿ ̿̿ ̿̿                             /=\/=\/=\/=\\
 //=\/=\/=\/=\                                                                               /=\/=\/=\/=\\
//=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\/=\\



int modPow(int a, int b);           

                
void solve(){
    int n ;
    cin >> n ;
    if(n>=30)cout <<"Yes";
    else cout << "No";
    
}






signed main(){

    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //cout << fixed;
    //cout <<setprecision(6);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    
   // int test=1; cin >> test; while(test--)
    solve();
}

int modPow(int a, int b){
    if(b==0)return 1;
    if(b%2==0){
        int x = a*a;
        x%=mod;
        return modPow(x,b/2);
    }
    return (a*modPow(a,b-1))%mod;
}




Measured memory_bytes: 3572
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int pop();
void push(int );
int cal(char );
int top=1;
int stuff[100];
int main(){
  int i=0,num,j;
  char c[100],m;
  while(scanf("%s",c)!=EOF){
    /*if('0'<=c[i] && c[i]<='9'){
      num=c[i]-48;
      push(num);
      }*/
    for(j=0;c[j]!=EOF;j++){
      if(c[j]=='\n'){break;}
    }
    
    if('+'==c[0] || '-'==c[0] || '*'==c[0]){
      push(cal(c[0]));
    }
    else {
      num = atoi(c);
      push(num);
    }
    
  }
  printf("%d\n",stuff[top-1]);

  return 0;
}

void push(int num){
  stuff[top]=num;
  /*printf("%d\n",stuff[top]);*/
  top++;
}

int cal(char kei){
  int n1,n2,ans;
  n2=pop();
  n1=pop();
  if(kei=='+'){
    ans=n1+n2;
  }
  else if(kei=='-'){
    ans=n1-n2;
  }
  else if(kei=='*'){
    ans=n1*n2;
  }
  else {}
  return ans;
}

int pop(){
  top--;
  return stuff[top];
}



Measured memory_bytes: 2100
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <cmath>

using namespace std;
typedef long long ll;
ll mod = 1000000007;

int main()
{
	int a, b;
	cin >> a >> b;
	cout << max(a+b, max(a-b, a*b)) << endl;
	return 0;
}

Measured memory_bytes: 256
/////16:25~
/////A:

#include<iostream>

using namespace std;

int n,m;
int d[111],v[111];
int t[111];
int main(){

    while(true){
    cin>>n>>m;
    if(n==0&&m==0)break;
    for(int i=0;i<n;i++)cin>>d[i]>>v[i];
    for(int i=0;i<n;i++)t[d[i]]=max(t[d[i]],v[i]);
    int ans=0;

    for(int i=1;i<=m;i++)ans+=t[i];

    cout<<ans<<endl;


    for(int i=0;i<=m;i++)t[i]=0;
    }

    return 0;
}


Measured memory_bytes: 3080
import java.util.*;

public class Main {
    static HashSet<Integer> dic = new HashSet<>();
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int d = sc.nextInt();
        String ans = "Christmas";
        for(int i=d;i<25;i++) ans = ans+" Eve";
        System.out.println(ans);
    }
}

Measured memory_bytes: 21332
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#include<complex>
using namespace std;

//#define int long long
typedef long long ll;

typedef unsigned long long ul;
typedef unsigned int ui;
const ll mod = 998244353;
const ll INF = mod * mod;
typedef pair<int, int>P;
typedef pair<int, bool> sP;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
typedef pair<ll, ll> LP;
typedef vector<ll> vec;
typedef long double ld;
typedef pair<ld, ld> LDP;
const ld eps = 1e-6;
const ld pi = acos(-1.0);
typedef vector<vector<ll>> mat;
typedef vector<ll> vec;

struct edge {
	int to, id;
};
vector<edge> G[1 << 17];
int ans[1 << 17];
int cnt;

void dfs(int id, int fr, int pre) {
	int tmp = 1;
	rep(j, G[id].size()) {
		int to = G[id][j].to;
		if (to == fr)continue;
		int t = G[id][j].id;
		if (tmp == pre)tmp++;
		ans[t] = tmp;
		dfs(to, id, tmp);
		tmp++;
	}
}
void solve() {
	int n; cin >> n;
	rep(i, n - 1) {
		int a, b; cin >> a >> b; a--; b--;
		G[a].push_back({ b,i });
		G[b].push_back({ a,i });
	}
	rep(i, n) {
		cnt = max(cnt, (int)G[i].size());
	}
	dfs(0, -1, 0);
	cout << cnt << endl;
	rep(i, n - 1) {
		cout << ans[i] << endl;
	}
}

signed main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	//cout << fixed << setprecision(7);
	//init();
	solve();
	//stop
	return 0;
}



Measured memory_bytes: 10112
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
typedef vector<int> vi;
typedef long long lint;
typedef unsigned int uint;
typedef pair<int, int> pii;
typedef pair<lint, lint> pll;
typedef unsigned long long ulint;
#define endl '\n'
#define fst first
#define sed second
#define pb push_back
#define mp make_pair
#define rint register int
#define SZ(x) (int((x).size()))
#define all(x) (x).begin(), (x).end()
#define reveal(x) cerr << #x << " = " << (x) << endl
#define rep(it, f, e) for (rint it = (f); it <= (e); ++it)
#define per(it, f, e) for (rint it = (f); it >= (e); --it)
#define repe(it, x) for (auto it = (x).begin(); it != (x).end(); ++it)
const int SIZE = (1 << 19) + 10;
vector<pii> vec;
vector<lint> unq;
struct SegmentTree {
	#define lson (root << 1)
	#define rson (root << 1 | 1)
	#define mid ((stdl + stdr) >> 1)
	lint val[SIZE], tag[SIZE];
	inline void build(int root = 1, int stdl = 0, int stdr = SZ(unq) - 1) {
		if (stdl == stdr) {
			val[root] = vec[stdl].sed;
			return;
		}
		build(lson, stdl, mid);
		build(rson, mid + 1, stdr);
		val[root] = max(val[lson], val[rson]);
	}
	inline void pushdown(int root) {
		if (tag[root]) {
			tag[lson] += tag[root];
			tag[rson] += tag[root];
			val[lson] -= tag[root];
			val[rson] -= tag[root];
			tag[root] = 0;
		}
	}
	inline pll query(int root = 1, int stdl = 0, int stdr = SZ(unq) - 1) {
		if (val[root] <= 0) return pll(- 1, - 1);
		if (stdl == stdr) return pll(stdl, val[root]);
		pushdown(root);
		return val[lson] > 0 ? query(lson, stdl, mid) : query(rson, mid + 1, stdr);
	}
	inline void modify(int l, int r, lint p, int root = 1, int stdl = 0, int stdr = SZ(unq) - 1) {
		if (l <= stdl && stdr <= r) {
			val[root] -= p;
			tag[root] += p;
			return;
		}
		pushdown(root);
		if (l <= mid) modify(l, r, p, lson, stdl, mid);
		if (r > mid) modify(l, r, p, rson, mid + 1, stdr);
		val[root] = max(val[lson], val[rson]);
	}
	#undef lson
	#undef rson
	#undef mid
}	tr;
int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL), cout.tie(NULL);
	int n, D, A;
	cin >> n >> D >> A;
	D <<= 1;
	rep (i, 1, n) {
		int x, y;
		cin >> x >> y;
		unq.emplace_back(x);
		vec.emplace_back(x, y);
	}
	sort(all(unq));
	sort(all(vec));
	tr.build();
	lint res = 0;
	auto getID = [&] (lint pos) {
		return upper_bound(all(unq), pos) - unq.begin() - 1;
	};
	while (true) {
		pll p = tr.query();
		if (p.fst == -1) break;
		lint tim = (p.sed + A - 1) / A ;res += tim;
		tr.modify(p.fst, getID(unq[p.fst] + D), tim * A);
	}
	cout << res << endl;
	return 0;
}

Measured memory_bytes: 11748
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<bitset>
#include<deque>
#include<functional>
#include<iterator>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<utility>
using namespace std;
typedef long long ll;
#define a first
#define b second
#define sz(x) (ll)((x).size())
#define pb push_back
#define mp make_pair
#define bg begin()
#define ed end()
#define all(x) (x).bg,(x).ed
#define rep(i,n) for(ll i=0;i<(n);i++)
#define rep1(i,n) for(ll i=1;i<=(n);i++)
#define rrep(i,n) for(ll i=(n)-1;i>=0;i--)
#define rrep1(i,n) for(ll i=(n);i>=1;i--)
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
const ll MOD=1000000007;
const ll INF=1000000000000000;
template<class T> inline bool chmin(T& a, T b){if(a>b){a=b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b){if(a<b){a=b;return true;}return false;}
ll maxx(ll x,ll y,ll z){return max(max(x,y),z);}
ll minn(ll x,ll y,ll z){return min(min(x,y),z);}
ll gcd(ll x,ll y){if(x%y==0) return y;else return gcd(y,x%y);}
ll lcm(ll x,ll y){return x*(y/gcd(x,y));}
ll digsz(ll x){if(x==0) return 1;else{ll ans=0;while(x){x/=10;ans++;}return ans;}}
ll digsum(ll x){ll sum=0;while(x){sum+=x%10;x/=10;}return sum;}
vector<ll> pw2(62,1);vector<ll> pw10(19,1);

int main(){
    {rep1(i,61) pw2[i]=2*pw2[i-1];}
    {rep1(i,18) pw10[i]=10*pw10[i-1];}
    
    ll N; cin>>N;
    vector<ll> A(N);
    vector<ll> B(N);
    ll sumA=0,sumB=0;
    rep(i,N){
        cin>>A[i];
        sumA+=A[i];
    }
    rep(i,N){
        cin>>B[i];
        sumB+=B[i];
    }
    
    if(sumB>sumA){
        cout<<-1<<endl;
        return 0;
    }
    
    ll ans=0,sum=0;
    vector<ll> X;
    rep(i,N){
        if(A[i]<B[i]){
            ans++;
            sum+=(B[i]-A[i]);
        }
        else if(A[i]>B[i]){
            X.pb(A[i]-B[i]);
        }
    }
    sort(all(X),greater<ll>());
    
    if(ans==0){
        cout<<0<<endl;
        return 0;
    }
    
    ll tmp=0;
    rep(i,sz(X)){
        ans++;
        tmp+=X[i];
        if(tmp>=sum) break;
    }
    
    cout<<ans<<endl;
}



Measured memory_bytes: 5412
F =-> {gets.split.map &:to_i}
*,k = F[]
a = F[] << k+1
B = F[]
m=n = a.index {0 > k-=_1}
A = a[0..n]
while a=A.pop
  k += a
  (k-=B.shift; n+=1) while B[0]<=k rescue A.pop(m)
  m = [m,n].max
  n -= 1
end
p m

Measured memory_bytes: 41800
import math
from math import gcd,pi,sqrt
INF = float("inf")

import sys
sys.setrecursionlimit(10**6)
import itertools
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    s = s_input()
    ans = 0
    trial = s[0]
    for i in s[1:]:
        if trial != i:
            ans += 1
            trial = i
    print(ans)


if __name__=="__main__":
    main()


Measured memory_bytes: 9480
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<cstring>
#include<string>

using namespace std;
int main()
{
  int a[10];//基础数组
int b[10];//存目标数组1
int c[10];//存目标数组2 
    int n,t2 = 0,t1 = 0;
    scanf("%d",&n);

   for(int i=0; i<n; i++){
    
        a[i] = i+1;
		
} //以0开头的存的是 这个最基本的哪一个数字 

        for(int i=0; i<n; ++i)
            scanf("%d",&b[i]);//每一个i表示一位数字
		 for(int i=0; i<n; ++i)
            scanf("%d",&c[i]);//每一个i表示一位数字
		

    do{
        t1++;
        int flag = 0;
        for(int i=0; i<n; ++i){
            if(a[i]!=b[i]){ //对比基本数字和存储的
			//如果不相等就是1 
			//退出循环开始演算基础的 继续拍
			//直到找到相等的 也就是位置 记录位置是第t个 
                flag = 1;
                break;
            }
        }
        if(!flag)
            break;
    }while(next_permutation(a,a+n));

    for(int i=0; i<n; i++){
     a[i] = i+1;
} 
    do{
        t2++;
        int flag = 0;
        for(int i=0; i<n; ++i){
            if(a[i]!=c[i]){
                flag = 1;
                break;
            }
        }
        if(!flag){
            break;
        }
    }while(next_permutation(a,a+n));

    printf("%d",abs(t1-t2));
    return 0;
}


Measured memory_bytes: 3740
#include<bits/stdc++.h>
using namespace std;
const int N=1005;
int k;
int main(){
	scanf("%d",&k);
	if (k<=500){
		printf("%d\n",k);
		for (int i=1;i<=k;i++){
			for (int j=1;j<=k;j++)printf("%d ",i);
			puts("");
		}
		return 0;
	}
	int n=(k+3)/4*2;
	printf("%d\n",n);
	for (int i=1;i<=n;i++){
		for (int j=1;j<=n;j++){
			int x;
			if (i&1)x=(i+j)%n;
			else x=n+(i+j)%n;
			if (x>=k)x-=n;
			printf("%d ",x+1);
		}
		puts("");
	}
}

Measured memory_bytes: 1152
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define dbg(x) cout << #x << '=' << x << '\n';
#define ll long long
#define pi pair<int,int>
#define pl pair<long long,long long>
#define lg length()
#define pb push_back
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005

long long ans=1,n,m,mod=1e9+7;

int32_t main(){
    ios_base :: sync_with_stdio(0); cin.tie(); cout.tie();
    cin >> n >> m;
    for(int i=1;i<=n;i++) ans*=i,ans%=mod;
    for(int i=1;i<=m;i++) ans*=i,ans%=mod;
    if(n==m){
        cout << 2*ans%mod;
    }
    else if(abs(n-m)==1){
        cout << ans;
    }
    else{
        cout << 0;
    }
}


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

int main(){
  int hist[100];
  for(int i=0; i<100;i++) hist[i] = 0;
 
  int n;
  while(cin >> n) hist[n]++;
  
  int maxv = 0;
  for(int i=0;i<100;i++){
    if(hist[i] >  maxv) maxv = hist[i];
  }
  
  for(int i=0;i<100;i++){
    if(maxv == hist[i]) cout << i << endl;
  }
  return 0;
}

Measured memory_bytes: 1160
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int main()
{
	int a[10],ans=0;
	for(int iii=1;iii<=2;iii++){
		ans=0;
	for(int i=0;i<10;i++){
		scanf("%d",&a[i]);
	}
	sort(a,a+10);
	ans+=a[7]+a[8]+a[9];
	if(iii==1)printf("%d ",ans);
	else printf("%d\n",ans);

	}
	return 0;
}

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

public class Hello {
    public static void Main() {
        //使わないのはコメントアウトしないとエラー
//        var num = NumInput();
        var text = StringInput();
        
        int res = 0;
      	if(text[0][0] == '1') res++;
      if(text[0][1] == '1') res++;
      if(text[0][2] == '1') res++;
        
        Result(res);
        
    }
    static int[] NumInput(){
        var input_line = Console.ReadLine().Split(' ');
        return input_line.Select(int.Parse).ToArray();
    }
    static string[] StringInput(){
        return Console.ReadLine().Split(' ');
    }
    
    static void Result(string text){
        Console.WriteLine( text );
    }   
    static void Result(int num){
        Console.WriteLine( num );
    }
    static void Result(float num){
        Console.WriteLine( num );
    }
}

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


int main() {
    int a,b;
    cin>>b>>a;
    int count=0;
    for (int i = b ; i <a+1; ++i) {
        if(i/10000==i%10 && (i/1000)%10==(i%100)/10)count++;
    }
    cout<<count<<endl;
    return 0;
}

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

int main(){
    int h,w;
    cin >> h >> w;
    char grid[h+1][w+1];
    for(int i=1;i<=h;i++)
        for(int j=1;j<=w;j++)
            cin >> grid[i][j];
    vector<vector<ll>> dp (h+1,vector<ll>(w+1));
    dp[0][1] = 1;
    for(int i=1;i<=h;i++){
        for(int j=1;j<=w;j++){
            if(grid[i][j] == '#') dp[i][j] = 0;
            else dp[i][j] = (dp[i-1][j] + dp[i][j-1]) % MOD;
        }
    }
    cout << dp[h][w] << endl;
    return 0;
}

Measured memory_bytes: 12208
#include <assert.h>
#include <limits.h>
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <complex>
#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>
 
#define rep(i, a, b) for (long long (i) = (a); i < (b); i++)
#define all(i) i.begin(), i.end()
#define debug(i) std::cerr << "debug " << #i <<" "<< i << std::endl
 
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 ((a == 0)||(mod!=-1&&a%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<ll, ll>;

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

  ll n;
  std::cin>>n;

  bool issame=true;
  ll sum=0,min=MOD;

  rep(i,0,n){
    ll a,b;
    std::cin>>a>>b;
    if(a!=b)issame=false;
    sum+=a;
    if(a>b)chmin(min,b);
  }

  if(issame)std::cout<<0<<"\n";
  else std::cout<<sum-min<<"\n";

  return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>

#define pb push_back
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define ll long long



using namespace std;

void file(){
	#ifndef ONLINE_JUDGE
    	freopen("in.txt", "r", stdin);
	#endif
}
int tc;
const int N=5e5+5,M=2e6+5,MOD=1e9+7,OO=1e9;

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

	int n,m;

	scanf("%d %d",&n,&m);
	std::vector<tuple<int,int,int>> edges(m,tuple<int,int,int>(0,0,0));
	for(int i=0,a,b,c;i<m;i++)scanf("%d %d %d",&a,&b,&c),edges[i]=make_tuple(a,b,c);

	std::vector<ll> dist(n+1,-1e18);
	
	dist[1]=0;
	for(int i=1;i<n;i++){
		for(auto e : edges){
			int a,b,c;
			tie(a,b,c) = e;
			if(dist[b]<dist[a]+c){
				dist[b]=dist[a]+c;
			}
		}

	}
	
	for(auto e : edges){
		int a,b,c;
		tie(a,b,c) = e;

		if(b==n && dist[n]<dist[a]+c){
			return !printf("inf\n");
		}
		if(dist[b]<dist[a]+c)dist[b]=dist[a]+c;	
	}

	printf("%lld\n",dist[n] );
}		


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <cstring>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string>
#include <stdlib.h>
#include <queue>
#include <stack>
#include <utility>
#include <fstream>
#include <random>
#include <map>
#include <unordered_map>
#include <cstdlib>
#include <functional>
#include <random>
#include <time.h>
#include <chrono>
#include <sstream>
#include <iomanip>
#define rep(i,n) for(int i=0;i<n;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define FOR(i,a,b) for(int i=a;i<b;i++)
#define ll long long
#define INF 1000000001
#define mod 1000000007
#define sort(s) sort(s.begin(), s.end());
#define reverse(s) reverse(s.begin(), s.end());
#define P pair<int,int>
#define mp make_pair
#define valid(x,y,h,w) (0<=x&&x<h&&0<=y&&y<w)
int dx[4] = { 0,1,0,-1 };
int dy[4] = { 1,0,-1,0 };
using namespace std;
int POW(int x, int y) { return int(pow(double(x), double(y))); }
double log(double a, double b) { return log(b) / log(a); }

vector<vector<ll>> conbination(int n) {
	auto ans = vector<vector<ll>>(n + 1);
	ans[0].push_back(1);
	rep(i, n) {
		rep(j, i + 2) {
			if (j == 0 || j == i + 1) {
				ans[i+1].push_back(1);
			}
			else {
				ans[i + 1].push_back(ans[i][j - 1] + ans[i][j]);
			}
		}
	}
	return ans;
}



int main() {
	int n;
	cin >> n;
	vector<vector<ll>> len(n);
	vector<vector<int>> to(n);
	rep(i, n-1) {
		int a, b, c;
		cin >> a >> b >> c;
		a--; b--;
		to[a].push_back(b);
		to[b].push_back(a);
		len[a].push_back(c);
		len[b].push_back(c);
	}
	int q, k;
	cin >> q >> k;
	k--;
	vector<ll> minLen(n, -1);
	stack<int> st;
	st.push(k);
	minLen[k] = 0;
	while (st.size()) {
		int x = st.top();
		st.pop();
		rep(j, to[x].size()) {
			if (minLen[to[x][j]] == -1) {
				minLen[to[x][j]] = minLen[x] + len[x][j];
				st.push(to[x][j]);
			}
		}
	}
	rep(i, q) {
		int x, y;
		cin >> x >> y;
		x--; y--;
		cout << minLen[x] + minLen[y] << endl;
	}
	return 0;
}



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


int Solve(int i, int m, int n, int* A) {
	if (m == 0) {
		return 1;
	}

	if (i >= n) {
		return 0;
	}

	int res = Solve(i + 1, m, n, A) || Solve(i + 1, m - A[i], n, A);
	return res;
}



int main() {
	

	int n = 0;
	cin >> n;

	int* A = new int[n];

	for (int i = 0; i < n; i++) {
		cin >> *(A + i);
	}

	int q = 0;
	int m = 0;
	int i = 0;

	cin >> q;

	for (i = 0; i < q; i++) {
		cin >> m;
		if (Solve(0, m, n, A)) {
			cout << "yes" << endl;
		}
		else {
			cout << "no" << endl;
		}
	}
	delete[] A;
	A = 0;

	return 0;

}


Measured memory_bytes: 3112
#include<bits/stdc++.h>
#define Yes cout<<"Yes"<<endl;
#define No cout<<"No"<<endl;
#define ll long long int
using namespace std;
int main()
{
    ll a,b,c,x,y,z,cnt=0,sum=0;
    string str;
    cin>>str;
    if(str=="ABC")
    {
        cout<<"ARC"<<endl;
    }
    else cout<<"ABC"<<endl;

}



Measured memory_bytes: 3548
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define f first
long long const mod = 1000000007; 
#define inf 1000000000000000000
inline ll add(ll a, ll b){ return ((a%mod)+(b%mod)+mod)%mod;}
inline ll mul(ll a, ll b){ return (((a%mod)*(b%mod))%mod+mod)%mod;}
inline ll sub(ll a, ll b){ return ((a%mod)-(b%mod)+mod)%mod;}

/*#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<pair<ll,ll>, null_type,less<pair<ll,ll> >, rb_tree_tag,tree_order_statistics_node_update> */

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

ll power(ll x,ll y,ll m) 
{ 
    if (y == 0) 
        return 1; 
    ll p = power(x, y/2, m) % m;
    p = (p * p) % m; 
    return (y%2 == 0)? p : (x * p) % m; 
}

ll modInv(ll x)
{
    return power(x,mod-2,mod)%mod;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
	
    ll n;
    cin>>n;
    // ll k;
    // cin>>k;
    // set<ll>st;
    // for(int i=0;i<k;i++)
    // {
    //     ll l,r;
    //     cin>>l>>r;
    //     st.insert(l);
    //     st.insert(r);
    // }
    // vector<ll>v;
    // for(auto x:st)
    //     v.push_back(v);

    ll ans=0;
    for(ll i=1;i<=n-1;i++)
    {
        ans=ans+(n/i)-(n%i==0);
    }
    cout<<ans<<endl;
    
    
    return 0;
}




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

template<class T> inline bool chmin(T& a,T b){
    if (a > b) {
        a=b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a,T b){
    if(a < b) {
        a=b;
        return true;
    }
    return false;
}
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define INF 999999999

    /*Solve*/
ll cul(ll n){
    if(n%2==0){
        return n/2;
    }else{
        return 3*n+1;
    }
    return -1;
}

int main(){
    ll s;
    cin >> s;
    ll a[1000010];
    ll tmp = s;   //第n項の一時置場
    a[0] = s;

    map<ll,bool> mp;
    mp[s] = true;
    for(ll i=1;i<1000000;i++){
        tmp = cul(tmp);
        a[i] = tmp;
        if(mp[tmp] == true){
            cout << i+1 << endl;
            break;
        }
        mp[tmp] = true;
    }
    return 0;
}

Measured memory_bytes: 256
N=int(input())

X=list(range((N//4)+1))
Y=list(range((N//7)+1))

flag=0
tmp=0

for x in X:
    if flag==1:
        break
    for y in Y:
        if int(4*x + 7*y)==N:
            flag=1
            print('Yes')
            break
    else:
        pass

if flag ==0 :
    print('No')



Measured memory_bytes: 3060
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<queue>
#include<deque>
#include<cmath>
#include<map>
#include<set>
#include<cstring>
#include<iomanip> //cout << fixed << setprecision(15) << x << endl;

using namespace std;
typedef long long ll;
const ll INF = 1e9 + 6;
const ll MOD = 1e9 + 7;
const ll LLINF = 1LL<<60;
#define P pair<int, int>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
/* -- template -- */

int main() {
    int N; cin >> N;
    string s; cin >> s;
    char animal[2] = {'W', 'S'};
    for(char a1 : animal) {
        for(char a2 : animal) {
            vector<char>ans;
            ans.pb(a1);
            ans.pb(a2);
            for(int i = 1; i <= N; ++i) {
                if(s[i%N] == 'o') {
                    if(ans[i] == 'S') {
                        ans.pb(ans[i - 1]);
                    }else {
                        ans.pb(((ans[i - 1] == 'S') ? 'W' : 'S'));
                    }
                }else {
                    if(ans[i] == 'S') {
                        ans.pb(((ans[i - 1] == 'S') ? 'W' : 'S'));
                    }else {
                        ans.pb(ans[i - 1]);
                    }
                }
            }
            if(ans[0] == ans[N] && ans[1] == ans[N + 1]) {
                rep(i, N) {
                    cout << ans[i];
                }
                return 0;
            }
        }
    }
    cout << -1 << endl;
}


Measured memory_bytes: 768
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG //これつけるとA[N]でもいいらしい
//for文のマクロ
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define big 1000000007
int main(){
    string s;
    cin >> s;
    int n = s.length();
    int k=1;
    int i=1;
    bool pre2 = false;
    while(i<n){
        if(!pre2 && s[i]!=s[i-1]){
            k++;
            i++;
        }
        else if(!pre2 && s[i]==s[i-1]){
            if(i==n-1){
                break;
            }
            k++;
            i += 2;
            pre2 = true;
        }
        else{
            k++;
            i++;
            pre2 = false;
        }
    }
    cout << k <<endl;
    
}

Measured memory_bytes: 640
def dfs(A):
    if len(A) == n+1:
        p = 0
        global ans
        for i in range(q):
            if A[b[i]]-A[a[i]] == c[i]:
                p += d[i]
        if p > ans:
            ans = p
        return
    num = A[-1]
    while num <= m:
        dfs(A[:]+[num])
        num += 1


if __name__ == "__main__":
    n, m, q = map(int, input().split())
    a, b, c, d = [None]*q, [None]*q, [None]*q, [None]*q
    for i in range(q):
        a[i], b[i], c[i], d[i] = map(int, input().split())
    ans = 0
    dfs([1])
    print(ans)

Measured memory_bytes: 78756
#include "bits/stdc++.h"
using namespace std;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
static const int INF = 0x3f3f3f3f; static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
template<typename T, typename U> static void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> static void amax(T &x, U y) { if(x < y) x = y; }

int main() {
	int N; int M;
	while(~scanf("%d%d", &N, &M)) {
		vector<vi> companies(N);
		vector<pair<pii, int>> edges;
		rep(i, M) {
			int p; int q; int c;
			scanf("%d%d%d", &p, &q, &c), -- p, -- q, -- c;
			companies[p].push_back(c);
			companies[q].push_back(c);
			edges.emplace_back(make_pair(p, c), q);
		}
		vector<int> offset(N + 1);
		offset[0] = N;
		rep(i, N) {
			vi &v = companies[i];
			sort(v.begin(), v.end());
			v.erase(unique(v.begin(), v.end()), v.end());
			offset[i + 1] = offset[i] + v.size();
		}
		vector<vi> graph(offset[N]);
		rep(i, N) {
			reu(j, offset[i], offset[i + 1])
				graph[j].push_back(i);
		}
		for(auto e : edges) {
			int u, c, v;
			tie(u, c) = e.first;
			v = e.second;
			int x = offset[u] + (int)(lower_bound(companies[u].begin(), companies[u].end(), c) - companies[u].begin());
			int y = offset[v] + (int)(lower_bound(companies[v].begin(), companies[v].end(), c) - companies[v].begin());
			graph[x].push_back(y);
			graph[y].push_back(x);
		}
		vector<bool> vis(offset[N]);
		vi q, nq;
		nq.push_back(0);
		int ans = -1;
		for(int d = 0; !nq.empty(); ++ d) {
			q.swap(nq);
			while(!q.empty()) {
				int i = q.back(); q.pop_back();
				if(vis[i]) continue;
				vis[i] = true;
				if(i == N - 1) {
					ans = d;
					nq.clear();
					break;
				}
				if(i < N) {
					reu(j, offset[i], offset[i + 1])
						nq.push_back(j);
				} else {
					for(int j : graph[i])
						q.push_back(j);
				}
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}


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

count = 0

count += (a[2] - a[1])

a[0] += (a[2] - a[1])
a[1] = a[2]


count += (a[2] - a[0] + 1) / 2

a[0] += 2*((a[2] - a[0] + 1) / 2)

count += (a[2] - a[0]) % 2

puts count


Measured memory_bytes: 1788
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
using namespace std; 
#define pb push_back 
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ll long long
#define sc(x) scanf("%d",&x)
#define sd(x) scanf("%lf",&x)



int main(int argc, char** argv) {
	int h1,m1,h2,m2,k;
	cin>>h1>>m1>>h2>>m2>>k;
	cout<<max(0,(h2-h1)*60+m2-m1-k);
	return 0;
}



Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
int main(){
        int n; cin >> n;
        long long int m = 1;
        bool q = false;
        for (int x = 1; x <= n; ++x){
            long long int v; cin >> v;
            if (v <= 1000000000000000000/m){
                m *= v;
            }
            else{
                q = true;
            }
            if (m == 0){
                break;
            }
        }
        if (q && m != 0){
            m = -1;
        }
        cout << m << endl;
    return 0;
}


Measured memory_bytes: 3636
#include"iostream"
#include"algorithm"
using namespace std;

int main()
{
	int n, m;
	cin >> n >> m;
	long long dis[2010];
	for (int i = 0; i < n + 1; i++)
	{
		dis[i] = -1234567890123;
		dis[1] = 0;
	}
	long long a[2010], b[2010], c[2010];
	for (int i = 0; i < m; i++)cin >> a[i] >> b[i] >> c[i];

	for (int loop = 0; loop < n; loop++)
	{
		for (int i = 0; i < m; i++)dis[b[i]] = max({ dis[b[i]], dis[a[i]] + c[i] });
	}

	long long ans = dis[n];

	for (int loop = 0; loop < n; loop++)
	{
		for (int i = 0; i < m; i++)dis[b[i]] = max({ dis[b[i]], dis[a[i]] + c[i] });
	}

	long long ifinf = dis[n];

	if (ans < ifinf)cout << "inf" << endl;
	else cout << ans << endl;
}

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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int d[30][30];
int c[500][500];
int v[3][30];

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    int n;cin >> n;
    int C;cin >> C;
    inc(i, 0, C){
        inc(j, 0, C){
            cin >> d[i][j];
        }
    }
    inc(i, 0, n){
        inc(j, 0, n){
            cin >> c[i][j];
            c[i][j]--;
        }
    }
    int ans = INT_MAX;
    inc(k, 0, 3){
        inc(x, 0, C){
            inc(i, 0, n){
                inc(j, 0, n){
                    if((i+j)%3 == k){
                        v[k][x] += d[c[i][j]][x];
                    }
                }
            }
        }
    }
    inc(x, 0, C){
        inc(y, 0, C){
            inc(z, 0, C){
                if(x == y || y == z || z == x) continue;
                ans = min(ans, v[0][x]+v[1][y]+v[2][z]);
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1408
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

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

    int N;

    int count = 1;

    cin >> N;

    vector<int> hp(N);

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

    sort(hp.begin(), hp.end());

    while(count != N){
        if(hp[N - count] % hp[0] == 0){
            hp.pop_back();
            count++;
        }else{
            int tui = hp[N - count] % hp[0];
            hp.insert(hp.begin(), tui);
            hp.pop_back();
        }
    }

    cout << hp[0];
}

Measured memory_bytes: 1024
<>;($x,$y)=glob,printf"%f\n",sort{$b<=>$a}0,map+(-$~+($~=$_))/$P-.5,(@b=sort{$a<=>$b}map+(/ /*atan2$'-$y,$`-$x)x!/^$x $y/,@a),"@b"+($P=6.2832)for@a=<>

Measured memory_bytes: 5248
#include<bits/stdc++.h>
#include<iostream>
#include<string>
#include<cmath>
#include<cstdio>
#include<cctype>
#include<cstring>
#include<iomanip>
#include<cstdlib>
#include<ctime>
#include<set>
#include<map>
#include<utility>
#include<queue>
#include<vector>
#include<stack>
#include<sstream>
#include<algorithm>
#define forn(i,a,b)for(int i=(a),_b=(b);i<=_b;i++)
#define fore(i,b,a)for(int i=(b),_a=(a);i>=_a;i--)
#define rep(i,n)for(int i=0,_n=n;i<n;i++)
#define ll long long
#define pii pair<int,int>
#define vi vector<int>
#define vpii vector<pii>
#define m_p make_pair
#define re return
#define pb push_back
#define si set<int>
#define ld long double
#define X first
#define Y second
#define st string
#define ull unsigned long long
#define mod 1000000007
#define INF 1000000007
#define x1 XZVJDFADSPFOE
#define y1 GASDIJSLDAEJF
#define x2 DFDAJKVOHKWIW
#define y2 PSFSAODSXVNMQ
#define LLINF 0x3f3f3f3f3f3f3f3fLL
using namespace std;
inline void read(int &x)
{
	short negative=1;
    x=0;
    char c=getchar();
    while(c<'0' || c>'9')
    {
		if(c=='-')
			negative=-1;
		c=getchar();
	}
    while(c>='0' && c<='9')
        x=(x<<3)+(x<<1)+(c^48),c=getchar();
    x*=negative;
}
ll quickpower(ll n,ll k){
	ll ans=1;
	while(k){
		if(k%2){
			ans*=n;
			ans%=mod;
		}
		n*=n;
		n%=mod;
		k/=2;
	}
	return ans;
}
string int_to_string(int n)
{
	string s="";
	while(n)
	{
		int now=n%10;
		s+=now+'0';
		n/=10;
	}
	reverse(s.begin(),s.end());
	return s;
}
int string_to_int(string s)
{
	int n=0;
	rep(i,s.size())
	{
		n*=10;
		n+=s[i]-'0';
	}
	return n;
}
map<string,bool>mp;
int main()
{
	ios::sync_with_stdio(0);
	//think twice,code once
	int n;
	string s;
	cin>>n;
	int ans=0;
	rep(i,n)
	{
		cin>>s;
		if(mp[s]==0)
		{
			ans++;
			mp[s]=1;
		}
	}
	cout<<ans<<endl;
	return 0;
}



Measured memory_bytes: 19292
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
using namespace std;

int main(){
  string s[3];
  for(int i = 0; i < 3; i++){
    cin >> s[i];
  }
  
  int number = 0;
  
  int num_abc[3] = {0, 0, 0};
  int ans = 0;
  while(true){
    if(s[number][num_abc[number]] == 'a'){
      num_abc[number]++;
      number = 0;
    }
    else if(s[number][num_abc[number]] == 'b'){
      num_abc[number]++;
      number = 1;
    }
    else {
      num_abc[number]++;
      number = 2;
    }
    
    if(num_abc[number] == s[number].size()){
      ans = number;
      break;
    }
  }
  
  if(ans == 0){
    cout << "A" << endl;
  }
  else if(ans == 1){
    cout << "B" << endl;
  }
  else {
    cout << "C" << endl;
  }
}


Measured memory_bytes: 256