akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
#include <math.h>
#define _GLIBCXX_DEBUG
#define _LIBCPP_DEBUG 0

using namespace std;
#define ll long long
#define rep(i,n) for (int i = 0; i < n; i++)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define MOD (1000000007)
#define vi vector<int>
#define vl vector<ll>
#define vb vector<bool>
#define vvi vector<vi>
#define vvl vector<vl>
#define pii pair<int, int>
#define pli pair<ll, int>
#define pb push_back

#define mp make_pair
#define all(a) (a).begin(),(a).end()

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

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

ll keta(ll n){
  string s = to_string(n);
  ll num = s.size();
  return num;
}

const ll INF = 1LL << 60;

const int dh[4] = {1,0,-1,0};
const int dw[4] = {0,1,0,-1};

struct Edge{
  int to;
  int weight;
  Edge(int t, int w) : to(t), weight(w){}
};
using Graph = vector<vector<Edge>>;
using P = pair<ll, int>;

const int MAX = 5e5;

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(ll n, ll k){
  if(n >= MAX){
    ll tmp = 1;
    rep(i,k){
      tmp *= (n-i);
      tmp %= MOD;
    }
    return tmp*finv[k]%MOD;
  }

  if (n < k) return 0;
  if (n < 0 || k < 0) return 0;
  return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

ll POW(ll x, ll n){
  ll ret = 1;
  while(0 < n){
    if(n%2 == 0){
      x = x*x%MOD;
      n = n >> 1;
    }
    else{
      ret = ret*x%MOD;
      n--;
    }
  }
  return ret;
}

int main(){
  int A,B,C,D,E,F; cin >> A>>B>>C>>D>>E>>F;
  int ans1,ans2;
  double n = -1.0;
  rep(a,F/(100*A)+1) rep(b,F/(100*B)+1) rep(c,F/C+1) rep(d,F/D+1) {
    int W = 100*A*a + 100*B*b;
    int S = C*c + D*d;
    if(W == 0 || W+S > F || 100*S > W*E) continue;
    double n_tmp = double(S)/(W+S);
    if(chmax(n,n_tmp)){
      ans1 = W+S;
      ans2 = S;
    }
  }

  printf("%d %d\n", ans1, ans2);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=0;i<int(n);i++)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;

template<class T> void read(T &x){
	int f=0; x=0; char ch=getchar();
	for(;!isdigit(ch);ch=getchar()) f|=(ch=='-');
	for(;isdigit(ch);ch=getchar()) x=x*10+ch-'0';
	if(f) x=-x;
}

const int N=100005;
ll f[N],g[N],n,ans,r,p;

int main(){
	read(n);
	f[0]=1;
	rep(i,0,n){
		read(r);
		while(p<=i&&r){
			if(f[p]>r){
				f[p]-=r;
				g[p+1]+=r;
				g[i+1]-=r;
				ans+=r*(i-p+1);
				r=0;
			}
			else{
				r-=f[p];
				g[p+1]+=f[p];
				g[i+1]-=f[p];
				ans+=f[p]*(i-p+1);
				f[p]=0;
				p++;
				g[p]+=g[p-1];
				f[p]=g[p];
			}
		}
		if(r){
			puts("-1");
			return 0;
		}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 4960
#include <cstdio>
using namespace std;

long long int arr[300000];
long long int ar[300000];

int main()
{
	long long int n,a;
	scanf("%lld",&n);
	
	for(long long int i=0;i<n;i++)
	{
		scanf("%lld",&arr[i]);
		ar[arr[i]]++;
	}

	long long int cevap=0;
	for(long long int i=1;i<=n;i++)
	{
		if(ar[i]>1)
		{
			cevap+=ar[i]*(ar[i]-1)/2;
		}
	}

	for(long long int i=0;i<n;i++)
	{
		printf("%lld\n",cevap-ar[arr[i]]*(ar[arr[i]]-1)/2+(ar[arr[i]]-1)*(ar[arr[i]]-2)/2);
	}
}

Measured memory_bytes: 5120
//apc001_a.cpp
//Sun Sep 30 18:19:13 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
#include <math.h>
#define INTINF 2147483647
#define LLINF 9223372036854775807
using namespace std;
using ll=long long;
typedef pair<int,int> P;

int main(){
	int x,y;
	cin >> x >> y;
	int flag = 0;
	if (x%y==0){
		cout << "-1" << endl;
	}else {
		cout << x << endl;
	}

}

Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <iomanip>
#include <cstdio>
#include <cassert>
#include <algorithm>
#include <iterator>
#include <string>
#include <vector>
#include <list>
#include <deque>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <tuple>
#include <queue>
#include <stack>
#include <functional>
#include <utility>
#include <complex>
#include <bitset>
#include <numeric>
#include <random>
using namespace std;

#define REP(i,n) for(int (i)=0; (i)<(n) ;++(i))
#define REPN(i,a,n) FOR((i),(a),(a)+(n))
#define FOR(i,a,b) for(int (i)=(a); (i)<(b) ;++(i))
#define PB push_back
#define MP make_pair
#define SE second
#define FI first
#define DBG(a) cerr<<(a)<<endl;
#define ALL(v) (v).begin(),(v).end()
typedef long long LL;  typedef pair<LL, LL> PLL; typedef vector<LL> VLL;
const LL LINF=334ll<<53; const int INF=15<<26; const LL MOD=1E9+7;

int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    LL x,a[100010]={},ans=0;
    cin >> x;
    REP(i,n)cin >> a[i];
    FOR(i,1,n){
        LL dif=a[i-1]+a[i]-x;
        if(dif>0){
            ans+=dif;
            if(dif<=a[i])a[i]-=dif;
            else{
                a[i-1]=x;
                a[i]=0;
            }
        }
    }
    cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 1024
import math
n = int(input())
a = list(map(int,input().split()))

def gcdall(a):
	rt = 0
	for i in a:
		rt = math.gcd(rt, i)
		if rt == 1:
			break
	return rt

#GCD(ai, aj)=1 がすべてとは, aの中の素因数に共通のものがないということ

def makediv(n):
	lower_divisors , upper_divisors = [], []
	i = 1
	while i*i <= n:
		if n % i == 0:
			lower_divisors.append(i)
			if i != n // i:
				upper_divisors.append(n//i)
		i += 1
	return lower_divisors + upper_divisors[::-1]

def sieve(n):
	ret = set()
	divlis = [-1]*(n+1)  # 何で割ったかのリスト(初期値は-1)
	flag = [True]*(n+1)
	flag[0] = False
	flag[1] = False
	ind = 2
	while ind <= n:
		if flag[ind]:
			ret.add(ind)
			ind2 = ind**2
			while ind2 <= n:
				flag[ind2] = False
				divlis[ind2] = ind
				ind2 += ind
		ind += 1
	#何で割ったかのリストを取得したいとき, divlisも出力する
	return ret

targ = sieve(n)

def pairwise(a):
	t = set()
	mode = True
	for i in a:
		if i == 1:
			continue
		if i in targ:
			if i in t:
				mode = False
				break
			else:
				t.add(i)
		else:
			k = makediv(i)
			for j in k:
				if j == 1:
					continue
				if j not in t:
					t.add(j)
				else:
					mode = False
					break
		if not mode:
			break
	return mode

if gcdall(a) == 1:
	if pairwise(a):
		print("pairwise coprime")
	else:
		print("setwise coprime")
else:
	print("not coprime")

Measured memory_bytes: 212552
#include <cmath>
#include <iostream>
#include <vector>
#include <utility>
#include <unordered_map>

using namespace std;

int Root(vector<int>& parents, int a) {
  if (parents[a] == a) {
    return a;
  }
  return parents[a] = Root(parents, parents[a]);
}

void Union(vector<int>& parents, int a, int b) {
  a = Root(parents, a);
  b = Root(parents, b);
  if (a == b) {
    return;
  }
  parents[a] = b;
}

bool Same(vector<int>& parents, int a, int b) {
  return parents[a] == parents[b];
}

int main() {
  int N, M, K;
  cin >> N >> M >> K;
  vector<int> friends(N+1);
  for (size_t n = 0; n <= N; ++n) {
    friends[n] = n;
  }
  vector<unordered_map<int, bool>> blocks(N+1);
  vector<int> friend_num(N+1);
  for (size_t m = 0; m < M; ++m) {
    int a, b;
    cin >> a >> b;
    Union(friends, a, b);
    ++friend_num[a];
    ++friend_num[b];
  }
  for (size_t k = 0; k < K; ++k) {
    int a, b;
    cin >> a >> b;
    blocks[a][b] = true;
    blocks[b][a] = true;
  }
  unordered_map<int, int> ranks;
  for (size_t i = 1; i <= N; ++i) {
    int root = Root(friends, i);
    ++ranks[root];
  }

  for (size_t n = 1; n <= N; ++n) {
    if (n != 1) cout << " ";
    int cand = ranks[Root(friends, n)] - friend_num[n] - 1;
    if (blocks[n].size()) {
      for (auto p : blocks[n]) {
        if (Same(friends, n, p.first)) {
          --cand;
        }
      }
    }
    cout << cand;
  }
  cout << endl;
  return 0; 
}


Measured memory_bytes: 19108
#include<iostream>

int main()
{
	int money = 100000;

	int n;

	std::cin >> n;

	for(int i=0;i<n;++i)
	{
		money*=1.05;

		if(money%1000 != 0)
		{
			money/=1000;
			++money;
			money*=1000;
		}
	}

	std::cout << money << '\n';
}

Measured memory_bytes: 1160
N = int(input())
lst = []
for i in range(N):
    lst.append([int(x) for x in input().split()])
dp = [[0] * 3 for i in range(N + 1)]
for i in range(N):
    dp[i + 1][0] = max(dp[i][1], dp[i][2]) + lst[i][0]
    dp[i + 1][1] = max(dp[i][0], dp[i][2]) + lst[i][1]
    dp[i + 1][2] = max(dp[i][1], dp[i][0]) + lst[i][2]

print(max(dp[-1]))


Measured memory_bytes: 44128
#include <stdio.h>
#include <cstring>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <string>
using namespace std;
map<int , int>mp;
int main(){
    int n,k, d;
    cin>>n>>k;
    mp.clear();
    for(int i=0; i<k; i++){
        cin>>d;
        int who;
        for(int j=0; j<d; j++){
            cin>>who;
            mp[who]++;
        }
    }
    int res = 0;
    for(int i=1; i<=n; i++){
        if(mp[i] == 0)++res;
    }
    cout<<res<<endl;
    return 0;
}


Measured memory_bytes: 3636
#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, bytes) => {
        read_value!($next, String).into_bytes()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_imports)]
use std::cmp::{max, min};
#[allow(unused_imports)]
use std::collections::{BinaryHeap, HashMap};

#[allow(dead_code)]
type Graph = Vec<Vec<usize>>;

pub fn gcd(a: u64, b: u64) -> u64 {
    if b == 0 {
        a
    } else {
        gcd(b, a % b)
    }
}

fn main() {
    input! {
        a: u64,
        b: u64,
    }

    let mut g = gcd(a, b);

    let mut ans = 1;
    for i in 2..g {
        if i * i > g {
            break;
        }
        if g % i == 0 {
            ans += 1;
            while g % i == 0 {
                g /= i as u64;
            }
        }
    }

    // todo

    if g != 1 {
        ans += 1;
    }

    println!("{}", ans);
}


Measured memory_bytes: 4352
n, w = map(int, input().split())
things = []
things.append([0,0])
things += [list(map(int, input().split())) for _ in range(n)]

dp = [[0 for _ in range(w + 1)] for _ in range(n + 1)]

def do_dp():
  for i,thing in enumerate(things):
    dp_1 = dp[i-1]
    for j in range(1, w + 1):      
      dp[i][j] = dp_1[j-thing[0]] + thing[1]  if (j - thing[0]) >= 0 else dp_1[j]
      dp[i][j] = max(dp[i][j], dp_1[j])

do_dp()
print(dp[n][w])


Measured memory_bytes: 171400
#include <algorithm>
#include <cassert>
#include <deque>
#include <functional>
#include <iostream>
#include <iterator>
#include <limits>
#include <map>
#include <set>
#include <string>
#include <tuple>
#include <utility>
#include <vector>

using namespace std;

bool att(long A, long B, const vector<long>& v, long rounds)
{
    long sub = rounds * B;
    long ex = A - B;

    long r = 0;
    for (long x : v) {
        if (x <= sub)
            break;
        r += (x - sub + ex - 1) / ex;
    }
    return r <= rounds;
}

int main()
{
    int N;
    long A, B;
    cin >> N >> A >> B;

    vector<long> v(N);
    for (int i = 0; i < N; ++i)
        cin >> v[i];

    sort(v.begin(), v.end(), greater<long>());

    long ub = v[0] / B + 1;
    long lb = 0;

    assert(att(A, B, v, ub));
    assert(!att(A, B, v, lb));

    while (ub > lb + 1) {
        long mid = (ub + lb) / 2;
        if (att(A, B, v, mid)) {
            ub = mid;
        } else {
            lb = mid;
        }
    }

    cout << ub << '\n';

    return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#define DATA_SIZE 1001

using namespace std;

int lcs(int dp[][DATA_SIZE], string x, string y){
    int xl = x.size();
    int yl = y.size();
    
    for(int i = 1; i <= xl; i++){
        for(int j = 1; j <= yl; j++){
            if(x[i-1] == y[j-1]){ dp[i][j] = dp[i-1][j-1] + 1; }
            else{ dp[i][j] = max(dp[i-1][j], dp[i][j-1]); }
        }
    }

    return dp[xl][yl];
}

int main(){
    int q, dp[DATA_SIZE][DATA_SIZE] = {};
    string X, Y;

    cin >> q;
    for(int i = 0; i < q; i++){
        cin >> X >> Y;
        cout << lcs(dp, X, Y) << endl;
    }

    return 0;
}


Measured memory_bytes: 7128
#include <iostream>
#include <iomanip>
#include <string>
#include <algorithm>
#include <math.h>
using namespace std;
int main() {
	long long int a, b, c, n;
	cin >> n;
	for (int i = 3500; i > 0; i--) {
		for (int j = 1; j <= 3500; j++) {
			a = n*i*j;
			b = 4*i*j - n*i - n*j;
			if (a%b == 0 && b > 0) {
				cout << i << " " << j << " " << a / b << endl;
				return 0;
			}
		}
	}
}

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

ll qpow(ll a, ll b) {
	ll ret = 1;
	while (b) {
		if (b & 1) ret *= a;
		a *= a;
		b >>= 1;
	}
	return ret;
}

int main() {
	ll n,k;
	while (cin >> n >> k) {
		ll ans = 0;
		while (qpow(k,ans) <= n) ans++;
		cout << ans << endl;
	}
}

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

#define F first
#define S second
#define PB push_back

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;
typedef priority_queue<int> HEAP;
typedef priority_queue<int, vector<int>, greater<int> > RHEAP;

const int N = 1010, M = 1 << 12, INF = 0x3f3f3f3f;

int n, m;
int a[N], b[N];
int f[N][M];

int main()
{
	cin >> n >> m;
	for (int i = 1; i <= m; i ++ )
	{
		int k;
		cin >> a[i] >> k;
		for (int j = 0; j < k; j ++ )
		{
			int t;
			cin >> t;
			b[i] += 1 << (t - 1);
		}
	}
	
	memset(f, 0x3f, sizeof f);
	f[0][0] = 0;
	for (int i = 1; i <= m; i ++ )
	{
		memcpy(f[i], f[i - 1], sizeof f[i]);
		for (int j = 0; j < 1 << n; j ++ )
		{
			int &t = f[i][j | b[i]];
			t = min(t, min(f[i - 1][j | b[i]], f[i - 1][j] + a[i]));
		}
	}
		
	int res = f[m][(1 << n) - 1];
	if (res == INF) puts("-1");
	else cout << res << endl;
	return 0;
}

Measured memory_bytes: 16384
#include <stdio.h>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <queue>
#include <stack>
#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>
#include <functional>
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
typedef vector<int> vint;
typedef vector<vector<int>> v2int;
typedef vector<ll> vll;
typedef vector<vector<ll>> v2ll;
typedef list<int> liint;
typedef pair<int, int> pint;
const int INF = int(2e9);
const ll LINF = ll(2e9) * ll(2e9);
#define rep(i, n) REP(i, 0, n)
#define ALL(v) v.begin(), v.end()
#define MSG(a) cout << #a << " " << a << endl;
#define REP(i, x, n) for(int i = x; i < n; i++)
template<class T, class C> void chmax(T& a, C b) { a > b ? : a = b; }
template<class T, class C> void chmin(T& a, C b) { a < b ? : a = b; }



int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N, X, Y;
    cin >> N >> X >> Y;
    
    v2int ans(N + 1, vint(N + 1, 0));
    REP(i, 1, N + 1) {
        REP(j, 1, N + 1) {
            int i_j = abs(i - j);

            int i_X_Y_j = abs(i - X) + 1 + abs(j - Y);
            int i_Y_X_j = abs(i - Y) + 1 + abs(j - X);
            ans[i][j] = min(i_Y_X_j, min(i_j, i_X_Y_j));
            //if (i <= X && j >= Y) {
            //    ans[i][j] -= (Y - X);
            //    ans[i][j] += 1;
            //}

        }
    }
    vint ansK(N);
    REP(i, 1, N + 1) {
        REP(j, i + 1, N + 1) {
            ansK[ans[i][j]]++;
        }
    }
    REP(i, 1, N) {
        cout << ansK[i] << endl;
    }
    return 0;
}

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

#define ll long long
#define ar array

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

	int a, b;
	cin >> a >> b;
	for(int i=1; i<=1e4; ++i) {
		int a2=i*8/100, b2=i*10/100;
		if(a2==a&&b2==b) {
			cout << i;
			return 0;
		}
	}
	cout << -1;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int box[200000];
  int N,max,i,v,min;
  scanf("%d",&N);
  for(i=0;i<N;i++){
    scanf("%d",&box[i]);
  }
  
  max=-10000000000;
  min=box[0];
 
    for(i=1;i<N;i++){
      
       v=box[i]-min;
      if(v>max) max=v;
       if(min>box[i]) min=box[i]; 
    }
 
  printf("%d\n",max);
  return 0;
}

Measured memory_bytes: 1804
/******************************************************************************

                              Online C++ Compiler.
               Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.

*******************************************************************************/

#include <iostream>

using namespace std;

int main()
{
    int a,b,c;
    cin>>a>>b>>c;
    if(a==b && b!=c)
    cout<<"Yes";
    else if(b==c && b!=a)
    cout<<"Yes";
    else if(a==c && b!=a)
    cout<<"Yes";
    else
    cout<<"No";

    return 0;
}


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

using namespace std;
int n,a[205],h;
int main()
{
	cin>>n;
	for(int i=1;i<=n*2;i++)
	cin>>a[i];
	sort(a+1,a+1+n*2);
	for(int i=1;i<n*2;i+=2)
	h+=a[i];
	cout<<h<<"\n";
	
	return 0;
}

Measured memory_bytes: 256
def warshall_floyd(n, d):
    #d[i][j]: iからjへの最短距離
    for k in range(n):
        for i in range(n):
            for j in range(n):
                d[i][j] = min(d[i][j],d[i][k] + d[k][j])
    return d

h,w = map(int,input().split()) 

s = [float("inf") for i in range(h)]
for i in range(h):
    s[i] = list(input())

n = h*w

d = [[float("inf") for i in range(n)] for j in range(n)]
#d[u][v] : 辺uvのコスト(存在しないときはinf)

for i in range(n):
    d[i][i] = 0

for y in range(h):
    for x in range(w):
        if s[y][x] == '#':
            continue
        if y-1 >= 0 and s[y-1][x] != '#':
            d[y*w + x][(y-1)*w+x] = 1
        if y+1 < h and s[y+1][x] != '#':
            d[y*w + x][(y+1)*w+x] = 1
        if x-1 >= 0 and s[y][x-1] != '#':
            d[y*w+x][y*w+x-1] = 1
        if x+1 < w and s[y][x+1] != '#':
            d[y*w+x][y*w+x+1] = 1

d = warshall_floyd(n, d)

ans = 0

for i in range(n):
    for j in range(n):
        if d[i][j] != float("inf"):
            ans = max(ans, d[i][j])

print(ans)

Measured memory_bytes: 135560
import sys
import math
from collections import defaultdict

sys.setrecursionlimit(10**7)
def input():
    return sys.stdin.readline()[:-1]

mod = 10**9 + 7

def I(): return int(input())
def II(): return map(int, input().split())
def III(): return list(map(int, input().split()))
def Line(N,num):
    if N<=0:
        return [[]]*num
    elif num==1:
        return [I() for _ in range(N)]
    else:
        read_all = [tuple(II()) for _ in range(N)]
        return map(list, zip(*read_all))

#################

N = I()
A = []
for i in range(N):
    A.append(III())

l = 0
for i in range(N):
    for j in range(i+1,N):
        flag = True
        for k in range(N):
            if k==i or k==j:
                continue
            now = A[i][k] + A[k][j]
            if now < A[i][j]:
                print(-1)
                exit()
            if now == A[i][j]:
                flag = False
        if flag:
            l += A[i][j]

print(l)

Measured memory_bytes: 43228
N, M = map(int,input().split())
AB = []
ans = 0
for i in range(N): AB.append(list(map(int,input().split())))
AB.sort()
for i in AB:
  if M >= i[1]: 
    ans += i[0] * i[1]
    M -= i[1]
  else: 
    ans += i[0] * M
    break
print(ans)    
    
                             

Measured memory_bytes: 60760
import sys
from math import factorial
from collections import Counter
from fractions import Fraction
import heapq, bisect, fractions
import math
import itertools
sys.setrecursionlimit(10 ** 5 + 10)
INF = 10**15 +5
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()))
MOD = 10**9 + 7

n = INT()
res = []
for i in range(n):
    s = input()
    res.append(s)
res = list(set(res))

print(len(res))

Measured memory_bytes: 107572
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <string>
#include <math.h>
#include <iomanip>
#include <limits>
#include <list>
#include <queue>
#include <tuple>
#include <map>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define INF (int)(1123456789)
#define LINF (long long int)(112345678901234567)

struct hoge{int a,b,c,d;};

int main(void){
	int h,w;
	vector< vector<int> > A;
	int a;
	cin>>h>>w;
	rep(i,h){
		A.push_back(vector<int>());
		rep(j,w){
			cin>>a;
			A[i].push_back(a);
		}
	}
	vector<hoge> ans;
	rep(i,h){
		int now,next;
		rep(j,w-1){
			if(i%2==0){
				now = j;
				next = j+1;
			}else{
				now = w-1-j;
				next = now - 1;
			}
			if(A[i][now]%2 == 1){
				A[i][next]++;
				hoge ho = {i+1,now+1,i+1,next+1};
				ans.push_back(ho);
			}

		}
		if(i == h-1) break;
		if(i%2 == 0){
			if(A[i][w-1]%2 == 1){
				A[i+1][w-1]++;
				hoge ho = {i+1,w-1+1,i+2,w-1+1};
				ans.push_back(ho);				
			}
		}else{
			if(A[i][0]%2 == 1){
				A[i+1][0]++;
				hoge ho = {i+1,0+1,i+2,0+1};
				ans.push_back(ho);				
			}
		}
	}
	cout<<ans.size()<<endl;
	rep(i,ans.size()){
		cout<<ans[i].a<<" "<<ans[i].b<<" "<<ans[i].c<<" "<<ans[i].d<<endl;
	}
	return 0;
}


Measured memory_bytes: 5232
#include <bits/stdc++.h>
#define pi pair<int, int>
#define l first
#define r second
#define pb push_back
#define all(x) x.begin(), x.end()
//#define DEBUG

using namespace std;

const int maxn = 2e5 + 1;

bool b[maxn], t[maxn], usd[maxn], hon[maxn];
int rm[maxn], n, m, val[maxn], pal[maxn];
vector<pi> g[maxn], f[maxn];
vector<int> cv, gv[maxn];
pi a[maxn], v[maxn];

int pst(bool x) {
    return (x ? -1 : 1);
}

void dfs0(int x, int pr = -1) {
    val[x] = 1;
    hon[x] = t[x];
    for (auto to : f[x]) {
        if (to.l == pr) continue;
        dfs0(to.l, x);
        hon[x] ^= hon[to.l];
    }
}

void dfs(int x, int pr = -1) {
    usd[x] = 1;
    for (auto to : f[x]) {
        if (to.l == pr) {
            if (hon[x]) cv.pb(to.r + 1);
            continue;
        }
        dfs(to.l, x);
    }
}

int p[maxn], sz[maxn], cnt[maxn];

int getp(int x) {
    if (p[x] == -1) return x;
    return (p[x] = getp(p[x]));
}

void unions(int x, int y) {
    x = getp(x); y = getp(y);
    if (x == y) return;
    if (sz[x] < sz[y]) swap(x, y);
    if (sz[x] == sz[y]) ++sz[x];
    p[y] = x; cnt[x] += cnt[y];
}

signed main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin >> n >> m;
    for (int i = 0; i < n; i++)
        cin >> a[i].l >> a[i].r;
    for (int i = 0; i < m; i++)
        cin >> v[i].l >> v[i].r;
  	sort(a, a + n);
  	b[n] = 0;
  	for (int i = 0; i < n; i++) {
        rm[i] = a[i].l;
        b[i] = a[i].r;
    }
  	for (int i = 0; i < m; i++) {
        v[i].l = (int)(lower_bound(rm, rm + n, v[i].l) - rm);
        v[i].r = (int)(upper_bound(rm, rm + n, v[i].r) - rm) - 1;
  	}
  	for (int i = 0; i <= n; i++) {
        p[i] = -1; sz[i] = 1;
        if (!b[i]) continue;
        t[i] ^= 1; t[i + 1] ^= 1;
  	}
  	for (int i = 0; i <= n; i++)
        cnt[i] = t[i];
    for (int i = 0; i < m; i++) {
        if (v[i].l > v[i].r) continue;
        g[v[i].l].pb({v[i].r + 1, i});
        g[v[i].r + 1].pb({v[i].l, i});
    }
    for (int i = 0; i <= n; i++) {
        for (auto to : g[i]) {
            if (getp(to.l) == getp(i))
                continue;
            f[i].pb({to.l, to.r});
            f[to.l].pb({i, to.r});
            unions(i, to.l);
        }
    }
    for (int i = 0; i <= n; i++) {
        if (cnt[getp(i)] % 2) {
            cout << -1; return 0;
        }
        if (t[i]) gv[getp(i)].pb(i);
    }
    for (int i = 0; i <= n; i++)
        if (!val[i]) dfs0(i);
    int ls = -1;
    for (int i = 0; i <= n; i++)
        if (!usd[i]) dfs(i);
    sort(all(cv));
    cout << cv.size() << '\n';
    for (auto gg : cv)
        cout << gg << ' ';
  	return 0;
}


Measured memory_bytes: 32252
#include <iostream>
#include <string>
using namespace std;
#include <algorithm>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <map>
#define MOD1 1000000007
#define MOD2 998244353
#define LIMIT1 200010
#define LIMIT2 500010
#define LIMIT3 1000010
#define INF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef long double ld;
typedef const void cv;
typedef pair<ll,ll> P;
#define rep(i,n) for((i)=0;(i)<(n);(i)++)
#define per(i,n) for((i)=(n)-1;(i)>=0;(i)--)
#define max(a,b) ((a)>(b) ? (a) : (b))
#define min(a,b) ((a)<(b) ? (a) : (b))
#define zt(a,b) (max((a),(b))-min((a),(b)))
#define setpre(n) fixed << setprecision(n)
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
#define sankaku(x) (((x)*((x)+1))/2)
int dx[8]={1,0,-1,0,1,-1,-1,1},dy[8]={0,1,0,-1,1,1,-1,-1};
int upint(cv *a, cv *b) { return *(int *)a < *(int *)b ? -1 : *(int *)a > *(int *)b ? 1 : 0; }
int downint(cv *a, cv *b) { return *(int *)a < *(int *)b ? 1 : *(int *)a > *(int *)b ? -1 : 0; }
int upchar(cv *left, cv *right) {return strcmp((char *)left,(char *)right);}
int downchar(cv *left, cv *right) {return strcmp((char *)right,(char *)left);}
ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1){
      res *= a; if(mod>=1) res %= mod;
    }
    a *= a; if(mod>=1) a %= mod;
    n >>= 1;
  }
  return res;
}
void initialize(){
  
}
int main(void){
  initialize();
  ll n,m,i,j,k,result=0,q;
  ll l,r,c,d;
  map<P,ll> dp;
  string s;
  
  cin >> n >> m >> q;
  rep(i,m){
    cin >> l >> r;
    dp[{l,r}]++;
  }
  for(i=1;i<=n;i++){
    for(j=1;j<=n;j++){
      dp[{i,j}] += dp[{i-1,j}]+dp[{i,j-1}]-dp[{i-1,j-1}];
    }
  }
  rep(i,q){
    cin >> c >> d;
    result = dp[{d,d}]-dp[{c-1,d}]-dp[{d,c-1}]+dp[{c-1,c-1}];
    cout << result << endl;
  }
  
  return 0;
}

Measured memory_bytes: 19308
#include <iostream>
#include <queue>
#include <vector>
#include <math.h>
#include <algorithm>
using namespace std;

int main(){
	vector<int> sum;
	int a, b;
	while (cin >> a >> b) sum.push_back(a + b);
	for_each(sum.begin(), sum.end(), [](int i) {
				if (i == 0) {
					cout << i << endl;
				} else {
					cout << static_cast<int>(log10(i)) + 1 << endl;
				}
			});
	return 0;
}

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

int main(void){
	int N, num_coin1;
	cin >> N;
	cin >> num_coin1;
	//cout << N << "," << num_coin1;
	int amari = N % 500; //あまりを比較
	if (amari <= num_coin1) {
		cout << "Yes" << endl;
	} else {
		cout << "No" << endl;
	}

	return 0;
}

Measured memory_bytes: 256
a,b = [int(x) for x in input().split()]

def gcd(a,b):
    while b:
        a,b = b, a%b
    return a

d = gcd(a,b)
pf = {}
for i in range(2, int(d**0.5)+1):
    while d%i == 0:
        pf[i] = pf.get(i,0)+1
        d//=i
if d>1:
    pf[d] = 1
P = list(pf.keys())
print(len(P)+1)

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

int main(void) {
	int A, B, C, D;
	cin >> A >> B >> C >> D;

	int l = A + B;
	int r = C + D;

	if (l > r)
		cout << "Left\n";
	else if (l == r)
		cout << "Balanced\n";
	else
		cout << "Right\n";

	return 0;
}


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

int main(){
    int n; cin >> n;
    int a[n], b[n], c[n];
    for (int i=0; i<n; i++){
        cin >> a[i] >> b[i] >> c[i];
    }

    int dpa[n], dpb[n], dpc[n];
    dpa[n-1] = a[n-1]; dpb[n-1] = b[n-1]; dpc[n-1] = c[n-1];
    for (int i=n-2; i>=0; i--){
        dpa[i] = max(dpb[i+1], dpc[i+1]) + a[i];
        dpb[i] = max(dpc[i+1], dpa[i+1]) + b[i];
        dpc[i] = max(dpa[i+1], dpb[i+1]) + c[i];
    }
    cout << max(dpa[0], max(dpb[0], dpc[0])) << endl;
    return 0;
}

Measured memory_bytes: 2560
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4,sse4.1,sse4.2,avx,tune=native")
#include <bits/stdc++.h>

#define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++)
#define rep(x,to) for(int (x)=0;(x)<(to);(x)++)
#define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--)
#define all(c) (c).begin(),(c).end()
#define sz(v) (int)(v).size()

using namespace std;
typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii;
const int MD = (int)1e9 + 7; typedef vector<ll> VL;
void dbg(){ cerr << "\n"; }  template <class T, class ...T2>
void dbg(const T& fst, const T2&...rst){ cerr << fst << ": "; dbg(rst...); }
template <class T> void amax(T& a,T b){ if(a>b) a=b;}


int main(){
	//cin.tie(0); ios_base::sync_with_stdio(false);
	int n, k;
	cin >>n  >>k;
	VI v(n);
	rep(i, n) cin >>v[i];
	ll ans = 0;
	rep(l, k+1) rep(r, k-l+1){
		if(r+l >n) continue;
		VL slc;
		rep(i, l) slc.push_back(v[i]);
		rep(i, r) slc.push_back(v[n-1-i]);
		ll sm = accumulate(all(slc), 0LL);
		sort(all(slc));
		rep(i, min(k-l-r, sz(slc))) {
			if(slc[i] >0) break;
			sm -= slc[i];
		}
		ans = max(ans , sm);
	}
	
	
	cout << ans <<"\n";
	return 0;
}


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


/// File input & output /////
#define fRead(x)        freopen("x.txt","r",stdin)
#define fWrite(x)       freopen ("x.txt","w",stdout)


#define ld              long double
#define ll              long long
#define ull             unsigned long long
#define ff              first
#define ss              second
#define pb              push_back
#define INF             2e16
#define PI              acos(-1.0)
#define mp              make_pair
#define pii             pair<int,int>
#define pll             pair<LL,LL>


#define min3(a,b,c)     min(a,min(b,c))
#define max3(a,b,c)     max(a,max(b,c))
#define min4(a,b,c,d)   min(a,min(b,min(c,d)))
#define max4(a,b,c,d)   max(a,max(b,max(c,d)))
#define SQR(a)          ((a)*(a))
#define FOR(i,a,b)      for(int i=a;i<=b;i++)
#define ROF(i,a,b)      for(int i=a;i>=b;i--)
#define REP(i,b)        for(int i=0;i<b;i++)
#define MEM(a,x)        memset(a,x,sizeof(a))
#define ABS(x)          ((x)<0?-(x):(x))

#define SORT(v)         sort(v.begin(),v.end())
#define REV(v)          reverse(v.begin(),v.end())


#define FASTIO        ios_base::sync_with_stdio(0);cin.tie(nullptr);




///..................Sort by second element in a pair in decending order............. ///
bool SortbySecDesc(const pair<long long,long long > &a, const pair<long long,long long > &b)
{
    return a.second>b.second;
}

///.........................first element of pair in descending order..........................//////
bool sortinrev(const pair<int,int> &a,
               const pair<int,int> &b)
{
       return (a.first > b.first);
}



///.............................................................TEMPLATE................................................./////

int main()
{
    FASTIO;

    ll a , b;

    cin >> a >> b;

    ll mid = (a+b)/2;

    if(abs(a-mid)==abs(b-mid))
    {
        cout << mid << endl;
    }
    else
    {
        cout << "IMPOSSIBLE" << endl;
    }





    return 0;
}



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

int main() {
    int n,m;
    cin >> n >> m;
    vector<int> h(n);
    vector<bool> ok(n,true);
    rep(i,n) cin >> h[i];
    rep(i,m) {
        int a,b;
        cin >> a >> b;
        --a; --b;
        if (h[a] <= h[b]) ok[a] = false;
        if (h[b] <= h[a]) ok[b] = false;
    }
    int ans = 0;
    rep(i,n) if (ok[i]) ans++;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3796
Imports System.Text
Imports System.String
Imports System
Imports System.Math

Module Module1

    Sub Main()
        Dim ans As String = ""
        Dim input As String() = Console.ReadLine.Split(" "c)

        Dim lakelength As Integer = CInt(input(0))
        Dim valuelength = CInt(input(1))

        Dim lakehouses(valuelength - 1) As Integer
        Dim tempstr As String() = Console.ReadLine.Split(" "c)

        Dim i As Integer = 0
        For Each str As String In tempstr
            lakehouses(i) = CInt(str)
            i = i + 1
        Next


        Dim house As Integer = lakehouses(0)
        Dim maxdistance As Integer = 0
        For Each tempint As Integer In lakehouses
            If tempint - house >= maxdistance Then
                maxdistance = tempint - house
            End If
            house = tempint
        Next

        If lakelength - lakehouses(lakehouses.Length - 1) + lakehouses(0) >= maxdistance Then
            maxdistance = lakelength - lakehouses(lakehouses.Length - 1) + lakehouses(0)
        End If

        Console.WriteLine(lakelength - maxdistance)
        Console.ReadKey()
    End Sub


End Module

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

using namespace std;


int main(void)
{
    int N;
    cin >> N;
    vector<int> A(N);
    double ans,rev_ans = 0;
    for(int i = 0; i<N; i++)
    {
        cin >> A.at(i);
    }
    sort(A.begin(),A.end());
    for(int i = N-1; i >= 0; i--)
    {
        rev_ans += 1.0/(double)A.at(i); 
    }
    
    ans = 1.0/rev_ans;

    printf("%f",ans);

}    

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define PI 3.14159265358979323846
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr long long INFL = numeric_limits<long long>::max() / 2;
constexpr int MOD = 1000000007;
using Graph = vector<vector<int>>;



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

    int A,B,K;
    cin >> A >> B >> K;
    int count=0;
    int x=min(A,B);
    int ans;
    for(int i=x;i>=0;i--){
        if(A%i==0 && B%i==0) count++;
        if(count==K) {
            ans=i;
            break;
        }
    }
    cout << ans << endl;


}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<ios>
#include<iomanip>
#include<algorithm>
#include<cmath>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<string>
#include<list>
#include<utility>
#include<tuple>
#include<map>
#include<unordered_map>
#include<complex>
using namespace std;
typedef long long llong;
llong gcd(llong a, llong b) {
	if (a < b) std::swap(a, b);
	if (a % b == 0) return b;
	else return gcd(b, a % b);
}
llong lcm(llong a, llong b) {
	llong g = gcd(a, b);
	return a * b / g;
}
//ここまで共通
int N;
double V[1000];
double ANS = 0;

int main() {
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> V[i];
	}
	sort(V, V + N);
	reverse(V, V + N);

	double D = 2;

	for (int i = 0; i < N; i++) {
		ANS += V[i] / D;
		if(i <= N - 3) D *= 2;
	}

	printf("%.9lf", ANS);
	return 0;
}

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

/*第二引数で第一引数を割ったときの切り上げの計算*/
long long int maxtime(long long int x, long long int y) {
	return(x + y - 1) / y;

}
/*最大公約数*/
long long int lcm(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;

	if (number2 > number1) {
		m = number2;
		n = number1;
	}
	long long int s = -1;
	while (s != 0) {
		s = m % n;
		m = n;
		n = s;
	}
	return m;
}
/*最大公倍数*/
long long int gcd(long long int number1, long long int number2) {
	long long int m = number1;
	long long int n = number2;
	return m / lcm(m, n) * n;
}
int dp[120][10200] = {};
int main() {
	int N;
	cin >> N;
	double T, A;
	cin >> T >> A;
	double abss = 10000000;
	int k = 0;
	for (int i = 0; i < N; i++) {
		double a;
		cin >> a;
		abss = min(abs(T-a*0.006-A), abss);
		if (abss == abs(T - a * 0.006 - A)) {
			k = i + 1;
		}
	}
	cout << k;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;

ll ceil(ll a, ll b) {  // a÷b以上の最小の整数
    if(b == 0) {
        return 0;
    }
    return (a+b-1)/b;
}

int main() {
    ll n, k;
    cin >> n >> k;
    
    vl a(n);
    ll left = 0;
    ll right = 0;
    rep(i, n) {
        cin >> a[i];
        chmax(right, a[i]);
    }

    // 判定問題「すべての丸太の長さをx以下にできるか？」を二分探索で解く
    while(right - left > 1) {
        ll x = (left + right)/2;
        ll cnt = 0;
        rep(i, n) {
            cnt += ceil(a[i], x) - 1;
        }
        if(cnt <= k) {
            right = x;
        }
        else {
            left = x;
        }
    }

    out(right);
    re0;
}

Measured memory_bytes: 4772
#include<iostream>
#include<queue>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cmath>
#include<functional>
#include<set>
using namespace std;
#define int long long
#define REP(i,n) for(int i=0;i<n;i++)
typedef pair<int, int>P;
int a[30];
signed main() {
	string s; cin >> s;
	for (int i = 0; i < s.size(); i++) {
		a[s[i] - 'a'] ++;
	}

	for (int i = 0; i < 26; i++) {
		if (a[i] == 0) {
			char a = 'a' + i;
			cout << s << a << endl;
			return 0;
		}
	}
	if (s == "zyxwvutsrqponmlkjihgfedcba") {
		cout << -1 << endl; return 0;
	}
	vector<char> sa;
	for (int i = s.size() - 1; i >= 1; i--) {
		sa.push_back(s[i]);
		if (s[i] > s[i - 1]) {
			sort(sa.begin(), sa.end());
			for (int j = 0; j < i - 1; j++)cout << s[j];
			for (int j = 0;j < sa.size(); j++) {
				if (sa[j] > s[i - 1]) {
					cout << sa[j]<<endl;
					return 0;
				}
			}
			return 0;
		}
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	long long A, V, B, W, T; 
	cin >> A >> V >> B >> W >> T; 
	if(V <= W) cout << "NO" << endl; 
	else if(abs(B - A) <= T * (V - W)) cout << "YES" << endl; 
	else cout << "NO" << endl;  
}

Measured memory_bytes: 3608
#include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>

using namespace std;

typedef long long ll;
// constexpr ll MOD = 998244353;
constexpr ll MOD = 1000000007;

// struct UnionFind {
//     vector<ll> par;
//     vector<ll> siz;
    
//     UnionFind(ll N): par(N), siz(N,1) {
//         for (ll i=0;i<N;i++) par[i] = i;
//     }

//     ll root(ll x) {
//         if (par[x] == x) return x;
//         else return par[x] = root(par[x]);
//     }

//     void unite(ll x, ll y) {
//         ll rx = root(x);
//         ll ry = root(y);
//         if (rx == ry) return;
//         // if (siz[rx] < siz[ry]) swap(rx,ry);
//         par[rx] = ry;
//         siz[ry] += siz[rx];
//     }

//     bool same(ll x, ll y) {
//         ll rx = root(x);
//         ll ry = root(y);
//         return rx == ry;
//     }

//     ll size(ll x) {
//         return siz[root(x)];
//     }
// };

//     vector<ll> par;
//     vector<ll> siz;
    
//     UnionFind(ll N): par(N), siz(N,1LL) {
//         for (ll i=0;i<N;i++) par[i] = i;
//     }

//     ll root(ll x) {
//         if (par[x] == x) return x;
//         else return par[x] = root(par[x]);
//     }

//     void unite(ll x, ll y) {
//         ll rx = root(x);
//         ll ry = root(y);
//         if (rx == ry) return;
//         par[rx] = ry;
//         siz[ry] += siz[rx];
//     }

//     bool same(ll x, ll y) {
//         ll rx = root(x);
//         ll ry = root(y);
//         return rx == ry;
//     }

//     ll size(ll x) {
//         return siz[root(x)];
//     }
// };

// void test(ll A, double B) {
//     ll C = B*100LL;
//     // cout << fixed << setprecision(2) << A*B << endl;
//     // cout << (A*C)/100LL << endl;
//     printf("%d, %d: ", (int)floor(A*B), (A*C)/100LL);
//     cout << boolalpha << (floor(A*B) == (A*C)/100LL) << endl;
// }


int main(void) {
    ll A;
    string B;
    cin >> A >> B;
    int C = (B[0]-'0')*100 + (B[2]-'0')*10 + (B[3]-'0');
    cout << (ll)(A*C/100LL)<< endl;
    // cout << (A*C)/100LL << endl;
    // for (int i=0;i<1000;i++) for (int j=0;j<1000;j++) {
    //     printf("%d, %.2f: ", i, j/100.0);
    //     test(i,j/100.0);
    // }


    return 0;
}


Measured memory_bytes: 3632
#include <iostream>
#include <algorithm>

using namespace std;

int k;
int t[2];
int d;


int main()
{

	cin >> t[0] >> t[1] >> k;
	
	sort(t, t + 2);

	for (int i = t[0]; i > 0; i--){
		if (t[0] % i == 0){
			if (t[1] % i == 0){
				d++;
				if (d == k){
					cout << i << endl;
				}
			}
		}
	}

	return 0;



}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
using i64 = int64_t;
using f80 = __float80;
static const int dy[4] = {0,1,0,-1}, dx[4] = {1,0,-1,0};
constexpr i64 INF = 1'010'000'000'000'000'017LL;
constexpr i64 MOD = 1'000'000'007LL;
#define _overload3(_1,_2,_3,name,...) name
#define repi(i,start,end) for(i64 i=(start);i<(end);++i)
#define _rep(i,n) repi(i,0,n)
#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(i,start,end) for(i64 i=(start);i>end;--i)
#define rng(a) a.begin(),a.end()
#define rrng(a) a.rbegin(),a.rend()
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define v(T) vector<T>
#define vv(T) v(v(T))
typedef v(i64) vi;
typedef v(vi) vvi;
template<class T> inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T> inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
template<typename T> ostream &operator<<(ostream &os, const vector< T > &v){
  rep(i,v.size()) os << v[i] << (i + 1 != v.size() ? " " : "");
  return os;
}
template<typename T> istream &operator>>(istream &is, vector< T > &v){
  for(T &in : v) is >> in;
  return is;
}

void Main()
{
  i64 X;
  cin >> X;
  rep(a, 400){
    rep(b,400) {
      if(a*a*a*a*a - b*b*b*b*b == X){
        cout << a << " " << b << "\n";
        return;
      }
      if(a*a*a*a*a + b*b*b*b*b == X){
        cout << a << " " << -1 * b << "\n";
        return;
      }
    }
  }
}

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

Measured memory_bytes: 3612
#define _USE_MATH_DEFINES
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <queue>
#include <stack>
#include <list>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <complex>
#include <cmath>
#include <numeric>
#include <bitset>
#include <functional>

using namespace std;

#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
  cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
  const char* comma = strchr(names + 1, ',');
  cerr.write(names, comma - names) << ": " << arg1 << " |";
  __f(comma + 1, args...);
}

typedef long long int64;
typedef pair<int, int> ii;
const int INF = 1 << 29;
const int MOD = 1e9 + 7;

const int N = 1e5 + 10;
vector<int> a[N];
bool leaf[N];
int deg[N];

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    int x, y;
    scanf("%d%d", &x, &y);
    --x; --y;
    a[x].push_back(y);
    a[y].push_back(x);
  }
  for (int i = 0; i < n; ++i) {
    leaf[i] = (a[i].size() == 1);
    // trace(i, leaf[i]);
  }
  for (int i = 0; i < n; ++i) {
    if (leaf[i]) continue;
    for (auto& j : a[i]) {
      if (leaf[j]) continue;
      ++deg[i];
    }
  }
  vector<int> A;
  bool found = false;
  for (int i = 0; i < n; ++i) {
    if (deg[i] == 1) A.push_back(i);
    if (deg[i] > 2) found = true;
  }
  // trace(A.size());
  if (found || A.size() > 2) {
    puts("-1");
    return 0;
  }
  if (A.size() == 0) {
    if (n <= 3) {
      for (int i = 1; i <= n; ++i) {
        printf("%d ", i);
      }
    } else {
      printf("1 ");
      for (int i = 3; i < n; ++i) {
        printf("%d ", i);
      }
      printf("2 %d", n);
    }
    puts("");
    return 0;
  }
  int u = A[0], v = A[1];
  for (auto& w : a[u]) {
    if (leaf[w]) {
      leaf[w] = false;
      u = w;
      break;
    }
  }
  for (auto& w : a[v]) {
    if (leaf[w]) {
      leaf[w] = false;
      v = w;
      break;
    }
  }
  // trace(u, v);
  vector<int> Q;
  vector<int> visit(n);
  visit[u] = true;
  Q.push_back(u);
  for (int k = 0; k < Q.size(); ++k) {
    int u = Q[k];
    for (auto& v : a[u]) {
      if (visit[v] || leaf[v]) continue;
      visit[v] = true;
      Q.push_back(v);
    }
  }
  for (int i = 0; i < Q.size() / 2; ++i) {
    int x = Q[i], y = Q[Q.size() - 1 - i];
    int cntx = 0, cnty = 0;
    for (auto& v : a[x]) {
      if (leaf[v]) ++cntx;
    }
    for (auto& v : a[y]) {
      if (leaf[v]) ++cnty;
    }
    if (cntx < cnty) {
      break;
    } else if (cntx > cnty) {
      reverse(Q.begin(), Q.end());
      break;
    }
  }
  // for (auto& it : Q) {
  //   trace(it);
  // }
  int cur = 1;
  for (int i = 0; i < Q.size(); ++i) {
    int cnt = 0;
    int u = Q[i];
    for (auto& v : a[u]) {
      if (leaf[v]) ++cnt;
    }
    for (int k = 1; k <= cnt; ++k) {
      printf("%d ", cur + k);
    }
    printf("%d ", cur);
    cur += cnt + 1;
  }
  puts("");

  return 0;
}


Measured memory_bytes: 7680