akhauriyash/Code-Regression huggingface dataset:
//C
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

//C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//Others
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
const int dx[8] = { -1, 0, 1, -1, 1, -1, 0, 1 };
const int dy[8] = { 1, 1, 1, 0, 0, -1, -1, -1 };
const int lr[4] = { 0, 1, 0, -1 };
const int ud[4] = { 1, 0, -1, 0 };



//LOVE Ayane Sakura



using namespace std;

long long nCm(long long n, long long m) {
	long long ans = 1;
	for (long long i = 1; i <= m; i++) {
		ans = ans * n / i;
		n--;
	}
	return ans;
}

int main() {
	double N;
	cin >> N;
	cout << ceil(N / 2) << endl;
}


Measured memory_bytes: 256
N=int(input())
A=list(map(int,input().split()))
flag=False
for i in range(N):
  if A[i]%2==0:
    if A[i]%3!=0 and A[i]%5!=0:
      flag=True
if flag==True:
  print('DENIED')
else:
  print('APPROVED')

Measured memory_bytes: 3060
#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>;
const int INF = 1000000001;

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() {
  ll h, n;
  ll a = 0;
  cin >> h >> n;
  rep(i, n){
    ll atack;
    cin >> atack;
    a += atack;
  }
  
  if(a >= h){
    cout << "Yes" << endl;
  }
  else{
    cout << "No" << endl;
  }

  return 0;
}


Measured memory_bytes: 256
S = raw_input()
c1 = (S[0] == 'A')
c2_indexes = []
for i, s in enumerate(S):
    if i < 2 or i == len(S)-1: continue
    if s == 'C': c2_indexes.append(i)
c2 = (len(c2_indexes) == 1)
c3 = True
if c1 and c2:
    for i, s in enumerate(S):
        if i == 0 or i == c2_indexes[0]: continue
        if s.isupper():
            c3 = False
            break
if c1 and c2 and c3:
    print 'AC'
else:
    print 'WA'

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

using VS = vector<string>;    using LL = long long;
using VI = vector<int>;       using VVI = vector<VI>;
using PII = pair<int, int>;   using PLL = pair<LL, LL>;
using VL = vector<LL>;        using VVL = vector<VL>;

#define ALL(a)  begin((a)),end((a))
#define RALL(a) (a).rbegin(), (a).rend()
#define SZ(a) int((a).size())
#define SORT(c) sort(ALL((c)))
#define RSORT(c) sort(RALL((c)))
#define UNIQ(c) (c).erase(unique(ALL((c))), end((c)))
#define FOR(i, s, e) for (int(i) = (s); (i) < (e); (i)++)
#define FORR(i, s, e) for (int(i) = (s); (i) > (e); (i)--)
//#pragma GCC optimize ("-O3") 
#ifdef YANG33
#include "mydebug.hpp"
#else
#define DD(x) 
#endif
const int INF = 1e9;                          const LL LINF = 1e16;
const LL MOD = 1000000007;                    const double PI = acos(-1.0);

/* -----  2019/04/13  Problem: ABC 124 D / Link: http://abc124.contest.atcoder.jp/tasks/abc124_d  ----- */

struct Cumusum {
	vector<LL>csum;
	Cumusum(vector<LL>&a) {
		csum.assign((int)a.size() + 1, 0);
		for (int i = 0; i < (int)a.size(); i++) {
			csum[i + 1] = csum[i] + a[i];
		}
	}
	Cumusum(vector<int>&a) {
		csum.assign((int)a.size() + 1, 0);
		for (int i = 0; i < (int)a.size(); i++) {
			csum[i + 1] = csum[i] + a[i];
		}
	}
	LL query(int l, int r) {
		if (r >= SZ(csum))r = SZ(csum) - 1;

		return csum[r] - csum[l];
	}
};


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

	LL N, K; cin >> N >> K;
	string s; cin >> s;

	// to block
	char pre = s.front();
	VI ele; ele.push_back(0); ele.push_back(0);
	VI is_a; is_a.push_back(0); is_a.push_back(pre == '0');
	FOR(i, 0, N) {
		if (pre == s[i]) {
			ele.back()++;
		}
		else {
			ele.push_back(1);
			is_a.push_back(s[i] == '0');
			pre = s[i];
		}
	}
	ele.push_back(0);
	is_a.push_back(0);
	N = SZ(ele);
	Cumusum elesum(ele);
	Cumusum isasum(is_a);
	DD(De(ele));
	DD(De(is_a));
	LL ans = 0LL;
	FOR(i, 0, N) {
		if (is_a[i] == 0)
			ans = max(ans, elesum.query(i, i + 2 * K + 1));
	}



	cout << (ans) << "\n";

	return 0;
}


Measured memory_bytes: 2884
#include <bits/stdc++.h>
typedef long long ll;
ll n, s;
bool check(ll base) {
    ll ret = 0, tmp = n;
    while (tmp) ret += tmp % base, tmp /= base;
    return ret == s;
}
int main() {
//    freopen("in.txt", "r", stdin);
    scanf("%lld%lld", &n, &s);
    ll up = ll(sqrt(n)) + 1;
    for (ll b = 2; b <= up; b++) if (check(b)) return 0 * printf("%lld\n", b);
        if (n == s) return 0 * printf("%lld\n", n + 1);
        if (n < s) return 0 * puts("-1");
        ll tmp = n - s, upper = ll(sqrt(n - s)) + 1;
        for (ll a1 = upper; a1 >= 1; a1--) {
                if (tmp % a1 == 0) {
                        ll b = tmp / a1 + 1, a0 = s - a1;
                        if (a0 >= 0 && a0 < b && a1 < b) return 0 * printf("%lld\n", b);
                }
        }
    return 0 * puts("-1");
}


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

int main() {
  unsigned N;
  std::cin >> N;
  std::vector<unsigned > s(N);
  unsigned long long ans = 0;
  for (unsigned i = 0; i < N; ++i) {
    std::cin >> s[i];
    ans += s[i];
  }
  std::sort(s.begin(), s.end());
  if (ans % 10 != 0) {
    std::cout << ans << std::endl;
    return 0;
  } else {
    for (unsigned i = 0; i < N; ++i) {
      if (s[i] % 10 != 0) {
        std::cout << ans - s[i] << std::endl;
        return 0;
      }
    }
    std::cout << 0 << std::endl;
    return 0;
  }
}

Measured memory_bytes: 384
#include <iostream>

using namespace std;

int main(void) {
    long long int W, H, x, y;
    cin >> W >> H >> x >> y;
    cout << W * H / 2.0 << endl;
    if(2*x == W && 2*y == H) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
    return 0;
}

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

using namespace std;

#define fr(i,a,b) for(int i=a;i<b;++i)
typedef long long ll;
///////////////////

int const N = 5e5 + 41;

int n, a, b, c, d;

ll mina[N], maxa[N], minb[N], maxb[N];

void solve(){
	cin >> n >> a >> b >> c >> d;
	if(a > b) swap(a, b);
	b -= a;
	a -= a;
	mina[0] = maxa[0] = 0;
	minb[0] = maxb[0] = b;
	fr(i, 1, n){
		mina[i] = i * 1LL * c;
		maxa[i] = i * 1LL * d;
		minb[i] = mina[i] + b;
		maxb[i] = maxa[i] + b;
	}
	bool ok = false;
	fr(i, 0, n){
		ll l = max(mina[i], minb[n-1-i]);
		ll r = min(maxa[i], maxb[n-1-i]);
		if(l <= r) ok = true;
	}
	if(ok) cout << "YES";
	else cout << "NO";
	cout << endl;
}

int main(){
#ifdef _DEBUG
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
#endif

	solve();

	return 0;
}

Measured memory_bytes: 15872
/**
 *    Author: "Robin Singh" !!
 *    BrainyIsTheNewSexy
 *    rob_in_1
**/

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

#define dbg( args...) { vector<string> _v = split( #args, ','); err( _v.begin(), args); cerr << '\n'; }
vector<string> split( const string& s, char c) { vector<string> v; stringstream ss( s); string x; 
while ( getline( ss, x, c)) v.emplace_back(x); return move(v); }
void err( vector<string>::iterator it) { } 
template<typename T, typename... Args>
void err( vector<string>::iterator it, T a, Args... args) {
cerr << it -> substr( ( *it)[0] == ' ', it -> length()) << " = " << a << '\t'; err( ++it, args...); }

#define int long long
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin())
#define ff first
#define ss second
#define MP make_pair
#define szz(v) ((int)(v).size())  
#define fr(i, j, k) for(int i = j; i < k; i++)     
#define bk(i, j, k) for(int i = j-1; i >= k; i--)
#define mem(ptr, val)  memset(ptr, val, sizeof ptr)
#define sbit(n)  __builtin_popcount(n)
#define nl "\n"

typedef long double ld;
typedef pair<int, int> pii;
typedef vector <int> vi;
typedef vector < pair<int,int> > vpii;
const long double eps = 1e-9;
const int mod = 1e9+7;

pii dir[8] = { {-1, 0}, {1, 0}, {0, -1}, {0, 1}, {1, 1}, {-1, -1} , {-1, 1}, {1, -1} };

//*****************************************!Template Ends Here!******************************************]

const int nn = 2e5+5;

void solve(){
	int n = 0, m = 0, cnt = 0, sum = 0, mx = -1e18, mn = 1e18, k = 0, ans = 0;
    cin >> n;
    int a[n+1];
    fr(i, 1, n+1) cin >> a[i];
    sort(a+1, a+n+1);
    if(n % 2 == 0){
        for(int i=n; i>=1; i--){
            if(i == n/2 + 1) ans += a[i];
            else if(i == n/2) ans -= a[i];
            else if(i > n/2) ans += a[i]*2;
            else ans -= a[i]*2;
        }
    }
    else{
    
        for(int i=n; i>=1; i--){
            if(i == n/2 + 1) ans -= a[i];
            else if(i == n/2) ans -= a[i];
            else if(i > n/2) ans += a[i]*2;
            else ans -= a[i]*2;
        }
        int s1 = 0;
        for(int i = n/2; i > 0; i--){
            s1 += a[i];
        }
        s1 *= 2;
        int s2 = a[n/2+1]+a[n/2+2];
        for(int i = n/2+3; i <= n; i++){
            s2 += 2*a[i];
        }
        s2 = s2 - s1;
        ans = max(ans, s2);

    }
    cout << ans;
}

int32_t main()
{
 //  freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

    int t = 1;
    // cin >> t;
    for(int tc = 1; tc <= t; tc++){
    	// cout << "Case #" << tc << ": ";
    	solve();
    }
    return 0;
}

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

using namespace std;

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

#define N 100010
#define M 200010
#define A 110
#define endl "\n"
#define mod 1000000007 

int main(){
	
	ios_base::sync_with_stdio(0);
	cin.tie(0);cout.tie(NULL);
	
	int k;
	
	cin >> k;
	
	ll sum = 0;
	for(int i = 1; i <= k; i++){
		for(int j = 1; j <= k; j++){
			for(int l = 1; l <= k; l++){
				sum += __gcd(i, __gcd(j, l));	
			}
		}
	}
	
	cout << sum << endl;
	
	return 0;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int main(){
	int n;
	cin >> n;
	for (int i = 1; i <= n; i++){
		if (i*(n / i) == n&&i<=9&&(n/i)<=9){
			cout << "Yes" << endl;
			exit(0);
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.IO.Pipes;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;

namespace AtCorders
{
	public class Program
	{
		static void Main(string[] args)
		{
			string x = Console.ReadLine();
			int n = x.Length;

			int rem = 0;
			int sCount = 0;
			for (int i = 0; i < n; i++) {
				if (x[i] == 'S') {
					sCount++;
				} else {
					if (sCount > 0) {
						sCount--;
						rem += 2;
					}
				}
			}

			int ans = n - rem;
			Console.WriteLine(ans);
		}
	}
}

Measured memory_bytes: 13140
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using ll=long long;  
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N,L;
    cin >> N >> L;
    int l=L,r=L+N-1;
    int eat;
    if(l>=0)eat=l;
    else if(r<=0) eat=r;
    else eat=0;
    int ans=(l+r)*(r-l+1)/2-eat;
    cout << ans <<endl;
    return 0;
}


Measured memory_bytes: 256
//==================================================================================================
// Name        : WinryRockbell.cpp
// Author      : lotus.eater086
// Copyright   : If you're reading this then this warning is for you. Every word you read of this 
//               useless fine print is another second of your life. Don't you've other things to do?
//               Is your life so empty that you honestly can't think of a better way to spend these
//               moments ? Or are you so impressed with authority that you give respect and 
//               credence to all who claim it ? Do you read everything you're supposed to read ? Do
//               you think everything you're supposed to think ? Buy what you're told you should 
//               want ? Get out of your apartment . Meet a member of the opposite sex. Stop the 
//               excessive shopping and self-improvement . Quit your boring job.
//               Start a fight. Prove you're alive. If you don't claim your humanity you'll become a
//               statistic. You've been warned !

// Description : 
// Date        : 2019-08-11
// Time        : 13:07:27
// Directory   : C:\Users\Lenovo\cpPractise\deliberatePractise\code_folder\.vscode
// FilePath    : C:\Users\Lenovo\cpPractise\deliberatePractise\code_folder\.vscode\WinryRockbell.cpp
//==================================================================================================
    

#include <bits/stdc++.h>
#define LL long long
#define endl "\n"

using namespace std ;
    
//
template < typename T >

inline T read( T &x )
{

    x = 0 ;

    int f = 0 ;

    char ch = getchar() ;

    while( ch < '0' || ch > '9' )  {

        f |= ( ch == '-' ) , ch = getchar() ;

    }

    while( ch >= '0' && ch <= '9' )  {

        x = ( x << 1 ) + ( x << 3 ) + ch - '0' , ch = getchar() ;

    }

    return x = f ? -x:x ;

}
//

void solve( void )
{

    int n ;

    read( n ) ;

    vector<string> vs ;

    while( n-- )  {

        string s ;

        cin >> s ;

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

        vs.emplace_back( s ) ;  

    }

    map< string , LL > msi ;        // key_value , mapped_value 

    for( int i = 0 ; i < vs.size() ; i++ )  {

        msi[ vs[i] ]++ ;  

    }

    LL ans = 0 ; 

    for( auto i = msi.begin() ; i != msi.end() ; i++ )  {

        LL x = i->second ;

        ans += ( ( x*x - x )/2 ) ;  

    }

    cout << ans << endl ; 

}

int main( void )

{

    //ios_base::sync_with_stdio( false ) ;  cin.tie( NULL ) ;  cout.tie( NULL ) ;

   
    if( 0 )  {

        int t = 100 ;

        for( int i = 1 ; i <= t ; i++ )  solve() ;

    }

    else  {

        solve() ;

    }

    

    return 0 ;

}


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

#ifndef __TOPCYBERFLOWER
#define debug(...) 0
#else
#define debug(...) cout << " [-] ", _dbg(#__VA_ARGS__, __VA_ARGS__)
template<class TH> void _dbg(const char *sdbg, TH h){ cout << sdbg << '=' << h << endl; }
template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) {
    while(*sdbg != ',') cout << *sdbg++;
    cout << '=' << (h) << ','; 
    _dbg(sdbg+1, a...);
}
#endif

#define TYPEMAX(type)   numeric_limits<type>::max()
#define TYPEMIN(type)   numeric_limits<type>::min()
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;

int main(void){
    ios_base::sync_with_stdio(false); cin.tie(NULL);
    int x,y,z; cin>>x>>y>>z;
    swap(x,y);
    swap(x,z);
    cout<<x<<" "<<y<<" "<<z;
    return 0;
}

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

const ll INF = 1LL << 60;

ll ans = 0;
ll lim = 0;
ll N;

void dfs(string target) {
    if (target.size() >= 3) {
        ll num = stol(target);

        map<char, ll> mp;
        rep(i, target.size()) {
            mp[target[i]]++;
        }
        if (mp.size() == 3 && num <= N) {
            // cout << target << " ";
            ans++;
        }
    }

    if (target.size() == lim) {
        return;
    }

    dfs(target + "3");
    dfs(target + "5");
    dfs(target + "7");
}

int main() {
    cin >> N;
    string s = to_string(N);
    lim = s.size();

    string tmp = "";
    dfs(tmp);
    cout << ans << endl;
}

Measured memory_bytes: 256
"use strict";
function Main(input) {
    let lines = input.split("\n");
    let cols = lines.shift().split(/\s/).map((v) => v - 0);
    let N = cols[0], M = cols[1];
    let D = [];
    for (let n = 0; n < N; n++) {
        let An = lines.shift().split(/\s/).map((v) => v - 0);
        D.push([An[0], An[1]]);
    }
    let yen = 0;
    D.sort((a, b) => a[0] - b[0]);
    for (let i = 0; M > 0; i++) {
        yen += (D[i][0] * Math.min(M, D[i][1]));
        M -= D[i][1];
    }
    console.log(yen);
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));


Measured memory_bytes: 52720
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    string a;
    cin>>a;
    if(a=="Sunny"){
        cout<<"Cloudy";
    }else if(a=="Cloudy"){
        cout<<"Rainy";
    }else{
        cout<<"Sunny";
    }
    return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;

/*
 <url:https://arc063.contest.atcoder.jp/tasks/arc063_a>
問題文============================================================
 きつねの次郎と三郎が一次元リバーシで遊んでいます。
 一次元リバーシでは、盤面には白か黒の石が一列に並んだ状態となっており、列の右端か左端に新たに石を打っていきます。
 通常のリバーシと同じように、たとえば白の石を打つことで黒の石を挟むと、挟まれた黒の石は白い石に変わります。
 
 ゲームの途中で三郎に急用ができて帰ってしまうことになりました。このとき、盤面の状態は文字列 S で表されます。
 石は |S| (文字列の長さ) 個並んでおり、
 左から i (1≦i≦|S|) 個目の石の色は、S の i 文字目が B のとき黒、W のとき白です。
 
 次郎は現在の盤面に対して、できるだけ少ない個数の石を新たに打つことで全ての石を同じ色にしようと考えました。
 最小で何個の石を打てばよいかを求めてください。
=================================================================

解説=============================================================

 左と右から順番にひっくり返して行った場合をシミュレーションすれば良い
 
================================================================
*/
int main(void) {
	cin.tie(0); ios::sync_with_stdio(false);
    string S; cin >> S;
    int ans = INF;
    int tmp = 0;
    for(int i = 0; i < (int)S.length()-1;i++){
        if(S[i] != S[i]+1) tmp++;
    }
    ans = min(ans,tmp);
    tmp = 0;
    for(int i = (int)S.length()-1; i>0;i--){
        if(S[i] != S[i-1]) tmp++;
    }
    ans = min(ans,tmp);
    cout << ans << endl;
	return 0;
}


Measured memory_bytes: 512
import heapq as h
import math
import numpy as np
import copy
import itertools

 
# x,y = map(int,input().split())
s = input()
t = input()

candidates = []
count = 0
for i in range(len(s)):
    if ((s[i] == t[0]) or (s[i] == '?')) and ((len(s)-i) >= len(t)):
        count = 1
        for j in range(1,len(t)):
            if (s[i+j] == t[j]) or (s[i+j] == '?'):
                count += 1
            else:
                break
        if count == len(t):
            new = s[:i] + t
            if i+len(t) < len(s):
                new += s[i+len(t):]
            candidates.append(new.replace('?','a'))
if candidates != []:
    print(sorted(candidates)[0])
else:
    print('UNRESTORABLE')








Measured memory_bytes: 12504
# import numpy as np
# import math
# import copy
# from collections import deque
import sys
input = sys.stdin.readline
# sys.setrecursionlimit(10000)


def main():
    HMK = list(map(int,input().split()))

    atime = HMK[2] * 60 + HMK[3] - HMK[0] * 60 - HMK[1]

    res = atime - HMK[4]

    print(res)



main()


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

struct point{
    int x;
    int y;
    int t;
};

int dist(point &a, point &b){
    return abs(a.x - b.x) + abs(a.y - b.y);
}

void kill(){
    cout << "No" << endl;
    exit(0);
}

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

    int n;
    cin >> n;
    int curx, cury, curt;
    point p;
    point q;
    p.x = 0, p.y = 0, p.t = 0;
    for(int i = 0; i < n; ++i){
        cin >> q.t >> q.x >> q.y;
        int d = dist(p,q);
        int difftime = q.t - p.t;
        if(d > difftime){
            kill();
        }
        if(d%2 != difftime%2){
            kill();
        }
        p.x = q.x, p.y = q.y, p.t = q.t;
    }

    cout << "Yes" << endl;

    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<atcoder/all>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; using namespace atcoder;
void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int N, Q;
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> N >> Q;
	fenwick_tree<ll> ft(N);
	rep(i, 0, N) {
		int a; cin >> a;
		ft.add(i, a);
	}
	rep(i, 0, Q) {
		int t, a, b; cin >> t >> a >> b;
		if (t == 0) ft.add(a, b);
		else {
			ll ans = ft.sum(a, b);
			printf("%lld\n", ans);

		}
	}
}







Measured memory_bytes: 8248
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>

using namespace std;

//----------------------- Print Function ----------------------//

inline void print() {
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest) {
    cout << first << ' ';
    print(rest...);
}

//------------------------- Libraries -------------------------//

//--------------------------- Solve ---------------------------//

void solve() {
    long long A, B, K; cin >> A >> B >> K;
    
    if (K > A) {
        K -= A;
        A = 0;
        if (K > B) {
            K -= B;
            B = 0;
        }
        else {
            B -= K;
            K = 0;
        }
    }
    else {
        A -= K;
        K = 0;
    }

    print(A, B);
}

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

    solve();

    return 0;
}

Measured memory_bytes: 3660
#include <iostream>
#include<algorithm>
#include<sstream>
#include<cmath>
#include<vector>
#include<iomanip>
#include<map>
#include<set>
#include<queue>
using namespace std;
typedef long long ll;
#define rep(i,n) for(int i = 0; i < n;i++)
int main(void) {
	ll a, b, c;cin >> c >> a >> b;
	if (a < b && c > 1) {
		cout << (c - 1) * b + a - (c -1) * a - b + 1 << endl;
	}
	else if (a == b) cout << 1 << endl;
	else cout << 0 << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <complex>
#include <sstream>
#include <string>
#include <algorithm>
#include <deque>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <vector>
#include <set>
#include <limits>
#include <cstdio>
#include <cctype>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <ctime>
using namespace std;
#define REP(i, j) for(int i = 0; i < (int)(j); ++i)
#define FOR(i, j, k) for(int i = (int)(j); i < (int)(k); ++i)
#define SORT(v) sort((v).begin(), (v).end())
#define REVERSE(v) reverse((v).begin(), (v).end())
typedef complex<double> P;
const int MAX_N = 1010;
const double PI = 3.141592653589793;

int main() {
  P ans[MAX_N];
  ans[1] = P(1.0, 0.0);
  FOR(i, 2, MAX_N) ans[i] = ans[i - 1] + (ans[i - 1] * P(0, 1) / abs(ans[i - 1]));
  int N;
  while(cin >>N && N != -1) cout <<ans[N].real() <<endl <<ans[N].imag() <<endl;
  return 0;
}

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

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
typedef pair<ll, ll> P;
//const double INF = 1e10;
const ll INF = LONG_LONG_MAX / 10;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;


void print_line(vector<ll> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}

typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK;

struct mint {
    ll x; // typedef long long ll;
    mint(ll x = 0) : x((x % mod + mod) % mod) {}

    mint &operator+=(const mint a) {
        if ((x += a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator-=(const mint a) {
        if ((x += mod - a.x) >= mod) x -= mod;
        return *this;
    }

    mint &operator*=(const mint a) {
        (x *= a.x) %= mod;
        return *this;
    }

    mint operator+(const mint a) const {
        mint res(*this);
        return res += a;
    }

    mint operator-(const mint a) const {
        mint res(*this);
        return res -= a;
    }

    mint operator*(const mint a) const {
        mint res(*this);
        return res *= a;
    }

    mint pow(ll t) const {
        if (!t) return 1;
        mint a = pow(t >> 1);
        a *= a;
        if (t & 1) a *= *this;
        return a;
    }

    // for prime mod
    mint inv() const {
        return pow(mod - 2);
    }

    mint &operator/=(const mint a) {
        return (*this) *= a.inv();
    }

    mint operator/(const mint a) const {
        mint res(*this);
        return res /= a;
    }
};

struct combination {
    vector<mint> fact, ifact;

    combination(int n) : fact(n + 1), ifact(n + 1) {
        assert(n < mod);
        fact[0] = 1;
        for (int i = 1; i <= n; ++i) fact[i] = fact[i - 1] * i;
        ifact[n] = fact[n].inv();
        for (int i = n; i >= 1; --i) ifact[i - 1] = ifact[i] * i;
    }

    mint operator()(int n, int k) {
        if (k < 0 || k > n) return 0;
        return fact[n] * ifact[k] * ifact[n - k];
    }

    mint nPk(int n, int k) {
        if (n < k) return 0;
        if (n < 0 || k < 0) return 0;
        return fact[n] * ifact[n - k];
    }

} combination(10000);


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

    mint ans = combination(n + k - 1, n);

    cout << ans.x << endl;

}





Measured memory_bytes: 3240
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,l,r) for(long long i=(l);i<(r);++i)
#define REP(i,n) FOR(i,0,n)
#define int long long
const int MOD=1e9+7;
const int INF=1e20;

signed main(){
    int N,K;cin>>N>>K;
    int ans=K;
    REP(i,N-1){
        ans*=K-1;
    }
    cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
 long long n;
 cin>>n;
 int a[n],b[n];
 for(int i=0;i<n;i++){
 	cin>>a[i]>>b[i];
 }
 int count=0;
 for(int i=0;i<n;i++){
 	if(a[i]==b[i]){
 		count++;
 		if(count==3){
 			break;
		 }
	 }else if(a[i]!=b[i]){
	 	count=0;
	 }
 }
 if(count==3){
 	cout<<"Yes"<<endl;
 }else {
 	cout<<"No"<<endl;
 }
 
	return 0;
}

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

using namespace std;
int main(){
    int n,k,r,s,p; cin>>n>>k>>r>>s>>p;
    string t; cin>>t;
    map<char,int> enemy;
    rep(i,t.length()){
        if(t[i]=='r') enemy['r']++;
        if(t[i]=='s') enemy['s']++;
        if(t[i]=='p') enemy['p']++;
    }

    ll tot=0;

    tot = enemy['r']*p + enemy['s']*r + enemy['p']*s;

    rep(i,t.length()){
        int j = i-k;
        if(j>-1){
           if(t[i]==t[j]){
                if(t[i]=='r') {tot-=p; t[i]='n';}
                if(t[i]=='s') {tot-=r; t[i]='n';}
                if(t[i]=='p') {tot-=s; t[i]='n';}
           }
        }
    }
    cout << tot << endl;
    return 0;
}

Measured memory_bytes: 512
void main()
{
    long i, o, t, j, l, s, z;
    rdVals(i, o, t, j, l, s, z);

    long k = o;
    if (i && j && l && (i & 1) + (j & 1) + (l & 1) >= 2)
    {
        k += 3;
        --i, --j, --l;
    }
    k += i / 2 * 2;
    k += j / 2 * 2;
    k += l / 2 * 2;

    k.writeln;
}

enum long mod = 10^^9 + 7;
enum long inf = 1L << 60;

T rdElem(T = long)()
if (!is(T == struct))
{
    return readln.chomp.to!T;
}

alias rdStr = rdElem!string;
alias rdDchar = rdElem!(dchar[]);

T rdElem(T)()
if (is(T == struct))
{
    T result;
    string[] input = rdRow!string;
    assert(T.tupleof.length == input.length);
    foreach (i, ref x; result.tupleof)
    {
        x = input[i].to!(typeof(x));
    }
    return result;
}

T[] rdRow(T = long)()
{
    return readln.split.to!(T[]);
}

T[] rdCol(T = long)(long col)
{
    return iota(col).map!(x => rdElem!T).array;
}

T[][] rdMat(T = long)(long col)
{
    return iota(col).map!(x => rdRow!T).array;
}

void rdVals(T...)(ref T data)
{
    string[] input = rdRow!string;
    assert(data.length == input.length);
    foreach (i, ref x; data)
    {
        x = input[i].to!(typeof(x));
    }
}

void wrMat(T = long)(T[][] mat)
{
    foreach (row; mat)
    {
        foreach (j, compo; row)
        {
            compo.write;
            if (j == row.length - 1) writeln;
            else " ".write;
        }
    }
}

import std.stdio;
import std.string;
import std.array;
import std.conv;
import std.algorithm;
import std.range;
import std.math;
import std.numeric;
import std.traits;
import std.container;
import std.functional;
import std.typecons;
import std.ascii;
import std.uni;

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

int main()
{
    int n;
    cin >> n;
    int temp;
    int *a = new int[n];
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    int *b = new int[n];
    for (int i = 0; i < n; i++)
    {
        cin >> b[i];
    }
    int *c = new int[n - 1];
    for (int i = 0; i < n - 1; i++)
    {
        cin >> c[i];
    }

    int sat = 0;
    for (int i = 0; i < n; i++)
    {
        if (i > 0 && a[i - 1] + 1 == a[i])
        {
            sat += c[a[i - 1] - 1];
        }
        sat += b[a[i] - 1];
    }
    cout << sat << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main( void )
{
  int n;
  while( 1 ){
    cin >> n;
    if( cin.eof() ) break;
    int x = 0;
    for( int a=0; a<=9; a++ ) for( int b=0; b<=9; b++ )
    for( int c=0; c<=9; c++ ) for( int d=0; d<=9; d++ )
    if( a+b+c+d == n ) x++;
    cout << x << endl;
  }
  return 0;
}

Measured memory_bytes: 0
#![allow(unused_imports)]
#![allow(dead_code)]
use datastructure::*;
use grapth::*;
use input_scanner::*;
use math::*;
use string_algorithm::*;
use util::*;

use std::cmp;
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, LinkedList, VecDeque};

fn main() {
    let mut scan = Scanner::new();
    let x: i32 = scan.next();
    let n: usize = scan.next();
    let p: Vec<i32> = scan.next_vec(n);

    let mut ans = 100000;
    for i in -200..200 {
        if p.iter().any(|a| *a == i) {
            continue;
        }
        if (x - i).abs() < (x - ans).abs() {
           ans = i;
        }
    }

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

mod datastructure {}
mod grapth {}
mod math {}
mod string_algorithm {}
mod util {}
mod input_scanner {
    pub struct Scanner {
        bytes: Vec<u8>,
        begin: usize,
        end: usize,
    }

    impl Scanner {
        pub fn new() -> Self {
            use std::io::Read;
            let mut buffer: Vec<u8> = Vec::new();
            std::io::stdin().read_to_end(&mut buffer).unwrap();
            let end = (0..buffer.len())
                .find(|i| buffer[*i].is_ascii_whitespace())
                .unwrap_or(buffer.len());
            Scanner {
                bytes: buffer,
                begin: 0,
                end: end,
            }
        }
        pub fn next<T: std::str::FromStr>(&mut self) -> T {
            let s: &str =
                unsafe { std::str::from_utf8_unchecked(&self.bytes[self.begin..self.end]) };
            let ret: T = s.parse::<T>().ok().expect("Parse error.");
            self.skip();
            ret
        }
        pub fn next_vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
            (0..n).map(|_| self.next()).collect()
        }
        pub fn next_word(&mut self) -> Vec<u8> {
            let r = Vec::from(&self.bytes[self.begin..self.end]);
            self.skip();
            r
        }
        fn skip(&mut self) {
            self.begin = (self.end..self.bytes.len())
                .find(|i| !self.bytes[*i].is_ascii_whitespace())
                .unwrap_or(self.bytes.len());
            self.end = (self.begin..self.bytes.len())
                .find(|i| self.bytes[*i].is_ascii_whitespace())
                .unwrap_or(self.bytes.len());
        }
    }
}


Measured memory_bytes: 2144
#include <stdio.h>

int main() {
	int S, a = -1;

	scanf("%d", &S);

	for (int i = 0; i < 4; i++) {
		if (S % 10 == a) {
			printf("Bad");
			return 0;
		}
		else {
			a = S % 10;
			S = S / 10;
		}
	}

	printf("Good");

	return 0;
}

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

namespace A
{
    public class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            Solve();
            Console.Out.Flush();
        }

        public static void Solve()
        {
            var nab = Console.ReadLine().Trim().Split(' ').Select(int.Parse).ToArray();
            Console.WriteLine(Math.Min(nab[0] * nab[1], nab[2]));
        }
    }
}


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

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

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define REP(i, n) for (int i = 1; i <= (int)(n); i++)
#define repi(i, s, n) for (int i = (s); i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define uniqueV(x)          \
  sort(x.begin(), x.end()); \
  x.erase(unique(x.begin(), x.end()), x.end());
#define debug(x) cerr << #x << ": " << x << '\n'
#define debug2(x, y) cerr << "(" << #x << ", " << #y << ") = " \
                          << "(" << x << ", " << y << ")" << '\n'

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

const long long INF = 3e18 + 12;
const int inf = 1e9;

// ----------------------------------------------

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

  int n, a, b;
  cin >> n >> a >> b;

  string s;
  cin >> s;

  int asum = 0;
  int bsum = 0;

  rep(i, n) {
    if (s[i] == 'a') {
      debug(asum);
      if (asum < a + b) {
        cout << "Yes" << endl;
        asum++;
      } else {
        cout << "No" << endl;
      }
    } else if (s[i] == 'b') {
      bsum++;
      if (asum < a + b && bsum <= b) {
        cout << "Yes" << endl;
        asum++;
      } else {
        cout << "No" << endl;
      }
    } else {
      cout << "No" << endl;
    }
  }

  return 0;
}

Measured memory_bytes: 848
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<utility>
#include<stack>
#include<map>
#include<set>
#include<assert.h>
using namespace std;
typedef long long ll;
const ll mod = 1000000007;
const ll INF = mod * mod;

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

#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define Rep1(i,sta,n) for(int i=sta;i<=n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define stop char nyaa;cin>>nyaa;


void solve() {
	string s; cin >> s;
	sort(s.begin(), s.end());
	if (s[0] == s[1] && s[2] == s[3] && s[1] != s[2]) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}


signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	//cout<<fixed<<setprecision(10);
	solve();
	//stop
	return 0;
}

Measured memory_bytes: 256
//quming
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
using namespace std;
typedef long long ll;
const int N=1e5+5;
ll q[N],st[N],cnt[N],a[N],s[N],x;int top,n,m;
void ins(R ll x,R ll p,R int pos){
    R int k;
    while(x>=st[1]){
        k=lower_bound(st+1,st+1+pos,x+1)-st-1;
        s[k]+=x/st[k]*p,x%=st[k],pos=k-1;
    }
    a[x]+=p;
}
int main(){
//  freopen("testdata.in","r",stdin);
    scanf("%d%d",&n,&m),top=0;
    st[++top]=n;
    fp(i,1,m){
        scanf("%lld",&x);
        while(top&&x<=st[top])--top;
        st[++top]=x;
    }
    fp(i,1,top-1)cnt[i]=st[i+1]/st[i];
    cnt[top]=cnt[top+1]=1;
    fd(i,top,2)cnt[i]=cnt[i]*cnt[i+1]+s[i],ins(st[i]%st[i-1],cnt[i],i-1);
    cnt[1]=cnt[1]*cnt[2]+s[1];
    fd(i,n,1)a[i]+=a[i+1];
    fp(i,1,n)printf("%lld\n",(i<=st[1]?cnt[1]+a[i]:0));
    return 0;
}

Measured memory_bytes: 4096
#include<iostream>
#include<string>
#include<cstdio>
using namespace std;
int main(){
  string str;
  getline(cin,str);
  for(int i=0,l=str.size();i<l;i++){
    if(str[i]>='a'&&str[i]<='z') printf("%c",str[i]-('a'-'A'));
    else if(str[i]>='A'&&str[i]<='Z') printf("%c",str[i]+('a'-'A'));
    else cout << str[i];
  }
  cout << endl;
}

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

li = []

for i in range(n):
    [si, pi] = input().split()
    li.append((si, int(pi), i+1))

li.sort(key = lambda tup: tup[0])

li2 = []
while len(li) > 0:
  key = li[0][0]
  flag = True
  while flag and len(li) > 0:
    if li[0][0] == key:
      li2.append(li.pop(0))
    else:
      flag = False
  li2.sort(key = lambda tup: tup[1], reverse = True)
  for x in li2:
    print(x[2])
  li2 = []
    
  

Measured memory_bytes: 3064
#!/usr/bin/env python3
import sys, math, fractions, itertools


def solve(N: int, L: "List[int]"):
    L = sorted(L)
    res = 0
    for i in range(N):
        res += min(L[2*i], L[2*i+1])
    print(res)
    return


# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    L = [ int(next(tokens)) for _ in range(2*N) ]  # type: "List[int]"
    solve(N, L)

if __name__ == '__main__':
    main()


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

using namespace std;

#define ll long long
#define REP(x,n) for(int x=0;x<n;x++)

//vector//
#define vei vector<int> 
#define velli vector<long long int> 
#define pb(x) push_back(x) // 末尾にxを加える
#define pb2 pop_back() // 末尾削除
#define all(x) (x).begin(),(x).end() //イテレーター
#define be(x) (x).begin()
//auto  auto begin = v.begin()とか

typedef pair<int,int> P;  //q(p.first,p.second)

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

    vector<ll int> u(n);
    u[0] = 0; //最初の踏み台は0

    for(int i=0; i<n-1; i++){
        // 前の人より大きいとき踏み台いらない
        if(a[i+1] >= a[i]) continue; 

        u[i+1] = a[i] - a[i+1]; // 踏み台最小値
        a[i+1] += u[i+1];
    }
    

    ll int ans = 0;
    for(int i=0; i<n; i++){
        ans += u[i];
    }

    cout << ans;
}

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

using ll = long long;
ll n, m, k, a;
std::vector<int> vec;

int main() {
    std::cin >> n >> m;
    vec.assign(m, 0);
    for (int i = 0; i < n; i++) {
        std::cin >> k;
        for (int t = 0; t < k; t++) {
            std::cin >> a;
            vec[a-1]++;
        }
    }
    int ans = 0;
    for (int i = 0; i < vec.size(); i++) {
        if (vec[i] == n) {
            ans++;
        }
    }
    std::cout << ans << std::endl;
}

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

int main() {
    lint n, k;
    cin >> n >> k;

    vector<lint> a(n);
    for(auto& elem : a)  cin >> elem;
    sort(a.begin(), a.end());

    // x以下のペアの個数
    auto f = [&](lint x) {
        lint res = 0;
        for(lint i=0; i<n; i++) {
            if(a[i] > 0) {
                auto left = a.begin();
                auto right = upper_bound(a.begin(), a.end(), (long double)x/a[i]);
                res += right - left;
                if(i < right - a.begin())  res--;
            } else if(a[i] == 0) {
                if(x >= 0)  res += n-1;
            } else {
                auto left = lower_bound(a.begin(), a.end(), (long double)x/a[i]);
                auto right = a.end();
                res += right - left;
                if(left - a.begin() <= i)  res--;
            }
        }
        return res/2;
    };

    // f(x) >= k ならばOK
    lint ok = 1e18;
    lint ng = -1e18;
    while(abs(ok - ng) > 1) {
        lint mid = (ok + ng) / 2;
        (f(mid) >= k ? ok : ng) = mid;
    }

    cout << ok << endl;
}


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

ans = sum(B)

for i in range(N-1):
    if A[i+1] - A[i] == 1:
        ans += C[A[i]-1]

print(ans)


Measured memory_bytes: 3060
#include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <cmath>
#include <climits>
#include <cstdint>
#include <cstring>
using namespace std;

inline namespace atcoder {
    template <typename T, size_t Depth>
    struct vector_helper { using type = vector<typename vector_helper<T, Depth - 1>::type>; };
    template <typename T>
    struct vector_helper<T, 0> { using type = T; };
    template <typename T, size_t Depth>
    using vector_t = typename vector_helper<T, Depth>::type;

    template <typename T> using vec = vector_t<T, 1>;
    template <typename T> using vvec = vector_t<T, 2>;
    template <typename T> using vvvec = vector_t<T, 3>;
}

int main() {
    int n, m; cin >> n >> m;
    vec<bool> ac(n, false);
    vec<int> wa(n, 0);

    int ans1 = 0, ans2 = 0;
    while (m--) {
        int p; cin >> p; --p;
        char s[3]; cin >> s;
        if (strcmp(s, "AC") == 0) {
            if (!ac[p]) {
                ++ans1;
                ans2 += wa[p];
            }
            ac[p] = true;
        }
        else {
            ++wa[p];
        }
    }

    cout << ans1 << ' ' << ans2 << endl;
}



Measured memory_bytes: 3672
#include <bits/stdc++.h>
using namespace std;
int main(){
    string s;
    cin >> s;
    for(int i = 0; i < s.size(); i++){
        cout << s[i];
        if(i == 3){
            cout << " ";
        }
    }
    cout << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using PII = pair<int, int>;
#define FI(i, a, b) for (int i = (a); i <= (b); ++i)
#define FD(i, b, a) for (int i = (b); i >= (a); --i)
#define DEBUG(x) cerr << #x << ": " << (x) << endl;

int main() {
  int n;
  cin >> n;
  vector<int> a(n + 1), x(n + 1);
  FI(i, 1, n) scanf("%d", &a[i]), a[i] *= 2;
  LL t1 = 0;
  int b = 1;
  for (int i = n; i >= 1; i--) {
    t1 += b * a[i];
    b = -b;
  }
  x[1] = t1 / 2;
  for (int i = 2; i <= n; i++) {
    x[i] = a[i - 1] - x[i - 1];
  }
  FI(i, 1, n) printf("%d%c", x[i], " \n"[i == n]);
}


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

#define vi vector<int>
#define vii vector<int, int>
#define ll long long
#define pb push_back
#define mp make_pair
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);

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

const int MOD = 1000000007;

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

    cout << min(a * n, b) << endl;


    #ifdef LOCAL
        cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
    #endif

    return 0;
}



Measured memory_bytes: 384
#include<iostream>
#include<cmath>
using namespace std;
int n;
long long sum,ans;
int a[100005];
main(){
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        if(i==n)ans+=abs(a[i]);
        ans+=abs(a[i]-a[i-1]);
    }
    for(int i=1;i<=n;i++){
        sum=ans;
        sum-=abs(a[i]-a[i-1])+abs(a[i]-a[i+1]);
        sum+=abs(a[i-1]-a[i+1]);
        cout<<sum<<endl;
    }
}

Measured memory_bytes: 1664