akhauriyash/Code-Regression huggingface dataset:
/*  Success may not come to me immediately,
 *  but it will come definitely....
 */
#include<bits/stdc++.h>
//=====================================================================
using namespace std;
//=====================================================================
#define opt ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
//=====================================================================
#define li      int64_t
#define ld      double_t
#define ulli    uint64_t
//=====================================================================
#define rep(i,a,b)  for(i=a;i<b;i++)
#define repr(i,a,b) for(i=a;i>b;i--)
#define repi(i,v)   for(i=v.begin();i!=v.end();i++)
#define repir(i,v)  for(i=v.rbegin();i!=v.rend();i++)
#define elif        else if
#define mset(a,b)   memset(a,b,sizeof(a))
#define nl          cout<<'\n'
//=====================================================================
typedef vector<li>       vli;
typedef vector<string>   vstr;
typedef pair<li,li>      pli;
typedef pair<li,pli >    ppli;
typedef pair<li,ppli >   pppli;
typedef vector<pli >     vpl;
typedef vector<ppli >    vppli;
typedef vector<pppli >   vpppli;
//=====================================================================
#define pb  push_back
#define pob pop_back
#define pf  push_front
#define pof pop_front
#define all(v)  v.begin(),v.end()
#define itr iterator
#define rtr reverse_iterator
#define sz  size()
#define lb  lower_bound
#define ub  upper_bound
#define bs  binary_search
#define mp  make_pair
#define F   first
#define S   second
//=====================================================================
#define mod (li)(1e9+7)
#define inf (li)(1e18)
#define MX1 (li)(1e5+5)
#define MX2 (li)(1e6+5)
#define pi  acos(-1)
//=====================================================================
li power(li a,li b){li ans=1;while(b){if(b&1){ans=(ans*a)%mod;}
a=(a*a)%mod;b>>=1;}return ans;}
//=====================================================================
li mmi(li n){return power(n,mod-2);}
//=====================================================================
li two(li n){return (1LL<<n);}
//=====================================================================
void onbit(li &n,li x){n|=two(x);}
//=====================================================================
void offbit(li &n,li x){n&=~two(x);}
//=====================================================================
li cntbit(li n){li res=0;while(n and ++res)n-=n&-n;return res;}
//=====================================================================
li dx[]={-1,0,1,0},dy[]={0,-1,0,1};
//=====================================================================
/*------------------------MAIN CODE BEGINS NOW!------------------------*/

li n,a;

void solve(){
  cin>>n>>a;
  cout<<n*n-a;
}

int main(){
  opt
  #ifndef ONLINE_JUDGE
  #endif
  li t=1;
  //cin>>t;
  while(t--){
    solve();
  }
  return 0;
}

Measured memory_bytes: 256
//In the name of God

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

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

const int N = 1e5+10 , mod = 1e9+7;

int dp[N] , a[N];

int32_t main(){
   ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
   int n;
   cin >> n;
   for(int i = 1 ; i <= n ; i++)
      cin >> a[i];
   dp[2] = abs(a[2] - a[1]);
   for(int i = 3 ; i <= n ; i++)
      dp[i] = min(dp[i - 2] + abs(a[i - 2] - a[i]) , dp[i - 1] + abs(a[i - 1] - a[i]));
   cout << dp[n];
   return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<algorithm>
#include<string>
using ll = long long;
using namespace std;
const ll MM = 1000000000;
const ll mod = MM + 7;
int main(){
    ll a, b; cin >> a >> b;
    int k; cin >> k;
    if(b - a + 1 <= k*2){
        for(int i = a; i <= b; i++){
            cout << i << endl;
        }
    }
    else {
        for(int i = a; i < a+k; i++){
            cout << i << endl;
        }
        for(int i = b-k+1; i <= b; i++){
            cout << i << endl;
        }
    }
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
signed main(){
    int n; cin >> n;
    vector<int>v(n);
    for(auto& e : v) cin >> e;
    map<int,int>mp;
    for(auto e : v)mp[e]++;
    int ans = 0;
    if(n % 2){
        for(auto itr : mp){
            if(itr.first == 0 and itr.second != 1)
                return cout << 0 << endl,0;
            if(itr.first == 0)continue;
            if(itr.first %2 or itr.second !=2 )
                return cout << 0 << endl,0;
        }
    } else {
        for(auto itr : mp){
            if(itr.first % 2 == 0 or itr.second !=2 ) return cout << 0 << endl,0;
        }
        
    }
    ans = 1;
    rep(i,n/2) ans *=2, ans %=1000000007;
    cout << ans << endl;
}



Measured memory_bytes: 4992
#include <cstdlib>
#include <iostream>
#include <sstream>

std::string eq_string(int a, int b) {
    std::string res;

    if (a < b) {
        res = std::string {"a < b"};
    } else if (a > b) {
        res = std::string {"a > b"};
    } else {
        res = std::string {"a == b"};
    }

    return res;
}

int main() {
    int a;
    int b;

    std::cin >> a;
    std::cin >> b;
    std::cout << eq_string(a, b) << std::endl;

    return EXIT_SUCCESS;
}

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

using namespace std;

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vvvvll = vector<vector<vector<vector<ll>>>>;
using pl4 = pair<ll,ll>;
using str = string;
using vpl4 = vector<pair<ll,ll>>;

#define sz size()
#define be begin()
#define en end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define llin(x) ll(x);cin >> (x);
#define stin(x) str(x);cin >> (x);
#define vllin(x,n) vll(x)(n);FOR(i,0,n-1){cin >> (x)[i];}
#define vllin2(a,b,n) vll(a)(n);vll(b)(n);FOR(i,0,n-1){cin >> (a)[i] >> (b)[i];}
#define vllin3(a,b,c,n) vll(a)(n);vll(b)(n);vll(c)(n);FOR(i,0,n-1){cin >> (a)[i] >> (b)[i] >> (c)[i];}
#define vlling(x,n) (x).assign(n,0);FOR(i,0,n-1){cin >> (x)[i];}
#define vlling2(a,b,n) (a).assign(n,0);(b).assign(n,0);FOR(i,0,n-1){cin >> (a)[i] >> (b)[i];}
#define vlling3(a,b,c,n) (a).assign(n,0);(b).assign(n,0);(c).assign(n,0);FOR(i,0,n-1){cin >> (a)[i] >> (b)[i] >> (c)[i];}
#define vpl4in(x,n) vpl4(x)((n),mp(0,0));FOR(i,0,n-1){cin >> x[i].fi >> x[i].se;}
#define FOR(i,a,b) for(ll i=a;i<=b;i++)
#define rFOR(i,b,a) for(ll i=a;i>=b;i--)
#define SORT(x) sort(x.be,x.en)
#define rSORT(x) sort(x.rbegin(),x.rend())
#define say(x) cout << (x);
#define sal(x) cout << (x) << endl;
#define says(x) cout << (x) << (' ');
#define sas cout << (' ');
#define sayR(x) cout << fixed << setprecision(10) << (x);
#define salR(x) cout << fixed << setprecision(10) << (x) << endl;
#define yn(a) cout << ((a) ? "yes" : "no") << endl;
#define Yn(a) cout << ((a) ? "Yes" : "No") << endl;
#define YN(a) cout << ((a) ? "YES" : "NO") << endl;
#define Imp(a) cout << ((a) ? "Possible" : "Impossible") << endl;
#define IMP(a) cout << ((a) ? "POSSIBLE" : "IMPOSSIBLE") << endl;

ll MOD = 1000000007;

signed main()
{
    llin(n);
    llin(q);
    stin(s);
    vector<pair<char,char>> d(q);
    FOR(i,0,q-1){
        cin >>d[i].fi>>d[i].se;
    }
    ll l=0;
    ll r=n-1;
    rFOR(i,0,q-1){
        if(l<=n-1&&s[l]==d[i].fi&&d[i].se=='L') l++;
        if(r>=0&&s[r]==d[i].fi&&d[i].se=='R') r--;
        if(l>0&&s[l-1]==d[i].fi&&d[i].se=='R') l--;
        if(r<n-1&&s[r+1]==d[i].fi&&d[i].se=='L') r++;
    }
    sal(r-l+1);
}

Measured memory_bytes: 900
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

    	Scanner parameter = new Scanner(System.in);

    	String[] line1 = parameter.nextLine().split(" ");
        String[] line2 = parameter.nextLine().split(" ");

        int S = Integer.parseInt(line1[0]);

        if (S >= 3200) {

        	System.out.println(line2[0]);
        } else {

        	System.out.println("red");
        }
    }
}


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

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

}

Measured memory_bytes: 1024
import java.io.*;
import java.util.*;


/**
 * AIZU ONLINE JUDGE
 * 0630
 *  2020/5/5
 */
public class Main {


    boolean main() throws IOException {

        Scanner sc = new Scanner(systemin);

        int A = sc.nextInt();
        int B = sc.nextInt();
        int C = sc.nextInt();
        int D = sc.nextInt();
        int E = sc.nextInt();

        int ret = 0;
        if (B > 0) {
            if (A > 0) {
                ret = (B - A) * E;
            }
            else {
                ret = B * E + D + (-A * C);
            }
        }
        else {
            ret = (B - A) * C;
        }

        result.printf("%d\n", ret);

        sc.close();
        return false;
    }



    PrintStream log;
    PrintStream result = System.out;
    BufferedReader systemin;

    static Main instance = new Main();

    Main() {
        systemin = new BufferedReader(new InputStreamReader(System.in));
        log = new PrintStream(new OutputStream() { public void write(int b) {} } );
    }

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

        instance.main();
        instance.systemin.close();
    }


}




Measured memory_bytes: 26560
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);
#define all(x) x.begin(),x.end()
#define pb push_back
#define pf push_front
#define ff first
#define ss second
#define vll vector<ll>
#define sll set<ll>
#define pll pair<ll, ll>
#define vpll vector<pll>
#define endl "\n"
const ll maxn = 2e5+2;
ll flag[1000002];

int main()
{
    fastio;
    ll i, j, k, n, m, t;
    vll a;
    memset(flag,0,sizeof(flag));

    cin>>n;
    for ( i = 0; i < n; i++)
    {
        cin>>j;
        a.pb(j);
    }
    sort(all(a));
    for ( i = 0; i < n-1; i++)
    {
        if(a[i]==a[i+1])    
            flag[a[i]]=1;
    }
    
    ll maxi=*max_element(all(a));

    for ( i = 0; i < n; i++)
    {
        for ( j = 2*a[i]; j<= maxi ; j+=a[i])
        {
            flag[j]=1;
        }
    }
    ll c=0;
    a.clear();
    for ( i = 0; i < n; i++)
    {
        if(flag[a[i]]==0)
            c++;
    }
    cout<<c<<endl;

        
    return 0;
}

Measured memory_bytes: 13140
from sys import stdin


def solve():
    r,c = [int(i) for i in stdin.readline().split()]
    A = []
    for _ in range(r):
        k = str(input())
        l = [1 if i == '.' else '#' for i in k]
        A.append(l)
    pre = False
    for i in range(c):
        if pre: A[0][i] = '#'
        elif A[0][i] == '#': pre = True
    for i in range(1, r):
        for j in range(c):
            if A[i][j] == '#': continue
            elif j == 0: A[i][j] = A[i-1][j]
            elif A[i-1][j] == '#' and A[i][j-1] == '#': A[i][j] = '#'
            elif A[i-1][j] == '#': A[i][j] = A[i][j-1]
            elif A[i][j-1] == '#': A[i][j] = A[i-1][j]
            else: A[i][j] = A[i][j-1] + A[i-1][j]
    if A[-1][-1] == '#': return 0
    else: return A[-1][-1] % ((10**9) + 7)

print(solve())

Measured memory_bytes: 219868
N = int(input())
s = [int(x) for x in input().split()]
 
a = 0
for i in range(N):
    if s[i]/2 == s[i]//2:
        if s[i]/3 == s[i]//3 or s[i]/5 == s[i]//5:
          a = a + 1
    else:
        a = a + 1
 
if a == N:
    print("APPROVED")
else:
    print("DENIED")

Measured memory_bytes: 3060
#[allow(unused_imports)]
use std::cmp::{Ordering};

#[allow(unused_imports)]
use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};

#[allow(unused_imports)]
use std::io::{stdin, stdout, BufWriter, Write};

#[allow(unused_imports)]
use std::iter::FromIterator;

#[allow(unused_macros)]
macro_rules! min {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::min($x, min!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! max {
    ($x: expr) => ($x);
    ($x: expr, $($z: expr),+) => {{
        std::cmp::max($x, max!($($z),*))
    }}
}

#[allow(unused_macros)]
macro_rules! get { 
    ([$t: ty]) => { 
        { 
            let mut line = String::new(); 
            stdin().read_line(&mut line).unwrap(); 
            line.split_whitespace().map(|t|t.parse::<$t>().unwrap()).collect::<Vec<_>>()
        }
    };
    ([$t: ty];$n: expr) => {
        (0..$n).map(|_|get!([$t])).collect::<Vec<_>>()
    };
    ($t: ty) => {
        {
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            line.trim().parse::<$t>().unwrap()
        }
    };
    ($($t: ty),*) => {
        { 
            let mut line = String::new();
            stdin().read_line(&mut line).unwrap();
            let mut iter = line.split_whitespace();
            ($(iter.next().unwrap().parse::<$t>().unwrap(),)*)
        }
    };
    ($t: ty; $n: expr) => {
        (0..$n).map(|_|get!($t)).collect::<Vec<_>>()
    };
    ($($t: ty),*; $n: expr) => {
        (0..$n).map(|_|get!($($t),*)).collect::<Vec<_>>()
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*).unwrap();
    }
}

const BIG_STACK_SIZE: bool = true;

#[allow(dead_code)]
fn main() {
    use std::thread;
    if BIG_STACK_SIZE {
        thread::Builder::new()
            .stack_size(32 * 1024 * 1024)
            .name("solve".into())
            .spawn(solve)
            .unwrap()
            .join()
            .unwrap();
    } else {
        solve();
    }
}

fn solve() {
    let n = get!(usize);
    let mut a = get!([usize]);
    a.sort();
    let mut sums = vec![0; n+1];
    for i in 0..n {
        sums[i+1] = sums[i]+a[i];
    }
    for i in (0..n).rev() {
        if 2*sums[i] < a[i] {
            println!("{}", n-i);
            return;
        }
    }
}


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

int main(){
    int a,b;cin>>a>>b;
    if ((a*b)%2)cout << "Odd" <<endl;
    else cout <<"Even" << endl;
    return 0;
}


Measured memory_bytes: 256
import java.util.*;

public class Main {

    public static void main(String[] args) throws Exception {
        Scanner stdId = new Scanner(System.in);
        int a = stdId.nextInt();
        int b = stdId.nextInt();
        String j;

        if (a < b) {
            j = "<";
        } else if (a == b) {
            j = "==";
        } else {
            j = ">";
        }

        System.out.println("a " + j + " b");

    }
}

Measured memory_bytes: 26252
# -*- coding: utf-8 -*-
"""
Created on Sun Dec 31 12:25:16 2017

@author: kanako_note
"""

N = int(input())

C = [0] * (N-1)
S = [0] * (N-1)
F = [0] * (N-1)

for i in range(N-1):
    C[i], S[i], F[i] = map(int, input().split())

for i in range(N):
    t = 0
    for j in range(i, N-1):
        if t<S[j]:  t = S[j]
        elif t%F[j]==0: pass
        else:   t = t+F[j]-t%F[j]
        t += C[j]
    print(t)

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

using namespace std;

typedef long long ll;

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

	int h, w;
	cin >> h >> w;

	vector<string> v(h);
	rep(i, h) cin >> v[i];

	rep(i, w + 2) cout << "#";
	cout << endl;

	rep(i, h){
		cout << "#" << v[i] << "#";
		cout << endl;
	}
	
	rep(i, w + 2) cout << "#";
	cout << endl;
}


Measured memory_bytes: 256
#include <iostream>

typedef long long ll;

int main() {
  ll N, D;  std::cin >> N >> D;
  D *= D;
  int ans = 0;
  for (int i = 0; i < N; ++i) {
    ll x, y;  std::cin >> x >> y;
    ll d2 = x*x + y*y;
    if (d2 <= D)
      ans++;
  }
  std::cout << ans << "\n";

  return 0;
}


Measured memory_bytes: 3672
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = s; i < (int)(n); i++)
#define chmax(a, b) a = max(a, b)
#define chmin(a, b) a = min(a, b)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

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

//const ll INF = 1e18L + 5;
//const int INF = 1e9 + 5;
//const double pi = 3.14159265358979323846;

void	solve()
{
	string o, e;
	cin >> o >> e;

	int no = o.size(), ne = e.size();
	int i = 0;
	while (i < ne)
	{
		cout << o[i] << e[i];
		i++;
	}
	if (i < no)
		cout << o.back() << endl;
	else
		cout << endl;
}

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

	solve();
}

Measured memory_bytes: 256
#pragma GCC -optimize(2)
#pragma GCC -optimize(3)
#pragma GCC -optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
template<class t> inline t read(t &x){
	x=0;char c=getchar();bool f=0;
	while(!isdigit(c)) f|=c=='-',c=getchar();
	while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
	if(f) x=-x;return  x;
}
template<class t> inline void write(t x){
	if(x<0){putchar('-'),write(-x);}
	else{if(x>9)write(x/10);putchar('0'+x%10);}
}

#include <tr1/unordered_map>
#define int long long

const int N=2e5+5;
int n,k,a[N],s[N],ans;
tr1::unordered_map<int,queue<int> > mp;

signed main(){
	read(n);read(k);
	for(int i=1;i<=n;i++){
		read(a[i]);
		s[i]=s[i-1]+a[i];
	}
	for(int i=1;i<=n;i++){
		int now=s[i]-i;
		now=(now%k+k)%k;
		while(!mp[now].empty()&&i-mp[now].front()>=k) mp[now].pop();
		ans+=mp[now].size();
		if(s[i]%k==i) ans++;
		mp[now].push(i);
	}
	write(ans);
}


Measured memory_bytes: 145992
#pragma region template 2.4
#include <bits/stdc++.h>
using namespace std;
template <typename T>
using pq_asc = priority_queue<T, vector<T>, greater<T>>;
typedef long long ll;
typedef vector<ll> vi;
typedef vector<vi> vvi;
typedef pair<ll, ll> ii;
typedef vector<ii> vii;
typedef vector<string> vs;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define REP1(i, n) for (ll i = 1; i <= (n); ++i)
#define FOR(i, a) for (auto &i : a)
#define CH(f, x, y) x = f(x, y)
#define IN(T, x) \
    T x;         \
    cin >> x;
#define AIN(T, a, n) \
    vector<T> a(n);  \
    FOR(i, a)        \
    cin >> i;
#define A2IN(T1, a, T2, b, n) \
    vector<T1> a(n);          \
    vector<T2> b(n);          \
    REP(i, n)                 \
    cin >> a[i] >> b[i];
#define OUT(x) cout << (x) << endl;
#define FOUT(x) cout << fixed << setprecision(15) << (x) << endl;
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))
#define DUMP(x) cout << #x << " = " << (x) << endl;
#define DUMPA(a)          \
    cout << #a << " = {"; \
    JOUT(ALL(a), cout, ", ") << "}" << endl;

template <typename T>
ostream &JOUT(T s, T e, ostream &os = cout, string sep = " ")
{
    if (s != e)
    {
        os << *s;
        ++s;
    }
    while (s != e)
    {
        os << sep << *s;
        ++s;
    }
    return os;
}

ostream &YES(bool cond, string yes = "Yes", string no = "No", ostream &os = cout)
{
    if (cond)
    {
        os << yes << endl;
    }
    else
    {
        os << no << endl;
    }
    return os;
}

template <typename T1, typename T2>
ostream &operator<<(ostream &os, const pair<T1, T2> &p)
{
    os << '(' << p.first << ", " << p.second << ')';
    return os;
}

template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v)
{
    os << '[';
    JOUT(ALL(v), os, ", ") << ']';
    return os;
}

const ll INF = 1e18;
const ll MOD = 1e9 + 7;
#pragma endregion template

int main()
{
    IN(ll, N);
    OUT((N + 1) / 2);
}

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

int main(){
    cout<<setprecision(8)<<fixed;
    int n; cin>>n;

    long double sum = 0;

    for(int i=0; i<n; i++){
        
        double money; string s;

        cin>>money>>s;

        if(s == "JPY")sum += money;

        else if( s == "BTC") sum += (money * 380000);
    } 

    cout<<sum<<endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define lli long long int
#define MOD 1000000007
#define INF INT_MAX // 2147483647
#define INFLL LLONG_MAX // 9223372036854775807
#define rep(i, n) for(int i=0; i<(int)(n); i++)
#define repf(i, n) for(int i=1; i<(int)(n+1); i++)
#define all(v) v.begin(), v.end()
#define endl "\n"
#define vi vector<lli>
#define vvi vector<vector<lli>>
#define Yes() cout << "Yes" << endl
#define YES() cout << "YES" << endl
#define No() cout << "No" << endl
#define NO() cout << "NO" << endl
using namespace std;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(10);
    string s;
    int n, cnt=0;
    cin >> n >> s;
    for(int i=0; i<n-2; i++){
        if(s.substr(i, 3) == "ABC") cnt++;
    }
    cout << cnt << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long int ll;

using namespace std;

int main()
{
    string S,T;

    cin  >> S >> T;


    int N =S.size();


    int count=0;
    for(int i=0;i<N;i++){


        if(S[i] != T[i]){

            count++;
        }
    }


    cout << count << endl;
    return 0;



}

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

int main(){
long long n;
cin >> n;

long long ans = 100000000000000;

for(long long i=1; i*i<=n; i++){

    if(n%i==0){
        long long p=i,q=n/i;
        ans=min(p+q-2,ans);

    }
}
cout << ans << endl;

}

Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <iomanip>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <vector>

using namespace std;
using LLONG = long long;

int main()
{
    int N, K, X, Y;
    cin >> N >> K >> X >> Y;
    if (N <= K)
    {
        cout << X * N << endl;
    }
    else
    {
        cout << X * K + Y * (N - K) << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <climits>
#include <string>
#include <queue>
#include <stack>
#include <map>
#include <cstring>
#include <numeric>
#include <set>

#define MOD 1000000007
#define INF 2000000000
#define sp ' '
#define st first
#define nd second
#define pb push_back
#define mp make_pair
#define FOR(YY, yy) for(long long yy = 0; yy < YY; ++yy)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector< vector<int> > vvi;
typedef pair<int, int> ii;
typedef vector<pair<int, int> > vii;
typedef vector<pair<int, pair<int, int> > > vpip;
typedef vector<bool> vb;
typedef priority_queue<int> pqi;

int N, M;
priority_queue<long long int> PQ;

int main(int argc, char **argv)
{
    ios::sync_with_stdio(); cin.tie(0);
    cin >> N >> M;
    for(int i = 0; i < N; ++i)
    {
        long long int temp = 0; cin >> temp;
        PQ.push(temp);
    }

    for(int i = 0; i < M; ++i)
    {
        long long int t = PQ.top(); PQ.pop();
        t >>= 1; PQ.push(t);
    }

    long long int sum = 0;
    while(!PQ.empty())
    {
        long long int n = PQ.top(); PQ.pop();
        sum += n;
    }
    cout << sum << endl;

    return 0;
}

//cikisir



Measured memory_bytes: 1400
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int x, y;
  	string ans = "No";
  cin >> x >> y;
  	for(int a = 0; a <= x; a++)
    {
      	int b = x - a;
      	if(a*2+b*4==y)
        {
          ans = "Yes";
        }
    }
  cout << ans;
}


Measured memory_bytes: 3596
#include <iostream>
#include <numeric>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)






int main() {
	char a, b,c='D';
	
	cin >> a >> b;
	if ((a == b)) {
		c = 'H';
	}

	
	cout <<c<< endl;
}


Measured memory_bytes: 256
n = int(input())
s = list(map(int, input().split()))
def partition(s, l, r):
    pivot = s[r]
    minVI = -1
    i = l
    while i < r:
        if s[i] <= pivot:
            minVI+=1
            s[minVI], s[i] = s[i], s[minVI]
        i+=1
    s[minVI+1], s[r] = s[r], s[minVI+1]
    return minVI+1
pivotI = partition(s, 0, len(s)-1)
answer = ''
for i in range(len(s)):
    if i!= 0:
        answer+=' '
    if i == pivotI:
        answer+='['+str(s[i])+']'
    else:
        answer+=str(s[i])
print(answer)


Measured memory_bytes: 16392
def bubbleSort(A, N):
    count = 0
    for j in range(N - 1):
        for i in reversed(range(j + 1, N)):
            if A[i - 1] > A[i]:
                temp = A[i]
                A[i] = A[i - 1]
                A[i - 1] = temp
                count = count + 1
    for i in range(N):
        print A[i],
    print
    print count

N = input()
A = map(int, raw_input().split())

bubbleSort(A, N)

Measured memory_bytes: 6328
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Competitive
{
    internal class Solution
    {
        public int N;
        public long MOD = 1000000007;
        public long[] A, B, X;
        public void Run()
        {
            N = Input.ReadInt();

            A = new long[N];
            B = new long[N];
            X = new long[N];
            for (int i = 0; i < N; i++)
            {
                var line = Input.ReadIntArray();
                A[i] = line[0];
                B[i] = line[1];
                X[i] = A[i] + B[i];
            }

            // 順位は
            Data[] D = new Data[N];
            for (int i = 0; i < N; i++)
            {
                D[i] = new Data(X[i], i);
            }
            Array.Sort(D, Data.CompareTo);
            Array.Reverse(D);

            long ret = 0;
            for (int i = 0; i < N; i++)
            {
                // 選ぶのはソート順
                int index = D[i].index;
                if (i % 2 == 0)
                    ret += A[index];
                else
                    ret -= B[index];
            }

            Console.WriteLine(ret);
        }
    }

    // libs ----------
    // 比較のみ
    class Data
    {
        public long x;
        public int index;

        public Data(long x, int index)
        {
            this.x = x;
            this.index = index;
        }

        // SortするときのComparerは明示的に指定する
        public static int CompareTo(Data d1, Data d2)
        {
            int result = d1.x.CompareTo(d2.x);
            if (result == 0)
                result = d1.index.CompareTo(d2.index);
            return result;
        }
    }

    // common ----------

    internal static class Input
    {
        public static string ReadString()
        {
            string line = Console.ReadLine();
            return line;
        }

        public static int ReadInt()
        {
            string line = Console.ReadLine();
            return int.Parse(line);
        }

        public static int[] ReadIntArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(int.Parse).ToArray();            
        }

        public static long ReadLong()
        {
            string line = Console.ReadLine();
            return long.Parse(line);
        }

        public static long[] ReadLongArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(long.Parse).ToArray();
        }

        public static double[] ReadDoubleArray()
        {
            string line = Console.ReadLine();
            return line.Split(' ').Select(double.Parse).ToArray();
        }
    }
    
    internal class Program
    {
        public static void Main(string[] args)
        {
            var s = new Solution();
            s.Run();
        }
    }
}

Measured memory_bytes: 23860
"use strict";
var input=require("fs").readFileSync("/dev/stdin","utf8");
var cin=input.split(/ |\n/),cid=0;
function next(){return +cin[cid++];}
function nextstr(){return cin[cid++];}
function nextbig(){return BigInt(cin[cid++]);}
function nexts(n,a){return a?cin.slice(cid,cid+=n):cin.slice(cid,cid+=n).map(a=>+a);}
function nextm(h,w,a){var r=[],i=0;if(a)for(;i<h;i++)r.push(cin.slice(cid,cid+=w));else for(;i<h;i++)r.push(cin.slice(cid,cid+=w).map(a=>+a));return r;}
function xArray(v){var a=arguments,l=a.length,r="Array(a["+--l+"]).fill().map(x=>{return "+v+";})";while(--l)r="Array(a["+l+"]).fill().map(x=>"+r+")";return eval(r);}

var myOut = main();
if(myOut !== undefined)console.log(String(myOut));

function main(){
  var [a,v,b,w,t] = nexts(5);
  var l = Math.abs(a-b);
  if(v <= w)return "NO";
  var dv = v-w;
  return l / dv <= t ? "YES" : "NO";
}

Measured memory_bytes: 29636
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,x) for(int i=0;i<x;i++)
#define put(ans)    cout << ans << endl;
#define reverse(s) reverse(s.begin(),s.end())

bool jugdg(int x[],int size,int t){
    for(int i=0;i<size;i++){
        if(t==x[i])
            return false;
    }
    return true;
}

int main(){
    int a,b,c;
    cin >> a >> b >> c;
    if(a<c&&b>c){
        puts("Yes");
    }else if(b<c&&a>c){
        puts("Yes");
    }else{
        puts("No");
    }

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define int long long
#define x first
#define y second
#define hashset unordered_set
#define hashmap unordered_map
#define getbit(x, i) (((x) >> (i)) & 1)
using namespace std;
typedef pair<int, int> pii;
template <typename T>
inline vector<T> readvector(size_t size) {
    vector<T> res(size);
    for (size_t i = 0; i < size; ++i) {
        cin >> res[i];
    }
    return res;
}
template <typename T>
inline void printvector(vector<T> &arr, string sep = " ", string ends = "\n") {
    for (size_t i = 0; i < arr.size(); ++i) {
    }
}
inline int binPow(int x, int deg, int mod) {
    int ans = 1;
    for (int i = sizeof(x) * CHAR_BIT - 1; i >= 0; i--) {
        ans *= ans;
        ans %= mod;
        if (getbit(deg, i)) ans *= x;
        ans %= mod;
    }
    return ans;
}
const int MAXN = 3e5 + 10;
const int MOD = 1e9 + 7;

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

    int n;
    cin >> n;
    int pos = 0;
    for (int i = 0; i < 60; i++) {
        if (getbit(n, i)) pos = i;
    }
    cout << (1ll << (pos + 1)) - 1 << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef tuple<string, int, int> tup;
typedef pair<int, int> p;

int main(){
  int n;
  cin >> n;
  vector<tup> rest(n);
  for(int i=0; i<n; ++i){
    string s;
    int x;
    cin >> s >> x;
    rest.at(i) = make_tuple(s, x, i);
  }
  sort(rest.begin(),rest.end());
  for(int i=0; i<n; ++i){
    vector<p> ans(0);
    for(int j=i; j<n; ++j){
      string s;
      int x, y;
      tie(s, x, y) = rest.at(j);
      ans.push_back(make_pair(x,y));
      if(j==n-1) break;
      if(s != get<0>(rest.at(j+1))) break;
      ++i;
    }
    sort(ans.begin(),ans.end());
    reverse(ans.begin(),ans.end());
    for(int j=0; j<(int)ans.size(); ++j){
      cout << ans.at(j).second +1 << endl;
    }
  }
}

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

int main(void) {
int A,B; cin >> A >> B;
int ans = -1;
for(int i=0; i<=1000; i++) {
    if((int)(i*0.08) == A && (int)(i*0.1) == B) {
        ans = i;
        break;
    }
}
cout << ans << endl;
}

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

using namespace std;
 
typedef long long ll;
typedef long double ld;
typedef pair<int, int> Pii;
typedef pair<int, ll> Pil;
typedef pair<ll, ll> Pll;
typedef pair<ll, int> Pli;

#define fi first
#define se second

const ll MOD = 1e9 + 7;
const ll MOD2 = 998244353;
const ll MOD3 = 1812447359;
const ll INF = 1ll << 62;
const double PI = 2 * asin(1);

void yes() {printf("yes\n");}
void no() {printf("no\n");}
void Yes() {printf("Yes\n");}
void No() {printf("No\n");}
void YES() {printf("YES\n");}
void NO() {printf("NO\n");}

string L;
int N;
ll DP1[int(1e5+5)], DP2[int(1e5+5)];

int main(){
  string L; cin >> L;
  N = L.length();

  DP1[0] = 1; DP2[0] = 2;
  for (int i = 1; i < N; i++){
    DP1[i] = DP1[i-1] * 3 % MOD;

    if (L[i] == '0'){
      DP2[i] = DP2[i-1];
    }else{
      DP1[i] += DP2[i-1]; DP1[i] %= MOD;
      DP2[i] = DP2[i-1] * 2 % MOD;
    }
  }

  ll ans = DP1[N-1] + DP2[N-1];
  cout << ans % MOD << endl;

  return 0;
}


Measured memory_bytes: 5288
#include<iostream>
#include<cstdio>
#include<iostream>
#include<queue>
#include<string>
#include<stdlib.h>

using namespace std;



int main()
{
	int N, limit;
	int total = 0;
	cin >> N >> limit;
	queue<pair<string, int> > Q;
	for (int i = 0; i < N; i++)
	{
		string s;
		int key;
		cin >> s >> key;
		Q.push(make_pair(s, key));
	}
	
	while (!Q.empty())
	{
		pair<string, int> q;
		q = Q.front();
		Q.pop();
		if (q.second > limit)
		{
			q.second -= limit;
			Q.push(q);
			total += limit;
		}
		else
		{
			total += q.second;
			cout << q.first << ' ' << total << endl;
			
		}
	}

	return 0;

}


Measured memory_bytes: 6252
N = int(input())
INF = 10 ** 9
dp = [0] + [INF for _ in range(N)]
for i in range(1,N+1):
  dp[i] = dp[i-1]+1
  for j in [6,9]:
    k = j
    while (k <= i):
      dp[i] = min(dp[i],dp[i-k]+1)
      k *= j
print(dp[N])

Measured memory_bytes: 45936
#include <iostream>
#include<algorithm>
#include<math.h>
#include<vector>
#include<string>
#include <queue>
#include <stack>
#include <cstring>
#include <map>
using namespace std;
typedef long long ll;
int d[4001][3];
int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
	int n; cin >> n;
	string s; cin >> s;
	ll ans = 0;
	if (s[0] == 'R')d[0][0] = 1;
	else if (s[0] == 'G')d[0][1] = 1;
	else d[0][2] = 1;
	for (int i = 1; i < s.size(); i++) {
		if (s[i] == 'R')d[i][0] = 1;
		else if (s[i] == 'G')d[i][1] = 1;
		else d[i][2] = 1;
		for (int j = 0; j < 3; j++) {
			d[i][j] += d[i - 1][j];
		}
	}

	for (int i = 0; i < s.size(); i++) {
		for (int j = i + 1; j < s.size(); j++) {
			if (s[i] == s[j])continue;
			if ((s[i] == 'R' && s[j] == 'G') || (s[i] == 'G' && s[j] == 'R')) {
				// B
				ans += d[s.size() - 1][2] - d[j][2];
				int k = j + (j - i);
				if (k < s.size() && s[k] == 'B')ans -= 1;
			}
			else if ((s[i] == 'R' && s[j] == 'B') || (s[i] == 'B'  && s[j] == 'R')) {
				// G
				ans += d[s.size() - 1][1] - d[j][1];
				int k = j + (j - i);
				if (k < s.size() && s[k] == 'G')ans -= 1;
			}
			else {
				// R
				ans += d[s.size() - 1][0] - d[j][0];
				int k = j + (j - i);
				if (k < s.size() && s[k] == 'R')ans -= 1;
			}
		}
	}
	cout << ans << '\n';


}

Measured memory_bytes: 3652
# coding: utf-8
from math import sqrt
a, b, c = map(int, input().split())
mod = 10**9 + 7
# if c**2 - 2*(a+b)*c + (a-b)**2 > 0:
# if a**2 + b**2 + c**2 >= 2 * (a*b + b*c + c*a):
if c-a-b > 0 and 4*a*b < (c-a-b)**2:
# T = sqrt(a*b + b*c + c*a) * 2
# if -T <= a+b+c <= T:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 2940
class PriorityQueue
  attr_reader :data

  def initialize(test_function = ->(a, b) { b <=> a })
    @data = []
    @test_function = test_function
  end

  def push(elem)
    @data << elem

    n = @data.size - 1
    while (n > 0)
      parent = (n - 1) / 2
      if @test_function.call(@data[n], @data[parent]) < 0
        tmp = @data[n]
        @data[n] = @data[parent]
        @data[parent] = tmp
      end
      n = parent
    end
  end

  def pop()
    max = @data[0]
    @data[0] = @data.last
    @data.pop

    parent = 0
    loop {
      child = 2 * parent + 1
      break unless child < @data.size

      child += 1 if (child < @data.size - 1 and @test_function.call(@data[child], @data[child + 1]) > 0)
      if @test_function.call(@data[parent], @data[child]) > 0
        tmp = @data[parent]
        @data[parent] = @data[child]
        @data[child] = tmp
      end
      parent = child
    }

    max
  end
end


xyzk, a, b, c = STDIN.read.lines.map { |line| line.split(/\s+/).map(&:to_i) }
k = xyzk[-1]

a.sort! { |x, y| y <=> x }
b.sort! { |x, y| y <=> x }
c.sort! { |x, y| y <=> x }

class ValueWithIndex
  attr_reader :v, :i, :j, :k

  def initialize(v, i, j, k)
    @v = v
    @i = i
    @j = j
    @k = k
  end
end

queue = PriorityQueue.new(->(a, b) { b.v <=> a.v })

queue.push(ValueWithIndex.new(a[0] + b[0] + c[0], 0, 0, 0))
registered = Hash.new
ret = []

k.times {
  m = queue.pop
  ret << m
  [[m.i + 1, m.j, m.k],[m.i, m.j + 1, m.k],[m.i, m.j, m.k + 1]].each { |ai, bi, ci|
    next if ai >= a.size or bi >= b.size or ci >= c.size

    key = [ai, bi, ci].join(',')
    unless registered.key? key
      queue.push(ValueWithIndex.new(a[ai] + b[bi] + c[ci], ai, bi, ci))
      registered[key] = true
    end
  }
}

puts ret.map(&:v).join("\n")


Measured memory_bytes: 3832
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define pi 3.1415926535897932384
#define all(v) v.begin(), v.end()
#define rep(i, n) for (ll i = 0; i < (ll)(n); i++)
ll h[200010];
int main()
{
   ll n,k;
    ll m=0;
    ll ans = 0;
    cin >> n >> k ;
    rep(m,n)cin >> h[m];
    sort(h,h+n);
    for(int  i=0;i < n-k;i++){
    	ans += h[i];
    	}
    cout << ans;
    return 0;
}


Measured memory_bytes: 1792
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        Main m = new Main(sc);
        m.show(m.solve());
        sc.close();
    }
    
	//フィールド
    Scanner sc;
    int N;
    int A;	//電車
    int B;	//タクシー
    
    //入力
    Main(Scanner sc) {
        this.sc = sc;
        N = sc.nextInt();
        A = sc.nextInt();
        B = sc.nextInt();
    }
    
    //解答処理
    private int solve() {
        
    	A *= N;
    	
    	int min = Math.min(A, B);
        return min;
    }
    
    //出力
    public void show(int answer) {
        System.out.println(answer);
    }

}

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

int main(){
  int n;cin >> n;
  vector<int> P(n);
  vector<int> Q(n);
  vector<int> A(n);
  for(int i=0; i<n; i++){
    cin >> P.at(i);
  }
  for(int i=0; i<n; i++){
  	cin >> Q.at(i);
  }
  for(int i=0; i<n; i++){
  	A.at(i) = i+1;
  }
  int a,b;
  int count = 0;
  do{
    count++;
    if(A==P){
      a=count;
    }
    if(A==Q){
      b=count;
    }
  }while(next_permutation(A.begin(),A.end()));
  cout << abs(a-b) << endl;
        
}

Measured memory_bytes: 256
H, W = map(int, input().split())
matrix = [str(input()) for i in range(H)]


matrix_1 = []
for i in range(H):
    if matrix[i] != "." * W:
        matrix_1.append(matrix[i])


matrix_2 = []
for i in range(W):
    a = ""
    for l in range(len(matrix_1)):
        a += matrix_1[l][i]
    matrix_2.append(a)


ans = []
k = len(matrix_1)
for i in range(W):
    if matrix_2[i] != "." * k:
        ans.append(matrix_2[i])


ans_2 = []
for i in range(len(ans[0])):
    a = ""
    for l in range(len(ans)):
        a += ans[l][i]
    ans_2.append(a)


for i in range(len(ans_2)):
    print(ans_2[i])

Measured memory_bytes: 3064
n = int(input())
from collections import Counter
li = []
for i in range (n):
    li.append(sorted(input()))
li.sort()
for i in range(n):
    li[i]="".join(li[i])

d = Counter(li)
L = list(d.values())

cnt = 0
for i in range(len(L)):
    cnt += L[i]*(L[i]-1)//2
print(cnt)

Measured memory_bytes: 30792
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n, m;
	cin >> n >> m;
	int ans = 0;
	if(n == 1 && m == 1){
		cout << 1 << endl;
		return 0;
	}
	if(n == 1 || m == 1){
		cout << max(n - 2, m - 2) << endl;
		return 0;
	}
	ans = n * m - 2 * n - 2 * m + 4;
	cout << ans << endl;
}

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

using namespace std;
using lint = long long;


int main(){
    int n;
    cin>>n;
    int ans=0;
    for (int i=0; i<n; i++) {
      string s;
      s=to_string(i+1);
      ans+=s.size()%2;
    }
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
#AtCorder Beginner Contest 081 B-Shift only
num = int(input())
list = [int(x) for x in input().split()]

cnt = 0
min = float("inf")

for i in list:
    while i%2 == 0:
        i = i/2
        cnt += 1
    if cnt == 0:
        min = cnt
        break
    elif cnt < min:
        min = cnt
    cnt = 0

print(str(min))

Measured memory_bytes: 3188
N = int(input())
As = list(map(int, input().split()))

ans = float('inf')
iB, iD = 1, 3
(P, Q, R), S = As[:3], sum(As[3:])

# 真ん中の区切りを全通り試す
for iC in range(2, N - 1):
    while P < Q and As[iB] <= Q - P:
        P += As[iB]
        Q -= As[iB]
        iB += 1

    while R < S and As[iD] <= S - R:
        R += As[iD]
        S -= As[iD]
        iD += 1

    ans = min(ans, max(P, Q, R, S) - min(P, Q, R, S))

    Q += As[iC]
    R -= As[iC]

print(ans)


Measured memory_bytes: 25056
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < n; ++i)
#define rrep(i,n) for (int i = n-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = s; i < n; ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define tmax(a,b,c) max(a,max(b,c))
#define tmin(a,b,c) min(a,min(b,c))
#define pb push_back
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class T> inline bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> inline bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int main() {
    int n;
    cin >> n;
    set<int> s;
    rep(i,n) {
        int a;
        cin >> a;
        s.insert(a);
    }
    cout << (s.size() == n ? "YES" : "NO") << endl;
} 


Measured memory_bytes: 9600
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	scan := bufio.NewScanner(os.Stdin)
	scan.Scan()
	scan.Scan()
	var in []int
	for _, i := range strings.Split(scan.Text(), " ") {
		v, _ := strconv.Atoi(i)
		in = append(in, v)
	}

	c := bubbleSort(in)
	
	trace(in)
	fmt.Println(c)
}

func bubbleSort(in []int) (count int) {
	for i := 0; i < len(in); i++ {
		for j := len(in)-1; j > i; j-- {
			if in[j] < in[j-1] {
				t := in[j]
				in[j] = in[j-1]
				in[j-1] = t

				count++
			}
		}
	}
	return count
}

func trace(in []int) {
	if len(in) > 0 {
		fmt.Print(in[0])
		for _, i := range in[1:] {
			fmt.Print(" ", i)
		}
	}

	fmt.Println("")
}


Measured memory_bytes: 1108
#include <algorithm>
#include <cassert>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long ll;

#define rep(i, n) for(ll i = 0; i < n; i++)
#define REP(i, n) for(ll i = 1; i < n + 1; i++)
#define PI 3.14159265359
#define EPS 0.0000000001
#define MOD 1000000007
//cout << std::fixed << std::setprecision(15) << y << endl;


int main(){
    ll N, L;
    cin >> N >> L;

    if(L <= 0 && L + N - 1 > 0){
        cout << N * (L + L + N - 1) / 2 << endl;
    }else if(L + N - 1 <= 0){
        cout << (N - 1) * (L + L + N - 2) / 2 << endl;
    }else{
        cout << (N - 1) * (L + 1 + L + N - 1) / 2 << endl;
    }

    return 0;
}

Measured memory_bytes: 3544
import sys
input = sys.stdin.readline
import math
def main():
    A, B, H, M = map(int, input().split())
    s_rad = 0
    if H == 0:
        s_rad = math.pi/2
    elif H <= 3:
        s_rad = (3-H)/12*2*math.pi
    else:
        s_rad = math.pi/2 + (12-H)/12*2*math.pi
    s_rad -= M/60*2*math.pi/12
    l_rad = 0
    if M == 0:
        l_rad = math.pi/2
    elif M <= 15:
        l_rad = (15-M)/60*2*math.pi
    else:
        l_rad = math.pi/2 + (60-M)/60*2*math.pi
    sx = A * math.cos(s_rad)
    sy = A * math.sin(s_rad)
    lx = B * math.cos(l_rad)
    ly = B * math.sin(l_rad)
    ans = math.sqrt(((sx-lx)**2) + ((sy-ly)**2))
    print(ans)
if __name__ == "__main__":
    main()

Measured memory_bytes: 62456
# -*- coding: utf-8 -*-
from sys import stdin
# import numpy as np
# import sys
# sys.setrecursionlimit(10**4)

def _li(): return list(map(int, stdin.readline().split()))
def _li_(): return list(map(lambda x: int(x)-1, stdin.readline().split()))
def _lf(): return list(map(float, stdin.readline().split()))
def _ls(): return stdin.readline().split()
def _i(): return int(stdin.readline())
def _f(): return float(stdin.readline())
def _s(): return stdin.readline()[:-1]


A, B = _li()
print(max(A+B, A-B, A*B))


Measured memory_bytes: 3064
#include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
using namespace std;
#define MAXN 100000 + 100
#define ll long long int
ll N[MAXN];
ll w[200];
ll v[200];
ll n;
ll max_V;
int main()
{
    cin>>n>>max_V;
    for(int i = 0;i < n;++i)
        cin>>v[i]>>w[i];
    for(int i = 0;i < n;++i)
        for(int j = max_V;j >= v[i];--j)
            N[j] = max(N[j], N[j - v[i]] + w[i]);
    cout<<N[max_V]<<endl;

    return 0;
}


Measured memory_bytes: 1024
N, W = map(int, input().split())
w = [0]*N
v = [0]*N
for i in range(N):
    w[i], v[i] = map(int, input().split())

dp = [[0]*(W+1) for _ in range(N+1)]
# dp[i][sum_w]
# i-1番目までの品物から重さがsum_wを超えないように選んだ時の価値の総和
# sum_w = 0, 1, 2, ... ,W

for i in range(N):
    for sum_w in range(W+1):
        if sum_w - w[i] >= 0:
            dp[i+1][sum_w] = dp[i][sum_w - w[i]] + v[i]

        dp[i+1][sum_w] = max(dp[i+1][sum_w], dp[i][sum_w])
print(dp[N][W])

Measured memory_bytes: 120684