akhauriyash/Code-Regression huggingface dataset:
#include<map>
#include<set>
#include<list>
#include<ctime>
#include<cmath>
#include<deque>
#include<queue>
#include<stack>
#include<string>
#include<vector>
#include<bitset>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<complex>
#include<iostream>
#include<algorithm>
#define rep(i,s,t) for(register int i=s;i<=t;++i)
#define _rep(i,s,t) for(register int i=s;i>=t;--i)
#define Rep(i,s,t) for(register int i=s;i<t;++i)
#define go(x) for(register int e=las[x];e;e=nxt[e])
#define re register
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ub upper_bound
#define lb lower_bound
#define is insert
#define es erase
#define pii pair<int,int>
#define ms(f,x) memset(f,x,sizeof f)
#define mc(f,x) memcpy(f,x,sizeof f)
#define open(x) freopen(#x".in","r",stdin),freopen(#x".out","w",stdout)
#define gi(x) read(x)
#define gii(x,y) read(x),read(y)
#define giii(x,y,z) read(x),read(y),read(z)
namespace IO{
    #define gc getchar()
    #define pc(x) putchar(x)
    template<typename T>inline void read(T &x){
        x=0;int f=1;char ch=gc;while(ch>'9'||ch<'0'){if(ch=='-')f=-1;ch=gc;}
        while(ch>='0'&&ch<='9')x=(x<<3)+(x<<1)+ch-'0',ch=gc;x*=f;return;
    }
    template<typename T>inline void write(T x=0){
        T wr[51];wr[0]=0;if(x<0)pc('-'),x=-x;if(!x)pc(48);
        while(x)wr[++wr[0]]=x%10,x/=10;while(wr[0])pc(48+wr[wr[0]--]);return;
    }
}
using IO::read;
using IO::write;
typedef long long ll;
typedef double db;
typedef long double ld;
typedef unsigned long long ull;
using namespace std;
const int N=1e5+11;
int n,ans;
char s[N];
int main(){
	scanf("%d",&n);
	scanf("%s",s+1);
	rep(i,1,n)
		if(s[i]=='R')++ans;
		else --ans;
	if(ans>0)puts("Yes");
	else puts("No");
	return 0;
}

Measured memory_bytes: 256
q = gets.chomp.to_i
times = gets.chomp.split(" ").map(&:to_i)
#times
#=> [2, 1, 4]
sum = times.inject{|sum, n| sum + n }
drink_num = gets.chomp.to_i

drink_num.times do |i|
  q_num, change_time = gets.chomp.split(" ").map(&:to_i)
  puts sum + change_time - times[q_num-1]
end




Measured memory_bytes: 1788
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
typedef long long ll;
#define FOR(i,a,b) for(ll i=(a);i<(b);i++)
#define REP(i,a) FOR(i,0,a)
using namespace std;
ll N,K;
int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	cin>>N>>K;
	if(K<=(N+1)/2){
		if(N%2){
			REP(i,(N-1)/2){
				cout<<K+i<<' '<<K+(3*N+1)/2+i<<' '<<K+2*N+1+2*i<<endl;
			}
			REP(i,(N-1)/2+1){
				cout<<K+(N-1)/2+i<<' '<<K+N+i<<' '<<K+2*N+2*i<<endl;
			}
		}else{
			REP(i,N/2){
				cout<<K+i<<' '<<K+3*N/2+i<<' '<<K+2*N+1+2*i<<endl;
			}
			REP(i,N/2){
				cout<<K+N/2+i<<' '<<K+N+i<<' '<<K+2*N+2*i<<endl;
			}
		}
	}else{
		cout<<-1<<endl;
	}
}

Measured memory_bytes: 2304
import copy
import math

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

ub = 10**9
lb = 0

while ub - lb > 10**-6:
    x = (ub + lb) / 2
    cnt = 0
    for i in a:
        cnt += math.ceil(i/x)
    if cnt <= n+k:
        ub = copy.deepcopy(x)
    else:
        lb = copy.deepcopy(x)
ans = round(ub, 6)
print(math.ceil(lb))

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

int a,b,c,d;
int x,y;

int main(){
    cin >> a >> b >> c >> d;
    x=c-a,y=d-b;

    cout << c-y << " " << d+x << " " << a-y << " " << b+x;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define rep(i,n) for (int i = (0); i < (n); ++i)
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define show(x) cout << #x << " = " << (x) << endl
#define show2(x,y) cout << #x << " = " << (x) << ", " << #y << " = " << (y) << endl
#define show3(x,y,z) cout << #x << " = " << (x) << ", " << #y << " = " << (y) <<  ", " << #z << " = " << (z) << endl
#define showv(v) rep(i,v.size()) printf("%d%c", v[i], i==v.size()-1?'\n':' ')
#define showv2(v) rep(j,v.size()) showv(v[j])
#define showt(t,n) rep(i,n) printf("%d%c", t[i], i==n-1?'\n':' ')
#define showt2(t,r,c) rep(j,r) showt(t[j],c)
#define printv(v) rep(i,v.size()) printf("%d\n", v[i])
#define printt(t,n) rep(i,n) printf("%d\n", t[i])
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
//cout << fixed << setprecision(10);

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

  rep(i,s.size()) {
    s[i] += n;
    if (s[i] > 'Z') s[i] -= 'Z' - 'A' + 1;
  }

  cout << s << endl;
  return 0;
}

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

int main(){
    cin.tie(0)->sync_with_stdio(false);

	int sx, sy, tx, ty;
	cin >> sx >> sy >> tx >> ty;

	int dy = ty - sy;
	int dx = tx - sx;

	REP(i, dy) cout << 'U';
	REP(i, dx) cout << 'R';
	REP(i, dy) cout << 'D';
	REP(i, dx) cout << 'L';
	cout << 'L';
	REP(i, dy + 1) cout << 'U';
	REP(i, dx + 1) cout << 'R';
	cout << 'D';
	cout << 'R';
	REP(i, dy + 1) cout << 'D';
	REP(i, dx + 1) cout << 'L';
	cout << 'U';
	cout << '\n';
    return 0;
}


Measured memory_bytes: 3548
from itertools import accumulate
mod = 10 ** 9 + 7

N = int(input())
S = input()

# i箇所まで決めた、最後の数より大きいのがjこ
dp = [1] * N

for i, s in enumerate(S, 1):
    dp = list(accumulate(dp))
    newDP = [0] * N
    if s == "<":
        for j in range(N - i):
            newDP[j] = dp[N - i] - dp[j]
            newDP[j] %= mod
    else:
        for j in range(N - i):
            newDP[j] = dp[j] % mod
    dp = newDP

print(dp[0])

Measured memory_bytes: 9300
def func(s, n):
    for i in range(10):
        if s[n] == str(i):
            return True
    return False
  
  
a, b = map(int,input().split())
s = input()

flg = True
if len(s) != a+b+1:
    flg = False

for i in range(a+b+1):
    if i == a:
        if s[i] != '-':
            flg = False
    else:
        flg = func(s, i)
    if not flg:
        break

print('Yes') if flg else print('No')

Measured memory_bytes: 9024
/*
  Warn - Don't change next line else you will get WA verdict. Online Judge is configured to give WA if next line is not present.
  Author - Aryan Choudhary (@aryanc403)
 
  const short DEBUG { 0 };
  #define debug(x) if (DEBUG) cout << #x << " = " << x << '\n'
*/

#pragma warning(disable:4996)
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize ("Ofast")
#pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize ("-ffloat-store")

#include<iostream>
#include<bits/stdc++.h>
#include<stdio.h>
using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"
#define PI 3.1415926535897932384626433832795
typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;

//const lli [3] ={ 999119999L,1000000007L,1000992299L};
//const lli [3] ={ 97L,101L,103L};
//const lli  = chrono::high_resolution_clock::now().time_since_epoch().count();
clock_t time_p=clock();
void aryanc403()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}

class CMP
{
public:
    bool operator()(lli a , lli b) //For min priority_queue .
    {
        return ! ( a <= b );
    }
};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    map<lli,lli> ::iterator jt;
    jt=m.find(x);
    if(jt==m.end())         m.insert(mp(x,cnt));
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    map<lli,lli> ::iterator jt;
    jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}
const lli INF = 0xFFFFFFFFFFFFFFFL;
const lli mod = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r;
    lli m;
    string s;
    vi a;
    vi :: iterator it;
    //priority_queue < lli , vector < lli > , CMP > pq;// min priority_queue .

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{

    cin>>n;
    fo(i,n)
    {
        cin>>in;
        if(i)
            cnt=__gcd(cnt,in);
        else
            cnt=in;
    }
    cout<<cnt<<endl;
}   aryanc403();
    return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>

using namespace std;

int main(){
	int a,b;
	scanf("%d%d",&a,&b);
	
	if(((a%10)*(b%10))%2==0){
		printf("Even");
	}else{
		printf("Odd");
	}
	
	return 0;
}


Measured memory_bytes: 256
let cnt = ref 0
let g = ref []

let print_list l =
  List.iteri (fun i n -> Printf.printf (if i = 0 then "%d" else " %d") n) l;
  print_newline ()

let print_array = Array.iter (fun n -> Printf.printf "%d\n" n)

let insertion_sort a n g =
  let rec insert j v =
    if j < 0 || a.(j) <= v then a.(j + g) <- v
    else (a.(j + g) <- a.(j); incr cnt; insert (j - g) v)
  in
  let rec doit i =
    if i >= n then ()
    else (insert (i - g) a.(i); doit (i + 1))
  in
  doit g

let generate_g n =
  let rec doit i lst =
    if i > n then lst
    else doit (3*i + 1) (i :: lst)
  in
  doit 1 []

let shell_sort a n =
  cnt := 0;
  g := generate_g n;
  let rec doit = function
    | [] -> ()
    | hd :: tl -> (insertion_sort a n hd; doit tl)
  in
  doit !g

let () =
  let n = read_int () in
  let a = Array.make n 0 in
  let rec doit i =
    if i >= n then ()
    else (a.(i) <- read_int (); doit (i + 1))
  in
  doit 0;
  shell_sort a n;
  Printf.printf "%d\n" (List.length !g);
  print_list !g;
  Printf.printf "%d\n" !cnt;
  print_array a

Measured memory_bytes: 12560
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <map>
#define rep(i, n) for(int i=0;i<(int)(n);i++)
#define pb(a) push_back(a)
#define MAX(a, b) ((a < b)?b:a)
#define MIN(a, b) ((a > b)?b:a)
typedef long long int ll;
typedef unsigned long long int ull;
using namespace std;
ll N;
#define pow5(x) ((x)*(x)*(x)*(x)*(x))
int main()
{
	int a, b;
	cin >> a >> b;

	cout << a * b << endl;


	return 0;
}

Measured memory_bytes: 3564
#include <iostream>
#include <vector>
#include <queue>
#include <tuple>

using namespace std;

using ll =  long long;
using Pll = pair<ll, ll>;
using Pii = pair<int, int>;

constexpr int H_MAX = 800;
constexpr int W_MAX = 800;
constexpr int dyx[4][2] = {
    { 0, 1}, {-1, 0}, {0,-1}, {1, 0}
};

int H, W, K;
Pii start = {-1, -1};
vector<string> a(H_MAX);
vector<vector<int>> shortest_turn(H_MAX, vector<int>(W_MAX, 1<<30));

inline int calc_shortest_turn() {
    priority_queue<pair<int, Pii>, vector<pair<int, Pii>>, greater<pair<int, Pii>>> que;
    que.emplace(0, start);
    shortest_turn[start.first][start.second] = 0;

    int turn;
    Pii p;
    while(!que.empty()) {
        tie(turn, p) = que.top(); que.pop();
        if(shortest_turn[p.first][p.second] < turn) continue;
        if(p.first == 0 || p.first == H-1 || p.second == 0 || p.second == W-1) {
            return turn;
        }
        for(int k=0;k<4;++k) {
            Pii q = {
                p.first + dyx[k][0], 
                p.second + dyx[k][1]
            };
            if(q.first < 0 || H <= q.first || q.second < 0 || W <= q.second) continue;
            int new_turn = turn  + 1;
            if(a[q.first][q.second] == '#') {
                new_turn = max(new_turn, K+1);   
            }
            if(shortest_turn[q.first][q.second] > new_turn) {
                shortest_turn[q.first][q.second] = new_turn;
                que.emplace(new_turn, Pii(q.first, q.second));
            }
        }
    }

    return -1;
}

int main() {
    std::ios::sync_with_stdio(false); cin.tie(nullptr);
    cin >> H >> W >> K;
    for(int i=0;i<H;++i){
        cin >> a[i];
        for(int j=0;j<W;++j) {
            if(a[i][j] != '#') {
                if(a[i][j] == 'S') {
                    start = {i, j};
                    shortest_turn[i][j] = 0;
                }
            }
        }
    }

    cout << (calc_shortest_turn()+K-1)/K << endl;
    // for(int i=0;i<H;++i){
    //     for(int j=0;j<W;++j) {
    //         printf("%4d", (shortest_turn[i][j] == 1<<30)?999:shortest_turn[i][j]);
    //     }
    //     printf("\n");
    // }

}


Measured memory_bytes: 4032
import std.algorithm;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

void main() {
  int n, m;
  readf (" %d %d", n, m);
  auto a = new int[m];
  foreach (t; 0 .. m) {
    readf (" %d", a[t]);
  }
  auto r = n - sum (a);
  writeln (max (-1, r));
}



Measured memory_bytes: 3188
N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(M)]
BC = sorted(BC, key= lambda x:x[1], reverse=True)


BC2 = []
for i in range(M):
  BC2.extend([BC[i][1]] * BC[i][0])
  if len(BC2) > N : break
A.extend(BC2)
A.sort(reverse=True)

print(sum(A[:N]))

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

#define rep(i,j,n) for(int i=(j);i<(n);i++)
#define all(i) i.begin(),i.end()
#define rall(i) i.rbegin(),i.rend()
#define INF 1e9
#define LINF 1e18
const int mod = 1e9+7;

typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef pair<int, int> pi;
typedef long long i64;

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

  int sx, sy, tx, ty;
  cin >> sx >> sy >> tx >> ty;

  int dx = tx - sx;
  int dy = ty - sy;

  rep(i, 0, dy) cout << 'U';
  rep(i, 0, dx) cout << 'R';

  rep(i, 0, dy) cout << 'D';
  rep(i, 0, dx) cout << 'L';

  dy++;
  dx++;

  cout << 'L';
  rep(i, 0, dy) cout << 'U';
  rep(i, 0, dx) cout << 'R';
  cout << 'D';

  cout << 'R';
  rep(i, 0, dy) cout << 'D';
  rep(i, 0, dx) cout << 'L';
  cout << 'U';
  cout << endl;
}


Measured memory_bytes: 256
/* 
Rohit645
Rohit Kumar 
*/

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
using db = double;
using pll = pair < ll, ll >;

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

#define pb push_back
#define mp make_pair
#define all(v) v.begin(), v.end() 
#define fastIo() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const int MOD = 1e9 + 7, INF = INT_MAX, N = 1e5 + 10;

int main() {
	fastIo();
	ll n; cin >> n;
	ll a[n];
	double ans=0;
	for (ll i = 0; i < n; i++) {
		cin >> a[i];
		ans += (1*1.0)/(a[i]*1.0);
	}
	double fans = (1*1.0)/(ans*1.0);
	cout << fixed;
	cout << setprecision(12) << fans;
	return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
Scanner SC = new Scanner(System.in);
int x = SC.nextInt();
int t = SC.nextInt();
int Sandleft = x - t;
if(x <= t) {
	System.out.println(0);
}
else {
	System.out.println(Sandleft);
}
	}

}

Measured memory_bytes: 35796
n,c,k=map(int,input().split())
buscount=1
waiting=0
T=[]
for _ in range(n):
    t=int(input())
    T.append(t)
T=sorted(T)
mae_no_time=T[0]
noruhito=1
for i in range(1,n):
    waiting+=T[i]-mae_no_time
    noruhito+=1
    mae_no_time=T[i]
    if waiting>k or noruhito>c:
        buscount+=1
        waiting=0
        noruhito=1

print(buscount)


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

#include <iostream>
#include <iomanip>
#include <sstream>
#include <fstream>
#include <stdint.h>
#include <string.h>

//#define _USE_MATH_DEFINES
//#include <math.h>

#include <vector>
#include <list>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <deque>
#include <string>

#include <algorithm>
#include <functional>
#include <bitset>
#include <functional>
#include <chrono>
#include <random>
#define sqr(x) (x) * (x)

typedef unsigned int u32;
typedef int i32;
typedef unsigned long long int u64;
typedef int i64;
typedef uint16_t u16;
typedef int16_t i16;
typedef uint8_t u8;
typedef int8_t i8;

using namespace std;
using namespace std::chrono;

const i64 mod = 1000000007ll;
const i64 smod = 998244353ll;
const i64 inf = 1000000007; // 10000000000000007ll;

const double eps = 1e-8;

const i64 MAXN = 100 + 2;

i64 h, w;
string a[MAXN];

i64 dp[MAXN][MAXN];
pair<i64, i64> b[] = { {0, 1}, {1, 0} };

inline bool check(pair<i64, i64> p) {
    if (p.first >= h || p.second >= w) {
        return false;
    }
    return true;
}

void bfs() {
    set<pair<i64, i64>> q;
    q.insert({ 0, 0 });

    while (!q.empty()) {
        set<pair<i64, i64>> nq;

        for (auto e : q) {
            for (auto t : b) {
                pair<i64, i64> n = { e.first + t.first, e.second + t.second };
                if (!check(n)) {
                    continue;
                }
                nq.insert(n);
                dp[n.first][n.second] = min(dp[n.first][n.second], dp[e.first][e.second] + (a[n.first][n.second] == a[e.first][e.second] ? 0 : 1));
            }
        }

        q = nq;
    }
}

int main(int argc, char* argv[]) {
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout.precision(15); cout.setf(ios::fixed);

    cin >> h >> w;
    for (i64 i = 0; i < h; i++) {
        cin >> a[i];
    }

    for (i64 i = 0; i < h; i++) {
        for (i64 j = 0; j < w; j++) {
            dp[i][j] = inf;
        }
    }

    //if (a[0][0] == '#' && a[h - 1][w - 1] == '#') {
    //    dp[0][0] = 2;
    //    for (i64 i = 0; i < h; i++) {
    //        for (i64 j = 0; j < w; j++) {
    //            a[i][j] = a[i][j] == '#' ? '.' : '#';
    //        }
    //    }
    //}
    if (a[0][0] == '#') {
        dp[0][0] = 1;
    }
    else {
        dp[0][0] = 0;
    }

    bfs();
    cout << dp[h - 1][w - 1] / 2  + dp[h - 1][w - 1]  % 2<< endl;

    return 0;
}

Measured memory_bytes: 384
//khodaya khodet komak kon
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define all(x) x.begin(), x.end()
#pragma GCC optimize ("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize ("-O2")


using namespace std;

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

const int N = 200000 + 10;
const ll MOD = 1000000000 + 7;
const ll INF = 1000000010;
const ll LOG = 25;

ll h[N];
int n, sz[N];
vector<pii> G[N];

int DFS(int v = 1, int p = 0){
	sz[v] = 1;
	for (auto u:G[v]){
		if (u.F == p) continue;
		h[u.F] = h[v] + u.S;
		sz[v] += DFS(u.F, v);
	}
	return sz[v];
}

int Cent(int v, int p){
	for (auto u:G[v]){
		if (u.F == p) continue;
		if (2 * sz[u.F] > n) return Cent(u.F, v); 
	}
	return v;
}

int32_t main(){
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	cin >> n;
	for (int i = 0; i < n - 1; i++){
		int v, u, w;
		cin >> v >> u >> w;
		G[v].pb({u, w});
		G[u].pb({v, w});
	}
	DFS();
	int cen = Cent(1, 0);
	h[cen] = 0;
	DFS(cen);
	ll ans = 0;
//	cout << cen << '\n';
	for (int i = 1; i <= n; i++) ans += h[i];
	ans *= 2;
	int mn = INF;
	for (auto u:G[cen]){
		if (sz[u.F] == n / 2 && n % 2 == 0){
			return cout << ans - u.S, 0;
		}
		mn = min(mn, u.S);
	}
	cout << ans - mn;








	return 0;
}


Measured memory_bytes: 16384
n=int(input())
ro=[{}for i in range(n)]
dis=[-1]*n
for i in range(n-1):
    a,b,c=map(int,input().split())
    ro[a-1][b-1]=c
    ro[b-1][a-1]=c
q,k=map(int,input().split())
dis[k-1]=0
stack=[k-1]
while stack:
    s=stack.pop()
    for i,j in ro[s].items():
        if dis[i] == -1:
            dis[i]=dis[s]+j
            stack.append(i)
for i in range(q):
    x,y=map(int,input().split())
    x,y=x-1,y-1
    print(dis[x]+dis[y])


Measured memory_bytes: 97440
#include <iostream>
#include <algorithm>
#include <string>
#include <math.h>
#include <cstdint>
#include <vector>

using namespace std;
typedef long long ll;


ll ans=1e18,mx,mn=1e8,sum,cnt;

int main(){
	ll a,b,c;
	cin>>a>>b>>c;
	ans = (a+b)+1;
	if(ans > c) cout<< b+c;
	else cout<< ans + b<<endl;
}


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

  int main() {

LL X,Y;
cin>>X>>Y;
if(X*4>=Y && Y%2==0 && X*2<=Y){
  cout<<"Yes"<<endl;
}
else{
  cout<<"No"<<endl;
}
}


Measured memory_bytes: 3636
#include <stdio.h>
int main(){
  int data[4][14]; //0:S 1:H 2:C 3:D
  int n, i, num, a, b;
  char moji;

  for(a = 0; a < 4; a++) {
    for(b = 1; b <= 13; b++) {
      data[a][b] = b;
    }
  }

  scanf("%d", &n);
  for(i = 1; i <= n; i++) {
    scanf("%s%d",&moji,&num);
    if(moji == 'S') {
      data[0][num] = 0;
    } else if(moji == 'H') {
      data[1][num] = 0;
    } else if(moji == 'C') {
      data[2][num] = 0;
    } else if(moji == 'D') {
      data[3][num] = 0;
    }
  }

  for(a = 0; a < 4; a++) {
    for(b = 1; b <= 13; b++) {
      if(data[a][b] != 0) {
	if(a == 0) {
	  printf("S %d\n", data[a][b]);
	} else if(a == 1) {
	  printf("H %d\n", data[a][b]);
	} else if(a == 2) {
	  printf("C %d\n", data[a][b]);
	} else if(a == 3) {
	  printf("D %d\n", data[a][b]);
	}
      }
    }
  }

  return 0;
}

Measured memory_bytes: 596
a,b,c,d=map(int,input().split())
def gcd(x,y):
  if x%y==0:
    return y
  else:
    return gcd(y,x%y)
    
r=int((c*d)/gcd(c,d)) 
s=(b//c)-((a-1)//c)
t=(b//d)-((a-1)//d)
u=(b//r)-((a-1)//r)

print(int(b-a+1-s-t+u))


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

typedef long long ll;
typedef pair<int, int> P;

int MOD=1e9+7;
ll INF=1e18;

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

int main(){
    int n, k; cin>>n>>k;
    vector<int> c(n+10), g(n+10);
    vector<vector<int>> books(20);
    for(int i=0; i<n; i++) {
        cin>>c[i]>>g[i];
        books[g[i]].emplace_back(c[i]);
    }

    for(int i=0; i<=10; i++){
        sort(books[i].begin(), books[i].end(), greater<int>());
    }
    
    vector<vector<int>> sum(20, vector<int>(2010, 0));
    for(int i=1; i<=10; i++){
        for(int j=0; j<books[i].size(); j++){
            sum[i][j+1] = sum[i][j] + books[i][j] + j*2;
        }
    }

    vector<vector<int>> dp(20, vector<int>(k+10, 0));
    for(int i=1; i<=10; i++){
        for(int j=0; j<=k; j++){
            for(int l=0; j+l<=k; l++){
                dp[i][j+l]=max(dp[i][j+l], dp[i-1][j]+sum[i][l]);
            }
        }
    }
    cout << dp[10][k] << endl;
}


Measured memory_bytes: 3300
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <math.h>
#include <numeric>
#include <complex>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <unordered_map>
#include <set>
#include <bitset>
#include <functional>
#include <assert.h>
using ll=long long;
#define int ll
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define eb emplace_back
#define all(x) x.begin(),x.end()
#define SZ(x) ((int)x.size())
#define fi first
#define se second
const int INF = 1e15;
using namespace std;

template<class T> using vc=vector<T>;
template<class T> using vvc=vc<vc<T>>;

using pi=pair<int,int>;
using vi=vc<int>;

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

signed main() {
    cin.tie(0);
    ios::sync_with_stdio(0);
    cout<<fixed<<setprecision(20);

    int N; cin >> N;
    int A[N],B[N];
    rep(i,N) {
        cin >> A[i] >> B[i];
    }
    sort(A,A+N);
    sort(B,B+N);
    if(N%2){
        int ma=A[N/2],mb=B[N/2];
        cout << mb-ma+1 << endl;
    } else {
        int ma=A[N/2]+A[N/2-1],mb=B[N/2]+B[N/2-1];
        cout << mb-ma+1 << endl;
    }
}

Measured memory_bytes: 6772
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define rep(i,l,r) for (int i=(l); i<=(r); i++)
typedef long long ll;
using namespace std;

int n,k;

int main(){
	scanf("%d%d",&n,&k);
	if (k==1) puts("0"); else printf("%d\n",n-(k-1)-1);
	return 0;
}

Measured memory_bytes: 256
RC = input().split()
r = int(RC[0])
c = int(RC[1])
A_c_sum =[]
final_sum = 0
for j in range(c):
    A_c_sum.append(0)
for i in range(r):
    A_r = input().split()
    A_r_sum = 0
    for j in range(c):
        A_c_sum[j] += int(A_r[j])
        print(A_r[j]+" ", end="")
        A_r_sum += int(A_r[j])
    print(A_r_sum)
    final_sum += A_r_sum
print(" ".join(map(str,A_c_sum))+" ",end="")
print(final_sum)

Measured memory_bytes: 7680
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
 
int main() {
  int n;
  while(cin >> n && n!=0) {
    int a[1000001]={};
    for(int i=1; i<=n; i++) {
      scanf("%d",&a[i]);
    }
    sort(a, a+n+1);
    int max=1, color=a[1], cnt=1;
    for(int i=1; i<=n; i++) {
      if(a[i-1]==a[i]) {
	cnt++;
	if(cnt>max) {
	  max=cnt;
	  color=a[i];
	}
      }	else cnt=1;
    }
    if(max>n/2) cout << color << endl;
    else cout << "NO COLOR" << endl;
  }
  return 0;
}


Measured memory_bytes: 5172
<?php
fscanf(STDIN, '%d %d', $cnt, $must);
$friends = explode(' ', trim(fgets(STDIN)));
$ans = 0;
for ($i=0; $i < $cnt; $i++) { 
    if ($friends[$i] >= $must) {
        $ans++;
    }
}
echo $ans."\n";

Measured memory_bytes: 12792
import sys

sys.setrecursionlimit(1000000000)

N = int(input())
V = list(map(int, input().split()))
C = list(map(int, input().split()))


def rec(i, ans):
    if i == N:
        return ans
    else:
        return max(rec(i + 1, ans + V[i] - C[i]), rec(i + 1, ans))


ans = rec(0, 0)
print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <iomanip>
#include <set>
#include <map>
#include <utility>
#include <algorithm>
#include <cstdint>

using namespace std;

typedef long long signed int ll;

constexpr ll inf = 1000000000000000;

ll c[1001][1001], n, d[1001],m,e[1001];

int main() {
	for (ll i = 0; i <= 1000; i++) for (ll j = 0; j <= 1000; j++) c[i][j] = -inf;
	for (ll i = 0; i <= 1000; i++) d[i] = -inf;
	for (ll i = 0; i <= 1000; i++) e[i] = -inf;
	cin >> n >> m;
	for (ll i = 0; i < m; i++) {
		ll a, b, cc;
		cin >> a >> b >> cc;
		c[a][b] = cc;
	}
	d[1] = 0;
	bool update = true;
	for (ll i = 0; i < 1000 && update; i++) {
		update = false;
		for (ll j = 1; j <= 1000; j++) {
			for (ll k = 1; k <= 1000; k++) {
				if (d[k] < d[j] + c[j][k]) {
					d[k] = d[j] + c[j][k];
					update = true;
				}
			}
		}
	}
	update = true;
	for (ll i = 0; i < 1000 && update; i++) {
		update = false;
		for (ll j = 1; j <= 1000; j++) {
			for (ll k = 1; k <= 1000; k++) {
				if (d[k] < d[j] + c[j][k]) {
					d[k] = d[j] + c[j][k];
					e[k] = 0;
					update = true;
				}
			}
		}
	}
	if (e[n] == 0) cout << "inf";
	else cout << d[n];
	cout << endl;
}

Measured memory_bytes: 8064
#include<stdio.h>

int main(){
  int N, i, j, A[100], temp, flag = 1, count = 0;

  scanf("%d", &N);

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

  while(flag){
    flag = 0;
    for(j = N-1; j >= 1 ; j--){
      if(A[j] < A[j-1]){
	temp = A[j-1];
	A[j-1] = A[j];
	A[j] = temp;
	flag = 1;
	count++;
      }
    }
  }

  for(i = 0; i < N; i++){
    if(i == N-1){
      printf("%d\n",A[i]);
      break;
    }
    printf("%d ", A[i]);
  }
  printf("%d\n", count);
}



Measured memory_bytes: 2140
from collections import Counter
N = int(input())
D = list(map(int, input().split()))

ans = 0
cnt = 0
if (D[0]==0) and (D.count(0)==1):
  D = Counter(D)
  cnt = 1
  ans = 1
  for i in range(1, max(D)+1):
    if D[i] == 0:
      ans = 0
      break
    else:
      ans *= cnt ** D[i]
      cnt = D[i]
ans = ans % 998244353
print(ans)

Measured memory_bytes: 24304
#include<bits/stdc++.h>
#include <iostream>
#include <string>
using namespace std;
int main ()
{
  string str,t ;
  cin>>str;
  cin>>t;
  t.pop_back();
  
  if(str==t)
  cout<<"Yes";
  
  else
  cout<<"No";
  
  return 0;
}

Measured memory_bytes: 3628
#include<stdio.h>
             
            int main(){
              int a, b;
              scanf("%d%d", &a, &b);
              if ((a  < 13) && (a > 5)) printf("%d", b/2);
              if(a<=5) printf("%d", 0);
              if (a>=13)printf ("%d", b);
              return 0;
            }

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

using namespace std;

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

    int ans = 0;
    for (int i = 0; i < N; i++) {
        ans += a[i] - 1;
    }

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

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

arr = [[list() for _ in range(10)] for _ in range(10)]
count = 0

for i in range(1,n+1):
  arr[int(str(i)[0])][int(str(i)[-1])].append(i)

for i in range(1,10):
  for j in range(1,10):
    arr[i][j] = len(arr[i][j])

for i in range(1,10):
  for j in range(1,10):
    count += arr[i][j]*arr[j][i]
print(count)

Measured memory_bytes: 11620
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Deque;
import java.util.ArrayDeque;

public class Main {
    public static void main(String[] args) throws Exception {
        
        Deque<Integer> list = new ArrayDeque<Integer>();
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine());
        for(int i = 0; i < n; ++i){
            String line = br.readLine();
            char c = line.charAt(0);
            if(c == 'i')
                list.addFirst(Integer.valueOf(line.substring(7)));
            if(c == 'd'){
                int len = line.length();
                if(len == 11)
                    list.removeFirst();
                else if(len == 10)
                    list.removeLast();
                else
                    list.remove(Integer.valueOf(line.substring(7)));
            }
        }

        Integer m;
        if((m = list.pollLast()) != null){
            StringBuilder sb = new StringBuilder();
            for(int j : list)
                sb.append(j).append(" ");
            sb.append(m);
            System.out.println(sb);
        }
    }
}


Measured memory_bytes: 124832
n = int(input())
a = [int(input()) for i in range(n)]
b = a.copy()
b.sort()
a_max = b[-1]
a_second = b[-2]
for i in range(n):
    if a[i] == a_max:
        print(a_second)
    else:
        print(a_max)

Measured memory_bytes: 14132
#pragma region
#include <bits/stdc++.h>
using namespace std;
inline void ci(void){
  return;
}
template <typename First, typename... Rest>
void ci(First& first, Rest&... rest){
  cin >> first;
  ci(rest...);
  return;
}
inline void co(void){
  cout << "\n";
  return;
}
template <typename First, typename... Rest>
void co(First first, Rest... rest){
  cout << first << " ";
  co(rest...);
  return;
}
#define ll long long
#define ld long double
#define st string
#define dl double
#define wh while
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define tp tuple
#define ft first
#define sc second
#define ve vector
#define tos to_string
#define len length
#define rt return 0
#define repi(i, m, n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i, n) repi(i, 0, n)
#define sz(v) ((int)(v).size()) 
#define ea(i, n) for(auto&& i: n)
#define so(n) sort(n.begin(), n.end())
#define sp(n) cout << fixed << setprecision(n)
#pragma endregion
// abs 絶対値, rtsq ルート, pow(a, n) aのn乗

int main() {
  int N;
  ci(N);
  map<int, int> S;
  rep(i, N){
    int a;
    ci(a);
    S[a] += 1;
  }
  ea(i, S){
    if(i.sc > 1){
      co("NO");
      rt;
    }
  }
  co("YES");
}

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

int main() {
	// your code goes here
	int n;
	cin>>n;
	int arr[n+1];
	for(int i=1;i<=n;i++)
	{
		cin>>arr[i];
	}
	
	int dp[n+1];
	dp[1]=0;
	dp[2]=abs(arr[2]-arr[1]);
	
	for(int i=3;i<=n;i++)
	{
		dp[i]=min(dp[i-1]+abs(arr[i]-arr[i-1]),dp[i-2]+abs(arr[i]-arr[i-2]));
	}
	
	cout<<dp[n];
	return 0;
}

Measured memory_bytes: 1024
package main

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

func main() {
	a := &Alds12d{}
	a.main()
}

type Alds12d struct {
	swapCount int
	G         []int
}

// test
func (a *Alds12d) test() {

	nums := []int{5, 1, 4, 3, 2}
	//n := len(nums)

	a.swapCount = 0
	a.ShellSort(nums, len(nums))

	fmt.Println(len(a.G))
	for _, v := range a.G {
		fmt.Print(strconv.Itoa(v) + " ")
	}
	fmt.Println("")

	fmt.Println(a.swapCount)

	for _, v := range nums {
		fmt.Println(strconv.Itoa(v) + " ")
	}
}

// get input value
func (a *Alds12d) scanInput() (n int, nums []int) {
	scanner := bufio.NewScanner(os.Stdin)
	scanner.Split(bufio.ScanWords)
	scanner.Scan()
	n, _ = strconv.Atoi(scanner.Text())
	nums = make([]int, n)
	for i := 0; i < n; i++ {
		scanner.Scan()
		nums[i], _ = strconv.Atoi(scanner.Text())
	}
	return
}

// shell sort
func (a *Alds12d) ShellSort(nums []int, n int) {

	// make G
	// g(n+1) = 1 + 3 * g(n)
	a.G = []int{}
	v := 1
	for v <= n {
		a.G = append(a.G, v)
		v = 1 + 3*v
	}

	// Gの各値絵挿入ソートを実行
	// 最後は1で挿入ソートを実行するが、そのタイミングではほぼソートされていることが期待される
	for i := len(a.G) - 1; i >= 0; i-- {

		// gの間隔で、配列の後ろから挿入ソート
		g := a.G[i]

		// このループだと不要なswapが発生する
		//for r := g; r < n; r++ {
		//
		//	l := r - g
		//
		//	if nums[l] > nums[r] {
		//		nums[l], nums[r] = nums[r], nums[l]
		//		a.swapCount++
		//	}
		//
		//}

		for r := g; r < n; r++ {

			// gの間だけ開けた左側にある比較対象
			l := r - g

			// rの位置の値を退避
			v := nums[r]

			// rからgだけ左の値と比較、その間隔で戦闘まで繰り返し、左が大きければ入れ替え
			for l >= 0 && nums[l] > v {
				nums[l+g] = nums[l]
				a.swapCount++

				// g間隔ずつ移動
				l = l - g
			}

			// ループの最後の移動を打ち消し
			l = l + g
			nums[l] = v
		}
	}
}

// main
func (a *Alds12d) main() {

	//test()

	// input
	n, nums := a.scanInput()

	// solve
	a.ShellSort(nums, n)

	// output

	// - NG: OLE is raised
	//fmt.Println(len(g))
	//for i := len(g) - 1; i >= 0; i-- {
	//	fmt.Print(strconv.Itoa(g[i]) + " ")
	//}
	//fmt.Println("")
	//
	//fmt.Println(a.swapCount)
	//
	//for _, v := range nums {
	//	fmt.Println(strconv.Itoa(v) + " ")
	//}

	// OK
	fmt.Println(len(a.G))
	for i := len(a.G) - 1; i >= 0; i-- {
		fmt.Printf("%d ", a.G[i])
	}
	fmt.Println("")

	fmt.Println(a.swapCount)

	for _, v := range nums {
		fmt.Printf("%d ", v)
	}
}



Measured memory_bytes: 17424
class UnionFind:
	def __init__(self, n):
		self.n = n
		self.root = [-1]*(n+1)
		self.rnk = [0]*(n+1)
		self.Maxroot = -1

	def Find_Root(self, x):
		if (self.root[x] < 0):
			return x
		else:
			self.root[x] = self.Find_Root(self.root[x])
			return self.root[x]

	def Unite(self, x, y):
		x = self.Find_Root(x)
		y = self.Find_Root(y)
		if x == y:
			return 
		elif self.rnk[x] > self.rnk[y]:
			self.root[x] += self.root[y]
			if self.root[x] < self.Maxroot:
				self.Maxroot = self.root[x]
			self.root[y] = x
		else:
			self.root[y] += self.root[x]
			if self.root[y] < self.Maxroot:
				self.Maxroot = self.root[y]
			self.root[x] = y
			if self.rnk[x] == self.rnk[y]:
				self.rnk[y] += 1

	def isSameGroup(self, x, y):
		return self.Find_Root(x) == self.Find_Root(y)

	def Count(self, x):
		return self.root[self.Find_Root(x)] * (-1)


N, Q = map(int, input().split())
solve = UnionFind(N)
ans = []
for _ in range(Q):
	q,x,y = map(int, input().split())
	if q == 0:
		solve.Unite(x,y)
	else:
		ans.append(solve.isSameGroup(x,y))

for a in ans:
	if a:
		print(1)
	else:
		print(0)


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

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


Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(){
  int i, n, ans=0, ct=0;
  cin >> n;
  int h[n];
  for(i=0; i<n; i++)
    cin >> h[i];
  for(i=0; i<n-1; i++){
    if(h[i+1]<=h[i])
      ct++;
    else
      ct=0;
    if(ct>ans)
      ans=ct;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int m, d;
    cin >> m >> d;
    
    int ans = 0;
    for(int mi = 1; mi <= m; mi++) {
        for(int dj = 1; dj <= d; dj++) {
            int d1 = dj % 10;
            int d10 = (dj / 10) % 10;
            
            if(d1 >= 2 && d10 >= 2 && d1 * d10 == mi) {
                ans++;
            }
        }
    }
    
    cout << ans << endl;
    return 0;
}


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

using namespace std;

int main()
{
	long long x;
	long long cur = 100;

	scanf("%lld", &x);

	int cnt = 0;

	while (cur < x)
	{
		cur += cur / 100;

		cnt++;
	}

	printf("%d\n", cnt);

	return 0;
}

Measured memory_bytes: 1732
S = list((input()))
n = len(S)-1
ans = 0
for i in range(2**n):
    new_S = S[0]
    for j in range(n):
        if i >> j & 1:
            new_S += "+"+S[j+1]
        else:
            new_S += S[j+1]
    ans += eval(new_S)
print(ans)

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

typedef long long ll;
typedef long double ld; 
typedef double db; 
typedef string str; 

typedef pair<int, int> pi;
typedef pair<ll,ll> pl; 
typedef pair<ld,ld> pd; 

typedef vector<int> vi; 
typedef vector<ll> vl;
typedef vector<ld> vd; 
typedef vector<str> vs; 
typedef vector<pi> vpi;
typedef vector<pl> vpl; 

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define sz(x) (int)x.size()
#define all(x) begin(x), end(x)
#define rall(x) rbegin(x), rend(x)

#define mp make_pair
#define pb push_back
#define f first
#define s second
#define lb lower_bound 
#define ub upper_bound 

const int MOD = 998244353;
const ll INF = 1e18;
const int MX = 1000001;

int R;

int main() {
	cin.sync_with_stdio(0); cin.tie(0);
	cin >> R;
	cout << pow(R, 2);
    return 0;
    // You should actually read the stuff at the bottom
}

/* Stuff to Look For
 * -----------------
 * Int overflow, array bounds
 * Initializing all variables, avoid weird behavior
 * Edge cases(n = 0, n = 1)
 * Just return 0 after result
 */


Measured memory_bytes: 256
import java.util.Scanner;

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

        long A = scanner.nextLong();
        long V = scanner.nextLong();
        long B = scanner.nextLong();
        long W = scanner.nextLong();
        long T = scanner.nextLong();
        scanner.close();

        if (W >= V) {
            System.out.println("NO");
            return;
        }

        if (Math.abs(A - B) <= T * (V - W)) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}


Measured memory_bytes: 35772
n = int(input())
v_list = sorted(map(int, input().split()))


for i in range(len(v_list) - 1):
    v_list[i + 1] = (v_list[i] + v_list[i + 1]) / 2
    # print(f"{i}: {v_list}")

print(v_list[-1])


Measured memory_bytes: 2940
#include <iostream>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
using namespace std;
using Int = long long;
int main()
{
    int n, d, x;
    cin >> n >> d >> x;
    int cho = 0;
    for (int i = 1; i <= n; i++) {
        int a;
        cin >> a;
        for (int j = 1; j <= d; j += a) cho++;
    }
    cout << cho + x << endl;
    return 0;
}


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

using namespace std;

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

    int N;
    cin >> N;
    vector<vector<int>> A(N, vector<int>(N - 1));
    for (int i = 0; i < N; ++i) {
        for (int j = 0; j < N - 1; ++j) {
            cin >> A[i][j];
            --A[i][j];
        }
    }
    queue<tuple<int, int, int>> q_ready;
    vector<int> in_q(N, 0);
    for (int i = 0; i < N; ++i) {
        int u = i, v = A[i][0];
        if (u == A[v][0] && !in_q[u] && !in_q[v]) {
            q_ready.emplace(u, v, 1);
            in_q[u] = in_q[v] = 1;
        }
    }
    vector<int> cur_ind(N, 0);
    int day = 1;
    for (int i = 0; i < N * (N - 1) / 2; ++i) {
        if (q_ready.empty()) {
            cout << -1 << "\n";
            return 0;
        }
        int u, v, d;
        tie(u, v, d) = q_ready.front();
        q_ready.pop();
        in_q[u] = in_q[v] = 0;
        day = max(day, d);
        ++cur_ind[u];
        ++cur_ind[v];
        if (cur_ind[u] < N - 1) {
            int w = A[u][cur_ind[u]];
            if (u == A[w][cur_ind[w]] && !in_q[u] && !in_q[w]) {
                q_ready.emplace(u, w, d + 1);
                in_q[u] = in_q[w] = 1;
            }
        }
        if (cur_ind[v] < N - 1) {
            int w = A[v][cur_ind[v]];
            if (v == A[w][cur_ind[w]] && !in_q[v] && !in_q[w]) {
                q_ready.emplace(v, w, d + 1);
                in_q[v] = in_q[w] = 1;
            }
        }
    }
    cout << day << "\n";

    return 0;
}

Measured memory_bytes: 4224
import bisect
n = int(input())
s = list(map(int, input().split()))
q = int(input())
t = list(map(int, input().split()))
s,t = sorted(s), sorted(t)

ans = 0
for i in t:
    up_index = bisect.bisect_left(s,i)
    if up_index != n:
        if s[up_index] == i:
            ans += 1
    
print(ans)



Measured memory_bytes: 16740
#include <iostream>
#include <string>
#include <algorithm>

using namespace std;

int countChanges(string& s, char color)
{
  int ret = 0;
  for(auto& ch : s)
  {
    if(color != ch)
    {
      ++ret;
    }
    color = (color == '0') ? '1' : '0';
  }
  return ret;
}
int main()
{
  string s; cin >> s;
  int n = s.length();
  cout <<  min(countChanges(s, '0'), countChanges(s, '1'));
  return 0;
}

Measured memory_bytes: 512
// https://atcoder.jp/contests/agc029/tasks/agc029_b
//
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use std::fmt::*;
use std::io::*;
use std::str::*;

macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

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

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

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

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

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

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

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        println!(concat!($(stringify!($a), " = {:?}, "),*), $($a),*);
    }
}

fn solve_odd(a: Vec<u64>) -> usize {
    let mut a = a;
    a.sort();
    a.reverse();

    let mut ans = 0;
    let mut mp: HashMap<u64, usize> = HashMap::new();
    for ai in a {
        let mut has = false;
        for w in 1..32 {
            if ai < 1 << w {
                let rem = (1 << w) - ai;
                let mut h = *mp.get(&rem).unwrap_or(&0);
                if h >= 1 {
                    ans += 1;
                    h -= 1;
                    has = true;
                    mp.insert(rem, h);
                    break;
                }
            }
        }
        if !has {
            let w = mp.get(&ai).unwrap_or(&0) + 1;
            mp.insert(ai, w);
        }
    }
    ans
}

fn solve(a: Vec<u64>) -> usize {
    if a.len() <= 1 {
        return 0;
    }
    let mut odds = vec![];
    let mut rem = vec![];
    for ai in a {
        if ai % 2 == 1 {
            odds.push(ai);
        } else {
            rem.push(ai / 2);
        }
    }
    solve_odd(odds) + solve(rem)
}

fn main() {
    input! {
        n: usize,
        a: [u64; n]
    };

    println!("{}", solve(a));
}


Measured memory_bytes: 15320
#include <iostream>
#include<utility>
#include<iomanip>
#include<cmath>
#include<algorithm>
#include<cfloat>
#include<functional>
#include<string>
#include<numeric>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<cctype>
#include<iterator>
#include <stdio.h>
#include <string.h>
#include <sstream>
//#include<conio.h>
#define ReadFile freopen("input.txt","r",stdin)
#define WriteFile freopen("output.txt","w",stdout)
#define MEGA_MIND ios_base::sync_with_stdio(0);cin.tie(0); cout.tie(0);
#define M_PI 3.14159265358979323846
#define mod 1000000007
#define endl "\n"
using namespace std;
using ll = long long;
using lli = long long int;
using ld = long double;


const int N = 5e6 + 5, inf = 2e9;

ll nCr(int n, int r)
{
	ll ans = 1;
	ll rFact = 2;
	for (ll i = n - r + 1; i <= n; i++)
	{
		ans = (ans % mod * i % mod) % mod;
		if (ans % rFact == 0 && rFact <= r)
		{
			ans = (ans % mod / rFact % mod) % mod;
			rFact++;
		}
	}
	return ans;
}
int main()
{
	MEGA_MIND

			int n, m;
			cin >> n >> m;
			cout << nCr(n, 2) + nCr(m, 2) << endl;
		
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
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 (b<a) {a=b; return 1;} return 0;}

const int mod = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int H, W, K;
    cin >> H >> W >> K;
    vvi dp(H+1, vi(W, 0));
    dp[0][0] = 1;
    rep(i, H) {
        rep(j, W) {
            rep(bit, 1<<(W-1)) {
                bool ok = true;
                rep(k, W-2) {
                    if (((bit>>k)&1) && ((bit>>(k+1))&1)) ok = false;
                }
                if (ok) {
                    if (j >= 1 && ((bit>>(j-1))&1)) {
                        dp[i+1][j-1] += dp[i][j];
                        dp[i+1][j-1] %= mod;
                    } else if (j <= W-2 && ((bit>>j)&1)) {
                        dp[i+1][j+1] += dp[i][j];
                        dp[i+1][j+1] %= mod;
                    } else {
                        dp[i+1][j] += dp[i][j];
                        dp[i+1][j] %= mod;
                    }
                }
            }
        } 
    }
    cout << dp[H][K-1] << endl;
}

Measured memory_bytes: 256