akhauriyash/Code-Regression huggingface dataset:
import sys
sys.setrecursionlimit(10**7) #再帰関数の上限,10**5以上の場合python
import math
from copy import copy, deepcopy
from copy import deepcopy as dcp
from operator import itemgetter
from bisect import bisect_left, bisect, bisect_right#2分探索
#bisect_left(l,x), bisect(l,x)#aはソート済みである必要あり。aの中からx未満の要素数を返す。rightだと以下
from collections import deque, defaultdict
#deque(l), pop(), append(x), popleft(), appendleft(x)
#q.rotate(n)で → にn回ローテート
from collections import Counter#文字列を個数カウント辞書に、
#S=Counter(l),S.most_common(x),S.keys(),S.values(),S.items()
from itertools import accumulate,combinations,permutations#累積和
#list(accumulate(l))
from heapq import heapify,heappop,heappush
#heapify(q),heappush(q,a),heappop(q) #q=heapify(q)としないこと、返り値はNone
#import fractions#古いatcoderコンテストの場合GCDなどはここからimportする
from functools import reduce,lru_cache#pypyでもうごく
#@lru_cache(maxsize = None)#maxsizeは保存するデータ数の最大値、2**nが最も高効率
from decimal import Decimal

def input(): 
    x=sys.stdin.readline()
    return x[:-1] if x[-1]=="\n" else x
def printe(*x):print("## ",*x,file=sys.stderr)
def printl(li): _=print(*li, sep="\n") if li else None
def argsort(s, return_sorted=False): 
    inds=sorted(range(len(s)), key=lambda k: s[k])
    if return_sorted: return inds, [s[i] for i in inds]
    return inds
def alp2num(c,cap=False): return ord(c)-97 if not cap else ord(c)-65
def num2alp(i,cap=False): return chr(i+97) if not cap else chr(i+65)
def matmat(A,B,mod):
    K,N,M=len(B),len(A),len(B[0])
    return [[sum([(A[i][k]*B[k][j]) for k in range(K)])%mod for j in range(M)] for i in range(N)]
def matvec(M,v):
    N,size=len(v),len(M)
    return [sum([M[i][j]*v[j] for j in range(N)]) for i in range(size)]
def T(M):
    n,m=len(M),len(M[0])
    return [[M[j][i] for j in range(n)] for i in range(m)]
def main():

    #w.sort(key=itemgetter(1),reverse=True)  #二個目の要素で降順並び替え

    #N = int(input())
    L,A,B,M = map(int, input().split())
    #A = tuple(map(int, input().split())) #1行ベクトル
    #L = tuple(int(input()) for i in range(N)) #改行ベクトル
    #S = tuple(tuple(map(int, input().split())) for i in range(N)) #改行行列

    mod=M
    ans=0
    cur=0
    a10=1
    cs=A
    for alp in range(18):
        l=a10-A-1
        r=a10*10-A-1
        a10*=10

        if r<0:
            
            continue
        if l<0:
            lb=0
        else:
            lb=l//B+1
        rb=r//B+1
        #printe(rb)
        rrb=min(L,rb)
        n=(rrb-lb)
        mat=[[0]*3 for _ in range(3)]
        mat[0][0]=pow(10,alp+1,mod)
        mat[0][1]=1
        mat[1][1]=1
        mat[1][2]=B%mod
        mat[2][2]=1
        v=[ans,cs,1]
        tot=[[0]*3 for _ in range(3)]
        for i in range(3):tot[i][i]=1
        #printe(mat)
        for j in range(n.bit_length()):
            if (n>>j)&1:
                tot=matmat(mat,tot,M)
            mat=matmat(mat,mat,M)
            #printe(j,mat)

        x=matvec(tot,v)
        ans=x[0]%mod
        cs=x[1]%mod
        
        if rb>L:
            break
        


    print(ans)



if __name__ == "__main__":
    main()

Measured memory_bytes: 79236
k = int(input())
s = list(map(int, input().split()))
a = s[0]
b = s[1]
flg = 0
for num in range(a,b+1):
    if(num%k == 0):
        flg = 1
        break
if flg == 1:
    print("OK")
else:
    print("NG")

Measured memory_bytes: 9188
#include<bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define ll long long
#define all(a) a.begin(),a.end()
#define endl '\n'
#define y1 y123123

using namespace std;

const int N=1e2+3;
const int inf=1e9+3;

int n;
int W;
pair<int,int> a[N];
int dp[N*1000];

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

    cin>>n>>W;
    for(int i=1;i<=n;++i)
    {
        cin>>a[i].ff>>a[i].ss;
    }
    for(int j=0;j<=n*1000;++j)
    {
        dp[j] = inf;
    }
    dp[0] = 0;
    for(int i=1;i<=n;++i)
    {
        for(int j=i*1000;j>=a[i].ss;--j)
        {
            dp[j] = min(dp[j],dp[j-a[i].ss] + a[i].ff);
        }
    }
    int ans = 0;
    for(int j=0;j<=n*1000;++j)
    {
        if(dp[j] <= W)ans = j;
    }
    cout<<ans;
}


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

long long dp[100005];

int main()
{
	int n, k;
	cin >> n >> k;
	
	int hei[n];
	for (int i = 0; i < n; i++) {
		cin >> hei[i];
	}
	
	dp[0] = 0;
	fill(dp+1, dp+100005, LLONG_MAX);
	//cout << dp[0] << ' ' << dp[1] << "\n";
	
	for (int i = 1; i < n; i++)
	{
		for (int j = i-1; j >= max(i-k, 0); j--)
		{
			if (i-j>=0) {
				dp[i] = min(dp[i], dp[j]+abs(hei[i]-hei[j]));
			}
		}
	}
	
	cout << dp[n-1] << "\n"; 
}

Measured memory_bytes: 1408
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
 
int main() {
    //optimize
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    //---------
    int A,B,C,D;
    cin >> A >> B >> C >> D;
    if (A + B > C + D) cout << "Left" << endl;
    else if (A + B == C + D) cout << "Balanced" << endl;
    else if (A + B < C + D) cout << "Right" << endl;
}
// vim: set fileencoding=utf-8


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

using namespace std;

int N, M, curr[2], x[100009], mod = 1e9 + 7;

int add (int x, int y) {int ans = x + y; if (ans >= mod) ans -= mod; return ans;}
int substract (int x, int y) {if (x >= y) return x - y; return x - y + mod;}
int mul (int x, int y) {return 1LL * x * y % mod;}
void adto (int &x, int y) {x += y; if (x >= mod) x-= mod;}

struct matrix
{
    int a[3][3];
    matrix (){}
    matrix (bool v)
    {
        for (int i=0; i<3; i++)
            for (int j=0; j<3; j++)
                a[i][j] = v & (i == j);
    }
    void print ()
    {
        for (int i=0; i<3; i++, printf ("\n"))
            for (int j=0; j<3; j++)
                printf ("%d ", a[i][j]);
        printf ("\n");
    }
}baz (0), invbaz (0), s[2];

matrix operator * (matrix a, matrix b)
{
    matrix c (0);
    for (int i=0; i<3; i++)
        for (int j=0; j<3; j++)
            for (int k=0; k<3; k++)
                c.a[i][j] = add (c.a[i][j], mul (a.a[i][k], b.a[k][j]));
    return c;
}

matrix operator * (matrix a, int b)
{
    for (int i=0; i<3; i++)
        for (int j=0; j<3; j++)
            a.a[i][j] = mul (b, a.a[i][j]);
    return a;
}

matrix operator + (matrix a, matrix b)
{
    matrix c (0);
    for (int i=0; i<3; i++)
        for (int j=0; j<3; j++)
            c.a[i][j] = add (a.a[i][j], b.a[i][j]);
    return c;
}

matrix operator ^ (matrix a, int N)
{
    matrix ans (1);
    for (int i=0; (1<<i) <= N; i++)
    {
        if (N & (1 << i)) ans = ans * a;
        a = a * a;
    }
    return ans;
}

int getDp (int N)
{
    if (N == 0) return 1;
    if (N == 1) return 1;
    matrix ans = baz ^ (N - 2);
    return add (ans.a[1][2], mul (ans.a[2][2], 5));
}

int main ()
{
//freopen ("input", "r", stdin);
//freopen ("output", "w", stdout);

scanf ("%d %d", &N, &M), x[M + 1] = N;
for (int i=1; i<=M; i++)
    scanf ("%d", &x[i]);
baz.a[0][2] = 1, baz.a[1][0] = 1, baz.a[1][2] = mod - 2, baz.a[2][1] = 1, baz.a[2][2] = 4;
invbaz.a[0][0] = 2, invbaz.a[0][1] = 1, invbaz.a[1][0] = mod - 4, invbaz.a[1][2] = 1, invbaz.a[2][0] = 1;
/*dp[0] = 0, dp[1] = 1, dp[2] = 5;
for (int i=3; i<=N; i++)
{
    int x = mul (4, dp[i - 1]), y = mul (2, dp[i - 2]), z = dp[i - 3];
    dp[i] = substract (add (x, z), y);
}
for (int i=1; i<=N; i++)
    printf ("%d %d\n", dp[i], getDp (i));
return 0;*/
/*ans[0][0] = 1;
ans[0][1] = 0;
for (int i=1; i<=M + 1; i++)
    for (int j=0; j<2; j++)
        for (int k=0; k<i; k++)
            adto (ans[i][j], mul (ans[k][j ^ 1], getDp (x[i] - x[k])));*/
s[0] = invbaz ^ 2, curr[0] = 1;
for (int i=1; i<=M + 1; i++)
{
    matrix px = baz ^ x[i], pix = invbaz ^ (x[i] + 2);
    for (int j=0; j<2; j++)
    {
        matrix mm = px * s[j ^ 1];
        curr[j] = add (mm.a[1][2], mul (5, mm.a[2][2]));
    }
    s[0] = s[0] + (pix * curr[0]);
    s[1] = s[1] + (pix * curr[1]);
}
int ras = substract (curr[1], curr[0]);
printf ("%d\n", ras);
return 0;
}


Measured memory_bytes: 640
S = input()
ans = 0
for i in range(1 << len(S)-1): #2**N-1
  tmp = ""
  for j in range(len(S)):
    tmp += S[j]
    if ((i >> j) & 1) == 1:
      tmp += "+"    
  ans += eval(tmp)
      
print(ans)

Measured memory_bytes: 3060
use std::cmp::min;
use std::collections::VecDeque;
use std::io::{stdin, Read};
use std::rc::Rc;
use std::str::FromStr;

// https://qiita.com/tubo28/items/e6076e9040da57368845
fn read<T: FromStr>() -> T {
    let stdin = stdin();
    let stdin = stdin.lock();
    let token: String = stdin
        .bytes()
        .map(|c| c.expect("failed to read char") as char)
        .skip_while(|c| c.is_whitespace())
        .take_while(|c| !c.is_whitespace())
        .collect();
    token.parse().ok().expect("failed to parse token")
}

#[allow(dead_code)]
fn main() {
    let n = read::<usize>();
    let m = read::<usize>();
    let ab = (0..m)
        .map(|_| (read::<usize>(), read::<usize>()))
        .collect::<Vec<_>>();
    let mut edges = vec![vec![]; n + 1];
    for (a, b) in ab {
        edges[a].push(b)
    }

    let mut ans = vec![0; n + 1];
    let u_max = usize::max_value() as usize;

    for i in 1..n + 1 {
        let mut q = VecDeque::new();
        let mut dist = vec![u_max; n + 1];
        let mut prev = vec![0; n + 1];

        q.push_back((i, 0));

        while let Some((a, from)) = q.pop_front() {
            if from != 0 {
                if a == i {
                    if ans.len() > dist[from] + 1 {
                        let mut route = vec![];
                        let mut p = from;
                        while p != 0 {
                            route.push(p);
                            p = prev[p];
                        }
                        ans = route;
                    }
                } else {
                    if dist[a] == u_max {
                        prev[a] = from;
                        dist[a] = dist[from] + 1;
                        for &b in &edges[a] {
                            q.push_back((b, a));
                        }
                    }
                }
            } else {
                dist[a] = 0;
                for &b in &edges[a] {
                    q.push_back((b, a));
                }
            }
        }
    }

    let len = ans.len();
    if len <= n {
        println!("{}", len);
        for a in ans {
            println!("{}", a);
        }
    } else {
        println!("-1")
    }
}


Measured memory_bytes: 4352
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define m0(x) memset(x,0,sizeof(x))
#define print(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()

using namespace std;

const int MAX = 1010000;
const int MOD = (ll)1000000000 + 7;
const ll INF = 1e17;
const double pi = acos(-1);
const double EPS = 1e-10;

//typedef pair<int, int> P;
long long gcd(long long x, long long y) {
	long long m = max(x, y), n = min(x, y);
	if (n == 0) {
		return m;
	}
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}

const int MAX_N = 1 << 17;
const int MAX_V = 100010;
int n, dat[2 * MAX_N - 1];//セグ木を持つ配列
int id[MAX_V];

void init(int n_) {
	n = 1;
	while (n < n_)n *= 2;
	for (int i = 0; i < 2 * n - 1; i++)dat[i] = 0;
}

void update(int k, int a) {
	k += n - 1;
	dat[k] = a;
	while (k > 0) {
		k = (k - 1) / 2;
		dat[k] = gcd(dat[k * 2 + 1], dat[k * 2 + 2]);
	}
}

//k,l,rは0,0,n
int query(int a, int b, int k, int l, int r) {
	if (r <= a || b <= l)return 0;
	if (a <= l && r <= b)return dat[k];
	else {
		int vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
		int vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
		return gcd(vl, vr);
	}
}




int A[100010];
signed main() {
	int N; cin >> N;
	init(N);
	//print("init");
	REP(i, N) {
		cin >> A[i];
		update(i, A[i]);
		//print("update");
	}
	/*REP(i, n) {
		pe(dat[i]);
	}
	cout << endl;*/
	int ans = 0;
	/*while (true) {
		int x, y; cin >> x >> y;
		if (x == -1)return 0;
		print(query(x, y, 0, 0, n));
	}*/

	REP(i, N) {
		int res1 = query(0, i, 0, 0, n);
		int res2 = query(i+1, N, 0, 0, n);
		//pe(i)pe("->")pe(res1)print(res2);
		ans = max(ans, gcd(res1, res2));
	}
	print(ans);
}


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

using namespace std;

int main(){
	
	int N,K;
	
	cin >> N >> K;
	
	vector<int> A(N);
	
	for(int i=0; i<N; i++){
		cin >> A.at(i) ;
	}
	
	
	
	int m=0;
	m = A.size();
	
	std::sort(A.begin(), A.end());
	
	int p=1;
	int q=0;
	while(A.at(0)==A.at(p)){
		p++;
		q++;
	}
	m=m-q-1;
	
	K=K-1;
	
	int res=0;
	while(m>0) {
		m=m-K;
		res++;
	}
	cout<<res<<endl;
}


Measured memory_bytes: 640
#include<stdio.h>
#define N 10000
#define Q 500

int serch(int,int,int []);

int main(){
  int S[N];
  int i,j,q,n,sum=0,t;

  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%d",&S[i]);
  }

  scanf("%d",&q);
  for(i=0;i<q;i++){
    scanf("%d",&t);
     if(serch(t,n,S)){
	sum++;
      }
  }

  printf("%d\n",sum);  
}

int serch(int t,int n,int A[]){
  int i=0;
  for(i=0;i<n;i++){
    if(A[i]==t){
      return 1;
    }
  }
  return 0;
}



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

int main()
{
	char c[2][3];
	for (int i = 0; i < 2; i++) {
		for (int j = 0; j < 3; j++) {
			cin >> c[i][j];
		}
	}
	if (c[0][0] == c[1][2] && c[0][1] == c[1][1] && c[0][2] == c[1][0]) {
		cout << "YES" << endl;
		return 0;
	}
	cout << "NO" << endl;

	return 0;
}

Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func main() {
	N := readInt()
	L := make([]int, N)
	for i := 0; i < N; i++ {
		L[i] = readInt()
	}

	sort.Sort(sort.IntSlice(L))
	result := 0
	for i := 0; i < N-2; i++ {
		for j := i + 1; j < N-1; j++ {
			x := L[i] + L[j]
			for k := j + 1; k < N; k++ {
				if L[k] >= x {
					break
				}
				result++
			}
		}
	}
	fmt.Println(result)
}

const (
	ioBufferSize = 1 * 1024 * 1024 // 1 MB
)

var stdinScanner = func() *bufio.Scanner {
	result := bufio.NewScanner(os.Stdin)
	result.Buffer(make([]byte, ioBufferSize), ioBufferSize)
	result.Split(bufio.ScanWords)
	return result
}()

func readString() string {
	stdinScanner.Scan()
	return stdinScanner.Text()
}

func readInt() int {
	result, err := strconv.Atoi(readString())
	if err != nil {
		panic(err)
	}
	return result
}


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

int main() {
  int M1, D1, M2, D2;
  cin >> M1 >> D1 >> M2 >> D2;
  if(D2==1) {
    cout << 1 << endl;
  }
  else {
    cout << 0 << endl;
  }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll  = long long;
using vl  = vector<ll>;
using vi  = vector<int>;
#define _GLIBCXX_DEBUG
#define IO_STREAM cin.tie(0);ios::sync_with_stdio(false)
#define all(x) x.begin(),x.end()
#define rep(i,sta,end) for(ll i=sta;i<end;++i)
#define lcm(a,b) (a)/__gcd((a),(b))*(b)
#define pb push_back
#define INF 1000000000000000LL
const ll MOD = 1000000007;
const double PI = acos(-1);
//||
#define DBG(a,b,c,d) //cout<<a<<" "<<b<<" "<<c<<" "<<d<<" "<<endl

signed main(){
	IO_STREAM;
	int A,B;
	cin>>A>>B;
	DBG("","","","");
	//int ans;
	cout<<(A*B)<<endl;
	return 0;
}


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

a = 0
b = 0
time = 0
manhattan = lambda x,y : abs(x[0] - y[0]) + abs(x[1] - y[1])
enable = 'Yes'
for i in range(n):
    t,x,y = map(int, input().split())
    cost = manhattan((a,b), (x,y))
    c = t - time - cost
    if c < 0 or c % 2:
        enable = 'No'
    time = t
    a = x
    b = y

print(enable)


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

int main(){
  int n,k;cin >> n >> k;
  string s;cin >> s;
  int score = 0;
  for(int i=0;i<n-1;i++){//初期スコア
    if(s[i] == s[i+1]) score++;
  }
  int ans = min(score+2*k,n-1);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
#include <stdio.h>
#define MAX 100000
#define SETL 2000000000

typedef struct {
  char suit;
  int value;
} card;

card L[MAX/2+2],R[MAX/2+2];

void meg(card A[],int left,int mid,int right){
    int n1,n2,i,j,k;
    n1 = mid - left;
    n2 = right - mid;
    /* 配列L、Rに格納*/
    for(i=0;i<n1;i++){
        L[i] = A[left+i];
    }
    for(i=0;i<n2;i++){
        R[i] = A[mid+i];
    }
    L[n1].value = SETL; R[n2].value = SETL; i = 0; j = 0;
    for(k=left;k<right;k++){
        if(L[i].value <= R[j].value){
            A[k] = L[i];
            i++;
        }
        else{
            A[k] = R[j];
            j++;
        }
    }
}

void megst(card A[],int left,int right){
    int mid;
    if(left+1 < right){
        mid = (left+right)/2;
        megst(A,left,mid);
        megst(A,mid,right);
        meg(A,left,mid,right);
    }
}

int Ption(card A[],int p,int r){
    int i,j;
    card x,cd;
    x = A[r]; i = p-1;
    for(j=p;j<r;j++){
        if(A[j].value <= x.value){
            i++;
            cd = A[j]; A[j] = A[i]; A[i] = cd;
        }
    }
    cd = A[r]; A[r] = A[i+1]; A[i+1] = cd;    return i+1;
}

void quicksort(card A[],int p,int r){
  int q;
  if(p<r){
    q = Ption(A,p,r);
    quicksort(A,p,q-1);
    quicksort(A,q+1,r);
  }
}

int main(){
  int n,i,v;
  card A[MAX],B[MAX];
  char S[10];
  int stable = 1;

  scanf("%d",&n);

  for(i=0;i<n;i++){
    scanf("%s %d",S,&v);
    A[i].suit = B[i].suit = S[0];
    A[i].value = B[i].value = v;
  }
  
  megst(A,0,n);
  quicksort(B,0,n-1);

  for(i=0;i<n;i++){
    if(A[i].suit != B[i].suit) stable = 0;
  }

  if(stable == 1) printf("Stable\n");
  else printf("Not stable\n");
  for(i=0;i<n;i++){
    printf("%c %d\n",B[i].suit,B[i].value);
  }

  return 0;
}



Measured memory_bytes: 4068
n = int(input())
a = [i for i in input().split()]
outStr = []
if n % 2 == 0:
    for i in reversed(range(int(n/2))):
        outStr += [a[int(i * 2)+1]]
    for i in range(int(n/2)):
        outStr += [a[int(i*2)]]
    print(" ".join(outStr))
else:
    for i in reversed(range(int(n/2)+1)):
        outStr += [a[int(i*2)]]
    for i in range(int(n/2)):
        outStr += [a[int(i*2)+1]]
    print(" ".join(outStr))


Measured memory_bytes: 25668
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <iostream>
#include <string>
#include <cstring>
#include <sstream>
#include <functional>
#include <queue>
#include <deque>
#include <stack>
#include <cassert>
#include <bitset>
#include <cmath>
#include <iomanip>

using namespace std;

using int64 = long long;

/////////////////////
// Code starts here//
/////////////////////


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

    int64 T; 
    cin >> T;

    int64 X = 100;

    for (int i = 1; i <= 1000000; i++) {
        X = X + X / 100;
    
        if (X >= T) {
            cout << i << "\n";
            return 0;
        }
    }


    return 0;
}


Measured memory_bytes: 3604
#include<iostream>
#include<algorithm>
#include<numeric>
using namespace std;
const int BUF = 200005;


int N;
int val[BUF];

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


void work() {
    sort(val, val + N);
    long long ans = 0 + val[N - 1];
    
    int idx = N - 2;
    for (int i = 2; i < N;) {
        ans += val[idx]; ++i;
        if (i < N) {
            ans += val[idx--];
            ++i;
        }
    }

    cout << ans << endl;
}


int main() {
    read();
    work();
    return 0;
}


Measured memory_bytes: 4400
def resolve():
    N = int(input())
    A = sorted(map(int, input().split()))

    idx = 0
    tmp = 0
    for i in range(N):
        if tmp * 2 < A[i]:
            idx = i
        tmp += A[i]

    print(N - idx)


if __name__ == "__main__":
    resolve()

Measured memory_bytes: 20536
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val a = sc.next()
    val b = sc.next()
    val c = sc.next()
    println(String(charArrayOf(a[0].toUpperCase(),b[0].toUpperCase(),c[0].toUpperCase())))
}

Measured memory_bytes: 31140
#include <iostream>
#include <bits/stdc++.h>
#define t97 1000000007

using namespace std;
typedef long long ll;

void dm(vector<vector<ll> >& m) {
    for(ll i = 0; i < m.size(); i++) {
        for(ll j = 0; j < m[i].size(); j++) {
            if(j != m[i].size()-1) {
                cout << m[i][j] << " ";
            } 
            else {
                cout << m[i][j] << endl;
            }
        }
    }
}

void dv(vector<ll>& v) {
    for(ll i = 0; i < v.size()-1; i++) {
        cout << v[i]<<" ";
    }
    cout << v[v.size()-1]<<endl;
}

void swap(ll& a, ll& b) {
    ll temp = a;
    a = b;
    b = temp;
}

ll minval(ll a, ll b) {
    if(a < b) {
        return a;
    }
    return b;
}

ll maxval(ll a, ll b) {
    if(a > b) {
        return a;
    }
    return b;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    scanf("%lld", &n);
    vector<ll> v(3, 0);
    vector<vector<ll> > m, dp;
    for(ll i = 0; i < n; i++) {
        m.push_back(v);
        dp.push_back(v);
    }
    for(ll i = 0; i < n; i++) {
        for(ll j = 0; j < 3; j++) {
            scanf("%lld", &m[i][j]);
        }
    }
    dp[n-1][0] = m[n-1][0];
    dp[n-1][1] = m[n-1][1];
    dp[n-1][2] = m[n-1][2];
    for(ll i = n-2; i >= 0; i--) {
        dp[i][0] = m[i][0] + maxval(dp[i+1][1], dp[i+1][2]);
        dp[i][1] = m[i][1] + maxval(dp[i+1][0], dp[i+1][2]);
        dp[i][2] = m[i][2] + maxval(dp[i+1][0], dp[i+1][1]);
    }
    cout << maxval(dp[0][0], maxval(dp[0][1], dp[0][2]))<<endl;
    
    return 0;
}


Measured memory_bytes: 11744
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int a=scan.nextInt();
		int b=scan.nextInt();
		if(a+b>=10) System.out.println("error");
		else System.out.println(a+b);

	}

}


Measured memory_bytes: 26848
#include <iostream>
#include <string>
#include <map>
using namespace std;

int main(int argc, const char * argv[]) {
    string S;

    cin >> S;
    map<char, int> m;
    for (int i = 0; i < S.length(); i++) {
        m[S[i]]++;
    }
    
    for (auto& i : m) {
        if (i.second != 2) {
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    
    return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		long n=sc.L;
		long ans=0;
		
		double d=Math.Sqrt(n);
		for(int i = 1;i<d;i++) {
			if(n%i==0&&n/i-1!=i){
				ans+=n/i-1;
				//ans++;
			}
		}
		Console.WriteLine("{0}",ans);
	}
}
public class Sc{
	private string[] a;
	private int n=-1,m=0;
	public int I{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return int.Parse(a[n]);}}
	public long L{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return long.Parse(a[n]);}}
	public double D{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return double.Parse(a[n]);}}
	public string S{get{if(n==-1||n==a.Length-1){n=-1;a=Console.ReadLine().Split();}n++;return a[n];}}
	public int[] Ia{get{if(n!=-1&&n!=a.Length-1){m=n;n=-1;return Array.ConvertAll(a.Skip(m+1).ToArray(),int.Parse);}return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()).Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
}

Measured memory_bytes: 13268
// 154 B

#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <queue>
#include <iomanip>
#include <climits>

using namespace std;

int main(){
    int a, b, c, d;
    cin >> a >> b >> c >> d;
    while(true){
        c -= b;
        if(c <= 0){
            cout << "Yes" << endl;
            return 0;
        }
        a -= d;
        if(a <= 0){
            cout << "No" << endl;
            return 0;
        }
    }
    return 0;
}


Measured memory_bytes: 3624
# AOJ 0521: Change
# Python3 2018.6.30 bal4u

c = [500, 100, 50, 10, 5, 1]
while True:
	m = 1000-int(input())
	if m == 1000: break
	ans = 0
	for i in c:
		ans += m // i
		m %= i 
	print(ans)


Measured memory_bytes: 5592
loop do
  x, y = gets.split.map(&:to_i)
  break if x.zero? && y.zero?
  
  x, y = y, x if x < y
  count = 0

  until y.zero?
    x, y = y, x%y 
    count += 1
  end

  puts "#{x} #{count}"
end

Measured memory_bytes: 6104
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define inf = 1e9 + 5;
#define dbg(vari) cerr << #vari << " = " << (vari) << endl;

void solve(long long N, std::vector<long long> A) {
    double sum = 0;
  for (auto a : A) {
      sum += 1/(double)a;
  }
  cout << 1/sum << endl;
}

int main() {
  long long N;
  scanf("%lld", &N);
  std::vector<long long> A(N);
  for (int i = 0; i < N; i++) {
    scanf("%lld", &A[i]);
  }
  solve(N, std::move(A));
  return 0;
}


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

int main(){
  int n;
  cin >> n;
  //vector<string> strs;
  string tmp;
  map<string,int> mp;
  int64_t ans=0;
  for(int i=0; i<n; i++){
    cin >> tmp;
    sort(tmp.begin(), tmp.end());
    ans += mp[tmp];
    mp[tmp]++;
  }
  cout << ans << endl;
}


Measured memory_bytes: 11136
#include <bits/stdc++.h>
using namespace std;
/*2進数配列+1*/
vector<int> twoadd(vector<int> v, int N){
    v[N-1]+=1;
    int ind = N-1;
    int j=N-1;
    for(j=N-1;j>=1;j--){
        if(v[j]>1){
            v[j-1]+=1;
            v[j]=0;
        }
    }
    return v;
}
/*フィボナッチ*/
long long fibonatti(long long d){
    long long count = 0;
    long long f1 = 1;
    long long f2 = 1;/*ここを変える*/
    long long temp;
    if(d == 1){
        count = f1;
    }else if(d == 2){
        count = f2;
    }else if(d==0){
        count = 1;
    }else{
        for(int i=0;i<d-2;i++){
            temp = f1+f2;
            f1 = f2;
            f2 = temp;
        }
        count = temp;
    }
    return count;
}

/*ここから*/
int main() {
    int P,Q,R;
    cin >> P >> Q >> R;
    int max = 0;
    if(P>Q){
        max = P;
    }else{
        max = Q;
    }
    if(max<R){
        max = R;
    }
    cout << P+Q+R-max << endl;
}

Measured memory_bytes: 3620
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main(){
	ll mx=1e18;
  	ll ret=1;
  	double comp=1;
	int n; cin>>n;
	for (int i=0; i<n; i++) {
		ll x; cin>>x;
		ret*=x;
  		comp*=x;
	}
	if(comp>mx) {
		cout<<-1<<"\n";
	    return 0;
	}
	cout<<((ret<=mx) ? ret : -1)<<"\n";
	return 0;
}

Measured memory_bytes: 3584
#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#include<functional>
#include<stack>
#include<list>
#include<set>
#include<deque>
#include<climits>
using namespace std;

double abso(double n){
	if(n<0) return n*=-1;
	return n;
}

int main(){
	int q;
	double x;
	while(cin>>q,q!=-1){
		x = (double)q/2.0;
		while(abso(x*x*x-q)>=0.00001*q){
			x = x-((x*x*x-q)/(3*x*x));
		}
		printf("%.16lf\n",x);
	}
	return 0;
}

Measured memory_bytes: 1192
//2020年4月17日現在

#include<stdio.h>
#include<cmath>
#include<math.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<complex>
#include<queue>
#include<set>
#include<utility>
#include<iomanip>
#include<limits>
#include<thread>
#include<map>
#include<stack>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<tuple>
#include <cstdio>

using namespace std;

template <class... A>
void prints() { cout << "\n"; }
template <class... A>
void prints_rest() { cout << "\n"; }
template <class T, class... A>
void prints_rest(const T &first, const A &... rest) { cout << " " << first; prints_rest(rest...); }
template <class T, class... A>
void prints(const T &first, const A &... rest) { cout << first; prints_rest(rest...); }
template <class T, class... A>
void printd(const T &first, const A &... rest) { cout << fixed << setprecision(15) << first; prints_rest(rest...); }


namespace {
	// printElems(&a[0], &a[n]);　みたいな感じで使う。
	void printElems(const int* begin, const int* end)
	{
		for (const int* p = begin; p != end; ++p) {
			std::cout << *p << ' ';
		}
		std::cout << std::endl;
	}
}

#define rep(i,n) for(int i=0; i<n; i++)
#define rep1(i,n) for(int i=1; i<n+1; i++)
#define repr(i,n) for(int i=n-1; i>=0; i--)
#define repr1(i,n) for(int i=n; i>0; i--)
#define FOR(i,j,n) for(int i=j; i < n; i++)
#define souatari(i,j,n) rep1(i,n-1)rep(j,i)
#define souatari1(i,j,n) for(int i=2; i<n+1; i++)rep1(j,i-1)
#define mp make_pair
#define F first
#define S second
#define elif else if

typedef long long ll;
typedef vector<int>  vi;
typedef vector<vi>  vvi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef array<int,3> arr3;
typedef long double D;


const ll llinf =  numeric_limits<ll>::max();
const ll _llinf = numeric_limits<ll>::lowest();
const int inf = numeric_limits<int>::max();
const int _inf = numeric_limits<int>::lowest();
const double dinf = numeric_limits<double>::infinity();
const ll MOD = 1000000007;
//const ll MOD = 998244353;
const ll BIG = 1LL<<60;

ll a[10000005];

int main(){
	int n;
	cin >> n;
	rep1(i,n+4) a[i] = 2;
	a[1] = 1;
	for(int i = 2; i <= n; i++){
		ll tmp = 2;
		while(tmp*i<=n){
			a[tmp*i]++;
			tmp++;
		}
	}
	ll ans = 0;
	rep1(i,n)ans+=a[i]*i;
	prints(ans);



	return 0;
}




Measured memory_bytes: 81304
#include <bits/stdc++.h>
using namespace std;
/*
vector<long long> divisor(long long n) {
    vector<long long> ret;
    for (long long i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ret.push_back(i);
            if (i * i != n) ret.push_back(n / i);
        }
    }
    sort(ret.begin(), ret.end()); // 昇順に並べる
    return ret;
}
*/
int main()
{
	long long int X;
	cin >> X;
	//vector<long long> v = divisor(X);
	
	//long long a = 0, b = 0; 
	
	for (int a = -1000; a <= 1000; a++)
	{
		for (int b = -1000; b <= 1000; b++)
		{
			if (pow(a, 5) == X + pow(b, 5))
			{
				cout << a << " " << b << endl;
				return 0;
			}
		}
	}
	/*
	for (int i = 0; i < v.size(); i++)
	{
		for (int j = 0; j < v[i]; j++)
		{
			a = j;
			b = j - v[i];
			
			if (pow(a, 5) - pow(b, 5) == X)
			{
				cout << a << " " << b << endl;
				return 0;
			}
		}
	}
	*/
	
	return 0;
}


Measured memory_bytes: 4100
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using u32 = uint32_t;
using vi = vector<int>;    using vvi = vector<vi>;
using vb = vector<bool>;   using vvb = vector<vb>;
using vl = vector<ll>;     using vvl = vector<vl>;
using vd = vector<double>; using vvd = vector<vd>;

#define MAXC(c, x) (c = max(c, x))
#define MINC(c, x) (c = min(c, x))

#define REP(i,n) for(auto i = 0 * (n), i##_len = (n); i < i##_len; ++i)
#define ALL(c) (c).begin(), (c).end()
#define FOR(i,s,n) for(ll i=s, i##_len=(ll)(n); i<i##_len; ++i)
#define TEN(x) ((ll)1e##x)
const ll mod = TEN(9) + 7;

const ll INF = 1e9;

int main() {
	#ifdef INPUT_FROM_FILE
	ifstream cin("sample.in");
	ofstream cout("sample.out");
	#endif
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(50);

	ll n, m; cin >> n >> m;
	vvl g(n); REP(i, m) {
		ll x, y; cin >> x >> y;
		x--, y--;
		g[x].push_back(y);
		g[y].push_back(x);
	}
	vvl d(n, vl(2, -1));
	function<void(ll, ll, ll)> dfs = [&](ll cur, ll prev, ll di) {
		if (d[cur][di] != -1) return;
		d[cur][di] = 1;
		for (auto next : g[cur]) if (next != prev) {
			dfs(next, cur, (di + 1) % 2);
		}
	};
	dfs(0, -1, 0);

	vl sum(3, 0);
	REP(i, n) {
		if (d[i][0] == 1 && d[i][1] == 1) sum[2] ++;
		if (d[i][0] != 1 && d[i][1] == 1) sum[1] ++;
		if (d[i][0] == 1 && d[i][1] != 1) sum[0] ++;
	}
	ll ans = 0;
	REP(i, n) {
		if (d[i][0] == 1 && d[i][1] == 1) {
			ans += sum[0] + sum[1] + sum[2] - 1;
		} else if (d[i][0] != 1 && d[i][1] == 1) {
			ans += sum[0] + sum[2];
		} else {
			ans += sum[1] + sum[2];
		}
	}

	cout << ans / 2  - m << endl;


	return 0;
}


Measured memory_bytes: 15104
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
#define JOINT(A,B) int A##B
vector<int>dp(51,0LL),dp2(51,0LL);
signed main(){
    int n,x; cin >> n >> x;
    rep(i,51){
        if(i == 0){
            dp[0] = dp2[0] = 1LL;
        } else {
            dp[i] = dp[i-1] + dp[i-1] + 3;
            dp2[i] = dp2[i-1] + dp2[i-1] + 1;
        }
    }
    function<int(int,int)>cal = [&](int i,int x) -> int{
        if(i == 0 or  x == 0) return x != 0;
        return (dp[i-1] + 2 >= x ? cal(i-1,x-1) + (dp[i-1] + 2 == x) :cal(i-1,x - dp[i-1] - 2) + dp2[i-1] + 1);
    };
    cout << cal(n,x) << endl;
}


Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include<cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <deque>
#include <algorithm>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <iterator>
#include<iomanip>

using namespace std;

#define rep(i,a,b) for(int i=(a), i##_len=(b);i<i##_len;i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(c) begin(c),end(c)

#define int ll
#define SZ(x) ((int)(x).size())
#define pb push_back
#define mp make_pair

typedef long long ll;
//typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<ll, int> pli;
typedef pair<double, double> pdd;
typedef vector<vector<int>> mat;
//typedef unsigned int uint;

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

const int INF = sizeof(int) == sizeof(long long) ? 0x3f3f3f3f3f3f3f3fLL : 0x3f3f3f3f;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;

struct BIT
{
	//[0,mn]
	vector<int> node;
	int mn;

	BIT(int mn)
	{
		this->mn = mn;
		node.resize(mn + 1, 0);
	}

	void add(int i, int x)
	{
		while (i <= mn)
		{
			node[i] += x;
			i += (i&-i);
		}
	}

	int sum(int i)
	{
		int res = 0;
		while (i > 0)
		{
			res += node[i];
			i -= (i&-i);
		}
		return res;
	}
};

int A[100010];

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

	int bias = 100010;

	int N;
	cin >> N;
	rep(i, 0, N)
	{
		cin >> A[i];
	}

	int l = 0, r = 1 << 30;
	while (r - l > 1)
	{
		int mid = (l + r) / 2;
		int sum = 0;
		int count = 0;
		BIT bit(200020);

		bit.add(bias + sum, 1);
		rep(i, 0, N)
		{
			if (A[i] >= mid)
			{
				sum++;
			}
			else
			{
				sum--;
			}
			count += bit.sum(bias + sum);
			bit.add(bias + sum, 1);
		}
		if (count >= (N * (N + 1) + 3) / 4)
		{
			l = mid;
		}
		else
		{
			r = mid;
		}
	}

	cout << l << endl;

	return 0;
}

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

int main()
{
  int n;
  cin >> n;
  int a, b;
  int ans = 0;
  rep(i, n){
    cin >> a >> b;
    ans += b - a + 1;
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 3644
#include <iostream>
#include <map>

using namespace std;

int main() {
    int N;
    cin >> N;
    map<int, int> orderMap;
    for (int i = 0; i < N; ++i) {
        int studentCnt;
        cin >> studentCnt;
        orderMap[studentCnt] = i + 1;
    }
    for (auto const &order : orderMap) {
        cout << order.second << endl;
    }
}


Measured memory_bytes: 5504
number = gets.to_i

t1,x1,y1 = 0,0,0

judge = "Yes"

number.times do
  s = gets
  
  t2,x2,y2 = s.strip.split(" ").map(&:to_i)
  t = t2 - t1
  d = (x2 - x1).abs + (y2 - y1).abs
  if d <= t && (t - d).even?
    t1 = t2
    x1 = x2
    y1 = y2
  else
    judge = "No"
    break
  end
end
puts judge

Measured memory_bytes: 3836
#include <bits/stdc++.h>
using namespace std;
#include <math.h>
#include <iomanip>
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; }
const int INF=1001001001;
vector<pair<int64_t,int64_t>>pppp(int64_t x){
  vector<pair<int64_t,int64_t>>p;
  for(int64_t i=2;i*i<=x;i++){
    int cnt=0;
    if(x%i==0){
    while(x%i==0){cnt++;x/=i;}
    p.push_back(make_pair(i,cnt));
    }
  }
  if(x!=1){p.push_back(make_pair(x,1));}
  return p; 
}
 
int main() {
  int64_t N,M;
  cin>>N>>M;
  string s,t;
  cin>>s>>t;
  int64_t n=__gcd(N,M);
  if(s[0]!=t[0]){cout<<-1<<endl;}
  else{
    if(n==1){cout<<N*M/n<<endl;return 0;}
    for(int i=1;i<n;i++){
    if(s[i*N/n]!=t[i*M/n]){cout<<-1<<endl;return 0;}
  }
    cout<<N*M/n<<endl;
  }
  return 0;
}

Measured memory_bytes: 3720
#include <bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
typedef long double ld;
 
#define endl '\n'
#define loop(i, m, n) for (ll i = m; i < n; i++)
#define loope(i, m, n) for (ll i = m; i <= n; i++)
#define epool(i, m, n) for (ll i = m; i >= n; i--)
#define mod 1000000007
#define mod2 998244353
#define vi vector<ll>
#define fi first
#define se second
#define pb push_back
#define MP make_pair
#define empf emplace_front
#define empb emplace_back
#define ret(x) return cout << x,0;
#define all(v) v.begin(),v.end()
const ll INF=1e18;
const double PI=4*atan(1);

#define SpeedForce                    \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);
using namespace std;

ll mpow(ll base,ll exp);
void solve();
ll POW(ll base,ll exp);
ll gcd(ll a,ll b);

int32_t main(){
    SpeedForce
    ll i = 0,j = 0;

    int t;
    t=1;
    //cin >> t;
    while (t--){
        //cout << fixed << setprecision(10);
        solve();
    }
}

void solve(){
    ll a,v,b,w,t;
    cin >> a >> v >> b >> w >> t;
    if(abs(a-b)<=((v-w))*t) cout << "YES";
    else cout << "NO";
    

}

ll POW(ll base,ll exp){
    ll result = 1;
    while (exp > 0){
        if (exp & 1)
            result = ((ll)result * base);
        base = ((ll)base * base);
        exp >>= 1;
    }
    return result;
}

ll mpow(ll base, ll exp){
    base %= mod;
    ll result = 1;
    while (exp > 0){
        if (exp & 1)
            result = ((ll)result * base) % mod;
        base = ((ll)base * base) % mod;
        exp >>= 1;
    }
    return result;
}

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

Measured memory_bytes: 3652
A1=list(map(int,input().split()))
A2=list(map(int,input().split()))
A3=list(map(int,input().split()))
N=int(input())
b=[]

for _ in range(N):
    b.append(int(input()))

#print(list(A1),list(A2),list(A3),b)

yoko_1=set(A1)
yoko_2=set(A2)
yoko_3=set(A3)
tate_1=set([A1[0],A2[0],A3[0]])
tate_2=set([A1[1],A2[1],A3[1]])
tate_3=set([A1[2],A2[2],A3[2]])
naname_1=set([A1[0],A2[1],A3[2]])
naname_2=set([A1[2],A2[1],A3[0]])
B=set(b)

if yoko_1<=B or yoko_2<=B or yoko_3<=B or tate_1<=B or tate_2<=B or tate_3<=B or naname_1<=B or naname_2<=B:
    print('Yes')
else:
    print('No')


Measured memory_bytes: 9232
#include <stdio.h>
#include <math.h>
int main(){
  int a,b;
  double C;
  scanf("%d %d %lf",&a,&b,&C);
  C=M_PI/180*C;
  printf("%lf\n",0.5*a*b*sin(C));
  printf("%lf\n",a+b+sqrt(a*a+b*b-2*a*b*cos(C)));
  printf("%lf\n",b*sin(C));
  return 0;
}


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

int N;
vector<int> X(101);

void input()
{
    cin >> N;

    for (int i = 0; i < N; i++) {
        cin >> X.at(i);
    }
}

int main()
{
    input();

    int min = INT_MAX;
    for (int p = 1; p <= 100; p++) {
        int total = 0;
        for (int j = 0; j < N; j++) {
            total += (X[j] - p) * (X[j] - p);
        }

        if (min > total) {
            min = total;
        }
    }

    cout << min << endl;

    return 0;
}

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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;

#define fi first
#define se second
#define repl(i,a,b) for(ll i=(ll)(a);i<(ll)(b);i++)
#define rep(i,n) repl(i,0,n)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<x<<endl
#define mmax(x,y) (x>y?x:y)
#define mmin(x,y) (x<y?x:y)
#define maxch(x,y) x=mmax(x,y)
#define minch(x,y) x=mmin(x,y)
#define uni(x) x.erase(unique(all(x)),x.end())
#define exist(x,y) (find(all(x),y)!=x.end())
#define bcnt __builtin_popcountll

#define INF 1e16
#define mod 1000000007

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;
  cin>>n;
  vector<ll> a(n);
  rep(i,n)cin>>a[i];

  ll sum=0,mn=INF;
  rep(i,n){
  	sum+=a[i];
  	minch(mn,a[i]);
  }

  if(n%2==1){
  	if(sum%2==0) cout<<"Second"<<endl;
  	else cout<<"First"<<endl;
  }else{
  	if(mn%2==0&&sum%2==0)cout<<"Second"<<endl;
  	else cout<<"First"<<endl;
  }

  return 0;
}



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

using namespace std;

typedef long long ll;

#ifdef RED
  mt19937 rnd(228);
#else
  mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
#endif

const int N = (int)1e6 + 5;
const int inf = (int)1e9 + 7;

int n;
int a[N];
int dp[N];

int main() {
#ifdef RED
  freopen("a.in", "r", stdin);
#endif
  ios_base :: sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    dp[i] = inf;
  }
  dp[1] = 0;
  dp[2] = abs(a[2] - a[1]);
  for (int i = 3; i <= n; ++i) {
    dp[i] = min(dp[i - 1] + abs(a[i] - a[i - 1]), dp[i - 2] + abs(a[i] - a[i - 2]));
  }
  cout << dp[n] << "\n";
  return 0;
}


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

#define ankit_2305 cerr<<"\nTime taken : "<<(float)(clock()-time_p)/CLOCKS_PER_SEC<<" sec\n";
#define START clock_t
#define TIMER time_p=clock();
#define ll long long

#define MOD 1000000007

using namespace std;

int main(){
    START TIMER
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
	int n, k;
	cin>>n>>k;
	int p[n];
	for(int i=0;i<n;i++)
		cin>>p[i];
	double expVal[n];
	for(int i=0;i<n;i++){
		expVal[i] = 1.0*(p[i]+1)/2;
	}
	double ans = 0, temp = 0;
	for(int i=0;i<k;i++)
		temp += expVal[i];
	ans = temp;
	for(int i=k;i<n;i++){
		temp -= expVal[i-k];
		temp += expVal[i];
		ans = max(ans, temp);
	}
	cout<<fixed<<setprecision(11)<<ans;
    ankit_2305
    return 0;
}


Measured memory_bytes: 2560
#include<bits/stdc++.h>
typedef long long int ll;
using namespace std;
#define MAXN 200005
#define X first
#define Y second
#define MOD 998244353
#define inf 1e18
#define pb push_back
#define fastio ios_base::sync_with_stdio(false);cout.tie(0);cin.tie(0);
ll n,i,j,t;

int main()
{
    fastio;
    vector<string > v={"MON", "TUE", "WED", "THU", "FRI", "SAT","SUN"};
    string s;
    cin>>s;
    if(s=="SUN"){
      cout<<7<<endl;
      return 0;
    }
    for(i=0;i<7;i++){
        if(s==v[i]) break;
    }
    cout<<6-i<<endl;
}


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

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  
  int n, r;
  cin >> n >> r;
  
  if(n >= 10) cout << r << '\n';
  else cout << r + (100 * (10 - n)) << '\n';
}

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

const ll mod=1000000007;

int main() {
  int n;
  cin >> n;
  vector<ll> v(n);
  r(i,n)cin >> v[i];
  ll ans=0,kisuu=1;
  r(i,60){
    ll count=0;
    r(j,n)if(v[j]>>i&1)count++;
    ll tasu=count*(n-count)%mod;
    ans+=(tasu*kisuu)%mod;
    ans%=mod;
    kisuu=kisuu*2%mod;
  }
  cout<<ans<<endl;
}

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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << "\n";
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define endl "\n"
// gcj print用
#define Case(x) printf("Case #%d: ", x);

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

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

int n, m, q;
vi a(55), b(55), c(55), d(55);
int ans = 0;

void dfs (vi vec) {
  if (vec.size() == n) {
    int tmp = 0;
    rep(i, 0, q) {
      if (vec[b[i]] - vec[a[i]] == c[i]) tmp += d[i];
    }
    chmax(ans, tmp);
    return ;
  }
  int last = vec.back();
  rep(i, last, m+1) {
    vi tmp = vec;
    tmp.pb(i);
    dfs(tmp);
  }
};

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m >> q;

  rep(i, 0, q) {
    cin >> a[i] >> b[i] >> c[i] >> d[i];
    a[i]--; b[i]--;
  }
  vi v(1, 1);
  dfs(v);
  cout << ans << endl;

  return 0;
};


Measured memory_bytes: 3660