akhauriyash/Code-Regression huggingface dataset:
#pragma region head
    #include <bits/stdc++.h>
    using namespace std;
    using ll = long long;
    using vi = vector<int>;
    using vll = vector<ll>;
    using pi = pair<int, int>;
    using pll = pair<ll,ll>;
    template <class T> using vv = vector<vector<T>>;
    #define rep(i,n) for(int i = 0; i < (int)(n); i++)
    #define repi(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
    #define rrep(i,n) for(int i = (int)(n)-1; i >= 0; i--)
    #define rrepi(i,a,b) for(int i = (int)(b)-1; i >= (int)(a); i--)
    const int INF = 1002003004;
    const ll LINF = 1002003004005006007ll;
    struct preprocess{preprocess()
    {cin.tie(nullptr);ios::sync_with_stdio(false);cout<<fixed<<setprecision(20);}}____;
#pragma endregion head
#pragma endregion library
    template<typename T>
    struct BIT {
    int n;
    vector<T> d;
    BIT(int n=0):n(n),d(n+1) {}
    void add(int i, T x=1) {
        for (i++; i <= n; i += i&-i) {
        d[i] += x;
        }
    }
    T sum(int i) {
        T x = 0;
        for (i++; i; i -= i&-i) {
        x += d[i];
        }
        return x;
    }
    T sum(int l, int r) {
        return sum(r-1) - sum(l-1);
    }
    };
#pragma endregion library
const int MX = 200005;
int in[MX], out[MX], k;
vector<int> to[MX];
void dfs(int v, int p=-1){
    in[v] = k++;
    for (int u: to[v]){
        if (u==p) continue;
        dfs(u,v);
    }
    out[v] = k;
}
    vector<ll> vs[MX];
ll f(ll n){
    return n*(n+1)/2;
}
int main(){
    int n; cin >> n;
    vector<ll> c(n);

    for (int i = 0; i < n; i++){
        cin >> c[i];
        vs[c[i]-1].emplace_back(i);
        
    }
    for (int i = 0; i < n-1; i++){
        int a,b;
        cin >> a >> b;
        a--; b--;
        to[a].emplace_back(b);
        to[b].emplace_back(a);
    }
    dfs(0);
    ll tot=f(n);
    BIT<int> d(n);
    for (int i = 0; i < n; i++){
        d.add(i,1);
    }
    for (int i = 0; i < n; i++){
        ll ans = tot;
        vector<ll> nvs = vs[i];
        sort(nvs.begin(), nvs.end(), [&](int a, int b){
            return in[a] > in[b];
        });
        vector<pair<ll, ll>> history;
        for (auto j: nvs){
            ll cnt = 1;      
            for(auto k: to[j]){
                if(in[j]>in[k])continue;
                ll num = d.sum(in[k],out[k]);
                ans -= f(num);
                cnt += num;
            }
            d.add(in[j],-cnt);
            history.emplace_back(make_pair(in[j],cnt));
        }
        ans -= f(d.sum(0,n));
        cout << ans << '\n';
        for (auto p:history){
            d.add(p.first,p.second);
        }
    }
    
}


Measured memory_bytes: 37260
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        if ((a * b) % 2 == 0) {
            System.out.println("Even");
        } else {
            System.out.println("Odd");
        }

    }

}

Measured memory_bytes: 21716
#pragma once
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <numeric>
#include <iomanip>
#define M_PI acos(-1)
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 1000000007;
const int MAX_V = 201;
int now = 0;

const int MAX = 510000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		fac[i] = fac[i - 1] * i % MOD;
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
		finv[i] = finv[i - 1] * inv[i] % MOD;
	}
}

// 二項係数計算
long long COM(int n, int k) {
	if (n < k) return 0;
	if (n < 0 || k < 0) return 0;
	return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}
struct edge {
	int t;
	edge(int _t) : t(_t) {}
};
bool use[100010];


vector<edge> te[100010];
vector<edge> fe[100010];
int t[64];
int d[100100];
ll rec(int num) {
	if (num == 0) return 0;
	return rec(num - 1) + num;
}

void Solve() {

	int n;
	cin >> n;
	ll res = 0;
	ll maa = 0;
	for (size_t i = 0; i < n; i++)
	{
		ll a, b;
		cin >> a >> b;
		if (maa < a) {
			maa = a;
			res = a + b;
		}
	}
	cout << res << endl;
}


int main() {
	Solve();
	return 0;
}



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

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 

#define ll long long
#define db double
#define el "\n"
#define ld long double
#define rep(i,n) for(int i=0;i<n;i++)
#define rev(i,n) for(int i=n;i>=0;i--)
#define rep_a(i,a,n) for(int i=a;i<n;i++)
#define all(ds) ds.begin(), ds.end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
typedef vector< long long > vi;
typedef pair<long long, long long> ii;
typedef priority_queue <ll> pq;
#define o_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update> 
#define graph vector<vi>

const ll mod = 1000000007;
const ll INF = (ll)1e18;
const ll MAXN = 1000006;

ll po(ll x, ll n ){ 
    ll ans=1;
     while(n>0){
         if(n&1) ans=(ans*x)%mod;
         x=(x*x)%mod;
         n/=2;
     }
     return ans;
}



int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
   
    int T=1;
    //cin >> T;
    while(T--){
        ll n,k;
        cin>>n>>k;
        ll a[n];
        rep(i,n) cin>>a[i];

        ll l=1, r=mod, mid, cnt;
        while(l<r){
            mid = (l+r)/2;
            cnt=0;
            rep(i,n){
                cnt+=(a[i]/mid);
                if(a[i]%mid==0) cnt--;
            }
            if(cnt<=k) r=mid;
            else l=mid+1;
        }
        cout<<r<<el;
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
    return 0;
}

Measured memory_bytes: 5324
// LCSの練習

#include"bits/stdc++.h"
#include <iostream>
#include <vector>


using namespace std;


int main(){
	
	int q;

	cin >> q ;

	vector<int> ans;

	for(int i= 0; i < q; i++){
		
		string x,y;

		cin >> x;
		cin >> y;

		int len_x = (int)x.length();
		int len_y = (int)y.length();

		// int dp[len_x+1][len_y+1];

		vector<vector<int> > dp(len_x + 1, vector<int>(len_y + 1));

		for(int i = 1; i <= len_x; i++){
			for(int j = 1; j <= len_y; j++){
				if(x[i-1] == y[j-1]){
					dp[i][j] = dp[i-1][j-1]+1;
				}
				else{
					dp[i][j] = max(dp[i-1][j], dp[i][j-1]); 
				}
			}
		}

		ans.push_back(dp[len_x][len_y]);
		// cout << dp[len_x][len_y] << endl;

	}

	for(int i = 0; i < q; i++){
		cout << ans[i] << endl;
	}

	return 0;
}	



Measured memory_bytes: 6908
#include <iostream>
#include <algorithm>
#include <cstring>

#define REP(i, a, b) for ( int i = (a); i < (b); i++ )
#define REVREP(i, a, b) for ( int i = (a); i >= (b); i--)
#define DEBUG_INT(var) printf("the value of "#var" is %d\n", var)
#define PRINT_ARRAY(name, i) printf("the value of "#name"[%d] is %d\n", (i), name[(i)])
#define DEBUG_ARRAY(name, begin, end) REP(i, begin, end) PRINT_ARRAY(name, i)

#define YES puts("YES")
#define NO  puts("NO")
#define Yes puts("Yes")
#define No  puts("No")

using namespace std;

typedef long long ll;

ll ans = 10000000000000;;
ll N;

int main(void) {
    scanf("%lld", &N);

    for (ll i = 1; i*i <= N; i++) {
    	if (N % i == 0) {
    		ll j = N / i;
    		ll v = i+j-2;
    		if (v < ans) ans = v;
    	}
    }
  
    printf("%lld\n", ans);

	return 0;
}


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

#ifdef LOCAL
#define debug(_) cerr << #_ << ": " << (_) << '\n'
#define _GLIBCXX_DEBUG
#else
#define debug(_) (void(0))
#endif  // LOCAL

bool isconnected(vector<vector<int>> &adj) {
    stack<int> st;
    vector<bool> visited(adj.size(), false);
    st.push(0);
    while (!st.empty()) {
        int v = st.top();
        st.pop();
        for (auto nv : adj[v]) {
            if (!visited[nv]) {
                st.push(nv);
                visited[nv] = true;
            }
        }
    }
    return all_of(visited.begin(), visited.end(), [](int x) { return x; });
}

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

    vector<int> as(M), bs(M);
    vector<vector<int>> adj(N, vector<int>(0));
    for (int i = 0; i < M; i++) {
        cin >> as[i] >> bs[i];
        as[i]--; 
        bs[i]--;
        adj[as[i]].push_back(bs[i]);
        adj[bs[i]].push_back(as[i]);
    }
    int ans = 0;
    for (int i = 0; i < M; i++) {
        adj[as[i]].erase(find(adj[as[i]].begin(), adj[as[i]].end(), bs[i]));
        adj[bs[i]].erase(find(adj[bs[i]].begin(), adj[bs[i]].end(), as[i]));
        ans += 1 - isconnected(adj);
        adj[as[i]].push_back(bs[i]);
        adj[bs[i]].push_back(as[i]);
    }

    cout << ans;

    return 0;
}

Measured memory_bytes: 3616
import sys

readline = sys.stdin.readline
MOD = 10 ** 9 + 7
INF = float('INF')
sys.setrecursionlimit(10 ** 5)


def main():
    N, R = map(int, readline().split())

    if N >= 10:
        print(R)
    else:
        print(R + 100 * (10-N))


if __name__ == '__main__':
    main()


Measured memory_bytes: 61972
# -*- coding: utf-8 -*-

import sys

input = sys.stdin.readline
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 2 ** 31 - 1
MOD = 10 ** 9 + 7

class StarrySkyTree:
    """ Starry Sky Tree """

    def __init__(self, N, func, intv):
        self.intv = intv
        self.func = func
        LV = (N-1).bit_length()
        self.N0 = 2**LV
        self.data = [0]*(2*self.N0)
        self.lazy = [0]*(2*self.N0)

    # 伝搬される区間のインデックス(1-indexed)を全て列挙するgenerator
    def gindex(self, l, r):
        L = l + self.N0; R = r + self.N0
        lm = (L // (L & -L)) >> 1
        rm = (R // (R & -R)) >> 1
        while L < R:
            if R <= rm:
                yield R
            if L <= lm:
                yield L
            L >>= 1; R >>= 1
        while L:
            yield L
            L >>= 1

    # 遅延評価の伝搬処理
    def propagates(self, *ids):
        # 1-indexedで単調増加のインデックスリスト
        for i in reversed(ids):
            v = self.lazy[i-1]
            if not v:
                continue
            self.lazy[2*i-1] += v; self.lazy[2*i] += v
            self.data[2*i-1] += v; self.data[2*i] += v
            self.lazy[i-1] = 0

    def update(self, l, r, x):
        """ 区間[l,r)の値にxを加算 """

        # 1. lazyの値は伝搬させない
        # 2. 区間[l,r)のdata, lazyの値を更新
        L = self.N0 + l; R = self.N0 + r
        while L < R:
            if R & 1:
                R -= 1
                self.lazy[R-1] += x; self.data[R-1] += x
            if L & 1:
                self.lazy[L-1] += x; self.data[L-1] += x
                L += 1
            L >>= 1; R >>= 1
        # 3. 更新される区間を部分的に含んだ区間のdataの値を更新 (lazyの値を考慮)
        for i in self.gindex(l, r):
            self.data[i-1] = self.func(self.data[2*i-1], self.data[2*i]) + self.lazy[i-1]

    def query(self, l, r):
        """ 区間[l,r)の最小値を取得 """

        # 1. トップダウンにlazyの値を伝搬
        self.propagates(*self.gindex(l, r))
        L = self.N0 + l; R = self.N0 + r

        # 2. 区間[l, r)の最小値を求める
        s = self.intv
        while L < R:
            if R & 1:
                R -= 1
                s = self.func(s, self.data[R-1])
            if L & 1:
                s = self.func(s, self.data[L-1])
                L += 1
            L >>= 1; R >>= 1
        return s

N, Q = MAP()
sst = StarrySkyTree(N+1, min, INF)

ans = []
for i in range(Q):
    cmd, *arg = MAP()
    if cmd == 0:
        s, t, x = arg
        sst.update(s, t+1, x)
    else:
        s, t = arg
        ans.append(str(sst.query(s, t+1)))
print('\n'.join(ans))



Measured memory_bytes: 24588
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int count = 0;
		while(true){
			int n = scan.nextInt();
			int x = scan.nextInt();

			if(n==0&&x==0){
				break;
			}

			for(int i = 1; i<=n; i++){
				for(int j = 1; j<=n; j++){
					for(int k = 0; k<=n; k++){
						if(i+j+k==x){
							if(i<j&&j<k){
								count++;
							}
						}
					}
				}
			}
			System.out.println(count);
			count = 0;
		}
	}
}

Measured memory_bytes: 26464
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>
#include <vector>
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define MAX 1000000007
using namespace std;

int main(void){
	int r;
	cin>>r;
	if(r<1200)cout<<"ABC"<<endl;
	else if(r<2800)cout<<"ARC"<<endl;
	else cout<<"AGC"<<endl;
	return 0;
}


Measured memory_bytes: 256
#include<cstdio>
#include<vector>
#include<algorithm>
#include<utility>

using namespace std;

int n;
int q;
int v[1<<18], w[1<<18];
vector<pair<int, int>> dp[1<<10];

int fxxk(int x, vector<pair<int, int>>& brute_force) {
  if (x < (1 << 10)) {
    return x;
  }
  int l = brute_force.size();
  for (int i = 0; i < l; i++) {
    brute_force.push_back({brute_force[i].first + w[x], brute_force[i].second + v[x]});
  }
  return fxxk(x/2, brute_force);
}

void solve(int u) {
    if (!dp[u].empty()) {
      return;
    }
    if (dp[u/2].empty()) {
      solve(u/2);
    }
    for (pair<int, int> pii: dp[u/2]) {
      int ww = pii.first;
      int vv = pii.second;
      dp[u].push_back(pii);
      dp[u].push_back({ww + w[u], vv + v[u]});
    }
    sort(dp[u].begin(), dp[u].end());
    for (int i = 1; i < dp[u].size(); i++) {
      if (dp[u][i].second < dp[u][i-1].second) {
        dp[u][i].second = dp[u][i-1].second;
      }
    }
}

int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &v[i], &w[i]);
  }
  dp[1].push_back({0, 0});
  dp[1].push_back({w[1], v[1]});
  for (int i = 1; i <= n && i < (1 << 10); i++) {
    solve(i);
  }
  scanf("%d", &q);
  for (int i = 0; i < q; i++) {
    int u, l;
    scanf("%d %d", &u, &l);
    if (u < (1 << 10)) {
      auto it = lower_bound(dp[u].begin(), dp[u].end(), make_pair(l+1, 0));
      if (it == dp[u].begin()) {
        printf("0\n");
      } else {
        printf("%d\n", (--it) -> second);
      }
    } else {
      vector<pair<int, int>> brute_force;
      brute_force.push_back({0, 0});
      brute_force.push_back({w[u], v[u]});
      int k = fxxk(u/2, brute_force);
      sort(brute_force.begin(), brute_force.end(), [] (auto x, auto y) {
        if (x.first == y.first) {
          return y.second < x.second;
        } else {
          return x.first < y.first;
        }
      });
      for (int j = 1; j < brute_force.size(); j++) {
        if (brute_force[j].second < brute_force[j-1].second) {
          brute_force[j].second = brute_force[j-1].second;
        }
      }
      int llllllll = brute_force.size();
      int p1 = dp[k].size() - 1;
      int p2 = 0;
      int ans = 0;
      while(p2 < llllllll && p1 >= 0) {
        if (dp[k][p1].first + brute_force[p2].first > l) {
          --p1;
        } else {
          ans = max(ans, dp[k][p1].second + brute_force[p2].second);
          ++p2;
        }
      }
      printf("%d\n", ans);
    }
  }
}


Measured memory_bytes: 10528
#include <algorithm>
#include <array>
#include <vector>
#include <iostream>
#include <string>
#include <cmath>
#include <functional>

using namespace std;


int main() {
	int N;
	cin >> N;
	(N < 1000) ? cout << "ABC" << endl : cout << "ABD" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		in.nextLine();
		int[] letters = new int[26]; //from a-z
		for (int z = 0; z < 26; z++) {
			letters[z] = 50;
		}
		for (int x = 0; x < n; x++) {
			String s = in.nextLine();
			int[] nletters = new int[26];
			for (int y = 0; y < s.length(); y++) {
				int a = alphabetExchange(s.charAt(y)) - 1;
				if (letters[a] != -1) {
					nletters[a]++;
				}
			}
			
			for (int z = 0; z < 26; z++) {
				if (nletters[z] == 0) {
					letters[z] = -1;
				} else {
					if (nletters[z] < letters[z]) {
						letters[z] = nletters[z];
					}
				}
			}
		}
		
		String result = "";
		for (int x = 0; x < 26; x++) {
			if (letters[x] > 0) {
				String letter = alphabetExchangeOpp(x + 1);
				for (int y = 0; y < letters[x]; y++) {
					result += letter;
				}
			}
		}
		
		System.out.println(result);
		
	}
	
	public static int alphabetExchange(char l) {
		int num = 0;
		switch (l) {
		case 'a':
			num = 1; break;
		case 'b':
			num = 2; break;
		case 'c':
			num = 3; break;
		case 'd':
			num = 4; break;
		case 'e':
			num = 5; break;
		case 'f':
			num = 6; break;
		case 'g':
			num = 7; break;
		case 'h':
			num = 8; break;
		case 'i':
			num = 9; break;
		case 'j':
			num = 10; break;
		case 'k':
			num = 11; break;
		case 'l':
			num = 12; break;
		case 'm':
			num = 13; break;
		case 'n':
			num = 14; break;
		case 'o':
			num = 15; break;
		case 'p':
			num = 16; break;
		case 'q':
			num = 17; break;
		case 'r':
			num = 18; break;
		case 's':
			num = 19; break;
		case 't':
			num = 20; break;
		case 'u':
			num = 21; break;
		case 'v':
			num = 22; break;
		case 'w':
			num = 23; break;
		case 'x':
			num = 24; break;
		case 'y':
			num = 25; break;
		case 'z':
			num = 26; break;
		}
		return num;
	}
	
	public static String alphabetExchangeOpp(int l) {
		String letter = "";
		switch (l) {
		case 1:
			letter = "a";break;
		case 2:
			letter = "b";break;
		case 3:
			letter = "c";break;
		case 4:
			letter = "d";break;
		case 5:
			letter = "e";break;
		case 6:
			letter = "f";break;
		case 7:
			letter = "g";break;
		case 8:
			letter = "h";break;
		case 9:
			letter = "i";break;
		case 10:
			letter = "j";break;
		case 11:
			letter = "k";break;
		case 12:
			letter = "l";break;
		case 13:
			letter = "m";break;
		case 14:
			letter = "n";break;
		case 15:
			letter = "o";break;
		case 16:
			letter = "p";break;
		case 17:
			letter = "q";break;
		case 18:
			letter = "r";break;
		case 19:
			letter = "s";break;
		case 20:
			letter = "t";break;
		case 21:
			letter = "u";break;
		case 22:
			letter = "v";break;
		case 23:
			letter = "w";break;
		case 24:
			letter = "x";break;
		case 25:
			letter = "y";break;
		case 26:
			letter = "z";break;
		}
		return letter;
	}

}


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

ll n,s,b=2;

ll f(ll b,ll n)
{
    if(n<b)
        return n;
    else
        return f(b,floor(n/b))+n%b;
}

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

    cin>>n>>s;
    if(n<s)
    {
        cout<<-1<<endl;
        return 0;
    }
    if(s==n)
    {
        cout<<n+1<<endl;
        return 0;
    }
    for(ll i=2;i<=sqrt(n)+1;i++)
    {
        if(f(i,n)==s)
        {
            cout<<i<<endl;
            return 0;
        }
    }
    b=1e18;
    ll x=n-s;

    for(ll i=1;i<=sqrt(x)+1;i++)
    {
        if(x%i==0)
        {
            ll r=x/i+1;
            ll k=n%r;
            if(i+k==s)
                if(b>r)
                    b=r;
        }
    }
    if(b!=1e18)
    {
        cout<<b<<endl;
        return 0;
    }
    
    cout<<-1<<endl;
    return 0;
}


Measured memory_bytes: 3696
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    while(cin>>n,n){
        int num[2000]={},co=n;
        for(int i=0;i<n;i++)cin>>num[i];
        for(int i=0;;i++){
            bool kawa=1;
            if(i==10000){
                cout<<-1<<endl;
                break;
            }
            for(int j=0;j<co&&kawa;j++)if(num[j]!=j+1)kawa=0;
            if(kawa){
                cout<<i<<endl;
                break;
            }
            for(int j=0;j<co;j++)num[j]-=1;
            num[co]=co;
            for(int j=0;j<=co;j++){
                if(num[j]==0){
                    for(int k=j+1;k<=co;k++){
                        if(num[k]!=0){
                            swap(num[j],num[k]);
                            break;
                        }
                    }
                }
            }
            for(int j=co+1;j>=0;j--){
                if(num[j]!=0){
                    co=j+1;
                    break;
                }
            }
        }
    }
}

Measured memory_bytes: 1168
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <functional>

using namespace std;
typedef vector<int>::iterator viter;
const int N = 400010;
int _w;

int n, m, ans;
vector<int> right[N];
priority_queue<int, vector<int>, greater<int> > pq;

int main() {
	_w = scanf( "%d%d", &n, &m );
	for( int i = 0; i < n; ++i ) {
		int l, r;
		_w = scanf( "%d%d", &l, &r );
		l += m, swap(l, r);
		if( l <= r ) right[l].push_back(r);
	}
	for( int i = 1; i <= m+m; ++i ) {
		for( viter it = right[i].begin(); it != right[i].end(); ++it )
			pq.push(*it);
		while( !pq.empty() && pq.top() < i )
			pq.pop();
		if( !pq.empty() )
			++ans, pq.pop();
	}
	ans = min(ans, m);
	printf( "%d\n", n-ans );
	return 0;
}


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

int main()
{
  string N;
  cin >> N;
  if(N.at(0)=='7'){ cout << "Yes"; return 0; }
  if(N.at(1)=='7'){ cout << "Yes"; return 0; }
  if(N.at(2)=='7'){ cout << "Yes"; return 0; }
  cout << "No" ;
}


Measured memory_bytes: 3592
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)n; i++)
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using P = pair<int,int>;

int euclidean_gcd(int a, int b) {
 
}

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

    ll ans = 0;
    int a, b, c;
    for(int i = 1; i <= N; i++){
        for(int j = 1; j <= N; j++){
            for(int k = 1; k <= N; k++){
                ans += __gcd(__gcd(i,j),k);
            }
        }
    }

    ll test = ans;
    cout << test << endl;
    return 0;
}

Measured memory_bytes: 3648
#include<iostream>
using namespace std;
typedef long long ll;
int main() {
	int n,x,t;
	cin>>n>>x>>t;
	int c = n/x;
	c += (n%x==0) ? 0 : 1;
	ll a = (long long) (c*t);
	cout<<a;
	return 0;
}


Measured memory_bytes: 3588
# ABC 122 D

MOD = 10**9 + 7
N = int(input())

dp = [[[[0,0,0,0] for k in range(4)] for l in range(4)] for m in range(N+1)]
# dp[i][a][b][c] := i番目まで見て、最後の三文字が左からa,b,c
# A,C,G,T = 0,1,2,3 にそれぞれ対応
dp[0][3][3][3] = 1

for p in range(1,N+1):
    for k in range(4):
        for l in range(4):
            for m in range(4):
                for n in range(4):
                    # だめなのは klmn = *021, *012, *201, 0*21, 02*1
                    if (l==0 and m==2 and n==1) or (l==0 and m==1 and n==2) or (l==2 and m==0 and n==1) or (k==0 and m==2 and n==1) or (k==0 and l==2 and n==1):
                        pass
                    else:
                        dp[p][l][m][n] += dp[p-1][k][l][m]
                        dp[p][l][m][n] %= MOD

ans = 0
for k in range(4):
    for l in range(4):
        for m in range(4):
            ans += dp[N][k][l][m]
print(ans%MOD)

Measured memory_bytes: 46960
#include <iostream>
#include <string>
#include <set>
#include <vector>
#include <algorithm>
#include <cstring>

using namespace std;


vector<string> ans;
string rs;

void dfs(int n, string s){

	if (rs.size() == n){
		string t = s;
		bool c[256]; memset(c, 0, sizeof c);
		for (int i = 0; i < rs.size(); i++){
			if (t[i] != 'a' && !c[t[i]]){
				c[t[i]] = true;
				t[i]--;
			}
		}

		if (rs == t)
			ans.push_back(s);
		return;
	}

	string t = s;
	bool c[256]; memset(c, 0, sizeof c);
	for (int i = 0; i < t.size(); i++){
		if (t[i] != 'a' && !c[t[i]]){
			c[t[i]] = true;
			t[i]--;
		}
	}
	if (t != rs.substr(0, n))return;

	s += 'a';
	for (char c = rs[n]; c <= rs[n]+1; c++){
		if (c >= 'a' && c <= 'z'){
			s[n] = c;
			dfs(n + 1, s);
		}
	}
}


int main(){

	while (cin >> rs && rs != "#"){

		ans.clear();
		dfs(0, "");

		sort(ans.begin(), ans.end());
		cout << ans.size() << endl;
		if (ans.size() <= 10){
			for (int i = 0; i < ans.size(); i++){
				cout << ans[i] << endl;
			}
		}
		else{
			for (int i = 0; i < 5; i++){
				cout << ans[i] << endl;
			}
			for (int i = ans.size() - 5; i < ans.size(); i++){
				cout << ans[i] << endl;
			}
		}
	}

	return 0;
}

Measured memory_bytes: 2360
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 10e7+9
#define MOD 1000000007
#define EPS 1e-10
#define MAX_N 100100
#define MAX_M 100100

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;

int a[3];

int main(){
	REP(i, 3)cin >> a[i];
	sort(a, a + 3);
	if (a[0] + a[1] == a[2])cout << "Yes" << endl;
	else cout << "No" << endl;
}

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

#define rep(i, n) for(int i = 0; i < n; i++)
int main()
{
	int n;
	cin >> n;
	vector<int> H(n);
	rep(i, n)  cin >> H[i];

	int ans = 0;
	int cnt = 0;
	if (n == 1) {
		cout << 0 << endl;
		return 0;
	}
	//2
	rep(i, n - 1) {
		if (H[i + 1] <= H[i])  cnt++;
		else  cnt = 0;
		ans = max(ans, cnt);
	}
	cout << ans << endl;
}

Measured memory_bytes: 640
package main

import (
	"bufio"
	"errors"
	"fmt"
	"io"
	"math"
	"os"
	"strconv"
)

func main() {
	sc := NewScanner(os.Stdin)
	n, _ := sc.NextInt()
	k, _ := sc.NextInt()
	a, _ := sc.NextInts(n)
	ans := solve(n, k, a)
	fmt.Println(ans)
}

func solve(n, k int, a []int) (ans int) {
	history := make([]int, n)
	for i := range history {
		history[i] = -1
	}
	current := 1
	history[current-1] = k
	for k > 0 {
		current = a[current-1]
		k--
		if history[current-1] != -1 {
			periodicTime := k - history[current-1]
			k %= periodicTime
		}
		history[current-1] = k
	}
	return current
}

// Scanner is a wrapper of bufio.Scanner which is customized for competitive programing.
type Scanner struct {
	bufio.Scanner
}

// NewScanner is a constructor for Scanner.
func NewScanner(r io.Reader) *Scanner {
	sc := Scanner{*bufio.NewScanner(r)}
	sc.Buffer([]byte{}, math.MaxInt64)
	sc.Split(bufio.ScanWords)
	return &sc
}

// NextInt reads a integer from io stream.
func (sc *Scanner) NextInt() (int, error) {
	if !sc.Scan() {
		return -1, errors.New("failed to scan")
	}
	return strconv.Atoi(sc.Text())
}

// NextInts reads n integers from io stream.
func (sc *Scanner) NextInts(n int) (arr []int, e error) {
	arr = make([]int, n)
	for i := 0; i < n; i++ {
		v, e := sc.NextInt()
		if e != nil {
			return nil, e
		}
		arr[i] = v
	}
	return arr, nil
}


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

#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,a) for (auto i = begin(a); i != end(a); ++i)
#define itrepd(i,a) for (auto i = rbegin(a); i != rend(a); ++i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
using namespace std;
using ll = long long;
using ld = long double;
template<class T> using priority_queuel = priority_queue<T, vector<T>, greater<T>>;
constexpr ll inf = static_cast<ll>(1e18);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e18;
constexpr double eps = 1e-10;
ll mod = static_cast<ll>(1e9 + 7);
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T> constexpr T pow2(const T a) { return a * a; }
template<class T, class ... Args> constexpr void mins(T& a, Args... args) { a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr void maxs(T& a, Args... args) { a = max<T>({ a,args... }); }
template<class A, int N, class T>
void fillArray(A(&array)[N], const T& val) { std::fill((T*)array, (T*)(array + N), val); }

int n;
pair<ll, ll> dp[(1 << 18) + 5];
void chmax(pair<ll, ll>& a, const pair<ll, ll>& b) {
    if (a.first > b.first) maxs(a.second, b.first);
    else {
        a.second = max(a.first, b.second);
        a.first = b.first;
    }
}
void solve() {
    cin >> n;
    rep(i, 1 << n) { cin >> dp[i].first; dp[i].second = -inf; }
    rep(i, n) rep(s, 1 << n) {
        if ((s >> i) & 1) chmax(dp[s], dp[s ^ (1 << i)]);
    }

    auto ans = dp[0].first + dp[0].second;
    reps(i, (1 << n) - 1) {
        maxs(ans, dp[i].first + dp[i].second);
        cout << ans << endl;
    }
}

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


Measured memory_bytes: 7168
# import numpy as np
import sys, math, heapq
from itertools import permutations, combinations
from collections import defaultdict, Counter, deque
from math import factorial, gcd
from bisect import bisect_left, bisect_right

sys.setrecursionlimit(10 ** 7)
MOD = 10 ** 9 + 7
input = lambda: sys.stdin.readline()[:-1]
pl = lambda x: print(*x, sep="\n")

N = int(input())
X = [list(map(int, input().split())) for _ in range(N)]
det = lambda p, q: p[0] * q[1] - p[1] * q[0]
sub = lambda p, q: (p[0] - q[0], p[1] - q[1])


def get_convex_hull(points):
    n = len(points)
    points.sort()
    size_convex_hull = 0
    ch = []
    for i in range(n):
        while size_convex_hull > 1:
            v_cur = sub(ch[-1], ch[-2])
            v_new = sub(points[i], ch[-2])
            if det(v_cur, v_new) > 0:
                break
            size_convex_hull -= 1
            ch.pop()
        ch.append(points[i])
        size_convex_hull += 1

    t = size_convex_hull
    for i in range(n - 2, -1, -1):
        while size_convex_hull > t:
            v_cur = sub(ch[-1], ch[-2])
            v_new = sub(points[i], ch[-2])
            if det(v_cur, v_new) > 0:
                break
            size_convex_hull -= 1
            ch.pop()
        ch.append(points[i])
        size_convex_hull += 1

    return ch[:-1]


mdist = -1
X = get_convex_hull(X)
used = [0] * len(X)
for index, start in enumerate(X):
    # if used[index] == 1:
    #     continue
    sx, sy = start
    maxv = -1
    maxi = -1
    for i, xi in enumerate(X):
        if i == index:
            continue
        x, y = xi
        # x, y = x - sx, y - sy
        # xx, yy = x + y, x - y
        # dist = max(abs(xx), abs(yy))
        dist = abs(x - sx) + abs(y - sy)
        # print("dist", dist)
        if maxv < dist:
            maxi = i
            maxv = dist
    # print("index, maxi", index, maxi)
    # used[maxi] = 1
    mdist = max(mdist, maxv)

print(mdist)

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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, m;
  cin >> n >> m;
  
  // s[i][j]でj番目の電球がi番目のスイッチに対応しているか判定（0-オリジン）
  vector<vector<bool>> s(m, vector<bool>(n, false));
  for(int i = 0; i < m; i++){
    int k;
    cin >> k;
    for(int j = 0; j < k; j++){
      int x;
      cin >> x;
      s.at(i).at(x - 1) = true;
    }
  }
  
  vector<int> p(m);
  int ans = 0;
  for(int i = 0; i < m; i++) cin >> p.at(i);
  
  for(int bi = 0; bi < pow(2, n); bi++){
    vector<int> x(m, 0);
    for(int i = 0; i < n; i++){
      for(int j = 0; j < m; j++){
        if(((bi >> i) & 1) && s.at(j).at(i)) x.at(j)++;
      }
    }
    
    bool check = true;
    for(int i = 0; i < m; i++){
      if(x.at(i) % 2 != p.at(i)) check = false;
    }
    if(check) ans++;
  }
  
  cout << ans << "\n";
}

Measured memory_bytes: 512
n,m=map(int,input().split())
h=list(map(int,input().split()))
a=[None]*m
b=[None]*m
for i in range(m):
    a[i],b[i]=map(int,input().split())
    a[i]-=1
    b[i]-=1
t = [True]*n

for i in range(m):
    if h[a[i]] == h[b[i]]:
        t[a[i]]=False
        t[b[i]]=False
    elif h[a[i]] > h[b[i]]:
        t[b[i]] = False
    else:
        t[a[i]] = False
print(t.count(True))

Measured memory_bytes: 21712
use std::io;

fn main() {
    let mut line = String::new();
    io::stdin().read_line(&mut line).unwrap();
    let vec: Vec<i8> = line.split_whitespace()
        .map(|s| s.parse::<i8>().unwrap())
        .collect();
    let (W, H, x, y, r) = (vec[0], vec[1], vec[2], vec[3], vec[4]);
    let s = if x<r || x+r>W || y<r || y+r>H {"No"} else {"Yes"};
    println!("{}", s);
}


Measured memory_bytes: 5028
#include<iostream>
#include<string>
#include<vector>
#include<queue>
#include<stack>
#include<map>
#include<set>
#include<algorithm>
#include<functional>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cassert>
#include<ctime>
using namespace std;

#define mind(a,b) (a>b?b:a)
#define maxd(a,b) (a>b?a:b)
#define absd(x) (x<0?-(x):x)
#define pow2(x) ((x)*(x))
#define rep(i,n) for(int i=0; i<n; ++i)
#define repr(i,n) for(int i=n-1; i>=0; --i)
#define repl(i,s,n) for(int i=s; i<=n; ++i)
#define replr(i,s,n) for(int i=n; i>=s; --i)
#define repf(i,s,n,j) for(int i=s; i<=n; i+=j)
#define repe(e,obj) for(auto e : obj)

#define SP << " " <<
#define COL << " : " <<
#define COM << ", " <<
#define ARR << " -> " <<
#define PNT(STR) cout << STR << endl
#define POS(X,Y) "(" << X << ", " << Y << ")"
#define DEB(A) " (" << #A << ") " << A
#define DEBREP(i,n,val) for(int i=0; i<n; ++i) cout << val << " "; cout << endl
#define ALL(V) (V).begin(), (V).end()
#define INF 1000000007
#define INFLL 1000000000000000007LL
#define EPS 1e-9

typedef unsigned int uint;
typedef unsigned long ulong;
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
#define P_TYPE int
typedef pair<P_TYPE, P_TYPE> P;
typedef pair<P, P_TYPE> PI;
typedef pair<P_TYPE, P> IP;
typedef pair<P, P> PP;
typedef priority_queue<P, vector<P>, greater<P> > pvqueue;

ll fast_pow(ll x, ll n, ll m) {
  ll r = 1;
  while(n > 0) {
    if(n & 1) {
      r = (r * x) % m;
    }
    x = (x * x) % m;
    n >>= 1;
  }
  return r;
}

#define MOD 1000000007

int main() {
  int m, n;
  cin >> m >> n;
  cout << fast_pow(m, n, MOD) << endl;
  return 0;
}


Measured memory_bytes: 3108
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;

#ifdef local
	#include "debug/debug.h"
#endif


#ifndef local
	#define deb(x...) ;	
#endif

#define int long long  
#define ll long long
#define vi vector <int>
#define vii vector <pair<int,int> >
#define vvi vector <vi>
#define rep(i,a,b) for (int i=a;i<b;i++)
#define repD(i,a,b) for (int i=a;i>b;i--)
#define pb push_back
#define pii pair <int,int>
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define MOD 1000000007
#define M_PI 3.14159265358979323846 

typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
///*X.find_by_order("index")
///X.order_of_key("key")

///----------------------------------------------------------------------------------

void solve()
{
	int x, k, d;
	cin >> x >> k >> d;
	if (1.00*k*d  <= abs(1.00*x)) cout << abs(x) - k*d << "\n";
	else
	{
		int rem = k - abs(x)/d;
		if (rem & 1) cout << d - (int)(abs(x))%d << "\n";
		else cout << (int)(abs(x))%d << "\n";
	}
}
signed main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);
	
	#ifdef local
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	clock_t TIMER = clock();
	#endif
	
	int t = 1;
	//cin >> t;
	rep(a,0,t)
	{
		//cout<<"Case #"<<a+1<<": ";
		solve();
		#ifdef local
		cout << "\n";
		#endif

	}
	
	#ifdef local
	{TIMER = clock() - TIMER;double time_taken = ((double)TIMER)/CLOCKS_PER_SEC;cerr<<fixed<<setprecision(5)<<"\n\nTime Taken : "<<time_taken<<" seconds\n";}
	#endif
}

Measured memory_bytes: 3652
def main():
    N = int(input())
    heights = list(map(int, input().split()))

    """
    for j>i, j-i = Ai + Aj
    -> i + Ai = j -Aj
    """

    x = [0] * N  # x represents i + Ai

    count = 0
    for i, height in enumerate(heights):
        right = i + height
        left = i - height

        if right < N:
            x[right] += 1

        if left > 0:
            count += x[left]

    print(count)


if __name__ == "__main__":
    main()


Measured memory_bytes: 32296
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define srep(i,s,t) for(int i = s; i < t; ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
#define yn {puts("Yes");}else{puts("No");}
#define MAX_N 200005

int main() {
    int n, m;
    cin >> n >> m;
    string s; cin >> s;
    int a[n];
    rep(i,n) a[i] = s[i] - '0';
    int l[m], r[m];
    rep(i,m){
        cin >> l[i] >> r[i];
        l[i]--; r[i]--;
    } 

    int cnt = 0;
    rep(i,n) cnt += a[i];
    if(cnt == 0 || cnt == n){
        cout << 1 << endl;
        return 0;
    }

    int right[m][n];
    rep(i,m)rep(j,n)right[i][j] = 0;
    rep(i,m){
        int now = r[i] + 1;
        drep(j,n){
            if(a[j] == 0) continue;
            if(j == n-1){
                right[i][j] = j;
            }else if(i==0){
                if(r[i] < j || j < l[i]){
                    right[i][j] = j;
                }else{
                    right[i][j] = now - 1;
                }
            }else if(r[i] < right[i-1][j] || right[i-1][j] < l[i]){
                right[i][j] = right[i-1][j];
            }else{
                right[i][j] = max(right[i-1][j], now-1);
            }
            if(a[j] == 1){
                now = min(now, right[i][j]);
            }
        }
        /*
        rep(j,n) cout << right[i][j] << ' ';
        cout << endl;
        */
    }

    int left[m][n];
    rep(i,m)rep(j,n)left[i][j] = n-1;
    rep(i,m){
        int now = l[i] - 1;
        rep(j,n){
            if(a[j] == 0) continue;
            if(j == 0){
                left[i][j] = j;
            }else if(i==0){
                if(r[i] < j || j < l[i]){
                    left[i][j] = j;
                }else{
                    left[i][j] = now + 1;
                }
            }else if(r[i] < left[i-1][j] || left[i-1][j] < l[i]){
                left[i][j] = left[i-1][j];
            }else{
                left[i][j] = min(left[i-1][j], now+1);
            }
            if(a[j] == 1){
                now = max(now, left[i][j]);
            }
        }
    }

    /*
    rep(i,n) cout << right[m-1][i] << ' ';
    cout << endl;
    */

    const ll MOD = 1000000007;
    ll dp[n][n];
    rep(i,n)rep(j,n)dp[i][j] = 0;

    cnt = 0;
    rep(i,n){
        if(a[i] == 0){
            if(cnt == 0) continue;
            rep(j,n) dp[i][j] = dp[i-1][j];
            continue;
        }
        cnt++;
        if(cnt == 1){
            srep(j,left[m-1][i],right[m-1][i]+1){
                dp[i][j] = 1;
            }
        }else{
            ll sum = 0;
            rep(j,n){
                if(left[m-1][i]<=j&&j<=right[m-1][i]){
                    dp[i][j] = sum;
                }
                sum += dp[i-1][j];
                sum %= MOD;
            }
        }
    }

    ll ans = 0;
    rep(i,n){
        ans += dp[n-1][i];
        ans %= MOD;
    }
    cout << ans << endl;
    return 0;
}




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



int main(){
  string s, t; cin >> s >> t;
  int ans = 1e9;
  rep(i, s.size() - t.size() + 1){
    string sb = s.substr(i, t.size());
    int sum = 0;
    rep(j, t.size()){
      if(sb[j] != t[j]) sum++;
    }
    ans = min(ans, sum);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3612
n = int(input())
sticks = [int(x) for x in input().split()]

count = 0
for i in range(n - 2):
    for j in range(i + 1, n - 1):
        for k in range(j + 1, n):
            a, b, c = sticks[i], sticks[j], sticks[k]
            if a != b and a != c and b != c:
                if a + b > c and b + c > a and c + a > b:
                    count += 1

print(count)


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

using namespace std; 

typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef pair<LL, LL> PLL;
typedef vector<PLL> VPLL;
typedef priority_queue<int> PQ_DESC;
typedef priority_queue<int, vector<int>, greater<int>> PQ_ASC;
typedef priority_queue<PII> PQ_DESC_PII;
typedef priority_queue<PII, vector<PII>, greater<PII>> PQ_ASC_PII;
typedef priority_queue<VL> PQ_DESC_VL;
typedef priority_queue<VL, vector<VL>, greater<VL>> PQ_ASC_VL;
typedef priority_queue<PLL> PQ_DESC_PLL;
typedef priority_queue<PLL, vector<PLL>, greater<PLL>> PQ_ASC_PLL;

#define ALL(c) (c).begin(),(c).end()
#define PB push_back
#define MP make_pair
#define SORT_ASC(c) sort(ALL(c))
//#define SORT_DESC(c) sort(ALL(c), greater<typeof(*((c).begin()))>())
#define SORT_DESC(c) sort((c).rbegin(),(c).rend())
#define REV(c) reverse((c).begin(), (c).end())
#define SIZE(a) int((a).size())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define ROF(i,a,b) for(int i=(b-1);i>=(a);--i)
#define REP(i,n) FOR(i,0,n)
#define PER(i,n) ROF(i,0,n)

const double EPS = 1e-10;
const double PI  = acos(-1.0);
const int LARGE_INT = 1e9+100;
const int INF = 2e9+100;
const LL INF_LL = (LL)INF*(LL)INF;
const int MOD = 1e9+7;

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

LL modpow(LL a, LL n) {
    LL res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % MOD;
        a = a * a % MOD;
        n >>= 1;
    }
    return res;
}

void Main()
{
    LL a,v;cin>>a>>v;
    LL b,w;cin>>b>>w;
    LL t;cin>>t;

    LL dist = abs(a-b);
    LL speed = v-w;
    if(speed*t >= dist){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
    
	return;
}

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

Measured memory_bytes: 3612
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

#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 int long long
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define f first
#define s second
#define sz(x) (int)x.size()
#define endl '\n'
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout << (x) << endl
#define watch2(x,y) cout << (x) << " " << (y) << endl
#define watch3(x,y,z) cout << (x) << " " << (y) << " " << (z) << endl
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld; 
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef tree<pii,null_type,less<pii>,rb_tree_tag,tree_order_statistics_node_update> oset;

// find_by_order(k) returns iterator to kth element starting from 0;
// order_of_key(k) returns count of elements strictly smaller than k;

const int mod = 1e9 + 7;
const int inf = 9e18;
const int N = 2e5 + 5;

int i,n,a[N];

void solve(){
    cin>>n;
    for(i=1;i<=n;++i){
        cin>>a[i];
    }
    map<int,int> mp;
    int ans=0;
    for(i=1;i<=n;++i){
        ans+=mp[i-a[i]];
        mp[i+a[i]]++;
    }
    cout<<ans;
}

signed main(){
    fastio;
    int t;
    //cin>>t;
    t=1;
    while(t--){
        solve();
        cout<<endl;
    }
    return 0;
}

Measured memory_bytes: 27880
n=int(input())
chk=0
add=1
while chk<n:
    chk+=add
    add+=1
add-=1
if n==chk:
    for i in range(add):
        print(i+1)
else:
    exc=chk-n
    for i in range(add):
        if i+1==exc:
            continue
        print(i+1)

Measured memory_bytes: 3316
#include <stdio.h> 
int main()
{
    int n,i;
    scanf("%d",&n);
    float x[n],sum=0.0f,max=380000.0f;
    char y[n][4];
    for(i=0;i<n;i++)
    {
    scanf("%f%s",&x[i],y[i]);
    if(y[i][0]=='B')
    {
        x[i]=x[i]*max;
        sum=sum+(x[i]);
    }
    else
    sum=sum+x[i];
    }
    printf("%.6f",sum);
    return 0;
}


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

using namespace std;

typedef long long ll;
typedef long double ld;

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

        int l,a;
        cin>>l>>a;
        l--;
        for(int j=a-l;j<=a+l;j++)
                cout<<j<<" ";
        cout<<"\n";


        return 0;
}
/**

**/


Measured memory_bytes: 256
#include<stdio.h>

int main() {
	int a[26] = {0},i;
	char x;

	while (scanf("%c", &x) != EOF) {
		for (i = 0; i < 26; i++) {
				if (x == 'a' + i || x == 'A' + i) {
					a[i]++;
				}
		}
	}
	for (i = 0; i < 26; i++) {
		printf("%c : %d\n", 'a' + i, a[i]);
	}

	return 0;
}


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

int main() {	

	ll a;
	double b;
	cin >> a >> b;

	ll b_integer = round(100 * b);
	ll ans;
	ans += a * b_integer;
	ans /= 100;

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

Measured memory_bytes: 3720
#include <iostream>
#include <algorithm>
#include <functional>

int solve(int n, int a[]) {

  std::sort(a, a+n, std::greater<int>());

  int alice, bob;
  alice =0;
  bob = 0;

  for(int i = 0; i < n;) {
    alice += a[i++];
    if (i < n)
      bob += a[i++];
  }

  return alice - bob;

}

int main() {
  int n;
  std::cin >> n;
  int a[n];

  for (int i = 0; i < n; i++)
    std::cin >> a[i];

  std::cout << solve(n, a) << std::endl;
  // std::cout << n << std::endl;

  // for (int i = 0; i < n - 1; i++)
  //   std::cout << a[i] << " ";
  
  // std::cout << a[n-1] << std::endl;
}


Measured memory_bytes: 256
#include <iostream>
#define LINF (1LL << 60)
using namespace std;
typedef long long Int;

Int n, a[110000], b[110000], c[110000];
Int dp[110000][3];

int main() {
  cin >> n;
  // 番兵を入れて、初期化を楽に
  for (int i = 1; i <= n; i++) cin >> a[i] >> b[i] >> c[i];

  for (int i = 0; i <= n; i++) {
    dp[i + 1][0] = max(dp[i][1] + a[i + 1], dp[i][2] + a[i + 1]);
    dp[i + 1][1] = max(dp[i][0] + b[i + 1], dp[i][2] + b[i + 1]);
    dp[i + 1][2] = max(dp[i][0] + c[i + 1], dp[i][1] + c[i + 1]);
  }
  Int ans = 0;
  for (int i = 0; i < 3; i++) ans = max(ans, dp[n][i]);
  cout << ans << endl;
  return 0;
}


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

using namespace std;

typedef long long ll;

#define INF 2000000000
#define SIZE 1000000
#define pb push_back
#define showint(x) cerr<<#x<<" is "<<x<<endl;
#define showarr(x,n) for(int I=0;I<n;I++) {cerr<<#x<<"["<<I<<"]"<<" is "<<x[I]<<endl;}
//#define fin cin

int main()
{
  ifstream fin("input.txt",ios::in);
	ios_base::sync_with_stdio(false);
	cout.tie(0);
	cin.tie(0);
  cout<<setprecision(10);
  cout<<fixed;
  int a[4];
  cin>>a[0]>>a[1]>>a[2]>>a[3];
  sort(a,a+4);
  if(a[0]==1&&a[1]==4&&a[2]==7&&a[3]==9) cout<<"YES";
  else cout<<"NO";
}


Measured memory_bytes: 892