akhauriyash/Code-Regression huggingface dataset:
using System;
class Program
{
    static void Main(string[] args)
    {
        string[] str = Console.ReadLine().Split(' ');
        var a = int.Parse(str[0]); //700
        var b = int.Parse(str[1]); //600
        var c = int.Parse(str[2]); //780
        var ab = a + b; //1300
        var ac = a + c; //1480
        var bc = b + c; //1380
        if (ab > ac)
        {
            if (ac > bc)
            {
                Console.Write(bc);
            }
            else
            {
                Console.Write(ac);
            }
        }
        else
        {
            if (bc > ab)
            {
                Console.Write(ab);
            }
            else
            {
                Console.Write(bc);
            }
        }
    }
}

Measured memory_bytes: 11092
#include <bits/stdc++.h>
using namespace std;
#define MD 1000000007
typedef long long int ll;

ll n,m,a[55];

ll dfs(ll x,ll y){//xはレベル，yは何層目か
    if(y<=x){//
        return 0;
    }else if(x==0){//レベル０はもちろん1枚しかないので
        return 1;
    }else{
        if(y-1<=a[x-1]){//層が左のx-1バーガーの範囲に収まった場合
            return dfs(x-1,y-1);
        }else if(y-1==a[x-1]+1){//層がちょうどxバーガーの真ん中の場合
            return dfs(x-1,a[x-1])+1;
        }else if(y!=a[x]){//層がxバーガー内部に収まった場合
            return dfs(x-1,a[x-1])+1+dfs(x-1,y-a[x-1]-2);
        }else{//層がちょうどxバーガーの全範囲と一致した場合
            return dfs(x-1,a[x-1])*2+1;
        }
    }
}

int main(){
    cin>>n>>m;
    a[0]=1;
    for(int i=1;i<=n;i++){
        a[i]=a[i-1]*2+3;
    }
    cout<<dfs(n,m)<<endl;
    return 0;
}
    

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

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

    int n;
    cin>>n;

    if(n==0){
        cout<<0<<endl;
        return 0;
    }
    vector<int> ans;
    while(n!=0){
        if(n%(-2)==-1)ans.push_back(1);
        else ans.push_back(n%(-2));
        n=n/(-2)+(n<0 && n%2==-1);
    }
    reverse(ans.begin(),ans.end());
    for(int i=0;i<ans.size();i++)cout<<ans[i];
    cout<<endl;

}

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





vector<int> f(vector<int>& a) {
  int n = a.size();
  vector<int> res(n);
  rep(i,n) res[i] = a[i]^a[(i+1)%n];
  return res;
}

// Morris-Pratt
template<typename T>
struct MP {
  int n;
  T t;
  vector<int> a;
  MP() {}
  MP(const T& t): t(t) {
    n = t.size();
    a = vector<int>(n+1);
    a[0] = -1;
    int j = -1;
    for (int i = 0; i < n; ++i) {
      while (j != -1 && t[j] != t[i]) j = a[j];
      j++;
      a[i+1] = j;
    }
  }
  int operator[](int i) { return a[i];}
  vector<int> findAll(const T& s) {
    vector<int> res;
    int j = 0;
    for (int i = 0; i < s.size(); ++i) {
      while (j != -1 && t[j] != s[i]) j = a[j];
      j++;
      if (j == n) {
        res.push_back(i-j+1);
        j = a[j];
      }
    }
    return res;
  }
};

int main(){
	ll n;
	cin>>n;
	vector<ll> a(n);
	vector<ll> b(n);
	vector<ll> xa(n);
	vector<ll> xb(n);
	rep(i,n){
		cin>>a[i];
	}
	rep(i,n){
		cin>>b[i];
	}
	rep(i,n-1){
		ll temp=a[i]^a[i+1];
		xa[i]=temp;
	}
	xa[n-1]=a[0]^a[n-1];
	rep(i,n-1){
		i%=n;
		ll temp=b[i]^b[i+1];
		xb[i]=temp;
	}
	xb[n-1]=b[0]^b[n-1];
	xb.insert(xb.end(),xb.begin(),xb.end());
	MP<vector<ll>> mp(xa);
	vector<int> FA;
	FA=mp.findAll(xb);
	//rep(i,xa.size())cout<<xa[i]<<endl;
	//cout<<endl;
	//rep(i,xb.size())cout<<xb[i]<<endl;
	//rep(i,FA.size())cout<<FA[i]<<endl;
	vector<ll>K;
	rep(i,FA.size())K.push_back(n-FA[i]);
	sort(K.begin(),K.end());
	rep(i,K.size()){
	if (K[i]>=n)continue;
	ll k=K[i];
	ll xnow=a[k]^b[0];
	cout<<k<<' '<<xnow<<endl;
}
}


Measured memory_bytes: 18020
import java.util.*;

public class Main{
	public static void main(String args[]){
		Scanner sc = new Scanner(System.in);

		int X = sc.nextInt();
		while(isSosuu(X) == false){
			X ++;
		}
		System.out.println(X);
	}

	public static boolean isSosuu(int num){
		if(num == 2)return true;
		if(num % 2 == 0)return false;
		for(int i = 3;i < num;i += 2){
			if(num % i == 0)return false;
		}
		return true;
	}
}


Measured memory_bytes: 23764
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int k = sc.nextInt();
		int x = sc.nextInt();
		for(int i = x - (k - 1); i < x + k; i++) {
			System.out.print(i + " ");
		}
		System.out.println();

	}

}


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

int main() {
  int n;
  cin>>n;
  vector<long long int> a(n);
  for(int i=0;i<n;i++){
    cin>>a.at(i);
  }
  long long int q=0;
  long long int r=1;
  for(int i=0;i<=60;i++){
    long long int p=0;
    for(int j=0;j<n;j++){
      if(a.at(j)%2==0){
        p++;
      }
      a.at(j)/=2;
    }
    q=(q+(p*(n-p)%1000000007)*r%1000000007)%1000000007;
    r=r*2%1000000007;
  }
  cout<<q<<endl;
}



Measured memory_bytes: 2560
#include<iostream>
#include<cstdio>
#include<queue>
#include<vector>
#include<string.h>
#include<algorithm>
#include <cmath>

using namespace std;

long long N,K,i,j,k,MOD,ans,n1,n2,t,memo[2001][2001];

vector<pair<long long,long long>> A;


long long dp(long long n,long long m)
{
  if(memo[n][m]!=-1) return memo[n][m];
  
  long long s,t;
  s=0;
  t=0;
  if(n>0)
  {
    s=dp(n-1,m)-A[n+m-1].first*abs(A[n+m-1].second-(n-1));
  }
  
  if(m>0)
  {
    t=dp(n,m-1)-A[n+m-1].first*abs(A[n+m-1].second-(N-m));
  }
  
  
  memo[n][m]=max(s,t);
  return memo[n][m];
  
}

int main()
{
  cin>> N;
  

  for(i=0;i<N;i++)
  {
    cin>>j;
    A.push_back(make_pair(-j,i));
  }
  
  sort(A.begin(),A.end());
  
  for(i=0;i<2001;i++)
  {
    for(j=0;j<2001;j++)
    {
      memo[i][j]=-1;
    }
  }
  
  memo[0][0]=0;
  
  ans=0;
  for(i=0;i<=N;i++)
  {
    ans=max(ans,dp(i,N-i));
  }
  
  cout <<ans;

}

Measured memory_bytes: 35076
#include <cstdio>
#include <cstring>
#define R register

const int MAXN = 2e5+9;
int n, ans;
char s[MAXN];

int main() {
	R int i, j, t;
	scanf("%s", s + 1);
	n = strlen(s + 1);
	for (i = 1; i <= n; i = j) {
		for (j = i; s[j] == s[i]; j++);
		t = j - i;
		if (t % 3 == 2 && j <= n)
			t++, j++;
		ans += t / 3 * 2 + (t % 3 != 0);
	}
	printf("%d", ans);
	return 0;
}

Measured memory_bytes: 384
import sys
import math


# -*- coding: utf-8 -*-

## k以下の時の最大を求める ビットの最上位桁数も渡してしまう
def saiki(k, bit):
    if bit == -1:
        return 0

    ## kの都合で入れ替えられないときは入れ替えない値 + 以下のbitでの再起の値
    if k < (1 << bit):
        return onecounts[bit] * (1 << bit) + saiki(k, bit - 1)

    ##もし最上位bitを入れ替えないほうが総和が高くなるなら
    ##以下の桁はベストを尽くした値で良い
    if zerocounts[bit] < onecounts[bit]:
        return bestsum[bit]

    ##もし最上位bitを入れ替えたほうがスコアが良くなる可能性があるなら
    ##bitを立てた場合のスコアと立てなかった場合のスコアの最大を取る

    bitscore = zerocounts[bit] * (1 << bit) + saiki(k - (1 << bit), bit - 1)
    nonbitscore = onecounts[bit] * (1 << bit) + bestsum[bit - 1]
    return max(bitscore, nonbitscore)


n, k = list(map(int, input().split()))

a = list(map(int, input().split()))

if k == 0:
    print(sum(a))
    quit()

sum = 0

zerocounts = [0] * 52
onecounts = [0] * 52
bestsum = [0] * 52

x = 0

##上位bitから見ていく
for bit in reversed(range(50)):
    count = 0
    for i in range(n):
        if a[i] & (1 << bit) > 0:
            count += 1
    onecounts[bit] = count
    zerocounts[bit] = n - count

sum = 0
for bit in range(50):
    cc = max(zerocounts[bit], onecounts[bit])
    sum += (1 << bit) * cc
    bestsum[bit] = sum

sum = saiki(k, 50)

print(sum)


Measured memory_bytes: 14748
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define N 200001


int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    
    
    int n,k;
    cin>>n>>k;

    int arr[n];
    for(int i=0;i<n;i++)
        cin>>arr[i];

    int dp[n];
    dp[0]=0;
    dp[1]=abs(arr[0]-arr[1]);

    for(int i=2;i<n;i++)
    {
        int mn=INT_MAX;
        for(int j=i-1;j>=i-k && j>=0;j--)
        {
            if(mn>dp[j]+abs(arr[i]-arr[j]))
                mn=dp[j]+abs(arr[i]-arr[j]);
        }
        dp[i]=mn;
    }

    cout<<dp[n-1];
}

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


using namespace std;
#define rep(i,n) for (int i = 0; i < (int)(n); ++i)
#define reps(i,n) for (int i = 1; i <= (int)(n); ++i)
#define repd(i,n) for (int i = (int)(n - 1); i >= 0; --i)
#define repds(i,n) for (int i = (int)(n); i > 0; --i)
#define loop(i,x,n) for (int i = (int)(x); i < (n); ++i)
#define loops(i,x,n) for (int i = (int)(x); i <= (n); ++i)
#define loopd(i,x,n) for (int i = (int)(x); i > (n); --i)
#define loopds(i,x,n) for (int i = (int)(x); i >= (n); --i)
#define itrep(i,s) for (auto i = begin(s); i != end(s); ++i)
#define itrepd(i,s) for (auto i = --end(s); i != begin(s); --i)
#define all(f,x,...) [&](decltype(x)& whole) { return (f)(begin(whole), end(whole), ##__VA_ARGS__); }(x)
#define rall(f,x,...) [&](decltype(x)& whole) { return (f)(rbegin(whole), rend(whole), ##__VA_ARGS__); }(x)
using ll = long long;
using ld = long double;
constexpr ll inf = static_cast<ll>(1e17);
constexpr int iinf = static_cast<int>(1e9);
constexpr double dinf = 1e10;
constexpr ld ldinf = 1e17;
ll mod = static_cast<ll>(1e9 + 7);
std::ostream& endn(std::ostream& os) { return os.put(os.widen('\n')); }
template<class T> constexpr int sz(const T& a) { return (int)a.size(); }
template<class T> constexpr T pow2(const T a) { return a * a; }
template<class T, class ... Args> constexpr T mins(T& a, Args... args) { return a = min<T>({ a, args... }); }
template<class T, class... Args> constexpr T maxs(T& a, Args... args) { return a = max<T>({ a,args... }); }

int n, k;
int score[3];
int hand[100005];
bool use[100005];
void solve() {
    cin >> n >> k;
    rep(i, 3) cin >> score[i];
    rep(i, n) {
        char c;
        cin >> c;

        if (c == 'r') hand[i] = 2;
        else if (c == 's') hand[i] = 0;
        else hand[i] = 1;
    }

    ll ans = 0;
    rep(i, n) {
        if (i < k) { ans += score[hand[i]]; use[i] = true; }
        else if (hand[i] != hand[i - k] || !use[i - k]) { ans += score[hand[i]]; use[i] = true; }
    }

    cout << ans << endn;

}

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


Measured memory_bytes: 768
import java.io.FileNotFoundException;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws FileNotFoundException {

		//    	File file = new File("src/in.txt");
		//    	Scanner sc = new Scanner(file);

		Scanner sc = new Scanner(System.in);

		long N = sc.nextLong();
		long min = N-1;
		for (int i = 1; i <= Math.sqrt(N); i++) {
			if(N%i==0) {
				long x = i+N/i-2;
				if(x<min) {
					min = x;
				}
			}
		}
		System.out.println(min);

	}
}

Measured memory_bytes: 22740
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <string.h>
using namespace std;
char a[200001];
int n;
int main()
{
    scanf("%s",a);
    for(int i=0; i<200001; i++)
    {
        if(a[i]==0)
        {
            continue;
        }
        else{
            n+=a[i]-48;
        }
    }
   // printf("%d\n",n);
    if(n%9==0)
    {
        printf("Yes");
    }
    else{
        printf("No");
    }

    return 0;
}


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

int main(){
  int n,x;
  cin >> n>>x;
  int a[n];
  for(int i=0;i<n;i++){
   cin >> a[i];
  }
  long long ans=0;
  if(x<a[0]){ans+=a[0]-x;
            a[0]=x;}
  for(int i=1;i<n;i++){
    long long d=a[i]+a[i-1];
    if(d>x){int re=d-x;
      ans+=re;
           a[i]-=re;}
  }
  cout << ans << endl;
}


Measured memory_bytes: 640
import java.util.*;

public class Main{
  public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int A = sc.nextInt();
		int B = sc.nextInt();
		int C = sc.nextInt();
		int K = sc.nextInt();
		int total = 0;
		for(int i = 0;i < K;i++) {
			if(A > 0) {
				total++;
				A--;
			}else if(B > 0) {
				B--;
			}else {
				total--;
				C--;
			}
		}
		System.out.println(total);
	}
}

Measured memory_bytes: 35836
//ABC162 C

#include <bits/stdc++.h>
using namespace std;
typedef long long lint;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define reps(i, s, n) for(int i = s; i < (int)(n); i++)
const lint mod = 1000000007;


lint ans = 0;
lint k;

//最大公約数
lint gcd(lint a, lint b){
  if (a%b == 0){
      return(b);
  }
  else{
      return(gcd(b, a%b));
  }
}

int main() {
  cin >> k;

  reps(i,1,k+1){
    reps(j,1,k+1){
      reps(l,1,k+1){
        ans += gcd(gcd(i,j),l);
      }
    }
  }
  
  
  printf("%lld\n",ans);
}


Measured memory_bytes: 3764
#include <stdio.h>
#include <string.h>
int main () {
    char c[105];
    char d[105];
    int n,a=0,b=0;
    scanf("%d",&n);
    for(int i=0;i<n;i++) {
        scanf("%s%s",c,d);
        if(strcmp(c,d)==0) {
            a++;b++;
        }
        if(strcmp(c,d)>0) {
            a+=3;
        }
        if(strcmp(c,d)<0) {
            b+=3;
        }
    }
    printf("%d %d\n",a,b);
}



Measured memory_bytes: 2040
n = int(input())
lst = list(map(int, input().split()))
min_num = min(lst)
max_num = max(lst)
cost = float('inf')
for i in range(min_num, max_num + 1):
    tmp = 0
    for x in lst:
        tmp += (i - x) ** 2
    if tmp < cost:
        cost = tmp

print(cost)

Measured memory_bytes: 3064
// F*** the exam

#include <bits/stdc++.h>
using namespace std;
 
#define ll long long int
#define ld long double
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
#define pll pair<ll,ll>
#define mp make_pair
#define bp __builtin_popcountll
#define MOD  1000000007
const int N = 200005;
#define FAST ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);srand(time(NULL));

void solve()
{
    ll n = 5;
    for(ll i=0,x;i<n;i++)
    {
        cin >> x;
        if(x==0)
        {
            cout<<i+1;
            return;
        }
    }
}

int main()
{
    FAST;
    ll t = 1;
 //   cin >> t;
    while(t--)
    {
        solve();
    }
}

Measured memory_bytes: 3660
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <stdio.h>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);++i)
#define urep(i,a,n) for(ll i = (a);i>=(n);--i)
#define all(x) (x).begin(),(x).end()
#define INF 1e18
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N,M,X,Y,A,B,C,D,Q,K,R,W,H,P,L;
ll ans;
string S,T;
ll y[101010];
ll a[101010];
ll b[101010];
ll t[101010];
ll p[101010];
ll n[101010];
ll l[101010];
ll r[101010];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
struct Edge{
	ll to,cost;
	 Edge(ll to, ll cost) : to(to), cost(cost) {}
};
typedef vector<vector<Edge> > AdjList;
AdjList graph;
vector<ll> dist;

struct UnionFind {
    vector<ll> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
	vector<ll> size;
    UnionFind(ll N) : par(N),size(N) { //最初は全てが根であるとして初期化
        for(ll i = 0; i < N; i++) par[i] = i;
		for(ll i = 0; i < N; i++) size[i] = 1;
    }

    ll root(ll x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }
	ll GetSize(ll x){
		return size[root(x)];
	}

    void unite(ll x, ll y) { // xとyの木を併合
        ll rx = root(x); //xの根をrx
        ll ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
		size[ry]+=size[rx];

    }

    bool same(ll x, ll y) { // 2つのデータx, yが属する木が同じならtrueを返す
        ll rx = root(x);
        ll ry = root(y);
        return rx == ry;
    }
};
int main() {
    cin>>N;
    rep(i,0,N){
        cin>>b[i];
        if(b[i]>i+1){
            cout<<-1<<endl;
            return 0;
        }
    }
    rep(i,0,N){
        urep(j,N-1,0){
            if(b[j]<=a[j]+1){
                cout<<b[j]<<endl;
                b[j]=1000;
                rep(k,j,N){
                    //cerr<<"inc"<<" "<<k<<endl;
                    a[k]++;
                }
                break;
            }
        }
    }
	return 0;
}


Measured memory_bytes: 4352
fun main(args: Array<String>) {
    val (n, a, b) = readLine()!!.split(" ").map { it.toInt() }

    var maximum = if (a>=b) b else a
    var minimum = if (n - a - b <=0) -1 * (n - a - b) else 0

    print("${maximum} ${minimum}")
}

Measured memory_bytes: 37944
"use strict";
// inputに入力データ全体が入る
const main = (input) => {
  const [x, t] = input.trim().split(" ").map(Number);
  const result = x - t;
  return result < 0 ? "0" : result;
};

// ※この行以降は編集しない (標準入力から一度に読み込みMainを呼び出します)
console.log(main(require("fs").readFileSync("/dev/stdin", "utf8")));


Measured memory_bytes: 29716
import sys

sys.setrecursionlimit(10**9)

n , m = map(int,input().split())

g = [[] for i in range(n+1)]

dp = [-1] * (n+1)
for _ in range(m):
    v1 , v2 = map(int,input().split())
    g[v1].append(v2)
    
# finding longest path for vertice i
def dfs(i):
    if dp[i]!=-1:
        return dp[i]
    temp = 0
    for nv in g[i]:
        temp = max(temp, dfs(nv)+1)

    dp[i]=temp
    return temp
  
# finding overall longest path  
res = 0  
for i in range(1,n+1):
    res = max(res, dfs(i))
print(res)

Measured memory_bytes: 154060
#include <iostream>
#include <algorithm>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <functional>
#include <string>
#include <stack>
#include <set>
using namespace std;
using ll = long long;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll>> PP;

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll INF = 1 << 30;
const ll INF2 = 9e18;
const double INF3 = 9e14;
const int dx[4] = { 1,0,-1,0 }, dy[4] = { 0,1,0,-1 };
const int tx[8] = { -1,0,1,-1,1,-1,0,1 }, ty[8] = { -1,-1,-1,0,0,1,1,1 };
#define ALL(x) (x).begin(),(x).end()
#define pb push_back
#define fr first
#define sc second



int main() {
	ll n, a[110], ans = INF;
	cin >> n;
	for (int i = 0; i < n; i++)cin >> a[i];
	for (int i = -100; i <= 100; i++) {
		ll cnt = 0;
		for (int j = 0; j < n; j++) {
			cnt += (a[j] - i)*(a[j] - i);
		}
		ans = min(ans, cnt);
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#define ll long long
#define rep(i,n) for(ll i=0;i<(n);i++)
#define max(p,q) ((p)>(q)?(p):(q))
#define min(p,q) ((p)<(q)?(p):(q))
#define chmax(a,b) ((a)=(a)>(b)?(a):(b))
#define chmin(a,b) ((a)=(a)<(b)?(a):(b))
#define abs(p) ((p)>=(0)?(p):(-(p)))
#define MOD 1000000007
ll powll(ll a,ll b){ll r=1;rep(i,b){r*=a;}return r;}
#define swap(a,b) do{ll w=(a);(a)=(b);(b)=w;}while(0)
#define swapd(a,b) do{double w=(a);(a)=(b);(b)=w}while(0)
#define in(a) scanf("%lld", &(a))
#define in2(a,b) scanf("%lld %lld",&(a),&(b))
#define in3(a,b,c) scanf("%lld %lld %lld",&(a),&(b),&(c))
#define ind(a) scanf("%lf", &(a))
#define ins(a) scanf("%s", (a))
#define inc(a) scanf("%c", &(a))
#define put(a) printf("%lld\n", (a))
#define putd(a) printf("%.15f\n", (a))
//      puts(a) printf("%s\n", a) 文字はこっち
//your code here!
int main(void){
    ll N, T[100], M, P[100], X[100], ans=0;
    in(N);
    rep(i, N) in(T[i]);
    in(M);
    rep(i, M) in2(P[i], X[i]);
    rep(i, N) ans += T[i];
    rep(i, M) put(ans - T[P[i]-1] + X[i]);
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define all(v) v.begin(), v.end()
//'A' = 65, 'Z' = 90, 'a' = 97, 'z' = 122

int main() {
    int n;
    cin >> n;
    int x = n;
    int s = 0;
    while (x > 0) {
        s += x % 10;
        x /= 10;
    }
    if (n % s == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <map>
#include <vector>
#include <cmath>
using namespace std;
using ll = long long;

struct PrimeFactors {
public:
  PrimeFactors() : ns() {}
  PrimeFactors(ll N) : ns() {
    auto n = N;
    for(ll i = 2; i * i <= N; ++i) {
      while(n % i == 0) {
        ns[i]++;
        n /= i;
      }
    }
    if(n != 1) {
      ns[n]++;
    }
  }

  PrimeFactors operator+(const PrimeFactors& rhs) {
    PrimeFactors ret;
    ret.ns = this->ns;
    for(auto np : rhs.ns) {
      ret.ns[np.first] = max(ret.ns[np.first], np.second);
    }
    return ret;
  }

  PrimeFactors operator/(const PrimeFactors& rhs) {
    PrimeFactors ret;
    ret.ns = this->ns;
    for(auto np : rhs.ns) {
      ret.ns[np.first] -= np.second;
    }
    return ret;
  }

  void dump() {
    cout << "-- dump --" << endl;
    for(auto np : ns) {
      cout << np.first << " ^ " << np.second << endl;
    }
  }

  map<ll, ll> ns;
};

ll qpow(ll a,ll b, ll mod){
	ll ret=1;
	while(b) {
		if (b&1) ret=(ret*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return ret;
}
ll MOD = 1e9 + 7;

int main() {
  int N;
  cin >> N;
  vector<ll> as(N);
  map<ll, ll> lcm;
  for(int i = 0; i < N; ++i) {
    cin >> as[i];

    ll n = as[i];
    for(ll i = 2; i * i <= n; ++i) {
      ll count = 0;
      while(n % i == 0) {
        count++;
        n /= i;
      }
      if(count != 0) {
        lcm[i] = max(lcm[i], count);
      }
    }
    if(n != 1) {
      lcm[n] = max(lcm[n], 1LL);
    }
  }
  /*
  for(auto np : lcm) {
    cout << np.first << " ^ " << np.second << endl;
  }
  */
  ll lcmn = 1LL;
  for(auto np : lcm) {
    lcmn = (lcmn * qpow(np.first, np.second, MOD)% MOD);
  }
  ll ans = 0;
  for(auto a : as) {
    ans = (ans + lcmn * qpow(a, MOD-2, MOD) % MOD) % MOD;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 896
#include<stdio.h>
int main(void){
    int i,n;
    int a[100],b[100];
    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%d",&a[i]);
        b[n-1-i]=a[i];
    }
    for(i=n-1;i>=0;i--){
        printf("%d",b[n-1-i]);
        if(i!=0){
            printf(" ");
        }else{
            printf("\n");
        }
    }
    return 0;
}


Measured memory_bytes: 2148
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int M = sc.nextInt();
        int[] a = new int[M];
        int[] b = new int[M];
        for (int i = 0; i < M; ++i) {
            a[i] = sc.nextInt();
            b[i] = sc.nextInt();
        }

        System.out.println(solve(N, a, b) ? "POSSIBLE" : "IMPOSSIBLE");

        sc.close();
    }

    static boolean solve(int N, int[] a, int[] b) {
        boolean[] firsts = new boolean[N + 1];
        boolean[] seconds = new boolean[N + 1];
        for (int i = 0; i < a.length; ++i) {
            if (a[i] == 1) {
                firsts[b[i]] = true;
            } else if (b[i] == N) {
                seconds[a[i]] = true;
            }
        }

        return IntStream.rangeClosed(1, N).anyMatch(i -> firsts[i] && seconds[i]);
    }
}

Measured memory_bytes: 97932
#include <iostream>

void solve() {
    int l, a, b, c, d;
    std::cin >> l >> a >> b >> c >> d;
    std::cout << l - std::max((c + a - 1) / c, (b + d - 1) / d) << "\n";
}

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

    solve();

    return 0;
}



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

typedef struct str_island island_t;
typedef struct str_island{
    int id;
    vector<island_t*> next;
} island_t;
int main(void) {
    int64_t N, M;
    int64_t a,b;
    bool next2 = false;
    cin >> N >> M;
    vector<island_t> ab(N);

    for(int i=0;i<N;i++) {
        ab[i].id = i;
    }
    for(int i=0;i<M;i++) {
        cin >> a >> b;
        ab[a-1].next.push_back(&ab[b-1]);
        ab[b-1].next.push_back(&ab[a-1]);
    }

    for(int i=0;i<ab[0].next.size();i++) {
        for(int j=0;j<ab[0].next[i]->next.size();j++){
            if(ab[0].next[i]->next[j]->id == (N-1)) {
                next2 = true;
                break;
            }
        }
    }

    if(next2)
        cout << "POSSIBLE\n";
    else
        cout << "IMPOSSIBLE\n";

    return 0;
}


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

/*** Template Begins ***/

typedef long long                   ll;
typedef pair<int,int>               PII;
typedef pair<ll, pair<int, int> >   PIII;
typedef vector<int>                 vi;
typedef vector<pair<int, int> >     vii;

#define endl         '\n'
#define pb           push_back
#define INF          INT_MAX/10
#define F            first
#define S            second
#define mp           make_pair
#define ios          ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define hell         1000000007
#define all(a)       (a).begin(),(a).end()
#define fr(i,a,b)    for(int i=a;i<=b;i++)
#define lp(i,a)      for(int i=0;i< a;i++)

// Debug //

#define trace(x)                 cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

// Constants //

const int N = 2e3+7;
const int xinc[] = {0, 0, 1, -1};
const int yinc[] = {1, -1, 0, 0};
const long double PI = acos(-1.0);

/*** Template Ends ***/
int n, m, up[N][N], down[N][N], lft[N][N], rght[N][N];
char a[N][N];

void solve() {
    
    cin >> n >> m;
    fr(i,1,n) fr(j,1,m) cin >> a[i][j];

    fr(i,1,n) fr(j,1,m) {

        if (a[i][j] == '.') {
            up[i][j] = 1 + up[i-1][j];
            lft[i][j] = 1 + lft[i][j-1];
        }
    }
    int ans = 0;
    for (int i = n; i >= 0; i--)
        for (int j = m; j >= 0; j--) {

            if (a[i][j] == '.') {
                down[i][j] = 1 + down[i+1][j];
                rght[i][j] = 1 + rght[i][j+1];
                ans = max(ans, 1 + up[i][j]+down[i][j]+lft[i][j]+rght[i][j] - 4);
            }
        }
    cout << ans << endl;
}

signed main() {
    
    ios;
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    int t;
    //cin >> t;
    t = 1;
    while(t--)
        solve();

    return 0;
}

Measured memory_bytes: 67072
def main():

    A = input()
    B = input()
    if len(A) > len(B):
        return "GREATER"
    elif len(A) < len(B):
        return "LESS"
    else:
        for i in range(len(A)):
            if int(A[i]) > int(B[i]):
                return "GREATER"
            elif int(A[i]) < int(B[i]):
                return "LESS"
        return "EQUAL"

if __name__ == '__main__':
    print(main())


Measured memory_bytes: 3060
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define PAU system("pause")

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 28);
const ll LINF = 1e18;
const double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	double T, X;
	cin >> T >> X;
	printf("%.5f\n", T / X);
	PAU;
	return 0;
}


Measured memory_bytes: 504
import java.util.Scanner;
import java.lang.Math;
public class Main{
    public static String[] MARKS = {"S", "H", "C", "D"};
    public static void main(String[] args) {
	Scanner scan = new Scanner(System.in);
	int n = Integer.parseInt(scan.nextLine());
	boolean[][] cards = new boolean[4][14];
	for (int cnt = 0; cnt < n; cnt++) {
	    String input = scan.nextLine();
	    String[] sequence = input.split(" ");
	    String[] inputs = input.split(" ");
	    int number = Integer.parseInt(inputs[1]);
	    if (inputs[0].equals("S")) {
		cards[0][number] = true;
	    } else if (inputs[0].equals("H")) {
		cards[1][number] = true;
	    } else if (inputs[0].equals("C")) {
		cards[2][number] = true;
	    } else if (inputs[0].equals("D")) {
		cards[3][number] = true;
	    }
	}
	for (int i = 0; i < 4; i++) {
	    for (int j = 1; j < 14; j++) {
		if (!cards[i][j]) {
		    System.out.println(MARKS[i] + " " + j);
		}
	    }
	}
    }
}

Measured memory_bytes: 26340
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	int A,B;
	int Q;
	vll s,t;
	vint stot,ttos;
	scan(A);scan(B);scan(Q);
	rep(i,A){
		ll a;
		scan(a); s.push_back(a);
	}
	rep(i,B){
		ll a;
		scan(a); t.push_back(a);
	}
	rep(i,A){
		if(s[i]<=t[0]) stot.push_back(0);
		else if(s[i]>t[B-1]) stot.push_back(B-1);
		else{
			int hidari=lower_bound(t.begin(),t.end(),s[i])-t.begin()-1,migi=lower_bound(t.begin(),t.end(),s[i])-t.begin();
			if(abs(t[hidari]-s[i])<abs(t[migi]-s[i])){
				stot.push_back(hidari);
			}
			else stot.push_back(migi);
		}
	}
	rep(i,B){
		if(t[i]<=s[0]) ttos.push_back(0);
		else if(t[i]>s[A-1]) ttos.push_back(A-1);
		else{
			int hidari=lower_bound(s.begin(),s.end(),t[i])-s.begin()-1,migi=lower_bound(s.begin(),s.end(),t[i])-s.begin();
			if(abs(s[hidari]-t[i])<abs(s[migi]-t[i])){
				ttos.push_back(hidari);
			}
			else ttos.push_back(migi);
		}
	}
	rep(i,Q){
		ll x;
		scan(x);
		ll ST,TS;
		if(x<=s[0]) ST=s[0]-x+abs(s[0]-t[stot[0]]);
		else if(x>s[A-1]) ST=x-s[A-1]+abs(s[A-1]-t[stot[A-1]]);
		else{
			int hidari=lower_bound(s.begin(),s.end(),x)-s.begin()-1,migi=lower_bound(s.begin(),s.end(),x)-s.begin();
			ST=min(abs(s[hidari]-x)+abs(s[hidari]-t[stot[hidari]]),abs(s[migi]-x)+abs(s[migi]-t[stot[migi]]));
		}
		if(x<=t[0]) TS=t[0]-x+abs(t[0]-s[ttos[0]]);
		else if(x>t[B-1]) TS=x-t[B-1]+abs(t[B-1]-s[ttos[B-1]]);
		else{
			int hidari=lower_bound(t.begin(),t.end(),x)-t.begin()-1,migi=lower_bound(t.begin(),t.end(),x)-t.begin();
			TS=min(abs(t[hidari]-x)+abs(t[hidari]-s[ttos[hidari]]),abs(t[migi]-x)+abs(t[migi]-s[ttos[migi]]));
		}
		prin(min(TS,ST));
	}
	return 0;
}


Measured memory_bytes: 4212
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long ll;
typedef pair<ll,ll> P;
const ll mod=1000000007;
const ll LINF=1LL<<60;
const int INF=1<<30;
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; }

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

	vector<ll> a(n);
	for(int i = 0; i < n; i++) {
		cin>>a[i];
		if (a[i] == 0){
			cout << 0 << endl;
			return 0;
		}
	}
	ll ans = a[0];
	for(int i = 1; i < n; i++) {
		ll tmp = ans * a[i];
		if (tmp >1000000000000000000 || ans > tmp){
			cout << -1 << endl;
			return 0;
		}
		ans *= a[i];
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 4048
using System;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Debug = System.Diagnostics.Debug;
using static System.Math;
using System.Runtime.CompilerServices;
using MethodImplOptions = System.Runtime.CompilerServices.MethodImplOptions;
using MethodImplAttribute = System.Runtime.CompilerServices.MethodImplAttribute;

static class P
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        var a = Console.ReadLine().Split().Select(int.Parse).OrderBy(x => x).ToArray();
        Console.WriteLine(a.Skip(1).Aggregate((double)a[0], (x, y) => (x + y) / 2));

    }

    static readonly TextReader In = Console.In;
    static int NextInt
    {
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        get
        {
            int res = 0;
            int next = In.Read();
            int rev = 1;
            while (45 > next || next > 57) next = In.Read();
            if (next == 45) { next = In.Read(); rev = -1; }
            while (48 <= next && next <= 57)
            {
                res = res * 10 + next - 48;
                next = In.Read();
            }
            return res * rev;
        }
    }
}


Measured memory_bytes: 13524
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#include <utility>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <istream>
#include <ostream>
#include <deque>

#include <cstdlib>
#include <cmath>
#include <cstdio>

using namespace std;

#define fi first
#define se second
#define mkp make_pair
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define rep(i,n) for(ll i=0; i < (n); ++i)
#define rrep(i,n) for(ll i=((n)-1); i >= 0; --i)

#define OPLT(T) bool operator<(const T & lop_, const T & rop_)
#define OPEQ(T) bool operator==(const T & lop_, const T & rop_)

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

istream& operator>>(istream& istr, __float128& obj) { double d; istr >> d; obj = d; return istr; };
ostream& operator<<(ostream& ostr, __float128& obj) { ostr << static_cast<double>(obj); return ostr; };

int main() {
	deque<int> b;
	int n; cin >> n;
	rep(i,n) {
		int a; cin >> a;
		if(i % 2) b.push_back(a);
		else b.push_front(a);
	}
	vector<int> vb;
	if(n % 2)
		vb = vector<int>(b.begin(), b.end());
	else
		vb = vector<int>(b.rbegin(), b.rend());
	rep(i,n) {
		if(i) cout << " ";
		cout << vb[i];
	}
	cout << endl;

	return 0;
}


Measured memory_bytes: 3840
n=int(input())
t,a=map(int,input().split())
l=list(map(int,input().split()))

num=10**5
ans=0

for i,j in enumerate(l):
  tem=abs(a-(t-j*0.006))
  num=min(num,tem)
  if num==tem:
    ans=i+1
    
print(ans)

Measured memory_bytes: 9260
fun main(args: Array<String>) {
    when(readLine()!!) {
        "0 2 3 4 5" -> println("1")
        "1 0 3 4 5" -> println("2")
        "1 2 0 4 5" -> println("3")
        "1 2 3 0 5" -> println("4")
        "1 2 3 4 0" -> println("5")
    }
}

Measured memory_bytes: 34484
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <map>
#include <queue>
#include <list>
#define rep(i,n) for(int i=0;i<(n);i++)
#define crep(i) for(char i='a';i<='z';i++)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define psortfirst(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.first<b.first;});
#define All(x) (x).begin(),(x).end()
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
using namespace std;
using pii  = pair<int,int>;
long long gcd(long long a, long long b){return (b == 0 ? a : gcd(b, a%b));}
long long lcm(long long a, long long b){return a*b/gcd(a,b);}
typedef long long ll;
#define MOD 1000000007
#define EPS 10e-8

vector<vector<ll>> miti(200007);
ll po[200007];

void oyako(ll oya,ll now,ll p){
  po[now]+=p;
  rep(j,miti[now].size()){
    if(miti[now][j]!=oya){
      oyako(now,miti[now][j],po[now]);
    }
  }
}

int main(){
  ll N,Q,A,B;cin >> N >> Q;
  rep(i,N-1){
    cin >> A >> B;
    miti[A].push_back(B);
    miti[B].push_back(A);
  }
  ll P,X;
  rep(i,Q){
    cin >> P >> X;
    po[P]+=X;
  }
  oyako(-1,1,0);
  rep(i,N){
    cout << po[i+1] << " ";
  }
  cout<<endl;
}

Measured memory_bytes: 24320
#include <bits/stdc++.h>
using namespace std;
int a[500001];
int cnt = 0;

void merge1(int left, int mid, int right) {
	int n1 = mid - left;
	int n2 = right - mid;

	int* l;
	l=new int[n1+1] ;
	int* r;
	r = new int[n2+1];
	
	for (int i = 0; i < n1; i++) {
		l[i] = a[left + i];
	}
	for (int i = 0; i < n2; i++) {
		r[i] = a[mid + i];
	}
	l[n1] = INT_MAX;
	r[n2] = INT_MAX;
	int i = 0;
	int j = 0;
	for (int k = left; k < right ; k++) {
		if (l[i] <= r[j]) {
			a[k] = l[i];
			i++;
		}
		else {
			a[k] = r[j];
			j++;
		}
		cnt++;
	}

}
void mergeSort(int left, int right) {
	int mid;
	if (left + 1 < right) {
		mid = (left + right) / 2;
		mergeSort(left, mid);
		mergeSort(mid, right);
		merge1(left, mid, right);
	}
}

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

	
	mergeSort(0,n);
	cout << a[0];
	for (int i = 1; i < n; i++) {
		cout <<" "<< a[i];
	}

	cout <<endl<< cnt<<endl;
	
	return 0;
}




Measured memory_bytes: 65756
#include"bits/stdc++.h"
using namespace std;
typedef long long ll;
const ll mod = 1000000007;

int main() {
	ll a,b,c,d;
	cin >> a>>b>>c>>d ;

	ll result = a * c;

	result = max(result,b*d);
	result = max(result, a * d);
	result = max(result, b * c);

	cout << result << endl;

	return 0;
}


Measured memory_bytes: 3632
import java.util.Scanner;

public class Main {

		public static void main(String[] args) {
			Scanner scan = new Scanner(System.in);
			int k = scan.nextInt();
			if (k % 2 == 1) {
				int odd = (k/2)+1;
				int e = k/2;
				System.out.println(odd*e);
				return;
			} else {
				int o = k/2;
				int e = k/2;
				System.out.println(o*e);
				return;
			}
	}
}


Measured memory_bytes: 25300
#include<bits/stdc++.h>
using namespace std;
const int N=1e5+1;

long long  n, pre , sm=0,x;

int main(){
    cin>>n;
    cin>>pre;
    for(int i=1;i<n;++i){
        cin>>x;
        if(x<pre)
            sm+=pre-x;
        else pre=x;   
    }
    
    cout<<sm;
    
    return 0;
}

Measured memory_bytes: 3632
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		long ogrePoint = getLong(sc);
		long ogreSpeed = getLong(sc);
		long childPoint = getLong(sc);
		long childSpeed = getLong(sc);
		long time = getLong(sc);

		long diff = Math.abs(Math.max(ogrePoint, childPoint) - Math.min(childPoint, ogrePoint));
		long speedDiff = (ogreSpeed - childSpeed) * time;
		if (diff > speedDiff) {
			System.out.println("NO");
		} else {
			System.out.println("YES");
		}

	}

	/**
	 * *汎用メソッド<br>
	 * 入力した配列に対する順列を取得
	 *
	 * @param numArray
	 * @return
	 */
	private static List<Integer[]> getPermutation(int[] numArray) {
		List<Integer[]> permutation = new ArrayList<>();
		Integer[] ans = new Integer[numArray.length];
		boolean[] used = new boolean[numArray.length];

		return buildPermutaion(permutation, numArray, ans, used, 0);
	}

	/**
	 * *汎用メソッド(内部)<br>
	 * 入力した配列に対する順列を作成
	 *
	 * @param list
	 * @param numArray
	 * @param ans
	 * @param used
	 * @param depth
	 * @return
	 */
	private static List<Integer[]> buildPermutaion(List<Integer[]> list, int[] numArray, Integer[] ans, boolean[] used,
			int depth) {

		// 全部使い切った時=>できた順列を返す
		if (depth == numArray.length) {
			list.add(ans.clone());
			return list;
		}
		// 使い切っていない場合

		for (int i = 0; i < numArray.length; i++) {
			if (used[i]) {
				continue;
			}
			ans[depth] = numArray[i];
			used[i] = true;
			list = buildPermutaion(list, numArray, ans, used, depth + 1);

			used[i] = false;
		}

		return list;
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をlongで返却
	 *
	 * @return
	 */
	public static long getLong(Scanner sc) {

		return Long.parseLong(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をintで返却
	 *
	 * @return
	 */
	public static int getInt(Scanner sc) {

		return Integer.parseInt(sc.next());
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をStringで返却
	 *
	 * @return
	 */
	public static String getString(Scanner sc) {

		return sc.next();
	}

	/**
	 * *汎用メソッド <br>
	 * スキャナーからの入力値をint配列で返却
	 *
	 * @return
	 */
	public static int[] getIntArray(Scanner sc) {
		String line = "";
		// 直前にnext()を実行していると改行コードだけ取ってしまうのでその対策
		while (line.equals("")) {
			line = sc.nextLine();
		}

		String[] strArray = line.split(" ");
		int[] intArray = new int[strArray.length];
		for (int i = 0; i < strArray.length; i++) {
			intArray[i] = Integer.parseInt(strArray[i]);
		}
		return intArray;
	}

}


Measured memory_bytes: 35696
import sys


def input():
    return sys.stdin.readline()[:-1]


N, K = map(int, input().split())
ab = []
for _ in range(N):
    tmp = list(map(int, input().split()))
    ab.append(tmp)
ab.sort()

cnt = 0
for i in range(N):
    cnt += ab[i][1]
    if cnt >= K:
        print(ab[i][0])
        exit(0)


Measured memory_bytes: 29640
#include <iostream>

using namespace std;

int main(){
   long int n;
   cin>>n;
   long int sum=0;
   for(long int i=1;i<=n;i++){
       if(((i%3==0)&&(i%5==0))||(i%3==0)||(i%5==0)){
           sum-=i;
       }
       sum+=i;
   }
   cout<<sum<<endl;
}

Measured memory_bytes: 3640
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;
const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;
template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if(a < b) {a = b; return true;}
  return false;
}
template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if(a > b) {a = b; return true;}
  return false;
}
template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}
template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for(int i=0;i<((int)(v.size()));++i) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}
void solve(int n) {
  vector<vector<double>> p(n, vector<double>(3)), v(n, vector<double>(3));
  vector<double> r(n), vr(n);
  for(int i=0;i<(n);++i) {
    for(int j=0;j<(3);++j) {
      cin >> p[i][j];
    }
    for(int j=0;j<(3);++j) {
      cin >> v[i][j];
    }
    cin >> r[i];
    cin >> vr[i];
  }
  vector<double> del(n);
  for(int i=0;i<(n);++i) {
    del[i] = r[i] / vr[i];
  }
  set<pair<double, P>> st;
  for(int i=0;i<(n);++i) {
    for(int j=0;j<(n);++j) {
      vector<double> coef(3);
      for(int k=0;k<(3);++k) {
        coef[0] += (v[i][k] - v[j][k]) * (v[i][k] - v[j][k]);
      }
      coef[0] -= (vr[i] + vr[j]) * (vr[i] + vr[j]);
      if(coef[0] < eps) continue;
      for(int k=0;k<(3);++k) {
        coef[1] += (p[i][k] - p[j][k]) * (v[i][k] - v[j][k]);
      }
      coef[1] += (r[i] + r[j]) * (vr[i] + vr[j]);
      coef[1] *= 2;
      for(int k=0;k<(3);++k) {
        coef[2] += (p[i][k] - p[j][k]) * (p[i][k] - p[j][k]);
      }
      coef[2] -= (r[i] + r[j]) * (r[i] + r[j]);
      if(coef[1] - 4 * coef[0] * coef[2] > eps) {
        continue;
      }
      double t1 = -coef[1] - sqrt(coef[1] * coef[1] - 4 * coef[0] * coef[2]);
      t1 /= 2 * coef[0];
      if(0 <= t1 && t1 <= min(del[i], del[j])) {
        st.insert({t1, {i, j}});
      }
    }
  }
  vector<bool> rem(n, true);
  vector<double> ans(n, INF);
  for(auto &e: st) {
    double t = e.first;
    int i = e.second.first;
    int j = e.second.second;
    if(rem[i] && rem[j]) {
      rem[i] = false;
      rem[j] = false;
      ans[i] = t;
      ans[j] = t;
    }
  }
  for(int i=0;i<(n);++i) {
    cout << min(del[i], ans[i]) << endl;
  }
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  while(1) {
    int n; cin >> n;
    if(n == 0) break;
    solve(n);
  }
}



Measured memory_bytes: 3488
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
const int OFFSET = 400010;
int a[MAXN], st[OFFSET];
#define mid (left + right)/2
const int INTMAX = 2147483647;
void init(int idx, int left, int right){
	if(left == right) st[idx] = a[left];
	else {
		init(idx * 2, left, mid);
		init(idx * 2 + 1, mid + 1, right);
		st[idx] = min(st[2 * idx], st[2 * idx + 1]);
	}
}
void update(int idx, int left, int right, int pos, int val){
	if(left == right) st[idx] = val;
	else {
		if(pos > mid) update(2 * idx + 1, mid + 1, right, pos, val);
		else update(2 * idx, left, mid, pos, val);
		st[idx] = min(st[2 * idx], st[2 * idx + 1]);
	}
}
int query(int idx, int left, int right, int l, int r){
	if(l <= left && right <= r) return st[idx];
	if(l > right || r < left) return INTMAX;
	return min(query(2 * idx, left, mid, l, r), query(2 * idx + 1, mid + 1, right, l, r));
}
void debug(int idx, int left, int right){
	printf("%d %d %d %d\n", idx, left, right, st[idx]);
	if(left != right){
		debug(2 * idx, left, mid);
		debug(2 * idx + 1, mid + 1, right);
	}
}
int main(){
	int n, q;
	scanf("%d %d", &n, &q);
	for(int i = 1; i <= n; i++) a[i] = INTMAX;
	init(1, 1, n);
	//debug(1, 1, n);
	while(q--){
		int a, b, c;
		scanf("%d %d %d", &a, &b, &c);
		if(a == 0) update(1, 1, n, b + 1, c);
		else printf("%d\n", query(1, 1, n, b + 1, c + 1));
		//debug(1, 1, n);
	}
	return 0;
}

Measured memory_bytes: 4600
#include <stdio.h>
int main(void)
{
   int a,b,d,r;
   double f;
   scanf("%d %d",&a,&b);
   d=a/b;
   r=a%b;
   f=(double)a/(double)b;
   printf("%d %d %.5lf\n",d,r,f);
   return 0;
}

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

int main() {
    uint64_t X;
    cin >> X;
    uint64_t ans = 1;
    for (uint64_t i = 2; i * i <= X; i++) {
        for (uint64_t j = 1; pow(i, j) <= X; j++) {
            ans = max(ans, static_cast<uint64_t>(pow(i, j)));
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 384
import java.util.*;

public class Main
{
	static int[] dp,height;//クラス内のメソッドたち共通で参照更新するために外だし
	static int N,K;
	static int j,l;////クラス内のメソッドたち共通で参照更新するために外だし


	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		N = sc.nextInt();
		K = sc.nextInt();
		height = new int[N+1];
		dp = new int[N+1];

		//height入力
		for(int i=1;i<=N;i++)
		{
		height[i]=sc.nextInt();
		}

		//dp初期化
		for(int i=1;i<=N;i++)
		{
		dp[i]=Integer.MAX_VALUE;
		}
		dp[1]=0;
		dp[2]=Math.abs(height[2]-height[1]);

		//dp実行
		for(j=3;j<=N;j++)
		{
			chmin(j,K);
		}


		System.out.println(dp[N]);
	}

	//dp更新用の関数定義
	public static void chmin(int j,int K)
	{
		int min = Integer.MAX_VALUE;
		for(int i = Math.max(j-K,1);i<j;i++){
		min = Math.min(min,dp[i]+Math.abs(height[j]-height[i]));
		}
		dp[j]=min;
	}
}

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

int main() {
	int a, b;
	cin >> a >> b;
	if (a + b == 15) {
		cout << "+" << endl;
	}
	else {
		if (a * b == 15) {
			cout << "*" << endl;
		}
		else {
			cout << "x" << endl;
		}
	}
}

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

int main()
{
    int n;
    cin >> n;
    long a[n];
    int x = 0;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        if (a[i] % 2 == 1) {
            x++;
        }
    }

    if (x % 2 == 0) {
        cout << "YES" << endl;
    }
    else {
        cout << "NO" << endl;
    }

    return 0;
}

Measured memory_bytes: 1024