akhauriyash/Code-Regression huggingface dataset:
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << " = " << (x) << endl;
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define SP << " " <<

typedef long long ll;
typedef pair<int, int> P;
typedef tuple<int, int, int> T;
typedef vector<int> vec;
typedef vector<P> pvec;
typedef vector<vector<int>> vvec;
typedef vector<vector<P>> pvvec;
typedef priority_queue<int> PQI;
typedef priority_queue<P> PQP;
typedef priority_queue<int,vector<int>,greater<int>> PQIG;
typedef priority_queue<P,vector<P>,greater<P>> PQPG;

const vector<int> DX = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> DY = {1, 0, -1, 0, 1, -1, 1, -1};
constexpr int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30); // 1073741824
const ll INF = (1LL << 60); // 1152921504606846976
const double PI = (3.141592653589794);
const double EPS = (0.0000000001); // 10^(-10)

template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}
template<class T> inline T ceil(T a, T b) {return T((a + b - 1) / b);}
template<class T> inline T round(T a, T b) {return T(a / b);}
template< typename T1, typename T2 > istream &operator>>(istream &is, pair< T1, T2 > &p) { is >> p.first >> p.second; return is; }
template <class T> inline void out(T &a) { bool flag=true; for(auto&x:a){if(flag) {flag=false;} else{ cout << ' '; } cout<<x; } cout << endl; }



//----------------------------------------------------------------
int nmax=200000; // 2*(10^5)
vvec G(nmax);





void solve4ts()
{
    
    
    int n,k;
    cin>>n>>k;
    vector<int> a(n);
    rep(i,n) cin >> a[i];
    rep(i,n-k){
        if(a[i]<a[i+k]) cout<<"Yes\n";
        else cout<<"No\n";
    }
    
    
}
//-----------------------------------------------------------------

signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout << fixed << setprecision(15);
    int repeat = 1;
    // cin >> repeat;
    while(repeat--) solve4ts();
}

/*

g++ -std=c++1z code.cpp
./a.out

*/

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

int main() {
  int n;
  cin >> n;
  vector<int> vec(n);
  bool a = true;
  
  for (int i = 0; i < n; i++){
    cin >> vec.at(i);
  }
  
  for (int i = 0; i < n; i++){
    if (vec.at(i)%2 == 0){
      if (vec.at(i)%3 == 0 || vec.at(i)%5 == 0){
        a = true;
      }
      else {
        a = false;
        break;
      }
    }
    else {
      continue;
    }
  }
  if (a == true){
    cout << "APPROVED" << endl;
  }
  else {
    cout << "DENIED" << endl;
  }
}
      

Measured memory_bytes: 256
N = int(input())
A = []
z = [ [] for k in range(0, N) ]

for i in range(0, N):
    A.append(int(input()))
    for j in range(0, A[i]):
        z[i].append(list(map(int, input().split())))

result = [0]
r = [1] + [ 0 for i in range(0, N-1)]

while r != [ 0 for j in range(0, N)]:
    s = 1
    for i in range(0, N):
        if r[i] == 1:
            for k in range(0, A[i]):
                if r[z[i][k][0] - 1] != z[i][k][1]:
                    s = 0
    if s == 1:
        result.append(sum(r))
    for i in range(0, N):
        if r[i] == 0:
            r[i] = 1
            break
        else:
            r[i] = 0

print(max(result))

Measured memory_bytes: 3484
#[allow(unused_imports)]
use std::cmp;
use std::io::Write;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    let s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

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

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

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

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

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

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

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

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

fn main() {
  let out = std::io::stdout();
  let mut out = std::io::BufWriter::new(out.lock());
  macro_rules! puts {
    ($($format:tt)*) => (write!(out,$($format)*).unwrap());
  }
  input! {
    n: usize,
    s: [String; n],
  }
  use std::collections::BTreeMap;
  let mut count = BTreeMap::new();
  for x in &s {
    *count.entry(x).or_insert(0) += 1;
  }
  let max = count.values().cloned().max().unwrap();
  for (x, &c) in &count {
    if c == max {
      puts!("{}\n", x);
    }
  }
}


Measured memory_bytes: 22396
(n, m) = list(map(int, input().split()))
hights = list(map(int, input().split()))

bads = set([])
for _ in range(m):
    (s, d) = list(map(int, input().split()))
    if hights[s-1] < hights[d-1]:
        bads.add(s)
    elif hights[s-1] > hights[d-1]:
        bads.add(d)
    elif hights[s-1] == hights[d-1]:
        bads.add(s)
        bads.add(d)
print(len(hights) - len(bads))

Measured memory_bytes: 19992
#include <stdio.h>

int main (){
   int a[3][3];
   for(int i = 0;i < 3;i++)
      for(int j = 0;j < 3;j++)
         scanf("%d",&a[i][j]);
   int n;scanf("%d",&n);
   int ans[3][3] = {0};
   int b[11];for(int i = 0;i < n;i++)scanf("%d",&b[i]);

   for(int i = 0;i < n;i++)
      for(int j = 0;j < 3;j++)
         for(int k = 0;k < 3;k++)
            if(b[i] == a[j][k])ans[j][k] = 1;

   
   /*for(int i = 0;i < 3;i++){
      for(int j = 0;j < 3;j++){
         printf("%d ",ans[i][j]);
      }
      printf("\n");
   }*/
   for(int i = 0;i < 3;i++){
      if((ans[i][0]+ans[i][1]+ans[i][2]==3)||
         (ans[0][i]+ans[1][i]+ans[2][i]==3)){
            printf("Yes\n");
            return 0;
         }
   }
   if(ans[0][2]+ans[1][1]+ans[2][0]==3||
      ans[0][0]+ans[1][1]+ans[2][2]==3)printf("Yes\n");
   else printf("No\n");
}

Measured memory_bytes: 256
#include "iostream"
#include "vector"
#include "string"
#include "algorithm"
#include "math.h"
#include "cstring"

using namespace std;
typedef long long ll;

int n, wmax;
int w[110];
ll v[110];
ll dp[110][100100];	//i未満重さj以下の最大価値
ll ans;

int main()
{
  cin >> n >> wmax;
  for (int i = 0; i < n; i++)
  {
    cin >> w[i] >> v[i];
  }
  fill(dp[0], dp[0], 0);
  for (int i = 0; i < n; i++)
  {
    for (int j = 0; j < 100100; j++)
    {
      if (j < w[i])
      {
        dp[i + 1][j] = dp[i][j];
      }
      else
      {
        dp[i + 1][j] = max(dp[i][j - w[i]] + v[i], dp[i][j]);
      }
    }
  }
  cout << dp[n][wmax] << "\n";
}

Measured memory_bytes: 79360
if __name__=='__main__':
	N=int(input())
	happiness=[]
	for i in range(N):
		cost=list(map(int,input().split()))
		happiness.append(cost)
	dp=[[0 for j in range(3)] for i in range(N+1)]
#j:0 is from A, 1 is from B, 2 is from C
	for i in range(N):
		for j in range(3):
			for k in range(3):
				if j != k:
					dp[i+1][k] = max(dp[i+1][k], dp[i][j]+happiness[i][k])
				else:
					continue
			
	print(max(dp[-1]))

Measured memory_bytes: 47328
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)*}
    };
}

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

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, usize1) => {
        read_value!($next, usize) - 1
    };

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

fn main() {
    input! {
        n: usize,
        m: usize,
        k: i64,
        a_books: [i64; n],
        b_books: [i64; m],
    }

    let mut sum_time = 0;
    let mut count = 0;
    let mut a_index = 0;
    for _ in 0..n {
        if k >= sum_time + a_books[a_index] {
            sum_time += a_books[a_index];
            count += 1;
            a_index += 1;
        } else {
            break;
        }
    }

    let mut b_index = 0;
    for _ in 0..m {
        if k >= sum_time + b_books[b_index] {
            sum_time += b_books[b_index];
            count += 1;
            b_index += 1;
        } else {
            break;
        }
    }

    let mut max_count = count;

    if max_count == n + m {
        println!("{}", max_count);
    } else {
        for i in 0..a_index {
            let index = a_index - i - 1;
            count -= 1;
            sum_time -= a_books[index];
            if b_index >= b_books.len() {
                break;
            }
            let mut next_b = b_books[b_index];
            while k >= sum_time + next_b && b_index < b_books.len() {
                count += 1;
                sum_time += next_b;
                b_index += 1;
                if b_index < b_books.len() {
                    next_b = b_books[b_index];
                }
            }
            if max_count < count {
                max_count = count;
            }
        }
        println!("{}", max_count);
    }
}

// いったんAを全部読もうとする　読める数をAAとする
// Aの最後を読むのをやめたときに、Bを読めるだけ読む
// Aの最後をもう１冊読むのをやめて、Bを読めるだけ読む
// Aをまったく読まなくするまで繰り返して、一番読めた冊数が答え


Measured memory_bytes: 5224
#ifdef LOCAL111
	#define _GLIBCXX_DEBUG
#else
	#pragma GCC optimize ("O3")
	#define NDEBUG
#endif
// #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
const int INF = 1e9;
using namespace std;
template<typename T, typename U> ostream& operator<< (ostream& os, const pair<T,U>& p) { os << '(' << p.first << ' ' << p.second << ')'; return os; }

#define endl '\n'
#define ALL(a)  (a).begin(),(a).end()
#define SZ(a) int((a).size())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
#ifdef LOCAL111
	#define DEBUG(x) cout<<#x<<": "<<(x)<<endl
	template<typename T> void dpite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
#else
	#define DEBUG(x) true
	template<typename T> void dpite(T a, T b){ return; }
#endif
#define F first
#define S second
#define SNP string::npos
#define WRC(hoge) cout << "Case #" << (hoge)+1 << ": "
template<typename T> void pite(T a, T b){ for(T ite = a; ite != b; ite++) cout << (ite == a ? "" : " ") << *ite; cout << endl;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}

template<typename T>
vector<T> make_v(size_t a){return vector<T>(a);}

template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
  return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value!=0>::type
fill_v(U &u,const V... v){u=U(v...);}

template<typename T,typename U,typename... V>
typename enable_if<is_same<T, U>::value==0>::type
fill_v(U &u,const V... v){
  for(auto &e:u) fill_v<T>(e,v...);
}

const array<int, 4> dx = {0, 1, 0, -1};
const array<int, 4> dy = {1, 0, -1, 0};


typedef long long int LL;
typedef unsigned long long ULL;
typedef pair<int,int> P;

void ios_init(){
	//cout.setf(ios::fixed);
	//cout.precision(12);
#ifdef LOCAL111
	return;
#endif
	ios::sync_with_stdio(false); cin.tie(0);
}

int main()
{
	ios_init();
	int a, b;
	while(cin >> a >> b) {
		cout << (b - 1 + a - 2) / (a - 1) << endl;
	}
	return 0;
}


Measured memory_bytes: 256
/*----------------by syr----------------*/
/*

         iii                  ii
     rBQBBBBBBE       BBR iBBBBQBBL     XBBBBBBQBBBBB
   iBBQJ    7BBB      BBsSBBr   BBQ      i      cBBB
  rBBU       iBBw     BBBQi     HBBi           KBBi
  BBH         BB5    iBBB       isL          wBB5
 GBB         iBBi    6BB                   iBBB
 BBQ         BQB     BBD                  QBBi
 BBB        BQB     iQBi                1BBv
 sBBg     wBBB      QBB               iBBB
  7BBBBBBBBBi       BBR              wBBBBBBBBBBBBB
     irvi           ii               ii    i i iii
                i5U
               BBB
               BB7
              1BB
      iPBBBBBKBBR    JBR1       rQBO   BR  UBQP  iBBQi
    7BBBGs7sXBBBi     QBBr     gBBE   rBB BB2BB7HBZQBB
   QBBi      sBQ       BBB   iBBB     SQBBR  BBBB  cBQ
  gBQ        BBg        BBB KBBi      MBBH   BBB   BBs
 iBBv       iBBi         QBBBL        BBR   pBB   iBB
 pBB        BBB         iBBBB        iBB    BBL   KBB
 MBB       BBBR        BBB JBBi      DBR   iBQ    BBL
 GBB     7BBBB2      PBBH   BBBi     BQr   DBB   iBB
  BQBXwgBBP BB7    1BBB      BBQ7   1BB    BBc   BBB
   2BBBBw   BB    EBBS        QBBi  HBa   iBB    BB7
*/
#include<bits/stdc++.h>

using namespace std;

#define PH push
#define MP make_pair
#define PB push_back
#define fst first
#define snd second
#define FOR(i, x, y) for(int i = (x); i < (y); ++i)
#define REP(i, x, y) for(int i = (x); i <= (y); ++i)
#define x0 x0123456789
#define y0 y0123456789
#define x1 x1234567890
#define y1 y1234567890
#define x2 x2345678901
#define y2 y2345678901
typedef double db;
typedef long long ll;
typedef long double ldb;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

const int INF = 1e9 + 7;
const int maxn = 55;

int n, ans = 0;
int x[maxn], y[maxn];
map<int, map<int, int> > mp;

int main(){
	scanf("%d", &n);
	FOR(i, 0, n){
		scanf("%d%d", x + i, y + i);
	}
	FOR(i, 0, n) FOR(j, 0, n) if(i != j)
		mp[x[i] - x[j]][y[i] - y[j]] += 1;
	if(!mp.size())
		printf("%d\n", n);
	else{
		for(map<int, map<int, int> >::iterator i = mp.begin(); i != mp.end(); ++i){
			for(map<int, int>::iterator j = (i -> snd).begin(); j != (i -> snd).end(); ++j)
				ans = max(ans, j -> snd);
		}
		printf("%d\n", n - ans);
	}
	return 0;
}



Measured memory_bytes: 640
#include <cstdio>
#include <vector>
using namespace std;
template <class Type>
class BIT {
private:
	int size_; vector<Type> v;
	Type sum(int r) { Type ret = 0; while (r > 0) ret += v[r], r -= r & -r; return ret; }
public:
	BIT() : size_(0), v(vector<Type>()) {};
	BIT(int size__) { for (size_ = 1; size_ < size__;) size_ <<= 1; v.resize(size_ + 1); }
	void add(int i, Type x) { i++; while (i <= size_) v[i] += x, i += i & -i; }
	Type sum(int l, int r) { return sum(r) - sum(l); }
};
int n, q, c, x, y;
int main() {
	scanf("%d%d", &n, &q);
	BIT<int> b(n);
	for (int i = 0; i < q; i++) {
		scanf("%d%d%d", &c, &x, &y);
		if (!c) b.add(x - 1, y);
		else printf("%d\n", b.sum(x - 1, y));
	}
	return 0;
}

Measured memory_bytes: 2864
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <map>
#include <cmath>
#include <iomanip>
#include <cassert>
#include <cstdio>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <unordered_set>
using namespace std;

#define db(x) cerr << #x << " = " << x << endl;

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

const ll   MOD       = 1000000007;
const ll   INF       = 1000000007ll*1000000007ll;
const ll   N         = 1000002;
const ll   logN      = 20;
const ld   PI        = acos(-1);
const ll   HashPrime = 31;

inline void No() {
    cout << "No\n";
}
inline void Yes() {
    cout << "Yes\n";
}

#define fi first
#define se second

ll l, r, d;
ll n, m;
ll ans[N];
bool mark[N];
vector < pll > g[N];

void dfs(int v) {
  mark[v] = true;
  for (int i = 0; i < g[v].size(); ++i) {
    ll to = g[v][i].first, len = g[v][i].second;
    if (ans[to] == INF) {
      ans[to] = ans[v] + len;
    }
    if (ans[to] != ans[v] + len) {
      No();
      exit(0);
    }
    if (!mark[to]) {
      dfs(to);
    }
  }
}

void solve() {
  fill(ans, ans+N, INF);
  cin >> n >> m;
  for (int i = 0; i < m; ++i) {
    cin >> l >> r >> d;
    g[l].push_back({r, d});
    g[r].push_back({l, -d});
  }
  for (int i = 1; i <= n; ++i) {
    if (!mark[i]) {
      ans[i] = 0;
      dfs(i);
    }
  }
  Yes();
}

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


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

using namespace std;

using llong = long long int;

#define rep(i, n) for (int i = 0; i < n; ++i)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) x.begin(), x.end()
#define allr(x) x.rbegin(), x.rend()

const static int MOD = 1000000007;
const static int INF = 1<<30;
const static int dx[4] = {1, 0, -1, 0};
const static int dy[4] = {0, 1, 0, -1};

int main (int argc, char *argv[]) {
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n;
    cin >> n;

    int k = ceil((double)n/1000);
    cout << k*1000 - n << endl;

    return 0;
}

Measured memory_bytes: 3648
from statistics import median


def main():
    n = int(input())
    a = [0] * n
    b = [0] * n
    for i in range(n):
        a[i], b[i] = map(int, input().split())
    ans = median(b) - median(a)
    if n % 2 == 0:
        ans *= 2
    ans = int(ans)
    ans += 1
    print(ans)


if __name__ == '__main__':
    main()


Measured memory_bytes: 28644
#include<bits/stdc++.h>
#define MOD 1000000007
using namespace std;
#define ll long long int
#define gc getchar_unlocked
#define pc putchar_unlocked
const long long int size=1000003;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#ifdef _WIN32
// no getchar_unlocked on Windows so call _getchar_nolock
inline int gc() { return getchar(); }
inline int pc(ll n) { return putchar(n);}
#endif
// //ll f[size];
// vector<bool>isPrime(size,1);
// //bool isPrime[size];
// ll p[size];
// void fact()
// {f[0] = 1;ll i = 1;while(i<size){f[i] = f[i-1]*i;f[i] = f[i]%MOD;i++;}}
// //use when mod is prime no
// ll fast_pow(ll a,ll n)
// {ll result = 1;while(n>0){if(n&1){result = result*a;result = result%MOD;}a = (a*a)   %MOD;n/= 2;}return result;}
// ll inv(ll x)
// {return fast_pow(x,MOD-2);}
// void sieve()
// {//for(ll i = 0; i <= size;++i) {isPrime[i] = true;}
// isPrime[0] = false;isPrime[1] = false;
// for(ll i = 2; i * i <= size; ++i) {if(isPrime[i] == true) {
// for(ll j = i * i; j <= size ;j += i)isPrime[j] = false;}}

//  p[1]=0;p[0]=0;
//     for(ll i=2;i<=size-1;i++)
//     {
//         if(isPrime[i])
//         p[i]=i+p[i-1];
//         else
//         p[i]=p[i-1];
//     }
// }
// vector<ll> factorize(ll n) {vector<ll> res;
// for (ll i = 2; i * i <= n; ++i) {while (n % i == 0) {res.push_back(i);n /= i;}}
// if (n != 1) {res.push_back(n);}return res;}
ll phi(ll n)
{
	ll result = n;
	for (ll p = 2; p * p <= n; ++p) {
		if (n % p == 0) {
			while (n % p == 0)
				n /= p;
			result -= result / p;
		}
	}
	if (n > 1)
		result -= result / n;
	return result;
}
inline void in(ll &x)
{
	register char c = gc();
	while(c<'0' || c>'9')
		c = gc();

	x=0;
	while(c>='0' && c<='9')
	{
		x = 10 * x + c - 48;
		c = gc();
	}

}
inline void out( ll &b)
{
	char snum[20];
	ll i=0;
	do
	{
		snum[i++]=b%10+'0';
		b=b/10;
	}while(b);
	i=i-1;

	while (i>=0)
	{
		pc(snum[i--]);
	}
   pc('\n');
}
int main()
{
 ll n;cin>>n;
 ll f1=0,f2=0;
  f1=n/500;
  n=n%500;
  f2=n/5;
  n=n%5;
    ll ans=(f1*1000)+(f2*5);
    cout<<ans;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int a = sc.nextInt();
    int b = sc.nextInt();
    int c = sc.nextInt();
    int d = sc.nextInt();

    if (a <= c && c <= b && b <= d) {
      System.out.println(b-c);
    } else if (c <= a && a <= d && d <= b) {
      System.out.println(d-a);
    } else if (a <= c && d <= b) {
      System.out.println(d-c);
    } else if (c <= a && b <= d) {
      System.out.println(b-a);
    }else {
      System.out.println(0);
    }

  }

}


Measured memory_bytes: 21972
def main():
    n, m = map(int, input().split())
    adj = [[] for i in range(n)]
    for i in range(m):
        s, t = map(int, input().split())
        adj[s].append(t)
        adj[t].append(s)

    q = int(input())
    component_ids = [-1 for i in range(n)]
    id = 0
    for i in range(n):
        if component_ids[i] != -1:
            continue
        bfs(i, id, adj, component_ids)
        id += 1

    for i in range(q):
        s, t = map(int, input().split())
        if component_ids[s] == component_ids[t]:
            print("yes")
        else:
            print("no")


def bfs(node, id, adj, component_ids):
    que = [node]
    while que:
        u = que.pop(0)
        component_ids[u] = id
        for v in adj[u]:
            if component_ids[v] == -1:
                que.append(v)

main()

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

using ll=__int128;
const ll MOD=1e9+7;


using Mat=vector<vector<ll>>;

Mat cross(const Mat &lhs,const Mat& rhs){
    assert(lhs[0].size()==rhs.size());
    int l=lhs.size();
    int m=lhs[0].size();
    int n=rhs[0].size();
    Mat res(l,vector<ll>(n,0LL));
    for(int i=0;i<l;i++){
        for(int k=0;k<m;k++){
            for(int j=0;j<n;j++){
                res[i][j]+=lhs[i][k]*rhs[k][j];
                res[i][j]%=MOD;
            }
        }
    }
    return res;
}

Mat E(ll sz){
    Mat e(sz,vector<ll>(sz,0));
    for(int i=0;i<sz;i++){
        e[i][i]=1;
    }
    return e;
}
Mat pow(const Mat& A,ll x){
    assert(A.size()==A[0].size());
    Mat cpA=A;
    Mat res=E(cpA.size());
    while(x){
        if(x&1) res=cross(res,cpA);
        cpA=cross(cpA,cpA);
        x>>=1;
    }
    return res;
}
// 1 2 3 5 ... 0-indexed
ll fib(ll x){
    Mat A(2,vector<ll>(2,0));
    A[0][0]=A[0][1]=A[1][0]=1;
    A[1][1]=0;
    Mat mat=pow(A,x);
    Mat vec(2,vector<ll>(1,0));
    vec[0][0]=2;
    vec[1][0]=1;
    Mat res=cross(mat,vec);
    return res[1][0];
}

ll getUnder(ll a){
    ll x=a/2+1;
    ll sum=x*(x+1);
    if(a&1) sum-=x;
    else sum-=2*x;
    return sum;
}
int main(){
    long long kbuf;
    cin>>kbuf;
    ll k=kbuf;
    k--;
    ll lb=0;
    ll ub=1e12;
    while(ub-lb>1){
        ll mid=(ub+lb)/2;
        ll sum=getUnder(mid);
        if(sum<=k){
            lb=mid;
        }
        else{
            ub=mid;
        }
    }        
    k-=getUnder(lb);
    
    ll x=lb/2+1;
    ll p;
    if(k<(x+1)/2){
        p=k*2;
    }
    else{
        ll y=x-k-1;
        p=y*2+1;
    }
    cout<<(long long)((fib(p)*fib(lb-p))%MOD)<<endl;
    return 0;
}


Measured memory_bytes: 3156
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            StringBuilder sb = new StringBuilder();

            string input;

            while (!string.IsNullOrEmpty(input = Console.ReadLine()))
            {
                int n = int.Parse(input);
                n %= 39;

                string ans = n == 0 ? "3C39" : string.Format("3C{0:00}", n);
                sb.AppendLine(ans);
            }
            Console.Write(sb);
        }
    }
}

Measured memory_bytes: 9332
fn main() {
    let mut reader = acio::Reader::new();
    let n = reader.read::<usize>();
    let a = reader.read_by::<i64>(n);
    let s: i64 = a.iter().sum();
    let mut x = vec![s];
    for i in 0..(n / 2) {
        x[0] -= 2 * a[1 + i * 2];
    }
    for i in 0..(n - 1) {
        let l = x.last().unwrap().clone();
        x.push(2 * a[i] - l);
    }
    for i in 0..n {
        if i == n {
            println!("{}", x[i]);
        } else {
            print!("{} ", x[i]);
        }
    }
}

/// Mathematics Module
#[allow(dead_code)]
mod math {
    trait Math {
        fn lcm(v1: Self, v2: Self) -> Self;
        fn gcd(v1: Self, v2: Self) -> Self;
    }

    macro_rules! integer {
        ($t:ty) => {
            impl Math for $t {
                fn lcm(v1: $t, v2: $t) -> $t {
                    v1 * v2 / Self::gcd(v1, v2)
                }

                fn gcd(v1: $t, v2: $t) -> $t {
                    let (mut v1, mut v2) = (v1, v2);
                    while v1 != v2 {
                        if v1 < v2 {
                            v2 -= v1;
                        } else {
                            v1 -= v2;
                        }
                    }
                    v1
                }
            }
        };
    }

    integer!(i8);
    integer!(i16);
    integer!(i32);
    integer!(i64);
    integer!(isize);
    integer!(u8);
    integer!(u16);
    integer!(u32);
    integer!(u64);
    integer!(usize);
}

/// IO Module for AtCoder
#[allow(dead_code)]
mod acio {
    use std::fmt::Debug;
    use std::io::{stdin, Stdin};
    use std::str::FromStr;

    pub struct Reader {
        input: Stdin,
        stack: Vec<String>,
    }

    impl Reader {
        pub fn new() -> Self {
            Reader {
                input: stdin(),
                stack: vec![],
            }
        }

        pub fn read_by<F>(&mut self, count: usize) -> Vec<F>
        where
            F: FromStr,
            <F as FromStr>::Err: Debug,
        {
            let mut v = vec![];
            for _ in 0..count {
                v.push(self.read());
            }
            v
        }

        pub fn read<F>(&mut self) -> F
        where
            F: FromStr,
            <F as FromStr>::Err: Debug,
        {
            while self.stack.is_empty() {
                let mut line = self.read_line();
                self.stack.append(&mut line);
                self.stack.reverse();
            }
            self.stack.pop().unwrap().parse().unwrap()
        }

        fn read_line(&mut self) -> Vec<String> {
            let mut buf = String::new();
            self.input.read_line(&mut buf).unwrap();
            buf.split_whitespace().map(|s| s.to_string()).collect()
        }
    }
}


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

#define rep(i, s, n) for (int i = s; i < n; ++i)
#define rrep(i, n) for (int i = n - 1; i > -1; --i)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
using namespace std;
const long long INF = 2000000001;
const int MOD = 1000000007;
typedef long long ll;
typedef pair<int, int> P;

int main() {
    ll l, r;
    cin >> l >> r;
    if (r - l >= 2019) {
        cout << 0 << endl;
        return 0;
    } else {
        ll ans = INF;
        rep(i, l, r + 1) {
            rep(j, i + 1, r + 1) { ans = min(ans, (ll)i * j % 2019); }
        }
        cout << ans << endl;
    }
}

Measured memory_bytes: 256
#include <iostream>

int main(){
    int64_t m,n,q = 1000000007;
    std::cin >> m >> n;

    int64_t r = 1;
    int64_t m2 = m*m;
    int64_t m4 = m*m*m*m;
    int64_t i = 0;
    for(int64_t j=0;j<n/4;j++)
    {
        r = (r*m4) %q;
        i += 4;
    }
    for(;i<n;i++)
    {
        r = (r*m) %q;
    }
    std::cout << r << "\n";
    return 0;
}




Measured memory_bytes: 3120
N = int(input())
A = [int(i) for i in input().split()]

is_all_even = True
counter = 0
while True:
    for i, v in enumerate(A):
        if v % 2 == 0:
            A[i] = A[i] // 2
        else:
            is_all_even = False
    if is_all_even:
        counter += 1
    else:
        break
print(counter)



Measured memory_bytes: 3060
N = int(input())
A = list(map(int, input().split()))
Amax = max(A)

counts = [0 for i in range(Amax+1)]

for a in A:
    counts[a] += 1

count = 0
for i in range(1, Amax+1):
    if counts[i] == 1:
        count += 1
    if counts[i]:
        for j in range(i*2, Amax+1, i):
            counts[j] = 0
print(count)


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

using namespace std;



int main() {
    int m, n, k;
    cin >> m >> n >> k;
    vector<vector<char>> grid(m, vector<char>(n));
    for (int i = 0; i < m; i++) {
        for (int j = 0;j  < n; j++) {
            cin >> grid[i][j];
        }
    }
    int ans =0 ;
    for (int markM = 0; markM < (1 << m); markM++) {
        for (int markN = 0; markN < (1 << n); markN++) {
            int cnt = 0;
            for (int i = 0; i < m; i++) {
                for (int j = 0; j < n; j++) {
                    if ((1 & (markM >> i)) == 0 && (1 & (markN >> j)) == 0 && grid[i][j] == '#') {
                        //cout << "here\n";
                        cnt++;
                    }
                }
            }
            if (cnt == k) {
                ans++;
            }
        }
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 3624
#include<bits/stdc++.h>
using namespace std;
int gcd(int a, int b) 
{ 
    if (a == 0) 
        return b; 
    return gcd(b % a, a); 
} 

int main()
{
	ios_base::sync_with_stdio(false); 
    cin.tie(NULL);
    int a,b,c,result;
    long sum=0;
    cin>>a;
    for(int i=1;i<=a;i++)
    {
    	for(int j=1;j<=a;j++)
    	{
    		for(int k=1;k<=a;k++)
    		{
    			sum+=gcd(gcd(i,j),k);

    		}
    	}
    }
    cout<<sum;

}

Measured memory_bytes: 3568
#include<iostream>
using namespace std;
typedef long long ll;
#define fr(i,n) for(int i=0;i++<n;)

int n,m,a[310][310],b[310],c,d[310];
bool f[310]={};

int F(){
  fr(i,m) b[i]=0;
  fr(i,n){
    for(int j=d[i];j<=m;j++){
      if(f[a[i][j]]==0){
        b[a[i][j]]++;
        d[i]=j;
        break;
      }
    }
  }
  int q=0;
  fr(i,m) q=max(q,b[i]);
  fr(i,m){
    if(b[i]==q){
      f[i]=1;
      return(q);
    }
  }
}

int main(){
  cin>>n>>m;
  fr(i,n) d[i]=1;
  fr(i,n) fr(j,m) cin>>a[i][j];
  c=1000;
  fr(k,m){
    c=min(c,F());
  }
  cout<<c<<endl;
}

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

#define rep(i,n) for(int i=0; i<n; i++)
#define rept(i,a,b) for(int i=a; i<b; i++)
#define all(x) (x).begin(),(x).end()

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

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

	ll n, m;
	cin >> n >> m;

	vector< pair<ll,ll> > v(n);
	vi a_sort(n);
	rep(i, n){
		cin >> v[i].first >> v[i].second;
	}

	sort(all(v));

	ll ans = 0;
	rep(j, n){
		if(m > v[j].second){
			ans += v[j].first * v[j].second;
			m = m - v[j].second;
		}else{
			ans += v[j].first * m;
			m = 0;
		}
	}


	cout << ans << endl;


    return 0;
}



Measured memory_bytes: 2176
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int MAXN=1000005;
int main()
{
   int N;cin>>N;
   vector<int> A(N);
   int FAC[MAXN]={0};
   int occ[MAXN]={0};
   unordered_set<int> s;
   for(int i=0;i<N;++i) {
       cin>>A[i];FAC[A[i]]++;
       occ[A[i]]++;
       s.insert(A[i]);
   }
   if(occ[1]){
       if(occ[1]==1){
           cout<<1;
       }
       else cout<<0;
       return 0;
   }
   
   int ans=0;
   for(int j=0;j<N;++j){
       bool ok=false;
       int itr=A[j];
       if(occ[A[j]]>1) continue;
       for(int i=2;i*i<=itr;++i){
           if(itr%i==0){
               if(itr/i==i){
                   if(FAC[i]) ok=true;
               }
               else if(FAC[i]||FAC[itr/i]) ok=true;
           }
        
       }
       if(!ok) ++ans;
   }
   cout<<ans<<"\n";
   
   
}

Measured memory_bytes: 19996
using System;
using System.IO;


public class CodeFile1
{
    public static void Main()
    {
        string a_hand = Console.ReadLine();
        string b_hand = Console.ReadLine();
        string c_hand = Console.ReadLine();
        turn(a_hand, b_hand, c_hand, 0, 0, 0, "a");
    }

    public static void turn(string a_hand, string b_hand, string c_hand, int a, int b, int c,string who)
    {
        if (who == "a")
        {
            if (a == a_hand.Length)
            {
                Console.WriteLine("A");
            }
            else turn(a_hand, b_hand, c_hand, a + 1, b, c, a_hand[a].ToString());
        }
        if (who == "b")
        {
            if (b == b_hand.Length)
                Console.WriteLine("B");
            else turn(a_hand, b_hand, c_hand, a, b + 1, c, b_hand[b].ToString());
        }
        if (who == "c")
        {
            if (c == c_hand.Length)
                Console.WriteLine("C");
            else turn(a_hand, b_hand, c_hand, a, b, c + 1, c_hand[c].ToString());
        }
    }
}
 

Measured memory_bytes: 13140
#include<cstdio>
using namespace std;
int n;
long long a,b,c;
int main()
{
    scanf("%d",&n);
    a=2;
    b=1;
    if(n==1)
    {
    	printf("1\n");
    	return 0;
    }
    if(n==0)
    {
    	printf("2\n");
    	return 0;
    }
    for(int i=2;i<=n;i++)
    {
    	c=a+b;
    	a=b;
    	b=c;
    	
    }
    printf("%lld\n",c);
    return 0;
}

Measured memory_bytes: 128
#include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <set>
#include <algorithm>

using namespace std;

#define mP make_pair
#define pB push_back
#define X first
#define Y second

int Abs(int x){
	if(x < 0) return -x;
	else return x;
}

int main(){
	int n;
	cin >> n;
	
	vector<int> v;
	for(int i = 0 ; i < n ; ++i){
		int x;
		cin >> x;
		v.pB(x);
	}

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

	int cnt = 0;

	int tt = v[n - 1];
	for(int i = n - 1 ; i >= 1 ; --i){
		int ttt = 0;
		while(v[i] == tt) {
			--i;
			++ttt;
		}
		if((i >= 0) && Abs(v[i] - tt) > 1){
			cout << "Impossible" << endl;
			return 0;
		}
		tt = v[i];
		++i;
		++cnt;
	}

	//cout << cnt << endl;

	if(v[0] == cnt){
		int ct = 0;
		for(int i = 0 ; i < n ; ++i){
			if(v[i] == v[0]) ++ct;
			else break;
		}
		if(ct % 2 == 0) cout << "Possible" << endl;
		else if(ct == 1) cout << "Possible" << endl;
		else cout << "Impossible" << endl;
	}
	else cout << "Impossible" << endl;

	return 0;
}

Measured memory_bytes: 384
N,M=map(int,input().split())
s=[list(map(int,input().split()))[1:] for m in range(M)]
p=list(map(int,input().split()))
count=0
for bit in range(1<<N):
    flag=True
    for m in range(M):
        on=0
        for n in range(N):
            if (bit>>n)&1 and n+1 in s[m]:
                on+=1
        if on%2!=p[m]:
            flag=False
    if flag:
        count+=1
print(count)

Measured memory_bytes: 3064
import sys
read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines

def main():
    N,K,*h = map(int, read().split())
    
    h.sort()
    ans = 10**10
    for i in range(N-K+1):
        tmp = h[i+K-1] - h[i]
        ans = min(ans, tmp)
    
    print(ans)


if __name__ == "__main__":
    main()


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

int main() {
  string N;
  cin >> N;
  int count = 0;
  sort(N.begin(),N.end());
  for(int i = 0; i < N.size()-1; i++){
      if(N.at(i) == N.at(i+1)){
          count++;
      }
  } 
   if(count > 0){
       cout << "no" << endl;
   }
   else cout << "yes" << endl;

}

Measured memory_bytes: 256
import std.algorithm;
import std.array;
import std.conv;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

real solve (int n, int m, int d)
{
	if (d == 0)
	{
		return 1.0L / n * (m - 1);
	}
	return 2.0L * (n - d) / n / n * (m - 1);
}

void main ()
{
	int n, m, d;
	while (readf (" %s %s %s", &n, &m, &d) > 0)
	{
		writefln ("%.10f", solve (n, m, d));
	}
}


Measured memory_bytes: 256
#include <algorithm>
#include <vector>
#include <cfloat>
#include <string>
#include <cmath>
#include <set>
#include <cstdlib>
#include <map>
#include <ctime>
#include <iomanip>
#include <functional>
#include <deque>
#include <iostream>
#include <cstring>
#include <queue>
#include <cstdio>
#include <stack>
#include <climits>
#include <sys/time.h>
#include <cctype>

using namespace std;

typedef long long ll;


#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)

#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)

class Point {
 public:
  double x, y;

  Point(double x = 0, double y = 0): x(x), y(y) {}

  Point operator + (Point p) { return Point(x+p.x, y+p.y); }
  Point operator - (Point p) { return Point(x-p.x, y-p.y); }
  Point operator * (double a) { return Point(a*x, a*y); }
  Point operator / (double a) { return Point(x/a, y/a); }

  double norm() { return x*x+y*y; }
  double abs() { return sqrt(norm()); }

  bool operator < (const Point &p) const {
    return x != p.x ? x < p.x : y < p.y;
  }

  bool operator == (const Point &p) const {
    return fabs(x-p.x) < EPS && fabs(y-p.y) < EPS;
  }
};

typedef Point Vector;
typedef vector <Vector> Polygon;

class Segment {
 public:
  Point p1, p2;

  Segment(Point p1 = Point(), Point p2 = Point()): p1(p1), p2(p2) {}
};

double norm(Vector a) {
  return a.x*a.x+a.y*a.y;
}

double abs(Vector a) {
  return sqrt(norm(a));
}

#define BOTTOM 0
#define LEFT 1
#define RIGHT 2
#define TOP 3

class EndPoint {
 public:
  Point p;
  int seg, st;
  EndPoint() {}
  EndPoint(Point p, int seg, int st): p(p), seg(seg), st(st) {}

  bool operator < (const EndPoint &ep) const {
    if (p.y == ep.p.y) {
      return st < ep.st;
    }else return p.y < ep.p.y;
  }
};

// MAX_N:???????????°
#define MAX_N 100000
// MAX_P:??§?¨?????????§???(??¶??????)
#define MAX_P 1000000000
EndPoint EP[2*MAX_N];

// ??????????????????: ????????????????????????
int manhattanIntersection(vector<Segment> s) {
  int n = s.size();

  for (int i = 0, k = 0; i < n; i++) {
    if (s[i].p1.y == s[i].p2.y) {
      if (s[i].p1.x > s[i].p2.x) swap(s[i].p1, s[i].p2);
    }else if (s[i].p1.y > s[i].p2.y) {
      swap(s[i].p1, s[i].p2);
    }
    if (s[i].p1.y == s[i].p2.y) {
      EP[k++] = EndPoint(s[i].p1, i, LEFT);
      EP[k++] = EndPoint(s[i].p2, i, RIGHT);
    }else {
      EP[k++] = EndPoint(s[i].p1, i, BOTTOM);
      EP[k++] = EndPoint(s[i].p2, i, TOP);
    }
  }

  sort(EP, EP+(2*n));

  set<int> BT;
  BT.insert(MAX_P+1);
  int cnt = 0;

  for (int i = 0; i < 2*n; i++) {
    if (EP[i].st == TOP) {
      BT.erase(EP[i].p.x);
    }else if (EP[i].st == BOTTOM) {
      BT.insert(EP[i].p.x);
    }else if (EP[i].st == LEFT) {
      set<int>::iterator b = lower_bound(BT.begin(), BT.end(), s[EP[i].seg].p1.x);
      set<int>::iterator e = upper_bound(BT.begin(), BT.end(), s[EP[i].seg].p2.x);
      cnt += distance(b, e);
    }
  }

  return cnt;
}

int main() {
  int n;
  cin >> n;
  vector<Segment> p;
  for (int i = 0; i < n; i++) {
    Segment l;
    cin >> l.p1.x >> l.p1.y >> l.p2.x >> l.p2.y;
    p.push_back(l);
  }
  cout << manhattanIntersection(p) << endl;
}

Measured memory_bytes: 14624
import sys

sys.setrecursionlimit(10 ** 6)
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep="\n")
def IS(): return sys.stdin.readline()[:-1]
def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LII(rows_number): return [II() for _ in range(rows_number)]
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]

def main():
	S = IS()
	if(S=='Sunny'):print("Cloudy")
	elif(S=='Cloudy'):print("Rainy")
	else:print("Sunny")

main()

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

using namespace std;
using ll = long long;

int main() {
	int N;
	cin >> N;
	vector<int> v(N);
	for (int i = 0; i < N; ++i) { cin >> v[i]; }
	sort(v.begin(), v.end());

	int res = v[N/2] - v[N/2 - 1];
	cout << res << endl;

	return 0;
}


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

int main() {
  string s, t;
  cin >> s >> t;

  int n = s.size(), m = t.size();
  vector<vector<int> > st(26);
  for (int i = 0; i < n; i++) {
    char c = s[i];
    st[c - 'a'].push_back(i);
  }
  for (int i = 0; i < n; i++) {
    char c = s[i];
    st[c - 'a'].push_back(i + n);
  }

  int p = 0;
  ll ans = 0;
  rep(i, m) {
    int c = t[i] - 'a';
    if (st[c].size() == 0) {
      cout << -1 << endl;
      return 0;
    }
    p = *lower_bound(st[c].begin(), st[c].end(), p) + 1;
    if (p >= n) {
      p -= n;
      ans += n;
    }
  }
  ans += p;
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 1724
"use strict";

const main = arg => {
    const input = arg.trim().split("\n");

    const N = Number(input[0].split(" ")[0]);
    const M = Number(input[0].split(" ")[1]);
    const A = input[1].split(" ").map(n => Number(n));
    const total = A.reduce((acc, curr) => acc+curr)
    const thresh = 1*total / (4*M)
    A.sort((a,b) => b-a)
    if(A[M-1] >= thresh) console.log("Yes")
    else console.log("No")
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));  


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

int main(){
  long n;
  cin >> n;
  vector<long> a(n);
  for(int i=0;i<n;++i){
    cin >> a[i];
  }
  sort(a.begin(), a.end());
  for(int i=0;i<n-1;++i){
    if(a[i] == a[i+1]){
      cout << "NO" << endl;
      return 0;
    }
  }
  cout << "YES" << endl;
  return 0;
}

Measured memory_bytes: 1792
N = int(input())
A_List =[]
for i in range(N):
    A = int(input())
    A_List.append(A)
A_List2 = A_List.copy()
A_List2 = sorted(A_List2)

A_max = A_List2[-1]
A_max2 = A_List2[-2]

for a in A_List:
    if a ==A_max:
        print(A_max2)
    else:
        print(A_max)


Measured memory_bytes: 14940
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int H=sc.nextInt();
		int W =sc.nextInt();
		int h= sc.nextInt();
		int w = sc.nextInt();
		System.out.println((H-h)*(W-w));
	}
}

Measured memory_bytes: 23764
#include <algorithm>
#include <bitset>
#include <cassert>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<pii, int> ppiii;
typedef vector<vector<ll>> matrix;

void solve() {
  int n;
  cin >> n;
  cout << (n-2) * 180 << endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  /*
  int t;
  cin >> t;
  for(int i = 1; i <= t; i++) {
    cout << "Case #" << i << ": ";
    solve();
  }
  */
  solve();
}


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

int main() {
  int a;
  std::string s;
  scanf("%d", &a);
  std::cin >> s;
  if (a >= 3200)
    std::cout << s << std::endl;
  else
    std::cout << "red" << std::endl;
}


Measured memory_bytes: 256
//int a = stoi(c); 文字列をintへ
//小文字から大文字
//transform(a.begin(), a.end(), a.begin(), ::toupper);
//途中の出力をそのまま残さない
//数値計算 個数以外はdouble
//map<キー,値> p は辞書。p[キー] = 値
//map 全探索
//auto begin = p.begin(), end = p.end();
//for (auto it = begin; it != end; it++) {}
//mapのキー：it->first mapのバリュー：it->second
//絶対値 abs()
//入力は空白で切れる
//大文字判定 isupper(文字) 小文字判定 islower(文字)
//do{}while(next_permutation(ALL(配列)))
//while(N)で回すとき、Nはコピーを作っておく
//小文字に対応する文字コード：S[i] - 'a'
//文字コード→小文字：(char)(数字+'a')
//グラフの距離:隣接行列で扱う
//等価なものに変換する思考
//bool型　初期値はTrue
//島渡りの問題：中間ノードに着目
//配列はvector<>を使う：意味わからないエラーがなくなる。
//背反な事象にちゃんとわける
//チェックリストはマップを使う
//数が大きい時の比較はstring型で行う
//全て0になったか調べたい->0になるたびにcntする
//またはかかつか
//例外処理は最初にする
//x = p^m + q^n...の約数の個数:(n+1)*(m+1)....
//N!のどの素因数で何回割れるか
//⇔1~Nまでの数がそれぞれどの素因数で何回割り切れるかの和
//パズルの問題->一般化して全探索
//数が大きい時のせぐふぉはコードテストで試してみる
//スペルミスに注意
//stack<ll> s;
//s.push(要素);s.top();s.pop();
//queue<ll> q;
//q.push(要素);q.front();q.pop();
#include <bits/stdc++.h>
#define rep(i,N) for(int i = 0; i < N;i++)
#define ALL(a) (a).begin(),(a).end()
#define ll long long int
using namespace std;

//円周率
const double PI = 3.14159265358979323846;
//割るやつ
const ll M = (pow(10, 9) + 7);

// K進数でのNの桁数
ll dig(ll N, ll K) {
	ll dig = 0;
	while (N) {
		dig++;
		N /= K;
	}
	return dig;
}
// a,bの最大公約数
ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a%b);
}

ll lcm(ll a, ll b) {
	ll g = gcd(a, b);
	return a / g * b;
}

//nC2の計算
ll C(ll N) {
	return N * (N - 1) / 2;
}

//階乗計算
ll f(ll n) {
	if (n == 0 || n == 1) return 1;
	else return (n * f(n - 1)) % M;
}

//Nをdで何回割れるか
ll divcnt(ll N, ll d) {
	ll ans = 0;
	while (1) {
		if (N%d == 0) {
			ans++;
			N /= d;
		}
		else break;
	}

	return ans;
}

//素数判定
bool prime(ll num) {
	if (num < 2) return false;
	else if (num == 2) return true;
	else if (num % 2 == 0) return false;
	double sqrtNum = sqrt(num);
	for (int i = 3; i <= sqrtNum; i += 2) {
		if (num % i == 0) return false;
	}
	return true;
}

//フィボナッチ数列
vector<ll> memo(pow(10, 6) + 1);
ll fibo(ll n) {
	if (n == 1) return 1;
	else if (n == 2) return 1;
	else if (memo[n] != 0) return memo[n];
	else return memo[n] = fibo(n - 1) + f(n - 2);
}

int main() {
	ll A, B, C; cin >> A >> B >> C;

	if (A == B && B == C) {
		if(A%2 == 0 && B%2 == 0 && C%2 == 0) cout << -1 << endl;
		else cout << 0 << endl;
		return 0;
	}

	ll a, b, c;
	ll cnt = 0;
	while (1) {
		if (A % 2 != 0 || B % 2 != 0 || C % 2 != 0) {
			cout << cnt << endl;
			return 0;
		}
		
		a = (B + C) / 2;
		b = (A + C) / 2;
		c = (A + B) / 2;
		A = a;
		B = b;
		C = c;
		cnt++;
	}
}

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

int n,a[100100];
bool chk(){
	int cnt=0;
	for(int i=1;i<=n;++i)cnt+=a[i]&1;
	if((n-cnt)&1)return 1;
	if(cnt>=2||a[1]==1)return 0;
	int g=0;
	for(int i=1;i<=n;++i)g=__gcd(g,a[i]/2);
	for(int i=1;i<=n;++i)a[i]/=g*2;
	return !chk();
}

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;
	for(int i=1;i<=n;++i)cin>>a[i];
	sort(a+1,a+n+1);
	cout<<(chk()?"First\n":"Second\n");
	return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SORT(x) sort(ALL(x))
#define RSORT(x) sort(RALL(x))
#define SUM(x) accumulate(ALL(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const ll mod = 1e9+7;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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

ll gcd(ll a, ll b) { return b ? gcd(b,a%b) : a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main () {
  int n, k;
  cin >> n >> k;
  vi h(n);
  rep(i,n) cin >> h[i];

  int ans = 0;
  rep(i,n) {
    if (h[i] >= k) ans++;
  }

  cout << ans << endl;
}

Measured memory_bytes: 640