akhauriyash/Code-Regression huggingface dataset:
/**
*
* Author: Mouhanad
* Lang: GNU C++14
*
**/
#include<bits/stdc++.h>
using namespace std;

#define F first
#define S second
#define ii pair < int , int >
#define LS pair < ll , string >
typedef long long ll;
const int inf = 1<<30;
const int N =100100;
int n , a[N] , q ;
vector < char > ANS ;
bool bk (int i , int sum ){
if ( i == 4 ){
 return sum == 7 ;
}
bool ret = 0 ;
 ret |= bk(i+1,sum+a[i]);
 if ( ret ){
    ANS.push_back('+');
    return ret ;
 }
ret |= bk(i+1,sum-a[i]);
 if ( ret ){
    ANS.push_back('-');
    return ret ;
 }
return ret ;
}
int main ( ){
    string s ;
    cin >> s;
 a[0] = s[0]-'0' ;
 a[1] = s[1]-'0' ;
 a[2] = s[2]-'0' ;
 a[3] = s[3]-'0' ;
bk(1,a[0]);
reverse(ANS.begin(),ANS.end());
cout << a[0] << ANS[0] <<a[1] <<ANS[1] <<a[2] <<ANS[2] << a[3] <<"=7\n";
return 0 ;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <random>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
//#define cerr if(false) cerr
#define show(...) cerr << #__VA_ARGS__ << " = ", debug(__VA_ARGS__);
using namespace std;
using ll = long long;
using pii = pair<int,int>;
template<typename T, typename S>
ostream &operator<<(ostream &os, pair<T, S> a){
    os << '(' << a.first << ',' << a.second << ')';
    return os;
}
template<typename T>
ostream &operator<<(ostream &os, vector<T> v){
    for(auto x:v)os << x << ' ';
    return os;
}
void debug(){cerr << '\n';}
template<typename H, typename... T>
void debug(H a, T... b){
    cerr << a;
    if(sizeof...(b))cerr << ", ";
    debug(b...);
}
int main(){
    int x,y,z,k;
    cin >> x >> y >> z >> k;
    vector<ll>a(x),b(y),c(z);
    rep(i,x)cin >> a[i];
    rep(i,y)cin >> b[i];
    rep(i,z)cin >> c[i];
    multiset<ll> st;
    rep(i,x){
        rep(j,y){
            st.insert(a[i] + b[j]);
            if(st.size() > k){
                st.erase(st.begin());
            }
        }
    }
    multiset<ll>st2;
    rep(i,z){
        for(auto x : st){
            st2.insert(x + c[i]);
            if(st2.size() > k){
                st2.erase(st2.begin());
            }
        }
    }
    auto it = st2.end();
    rep(i, st2.size()){
        it--;
        cout << *it << "\n";
    }
}

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

typedef long long lli;

bool check(vector<int> v) {
    lli sum = 0;

    for(int i : v)
        sum += i;

    cout << endl << sum << endl;

    for(int i : v) {
        if(__gcd(lli(i), sum - i) <= 1) {
            cout << i << " --- " << sum - i << endl;
            return false;
        }
    }

    return true;
}

bool used[50000];

int main() {
    int n, m, k;

//    cout << check({2, 4, 6, 3, 9});

    cin >> n;

    if(n == 3) {
        cout << "2 5 63\n";
    } else if(n == 4) {
        cout << "2 5 20 63\n";
    } else if(n <= 100) {
        vector<int> v;

        v.push_back(2);
        v.push_back(4);
        v.push_back(3);
        v.push_back(6);
        v.push_back(9);

        for(int i = 0; i < n - 5; i++) {
            v.push_back(12 + i * 6);
        }

//        cout << check(v) << endl;

        for(int i : v) {
            cout << i << " ";
        }
        cout << endl;
    } else {
        m = (5 - n % 5) % 5;
        n += m;
        k = n / 5;

        if(k % 2) {
//            cout << "been here " << m << endl;
            m += 5;
            n += 5;
            k++;
        }

        int cnt = 0, base;

        lli sum1 = 0, sum2 = 0;
        int mx = 0, joj = 0;

        vector<int> v;

        for(int i = 0, base = 3; i < 2 * k; i++) {
            while(used[base + i * 3]) {
                base += 3;
            }

            if(cnt < 2000 - (m == 0) * 0) {
                if((base + i * 3) % 2 == 0) {
                    cnt++;
                    base += 3;
                }
            }

            used[base + i * 3] = true;
            v.push_back(base + i * 3);
            sum1 += base + i * 3;
            mx = max(mx, base + i * 3);
        }

        for(int i = 0, base = 2; i < 3 * k; i++) {
            while(used[base + i * 2]) {
                base += 2;
            }

            used[base + i * 2] = true;
            v.push_back(base + i * 2);
            mx = max(mx, base + i * 2);
            sum2 += base + i * 2;
        }

//        cout << v.size() << endl;
//        for(int i : v) {
//            cout << i << " ";
//        }
//        cout << endl;
//
//        cout << m << endl;

        for(int i = 0; m > 0 && i < v.size(); i++) {
            if(v[i] % 6 == 0) {
                v.erase(v.begin() + i);
                m--;
                i--;
            }
        }

        for(int i : v) {
            cout << i << " ";
        }
        cout << endl;

//        cout << v.size() << endl;

//        cout << endl << mx << "  " << sum1 << "," << sum2 << " " << (sum1 + sum2) % 2 << "%2 " << (sum1 + sum2) % 3 << "%3" << endl;
//
//        cout << check(v) << endl;
//
//        cout << endl;
    }

    return 0;
}


Measured memory_bytes: 640
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100010;
vector<int> Prev(MAXN, -1);
vector<vector<int>> Graph(MAXN);
int64_t N, M;
queue<int> Q;

int main()
{
  int a, b;
  cin >> N >> M;
  for (int i = 0; i < M; i++)
  {
    cin >> a >> b;
    Graph.at(a).push_back(b);
    Graph.at(b).push_back(a);
  }
  Prev.at(1) = 0;
  vector<int> Steps(N + 1, -1);
  Steps.at(1) = 0;
  Q.push(1);
  while (!Q.empty())
  {
    int curNode = Q.front();
    Q.pop();
    for (int i = 0; i < Graph.at(curNode).size(); i++)
    {
      int nextNode = Graph.at(curNode).at(i);
      if (Steps.at(nextNode) != -1)
        continue;
      Steps.at(nextNode) = Steps.at(curNode) + 1;
      Prev.at(nextNode) = curNode;
      Q.push(nextNode);
    }
  }
  cout << "Yes" << endl;
  for (int i = 2; i <= N; i++)
  {
    cout << Prev.at(i) << endl;
  }
}


Measured memory_bytes: 10556
import std.stdio;
import std.conv;
import std.string;
import std.typecons;
import std.algorithm;
import std.array;
import std.range;
import std.math;
import std.regex : regex;
import std.container;
import std.bigint;
import std.numeric;


void main()
{
  auto n = readln.chomp.to!int;
  auto h = readln.chomp.split.to!(int[]);
  int res, cnt;
  foreach (i; 1..n) {
    if (h[i-1] >= h[i]) {
      cnt++;
    } else {
      res = max(res, cnt);
      cnt = 0;
    }
  }
  res = max(res, cnt);

  res.writeln;
}


Measured memory_bytes: 4348
#include <bits/stdc++.h>
using namespace std;
long long MOD = 1000000007;
long long modpow(long long a, long long b){
  long long ans = 1;
  while (b > 0){
    if (b % 2 == 1){
      ans *= a;
      ans %= MOD;
    }
    a *= a;
    a %= MOD;
    b /= 2;
  }
  return ans;
}
long long modinv(long long a){
  return modpow(a, MOD - 2);
}
vector<long long> mf = {1};
long long modfact(int n){
  if (mf.size() > n){
    return mf[n];
  } else {
    for (int i = mf.size(); i <= n; i++){
      long long next = mf.back() * i % MOD;
      mf.push_back(next);
    }
    return mf[n];
  }
}
long long modbinom(int n, int k){
  return modfact(n) * modinv(modfact(k)) % MOD * modinv(modfact(n - k)) % MOD;
}
int main(){
  long long N, M, K;
  cin >> N >> M >> K;
  long long ans1 = 0;
  for (int i = 1; i <= N; i++){
    ans1 += (N - i) * i;
  }
  ans1 %= MOD;
  ans1 *= M;
  ans1 %= MOD;
  ans1 *= M;
  ans1 %= MOD;
  long long ans2 = 0;
  for (int i = 1; i <= M; i++){
    ans2 += (M - i) * i;
  }
  ans2 %= MOD;
  ans2 *= N;
  ans2 %= MOD;
  ans2 *= N;
  ans2 %= MOD;
  long long ans = ans1 + ans2;
  ans %= MOD;
  ans *= modbinom(N * M - 2, K - 2);
  ans %= MOD;
  cout << ans << endl;
}

Measured memory_bytes: 5368
#include <bits/stdc++.h>
#define INF 5000000000000000000
#define ll long long
#define pll pair<ll, ll>
using namespace std;


int main()
{
  ll K, A, B;
  cin >> K >> A >> B;
  if (B - A <= 2) {
    cout << 1 + K << endl;
    return 0;
  }
  if (1 + K <= A) {
    cout << 1 + K << endl;
    return 0;
  }
  ll left_time = K - (A - 1);
  ll ans = A + (left_time / 2) * (B - A);
  if (left_time % 2 == 1) {
    ans += 1;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
# solution
import io
import math

data=int(input())
zxc=map(int,input().split())
arr=list(zxc)
aone=0
bone=0
for i in range(data-1):
  if arr[i]>=arr[i+1]:
    aone+=1
    if aone>bone:
      bone=aone
  else:
    aone=0
print(bone)

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

//using namespace--------------------------------------------------------------------------------------------------------------
using namespace std;

//define-----------------------------------------------------------------------------------------------------------------------
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define FOR(i, s, n) for(int i = s; i < (int)n; i++)
#define per(i, n) for(int i = n; i >= 0; i--)
#define ROF(i, s, n) for(int i = s; i >= (int)n; i--)
#define FORIT(i, A) for (auto i : A)
#define PRINT(x) cout << (x) << "\n"
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define EACH(i, n) for (__typeof((n).begin()) i = (n).begin(); i != (n).end(); ++i)
#define SZ(a) int((a).size())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define INF 1 << 25
#define CLR(a) memset((a), 0 ,sizeof(a))
#define dump(x) cerr << #x << " = " << (x) << "\n";
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << "\n";
#define sq(n) (n) * (n)

//typedef----------------------------------------------------------------------------------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;
typedef unsigned int uint;
typedef unsigned long long ull;

//const------------------------------------------------------------------------------------------------------------------------
const double EPS = 1e-10;
const double PI = acos( -1.0 );

//global-----------------------------------------------------------------------------------------------------------------------
int n;
int a, b, c, d;
//function---------------------------------------------------------------------------------------------------------------------
int main() {
	scanf( "%d", &n );
	rep( i, n ) {
		int ans = 0;
		scanf( "%d %d %d %d", &a, &b, &c, &d );
		ans += a * c;
		ans += b * d;
		if ( c < 5 ) {
			c = 5;
		}
		if ( d < 2 ) {
			d = 2;
		}
		if ( ans > a * 0.8 * c + b * 0.8 * d ) {
			ans = a * 0.8 * c + b * 0.8 * d;
		}
		printf( "%d\n", ans );
	}
	return 0;
}

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

using namespace std;

using ll = long long;

using P = pair<int,int>;

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

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

int main() {
    int N, X ;
    cin >>N >>X ;
    vector<int> x(N) ;
    rep(i,N){
        cin >> x[i] ;
    }
int ans= abs(X-x[0]) ;
for(int  i=1 ;i<N ; ++i){
    ans= gcd(ans,abs(X-x[i])) ;
}
 cout <<ans <<endl ;

  return 0;

}

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

#define debug(x) cout<<#x<<": "<<x<<endl
#define rep(i,n) for (int i=0;i<(n);i++)
#define FOR(i,a,b) for (int i=(a);i<=(b);i++)
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
typedef long long ll;


void solve(){
#ifdef _WIN32
	istream &cin = ifstream("input.txt");
#endif
	int n;
	cin >> n;
	VI v(n * 2);

	rep(i, 2 * n){
		cin >> v[i];
	}
	sort(all(v));
	int ans = 0;
	rep(i, n){
		ans += v[i * 2];
	}

	cout << ans << endl;
}


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


	solve();
	system("PAUSE");
	return 0;
}

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

int main() {
	int S1;
  	char S2;
  	int S3;
  	int sum;
  	cin >> S1 >> S2 >> S3 ;  

  	
  	if(S2 == '+'){
    	sum = S1+S3;
    }
  	else if (S2 == '-'){
    	sum = S1-S3;
    }
  	else if (S2 == '*'){
    	sum = S1*S3;
    }
  	else if (S2 == '/'){
    	sum = S1/S3;
    }
  
  	cout << sum << endl; 
}

Measured memory_bytes: 256
import           Data.Array.IO

main = do
  n <- readLn :: IO Int
  let as = flip
        map
        [(x, y, z)
        | x <- [1 .. 100]
        , y <- [1 .. 100]
        , z <- [1 .. 100]
        , x ^ 2 + y ^ 2 + z ^ 2 + x * y + y * z + z * x <= 10 ^ 4]
        $ \(x, y, z) -> x ^ 2 + y ^ 2 + z ^ 2 + x * y + y * z + z * x
  ar <- newArray (1, n) 0 :: IO (IOUArray Int Int)
  flip mapM_ as $ write n ar
  flip mapM_ [1 .. n] $ \i -> print =<< readArray ar i
  where
    write n ar i
      | i <= n = writeArray ar i =<< (+ 1) <$> (readArray ar i)
      | otherwise = return ()


Measured memory_bytes: 4920
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

int main(int argc, char const *argv[]) {
    int n; cin>>n;
    vector<int> a(n);
    rep(i,n) cin>>a[i];
    int m = INF;
    int ans = 0;
    rep(i,n) {
        if (a[i]<m) {
            chmin(m,a[i]);
            ans++;
        }
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;

int main(void) {
    ll n;
    cin >> n;
    vector<vector<ll>> g(n);
    REP(i, n-1) {
        ll a, b;
        cin >> a >> b;
        a--, b--;
        g[a].push_back(b);
        g[b].push_back(a);
    }

    vector<ll> dist(n, INF);
    auto dfs = [&](auto &&self, ll v, ll p, ll d) -> void {
        dist[v] = d;
        for(auto to: g[v]) if(to != p) {
            self(self, to, v, d+1);
        }
    };
    dfs(dfs, 0, -1, 0);
    ll ma = -1, idx = -1;
    REP(i, n) if(ma < dist[i]) ma = dist[i], idx = i;

    dist.assign(n, INF);
    dfs(dfs, idx, -1, 0);
    ma = 0;
    REP(i, n) chmax(ma, dist[i]);

    if(ma == 0) cout << "First\n";
    else if(ma == 1) cout << "Second\n";
    else {
        ma -= 2;
        ma %= 3;
        if(ma <= 1) cout << "First\n";
        else cout << "Second\n"; 
    } 

    return 0;
}

Measured memory_bytes: 20096
# -*- coding: utf-8 -*-

class dice_class:
    def __init__(self, list):
        self.num = list

    def sut(self, top):  #set_up_top
        i = 0
        while i < 3:
            if self.num[0] == top:
                break
            else:
                self.roll('E')
            if self.num[0] == top:
                break
            else:
                self.roll('N')
            i += 1

    def suf(self, front):   #set_up_front
        i = 0
        while i < 4:
            if self.num[1] == front:
                break
            else:
                self.roll('SEN')
            i += 1

    def roll(self, s):
        for i in s:
            if i == 'E':
                self.rollE()
            elif i == 'N':
                self.rollN()
            elif i == 'S':
                self.rollS()
            elif i == 'W':
                self.rollW()

    def rollE(self):
        self.num = [self.num[3], self.num[1], self.num[0], self.num[5], self.num[4], self.num[2]]

    def rollN(self):
        self.num = [self.num[1], self.num[5], self.num[2], self.num[3], self.num[0], self.num[4]]

    def rollS(self):
        self.num = [self.num[4], self.num[0], self.num[2], self.num[3], self.num[5], self.num[1]]

    def rollW(self):
        self.num = [self.num[2], self.num[1], self.num[5], self.num[0], self.num[4], self.num[3]]


if __name__ == "__main__":
    dice1 = dice_class(map(int, raw_input().split()))
    dice2 = dice_class(map(int, raw_input().split()))
    flg = False

    for i in range(6):
        if i % 2:
            dice1.roll('E')
        else:
            dice1.roll('N')
        dice2.sut(dice1.num[0])
        dice2.suf(dice1.num[1])
        if dice1.num == dice2.num:
            flg = True
            break

    if flg:
        print "Yes"
    else:
        print "No"

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

int main(){
  string s,t;
  cin >> s >> t;
  int ans = 0;
  rep(i,3){
    if(s[i]==t[i]) ans++;
  }
  
  cout << ans << endl;
}


Measured memory_bytes: 256
// https://beta.atcoder.jp/contests/abc045
// status:

#define SUBMIT
#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    int a, b, h;
    cin >> a >> b >> h;
    auto ans = (a + b) * h / 2;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
    string S,T;
    cin >> S >> T;
    int count = 0;
    for (int i = 0; i < S.size(); i++)
    {
        if(S[i] != T[i])
        {
            ++count;
        }
    }
    cout << count << endl;
}


Measured memory_bytes: 3916
#include <bits/stdc++.h>
#define pq priority_queue
using namespace std;
constexpr long long gcd(long long a, long long b){return b ? gcd(b, a % b) : a;}
constexpr long long lcm(long long a, long long b){return a / gcd(a, b) * b;}
constexpr int INF = 1e9, MOD = INF + 7, around[] = {0, 1, 1, -1, -1, 0, -1, 1, 0, 0};
constexpr int mod_pow(long long x, long long n, const int mod){long long ret=1;while(n){if(n&1)(ret*=x)%=mod;(x*=x)%=mod;n>>=1;}return ret;}
template<int n> struct Prime{bool arr[n+1];constexpr bool operator[](int k){return arr[k];}constexpr Prime():arr(){for(int i=2;i<n;i++){arr[i]=true;for(int j=2;j*j<=i;j++){if(!(i%j))arr[i]=false;}}}};
template<int n> struct Factorial{long long arr[n+1],ary[n+1];constexpr Factorial():arr(),ary(){arr[0]=1;ary[0]=1;for(int i=0;i<n;i++){arr[i+1]=arr[i]*(i+1)%MOD;ary[i+1]=mod_pow(arr[i+1],MOD-2,MOD);}}};
constexpr Factorial<1010> fact; constexpr Prime<10> prime;
constexpr long long comb(int a, int b){if(a < b) return 0LL;if(!a or !b) return 1LL; long long pos = fact.arr[a], pot = fact.ary[a - b], por = fact.ary[b]; return pos * pot % MOD * por % MOD;}
template<int n> struct Bernoulli{long long arr[n+1];constexpr Bernoulli():arr(){arr[0]=1;for(int i=1;i<=n;i++){long long sum=0;for(int j=0;j<i;j++){(sum+=comb(i+1,j)*arr[j]%MOD)%=MOD;}arr[i]=(MOD-mod_pow(i+1,MOD-2,MOD))%MOD*sum%MOD;}}};
constexpr int vx[] = {1, 0, -1, 0}, vy[] = {0, 1, 0, -1};
constexpr long double PI = abs(acos(-1));
constexpr int sqrtN = 512, logN = 32;
constexpr long long LINF=1e18;

int main(){
	int n; cin >> n; vector<pair<int, int>> vec(n);
	for(int i = 0; i < n; i++){
		int a; cin >> a;
		vec[i] = {a, i};
	}
	sort(begin(vec), end(vec));
	vector<int> ans(n);
	
	for(int i = 0; i < n / 2; i++){
		ans[vec[i].second] = vec[n / 2].first;		
	}
	
	for(int i = n / 2; i < n; i++){
		ans[vec[i].second] = vec[n / 2 - 1].first;
	}

	for(auto v : ans) cout << v << endl;
	return 0;
}


Measured memory_bytes: 4480
#B - FizzBuzz Sum
N = int(input())
sum = 0
for i in range(1,N+1):
    if i % (3*5) ==0:
        pass
        #sum += i
        #print("FizzBuzz")
    elif i % 3 == 0:
        pass
        #sum += i
        #print("Fizz")
    elif i % 5 == 0:
        pass
        #sum += i
        #print("Buzz")
    else:
        sum += i
print(sum)


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

int main() {
  int n;
  cin >> n;
  vector<long long> b(n-1);
  for(int i = 0; i < n-1; i++) {
    cin >> b.at(i);
  }
    
  int ans = 0;
  ans += b.at(0);
  for(int i = 1; i < n-1; i++){
    ans += min(b.at(i-1), b.at(i));
  }
  ans += b.at(n-2);
  cout << ans << endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <string>
#include <cstring>
#include <functional>
#include <climits>
#define ll long long
#define P(a) cout << a << " ";
#define NCONS 200001
#define endl '\n'
using namespace std;

int main(void)
{
	cin.tie(NULL); ios_base::sync_with_stdio(false);
	double T, X; cin >> T >> X;
	cout << T / X << endl;

	return 0;
}

Measured memory_bytes: 256
#include<deque>
#include<queue>
#include<vector>
#include<set>
#include<map>
#include<unordered_map>
#include<iostream>
#include<algorithm>
#include<bitset>
#include<cmath>
#include<cstring>
#include<cassert>
#include<random>
#include<fstream>
#include<chrono>
// #include<ext/pb_ds/assoc_container.hpp>
// #include<ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
using namespace std;
#define ld           long double
#define pii          pair<int,int>
#define vi           vector<int>
#define pb           push_back
#define mp           make_pair
#define ff           first
#define ss           second
#define endl         '\n'
#define rep(i,s,e)   for(int i=(s);i<=(e);i++)
#define brep(i,s,e)  for(int i=(s);i>=(e);i--)
#define all(x)       (x).begin(),(x).end()
#define ball(x)      (x).rbegin(),(x).rend()
#define sz(x)        (int)x.size()
#define mem(x,y)     memset(x,y,sizeof(x))
#define VR46         ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);ifstream fin("ip.txt");ofstream fout("op.txt");
#define milf(x)      x.reserve(1LL<<14LL); x.max_load_factor(0.25); // less_equal
#define pbds         tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update>
mt19937              rng(chrono::steady_clock::now().time_since_epoch().count());
#define int          long long
const int INF = 0x3F3F3F3F3F3F3F3F;
const int MOD = 1e9+7;
ld EPS = 1e-12;

const int N = 1e5 + 5;
int n, a[N], dp[N];

int REC(int id)
{
    if( id>=n-1 )
        return 0;
    if( dp[id]!=-1 )
        return dp[id];
    int ans = INF;
    rep(i,1,2)
    {
        if( id+i >= n )
            break;
        ans = min( ans, REC( id+i ) + abs( a[id]-a[id+i] ) );
    }
    dp[id] = ans;
    return ans;
}

signed main()
{
    VR46 // DONT USE DEQUE IF NOT NECESSARY
    // int t;cin>>t;rep(test,1,t)
    {
        cin >> n;
        rep(i,0,n-1)
            cin >> a[i];
        mem( dp, -1 );
        cout << REC( 0 ) << endl;
    }
}

Measured memory_bytes: 6528
#include <stdio.h>
#include <limits.h>
#include <math.h>

#define MIN(a, b) ((a) < (b) ? (a) : (b))

int main() {
    int N, K;
    scanf("%d\n%d", &N, &K);

    int d_min = INT_MAX;
    for (int i = 0; i <= N; i++) {
        d_min = MIN((int) pow(2, i) + K * (N - i), d_min);
    }

    printf("%d\n", d_min);
    return 0;
}

Measured memory_bytes: 128
while True:
    try:
        data=raw_input()
        original=''
        i=0
        while True:
            if data[i]=='@':
                original+=int(data[i+1])*data[i+2]
                i+=2
            else:
                original+=data[i]
            i+=1
            if len(data)<=i:
                break
        print original
    except:
        break

Measured memory_bytes: 4204
import java.util.*;

public class Main {
    void run() {
        Scanner sc = new Scanner(System.in);
        String n = sc.next();
        boolean ans = false;
        for (char c : n.toCharArray()) {
            if (c == '7') {
                ans = true;
            }
        }
        System.out.println(ans ? "Yes" : "No");
    }

    void debug(Object... os) {
        System.err.println(Arrays.deepToString(os));
    }

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


Measured memory_bytes: 26912
// ABC160E.cpp :
//#include "pch.h"
#include <iostream>
#include <vector>
#include <algorithm> // min
using namespace std;
int main()
{
	int N, X, Y;
	cin >> N >> X >> Y;
	vector<vector<int>>dp(N + 1, vector<int>(N + 1));
	for (int i = 1; i <= N; i++)
	{
		for (int j = i+1; j <= N; j++)
		{
			dp.at(i).at(j) = j - i;
		}
	}
	for (int j = N; j >= 1; j--)
	{
		for (int i = N; i >= 1; i--)
		{
			dp.at(i).at(j) = min(1 + abs(X - i)+abs(Y-j), dp.at(i).at(j));
		}
	}
	vector<int>ans(N + 1);
	for (int i = 1; i <= N; i++)
	{
		for (int j = 1; j <= N; j++)
		{
			ans.at(dp.at(i).at(j))++;
		}
	}
	for (int i = 1; i < N; i++)
	{
		cout << ans.at(i) << endl;
	}

}


Measured memory_bytes: 16128
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mt make_tuple
#define pii pair<int, int>
#define pll pair<long long,long long>
#define vl vector<long long>
#define vll vector<pll>
#define vi vector<int>
#define vii vector<pii>
#define sws ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl '\n'
#define tcase int tt; cin>>tt; while(tt--)
#define tcase2 int tt; cin>>tt; for(int qq=1;qq<=tt;qq++)
using namespace std;
typedef long long int ll;
typedef  unsigned long long int ull;
typedef long double ld;
const int MAX = 1000002;
const int MOD2 = 998244353;
const int MOD = 1000000007; 
const int INF = 1e8;
const ld EPS = 1e-7;
// Extra
#define forn(i, n) for(int i = 0; i < (int)n; i++)
#define forne(i, a, b) for(int i = a; i <= b; i++)
#define all(x) x.begin(), x.end()
#define trav(a, x) for(auto& a : x)
#define fill(x,y) memset(x,y,sizeof(x))
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
ll dectobin(ll n,ll p[])
{
    ll i=0 ;
    while(n!=0)
    {
        p[i]=n%2 ;
        n/=2 ;
        i++ ;
    }
    return(i-1) ;
}
ll binarySearchCount(ll arr[], ll n, ll key) 
{ 
    ll left = 0; 
    ll right = n - 1; 
  
    ll count = 0; 
  
    while (left <= right) { 
        int mid = (right + left) / 2; 
  
        // Check if middle element is 
        // less than or equal to key 
        if (arr[mid] < key) { 
  
            // At least (mid + 1) elements are there 
            // whose values are less than 
            // or equal to key 
            count = mid + 1; 
            left = mid + 1; 
        } 
  
        // If key is smaller, ignore right half 
        else
            right = mid - 1; 
    } 
  
    return count; 
} 
void printDivisors(ll n,ll k) 
{  ll temp=1  ;
    // Note that this loop runs till square root 
    for (int i=1; i<=sqrt(n); i++) 
    { 
        if (n%i == 0) 
        { 
            // If divisors are equal, print only one 
            if (n/i == i) 
                {
                	if(i<=k && i>temp)
                	temp=i ;
				}
  
            else // Otherwise print both 
                
                {
                if(i<=k && i>temp)
                	temp=i ;
                if(n/i<=k && n/i>temp)
                temp=n/i ;
				}
        } 
    }
	cout<<n/temp<<"\n" ;
	return ; 
} 
ll solve(ll n)
{
	ll temp=-1 ;
	forn(i,n)
	{
		forn(j,3)
		{
			if(j!=temp)
			{
				
			}
		}
	}
}
int main(int argc, char** argv)
{   sws ;
 //tcase
{
ll n,m=1e9+7,sum=0;
cin>>n ;
ll a[n] ;
forn(i,n)
{
cin>>a[i] ;
if(a[i]<=m)
{
	m=a[i] ;
	sum++ ;
}
}
cout<<sum<<"\n" ;
}
  return 0;
}

Measured memory_bytes: 1792
#include <iostream>
#include <string>
#include <queue>
#include <stack>
#include <algorithm>
#include <list>
#include <vector>
#include <complex>
#include <utility>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <bitset>
#include <ctime>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <cassert>
#include <cstddef>
#include <iomanip>
#include <numeric>
#include <tuple>
#include <sstream>
#include <fstream>
#include <functional>

using namespace std;
#define REP(i, n) for (int (i) = 0; (i) < (n); (i)++)
#define FOR(i, a, b) for (int (i) = (a); (i) < (b); (i)++)
#define RREP(i, a) for(int (i) = (a) - 1; (i) >= 0; (i)--)
#define FORR(i, a, b) for(int (i) = (a) - 1; (i) >= (b); (i)--)
#define DEBUG(C) cerr << #C << " = " << C << endl;
using LL = long long;
using VI = vector<int>;
using VVI = vector<VI>;
using VL = vector<LL>;
using VVL = vector<VL>;
using VD = vector<double>;
using VVD = vector<VD>;
using PII = pair<int, int>;
using PDD = pair<double, double>;
using PLL = pair<LL, LL>;
using VPII = vector<PII>;
template<typename T> using VT = vector<T>;
#define ALL(a) begin((a)), end((a))
#define RALL(a) rbegin((a)), rend((a))
#define SORT(a) sort(ALL((a)))
#define RSORT(a) sort(RALL((a)))
#define REVERSE(a) reverse(ALL((a)))
#define MP make_pair
#define FORE(a, b) for (auto &&a : (b))
#define EB emplace_back
#define GREATER(T) T, VT<T> greater<T>
template<typename T> inline bool chmax(T &a, T b){if (a < b){a = b;return true;}return false;}
template<typename T> inline bool chmin(T &a, T b){if (a > b){a = b;return true;}return false;}

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

int main(void) {
    int M;
    int K;
    cin >> M >> K;
    if (K == 0) {
        REP(i, (1 << M)) {
            cout << i << " " << i << (i + 1 == (1 << M) ? "\n" : " ");
        }
        return 0;
    }

    if ((1 << M) <= K || (K == 1 && M == 1)) {
        cout << -1 << endl;
        return 0;
    }

    deque<int> que;
    que.emplace_back(K);
    int val = 0;
    REP(i, (1 << M)) {
        if (i != K) {
            val ^= i;
            que.emplace_front(i);
            que.emplace_back(i);
        }
    }
    que.emplace_back(K);

    if (val != K) {
        cout << -1 << endl;
        return 0;
    }
    FORE(e, que) {
        cout << e << " ";
    }
    cout << "\n";
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n)     for (ll i = 0; i < (n); ++i)
#define rep2(i, a, b) for (ll i = (a); i < (b); ++i)
#define repin(a, n)  \
    vector<ll> a(n); \
    rep(i, n) { cin >> a[i]; }
#define repins(a, n)     \
    vector<string> a(n); \
    rep(i, n) { cin >> a[i]; }
#define repind(a, n)     \
    vector<double> a(n); \
    rep(i, n) { cin >> a[i]; }
#define in(a) \
    ll a;     \
    cin >> a;
#define ins(a) \
    string a;  \
    cin >> a;
#define ind(a) \
    double a;  \
    cin >> a;
template <class T>
inline void out(T a) {
    cout << a << endl;
}
inline void out(double a) { printf("%.10f\n", a); }
#define all(x)  (x).begin(), (x).end()    //昇順
#define rall(x) (x).rbegin(), (x).rend()  //降順
#define yes     out("Yes");
#define no      out("No");

int main() {
    in(x);
    if (x >= 30) {
        yes;
    } else {
        no;
    }
}

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

int n,a,b,c,d,ans;


int main(){
	for((cin>>n);n;n--){
		cin>>a>>b>>c>>d;
		ans=999999;
		for(int i=c;i<=6;i++){
			for(int j=d;j<=6;j++){
				if(i>=5&&j>=2){
					ans=min( ans , (a*i+b*j)*8/10);
				}
				else{
					ans=min(ans,a*i+b*j);
				}
			}
		}
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 1164
#include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;++i)
#include<string>
using namespace std;
typedef long long ll;
typedef pair<int, int>P;
//max=({});
//条件式が真ならwhileの中身を回し続ける

int g[15][15];
bool flag[1050000];
const int INF = 1001001001;
const int di[] = { -1,0,1,0 };
const int dj[] = { 0,-1,0,1 };

int main() {
	string s;
	cin >> s;
	int n = s.size();
	vector<int>ans(n);
	rep(ri, 2) {
		{
			int cnt = 0;
			rep(i, n) {
				if (s[i] == 'R')cnt++;
				else {
					ans[i] += cnt / 2;
					ans[i - 1] += (cnt + 1) / 2;
					cnt = 0;
				}
			}
		}
		reverse(ans.begin(), ans.end());
		reverse(s.begin(), s.end());
		rep(i, n) {
			if (s[i] == 'L')s[i] = 'R';
			else s[i] = 'L';
		}
	}
	rep(i, n) {
		printf("%d\n", ans[i]);
	}
	return 0;
}


Measured memory_bytes: 1024
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int h = sc.nextInt();
        int a = sc.nextInt();
        
        int count = 0;
        for (int i = 0; i < h; i+=a) count++;
        System.out.println(count);
    }
}

Measured memory_bytes: 21204
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstring>
#include <climits>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())

typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

constexpr ll INF = 1e18;
constexpr ll MOD = 1e9 + 7;
constexpr double PI = 3.14159265358979323846;
constexpr int di[] = {0, 0, 1, -1};
constexpr int dj[] = {1, -1, 0, 0};

int gcd(int a, int b)
{
    if (a < b)
        int c = a, a = b, b = c;
    return a % b == 0 ? b : gcd(b, a % b);
}

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

    int a, b, k;

    cin >> a >> b >> k;

    int cnt = 0;

    V v;

    for (int i = 1; i <= max(a, b); i++)
    {
        if (a % i == 0 && b % i == 0)
        {
            v.push_back(i);
        }
    }

    cout << v[v.size() - k] << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int MAX = 410000;
const int MOD = 1000000007;

long long fac[MAX], finv[MAX], inv[MAX];
//invの要素にはiの逆元が格納されている
//前処理
void COMinit(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for(int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;//i!(mod MOD)を計算
        inv[i] = MOD - inv[MOD%i]* (MOD / i) % MOD;//iの逆元を計算
        finv[i] = finv[i - 1] * inv[i] % MOD;//i!(mod MOD)の逆元を計算
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;//nCk = n!/(k!*(n-k)!)を計算
}
//例のアレ
long long nPm(int n, int m){
    if(n < m) return 0;
    if(n < 0 || m < 0) return 0;
    return fac[n] * finv[n - m] % MOD;
}
long long ans = 1;
vector<vector<int>> G;
int N, K;
vector<int> used;
void dfs(int s){
    if(K - 2 < (int)G[s].size() - 1){
        ans *= 0;
        return;
    }
    if(s != 0){
        ans *= nPm(K - 2, (int)G[s].size() - 1);
    }
    else ans *= nPm(K - 1, (int)G[s].size());
    ans %= MOD;
    used[s] = 1;
    for(int j: G[s]) {
        if(used[j] == -1) dfs(j);
    }
}
int main(){
    cin >> N >> K;
    COMinit();
    G.resize(N);
    used.resize(N, -1);
    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);
    }
    ans *= K;
    dfs(0);
    cout << ans << endl;
}


Measured memory_bytes: 20900
#include <bits/stdc++.h>
using namespace std;
#define ms(s, n) memset(s, n, sizeof(s))
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define FORd(i, a, b) for (int i = (a); i >= (b); --i)
#define sz(a) int((a).size())
#define pconent(t, x) (t.find(x) != t.end())
#define all(a) (a).begin(), (a).end()
#define uni(a) (a).erase(unique(all(a)), (a).end())
#define pb push_back
#define pf push_front
#define mp make_pair
#define fi first
#define se second
#define prec(n) fixed<<setprecision(n)
#define bit(n, i) (((n) >> (i)) & 1)
#define bitcount(n) __builtin_popcountll(n)
typedef long long ll;
typedef long double ld;
const ll MOD =  1e9 + 7;
const ll LINF = (ll) 1e18;
const ld PI = acos((ld) -1);
const ld EPS = 1e-9;
inline ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
inline ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
inline ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
inline ll isqrt(ll k) {ll r = sqrt(k) + 1; while (r * r > k) r--; return r;}
inline ll icbrt(ll k) {ll r = cbrt(k) + 1; while (r * r * r > k) r--; return r;}
inline int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
inline int sign(ld x) {return x < -EPS ? -1 : x > +EPS;}
inline int sign(ld x, ld y) {return sign(x - y);}
#define pos(v) ((v) << 1)
#define neg(v) (pos(v) ^ 1)
#define db(v) (cout<<v<<" ** "<<endl)
template <class T> inline void dbv(T a) { for(auto x : a){ cout<<x<<" ** " ;} cout<<endl;}

void output()
{
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    if(k%2)
    {
        cout<<(b-a)<<endl;
    }
    else
    {
        cout<<(a-b)<<endl;
    }
    // FOR(i,0,k)
    // {
    //     ll at = b+c;
    //     ll bt = a+c;
    //     ll ct = a+b;
    //     a = at;
    //     b = bt;
    //     c = ct;
    //     if(a>LINF || b>LINF || c>LINF)
    //     {
    //         cout<<"Unfair"<<endl;
    //         return;
    //     }
    // }
    // cout<<(a-b)<<endl;
    // cout<<"Case #"<<tx<<": "<<fin<<endl;
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll t  =1 ;
    FOR(i,0,t)
    {
        output() ;
    }
    return 0 ;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int B[110];
int main()
{
  int N;
  cin>>N;
  N--;
  for(int i=0;i<N;i++)
    cin>>B[i];
  N--;
  int ans=B[0];
  for(int i=0;i<N;i++)
    ans+=min(B[i],B[i+1]);
  ans+=B[N];
  cout<<ans<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n,k,x,y;
	cin >> n >> k >> x >> y;
	int sum=0;
	sum+=min(n,k)*x;
	if(n>k)
	{
		sum+=(n-k)*y;
	}
	cout << sum;
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll a, b, x;
	cin >> a >> b >> x;
	ll ans = b/x - (a == 0 ? -1 : (a-1)/x);
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3612
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
using P = pair<int,int>;

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

    int mdn = 0;
    for(int i = 0; i < n.length(); i++){
        mdn += (n[i] - '0');
        mdn %= 9;
    }
    if(mdn == 0) cout << "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}

Measured memory_bytes: 3728
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0; i<(n); i++)
#define all(v) v.begin(),v.end()

using namespace std;
typedef long long ll;




int main()
{
    int N;
    cin >> N;
    vector<pair<int,int>> D(N);
    rep(i,N) cin >> D[i].first;
    rep(i,N) D[i].second = i;
    
    ll ans = 1;
    const ll mod = 998244353;
    
    sort(all(D));
    
    if(D[0].first != 0 || D[0].second != 0){
        cout << 0 << endl;
        return 0;
    }
    
    int a = 0;
    ll ab = 1;
    ll b = 1;
    for (int i = 1; i < N; i++) {
        if(D[i].first == 0){
           cout << 0 << endl;
            return 0;
        }
        
        if(D[i].first == a) b++;
        else if(D[i].first == a+1)a = D[i].first, ab = b, ab %= mod, b = 1;
        else{
           cout << 0 << endl;
            return 0;
        }
        ans = (ans*ab)%mod;
        
        //cout << ab << " " << ans<< endl;
        
    }
    
    cout << ans%mod << endl;
    
    
    
    
    return 0;
}



Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
#define pb push_back
#define mp makepair
#define deb(x) cout<<x<<"\n";
#define deB(x,y) cout<<x<<" "<<y<<"\n";
#define Deb(x,y,z) cout<<x<<" "<<y<<" "<<z<<"\n" 
#define YES cout<<"YES\n";
#define Yes cout<<"Yes\n";
#define NO cout<<"NO\n";
#define No cout<<"No\n";
#define all(v) (v).begin(),(v).end()
ll a[200009],b[200009];
int main()
{
  ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
  //freopen("input.txt", "r", stdin);
  //freopen("output.txt", "w", stdout);
  ll n,m,k;
  cin>>n>>m>>k;
  ll i=1;
  while(i<=n)
  {
    cin>>a[i];
    a[i]+=a[i-1];
    i++;
  }
  i=1;
  ll j;
  while(i<=m)
  {
    cin>>b[i];
    b[i]+=b[i-1];
    i++;
  }
  i=1;
  while(i<=n&&a[i]<k)
    i++;
  if(i==n+1)
    i--;
  if(a[i]>k)
    i--;
  ll ans=0;
  j=1;
  while(i>-1)
  {
    while(j<=m&&b[j]<k-a[i])
      j++;
    if(j==m+1)
      j--;
    if(b[j]>k-a[i])
      j--;
    ans=max(ans,i+j);
    i--;
  }
  deb(ans)
}


Measured memory_bytes: 6776
fn main() {
  let vec: Vec<char> = read_vec();
  
  let &h = vec.first().unwrap();
  let &l = vec.last().unwrap();
  
  if h == l {
    if (vec.len() - 2) % 2 == 0 {
      println!("First");
    } else {
      println!("Second");
    }
    return;
  }
  
  let mut hls = vec.iter().filter(|&&c| c==h||c==l).collect::<Vec<_>>();
  hls.dedup();

  if (vec.len() - hls.len()) % 2 == 0 {
    println!("Second");
  } else {
    println!("First");
  }
}

fn read_vec() -> Vec<char> {
  let mut buf = String::new();
  std::io::stdin().read_line(&mut buf).ok();
  buf.trim().chars().collect()
}

Measured memory_bytes: 4352
#include<bits/stdc++.h>
using namespace std;
#define MAX 100000

int n, m;

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

  sort(x, x+m);

  int diff[m-1];
  for ( int i = 1; i < m; i++){
    diff[i-1] = x[i] - x[i-1];
  }

  sort(diff, diff+m-1);
  int sum = 0;
  for ( int i = 0; i < m-n; i++){
    sum += diff[i];
  }

  cout << sum << endl;

  return 0;
}

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

const int maxn = 100000 +5;
double ans[maxn];

int main()
{
	int n;
	cin >> n;
	for(int i = 0; i < n; i++) cin >> ans[i];
	sort(ans, ans+n);
	double max = ans[n-1]; double half = max/2; double del = abs(ans[0] - half);
	int p = ans[0];
	for(int i = 0 ; i < n-1; i++)
	{
		double del2 = abs(ans[i] - half);
		if(del2 < del) { del = del2; p = ans[i]; }
	}
	cout << (int)max << " " << p << endl;
	return 0;
}

Measured memory_bytes: 1024
import Data.Array.IArray(Array,listArray,(!))
import Data.List(sort)
-- after editorial
main = do
    n <- readLn
    ai <- fmap read . words <$> getLine
    let bi = zipWith (-) ai (iterate (+1) 1)
    let bi' = listArray (1,n) $ sort bi :: Array Int Int
    let b = bi'!(1+div n 2)
    print $ sum $ fmap (abs.subtract b) bi

Measured memory_bytes: 116860
#include <bits/stdc++.h>
#define ll long long

using namespace std;

int a[1000];
ll sum;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);


    int n;cin>> n;

    for(int i=0;i<n-1;i++)cin >> a[i];

    sum=a[0];
    for(int i=0;i<n-2;i++)
    {
        if(a[i]<=a[i+1])
        {
            sum+=a[i];
        }
        else sum+=a[i+1];
    }
    sum+=a[n-2];

    cout << sum;




}



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

using namespace std;

typedef long long LL;
typedef pair<int , int> P2;
typedef pair<pair<int , int> , int> P3;
typedef pair<pair<int , int> , pair<int , int> > P4;
#define PB(a) push_back(a)
#define MP(a , b) make_pair((a) , (b))
#define M3P(a , b , c) make_pair(make_pair((a) , (b)) , (c))
#define M4P(a , b , c , d) make_pair(make_pair((a) , (b)) , make_pair((c) , (d)))
#define repp(i,a,b) for(int i = (int)(a) ; i < (int)(b) ; ++i)
#define repm(i,a,b) for(int i = (int)(a) ; i > (int)(b) ; --i)

const int MC = 100010;
int N;
LL K;
LL w[MC],d[MC];

bool eval(LL z){
	LL a = 0;
	repp(i,0,N){
		if(w[i] > z) continue;
		if(a >= K) break;
		a += (z-w[i]) / d[i] + 1;
	}
	return a >= K;
}

LL BS(LL x , LL y){
	if(x-y<2) return x;
	LL z = (x+y) / 2;
	return eval(z) ? BS(z,y) : BS(x,z);
}

int main(){
	cin >> N >> K;
	repp(i,0,N) cin >> w[i] >> d[i];
	cout << BS((LL)1<<62,0) << endl;
	return 0;
}


Measured memory_bytes: 1792
#include<stdio.h>
#include<math.h>
void dfs(int n, char xz, int now, char a[])
{
	if(now==n)
	{
		for(int j=0;j<n;j++)
		printf("%c",a[j]);
		printf("\n");
	}
	else
	{
		for(char i='a';i<=xz;i++)
		{
			a[now]=i;
			if(i==xz)
			dfs(n,xz+1,now+1,a);
			else
			dfs(n,xz,now+1,a);
		}
	}
}
int main()
{
	int n,now=0;
	char a[11];
	scanf("%d",&n);
	dfs(n,'a',now,a);
	return 0;
}

Measured memory_bytes: 1408
#include<iostream>
#include<cstdio>

using namespace std;

int n;
bool f[105][11];
int p[105][12];

int main(){
  cin >> n;
  for(int i = 0; i < n; ++i){
    for(int j = 0; j < 10; ++j){
      cin >> f[i][j];
    }
  }
  for(int i = 0; i < n; ++i){
    for(int j = 0; j < 11; ++j){
      cin >> p[i][j];
    }
  }
  int res = -(1 << 30);
  for ( int b =1; b <(1 <<10); b ++){
    int cc = 0;
    for(int i = 0; i < n; ++i){
      int c = 0;
      for ( int j =0; j <10; ++j){
        if (( b >> j&1)&& f[i][j]) c ++;
      }
      cc += p[i][c];
    }
    if(res < cc) res = cc;
  }
  cout << res << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <cmath>
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
typedef long long ll;
const double pi=acos(-1);
int ten_xth_power(ll x,ll y){
    int ans=0;
    while(x>=10){
        x/=10;
        ans++;
    }
    while(y>=10){
        y/=10;
        ans++;
    }
    if(x*y>=10) ans++;
    return ans;
}
int main(){
    int n;
    cin >> n;
    vector<ll> A(n);
    rep(i,n) cin >> A[i];
    for(int i=0;i<n;i++){
        if(A[i]==0){
            cout << 0 << endl;
            return 0;
        }
    }
    unsigned long long ans=1;
    for(int i=0;i<n;i++){
        if(ten_xth_power(ans,A[i])>18){
            cout << -1 << endl;
            return 0;
        }
        if(ans*A[i]>1000000000000000000){
            cout << -1 << endl;
            return 0;
        }
        ans*=A[i];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4024
n=int(input())
a=[0]
for i in range(n):
    a.append(int(input()))
a.append(0)

p=[0]*(2*n)
q=[0]*(2*n)
m=0
for i in range(n+2):
    m=max(a[i],m)
    p[i]=m
m=0
for i in reversed(range(n+2)):
    m=max(a[i],m)
    q[i]=m
for i in range(1,n+1):
    print(max(p[i-1],q[i+1]))
    

Measured memory_bytes: 18800
#include <iostream>
#include <string>
#include <vector>
#include <stdlib.h>
#include <cstdint>
#include <cmath>
#include <algorithm>
using namespace std;

#define N 100

int m[N];

int main()
{
	int n, x;
	int ans;

	cin >> n >> x;
	for( int i = 0; i < n; i++ ) {
		cin >> m[i];
	}

	int remain = x;
	for( int i = 0; i < n; i++ ) {
		remain -= m[i];
	}

	sort( m, m + n );

	ans = n;
	for( int i = 0; i < n; i++ ) {
		int num = remain / m[i];
		ans += num;
		remain -= num * m[i];
		if( remain == 0 ) {
			break;
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 384