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

using namespace std;

using ll = long long;

int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, m;
  cin >> n >> m;
  vector<bool> a(n + 1, 0);
  while (m--) {
    int i;
    cin >> i;
    a[i] = 1;
  }
  vector<ll> c(n + 1);
  c[0] = 1;
  ll M = (ll)1e9 + 7;
  for (int i = 1; i <= n; i++) {
    if (a[i]) {
      c[i] = 0;
    } else if (i == 1) {
      c[i] = 1;
    } else {
      c[i] = c[i - 2] + c[i - 1];
      c[i] %= M;
    }
  }
  cout << c[n] << '\n';
  return 0;
}


Measured memory_bytes: 3952
#include <bits/stdc++.h>
using namespace std;
int main(){
  
  int n, k;
  cin >> n >> k;
  
  vector<int> v(n);
  for(int i; i < n; i++)
    cin >> v.at(i);
  
  sort(v.begin(), v.end());
  
  int p = 0;
  int q = 1000000000;
  
  while(p < n-k+1){
    if(q > (v.at(p+k-1)-v.at(p)))
       q = v.at(p+k-1)-v.at(p);
    p++;
  }
  cout << q << endl;
}
       
       
       
  
  

Measured memory_bytes: 640
/* Author : Aaryan Srivastava ^__^ */ 
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second   
#define rep(i,n) for(int i = 0 ; i < (n) ; i++)
#define repA(i,x,y) for(int i = (x) ; i <= (y) ; i++)
#define repD(i,x,y) for(int i = (x) ; i >= (y) ; i--)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define setval(a,val) memset(a,val,sizeof(a))
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define trav(x , a) for(auto &x : a)
#define sz(a) ((int)a.size())
typedef long long ll ; 
#define int ll
using namespace std;

const int N = 3e5 + 5 ;
const int mod = 1e9 + 7 ;
const ll inf = 1e18 ;
const int SZ = 101 ;
const long double eps = 1e-9 ;

using namespace __gnu_pbds;
using ordered_set =  tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ;

typedef pair<int, int> pii; 
typedef pair<int , pii> ipii ;
typedef pair<pii , int> piii ; 
typedef unsigned long long ull ;
typedef long double ld;

ll po(ll x,ll y,ll p = mod) {ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}

void solve()
{
  int n , m , X , Y;
  cin >> n >> m >> X >> Y;
  vector<int> x(n) , y(m) ;
  trav(a , x) cin >> a ;
  trav(a , y) cin >> a; 
  sort(all(x));
  sort(all(y));
  int l = x.back() + 1;
  int r = y[0];
  l = max(l , X + 1);
  r = min(r , Y);
  cout << (l > r ? "War" : "No War");
}
     
int32_t main(int32_t argc, char *argv[])
{
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    int TC = 1, t = 0;
    //cin >> TC ;
    while(t++ < TC)
    {
        //cout << "Case #" << t << ": " ;
        solve();
        cout << "\n" ;
    }
    return 0;
}


Measured memory_bytes: 3576
#include "bits/stdc++.h"
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> mat;
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define rep(i,n) FOR(i,0,n)
#define ALL(x) (x).begin(),(x).end()
#define RALL(x) (x).rbegin(),(x).rend()
#define mset(a,x) memset(a,x,sizeof(a))
#define OUT(x) cout<<(x)<<"\n"
#define SZ(x) (int)(x).size()
#define FASTIO cin.tie(0),ios::sync_with_stdio(0)

const int MOD = int(1e9) + 7;
int n, m;
ll X[100010], Y[100010];

int main() {
    FASTIO;
    cin >> n >> m;
    rep(i, n) cin >> X[i];
    rep(i, m) cin >> Y[i];

    ll xs = 0, ys = 0;
    rep(k, n) {
        xs += X[k] * k - X[k] * (n - k - 1);
        xs %= MOD;
    }
    rep(k, m) {
        ys += Y[k] * k - Y[k] * (m - k - 1);
        ys %= MOD;
    }

    cout << (xs * ys) % MOD << endl;

    return 0;
}

Measured memory_bytes: 1792
// #define _GLIBCXX_DEBUG // for STL debug (optional)
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <fstream>
#include <functional>
#include <bitset>
using namespace std;
using ll = long long int;
using int64 = long long int;
 
template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}
 
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
const int INF = 1LL << 29;
const ll LONGINF = 1LL << 60;
const ll MOD = 1000000007LL;
 
int main() {
    int A, B; cin >> A >> B;
    cout << max(0, A - 2*B) << endl;
    return 0;
}


Measured memory_bytes: 256
using System;
using static System.Console;
using static System.Math;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TemplateAlgorithm
{
    class Program
    {
        public const long Inf = (long)1e18;
        public const double eps = 1e-6;
        public const string alfa = "abcdefghijklmnopqrstuvwxyz";
        public const string ALFA = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
        public const int MOD = 1000000007;
        
        // c ot i
        static int ToInt(char c) => c - '0';

        static void Main(string[] args)
        {
            int N = IO.ReadInt();
            int[] H = IO.ReadIntArr();
            Array.Sort(H);
            int other = H.Take(N - 1).Sum();
            int longest = H.Max();

            if (longest < other) WriteLine("Yes");
            else WriteLine("No");
        }

        #region  範囲

        public static bool InRange<T>(T begin, T end, T value) where T : IComparable<T> 
            => value.CompareTo(begin) >= 0 && value.CompareTo(end) <= 0;

        #endregion

        #region MIN,MAX

        /// <summary>
        /// 最大値を返す
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="vals"></param>
        /// <returns></returns>
        public static T MaxValue<T>(params T[] vals) => vals.Max();

        /// <summary>
        /// 最小値を返す
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="vals"></param>
        /// <returns></returns>
        public static T MinValue<T>(params T[] vals) => vals.Min();
        #endregion
    }

    #region IO

    /// <summary>
    /// IO
    /// </summary>
    public class IO
    {
        public static string ReadStr(bool isTrim = false) => (isTrim) ? ReadLine().Trim() : ReadLine();
        public static int ReadInt() => int.Parse(ReadStr());

        public static long ReadLong() => long.Parse(ReadStr());

        public static decimal ReadDecimal() => decimal.Parse(ReadStr());
        public static double ReadDouble() => double.Parse(ReadStr());
        public static string[] ReadStrArr(char separator = ' ') => ReadLine().Split(separator);
        public static int[] ReadIntArr() => Array.ConvertAll(ReadStrArr(), int.Parse);
        public static long[] ReadLongArr() => Array.ConvertAll(ReadStrArr(), long.Parse);

        public static decimal[] ReadDecimalArr() => Array.ConvertAll(ReadStrArr(), decimal.Parse);
        public static double[] ReadDoubleArr() => Array.ConvertAll(ReadStrArr(), double.Parse);        
    }

    #endregion    
}


Measured memory_bytes: 13396
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()
{
  long h, w;
  readf("%s %s\n", &h, &w);

  auto s = h * w;

  long df = s;

  foreach (_; 0..2) {
    swap(h, w);

    foreach (i; 1..w) {
      auto s1 = h * i;

      //v
      auto vl = (w - i) / 2;
      auto s2 = h * vl;
      auto s3 = s - s1 - s2;
      df = min(df, max(max(s1, s2), s3) - min(min(s1, s2), s3));
      //h
      auto hl = h / 2;
      s2 = hl * (w - i);
      s3 = s - s1 - s2;
      df = min(df, max(max(s1, s2), s3) - min(min(s1, s2), s3));
    }
  }

  df.writeln;
}


Measured memory_bytes: 256
#k = int(input())
#s = input()
#a, b = map(int, input().split())
#s, t = map(str, input().split())
#l = list(map(int, input().split()))
#l = [list(map(int,input().split())) for i in range(n)]
#a = [list(input()) for _ in range(n)]

K = int(input())
ans = 0
for i in range(1, K+1):
    for j in range(i+1, K+1):
        if (i % 2 == 0 and j % 2 != 0):
            ans += 1
        elif (i % 2 != 0 and j % 2 == 0):
            ans += 1
print(ans)




Measured memory_bytes: 8908
//
// Created on 2020/04/19.
//


#include <iostream> // cout, endl, cin
#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
#include <math.h>
#include <ios>
#include <iomanip>
#include <numeric>

#define all(x) (x).begin(),(x).end()
typedef long long ll;
using namespace std;
const long long LINF =1e18;
const int INF = 1e9;


int main() {
    double ans;
    double r;
    cin>>r;
    static const double pi =acos(-1);

    ans = 2 * r * pi;
    printf("%.20f\n",ans);
  return 0;


}


Measured memory_bytes: 3784
#include <bits/stdc++.h>
#define rp(i,n) for(int i=0; i<n; i++)
using namespace std;
using ll=long long;
using P=pair<int,int>;
using G=vector<vector<int>>;

int dp[103][2][4];
int main(){
    string n;
    cin >> n;
    int t;
    cin >> t;
    int digit=n.size();
    int hi=n[0]-'0';
    if(digit==1){
        if(t>1){
            cout << 0 << endl;
            return 0;
        }
        cout << hi << endl;
        return 0;
    }
    dp[1][0][1]=hi-1;
    dp[1][1][1]=1;
    dp[1][0][0]=1;
    for(int i=2; i<=digit; i++){
        for(int k=0; k<=min(i,3); k++){
            if(k==0){
                dp[i][0][0]=dp[i-1][0][0];
                continue;
            }
            if(n[i-1]=='0'){
                dp[i][0][k]=dp[i-1][0][k]+dp[i-1][0][k-1]*9;
                dp[i][1][k]=dp[i-1][1][k];
            }
            else{
                dp[i][1][k]=dp[i-1][1][k-1];
                dp[i][0][k]=dp[i-1][0][k]+dp[i-1][0][k-1]*9+dp[i-1][1][k]+dp[i-1][1][k-1]*(n[i-1]-'1');
            }
        }
    }
    cout << dp[digit][0][t]+dp[digit][1][t] << endl;
    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 ll;

int main() {
  int c['z' - 'a' + 1] = {0};
  char tmp;
  cin >> noskipws >> tmp;
  int i = 0;
  do {
    if ('a' <= tmp && tmp <= 'z') {
      c[tmp - 'a']++;
    } else if ('A' <= tmp && tmp <= 'Z') {
      c[tmp - 'A']++;
    }
    cin >> noskipws >> tmp;
  } while (cin.eof() == false);

  rep(i,'z' - 'a' + 1) {
    char t = 'a' + i;
    cout << t << " : " << c[i] << endl;
  }
  return 0;
}



Measured memory_bytes: 3092
import math
n = int(input())
p = list(map(int,input().split()))
q = list(map(int,input().split()))
pp = sorted(p)
qq = sorted(q)

x = 0
y = 0
l = 1
m = 1
for i in p[:n-1]:
    x += math.factorial(n-l)*pp.index(i)
    l += 1
    pp.remove(i)
    del p[0]
    
for j in q[:n]:
    y += math.factorial(n-m)*qq.index(j)
    m += 1
    qq.remove(j)
    del q[0]

print(abs((x+1)-(y+1)))

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
 
class Atest {
    static void Main(string[] args) {
        String n = Console.ReadLine();
        switch(n)
        {
            case "a":
                Console.WriteLine("b");
                break;
            case "b":
                Console.WriteLine("c");
                break;
            case "c":
                Console.WriteLine("d");
                break;
            case "d":
                Console.WriteLine("e");
                break;
            case "e":
                Console.WriteLine("f");
                break;
            case "f":
                Console.WriteLine("g");
                break;
            case "g":
                Console.WriteLine("h");
                break;
            case "h":
                Console.WriteLine("i");
                break;
            case "i":
                Console.WriteLine("j");
                break;
            case "j":
                Console.WriteLine("k");
                break;
            case "k":
                Console.WriteLine("l");
                break;
            case "l":
                Console.WriteLine("m");
                break;
            case "m":
                Console.WriteLine("n");
                break;
            case "n":
                Console.WriteLine("o");
                break;
            case "o":
                Console.WriteLine("p");
                break;
            case "p":
                Console.WriteLine("q");
                break;
            case "q":
                Console.WriteLine("r");
                break;
            case "r":
                Console.WriteLine("s");
                break;
            case "s":
                Console.WriteLine("t");
                break;
            case "t":
                Console.WriteLine("u");
                break;
            case "u":
                Console.WriteLine("v");
                break;
            case "v":
                Console.WriteLine("w");
                break;
            case "w":
                Console.WriteLine("x");
                break;
            case "x":
                Console.WriteLine("y");
                break;
            case "y":
                Console.WriteLine("z");
                break;
        }
    }
}


Measured memory_bytes: 11220
#include <iostream>
#include <cstdio>
#include <vector>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <array>
#include <map>
#include <queue>
#include <limits.h>
#include <set>
#include <stack>
#include <random>
#include <complex>
#define rep(i,s,n) for(int i = (s); (n) > i; i++)
#define REP(i,n) rep(i,0,n)
#define RANGE(x,a,b) ((a) <= (x) && (x) <= (b))
#define DUPLE(a,b,c,d) (RANGE(a,c,d) || RANGE(b,c,d) || RANGE(c,a,b) || RANGE(d,a,b))
#define INCLU(a,b,c,d) (RANGE(a,c,d) && (b,c,d))
#define PW(x) ((x)*(x))
#define ALL(x) (x).begin(), (x).end()
#define MODU 1000000007
#define bitcheck(a,b)   ((a >> b) & 1)
#define bitset(a,b)      ( a |= (1 << b))
#define bitunset(a,b)    (a &= ~(1 << b))
#define MP(a,b) make_pair((a),(b))
#define Manh(a,b) (abs((a).first-(b).first) + abs((a).second - ((b).second))
using namespace std;
typedef pair<int, int> pii;
typedef long long ll;

const pii Dir[8] = { //?????????
	{ 0,1 },{ 0,-1 },{ 1,0 },{ -1,0 },
	{ 1,1 },{ 1,-1 },{ -1,-1 },{ -1,1 }
};
template<typename A, size_t N, typename T>
void Fill(A(&array)[N], const T &val) {
	std::fill((T*) array, (T*) (array + N), val);
}

signed main() {
	int n, m;
	ll dp[16] = {};
	dp[0] = 1;
	rep(i, 1,16) {
		dp[i] = dp[i - 1] * 3;
	}

	while (scanf("%d %d", &n, &m)) {
		if (n == 0)
			break;
		vector<int> pos(n);
		REP(i, 3) {
			int c;
			scanf("%d", &c);


			REP(j, c) {
				int size;
				scanf("%d", &size);

				pos[size - 1] = i;
			}
		}
		ll ans = 0, ans2 = 0;
		bool curs = 0;
		REP(i, n) {
			if (pos[i] % 2) {
				ans += dp[n - i - 1];
				curs = 1 - curs;
			}
			else if (curs * 2 - pos[i]) {
				ans += dp[n - i-1]*2;
			}
		}
		curs = 1;
		REP(i, n) {
			if (pos[i] % 2) {
				ans2 += dp[n - i - 1];
				curs = 1 - curs;
			}
			else if (curs * 2 - pos[i]) {
				ans2 += dp[n - i-1]*2;
			}
		}
		ans = min(ans2, ans);
		if (ans > m)
			ans = -1;
		printf("%lld\n", ans);
	}
	return 0;
}

Measured memory_bytes: 3144
#include <bits/stdc++.h>
    #include <ext/pb_ds/assoc_container.hpp>
    #include <ext/pb_ds/tree_policy.hpp>
    #include <ext/pb_ds/detail/standard_policies.hpp>
 
    using namespace std;
    using namespace __gnu_pbds;
 
    #define endl "\n"
    #define fi first
    #define se second
    #define pb push_back
    #define int long long 
    #define ll long long
    #define ld long double
    #define pii pair<ll,ll>
 
    #define read(t) ll t;cin>>t;
    #define all(x) x.begin(),x.end()
    #define f(a,b,c) for(ll a=b;a<c;a++)
    #define For(i,n) for(ll i=0;i<n;i++)
 
    #define what(x) cerr << #x << " is " << x << endl;
    #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL) ;
 
    typedef tree<pair<ll,ll>, null_type,less<pair<ll,ll>>, rb_tree_tag,tree_order_statistics_node_update> omultiset;
    typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> oset;
    typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> oset1;
 
/*.....................................................................................................................*/
 
    const ll mod=(ll)1e9+ 7;
 
    ll add(ll x,ll y) {return (x+y)%mod;}
    ll mult(ll x, ll y){return ((x%mod )* (y%mod)) % mod;}
 
    long long binpow(long long x, long long p) 
    {
        if (p == 0) {return 1;} 
    	if (p == 2 || (p & 1)) {return mult(x, binpow(x, p - 1));}
    	return binpow(binpow(x, p / 2), 2);
    }
    ll modinv(ll a) {return binpow(a,mod-2);}
 
    //A.erase(unique(A.begin(),A.end()),A.end());
    double pi=3.141592653589793238462641;
    ll dx[4]={1,-1,0,0},dy[4]={0,0,1,-1};
    const ll  man  =   (int)200005   ,  inf   =   1e18;
 
 
/*......................................................................................................................*/



signed main()
{
    fast;
    int n;
    cin>>n;
    vector<ld>p(n+1);
    for(int i=1;i<=n;i++)
    {
        cin>>p[i];
    }
    vector<vector<ld>>dp(n+1,vector<ld>(n+1));
    dp[0][0]=1.0;
    for(int i=1;i<=n;i++)
    {
        for(int j=0;j<=i;j++)
        {
            if(j==0)
            {
                //headsifzero
                dp[i][j]=dp[i-1][j]*(1.0-p[i]);
            }
            else 
            {
                dp[i][j]=dp[i-1][j]*(1.0-p[i])+dp[i-1][j-1]*p[i];
            }
        }
    }
    ld ans=0;
    for(int j=(n+1)/2;j<=n;j++)
    {
        ans+=dp[n][j];
    }
    cout<<fixed<<setprecision(10)<<ans<<endl;
}   

Measured memory_bytes: 144216
def f(xyz)
    xyz[0]*xyz[0] + xyz[1]*xyz[1] + xyz[2]*xyz[2] + xyz[0]*xyz[1] + xyz[1]*xyz[2] + xyz[2]*xyz[0]
end
 
def countCombination(xyz)
    c = xyz.uniq.size
    if c == 1 then
        return 1
    elsif c == 2 then
        return 3
    else
        return 6
    end
end
 
n = gets.chomp.to_i
MAX = 1000000
ans = Array.new(MAX, 0)
 
[*1..300].repeated_combination(3) do |xyz|
    ans[f(xyz)] += countCombination(xyz)
end
 
(1..n).each do |i|
    puts ans[i]
end

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

int main() {
  long long L, R;
  cin >> L >> R;
  if (R - L + 1 >= 2019) cout << 0 << endl;
  else {
    long long ans = 2020;
    for (long long i = L; i < R; i++) {
      for (long long j = L+1; j <= R; j++) {
        ans = min(ans, (i*j) % 2019);
      }
    }
    cout << ans << endl;
  }
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cmath>
#include <complex>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#include <stack>
#include <string>
#include <vector>

const int MOD = 1e9 + 7;
const int iINF = 2147483647 / 2;
const long long int llINF = 9223372036854775807 / 2;

using namespace std;
using ll = long long int;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
using vvvl = vector<vector<vector<ll>>>;

typedef pair<ll, ll> pll;
bool paircomp(const pll &a, const pll &b) {
  if (a.first == b.first)
    return a.second < b.second;
  return a.first < b.first;
}

#define REP(i, n) for (ll i = 0; i < (n); i++)
#define RREP(i, n) for (ll i = (n)-1; i >= 0; i--)
#define FOR(i, a, b) for (ll i = (a); i < (b); i++)
#define AUTO(i, m) for (auto &i : m)
#define ALL(a) (a).begin(), (a).end()
#define MAX(vec) *std::max_element(vec.begin(), vec.end())
#define MIN(vec) *std::min_element(vec.begin(), vec.end())
#define ARGMAX(vec)                                                            \
  std::distance(vec.begin(), std::max_element(vec.begin(), vec.end()))
#define ARGMIN(vec)                                                            \
  std::distance(vec.begin(), std::min_element(vec.begin(), vec.end()))
#define REV(T) greater<T>()
#define PQ(T) priority_queue<T, vector<T>, greater<T>>
#define VVL(a, b, c) vector<vector<ll>>(a, vector<ll>(b, c))
#define VVVL(a, b, c, d)                                                       \
  vector<vector<vector<ll>>>(a, vector<vector<ll>>(b, vector<ll>(c, d)))
#define SP(a) setprecision(a)
#define SQRT(a) sqrt((long double)(a))
#define DPOW(a, b) pow((long double)(a), (long double)(b))
#define UNIQUE(vec)                                                            \
  do {                                                                         \
    sort(ALL((vec)));                                                          \
    (vec).erase(std::unique(ALL((vec))), (vec).end());                         \
  } while (0)

ll POW(ll n, ll m) {
  if (m == 0) {
    return 1;
  } else if (m % 2 == 0) {
    ll tmp = POW(n, m / 2);
    return (tmp * tmp);
  } else {
    return (n * POW(n, m - 1));
  }
}

int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  ll N;
  cin >> N;
  vector<long double> v(N);
  REP(i, N) cin >> v[i];
  sort(ALL(v));
  long double ans = v[0];
  FOR(i, 1, N) { ans = (ans + v[i]) / 2; }
  cout << SP(20) << ans << endl;

  return 0;
}


Measured memory_bytes: 888
package main

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

var sc = bufio.NewScanner(os.Stdin)

func nextLine() string {
	sc.Scan()
	return sc.Text()
}

func count(n int) int {
	res := 0
	l := int(math.Trunc(math.Sqrt(float64(n))))

	for i := 1; i <= l; i++ {
		if i*i == n {
			res++
		} else if n%i == 0 {
			res += 2
		}
	}

	return res
}

func main() {
	line := nextLine()

	n, _ := strconv.Atoi(line)
	ans := 0

	if n < 105 {
		ans = 0
	} else {
		for i := 105; i <= n; i += 2 {
			if count(i) == 8 {
				ans++
			}
		}
	}

	fmt.Println(ans)
}


Measured memory_bytes: 640
a,b,c,d,e,f=map(int,input().split())
water=[]
sugar=[]
ans,ans_2,con=0,0,0
for i in range(f//100+1):#f//100+1によりTLEを解消
    for j in range(f//100+1):
        x=100*a*i+100*j*b
        if x<=f:
            water.append(x)
for i in range(f):
    for j in range(f):
        y=c*i+d*j
        if y<=f:
            sugar.append(y)
sugar=list(set(sugar))
for i in water:
    for j in sugar:
        if i+j<=f:
            if i!=0 or j!=0:
                if j<=(i//100)*e:
                    now=(100*j)/(i+j)
                    if con<=now:
                        ans=i+j
                        ans_2=j
                        con=now
print(ans,ans_2)


Measured memory_bytes: 12440
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9+7;
int main(){
  ios::sync_with_stdio(0);
  cin.tie(0);
  string s;
  cin >> s;
  int n = s.size();
  int nbR = 1,nbL = 0;
  for(int i = 1; i < n; ++i){
    if(s[i] == 'R' and s[i-1] == 'L'){
      for(int j = 0; j < nbR-1; ++j) cout << "0 ";
      int left = (nbL+nbR)/2,right = left;
      if((nbL-nbR)&1){
        if(nbL > nbR){
          if(nbL&1) ++right;
          else ++left;
        }
        else{
          if(nbR&1) ++left;
          else ++right;
        }
      }
      cout << left << ' ' << right << ' ';
      for(int j = 0; j < nbL-1; ++j) cout << "0 ";
      nbR = 1;
      nbL = 0;
    }
    else if(s[i] == 'R') ++nbR;
    else ++nbL;
  }
  for(int j = 0; j < nbR-1; ++j) cout << "0 ";
  int left = (nbL+nbR)/2,right = left;
  if((nbL-nbR)&1){
    if(nbL > nbR){
      if(nbL&1) ++right;
      else ++left;
    }
    else{
      if(nbR&1) ++left;
      else ++right;
    }
  }
  cout << left << ' ' << right << ' ';
  for(int j = 0; j < nbL-1; ++j) cout << "0 ";
  return 0;
}

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

int main() {
	int n;
	cin >> n;
	vector<int> b(n + 1);
	b[0] = 1001001001;
	b[n] = 1001001001;
	for (int i = 1; i < n; ++i)cin >> b[i];
	vector<int> res;
	rep(i, n) {
		int tmp = min(b[i], b[i + 1]);
		res.emplace_back(tmp);
	}
	int ans = 0;
	for (auto& c : res) ans += c;
	cout << ans << endl;
	return 0;
}


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

int MAX_ANS = 1000000000+7;

long pow_(long x, int n) {
	long ans = 1;
    while (n > 0) {
		if ((n & 1) == 1) {
			ans = (ans * x) % MAX_ANS;
		}
        x = (x * x) % MAX_ANS;
		n >>= 1;
	}
    return ans;
}

long weak_num(int a, int n) {
    long x = 1, y = 1;
    for(int i=n-a+1; i<=n; i++) x = (x*i) % MAX_ANS;
    for(int i=1; i<=a; i++) y = (y*i) % MAX_ANS;
    long ans = (x * pow_(y, MAX_ANS-2)) % MAX_ANS;
    return ans;
}

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

    long ans = pow_(2, n) - 1;
    ans = (ans - weak_num(a, n) + MAX_ANS) % MAX_ANS;
    ans = (ans - weak_num(b, n) + MAX_ANS) % MAX_ANS;
    cout << ans << endl;
}


Measured memory_bytes: 256
<?php
$cards = explode(" ",trim(fgets(STDIN)));
$k = trim(fgets(STDIN));
$ans = 'No';
for ($i = 0;$i < $k;++$i) {
    if ($cards[0] >= $cards[1]) {
        $cards[1] *= 2;
    } else {
        $cards[2] *= 2;
    }
}

if ($cards[0] < $cards[1] and $cards[1] < $cards[2]) {
    $ans = "Yes";
}

echo $ans.PHP_EOL;

Measured memory_bytes: 16164
/**Bismillahir Rahmanir Rahim**/


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

#define pb push_back
#define io ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define clr(v) v.clear()
vector<ll>v;
pair<ll,ll>p;
map<ll,ll>mp;
set<ll>st;
deque<ll>dq;
priority_queue<ll>pq;
#define f(i,b) for(i=0;i<b;i++)
#define f1(i,b) for(i=1;i<=b;i++)
#define fr(i,b)for(i=b-1;i>=0;i--)
ll mn=INT_MAX,mx=INT_MIN;
ll n,m,tc,i,j,tmp,sum,cn,ans,res,pos,flag,l,x,k,dif;

string s,str;


ll a[200007],b[200007];
int main()
{

   io;
ll a,b,c,d;
cin>>a>>b;
//cout<<min(a,b)+min(c,d)<<endl;
a=a*b;
if(a&1)puts("Odd");
else puts("Even");
return 0;
}





Measured memory_bytes: 3672
N=int(input())
if N==1:
  print(1)
elif 1<N<=3:
  print(2)
elif 4<=N<8:
  print(4)
elif 8<=N<16:
  print(8)
elif 16<=N<32:
  print(16)
elif 32<=N<64:
  print(32)
else:
  print(64)

Measured memory_bytes: 9044
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <string>
#include <vector>
#include <random>
#include <bitset>
#include <queue>
#include <cmath>
#include <stack>
#include <set>
#include <map>
typedef long long ll;
using namespace std;
const ll MOD = 1000000007LL;

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

    int n, l;
    cin >> n >> l;

    int ans = 0;
    for (int i = 0; i < n; i++) {
        ans += l + i;
    }

    if (l > 0) {
        ans -= l;
    } else if (l + n - 1 < 0) {
        ans -= l + n - 1;
    }

    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 888
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<double,LL> P;
const LL mod=1e9+7;
const LL LINF=1LL<<62;
const LL INF=1<<30;

LL f(LL s){
    LL ret=0;
    while(s){
        ret+=s%10;
        s/=10;
    }
    return ret;
}

int main(){
    LL K;
    cin >> K;
    LL t=1;
    vector<LL> ans;
    for(int i=1;i<10;i++){
        ans.pb(i);
    }
    for(int s=0;s<=15;s++){
        vector<P> v;
        for(LL p=10;p<=1000;p++){
            v.pb(mp((double)(p*t-1LL)/f(p*t-1LL),p*t-1LL));
        }
        for(int i=0;i<v.size();i++){
            for(int j=i+1;j<v.size();j++){
                if(v[i].fs>v[j].fs) break;
                if(j==v.size()-1) ans.pb(v[i].sc);
            }
        }
        t*=10;
    }
    sort(ALL(ans));
    ans.erase(unique(ALL(ans)),ans.end());
    for(int i=0;i<K;i++){
        cout << ans[i] << endl;
    }
    return 0;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ldb = long double;
using pa = pair < ll, ll >;
using vec = vector < ll >;
#define pb push_back
#define F  first
#define S  second
#define f(i,x,n) for(ll i=x;i<n;i++) 
#define all(c) c.begin(),c.end()
#define edl "\n"
#define str string
#define fast() ios_base::sync_with_stdio(false);cin.tie(NULL)
const int MOD = 1e9 + 7, N = 1e5 + 10;
const ll LINF = LLONG_MAX;
int main() {
    fast();
    // #ifndef ONLINE_JUDGE
    //   freopen("input.txt", "r", stdin);
    //   freopen("output.txt","w",stdout);
    // #endif
    ll n,k;
    cin >> n >> k;
    vec q(n);
    f(i,0,n){
        cin >> q[i];
    }
    sort(all(q));
    ll k1=lower_bound(all(q),k)-q.begin();
    cout<<n-k1;

    cerr << "Time taken: " << int((clock() * 1000.) / CLOCKS_PER_SEC) << "ms\n";
    return 0;
}
 

Measured memory_bytes: 1024
INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))
def do():
    n,x,y=INTM()
    z=y-x
    sc=y-x-1
    loop=y-x+1
    maxl=n-(y-x)+loop//2+1
    for i in range(1,n):
        ct=0
        if i<maxl:
            for j in range(1,n):
                if j+i<=x or j>=y:
                    if j+i<=n:
                        ct+=1
                else:
                    if j<=x:
                        if j+i+sc<=n:
                            ct+=1
                        temp=i-(x-j)
                        if temp>=2:
                            if loop>temp*2:
                                ct+=2
                            elif loop==temp*2:
                                ct+=1
                        else:
                            ct+=1
                        
                    else:
                        lpmin=min(y-j,+(j-x+1))
                        if lpmin==j-x+1:
                            if lpmin==y-j:
                                if lpmin+(n-y)>=i:
                                    ct+=1
                            else:
                                if lpmin>i:
                                    ct+=1
                                elif lpmin==i:
                                    ct+=2
                                else:
                                    if lpmin+(n-y)>=i:
                                        ct+=1
                                    
                                    if loop>i*2:
                                        ct+=2
                                    elif loop==i*2:
                                        ct+=1
                        else:
                            if lpmin+(n-y)>=i:
                                ct+=1
                #print(ct)
            print(ct)        
        else:
            print(ct)
                
        
if __name__ == '__main__':
    do()

Measured memory_bytes: 3444
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>
using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)
#define eprintf(...) fprintf(stderr, __VA_ARGS__)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N;
int M;
LL K;
LL X[100011];
int A[100011];
int Z[60][100011];
int idx[100011];

void MAIN() {
    scanf("%d", &N);
    REP (i, N) {
	int x;
	scanf("%d", &x);
	X[i] = x;
    }

    scanf("%d%lld", &M, &K);
    REP (i, M) scanf("%d", A+i), A[i]--;

    REP (i, N-1) idx[i] = i;
    REP (i, M) {
	swap(idx[A[i]-1], idx[A[i]]);
    }
    REP (i, N-1) Z[0][idx[i]] = i;
    REP (t, 59) REP (i, N-1) Z[t+1][i] = Z[t][Z[t][i]];

    vector<LL> cur(N-1), nxt(N-1);
    REP (i, N-1) cur[i] = X[i+1] - X[i];
    REP (t, 60) if (K>>t&1) {
	REP (i, N-1) nxt[Z[t][i]] = cur[i];
	swap(cur, nxt);
    }

    LL x = X[0];
    printf("%lld\n", x);
    REP (i, N-1) {
	x += cur[i];
	printf("%lld\n", x);
    }
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 27904
#include <bits/stdc++.h>
  using namespace std;
#define ll long long
#define fw(p) for(int w=0;w<(p);w++)
#define fx(p) for(int x=0;x<(p);x++)
#define fy(p) for(int y=0;y<(p);y++)
#define fz(p) for(int z=0;z<(p);z++)
#define fyg(p,g) for(int y=(g);y<(p);y++)
#define fzg(p,g) for(int z=(g);z<(p);z++)
#define ce(d) cout<<d<<endl;
#define vecp(p) int aa;cin>>aa;(p).push_back(aa);
#define vecpl(p) long long aa;cin>>aa;(p).push_back(aa);
#define vecps(p) string aa;cin>>aa;(p).push_back(aa);
#define vecp2(p) int ab;cin>>ab;(p).push_back(ab);
#define vecpl2(p) long long ab;cin>>ab;(p).push_back(ab);
#define vecps2(p) string ab;cin>>ab;(p).push_back(ab);
#define set0(k,n) for(int nn=0;nn<(n);nn++){ (k).push_back(0); }
#define sorts(c) sort((c).begin(),(c).end());
#define reverses(c) reverse((c).begin(),(c).end());
#define vec(b) vector<int> (b);
#define vecl(b) vector<long long> (b);
#define vecs(b) vector<string> (b);
#define vecsize(b,size) vector<int> (b)((size));
#define pb(b,a) (b).push_back((a));

 		
int main() {

int N,M;
cin>>N>>M;
vector<pair<int,int>> S;
vec(A)
set0(A,N+1)
fx(M){
	int a,b;
	cin>>a>>b;
S.push_back(make_pair(b,a));
}
sorts(S)

int ans=0;
fx(M){
	bool next=false;
	fyg(S.at(x).first,S.at(x).second){
		if(A.at(y)==1){
			next=true;
			break;
		}
	}
	
	if(next){
		continue;
	}else{
		A.at(S.at(x).first-1)=1;
		ans++;
	}
	
}
ce(ans)
}


Measured memory_bytes: 1784
#include <algorithm>
#include <cstdlib>
#include <cmath>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <math.h>
#include <numeric>
#include <string>
#include <utility>
#include <vector>
using namespace std;
typedef long long ll;

int main(){
    ll K;
    ll ans = 0;

    cin >> K;

    for(int a = 1; a < K + 1; a++){
        for(int b = 1; b < K + 1; b++){
            for(int c = 1; c < K + 1; c++){
                ans += gcd(gcd(a, b), c);
            }
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, X, T, a;
  cin >> N >> X >> T;
  a = N / X;
  if (N % X == 0) {
    cout << T * a << endl;
  }
  else {
    cout << T * (a + 1) << endl;
  }
}

Measured memory_bytes: 3672
x=input()
import sys

if (x[0:1]=='A') :
    pass
else:
    print('WA')
    sys.exit()

if 'C' in x[2:len(x)-1]:
    pass
else:
    print('WA')
    sys.exit()

z=x[2:len(x)-1]
    
if z.count('C')==1:
    pass
else:
    print('WA')
    sys.exit()

y=x.replace('C','c')
y=y.replace('A','a')


if str.islower(y):
    print('AC')
else:
    print('WA')
        
 

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

#define CIN1(a) long long a;cin >> a;
#define CIN2(a,b) long long a,b;cin >> a >> b;
#define CIN3(a,b,c) long long a,b,c;cin >> a >> b >> c;
#define rep(i,n) for(int i=0,i##_len=(n); i<i##_len; ++i)

int main(){
    CIN2(n,k)
    string s;cin >> s;
    rep(i,n){
        if(i+1==k) s[i] += 32;
    }
    cout << s << endl;
}





Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static void main(String [] args){
		Scanner sc = new Scanner(System.in);
		int a,b;
		String op = "";
		a = sc.nextInt();
		op = sc.next();
		b = sc.nextInt();
		while(!op.equals("?")){
			if(op.equals("+")){
				System.out.println(a+b);
			}else if(op.equals("-")){
				System.out.println(a-b);
			}else if(op.equals("*")){
				System.out.println(a*b);
			}else if(op.equals("/")){
				System.out.println(a/b);
			}
			a = sc.nextInt();
			op = sc.next();
			b = sc.nextInt();
		}
	}
}

Measured memory_bytes: 26244
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <cstdio>
#include <cmath>
using namespace std;

int main()
{
	int a[4], b[4];
	while(cin >> a[0] >> a[1] >> a[2] >> a[3] && cin >> b[0] >> b[1] >> b[2] >> b[3]){
		int A[10] = {0}, B[10] = {0}, h = 0, br = 0;
		for (int i = 0; i < 4; ++i)
		{
			A[a[i]]++;
			B[b[i]]++;
		}
		for (int i = 0; i < 4; ++i)
		{
			if (a[i] == b[i]){
				h++;
				A[a[i]]--;
				B[b[i]]--;
			}
			//cout << a[i]  << b[i] << endl;
		}
		for (int i = 0; i < 10; ++i)
		{
			if(A[i] == 1 && B[i] == 1){
				br++;
			}
		}
		cout << h << ' ' << br << endl;
	}
}

Measured memory_bytes: 1160
#include <iostream>
using namespace std;
int main(void){
   while(true){

       int y=0,n;
       int a[31]={0};
       cin >> n;

       if(n==0)    break;

       a[1]=1;
       a[2]=2;
       a[3]=4;
       for(int i=4;i<31;i++){
           a[i]=a[i-1]+a[i-2]+a[i-3];
       }

       y=(a[n]/10)/365+1;
       cout << y << endl;

   }
}


Measured memory_bytes: 2996
#include <stdio.h>
#include <string>
#include <cstring>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <iterator>
#include <assert.h>
#pragma warning(disable:4996) 
 
typedef long long ll;
#define MIN(a, b) ((a)>(b)? (b): (a))
#define MAX(a, b) ((a)<(b)? (b): (a))
#define LINF 9223300000000000000
#define INF 2140000000
const long long MOD = 1000000007;
//const long long MOD = 998244353;
using namespace std;


int main(int argc, char* argv[])
{
    ll a,b,c;
    scanf("%lld%lld%lld", &a, &b, &c);

    if(a%2==0 || b%2==0 || c%2==0) {
        printf("0\n");
    }
    else {
        printf("%lld\n", MIN(MIN(a*b,b*c),c*a));
    }
    return 0;
}


Measured memory_bytes: 128
#include<algorithm>
#include<cmath>
#include<cstdlib>
#include<iostream>
#include<vector>
using namespace std;

//repetition
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//infinity
#define INTINF 2000000000
#define LONGINF 2000000000

//debug
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;

int main(){
	int n; cin >> n;
	int a[n];
	REP(i, n) cin >> a[i];

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

	for(int i = n%2; i < n; i+=2){
		cout << " " << a[i];
	}

	cout << endl;
	return 0;
}


Measured memory_bytes: 2944
#include <bits/stdc++.h>
#define REP(i, a, b) for (long long i = a; i <= b; ++i)
#define ll long long
using namespace std;

ll n, m, l, ans;

inline ll read(){						//快读 
	ll s = 0, w = 1;
	char ch = getchar();
	for (; ch < '0' || ch > '9'; ch = getchar()) w *= ch == '-' ? -1 : 1;
	for (; ch >= '0' && ch <= '9'; ch = getchar()) s = s * 10 + ch - '0';
	return s * w;
}

inline void work(){
	n = read(), m = read();				//输入n和m 
	REP(i, 1, m) l = read(), ans += l;	//l同题目中的a[i]，ans记录一共要写多少天作业 
	if (ans > n) puts("-1");			//如果n天内写不完作业就输出-1
	else printf("%lld\n", n - ans);		//否则输出还有多少天不用写作业
}

int main(){
	work();
	return 0;
}

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

int main(){
  int N;
  cin>>N;
  vector<pair<int,int>> taisei(N);
  for(int i=0; i<N; i++){
      int x,y;
      cin >> x >> y;
      taisei[i]=pair(x,y);
  }
  sort(taisei.begin(), taisei.end());
  reverse(taisei.begin(), taisei.end());
  
  cout << taisei[0].first + taisei[0].second << endl;
  
//   for(auto x:taisei){
//      cout << x.first << " : " << x.second << endl;
//   }
}




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

public class Solution
{
    public static void Main()
    {
        var N = int.Parse(Console.ReadLine());
        var vertex = new int[N + 1];
        var edges = Enumerable.Range(0, N + 1).Select(_ => new List<int>()).ToArray();
        var edgeColor = new Dictionary<Tuple<int, int>, int>();
        var maxColor = 0;
        var edgeList = new List<Tuple<int, int>>();
        for (int i = 1; i < N; i++)
        {
            var vals = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var a = vals[0];
            var b = vals[1];
            edges[a].Add(b);
            edgeList.Add(Tuple.Create(a, b));
        }
        for (int i = 1; i <= N; i++)
        {
            var c = 0;
            foreach (var child in edges[i])
            {
                c++;
                if (c == vertex[i])
                {
                    c++;
                }
                vertex[child] = c;
                edgeColor[Tuple.Create(i, child)] = c;
                maxColor = Math.Max(maxColor, c);
            }
        }

        Console.WriteLine(maxColor);
        Console.WriteLine(string.Join(Environment.NewLine, edgeList.Select(e => edgeColor[e])));
    }
}

Measured memory_bytes: 38324
#include <iostream>
#include <string>
#include <sstream>
#include <cctype>

class MyList {
    struct Node {
        int value;
        Node* prev;
        Node* next;
    };

public:
    MyList();
    ~MyList();
    MyList(const MyList&) = delete;
    MyList& operator=(const MyList&) = delete;

    void Execute(const std::string&, const int);
    void WriteAll() const;

private:
    void Insert(const int);
    void Delete(const int);
    void Delete(Node* node);
    void DeleteFirst();
    void DeleteLast();
    void Clear();

    Node dummy_;
};

MyList::MyList() {
    dummy_.value = 0;
    dummy_.prev = dummy_.next = &dummy_;
}

MyList::~MyList() {
    Clear();
}

void MyList::Execute(const std::string& str, const int x) {
    if (str[0] == 'i') Insert(x);
    else if (str[6] == 'F') DeleteFirst();
    else if (str[6] == 'L') DeleteLast();
    else Delete(x);
}

void MyList::WriteAll() const {
    Node* node = dummy_.next;

    if (node == &dummy_) return;

    while (node != &dummy_) {
        std::cout << node->value;

        node = node->next;
        if (node != &dummy_) std::cout << " ";
    }

    std::cout << std::endl;
}

void MyList::Insert(int x) {
    Node* node = new Node;
    node->value = x;
    node->next = dummy_.next;
    node->prev = &dummy_;

    dummy_.next->prev = node;
    dummy_.next = node;
}


void MyList::Delete(const int x) {
    Node* node = dummy_.next;

    while (node != &dummy_) {
        if (node->value == x) {
            Delete(node);
            break;
        }

        node = node->next;
    }

}

void MyList::Delete(Node* node) {
    Node* prev = node->prev;
    Node* next = node->next;
    delete node;

    prev->next = next;
    next->prev = prev;
}

void MyList::DeleteFirst() {
    Delete(dummy_.next);
}

void MyList::DeleteLast() {
    Delete(dummy_.prev);
}

void MyList::Clear() {
    Node* node = dummy_.next;

    if (node == &dummy_) return;

    while (node != &dummy_) {
        Node* deleteNode = node;
        node = node->next;
        delete deleteNode;
    }

}


int main() {
    int n;
    std::cin >> n;
    std::cin.ignore();

    MyList li;

    std::string str;
    int x;
    
    for (int i = 0; i < n; i++) {
        std::cin >> str;
        x = 0;
        if (std::cin.peek() != '\n') std::cin >> x;
        li.Execute(str, x);
    }

    li.WriteAll();
    return 0;
}

Measured memory_bytes: 34372
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <cmath>
typedef long long ll;
using namespace std;

int main(){
  int a,b,c,d;
  cin >> a >> b >> c >> d;
  cout << min(a,b) + min(c,d) << endl;
}


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

#define REP(i, n) for (int i = 0; i < (n); i++)
#define ANS(ans) cout << ans << endl;


int
main()
{
  string S; cin >> S;

  int red = 0;
  int blue = 0;
  REP(i, S.size()) {
    if (S.at(i) == '0') ++red; else ++blue;
  }

  ANS(S.size() - abs(red - blue));

  return 0;
}


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


int main(void){
  int n; cin >> n;
  map<string,int> mp;
  rep(i,n){
    string s; cin >> s;
    sort(s.begin(),s.end());
    mp[s]++;
  }
  ll ans = 0;
  for(auto p : mp){
    ll s = p.second;
    ans += s*(s-1)/2;
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 11136
#include <stdio.h>

int main(){
    int x, y;
    
    while(scanf("%d %d", &x, &y), x > 0 || y > 0){
        if(x > y){
            printf("%d %d\n", y, x);
        }
        
        else {
            printf("%d %d\n", x, y);
        }
    }
    
    return 0;
}

Measured memory_bytes: 2572
use io::*;
use proconio::{fastout, input};
use std::*;

#[fastout]
fn main() {
    input! {
        s : String,
        t : String
    }
    let mut res = 0;
    for i in 0..s.len() {
        if s.as_bytes()[i] != t.as_bytes()[i] {
            res += 1;
        }
    }
    print!("{}", res);
}


Measured memory_bytes: 2900
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
const int maxn = 200100;
long long l;
long long x[maxn];
int n;
long long h1[maxn], h2[maxn];
int main()
{
	std::ios::sync_with_stdio(false);
	cin >> l >> n;
	for(int i = 1; i <= n; i ++)
		cin >> x[i];
	h1[0] = h2[n + 1] = 0;
	for(int i = 1; i <= n; i ++)
		h1[i] = h1[i - 1] + x[i];
	for(int i = n; i >= 1; i --)
		h2[i] = h2[i + 1] + x[i];
	/*
	for(int i = 1; i <= n; i ++)
		cout << h1[i] << " " << h2[i] << endl;
		*/
	long long ans = 0;
	for(int i = 1; i <= n; i ++)
	{
		int st = i;
		int m = n - st + 1;
		if(m == 1)
		{
			ans = max(ans, x[i]);
			//cout << i << " " << ans << endl;
			continue;
		}
		else if(m == 2)
		{
			ans = max(ans, x[i] + x[i] + l - x[i + 1]);
			//cout << i << " " << ans << endl;
			continue;
		}
		int mid = (st + n) / 2;
		//cout << mid << endl;
		if(m & 1)
			ans = max(ans, x[i] + (m - 1) * l + (h1[mid] - h1[st - 1]) + (h1[mid - 1] - h1[st]) - h2[mid + 1] * 2);
		else
			ans = max(ans, x[i] + (m - 1) * l + (h1[mid] - h1[st - 1]) + (h1[mid] - h1[st]) - h2[mid + 1] - h2[mid + 2]);
		//cout << i << " " << ans << endl;
	}
	//cout << ans << endl;
	for(int i = n; i >= 1; i --)
	{
		int ed = i;
		int m = i;
		if(m == 1)
		{
			ans = max(ans, l - x[i]);
			continue;
		}
		if(m == 2)
		{
			ans = max(ans, l - x[i] + l + x[i - 1] - x[i]);
			continue;
		}
		int mid = ed / 2;
		if(m & 1)
			ans = max(ans, l - x[i] + l * (m - 1) + 2 * h1[mid] - (h2[mid + 1] - h2[ed + 1]) - (h2[mid + 2] - h2[ed]));
		else
			ans = max(ans, l - x[i] + l * (m - 1) + h1[mid] + h1[mid - 1] - (h2[mid + 1] - h2[ed]) - (h2[mid + 1] - h2[ed + 1]));
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;
typedef long long ll;

int main() {
  ll N,A,B,C,D;
  cin>>N>>A>>B>>C>>D;
  A--; B--; C--; D--;
  string S;
  cin>>S;
  S = S + '#';
  vector<ll> v(N,0);
  if (S[0] == '#') v[0] = 1;
  for (ll i = 1; i < S.size(); i++) {
    if (S[i] == '#') v[i] += v[i - 1] + 1;
    else v[i] = v[i - 1];
  }
  if (C < D) {
    for (ll i = B; i < D; i++) {
      if (S[i + 1] == '#' && S[i] == '#') {
          cout<<"No"<<endl;
          return 0;
      }
    }
    for (ll i = A; i <= C; i++) {
      if (S[i + 1] == '#' && S[i] == '#') {
        cout<<"No"<<endl;
        return 0;
      }
    }
    cout<<"Yes"<<endl;
    return 0;
  } else {
    bool bad = true;
    for (ll i = A; i <= C; i++) {
      if (S[i + 1] == '#' && S[i] == '#') {
        cout<<"No"<<endl;
        return 0;
      }
    }
    for (ll i = B; i <= D; i++) {
      if (S[i + 1] == '#' && S[i] == '#') {
          cout<<"No"<<endl;
          return 0;
      }
      if (S[i - 1] == '.' && S[i] == '.' && S[i + 1] == '.') bad = false;
    }
    if (bad) {
      cout<<"No"<<endl;
      return 0;
    }
    cout<<"Yes"<<endl;
  }
  return 0;
}

Measured memory_bytes: 2116