akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<bits/stdc++.h>
#define mod 1000000007
#define eps 1e-9
#define PI 3.14159265358979323846
#define F first
#define S second
#define ll long long
#define pb push_back
#define mp make_pair
#define Fr(i,a,b) for(int i=a;i<=b;i++)
#define RF(i,a,b) for(int i=a;i>=b;i--)
#define pii pair<ll,int>
#define vi vector<ll>
#define vvi vector<vector<double>>
#define vpii vector<pii>
using namespace std;

int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
  
    int t=1;
    //cin>>t;
    while(t--){
        int n,k;
        cin>>n>>k;
        int x;
        vi a;
        Fr(i,0,n-1){
            cin>>x;
            a.pb(x);
        }
        vi b(n,INT_MAX);
        b[0]=0;
        Fr(i,0,n-1){
            for(int j=i+1;j<=i+k&&j<n;j++){
                b[j]=min(abs(a[j]-a[i])+b[i],b[j]);
            }
        }
        cout<<b[n-1]<<endl;
    }
    return 0;
} 

Measured memory_bytes: 1908
#include <iostream>
#include <vector>

using namespace std;

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

    int atc = 0;
    for (int i=0; i<n; i++) {
        int a;
        cin >> a;
        atc += a;
    }

    cout << (h<=atc?"Yes":"No") << endl;
}


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

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<string> vs;
typedef vector<char> vc;
typedef vector<vc> vvc;
typedef vector<bool> vb;
typedef pair<int, int> pii;
typedef pair<char, char> pcc;

#define ZP(a, len) setfill('0') << setw(len) << right << a
const int INF = 1e9;
const int MOD = 1e9 + 7;
const int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
const ll LINF = 1e11;

ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }

ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }

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

    int n, m;
    cin >> n >> m;
    vector<pii> va = vector<pii>(n);
    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        va[i] = make_pair(a, 1);
    }

    for (int i = 0; i < m; ++i) {
        int b, c;
        cin >> b >> c;
        va.push_back(make_pair(c, b));
    }

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

    ll ans = 0;
    int idx = va.size() - 1;
    for (int i = n; i > 0; --i) {
        ans += va[idx].first;
        va[idx].second--;
        if (va[idx].second == 0) {
            idx--;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 2928
#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;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define pb push_back
#define pf push_front
#define mt make_tuple
#define popb pop_back
#define popf pop_front
#define int long long int
#define vi         vector<int>
#define vll        vector<ll>
#define vpii       vector<pair<int,int>>
#define vpll       vector<pair<ll,ll>>
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define sz(container) int((container).size())
#define rep(i,a,b) for(i=a;i<b;i++)
#define tr(container,it)   for(auto it = container.begin(); it != container.end(); it++)
#define present(container, element) (container.find(element) != container.end())      //set,map etc.
#define cpresent(container, element) (find(all(container),element) != container.end())    //vector
#define hell 1000000007
#define PI 3.14159265
#define mod 998244353
#define fs first
#define sc second
#define TIME        cerr << "\nTime elapsed: " << setprecision(5) <<1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
void solve()
{
  int n,i,j;
  cin>>n;
  int y= (n+1000-1)/1000;
  cout<<y*1000-n;
}
signed main()
{
  fastio
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  int t;
  t=1;
  //cin>>t;
  while(t--)
  solve();
  TIME
  return 0;
}

Measured memory_bytes: 3708
A,B,C,X,Y = map(int, input().split())
a = min(A+B, 2*C)
if X <= Y:
    ans = a * X + (Y - X) * min(B, 2*C)
else:
    ans = a * Y + (X - Y) * min(A, 2*C)
print(ans)

Measured memory_bytes: 3060
import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7

A, B = MAP()
print(max(0, A-2*B))


Measured memory_bytes: 5192
#include <iostream>
#include <string>
#include <cmath>
#include <sstream>
#include <iomanip>

using namespace std;

int main(int argc, char* argv[])
{

	int N;

	cin >> N;

	cout << ((N/9==10 || N % 10==9) ? "Yes" : "No") << endl;

	return 0;

}

Measured memory_bytes: 256
//----------BHAVIK DIWANI(PICT_COMP)---------------
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define test ll t; cin>>t; while(t--)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define mod 1000000007
#define ll long long
#define int long long
#define ull unsigned long long
#define MAX 1000005
#define pb push_back
#define mkp make_pair
#define vi vector<int>
#define pii pair<int,int>
#define endl '\n'
#define vs vector<string>
#define mii map<int,int>
#define msi map<string,int>
#define vpii vector< pair<int, int > >
#define vpsi vector< pair< string ,int > >
#define forci(p,q) for(int i=p;i<q;i++)
ll gcd(ll a,ll b){ if(b==0) return a;    return gcd(b,a%b);}
ll lcm(ll a,ll b) { return (a/gcd(a,b)*b);}
ull power(ull a, ull b) {a %= mod;  ull res = 1;  while (b > 0) { if (b & 1) res = res * a % mod;  a = a * a % mod;  b >>= 1; }  return res%mod; }
ll modmul(ll x, ll y){return (x*y)%mod;}
ll modadd(ll x, ll y){return (x+y)%mod;}
ll modsub(ll x, ll y){return (x-y+mod)%mod;}
ll fact[1000007]={0};
void facto() {fact[0]=1;fact[1]=1;for(int i=2;i<1000007;i++)fact[i]=(fact[i-1]*i)%mod;}
ll ncr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[r],mod-2)))%mod; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
ll npr(ll n,ll r) {ll res=1; res=fact[n]; res=(res*(power(fact[n-r],mod-2)))%mod; return res;}
inline long long toint(const std::string &s) {std::stringstream ss; ss << s; long long x; ss >> x; return x;}
inline std::string tostring(long long number) {std::stringstream ss; ss << number; return ss.str();}
inline std::string tobin(long long x) {return std::bitset<63>(x).to_string();}
/*bool prime[MAX];
ull sieve(){memset(prime,true,sizeof(prime));for(ull p=2;p*p<MAX;p++){if(prime[p]==true){for(ull i=2*p;i<MAX;i+=p){prime[i]=false;}}}prime[0]=0;prime[1]=0;
}*/
/*
int inv[1000001]={0};int invf[1000001]={0};
void findinverse(){
	inv[0]=1;
	inv[1] = 1;
	for(int i = 2; i <=1e6 ; ++i)
		inv[i] = (mod - (mod/i) * inv[mod%i] % mod) % mod;
	invf[0]=1;invf[1]=1;
	for(int i=2;i<=1e6;i++){
		invf[i]=invf[i-1]*inv[i]%mod;
	}
}*/
#define size 51
using namespace std;
int a[size],b[size],c[size],d[size];
int n,m,q;
int mx=INT_MIN;
int ans[size]={0};
void f(int curr,int prev){
//	cout<<"i :"<<curr<<" "<<"j :"<<prev<<endl;
	if(curr==n+1){
		int sum=0;
		for(int i=0;i<q;i++){
			if(ans[b[i]]-ans[a[i]]==c[i])
				sum+=d[i];
		}
		mx=max(sum,mx);
		return;
	}
	for(int j=prev;j<=m;j++){
		ans[curr]=j;
		f(curr+1,j);
	}
}
int solve()
{
	cin>>n>>m>>q;
	for(int i=0;i<q;i++){
		cin>>a[i]>>b[i]>>c[i]>>d[i];
	}
	f(1,1);
	cout<<mx<<endl;
	return 0;
}
signed main()
{
	fastio;
		solve();
}

Measured memory_bytes: 3640
[n,k] = [int(i) for i in input().split()]

if k % 2 == 0:
    mod = k // 2
    count_mod = 0
    count = 0
    for i in range(1,n+1):
        if i % k == 0:
            count += 1
            #print("zero",i)
        elif i % k == mod:
            count_mod += 1
            #print("mod",i)
    #print(count,count_mod)
    print(count**3 + count_mod ** 3)
else:
    count = 0
    for i in range(1,n+1):
        if i % k == 0:
            count += 1
    print(count ** 3)


Measured memory_bytes: 64576
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)x.size()
#define all(x) (x).begin(), (x).end()
#define Red ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define rep(i, n) for(int i =0 ; i < n; ++i)
#define Rep(i,a,b) for(int i=a;i<=b;i++)
#define pii pair < int, int >
typedef vector<int> vi;
typedef  long long ll;
const int mod =1e9+7;
const int N = (int)2e5 + 5;
const double pi=3.14159265359;

void solve(){
			int r;
			cin>>r;
			printf("%.12f",r*2*pi);

}

int main(){
	Red;
	int t=1;
	// cin>>t;
	while(t--)
	solve();
	return 0;
}

Measured memory_bytes: 3772
"use strict"

const gcd = (m, n) => {
  let tmp

  // m が n より 小さかったら入れ替える
  if (m < n) {
    tmp = m
    m = n
    n = tmp
  }
  while ((tmp = m % n) != 0) {
    m = n
    n = tmp
  }
  return n
}
// gcd(12, 42)

function main(input) {
  input = input.split(/\n/).map(v => v.split(/\s/).map(v => ~~v))
  const X = input[0][1]
  const distance = input[1].sort((a, b) => a - b).map(v => {
    return v - X
  })
  const ans = distance.reduce((a, b) => {
    return gcd(a, b)
  })
  console.log(Math.abs(ans))
}
main(require("fs").readFileSync("/dev/stdin", "utf8"))


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

int main() {
  string s;
  cin >> s;
  bool b = true;
  for (char c = 'a'; c <= 'z'; c++) {
    int sum = 0;
    rep(i,s.size()) {
      if (s[i] == c) sum++;
    }
    if (sum % 2 != 0) b = false;
  }
  if(b) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
s = gets.chomp.split
a,b,c = s[0].to_i,s[1],s[2].to_i

while b != '?' do
    case b
    when '+' then
        puts a+c
    when '-' then
        puts a-c
    when '*' then
        puts a*c
    when '/' then
        puts a/c
    end
    s = gets.chomp.split
    a,b,c = s[0].to_i,s[1],s[2].to_i
end

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

using namespace std;

int main() {
	int N, M;
	cin >> N >> M;
	int path[8][8] = { 0 };
	for (int i = 0; i < M; i++) {
		int a, b;
		cin >> a >> b;
		path[a - 1][b - 1] = 1;
		path[b - 1][a - 1] = 1;
	}
	vector<int> x;
	for (int i = 0; i < N; i++) {
		x.push_back(i);
	}
	int ans = 0;
	do {
		bool flag = true;
		for (int i = 1; i < x.size(); i++) {
			if (path[x[i - 1]][x[i]] == 0) {
				flag = false;
				break;
			}
		}
		if (flag)ans++;
	} while (next_permutation(x.begin() + 1, x.end()));
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#define N 1001
static const int INFTY = (1<<21);

int n, M[N][N];
int color[N], d[N], f[N], tt;
int Q[N*2], head, tail;

void init(){
  head = tail = 1;
}

void enqueue(int x){
  Q[tail++] = x;
}

int empty(){
  return head == tail;
}

int dequeue(){
  int x = Q[head++];
  return x;
}

void bfs(int s){
  int i, u, v;
  init();
  enqueue(s);
  for ( i = 0; i < n; i++ )d[i] = INFTY;
  d[s] = 0;
  while(!empty()){
    u = dequeue();
    for ( v = 0; v < n; v++ ){
      if ( M[u][v] == 0 ) continue;
      if ( d[v] != INFTY ) continue;
      d[v] = d[u] + 1;
      enqueue(v);
    }
  }
  for ( i = 0; i < n; i++ ){
    printf("%d %d\n", i+1,((d[i]==INFTY)?(-1):d[i]));
  }
}

main(){
  int  u, k, v, i, j; 

  scanf("%d", &n);

  for ( i = 0; i <n; i++ ){
    for ( j = 0; j <n; j++ ) M[i][j] = 0;
  }
  
  for ( i = 0; i < n; i++ ){
    scanf("%d %d", &u, &k);
    u--;
    for ( j = 0; j < k; j++ ){
      scanf("%d", &v);
      v--;
      M[u][v] = 1;
    }
  }
  
  bfs(0);

  return 0;
}


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

#define rep(i,n) for(i = 0;i < n;++i)
#define all(v) v.begin(), v.end()
using ll = long long;

int main()
{
    ll i,j;
    string s;
    cin >> s;
    cout << s.substr(0,4) << " " << s.substr(4,8) << endl;

    return 0;
}

Measured memory_bytes: 3628
#include <cstdio>
#include <cmath>
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
#define PB push_back
#define MP make_pair
#define REP(i,n) for(int i=0;i<(n);i++)

int main()
{
    int A,B,M;
    int a[100100],b[100100];
    int mia=100100, mib=100100;
    cin >> A >> B >> M;
    REP(i,A)
    {
        cin >> a[i];
        mia = min(mia, a[i]);
    }
    REP(i,B)
    {
        cin >> b[i];
        mib = min(mib, b[i]);
    }
    int ans = mia + mib;
    REP(i,M)
    {
        int x,y,c;
        cin >> x >> y >> c;
        x--;
        y--;
        ans = min(ans, a[x] + b[y] - c);
    }
    cout << ans << endl;
}


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

int main() {
  int a,b,c,s1,s2,s3,x;
  cin >> a;
  
  s1 = a / 100;
  b = a % 100;
  
  s2 = b / 10;
  c = b % 10;
  
  s3 = c / 1;
  
  x = s1 + s2 + s3;
  cout << x << endl;
}


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

int main(){
	int K;
	scanf("%d", &K);
	int ans = 0;
	for(int i = 1; i <= K; ++i){
		for(int j = 1; j <= K; ++j){
			for(int k = 1; k <= K; ++k){
				int tmp = __gcd(i, __gcd(j, k));
				ans += tmp;
			}
		}
	}
	printf("%d\n", ans);
}

Measured memory_bytes: 3828
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
import java.util.StringTokenizer;

public class Main {
    int n;
    int[] ss;
    int sum;

    public static void main(String args[]) {
        new Main().run();
    }

    void run() {
        FastReader sc = new FastReader();
        n = sc.nextInt();
        ss = new int[n];
        sum = 0;
        for (int i = 0; i < n; i++) {
            ss[i] = sc.nextInt();
            sum += ss[i];
        }
        solve();
    }

    void solve() {
        Arrays.sort(ss);
        if (sum % 10 == 0) {
            int i = 0;
            while (i < n) {
                if (ss[i] % 10 == 0) {
                    i++;
                } else {
                    sum -= ss[i];
                    break;
                }
                if (i == n) {
                    System.out.println(0);
                    return;
                }
            }
        }
        System.out.println(sum);
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

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

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

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


Measured memory_bytes: 21204
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#define lp(n) for (int i = 0; i < n; i++)
#define lop(n,i) for (int i = 0; i < n; i++)
#define INT_MAX 2147483647
#define LLINT_MAX 9223372036854775807
#define mod 1000000007
#define ll long long int
using namespace std;

int main() {
	int h, w;
	cin >> h >> w;
	char a[9][9];
	lp(h) {
		lop(w, j)
			cin >> a[i][j];
		a[i][w] = '.';
	}
	lp(w + 1)
		a[h][i] = '.';
	int i, j;
	i = j = 0;
	while(true){
		a[i][j] = '.';
		if (a[i + 1][j] == '#')i++;
		else if (a[i][j + 1] == '#')j++;
		else break;
	}
	lp(h + 1)
		lop(w + 1, j) {
			if (a[i][j] == '#') {
				cout << "Impossible" << endl;
				return 0;
			}
		}
	cout << "Possible" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
const ll LINF=0x1fffffffffffffff;
const int INF=0x3fffffff;
const int MOD=1000000007;
#define VAR(type,...) type __VA_ARGS__;in(__VA_ARGS__)
#define VEC(type,name,size) vector<type> name(size);each(x, name)in(x)
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define rrep(i,a,b) for(int i=(a-1);i>=(b);--i)
#define each(x,v) for(auto &x:(v))
#define all(x) (x).begin(),(x).end()
#define print(...) out(__VA_ARGS__);cout<<endl
void in(){} template<class T,class... U> void in(T &t,U &...u){cin>>t;in(u...);}
void out(){} template<class T,class... U> void out(T t,U ...u){cout<<t<<" ";out(u...);}
void solve();
int main(){cin.tie(0);ios::sync_with_stdio(0);solve();}

void solve() {
  VAR(int, a, b, c);
  print(a + b + c - max({a, b, c}));
}


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

using namespace std;

#define int long long
// #define double long double
#define FOR(i, a, b) for(ll i = (a); i < (b); ++i)
#define FORR(i, a, b) for(ll i = (a); i > (b); --i)
#define REP(i, n) for(ll i = 0; i < (n); ++i)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOREACH(x, a) for(auto &(x) : (a))
#define VECCIN(x)                                                              \
    for(auto &youso_ : (x)) cin >> youso_
#define bitcnt __builtin_popcount
#define SZ(x) ((ll)(x).size())
#define fi first
#define se second
#define All(a) (a).begin(), (a).end()
#define rAll(a) (a).rbegin(), (a).rend()
template <typename T = long long> inline T IN() {
    T x;
    cin >> x;
    return (x);
}
inline void CIN() {}
template <class Head, class... Tail>
inline void CIN(Head &&head, Tail &&... tail) {
    cin >> head;
    CIN(move(tail)...);
}
#define CCIN(...)                                                              \
    char __VA_ARGS__;                                                          \
    CIN(__VA_ARGS__)
#define DCIN(...)                                                              \
    double __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define LCIN(...)                                                              \
    ll __VA_ARGS__;                                                            \
    CIN(__VA_ARGS__)
#define SCIN(...)                                                              \
    string __VA_ARGS__;                                                        \
    CIN(__VA_ARGS__)
#define Printv(v)                                                              \
    {                                                                          \
        REP(x, v.size()) { cout << v[x] << (x == v.size() - 1 ? "\n" : " "); } \
    }
template <typename T = string> inline void eputs(T s) {
    cout << s << "\n";
    exit(0);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val) {
    std::fill((T *)array, (T *)(array + N), val);
}
template <typename T> using PQG = priority_queue<T, vector<T>, greater<T>>;
template <typename T> using PQ = priority_queue<T>;

typedef long long ll;
typedef pair<ll, ll> PL;
typedef vector<PL> VPL;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<double> VD;

const int INF = 1e9;
const int MOD = 1e9 + 7;
const ll LINF = 1e18;
const ll dx[] = {1, 0, -1, 0};
const ll dy[] = {0, 1, 0, -1};
#define PI 3.141592653589793238

ll N, A, B;
VL h;

bool check(ll k) {
    ll cnt = 0;
    REP(i, N) { cnt += max(0LL, (h[i] - B * k + (A - B - 1)) / (A - B)); }
    return cnt <= k;
}

signed main() {
    cin >> N >> A >> B;
    h.resize(N);
    ll lb = 0, ub = 1LL << 32;
    REP(i, N) cin >> h[i];
    while(ub - lb > 1) {
        ll mid = (ub + lb) / 2;
        if(check(mid))
            ub = mid;
        else
            lb = mid;
    }
    cout << ub << "\n";
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define MOD	1000000007
#define int	long long
#define pii pair<int,int> 
#define vi vector<int>
using namespace std;

int power(int a, int b){ int S = 1; while(b--)S *= a; return S;}

int32_t main(){
	string s;
	cin >> s;
	if(s[3] == s[2] && s[5] == s[4]){
		cout << "Yes";
	}
	else{
		cout << "No";
	}

	return 0;
}



Measured memory_bytes: 256
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if v <= w:
  print("NO")
elif a <= b:
  if a+v*t >= b+w*t:
    print("YES")
  else:
    print("NO")
else:
  if a-v*t <= b-w*t:
    print("YES")
  else:
    print("NO")

Measured memory_bytes: 61660
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <queue>
using namespace std;
#define loop(i,N) for(ll (i)=0; (i)<(N);++(i))
struct TEMP_OMAZINAI_ { TEMP_OMAZINAI_() { std::ios::sync_with_stdio(false); std::cin.tie(0); } } TEMP__omazinai_instance__;
#define INF ((1LL<<61) + (1<<29))
#define YesNo(x) {std::cout << ((x)?"Yes":"No") << std::endl;}
#define YESNO(x) {std::cout << ((x)?"YES":"NO") << std::endl;}
#define OddEven(x) {std::cout << ((x)%2?"Odd":"Even") << std::endl;}
#define ODDEVEN(x) {std::cout << ((x)%2?"ODD":"EVEN") << std::endl;}
typedef long long int ll;
ll my_gcd(ll a, ll b) { return b ? my_gcd(b, a%b) : a; };
void TEMP_INPUT_IMPL_() {};
template <class T, class... Args> void TEMP_INPUT_IMPL_(T& dest, Args&... args) { cin >> dest; TEMP_INPUT_IMPL_(args...); }
void TEMP_OUTPUT_IMPL_() {};
template <class T, class... Args> void TEMP_OUTPUT_IMPL_(T dest, Args... args) { cout << dest << (sizeof...(Args) ? " " : ""); TEMP_OUTPUT_IMPL_(args...); }
#define in(type, ...) type __VA_ARGS__; TEMP_INPUT_IMPL_(__VA_ARGS__)
#define in_v(type, name, cnt) vector<type> name(cnt); loop(i, cnt) cin >> name[i];
#define sort_v(v) std::sort(v.begin(), v.end())
#define unique_v(v) v.erase(std::unique(v.begin(), v.end()), v.end()) //必ずソート後に実行
#define out(...) (TEMP_OUTPUT_IMPL_(__VA_ARGS__), std::cout<<std::endl)
#define set_fix(x) ((std::cerr<<std::fixed<<std::setprecision(x)),(std::cout<<std::fixed<<std::setprecision(x)))
//小さい方に寄る
#define space_op(x, y, a, b, c) ([](auto x_, auto y_, auto a_, auto b_, auto c_){if(x_<y_)return a_;if(x_>y_)return c_;return b_;}(x,y,a,b,c))
#define space_out(x, y, a, b, c) out(space_op(x, y, a, b, c))

// ^^^ Template ^^^ //


int main() {
	map<char, bool> t;
	in(string, S);
	for (char c : S)
		t[c] = true;
	YesNo(t['N'] == t['S'] && t['W'] == t['E']);
	return 0;
}


Measured memory_bytes: 256
// need
#include <iostream>
#include <algorithm>
// data structure
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
//#include <deque>
#include <valarray>
#include <unordered_map>
#include <array>
// stream
//#include <istream>
#include <sstream>
//#include <ostream>
#include <fstream>
// etc
#include <cassert>
#include <cmath>
#include <functional>
#include <iomanip>
#define INF 100000
//#include <chrono>
using namespace std;
int N, A, B, C;
int l[8];
int dfs(int n, int a, int b, int c){
  int m;
  if(n == N){
    if(min({a,b,c}) > 0){
      return abs(a-A)+abs(b-B)+abs(c-C)-30;
    }else{
      return INF;
    }
  }
  m = dfs(n+1, a, b, c);
  m = min(m, dfs(n+1, a+l[n], b, c)+10);
  m = min(m, dfs(n+1, a, b+l[n], c)+10);
  m = min(m, dfs(n+1, a, b, c+l[n])+10);
  return m;
   	
}
int main()
{
  cin >> N >> A >> B >> C;
  for(int i = 0 ; i < N; i++){
    cin >> l[i];
  }
  cout << dfs(0,0,0,0) << endl;
  return 0;
}


Measured memory_bytes: 256
#ifdef DBG1
  #define LOCAL
#endif

#ifdef LOCAL
  #define _GLIBCXX_DEBUG
#endif

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>

#ifdef DBG1
    #define dbg(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dbg(...)
#endif

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair <int, int> pii;

bool solve() {
  int n;
  if (scanf("%d", &n) != 1) { return false; }

  vector <int> a(n);
  for (int i = 0; i < n; ++i) {
    scanf("%d", &a[i]);
  }
  sort(a.begin(), a.end());
  vector <pii> b;
  for (int i = 0; i < n; ++i) {
    if (b.empty() || b.back().first != a[i]) {
      b.push_back(pii(a[i], 0));
    }
    b.back().second += 1;
  }

  int res = 0;
  while (!b.empty()) {
    if (b.back().second == 0) {
      b.pop_back();
      continue;
    }
    int k = b.back().first;
    b.back().second--;

    int len = int(b.size());
    for (int pow = (1 << 30); pow > 0; pow >>= 1) {
      int index = lower_bound(b.begin(), b.end(), pii(pow - k, 1)) - b.begin();
      if (index < len && b[index].first == pow - k) {
        b[index].second--;
        res++;
        break;
      }
    }
  }
  printf("%d\n", res);

  return true;
}

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

Measured memory_bytes: 3188
#include <algorithm> //STLͨ���㷨
#include <cmath> //������ѧ����
#include <cstdio> //��������/�������
#include <iostream> //����������/���
#include <cstring> //�ַ�������
#include <string> //�ַ�����
#include <ctime> //�������ʱ��ĺ���
#define itn int
#define fro for
#define ll long long
#define reg register
#define inf 1234567890
#define rep(i,a,b,c) for (int i=a;i<=b;i+=c)
/*#include <bitset> //STLλ������
#include <cstype> //�ַ�����
#include <cerrno> //���������
#include <complex> //������
#include <clocale> //���屾�ػ�����
#include <cstdlib> //������������ڴ���亯��
#include <deque> //STL˫�˶�������
#include <exception> //�쳣������
#include <fstream> //�ļ�����/���
#include <functional> //STL�������㺯��(���������)
#include <limits> //�����������������ֵ����
#include <list> //STL�����б�����
#include <map> //STLӳ������
#include <iomanip> //����������/���
#include <ios> //��������/���֧��
#include <iosfwd> //����/���ϵͳʹ�õ�ǰ������
#include <istream> //����������
#include <ostream> //���������
#include <queue> //STL��������
#include <set> //STL��������
#include <sstream> //�����ַ�������
#include <stack> //STL��ջ����
#include <stdexcept> //��׼�쳣��
#include <streambuf> //�ײ�����/���֧��
#include <utility> //STLͨ��ģ����
#include <vector> //STL��̬��������
#include <cwchar.h>//���ַ�����������/���
#include <cwctype.h> //���ַ�����*/

using namespace std;

int ans;

int max(int x,int y){return x>y?x:y;}

int min(int x,int y){return x<y?x:y;}

int abs(int x){return x>0?x:-x;}

int gcd(int x,int y){return (!y)?x:gcd(y,x%y);}

void exgcd(int a,int b,int &d,int &x,int &y){if (!b){d=a,x=1,y=0;}else{exgcd(b,a%b,d,y,x);y-=x*(a/b);}}

int quick_power(ll a,int b){ll r=1;for (;b;b>>=1,a=a*a)if (b&1) r=r*a;return r;}

inline char read() {
	static const int IN_LEN = 1000000;
	static char buf[IN_LEN], *s, *t;
	return (s == t ? t = (s = buf) + fread(buf, 1, IN_LEN, stdin), (s == t ? -1 : *s++) : *s++);
}
template<class T>
inline void read(T &x) {
	static bool iosig;
	static char c;
	for (iosig = false, c = read(); !isdigit(c); c = read()) {
		if (c == '-') iosig = true;
		if (c == -1) return;
	}
	for (x = 0; isdigit(c); c = read()) x = x * 10 + (c ^ '0');
	if (iosig) x = -x;
}

char sr[10000000],z[20];int C=-1,Z=0;
void Ot(){fwrite(sr,1,C+1,stdout),C=-1;}
void print(int x){
	if (x<0) sr[++C]='-',x=-x;
    while(z[++Z]=x%10+48,x/=10);
    while(sr[++C]=z[Z],--Z);sr[++C]='\n';
}
//int find(int x){return fa[x]=fa[x]==x?x:find(fa[x]);}

//void add(int x,int y,int z){to[++cnt]=y;v[cnt]=z;Next[cnt]=head[x];head[x]=cnt;}
int main()
{
	int n,m;
	read(n);read(m);
	cout<<max(0,n-m*2);
	return 0;
}









Measured memory_bytes: 2812
N = int(input())
A = [int(input()) for i in range(N)]
l = {}

for a in A:
    if a not in l:
        l[a] = 0
    if l[a] != 0:
        l[a] = 0
    else:
        l[a] = 1

ans = 0
for d in l.values():
    ans += d

print(ans)

Measured memory_bytes: 16268
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int m = in.nextInt();
		List<Integer> a = new ArrayList<>();
		for(int i=1;i<=Math.sqrt(m);i++) {
			if(m%i==0) {
				a.add(i);
				a.add(m/i);
			}
		}
		a.sort(Comparator.naturalOrder());
		int i = 0;
		while(a.get(i)<n) {
			i++;
		}
		System.out.println(m/a.get(i));

	}

}


Measured memory_bytes: 23252
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <list>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <bitset>
#include <random>
#include <complex>
#include <assert.h>

using namespace std;
typedef long long ll;
#define endl '\n'

template<typename T>
inline bool chmin(T& x, T a) {
	if (x >= a) { x = a; return true; }
	return false;
}

template<typename T>
inline bool chmax(T& x, T a) {
	if (x <= a) { x = a; return true; }
	return false;
}

int main() {
	ios::sync_with_stdio(false);
	std::cin.tie(0);
	
	int a, b, c; cin >> a >> b >> c;
	int k; cin >> k;
	while (a >= b) {
		b *= 2; k--;
	}
	while (b >= c) {
		c *= 2; k--;
	}

	if (k >= 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 3624
import java.util.Scanner;

public class Main {
  public static void main(String[] args){
    Scanner sc = new Scanner(System.in);
    // a
    int limit = Integer.parseInt(sc.next());
    // b
    int container1 = Integer.parseInt(sc.next());
    // c
    int container2 = Integer.parseInt(sc.next());

    int residual = container1 + container2 - limit;
    int result = residual < 0 ? 0 : residual; 
    System.out.print(result);
  }
}

Measured memory_bytes: 23764
#include <bits/stdc++.h>
#define ll long long int
#define endl "\n"
using namespace std;
#define M 1000000007
#define pb push_back
#define rep(i, a, b) for(int i = a; i <= b; i++)
ll mod = 998244353;


int main()
{
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
	int t; t = 1;
	//cin >> t;
	while(t--)
	{	
		ll k, a, b;
		cin >> k >> a >> b;ll g = 0;
		if(abs(a-b) < k)
		{
			for(int i = a; i <= b; i++)
				if(i%k == 0)
					{cout << "OK" << endl;
				g++;
				return 0;}
				if(g == 0)
					cout << "NG" << endl;
		}
		else if(a%k == 0 || b%k == 0)
			cout << "OK" << endl;
		else if(abs(a-b) >= k)
			cout << "OK" << endl;
		else
			cout << "NG" << endl;
	}
		
}  

Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
#define FastRead ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
#define ld long double
#define FOR(i,a,n) for (int i=(a);i<=(n);++i)
#define RFOR(i,a,n) for (int i=(n);i>=(a);--i)
#define FI(i,n) for (int i=0; i<(n); ++i)
#define ZERO(a) memset((a),0,sizeof((a)))
#define f first
// #define s second
#define pb push_back
#define mk make_pair
#define all(g) g.begin(),g.end()
int fastMax(int x, int y) { return (((y-x)>>(32-1))&(x^y))^y; }
int fastMin(int x, int y) { return (((y-x)>>(32-1))&(x^y))^x; }

// #include <ext/pb_ds/assoc_container.hpp> // Common file
// #include <ext/pb_ds/tree_policy.hpp>     // Including tree_order_statistics_node_updat
// using namespace __gnu_pbds;
// typedef tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;

// I am questioning life and universe and 
// everything else after looking at this

struct node {
    ll x,y,z,val;
};
class Compare
{
public:
    bool operator() (node a, node b)
    {
        return a.val <= b.val;
    }
};
void solve(){

    ll x,y,z,k;
    cin>>x>>y>>z>>k;

    ll a[x],b[y],c[z];

    FOR(i,0,x-1) cin>>a[i];
    FOR(i,0,y-1) cin>>b[i];
    FOR(i,0,z-1) cin>>c[i];
    
    sort(a,a+x); reverse(a,a+x);
    sort(b,b+y); reverse(b,b+y);
    sort(c,c+z); reverse(c,c+z);

    auto cmp = [&](node a,node b){
        return a.val >= b.val;
    };

    priority_queue<node,vector<node>,Compare> q;

    q.push({0,0,0,a[0]+b[0]+c[0]});

    map<pair<ll,pair<ll,ll>>,bool> visit;
    while(k>0){
        node temp = q.top();
        q.pop();
        
        ll ai = temp.x,bi = temp.y,ci = temp.z;

        if(visit.count(make_pair(ai,make_pair(bi,ci)))){
            continue;
        }else {
            visit[make_pair(ai,make_pair(bi,ci))] = 1;
        }
        cout<<temp.val<<endl;
        

        if(ai+1 < x) q.push({ai+1,bi,ci,a[ai+1]+b[bi]+c[ci]});
        if(bi+1 < y) q.push({ai,bi+1,ci,a[ai]+b[bi+1]+c[ci]});
        if(ci+1 < z) q.push({ai,bi,ci+1,a[ai]+b[bi]+c[ci+1]});
        k--;
    }
}


signed main(){
    FastRead;    

    ll t;
    t = 1; 
    // cin>>t;
    FOR(tt,1,t){
        // cout<<"Case #"<<tt<<": ";
        solve();
    }
    
}

Measured memory_bytes: 768
#include <stdio.h>
#include <string.h>
int main(void)
{
    int  a,b[200000],i,j,n=0,m,x,y,z=0;
    char c[10100],s[10100];

    scanf("%d%d",&x,&y);

    for (size_t i = 0; i < y; i++)
    {
        scanf("%d",&b[i]);
        n+=b[i];
    }
    if(x>=n) printf("%d",x-n);
    else printf("-1");
    
    printf("\n");
    return 0;
}

Measured memory_bytes: 1744
#include <bits/stdc++.h>
#include <typeinfo>
#include <cxxabi.h>
#ifdef LOCAL
#include "dbgtoki.hpp"
#define DUMP(i) dump((string)TOSTRING(i), demangle(typeid(i).name()), __LINE__ , i) 
#else
#define DUMP(i)
#endif

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ALL(s) (s).begin(), (s).end()
#define dis distance
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define pub push_back
#define sec second
#define fir first

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vector <int> > vvi;
const int EPS = 1e-9;
const int MOD = 1e9+7;
const int INF = (1 << 30);
const double PI = acos(-1);

int n,a;
bool check(int k){
	if(k < 0 || k > n*a)return false;
	return true;
}

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	cin >> n >> a;
	vector< vector< vector<ll> > > dp = vector< vector< vector<ll> > > (n+1,vector< vector<ll> >(n+1,vector<ll>(n*a+1,0)));
	REP(i,n+1)dp[i][0][0] = 1; //dp[i][j][k] iまでの中からj個選んだ和がkになる組み合わせ数
	FOR(i,1,n+1){
		int x;
		cin >> x;
		FOR(j,1,i+1){
			REP(k,n*a+1){
				//i番目を選ばないとき
				dp[i][j][k] = dp[i-1][j][k];
				//i番目を選ぶとき
				if(check(k-x))dp[i][j][k] += dp[i-1][j-1][k-x];
			}
		}
		DUMP(dp[i]);
	}
	ll ans = 0;
	FOR(j,1,n+1) ans+=dp[n][j][j*a];
	cout << ans << endl;
	return 0;
}

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

int main() {
  int64_t N;
  cin >> N;
  int64_t minimum;
  for(int i = 0; i < 5; i++) {
    if(i == 0) {
      cin >> minimum;
    }
    else {
      int64_t a;
      cin >> a;
      minimum = min(minimum, a);
    }
  }
  cout << (N - 1) / minimum + 5 << endl;
}

Measured memory_bytes: 3544
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<int, int> i_i;
ll INF = 1e9+10;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
vector<pair<ll, ll> > pairs;

ll n, mod = 998244353;
const ll MAX = 1e7 + 1;
vector<ll> v(MAX);

ll inv[MAX];

int main()
{
    ll N;
    ll X[2000], Y[2000];
    cin >> N;
    
    rep(i, N) cin >> X[i] >> Y[i];
    
    double sum = 0.0;
    for (int i = 0; i < N; i++){
        for (int j = i; j < N; j++){
            double tmp = (X[i] - X[j])*(X[i] - X[j]) + (Y[i] - Y[j])*  (Y[i] - Y[j]);
            sum += sqrt(tmp);
        }
    }
    fprintf(stdout, "%.10f",  2.0 * sum/(double)N);
    return 0;
}


Measured memory_bytes: 78336
#include <stdio.h>

int main(int argc, char const *argv[])
{
	int A,B,N;
	int max,min;

	scanf("%d%d%d",&N,&A,&B);
	if(A<=B)
	max=A;
	else
	{
		max=B;
	}
	
	if(N-(A+B)>=0)
	min=0;
	else
	{
		min=(A+B)-N;
	}
	printf("%d %d\n",max,min);
	return 0;
}


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

int main(){
    int l;
    cin>>l;
    double s=l;
    double length = s / 3; 
    s -= length; 
    double breadth = s / 2;
    double height = s - breadth;
    cout<<fixed<<setprecision(12)<<(length * breadth * height)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
signed main(void){
	string s;
	while(getline(cin,s)){
		while(s.find("this")==s.npos&&s.find("that")==s.npos&&s.find("the")==s.npos)
			for(int i=0;i<(int)s.length();i++){
				if(s[i]>'z'||s[i]<'a')continue;
				if(s[i]!='z')s[i]++;
				else s[i]='a';
			}
		cout<<s<<endl;
	}
}

Measured memory_bytes: 1176
a, b, c, x = 4.times.map { gets.to_i }
cnt = 0
(0..a).each do |i|
  (0..b).each do |j|
   (0..c).each do |k|
     if 500*i + 100*j + 50*k == x
       cnt += 1
     end
   end
  end
end
 
puts cnt

Measured memory_bytes: 1916
#include<bits/stdc++.h>
#define mod 1000000007
#define ll long long int
#define ar array
#define pb push_back
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	ll a,b,n;
	cin>>a>>b>>n;
	ll y = b-1;
	ll h = n/b *b;
	y = h-1;
	if(y<=0)
		y = n;
	y %= b;
	cout<<y*a/b<<endl;
	return 0;
}

Measured memory_bytes: 3660
#include<iostream>
#include<algorithm>
#include<string>
#include<cstring>
#include<queue>
#include<stack>
#include<cmath>
#include<set>
#include<vector>
#include<map>
#include<unordered_map>

#define ll long long
using namespace  std;
int gcd(int a, int b) {
	return b == 0 ? a : gcd(b, a%b);
}
ll qpow(ll a, ll b) {
	ll ans = 1, base = a;
	while (b) {
		if (b & 1) {
			ans *= base;
		}
		base *= base;
		b >>= 1;
	}
	return ans;
}

/*A*/

int main() {
	ios::sync_with_stdio(0);
	int l, r,d; cin >> l >> r >> d;
	cout << (r / d) - (l - 1) / d << endl;
}

/*B*/

//int main() {
//	ios::sync_with_stdio(0);
//}

/*C*/

//int main() {
//	ios::sync_with_stdio(0);
//}

Measured memory_bytes: 3644
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<assert.h>
#include<numeric>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef long double ld;
const int inf=1e9+7;
const ll longinf=1LL<<60;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
#define F first
#define S second

const int mx=200010;
const ll mod=1e9+7;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x=0):x((x%mod+mod)%mod){}
    mint& operator+=(const mint a) { if ((x += a.x) >= mod) x -= mod; return *this; }
    mint& operator-=(const mint a) { if ((x += mod-a.x) >= mod) x -= mod; return *this; }
    mint& operator*=(const mint a) { (x *= a.x) %= mod; return *this; }
    mint operator+(const mint a) const { mint res(*this); return res+=a; }
    mint operator-(const mint a) const { mint res(*this); return res-=a; }
    mint operator*(const mint a) const { mint res(*this); return res*=a; }
    mint pow(ll t) const { if (!t) return 1; mint a = pow(t>>1); a *= a; if (t&1) a *= *this; return a; }
    // for prime mod
    mint inv() const { return pow(mod-2); }
    mint& operator/=(const mint a) { return (*this) *= a.inv(); }
    mint operator/(const mint a) const { mint res(*this); return res/=a; }
};

typedef vector<vector<pair<ll,int>>> wgraph;
typedef pair<ll,int> pli;


vector<pair<ll,mint>> bfs(wgraph v,int x){
  priority_queue<pli,vector<pli>,greater<pli>> q;
  vector<pair<ll,mint>> dist(v.size(),{longinf,0});
  dist[x]={0,1};
  q.push({0LL,x});

  while(q.size()){
    pli p=q.top(); q.pop();
    ll d=p.F, cur=p.S;
    if(dist[cur].F<d){ continue; }
    for(auto to:v[cur]){
      if(dist[to.S].F>dist[cur].F+to.F){
        dist[to.S].F = dist[cur].F+to.F;
        dist[to.S].S = dist[cur].S;
        q.push({dist[to.S].F, to.S});
      } else if(dist[to.S].F == dist[cur].F+to.F){
        dist[to.S].S += dist[cur].S;
      }
    }
  }
  return dist;
}

int main(){
  int n,m,s,t;
  cin >> n >> m >> s >> t; s--; t--;
  wgraph v(n);
  rep(i,m){
    int x,y,z;
    cin >> x >> y >> z; x--; y--;
    v[x].emplace_back(z,y);
    v[y].emplace_back(z,x);
  }
  vector<pair<ll,mint>> ds=bfs(v,s); //<length, routs num>
  vector<pair<ll,mint>> dt=bfs(v,t);
  mint ans = ds[t].S*dt[s].S;
  ll minlength = ds[t].F;
  rep(i,n){		//meet at node
    if(ds[i].F==dt[i].F && 2*ds[i].F == minlength){
      mint tmp = ds[i].S * dt[i].S;
      ans -= tmp*tmp;
    }
  }
  rep(i,n){		//meet on edge
    for(auto to:v[i]){
      int j = to.S;
      if(ds[i].F+to.F+dt[j].F == minlength && 2*ds[i].F<minlength && 2*dt[j].F<minlength){
        mint tmp = ds[i].S*dt[j].S;
        ans -= tmp*tmp;
      }
    }
  }
  cout << ans.x << endl;
  return 0;
}


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

int main(){
    int n;
    cin >> n;
    vector <int> ans(100001,0),so(100001,1);
    int j;

    rep(i,50001){
        if(i>=2 and so[i]==1){
            j=2;
            while(i*j<100001){
                so[i*j]=0;
                ++j;
            }
        }
    }

    /*rep(i,100001){
        cout << i << " " << so[i] << endl;
    }*/

    rep(i,100001){
        if(i>=3){
            if(so[i]==1 and so[(i+1)/2]==1){
                ans[i]=ans[i-1]+1;
            }
            else{
                ans[i]=ans[i-1];
            }
        }
        //cout << i << " " << ans[i] << endl;
    }

    vector <int> l(n),r(n);
    rep(i,n){
        cin >> l[i] >> r[i];
    }

    rep(i,n){
        cout << ans[r[i]]-ans[l[i]-1] << endl;
    }

    

    return 0;
}

Measured memory_bytes: 4832
#include<iostream>
#include<fstream>
using namespace std;
long long sequence[3005] = {0};
long long maxSum = 0;
long long matrix[3005][3005] ;
int n;
void init()
{
    for(int i = 0; i < 3005; i++)
        sequence[i] = 0;
    for(int i = 0; i < 3005; i++)
        for(int j = 0; j < 3005; j++)
            matrix[i][j] = -1;
}
void read()
{
    init();
    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        cin >> sequence[i];
        maxSum = maxSum + sequence[i];
    }
}

long long dei(long long l, long long r)
{
    if(l > r)
        return 0;
    if(matrix[l][r] == -1)
    {
        long long a;
        long long b;
        if(matrix[l + 2][r] == -1)
            matrix[l +2][r] = dei(l + 2, r);
        if(matrix[l + 1][r - 1] == -1)
            matrix[l + 1][r-1] = dei(l + 1, r - 1);
        if(matrix[l ][r - 2] == -1)
            matrix[l][r -2] = dei(l , r - 2);
        if(matrix[l + 2][r] > matrix[l + 1][r - 1])
            a = matrix[l + 1][r - 1];
        else a = matrix[l + 2][r];
        if(matrix[l + 1][r - 1] > matrix[l ][r - 2])
            b = matrix[l ][r - 2];
        else b = matrix[l + 1][r - 1];
        if(sequence[l] + a < sequence[r] + b)
            matrix[l][r] = sequence[r] + b;
        else matrix[l][r] = sequence[l] + a;

    }
    return matrix[l][r];
}
int main()
{
    read();

    long long rez = dei(1, n);
    cout << 2 * rez - maxSum;
}

Measured memory_bytes: 70912
import Data.List
import Control.Monad
import qualified Data.IntMap as M
import qualified Data.ByteString.Char8 as B

main=do
    (n:k:_)<-map read.words<$>getLine::IO[Int]
    abs<-replicateM n $ unfoldr (B.readInt.B.dropWhile(==' '))<$>B.getLine::IO[[Int]]
    print . src k . M.toAscList.foldl' (\m (a:b:_)->M.insertWith(+)a b m) M.empty $ abs
--
src k ((i,n):r)
    | k<=n = i
    | True = src (k-n) r

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


int main(){
  map<int,int>l;
  int n;
  cin>>n;
  int sum=0;
  for(int i=0;i<n;i++){
    int a;
    cin >>a;
    l[a]+=1;
    if(l[a]<a){sum++;}
    else if( l[a]==a){sum-=l[a]-1;}
    else{
      sum++;
    }
      
  }
  cout << sum;
}

Measured memory_bytes: 4736
#include<iostream>
#include<vector>
#include<string>

using namespace std;

int main()
{string S,T;
 cin >> S >> T;
 
 vector<int> start(26,-1),goal(26,-1);
 
 for(int i = 0; i < S.size(); i++)
 {int a = S[i] - 'a';
  int b = T[i] - 'a';
  // char⇨intへの変換
  if(start[a] != -1 ||goal[b] != -1)
  {//もうすでにいじられている場合
    if(start[a] != b || goal[b] != a)
    {//一対一対応が崩壊している 
      cout << "No" << endl;
      return 0;}}
     
     start[a] = b;
     goal[b] = a;
     }
 cout << "Yes" <<endl;
return 0;
}

Measured memory_bytes: 776
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
typedef long long int ll;
typedef unsigned long long int ull;
 
int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  int a,b,c,ans;
  string s,t;
  cin >>a>>b>>c;
  if(a>=b&&a>=c)ans=b+c;
  if(b>=a&&b>=c)ans=a+c;
  if(c>=b&&c>=a)ans=b+a;
  cout <<ans;
}

Measured memory_bytes: 3636
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <cstring>

#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))

#define INF (int)1e9+7

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

using namespace std;

int main(){
    int a[5];
    int sum = 0;
    
    for(int i = 0; i < 5; i++){
        cin >> a[i];
        sum += a[i];
    }
    //cout << sum << endl;

    vector<int> p(5, 0);

    for(int i = 0; i < 5; i++){
        int k = a[i] % 10;
        p[i] = k == 0 ? 0 : 10 - k;
    }
    sort(p.begin(), p.end());
    
    for(int i = 0; i < 4; i++){
        sum += p[i];
    }

    cout << sum << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, n) for(int i = 0; i < (n); i++)
#define MEM(a, x) memset(a, x, sizeof(a))
#define ALL(a) a.begin(), a.end()
#define UNIQUE(a) a.erase(unique(ALL(a)), a.end())
typedef long long ll;

int n;
ll a[100005], b[100005];

int main(int argc, char const *argv[]) {
	ios_base::sync_with_stdio(false);
	cin >> n;
	FOR(i, n) cin >> a[i] >> b[i];
	ll ret = 0;
	for (int i = n-1; i >= 0; i--) {
		a[i] += ret;
		if (a[i] % b[i] == 0) continue;
		ret += (a[i]+b[i]-1)/b[i]*b[i]-a[i];
	}
	cout << ret << endl;
	return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
 
#define ll long long int
 
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define mp make_pair
#define xx first
#define yy second
 
#define pii pair <int, int >
#define pll pair < ll, ll >
#define xx first
#define yy second
#define vi vector < int >
#define vl vector < ll >
#define vp vector < pii >
 
#define inf  100000000
 
#define f(i, c, n) for(int i = c; i < n; i++)
#define fe(i, c, n) for(int i = c; i <= n; i++)
#define fr(i, n, c) for(int i = n - 1; i >= c; i--)
 
#define be(a) a.begin(), a.end()
#define vsort(a) sort(a.begin(), a.end())
#define mem(a) memset(a, 0, sizeof(a))
#define memn(a) memset(a, -1, sizeof(a))
#define srti(a, n) sort(a, a + n)
#define srtd(a, n) sort(a, a + n, greater<int>())
#define LB(a, x) (lower_bound(vbe(a), x) - a.begin())
#define UB(a, x) (upper_bound(vbe(a), x) - a.begin())
#define S " "
#define N "\n"

//cout << "Case " << ++cs << ": " <<
#define fast ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define FILE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);


void solve() {
	int a, b, c, d;
	cin >> a >> b >> c >> d;
	if(abs(c - a) <= d) {
		cout << "Yes" << N;
	} else {
		if(abs(a - b) <= d and abs(b - c) <= d) {
			cout << "Yes" << N;
		} else {
			cout << "No" << N;
		}
	}
}

int main() {
    // FILE;
    fast;
    // int t; cin >> t; while(t--)
    solve();
}

Measured memory_bytes: 3640