akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int main()
{
	int a[30]={};
	bool flag=true;
	string s;
	cin>>s;
	for(int i=0;i<s.length();i++)
	{
		a[s[i]-'a']++;
	}
	for(int i=0;i<26;i++)
	{
		if(a[i]%2)flag=false;
	}
	if(flag)cout<<"Yes"<<endl;
	else cout<<"No"<<endl;
	return 0;
}

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


signed main() {
  int x,r,d;
  cin >> r >> d >> x;
  rep(i,10) {
    x = r*x-d;
    cout << x << endl;
  }
}


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

#define rep(i,n) for(int i = 0; i < n; i++)
#define Rep(i,n) for(int i = 1; i <= n; i++)
#define sz(x) int(x.size())
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define YesorNo(a) printf(a ? "Yes\n" : "No\n")
#define endl '\n'
#define fi first
#define se second
using ll = long long;
using P = pair<int,int>;
using Pl = pair<ll,ll>;
template<class T> using V = vector<T>;
const int dx[] = {0,1,0,-1,1,1,-1,-1};
const int dy[] = {1,0,-1,0,1,-1,-1,1};
const int inf = (1<<30)-1;
const ll infll = (1LL<<62)-1;
ll ceil(const ll &a, const ll &b){return ((a)+(b)-1)/b;}
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }



struct Biparite_Matching {

    int n;
    vector<vector<int>> g;
    vector<int> match;
    vector<bool> seen;

    Biparite_Matching(int _n) {
        n = _n;
        g.assign(n, vector<int>());
        match.resize(n);
        seen.resize(n);
    }

    // 辺の追加
    void add_edge(int u, int v) {
        g[u].push_back(v);
        g[v].push_back(u);
    }

    bool dfs(int v) {
        seen[v] = true;
        for(int i = 0; i < (int)g[v].size(); i++) {
            int u = g[v][i];
            int w = match[u];
            if(w < 0 || (!seen[w] && dfs(w))) {
                match[v] = u;
                match[u] = v;
                return true;
            }
        }
        return false;
    }

    // 最大マッチング
    int count() {
        int res = 0;
        match.assign(n, -1);
        for(int v = 0; v < n; v++) {
            if(match[v] < 0) {
                seen.assign(n, false);
                if(dfs(v)) res++;
            }
        }
        return res;
    }

};


int main(){

    int n;
    cin >> n;
    V<P> as(n), bs(n);
    rep(i,n) cin >> as[i].fi >> as[i].se;
    rep(i,n) cin >> bs[i].fi >> bs[i].se;

    Biparite_Matching bm(n*2);
    rep(i,n)rep(j,n) {
        if(as[i].fi < bs[j].fi && as[i].se < bs[j].se) 
            bm.add_edge(i, j+n);
    }

    int ans = bm.count();
    cout << ans << endl;
}

Measured memory_bytes: 3668
#include<bits/stdc++.h>
#define IO ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
using namespace std;
long long  n,m;
int main() {
	IO
	int n,k;
	cin>>n>>k;
	int a[n];
	for(int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
        int sum=0;
    for(int i=0;i<k;i++)
        sum+=a[i];
        cout<<sum<<endl;
    return 0;
}


Measured memory_bytes: 3628
import java.util.*;
import static java.lang.Math.*;

class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int N = sc.nextInt();
        int K = sc.nextInt();
        K = Math.min(K, 41);

        int[] A = new int[N];
        for (int i=0; i<N; i++) {
            A[i] = sc.nextInt();
        }

        for (int j=0; j<K; j++){
            int[] B = new int[N];

            for (int i=0; i<N; i++){
                int start = Math.max(i-A[i], 0);
                int end = Math.min(i+A[i], N-1);

                B[start] += 1;
                if (end+1 < N){
                    B[end+1] -= 1;
                }
            }
            for (int i=1; i<N; i++){
                B[i] += B[i-1];
            }
            for (int i=0; i<N; i++){
                A[i] = B[i];
            }
        }
        for (int i=0; i<N-1; i++){
            System.out.print(A[i] + " ");
        }
        System.out.print(A[N-1]);
        
    }
}

Measured memory_bytes: 62144
n = gets.strip.to_i
ll = gets.strip.split.map(&:to_i).sort

result=0
(n-2).times do |i|
  a=ll[i]
  (i+1...n-1).each do |j|
    b=ll[j]
    ab = a+b
    idx=ll.bsearch_index {|e| e>= ab}
    if idx.nil?
      result += (n-j-1)
    else
      result+=(idx-j-1)
    end
  end
end

p result


Measured memory_bytes: 1912
import numpy as np
n=int(input())
abc=np.array([list(map(int,input().split())) for _ in range(n)])
dp=np.zeros((n+1,3),np.int64)
# dp[i+1][j]:i日目にjで遊んだ時の最大の幸福度
# dp[0][j]=0,dp[1][j]=abc[0][j]
dp[1]=abc[0]
for i in range(1,n):
      dp[i+1][0]=abc[i][0]+max(dp[i][1],dp[i][2])
      dp[i+1][1]=abc[i][1]+max(dp[i][0],dp[i][2])
      dp[i+1][2]=abc[i][2]+max(dp[i][0],dp[i][1])
print(np.max(dp[-1]))

Measured memory_bytes: 41792
N = int(input())
T = [int(input())-1 for _ in range(N)]
visited =[0]*N

def main():
  cnt = 0
  nxt = T[0]
  visited[0]=1
  while nxt:
    cnt+=1
    if nxt == 1:
      print(cnt)
      return
    if visited[nxt]:
      break
    visited[nxt]=1
    nxt = T[nxt]
  print(-1)

if __name__=="__main__":
  main()

Measured memory_bytes: 7884
#include <iostream>
#include <sstream>
#include <regex>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
#include  <cassert>
#include <fstream>
#include <codecvt>

using namespace std;
using ll = long long int;
#define rep(i,n) for(int i = 0; i < n; i++)
#define FOR(i, a, b)  for(int i = (a); i < (b) ; i++)
#define pb push_back
#define SORT(v,n) sort(v, v+n)
#define ALL(x) (x).begin(),(x).end()
#define debug(x) cerr << #x << ": " << x << '\n'
#define elif else if
#define int ll
const int INF = (1LL << 32);
const int MOD = (int)1e9 + 7;
const double EPS = 1e-9;
int dx[8] = { 1, 0, -1, 0, 1, -1, -1, 1 };
int dy[8] = { 0, 1, 0, -1, 1, 1, -1, -1 };


int gcd(int x, int y) {
	return y ? gcd(y, x % y) : x;
}
signed main() {
	ios::sync_with_stdio(true);
	int x, y;
	cin >> x >> y;
	cout << gcd(x, y) << endl;
	return 0;
}


Measured memory_bytes: 3104
#include <iostream>
#include <vector>
#include <cmath>
#include <string>
#include <algorithm>
#include <iomanip>
#include <map>
#include <bitset>
#include <cstdio>
#include <set>
#include <stack>
#include <queue>
#include <cassert>
#include <numeric>
#define rep(i,n) Rep(i,0,n)
#define Rep(i,k,n) for(int i=k ; i<n ; i++)
#define rep1(i,n) for(int i=1 ; i<=n ; i++)
#define Rep1(i,k,n) for(int i=k ; i<=n ; i++)
#define rrep(i,n) for(int i=n ; i>=0 ; i--)
#define vi vector<int>
#define vii vector<vector<int>>
#define mii map<int,int>
#define Sort(v) sort(v.begin(),v.end())
#define Reverse(v) reverse(v.begin(),v.end())
#define ALL(a)  (a).begin(),(a).end()
#define pb push_back
#define mp make_pair
//#define int ll
typedef long long ll;

const int md = 1000000007;
const int INF = 1<<30;
using namespace std;

int gcd(int x, int y){
    return y ? gcd(y,x%y) : x;
}

int lcm(int x, int y){
    int g = gcd(x,y);
    return g * (x/g) * (y/g);
}
int main(){
    int a;
    while(cin >> a){
        int b; cin >> b;
        cout << gcd(a,b) << " " << lcm(a,b) << endl;

    }
}



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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define orep(i, n) for(int i = 1; i < (int)(n); ++i)
#define rrep(i, n) for(int i = (n)-1; i >= 0; i--)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

int main() {
    int n;
    string s;
    cin >> n >> s;
    rep(i, s.length()) {
        if (s[i] + n > 90) {
            s[i] = (char) (s[i] + n - 26);
        } else {
            s[i] = (char) (s[i] + n);
        }

    }

    cout << s << endl;
    return 0;
}



Measured memory_bytes: 256
#include <cstdio>
#include <iostream> 
#include <string>
#include <vector>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <functional>

using namespace std;
using ll = long long;

const ll INF = 1e9;
const ll MOD = 1e9 + 7;
int dx[4] = { 1,0,-1,0 };
int dy[4] = { 0,1,0,-1 };

int main()
{
	ll n, a, i, b, c, sum = 0;
	map<ll, ll> m;

	cin >> n;
	for (i = 0; i < n; i++) {
		cin >> a;
		m[a]++;
	}
	for (auto v : m) {
		b = v.first;
		c = v.second;
		if (b == c)continue;
		if (c > b) {
			sum += c - b;
		}
		else {
			sum += c;
		}
	}

	cout << sum << endl;
}

Measured memory_bytes: 6272
#pragma comment(linker, "/stack:20000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")

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

#define se second
#define fi first
#define ss size()
#define pb push_back
#define mp make_pair
#define ins insert
#define ll long long
#define y1 y12313312312
#define endl '\n'
#define gcd __gcd
//#define int ll

using namespace std;
//using namespace __gnu_pbds;

//template <typename T> using ordered_set = tree<T, null_type, std::less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const int N = 3e3 + 40, T = 4 * N, inf = 1e9 + 7;

int n, m, f, r, l, e, w, o, z, test, id;
int d[N][N];
char a[N][N];

void freop()
{
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
}

void boos()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}

main()
{
    //freop();
    boos();
    cin >> n >> m;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            cin >> a[i][j];
        }
    }
    d[0][0] = 1;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            if (a[i][j] == '#' || (i == 0 && j == 0)) continue;
            if (i == 0)
            {
                if (j == 0) continue;
                d[i][j] += d[i][j - 1];
            }
            else if (j == 0) d[i][j] += d[i - 1][j];
            else
            {
                d[i][j] += d[i - 1][j] + d[i][j - 1];
            }
            d[i][j] %= inf;
        }
    }
    cout << d[n - 1][m - 1];
}


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

int main() {
  ll n,a,b,c,d,e; cin>>n>>a>>b>>c>>d>>e;
  ll mini = min(min(min(min(a,b),c),d),e);

  cout << (n+mini-1) / mini + 4 << endl;
}


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

#define SYNC ios::sync_with_stdio(0);
#define F first
#define S second
#define endl '\n'


using namespace std;

using ll = long long int;
using ii = pair<int, int>;
using vii = vector<ii>;
using vi = vector<int>;
using graph = vector<vi>;
const int INF = 0x3f3f3f3f;
const int MAXN = 58;
const ll mod = 1000000007;



int main() {
    SYNC
    string s;
    cin >> s;
    int ans = 0;
    for (int i = 1; i < s.size(); ++i) {
        if (s[i] == s[i-1]) {
            s[i] = !(s[i-1] - '0') + '0';
            ans ++;
        }
    }
    cout << ans << endl;
    return 0;
}

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

#define pii  pair<int, int>
#define vi vector<int >
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
#define sz(x) (x).size()
#define all(x) (x).begin(), (x).end() //Forward traversal
#define rall(x) (x).rbegin, (x).rend() //reverse traversal

#define ll long long
#define ld long double

const ld EPS = 10e-9;
const int INF = 1e9 + 5;
const long long INFLL = (ll)INF * (ll)INF;
const ll MOD = 1e9 + 7;
const ld PI = 3.14159265358979323846;

template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v)
{
    os << "[";
    for (int i = 0; i < (int)v.size(); ++i) {
        os << v[i];
        if (i != (int)v.size() - 1)
            os << ", ";
    }
    os << "]\n";
    return os;
}

template <typename T>
ostream& operator<<(ostream& os, const set<T>& v)
{
    os << "{";
    for (const auto& it : v) {
        os << it;
        if (it != *v.rbegin())
            os << ", ";
    }
    os << "}\n";
    return os;
}

template <typename T>
ostream& operator<<(ostream& os, const unordered_set<T>& v)
{
    os << "{";
    for (const auto& it : v) {
        os << it;
        if (it != *v.rbegin())
            os << ", ";
    }
    os << "}\n";
    return os;
}

template <typename T, typename S>
ostream& operator<<(ostream& os, const map<T, S>& v)
{
    os << "{";
    for (const auto& it : v) {
        os << it.first << " : "
           << it.second;

        if( it != *v.rbegin())
            os  << ", ";
    }

    os << "}\n";
    return os;
}

template <typename T, typename S>
ostream& operator<<(ostream& os, const unordered_map<T, S>& v)
{
    os << "{";
    for (const auto& it : v) {
        os << it.first << " : "
           << it.second;

        if( it != *v.rbegin())
            os  << ", ";
    }

    os << "}\n";
    return os;
}

template <typename T, typename S>
ostream& operator<<(ostream& os, const pair<T, S>& v)
{
    os << "(";
    os << v.first << ", "
       << v.second << ")";
    os << "\n";
    return os;
}

#define DEBUG

#ifdef DEBUG
#define debug(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr << name << " : " << arg1;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma = strchr(names + 1, ',');cerr.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);
}
#else
#define debug(...)
#endif


// __gcd(x, y)

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

    ld a, b;
    cin >> a >> b;

    ld res = a * b;
    cout << (ll)res << endl;



    return 0;
}


Measured memory_bytes: 3748
# -*- coding: utf-8 -*-
"""
http://abc076.contest.atcoder.jp/tasks/abc076_b

"""
import sys
from sys import stdin
input = stdin.readline


def main(args):
    current= 1
    N = int(input())
    K = int(input())

    for _ in range(N):
        current = min(current*2, current+K)
    print(current)



if __name__ == '__main__':
    main(sys.argv[1:])
    


Measured memory_bytes: 3060
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <stdio.h>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#define rep(i,a,n) for(ll i =(a);i<(n);++i)
#define urep(i,a,n) for(ll i = (a);i>=(n);--i)
#define all(x) (x).begin(),(x).end()
#define INF 1e18
const int mod = 1e9 + 7;
typedef long long ll;
using namespace std;
ll dx[4] = { 1,-1,0,0 };
ll dy[4] = { 0,0,1,-1 };
ll N,M,X,Y,A,B,C,Q,K,R,W,H,P,L;
string S,T;
ll ans;
ll x[101010];
ll y[101010];
ll a[101010];
ll b[101010];
ll c[101010];
ll t[101010];
ll p[101010];
ll n[101010];
ll l[101010];
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	else return gcd(b, a%b);
}
struct Edge{
	ll to,cost;
	 Edge(ll to, ll cost) : to(to), cost(cost) {}
};
typedef vector<vector<Edge> > AdjList;
AdjList graph;
vector<ll> dist;

struct UnionFind {
    vector<ll> par; // par[i]:iの親の番号　(例) par[3] = 2 : 3の親が2
	vector<ll> size;
    UnionFind(ll N) : par(N),size(N) { //最初は全てが根であるとして初期化
        for(ll i = 0; i < N; i++) par[i] = i;
		for(ll i = 0; i < N; i++) size[i] = 1;
    }

    ll root(ll x) { // データxが属する木の根を再帰で得る：root(x) = {xの木の根}
        if (par[x] == x) return x;
        return par[x] = root(par[x]);
    }
	ll GetSize(ll x){
		return size[root(x)];
	}

    void unite(ll x, ll y) { // xとyの木を併合
        ll rx = root(x); //xの根をrx
        ll ry = root(y); //yの根をry
        if (rx == ry) return; //xとyの根が同じ(=同じ木にある)時はそのまま
        par[rx] = ry; //xとyの根が同じでない(=同じ木にない)時：xの根rxをyの根ryにつける
		size[ry]+=size[rx];

    }

    bool same(ll x, ll y) { // 2つのデータx, yが属する木が同じならtrueを返す
        ll rx = root(x);
        ll ry = root(y);
        return rx == ry;
    }
};

int main() {
    cin>>N>>M;
    vector<pair<ll,ll> > v(N);
    rep(i,0,N){
        cin>>a[i]>>b[i];
        v[i]=make_pair(a[i],b[i]);
    }
    sort(all(v));
    ll point=0;
    ans=0;
    while(true){
        //cerr<<ans<<endl;
        if(M-v[point].second<=0){
            ans+=v[point].first*M;
            break;
        }
        ans+=v[point].first*v[point].second;
        M-=v[point].second;
        point++;
    }
    cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 5888
#include<iostream>
#include<algorithm>
#include<vector>
#include<string>
#include<set>
#include<queue>
#include<stack>
using namespace std;
#define int long long
#define vel vector<long long>
#define vvel vector<vel>
#define rep(i,n) for(long long i=0;i<n;i++)
#define rp(i,n) for(long long i=1;i<n;i++)
#define sor(v) sort(v.begin(),v.end())
#define mmax(a,b) a=max(a,b)
#define mmin(a,b) a=min(a,b)
#define mkp make_pair
#define pin pair<int,int>
#define V vector
long long p = 1000000007;
vel rui(19, 1);
vel kai(1000007, 1);
vel ink(1000007, 1);
vel par;
int root(int ser) {
	if (par[ser] == -1) { return ser; }
	int ans = root(par[ser]);
	par[ser] = ans;
	return ans;
}
bool marge(pin a) {
	int x = root(a.first);
	int y = root(a.second);
	if (x != y) {par[x] = y;}
	return x != y;
}
int gcd(int a, int b) {
	if (a < b) { swap(a, b); }
	if (b == 0) { return a; }
	return gcd(b, a%b);
}
int ru(int a, int r) {
	if (r == 0) { return 1; }
	int ans = ru(a, r / 2);
	ans *= ans; ans %= p;
	if (r % 2 == 1) { ans *= a; ans %= p; }
	return ans;
}
int inv(int a) {
	return ru(a, p - 2);
}
void make_kai() {
	rep(i, 1000006) { kai[i + 1] = (kai[i] * (i + 1)) % p; }
	rep(i, 1000007) { ink[i] = inv(kai[i]); }
}
int com(int n, int r) {
	int ans = kai[n] * ink[r];
	ans %= p;
	return ans;
}
signed main() {
	int n; cin >> n;
	vel pl(0), mi(0);
	int ans = 0;
	rep(i, n) { 
		int a; cin >> a;
		ans += abs(a);
		if (a > 0) { pl.push_back(a); }
		else { mi.push_back(a); }
	}
	sor(pl); sor(mi);
	if (mi.size() == 0) {
		ans -= 2 * pl[0];
		vel npl(pl.size() - 1);
		mi.push_back(pl[0]);
		rep(i, pl.size() - 1) {
			npl[i] = pl[i + 1];
		}
		pl = npl;
	}
	if (pl.size() > 0) {
		cout << ans << endl;
		for (int i = 1; i < mi.size(); i++) {
			cout << pl[0] << " " << mi[i] << endl;
			pl[0] -= mi[i];
		}
		for (int i = 1; i < pl.size(); i++) {
			cout << mi[0] << " " << pl[i] << endl;
			mi[0] -= pl[i];
		}
		cout << pl[0] << " " << mi[0] << endl;
	}
	else {
		reverse(mi.begin(), mi.end());
		cout << ans + 2 * mi[0] << endl;
		for (int i = 1; i < mi.size(); i++) {
			cout << mi[0] << " " << mi[i] << endl;
			mi[0] -= mi[i];
		}
	}
	return 0;
}


Measured memory_bytes: 18420
#include<stdio.h>
#include<string.h>

int main()
{
    long long int a,b,c,d,max,i,j,k,l;
    scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
    i=a*c;
    j=a*d;
    k=b*c;
    l=b*d;
    if(i>=j&&i>=k&&i>=l)
        printf("%lld\n",i);
    else if(j>=i&&j>=k&&j>=l)
        printf("%lld\n",j);
    else if(k>=i&&k>=j&&k>=l)
        printf("%lld\n",k);
    else if(l>=i&&l>=j&&l>=k)
        printf("%lld\n",l);
    return 0;
}


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

// 型定義
typedef long long ll;
typedef pair<ll, ll> P;

// forループ
#define REP(i,n) for(ll i=0; i<(ll)(n); ++i)

// 定数宣言
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;

// グラフ表現
using Graph = vector<vector<int>>;

// グラフの辺表現
using Edge = map<pair<int,int>,int>;

// n次元配列の初期化。第２引数の型のサイズごとに初期化していく。
template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

// 最大公約数
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;
}

int main()
{
    cout << fixed << setprecision(15);
    ll A, B;
    cin >> A >> B;

    if(A+B >= 10){
        cout << "error" << endl;
    }
    else{
        cout << A+B << endl;
    }
    return 0;
}

Measured memory_bytes: 3536
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mod=1e9+7;
const ll N = 2e5+10;



void Solve(){
            
        
        int arr[32]={1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51};
        int k=0;
        cin>>k;
        cout<<arr[k-1];
        
}


int main(){
    
        #ifdef debug
            freopen("input.txt", "r", stdin);
            freopen("output.txt", "w", stdout); 
            
        #endif
            ios_base::sync_with_stdio(0);
            cin.tie(0);cout.tie(0);
            
            
            
                Solve();
            
            
            
        return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(), v.end()
#define downque(que)  priority_queue<ll> que;
#define upque(que) priority_queue<ll, vector<int>, greater<int>> que;
typedef long long ll;
typedef vector<vector<int> > Matrix;
const int MOD = 1e9+7;

ll GCD(ll p,ll q){
    ll r=p%q;
    
  while(r>0){
      p=q;
      q=r;
      r=p%q;
  }
  return q;
}

int main(){
  ll a,b,ans=1; cin>>a>>b;
  ll gcd=GCD(a,b);

  ans*=(a/gcd);
  ans*=(b/gcd);
  ans*=gcd;
  cout<<ans<<endl;
  
}

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

using ll = long long;

using namespace std;

int main() {
    int a[4];
    for (int i=0; i<4; i++) cin >> a[i];
    vector<int> ids{0, 1, 2, 3};
    int ans = 100000000;
    do {
        ans = min(ans, abs((a[ids[0]] + a[ids[1]]) - (a[ids[2]] + a[ids[3]])));
    } while (next_permutation(ids.begin(), ids.end()));
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 3112
#include <bits/stdc++.h>
using namespace std;
     
int main() {
  int a, b, c;
  cin >> a >> b >> c;
  if(a == 5 && b == 7 && c == 5)
  {cout << "YES" << endl;}
  else if(a == 5 && b == 5 && c == 7)
  {cout << "YES" << endl;}
  else if(a == 7 && b == 5 && c == 5)
  {cout << "YES" << endl;}
  else
  {cout << "NO" << endl;}
      
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class Main {
    int a, b, h;

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

    void run() {
        FastReader sc = new FastReader();
        a = sc.nextInt();
        b = sc.nextInt();
        h = sc.nextInt();
        solve();
    }

    void solve() {
        System.out.println((a + b) * h / 2);
    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

        String next() {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        int nextInt()
        {
            return Integer.parseInt(next());
        }

        long nextLong()
        {
            return Long.parseLong(next());
        }

        double nextDouble()
        {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }
    }
}


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

int main() {
	int a,b;
	while(1){
		cin>>a>>b;
		if (a==0 && b==0){break;}
		for(int i=0; i<a; i++){
			for(int j=0; j<b; j++){
				if(i==0 || i==a-1 || j==0 || j==b-1){
					cout<<"#";
				}else{
					cout<<".";
				}
		
			}
			cout<<endl;
		}
		cout<<endl;
	}
	return 0;
}


Measured memory_bytes: 3120
#include<cstdio>
#include<algorithm>
#include<iostream>
#include<cstring>
#include<vector>
#include<queue>
#include<set>
#include<map>
using namespace std;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    int k;
    cin>>k;
    string ss;
    cin>>ss;
    if((int)ss.length()>k) ss=ss.substr(0,k)+"...";
    cout<<ss<<'\n';
    return 0;
}


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

int main(){
 
    long int N,K;
    cin>>N>>K;
    vector<pair<long int,long int>> S(N);
    for(int i=0;i<N;i++){
        cin>>S.at(i).first>>S.at(i).second;
    }
    sort(S.begin(),S.end());
    long int ans=0;
    for(int i=0;i<N;i++){
        ans+=S.at(i).second;
        if(ans>=K){
            cout<<S.at(i).first<<endl;
            break;
        }
    }
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define inf 1e18
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pb push_back
#define ff first
#define ss second
#define vll vector<ll>
#define pii pair<ll,ll>
#define sz(v) (v).size()
#define srt(v) sort(v.begin(),v.end())
#define ull unsigned long long
#define tell(a) cout<<a<<" "
#define el cout<<endl
#define rev(v) reverse(v.begin(),v.end())
#define rep(i,a,n) for(int i=a;i<n;i++)
#define M 1000000007
ll power(ll x, ll y, ll p){ll res = 1;x = x % p;while (y > 0){   if (y & 1)res = (res*x) % p;y = y>>1;
x = (x*x) % p;}return res;}

bool solve(ll n, ll k) 
{ 
	if((k*(k+1))/2<0)return false;
    if (n >= (k * (k + 1)) / 2) { 
        return true; 
    } 
  
    return false; 
} 
ll a[50];
int main()
{
	IOS;
	a[0]=0;
	a[1]=1;
	a[2]=1;
	for(ll i=3;i<50;i++)
	{
		a[i]=1LL;
		for(ll j=1;j<=i;j++)
		{
			if(!solve(i,j))
			break;
			a[i]=j;
		}
	}
	ll n;
	cin>>n;
	ll ans=0;
	ll c=0;
	while(n%2==0)
	{
		c++;
		n/=2;
	}
	ans+=a[c];
	for(ll i=3;i*i<=n;i+=2)
	{
		c=0;
		while(n%i==0)
		{
			c++;
			n/=i;
		}
		ans+=a[c];
	}
	if(n>1)
	ans+=1;
	cout<<ans;
	
}



Measured memory_bytes: 3640
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main() {
    int N;
    cin >> N;
    int A[N];
    for(int i = 0; i < N; i++)cin >> A[i];
    int ans = 0;
    while(true){
        for(int j = 0; j < N; j++) {
            if (A[j] % 2 != 0) {
                goto flag;
            }
            A[j] = A[j] / 2;
        }
        ans++;
    }
    flag:
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <queue>
#include <algorithm>
#include <string>
#include <utility>
#include <vector>
#include <map>
#include <stack>
#include <iomanip>
#include <set>
#include <sstream>
#include <cmath>
#include <deque>
#include <list>
#include <bitset>
using namespace  std;
typedef pair<long long , long long> P;
typedef long long int64;
typedef long long lint;
#define REP(i, n) for(long long (i)=0; (i)<(n); ++i)
#define FOR(i, a, b) for(long long (i)=(a); (i)<(b); ++i)
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define FST first
#define SND second

const long long MOD = (lint)(1e9) + 7;
lint N, M;
vector<P> factoring(lint N) {
    vector<P> res;
    lint n=N;
    for(int i=2; i*i<N; i++) {
        if(n%i==0) {
            P p=P(i, 0);
            while(n%i==0){
                p.second++;
                n /= i;
            }
            res.push_back(p);
        }
    }
    if(n>1) res.push_back(P(n, 1));
    return res;
}
lint pow(lint n, lint x) {
    lint res = 1LL;
    while(x){
        if(x%2==1) res = (res*n) % MOD;
        x = x>>1;
        n= (n*n) % MOD;
    }
    return res%MOD;
}
lint factorial(lint n) {
    if(n<=1) return 1;
    else return (n * factorial(n-1))%MOD;
}

lint cmb(lint n, lint r){
    lint res = 1LL;
    r = min(r, n-r);
    for(lint i=n-r+1; i<=n; i++) res = (res*i)%MOD;
    res *= pow(factorial(r), MOD-2);
    return res % MOD;
}

signed main(){
    cin>>N>>M;
    vector<P> A = factoring(M);
    lint res = 1LL;
    for(lint i=0, n=(lint)A.size(); i<n; i++){
        res = (res * cmb(A[i].second+N-1, A[i].second)) % MOD;
    }
    cout << res%MOD << endl;
    return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>

using namespace std;

int main() {
  int l, r;
  scanf("%d%d", &l, &r);
  const int mod = 2019;
  int ans = mod;
  for (int i = 0; i < 2 * mod && l + i <= r; ++i) {
    for (int j = i + 1; j < 2 * mod && l + j <= r; ++j) {
      ans = min(ans, (l + i) % mod * ((l + j) % mod) % mod);
    }
  }
  printf("%d\n", ans);
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define MP make_pair
#define PII pair<int, int>
#define PLL pair<ll, ll>
#define PLI pair<ll, int>
#define PIL pair<int, ll>
#define STR string
#define Fst first
#define Snd second
#define SHN 1e9
#define LSHN 1e18
using namespace std;
int n;
map<string, int> mp;
int main()
{
	cin >>n;
	while (n--)
	{
		string s;
		cin >>s;
		mp[s]++;
	}
	cout <<"AC x "<<mp["AC"]<<"\n";
	cout <<"WA x "<<mp["WA"]<<"\n";
	cout <<"TLE x "<<mp["TLE"]<<"\n";
	cout <<"RE x "<<mp["RE"]<<"\n";
	return 0;
}

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

using namespace std;

const int maxn = 3e3+10;

typedef long long ll;

int num[maxn];

ll dp[maxn][maxn][2];

ll solve(int l, int r, bool q)
{
	if (l > r) return 0LL;
	if (dp[l][r][q] != -1) return dp[l][r][q];

	ll ans;

	if (q)
	{
		ans = 1LL*num[l]+solve(l+1, r, !q);
		ans = max(ans, 1LL*num[r]+solve(l, r-1, !q));
	}
	else
	{
		ans = solve(l+1, r, !q)-1LL*num[l];
		ans = min(ans, solve(l, r-1, !q)-1LL*num[r]);
	}

	return dp[l][r][q] = ans;
}

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

	for (int i = 1; i <= n; i++)
		cin >> num[i];

	memset(dp, -1, sizeof dp);

	cout << solve(1, n, 1) << "\n";
}

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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;


int main() {
    int N, M;
    cin >> N >> M;

    string res;
    if (N == M) res = "Yes";
    else res = "No";
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc=new Scanner(System.in);

		int N=sc.nextInt();

		int[] A=new int[N];

		for(int i=0;i<N;i++) A[i]=sc.nextInt();

		long ans=0;

		int cnt=0;

		for(int i=0;i<N;i++) {
			if(A[i]<=0) cnt++;
		}

		if(cnt%2==0) {
			for(int i=0;i<N;i++) ans+=Math.abs(A[i]);
		}else {
			int min=+1000000001;
			int index=0;
			for(int i=0;i<N;i++) {
				if(min>Math.abs(A[i])) {
					min=Math.abs(A[i]);
					index=i;
				}
			}
			for(int i=0;i<N;i++) {
				if(index==i) {
					if(A[i]<0) ans+=A[i];
					else ans+=-A[i];
				}
				else ans+=Math.abs(A[i]);
			}
		}

		System.out.println(ans);

		sc.close();

	}

}


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

void quit(string s) {
    cout<<s<<endl;
    exit(0);
}

const int N = 1e5+7;
vector<pair<int, int>> edges;
vector<int> adj[N];

bool dfs(int u, int pe, int s, int t) {
    for (int e: adj[u]) {
        if (e == pe)    continue;
        int v = edges[e].first^edges[e].second^u;
        if (v == t) continue;
        if (v == s || dfs(v, e, s, t))    return true;
    }
    return false;
}

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

    int n, m;
    cin>>n>>m;

    for (int i=1; i<=m; i++) {
        int u, v;
        cin>>u>>v;
        edges.push_back({u, v});
        adj[u].push_back(edges.size()-1);
        adj[v].push_back(edges.size()-1);
    }

    for (int i=1; i<=n; i++) {
        int deg = adj[i].size();
        if (deg%2)  quit("No");
    }

    vector<int> fours;
    for (int i=1; i<=n; i++) {
        int deg = adj[i].size();
        if (deg>4)  quit("Yes");
        else if (deg == 4)  fours.push_back(i);
    }

    if (fours.size()>2) quit("Yes");
    if (fours.size()<2) quit("No");

    int a = fours[0], b = fours[1];
    if (dfs(a, -1, a, b))   quit("Yes");
    else                quit("No");
}


Measured memory_bytes: 8436
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;
typedef pair<P, char> PC;

int n;
int a, b, c, d;
int sum[110];
int r[110];

int main(){
	cin >> n;
	REP(i, n*(n - 1) / 2){
		cin >> a >> b >> c >> d;
		if (c > d) sum[a] += 3;
		else if (c < d)sum[b] += 3;
		else{
			sum[a]++;
			sum[b]++;
		}
	}
	REP(i, n){
		r[i + 1] = 1;
		REP(j, n){
			if (i == j)continue;
			if (sum[i + 1] < sum[j + 1]){
				r[i + 1]++;
			}
		}
	}
	REP(i, n){
		cout << r[i + 1] << endl;
	}
}

Measured memory_bytes: 1160
using System;
//using System.Collections;
//using System.Collections.Generic;
//using System.Linq;

namespace problem
{
  class Test
  {
    static void Main()
    {
        double r = double.Parse(Console.ReadLine());
        Console.WriteLine("{0:0.000000} {1:0.000000}", (decimal)(Math.PI * r * r), (decimal)(2 * Math.PI * r));
    }
  }
}


Measured memory_bytes: 9292
#!/usr/bin/env python3
import sys


def solve(N: int, M: int, Q: int, a: "List[int]", b: "List[int]", c: "List[int]", d: "List[int]"):
    from itertools import combinations_with_replacement
    answer = 0
    for AA in combinations_with_replacement(range(1,M+1),r=N):
        
        tmp_ans = 0
        for q in range(Q):
            if AA[b[q]-1] - AA[a[q]-1] ==  c[q]:
                tmp_ans += d[q]
  
        answer = max(answer,tmp_ans)
    print(answer)
    return


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    M = int(next(tokens))  # type: int
    Q = int(next(tokens))  # type: int
    a = [int()] * (Q)  # type: "List[int]"
    b = [int()] * (Q)  # type: "List[int]"
    c = [int()] * (Q)  # type: "List[int]"
    d = [int()] * (Q)  # type: "List[int]"
    for i in range(Q):
        a[i] = int(next(tokens))
        b[i] = int(next(tokens))
        c[i] = int(next(tokens))
        d[i] = int(next(tokens))
    solve(N, M, Q, a, b, c, d)

if __name__ == '__main__':
    main()


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

using namespace std;

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

int H,W;
int c[10][10];
int x[11];

int main(){
	cin >> H >> W;
	repp(i,0,10) repp(j,0,10){
		cin >> c[i][j];
	}
	repp(k,0,10) repp(i,0,10) repp(j,0,10) c[i][j] = min(c[i][j],c[i][k]+c[k][j]);
	repp(i,0,H) repp(j,0,W){
		int A; cin >> A;
		++A;
		++x[A];
	}
	LL ans = 0;
	repp(i,0,10){
		ans += c[i][1] * x[i+1];
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include <cmath>
#include <string>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int n, t, a[100009]; long long b[100009], c[100009];
int main() {
	ios::sync_with_stdio(false);
	cin >> n >> t;
	for (int i = 0; i < n; i++) cin >> a[i];
	for (int i = 0; i < n; i++) b[i] = a[i] + (i >= 1 ? b[i - 1] : 0);
	for (int i = 0; i < n; i++) {
		c[i] = b[i] + a[i];
		if (i >= 1) c[i] = max(c[i], c[i - 1] + a[i]);
	}
	for (int i = 0; i < n; i++) {
		if (t < b[i]) cout << 1 << '\n';
		else if (t < c[i]) cout << 2 << '\n';
		else cout << (t - b[i]) / (c[i] - b[i]) + 2 << '\n';
	}
	return 0;
}

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

#define rep(i, a, b) for (int i = a; i < (int)(b); ++i)
#define rrep(i, a, b) for (int i = b - 1; i >= (int)(a); --i)

using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
using vd = vector<double>;
using vvi = vector<vi>;

constexpr int MOD = 1000000007;

// Data structures.
struct Point {
    double x, y;
    Point(double x = 0, double y = 0) : x(x), y(y) {}
    Point(const Point& p) : x(p.x), y(p.y) {}

    Point operator+(const Point& p) const { return Point(x + p.x, y + p.y); }
    Point operator-(const Point& p) const { return Point(x - p.x, y - p.y); }
    Point operator*(double k) const { return Point(k * x, k * y); }
    Point operator/(double k) const { return Point(x / k, y / k); }

    bool operator<(const Point& p) const { return x != p.x ? x < p.x : y < p.y; }
    bool operator==(const Point& p) const { return fabs(x - p.x) < 1e-10 && fabs(y - p.y) < 1e-10; }

    static double norm(const Point& p) { return sqrt(p.x * p.x + p.y * p.y); }
    static double dot(const Point& p1, const Point& p2) { return p1.x * p2.x + p1.y * p2.y; }
    static double cross(const Point& p1, const Point& p2) { return p1.x * p2.y - p1.y * p2.x; }
};
typedef Point Vector;

struct Segment {
    Point s, t;
};
typedef Segment Line;

class Circle {
public:
    Point c;
    double r;
    Circle(double cx = 0.0, double cy = 0.0, double r = 0.0) : c(cx, cy), r(r) {}
    Circle(Point c = Point(), double r = 0.0) : c(c), r(r) {}
};

vector<Point> cross_point(const Circle& c1, const Circle& c2) {
    vector<Point> ans;

    double d = Point::norm(c2.c - c1.c);
    Point vec((c2.c - c1.c) / d);

    double x = (d * d + c1.r * c1.r - c2.r * c2.r) / (2 * d);
    Point mid = (c1.c * (d - x) + c2.c * x) / d;

    Point normal = Point(-vec.y, vec.x) * sqrt(c1.r * c1.r - x * x);
    ans.push_back(mid - normal);
    ans.push_back(mid + normal);

    return ans;
}

vector<Point> cross_point2(const Circle& c1, const Circle& c2) {
    vector<Point> ans;

    double d = Point::norm(c2.c - c1.c);
    Point vec(c2.c - c1.c);

    double alpha = acos(c1.r * c1.r + d * d - c2.r * c2.r) / (2 * c1.r * d);
    double t = atan(vec.y / vec.x);

    double cos1 = cos(alpha + t);
    double sin1 = sin(alpha + t);
    ans.push_back(c1.c + Point(cos1, sin1) * d);

    double cos2 = cos(-alpha + t);
    double sin2 = sin(-alpha + t);
    ans.push_back(c1.c + Point(cos2, sin2) * d);

    return ans;
}

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

    double cx, cy, r;

    cin >> cx >> cy >> r;
    Circle c1(cx, cy, r);

    cin >> cx >> cy >> r;
    Circle c2(cx, cy, r);

    vector<Point> ps = cross_point(c1, c2);
    sort(ps.begin(), ps.end());
    printf("%.10f %.10f %.10f %.10f\n", ps[0].x, ps[0].y, ps[1].x, ps[1].y);

    return 0;
}


Measured memory_bytes: 3292
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include<stdio.h>
#include<math.h>
#define Rad(C) C*M_PI/180.0

int main() {
	double m, a, n,sum,s[1000], *p;
	int i;
	while (1) {
		scanf("%lf", &n);
		if (n == 0.0) break;
		sum = 0.0; a = 0.0;
		p = s;
		for (i = 0; i < n; i++) {
			scanf("%lf", &s[i]);
			sum += s[i];
		}
		m = sum / n;
		for (i = 0; i < n; i++)  a += pow(*(p++) - m, 2);
		a /= n;
		printf("%lf\n", sqrt(fabs(a)));	
	}
	return 0;
}

Measured memory_bytes: 656
import java.util.*;
// warm-up
public class Main {

	static void solve() {
		Scanner sc = new Scanner(System.in);
		System.out.println((int)Math.ceil((sc.nextDouble()+sc.nextDouble())/2));
		sc.close();		
	}

	public static void main(String args[]) {
		solve();
	}

}

Measured memory_bytes: 37088
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Console = System.Console;

namespace Atcoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var r = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var X = r[0];
            var A = r[1];
            var B = r[2];
            var over = B - A;
            if (over <= 0)
            {
                Console.WriteLine("delicious");
            }
            else if (X >= over)
            {
                Console.WriteLine("safe");
            }
            else
            {
                Console.WriteLine("dangerous");
            }
        }
    }
}

Measured memory_bytes: 13268
#include<iostream>
#include<map>
#include<set>
#include<string>
#include<algorithm>
#include<cmath>
#include<vector>
#include<queue>
#include<stack>
#include<limits>
#include<sstream> 
#include<unordered_map>      

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef int itn;

const int inf = numeric_limits<int>::max() >> 2;
const ll linf = numeric_limits<ll>::max() >> 2;
const ull ulinf = numeric_limits<ull>::max() >> 2;
const double pi = acos(-1);
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
const int dx8[8]={-1,0,1,-1,1,-1,0,1};
const int dy8[8]={-1,-1,-1,0,0,1,1,1};

#define p_queue(i) priority_queue<i> 
#define rp_queue(i) priority_queue<i, vector<i>, greater<i>> 
#define umap(i,j) unordered_map<i,j>
#define P(p) cout<<(p)<<endl
#define PS(p) cout<<(p)<< " "
#define PN cout << endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i = (n-1); i >= (int)(m); i--)
#define inrep(n,a) for(int i = 0; i < (int)(n); i++)cin >> a[i];
#define mod(i) ((i)%(ll)(1e9 + 7))
#define divm(a,b) (mod(a * modpow((ll)b,(ll)(1e9+5))))
#define rsort(a,b,c) sort(a, b, greater<c>())
#define vsort(v) sort(v.begin(), v.end())
#define rvsort(v,c) sort(v.begin(), v.end(), greater<c>()) 
#define ft first
#define sd second
#define pb push_back
#define it insert
#define sz(x) ((int)(x).size())
#define lb(a,n,k) (lower_bound(a,a+n,k) - (a)) 
#define vlb(a,k)  (lower_bound(a.begin(),a.end(),k) - a.begin())
#define ub(a,n,k) (upper_bound(a,a+n,k) - (a)) 
#define vub(a,k)  (upper_bound(a.begin(),a.end(),k) - a.begin())
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return

/*
ll modpow(ll i,ll j){ ll tmp=1; while(j){ if(j%2)tmp=mod(tmp*i);i=mod(i*i);j/=2;}return tmp;}
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a / gcd(a, b) * b; }
*/

/*
vector<string> split(const string &str, char sep){
    vector<string> v;
    stringstream ss(str);
    string buffer;
    while( getline(ss, buffer, sep) ) {
        v.push_back(buffer);
    }
    return v;
}
*/

/*
ll ncr[100][100];
ll nCr(int n, int r){if(n==r) ret ncr[n][r] = 1; if(r==0) ret ncr[n][r] = 1; if(r==1) ret ncr[n][r] = n;if(ncr[n][r]) ret ncr[n][r]; ret ncr[n][r] = nCr(n-1,r) + nCr(n-1,r-1);}

ll npr[100][100]={};
ll nPr(int n,int r){if(npr[n][r])ret npr[n][r];if(r==0)ret npr[n][r] = 1;if(r==1)ret npr[n][r] = n;ret npr[n][r] = n * nPr(n-1,r-1);}

ll nHr(int n,int r){ret nCr(n+r-1,r);}
*/

///////////////////////////////////////////////////////////////////////////



int main(){

    ll x;
    cin >> x;

    while(1){
	ll a = 2;
	while(x%a != 0 && a < sqrt(x)){
	    a++;
	}
	if(a >= sqrt(x)){
	    P(x);
	    ret 0;
	}
	x++;
    }
    return  0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
#define fir first
#define sec second
#define rep(i,a,b) for (int i = (a) ; i <= (b) ; ++ i)
#define rrp(i,a,b) for (int i = (a) ; i >= (b) ; -- i)
#define gc() getchar()
template <typename tp>
inline void read(tp& x) {
  x = 0; char tmp; bool key = 0;
  for (tmp = gc() ; !isdigit(tmp) ; tmp = gc())
    key = (tmp == '-');
  for ( ; isdigit(tmp) ; tmp = gc())
    x = (x << 3) + (x << 1) + (tmp ^ '0');
  if (key) x = -x;
}

const int MOD = 998244353, N = 1000010;
int power(int a,int b) {
  int ret = 1;
  while (b) {
    if (b & 1) ret = 1ll * ret * a % MOD;
    a = 1ll * a * a % MOD;
    b >>= 1;
  }
  return ret;
}
int jc[N], inv[N];
int comb(int a,int b) {
  if (a < 0 || b < 0 || a < b) return 0;
  return 1ll * jc[a] * inv[b] % MOD * inv[a-b] % MOD;
}
void init(int n) {
  jc[0] = 1;
  rep (i, 1, n) jc[i] = 1ll * jc[i-1] * i % MOD;
  inv[n] = power(jc[n], MOD-2);
  rrp (i, n-1, 0) inv[i] = 1ll * inv[i+1] * (i+1) % MOD;
}
int ans;
int main() {
  int n, m;
  read(n), read(m);
  init(n + m);
  if (n > m) swap(n, m);
  rep (i, 1, n) (ans += 1ll * comb(i+i-1,i) * comb(n-i+m-i,n-i) % MOD) %= MOD;
  ans = 1ll * ans * power(comb(n + m, n), MOD - 2) % MOD;
  ans = n - ans;
  ans = n + m - ans;
  ans = (ans % MOD + MOD) % MOD;
  printf("%d\n", ans);
  return 0;
}


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

#define int long long
#define ld long double

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

#define pb push_back
#define mp make_pair
#define all(A) A.begin(),A.end()
#define allr(A) A.rbegin(),A.rend()
#define precise(i) fixed << setprecision(i)
#define fi first
#define se second

#define err() cout<<"\n==================================\n";
#define errA(A) for(auto i:A) cout<<i<<" "; cout<<"\n";
#define err1(a) cout<<#a<<" "<<a<<"\n";
#define err2(a,b) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<"\n";
#define err3(a,b,c) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<"\n";
#define err4(a,b,c,d) cout<<#a<<" "<<a<<" "<<#b<<" "<<b<<" "<<#c<<" "<<c<<" "<<#d<<" "<<d<<"\n";

const int logN = 20;
const int M = 1000000007;
const int INF = 1e12;
#define PI 3.14159265;
const int N = 200005;

#define Pii pair<int,int>
#define Vi vector<int>
#define Vpii vector<Pii>

void solve()
{
       ld a,b;
       cin>>a>>b;
       cout<<precise(0)<<floor(a*b);
}

int32_t main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int t=1;
//    cin>>t;
    while(t--)
    {
           solve();
    }
    return 0;
}

Measured memory_bytes: 3808
//arc078_c.cpp
//Fri Jun  8 22:21:25 2018

#include <iostream>
#include <string>
#include <queue>
#include <unordered_map>
#include <vector>
#include <algorithm>
using namespace std;
using ll=long long;

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

	int a[n];
	ll sum = 0;
	for (int i=0;i<n;i++){
		cin >> a[i];
		sum = sum + a[i];
	}

	ll ssum = a[0];
	sum = sum - a[0];
	ll ans = abs(sum-ssum);

	for (int i=1;i<n-1;i++){
		ssum = ssum + a[i];
		sum = sum - a[i];
		ll temp = abs(sum-ssum);
		if (temp < ans){
			ans = temp;
		}
	}

	cout << ans << endl;
}

Measured memory_bytes: 1024