akhauriyash/Code-Regression huggingface dataset:
import java.util.Scanner;

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();
		sc.close();
		if(a==b&&a!=c){
			System.out.println("Yes");
		}else if(a==c&&a!=b){
			System.out.println("Yes");
		}else if(b==c&&b!=a){
			System.out.println("Yes");
		}else{
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 23124
n,m,X,Y = map(int, input().split())
import numpy as np
x = np.array(list(map(int, input().split())))
y = np.array(list(map(int, input().split())))

for i in range(X+1,Y+1):
  if (x<i).all() and (y>=i).all():
    print("No War")
    break
else:
  print("War")

Measured memory_bytes: 12508
import sys
import itertools
arr = [i for i in range(-150,151)]
X = int(input())
t = len(arr)

for v in itertools.permutations(arr,2):
   if v[0]**5 - v[1]**5==X:
      print("{0} {1}".format(v[0],v[1]))
      sys.exit()

Measured memory_bytes: 9192
module Main where

import Data.List
import Control.Monad
import Debug.Trace
import qualified Data.ByteString.Char8 as BC
import Data.Maybe (fromJust)


readTuple2 :: IO (Int, Int)
readTuple2 = do
    [a, b] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b)

readTuple3 :: IO (Int, Int, Int)
readTuple3 = do
    [a, b, c] <- map (fst . fromJust . BC.readInt) . BC.words <$> BC.getLine
    return (a, b, c)

readInt :: IO Int
readInt = fst . fromJust . BC.readInt <$> BC.getLine
    

main = do
    (a, b) <- readTuple2
    if a > 12 then
        print b
    else if a > 5 then
        print $ b `div` 2
    else
        putStrLn "0"
    


Measured memory_bytes: 380
import java.util.*;

public class Main {

    private static final int[] VEC = {-1, 0, 1};

    public static void main(String[] args) {
        new Main().execute();
    }


    public void execute() {
        Scanner sc = new Scanner(System.in);
        while (true) {
            int W = sc.nextInt();
            int H = sc.nextInt();

            if (W == 0 && H == 0) {
                break;
            }

            int[][] field = new int[H][W];
            for (int i = 0; i < H; i++) {
                for (int j = 0; j < W; j++) {
                    field[i][j] = sc.nextInt();
                }
            }
            System.out.println(countIslands(W, H, field));
        }

        sc.close();
    }

    private int countIslands(int w, int h, int[][] field) {
        int count = 0;
        for (int i = 0; i < h; i++) {
            for (int j = 0; j < w; j++) {
                if (field[i][j] == 1) {
                    dfsIsland(i, j, field);
                    count++;
                }
            }
        }

        return count;
    }

    private void dfsIsland(int x, int y, int[][] field) {
        field[x][y] = 0;
        for (int dx : VEC) {
            for (int dy : VEC) {
                int x1 = x + dx;
                int y1 = y + dy;
                if (x1 >= 0 && y1 >= 0 && x1 < field.length && y1 < field[x].length) {
                    if (field[x1][y1] == 1) {
                        dfsIsland(x1, y1, field);
                    }
                }
            }
        }
    }


}


Measured memory_bytes: 45292
#include<iostream>
#include<cstdio>
#include<cstring>
#include<set>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long ll;
inline int read(){
	int x=0,f=1;
	char c=getchar();
	while(c<'0'||c>'9'){
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0'&&c<='9'){
		x=(x<<1)+(x<<3)+c-'0';
		c=getchar();
	}
	return x*f;
}
int n,L;
ll ans;
struct Inter{
	int pos,val,l,r;
	Inter(int _p=0,int _v=0,int _l=0,int _r=0){pos=_p,val=_v,l=_l,r=_r;}
};
struct cmp1{
	bool operator ()(const Inter a,const Inter b)const{
		return a.pos<b.pos;
	}
};
struct cmp2{
	bool operator ()(const Inter a,const Inter b)const{
		return a.val==b.val?a.pos<b.pos:a.val<b.val;
	}
};
set<Inter,cmp1> p;
set<Inter,cmp2> s;
inline ll calc(vector<Inter> &v){
	ll tot=0,sum=0;
	for(int i=0;i+L-1<(int)v.size();++i){
		sum+=v[i].l;
		tot+=sum*v[i+L-1].r;
	}
	return tot;
}
int main(){
	n=read(),L=read();
	for(int i=1;i<=n;++i){
		int x=read();
		Inter zyk(i,x,1,1);
		p.insert(zyk),s.insert(zyk);
	}
	while(!s.empty()){
		int w=s.begin()->val;
		vector<Inter> t;
		while(s.begin()->val==w){
			t.push_back(*s.begin());
			s.erase(s.begin());
		}
		for(int l=0,r=1;l<(int)t.size();l=r++){
			while(r<(int)t.size()&&(--p.find(t[r]))==p.find(t[r-1]))++r;
			int len=r-l,cnt=len/L;
			if(!cnt)continue;
			vector<Inter> myh,zyy;
			myh.insert(myh.begin(),t.begin()+l,t.begin()+r);
			for(auto x:myh){
				p.erase(x);
			}
			ans+=calc(myh);
			for(int i=0;i<cnt;++i){
				zyy.push_back(Inter(myh[0].pos+i,w+1,0,0));
			}
			for(int i=0;i+L-1<(int)myh.size();++i){
				zyy[cnt-((int)myh.size()-i)/L].l+=myh[i].l;
			}
			for(int i=L-1;i<(int)myh.size();++i){
				zyy[(i-L+1)/L].r+=myh[i].r;
			}
			ans-=calc(zyy);
			for(auto x:zyy){
				p.insert(x),s.insert(x);
			}
		}
	}
	printf("%lld\n",ans+n);
	return 0;
}



Measured memory_bytes: 32988
#include <iostream>
#include <fstream>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <queue>
#include <deque>
#include <stack>
#include <functional>
#include <algorithm>
#include <climits>
#include <cmath>
#include <iomanip>
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long
struct UnionFind {
	vector<int> par;
	UnionFind(int x) : par(x, -1) {}
	void init(int x) { par.assign(x, -1); }
	int root(int x) {
		if (par[x] <= -1) return x;
		else return root(par[x]);
	}
	bool issame(int x, int y) {
		return root(x) == root(y);
	}
	bool merge(int x, int y) {
		x = root(x); y = root(y);
		if (x == y) return false;
		if (par[x] > par[y]) swap(x, y);
		par[x] += par[y];
		par[y] = x;
		return true;
	}
	int size(int x) {
		return -par[root(x)];
	}
};
int ans[100010];
signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    int a[100010], b[100010];
    rep(i, M) {
        cin >> a[i] >> b[i];
        a[i]--; b[i]--;
    }
    int sum = N * (N - 1) / 2;
    UnionFind UF(N);
    RREP(i, M - 1, 0) {
        ans[i] = sum;
        int diff = -UF.size(a[i]);
        if(!UF.issame(a[i], b[i])) {
            sum -= UF.size(a[i]) * UF.size(b[i]);
            UF.merge(a[i], b[i]);   
        }     
        
    }
    rep(i, M) cout << ans[i] << endl;


    return 0;
}


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

/*int main(void)
{
    int a, b;
    cin >> a >> b;
    
    vector<int> n(5);
    int ans = 0;
    for (int i = a; i <= b; i++)
    {
        for (int j = 0; j < 5; j++)
        {
            n[j] = i % 10;
            i /= 10;
        }
        if (n[0] == n[4])
        {
            if (n[1] == n[3])
            {
                ans++;
            }
        }
    }

    cout << ans << endl;
}*/

/*int main(void)
{
    int a, b;
    cin >> a >> b;

    string s;
    int ans = 0;
    for (int i = a; i <= b; i++)
    {
        s = to_string(i);
        if (s[0] == s[4])
        {
            if (s[1] == s[3])
            {
                ans++;
            }
        }
    }
    cout << ans << endl;
}*/


int main()
{
    int a, b;
    cin >> a >> b;

    int ans = 0;
    for (int i = a; i <= b; i++)
    {
        int s = i % 10, t = i / 10000;
        int u = i / 10 % 10, v = i / 1000 % 10;
        if (s == t && u == v)
        {
            ans++;
        } 
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<string.h>

int main(void)
{
  char s1[4],s2[4],s3[4];
  scanf("%s%s%s",s1,s2,s3);
  printf("%c%c%c\n",s1[0],s2[1],s3[2]);
  return 0;
}


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

#define debug(x) cerr << x << " = "(x) << endl;
#define ll long long
#define rep(i,x,y) for(int i=x;i<y;i++)
#define rel(i,x,y) for(int i=x-1;i>=y;i--)
#define all(x) x.begin(),x.end()

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    int n,k; cin >> n >> k;
    int a[n];
    rep(i,0,n) cin >> a[i];
    int imos[n+1] = {}; //nはマージン、いもすのはみ出した時使う。
    rep(i,0,n){
        imos[max(0,i-a[i])]++;
        imos[min(n,i+a[i]+1)]--;
    }
    int rui[n+1] = {};
    rui[0] = imos[0];
    rep(i,0,n) rui[i+1] = rui[i] + imos[i+1];
    rep(i,0,min((int)log(n)+100,k-1)){
        int imos1[n+1] = {};
        rep(j,0,n){
            imos1[max(0,j-rui[j])]++;
            imos1[min(n,j+rui[j]+1)]--;
        }
        rep(j,0,n) rui[j]  = 0;
        rui[0] = imos1[0];
        rep(j,0,n) rui[j+1] = rui[j] + imos1[j+1];
    }
    rep(i,0,n){
        cout << rui[i] << " ";
    }
    cout << endl;
}

Measured memory_bytes: 6876
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld EPS = 1e-12;
constexpr ld PI = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }


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

	int n;
	cin >> n;
	vector<int> a(n + 2);
	rep(i, n) cin >> a[i + 1];
	a[0] = a[n + 1] = 0;
	int sum = 0;
	rep(i, n + 1) sum += abs(a[i] - a[i + 1]);
	rep(i, n) cout << sum - abs(a[i] - a[i + 1]) - abs(a[i + 1] - a[i + 2]) + abs(a[i] - a[i + 2]) << '\n';
}

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

int gcd(int a, int b){
  while(b){
	int r = a % b;
    a = b;
    b = r;
  }
  return a;
}
int main(){
	int n;
  cin >> n;
  int a[n];
    for(int i = 0; i < n; i++){
    	cin >> a[i];
    }
  int g = a[0];
	for(int i = 0; i < n; i++){
     	g = gcd(g, a[i]); 
    }
  cout << g << endl;

  return 0;
}

Measured memory_bytes: 640
#include<iostream>
#include<cstdio>
#include<string>
	using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	string s="",t="",k="";
	cin>>s>>t;
	int len=s.size();
	for(int i=0;i<len;i++)
	{
		k="";
		for(int j=0,w=i;j<len;j++,w=(w==len-1)?0:(w+1)) k+=s[w];
		if(k==t)
		{
			cout<<"Yes";
			return 0;
		}
	}
	cout<<"No";
	return 0;
}

Measured memory_bytes: 256
import std.stdio, std.algorithm, std.conv, std.array, std.string, std.math, std.typecons, std.numeric;

void main()
{
    auto nk = readln.split.to!(int[]);
    auto N = nk[0];
    auto K = nk[1];
    auto rsp = readln.split.to!(long[]);
    auto r = rsp[0];
    auto s = rsp[1];
    auto p = rsp[2];
    auto T = readln.chomp;

    long add(int i) {
        switch (T[i]) {
            case 'r': return p;
            case 's': return r;
            case 'p': return s;
            default:
        }
        return 0;
    }

    long res;
    foreach (i; 0..K) {
        auto j = i;
        bool added;
        while (j < N) {
            if (j == i) {
                res += add(j);
                added = true;
            } else if (T[j-K] != T[j]) {
                res += add(j);
                added = true;
            } else if (!added) {
                res += add(j);
                added = true;
            } else {
                added = false;
            }
            j += K;
        }
    }

    writeln(res);
}

Measured memory_bytes: 2428
N = int(raw_input())

v = 10**9 + 7

t = 1
mod = []
for i in range(1,N+1):
    t = t * i
    if (t > v):
        mod.append(t % v)
        t = 1 #reset
mod.append(t % v)

#print mod

s = 1
for j in range(len(mod)):
    s = s * mod[j]

ans = s % v
print ans


Measured memory_bytes: 7284
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
typedef long long ll;
using Graph = vector<vector<int>>;
int main() {
  ll x1,x2,y1,y2;
  cin >> x1 >> x2 >> y1 >> y2;
  ll ans = max(x1*y1, x1*y2);
  ans = max(ans, x2*y1);
  ans = max(ans, x2*y2);
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3596
#![allow(unused_imports)]
#![allow(non_snake_case)]

use std::cell::RefCell;
use std::cmp::{max, min, Ordering};
use std::collections::*;
use std::fmt::{Debug, Formatter, Write as FmtWrite};
use std::io::{stderr, stdin, BufRead, Write};
use std::mem::{replace, swap};
use std::ops::*;
use std::rc::Rc;

// -----------------------------------------------
// Framework <https://github.com/vain0x/procon>
// -----------------------------------------------

#[cfg(debug_assertions)]
include!{"./procon/debug.rs"}

#[cfg(not(debug_assertions))]
macro_rules! debug {
    ($($arg:expr),*) => {};
}

#[allow(unused_macros)]
macro_rules! read {
    ([$t:ty] ; $n:expr) =>
        ((0..$n).map(|_| read!([$t])).collect::<Vec<_>>());
    ($($t:ty),+ ; $n:expr) =>
        ((0..$n).map(|_| read!($($t),+)).collect::<Vec<_>>());
    ([$t:ty]) =>
        (rl().split_whitespace().map(|w| w.parse().unwrap()).collect::<Vec<$t>>());
    ($t:ty) =>
        (rl().parse::<$t>().unwrap());
    ($($t:ty),*) => {{
        let buf = rl();
        let mut w = buf.split_whitespace();
        ($(w.next().unwrap().parse::<$t>().unwrap()),*)
    }};
}

#[allow(dead_code)]
fn rl() -> String {
    let mut buf = String::new();
    stdin().read_line(&mut buf).unwrap();
    buf.trim_right().to_owned()
}

trait IteratorExt: Iterator + Sized {
    fn vec(self) -> Vec<Self::Item> {
        self.collect()
    }
}

impl<T: Iterator> IteratorExt for T {}

// -----------------------------------------------
// Solution
// -----------------------------------------------

fn main() {
    let (N, T) = read!(usize, i64);
    let R = read!(i64, i64; N);

    let mut mi = std::i64::MAX;
    let mut tle = true;
    for (c, t) in R {
        if t <= T {
            mi = min(mi, c);
            tle = false;
        }
    }

    if tle {
        println!("TLE");
    } else {
        println!("{}", mi)
    }
}


Measured memory_bytes: 4352
#include <iostream>

using namespace std ;

int main()
{
string s;
cin>>s;
int x=700;
if(s[0]=='o')
    x=x+100;

if(s[1]=='o')
    x=x+100;
if(s[2]=='o')
    x=x+100;
cout<<x;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = int(a); i < int(b); ++i)
typedef long long ll;
long long mod = 1e9 + 7;
const long long INF = 1LL << 60;
using namespace std;

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

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

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

  ll ans = 0;
  repi(i, 1, k + 1) repi(j, 1, k + 1) repi(l, 1, k + 1)
  {
    ans += gcd(i, gcd(j, l));
  }

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


Measured memory_bytes: 3632
# -*- coding: utf-8 -*-

N = str(input())

h = "hon"
p = "pon"
b = "bon"

if (N[-1] == "3"):
    print(b)

elif (N[-1] == "0" or N[-1] == "1" or N[-1] == "6" or N[-1] == "8"):
    print(p)

else:
    print(h)

Measured memory_bytes: 9060
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define ll long long int
#define ff first
#define ss second
#define S size()
#define mod (ll)(1e9+7)
#define mset(a,k) memset(a,k,sizeof(a))
#define fr(i, x, y) for ( ll i = x; i < y;i++)
#define dr(i, x, y) for ( ll i = x; i >= y; i--)
#define all(v) v.begin(), v.end()
#define pqueue priority_queue<ll>
#define piqueue priority_queue<ll,vll ,greater<ll>>
#define mapcl map<char,ll>
#define mapll map<ll,ll>
#define mapsl map<string,ll>
#define vi vector<ll>
#define vs vector<string>
#define vb vector<bool>
#define psi pair<string,ll>
#define pii pair<ll,ll>
#define piii pair<ll,pii>
#define vii vector<pii>
#define vvi vector<vi>
#define vvii vector<vii>
using namespace std;
void fast() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
}
//----------------------------------------FUNCTIONS-------------------------------------
ll gcd(ll x, ll y )						{if (y == 0) return x; return gcd(y, x % y);}
ll lcm(ll a, ll b)						{return (a * b) / gcd(a, b);}
ll logx(ll base, ll num)				{int cnt = 0; while (num != 1) {num /= base; ++cnt;} return cnt;}
vi vin(ll n)							{vi a(n); fr(i, 0, n) cin >> a[i]; return a;}
void out(vi a)							{for (int i = 0; i < (ll)a.S; i++) { cout << a[i] << " "; } cout << endl;}
void in(ll *a, ll n)        			{for (ll i = 0; i < n; i++)cin >> a[i];}
void out(ll *a, ll n)					{fr(i, 0, n) {cout << a[i] << " ";} cout << '\n';}
void out1(vi v)							{fr(i, 0, (ll)v.S) {cout << v[i] << " ";} cout << endl;}
const ll MAXN = (ll)(1 * 1e6 + 5 ), level = 22;
void solve()
{
ll n;
cin>>n;
ll a[n];
in(a,n);
ll m;
cin>>m;
ll sum=0;
fr(i,0,m)
{
    sum=0;
    ll pos,t;
    cin>>pos>>t;
    sum+=t;
    fr(i,0,n)if(i+1!=pos)sum+=a[i];
    cout<<sum<<'\n';
}
}
int main()
{

#ifndef ONLINE_JUDGE
	freopen ("inp4.txt", "r", stdin);
	freopen ("out4.txt", "w", stdout);
#endif
	fast();

	ll t = 1;
	//cin >> t;
	//sieve(1e7 + 5);
	fr(i, 0, t)
	{
		solve();
	}
}



Measured memory_bytes: 3596
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
using VI = vector<int>;
using VL = vector<LL>;
using PII = pair<int, int>;
using PLL = pair<LL, LL>;

#define SZ(a) (int)a.size()
#define ALL(a) a.begin(), a.end()
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define f first
#define s second
#define FOR(i, a, b) for (int i = (a); i<(b); ++i)
#define RFOR(i, b, a) for (int i = (b)-1; i>=(a); --i)
#define FILL(a, b) memset(a, b, sizeof(a))

void dout() { cerr << endl; }

template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

const int MOD = 998244353;

vector<vector<pair<int, double>>> g; 

double dist(PII a, PII b)
{
	return sqrt((LL)(a.f - b.f) * (a.f - b.f) + (LL)(a.s - b.s) * (a.s - b.s));
}

int main()
{
    ios::sync_with_stdio(false);
    PII s, t;
    cin >> s.f >> s.s >> t.f >> t.s;
    int n;
    cin >> n;
    g.resize(n + 2);
    VI x(n + 1), y(n + 1), r(n + 1);
    for (int i = 1; i < n + 1; ++i)
    {
    	cin >> x[i] >> y[i] >> r[i];
    }

    for (int i = 1; i < n + 1; ++i)
    {
    	for (int j = i + 1; j < n + 1; ++j)
    	{
    		double d = dist({x[i], y[i]}, {x[j], y[j]});
    		d = max((double)0.0, d - r[i] - r[j]);
    		g[i].EB(j, d);
    		g[j].EB(i, d);
    	}
    }

    for (int i = 1; i < n + 1; ++i)
    {
    	double d = dist(s, {x[i], y[i]});
    	d = max((double)0.0, d - r[i]);
    	g[0].EB(i, d);
    	g[i].EB(0, d);
    	d = dist(t, {x[i], y[i]});
    	d = max((double)0.0, d - r[i]);
    	g[n + 1].EB(i, d);
    	g[i].EB(n + 1, d);
    }
    g[0].EB(n + 1, dist(s, t));
    g[n + 1].EB(0, dist(s, t));
    
    vector<double> dist(n + 2, 1e18);
    dist[0] = 0;
    priority_queue<pair<double, int>> que;
    que.emplace(dist[0], 0);
    while(!que.empty())
    {
    	auto kek = que.top();
    	double cur_d = -kek.f;
    	int v = kek.s;
    	que.pop();
    	if (cur_d > dist[v])
    	{
    		continue;
    	}
    	for (auto el : g[v])
    	{
    		int to = el.f;
    		double w = el.s;
    		if (dist[to] > dist[v] + w)
    		{
    			dist[to] = dist[v] + w;
    			que.emplace(-dist[to], to);
    		}
    	}
    }

    cout << fixed << setprecision(12) << dist[n + 1] << "\n";

    return 0;
}

Measured memory_bytes: 22660
#include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  string s; cin >> s;
  int ans = 0;
  FOR(i,0,s.length()) {
    if(s[i] == '1') ans++;
  }
  cout << ans << 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;
using ll = long long;

int main() {
  int N, K;
  cin >> N >> K;

  if (N >= 2 * K - 1)
    cout << "YES" << endl;
  else
    cout << "NO" << endl;
  return 0;
}

Measured memory_bytes: 3600
from collections import defaultdict

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

dic1 = defaultdict(int)
dic2 = defaultdict(int)
dic3 = defaultdict(int)
list1 = []
list2 = []
ans = 0
for s in S:
    for xx in list2:
        if dic3[xx + s] == 0:
            ans += 1
            dic3[xx + s] = 1
    for x in list1:
        if dic2[x + s] == 0:
            dic2[x + s] = 1
            list2.append(x + s)
    if dic1[s] == 0:
        dic1[s] = 1
        list1.append(s)
print(ans)


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

int main()
{
  int n,i;
  int pay,s;
  while(cin>>pay,pay){
    s=0;
    for(i=0;i<9;i++){
      cin>>n;
      s+=n;
    }
    cout<<pay-s<<endl;
  }
}

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

const int max = 1000000000;

int n;
int data[101][101];
int cost[101];
bool used[101];

void dijkstra(int s){
	for (int i = 1; i <= n; i++)cost[i] = max;
	for (int i = 1; i <= n; i++)used[i] = false;

	cost[s] = 0;
	while (true){
		int v = -1;
		for (int i = 1; i <= n; i++){
			if (!used[i] && (v == -1 || cost[i] < cost[v]))v = i;
		}
		if (v == -1)break;

		used[v] = true;

		for (int i = 1; i <= n; i++){
			cost[i] = std::min(cost[i], cost[v] + data[v][i]);
		}
	}
}

int main(){

	int k;
	while (std::cin >> n >> k, n || k){
		for (int i = 1; i <= 100; i++){
			for (int j = 1; j <= 100; j++){
				data[i][j] = max;
			}
		}

		for (int i = 0; i < k; i++){
			int t;
			std::cin >> t;

			if (t == 0){
				int a, b;
				std::cin >> a >> b;

				dijkstra(a);
				if (cost[b] == max)std::cout << -1 << std::endl;
				else std::cout << cost[b] << std::endl;
			}

			if (t == 1){
				int c, d, e;
				std::cin >> c >> d >> e;

				data[c][d] = std::min(data[c][d], e);
				data[d][c] = std::min(data[d][c], e);
			}
		}
	}

	return 0;
}

Measured memory_bytes: 1204
def lr_op(expr, length):
	op = {"+": lambda x,y : x + y, "*": lambda x,y : x * y }
	result = expr[0]
	inc = 1
	while inc < length:
		result = op[expr[inc]](result,expr[inc+1])
		inc += 2
	return result
inputs = raw_input()
length = len(inputs)
expr = [int(inputs[i]) if i % 2 == 0 else inputs[i] for i in range(length)]
bob = int(raw_input())
L = lr_op(expr, length)
inc = 1
while inc < length:
	if expr[inc] == "*":
		expr[inc] = expr[inc-1] * expr[inc+1]
		for i in range(2):
			del expr[inc-1+i]
		length -= 2
	else :
		inc += 2
M = lr_op(expr, length)
if M == bob:
	print "U" if L == bob else "M"
else :
	print "L" if L == bob else "I"

Measured memory_bytes: 4268
// ABC061_B
#include <iostream>
#include <cstdio>
#include <string>
#include <vector>
#include <iterator>  // std::back_inserter()
#include <tuple>  // std::tuple std::get
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>  // std::copy()
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>  // std::setprecision()
using namespace std;

#define ALL(obj) (obj).begin(), (obj).end()
#define REP(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define REPN(i, n) for (ll i=1; i <= n; i++)  // 1 ~ n
#define MIN(vec) min_element(ALL((vec)))  // イテレータのため、値を取り出すときは * を先頭につける
#define MAX(vec) max_element(ALL((vec)))
#define IDX(vec, element_iter) distance((vec).begin(), element_iter)
#define SUM(vec) accumulate(ALL((vec)), 0LL)  // 0 は初期値
#define COPY(vec1, vec2) copy(ALL(vec1), back_inserter(vec2))  // vec1をvec2にコピーする vec2は空にしておく必要あり
#define zero_pad(num) setfill('0') << std::right << setw(num)
#define space_pad(num) setfill(' ') << std::right << setw(num)

typedef long long ll;

const ll MOD7 = 1000000007;  // 1 000 000 007
const ll MOD9 = 1000000009;  // 1 000 000 009

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

    // input
    ll N, M;
    cin >> N >> M;
    ll A, B;
    vector<ll> num(N+1, 0);
    REP(i, M) {
        cin >> A >> B;
        num[A]++;
        num[B]++;
    }
    
    // calculation
    for (ll j = 1; j < N+1; ++j) {
        cout << num[j] << "\n";
    }
    
    return 0;
}


Measured memory_bytes: 256
import java.util.*;
public class Main{

static public void main(String[] args){

 Scanner scan=new Scanner(System.in);
String a=null;
a=scan.next();
System.out.print(a.charAt(0));
System.out.print(a.length()-2);
System.out.println(a.charAt(a.length()-1));





}

}

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

int n;
long long arr[50];

bool cando(long long num) {
	long long temp;
	long long ret = 0;
	for (int i = 0; i < n; ++i) {
		temp = arr[i] + num;
		ret += (temp + 1) / (n + 1);
	}
	return ret <= num;
}

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

	cin >> n;

	bool zero = 1;
	for (int i = 0; i < n; ++i) {
		cin >> arr[i];
		if (arr[i] >= n) zero = 0;
	}
	if (zero) {
		cout << 0;
		return 0;
	}

	long long low = 0, high = (long long)(1e18), mid;
	while (high - low > 1) {
		mid = (low + high) / 2;
		if (cando(mid)) high = mid;
		else low = mid;
	}
	long long ans = high;
	for (int i = 1; i <= 2500; ++i) {
		if (high - i >= 0 && cando(high - i)) ans = high - i;
	}
	cout << ans;
}

Measured memory_bytes: 256
N, *A = map(int, open(0).read().split())
ans = 0
for i in range(N):
    q, r = divmod(A[i], 2)
    ans += q
    if r == 0 or i == N - 1:
        continue
    elif A[i + 1] != 0:
        A[i + 1] += 1
print(ans)


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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 1005

int n , m;

int main()
{
    _FastIO;
    cin >> n >> m;
    if(n < m){
        swap(n , m);
    }
    for(int i = 0; i < n; i++){
        cout << m;
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<ll,ll>;
const ll mod = 1e9+7;
#define ALL(x) (x).begin(),(x).end()
#define pow(x,y) modpow(x,y)
#define REP(i,n) for(ll (i)=0;(i)<(n);(i)++)

template <class T = int>T in(){
    T x;
    cin >> x;
    return (x);
}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout<<fixed<<setprecision(10);
    int N = in(),K = in();
    ll answer = 0;
    for (int i = 1; i < N+1; i++){
        if(i < K){
            i = K;
            continue;
        }
        answer += (N/i)*(i-K);
        if(K == 0)answer-=1;
        answer += max(0,N%i - K + 1);
    }
    cout << answer << "\n";
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define INF 1e9
#define llINF 1e18
#define MOD 1000000007
#define pb push_back
#define mp make_pair 
#define F first
#define S second
#define ll long long
#define vi vector<ll>
#define vvi vector<vi>
#define BITLE(n) (1LL<<((ll)n))
#define SUBS(s,f,t) ((s).substr((f),(t)-(f)))
#define ALL(a) (a).begin(),(a).end()
#define Max(a) (*max_element(ALL(a)))
#define Min(a) (*min_element(ALL(a)))
using namespace std;

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll n;cin>>n;
  vi A(n);
  ll ans = 1000;
  for(auto &a:A)cin>>a;
  for(int i=0;i<n-1;i++){
    if(A[i] < A[i+1]){
      ll num = ans/A[i];
      ans = ans%A[i] + num * A[i+1];
    }
  }
  cout<<ans<<endl;
  return 0;
}


Measured memory_bytes: 3632
N = gets.to_i
A = gets.split(" ").map(&:chomp).map(&:to_i)

X = A.select { |a| a % 2 == 0 }.all? { |_a| _a % 3 == 0 || _a % 5 == 0 }

puts X ? "APPROVED" : "DENIED"

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

using namespace std;

int n;
long long cur, ba, bb;
long long ta, tb;

int sum(long long a) {
	int re = 0;
	while (a) {
		re += a % 10;
		a /= 10;
	}
	return re;
}

int main() {
	scanf("%d", &n);
	while (n--) {
		cur++;
		ba = cur;
		bb = sum(cur);
		ta = 10;
		while (cur * 10 >= ta) {
			cur = cur - cur % ta + ta - 1;
			tb = sum(cur);
			if (cur * bb < ba * tb) {
				ba = cur;
				bb = tb;
			}
			ta *= 10;
		}
		cur = ba;
		printf("%lld\n", cur);
	}
	return 0;
}


Measured memory_bytes: 256
def dfs(i, f):
    if i == n - 1:
        return sum(list(map(int, f.split("+"))))
        # return sum(list(map(eval,f)))

    # 式 f の末尾に "+" を追加するかしないかして次の数字を追加
    return dfs(i + 1, f + s[i + 1]) + \
           dfs(i + 1, f + "+" + s[i + 1])


s = input()
n = len(s)

print(dfs(0, s[0]))


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define DEBUG
#ifdef DEBUG
#define debug(...) __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 debug(...)
#endif
#define FOR(i,a,b) 	for(int i=a;i<b;++i)
#define RFOR(i,a,b) 	for(int i=a;i>=b;--i)
#define ln 		"\n"
#define mp make_pair
#define pb push_back
#define sz(a)	ll(a.size())
#define F first
#define S second
#define all(c)	c.begin(),c.end()
#define trace(c,x) for(auto &x:c)
#define pii pair<ll,ll>
typedef long long ll;
typedef long double ld;
typedef	priority_queue<pii,std::vector<pii>,greater<pii> > revpr;

typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> pbds;
// ordered_set X
//K-th smallest
//*X.find_by_order(k-1)
//NO OF ELEMENTS < A
//X.order_of_key(A)

const int L=3003;
int dp[L][L];
int main()
{
		ios_base::sync_with_stdio(false);
	 	cin.tie(NULL);
	 	string s, t;
	 	cin >> s >> t;
	 	int lens = s.length(), lent = t.length();
	 	string ans = "";
	 	FOR(i,1,lens + 1)
	 	{
	 		FOR(j,1,lent + 1)
	 		{
	 			if(s[i-1] == t[j-1])
	 			{
	 				dp[i][j] = dp[i-1][j-1] + 1;
	 				dp[i][j] = max(dp[i][j], dp[i-1][j]);
	 				dp[i][j] = max(dp[i][j], dp[i][j-1]);
	 			}
	 			else 
	 			{
	 				dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
	 			}
	 		}
	 	}
	 	int cur = dp[lens][lent], i = lens, j = lent;
	 	while(i>0 && j > 0)
	 	{
	 		if(s[i-1] == t[j-1])
	 		{
	 			ans += s[i-1];
	 			i--, j--;
	 		}
	 		else
	 		{
	 			if(dp[i-1][j] > dp[i][j-1])i--;
	 			else j--;
	 		}
	 	}
	 	reverse(all(ans));
	 	cout<<ans<<ln;
		return 0;
}

Measured memory_bytes: 35456
#include <iostream>
#include <vector>
#include <string>
#include <numeric>
#include <math.h>

#define say(s) cout << s << endl
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define vec vector

using namespace std;
using ll = long long;
using P = pair<int, int>;

int main() {
  string s, t;
  cin >> s >> t;
  int a, b;
  cin >> a >> b;
  string u;
  cin >> u;
  if (u == s) {
    a--;
  } else if (u == t) {
    b--;
  }
  say(a);
  say(b);
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string N;
  cin >> N;
 
  if (N.at(0) == N.at(1) && N.at(1) == N.at(2)) cout << "Yes" << endl;
  else if (N.at(1) == N.at(2) && N.at(2) == N.at(3)) cout << "Yes" << endl;
  else cout << "No" << endl;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
s = sum(A)

for i in range(N):
    t1 = max(A[i]-B[i], 0)
    t2 = max(B[i]-A[i], 0)
    A[i] = t1
    A[i+1] = max(A[i+1]-t2, 0)

print(s-sum(A))

Measured memory_bytes: 82148
from collections import*
n,*a=map(int,open(0).read().split())
r=[0,0];s=[0]
for k,v in Counter(a).items():
	if v>1:
		r+=[k]
	if v>3:
		s+=[k]
r.sort();s.sort()
print(max(r[-1]*r[-2],s[-1]**2))

Measured memory_bytes: 18528
#define _USE_MATH_DEFINES

#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <unordered_map> 
#include <unordered_set>

using namespace std;

typedef pair<long long int, long long int> P;
typedef tuple<int, int, int> T;

long long int INF = 1e18;
long long int MOD = 998244353;

long long int fact[1100000];

long long int rev_mod(long long int num){
	long long int pow_num = MOD - 2;
	long long int mod_num = MOD;
	long long int pow_cur = num;
	long long int ret = 1;
	while(pow_num > 0){
		if(pow_num % 2 == 1){
			ret *= pow_cur;
			ret %= mod_num;
		}
		pow_cur *= pow_cur;
		pow_cur %= mod_num;
		pow_num /= 2;
	}
	return ret;
}

long long int cnt[1100000];

int main(){
	for(int i = 1; i <= 1000100; i++){
		fact[i] += rev_mod(i);
		fact[i] %= MOD;
		for(int j = i * 2; j <= 1000100; j += i){
			fact[j] += MOD - fact[i];
			fact[j] %= MOD;
		}
	}
	int N;
	cin >> N;
	for(int i = 0; i < N; i++){
		int num;
		cin >> num;
		cnt[num] += 1;
	}
	long long int ans = 0;
	for(int i = 1; i <= 1000100; i++){
		long long int S = 0;
		for(int j = i; j <= 1000100; j += i){
			S += cnt[j] * j;
		}
		S %= MOD;
		ans += S * S % MOD * fact[i] % MOD;
		for(int j = i; j <= 1000100; j += i){
			ans += MOD - (cnt[j] * j % MOD * j % MOD * fact[i] % MOD);
			ans %= MOD;
		}
	}
	cout << ans * rev_mod(2) % MOD << endl;
	return 0;
}

Measured memory_bytes: 16768
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define REP2(i, a, b) for (int i = (a); i < (int)(b); i++)
#define RREP2(i, a, b) for (int i = (a); i > (int)(b); i--)
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef long long ll;
typedef vector<ll> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;

int Main(int n)
{
    int ans = 0;
    if(n % 2 != 0) ans = n/2;
    else ans = (n-1)/2; 
    return ans;
}

int main(void){
    int n;
    cin >> n;
    cout << Main(n) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<string>
#include<math.h>
#include<vector>
#include<algorithm>
#include<array>
#include<functional>
#include<iomanip>
#include<ios>
using namespace std;
#define FOR(i,n) for(int (i)=0;(i)<(n);(i)++)

typedef int value_type; /* ソートするキーの型 */

value_type med3(value_type x, value_type y, value_type z)
/* x, y, z の中間値を返す */
{
    if (x < y)
        if (y < z) return y; else if (z < x) return x; else return z; else
        if (z < y) return y; else if (x < z) return x; else return z;
}

void quicksort(value_type a[], int left, int right,value_type index[])
/* クイックソート
 * a     : ソートする配列 
 * left  : ソートするデータの開始位置
 * right : ソートするデータの終了位置
 * index: index配列
 */
{
    if (left < right) {
        int i = left, j = right;
        value_type tmp, pivot = med3(a[i], a[i + (j - i) / 2], a[j]); /* (i+j)/2ではオーバーフローしてしまう */
        while (1) { /* a[] を pivot 以上と以下の集まりに分割する */
            while (a[i] < pivot) i++; /* a[i] >= pivot となる位置を検索 */
            while (pivot < a[j]) j--; /* a[j] <= pivot となる位置を検索 */
            if (i >= j) break;
            tmp = a[i]; a[i] = a[j]; a[j] = tmp; /* a[i],a[j] を交換 */
            tmp = index[i]; index[i] = index[j]; index[j] = tmp;
            i++; j--;
        }
        quicksort(a, left, i - 1,index);  /* 分割した左を再帰的にソート */
        quicksort(a, j + 1, right,index); /* 分割した右を再帰的にソート */
    }
}

bool is753(int n){
    bool x[3]={false,false,false};

    while(n>0){
        switch (n%10){
            case 3:
                x[0]=true;
                break;
            case 5:
                x[1]=true;
                break;
            case 7:
                x[2]=true;
                break;
            default:
            return false;
        }
        n/=10;
    }
    if(x[0]&& x[1]&&x[2]){
        return true;
    }else{
        return false;
    }

}

int dfs(int n,int N){
    if (n>N){
        return 0;
    }
    

    int ret;
    if(is753(n)){
        ret=1;
    }else{
        ret=0;
    }
    FOR(i,3){
        ret+=dfs(10*n + (2*i+3),N);
    }
    return ret;
}


int main(){
    int x1,y1,x2,y2;
    cin>>x1 >>y1>>x2>>y2;

    int v1x=y1-y2;
    int v1y=x2-x1;

    cout<< x2+v1x << " "<< y2+v1y << " "<< x1+v1x << " "<<y1+v1y<<endl;

    return 0;

    


}

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

using namespace std;

int main()
{
    int n, k;
    cin>>n>>k;
    vector<int> a(n);
    for (int i=0; i<n; i++) cin>>a[i];
    for (int i=k; i<n; i++) {
        if (a[i] > a[i-k]) cout << "Yes" << '\n';
        else cout << "No" << '\n';
    }
    return 0;
}

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

using namespace std;

typedef long long i64;
typedef i64 int_t;
typedef vector<int_t> vi;
typedef vector<vi> vvi;

typedef pair<int_t, int_t> pi;

#define tr(c, i) for(auto i = (c).begin(); i != (c).end(); i++)
#define pb push_back
#define sz(a) i64((a).size())
#define all(c) (c).begin(), (c).end()
#define REP(s, e, i) for(i=(s); i < (e); ++i)

i64 diff(const vi &v) {
  return *max_element(all(v)) - *min_element(all(v));
}

int main(int argc, char *argv[]) {
  i64 N, i;
  cin >> N;
  vi x(N), y(N);
  REP(0, N, i) {
    cin >> x[i] >> y[i];
  }

  vi b1(N), b2(N);
  REP(0, N, i) {
    b1[i] = x[i] - y[i];
    b2[i] = x[i] + y[i];
  }
  cout << max(diff(b1), diff(b2)) << endl;

  return 0;
}


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

const int MAXV=401;
const int MAXD=(long) 1e6;
 
int V;
 
void warshall_floyd(vector<vector <int> > &d) {
    for(int k = 0; k < V; k++) {
        for(int i = 0; i < V; i++) {
            for(int j = 0; j < V; j++) {
                d[i][j] = min(d[i][j], d[i][k] + d[k][j]);
            }
        }
    }
    return;
}

int main(){
    int H,W;
    cin >> H >> W;
    string tmp;
    char maze[H][W];
    V = H*W;

    vector <vector <int> > d(MAXV, vector<int>(MAXV, MAXD));

    for(int i=0; i<H; i++){
        cin >> tmp;
        for(int j=0; j<W; j++){
            maze[i][j]=tmp[j];
        }
    }
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            if( maze[i][j]=='#' ) continue;
            //cout << "i j " << i << " " << j << endl;
            if( i>0 && maze[i-1][j]=='.'){
                d[i*W+j][(i-1)*W+j]=1;
                d[(i-1)*W+j][i*W+j]=1;
            }
            if( i<H-1 && maze[i+1][j]=='.'){
                d[i*W+j][(i+1)*W+j]=1;
                d[(i+1)*W+j][i*W+j]=1;
            }
            if( j>0 && maze[i][j-1]=='.'){
                d[i*W+j][i*W+j-1]=1;
                d[i*W+j-1][i*W+j]=1;
            }
            if( j<W-1 && maze[i][j+1]=='.'){
                d[i*W+j][i*W+j+1]=1;
                d[i*W+j+1][i*W+j]=1;
            }
        }
    }

    warshall_floyd(d);
    int ans=0;

    for(int i=0; i<V; i++){
        for(int j=0; j<V; j++){
            if( i==j ) continue;
            if( d[i][j]>=MAXD ) continue;
            if(ans < d[i][j]){
                //cout << "max refresh i1,j1  i2,j2, d[i][j]  " << (int) i/W << "," << i%W << "  " << (int) j/W << "," << j%W << "  " << d[i][j] << endl; 
                ans = d[i][j];
            }
        }
    }

/*
    for(int i=0; i<H; i++){
        for(int j=0; j<W; j++){
            if( i*W+j==0 ){
                cout << 0;
                cout << " ";
                continue;
            }
            if( d[0][i*W+j]>=MAXD ){
                cout << "#";
            }else{
                cout << d[0][i*W+j];
            }
            cout << " ";
        }
        cout << endl;
    }
*/
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 896
#pragma GCC optimize("O3")   //
#include <bits/stdc++.h>
using namespace std;

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, b, a) for(int i = b - 1; i >= a; i--)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef long double ld;
typedef unsigned long long ull;

unsigned seed = std::chrono::system_clock::now().time_since_epoch().count();
std::mt19937 eng(seed);

uniform_int_distribution<> DD(0, (1ll << 31));

ll random2(){
    return (ll(DD(eng))*(1ll << 31) + ll(DD(eng))) & ((1ll << 62ll)-1);
}

ll n,m,k,q,T;

const ll big = 1000000007;
const ll big2 = 1000000009;
const ll mod =  998244353;

const int MAXN = 300001;

ll nonleaf[MAXN] = {0};

vl A;

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

    //freopen("input.txt","r",stdin);
    //freopen("autput.txt","w",stdout);

    ll a,b,c,d,e;

    cin >> n;
    b = 1;
    rep(c1,0,n+1){
        cin >> a;
        A.push_back(a);
        b -= a;
        b = max(0ll, b);
        nonleaf[c1] = b;
        b *= 2;
        b = min(b, big*big);
    }
    ll ans = 0;


    if(n == 0){
        if(A[0] == 1){
            cout << "1\n";
        }
        else{
            cout << "-1\n";
        }
        return 0;
    }

    ll prev = 0;
    for(int c1 = n; c1 >= 0; c1--){
        if(2*nonleaf[c1] < prev){
            cout << "-1\n";
            return 0;
        }
        ll nl = min(prev, nonleaf[c1]);
        prev = nl + A[c1];
        ans += prev;
    }
    cout << ans << "\n";


    return 0;
}


Measured memory_bytes: 5104
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <math.h>
#include <limits.h>
#define Max(a, b) ((a) > (b) ? (a) : (b))
#define Min(a, b) ((a) > (b) ? (b) : (a))
#define abs(x) ((x) > 0 ? (x) : -(x))
#define MOD (ll)1000000007 //10^9 + 7
#define endl printf("\n")
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep2(i, n, m) for (int i = (n), i < (m); i++)

int
main(int argc, char *argv[])
{
  int n;
  scanf("%d", &n);
  ll x = 1, y = 0;
  rep(i, n) {
    int q; ll X;
    scanf("%d %lld", &q, &X);
    if (q == 1) {
      x *= X; y *= X;
    } else if (q == 2) {
      y += X;
    } else {
      y -= X;
    }
  }

  printf("%lld %lld\n", -y, x);

  return 0;
}



Measured memory_bytes: 2144
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
using namespace std;

int main() {
    int N; cin >> N;
    int x[N], y[N];
    for (int i = 0; i < N; i++) cin >> x[i] >> y[i];

    double ans = 0;
    for (int i = 0; i < N; i++) {
        for (int j = i+1; j < N; j++) {
            ans += 2 * sqrt( pow(x[i] - x[j], 2) + pow(y[i] - y[j], 2) );
        }  
    }
    ans = ans / N;
    cout << fixed << setprecision(10) << ans << endl;
}

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

using ll = long long;

#define rep(i, n) for (int i = 0; i < (n); ++i)
#define rrep(i, n) for (int i = 1; i <= (n); ++i)
#define drep(i, n) for (int i = (n)-1; i >= 0; --i)
#define ddrep(i, n) for (int i = n; i > 0; --i)
#define srep(i, s, t) for (int i = s; i < t; ++i)
#define ssrep(i, s, t) for (int i = s; i <= t; ++i)

#define rng(a) a.begin(), a.end()
#define rrng(a) a.rbegin(), a.rend()
#define pb push_back
#define eb emplace_back
#define fi first
#define se second

#define chmax(x, y) (x = max(x, y))
#define chmin(x, y) (x = min(x, y))

using pi = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using ld = long double;

template <class T, class U>
ostream &operator<<(ostream &os, const pair<T, U> &p) {
    os << "(" << p.first << "," << p.second << ")";
    return os;
}

template <class T> ostream &operator<<(ostream &os, const vector<T> &v) {
    os << "{";
    rep(i, (int)v.size()) {
        if (i)
            os << ",";
        os << v[i];
    }
    os << "}";
    return os;
}

template <typename T, size_t S> void printArray(const T (&array)[S]) {
    for (auto val : array)
        std::cout << val << ", ";
    std::cout << "\n";
}

const int mod = 998244353;
const int inf = 1e9 + 5;

struct mint {
    ll x;
    mint(ll x=0) : x(x%mod) {}
    mint& operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }
    mint& operator-=(const mint a) {
        if ((x -= a.x) < 0) x += mod;
        return *this;
    }
    mint& operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }
    mint operator+(const mint a) {
        mint res(*this);
        return res+=a;
    }
    mint operator-(const mint a) {
        mint res(*this);
        return res-=a;
    }
    mint operator*(const mint a) {
        mint res(*this);
        return res*=a;
    }
};

const int MAX = 200'000 + 5;
ll fac[MAX], finv[MAX], inv[MAX];

void initComb() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    srep(i, 2, MAX) {
        fac[i] = fac[i - 1] * i % mod;
        inv[i] = mod - inv[mod%i] * (mod / i) % mod;
        finv[i] = finv[i - 1] * inv[i] % mod;
    }
}
ll comb(ll n, ll k) {
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % mod) % mod;
}

inline ll mypow(ll x, ll n) {
    if (n == 0) return 1;
    if (n % 2 == 0)
        return mypow(x * x % mod, n / 2);
    else
        return x * mypow(x, n - 1) % mod;
}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << std::setprecision(10);

    initComb();
    int n, m, k; std::cin >> n >> m >> k;
    mint ans = 0;
    rep(i, k+1) {
        mint tmp = m;
        tmp *= mypow(m-1, n-i-1);
        tmp *= comb(n-1, i);
        ans += tmp;
    }
    std::cout << ans.x << "\n";
}


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


  
int main(){
  

  int n,m;
  cin>>n>>m;

  vector<bool> data1(n,false);
  
  vector<bool> datan(n,false);
  
  for (int i=0;i<m;i++){
    int a,b;
    cin>>a>>b;
    if (a==1){
      data1.at(b)=true;
    }
    
    if (b==n){
      datan.at(a)=true;
    }
  }
  
  string answer="IMPOSSIBLE";
  
  for (int i=2;i<=n-1;i++){
    if (data1.at(i)==true and datan.at(i)==true){
      answer="POSSIBLE";
    }
  }
  
  cout<<answer<<endl;
  
  
  
}

















Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <iostream>
#include <cmath>
#include <bits/stdc++.h>
#include <algorithm>
#include <complex>
#define FIXED_FLOAT(x)  std::fixed <<std::setprecision(7)<<(x)
#define fast ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define X real()
#define Y imag()

using namespace  std;
using ll = long long;
const ll mod = 1e9 + 7;
typedef pair<int, int> pairs;
typedef complex<ll> G;
const int N = 1e5+5;
int a[N];
void solve(){


    ll a, b, v, w, t;
    cin >> a>> v >> b >> w >> t;
    ll q = abs(a-b);
    if(v > w && q <=(v-w)*t)cout << "YES\n";
    else cout << "NO\n";




}
int main() {
    fast;
    solve();


}


Measured memory_bytes: 3632