akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>

using namespace std;

int h[111111];
int n, a, b;

bool ok(int t){
	long long q = 0;
	for(int i = 1; i <= n; ++i){
		if (1ll * a * t < h[i]) return false;
		long long x = h[i] - 1ll * b * t;
		if (x > 0) q += (x - 1) / (a - b) + 1;
		if (q > t) return false; 
	}
	return true;
}

int main(){
//	freopen("input.inp", "r", stdin);
	scanf("%d%d%d",&n,&a,&b);
	for(int i = 1; i <= n; ++i) scanf("%d",&h[i]);
	int l = 1, r = 1e9;
	while (l <= r){
		int md = (l + r) >> 1;
		if (ok(md)) r = md - 1;
		else l = md + 1;
	}
	printf("%d",l);
	return 0;
}

Measured memory_bytes: 640
s=list(input())

ans=0
ans1=[]
for x in range(len(s)):
  if s[x]=='A' or s[x]=='T' or s[x]=='G' or s[x]=='C':
    ans+=1
  else:
    ans1.append(ans)
    ans=0
  if x==len(s)-1:
    ans1.append(ans)
    
print(max(ans1))

Measured memory_bytes: 8992
#include <stdio.h>

int main()
{
	int a,b,c,t = 0;
	scanf("%d%d%d",&a,&b,&c);
	
	if(a>b) // bの値をaに
	{
		t = b;
		
		b = a;
		a = t;
		
	}

	if(b>c)
	{
		t =c;
		c = b;
		b = t;



	}

	if(a>b) // bの値をaに
	{
		t = b;
		
		b = a;
		a = t;
		
	}




	 
printf("%d %d %d\n",a,b,c);

	return 0;
}



Measured memory_bytes: 2032
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    char c;
    cin>>c;
    if(c=='a'||c=='e'||c=='i'||c=='o'||c=='u')
        cout<<"vowel\n";
    else
        cout<<"consonant\n";
    
    return 0;   
}




 
 


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

// Begin {{{
using namespace std;
#define all(x) x.begin(), x.end()
#define rep(i, n) for (i64 i = 0, i##_limit = (n); i < i##_limit; ++i)
#define reps(i, b, e) for (i64 i = (b), i##_limit = (e); i <= i##_limit; ++i)
#define repr(i, b, e) for (i64 i = (b), i##_limit = (e); i >= i##_limit; --i)
#define var(Type, ...) Type __VA_ARGS__; input(__VA_ARGS__)
using i64 = int_fast64_t;
using pii = pair<i64, i64>;
template <class T> using MaxHeap = priority_queue<T>;
template <class T> using MinHeap = priority_queue<T, vector<T>, greater<>>;
template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }
inline i64 sigma(i64 n) { return n * (1 + n) >> 1; }
inline i64 updiv(i64 n, i64 d) { return (n + d - 1) / d; }
constexpr int INF = 0x3f3f3f3f;
constexpr i64 LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int MOD = int(1e9) + 7;
#ifndef DEBUG
#define dump(...)
#endif

inline void input() {}
template <class Head, class... Tail>
inline void input(Head&& head, Tail&&... tail) {
    cin >> head;
    input(forward<Tail>(tail)...);
}

inline void outs() { cout << "\n"; }
template <class Head, class... Tail>
inline void outs(Head&& head, Tail&&... tail) {
    cout << head << (sizeof...(tail) ? " " : "");
    outs(forward<Tail>(tail)...);
}

template <class T>
inline void outs(vector<T> &vec) { for (auto &e : vec) cout << e << " \n"[&e == &vec.back()]; }

template <class T>
inline void outs(vector<vector<T>> &df) { for (auto &vec : df) outs(vec); }

inline void outl() { cout << "\n"; }
template <class Head, class... Tail>
inline void outl(Head&& head, Tail&&... tail) {
    cout << head << (sizeof...(tail) ? "\n" : "");
    outl(forward<Tail>(tail)...);
}

template <class T>
inline void outl(vector<T> &vec) { for (auto &e : vec) cout << e << "\n"; }

inline void outn() {}
template <class Head, class... Tail>
inline void outn(Head&& head, Tail&&... tail) {
    cout << head;
    outn(forward<Tail>(tail)...);
}

template <class T>
inline void outn(vector<T> &vec) { for (auto &e : vec) cout << e; }

template <class T>
inline vector<T> make_v(const T &initvalue, size_t sz) {
    return vector<T>(sz, initvalue);
}

template <class T, class... Args>
inline auto make_v(const T &initvalue, size_t sz, Args... args) {
    return vector<decltype(make_v<T>(initvalue, args...))>(sz, make_v<T>(initvalue, args...));
}
// }}} End

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    var(int, H, W);
    auto mat = make_v('.', H + 2, W + 2);
    reps(i, 1, H) reps(j, 1, W) {
        input(mat[i][j]);
    }
    reps(i, 1, H) reps(j, 1, W) {
        if (mat[i][j] == '#') {
            if (mat[i - 1][j] == '.' && mat[i][j + 1] == '.' && mat[i + 1][j] == '.' && mat[i][j - 1] == '.') {
                outl("No");
                return 0;
            }
        }
    }
    outl("Yes");
    return 0;
}


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

int main() {
  long N, K;
  cin >> N >> K;
  vector<long> A(N);
  for (int i = 0; i < N; i++) cin >> A.at(i);
  sort(A.begin(), A.end());
  long L = -2e18, R = 2e18;
  while (R - L > 1) {
    long M = (L + R) / 2, sum = 0;
    for (int i = 0; i < N; i++) {
      if (A.at(i) < 0) sum += N - (upper_bound(A.begin(), A.end(), (long double)M / A.at(i)) - A.begin());
      if (A.at(i) > 0) sum += lower_bound(A.begin(), A.end(), (long double)M / A.at(i)) - A.begin();
      if (A.at(i) == 0) sum += (M > 0) ? N : 0;
      if (A.at(i) * A.at(i) < M) sum--;
    }
    (sum / 2 < K) ? L = M : R = M;
  }
  cout << L << "\n";
}


Measured memory_bytes: 4772
#include<bits/stdc++.h>
using namespace std;
#define pi acos(-1)
#define ll long long
int main()
{
    ll n,i,j,k,l,m;
    string s1,s2;
    cin>>s1;
    cin.ignore();
    cin>>s2;
    k=0;
    for(i=0;i<3;i++)
    {
        if(s1[i]==s2[i]){k++;}
    }
    cout<<k<<endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>  // include all standard C++ libraries

using namespace std;

// Loops
#define _overload3(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=int(a);i<int(b);++i)
#define _rrep(i,n) rrepi(i,n,0)
#define rrepi(i,a,b) for(int i=int(a)-1;i>=int(b);--i)

#define rep(...) _overload3(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define rrep(...) _overload3(__VA_ARGS__,rrepi,_rrep,)(__VA_ARGS__)
#define each(xi, x) for (auto&& xi : x)
// Note: we can use rep(i,N) or rep(i,from,to)


// typedef
using ll = long long;
template <class T> using vec = vector<T>;
using vi   = vector<int>;
using vvi  = vector<vi>;
using vvvi = vector<vvi>;
using pii  = pair<int, int>;


// Constants

// Shorter repr for frequently used terms
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define Fi first
#define Se second


// Algorithms
#define all(x) (x).begin(), (x).end()
#define uniq(v) v.erase( unique(all(v)), v.end() )
#define perm(c) sort(all(c));for(bool c##p=1;c##p;c##p=next_permutation(all(c)))

template<class T> pair<T, size_t> max(vector<T> &x){ auto it = max_element(all(x)); return mp(*it, it-x.begin()); }
template<class T> pair<T, size_t> min(vector<T> &x){ auto it = min_element(all(x)); return mp(*it, it-x.begin()); }

template<class T> inline bool chmax(T &maxval, const T &newval) { if (maxval<newval) { maxval=newval; return 1; } return 0; }
template<class T> inline bool chmin(T &minval, const T &newval) { if (minval<newval) { minval=newval; return 1; } return 0; }

// Utilities
// Grid world utilities
int dx[4]={0,1,0,-1};
int dy[4]={1,0,-1,0};
#define inside(H,W,y,x) 0<=(x) && (x)<(W) && 0<=(y) && (y)<(H)

inline int in() {int x; cin >> x; return x;} // read int from cin
inline  ll IN() {ll x; cin >> x; return x;}  // read ll from cin



// Debug
#ifdef LOCAL
  #include "dump.hpp"
  #define debug(x) cerr << #x << ": " << x << '\n'
#else
  #define dump(...)
  #define debug(x)
#endif

// Paste snippets here!!
// 最大公約数
template <class INT_T>
INT_T gcd(INT_T a, INT_T b) {
  if(a < b) return gcd(b, a);
  INT_T r;
  while ((r=a%b)) { a = b; b = r; }
  return b;
}

// 

int main(){
  cin.tie(0); ios::sync_with_stdio(false);    // Magic for faster cin
  int n = in();
  vi a(n);
  rep(i,n) cin >> a[i];
  int g = gcd(a[0],a[1]);
  rep(i,1,n){
    g = gcd(g,a[i]);
  }
  cout << g << endl;
  return 0;
}


Measured memory_bytes: 640
#include <iostream>
#include <iomanip>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <utility>
#include <string>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <numeric>

using namespace std;

typedef uint64_t u64;
typedef int64_t s64;
typedef uint32_t u32;
typedef int32_t s32;
typedef vector<s32> vs32;
typedef vector<u32> vu32;
typedef vector<s64> vs64;
typedef vector<u64> vu64;

const double PI=3.14159265358979323846;

#define MAX(x, y) ((x) < (y) ? (y) : (x))
#define MIN(x, y) ((x) > (y) ? (y) : (x))

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

#define CEIL(x, y) (((x) + (y) - 1) / (y))
#define MOD 1000000007ULL

#define IN(l, r, x) ((l) <= (x) && (x) < (r))


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

    int n;
    cin >> n;

    vs64 a(n), b(n);
    rep (i, n) cin >> a[i] >> b[i];

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

    s64 ma, mb;
    if (n & 1)
    {
        ma = a[n / 2];
        mb = b[n / 2];
        cout << mb - ma + 1 << "\n";
    }
    else
    {
        ma = a[(n - 1) / 2] + a[(n - 1) / 2 + 1];
        mb = b[(n - 1) / 2] + b[(n - 1) / 2 + 1];
        cout << mb - ma + 1 << "\n";
    }

    return 0;
}



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

#define fast_io ios_base::sync_with_stdio(false); cin.tie(nullptr)
#define rep(i, x, y) for(decltype(y) i = (x) - ((x) > (y)); i != (y) - ((x) > (y)); i += 1 - 2 * ((x) > (y)))
#define trav(i,a) for(auto& (i) : (a))
#define all(a) (a).begin(),(a).end()
#define sz(a) int((a).size())
#define clr(a,x) memset((a),(x),sizeof(a)) // array (0,-1)
#define dbg(x) cerr << "STDERR => " << __LINE__ << ": " << #x << " = " << (x) << "  :(\n";
#define pb push_back
#define mp make_pair
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
inline void cpuTime() { cerr << "cpu time : " << double(clock())/CLOCKS_PER_SEC << "\n"; return; }
using ll = long long;
using ull = unsigned long long;
using F = float;
using D = double;
using vi = vector<int>;
using pii = pair<int,int>;



void solve(){

    string s;
    cin >> s;
    int q;
    cin >> q;

    bool reverse = 0;
    int t, p;
    char c;
    while(q--){
        cin >> t;
        if(t == 1){
            reverse ^= 1;
        }else{
            cin >> p >> c;
            --p;
            if(reverse^bool(p)) s.push_back(c);
            else s.insert(0, 1, c);
        }
    }

    if(reverse){
        rep(i,sz(s),0) cout << s[i];
    }else{
        rep(i,0,sz(s)) cout << s[i];
    }

    cout << "\n";
    return;
}

/*
 read the question carefully ( what're the exact constraints? )
 look out for SPECIAL CASES (n=1?) and OVERFLOW (ll vs int?) ARRAY OUT OF BOUNDS
 Check datatypes
*/
int main(){

    fast_io;
    int t=1;
    // cin >> t;

    while(t--){
        solve();
    }

    cpuTime();
return 0;
}


Measured memory_bytes: 1040
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val n = sc.nextInt()
    var now = 1
    var ans = 0
    for (i in 0 until n) {
        val x = sc.nextInt()
        if (x != now) {
            ans++
        } else {
            now++
        }
    }
    if (ans == n) {
        println(-1)
    } else {
        println(ans)
    }
}


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


int get(string str)
{
	int value = 0;
	int pow = 1;
	for (int i = 0; i < str.size(); i++)
	{
		if (str[i] == ',') str = str.substr(0, i);
	}
	for(int i = str.size() - 1; i >= 0; i--)
	{
		value += pow * (str[i] - '0');
		pow *= 10;
	}
	return value;
}


int main()
{	
	int data[1001] = {};
	bool flag[1001] = {};
	string str;
	
	while (getline(cin, str), !str.empty())
	{
		data[get(str)]++;
	}
	while (getline(cin, str))
	{
		if(data[get(str)])
		{
			data[get(str)]++;
			flag[get(str)] = true;
		}
	}
	for (int i = 1; i <= 1000; i++)
	{
		if (flag[i]) cout << i << ' ' << data[i] << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1184
import qualified Data.Text as T
import qualified Data.Text.IO as T
import qualified Data.Text.Read as T

main :: IO ()
main = do
  let
    f :: [Int] -> (Int, Maybe (Int, Int))
    f = foldl step (0, Nothing)
      where
        step :: (Int, Maybe (Int, Int)) -> Int -> (Int, Maybe (Int, Int))
        step (m, Nothing) h = (m, Just (0, h))
        step (m, Just (l, h')) h | h <= h'   = (m, Just (l + 1, h))
                                 | otherwise = (m `max` l, Just (0, h))
  n <- unsafeTextToInt <$> T.getLine :: IO Int
  hs <- map unsafeTextToInt . T.words <$> T.getLine :: IO [Int]
  print . uncurry max . fmap (maybe 0 fst) . f $ hs

unsafeTextToInt :: T.Text -> Int
unsafeTextToInt s = case T.signed T.decimal s of
  Right (n, _) -> n
{-# INLINE unsafeTextToInt #-}


Measured memory_bytes: 11152
/// referenced: https://beta.atcoder.jp/contests/abc066/submissions/2252964
#include <bits/stdc++.h>
using namespace std;

#define MOD 1000000007

int64_t Power(int64_t x,int64_t e){
  if(e==1) return x%MOD;
  if(e==0) return 1;
  return Power(x*x%MOD,e/2)*(e%2==0?1:x)%MOD;
}
int64_t inv(int64_t i){
  return Power(i,MOD-2);
}
int64_t fact[100002],factinv[100002];
int64_t C(int64_t n,int64_t r){
  return fact[n]*factinv[r]%MOD*factinv[n-r]%MOD;
}

int main(){
  int64_t n,a;
  bool c[100002];
  cin >> n;
  for(int64_t i=1;i<=n;i++) c[i]=false;
  int64_t p[100002];
  int64_t x,y;

  for(int64_t i=0;i<=n;i++){
    cin >> a;
    if(c[a]){
      x=p[a];
      y=i;
    }
    c[a]=true;
    p[a]=i;
  }


  fact[0]=1;
  for(int64_t i=1;i<=n+1;i++) fact[i]=i*fact[i-1]%MOD;
  for(int64_t i=0;i<=n+1;i++) factinv[i]=inv(fact[i]);

  for(int64_t i=1;i<=n+1;i++){
    int64_t ans;
    ans=C(n+1,i);
    if(i-1<=n-(y-x)) ans+=MOD-C(n-(y-x),i-1);
    cout << (ans%MOD) << endl;
  }

  return 0;
}


Measured memory_bytes: 3584
Imports System.Collections.Generic
Public Class Program
  Shared Sub Main()
    Dim nk As Long() = Array.ConvertAll(Of String, Long)(Console.ReadLine().Split(" "), AddressOf Long.Parse)
    Dim n As Long = nk(0)  
    Dim k As Long = nk(1)
    Dim arrayA As Long() = Array.ConvertAll(Of String, Long)(Console.ReadLine().Split(" "), AddressOf Long.Parse)
    Dim sumA As Long = 0
    For i As Long = 0 To n - 1
      sumA += arrayA(i)
    Next
    Dim cds As List(Of Long) = GetCdList(sumA)
    cds.Sort()
    cds.Reverse()
    Dim output As Long = 1
    For Each cd As Long In cds
      Dim arrayAModCd(0 To n - 1) As Long
      Dim sumAMod As Long = 0
      For i As Long = 0 To n - 1
        arrayAModCd(i) = arrayA(i) Mod cd
        sumAMod += arrayAModCd(i)
      Next
      Dim operationCount As Long = 0
      Array.Sort(arrayAModCd)
      Array.Reverse(arrayAModCd)
      For i As Long = 0 To sumAMod \ cd - 1
        operationCount += cd - arrayAModCd(i)
      Next
      If operationCount <= k Then
        output = cd
        Exit For
      End If
    Next
    Console.WriteLine(output.ToString())
  End Sub
  
  Shared Function GetCdList(value As Long) As List(Of Long)
    Dim result As List(Of Long) = New List(Of Long)
    For i As Long = 2 To value
      If i * i > value Then Exit For
      If value Mod i = 0 Then
        result.Add(i)
        result.Add(value \ i)
      End If
    Next
    result.Add(value)
    Return result
  End Function
End Class

Measured memory_bytes: 17464
#include<stdio.h>
using namespace std;
int main() {
int a, b, c, e=0;
scanf("%d %d %d", &a,&b,&c);
if (a > b) {
e = a;
a = b;
b = e;
}
if (b > c) {
e = b;
b = c;
c = e;
}
if (a > b) {
e = a;
a = b;
b = e;
}

printf("%d %d %d\n", a, b, c);
}



Measured memory_bytes: 2700
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <list>
#include <vector>
#include <queue>
#include <algorithm>
#include <climits>
#include <cstring>
#include <cmath>
#include <stack>
#include <iomanip>
#include <tuple>
#include <functional>
#include <cfloat>
#include <map>
#include <set>
#include <array>
#include <stdio.h>
#include <string.h>
using ll = long long;
using ull = unsigned long long;
using namespace std;
#define int long long
#define CONTAINS_VEC(v,n) (find((v).begin(), (v).end(), (n)) != (v).end())
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())
#define ARY_SORT(a, size) sort((a), (a)+(size))
#define REMOVE(v,a) (v.erase(remove((v).begin(), (v).end(), (a)), (v).end()))
#define REVERSE(v) (reverse((v).begin(), (v).end()))
#define ARY_REVERSE(v,a) (reverse((v), (v)+(a)))
#define REP(i, n) for (int (i)=0; (i) < (n); (i)++)
#define CONTAINS_MAP(m, a) (m).find((a)) != m.end()
#define CONTAINS_SET(m, a) (m).find((a)) != m.end()
void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }


//----------BIT 0-index----------
int BIT_N = 1000010;
int bit_tree[1000010];
//[index]にnを追加
void bit_add(int index, int n)
{
	for (int x = index; x < BIT_N; x |= x + 1)
	{
		bit_tree[x] += n;
	}
}
//[0, index)の合計
int bit_sum(int index)
{
	int ret = 0;
	for (int x = index - 1; x >= 0; x = (x & (x + 1)) - 1)
	{
		ret += bit_tree[x];
	}
	return ret;
}



struct St
{
	int index;
	int l;
	int r;
	bool operator < (const St& st) const
	{
		return (r < st.r); //(昇順)
	}
};

St sts[1000000];
int N, Q;
int ary[1000000];
int C[1000000];
int ans[1000000];

int cur_r = 0;
void update_r(int r)
{
	for (int i = cur_r + 1; i <= r; i++)
	{
		if (ary[C[i]] != 0)
		{
			int index = ary[C[i]];
			bit_add(index, -1);
		}
		ary[C[i]] = i;
		bit_add(i, 1);
	}
	cur_r = r;
}

signed main()
{
	cin >> N >> Q;
	REP(i, N) cin >> C[i + 1];
	REP(i, Q)
	{
		cin >> sts[i].l >> sts[i].r;
		sts[i].index = i;
	}

	ARY_SORT(sts, Q);
	for (int i = 0; i < Q; i++)
	{
		update_r(sts[i].r);
		int a = bit_sum(sts[i].r + 1);
		int b = bit_sum(sts[i].l);
		ans[sts[i].index] = a - b;
	}

	for (int i = 0; i < Q; i++)
	{
		cout << ans[i] << endl;
	}
}



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

int main()
{
  int n;
  cin >> n;
  int a = 0, b = 0;
  for (int i = 0; i < n; i++)
  {
    string A, B;
    cin >> A >> B;
    if (A > B)
    {
      a += 3;
    }
    else if (A < B)
    {
      b += 3;
    }
    else
    {
      a++;
      b++;
    }
  }
  cout << a << " " << b << endl;
}


Measured memory_bytes: 3148
d,g = map(int,input().split())
pc = [list(map(int,input().split())) for _ in range(d)]
ans = float("inf")
def bfs(i,solve,sum,n):
  if i == d:
    if sum>=g:
      global ans
      ans = min(ans,solve)
    elif (pc[n][0]-1)*(n+1)*100 >= g-sum:
      if (g-sum) % ((n+1)*100) == 0:
        plus = (g-sum) // ((n+1)*100)
      else:
        plus = (g-sum) // ((n+1)*100) + 1 
      ans = min(ans,solve+plus)
  else:
    bfs(i+1,solve+pc[i][0],sum+pc[i][0]*(i+1)*100+pc[i][1],n)
    bfs(i+1,solve,sum,i)
bfs(0,0,0,0)
print(ans)

Measured memory_bytes: 39664
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <string>
#include <algorithm>
#include <numeric>
#include <queue>
//#include <bits/stdc++.h>

typedef long long ll;
const ll INF = 1e18 + 1;
const ll MOD = 1e9 + 7;

// print(x, y, z);
// print(va.begin(), va.end());
void print(){ std::cout << std::endl; }
template <typename Head> void print(Head&& head) { std::cout << head << std::endl; }
template <typename Head, typename... Tail> void print(Head&& head, Tail&&... tail)
{
  std::cout << head << " ";
  print(std::forward<Tail>(tail)...); // or print(tail...);
}
template<typename Iterator> void printVec(Iterator begin, Iterator end)
{
  for (Iterator it = begin; it != end; it++) {
    std::cout << "[" << std::distance(begin, it) << "] " << *it << " ";
    if (std::distance(begin, it) % 50 == 49) { std::cout << std::endl; }
  }
  std::cout << std::endl;
}

template<typename T> void lsort(std::vector< T >& v) {std::sort(v.begin(), v.end());}

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

  ll N;
  std::cin >> N;
  std::vector< ll > va(2*N, 0LL);
  for (ll i = 0; i < 2*N; i++) {
    std::cin >> va[i];
  }

  lsort(va);

  ll ans = 0;
  for (ll i = 0; i < 2*N; i+=2) {
    ans += va[i];
  }

  print(ans);
  return 0;
}


Measured memory_bytes: 384
import itertools
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())

ans = 10**9
for v in itertools.permutations([a,b,c,d,e],5):
    time = 0
    for i in range(4):
        time += v[i]
        amari = time % 10
        if amari != 0:
            time += 10 - amari
    time += v[4]
    ans = min(ans,time)

print(ans)

Measured memory_bytes: 8836
import java.util.*;
import java.math.*;

public class Main {

    public static void main (String[] args) throws Exception {

        final Scanner in = new Scanner(System.in);
        final BigInteger A = in.nextBigInteger();
        final BigDecimal B = in.nextBigDecimal();

        final BigDecimal AA = new BigDecimal(A);

        final BigDecimal product = AA.multiply(B);

        System.out.println(product.toBigInteger());

    }
}

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

int main(){
  int i,j,k;
  char S[256],T[256];
  
  scanf("%s",S);
  scanf("%s",T);
  char tmp[256];
  if(strcmp(S,T)==0){
    puts("Yes");
    return 0;
  }
  for(i=0;i<strlen(S)-1;i++){
   /* tmp[0] = ((int)S[strlen(S)-1]);
    for(j=1;j<strlen(S);j++){
      tmp[i] = ((int)S[j-1]);
    }*/
    sprintf(tmp,"%c%s",S[strlen(S)-1],S);
    strncpy(S,tmp,strlen(S));
    S[strlen(S)] ='\0';
    
    if(strcmp(S,T)==0){
      puts("Yes");
      return 0;
    }
  }
  puts("No");
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
//#include <boost/multiprecision/cpp_int.hpp>
//typedef boost::multiprecision::cpp_int ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E17;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
void Max(ll &pos,ll val){pos=max(pos,val);}//Max(dp[n],dp[n-1]);
void Min(ll &pos,ll val){pos=min(pos,val);}
void Add(ll &pos,ll val){pos=mod(pos+val);}
dd EPS=1E-9;
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
///////////////////////////////////////

int main(){fastio
    ll h,w;cin>>h>>w;
    string s[h];rep(i,0,h-1)cin>>s[i];
    ll a[5][h+2][w+2];memset(a,0,sizeof(a));
    rep(i,0,h-1){
        rep(j,0,w-1){
            if(s[i][j]=='#')a[0][i+1][j+1]=0;
            else a[0][i+1][j+1]=a[0][i+1][j]+1;
        }
    }
    rep(i,0,h-1){
        for(ll j=w-1;j>=0;j--){
            if(s[i][j]=='#')a[1][i+1][j+1]=0;
            else a[1][i+1][j+1]=a[1][i+1][j+2]+1;
        }
    }
    rep(j,0,w-1){
        rep(i,0,h-1){
            if(s[i][j]=='#')a[2][i+1][j+1]=0;
            else a[2][i+1][j+1]=a[2][i][j+1]+1;
        }
    }
    rep(j,0,w-1){
        for(ll i=h-1;i>=0;i--){
            if(s[i][j]=='#')a[3][i+1][j+1]=0;
            else a[3][i+1][j+1]=a[3][i+2][j+1]+1;
        }
    }
    /*rep(k,0,3){
        rep(i,1,h){
            rep(j,1,w){
                cout<<a[k][i][j]<<" ";
            }cout<<endl;
        }cout<<endl;
    }cout<<endl;*/
    
    rep(i,1,h)rep(j,1,w)rep(k,0,3)a[4][i][j]+=a[k][i][j];
    ll ans=0;
    rep(i,1,h)rep(j,1,w)Max(ans,a[4][i][j]);
    cout<<ans-3<<endl;
    
    return 0;
}



Measured memory_bytes: 161152
#include<stdio.h>
#include<string.h>
#define LEN 100005
typedef struct pp{
	char name[100];
	int t;
}P;
P Q[LEN];
int head,tail,n;
void enqueue(P x)
{
	Q[tail]=x;
	tail=(tail+1)%LEN;
}
P dequeue()
{
	P x=Q[head];
	head=(head+1)%LEN;
	return x;
}
int min(int a,int b){return a<b?a:b;}
int main()
{
	int elaps=0,c;
	int i,q;
	P u;
	scanf("%d%d",&n,&q);
	for(i=1;i<=n;i++)
	{
		scanf("%s",Q[i].name);
		scanf("%d",&Q[i].t);
	}
	head=1;tail=n+1;
	while(head!=tail)
	{
		u=dequeue();
		c=min(q,u.t);
		u.t-=c;
		elaps+=c;
		if(u.t>0) enqueue(u);
		else {
			printf("%s %d\n",u.name,elaps);
		}
	}
	return 0;
}

Measured memory_bytes: 12720
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(){
  string str;
  vector <int> nums;
  vector <int> marks;
  int i,j,k=0,buf;
  long long m=0,n=0,ans;
  vector <int> p;
  int o=0;
  cin >> str >> ans;
  j=0;
  for(i=0;i<str.size();i++){
    if(str[i]=='+') {
      nums.push_back(buf);
      buf=0;
      marks.push_back(1);
    }else if(str[i]=='*'){
      nums.push_back(buf);
      buf=0;
      marks.push_back(2);
      k++;
    }else{
      buf*=10;
      buf+=(str[i]-'0');
    }
  }
  nums.push_back(buf);
  m=nums[0];
  for(i=0;i<marks.size();i++){
    if(marks[i]==1){
      m+=nums[i+1];
    }else{
      m*=nums[i+1];
    }
  }
  i=0;
  while(i<marks.size()){
    if(marks[i]==2){
      nums[i]*=nums[i+1];
      nums.erase(nums.begin()+i+1);
      marks.erase(marks.begin()+i);
    }else{
      i++;
    }
  }
  
  n=nums[0];
  for(i=0;i<marks.size();i++){
    n+=nums[i+1];
    //cout << nums[i+1] << endl;
  }
  

  //cout << n << " " << m << " " << ans << endl;
   
  if(n==ans){
    if(m==ans) cout << "U" <<endl;
    else cout << "M" <<endl;	   
  }else{
    if(m==ans) cout << "L" <<endl;
    else cout << "I" <<endl;	  
  } 
}

Measured memory_bytes: 1224
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> P;
 
const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;
 
#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)
 
ll gcd(ll x, ll y)
{
  if (x % y == 0)
  {
    return y;
  }
  return gcd(y, x % y);
}
 
int main()
{
  ll a;
  cin >> a;
  cout << "ABC" << a << endl;
  return 0;
}


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

using namespace std;

const long long inf = 1e18;

    int a[4];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    int u, v;
    for (int j = 0; j < 3; j++) {
        cin >> u >> v;
        a[--u]++;
        ++a[--v];
    }
    for (int j = 0; j < 4; j++)
        if (a[j] > 2) {
            cout << "NO";
            return 0;
        }
    cout << "YES";
}


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

int main(){ 
    int N; cin >> N;
    vector<int> a(10100, 0);

    int sum = 0;
    int x, y, z;
    x = 1;
    y = 1;
    z = 1;

    bool x_flag, y_flag, z_flag;
    x_flag = true;
    y_flag = true;
    z_flag = true;

    while (x_flag)
    {
        y_flag = true;
        while (y_flag)
        {
            z_flag = true;
            while (z_flag)
            {
                sum = x*x + y*y + z*z + x*y + y*z + z*x;
                if (x == y && y == z)
                {
                    a[sum] += 1;
                }
                else if (x != y && y != z && z != x)
                {
                    a[sum] += 6;
                }
                else
                {
                    a[sum] += 3;
                }
                

                if (sum > N)
                {
                    z_flag = false;
                }
                
                z++;
            }

            y++;
            z = y;
            if (x*x + y*y + z*z + x*y + y*z + z*x > N)
                {
                    y_flag = false;
                }
        }

        x++;
        y = x;
        z = y;
        if (x*x + y*y + z*z + x*y + y*z + z*x > N)
            {
                x_flag = false;
            }
    }
    


    for (int i = 1; i <= N; i++)
    {
        // cout << i << " ";
        cout << a[i] << endl;
    }
    
    
}

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

using namespace std;

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

const int N = 1e5 + 5;

vector <int> v,v2,ans;
int n;

void fail() {
  cout << "-1\n";
  exit(0);
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL); cout.tie(NULL);
  cin >> n;
  for (int i = 1 ; i <= n ; i++) {
    int x;
    cin >> x;
    v.push_back(x);
  }
  while(v.empty() == false) {
    bool flag = false;
    v2.clear();
    for (int i = v.size() - 1 ; i >= 0 ; i--) {
      if (flag == false && i + 1 == v[i]) {
        ans.push_back(v[i]);
        flag = true;
      }
      else {
        v2.push_back(v[i]);
      }
    }
    reverse(v2.begin(),v2.end());
    if (flag == false)
      fail();
    swap(v,v2);
  }
  reverse(ans.begin(),ans.end());
  for (auto i : ans)
    cout << i << "\n";

}

Measured memory_bytes: 256
import java.util.*;

public class Main {

    long INF = Long.MAX_VALUE;

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

    void solve() {
        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        char[] s = S.toCharArray();
        boolean[] c = new boolean[26];
        Arrays.fill(c, false);
        for (int i = 0; i < S.length(); i++) {
            c[s[i] - 'a'] = true;
        }
        if (S.length() < 26) {
            for (int i = 0; i < 26; i++) {
                if (!c[i]) {
                    System.out.print(S);
                    System.out.println((char) ('a' + i));
                    return;
                }
            }
        }
        if("zyxwvutsrqponmlkjihgfedcba".equals(S)){
            System.out.println("-1");
            return;
        }
        char right;
        for (int i = 24; i >= 0; i--) {
            if ((s[i + 1]) > (s[i])) {
                right = s[i + 1];
                for (int j = i + 1; j < 26; j++) {
                    if ((s[i]) < (s[j])) {
                        right = (char) Math.min(right, s[j]);
                    }
                }
                for (int j = 0; j < i; j++) {
                    System.out.print(s[j]);
                }
                System.out.println(right);
                return;
            }
        }
    }
}

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

int main(void)
{
    long long a, b, c, d;
    long long ans;
    cin >> a >> b >> c >> d;

    if (b > 0 && d > 0)
        ans = max(b * d, a * c);
    else if (b <= 0 && d <= 0)
        ans = a * c;
    else if (b > 0 && d <= 0)
        ans = max(a * d, a * c);
    else if (b <= 0 && d > 0)
        ans = max(c * b, c * a);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3636
import sys
sys.setrecursionlimit(200000)
h, w = map(int, input().split())
s = []
for i in range(h):
    s.append(input())

ans = 0

dx = [0, 0, 1, -1]
dy = [1, -1, 0, 0]

was = [[0 for i in range(w)] for j in range(h)]

def dfs(x, y):
    global cc
    global was
    was[x][y] = 1
    if s[x][y] == '#':
        cc[1] += 1
    else:
        cc[0] += 1
    for i in range(4):
        nx = x + dx[i]
        ny = y + dy[i]
        if nx >= 0 and ny >= 0 and nx < h and ny < w and s[nx][ny] != s[x][y] and not was[nx][ny]:
            dfs(nx, ny)

for i in range(h):
    for j in range(w):
        if not was[i][j]:
            cc = [0] * 2
            dfs(i, j)
            ans += cc[1] * cc[0]
print(ans)



Measured memory_bytes: 148212
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for(int i=0;i<c;++i)
int main(){
  vector<int>a(3);
  int i;
  rep(i,3) cin >> a[i];
  sort(a.begin(),a.end());
  cout << abs(a[i]-a[i+1])+abs(a[i+1]-a[i+2]) << endl;
  return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
  long long h;
  cin >> h;

  long long d = 1;
  long long ans = 0;
  while (h) {
    ans += d;
    d *= 2;
    h /= 2;
  }
  cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <ctime>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(ll i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {0,1,0,-1,1,-1,1,-1};
ll dx[8] = {1,0,-1,0,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;


int main(){
	ll n; cin >> n;
	vl a(n+1); rep(i,n+1) cin >> a[i];
	vl num(n+1,1);
	if(n == 0){
		if(a[0] == 1) cout << 1 << endl;
		else cout << -1 << endl;
		return 0;
	}
	if(a[0] != 0) cout << -1 << endl;
	else{
		rep(i,n){
			if(num[i] < a[i]){
				cout << -1 << endl;
				return 0;
			}
			num[i] -= a[i];
			num[i+1] = min(linf, 2 * num[i]);
		}
		if(num[n] < a[n]){
			cout << -1 << endl;
			return 0;
		}
		ll ans = a[n];
		ll now = a[n];
		for(ll i=n-1; i>=0; i--){
			ans += min(num[i], now) + a[i];
			now += a[i];
		}
		cout << ans << "\n";
	}
}

Measured memory_bytes: 4840
#include <bits/stdc++.h>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
#define lol long long
#define SUM(n) ((n)+1)*(n)/2　//1〜nまでの総和を求める式
#define mp make_pair
#define fi first
#define se second
#define pu push_back
#define SYOU(x) fixed<<setprecision(x+1) //小数点桁数を指定する
#define abs(x,y) (max(x,y)-min(x,y))
#define all(v) v.begin(),v.end()
#define UPDight(a,b) (a+b-1)/b //小数点切り上げ 
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
const int MOD=int(1e9)+7; 
using namespace std;
using pii = pair<int,int>;
typedef vector<int> vit;

signed main(void){
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);

  
  int h, w;
  cin >> h >> w;
  string s[h + 5];
  rep(i, h){
    cin >> s[i];
  }

  rep(i, h){
    rep(j, w){
      if(s[i][j] == '#'){
	if(s[i - 1][j] != '#' && s[i][j - 1] != '#' && s[i + 1][j] != '#' && s[i][j + 1] != '#'){
	  cout << "No\n";
	  return 0;
	}
      }
    }
  }
  cout << "Yes\n";
  return 0;
}


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

void solve(long long N, long long A, long long B){
	printf("%lld %lld\n", min(A,B), max(0LL,A+B-N));
}

int main(){
	long long B;
	long long A;
	long long N;
	scanf("%lld",&N);
	scanf("%lld",&A);
	scanf("%lld",&B);
	solve(N, A, B);
	return 0;
}


Measured memory_bytes: 256
a, b, c = sorted(map(int, input().split()))
x = (c-a)//2
a += x*2
y = (c-b)//2
b += y*2
a, b, c = sorted([a, b, c])
r = x + y
if a == b == c:
    print(r)
elif b == a+1 and b == c:
    print(r+2)
else:
    print(r+1)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>

using namespace std;

int main() {
    int A, B, M;
    cin >> A >> B >> M;

    vector<int> a(A), b(B);
    for (int& x : a)
        cin >> x;
    for (int& x : b)
        cin >> x;
    
    int min_a = 1000000;
    for (int x : a) {
        min_a = min(min_a, x);
    }

    int min_b = 1000000;
    for (int x : b) {
        min_b = min(min_b, x);
    }

    int ans1 = min_a + min_b;
    int ans2 = 1000000;
    int x, y, c;
    for (int i = 0; i < M; i++) {
        cin >> x >> y >> c;
        ans2 = min(ans2, a[x-1] + b[y-1] - c);
    }
    if (ans1 <= ans2)
        cout << ans1 << endl;
    else
        cout << ans2 << endl;

}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <cassert>
#include <set>
using namespace std;
using ll = long long;
const int INF = 1<<30;
const int MOD = 1e9 + 7;

using Gragh = vector<vector<int>>;
struct LowLink
{
    int V;
    Gragh G;
    vector<int> used, order, lowlink, articulation;
    vector<pair<int, int>> bridges;
    LowLink(int V) : V(V)
    {
        G.resize(V);
        used.resize(V, 0);
        order.resize(V, 0);
        lowlink.resize(V, 0);
    }
    void add_edge(int s, int t) { G[s].emplace_back(t); }
    void dfs(int v, int p)
    {
        static int k = 0;
        used[v] = 1;
        order[v] = lowlink[v] = k++;
        int cnt = 0;
        bool flag = false;
        for(auto &u : G[v])
        {
            if(not used[u])
            {
                cnt++;
                dfs(u, v);
                lowlink[v] = min(lowlink[v], lowlink[u]);
                if(order[v] <= lowlink[u] and p != -1) flag = true;
                if(order[v] < lowlink[u]) bridges.emplace_back(min(v, u), max(v, u));
            }
            else if(u != p) lowlink[v] = min(lowlink[v], order[u]);
        }
        if(p == -1 and cnt > 1) flag = true;
        if(flag) articulation.push_back(v);
    }
    void build() { dfs(0, -1); }
};

signed main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int V, E; cin >> V >> E;
    LowLink L(V);
    for(int i = 0; i < E; i++)
    {
        int s, t; cin >> s >> t;
        L.add_edge(s, t);
        L.add_edge(t, s);
    }
    L.build();
    sort(L.bridges.begin(), L.bridges.end());
    for(auto ans : L.bridges) cout << ans.first << " " << ans.second << endl;
    return 0;
}


Measured memory_bytes: 4344
while True:
    x = raw_input().split()

    a = int(x[0])
    b = int(x[2])
    op = x[1]

    if op == '?':
        break
    if op == '+':
        print(a+b)
    if op == '-':
        print(a-b)
    if op == '*':
        print(a*b)
    if op == '/':
        print(a/b)

Measured memory_bytes: 6284
#include <algorithm>
#include <cmath>
#include <complex>
#include <cstdio>
#include <deque>
#include <iomanip>
#include <ios>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <unordered_map>
#include <utility>
#include <vector>
#define itn int
#define retrun return
#define rep(i, n) for (int i = 0, i##_len = (n); i < i##_len; ++i)
using namespace std;
typedef long long llong;
typedef pair<int, int> pii;
llong gcd(llong a, llong b) {
	if (a < b) std::swap(a, b);
	if (a % b == 0)
		return b;
	else
		return gcd(b, a % b);
}
llong lcm(llong a, llong b) {
	llong g = gcd(a, b);
	return a * b / g;
}
//ここまで共通
llong X, H = 0;
int main() {
	cin >> X;
	H += (X / 500) * 1000;
	X %= 500;
	H += (X / 5) * 5;
	cout << H << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;

public class Program
{
    public static void Main()
    {
        var n = int.Parse(Console.ReadLine());
        var xs = Console.ReadLine().Split()
            .Select(x => int.Parse(x))
            .ToArray();

        int count = 1;
        int sign = 0;
        for (int i = 1; i < n; ++i)
        {
            if (sign == 0 && i + 1 < n)
            {
                sign = Math.Sign(xs[i] - xs[i - 1]);
            }
            else if (sign > 0 && xs[i] - xs[i - 1] < 0 
            ||       sign < 0 && xs[i] - xs[i - 1] > 0)
            {
                ++count;
                sign = 0;
            }
        }

        Console.WriteLine(count);
    }
}


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

int main() {
    string S;
    cin >> S;
    
    int a = 0;
    for (int i = 0; i < S.size(); ++i) {
        int x = S[i] - '0';
        if (x != i % 2) ++a;
    }
    int b = 0;
    for (int i = 0; i < S.size(); ++i) {
        int x = S[i] - '0';
        if (x != (i + 1) % 2) ++b;
    }
    if (a < b) cout << a << endl;
    else cout << b << endl;
    return 0;
}


Measured memory_bytes: 512
#include<stdio.h>
int main(void)
{
	int a,b,x,y,z;
	while(scanf("%d %d",&a,&b)!=EOF) {
		if(a>=b) {
			x=a;
			y=b;
		}
		else {
			x=b;
			y=a;
		}
		while(y!=0) {
			z=x%y;
			x=y;
			y=z;
		}
		printf("%d\n",x);
	}
	return 0;
}

Measured memory_bytes: 596
#include<bits/stdc++.h>
#define taskname "test1"
#define int long long
using namespace std;

main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);   cout.tie(nullptr);
    if (ifstream("test.inp"))
    {
        freopen("test.inp", "r", stdin);
        #ifdef CHECKING
            freopen(taskname".out", "w", stdout);
        #else
            freopen("test.out", "w", stdout);
        #endif //CHECKING
    }
    else if (ifstream(taskname".inp"))
    {
        freopen(taskname".inp", "r", stdin);
        freopen(taskname".out", "w", stdout);
    }

    int n, k;   cin >> n >> k;
    vector<int> a(n);
    for (int &i : a) cin >> i;
    int ans = LLONG_MAX;
    for (int i = 0; i <= n - k; ++i)
    {
        int j = i + k - 1;
        ans = min(ans, min(abs(a[j]), abs(a[i])) + a[j] - a[i]);
    }
    cout << ans;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <math.h>
#include <algorithm>
#include <deque>
#include <climits>

using namespace std;
#define ll long long
#define ve vector
#define umap unordered_map
#define iter iterator

// const int MxN=1e5+1;
const ll MOD=1e9+7;
umap<int,int> mp;

int solve(int n) {
	ll ans = 1;
    int i=1;
	if(n%2) {
        i=2;
        if(mp[0] != 1) return 0;
    }
    for (i; i<n; i+=2) {
        if(mp[i] != 2) return 0;
        ans = ans*2 % MOD;
    }
    return ans;
}

int main() {
    int n; cin>>n;
    for(int i=0;i<n;i++) {
        int x; cin>>x;
        mp[x]++;
    }
    cout<<solve(n)<<endl;
    
    return 0;
}

Measured memory_bytes: 3596
#include <cstdio>
#include <iostream>
#include <cmath>
#include <string>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
#define dbg(x...) do { cout << "\033[32;1m" << #x <<" -> "; err(x); } while (0)
void err() { cout << "\033[39;0m" << endl; }
template<class T, class... Ts> void err(const T& arg,const Ts&... args) { cout << arg << " "; err(args...); }
const int N = 100 + 5;
typedef double db;
const db eps = 1e-8;
int sgn(db x){
    if(fabs(x) < eps) return 0;
    if(x < 0) return -1;
    return 1;
}
struct Point{
    db x, y;
    Point(){}
    Point(db x, db y):x(x), y(y){}
    void input(){
        //如果为longdouble则需要改为Lf
        scanf("%lf%lf",&x, &y);
    }
    db distance(Point p){
        return hypot(x - p.x, y - p.y);
    }
};
struct circle{
    Point p;
    db r;
    circle(){}
    circle(Point p, db r):p(p), r(r){}
    void input(){
        p.input();
        // 注意类型
        scanf("%lf", &r);
    }
    /*
        两圆的关系
        5 相离
        4 外切
        3 相交
        2 内切
        1 内含
    */
    int relationcircle(circle v){
        db d = p.distance(v.p);
        if(sgn(d - r - v.r) > 0) return 5;
        if(sgn(d - r - v.r) == 0) return 4;
        db l = fabs(r - v.r);
        if(sgn(d - r - v.r) < 0 && sgn(d - l) > 0) return 3;
        if(sgn(d - l) == 0) return 2;
        if(sgn(d - l) < 0) return 1;
    }
} c1, c2;

int main(){
    c1.input();
    c2.input();
    int res = c1.relationcircle(c2);
    printf("%d\n", res-1);

    return 0;
}


Measured memory_bytes: 3268
#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops") 
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define fr(i,a,b) for(int i = a ; i <= b ; ++i)
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define trav(a, x) for(auto& a : x)
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define sz(x) (int)(x).size()
#define pb push_back
#define fst first
#define snd second
using namespace __gnu_pbds;
using ordered_set =
 tree<int, null_type,less<int>,
 rb_tree_tag,tree_order_statistics_node_update>;
//find_by_order(k):returns iterator to kth element starting from 0
//order_of_key(k):returns count of elements strictly smaller than k
typedef long long ll;typedef pair<int, int> pii;
typedef vector<int> vi;typedef long double ld;
template<class T>
using min_heap = priority_queue<T,vector<T>,greater<T>>; 
template<typename T> T gcd(T a, T b){return(b?__gcd(a,b):a);}
template<typename T> T lcm(T a, T b){return(a*(b/gcd(a,b)));}
template<typename T> 
void remdup(vector<T>& v) {
	sort(all(v)); v.erase(unique(all(v)), v.end());
}
template<typename T> void re(vector<T> &v) {trav(i,v) cin >> i;}
void unsyncIO() { ios_base::sync_with_stdio(0); cin.tie(0); }
#ifdef np
#include "C:\Users\navodit\Desktop\mycodes\pr.h"
#else
#define trace(...)
#endif

#define MOD 1000000007  



void solve(){
	int k ; cin >> k ;
	int o = 0 , e = 0 ;
	rep(u,1,1+k){ if(u&1) o++; else e++;}
	cout << o * e << endl; 
}

signed main() {
	unsyncIO();
	int tt =1 ;
	// cin >> tt;
	rep(i,0,tt) solve();













#ifdef np
	cout <<endl<<endl<< "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
	return 0;
}


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

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

    }

    int ans = 0;

    for(int i=1; i<n-1; i++){
        if(p[i-1] < p[i] && p[i] < p[i+1]) ans++;
        if(p[i-1] > p[i] && p[i] > p[i+1]) ans++;

    }

    cout << ans << endl;
 
}


Measured memory_bytes: 256