akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<cstdlib>
#include<string>
#include<vector>
#include<map>
#include<unordered_map>
#include<queue>
#include<algorithm>
#include<iomanip>
#include<typeinfo>
#include<complex>
using namespace std;
using ll = long long int;
const int mod = 1e9 + 7;
#define rep(i, a, b) for(ll i = a;i < b; i++)

int main() {

	int n, k;
	cin >> n >> k;

	double pnt = 0;

	for(int i = 1; i <= n; i++){
		double x = 1.0 / n;
		int y = i;
		while (y < k) {
			y *= 2;
			x /= 2;
		}
		pnt += x;
	}

	cout << fixed << setprecision(12) << pnt << endl;

	return 0;
}

Measured memory_bytes: 256
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Numerics;

namespace AtCoderWorkspace
{
    public class Solver
    {
        public void Solve()
        {
            var cin = new Scanner();
            var n = cin.nextInt();
            var d = cin.nextInt();
            var list = new List<Tuple<int, int>>();
            for (int i = 0; i < n; i++)
            {
                var x = cin.nextInt();
                var y = cin.nextInt();
                list.Add(Tuple.Create(x, y));
            }
            var ans = 0;
            foreach (var item in list)
            {
                var di = Math.Sqrt(Math.Abs(Math.Pow(item.Item1,2) + (Math.Pow(item.Item2,2))));
                if (di <= d) ans++;
            }


            Console.WriteLine(ans);
        }
    }

    class Scanner
    {
        string[] s;
        int i;

        char[] cs = new char[] { ' ' };

        public Scanner()
        {
            s = new string[0];
            i = 0;
        }

        public string next()
        {
            if (i < s.Length) return s[i++];
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            if (s.Length == 0) return next();
            i = 0;
            return s[i++];
        }

        public int nextInt()
        {
            return int.Parse(next());
        }
        public int[] ArrayInt(int N, int add = 0)
        {
            int[] Array = new int[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt() + add;
            }
            return Array;
        }

        public int[] DPArrayInt(int N, int ex)
        {
            int[] Array = new int[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextInt();
            }
            return Array;
        }

        public long nextLong()
        {
            return long.Parse(next());
        }

        public long[] ArrayLong(int N, long add = 0)
        {
            long[] Array = new long[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong() + add;
            }
            return Array;
        }

        public long[] DPArrayLong(int N, int ex)
        {
            long[] Array = new long[N + ex];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextLong();
            }
            return Array;
        }

        public double nextDouble()
        {
            return double.Parse(next());
        }


        public double[] ArrayDouble(int N, double add = 0)
        {
            double[] Array = new double[N];
            for (int i = 0; i < N; i++)
            {
                Array[i] = nextDouble() + add;
            }
            return Array;
        }
    }

    class Program
    {
        static void Main(string[] s) => new Solver().Solve();
    }
}


Measured memory_bytes: 47780
#include<iostream>
#include<vector>

#define rep(i,a) for(int i = 0 ; i < a ; i ++)
using namespace std;

int main(void){
	int n;
	cin>>n;
	vector<vector<int> > inp(n,vector<int>(3) );
	vector<vector<int> > ans(n,vector<int>(3) );
	rep(i,n){
		rep(j,3){
			cin>>inp[i][j];
			ans[i][j]=inp[i][j];
		}
		rep(j,i)
			rep(k,3)
				if(inp[i][k]==inp[j][k])
					ans[i][k]=ans[j][k]=0;
	}
	rep(i,n){
		int sum = 0;
		rep(j,3)
			sum+=ans[i][j];
		cout<<sum<<endl;
	}
}

Measured memory_bytes: 1232
#include<iostream>
#include<algorithm>
#include<vector>
#include<numeric>
#include<string>
#include<cmath>
#include<set>
#include<queue>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cctype>
#include<map>
#include<cstring>

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

using namespace std;
using ll = long long int;

const int inf = 1001001000;
const long long int Inf = 1001001001001001000;


void print(vector<vector<int>> a){
	for (int i = 0; i < a.size(); i++)
	{
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<vector<long long int>> a){
	for (int i=0;i<a.size();i++){
		for (int j=0;j<a[i].size();j++){
			cout << a[i][j] << " ";
		}
		cout << endl;
	}
}

void print(vector<int> a){
    int n = a.size();
    for (int j=0;j<n;j++) {
        if (j != n-1) cout << a[j] << " ";
        else cout << a[j] << endl;
    }
}

void print(set<int> a){
	for (auto x:a)
		cout << x << " ";
	cout << endl;
}


 
int main() {
	map<int, char> i2c;
	map<char, int> c2i;
	rep(i,26){
		i2c[i] = char('A' + i);
		c2i[char('A' + i)] = i;
	}
	int n;
	cin >> n;
	string s;
	cin >> s;
	rep(i,s.size()){
		cout << i2c[(c2i[s[i]] + n) % 26];
	}
	cout << endl;

	return 0;
}

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

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define MOD 1000000007
#define NUM 2520
#define INF (1LL<<50)
#define DEBUG 0
#define mp(a,b) make_pair(a,b)
#define SORT(V) sort(V.begin(),V.end())
#define PI (3.141592653589794)


void func(long long N, long long K){

    double ans=0.0;

    REP(i,1,N+1){
        lli twoCnt=0;
        lli two=1;
        while(i*two<K){
            two*=2;
            twoCnt++;
        }

        ans += (1/(double)(N) * (1/(double)two));
    }

    cout<<setprecision(15);
    cout<<ans<<endl;

}

int main(){
    // cout << fixed << setprecision(5);

    long long N;
    scanf("%lld",&N);
    long long K;
    scanf("%lld",&K);
    func(N, K);
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <stack>
#include <list>
#include <utility>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include <unordered_map>
#include <climits>


typedef long long ll;
const int MOD = pow(10,9)+7;
const int MAX = 100001;

using namespace std;
int in(){
    int temp;
    scanf("%d",&temp);
    return temp;
}

ll lin(){
    ll temp;
    scanf("%lld",&temp);
    return temp;
}


long long fac[MAX];
long long finv[MAX];
long long inv[MAX];

void binom_init(){
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; ////  inv[i] = div(1,i) =  (1/i) mod M;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

int main() {

    ll N = lin();
    ll M = lin();
    
    if( abs(N - M) >= 2){
        cout << 0 << endl;
        return 0;
    }
    
    binom_init();
    
    ll ans = fac[N] * fac[M] %MOD;
    
    if (N == M){
        ans *=2;
        ans %= MOD;
    }
    
    cout << ans << endl;
    
    
    
    
    return 0;
    
    
}








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

int main()
{
	int N;
	cin >> N;
	vector<int> p(N);
	for (int i = 0; i < N; i++) {
		cin >> p[i];
	}
	int res = 0;
	for (int i = 0; i < N; i++) {
		if (p[i] == i + 1) {
			swap(p[i], p[i + (i + 1 == N ? -1 : 1)]);
			res++;
		}
	}
	cout << res << endl;
	return 0;
}


Measured memory_bytes: 640
fun main(args : Array<String>) {
    val (L, R) = readLine()!!.split(" ").map { it.toLong() }
    val MOD = 2019
    var i = L
    val candidates = mutableListOf<Int>()
    candidates.add(i.mod(2019).toInt())
    (0..2019 * 4).forEach {
        i++
        if (i <= R) {
            candidates.add(i.mod(2019).toInt())
        }
    }

    val size = candidates.size

    if (size <= 1) {
        println(0)
        return
    }

    var answer = Int.MAX_VALUE
    var contains3X = false
    var contains673X = false
    (0..(size - 2)).forEach { i ->
        if (candidates[i].mod(3) == 0) {
            contains3X = true
        }
        if (candidates[i].mod(673) == 0) {
            contains673X = true
        }
        ((i+1)..(size - 1)).forEach { j ->
            answer = Math.min(answer, (candidates[i] * candidates[j]).mod(2019))
        }
    }

    if (contains3X && contains673X) {
        println(0)
        return
    }

    println(answer)
}

Measured memory_bytes: 38760
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define inf 1001001001001001001
#define mod 1000000007
#define mod2 998244353
#define pi acos(-1)
#define all(v) v.begin(),v.end()
int main(){
    int a,b;cin>>a>>b;
    if(a*b%2==0){
        cout<<"Even"<<endl;
    }else{
        cout<<"Odd"<<endl;
    }
}


Measured memory_bytes: 3556
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<cmath>
#include<iostream>
#include<set>
#include<cstring>
#include<map>
using namespace std;
template<class _T>inline void read(_T &_a)
{
    bool f=0; char _c=getchar(); _a=0;
    while(_c<'0'||_c>'9'){ if(_c=='-') f=1; _c=getchar(); }
    while(_c>='0'&&_c<='9'){ _a=(_a<<3)+(_a<<1)-'0'+_c; _c=getchar(); }
    if(f) _a=-_a;
}

const int MAXN=1000002;
int ans,n;
string str;
set<string>mp;

int main()
{
    read(n);
    for (register int i=1;i<=n;++i)
    {
    	cin>>str;
    	mp.insert(str);
    }
    printf("%d",int(mp.size()));
    return 0;
}

Measured memory_bytes: 19352
#include <bits/stdc++.h>
 
using namespace std;
int main(void)
{
  int n, k;
  cin >> n >> k;
  
  vector<int> h;
  for(int i=0; i<n; i++){
      int tmp;
      cin >> tmp;
      h.push_back(tmp);
  }
  sort(h.begin(), h.end());
  
  int hmin=INT_MAX;
  for(int i=0; i<=n-k; i++){
      hmin = min(hmin, h[i+k-1]-h[i]);
  }

  cout << hmin << endl;
  return 0;
}


Measured memory_bytes: 892
#include <iostream>
#include<vector>
#include <cmath>
using namespace std;
int main() {
    string ss;
    vector<int>nn;
    int like = 753;
    int ans = 10000;
    cin >> ss;

    for (int i = 0; i < ss.size(); ++i) {
        int q = ss[i] -48;
        nn.push_back(q);
    }

    for (int j = 2; j < nn.size(); ++j) {
        int x = 0;
        int n = 0;
        x = nn[j-2] * 100 + nn[j -1]* 10 + nn[j];
        n = abs(x - like);
        ans = min(ans,n);
    }

    cout << ans;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<map>
#include<set>
#include<stack>
#include<queue>
#include<math.h>
using namespace std;
typedef long long ll;
typedef vector<int> VI;
#define REP(i,n) for(int i=0;i<n;i++)
#define eREP(i,n) for(int i=0;i<=n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define eFOR(i,a,b) for(int i=(a);i<=(b);++i)
#define SORT(c) sort((c).begin(),(c).end())
#define rSORT(c) sort((c).rbegin(),(c).rend())
#define LB(x,a) lower_bound((x).begin(),(x).end(),(a))
#define UB(x,a) upper_bound((x).begin(),(x).end(),(a))
#define INF 1000000000
#define LLINF 9223372036854775807
#define mod 1000000007
//vector<vector<int> > dp;
//vector<vector<vector<int> > > vvvi;
//dp=vector<vector<int> >(N, vector<int>(M,0));
//vector<pair<int,int> > v;
//v.push_back(make_pair(x,y));

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

	int N;
	cin>>N;
	int F[100][5][2]={0};
	int P[100][11];
	REP(i,N){
		REP(j,5)
			cin>>F[i][j][0]>>F[i][j][1];
	}
	REP(i,N){
		REP(j,11)cin>>P[i][j];
	}
	ll ans=INF*-1;
	REP(a,2){
		REP(b,2){
			REP(c,2){
				REP(d,2){
					REP(e,2){
						REP(f,2){
							REP(g,2){
								REP(h,2){
									REP(i,2){
										REP(j,2){
											ll ansco=0;
											REP(A,N){
												int cnt=0;
												if(a==0&&b==0&&c==0&&d==0&&e==0&&f==0&&g==0&&h==0&&i==0&&j==0){ansco=INF*-1;break;}
												if(a==1 && F[A][1][0]==1)cnt++;
												if(b==1 && F[A][2][0]==1)cnt++;
												if(c==1 && F[A][3][0]==1)cnt++;
												if(d==1 && F[A][4][0]==1)cnt++;
												if(e==1 && F[A][0][0]==1)cnt++;
												if(f==1 && F[A][1][1]==1)cnt++;
												if(g==1 && F[A][2][1]==1)cnt++;
												if(h==1 && F[A][3][1]==1)cnt++;
												if(i==1 && F[A][4][1]==1)cnt++;
												if(j==1 && F[A][0][1]==1)cnt++;
												ansco+=P[A][cnt];
												//cout<<P[A][cnt-1]<<endl;
											}
											//cout<<ansco<<endl;
											ans=max(ans,ansco);
	}	}	}	}	}	}	}	}	}	}
	cout<<ans<<endl;
	return 0;
}






Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define int long long
#define sim template <class c
#define ris return *this
#define dor > debug &operator<<
#define eni(x)                                                                    \
	sim > typename enable_if<sizeof dud<c>(0) x 1, debug &>::type operator<<(c i) \
	{
sim > struct rge
{
	c b, e;
};
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c *x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug
{
#ifndef LOCAL
	~debug()
	{
		cerr << endl;
	}
	eni(!=) cerr << boolalpha << i;
	ris;
} eni(==) ris << range(begin(i), end(i));
}
sim, class b dor(pair<b, c> d)
{
	ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d)
{
	*this << "[";
	for (auto it = d.b; it != d.e; ++it)
		*this << ", " + 2 * (it == d.b) << *it;
	ris << "]";
}
#else
	sim dor(const c &)
	{
		ris;
	}
#endif
}
;
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "
template <typename T>
using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define int long long
#define ld long double
#define pb push_back
#define mp make_pair
#define in insert
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define sz(v) (int)(v.size())
#define all(x) x.begin(), x.end()
#define prec fixed << setprecision(12)
#define rep(i, a, b) for (int i = a; i <= b; ++i)
#define repr(i, a, b) for (int i = a; i >= b; i--)
#define test  \
	int t;    \
	cin >> t; \
	while (t--)
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef set<int> si;
typedef map<int, int> mii;
typedef vector<pii> vpi;

void solve()
{
	int n;
	cin >> n;
	vi v(n);
	int ans = 0;
	rep(i, 0, n - 1) cin >> v[i];
	rep(i, 1, n - 2)
	{
		if ((v[i] > v[i - 1] && v[i] < v[i + 1]) || (v[i] > v[i + 1] && v[i] < v[i - 1]))
			ans++;
	}
	cout << ans << "\n";
}

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
#endif
	// test
	{
		solve();
	}
	return 0;
}


Measured memory_bytes: 3628
#! /usr/bin/env python3

import math

def main():
    N, A, B = map(int, input().split())
    v = sorted(map(int, input().split()))[::-1]
    d = sum(v[:A]) / A
    L = [v[:A]]
    for i in range(A+1, B+1):
        if sum(v[:i]) / i == d : L += [v[:i]]
    ans = 0
    for i in L:
        a = 1
        for j in set(i):
            if i.count(j) == 1:
                a *= v.count(j)
            else:
                x = v.count(j)
                y = i.count(j)
                a *= (math.factorial(x) // math.factorial(x-y)) // math.factorial(y)
        ans += a
    print(d)
    print(ans)

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
from heapq import*
i=input
for s in[0]*int(i()):
 n,x,*y=int(i()),[]
 for _ in'_'*n:k,l,r=t=[*map(int,i().split())];x+=[t]*(l>r);y+=[[n-k,r,l]]*(l<=r)
 for x in x,y:
  x.sort();n,*h=len(x),
  while h or x:
   while[[n]]<x[-1:]:k,l,r=x.pop();heappush(h,(r-l,l,r))
   if h:s+=heappop(h)[2-(n>0)]
   n-=1
 print(s)

Measured memory_bytes: 47756
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
using namespace std;

using ll = long long;
using ull = unsigned long long;
using ld = long double;

#define forn(i, a, n) for (int i = (int)(a); i < (int)(n); ++i)
#define ford(i, a, n) for (int i = (int)(n) - 1; i >= (int)(a); --i)
#define fore(i, a, n) for (int i = (int)(a); i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define fs first
#define sn second
#define trace(a)\
    for (auto i : a) cerr << i << ' ';\
    cerr << '\n'
#define eb emplace_back

#ifndef M_PI
const ld M_PI = acos(-1.0);
#endif

template<typename T>
inline void setmax(T& a, T b) {
    if (a < b) a = b;
}

template<typename T>
inline void setmin(T& a, T b) {
    if (a > b) a = b;
}

const ld eps = 1e-9;
const int INF = 2000000000;
const ll LINF = 1ll * INF * INF;
const ll MOD = 1000000007;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); 
    srand((unsigned)chrono::high_resolution_clock::now().time_since_epoch().count());
    string s = "AKIHABARA";
    string t;
    cin >> t;
    int si = 0, ti = 0;
    while (si < s.length() || ti < t.length()) {
        if (s[si] == t[ti]) {
            ++si, ++ti;
        } else if (s[si] == 'A') ++si;
        else {
            cout << "NO\n";
            return 0;
        }
    }
    cout << "YES\n";
}


Measured memory_bytes: 764
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int MAXN = 1e5 + 7;

bool cmp(string a, string b)
{
    return a < b;
}

string s[MAXN];
int main()
{
    ios::sync_with_stdio(0);
    int n;
    cin>>n;

    ll ans = 0;
    for(int i = 0; i < n; i++)
    {
        cin>>s[i];
        sort(s[i].begin(), s[i].end());
    }
    sort(s, s+n, cmp);
    int x = 1;
    for(int i = 1; i < n; i++)
    {
        if(s[i] == s[i-1])
            ans += x++;
        else x = 1;
    }
    cout<<ans<<endl;

    return 0;
}



Measured memory_bytes: 5760
// 問題の URL を書いておく
// 

#include <algorithm>
#include <array>
#include <bitset>
#include <cmath>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <vector>

using namespace std;

//#define ENABLE_PRINT

#if defined(ENABLE_PRINT)

#define Print(v) \
do {\
    cout << #v << ": " << v << endl; \
}while(0)

#define PrintVec(v) \
do {\
    for(int __i = 0; __i < v.size(); ++__i) \
    { \
        cout << #v << "[" << __i << "]: " << v[__i] << endl; \
    }\
}while(0)

#else

#define Print(v) ((void)0)
#define PrintVec(v) ((void)0)

#endif

#define rep(i, n) for(int i = 0; i < (int)(n); ++i)

using ll = int64_t;

int main(int, const char**)
{
    int n, m;
    cin >> n >> m;
    struct Node
    {
        int parent;
        int id;
        int count;
        int root(vector<Node>& nodes)
        {
            if(parent == -1)
            {
                return id;
            }
            auto r = nodes[parent].root(nodes);
            parent = r;
            return r;
        }
    };
    vector<Node> nodes(n);
    rep(i, n)
    {
        nodes[i] = {-1, i, 1};
    }

    rep(i, m)
    {
        int a, b;
        cin >> a >> b;
        a--; b--;
        auto ar = nodes[a].root(nodes);
        if(ar == nodes[b].root(nodes))
        {
            continue;
        }
        auto r = nodes[b].root(nodes);
        nodes[ar].parent = r;
//        nodes[r].count += nodes[a].count;
    }
    vector<int> counts(n, 0);
    rep(i, n)
    {
        counts[nodes[i].root(nodes)]++;
    }
    int ans = 0;
    rep(i, n)
    {
        ans = max(ans, counts[i]);
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 9508
#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdio>
#include <iomanip>
#include <fstream>
#include <cassert>
#include <cstring>
#include <numeric>
#include <ctime>
#include <complex>
#include <bitset>
#include <random>
#include <stack>

using namespace std;

typedef long long ll;
typedef long double ld;

#define int ll
#define double ld
#define loop(i, n) for(int i = 0; i < (int)n; ++i)
#define loop1(i, n) for(int i = 1; i <= (int)n; ++i)
#define F first
#define S second
#define pb push_back
#define pi pair <int, int>
#define all(x) begin(x), end(x)
#define ti tuple <int, int, int>
#define Point Vect
#define mkt make_tuple
#define no {cout << -1; return;}

void solve() {
    int r, d, x;
    cin >> r >> d >> x;
    loop(i, 10) {
        x = r * x - d;
        cout << x << "\n";
    }
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    //int t; cin >> t; loop(i, t)
    solve();
    return 0;
}

Measured memory_bytes: 3636
#include <stdio.h>
#include<math.h>
int main(void){
	int n,i;
	while(1){
		scanf("%d",&n);
		if(n==0) break;
		int sum=0;
		double m,sum1=0,a;
		for(i=0;i<n;i++){
			int s[n];
			scanf("%d",&s[i]);
			sum=sum+s[i];		
			sum1+=(double)s[i]*s[i];
		}
		m=(double)sum/n;
		a=(double)sqrt(sum1/n-m*m);
		printf("%f\n",a);
	}
	return 0;
}


Measured memory_bytes: 2100
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <cctype>
#include <climits>
#include <string>
#include <bitset>
#include <cfloat>
#include <unordered_set>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long double ld;
typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef vector<string> vs;
typedef vector<ll> vll;
typedef vector<pair<int,int> > vpii;
typedef vector<vector<int> > vvi;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<ll> > vvll;
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define irep(it, stl) for(auto it = stl.begin(); it != stl.end(); it++)
#define drep(i,n) for(int i = (n) - 1; i >= 0; --i)
#define fin(ans) cout << (ans) << '\n'
#define STI(s) atoi(s.c_str())
#define mp(p,q) make_pair(p, q)
#define pb(n) push_back(n)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define Sort(a) sort(a.begin(), a.end())
#define Rort(a) sort(a.rbegin(), a.rend())
#define MATHPI acos(-1)
#define itn int
template <class T> inline bool chmax(T& a,T b){if(a<b){a=b;return 1;} return 0;}
template <class T> inline bool chmin(T& a,T b){if(a>b){a=b;return 1;} return 0;}
struct io{io(){ios::sync_with_stdio(false);cin.tie(0);}};
const ll MOD = 1000000007;
const double EPS = 1e-9;
const int INF = INT_MAX;
const ll LLINF = 1LL<<60;


int main(void) {

    
    int minn=INF;
    int n;
    cin>>n;
    vi v(n);
    int ans=0;
    rep(i,n)cin>>v[i];
    rep(i,n){
        if(minn>=v[i]){
            ans++;
        }
        minn=min(v[i],minn);
    }
    fin(ans);
}


Measured memory_bytes: 1024
#include <iostream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <deque>
#include <list>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

int d;
int sum;

int main() {
	d = -1;
	cin >> d;
	while (d != -1) {
		sum = 0;
		
		for (int x = d; x < 600; x += d) {
			sum += d * (x * x);
		}

		cout << sum << endl;
		
		d = -1;
		cin >> d;
	}

	return 0;
}

/*@@@@@@@@@@@@@@@@@@@@@@@@@*/
/*@                       @*/
/*@ debug output erased ? @*/
/*@                       @*/
/*@@@@@@@@@@@@@@@@@@@@@@@@@*/

Measured memory_bytes: 1160
#include <bits/stdc++.h>
#define rep(i,n)for(long long i=0;i<(long long)(n);++i)
#define all(a) a.begin(), a.end()
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
  
const ll MOD=1e9+7;
const ll INF=1e18;
const double pi=acos(-1);
int dx[8] = {1,0,-1,0,1,1,-1,-1};
int dy[8] = {0,1,0,-1,-1,1,1,-1};
int ddx[5] = {2,1,0,-1,-2};
int ddy[5] = {2,1,0,-1,-2};
 
const int MAX=510000;
int main(){
  cin.tie(0);
  ios::sync_with_stdio(false); 
   
  int h,w,m;
  cin >> h >> w >> m;
  vector<int>a(h),b(w);
  set<P>st;
  rep(i,m){
    int y,x;
    cin >> y >> x;
    y--;
    x--;
    a[y]++;
    b[x]++;
    st.insert(P(y,x));
  }
  int ymax = *max_element(a.begin(),a.end());
  int xmax = *max_element(b.begin(),b.end());
  
  int cnty = 0, cntx = 0;
  rep(i,h) if(a[i] == ymax)cnty++;
  rep(i,w) if(b[i] == xmax)cntx++;
  
  int num = cnty*cntx;
  for(auto s:st){
    if(a[s.first] == ymax && b[s.second] == xmax )num--;
  }
  int ans = ymax + xmax;
  if(num==0) ans--;
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 24288
#ABC-117-B
s = int(input())
memo = {s:None}
ans = 1000000

for i in range(1, 1000001): 
    if s % 2 == 0:
        s = s / 2
        if s in memo:
            ans = i
            break
        else:
            memo[s] = None
    else:
        s = 3*s + 1
        if s in memo:
            ans = i
            break
        else:
            memo[s] = None
            
print(ans+1)

Measured memory_bytes: 3064
package main

import "fmt"

func main() {
	var k int
	var s string
	fmt.Scan(&k)
	fmt.Scan(&s)
	rs := []rune(s)
	if len(s) <= k {
		fmt.Printf("%s", s)
	} else {
		fmt.Printf("%s...", string(rs[0:k]))
	}
}


Measured memory_bytes: 1816
#include <bits/stdc++.h>
using namespace std;
#define int long long


void solve()
{
    int n,w;
    cin>>n>>w;
    vector<int>weight(n);
    vector<int>value(n);
    for(int i=0 ; i<n ; i++)
    {
        cin>>weight[i]>>value[i];
    }


    vector<vector<int>>dp(w+1 , vector<int>(n+1 , 0));
    int ans= 0 ;
    for(int i=0 ; i<=w ; i++)
    {
        for(int j=0 ; j<=n ; j++)
        {
            if(i==0 && j==0)
            {
                dp[i][j]=0;continue;
            }
            if(i==0)
            {
                dp[i][j]=0;continue;
            }
            if(j==0)
            {
                dp[i][j]=0;continue;
            }

            dp[i][j] = max(dp[i][j] , dp[i][j-1]);
            int left = i-weight[j-1];
            if(left>=0)
            {
                dp[i][j] = max(dp[i][j] , value[j-1]+dp[left][j-1]);
            }
            ans = max(ans,dp[i][j]);
        }
    }
    cout<<ans<<endl;


}
int32_t main()
{
    int tests=1;
    //cin>>tests;
    while(tests--)
    {
        solve();
    }
}


Measured memory_bytes: 85296
#include <stdio.h>
int main(void){
    int n, k;
    int i;
    int comp = 1;
    int a[200000];
    
    scanf("%d%d", &n, &k);
    for(i = 0; i < n; i++){
        scanf("%d", &a[i]);
    }
    
    for(i = 0; i < k; i++){
        comp *= a[i];
    }
    
    for(i = 0; i < n - k; i++){
        if((double)a[i + k] / a[i] > 1){
            printf("Yes\n");
        }else{
            printf("No\n");
        }
    }
    
}

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

int main() {
    int N;
    cin >> N;
    vector<long long> a(N);
    for (int i=0; i<N; i++) {
        cin >> a.at(i);
    }
    long long ans1 = 0, ans2 = 0, sum1 = 0, sum2 = 0;
    for (int i=0; i<N; i++) {
        sum1 += a.at(i);
        if (i%2 == 0 && sum1 <= 0) {
            ans1 += 1-sum1; //sumは負
            sum1 = 1;
        }
        else if (i%2 != 0 && sum1 >= 0) {
            ans1 += sum1+1;
            sum1 = -1;
        }
    }
    for (int i=0; i<N; i++) {
        sum2 += a.at(i);
        if (i%2 == 0 && sum2 >= 0) {
            ans2 += sum2+1;
            sum2 = -1;
        }
        else if (i%2 != 0 && sum2 <= 0) {
            ans2 += 1-sum2;
            sum2 = 1;
        }
    }
    cout << min(ans1, ans2) << endl;
    return 0;
}


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

int main(){
    string s;
    string tmp1;
    string tmp2;
    getline(cin,s);
    tmp1 = s;
    tmp2 = s;
    while(tmp1.find("apple") != string::npos){
        s.replace(tmp1.find("apple"),5,"peach");
        tmp1.replace(tmp1.find("apple"),5,"peach");
    }
    while(tmp2.find("peach") != string::npos){
        s.replace(tmp2.find("peach"),5,"apple");
        tmp2.replace(tmp2.find("peach"),5,"apple");
    }
    cout << s << endl;
}

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

typedef long long   signed int LL;
typedef long long unsigned int LU;

#define incID(i, l, r) for(int i = (l)    ; i <  (r); i++)
#define incII(i, l, r) for(int i = (l)    ; i <= (r); i++)
#define decID(i, l, r) for(int i = (r) - 1; i >= (l); i--)
#define decII(i, l, r) for(int i = (r)    ; i >= (l); i--)
#define  inc(i, n) incID(i, 0, n)
#define inc1(i, n) incII(i, 1, n)
#define  dec(i, n) decID(i, 0, n)
#define dec1(i, n) decII(i, 1, n)

#define inII(v, l, r) ((l) <= (v) && (v) <= (r))
#define inID(v, l, r) ((l) <= (v) && (v) <  (r))

#define PB push_back
#define EB emplace_back
#define MP make_pair
#define FI first
#define SE second
#define PQ priority_queue

#define  ALL(v)  v.begin(),  v.end()
#define RALL(v) v.rbegin(), v.rend()
#define  FOR(it, v) for(auto it =  v.begin(); it !=  v.end(); ++it)
#define RFOR(it, v) for(auto it = v.rbegin(); it != v.rend(); ++it)

template<typename T> bool   setmin(T & a, T b) { if(b <  a) { a = b; return true; } else { return false; } }
template<typename T> bool   setmax(T & a, T b) { if(b >  a) { a = b; return true; } else { return false; } }
template<typename T> bool setmineq(T & a, T b) { if(b <= a) { a = b; return true; } else { return false; } }
template<typename T> bool setmaxeq(T & a, T b) { if(b >= a) { a = b; return true; } else { return false; } }
template<typename T> T gcd(T a, T b) { return (b == 0 ? a : gcd(b, a % b)); }
template<typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; }

// ---- ----

int n, x, y, a[2000];

int main() {
	cin >> n >> x >> y;
	inc(i, n) { cin >> a[i]; }
	
	int ans = abs(a[n - 1] - y);
	if(n > 1) { setmax(ans, abs(a[n - 1] - a[n - 2])); }
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <map>
#include <cmath>
#include <time.h>
#include <stdio.h>
#include <vector>
#define int long long
using namespace std;

signed main(){
	int a, b;
	cin >> a >> b;
	if ((a + b) % 2 == 0)cout << (a + b) / 2 << endl;
	else cout << (a + b) / 2 + 1 << endl;
}

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

void solve(int K,int N){
    if(K%2==0){
        cout << (K/2);
        for(int i=1;i<N;i++) cout << ' ' << K;
        cout << endl;
        return;
    }
    int R[300001];
    for(int i=0;i<N;i++) R[i]=(K+1)/2;
    for(int i=0;i<N/2;i++){
        auto it=lower_bound(R,R+N,1);
        (*it)--;
        if(*it!=0) for(int j=0;R[j]==0;j++) R[j]=K;
    }
    cout << R[N-1];
    for(int i=N-2;i>=0;i--) if(R[i]!=0) cout << ' ' << R[i];
    cout << endl;
}
int main(){
    int K,N;
    cin >> K >> N;
    solve(K,N);

    return 0;
}

Measured memory_bytes: 3456
#include "iostream"
#include "algorithm"
#include "string"
#include "vector"
#include "cmath"
#include "bitset"
#include "queue"
#include "functional"
#include "map"
#include "unordered_map"
#include "set"
#include "stack"
#include "tuple"

#define rep(n) for (int i = 0; i < n; ++i)
#define REP(n,i) for (int i = 0; i < n; ++i)
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nyan "(=^･ω･^=)"
#define mkp make_pair
#define mkt make_tuple
#define P pair<ll, ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;

int h, w, a[200][200], dp[200][200][400] = {};
int main() {
	cin >> h >> w;
	rep(h)
		REP(w, j)
			cin >> a[i][j];
	for (int i = 1; i != w + h - 2; ++i) {
		for (int j = max(0, i - h + 1); j != min(w, i + 1); ++j) {
			for (int k = j + 1; k != min(w, i + 1); ++k) {
				dp[j][k][i] = a[i - j][j] + a[i - k][k];
				if (j)
					dp[j][k][i] += max({ dp[j - 1][k - 1][i - 1],dp[j - 1][k][i - 1],dp[j][k - 1][i - 1],dp[j][k][i - 1] });
				else
					dp[j][k][i] += max(dp[j][k - 1][i - 1], dp[j][k][i - 1]);
			}
		}
	}
	cout << a[0][0] + a[h - 1][w - 1] + dp[w - 2][w - 1][w + h - 3] << endl;
	return 0;
}


Measured memory_bytes: 61824
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fo(i,s,e) for( i=s;i<e;i++)
#define rfo(i,s,e) for(i=s;i>e;i--)
#define LL long long int 
const LL MOD=1e9+7;
#define pb push_back
#define pob pop_back()
#define sp " "
#define ff first
#define ss second
//            When something is important enough, you do it even if the odds are not in your favor.
LL n,k;
bool check(LL a[],LL l){
  LL i,x=0;
  fo(i,0,n){
    x+=a[i]/l-1;
    if(a[i]%l!=0) x++;
  }
  if(x<=k) return 1;
  return 0;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    #ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
    #endif
    // code goes here
    int t=1;//cin>>t;
    while(t--){
      LL i;cin>>n>>k;
      LL a[n];
      fo(i,0,n) cin>>a[i];
      LL l=1,r=1e18,ans=*max_element(a,a+n);
      while(l<=r){
        LL mid=(l+r)/2;
        if(check(a,mid)){
          ans=mid;r=mid-1;
        }
        else l=mid+1;
      }
      cout<<ans;
    }
    return 0;
}

Measured memory_bytes: 5120
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <set>
#include <queue>
#include <stack>
#include <cmath>
#define ll long long
#define rep(i,n) for(int i=0;i<(n);i++)
using namespace std;
int main(){
    int a,b; cin >> a >> b;
    int ans = max(0,a-2*b);
    cout << ans << endl;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define INF (1LL<<50)
#define MOD 1000000007

int main(){
    int N;
    cin >> N;
    vector<int> B(N);
    rep(i,N) cin >> B[i];
    vector<int> ans;
    
    while(ans.size()<N){
        bool f = true;
        for(int i=B.size()-1;i>=0;i--){
            if(i+1==B[i]){
                //cout << "del:" << i+1 << endl;
                ans.push_back(i+1);
                f=false;
                B.erase(B.begin()+i);
                break;
            }
        }
        if(f){
            cout << -1 << endl;
            return 0;
        }
    }
    
    rep(i,N){
        cout << ans[N-1-i] << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int min (int a, int b){
	if (a < b){
		return a;
	}
	return b;
}

int f(int n, int k, int num){
	if (n == 0){
		return num;
	} else {
		int a = f(n - 1, k, num * 2);
		int b = f(n - 1, k, num + k);
		return min(a, b);
	}
}

int main () {
	int n, k;
	scanf("%d %d", &n, &k);
	int res = f(n, k, 1);
	printf("%d\n", res);
	return 0;
}

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

#define tipo int
#define MAXN 502

#define pb push_back
#define endl '\n'
#define all(x) (x).begin(),(x).end()
#define ff first
#define ss second
#define sz(x) (int)(x).size()
#define f(n) for(int i=0;i<n;++i)
#define f2(n) for(int j=0;j<n;++j)
#define f3(n) for(int k=0;k<n;++k)
#define F(i,x,n,y) for(i=x;i<n;i+=y)
#define fi(i) for(i=0;i<n;++i)
#define fa(x,y) for(auto x:y)

//Warsaw debug template
#define LOCAL
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
    enable_if<sizeof dud<c>(0) x 1,debug&>::type operator<<(c i){
sim > struct rge {c b,e;};
sim > rge<c> range(c i, c j) {return rge<c>{i,j};}
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug{
#ifdef LOCAL
~debug() {cerr<<endl; }
eni(!=) cerr<< boolalpha << i; ris;}
eni(==) ris <<range(begin(i),end(i)); }
sim, class b dor(pair<b,c> d){
ris<<"("<<d.first<<","<<d.second<<")";
}
sim dor(rge<c> d){
    *this << "[";
    for(auto it=d.b;it!=d.e;++it)
        *this <<"," +(it==d.b)<< *it;
    ris<<"]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) "["<<#__VA_ARGS__":"<<(__VA_ARGS__)<<"]"
//End of debug template        
    

typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long long ll;

struct Fenwick{
	int tam; //los elementos van de 1 a tam-1
	tipo t[MAXN][MAXN];
	void init (int n){
		tam = n;
		for(int i=0; i<MAXN;++i){
			memset(t[i],0,sizeof t[i]);
		}
	}
	void adjust(int p, int q, tipo v){
		for(int i=p; i<tam; i+=(i&-i)) 
			for(int j=q; j<tam; j+=(j&-j)) 
				t[i][j]+=v;
	}
	tipo sum(int p,int q){
		tipo s=0;
		for(int i=p; i; i-=(i&-i))
			for(int j=q; j; j-=(j&-j))
				s+=t[i][j];
		return s;
	}
	
	tipo sum(int a1, int b1, int a2, int b2){return sum(a2,b2)-sum(a1-1,b2) - sum(a2,b1-1) + sum(a1-1,b1-1);}
};

int main(){
	Fenwick tree;
	tree.init(MAXN);
	int n,m,q;
	cin>>n>>m>>q;
    f(m){
        int l,r;
        cin>>l>>r;
        tree.adjust(l,r,1);
    }
	while(q--){
        int l,r;
        cin>>l>>r;
        cout<<tree.sum(l,l,r,r)<<endl;
    }
	return 0;
}


Measured memory_bytes: 1920
#include <vector> 
#include <list> 
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <queue>
#include <complex>
using namespace std;

//conversion
//------------------------------------------
inline int toInt(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); }

//math
//-------------------------------------------
template<class T> inline T sqr(T x) { return x * x; }

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

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(t,c) for(typeof((c).begin()) t=(c).begin(); t!=(c).end(); ++t)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

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

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

//clear memory
#define CLR(a) memset((a), 0 ,sizeof(a))

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



const LL mod = 1000000007;

LL gcd(LL a, LL b) { if (a%b == 0) { return b; } else return gcd(b, a%b); }
LL lcm(LL a, LL b) { return a / gcd(a, b)*b; }

#define Yes_ cout<<"Yes"<<endl; return 0;
#define No_ cout<<"No"<<endl; return 0;


#define YES_ cout<<"YES"<<endl; return 0;
#define NO_ cout<<"NO"<<endl; return 0;

#define POSSIBLE cout<<"POSSIBLE"<<endl; return 0;
#define IMPOSSIBLE cout<<"IMPOSSIBLE"<<endl; return 0;




int main() {
	char a;
	int ans=0;
	REP(i, 3) {
		cin >> a;
		if (a == '1') {
			ans++;
		}
	}
	cout << ans << endl;
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var array = Console.ReadLine().Split().Select(decimal.Parse).ToArray();
            var H = array[0];
            var A = array[1];

            var answer = Math.Ceiling(H / A);

            Console.WriteLine(answer);
        }
    }
}


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

int main() {
	int N, V[20], C[20], count = 0;
	cin >> N;
	for (int i = 0; i < N; i++) {
		cin >> V[i];
	}
	for (int i = 0; i < N; i++) {
		cin >> C[i];
	}
	for (int i = 0; i < N; i++) {
		count += max(V[i] - C[i], 0);
	}
	cout << count;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.Scanner;
import java.util.StringTokenizer;

public class Main{
     public static void main(String[] args) {
         Scanner sc = new Scanner(System.in);
         PrintWriter out = new PrintWriter(System.out);
         int w = Integer.parseInt(sc.next());
         int h = Integer.parseInt(sc.next());
         long ans = 1000000000;
         if(w%3 == 0 || h%3 == 0)
         {
             ans = 0;
         }
         ans = Math.min(ans, w);
         ans = Math.min(ans, h);
         {
             int tmp = w/3;
             if(w%3==2){
                 tmp += 1;
             }
             long tmp_max = (long)tmp*(long)h;
             long tmp_min = (long)tmp*(long)h;
             tmp = w-tmp;
             if(h%2==0)
             {
                 tmp_max = Math.max(tmp_max, (long)tmp*(long)h/2l);
                 tmp_min = Math.min(tmp_min, (long)tmp*(long)h/2l);
             }
             else{
                 tmp_max = Math.max(tmp_max, (long)tmp*((long)h/2l+1l));
                 tmp_min = Math.min(tmp_min, (long)tmp*((long)h/2l));
             }
             ans = Math.min(ans, tmp_max-tmp_min);
         }
         {
             int tmp = h/3;
             if(h%3==2){
                 tmp += 1;
             }
             long tmp_max = (long)tmp*(long)w;
             long tmp_min = (long)tmp*(long)w;
             tmp = h-tmp;
             if(w%2==0)
             {
                 tmp_max = Math.max(tmp_max, (long)tmp*(long)w/2l);
                 tmp_min = Math.min(tmp_min, (long)tmp*(long)w/2l);
             }
             else{
                 tmp_max = Math.max(tmp_max, (long)tmp*((long)w/2l+1l));
                 tmp_min = Math.min(tmp_min, (long)tmp*((long)w/2l));
             }
             ans = Math.min(ans, tmp_max-tmp_min);
         }

         out.println(ans);
         out.flush();
         sc.close();
     }

}


Measured memory_bytes: 22100
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1e5+5;
using pii = pair<int, int>;
int p[N],vis[N],n,m;
vector<pii> G[N];

bool dfs(int x, int v){
	if(vis[x]) return p[x] == v;
	vis[x] = 1;
	p[x] = v;
	for(auto &n : G[x]){
		if(!dfs(n.first, v+n.second)) return false;
	}
	return true;
}

int main(){
	ios::sync_with_stdio(false);
    cin.tie(nullptr);
	
	cin >> n >> m;
	for(int i=0;i<m;++i){
		int a,b,d;
		cin >> a >> b >> d;
		G[a].push_back({b, d});
		G[b].push_back({a, -d});
	}
	
	for(int i=1;i<=n;++i){
		if(!vis[i]){
			if(!dfs(i, 0)){
				puts("No");
				return 0;
			}
		}
	}
	puts("Yes");
	return 0;
}



Measured memory_bytes: 11520
/* ALDS1_6_B: Partition */

#include <iostream>

int partition(int A[], int p, int r) {
    int pivot = A[r];
    int i = p - 1;
    for (int j = p; j < r; j++) {
        if (A[j] <= pivot) {
            i++;
            std::swap(A[i], A[j]);
        }
    }
    std::swap(A[i + 1], A[r]);
    return i + 1;
}

int main() {
    std::ios::sync_with_stdio(false);

    int n;
    std::cin >> n;

    int A[n];
    for (int i = 0; i < n; i++)
        std::cin >> A[i];

    int q = partition(A, 0, n - 1);
    for (int i = 0; i < n; i++) {
        if (0 < i)
            std::cout << " ";
        if (i == q)
            std::cout << "[" << A[i] << "]";
        else
            std::cout << A[i];
    }
    std::cout << std::endl;
}

Measured memory_bytes: 1592
#include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<map>
#include <algorithm>
#include<cstdlib>
#include<cmath>
#include<deque>
#include <numeric>
typedef unsigned long long ll;

int main() {
	//std::cin.tie(0);
	ll N, K;
	std::cin >> N >> K;
	std::vector< ll>v(N);
	//for (auto &i : v)std::cin >> i;
	for (std::vector<ll>::iterator::value_type &i : v)std::cin >> i;
	ll ans = 0;
	for (int i = 50; i >= 0; i--) {
		int cnt = 0;
		for (auto j : v) {
			if ((j >> i) & 1)cnt++;
		}
		if (cnt < (N + 1) / 2) {
			if (ans + (1LL << i) <= K)ans += 1LL << i;
		}
	}
	for (auto &i : v)i ^= ans;
	std::cout << std::accumulate(v.begin(), v.end(), 0LL) << std::endl;
	return 0;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main()
{
	long long N, P;
	scanf("%lld %lld", &N, &P);
	
	if (N == 1) {
		printf("%lld\n", P);
		fflush(stdout);
		return 0;
	}
	
	int i, j, ans = 1;
	long long tmp;
	for (i = 2; i <= 1000000; i++) {
		for (j = 0, tmp = 1; j < N && tmp <= P; j++, tmp *= i);
		if (tmp > P) break;
		else if (P / tmp * tmp != P) continue;
		else ans = i;
	}		

	printf("%d\n", ans);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 128
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <climits> // FOO_MAX, FOO_MIN
#include <cmath> 
#include <cstdlib> // abs(int)

#define roundup(n,d) ( ((n) + ((d)-1)) / (d) )
#define ll long long

using namespace std;

int main(void){
    int N;
    cin >> N;
    vector<vector<int>> v(3, vector<int> (N));
    for(int i = 0;i < N;i++){
        for(int j = 0;j < 3;j++)
        cin >> v[j][i];
    }

    vector<vector<int>> dp(3, vector<int> (N+1, 0));

    for(int i = 1;i <= N;i++){
        for(int from = 0;from < 3;from++){
            for(int to = 0;to < 3;to++){
                if(from == to) continue;

                dp[to][i] = max(dp[to][i], dp[from][i-1] + v[to][i-1]);
            }
        }
    }
    int ans = 0;
    for(int i = 0;i < 3;i++){
        ans = max(ans, dp[i][N]);
    }

    cout << ans << endl;

}

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

int main() {
	int a, b;
	while (cin >> a >> b) {
		int c, d;
		int ve[1000] = {};

		ve[a - 1]++;
		ve[b - 1]++;

		while (cin >> c >> d, c, d) {
		ve[c - 1]++;
		ve[d - 1]++;
		}

		int ca = 0;

		for (int i = 0;i < 1000;i++) {
			if (ve[i] % 2 != 0)ca++;
		}

		if (ca >= 4)cout << "NG" << endl;
		else if (ca == 2 && (ve[0] % 2 != 1 || ve[1] % 2 != 1))cout << "NG" << endl;
		else if (ca == 0)cout << "NG" << endl;
		else cout << "OK" << endl;
	}
	return 0;
}

Measured memory_bytes: 2976
#include <bits/stdc++.h>
#define INF 100000000000
#define MOD 1000000007
#define ll long long int
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()



using namespace std;



int main() {
  int N,M; cin>>N>>M;
  vector <int> A;
  int sum = 0;
  REP(i,N){
    int a; cin>>a;
    A.push_back(a);
    sum += a;
  }

  int ans = 0;

  REP(i,N){
    if(double(A[i]) < double(sum)/double(4*M)) continue;
    else ans++;
  }

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

  



  return 0;
}

Measured memory_bytes: 256
#include <iostream>

using namespace std;

int main()
{
    int A, B;
    cin >> A >> B;
    int ans;

    ans = A + B;
    
    if (ans < (A - B)){
        ans = A - B; 
    }
    if (ans < A * B){
        ans = A * B;
    }
    cout << ans << endl;
}

Measured memory_bytes: 256