akhauriyash/Code-Regression huggingface dataset:
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <fstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
using namespace std;
typedef long long ll;
typedef long long int llint;
typedef pair<ll, ll> pa;
#define MM 1000000000
#define MOD MM+7
#define MAX 101000
#define MAP 110
#define initial_value -1
#define MAX_T 1001
#define Pair pair<int,int>
#define chmax(a,b) (a<b ? a=b:0)
#define chmin(a,b) (a>b ? a=b:0)
#define INF (1 << 29) //536870912
const long double PI = acos(-1);
const ll DEP = 1e18;
int dx[4] = {-1,0,1,0};
int dy[4] = {0,-1,0,1};
int GCD(int x,int y){
    return y ? GCD(y,x%y) : x;
}
ll N,a[100001];
int main(){
    cin >> N;
    for(int i = 0; i < N; i++){
        cin >> a[i];
    }
    sort(a,a+N);
    ll sum = 0;
    ll ans = N;
    for(int i = 0; i < N-1; i++){
        sum += a[i];
        if(sum*2 < a[i+1]) ans = N-i-1;
    }
    cout << ans << endl;
}



Measured memory_bytes: 1024
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace _20170410_AOJ
{
    class ALDS1_10A
    {
        static long[] table;
        static void Main(string[] args)
        {
            for (;;)
            {
                string line = Console.ReadLine();
                if (string.IsNullOrEmpty(line))
                {
                    break;
                }

                int n = int.Parse(line);
                table = new long[n + 1];

                long f = Fib(n);
                Console.WriteLine(f);
            }
        }

        static long Fib(int n)
        {
            long rv;
            if (table[n] > 0)
            {
                rv = table[n];
            }
            else
            {
                if (n == 0 || n == 1)
                {
                    rv = 1;
                }
                else
                {
                    rv = Fib(n - 1) + Fib(n - 2);
                }

                table[n] = rv;
            }

            return rv;
        }
    }
}



Measured memory_bytes: 9172
import sys
import socket
from collections import deque


if socket.gethostname() in ['N551J', 'F551C']:
    in_file = 'f1.in'
    in_file = 'after_contest_01.in'
    sys.stdin = open(in_file)


def read_int_list():
    return list(map(int, input().split()))


def read_int():
    return int(input())


def read_str_list():
    return input().split()


def read_str():
    return input()


def solve():
    n, d, a = read_int_list()
    pairs = [read_int_list() for _ in range(n)]
    pairs.sort()
    x, h = map(list, zip(*pairs))

    res = 0
    damage = 0
    q = deque()
    for i in range(n):
        # print(i, damage, file=sys.stderr)
        while len(q) > 0 and q[0][0] + d < x[i]:
            y, m = q.popleft()
            damage -= m * a
        if damage < h[i]:
            y = x[i] + d
            quotient, rest = divmod(h[i] - damage, a)
            m = quotient + (rest > 0)
            q.append((y, m))
            damage += m * a
            res += m

    return res



def main():
    res = solve()
    print(res)


if __name__ == '__main__':
    main()


Measured memory_bytes: 69912
package main

import (
	"fmt"
	"io"
	"os"
)

type point struct {
	t int
	x int
	y int
}

func proc(r io.Reader, w io.Writer) {
	var n, t, x, y int
	fmt.Fscanf(r, "%d", &n)

	arr := make([]*point, n+1)
	arr[0] = &point{t: 0, x: 0, y: 0}
	for i := 1; i <= n; i++ {
		fmt.Fscanf(r, "%d %d %d", &t, &x, &y)
		arr[i] = &point{t: t, x: x, y: y}
	}

	for i := 0; i < n; i++ {
		current := arr[i]
		next := arr[i+1]
		dt := next.t - current.t
		dx := next.x - current.x
		dy := next.y - current.y
		if dx < 0 {
			dx = -dx
		}
		if dy < 0 {
			dy = -dy
		}
		d := dt - (dx + dy)
		if d < 0 || d%2 != 0 {
			fmt.Fprintf(w, "No")
			return
		}
	}

	fmt.Fprintf(w, "Yes")
}

func main() {
	proc(os.Stdin, os.Stdout)
}


Measured memory_bytes: 6144
//Bismillah hirrahmanir Rahim
    #include<bits/stdc++.h>
    #define ll long long
    #define pb push_back
    #define dbug printf("I am here\n");
    #define Fast ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  using namespace std;
int main() {
    ll int tst,n,x;
    map<ll,ll>mp;
  cin>>tst;
  for(int i=0;i<tst-1;i++){
cin>>x;
mp[x]++;
  }
for(int i=1;i<=tst;i++){
    cout<<mp[i]<<endl;
}
    return 0;
  }


Measured memory_bytes: 16096
n = gets.chomp.to_i
s = gets.chomp.split(" ").map(&:to_i)
q = gets.chomp.to_i
t = gets.chomp.split(" ").map(&:to_i)

res = 0
t.each do |i|
  s.each do |j|
    if i == j then
      res += 1
      break
    end
  end
end
puts res

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

using namespace std;

vector<int>link;
vector<int>S;

int find(int x){
    return link[x] = ((link[x]!=x)?find(link[x]):x);
}

void unite(int a, int b){
    a = find(a);
    b = find(b);

    if(S[a]<S[b]){
        swap(a,b);
    }

    S[a] += S[b];
    link[b] = a;
}

void solve(int n, int q){
    S.assign(n,1);
    link.resize(n);

    for(int i=0;i<n;i++){
        link[i] = i;
    }

    int opt,u,v;
    while(q--){
        cin>>opt>>u>>v;

        if(opt==0){
            unite(u,v);
            continue;
        }

        if(opt==1){
            cout<<(find(u) == find(v))<<endl;
            continue;
        }
    }
}

int main(){
    int n,q;
    cin>>n>>q;
    solve(n,q);

    return 0;
}

Measured memory_bytes: 4684
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
using namespace std;
typedef long long ll;
int INF = (1LL << 30) - 1;
int MOD = 1e9+7;
main(){
    int N;
    cin >> N;
    vector<int> V(N);
    rep(i,0,N)cin >> V[i];
    vector<ll> accum(N+1);
    rep(i,0,N)accum[i+1] = accum[i] + V[i];
    map<ll,int> mp;
    rep(i,0,N+1)mp[accum[i]]++;

    ll ans = 0;
    //ans += max(mp[0]-1, 0);
    for(auto p:mp){
        ll num = p.second;
        //cout << p.first << "," << num << endl;
        ans += num * (num-1) / 2;
    }
    cout << ans << endl;
}


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

int main() {
    int N;
	cin >> N;
  	int arr[N];
  
  	for (int i = 0; i < N; i++) {
  		cin >> arr[i];  	 
    }
  
  	int dp[N];
  
  	dp[0] = 0;
  	dp[1] = abs(arr[1] - arr[0]);
  	//dp[2] = min(dp[1] + abs(arr[2] - arr[1]), abs(arr[2] - arr[0]));
  	for (int i = 2; i < N; i++) {
    	dp[i] = min(dp[i - 1] + abs(arr[i] - arr[i - 1]), dp[i - 2] + abs(arr[i] - arr[i - 2])); 
    }
  
  	cout << dp[N - 1] << endl;
  
  
}

Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<string>
#include<sstream>
#include<iomanip>
#include<limits>
#include<deque>
#include<map>
#include<list>
#include<set>
#include <unordered_set>
#include<vector>
#include<cmath>
#include<cstdio>
#include<memory>
#include<bitset>

using namespace std;


int main(void) {
	int x, y; cin >> x >> y;

	if ((x+1)/2>=y) { cout << "YES" << endl; }
	else { cout << "NO" << endl; }


	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#ifdef HIRO
#define d(f_, ...) printf((f_), ##__VA_ARGS__)
#else
#define d(f_, ...)
#endif

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef queue<int> qi;
typedef queue< pair<int, int> > qp;
#define mp make_pair
#define pi 3.14159265358979323846
#define MAX max_element
#define MIN min_element
#define all(v) v.begin(), v.end()
#define gt(T) greater<T>()
#define sum(v) accumulate(v.begin(), v.end(), 0)
#define uni(v) do{ \
  sort(v.begin(), v.end()); \
  decltype(v)::iterator result = unique(v.begin(), v.end()); \
  v.erase(result, v.end()); \
}while(0)
#define fi(init, n) for(int i = init; i < n; ++i)
#define fj(init, n) for(int j = init; j < n; ++j)
#define fk(init, n) for(int k = init; k < n; ++k)
#define zero(x) memset(x, 0, sizeof(x))
#define negative(x) memset(x, ~0, sizeof(x))
const ll MOD = 1e9 + 7;
const int INF = 1e9;
const int di[] = { 0, 1, 0, -1 };
const int dj[] = { 1, 0, -1, 0 };

template<typename T>
T gcd(T a, T b) {
	return b ? gcd(b, a % b) : a;
}
template<typename T>
T lcm(T a, T b) {
	return a * b / gcd(a, b);
}
template<typename T>
int finder(vector<T> vec, T number) {
	auto itr = find(vec.begin(), vec.end(), number);
	size_t index = distance(vec.begin(), itr);
	if (index != vec.size()) return 1;
	else return 0;
}
ll frac(ll n){
	if (n == 0) return 1;
	return (n * frac(n - 1)) % MOD;
}

ll dp[100001];
int main(int argc, char** argv) {
#ifdef HIRO
  string quiz(argv[1]);
  string id(argv[2]);
  string filename("input/" + quiz + "/" + id + ".txt");
  ifstream fin(filename);
  if (fin.peek() == ifstream::traits_type::eof()) {
    cout << "No input.";
    return 0;
  }
  ifstream cin(filename);
  std::cin.rdbuf(cin.rdbuf());
#endif
  ll ans = 0;
  // ll n;
  // cin >> n;
  ll n, m;
  cin >> n >> m;
  // ll n, m, k;
  // cin >> n >> m >> k;
  int arr[n];
  fi(0, n)
    cin >> arr[i];
  fi(0, n)
    dp[i] = INF;
  dp[0] = 0;
  fi(1, n) {
    fj(i - m, i) {
      if(j < 0) continue;
      int v = dp[j] + abs(arr[i] - arr[j]);
      // printf("%ld, %d\n", dp[i], v);
      if(v < dp[i]) dp[i] = v;
    }
  }
  cout << dp[n - 1];
  // cout << ans << endl;
  return 0;
}



Measured memory_bytes: 1408
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>

int main()
{
	int n,t;
	int sum=0;
	scanf("%d", &n);
	t = n;

	while (t > 0)
	{
		sum += t % 10;
		t /= 10;
	}

	if(n%sum)
		printf("No\n");
	else
		printf("Yes\n");

	return 0;
}

Measured memory_bytes: 128
#include<iostream>
#include<set>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<queue>
#include<stdio.h>
using namespace std;

#define rep(i,n) for(long long i = 0; i < n; i++)

typedef long long ll;
typedef unsigned long long int ulli;
typedef vector<int> vi;
typedef vector<long long> vll;
typedef pair<int, int> pii;

const ll INF = ll(1e18) + 1;

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

ulli gcd(ulli a, ulli b) {
	return (b <= 0) ? a : gcd(b, a % b);
}

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

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

void Main()
{
	ll n, b, r, ans = 0; cin >> n >> b >> r;
	ll sum = b + r;
	ans += (n / sum) * b;
	ll surplus = n % sum;
	if (surplus <= b) ans += surplus;
	else ans += b;
	cout << ans << endl;
}
int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	Main();
	
	return 0;
}

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

int main() {
  int a, b;
  cin >> a >> b;
    
  int add = a+b;
  int sub = a-b;
  int mul = a*b;
  
  if ((add > sub) && (add > mul)) cout << add << endl;
  else if (sub > mul) cout << sub << endl;
  else cout << mul << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, int> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

const ll MODBASE = 1000000007LL;
const int MAXN = 500010;
const int MAXM = 1000;
const int MAXK = 16;
const int MAXQ = 200010;

struct Data {
	int l, r, cs, block;
	Data(int l = 0, int r = 0, int cs = 0, int block = 0) : l(l), r(r), cs(cs), block(block) {}
};

bool operator<(Data a, Data b) {
	if (a.block == b.block) return a.r < b.r;
	return a.block < b.block;
}

vector<Data> b;
int n, q, a[MAXN], kq, cnt[MAXN], res[MAXN];

void add(int u) {
	kq += (cnt[a[u]]++ == 0);
}
void del(int u) {
	kq -= (--cnt[a[u]] == 0);
}

int main() {
	ios::sync_with_stdio(0);
	cin.tie(nullptr);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	cin >> n >> q;
	FOR(i, 1, n) cin >> a[i];

	// length of one block
	int k = int(sqrt(n));
	// num of blocks
	int part = n / k + (n % k > 0);

	FOR(i, 1, q) {
		int l, r;
		cin >> l >> r;
		b.push_back(Data(l, r, i, l / part - (l % part == 0)));
	}

	sort(ALL(b));
	int currL = 1, currR = 1;
	cnt[a[1]]++;
	kq = 1;
	FOR(i, 0, q - 1) {
		while (currR > b[i].r) del(currR--);
		while (currR < b[i].r) add(++currR);
		while (currL < b[i].l) del(currL++);
		while (currL > b[i].l) add(--currL);
		res[b[i].cs] = kq;
	}

	FOR(i, 1, q) cout << res[i] << "\n";
	return 0;
}

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

int main() {
  int n, d;
  cin >> n >> d;
  vector<vector<int>> x(n, vector<int>(d));
  for(int i=0; i<n; i++) {
    for(int j=0; j<d; j++) {
      cin >> x.at(i).at(j);
    }
  }
  int count = 0;
  for(int i=1; i<n; i++) {
    for(int j=0; j<i; j++) {
      int s = 0;
      for(int k=0; k<d; k++) {
        s += (x.at(i).at(k) - x.at(j).at(k)) * (x.at(i).at(k) - x.at(j).at(k));
      }
      for(int k=0; k<200; k++) {
        if(s == k*k) {
          count++;
          break;
        }
      }
    }
  }
  cout << count << endl;
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int main()
{
	int n; cin>>n;
  string s[501];
  for(int i=0; i<n; i++){
    cin>>s[i];
  }
  int ctt=0;
  bool nuee[501];
  fill(nuee, nuee+n, 1);
  bool dame=1;
  for(int j=0; j<n; j++){
    bool ok=1;
    for(int i=0; i<n; i++){
      if(s[i][j]=='.'){
        ok=0;
      }else{
        nuee[j]=0;
      }
    }
    if(ok) ctt++;
    if(!nuee[j]) dame=0;
  }
  if(dame){
    cout<<-1<<endl; return 0;
  }
  int ans=2*n;
  for(int i=0; i<n; i++){
    int cty=0;
    for(int j=0; j<n; j++){
      if(s[i][j]=='#') cty++;
    }
    if(cty==n){
      cout<<n-ctt<<endl;
      return 0;
    }
    if(nuee[i]){
      ans=min(ans, n-ctt+n-cty+1);
    }else{
      ans=min(ans, n-ctt+n-cty);
    }
  }
  cout<<ans<<endl;
	return 0;
}

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

using namespace std;

long long n, k, ans, a[200005], pr[200005], pp[200005];
map<long long, long long> mp;
int main()
{
    ios_base::sync_with_stdio(false);
    cin >> n >> k;
    pr[0] = 1;
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
        pr[i] = (pr[i - 1]  + a[i]);
        pp[i] = (pr[i - 1] - i + 1) % k;
        mp[(pr[i - 1] - i + 1) % k]++;
        if (i - k + 1 >= 1)
            mp[pp[i - k + 1]]--;
        ans += mp[(pr[i] - i) % k];
    }
    cout << ans;
    return 0;
}


Measured memory_bytes: 17408
#include <iostream>
#include <cstdio>
#include <cmath>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <queue>
#include <bitset>

typedef long long ll;
typedef std::vector< int > VI;

const double EPS = 1e-10;
const double PI  = acos(-1);
const ll     INF = 1 << 30;

int main(int argc, char* argv[])
{
  int a, b;
  std::string s;
  std::string::iterator it;

  std::cin >> a >> b;
  std::cin >> s;

  std::string x = s.substr(0, a);
  std::string y = s.substr(a+1);

  std::string judge = "Yes";
  //std::cout << x.size() << " " << y.size() << std::endl;
  if (s[a] != '-') {
    judge = "No";
  }
  if ((int)x.size() != a || (int)y.size() != b) {
    judge = "No";
  }
  for (it = x.begin(); it != x.end(); it++) {
    if (*it > '9' || *it < '0') {
      judge = "No";
    }
  }

  for (it = y.begin(); it != y.end(); it++) {
    if (*it > '9' || *it < '0') {
      judge = "No";
    }
  }

  std::cout << judge << std::endl;
  return 0;
}


Measured memory_bytes: 256
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>

using namespace std;

//typedef
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;

//conversion
inline LL toLong(string s) {LL v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}

//math
//-------------------------------------------
template<class T> inline T sqr(T x) {return x*x;}

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) LL((a).size())
#define EACH(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define UNTIL(p) while(!(p))

//constant
const double EPS = 1e-5;
const double PI  = acos(-1.0);

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

#define PUTS(x) cout << (x) << endl;

int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);
    LL r,g,b,n;
    cin>>r>>g>>b>>n;
    LL ans = 0;
    REP(i,n+1)REP(j,n+1){
        LL x = n - r*i - g*j; 
        if(x >= 0 && x % b == 0)ans++;
    }
    PUTS(ans);
}

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

// limit
#define oo 1000000007LL
#define OO 1000000000000000007LL

// loop
#define fto(i, x, y) for(int i = (x); i <= (y); ++i)
#define fdto(i, x, y) for(int i = (x); i >= (y); --i)
#define ftoa(i, x, y, a) for(int i = (x); i <= (y); i += a)
#define fdtoa(i, x, y, a) for(int i = (x); i >= (y); i -= a)
#define ftoit(it, var) for (__typeof(var.begin()) it = var.begin(); it != var.end(); ++it)
#define fdtoit(rit, var) for (__typeof(var.rbegin()) rit = var.rbegin(); rit != var.rend(); ++rit)

// debug
#define debug cout << "*" << endl;
#define bug1d(a, x, y) { cout << #a << ": "; fto(_, x, y) cout << a[_] << ' '; cout << endl; }
#define bug2d(a, x, y, u, v) { cout << #a << ": " << endl; fto(i, x, y) {fto(j, u, v) cout << a[i][j] << ' '; cout << endl;}; cout << endl;}
#define bug(a) cout << #a << " = " << a << endl;
#define bug2(a, b) cout << #a << " = " << a << "; "; cout << #b << " = " << b << endl;
#define bug3(a, b, c) cout << #a << " = " << a << "; "; cout << #b << " = " << b << "; "; cout << #c << " = " << c << endl;

// operation
#define mp make_pair
#define pb push_back
#define pf push_front

// structure
#define ii pair<int, int>
#define iii pair<ii, int>
#define vi vector<int>
#define vll vector<ll>
#define vii vector<ii>

// get value
#define FF first
#define SS second

// data type
#define ll long long
#define ull unsigned long long

// function
#define lb lower_bound
#define ub upper_bound

using namespace std;

template <class T>
T min(T a, T b, T c) {
    return min(a, min(b, c));
}

template <class T>
T min(T a, T b, T c, T d) {
    return min(a, min(b, min(c, d)));
}

template <class T>
T max(T a, T b, T c) {
    return max(a, max(b, c));
}

template <class T>
T max(T a, T b, T c, T d) {
    return max(a, max(b, max(c, d)));
}

bool cmp(const ii& a, const ii& b) {return (a.FF > b.FF || (a.FF == b.FF && a.SS >= b.SS));}
ll GCD(ll a, ll b) {return (a%b) ? GCD(b, a%b) : b;}

const string namePro = "tmp";
#define maxN 100007

int a[maxN], f[maxN];

int main() {
//    #ifndef ONLINE_JUDGE
//        freopen((namePro+".inp").c_str(), "r", stdin);
//        freopen((namePro+".out").c_str(), "w", stdout);
//    #endif // ONLINE_JUDGE

    int n; scanf("%d", &n);
    fto (i, 1, n) scanf("%d", &a[i]);

    vi vc;
    fto (i, 1, n) {
        if (a[i] == i) vc.pb(i);
    }

    if (vc.size() == 0) {
        puts("0");
        return 0;
    }

    vi vt;
    vt.pb(0);

    f[0] = 0;
    f[1] = 1;

    n = (int)vc.size();
    fto (i, 0, n-1) vt.pb(vc[i]);

    fto (i, 2, n) {
        f[i] = min(f[i-1]+1, f[i-2]+vt[i]-vt[i-1]);
    }

    printf("%d\n", f[n]);
    return 0;
}



Measured memory_bytes: 1912
#include<iostream>
#include<cstdio>
#include<sstream>
#include<string>
using namespace std;
int main()
{
    //freopen("xx.out","w",stdout);
    //freopen("xx.in","r",stdin);
    long long a;
    cin>>a;
    cout<<(a*800)-((a/15)*200)<<endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <unordered_set>
using namespace std;
typedef unsigned long long ll;
constexpr ll MOD = 1000000007;

int main(){
  int a;
  string s;
  cin >> a;
  cin >> s;
  if(a >= 3200){
    cout << s << endl;
  } else {
    cout << "red" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <climits>
using namespace std;

#define REP(i,n) for(int i=0; i<n; ++i)
#define FOR(i,a,b) for(int i=a; i<=b; ++i)
#define FORR(i,a,b) for (int i=a; i>=b; --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    int ans = 0;
    FOR(i, 1, n) {
        if(i % 2 == 0) continue;
        int cnt = 0;
        FOR(div, 1, i) if(i % div == 0) cnt++;
        if(cnt == 8) ans++;
    }
    cout << ans << endl;
    
    return 0;
}


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

using namespace std;
#define PI 3.1415926535897932384626433832795
#define MOD (1000000007)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define repc(i, s, n) for (int i = (s); i <= (n); i++)
#define rrep(i, n) for (int i = (n) - 1; i >= 0; i--)
#define rrepc(i, s, n) for (int i = (s); i >= (n); i--)
typedef long long ll;
typedef unsigned long long ull;

int main()
{
	string s;
	int len, ans = 100;

	cin >> s;
	len = s.length();

	for (char c = 'a'; c <= 'z'; c++) {
		int cnt = 0, maxcnt = 0;

		rep(i, len) {
			if (s[i] == c) {
				maxcnt = max(maxcnt, cnt);
				cnt = 0;
			}
			else if (i == len - 1) maxcnt = max(maxcnt, cnt + 1);
			else cnt++;
		}

		ans = min(ans, maxcnt);
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;
class Main {
    public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
		int input = scan.nextInt();
		int[] num = new int[input];
		int count;
		
		for(int c = 0; c < input; c++){
			num[c] = scan.nextInt();
		}
		
		count = SelectionSort(num, input);
		
		for(int i = 0; i < input; i++){
			if(i != input - 1){
				System.out.print(num[i] + " ");
			}else{
				System.out.println(num[i]);
			}
		}
		System.out.println(count);
	}
	
	static int SelectionSort(int data[], int n){
		int temp;
		int c = 0;
		int min;
		boolean b;
		
		for(int i = 0; i < n - 1; i++){
			min = i;
			b = false;
			
			for(int j = i + 1; j < n; j++){
				if(data[j] < data[min]){
					min = j;
					b = true;
				}
			}
			if(b){
				temp = data[i];
				data[i] = data[min];
				data[min] = temp;
				c++;
			}
		}
		
		return c;
	}
}

Measured memory_bytes: 26372
n = int(input())

total_jpy = 0
for i in range(n):
    x_str, u = input().split(' ')
    x = float(x_str)
    if u == 'JPY':
        total_jpy += x
    else:
        x_jpy = x * 380000.0
        total_jpy += x_jpy

print(total_jpy)

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

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

int main() {
  int n; cin>>n;
  int ans=1e9;
  vector<int> a(n);
  for(int i=0; i<n; i++) cin>>a[i];
  // おそらくユークリッドの互除法を使うことになる
  // 正直自信はない、が... 前から順番に最大公約数を求めてみる
  for(int i=0; i<a.size()-1; i++) {
    ans = min(ans,gcd(a[i],a[i+1]));
    if(ans==1) break;
  }
  cout << ans << endl;
}


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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;
const ll m=1LL<<32;

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;
}


int main(){

  ll n,m;cin>>n>>m;
  COMinit();

  map<ll,ll>mp;
  for(ll i=2;i*i<=m;i++){
    while(m%i==0){
      mp[i]++;
      m/=i;
    }
  }
  if(m!=1)mp[m]++;

  ll ans=1;
  for(auto p:mp){
    // out(p.first<<":"<<p.second<<" "<<COM(p.second+n-1,p.second));
    ans*=COM(p.second+n-1,p.second);
    ans%=mod;
  }
  //因数別にそれぞれ配分していく組み合わせを掛けていく
  out(ans);

  return 0;
}


Measured memory_bytes: 12160
#include <iostream>
#include <string.h>
#include <string>
#include <map>
#include <vector>
#include <queue>
#include <math.h>
#include <algorithm>
#include <stdlib.h>
using namespace std;

int main()
{
	int n,a[9]={0},i,ans;
	scanf("%d",&n);
	while(n--)
	{
		scanf("%d",&i);
		if(i<400) a[0]++;
		else if(i<800) a[1]++;
		else if(i<1200) a[2]++;
		else if(i<1600) a[3]++;
		else if(i<2000) a[4]++;
		else if(i<2400) a[5]++;
		else if(i<2800) a[6]++;
		else if(i<3200) a[7]++;
		else a[8]++;
	}
	for(i=0;i<8;i++) ans+=(a[i]>0);
	printf("%d %d\n",ans+(ans==0),ans+a[8]);
}

Measured memory_bytes: 256
import sys
import heapq
n = int(input())
V = [[int(i) for i in input().split()] for _ in range(n)]
dis = [sys.maxsize for _ in range(n)]
dis[0] = 0
h = []
for i in range(n):
    heapq.heappush(h,(dis[i],i))
while(len(h)>0):
    node = heapq.heappop(h)
    tmp = node[1]
    for i in range(V[tmp][1]):
        ind = V[tmp][2*i+2]
        cos = V[tmp][2*i+3]
        if cos + dis[tmp] < dis[ind]:
            dis[ind] = cos + dis[tmp]
            heapq.heappush(h,(dis[ind],ind))
for i,j in enumerate(dis):
    print(i,j)


Measured memory_bytes: 5952
#include <bits/stdc++.h>
using namespace std;
#define repd(i,a,b) for (ll i=(a);i<(b);i++)
#define rep(i,n) repd(i,0,n)
#define all(x) (x).begin(),(x).end()
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
typedef long long ll;
const long long INF = 1LL << 60;
int main()
{
    int N, W;
    cin >> N >> W;

    vector<ll> A, B, C, D;
    ll st, w, v;
    cin >> st >> v;
    A.push_back(v);

    rep(i, N - 1) {
        cin >> w >> v;
        if (w - st == 0) A.push_back(v);
        else if (w - st == 1) B.push_back(v);
        else if (w - st == 2) C.push_back(v);
        else D.push_back(v);
    }

    sort(all(A), greater<ll>());
    sort(all(B), greater<ll>());
    sort(all(C), greater<ll>());
    sort(all(D), greater<ll>());

    ll ans = 0;
    rep(i, (int)A.size() + 1) {
        rep(j, (int)B.size() + 1) {
            rep(k, (int)C.size() + 1) {
                rep(l, (int)D.size() + 1) {
                    ll v = 0;
                    rep(h, i) v += A[h];
                    rep(h, j) v += B[h];
                    rep(h, k) v += C[h];
                    rep(h, l) v += D[h];
                    ll weight = (i + j + k + l) * st;
                    weight += (j + k * 2 + l * 3);
                    //cout << i << ":" << j << ":" << k << ":" << l << ":" << weight << endl;
                    if (weight <= W) ans = max(ans, v);
                }
            }
        }
    }

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

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long int llint;
typedef long long ll;
typedef long int lint;
typedef vector<char> vchar;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef vector<vector<long long>> vvll;
typedef vector<vector<int>> vvint;
typedef vector<vector<char>> vvchar;
#define vsort(v) sort((v).begin(), (v).end())
#define vrsort(v) sort((v).rbegin(), (v).rend())
#define vreverse(v) reverse((v).begin(), (v).end())
#define pb(a) push_back(a)
#define INF 2000000009
#define MOD 1000000007
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  //input
  ll i,n;cin>>n;vll a(3*n);
  for(i=0;i<3*n;i++){cin>>a[i];}
  //caricurate
  vrsort(a);ll ans=0;
  for(i=0;i<n;i++){
    ans+=a[2*i+1];
  }
  //output
  cout<<ans<<endl;
}

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

using namespace std;
using int64 = long long;

constexpr int DEBUG = 0;

template<class T> inline bool UpdateMin(T& a, T b) {
  if (a > b) { a = b; return 1; } return 0;
}

template<class T> inline bool UpdateMax(T& a, T b) {
  if (a < b) { a = b; return 1; } return 0;
}

vector<int> ZAlgorithm(const string& s) {
  int n = s.length();
  vector<int> zs(n, -1);
  zs[0] = n;

  int l = 0;
  int r = 0;
  for (int i = 1; i < n; i++) {
    if (r <= i) {
      l = i;
      r = i;
      while (r < n && s[r] == s[r - l]) r++;
      zs[i] = r - l;
    } else {
      if (zs[i - l] + i < r) {
        zs[i] = zs[i - l];
      } else {
        l = i;
        while (r < n && s[r] == s[r - l]) r++;
        zs[i] = r - l;
      }
    }
  }
  return zs;
}

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

  int n;
  cin >> n;
  string s;
  cin >> s;

  int ans = 0;
  for (int i = 0; i < n; i++) {
    string t = s.substr(i);
    auto zs = ZAlgorithm(t);
    for (int j = 0; j < t.length(); j++) {
      UpdateMax(ans, min(j, zs[j]));
    }
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
// C - Train Ticket
#include <stdio.h>
#include <string.h>

int main(void){
    char abcd[4], op[3];
    int abcdInt[4], i, j, temp, sum=0;
    scanf("%s", abcd);
    for(i=0; i<4; i++){
        abcdInt[i] = abcd[i]-'0';
    }
    for(i=0; i<(1<<4); i++){
        int sum=abcdInt[0];
        for(j=0; j<3; j++){
            if(i & (1<<j)){
                op[j]='+';
                sum+=abcdInt[j+1];
            }else{
                op[j]='-';
                sum-=abcdInt[j+1];
            }
        }
        if(sum==7) break;
    }

    for(i=0; i<3; i++){
        printf("%d%c", abcdInt[i], op[i]);
    }
    printf("%d=7\n", abcdInt[3]);
    return 0;
}


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

int main(void){
    int n,m;
    cin >> n;
    int d[n];
    for(int i = 0;i < n;i++)cin >> d[i];
    cin >> m;
    int t[m];
    for(int i = 0;i < m;i++)cin >> t[i];
    if(m > n)cout << "NO";
    else {
        sort(t,t+m);
        sort(d,d+n);
        bool check = true;
        for(int i = 0,j = 0;i < m;i++){
            for(;;j++){
                if(j >= n){
                    check = false;
                    break;
                }
                else if(d[j] == t[i]){
                    j++;
                    break;
                }
            }
        }
        if(check == true)cout << "YES";
        else cout << "NO";
    }
}

Measured memory_bytes: 1792
#include <bits/stdc++.h>
const int N=1005;
using namespace std;
typedef long double ld;
typedef long long ll;
vector<vector<ll>>ps;
ll n,x,y;
ld dist[N][N];
ld calc(vector<ll>&a,vector<ll>&b){
    ld x=a[0]-b[0];
    ld y=a[1]-b[1];
    ld e=x*x+y*y;
    e=max(e,(ld) 0.0);
    e=pow(e,0.5);
    e=max(e-a[2]-b[2],(ld) 0.0);
    return e;
}
vector<ld>d(N,numeric_limits<ld>::max());
int main()
{ios_base::sync_with_stdio(0);cout.tie(0);cin.tie(0);
    cin>>x>>y;
    ps.push_back({x,y,0});
    cin>>x>>y;
    ps.push_back({x,y,0});
    cin>>n;
    for(int i=1;i<=n;i++){
        ll x,y,r;cin>>x>>y>>r;
        ps.push_back({x,y,r});
    }
    for(int i=0;i<ps.size();i++){
        for(int j=0;j<ps.size();j++){
            dist[i][j]=calc(ps[i],ps[j]);
            //cout<<i<<' '<<j<<' '<<dist[i][j]<<endl;
        }
    }
    priority_queue<pair<long double,int>,vector<pair<long double,int>>,greater<pair<long double,int>>>pq;
    pq.push({0,0});
    d[0]=0;
    while(pq.size()){
        int u=pq.top().second;pq.pop();
        //cout<<u<<' '<<d[u]<<endl;
        for(int v=0;v<ps.size();v++){
            if(d[u]+dist[u][v]<d[v]){
                d[v]=d[u]+dist[u][v];
                pq.push({d[v],v});
            }
        }
    }
    cout.precision(10);
    cout<<fixed<<d[1]<<'\n';
    return 0;
}


Measured memory_bytes: 27524
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
#define int long long


signed main(void){
  int n;
  string s,t;

  cin >> n >> s >> t;

  int buf;
  for(int i = n; i >= 0; i--){
    if(s.substr(n-i)==t.substr(0,i)){
      buf = i;
      break;
    }
  }

  cout << 2*n-buf << "\r\n";


}


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

int main(){
    vector<vector <int>> bingo(3,vector <int> (3));
    int i,j,k,n;
    int ans;
    ans=0;
    rep(i,3){
        rep(j,3){
            cin >> bingo[i][j];
        }
    }
    cin >> n;
    vector <int> b(n);
    rep(i,n){
        cin >> b[i];
    }
    rep(k,n){
        rep(i,3){
            rep(j,3){
                if(bingo[i][j]==b[k]){
                    bingo[i][j]=0;
                }
        }
    }
    }
    
    

    rep(i,3){
        if (bingo[i][0]==0 and bingo[i][1]==0 and bingo[i][2]==0){
            ans=1;
        }
        if (bingo[0][i]==0 and bingo[1][i]==0 and bingo[2][i]==0){
            ans=1;
        }
        
    }
    if (bingo[0][0]==0 and bingo[1][1]==0 and bingo[2][2]==0){
            ans=1;
        }
    if (bingo[2][0]==0 and bingo[1][1]==0 and bingo[0][2]==0){
            ans=1;
        }
    if(ans==0){
        cout << "No" << endl;

    }
    else {
        cout << "Yes" << endl;
    }
    return 0;
}

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

int dp[3][100'000], cost[3][100'000];

int recurse(int i, int j) {
	int& state = dp[i][j];
  	if(state != -1) return state;
  	if(j == 0) return state = cost[i][j];
  	int x, y;
  	switch(i) {
      case 0: x = 1, y = 2;
        break;
      case 1: x = 0, y = 2;
        break;
      default: x = 0, y = 1;
   	}
  	state = max(recurse(x, j - 1), recurse(y, j - 1)) + cost[i][j];
    return state;
}

int main() {
	int n; cin >> n;
  	for(int i = 0; i < n; ++i) cin >> cost[0][i] >> cost[1][i] >> cost[2][i];
  	memset(dp, -1, sizeof dp);
  	cout << max({recurse(0, n - 1), recurse(1, n - 1), recurse(2, n - 1)}) << endl;
	return 0;
}

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

int main(){
  char s[100006];
  int gcnt = 0;
  int pcnt = 0;
  int i,n;

  scanf("%s", s);
  n = strlen(s);

  for(i = 0;i < n;i++){
    if(s[i] == 'g') gcnt++;

    else pcnt++;
  }

  int r;
  if(gcnt >= pcnt){
    r = gcnt - pcnt;
    printf("%d\n", r/2);
  }

  else {
    r = pcnt - gcnt;

    printf("%d\n", -r/2 - 1);
  }

  return 0;
}

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

array<pair<int, int>, 4> dirs = { make_pair(0, -1), { -1, 0 }, { 1, 0 }, { 0, 1 } };

struct pos_t {
    int x;
    int y;
    int cost;
};

ll solve_maze(vector<string> Sss, int start_x, int start_y, ll H, ll W)
{
    queue<pos_t> que;
    que.push({ start_x, start_y, 0 });
    Sss[start_y][start_x] = 'q'; // キュー登録済みマーク
    int max_cost = 0;
    while (!que.empty()) {
        auto pos = que.front();
        que.pop();
        max_cost = max(pos.cost, max_cost);
        for (auto&& d : dirs) {
            int nx = pos.x + d.first;
            int ny = pos.y + d.second;
            if (Sss[ny][nx] == '.') {
                que.push({ nx, ny, pos.cost + 1 });
                Sss[ny][nx] = 'q'; // キュー登録済みマーク
            }
        }
        // 探索済みマーク
        Sss[pos.y][pos.x] = '*';
    }

    return max_cost;
}

void main_()
{
    ll H, W;
    cin >> H >> W;
    vector<string> Sss;
    Sss.emplace_back(W + 2, '#');
    for (ll i = 0; i < H; ++i) {
        string s;
        cin >> s;
        Sss.push_back('#' + s + '#');
    }
    Sss.emplace_back(W + 2, '#');

    ll ans = 0;
    for (ll i = 1; i <= H; ++i) {
        for (ll j = 1; j <= W; ++j) {
            if (Sss[i][j] == '.') {
                ans = max(ans, solve_maze(Sss, j, i, H, W));
            }
        }
    }
    cout << ans << endl;
}
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
  int h,w;
  int kesu_width_kazu = 0;
  int kesu_height_kazu = 0;

  cin >> h >> w;
  int kesu_height[h];
  int kesu_width[w];
  string str[h];
  for(int i = 0; h > i; i++){
    cin >> str[i];
  }
  //横から
  for(int i = 0; h > i; i++){
    bool kesu = true;
    for(int j = 0; w > j; j++){
      if(str[i].at(j) == '#'){
        kesu = false;
        break;
      }
    }
    if(kesu){
      kesu_height[kesu_height_kazu] = i;
      kesu_height_kazu++;
    }
  }
  //縦から
  for(int i = 0; w > i; i++){
    bool kesu = true;
    for(int j = 0; h > j; j++){
      if(str[j].at(i) == '#'){
        kesu = false;
        break;
      }
    }
    if(kesu){
      kesu_width[kesu_width_kazu] = i;
      kesu_width_kazu++;
    }
  }
  for(int i = 0; h > i; i++){
    bool continu = false;
    for(int j = 0; kesu_height_kazu > j; j++){
      if(kesu_height[j] == i){
        continu = true;
      }
    }
    if(continu) continue;
    for(int j = 0; w > j; j++){
      continu = false;
      for(int k = 0; kesu_width_kazu > k; k++){
        if(kesu_width[k] == j) continu = true;
      }
      if(continu) continue;
      cout << str[i].at(j);
    }
    cout << endl;
  }
  return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,a,b) for(int i =(a);i<(b);i++)
#define REP(i,n) for(int i=0;i<(n);i++)
#define REPm(i,n) for(int i=(n)-1;i>=0;i--)
#define REP1(i,n) for(int i=1;i<=(n);i++)
typedef long long ll;
#define MAX_N 100000
bool isP[MAX_N+1];
int ans[MAX_N+1];
int main(){
    int Q;
    cin >> Q;
    isP[2] =true;
    for(int i=3;i<=100000;i+=2){
        bool flag = true;
        for(int j=3;j*j<=i;j+=2){
            if(i%j == 0){
                flag = false;
                break;
            }
        }
        isP[i] = flag;
        if(isP[i] && isP[(i+1)/2]) ans[i] = 1;
    }
    for(int i=3;i<=100000;i++) ans[i] += ans[i-1];
    REP(i,Q){
        int l,r;
        cin >> l >> r;
        cout << ans[r] - ans[l-1] << endl;
    }
    return 0;
}


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

int main(){
    
    ll a,v; 
    cin >> a >> v;
    ll b,w;
    cin >> b >> w;
    ll t;
    cin >> t;
    ll d = abs(a-b);
    ll d2 = (v-w)*t;
    puts(d<=d2?"YES":"NO");
}


Measured memory_bytes: 3584
from fractions import gcd
n, start = map(int, input().split())
x = list(map(int, input().split()))

x.append(start)
x.sort()

distance = []
for i in range(n):
    dis = abs(x[i+1] - x[i])
    distance.append(dis)
if len(distance) == 1:
    D = distance[0]
else:
    D = gcd(distance[0], distance[1])
    for i in range(2, n):
        D = gcd(D, distance[i])
print(D)

Measured memory_bytes: 88596
//的場梨沙★担当
//結城晴★副担当
//日野茜★副担当
#include <vector>
#include <list>
#include <map>
#include <climits>
#include <set>
#include <unordered_set>
#include <unordered_map>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string.h>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <random>
#include <cctype>
#include <complex>
#include <regex>
#include <unordered_map>
#include <string>
#include <algorithm>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <iomanip>
#include <iostream>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <stdio.h>


using namespace std;

int main(void) {
    double R;
    cin>>R;

    double ans=2*3.14159264*R;

    cout<<ans<<endl;


}


Measured memory_bytes: 3796
#include <stdio.h>
#include <stdlib.h>

void shuffle(int *card,int p,int c);

int main(void){
	int i,j,n,r,p,c;
	int *card;
	
	while(1){
		scanf("%d %d",&n,&r);
		if((n == 0) && (r == 0)){
			break;
		}
		card = (int *)calloc(n,sizeof(int));
		if(card == NULL){
			printf("メモリが確保できません\n");
			return -1;
		}
		for(i = 0;i < n; i++){
			card[i] = n - i;
		}
		for(i = 0;i < r; i++){
			scanf("%d %d",&p,&c);
			shuffle(card,p,c);
		}

		printf("%d\n",card[0]);
		free(card);
	}
	return 0;
}

void shuffle(int *card,int p,int c){
	int box[50],i;
	for(i = 0; i < c; i++){
		box[i] = card[p + i - 1];
	}
	for(i = 0; i < p; i++){
		card[p - 2 + c - i] = card[p - 2 - i];
	}
	for(i = 0; i < c; i++){
		card[i] = box[i];
	}
}

Measured memory_bytes: 612
n = int(input())
nums = list(map(int, input().split()))

# これ直前に解いた
# 重複している=取り除かなきゃいけない枚数の2の倍数切り上げ。

nums.sort()
sequential = 1
before = nums[0]
dup = 0
for i in nums[1:]:
    if i == before:
        sequential += 1
    else:
        dup += sequential - 1
        sequential = 1
    before = i

dup += sequential - 1

print(n - (dup + 1) // 2 * 2)


Measured memory_bytes: 14396
#include<stdio.h>
#include<string.h>
#include <math.h>
int main(void)
{
	double a,s,d,f,g,h,i,j,z;
	scanf("%lf %lf %lf %lf",&a,&s,&d,&f);
	h=s-f;
	g=a-d;
	z=sqrt(h*h+g*g);
	printf("%lf\n",z);
	return 0;
}

Measured memory_bytes: 2752
//
// Created by tac on 2016/10/24.
//

#include <cmath>
#include <cstdlib>
#include <iostream>

int main() {
    int n;
    int r;
    int min = -1;
    int max_diff = -1 * 1000000001;

    std::cin >> n;
    std::cin >> min;
    for (int i = 1; i < n; ++i) {
        std::cin >> r;
        max_diff = std::max(max_diff, r - min);
        min = std::min(min, r);
    }
    std::cout << max_diff << std::endl;
    return EXIT_SUCCESS;
}

Measured memory_bytes: 3100
#include <bits/stdc++.h>
using namespace std;
#define rep0(i,n) for(ll (i) = 0; (i) < (n); ++(i))
#define rrep0(i,n) for(ll (i) = (n) - 1; (i) >= 0; --(i))
#define rep1(i,n) for(ll (i) = 1; (i) < (n); ++(i))
#define rrep1(i,n) for(ll (i) = (n) - 1; (i) >= 1; --(i))
#define nfor(i,a,b) for(ll (i) = (a); (i) < (b); ++(i))
#define ll long long
#define mod (1000000007)
#define YES cout << "YES" << endl;
#define Yes cout << "Yes" << endl;
#define yes cout << "yes" << endl;
#define NO cout << "NO" << endl;
#define No cout << "No" << endl;
#define no cout << "no" << endl;
#define all(x) (x).begin(),(x).end()

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

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

ll fac(ll n){
    ll t = 1;
    rep1(i, n + 1)t *= i;
    return t;
}

int main()
{
    ll n,t,t1,t2,ans = 0;
    cin >> n >> t >> t1;
    if (n == 1) {
        cout << t << endl;
        return 0;
    }
    rep1(i, n){
        cin >> t2;
        if (t2 - t1 >= t) {
            ans += t;
        }else{
            ans += t2 - t1;
        }
        t1 = t2;
    }
    cout << ans + t << endl;
    return 0;
}


Measured memory_bytes: 256
#最初に入力される情報を整理する
str_input_list = input().rstrip().split(' ')

int_input_list = []
for a in str_input_list:
    int_input_list.append(int(a))

amount = int_input_list[0]
length = int_input_list[1]

#文字列を受け取りリストに格納
mojiretu_list = []
for a in range(amount):
    mojiretu_list.append(input())


#文字列を小さい順に並べ、結合
sorted_list = sorted(mojiretu_list)
min_mojiretu = ''
for a in range(amount):
    min_mojiretu += sorted_list[a]

#出力
print(min_mojiretu)
print()

Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
#include <ctime>
#include <tuple>
#include <bitset>
using namespace std;

/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long ll;

#define fi first
#define se second

using Graph = vector<vector<int>>;

void dfs(vector<vector<int>> &ab, vector<bool> &visited, int index, int n)
{
    for (auto v : ab[index])
    {
        if (visited[v] == false)
        {
            visited[v] = true;
            dfs(ab, visited, v, n);
        }
    }
}

int main()
{
    int n;
    cin >> n;
    map<ll, ll> m1;
    map<ll, ll> m2;
    for (ll i = 0; i < n; i++)
    {
        ll a;
        cin >> a;
        if (m1.count(i + 1 + a) == 0)
        {
            m1[i + 1 + a] = 1;
        }
        else
        {
            m1[i + 1 + a] += 1;
        }
        if (m2.count(i + 1 - a) == 0)
        {
            m2[i + 1 - a] = 1;
        }
        else
        {
            m2[i + 1 - a] += 1;
        }
    }
    ll ans = 0;
    for (auto itr = m1.begin(); itr != m1.end(); itr++)
    {
        ans += (itr->second) * m2[itr->first];
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 37788
#include <algorithm>
#include <climits>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <vector>

#define int long long int
constexpr int INF = std::numeric_limits<int>::max();
constexpr int NINF = std::numeric_limits<int>::min();
using namespace std;

void solve() {
  int A, B;
  cin >> A >> B;

  int ans = 0;
  for (int i= 1; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
       for (int k = 0; k < 10; k++) {
         int x = 10000*i + 1000*j + 100*k + 10*j + i;
         if (A <= x && x <= B) {
           ans++;
         }
       }
    }
  }
  cout << ans << endl;
}

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


Measured memory_bytes: 256