akhauriyash/Code-Regression huggingface dataset:
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#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>

#if __cplusplus >= 201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif

// C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#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>

#if __cplusplus >= 201103L
#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>
#endif


using namespace std;
using ll = long long;

const ll MOD = 1000000007;
const ll INF = 1e18;
const double pi = acos(-1);
const int dx4[4] = {1, 0, -1, 0};
const int dy4[4] = {0, 1, 0, -1};
const int dx8[8] = {1,1,0,-1,-1,-1,0,1};
const int dy8[8] = {0,1,1,1,0,-1,-1,-1};


#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()


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

 


void solve(){
    
    // remove the bottom 3 lines when you submit this code.
    std::ifstream in("sample.txt");
    std::cin.rdbuf(in.rdbuf());

    cin.tie(0);
    ios::sync_with_stdio(false);
    
    int n,k; cin >> n >> k;
    vector<ll> H(n);
    rep(i,n) cin >> H[i];
    
    sort(H.begin(), H.end(), greater<ll>());
    ll ans = 0;
    for (int i = min(k,n); i < n; i++) {
        ans += H[i];
    }
    
    cout << ans << endl;
    
}



signed main() {
    solve();
    return 0;
}



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

using namespace std;

using namespace __gnu_pbds;

const int N = 200005;

vector<int> g[N];

int pr[N];
int M[N];

void pre_dfs(int v, int p = -1) {
  pr[v] = p;
  M[v] = (p == -1 ? -1 : max(p, M[p]));
  for (int to : g[v]) {
    if (to != p) {
      pre_dfs(to, v);
    }
  }
}

gp_hash_table<int, int> go[N];

int get(int v, int x) {
  if (go[v][x]) return go[v][x];
  go[v][x] = 1;
  for (int to : g[v]) {
    if (to != pr[v] && to <= x) {
      go[v][x] += get(to, x);
    }
  }
  return go[v][x];
}

int c[N];

void dfs(int v, int p = -1) {
  if (p != -1 && v > M[p]) {
    c[v] = get(v, M[v]) + c[p];
  } else if (p != -1) {
    c[v] = get(v, M[v]) - get(v, M[p]) + c[p];
  }
  for (int to : g[v]) {
    if (to != p) {
      dfs(to, v);
    }
  }
}

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    --a; --b;
    g[a].push_back(b);
    g[b].push_back(a);
  }
  pre_dfs(0);
  dfs(0);
  for (int i = 1; i < n; i++) {
    cout << c[i] << ' ';
  }
  cout << '\n';
  return 0;
}


Measured memory_bytes: 77760
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i,n) for (int i = 0; i < (int)(n); i++)
#define all(v) v.begin(),v.end()
#define puts(i) cout << i << endl
#define INF INT_MAX
#define INFL LLONG_MAX
typedef long long ll;
using namespace std;

#define MOD 1000000007


int main(){


  string s,t;
  int n;
  cin >> n;
  cin >> s >> t;
    string moji=s+t;

int j=0;
rep(i,n){
    moji.at(j)=s.at(i);
    j++;
    moji.at(j)=t.at(i);
    j++;

  }



  cout << moji << endl ;


  }


Measured memory_bytes: 3588
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
#define x_ real()
#define y_ imag()
#define cross(a, b) (conj(a)*(b)).imag()
#define dot(a, b) (conj(a)*(b)).real()
#define PI acos(-1)
#define F first
#define S second
#define fastIO ios_base::sync_with_stdio(false), cin.tie(NULL)
#define fileIO freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout)
#define ordered_set tree<int, null_type,less_equal<int>, rb_tree_tag,tree_order_statistics_node_update>
typedef long double ld;
typedef long long ll;
typedef unsigned long long ull;
typedef complex<ld> point;
typedef tuple<int, int, int> line;
typedef vector<point> polygon;
typedef pair<double, double> pd;
pair<int, int> dirs[] = { {1, 2}, {-1, 2}, {2, 1}, {2, -1}, {-2, 1}, {-2, -1}, {1, -2}, {-1, -2} };
const double eps = 1e-6;
const int N = 1e5 + 7;




int main() {
	fastIO;
	ll n, m;
	cin >> n >> m;
	vector<ll> v(n+1);
	v[0] = 0;
	for (int i = 1; i <= n; i++) {
		cin >> v[i];
		v[i] += v[i-1];
	}
	unordered_map<ll, vector<ll>> occ;
	for (int i = 0; i <= n; i++) {
		v[i] %= m;
		occ[v[i]].push_back(i);
	}

	ll ans = 0;
	for (int i = 0; i <= n; i++) {
		ll cnt = occ[v[i]].end() - upper_bound(occ[v[i]].begin(), occ[v[i]].end(), i);
		ans += cnt;
	}

	cout << ans;

}


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

int main(void){
	string L[3] = {"Sunny", "Cloudy", "Rainy"};
  	string s;
  	cin >> s;
  	int ans;
  	for (int i = 0; i < 3; i++){
      if(s == L[i]) ans = i;
    }
  	
  	cout << L[(ans+1)%3] << endl;
	return 0;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <iomanip>
using namespace std;
typedef long long ll;
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

#define EPS (1e-7)
#define INF (1e15)
#define PI (acos(-1))
#define MOD 1000000007

#define REP(i,n) for(int i=0;i<n;i++)
#define REPS(i,f,n) for(int i=(f);i<(n);i++)
#define EACH(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)

#define dump(x)  cout << #x << " = " << (x) << endl;
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
#define arrdump(n,a) for(int i=0;i<n;i++) {cout<<((i>0)? " ":"")<<a[i];}cout<<"\n";


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

int dy4[]={0, 0, 1, -1};
int dx4[]={1, -1, 0, 0};
int dx8[]={0, 0, 1, -1, 1, 1, -1, -1};
int dy8[]={1, -1, 0, 0, 1, -1, -1, 1};

// https://atcoder.jp/contests/abc099/tasks/abc099_c

int main() {
  int N; cin >> N;
  ll dp[N+5]; REP(i, N+5) dp[i] = INF;
  dp[0] = 0;
  REP(i, N+1) {
    chmin(dp[i+1], dp[i] + 1);

    for (int k = 6; i+k <= N; k=k*6) {
      chmin(dp[i+k], dp[i] + 1);
    }
    for (int k = 9; i+k <= N; k=k*9) {
      chmin(dp[i+k], dp[i] + 1);
    }
  }

  cout << dp[N] << "\n";

  return 0;
}


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

int main() {
    int32_t n, k;
    cin >> n >> k;
    int32_t x[n];
    for(int32_t i = 0; i < n; i++) {
        cin >> x[i];
    }

    int32_t answer = INT32_MAX;
    for (int32_t i = 0; i <= n - k; i++) {
        int32_t d;
        if (x[i] >= 0) {
            d = x[i + k - 1];
        } else if (x[i + k - 1] >= 0) {
            d = x[i + k - 1] - x[i] + min(-x[i], x[i + k - 1]);
        } else {
            d = -x[i];
        }
        if (d < answer) {
            answer = d;
        }
    }
    cout << answer << endl;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < n; i++)
using P = pair<int, int>;
int h, w, n, a, b, c, ans[11], cnt;
vector<P> v;
P temp = P(0,0);
int main(){
	scanf("%d%d%d", &h, &w, &n);
	rep(i,n){
		scanf("%d%d", &a, &b);
		rep(j,3) rep(k,3) if(a+j >= 3 && b+k >= 3 && a+j <= h && b+k <= w)v.push_back(P(a+j,b+k));
	}
	sort(v.begin(), v.end());
	v.push_back(P(1,1));
	for(P it: v){
		if(temp != it){
			ans[c]++; cnt++;
			c = 1;
			temp = it;
		}else c++;
	}
	printf("%lld\n", 1LL*(h-2)*(w-2)-cnt+1);
	rep(i,9) printf("%d\n", ans[i+1]);
}

Measured memory_bytes: 10220
#include<iostream>
#include<fstream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<tuple>
#include<string>
#include<cmath>
using namespace std;

#define REP(i,m,n) for(int i=(m); i<(int)(n); i++)
#define RREP(i,m,n) for(int i=(int)(n-1); i>=m; i--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,0,n)
#define fi first
#define se second

#ifdef _DEBUG
ifstream ifs("input");
#define input ifs
#else
#define input cin
#endif
#define DEBUG(x) cout<<#x<<": "<<x<<endl

using ll = long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;

const double INF = 1e9;

vi G[100010];
int dist[100010];

bool dijk(vi starts){
    priority_queue< pii, vector<pii>, greater<pii> > pq;
    for(int s : starts) pq.push(pii(dist[s], s));

    while(!pq.empty()){
        int u, buf;
        std::tie(buf, u) = pq.top(); pq.pop();
        for(int v : G[u]){
            if(dist[v] == INF){
                dist[v] = dist[u] + 1;
                pq.push(pii(dist[v], v));
            }else if(abs(dist[v]-dist[u]) != 1){
                return false;
            }
        }
    }
    return true;
}

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

    int N, K;
    input >> N;
    fill(dist, dist+N, INF);
    rep(i, N-1){
        int a, b;   
        input >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    vi s;
    input >> K;
    rep(i, K){
        int v, p;
        input >> v >> p;
        v--; p;
        dist[v] = p;
        s.push_back(v);
    }
    if(dijk(s)){
        cout << "Yes" << endl;
        rep(i, N) cout << dist[i] << endl;
    }else{
        cout << "No" << endl;
    }

    return 0;
}


Measured memory_bytes: 8088
#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
using ulli = unsigned long long int;
#define debug(x) cerr << #x << " : " << x << endl

namespace atcoder {
	template<typename T>
	T ncr(T left, T right) {
		right = min(left - right, right);
		T ans = 1;
		for (T i = 1; i <= right; i++) {
			ans = ans * (left - right + i) / i;
		}
		return ans;
	}

	const int LIMIT = 1000000007;
	const int tenfive = 100000;
}

using namespace atcoder;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int N, A, B;
	cin >> N >> A >> B;
	array<int, 3> num = {0,0,0};
	int stk;
	for (int i = 0; i < N; i++) {
		cin >> stk;
		if (stk <= A) {
			num[0]++;
		}
		else if (stk <= B) {
			num[1]++;
		}
		else {
			num[2]++;
		}
	}
	cout << min({ num[0],num[1],num[2] }) << endl;
	return 0;
}

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

int main()
{
	int x,i=1;//x…入力用の変数
	int a[10001] = {};
	while (cin >> x) {
		if (x) {
			a[i] = x;
			i++;
		}else break;
	}
	for (int j = 1; j < i; j++) {
		cout << "Case " << j << ": " << a[j] << endl;
	}
    return 0;
}


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

typedef long long ll;

const int INF = 1e9;
const int MOD = 1e9+7;
const ll LLINF = 1e18;

#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define ANS(n) cout << (n) << endl

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define FORR(i,a,b) for(int i=(a);i>=(b);i--)

#define ALL(obj) (obj).begin(),(obj).end()

#define pii pair<int,int>

#define pb(a) push_back(a)
#define mp make_pair

int main()
{
	string s[3];
	cin >> s[0] >> s[1] >> s[2];
	int cur = 0;
	while(1){
		if(s[cur].empty()){
			ANS((char)('A'+cur));
			return 0;
		}
		int next = s[cur][0] - 'a';
		s[cur].erase(0,1);
		cur = next;
	}
	return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define ull unsigned long long
#define ll long long
#define ld long double
#define PSET(x,y) fixed<<setprecision(y)<<x
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define lop(i,a,b) for(ll i=a;i<b;i++)
#define lopr(i,a,b) for(ll i=a;i>=b;i--)
#define all(v) (v).begin(),(v).end()
#define mp make_pair
#define pb push_back
#define mt make_tuple
#define eb emplace_back
#define ff first
#define ss second
#define pi pair<int,int>
#define pll pair<ll, ll>
#define ti tuple<int,int>
#define tll tuple<ll, ll>
#define si set<int>
#define sll set<ll>
#define maxheap priority_queue<ll>
#define minheap priority_queue<ll,vector<ll>,greater<ll>>
#define state tuple<int,int,int>
#define graph map<ll,list<ll>>

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
const ld PI = asin(1) * 2;
inline int sbt(int x){return __builtin_popcount(x);} //returns number of set bits

using namespace std;

#define TRACE
#ifdef TRACE
#define deb(...) __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 deb(...)
#endif

#define SIZE 0

int main(){
    // clock_t tStart = clock();
    // #ifndef ONLINE_JUDGE
    //     freopen("input.txt", "r", stdin);
    //     freopen("output.txt", "w", stdout);
    // #endif
    
    FastIO
    
    vector<int> vec(5);
    int k;

    lop(i,0,5)
 		cin>>vec[i];   
 	cin>>k;

 	lop(i,0,5)
 		lop(j,i+1,5)
 			if(vec[j]-vec[i] > k){
 				cout<<":(";
 				return 0;
 			}


	cout<<"Yay!";
    // printf("Time taken: %.6fs\n", (double)(clock() - tStart)/CLOCKS_PER_SEC);
    return 0;
}

Measured memory_bytes: 256
w,h,n = map(int,input().split())

x1 = 0
x2 = w
y1 = 0
y2 = h

for i in range(n):
    x,y,a = map(int,input().split())
    if a == 1:
        x1 = max(x1,x)
    elif a == 2:
        x2 = min(x2,x)
    elif a == 3:
        y1 = max(y1,y)
    elif a == 4:
        y2 = min(y2,y)

if x1 >= x2 or y1 >= y2:
    print(0)
else:
    print(abs(x1-x2)*abs(y1-y2))


Measured memory_bytes: 9124
#include<stdio.h>

int main()
{
    int moji, OK=0, OKmax=0;
    int i=0, j=0;
    char s[100]={0};
    char p[100]={0};
//    char *s;
//    char *p;
    
    scanf("%s", &s);
    scanf("%s", &p);
//    int Ssize = sizeof(s)/sizeof(s[0]);
//    int Psize = sizeof(p)/sizeof(p[0]);
    int Ssize, Psize;
    for(Ssize=0; s[Ssize]!='\0'; ++Ssize);//https://webkaru.net/clang/display-string-length/
    for(Psize=0; p[Psize]!='\0'; ++Psize);
//    printf("%d %d\n",Ssize, Psize);

    for(i=0; i<Ssize; i++){    //ズラし
        OK = 0;
        for(j=0; j<Psize; j++){
            if(i+j > Ssize-1){
                if(p[j] == s[(j+i)-Ssize]) OK++;
                //printf("if1 ");
            }else{
                if(p[j] == s[(j+i)]) OK++;
                //printf("if2 ");
            }
            //printf("%d %d %d\n",OK, i,j);
        }
        if(OKmax < OK)OKmax = OK;
    }

    if(OKmax == Psize) printf("Yes\n");
    else printf("No\n");
    
    return 0;
}


Measured memory_bytes: 2100
#include<bits/stdc++.h>
using namespace std;
using ll = long long; 
using ull = unsigned long long;
using V = vector<int>;
using VV = vector<vector<int>>;
using VVV = vector<vector<vector<int>>>;
using VL = vector<ll>;
using VVL = vector<vector<ll>>;
using VVVL = vector<vector<vector<ll>>>;
template<class T> using pq = priority_queue<T>;
template<class T> using P = pair<T, T>;
#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,k,n) for(int i=(k);i<(n);i++)
#define all(a) (a).begin(),(a).end()
#define output(x,y) cout << fixed << setprecision(y) << x << endl;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
const ll MOD = 1e9 + 7;
const ll BetsuMOD = 998244353;
ll upper = MOD + MOD;
ll under = -upper;
ll UPPER = MOD * MOD;
ll UNDER = -UPPER;
const long double pi = 3.141592653589793;
ll Ceil(ll a, ll b) {
	return (a + b - 1) / b;
}
int main() { // 問題文はしっかり読め!!!
	int n;
	cin >> n;
	V t(n), a(n);
	rep(i, n) {
		cin >> t[i] >> a[i];
	}
	ll T = 1, A = 1;
	rep(i, n) { // 次にあり得る得票数は、n*t[i]>=Tかつn*a[i]>=Aになるようなnがあり得る
		ll mul = max(Ceil(T, t[i]), Ceil(A, a[i]));
		T = t[i] * mul;
		A = a[i] * mul;
	}
	cout << T + A << endl;
	return 0;
}

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

#define rep(i,n) for(int i=0; i<(n); i++)
#define reps(i,x,n) for(int i=x; i<(n); i++)
#define rrep(i,n) for(int i=(n)-1; i>=0; i--)
#define all(X) (X).begin(),(X).end()
#define X first
#define Y second
#define pb push_back
#define eb emplace_back

using namespace std;
typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

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 (a>b) { a=b; return 1; } return 0; }

template<class A, size_t N, class T> void Fill(A (&a)[N], const T &v){ fill( (T*)a, (T*)(a+N), v ); }

template<class T> ostream& operator<<(ostream &os, const vector<T> &t) {os<<"{"; rep(i,t.size()) {os<<t[i]<<",";} os<<"}"; return os;}
template<class T,size_t n> ostream& operator<<(ostream &os, const array<T,n> &t) {os<<"{"; rep(i,n) {os<<t[i]<<",";} os<<"}"; return os;}
template<class S, class T> ostream& operator<<(ostream &os, const pair<S,T> &t) { return os<<"("<<t.first<<","<<t.second<<")";}

const ll INF = 1e9+7;


int main(){
	ios_base::sync_with_stdio(false);
	int X;
	ll ans = 0;

	cin >> X;

	ans += (X / 500) * 1000;
	ans += ((X % 500) / 5) * 5;

	cout << ans << endl;

	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <stack>
#include <algorithm>
#include <numeric>
#include <unordered_map>
#include <cmath>
#include <iomanip>

using namespace std;

int main() {
    int N, M;

    cin >> N >> M;

    if(N==M)
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;

    return 0;
}

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

using namespace std;
typedef long long ll;

struct node{
    int id;
    ll dp;
};

struct edge{
    int des;
    ll w;
};

int n,m;
vector <edge> adj[100007];
ll Min[100007];
bool mark[100007];

bool operator<(node a,node b)
{
        return a.dp>=b.dp;
}


void prim(int u)
{
    fill(Min,Min+100007,1e11);
    Min[u]=0;
    node nd;
    nd.id=u;
    nd.dp=0;

    priority_queue <node> q;
    q.push(nd);

    while(q.size()>0)
    {
        nd=q.top();
        q.pop();
        if(mark[nd.id])
            continue;
        mark[nd.id]=1;
        int u=nd.id;

        for(int i=0;i<adj[u].size();i++)
        {
            int v=adj[u][i].des;
            int val=adj[u][i].w;

            if(Min[v]<=val+nd.dp)
                continue;
            Min[v]=val+nd.dp;
            node nn;
            nn.id=v;
            nn.dp=val+nd.dp;
            q.push(nn);
        }
    }
}

int main()
{
    int u;
    cin>>n>>m>>u;
    for(int i=0;i<m;i++)
    {
        int x,y;
        edge e;
        cin>>x>>y>>e.w;
        e.des=y;
        adj[x].push_back(e);
    }
    prim(u);
    for(int i=0;i<n;i++)
        {
            if(Min[i]<1e11)
                cout<<Min[i]<<endl;
            else
                cout<<"INF"<<endl;
        }
}

Measured memory_bytes: 17844
#include"bits/stdc++.h"
#include<math.h>
#include<vector>
#include<algorithm>
using namespace std;
int64_t i,j,k,l;//preparation for
int gcd(int a,int b){
    int g;

    while(a!=b){
        if(a>b){
            a-=b;
        }
        else{
            b-=a;
        }
    }

    return a;
    
}
int main(){
    int x,k,g;
    cin>>x;
    g=gcd(360,x);
    k=360/g;
    cout<<k;
    
    return 0;
}

Measured memory_bytes: 3632
//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (int)(n);i++)
using ll = long long;
const ll MOD=1000000007;
//const ll MOD=998244353;
const long long INF = 1LL << 60;
const double pi=acos(-1.0);

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



int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  // cout << fixed << setprecision(15);
  
  string S; cin>>S;
  for(auto cha:S) if(cha=='7') {cout<<"Yes"<<endl; return 0;}
  cout<<"No"<<endl;
  return 0;
}


Measured memory_bytes: 3640
#include <bits/stdc++.h>
#define Max 100000
using namespace std;
typedef long long ll;

/* short */
#define pb push_back
#define mp make_pair
#define Fi first
#define Se second
#define ALL(v) begin(v), end(v)
#define RALL(v) rbegin(v), rend(v)

/* REPmacro */
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define REP(i, n) for(int i = 0; i < (n); i++)
#define EACH(begin, end) for(auto itr = (begin); itr != (end); itr++)

/* function */
#define in(x) cin >> x
#define DEBUG(x) cerr << (x) << " "
#define PRINT(x) cout << (x) << endl
#define BR cout << endl

/* const */
const int INF = 1001001001; // 10^9
const ll LINF = 1001001001001001001; // 10^18
const int MOD = 1e9 + 7;



ll N = 0;
double ret = 0;
vector<pair<double,string>> v;

void input() {
  in(N);
  double a;
  string b;
  pair<double, string> p;
  REP(i,N){
    in(a);
    in(b);
    p = make_pair(a, b);
    v.push_back(p);
  }
}

void solve() {
  REP(i,N){
    double price = v[i].first;
    // DEBUG(i);
    if(v[i].second == "BTC") {
      price *= 380000;
    }
    ret += price;
  }
}

int main(void){
  input();
  solve();
  PRINT(ret);
}


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

using ll = long long;

const int INF = 1001001001;
const ll INF_LL = 1001001001001001001LL;

int main(void){
  string w; cin >> w;
  map<char,int> mp;

  rep(i,w.size()) mp[w[i]]++;

  bool even = true;
  for(auto x : mp){    
    if(x.second % 2 != 0) even = false;
  }
  
  if(even) cout << "Yes" << endl;
  else cout << "No" << endl;
  
  return 0;
}


Measured memory_bytes: 3640
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <math.h>
#include <limits.h>

//最大値を求める。
int max(int x,int y){
    if(x > y) return x;
    return y;
}
//最小値を求める
int min(int x,int y){
    if(x > y)return x;
    return y;
}

//各桁の和を求める。
int wa(int a){
    int sum;
    int dig;
    for(;;){
        dig = a % 10;
        sum += dig;
        a = a / 10;
        if(a == 0) break;
    }
    return sum;
}

//バブルソート（降べきの順）
void bsort(int a[],int n){
    int i,j,tmp;
    for(i = 0;i < n;i++){
        for(j = i+1;j<n;j++){
            if(a[i]<a[j]){
                tmp = a[j];
                a[j] = a[i];
                a[i]= tmp;
            }
        }
    }
}

//最大公約数を求める
int gcd(int x,int y){
    int c;
    for(;;){
        c = x % y;
        if(c == 0)return y;
        x = y;
        y = c;
    }
}

int main(void){
    int n;
    int a,b;
    scanf("%d",&n);
    if(n == 1){
    printf("Hello World\n");
    return 0;
    }else {
        scanf("%d %d",&a,&b);
    printf("%d\n",a+b);
    }    
    return 0;
}

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

# define ll long long

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n;
    cin>>n;
    ll ar[n];

    for(ll i=0;i<n;i++){
        cin>>ar[i];
    }
    ll temp=0;
    for(ll i=0;i<n/2;i++){
        temp^=ar[i]^ar[n-i-1];
    }
    for(ll i=0;i<n;i++){
//        cout<<temp^ar[i]<<endl;
        ll temp1=temp^ar[i];
        cout<<temp1<<" ";
    }
}


Measured memory_bytes: 5176
k, n = gets.split(" ").map(&:to_i)
a = gets.split(" ").map(&:to_i)
max = 0
argmax = nil
n.times do |i|
  nxt = (i == n - 1) ? a[0] + k : a[i+1]
  if nxt - a[i] > max
    max = nxt - a[i]
    argmax = [i, nxt]
  end
end
x, y = argmax
puts k - max

Measured memory_bytes: 17412
#include <bits/stdc++.h>
 
#define REP(i, a, b) for (int i = (int)a; i <= (int)b; i++)
#define fi first
#define sc second
#define pb push_back
#define double long double
#define all(x) x.begin(), x.end()
 
using namespace std;
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pair<int, int>> vpii;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<int, int> pii;
typedef pair<i64, i64> pi64;
typedef vector<pi64> vpi64;
 
const i64 MOD = 1000000007;
const i64 INF = 2e15;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
                        
   	int a, b;
   	cin >> a >> b;

    cout << max(a+b, max(a-b, a*b)) << endl;

    return 0;
}

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

using namespace std;

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

    int N;
    cin >> N;
    int len = (1 << N);
    vector<int> S(len);
    multiset<int> todo;
    for (int i = 0; i < len; ++i) {
        cin >> S[i];
        todo.insert(S[i]);
    }
    vector<int> act;
    auto it = --end(todo);
    act.push_back(*it);
    todo.erase(it);

    for (int i = 0; i < N; ++i) {
        int m = act.size();
        for (int j = 0; j < m; ++j) {
            it = todo.lower_bound(act[j]);
            if (it == begin(todo)) {
                cout << "No\n";
                return 0;
            }
            --it;
            act.push_back(*it);
            todo.erase(it);
        }
        //sort(begin(act), end(act));
        //reverse(begin(act), end(act));
    }
    cout << "Yes\n";

    return 0;
}

Measured memory_bytes: 14712
#pragma GCC optimize("O3")
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("unroll-loops")

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds; 

#define int long long
#define pb push_back
#define pf push_front
#define eb emplace_back
#define mp make_pair
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v).rend()
#define f first
#define s second
#define sz(x) (int)x.size()
#define endl "\n"
#define forn(i,n) for(int i=0;i<n;++i)
#define fore(i,l,r) for(int i=int(l);i<=int(r);++i)
#define rep(i,begin,end) for(__typeof(end) i=(begin);i!=(end);i++)
#define fill(a,value) memset(a,value,sizeof(a));
#define gcd(a,b) __gcd((a),(b))
#define watch1(x) cout<<(x)<<endl
#define watch2(x,y) cout<<(x)<<" "<<(y)<<endl
#define watch3(x,y,z) cout<<(x)<<" "<<(y)<<" "<<(z)<<endl
#define fastio ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);

typedef long long ll;
typedef long double ld; 
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<pii> vpii;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> oset;

const int INF = 9e18;
const int mod = 1e9 + 7;
const int N = 2e5 + 5;

int i,n,k,a[N],f[N],coeff[N];

bool check(int mid)
{
    for(i=1;i<=n;++i)
    {
        coeff[i]=mid/f[i];
    }
    sort(coeff+1,coeff+n+1);
    int req=0;
    for(i=1;i<=n;++i)
    {
        req+=max(0LL,a[i]-coeff[i]);
    }
    return req<=k;
}

void solve()
{
    cin>>n>>k;
    for(i=1;i<=n;++i)
    {
        cin>>a[i];
    }
    sort(a+1,a+n+1);
    for(i=1;i<=n;++i)
    {
        cin>>f[i];
    }
    int lo=0,hi=1e12;
    while(lo<hi)
    {
        int mid=(lo+hi)/2;
        if(check(mid))
            hi=mid;
        else
            lo=mid+1;
    }
    cout<<lo;
}

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

Measured memory_bytes: 4992
/*siddharth goyal*/
#include<bits/stdc++.h>
using namespace std;
#define   pb              push_back
#define   REP(i,n)        for(i=1;i<=n;i++)
#define   FOR(i,a,b)      for(i=a;i<=b;i++)
#define   all(v)          v.begin(),v.end()
#define   F               first
#define   S               second
#define   vl              vector<LL>
#define   itr             ::iterator it
#define   lb              lower_bound
#define   ub              upper_bound
#define   LL              long long
#define   ULL             unsigned long long
LL n,i,j,ans = 0;
LL A,B,K ; 
int main()
{   // Read the constraints,highlights,Time Limit,Test Cases
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin>>A>>B>>K ;

    REP(i,K)
    { if(i%2)
      {  if(A%2) A-- ; 
         B += A/2 ; 
         A = A/2 ;  
      }  
      else
      { if(B%2) B-- ; 
        A += B/2 ; 
        B = B/2 ; 

      }

    } 
    cout<<A<<" "<<B ; 
}
//Check for 0,1 and other corner cases.

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

using namespace std;

using ll = long long;

template<typename T> using V = std::vector<T>;
using Vi = V<int>;
using VVi = V<V<int>>;
using Vl = V<ll>;
using VVl = V<V<ll>>;
using Vs = V<string>;

template<typename T1, typename T2> using P = std::pair<T1, T2>;
using Pii = P<int, int>;
using Pll = P<ll, ll>;
using Pdd = P<double, double>;

template<typename T1, typename T2> using M = std::map<T1, T2>;
using Mii = M<int, int>;
using Msi = M<string, int>;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

const double PI = acos(-1);
const ll MOD = 1e9+7;

int n, m;
string s;

int main() {
    cin >> n;

    V<Pii> v(n);
    REP(i, n) {
        int x, l;
        cin >> x >> l;
        v[i] = {x, l};
    }

    sort(ALL(v), [](const Pii &a, const Pii &b) {
        if (a.first + a.second == b.first + b.second) {
            return a.first < b.first;
        }
        return a.first + a.second < b.first + b.second;
    });

    int right = -2e9;
    int res = 0;
    FOR(i, v) {
        if (i->first - i->second >= right) {
            res++;
            right = i->first + i->second;
        }
    }

    std::cout << res << '\n';

    return 0;
}


Measured memory_bytes: 1024
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef  long long ll;
typedef  vector<int> vi;
typedef  pair<int,int> pii;
typedef  pair<int,string> pis;
double   pi=3.1415926535898;
#define speed      ios::sync_with_stdio(false);cin.tie(NULL); cout.tie(NULL);
#define lp(i,n)   for(int i=0;i<int(n);i++)
#define ff(i,a,b)  for(int i=a;i<=int(b);++i)
#define rng(i,a,b) for(int i=a;i>=int(b);i--)
#define ms(x,a)    memset(x,a,sizeof(x))
#define all(x)     (x).begin(),(x).end()
#define sz(x)      int(x.size())
#define pb         push_back
#define r0         return 0;
#define CC         continue;
#define bb(x)      cerr<< x <<endl;
#define F          first
#define S          second       //  __builtin_popcount;
//freopen("input.txt","r",stdin),freopen("output.txt","w",stdout);
const ll M  = 1e9+7 ;
//const int N = 111;
const int inf = 2e9+7;
const double EPS = 1e-9;
//////////////////////    Hi    ^_^  hack me if you can :P
string ys = "YES\n";
string no = "NO\n" ;


int main()
{
    speed;
    int n,m;
    cin >>n>>m;
    n--;
    m--;
    cout << n*m<<endl;

    return 0;
}

Measured memory_bytes: 256
from math import factorial
from itertools import permutations

n = int(input())
x, y = [0] * n, [0] * n
for i in range(n):
    x[i], y[i] = map(int, input().split())

dist_sum = 0
for route in permutations(range(n), n):
    for j in range(1, n):
        dist = (x[route[j]] - x[route[j - 1]]) ** 2
        dist += (y[route[j]] - y[route[j - 1]]) ** 2
        dist = dist ** 0.5
        dist_sum += dist
ans = dist_sum / factorial(n)
print(ans)


Measured memory_bytes: 40684
#include<iostream>
#include<algorithm>
#include<utility>
#include<vector>
#include<cmath>
using namespace std;

typedef pair<int, int> P;
typedef long long ll;
const int INF = 100000000;

ll gcd( ll a, ll b ){//最大公約数
    ll tmp;
    if( a < b ) { tmp = a; a = b; b = tmp; }
    if( b < 1 ) return -1;

    if( a % b == 0 ) return b;
    return gcd( b, a % b );
}

ll lcm(ll a, ll b){//最小公倍数
    return a * b / gcd(a, b);
}


//入力

int main(){

    int a, b, c;
    cin >> a >> b >> c;

    if(a+b+c >= 22){
        cout << "bust" << endl;
    }
    else{
        cout << "win" << endl;
    }

    return 0;
}

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

using ll = int64_t;
#define int ll

#define FOR(i, a, b) for (int i = int(a); i < int(b); i++)
#define REP(i, b) FOR(i, 0, b)
#define MP make_pair
#define PB push_back
#define EB emplace_back
#define ALL(x) x.begin(), x.end()

using pi = pair<int, int>;
using vi = vector<int>;
using ld = long double;

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

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

ll read() {
  ll i;
  scanf("%" SCNd64, &i);
  return i;
}

void printSpace() { printf(" "); }

void printEoln() { printf("\n"); }

void print(ll x, int suc = 1) {
  printf("%" PRId64, x);
  if (suc == 1)
    printEoln();
  if (suc == 2)
    printSpace();
}

string readString() {
  static char buf[3341000];
  scanf("%s", buf);
  return string(buf);
}

char *readCharArray() {
  static char buf[3341000];
  static int bufUsed = 0;
  char *ret = buf + bufUsed;
  scanf("%s", ret);
  bufUsed += strlen(ret) + 1;
  return ret;
}

template <class T, class U> void chmax(T &a, U b) {
  if (a < b)
    a = b;
}

template <class T, class U> void chmin(T &a, U b) {
  if (b < a)
    a = b;
}

template <class T> T Sq(const T &t) { return t * t; }

const int mod = 1e9 + 7;

signed main() {
  string o, e;
  std::cin >> o >> e;
  int oi = 0, ei = 0;
  REP(i, o.size() + e.size()) {
    if (i & 1)
      std::cout << e[oi++];
    else
      std::cout << o[ei++];
  }
}

Measured memory_bytes: 256
#include<algorithm>
#include<stack>
#include<ctime>
#include<cstring>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<cstdio>
#include<queue>
using namespace std;
inline int read(){
	int num=0,f=1;char x=getchar();
	while(x<'0'||x>'9'){if(x=='-')f=-1;x=getchar();}
	while(x>='0'&&x<='9'){num=num*10+x-'0';x=getchar();}
	return num*f;
}
const int maxn=200005;
struct line{
	int p,len;
}l[maxn];
vector<string> str;
int n;
bool cmp(line a,line b){
	return a.len<b.len;
}
struct trie{
	int ch[26],num[26];
}tr[1000005];
int bag[26],root,cnt;
#define ll long long 
ll ans;
string a;
void query(int x,int p){
	if(!x||p==-1)return;
	for(int i=0;i<26;++i)
		if(bag[i]&&tr[x].num[i])ans+=tr[x].num[i];
	--bag[a[p]-'a'];
	query(tr[x].ch[a[p]-'a'],p-1);	
}
void ins(int &x,int p){
	if(!x)x=++cnt;
	if(p==0){++tr[x].num[a[p]-'a'];return;}
	ins(tr[x].ch[a[p]-'a'],p-1);
}
int main(){
	n=read();
	for(int i=0;i<n;++i){
		cin>>a;
		l[i].p=i;l[i].len=a.length();
		str.push_back(a);
	}
	sort(l,l+n,cmp);
	for(int i=0;i<n;++i){
		a=str[l[i].p];
		memset(bag,0,sizeof bag);
		int len=l[i].len;
		for(int j=0;j<len;++j)++bag[a[j]-'a'];
		query(root,len-1);
		ins(root,len-1);
	}
	printf("%lld",ans);
	return 0;
}


Measured memory_bytes: 207344
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<functional>
#include<limits>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

#define MOD 1000000007
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3fLL

int main() {
	int s, a;
	for (int N, M, P; cin >> N >> M >> P&&N;) {
		s = 0;
		for (int i = 1; i <= N; i++) {
			int X; cin >> X;
			s += X;
			if (i == M)	a = X;
		}
		cout << (a ? s*(100 - P) / a : 0) << endl;
	}
	return 0;
}

Measured memory_bytes: 1160
from collections import Counter

N = int(input())
S = [input() for _ in range(N)]
M = int(input())
T = [input() for _ in range(M)]

S_cnt = Counter(S)
S_key = S_cnt.keys()
T_cnt = Counter(T)

for key,v in T_cnt.items():
    if not key in S_key:
        continue
    S_cnt[key] -= v
print(max(max(S_cnt.values()), 0))

Measured memory_bytes: 3316
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;

const int maxn = 1e5 + 10;
ll n , a , b , arr[maxn];

bool can(ll x)
{
	vector < ll > v;
	for(int i=0;i<n;i++)
	{
		if(arr[i] <= b * x) continue;
		v.push_back(arr[i] - b * x);
	}
	ll ch = a - b;
	for(int i=0;i<v.size();i++)
	{
		x -= ceil((double)v[i] / (double)ch);
	}
	return x >= 0;
}

int main()
{
	ios_base::sync_with_stdio(0); cin.tie(NULL);
	cin >> n >> a >> b;
	for(int i=0;i<n;i++) cin >> arr[i];
	ll low = 1 , high = 1e9 + 1 , mid , ans = -123456;
	while(high >= low)
	{
		mid = (high + low) / 2;
		if(can(mid))
		{
			ans = mid;
			high = mid - 1;
		}
		else low = mid + 1;
	}
	cout << ans << endl;
}

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

using namespace std;

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

inline int toInt(string s) {int v; istringstream sin(s);sin>>v; return v;}

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector< vector<int> > Mat;
typedef tuple<int, int, int, int> T;

const int MOD = (int)1e9+7;
const int INF = (int)1e9;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

int main(){
    int n, m;
    cin >> n >> m;
    int a[1000], b[1000], c[1000], dist[100][100];
    for(int i = 0; i < m; i++){
        cin >> a[i] >> b[i] >> c[i];
        a[i]--;
        b[i]--;
    }

    for(int i = 0; i < n; i++){
        for(int j = 0; j < n; j++){
            if(i == j) dist[i][j] = 0;
            else dist[i][j] = INF;
        }
    }

    for(int i = 0; i < m; i++){
        dist[a[i]][b[i]] = min(dist[a[i]][b[i]], c[i]);
        dist[b[i]][a[i]] = min(dist[b[i]][a[i]], c[i]);
    }

    for(int k = 0; k < n; k++){
        for(int i = 0; i < n; i++){
            for(int j = 0; j < n; j++){
                dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j]);
            }
        }
    }

    int ans = m;
    for(int i = 0; i < m; i++){
        bool shortest = false;
        for(int j = 0; j < n; j++){
            if( dist[j][a[i]] + c[i] == dist[j][b[i]] ) shortest = true;
        }
        if(shortest == true) ans--;
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
/*
	f[i][j] = max(f[i - 1][j], f[i][j - 1]) + arr[i][j] 
*/
#include <iostream>

using namespace std;

int arr[5][105];
int n;
int f[5][105];

int main() {
	cin >> n;
	for (int i = 1; i <= 2; i ++)
		for (int j = 1; j <= n; j ++)
			cin >> arr[i][j];
	for (int i = 1; i <= 2; i ++)
		for (int j = 1; j <= n; j ++) {
			int s = max(f[i - 1][j], f[i][j - 1]) + arr[i][j];
			if (s > f[i][j])
				f[i][j] = s;
		}
	cout << f[2][n] << endl;

	return 0;
}

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

using namespace std;

int n, h[100000], dp[100000];

int main() {
	scanf("%d", &n);
	
	for(int i = 0; i < n; i++) {
		scanf("%d", &h[i]);
		dp[i] = INT_MAX;
	}
	dp[0] = 0;
	for(int i = 0; i < n - 1; i++) {
		dp[i + 1] = min(dp[i + 1], dp[i] + abs(h[i] - h[i + 1]));
		// printf("dp[i+1] = %d (where i = %d)\n", dp[i + 1], i);
		if(i + 2 < n) {
			dp[i + 2] = min(dp[i + 2], dp[i] + abs(h[i] - h[i + 2]));
			// printf("dp[i+2] = %d (where i = %d)\n", dp[i + 2], i);
		}
		//printf("\n");
	}
	printf("%d", dp[n-1]);
}


Measured memory_bytes: 1024
#include <bits/stdc++.h>
#define rep(i, N) for (int i=0; i<(int)N; i++)
#define rep1(i, N) for (int i=1; i<(int)N; i++)

using namespace std;

int n;

int main() {
  cin >> n;
  cout << n*n*n << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
#define inf LLONG_MAX
#define bp __builtin_popcountll
#define pb push_back
#define ff first
#define ss second
#define P pair<ll,ll>
#define N 100001
#define all(a) a.begin(),a.end()
#define LG 20
#define int ll
#define nl '\n'
#define vi vector<int>
#define mod 1000000007
#define fast ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ps(x,y)



signed main(){
    fast;
    int h,w;
    cin>>h>>w;
    vector<vector<int>> vec(h,vector<int> (w));
    vector<vector<char>> input(h,vector<char> (w));
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++) cin>>input[i][j];
    }
//    char curr;
    bool flag=false;
    for(int i=0;i<w;i++){
        if(input[0][i]=='#')  flag=true;
        if(!flag) vec[0][i]=1;
        else vec[0][i]=0;
    }
    flag=false;
    for(int i=0;i<h;i++){
        if(input[i][0]=='#')  flag=true;
        if(!flag) vec[i][0]=1;
        else vec[i][0]=0;
    }
    for(int i=1;i<h;i++){
        for(int j=1;j<w;j++){
            if(input[i][j]=='.') vec[i][j]=(vec[i][j-1] + vec[i-1][j])%mod;
            else vec[i][j]=0;
        }
    }
    cout<<vec[h-1][w-1];
}

Measured memory_bytes: 9088
#define _CRT_SECURE_NO_DEPRECATE
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
//using namespace __gnu_pbds;
#define int long long int
#define SYNC std::ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define FRE freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
typedef long double ld;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<int> vi;
typedef vector<ii>   vii;
//typedef tree<int, null_type, less<int>, rb_tree_tag, 
//             tree_order_statistics_node_update> 
//    data_set;
#define rep(i,l,r)   for(int i=(l);i<(r);i++)
#define deb(x)     cout << (#x) << " = " << (x) << endl
#define here cout << " Hey!!\n";
#define  pb push_back
#define  F  first
#define  S  second
#define all(v) (v).begin(),(v).end()
#define sz(a) (int)((a).size())
#define sq(x) ((x)*(x))
const int MOD = 1e9+7;
const int MOD1 = 998244353;
const int N = 2e5+5;
const int INF = 1000111000111000111LL;
const ld EPS = 1e-12;
const ld PI = 3.141592653589793116;
 
int32_t main()
{
	SYNC
	int n; cin >> n;
	vi d(n+1);
	for(auto &it : d)	cin >> it;
	vi node(n+1);
	node[0] = 1-d[0];
	if(node[0] < 0)	return cout << -1,0;
	for(int i = 1; i <= n; i++) {
		node[i] = 2*node[i-1] - d[i];
		node[i] = min(node[i],(int)1e16);
		if(node[i] < 0)	return cout << -1,0;
	}
	// for(auto it : node)	cout << it << ' ';
	// cout << endl;
	int ans = d[n];
	int child = d[n];
	for(int i = n-1; i >= 0; i--) {
		int to_add = min(node[i]+d[i],child+d[i]);
		ans += to_add;
		child = to_add;
		// deb(to_add);
	}
	cout << ans;
	return 0;
}

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

#define int             long long
#define	ll				long long

#define	mod 			1000000007
#define	inf 			1000000000000000
#define infty			1000000000000000000LL
#define	md				998244353
#define	PI				acos(-1.0)
#define	endl 			"\n"
#define	rr				return
#define	br				cout<<"\n";
long long prime[1000000];

void sieve()
{
	prime[0]=0;
	prime[1]=0;
	for(int i=2;i<1000000;i++)
		prime[i]=1;

	for(int i=2;i*i<1000000;i++)
		if(prime[i]==1)
			for(int j=i*i;j<1000000;j+=i)
				prime[j]=0;
}

bool isPrime(int n)
{
    if (n <= 1)
        return false;
    for (ll i = 2; i <= floor(sqrt(n)); i++)
        if (n % i == 0)
            return false;

    return true;
}

int factorial(int n)
{
    int f=1;
    for(int i = 1;i<=n ; i++)
        f = (f*i)%mod;
    return f;
}

int gcd(int a, int b)
{
	return !b ? a : gcd(b, a % b);
}

int lcm(int a, int b)
{
	return (a / gcd(a, b)) * b;
}

int fastExponentiation(int n, int x, int modulo)
{
	int res = 1;
	while(x > 0)
       {
          if(x & 1)
          res = (res*n) % modulo;
          x = x >> 1;
          n = (n * n) % modulo;
       }
       return res;
}

int power(int n , int p )
{
	if(p==0)
	   return 1;

	 int res = power((n*n)%mod,p/2);
	 if(p%2==1)
	   res = (n*res)%mod;

	   	 return res;
}

bool isPowerOfTwo(int n)
{
   	return n && (!(n&(n-1)));
}

bool isSet(int n,int i)
{
	// To check if ith bit is set or not in binary representation of n
   	return n & (1 << i);
}

bool valid_coordinate(ll x,ll y,ll n,ll m)
{
    if(x<0 || y<0)
       return false;

   	else if(x>=n || y>=m)
       return false;

   	else
   		return true;
}

int sod(int n)
{
	int sum=0;
	while(n)
	{
		sum+=(n%10);
		n/=10;
	}
	return sum;
}



void solve()
{
	int a;
	cin>>a;
	int count=a+(a*a)+(a*a*a);
	cout<<count<<endl;
}

int32_t main()
{

	//int t; cin>>t; while(t--)
	solve();

	return 0;
}


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

int main()
{
    int n;
    scanf("%d",&n);
    int f=1;
    while(n--)
    {
        int x;
        scanf("%d",&x);
        if(x%2==0)
        {
            if(x%3!=0&&x%5!=0)f=0;
        }
    }
    if(f)printf("APPROVED");
    else printf("DENIED");
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
int main() {
  int x1,y1,x2,y2,x3,y3,x4,y4,len;
  cin>>x1>>y1>>x2>>y2;
  x3=x2-(y2-y1);
  y3=y2+(x2-x1);
  x4=x1-(y2-y1);
  y4=y1+(x2-x1);
  cout<<x3<<" "<<y3<<" "<<x4<<" "<<y4<<endl;  
}


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

typedef long long ll;

#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define file() freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);
#define tt int tc; cin>>tc; while(tc--)
#define nl cout<<"\n";
#define sp cout<<" ";
#define rep(i, a, b) for(long long i=a; i<b; i++)

const int INF = 1e9 + 7;
const int MOD = 1e9 + 7;
double PI = 4*atan(1);

int main()
{
    optimize();

    int n, x, i, t, s=0;
    cin>> n>> x;


    for( i=0; i<n; i++)
    {
        cin>> t;
        s+= t;

        if( x<s)
        {
            cout << i+1;
            nl;
            return 0;
        }
    }

    cout << n+1;
    nl;

    return 0;
}




Measured memory_bytes: 3492
n = int(input())
array = []
for i in range(n):
    array.append(int(input()))
array = sorted(array)
under_mochi = array[-1]

cnt = 1
array_mochi = reversed(array[:-1])
for j in array_mochi:

    if under_mochi > j:
        cnt += 1
        under_mochi = j
print(cnt)


Measured memory_bytes: 3060
#include <stdio.h>

int main()
{
    short a,b;
    
    scanf("%d %d",&a,&b);
    if(a > b)
    {
        printf("a > b\n");
    }
    else if(a < b)
    {
        printf("a < b\n");
    }
    else
    {
        printf("a == b\n");
    }
}


Measured memory_bytes: 2108
M, K = map(int, input().split())

max_val = 2 ** M

ans = []
if K < max_val:
    if M == 0:
        ans = [0, 0]
    elif M == 1:
        if K == 0:
            ans = [0, 0, 1, 1]
        else:
            ans = [-1]
    else:
        for i in range(max_val):
            if i != K:
                ans.append(i)
        ans.append(K)
        for i in range(max_val-1, -1, -1):
            if i != K:
                ans.append(i)
        ans.append(K)
else:
    ans = [-1]
print(*ans)


Measured memory_bytes: 19380