akhauriyash/Code-Regression huggingface dataset:
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include <map>
#include <set>
#include <algorithm>
using namespace std;
using ll = long long;
constexpr ll INF = 1010000000000000017LL;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(v) v.begin(), v.end()

class BGoodDistance {
public:
	void solve(std::istream& in, std::ostream& out) {
        ll n,d;
        in>>n>>d;
        vector<vector<ll>> x(n,vector<ll> (d));
        rep(i,n){
            rep(j,d){
                in>>x[i][j];
            }
        }
        ll ans=0;
        rep(i,n){
            for (int k = i+1; k < n; ++k) {


                long double res = 0;
                rep(j, d) {
                    res += (x[i][j] - x[k][j]) * (x[i][j] - x[k][j]);
//                    out<<x[i][j]<<" - "<<x[k][j]<<endl;
                }
                res = sqrt(res);
//                out<<res<<endl;
                if (res == (ll) res) ans++;
            }
        }
        out<<ans;
	}
};


int main() {
	BGoodDistance solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 256
import sys
from collections import deque
import copy
import math
def get_read_func(fileobject):
    if fileobject == None :
        return raw_input
    else:
        return fileobject.readline



def main():
    if len(sys.argv) > 1:
        f = open(sys.argv[1])
    else:
        f = None
    read_func = get_read_func(f);
    input_raw = read_func().strip().split()
    [X, A] = [int(input_raw[0]), int(input_raw[1])]
    if X < A:
        print 0
    else:
        print 10
if __name__ == '__main__':
    main()


Measured memory_bytes: 2932
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::io::{BufWriter, Write};

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

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

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

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

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

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

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

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

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

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

fn solve() {
    input!(
        n: usize,
    );

    let ans = (n - n / 2) as f64 / n as f64;

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

fn main() {
    let stack_size = 1 << 28;
    let thd = std::thread::Builder::new().stack_size(stack_size);
    thd.spawn(|| solve()).unwrap().join().unwrap();
}


Measured memory_bytes: 8572
'use strict'

const main = (INPUT) => {
  const N = INPUT.split('\n')[0].split(' ').map(n => Number(n))

  if (N[0] <= 5) {
    console.log(0)
  } else if (N[0] <= 12) {
    console.log(N[1] / 2)
  } else {
    console.log(N[1])
  }
}

main(require('fs').readFileSync('/dev/stdin', 'utf8'))


Measured memory_bytes: 21064
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.lang.Math;
import java.math.*;

public class Main {
    public static void main(String[] args) {
        FS reader = new FS();
        // write reader
        int A = reader.nextInt();
        int B = reader.nextInt();
        int C = reader.nextInt();
        int D = reader.nextInt();
        if (A+B > C+D) System.out.println("Left");
        else if (A+B == C+D) System.out.println("Balanced");
        else System.out.println("Right");
    }

    // Read Class
    static class FS {
        private final InputStream in = System.in;
        private final byte[] buffer = new byte[1024];
        private int ptr = 0;
        private int buflen = 0;
        private boolean hasNextByte() {
            if (ptr < buflen) {
                return true;
            } else {
                ptr = 0;
                try {
                    buflen = in.read(buffer);
                } catch (IOException e) {
                    e.printStackTrace();
                }
                if (buflen <= 0) {
                    return false;
                }
            }
            return true;
        }
    
        private int readByte() { return hasNextByte() ? buffer[ptr++] : -1;}
        private boolean isPrintableChar(int c) {return 33 <= c && c <= 126;}
        private void skipUnprintable() {while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++;}
    
        public boolean hasNext() { skipUnprintable(); return hasNextByte();}
        public String next() {
            if (!hasNext()) throw new NoSuchElementException();
            StringBuilder sb = new StringBuilder();
            int b = readByte();
            while(isPrintableChar(b)) {
                sb.appendCodePoint(b);
                b = readByte();
            }
            return sb.toString();
        }
        public int nextInt() {
            return (int)nextLong();
        }
        public long nextLong() {
            if (!hasNext()) throw new NoSuchElementException();
            long n = 0;
            boolean minus = false;
            int b = readByte();
            if (b == '-') {
                minus = true;
                b = readByte();
            }
            if (b < '0' || '9' < b) {
                throw new NumberFormatException();
            }
            while(true) {
                if ('0' <= b && b <= '9') {
                    n *= 10;
                    n += b - '0';
                } else if(b == -1 || !isPrintableChar(b)) {
                    return minus ? -n : n;
                } else {
                    throw new NumberFormatException();
                }
                b = readByte();
            }
        }
    }
}



Measured memory_bytes: 21076
# chokudaiブログの典型力の話を意識しつつ考えたら思いついた!

# 「ある集合の部分集合の中で、〜〜〜の値が最小になるものを求めよ」のパターン
# 愚直にやると2^Nを調べねばならず無理。
# したがって「一部を調べればよい」に帰着するのが多いだろう。
# 何らかの形でソートしておいて、空集合から1つずつ付け加えるとか。全体集合から1つずつ取り去るとか。

# 今回は全体集合から1つずつ取り去るのを考えるとできる。
# 全体集合である競技m0が最多の人数p0人を集めたとする。
# すると、全ての部分集合のうち「m0を含む集合」を考えると、競技m0は必ずp0人以上集まるので解もp0以上。
# ここで「m0を含む集合」について一気に計算できていることに注意! 一撃で多数の集合について計算が終わる。
# 次に全体集合からm0を取り去ったものを考える。
# ここである競技m1が最多の人数p1人を集めたとする。すると……以下同様。
# なお複数種目の競技が同率1位になった場合は全て一度に取り除いて良い。
# これで空集合までやって、最大が最小のものを出力すればOK! 

n, m = list(map(int, input().split()))
preference = [list(map(lambda x: int(x) - 1, input().split())) for _ in range(n)] # 1-index → 0-index

ans = n
held_sports = set(range(m))

while held_sports:
    # 各競技に参加する人数を求める
    parti = [0] * m
    for pref in preference:
        for s in pref:
            if s in held_sports:
                parti[s] += 1
                break
    
    temp = max(parti)
    ans = min(ans, temp)
    # 集合から最大人数を取った要素を除外
    for idx, par in enumerate(parti):
        if par == temp:
            held_sports.remove(idx)

print(ans)

Measured memory_bytes: 10188
#pragma GCC optimize(2)
#include <bits/stdc++.h>
#include<stdio.h>
#include <string.h>
#include<algorithm>
#include <queue>
typedef long long ll;
const int mod=998244353;
const int maxn=1e6+5;
const ll INF=100000000000000005;
const double eps=1e-11;
using namespace std;
ll n,m,p;
char str[maxn];
int main()
{
    scanf("%lld%s",&n,str+1);
    if(n%2) printf("No\n");
    else{
        int f=0;
        for(int i=1;i<=n/2;i++)
        {
            if(str[i]!=str[i+n/2]) f=1;
        }
        if(f) printf("No\n");
        else printf("Yes\n");
    }
    return 0;
}


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

#define rep(i, n) for (int i = 0; i < (n); i++)

int main(){
    int N,M;
    cin >> N >> M;
    vector<int> A(N);
    for(int i=0;i<N;i++) cin >> A[i];
    sort(A.begin(),A.end());
    vector<pair<int,int>> CB;
    for(int i=0;i<M;i++){
        int b,c;
        cin >> b >> c;
        CB.emplace_back(make_pair(c,b));
    }
    sort(CB.begin(),CB.end(),greater<pair<int,int>>());
    int index=0;
    bool flag = false;
    for(auto cb : CB){
        for(int i=0;i<cb.second;i++){
            if(A[index] > cb.first){
                flag = true;
                break;
            } 
            A[index] = cb.first;
            index++;
        }
        if(flag) break;
    }
    long long sum = 0;
    for(auto a : A) sum += a;
    cout << sum << endl;
    return 0;
}

Measured memory_bytes: 1784
#include<stdio.h>

int main(void){
    
    int a,b,c,d;
    
    scanf("%d %d", &a, &b);
    
    c=a*b;
    
    d=2*a+2*b;
    
    printf("%d %d\n", c, d);
    
    return 0;
    
}


Measured memory_bytes: 2048
from collections import Counter
import math
N,A,B = map(int,input().split())
S = input()
a_count = 0
b_count = 0
for i in range(N):
	if S[i] == "a":
		if a_count + b_count > A + B -1:
			print("No")
		else:
			print("Yes")
			a_count += 1
	elif S[i] == "b":
		if A + B >= a_count + b_count + 1 and B >= b_count + 1 :
			print("Yes")
			b_count += 1
		else:
			print("No")
	else:
		print("No")

Measured memory_bytes: 4296
import math
num = list(map(int, input().split()))
hour_len   = num[0]
minute_len = num[1]
hour       = num[2]
minute     = num[3]

hour_degree = (hour*60 + minute)*0.5
minute_degree = minute*6

diff_degree = abs(hour_degree - minute_degree)
if(abs(hour_degree - minute_degree) > 180):
  diff_degree = 360 - diff_degree

result = pow(hour_len,2)+pow(minute_len,2)-2*hour_len*minute_len*math.cos(math.radians(diff_degree))

print(math.sqrt(result))



Measured memory_bytes: 9516
import java.util
import java.util.Scanner
import scala.util.Failure
import scala.util.Success
import scala.util.Try

object Main extends App {
  val sc = new Scanner(System.in)
  def next(): String = sc.next()
  def nextInt(): Int = next().toInt
  def nextLong(): Long = next().toLong

  def task(): Unit = {
    val n, k = nextInt()
    val hs = Array.fill(n)(nextInt()).sorted
    val map = new util.TreeMap[Int, Int]
    for (i <- 0 until k) {
      Try(map.get(hs(i))) match {
        case Failure(_) => map.put(hs(i), 1)
        case Success(v) => map.put(hs(i), v + 1)
      }
    }

    var ans = map.lastKey() - map.firstKey()
    for (i <- k until n) {
      val prev = map.remove(hs(i - k))
      if (prev != 1) {
        map.put(hs(i - k), prev - 1)
      }

      Try(map.get(hs(i))) match {
        case Failure(_) => map.put(hs(i), 1)
        case Success(v) => map.put(hs(i), v + 1)
      }

      ans = Math.min(ans, map.lastKey() - map.firstKey())
    }
    println(ans)
  }

  task()
}


Measured memory_bytes: 51596
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ld=long double;
using ch=char;
typedef pair<ll,ll> P;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vP;
typedef vector<ch> vc;
typedef vector<vc> vvc;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define rep(i,n) FOR(i,0,n)
#define ROF(i,a,b) for(ll i=a;i>=b;i--)
#define per(i,a) ROF(i,a,0)
#define pb push_back
const ll MOD=1000000007;
const ll MOD2=998244353;
const ld PI=acos(-1);
const ll INF=1e18;
string abc="abcdefghijklmnopqrstuvwxyz";
string ABC="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
struct edge{ll to,cost;};
struct edge2{ll from,to,cost;};


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll A,B,C,K;
    cin >> A >> B >> C >> K;
    int cnt=0;
    while(A>=B){
        B*=2;
        cnt++;
    }
    while(B>=C){
        C*=2;
        cnt++;
    }
    if(cnt<=K){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 3652
#include <cstdio>
#include <iostream>
#include <string>

int main() {
    int n;
    scanf("%d", &n);
    int a[n];
    for (int i = 0; i < n; i++) {
        scanf("%d", &a[i]);
    }
    int ans = 0;
    int x = 1;
    for (int i = 0; i < 100000; i++) {
        x = a[x - 1];
        ans++;
        if (x == 2) {
            printf("%d\n", ans);
            return 0;
        }
    }
    puts("-1");
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;

const long long mod = 1000000007;
const long long inf = 1e18;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    string s;
    cin>>s;
    cout<<s[0]<<s[1]<<s[2]<<endl;
    return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#include<vector>
using namespace std;
#define rep(i, n)        for(int i=0; i<(int)(n); ++i)
int main() {
  int a,b,c,d=0;cin>>a;
  rep(i,a){
    cin>>b;
    c=max(b,c);
    d+=b;
  }
  if(d-c>c)cout<<"Yes";
  else cout<<"No";
}

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

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)

vector<string> f(string s){
    vector<string> ret;
    string a = "";
    for(auto c:s){
        if(c == '"'){
            ret.push_back(a);
            a = "";
        }else{
            a += c;
        }
    }
    ret.push_back(a);
    return ret;
}

int main(){
    string s,t;
    while(cin >> s, s!="."){
        cin >> t;
        if(s == t){
            cout << "IDENTICAL" << endl;
            continue;
        }
        auto a = f(s);
        auto b = f(t);

        //cout << "# "; for(auto&s:a) cout << s<< ";" ; cout << endl;
        //cout << "# "; for(auto&s:b) cout << s<< ";" ; cout << endl;

        if(a.size() != b.size()){
            cout << "DIFFERENT" << endl;
            continue;
        }
        int c = 0;
        rep(i, a.size()){
            if(a[i] != b[i]){
                if(i%2 == 1){
                ++c;
                }else{
                    c+= 100;
                }
            }
        }
        if(c <= 1){
            cout << "CLOSE" << endl;
        } else{
            cout << "DIFFERENT" << endl;
        }
    }
}


Measured memory_bytes: 3156
use std::cmp;

fn main(){
  let n: usize = read();

  let mut a: Vec<Vec<i32>> = vec![vec![0;n+1];n];

  for i in 0 .. n {
    let t: Vec<i32> = read_vec();
    for j in 0 .. n {
      a[i][j+1] = a[i][j] + t[j];
    }
  }

  let mut mxv: i32 = std::i32::MIN;
  
  for i in 0 .. n {
    for j in i+1 .. n+1 {
      let mut ac: i32 = a[0][j] - a[0][i];
      mxv = cmp::max(mxv, ac);
      
      for k in 1 .. n {
        let s: i32 = a[k][j] - a[k][i];
        ac = cmp::max(ac+s, s);
        mxv = cmp::max(mxv, ac);
      }
    }
  }
  
  println!("{}", mxv);
}

fn read<T>() -> T
  where T: std::str::FromStr,
        T::Err: std::fmt::Debug
{
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).expect("failed to read");
  buf.trim().parse().unwrap()
}

fn read_vec<T>() -> Vec<T>
  where T: std::str::FromStr,
        T::Err: std::fmt::Debug
{
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).expect("failed to read");
  buf.split_whitespace().map(|e| e.parse().unwrap()).collect()
}



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

using namespace std;

typedef long long ll;

const double pi = 3.14159265358979323846;

#define REP(i, n) for (ll i = 0; i < n; i++)
#define MOD 1000000007LL
#define PS(p) cout << setprecision(15) << fixed << p << endl;
#define UNIQUE(v) v.erase(std::unique(v.begin(), v.end()), v.end());
#define ALL(c) c.begin(), c.end()
#define CIN(v) cin >> v;
#define COUT(v) cout << v << "\n";

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

  int N;

  CIN(N);

  int B[N];
  int count = 0;
  for (int i = 0; i < N; i++) {
    CIN(B[i]);
  }
  B[N - 1] = INT_MAX;

  if (N == 2) {
    count = B[0] * 2;
    COUT(count);
    return 0;
  }

  count += B[0];
  for (int i = 1; i < N; i++) {
    count += min(B[i - 1], B[i]);
  }

  COUT(count);

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define repr(i,a,b) for(int i=a;i<b;i++)
#define rep(i,n) for(int i=0;i<n;i++)
#define invrepr(i,a,b) for(int i=b-1;i>=a;i--)
#define invrep(i,n) invrepr(i,0,n)
#define repitr(itr,a) for(auto itr=a.begin();itr!=a.end();++itr)
#define P pair<int,int>
const int MOD=1e9+7;
const int INF=2e9;
const double PI=acos(-1);


int main() {
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;
    vector<int> f(n+1);
    repr(i,1,100) {
        repr(j,1,100) {
            repr(k,1,100) {
                ll fi=pow(i+j,2)+pow(j+k,2)+pow(i+k,2);
                if (fi<=2*n && fi%2==0) {
                    ++f[fi/2];
                }
            }
        }
    }
    repr(i,1,n+1) cout << f[i] << endl;

    return 0;   
}

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

int main()
{
    long long n;cin>>n;
    vector<long long> a(n);
    vector<long long> b(n);
    vector<long long> c(n);
    int i;
    long long ans=0;
    for(i=0;i<n;i++)cin>>a.at(i);
    for(i=0;i<n;i++)cin>>b.at(i);
    for(i=0;i<n;i++)cin>>c.at(i);
    sort(a.begin(),a.end());
    sort(b.begin(),b.end());
    sort(c.begin(),c.end());
    vector<long long> sumb(n);
    for(i=0;i<n;i++)
    {
        auto it2 = upper_bound(c.begin(),c.end(),b.at(i));
        sumb.at(i)=c.end()-it2;
    }
    for(i=n-2;i>=0;i--)
    {
        sumb.at(i)+=sumb.at(i+1);
    }
    for(i=0;i<n;i++)
    {
        auto it=upper_bound(b.begin(),b.end(),a.at(i));
        int index=it-b.begin();
        if(index>=0&&index<n)ans+=sumb.at(index);
    }
    cout<<ans<<endl;
}


Measured memory_bytes: 3328
integer,allocatable,dimension(:)::K
integer a
allocate(K(5))
do i=1,5
 read*,K(i)
end do
read*,a
if(maxval(K)-minval(K)>a)print"(A)",":("
if(maxval(K)-minval(K)<=a)print"(A)","Yay!"
end

Measured memory_bytes: 256
alist = []
blist = []
for i in range(10):
    a = int(input())
    alist.append(a)
for i in range(10):
    b = int(input())
    blist.append(b)
x = sorted(alist)
y = sorted(blist)
list.sort(x, reverse=True)
list.sort(y, reverse=True)
s=x[0]+x[1]+x[2]
t=y[0]+y[1]+y[2]
print(s,t)


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

using namespace std;

int main() {

	int x;
	int max = 0, beki = 1;
	int count = 0;

	cin >> x;

	for (int i = 2; i < x; i++) {
		beki = i;
		count = 0;
		while (beki*i <= x) {
			beki = beki * i;
			count++;
		}
		if (max < beki && count != 0)
			max = beki;
	}
	
	if (x == 1)
		max = 1;


	cout << max << endl;

	return 0;
}


Measured memory_bytes: 256
n, m, q = map(int, input().split())

matrix = [[0] * (n + 1) for _ in range(n + 1)]
for _ in range(m):
    l, r = map(int, input().split())
    matrix[l][r] += 1

totals = [[0] * (n + 1) for _ in range(n + 1)]
for i in range(1, n + 1):
    for j in range(1, n + 1):
        totals[i][j] += totals[i][j - 1] + matrix[i][j]

answers = []
for _ in range(q):
    p, q = map(int, input().split())
    answer = sum(totals[i][q] - totals[i][p - 1] for i in range(p, q + 1))
    answers.append(answer)

for answer in answers:
    print(answer)


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

int main()
{
    int a;
    ll ans;

    cin >> a;

    ans = a + a * a + a * a * a;

    cout << ans << endl;

    return(0);
}

Measured memory_bytes: 3624
def answer(in0):
    in0 = [int(n) for n in in0.split(" ")]
    N = in0[0]
    T = in0[1]
    minCost = 1001
    for _ in range(N):
        _in = [int(n) for n in input().split(" ")]
        if _in[1] <= T and _in[0] <= minCost:
            minCost = _in[0]

    if minCost == 1001:
        return 'TLE'

    return minCost


print(answer(input()))


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

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

long long MOD = 1000000000 + 7;

int main(){
  cout << setprecision(10);
  int N,M;
  cin >> N >> M;
  ll INF = 10000000000;
  vector<vector<ll>> dp(N, vector<ll>(N, INF));

  for(int i = 0; i < N; i++){
    dp.at(i).at(i) = 0;
  }

  map<pair<int,int>, ll> m;
  map<pair<int,int>, bool> check;
  for(int i = 0; i < M; i++){
    int a,b;
    ll c;
    cin >> a >> b >> c;
    a--;
    b--;
    dp.at(a).at(b) = c;
    dp.at(b).at(a) = c;

    if(a > b) swap(a,b);

    m[make_pair(a,b)] = c;
    check[make_pair(a,b)] = false;
  }

  // ワーシャルフロイド
  for(int k = 0; k < N; k++){
    for(int i = 0; i < N; i++){
      for(int j = 0; j < N; j++){
        dp[i][j] = min(dp[i][j], dp[i][k] + dp[k][j]);
      }
    }
  }

  for(int i = 0; i < N-1; i++){
    for(int j = i+1; j < N ; j++){
      for(auto e: check){
        if(e.second) continue;
        auto length = m[e.first];
        int start = e.first.first;
        int end = e.first.second;

        if(dp[i][j] == dp[i][start] + length + dp[end][j]) check[e.first] = true;
        if(dp[i][j] == dp[i][end] + length + dp[start][j]) check[e.first] = true;
      }
    }
  }

  int ans = 0;
  for(auto x: check){
    if(!x.second) ans++;
  }
  cout << ans << endl;

}


Measured memory_bytes: 512
module.exports=function(t){var e={};function i(n){if(e[n])return e[n].exports;var r=e[n]={i:n,l:!1,exports:{}};return t[n].call(r.exports,r,r.exports,i),r.l=!0,r.exports}return i.m=t,i.c=e,i.d=function(t,e,n){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(i.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)i.d(n,r,function(e){return t[e]}.bind(null,r));return n},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=0)}([function(t,e,i){i(1)(i(3).readFileSync("/dev/stdin","UTF-8").split("\n"))},function(t,e,i){var n=i(2);t.exports=function(t){for(var e=t[0].split(" "),i=Number(e[0]),r=Number(e[1]),s=[],o=0,u=new n(100),d=0;d<i;d++){for(var f=t[d+1].split(""),l=0;l<r;l++)"#"==f[l]?u.enq({x:l,y:d,dist:0}):o+=1;s.push(f)}for(;u.size>0;){var c=u.deq();if("."==s[c.y][c.x]||0==c.dist){if("."==s[c.y][c.x]&&(s[c.y][c.x]="#",o-=1),o<=0)return void console.log(c.dist);c.x+1<r&&"#"!=s[c.y][c.x+1]&&u.enq({x:c.x+1,y:c.y,dist:c.dist+1}),c.x-1>=0&&"#"!=s[c.y][c.x-1]&&u.enq({x:c.x-1,y:c.y,dist:c.dist+1}),c.y+1<i&&"#"!=s[c.y+1][c.x]&&u.enq({x:c.x,y:c.y+1,dist:c.dist+1}),c.y-1>=0&&"#"!=s[c.y-1][c.x]&&u.enq({x:c.x,y:c.y-1,dist:c.dist+1})}}}},function(t,e,i){"use strict";t.exports=class{constructor(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1e4;this.size=0,this.items=[],this.ind=0,this.maxGap=t}enq(t){this.size+=1,this.items.push(t),this.items.size-this.ind>this.maxGap&&(this.items=this.items.slice(this.ind))}deq(){var t=this.items[this.ind];return this.size-=1,this.ind+=1,t}}},function(t,e){t.exports=require("fs")}]);

Measured memory_bytes: 200640
#include <vector>
#include <algorithm>
#include <iostream>
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <cstdio>
#include <ctime>
#include <map>
#include <set>
#include <string>
#include <cassert>

#define INFLL 2000000000000000000
#define INF 2000000000
#define MOD 1000000007
#define PI acos(-1.0)

using namespace std;

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

int cnt[100001];
int n;

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	cin >> n;
	int ans = -INF;
	for (int i = 0; i < n; i++) {
		int a;
		cin >> a;
		cnt[a]++;
		ans = max(ans, cnt[a]);
		if (a < 100000) {
			cnt[a + 1]++;
			ans = max(ans, cnt[a + 1]);
		}			
		if (a > 0) {
			cnt[a - 1]++;
			ans = max(ans, cnt[a - 1]);
		}	
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 640
import * as fs from "fs"
import { parse } from "url"

function Main(input: string) {

  const [a, b, c, d] = input.split(" ").map(l => parseInt(l, 10))

  if (a * b >= c * d) {
    console.log(a * b)
  }
  else {
    console.log(c * d)
  }

}


fs.readFile('/dev/stdin', (err, data) => {
  if (err) {
    Main(fs.readFileSync('./input.txt', 'utf8'))
    return null
  }
  Main(data.toString())
  return null
})

Measured memory_bytes: 7372
#include<bits/stdc++.h>
using namespace std;
#define int  long long
#define tc(t)  int t; cin>>t; while(t--)
#define f(n)    for(int i=0;i<n;i++)
#define endl   "\n"
int32_t main()
{
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);

int a,b;
cin>>a>>b;
  if(a-2*b<0) cout<<"0"<<endl;
  else cout<<a-2*b<<endl;

}

Measured memory_bytes: 3608
import java.util.Scanner;

/**
 * Created 2017/05/25.
 * nextLineの挙動とか
 */
public class Main {
   public static void main(String[] args) {
      //String word = "AAA";
      Scanner sc = new Scanner(System.in);
      String line = sc.nextLine();

     if(line.charAt(0) == line.charAt(1) && line.charAt(1) == line.charAt(2)){
        System.out.println("No");
     }else{
        System.out.println("Yes");
     }

   }
}


Measured memory_bytes: 21844
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author
 */

#include <iostream>
#include <fstream>

#include <iostream>
#include "bits/stdc++.h"

using namespace std;

typedef unsigned long long ll;
typedef int                     integer;
#define int                     long long
#define ii                      pair<int,int>
#define vii                     vector<pair<int,int>>
#define vi                      vector<int>
#define vvi                     vector<vector<int>>
#define f(a,b,c)                for(int a=b;a<c;a++)
#define s(x)                    in>>x
#define s2(x,y)                 in>>x>>y
#define s3(x,y,z)               in>>x>>y>>z
#define s4(x,y,z,w)             in>>x>>y>>z>>w
#define p(x)                    out<<x<<endl
#define p2(x,y)                 out<<x<<" "<<y<<endl
#define pl(x)                   out<<x
#define p2l(x,y)                out<<x<<" "<<y
#define p1d(a,n)                for(int ix=0;ix<n;ix++) out<<a[ix]<<" "; out<<endl
#define p2d(a,n,m)              for(int ix=0;ix<n;ix++){ for(int jx=0;jx<m;jx++) out<<a[ix][jx]<<" "; out<<endl;}
#define range(v)                v.begin(),v.end()
#define w(x)                    while(x--)
#define rst(x)                  memset(x, -1, sizeof(x))
#define UNVISITED               -1
#define VISITED                 0
#define EXPLORED                2

class CPoll {
public:
	void solve(std::istream& in, std::ostream& out) {
        int n;
        s(n);
        map<string,int> votes;
        f(i,0,n){
            string s;
            s(s);
            votes[s]++;
        }
        int m = 0;
        for(auto p : votes){
            m = max(m, p.second);
        }
        set<string> won;
        for(auto p : votes){
            if(p.second == m) won.insert(p.first);
        }
        for(auto ss:won){
           out<<ss<<endl;
        }
	}
};


integer main() {
	CPoll solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
}


Measured memory_bytes: 34560
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define IO ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define pb push_back
#define ff first
#define ss second
#define mod 1000000007
 
int32_t main() 
{
    IO;
    int n,sum;
    cin>>n>>sum;
    int w[n], v[n];
    for(int i=0;i<n;i++)
    {
        cin>>w[i];
        cin>>v[i];
    }
    vector<vector<int> > dp(n);
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<=sum;j++)
        dp[i].pb(0);
    }
    for(int i=w[0];i<=sum;i++)
    dp[0][i] = v[0];
    
    for(int i=1;i<n;i++)
    {
        for(int j=0;j<=sum;j++)
        {
            if(j < w[i])
            {
                dp[i][j] = dp[i-1][j];
            }
            else
            dp[i][j] = max(dp[i-1][j],v[i] + dp[i-1][j - w[i]]);
        }
    }
    cout<<dp[n-1][sum];
	return 0;
}


Measured memory_bytes: 79476
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep1(i, n) for(int i = 1; i < n+1; i++)
#define sort(A) sort(A.begin(),A.end())
#define reverse(A) reverseA(A.begin(),A.end());

typedef long long ll;

ll rec(ll n){
  if(n>1) return 1+2*rec(n/2);
  else return 1;
}

int main(){
  ll H;
  cin >>H;
  cout << rec(H) << endl;
}

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

int main(){
  int a, b;
  cin >> a >> b;
  string x="", y="";
  for(int i=0; i<b; i++){
    x.append(to_string(a));
  }
  for(int i=0; i<a; i++){
    y.append(to_string(b));
  }
  if(x >= y)cout << y << endl;
  if(x<y)cout << x << endl;
  return 0;
}

Measured memory_bytes: 256
N = int(input())
ARR = [int(s) for s in input().split(" ")]
# N = 8
# ARR = [1, 2, 1, 4, 2, 1, 4, 1]

def calculate(n,arr):

    dict = {}
    brr = {}
    for ar in arr:

        if dict.get(ar) == None:
            dict.__setitem__(ar,1)
        else:
            tmp = dict.get(ar)
            tmp = tmp + 1
            brr.__setitem__(ar,(tmp * (tmp - 1)) // 2 )
            dict.__setitem__(ar,tmp)

    sumValue = sum(brr.values())

    for ar in arr:
        tmp = dict.get(ar)

        print(sumValue - (tmp - 1))

calculate(N,ARR)

Measured memory_bytes: 26620
from collections import deque

def main():
    S = list(input())
    Q = int(input())
    l = [list(input().split(' ')) for _ in range(Q)]

    d = deque(S)

    FLAG = False

    for li in l:
        if int(li[0]) == 1: # 前後反転
            if FLAG == True:
                FLAG = False
            else:
                FLAG = True
        
        elif int(li[0]) == 2: # 追加, li[1] == 1 => li[2]を先頭に，li[1] == 2 => li[2]を末尾
            if int(li[1]) == 1:
                if FLAG == True:
                    d.append(li[2])
                else:
                    d.appendleft(li[2])
            elif int(li[1]) == 2:
                if FLAG == True:
                    d.appendleft(li[2])
                else:
                    d.append(li[2])

    S = ''.join(d)
    if FLAG:
        S = S[::-1]
    print(S)


main()

Measured memory_bytes: 36180
//#pragma GCC optimize("Os")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")
#include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#ifdef rd
#define trace(...) cout<<"Line:"<<__LINE__<<" "; __f(#__VA_ARGS__, __VA_ARGS__)
template<typename Arg1>
void __f(const char* name, Arg1&& arg1) {
	cout<<name<<" : "<<arg1<<endl;
}
template<typename Arg1, typename ... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
	const char* comma=strchr(names+1,',');
	cout.write(names,comma-names)<<" : "<<arg1<<" | ";
	__f(comma+1,args...);
}
#else
#define trace(...)
#define endl '\n'
#endif
#define pb push_back
#define fi first
#define se second
//#define int long long
typedef long long ll;
typedef float f80;
//#define double long double
#define pii pair<int,int>
#define pll pair<ll,ll>
#define sz(x) ((long long)x.size())
#define fr(a,b,c) for(int a=b; a<=c; a++)
#define rep(a,b,c) for(int a=b; a<c; a++)
#define trav(a,x) for(auto &a:x)
#define all(con) con.begin(),con.end()
const ll infl=0x3f3f3f3f3f3f3f3fLL;
const int infi=0x3f3f3f3f;
//const int mod=998244353;
int mod=1000000007;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> oset;
auto clk=clock();
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());
int rng(int lim) {
	uniform_int_distribution<int> uid(0,lim-1);
	return uid(rang);
}
int powm(ll a, ll b) {
	int res=1;
	while(b) {
		if(b&1)
			res=(res*a)%mod;
		a=(a*a)%mod;
		b>>=1;
	}
	return res;
}

vi clos[100005];
int open[100005];
void solve() {
	int n,m;
	cin>>n>>m;
	vector<pii> tol;
	int a,b;
	cin>>a;
	fr(i,2,n) {
		cin>>b;
		tol.pb({a,b});
		a=b;
	}
	int inter=0;
	ll sum=0,val=0;
	for(auto i:tol) {
		if(i.fi>i.se) {
			inter++;
			val+=m-i.fi;
			sum+=m-i.fi+i.se;
			clos[i.se].pb(m-i.fi+i.se-1);
		} else {
			sum+=i.se-i.fi;
			clos[i.se].pb(i.se-i.fi-1);
		}
		open[i.fi]++;
		trace(sum,i.fi,i.se,m,val,inter,clos[i.se].back());
	}
	ll ans=val;
	fr(x,1,m-1) {
		for(int j:clos[x])
			val-=j;
		inter-=clos[x].size();
		val+=inter;
		inter+=open[x];
		trace(inter,val);
		ans=max(ans,val);
	}
	cout<<sum-ans<<endl;
}
signed main() {
	ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	srand(chrono::high_resolution_clock::now().time_since_epoch().count());
	cout<<fixed<<setprecision(10);
	int t=1;
//	cin>>t;
	fr(i,1,t)
		solve();
#ifdef rd
	cout<<endl<<endl<<endl<<endl<<"Time elapsed: "<<(double)(clock()-clk)/CLOCKS_PER_SEC<<endl;
#endif
	return 0;
}


Measured memory_bytes: 6132
#include <stdio.h>
int main(void)
{
  int S,h,m,s;
  scanf("%d",&S);
  h=S/3600;
  m=S%3600/60;
  s=S%3600%60;
  printf("%d:%d:%d\n",h,m,s);
  return 0;
}


Measured memory_bytes: 2128
#template
def inputlist(): return [int(k) for k in input().split()]
#template
S = list(input())
T = list(input())
for i in range(len(S)):
    Sa = S[:]
    S = [Sa[-1]] + Sa[:-1]
    if S == T:
        print("Yes")
        exit()
print("No")

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>

using namespace std;
const long long MOD = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ld, ll> pdl;
typedef pair<ld, ld> pdd;
//typedef boost::multiprecision::cpp_int bigint;

ll N;
ll A, B;

int main() {
	cin >> N;
	A = 0; B = 0;
	for (ll n = 0; n < N; n++) {
		ll a;
		cin >> a;
		if (a % 4 == 0)A++;
		else if (a % 2 == 0)B++;
	}
	ll res = 2 * A + B;
	if (B == 0)res++;
	if (res >= N)cout << "Yes" << endl;
	else cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <queue>
#include <list>
#include <cmath>
#include <stack>
#include <iomanip>

using namespace std;
typedef long long ll;
using Pll = pair<ll,ll>;

const ll INF = 1LL<<60;
const ll MOD = 1000000007;

//cout << fixed << setprecision(10);

int main() {
    ll A,B;
    cin >> A >> B;
    cout << ((A+B)%2==0?to_string((A+B)/2):"IMPOSSIBLE") << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0;i<(n);++i)
#define ALL(v)   (v).begin(),(v).end()
#define debug(x) cerr<<#x<<": "<<(x)<<endl
#define INF      (int)1e9
#define MOD      ((int)1e9+7)
using namespace std;
typedef long long     llong;
typedef pair<int,int> pii;
typedef vector<int>   vi;
typedef vector<vi >   vvi;
typedef vector<vvi >  vvvi;
template<class Type> void line(const Type &a){int cnt=0;for(auto &elem:a){if(cnt++)cout<<' ';cout<<elem;}cout<<endl;}

int main(){
	int a[3];
	REP(i,3) cin>>a[i];
	
	int sum=0;
	REP(i,3) sum+=a[i];
	
	if(sum>=22) cout<<"bust"<<endl;
	else cout<<"win"<<endl;
}


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

int selectionSort(int A[], int N){
    int minj;
    int x= 0;
    int a;
    for(int i = 0; i < N-1; i++){
        minj = i;
        for(int j = i; j<N; j++){
            if (A[j] < A[minj]) minj = j;
        }
        a = A[i]; A[i] = A[minj]; A[minj] = a;
        if(i != minj) x++;
    }return x;
}
int main(){
    int x;
    int N;
    int A[1000];
    cin >>N;
    for (int i = 0; i < N; i++){
        cin >>A[i];
    }
    
    x = selectionSort(A, N);
    for(int i = 0; i < N; i++){
        cout <<A[i];
        if(i!=N-1){
            cout<<" ";
        }
        else cout<<endl;
    }
    cout <<x <<endl;
    return 0;
}




Measured memory_bytes: 3108
#include <bits/stdc++.h>
#define debug(...) fprintf(stderr,__VA_ARGS__);
using namespace std;
typedef long long ll;
const int MAXSIZE=10000020;
int bufpos;
char buf[MAXSIZE];
#define NEG 0
void init(){
	//freopen("color.in","r",stdin);
	//freopen("color.out","w",stdout);
	buf[fread(buf,1,MAXSIZE,stdin)]='\0';
	bufpos=0;
}
#if NEG
int readint(){
	bool isneg;
	int val=0;
	for(;!isdigit(buf[bufpos]) && buf[bufpos]!='-';bufpos++);
	bufpos+=(isneg=buf[bufpos]=='-');
	for(;isdigit(buf[bufpos]);bufpos++)
		val=val*10+buf[bufpos]-'0';
	return isneg?-val:val;
}
#else
int readint(){
	int val=0;
	for(;!isdigit(buf[bufpos]);bufpos++);
	for(;isdigit(buf[bufpos]);bufpos++)
		val=val*10+buf[bufpos]-'0';
	return val;
}
#endif
char readchar(){
	for(;isspace(buf[bufpos]);bufpos++);
	return buf[bufpos++];
}
int readstr(char* s){
	int cur=0;
	for(;isspace(buf[bufpos]);bufpos++);
	for(;!isspace(buf[bufpos]);bufpos++)
		s[cur++]=buf[bufpos];
	s[cur]='\0';
	return cur;
}
const int maxn=310002;
const int INF=0x3f3f3f3f;
struct segtree{
	int n;
	int t[maxn*4],ad[maxn*4];
	void init(int n){
		this->n=n;
		memset(t,0,sizeof(t));
		memset(ad,0,sizeof(ad));
	}
	int ul,ur,uv;
	void update(int o,int l,int r){
		// debug("o=%d l=%d r=%d ul=%d ur=%d\n",o,l,r,ul,ur);
		if (ul<=l && ur>=r){
			ad[o]+=uv;
			t[o]+=uv;
			return;
		}
		int mid=(l+r)/2;
		if (ul<=mid)
			update(o*2,l,mid);
		if (ur>mid)
			update(o*2+1,mid+1,r);
		t[o]=max(t[o*2],t[o*2+1])+ad[o];
	}
	void add(int l,int r,int v){
		if (l>r)
			return;
		// debug("add %d %d %d\n",l,r,v);
		ul=l,ur=r,uv=v;
		update(1,1,n);
	}
	int ql,qr;
	int query(int o,int l,int r){
		if (ql<=l && qr>=r)
			return t[o];
		int mid=(l+r)/2,ans=-INF;
		if (ql<=mid)
			ans=max(ans,query(o*2,l,mid));
		if (qr>mid)
			ans=max(ans,query(o*2+1,mid+1,r));
		return ans+ad[o];
	}
	int query(int l,int r){
		if (l>r)
			return -INF;
		ql=l,qr=r;
		return query(1,1,n);
	}
}t;
struct point{
	int x,y;
	bool operator <(const point & rhs)const{
		return y<rhs.y;
	}
}a[maxn];
int h,w,n;
int s1[maxn],t1,s2[maxn],t2;
int work(){
	sort(a+1,a+n+1);
	t.init(n);
	int o=h/2;
	s1[0]=s2[0]=1;
	t1=t2=0;
	int ans=0;
	// debug("n=%d\n",n);
	for(int i=1;i<=n;i++){
		ans=max(ans,t.query(1,i-1)+a[i].y);
		// debug("i=%d\n",i);
		if (a[i].x<=o){
			while(t1 && a[s1[t1]].x<a[i].x){
				t.add(s1[t1-1],s1[t1]-1,a[s1[t1]].x);
				t1--;
			}
			t.add(s1[t1],i-1,-a[i].x);
			s1[++t1]=i;
		}else{
			t.add(s2[t2],i-1,-h);
			while(t2 && a[s2[t2]].x>=a[i].x){
				t.add(s2[t2-1],s2[t2],-a[s2[t2]].x);
				t2--;
			}
			t.add(s2[t2],i-1,a[i].x);
			s2[++t2]=i;
		}
		// debug("i=%d\n",i);
		t.add(i,i,h-a[i].y);
	}
	// debug("ans=%d\n",ans);
	return ans;
}
int main(){
	init();
	h=readint(),w=readint(),n=readint();
	for(int i=1;i<=n;i++)
		a[i].x=readint(),a[i].y=readint();
	a[++n]=(point){0,0};
	a[++n]=(point){h,w};
	// debug("233\n");
	int ans=work();
	// debug("233\n");
	swap(h,w);
	for(int i=1;i<=n;i++)
		swap(a[i].x,a[i].y);
	ans=max(ans,work());
	printf("%d",ans*2);
}

Measured memory_bytes: 19328
MON = list(map(int,input().split()))
 
while 1:
  
  MON[2] = MON[2] - MON[1]
  if(MON[2] <= 0):
    print("Yes")
    break
 
  MON[0] = MON[0] - MON[3]
  if (MON[0] <= 0 ):
    print("No")
    break

Measured memory_bytes: 8964
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;

class Solve{
    static void Main(string[] args){
        var N = int.Parse(Console.ReadLine());
        var P = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        var Q = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);
        int a = 1, b = 1;
        var list = new List<int>(8);
        for (int i = 0; i < N; i++){
            var pi = P[i];
            var count = 0;
            if (list.Any())
                for (int j = 0, len = list.Count; j < len; j++){
                    var s = list[j];
                    if (s < pi) count++;}
            var x = pi - count;
            a += i == N - 1 ? 0 : (x - 1) * Factorial(N - 1 - i);
            list.Add(pi);}
        list.Clear();
        for (int i = 0; i < N; i++){
            var qi = Q[i];
            var count = 0;
            if (list.Any())
                for (int j = 0, len = list.Count; j < len; j++){
                    var s = list[j];
                    if (s < qi) count++;}
            var x = qi - count;
            b += i == N - 1 ? 0 : (x - 1) * Factorial(N - 1 - i);
            list.Add(qi);}
        var answer = Math.Abs(a - b);
        var writer = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
        Console.SetOut(writer);
        Console.WriteLine(answer);
        Console.Out.Flush();}

    public static int Factorial(int n){
        int result = 1;
        for (int i = n; i > 1; i--){
            result *= i;}
        return result;}}

Measured memory_bytes: 28244
#include <bits/stdc++.h>
using namespace std;
int main() {
    int A, B;
    cin >> A >> B;

    if (A < B) {
        cout << 2 * B - 1 << endl;
    } else if (B < A) {
        cout << 2 * A - 1 << endl;
    } else if (A == B) {
        cout << 2 * A << endl;
    }
}

Measured memory_bytes: 256
/*==============================================*\
ID:          shahidul_brur
 
Name:     Md. Shahidul Islam
Study:      CSE, BRUR
Address:  Rangpur, Bangladesh
 
 mail: shahidul.cse.brur@gmail.com
 FB  : fb.com/shahidul.brur
 Blog: shahidul-brur.blogspot.com(in Bengali),
       shahidul-brur-en.blogspot.com(in English)
\*===============================================*/
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
//using namespace __gnu_pbds;
using namespace std;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;

#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma")

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef pair<ll, int> li;
typedef pair<int, ll> il;
typedef vector<ii> vii;
typedef vector<il> vil;
typedef vector<li> vli;
 
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz size()
#define all(a)  a.begin(), a.end()
#define mem(a, b)     memset(a, b, sizeof(a))
#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)
#define rep(i,a,b,c) for(int i=(a);i!=(b);i+=(c))
 
int dx8[] = {0, 0, 1, 1, 1, -1, -1, -1};
int dy8[] = {1,-1, 1, -1, 0, 0, -1, 1};
int dx4[] = {0, 0, 1, -1};
int dy4[] = {1, -1, 0, 0};

const double pi = acos(-1.0);
const double eps = 1e-6;
const int mod = (int)1e9+7;
const int maxn = (int)2e5+5;
const int logn = 20;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    int a, b,c;
    cin>>a>>b>>c;
    cout << max(0, c - (a-b));
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <queue>
#include <map>
#include<algorithm>



using namespace std;



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

	vector<pair<int,int>> a(n);
	for (int i = 0; i < n; i++) {
		cin >> a[i].first;
		a[i].second = i+1;
	}

	
	
	sort(a.begin(), a.end());
	

	for (int i = 0; i < n; i++) {
		printf("%d", a[i].second);
		if (i != n - 1) {
			printf(" ");
		}
	}
}

Measured memory_bytes: 1536
/*
 * Author:  heyuhhh
 * Created Time:  2020/5/13 18:09:49
 */
#include <iostream>
#include <algorithm>
#include <cstring>
#include <cstdio>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <assert.h>
#define MP make_pair
#define fi first
#define se second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define INF 0x3f3f3f3f
#define Local
#ifdef Local
  #define dbg(args...) do { cout << #args << " -> "; err(args); } while (0)
  void err() { std::cout << std::endl; }
  template<typename T, typename...Args>
  void err(T a, Args...args) { std::cout << a << ' '; err(args...); }
  template <template<typename...> class T, typename t, typename... A> 
  void err(const T <t> &arg, const A&... args) {
  for (auto &v : arg) std::cout << v << ' '; err(args...); }
#else
  #define dbg(...)
#endif
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
//head
const int N = 11;

ll f[N][N], g[N];

void run() {
    int k; cin >> k;
    for (int i = 0; i < 10; i++) f[i][1] = 1;
    for (int t = 2; t < N; t++) {
        for (int i = 0; i < 10; i++) {
            for (int j = max(i - 1, 0); j <= min(i + 1, 9); j++) {
                f[i][t] += f[j][t - 1];
            }
        }
    }
    for (int t = 1; t < N; t++) {
        for (int i = 1; i < 10; i++) {
            g[t] += f[i][t];
        }
    }
    int t;
    for (t = 1; t < N; t++) {
        if (g[t] < k) k -= g[t];
        else break;
    }
    ll x = 0;
    int last = -1;
    for (int i = t; i >= 1; i--) {
        if (last != -1) {
            for (int j = max(last - 1, 0); j <= min(last + 1, 9); j++) {
                if (f[j][i] < k) k -= f[j][i];
                else {
                    last = j;
                    x = x * 10 + j;
                    break;
                }
            }
        } else for (int j = 1; j < 10; j++) {
            if (f[j][i] < k) k -= f[j][i];
            else {
                last = j;
                x = x * 10 + j;
                break;
            }
        }
    }
    cout << x << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(20);
    run();
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
int n;
int m;
vector < pair < int , int > > res;
int main()
{
            ios_base::sync_with_stdio(false);
            cin.tie(0);
            cout.tie(0);
            int a,b,c;
            cin >> a >> b >> c;
            if((10 * b + c) % 4 == 0)
                cout << "YES"  << endl;
            else
                cout << "NO" << endl;
            return 0;
}


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

int main(){
    int a,b;
    cin >> a >> b;
    if (a<b){
        cout << "a < b" << endl;
    } else if (a>b){
        cout << "a > b" << endl;
    } else if (a==b) {
        cout << "a == b" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 3032
from collections import deque
n=int(input())
a=list(map(int,input().split()))
b=deque()
for i in range(n):
    if i%2==0:
        b.append(a[i])
    if i%2==1:
        b.appendleft(a[i])

if n%2==1:
    c=deque()
    for i in range(n):
        d=b.pop()
        c.append(d)
    print(*c)
else:
    print(*b)



Measured memory_bytes: 25412