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

#define bit(n) (1<<(n))
#define inf 1000000000
#define eps 1e-9
#define PI 3.1415926535897932385
#define pb push_back
#define sz size()
#define mp make_pair
#define cl clear()
#define all(a) a.begin(),a.end()
#define fill(ar,val) memset(ar,val,sizeof(ar))
#define MIN(a,b) if(a>(b)) a=(b)
#define MAX(a,b) if(a<(b)) a=(b)
#define sqr(x) ((x)*(x))
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
//#define MOD 1000000007
#define bsize 1111


using namespace std;
 // ================================================================== //


int main()
{
    // * Faster Input *//
    
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    
    // * ========================================================== * //
    
    int n,k;
    long long int ans = 1;
    cin >> n >> k;
    for(int i=0;i<n;i++)
    {
        if(i==0)
        {
            ans *= k; 
        }
        else
        {
            ans *= k-1;
        }
    }
    cout << ans << endl;
    
    

    return 0;
}


Measured memory_bytes: 256
n = range(int(input())+1)
N =list(n)
A =[]
B = []
for i in N[1:] :
  if i%3==0 and i%5==0 :
    A.append('fizzbuzz')
  elif i%3==0 :
    A.append('fizz')
  elif i%5==0 :
    A.append('buzz')
  else:
    B.append(i)
c=0
for j in B:
  c+=j
print(c)

    

Measured memory_bytes: 64064
#include <bits/stdc++.h>
#define REP(i, n) for (int (i) = 0; (i) < (int)(n); i++) 
#define FOR(i, a, b) for(int (i) = a; (i) < (int)b; i++)
#define RREP(i, n) for(int (i)=((int)(n)-1); (i)>=0; i--)
#define RFOR(i, a, b) for(int (i) =((int)(b)-1); (i)>=(int)a; i--)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007
#define NIL -1
#define FI first
#define SE second
#define MP make_pair
#define PB push_back
#define SZ(x)  (int)x.size()
#define SP(x)  setprecision((int)x)


using namespace std ;
typedef long long ll;
typedef vector<int> vint;
typedef vector<vint> vvint;
typedef vector<string> vstr;
typedef pair<int, int> pii;
const int INF = 1e9;
const ll LINF = 1e18;
const double EPS = 1e-9;
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;} //最小公倍数

//-------------------------------------------------
// 
void yes(){
  cout <<"Yes"<<endl ;
}
void no(){
  cout <<"No"<<endl ;
}


//-------------------------------------------------
// メモ
/*






*/
//-------------------------------------------------


int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n ;
  cin >> n ;
  vector<int> num(n) ;
  REP(i,n){
    cin >> num[i] ;
  }
  int ans = INF ;
  REP(i,101){
    int sum = 0 ;
    REP(j,n){
      sum += (num[j]-i)*(num[j]-i) ;
    }
    ans = min(ans,sum) ;
  }
  cout <<ans <<endl ;
  
  
  
  return 0 ;
}




Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int n, i, j, t_score = 0, h_score = 0, flag = 0;
	char t_card[101], h_card[101];
	
	
	scanf("%d\n", &n);
	for(i = 0; i < n; i++){
		scanf("%s %s\n", t_card, h_card);
		for(j = 0; !(t_card[j]=='\0' && h_card[j]=='\0'); j++){
			if(t_card[j] > h_card[j] || h_card[j] == '\0'){
				t_score += 3;
				flag = 1;
				break;
			}else if(t_card[j] < h_card[j] || t_card[j] == '\0'){
				h_score += 3;
				flag = 1;
				break;
			}else if(t_card[j] == h_card[j]){
				flag = 0;
				continue;
			}
		}
		if(flag == 0){
			t_score += 1;
			h_score += 1;
		}
	}
	printf("%d %d\n", t_score, h_score);
	
	return 0;
}


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

using namespace std;
typedef long long LL;
const int mod = 1e9+7;
const int maxn = 1e5+15;
int n,k,block;
LL sum[maxn],a[maxn],num[maxn];
int main(){
    cin >> n >> k;
    block = 1;
    for(int i = 1;i <= n; ){
        int t = n/i;
        int up = n/t;
        num[block] = up-i+1;
        sum[block] = t;
        i = up + 1;
        block++;
    }
    for(int i = 2;i <= k; ++i){
        for(int j = 1;j < block; ++j){
            a[j] = sum[j]*num[j]%mod;
        }
        for(int j = 1;j < block; ++j){
            sum[j] = (sum[j-1] + a[j])%mod;
        }
        int t = block/2;
        for(int j = 1;j <= t; ++j) swap(sum[j],sum[block-j]);
    }
    cout << sum[1] << endl;
    return 0;
}

Measured memory_bytes: 1792
import java.util.ArrayList;
import java.util.Scanner;

public class Main {

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

	class UF{
		int p[];
		int rank[];
		int cnt[];
		public UF(int n) {
			p = new int[n];
			rank = new int[n];
			cnt = new int[n];
			for(int i=0; i<n; i++) {
				p[i]=i;
				rank[i]=1;
				cnt[i]=1;
			}
		}

		private int find(int x) {
			if(p[x] == x) return x;
			return p[x] = find(p[x]);
		}
		public boolean unite(int x, int y) {
			return link(find(x), find(y));
		}
		public boolean same(int x, int y) {
			return find(x) == find(y);
		}
		private boolean link(int x, int y) {
			if(x==y) return false;
			if(rank[x]<rank[y]) {
				p[x]=y;
				cnt[y] += cnt[x];
			}else {
				p[y]=x;
				cnt[x] += cnt[y];
				if(rank[x]==rank[y]) {
					rank[x]++;
				}
			}
			return true;
		}
		public int size(int x) {
			return cnt[find(x)];
		}
	}
	public void run() {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int m = sc.nextInt();
		int k = sc.nextInt();

		UF uf = new UF(n);
		int deg[] = new int[n];
		for(int i=0; i<m; i++) {
			int a = sc.nextInt(); a--;
			int b = sc.nextInt(); b--;
			uf.unite(a, b);
			deg[a]++;
			deg[b]++;
		}

		ArrayList<ArrayList<Integer>> to = new ArrayList<ArrayList<Integer>>();
		for(int i=0; i<n; i++) {
			to.add(new ArrayList<Integer>());
		}
		for(int i=0 ;i<k; i++) {
			int c = sc.nextInt(); c--;
			int d = sc.nextInt(); d--;
			to.get(c).add(d);
			to.get(d).add(c);
		}

		for(int i=0; i<n; i++) {
			int ans = uf.size(i) - deg[i] - 1;
			for(int j : to.get(i)) {
				if(uf.same(i, j)) {
					ans--;
				}
			}
			System.out.print(ans + (i==n-1 ? "\n" : " "));
		}
		sc.close();
	}

}


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

typedef long long int ll;

int main() {
    int N;
    cin >> N;
    vector<ll> v(N);
    vector<int> pos(N+1);
    pos[0] = -1;
    for (int i = 0; i < N; i++) {
        cin >> v[i];
        pos[v[i]] = i;
    }

    ll ans = 0;
    set<int> s;
    s.insert(-1);
    s.insert(N);
    for (int i = 1; i <= N; i++) {
        s.insert(pos[i]);
        auto ite = s.lower_bound(pos[i]);
        auto l = ite; l--;
        auto r = ite; r++;
        ans += (ll)1LL * i * (pos[i] - *l) * (*r - pos[i]);
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 11904
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define all(a) (a).begin(),(a).end()
#define pb emplace_back
#define INF (1e9+1)

void leave(vector<int> &v, const vector<int> &leavers){
    for(auto name:leavers){
        rep(i,v.size()){
            if(v[i]==name){
                v[i] = -1;
            }
        }
    }
}

int IsThereSpace(const vector<int> &v, int num){
    assert(num<=v.size());
    rep(i,v.size()-num+1){
        bool space = true;
        for(int j=i;j<i+num;j++){
            if(v[j]!=-1){
                space = false;
            }
        }
        if(space) return i;
    }
    return -1;
}

int processing_que(vector<int> &v, queue<pii> &que){
    if(que.empty())return -1;
    int name, num;
    tie(name,num) = que.front();

    int res = IsThereSpace(v, num);
    if( res!=-1 ){
        for(int i=res;i<res+num;i++){
            assert(v[i]==-1);
            v[i] = name;
        }
        que.pop();
        return name;
    }else{
        return -1;
    }
}

int main(){
    int n;
    while(cin>>n){
        vector<int> eating_times(101,INF);
        vector<int> v(17,-1);
        queue<pii> que;
        map<int,vector<int>> mp;
        for(int t=0; t<=4200; t++){
            if(mp.count(t)!=0){
                leave(v, mp[t]);
                mp[t] = vector<int>();
            }
            if(t%5==0){
                int name = t/5;
                if(name>99)continue;
                int num;
                if(name%5==1)num = 5;
                else num = 2;

                int eating_time = 17*(name % 2) + 3*(name % 3) + 19;
                eating_times[name] = eating_time;
                que.push(pii(name, num));
            }
            bool n_entered = false;
            while(1){
                int res = processing_que(v, que);
                if(res==-1)break;
                else{
                    assert(eating_times[res]!=INF);
                    mp[t+eating_times[res]].pb(res);
                    if(res==n) n_entered = true;
                }
            }

            if(n_entered){
                cout<<t-n*5<<endl;
                break;
            }
            if(t==4200) assert(false);
        }
    }
}



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

#define WHITE 0
#define GRAY 1
#define BLACK 2

static const int INFTY = (1<<21);
static const int N=100;

int n, M[N][N];
int color[N], d[N], f[N], tt;

// void dfs_visit(int u) {
//    color[u] = GRAY;
//    d[u] = ++tt;
//    rep(v, n) {
//       if (M[u][v] == 0) continue;

//       if(color[v] == WHITE) {
//          dfs_visit(v);
//       }
//    }
//    color[u] = BLACK;
//    f[u] = ++tt;
// }

// void dfs() {
//    int u;
//    for(u = 0; u < n; u ++) {
//       color[u] = WHITE;
//    }

//    for(u = 0; u < n; u ++) {
//       if(color[u] == WHITE) dfs_visit(u);
//    }

//    for(u =0; u<n;u++) {
//       printf("%d %d %d\n", u+1, d[u], f[u]);
//    }
// }

// void bfs_visit() {

// }

void bfs(int s) {
   queue<int> q;

   rep(i, n) {
      d[i] = INFTY;
      color[i] = WHITE;
   }

   q.push(s);
   d[s] = 0;

   while (!q.empty()) {
      int u = q.front(); q.pop();
      rep(v, n) {
         if (M[u][v] && color[v] == WHITE) {
            color[v] = GRAY;
            d[v] = d[u] + 1;
            q.push(v);
         }
      }
      color[u] = BLACK;
   }

   rep(i, n) {
      if(d[i] != INFTY) {
         cout << i+1 << " " << d[i] << endl;
      } else {
         cout << i+1 << " " << -1 << endl;
      }
   }
}

int main(){
   int u, k, v;
   cin>>n;

   // graphを0で初期化
   for(int i = 0; i < n; i ++) {
      for(int j = 0; j < n; j ++) {
         M[i][j] = 0;
      }
   }

   // 隣接リストを隣接行列に変換
   for(int i = 0; i < n; i ++) {
      scanf("%d %d", &u, &k);
      u--;
      for(int j = 0; j < k; j++) {
         scanf("%d", &v);
         v--;
         M[u][v] = 1;
      }
   }

   bfs(0);
   // dfs();
   return 0;
}



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

#define fori(i,a,b)    for(int i=a;i<=b;i++)
#define ford(i,a,b)   for(int i=a;i>=b;i--)
#define all(a)        a.begin(), a.end()
#define in(c,x)       ((c).find(x) != (c).end())
#define isp(c,x)      (find(all(c),x) != (c).end())
#define pb             push_back
#define ppb            pop_back
#define sz(x)          (int)x.size()
#define fill(a,v)      memset(a, v, sizeof a)
#define fs first
#define sc second
#define ub upper_bound
#define lb lower_bound
#define en '\n'

typedef long long int lli;
typedef long double ld;
typedef vector<int> vi;
typedef vector<long long int> vlli;
typedef pair< int, int > pii;
typedef pair< lli, lli > plli;
typedef list<int> li;
typedef map<int, int> mi;
typedef map<lli, lli> mlli;
lli gcd(lli a,lli b){return (!b)?a:gcd(b,a%b);}
int t = 1; int ti;





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


void solve(){
    cin>>n;

    fori(i, 1, n){
        cin>>h[i];
        dp[i] = INT64_MAX;
    }

    dp[1] = 0;

    fori(i, 1, n){
        dp[i+1] = min(dp[i+1], dp[i] + abs(h[i+1]-h[i])); 
        dp[i+2] = min(dp[i+2], dp[i] + abs(h[i+2]-h[i])); 
    }


    cout<<dp[n];
}
//THINK OF SPECIAL CASES, ARRAY LIMITS, LLI vs INT, 1LL

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

    // cin>>t;

    // for(ti= 1; ti <= t; ti++)
    solve();

//    cout<<"\nTHINK OF SPECIAL CASES, ARRAY LIMITS, LLI vs INT, 1LL";
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define REP(i,n) for (int i=0;i<(n);i++)
#define RREP(i,n) for (int i=(n)-1;i>=0;i--)
int main(){
	int a,b,c;
	cin>>a>>b>>c;
	int count=3;
	if(a==b)count--;
	if((b==c)||(c==a))count--;
        cout<<count<<endl;
	return(0);
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define FI first
#define SE second
#define EPS 1e-9
#define ALL(a) a.begin(),a.end()
#define SZ(a) int((a).size())
#define MS(s, n) memset(s, n, sizeof(s))
#define FOR(i,a,b) for (int i = (a); i <= (b); i++)
#define FORE(i,a,b) for (int i = (a); i >= (b); i--)
#define FORALL(it, a) for (__typeof((a).begin()) it = (a).begin(); it != (a).end(); it++)
#define WHATIS(x) cout << #x << " is " << x << endl;
#define ERROR(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
//__builtin_ffs(x) return 1 + index of least significant 1-bit of x
//__builtin_clz(x) return number of leading zeros of x
//__builtin_ctz(x) return number of trailing zeros of x

using namespace std;
using ll = long long;
using ld = double;
typedef pair<int, int> II;
typedef pair<II, ll> III;
typedef complex<ld> cd;
typedef vector<cd> vcd;

void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
    cout << *it << " = " << a << endl;
    err(++it, args...);
}

const ll MODBASE = 1000000007LL;
const int MAXN = 100010;
const int MAXM = 100010;
const int MAXK = 510;
const int MAXQ = 200010;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(nullptr);
  int a, b, c;
  cin >> a >> b >> c;
  a = a * 100 + b * 10 + c;
  if (a % 4 == 0) cout << "YES";
  else cout << "NO";
    return 0;
}

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


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

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

  int cnt = 0;
  int idx = 1;
  vector<int> ansVec;
  for (int i = 0; i < n; i++) {
    if (as[i] == idx) {
      ansVec.push_back(as[i]);
      idx++;
    } else {
      cnt++;
    }
  }

  if (ansVec.size() == 0) {
    cout << -1 << "\n";
    return;
  }
  cout << cnt << "\n";
}

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


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

namespace CPLib
{
    class Atria
    {
        static void Main(string[] args)
        {
            int n = int.Parse(ReadLine());
            int ac = 0;
            int wa = 0;
            int tle = 0;
            int re = 0;
            for (int i = 0; i < n; i++)
            {
                string s = ReadLine();
                if (s == "AC")
                {
                    ac++;
                }
                else if (s == "WA")
                {
                    wa++;
                }
                else if (s == "TLE")
                {
                    tle++;
                }
                else if (s == "RE")
                {
                    re++;
                }
            }
            WriteLine("AC x "+ac);
            WriteLine("WA x "+wa);
            WriteLine("TLE x "+tle);
            WriteLine("RE x "+re);
        }
    }
}


Measured memory_bytes: 30624
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <functional>
#define _USE_MATH_DEFINES
#include <cmath>
#include <climits>
#include <cstdlib>
#include <cstring>
#include <cfloat>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <cassert>
using namespace std;

#define EPS 1e-12
#define ull unsigned long long
#define ll long long
#define VI vector<ll>
#define PII pair<ll, ll> 
#define VVI vector<vector<ll> >
#define REP(i,n) for(int i=0,_n=(n);(i)<(int)_n;++i)
#define RANGE(i,a,b) for(int i=(int)a,_b=(int)(b);(i)<_b;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
#define ALLR(c) (c).rbegin(), (c).rend()
#define PB push_back
#define MP(a, b) make_pair(a, b)
#define POPCOUNT __builtin_popcount
#define POPCOUNTLL __builtin_popcountll
#define CLEAR(table, v) memset(table, v, sizeof(table));
#define PRINT1(table, D0) REP(d0, D0) cout<<table[d0]<<" "; cout<<"\n";
#define PRINT2(table, D0, D1) REP(d0, D0) { REP(d1, D1) cout<<table[d0][d1]<<" "; cout<<"\n"; }
#define PRINT3(table, D0, D1, D2) REP(d0, D0) { REP(d1, D1) { REP(d2, D2) cout<<table[d0][d1][d2]<<" "; cout<<"\n"; } cout<<"\n"; }
#define UNIFORM_DOUBLE(a, b) (((b-a)*(double)rand()/RAND_MAX)+a) // [a, b) 
#define UNIFORM_LL(a, b) (ll)UNIFORM_DOUBLE(a, b) // [a, b) 
#define IN(v, lo, hi) ((lo)<=(v) && (v)<(hi))
#define DD(v) cout<<#v<<": "<<v<<endl
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const map<T0, T1>& v) { for( typename map<T0, T1>::const_iterator p = v.begin(); p!=v.end(); p++ ){os << p->first << ": " << p->second << " ";} return os; }
template <typename T0, typename T1> std::ostream& operator<<(std::ostream& os, const pair<T0, T1>& v) { os << v.first << ": " << v.second << " "; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<T>& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << " "; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const vector<vector<T> >& v) { for( int i = 0; i < (int)v.size(); i++ ) { os << v[i] << endl; } return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const set<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }
template <typename T> std::ostream& operator<<(std::ostream& os, const deque<T>& v) { vector<T> tmp(v.begin(), v.end()); os << tmp; return os; }

#define MOD 1000000007LL
#define INF (1LL<<60)

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll N;
	while(cin>>N) {
		VI H(N);
		REP(i, N) cin>>H[i];
		ll ans = 0;
		while(accumulate(ALL(H), 0LL)) {
			REP(i, N) {
				if(H[i]) {
					ll NZ = N;
					RANGE(j, i, N) {
						if(H[j]==0) {NZ=j;break;}
						else H[j]--;
					}
					ans++;
					i = NZ-1;
				}
			}
		}
		cout<<ans<<endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
N = int(input())

ans = 0
b_ = 0
_a = 0
b_a = 0

for _ in range(N):
    s = input()
    ans += s.count('AB')
    if s[0]=='B' and s[-1]=='A':
        b_a += 1
    elif s[0]=='B':
        b_ += 1
    elif s[-1]=='A':
        _a += 1

if b_a > 0:
    ans += b_a - 1
    if 0 < _a >= b_:
        ans += 1
        _a -= 1
    if 0 < b_ >= _a:
        ans += 1
        b_ -= 1
ans += min(_a, b_)
    


print(ans)


Measured memory_bytes: 3064
#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>

#define PI acos(-1)

using namespace std;

typedef struct Point{
  double x, y;
} P;

int n;

void koch(int cnt, P p1, P p2){
  P s, t, u;

  if(cnt == n) return ;

  s.x = (2 * p1.x + p2.x) / 3;
  s.y = (2 * p1.y + p2.y) / 3;
  t.x = (p1.x + 2 * p2.x) / 3;
  t.y = (p1.y + 2 * p2.y) / 3;
  u.x = (t.x - s.x) * cos(PI / 3) - (t.y - s.y) * sin(PI / 3) + s.x;
  u.y = (t.x - s.x) * sin(PI / 3) + (t.y - s.y) * cos(PI / 3) + s.y;

  koch(cnt + 1, p1, s);
  printf("%.8f %.8f\n", s.x, s.y);
  koch(cnt + 1, s, u);
  printf("%.8f %.8f\n", u.x, u.y);
  koch(cnt + 1, u, t);
  printf("%.8f %.8f\n", t.x, t.y);
  koch(cnt + 1, t, p2);
}

int main(){

  P l, r;

  l.x = 0.0;
  l.y = 0.0;
  r.x = 100.0;
  r.y = 0.0;

  cin >> n;

  printf("%.8f %.8f\n", l.x, l.y);
  koch(0, l, r);
  printf("%.8f %.8f\n", r.x, r.y);

  return 0;
}



Measured memory_bytes: 3188
#include <cstdio>
int N;
int a;
int main()
{
  scanf("%d",&N);
  int cnt = 0;
  bool ans=false;
  for(int i;i<N;i++){
    scanf("%d",&a);
    if(a%2==1){
      ans = true;
      break;
    }
  }
  if(ans)
    printf("first");
  else
    printf("second");
}


Measured memory_bytes: 128
import java.util.Scanner;

public class Main {

  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int coins = Integer.parseInt(sc.nextLine());
    String[] str = sc.nextLine().split(" ");
    double[] d = new double[coins];
    for (int i = 0; i < coins; i++) {
      d[i] = Double.parseDouble(str[i]);
    }
    System.out.println(solve(d, coins));
  }

  private static String solve(double[] d, int coins) {

    double[] dp = new double[coins + 1];
    /**
     * Let f(i, j) be the probability of getting exactly i heads among the first j coins. We have
     * two possibilities for the j-th coin. Case 1 - It is a heads. The probability of getting a
     * head is p[j]. And we need to get exactly (i - 1) heads from the previous (j - 1) coins. This
     * is given by p[j] x f(i - 1, j - 1) Case 2 - It is tails The probability is given by (1 -
     * p[j]) We need i heads from the first j - 1 coins. The probability is (1 - p[j]) x f(i, j - 1)
     * The base case is that f(0, 0) = 1.
     */
    dp[0] = 1;
    for (int i = 0; i < d.length; i++) {
      for (int j = i + 1; j >= 0; j--) {
        dp[j] = (j == 0 ? 0 : dp[j - 1] * d[i]) + dp[j] * (1 - d[i]);
        //        System.out.print(dp[j] + " ");
      }
      //      System.out.println();
    }

    //    for(int i=0;i<coins;i++){
    //      System.out.print(dp[i]+" ");
    //    }
    //    System.out.println();

    double ans = 0;
    for (int heads = 0; heads <= coins; heads++) {
      int tails = coins - heads;
      if (heads > tails) {
        ans += dp[heads];
      }
    }
    return String.format("%.10f", ans);
  }
}


Measured memory_bytes: 25680
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>
#include <utility>
typedef long long ll;
ll MOD = 1e9+7;

using namespace std;

int main()
{
	string s;
	string ans;

	cin>>s;
	for(int i=0;i<s.length();i++)
	{
		if(s[i]=='B')
		{
			if(ans.length()>0)
				ans.pop_back();
		}else{
			ans.push_back(s[i]);
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

#define rep(i, N) for (ll i = 0; i < N; i++)
#define rep1(i, N) for (ll i = 1; i <= N; i++)
#define MOD (int)1e9+7;

using ll = long long;
using namespace std;

int main() {
    int N;
    ll ans = 0;
    cin >> N;
    vector<int> A(N+1);
    A[0] = 0;
    rep1(i, N) 
        cin >> A[i];
    A.push_back(0);

    rep1(i, N+1) {
        ans += abs(A[i] - A[i-1]);
    }
    
    rep1(i, N) {
        int pdif = A[i] - A[i-1];
        int ldif = A[i] - A[i+1];
        if(pdif*ldif <= 0) {
            cout << ans << "\n";
        } else {
            cout << ans - 2*min(abs(pdif), abs(ldif)) << "\n";
        }
    }

    
    return 0;
}


Measured memory_bytes: 1656
a = 1000000007
 
n = int(input())
 
not0 = 1
not0and9 = 1
all = 1
for i in range(n):
  not0and9 = (not0and9 * 8) % a
  not0 = (not0 * 9) % a
  all = (all * 10) % a;
  
print((all + not0and9 - 2 * not0) % a) 

Measured memory_bytes: 9180
#include <iostream>
using namespace std;
int main(void){
    int a, b, c;
    cin >> a >> b >> c;
    int count = 0;
    
    for (int i=1; i<=c; i++){
        if (c % i == 0){
            if(a <= i && i <= b) count++;
        }
    }
    cout << count << endl;
    return 0;
}



Measured memory_bytes: 3116
#include<iostream>
using namespace std;
long long dp[51][51][1251];
int main(){
	int N,K;
	cin>>N>>K;
	if(K&1){
		cout<<0<<endl;
		return 0;
	}
	dp[0][0][0]=1;
	for(int i=1;i<=N;i++)
		for(int j=0;j<=i;j++)
			for(int k=j;k<=K/2;k++)
				dp[i][j][k]=((2*j+1)*dp[i-1][j][k-j]+
							(j+1)*(j+1)*dp[i-1][j+1][k-j]+
							((j>0)?dp[i-1][j-1][k-j]:0))%1000000007;
	cout<<dp[N][0][K/2]<<std::endl;
	return 0;
}

Measured memory_bytes: 23808
#include<algorithm>
#include<iostream>
#include<functional>
#include<cmath>
#include<iomanip>
using namespace std;
int main(){
  string x;
  char y;
  int ns=0,ew=0,n=0,e=0,w=0,s=0;
  cin>>x;
  for(int i=0;i<x.size();i++){
    y=x[i];
    if(y=='N')
      n++;
    else if(y=='E')
      e++;
    else if(y=='S')
      s++;
    else
      w++;
  }
  if(n!=0 and s!=0){
    ns++;
  }
  if(e!=0 and w!=0){
    ew++;
  }
  if(ns==1 and ew==1)
    cout<<"Yes"<<endl;
  else if(ns==0 and ew==0)
    cout<<"No"<<endl;
  else if(ns==1 and e==0 and w==0)
    cout<<"Yes"<<endl;
  else if(ew==1 and n==0 and s==0)
    cout<<"Yes"<<endl;
  else 
    cout<<"No"<<endl;
}

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

typedef priority_queue<int> maxHeap;
typedef priority_queue<int, vector<int>, greater<int>> minHeap;
#define endl "\n"
#define int long long
#define MOD 1000000007
#define PI 3.1415926535897932384626433832795
#define max(x, y) ((x > y) ? x : y)
#define min(x, y) ((x < y) ? x : y)
#define mid(s, e) ((s + (e - s) / 2))

bool test_cases;

void init(bool k) {
    test_cases = k;
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
}

struct precompute {
    void compute() {
    }
};

struct test_cases {
    void test_case() {
        int n;
        cin >> n;
        int dp[n + 1];
        int a[n];
        for (int i = 0; i < n; i++) cin >> a[i];

        dp[0] = 0;
        dp[1] = 0;
        for (int i = 2; i <= n; i++) {
            dp[i] = min(dp[i - 1] + abs(a[i - 1] - a[i - 1 - 1]), dp[i - 2] + abs(a[i - 1] - a[i - 2 - 1]));
        }

        cout << dp[n] << endl;
    }
};

int32_t main() {
    init(false);
    int tc;
    if (test_cases) {
        cin >> tc;
    } else {
        tc = 1;
    }
    struct precompute l;
    l.compute();
    for (int i = 0; i < tc; i++) {
        struct test_cases o;
        o.test_case();
    }
    return 0;
};

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

using ll = long long;
using P = pair<int, int>;

const int INF = 1e9;
const int MOD = 1e9 + 7;

// 4近傍、8近傍
int dx[] = {1, 0, -1, 0, 1, -1, -1, 1};
int dy[] = {0, 1, 0, -1, 1, 1, -1, -1};

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

  int a[N];
  for (int i = 0; i < N; i++) {
    a[i] = L + i;
  }

  int diff[N];
  int idx;
  for (int i = 0; i < N; i++) {
    diff[i] = max(a[i], -a[i]);
    if (i == 0) idx = 0;
    else {
      if (abs(diff[idx]) > abs(diff[i])) {
        idx = i;
      }
    }
  }

  int ans = 0;
  for (int i = 0; i < N; i++) {
    if (i == idx) continue;
    ans += a[i];
  }

  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import java.util.Scanner;

public class Main{
	public static String operation(String data){
		StringBuilder sb = new StringBuilder();
		for(int i = 0; i < data.length(); i++){
			int counter = 1;
			while( data.charAt(i) == data.charAt(i+1) ){
				counter++;
				i++;
				if( i == data.length()-1 ){
					break;
				}
			}
			sb.append(String.valueOf(counter));
			sb.append(data.charAt(i));
			if( i == data.length()-2 ){
				sb.append("1");
				sb.append(data.charAt(i+1));
				break;
			}
		}
		return sb.toString();
	}
			
	public static void main(String[] args){
		Scanner stdIn = new Scanner(System.in);
		int n = stdIn.nextInt();
		int index = 0;
		String[] ans = new String[1000];
		
		while( n != 0 ){
			ans[index] = new String();
			ans[index] = stdIn.next();
			while( n-- > 0 ){
				String temp = new String(ans[index]);
				ans[index] = operation(temp);
			}
			index++;
			n = stdIn.nextInt();
		}
		
		for(int i = 0; i < index; i++){
			System.out.println(ans[i]);
		}
	}
}

Measured memory_bytes: 12000
#include <stdio.h>

int main(int argc, char** argv){
	return printf("%d\n", (scanf("%d %d %d %d\n%d %d %d %d", &((int*)argv)[0], &((int*)argv)[1], &((int*)argv)[2], &((int*)argv)[3], &((int*)argv)[4], &((int*)argv)[5], &((int*)argv)[6], &((int*)argv)[7]) == 8) ? (((((int*)argv)[0] += ((int*)argv)[1] + ((int*)argv)[2] + ((int*)argv)[3]) > (((int*)argv)[4] += ((int*)argv)[5] + ((int*)argv)[6] + ((int*)argv)[7])) ? ((int*)argv)[0] : ((int*)argv)[4]) : 1) == 0;
}

Measured memory_bytes: 592
#include <iostream>
#include <algorithm>

using namespace std;

int main() {
  long long q, h, s, d, n;
  cin >> q >> h >> s >> d >> n;
  long long tq = q * 8, th = h * 4, ts = s * 2, td = d;
  auto best_t = min({tq, th, ts, td});
  auto best_o = min({tq, th, ts}) / 2;
  long long nt = n / 2, rem = n % 2;
  cout << (nt * best_t) + (rem * best_o) << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double db;
#define go(u) for(int i = head[u], v = e[i].to; i; i=e[i].lst, v=e[i].to)
#define rep(i, a, b) for(int i = a; i <= b; ++i)
#define pb push_back
#define re(x) memset(x, 0, sizeof x)
inline int gi() {
    int x = 0,f = 1;
    char ch = getchar();
    while(!isdigit(ch)) { if(ch == '-') f = -1; ch = getchar();}
    while(isdigit(ch)) { x = (x << 3) + (x << 1) + ch - 48; ch = getchar();}
    return x * f;
}
template <typename T> inline bool Max(T &a, T b){return a < b ? a = b, 1 : 0;}
template <typename T> inline bool Min(T &a, T b){return a > b ? a = b, 1 : 0;}
const int N = 1e5 + 7;
int n;
int V[N], a[N];
int main() {
#ifndef ONLINE_JUDGE
#endif
	n = gi();
	rep(i, 1, n) a[i] = V[i] = gi();
	sort(V + 1, V + 1 + n);
	rep(i, 1, n) a[i] = lower_bound(V + 1, V + 1 + n, a[i]) - V;
	int ans = 0;
	rep(i, 1, n) if(abs(a[i] - i) & 1) ++ans;
	printf("%d\n", ans / 2);
	return 0;
}

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

typedef long long ll;

int n;
ll a[55];

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

    ll ans = 0LL;
    for (int i=0; i<n; i++) {
        for (int j=i+1; j<n; j++) {
            ans += a[i] * a[j];
        }
    }

    cout << ans;

    return 0;
}


Measured memory_bytes: 256
N = int(input())

def factorize(n):
    result = []
    tmp = n

    for i in range(2, int(n**0.5)+1):
        if tmp % i == 0:
            cnt = 0
            while tmp % i == 0:
                cnt += 1
                tmp //= i
            result.append(cnt)
         
    if tmp != 1:
        result.append(1)
    
    if len(result) == 0:
        result.append(1)
    
    return result

def nearest_sum(n):
    num_list = [1]
    
    if n <= 2:
        return 1

    i = 2
    while True:
        num_list.append(num_list[-1]+i)
        i += 1
        if num_list[-1]+i > n:
            break
    
    return i-1

if N == 1:
    print(0)
else:
    ind_list = factorize(N)

    cnt = 0
    for ind in ind_list:
        cnt += nearest_sum(ind)

    print(cnt)

Measured memory_bytes: 9464
#include <iostream>
using namespace std;
int main(void)
{
	int n,i,j,tmp,a[100];
	double all;
	cin>>n;//数値の総数を入力
	for(i=0;i<n;i++) cin>>a[i];//配列に格納する数値を入力
	for(i=0;i<n;i++){//数値を昇順ソート
		for(j=i+1;j<n;j++){
			if(a[i]>a[j]){
				tmp=a[i];
				a[i]=a[j];
				a[j]=tmp;
			}
		}
	}
	all=(a[0]+a[1])/2.0;
	if(n==2) cout<<all<<endl;
	else{
		for(i=2;i<n;i++) all=(all+a[i])/2.0;
		cout<<all<<endl;
	}
	//for(i=0;i<a[i];i++) cout<<a[i]<<endl;//昇順ソートした数値を出力
	return 0;
}

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

map<int , int> m;
int n;
int dig[1234];

int main()
{
    cin >> n;
    for(int i = 0; i < n; i++)
    {
        cin >> dig[i];
    }
    for(int i = 0; i < n; i++)
    {
        m[dig[i]] = 1;
    }
    for(int i = n - 1; i > 0; i--)
    {
        int res = 0;
        res = 10*dig[i-1] + dig[i];
        m[res] = 1;
    }
    for(int i = n - 1; i > 1; i--)
    {
        int res = 0;
        res = 100*dig[i-2] + 10*dig[i-1] + dig[i];
        m[res] = 1;
    }
    for(int i = n - 1; i > 2; i--)
    {
        int res = 0;
        res = 1000*dig[i-3] + 100*dig[i-2] + 10*dig[i-1] + dig[i];
        m[res] = 1;
    }
    for(int i=0;i<=10000;i++)
    {
        if(!m[i])
        {
            printf("%d\n", i);
            break;
        }
    }
    return 0;
}

Measured memory_bytes: 1256
n, k = map(int, input().split())
a = list(map(int, input().split()))
m = max(a)

def gcd(x, y):
    # x <= y
    x, y = sorted([x, y])
    while x != 0:
        x, y = y%x, x
    return 1 if y == 0 else y
g = a[0]
for i in range(n):
    g = gcd(g, a[i])
if k <= m and k%g == 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Measured memory_bytes: 14252
#define _USE_MATH_DEFINES
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
#include <iomanip>	
#include <deque>
#include <set>
#define rep(i,a,b) for(int i=a;i<b;++i)
#define rrep(i,a,b) for(int i=a;i>=b;--i)
#define fore(i,a) for(auto &i:a)
#define INF INT_MAX/2;
typedef long long ll;
using namespace std;
using vi = vector<int>;
using vll = vector<ll>;
ll mod = 1e9 + 7;
//ll llmax = 10000000000000000000ll;
using namespace std;
using Graph = vector<vector<int>>;


int cnt_digit(ll N)
{
	int digit = 0;

	while (N > 0)
	{
		N /= 10;
		digit++;
	}
	return digit;
}


 // 最大公約数計算
 
ll gcd(ll a, ll b)
{
	if (b == 0) {
		return a;
	}
	else {
		return gcd(b, a % b);
	}
}
// 最小公倍数の計算

ll lcm(ll a, ll b)
{
	ll g = gcd(a, b);

	return a / g * b;
}

struct union_find
{
	vector<int> par, r;
	union_find(int n)
	{
		par.resize(n);
		r.resize(n);
		init(n);
	}


	void init(int n)
	{
		for (int i = 0; i < n; i++) par[i] = i;
		for (int i = 0; i < n; i++) r[i] = 0;
	}

	int find(int x)
	{
		if (par[x] == x)return x;
		else return find(par[x]);
	}

	void unite(int x, int y)
	{
		x = find(x);
		y = find(y);

		if (r[x] < r[y])
		{
			par[x] = y;
		}
		else
		{
			par[y] = x;
			if (r[x] == r[y])
			{
				r[x]++;
			}
		}
	}
};



int main()
{
	cin.tie(0);
	ios::sync_with_stdio(false);
	int a,b,c,d;
	cin >> a >> b >> c >> d;

	if (abs(c - a) <= d) {
		cout << "Yes" << endl;
		return 0;
	}
	else if (abs(b - a) <= d && abs(c - b) <= d) {
		cout << "Yes" << endl;
		return 0;

	}
	else {
		cout << "No" << endl;
	}
	
	return 0;
	
}
	

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

int main(void)
{
  int i, crdnum, pleft = 0, pright = 0;
  string cleft, cright;
  cin >> crdnum;
  for (i = 0; i < crdnum; i++) {
    cin >> cleft >> cright;
    if (cleft > cright) pleft += 3;
    else if (cleft < cright) pright += 3;
    else {
      pleft += 1;
      pright += 1;
    }
  }
  cout << pleft << " " << pright << endl;
  return 0;
}

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

int main()
{
    int N; cin >> N;
    int boss[N+1] = {0};

    int input;
    for (int i = 1; i < N; i++) {
        cin >> input;
        boss[input] = boss[input] + 1;
    }

    for (int i = 1; i <= N; i++) {
        cout << boss[i] << endl;
    }
}

Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(ll i=(a); i<(b); i++)
const ll maxn=10;
ll n,m,k,s[maxn];
string a[maxn];
int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    cin>>n>>m>>k;
    rep(i,0,n) cin>>a[i];
    ll ans=n*m+1;
    rep(i,0,(1<<(n-1))) {
        vector<ll> hcut;
        rep(j,0,n-1) if(i&(1<<j)) hcut.push_back(j);
        ll ncuts=hcut.size(),sol=1;
        hcut.push_back(n-1);
        rep(j,0,hcut.size()) s[j]=0;
        rep(j,0,m) {
            ll p=0,addable=1;
            rep(h,0,n) {
                s[p]+=a[h][j]-'0';
                if(s[p]>k) addable=false;
                if(h==hcut[p]) p++;
            }
            if(!addable) {
                p=0;
                ncuts++;
                rep(h,0,hcut.size()) s[h]=0;
                rep(h,0,n) {
                    s[p]+=a[h][j]-'0';
                    if(s[p]>k) sol=false;
                    if(h==hcut[p]) p++;
                }
            }
        }
        if(sol) ans=min(ans,ncuts);
    }
    cout<<ans<<"\n";
}


Measured memory_bytes: 256
S = input()
yymm_flag = False
mmyy_flag = False
if 1 <= int(S[0:2]) <= 12:
    mmyy_flag = True
if 1 <= int(S[2:4]) <= 12:
    yymm_flag = True
if (mmyy_flag == True) and (yymm_flag == True):
    print('AMBIGUOUS')
elif (mmyy_flag == True) and (yymm_flag == False):
    print('MMYY')
elif (mmyy_flag == False) and (yymm_flag == True):
    print('YYMM')
elif (mmyy_flag == False) and (yymm_flag == False):
    print('NA')


Measured memory_bytes: 3060
class UnionFind
  require 'set'
  def initialize(size)
    # 各ノードのランク(下にどれだけの深さでノードがぶら下がってるか)
    @rank = Array.new(size, 0)
    @parent = Array.new(size) { |id| id }
  end

  def unite(id_x, id_y)
    x_parent = get_parent(id_x)
    y_parent = get_parent(id_y)
    return if x_parent == y_parent

    if @rank[x_parent] > @rank[y_parent]
      @parent[y_parent] = x_parent
    else
      @parent[x_parent] = y_parent
      @rank[y_parent] += 1 if @rank[x_parent] == @rank[y_parent]
    end
  end

  def get_parent(id_x)
    @parent[id_x] == id_x ? id_x : (@parent[id_x] = get_parent(@parent[id_x]))
  end

  def same?(id_x, id_y)
    get_parent(id_x) == get_parent(id_y)
  end

  def size
    Set.new(@parent.map { |id_x| get_parent(id_x) }).size
  end
end

nn, mm = gets.chomp.split.map(&:to_i)

q = []
1.step(mm, 1) do |_i|
  q.push(gets.chomp.split.map { |g| g.to_i - 1 })
end

ans = 0
0.step(mm - 1, 1) do |i|
  union = UnionFind.new nn
  0.step(mm - 1, 1) do |j|
    next if i == j

    union.unite(*q[j])
  end
  ans += 1 unless union.size == 1
end

p ans


Measured memory_bytes: 2044
#include <stdio.h>

int combination(int d[],int s,int N);
int main(){
  int N,i,ct=0;

  scanf("%d",&N);
  int d[N];
  for(i=0;i<N;i++)scanf("%d",&d[i]);
  for(i=0;i<N;i++){
    ct+=combination(d,i,N);
  }

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

int combination(int d[],int s,int N){
  int ct=0;
  for(int i=s+1;i<N;i++)ct+=d[s]*d[i];
  return ct;
}


Measured memory_bytes: 128
#include <stdio.h>

int main(void) {
	// your code goes here
	int h,w,i,j;
	scanf("%d %d",&h,&w);
	while(h!=0&&w!=0){
		for(i=0;i<h;i++){
			for(j=0;j<w;j++){
				if(0==(i+j)%2){
					printf("#");
				}else{
					printf(".");
				}
			}
			printf("\n");
		}
		printf("\n");
		scanf("%d %d",&h,&w);
	}
	return 0;
}



Measured memory_bytes: 2060
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;

void main() {
    auto s = readln.split.map!(to!int);
    auto H = s[0];
    auto W = s[1];
    auto K = s[2];
    auto A = iota(H).map!(_ => readln.chomp).array;

    int ans = 1 << 29;
    auto cnt = new int[](H);
    auto cnt2 = new int[](H);

    outer: foreach (mask; 0..1<<(H-1)) {
        int tmp = mask.popcnt;
        cnt[] = 0;
        cnt2[] = 0;
        foreach (j; 0..W) {
            int p = 0;
            bool flag = false;
            foreach (i; 0..H) {
                cnt2[p] += A[i][j] == '1';
                if (cnt2[p] > K) continue outer;
                if (cnt[p] + cnt2[p] > K) flag = true;
                if (mask & (1 << i)) p += 1;
            }
            if (flag) {
                tmp += 1;
                foreach (i; 0..cnt.length) {
                    cnt[i] = cnt2[i];
                }
            } else {
                foreach (i; 0..cnt.length) {
                    cnt[i] += cnt2[i];
                }
            }
            cnt2[] = 0;
        }
        ans = min(ans, tmp);
    }

    ans.writeln;
}

Measured memory_bytes: 256
program A322B
    implicit none
    integer(8)::N,i,ocount,zcount
    character(1000000)::S
    read*,S
    ocount=0
    zcount=0
    N=len_trim(S)

    do i=1,N
        if(S(i:i)=="0")ocount=ocount+1
        if(S(i:i)=="1")zcount=zcount+1
    end do

    print'(i0)',2*min(ocount,zcount)
end program A322B

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

int main(){
  int a,b;
  cin >> a >> b;
  if(a>=b){
    int t = a;
    a = b;
    b = t;
  }
  for(int i=0;i<b-1;i++){
  	a *= 10;
  	a += ((a/10)%10);
  }
  cout << a << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <set>
#define REP(i,n) for(int i=0;i<(n);++i)
using namespace std;
using ll = long long;
constexpr int INF = 1e9;
constexpr int MOD = 1e9 + 7;
template<class T> inline void chmax(T &a,T b){if(a<b)a=b;}
template<class T> inline void chmin(T &a,T b){if(a>b)a=b;}

int main(){
    cin.tie(0); ios_base::sync_with_stdio(false);
    int a,b,c,d;cin>>a>>b>>c>>d;
    cout << min(a,b)+min(c,d) << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define upperlimit 1000100
#define INF 1000000100
#define INFL 1000000000000000100LL
#define eps 1e-8
#define endl '\n'
#define sd(n) scanf("%d",&n)
#define slld(n) scanf("%lld",&n)
#define pd(n) printf("%d",n)
#define plld(n) printf("%lld",n)
#define pds(n) printf("%d ",n)
#define pllds(n) printf("%lld ",n)
#define pdn(n) printf("%d\n",n)
#define plldn(n) printf("%lld\n",n)
#define REP(i,a,b) for(i=a;i<=b;i++)
#define mp make_pair
#define pb push_back
#define pcc pair<char,char>
#define pii pair<int,int>
#define pll pair<ll,ll>
#define vi vector<int>
#define vl vector<ll>
#define vii vector<pii>
#define vll vector<pll>
#define tr(container,it) for(typeof(container.begin()) it=container.begin();it!=container.end();it++)
#define F first
#define S second
#define clr(a) memset(a,0,sizeof(a))
#define FILEIO(name) \
    freopen(name".in", "r", stdin); \
    freopen(name".out", "w", stdout);

using namespace std;

ll gcd(ll n1,ll n2){
    if(!n1)return n2;
    if(!n2)return n1;
    if(n1%n2==0)return n2;
    return gcd(n2,n1%n2);
}
ll powmod(ll base,ll exponent){
    base%=mod;
    ll ans=1;
    while(exponent){
        if(exponent&1)ans=(ans*base)%mod;
        base=(base*base)%mod;
        exponent/=2;
    }
    ans%=mod;
    return ans;
}
int main()
{
	int d,n,m;
	sd(n);sd(m);sd(d);
	double answer=(n-d)/(1.0*n*n);
	if(d)answer*=2;
	answer*=(m-1);
	printf("%.10f\n",answer);
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include <list>
#include<stack>
#include<queue>
#include <vector>
#include <set>
#include<algorithm>
#include<math.h>
#include<stdlib.h>
#include<string>
#include <functional>
#include<fstream>

#define FOR(k,m,n) for(int (k)=(m);(k)<(n);(k)++)
#define REP(i,n) FOR((i),0,(n))
#define LL long long
#define CLR(a) memset((a),0,sizeof(a))
#define SZ(x) (int((x).size()))
#define WAITING(str) int str;std::cin>>str;
#define DEBUGING(str) cout<<str<<endl
using namespace std;

const LL MOD = 1000000007;// 10^9+7
const int INF = (1 << 30);


//変数
LL p, q;




//素因数分解
//in: number
//out: prime numbers
template<typename T>
vector<T> prime_factorization(T n)
{
	vector<T> res;
	T check = 2;

	while (check*check <= n) {
		if (n%check == 0) {
			n /= check;
			res.push_back(check);
		}
		else {
			check++;
		}
	}
	if (n != 1) res.push_back(n);
	sort(res.begin(), res.end());
	return res;
}


//最大公約数
//(ユークリッドの互除法)
//in: a,b
//out:  GCD(a,b)
template<typename T>
T GCD(T a, T b)
{
	if (a < b)swap(a, b);
	int r = a % b;
	while (r != 0) {
		a = b;
		b = r;
		r = a % b;
	}
	return b;
}




//サブ関数
//入力
void input()
{
	cin >> p >> q;
}

//計算
void calc()
{
	LL gcd = GCD(p, q);
	q /= gcd;
	auto primes = prime_factorization(q);

	set<LL> primeKind;
	for (auto prime : primes)primeKind.insert(prime);

	LL res = 1;
	for (auto prime : primeKind)res *= prime;

	cout << res << endl;
}


//出力
void output()
{

}


//デバッグ
void debug()
{
	int N;
	cin>>N;
}


//メイン関数
int main()
{
	input();
	calc();
	output();
	debug();
	
	return 0;
}



Measured memory_bytes: 3152
# coding: utf-8

import sys
import math

import array
import bisect
import collections
from collections import Counter, defaultdict
import fractions
import heapq
import re

sys.setrecursionlimit(1000000)


def array2d(dim1, dim2, init=None):
    return [[init for _ in range(dim2)] for _ in range(dim1)]

def argsort(l, reverse=False):
    return sorted(range(len(l)), key=lambda i: l[i], reverse=reverse)

def argmin(l):
    return l.index(min(l))

def YESNO(ans, yes="YES", no="NO"):
    print([no, yes][ans])

II = lambda: int(input())
MI = lambda: map(int, input().split())
MIL = lambda: list(MI())
MIS = lambda: input().split()


def main():
    n, k = MI()
    s = ""
    for n, c in enumerate(input()):
        s += c.lower() if n == k-1 else c
    return s


if __name__ == "__main__":
    print(main())


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

using namespace std;

using ll = long long int;
using vi = vector<int>;
#define f(n) for(int i = 0; i < n; i++)
#define fj(n) for(int j = 0; j < n; j++)
#define fk(n) for(int k = 0; k < n; k++)
#define ci(n) cin >> n;
#define ic(n) int n; cin >> n;
#define lc(n) int n; cin >> n;
#define all(a) a.begin(), a.end()
#define pri(a, n) for(int i = 0; i < n; i++) cout << a[i] << " "; cout << "\n";
#define sc(a, n) int a[n] = {0}; for(int i = 0; i < n; i++) cin >> a[i];
#define scl(a, n) ll a[n] = {0}; for(int i = 0; i < n; i++) cin >> a[i];
#define pb push_back
#define eb emplace_back
#define int long long
const int inf = 2e18, maxn = 200000;

void solve(int ci)
{
    ic(n)
    cout << ((n + 999) / 1000) * 1000 -  n;
}


main()
{
    //cout << atan2(0, -1);
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int t = 1;
    //cin >> t;
    f(t) solve(i + 1);
}


Measured memory_bytes: 3640
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <regex>
#include <numeric>

using namespace std;


/*--- Macro ---*/
#define rep(i, n) for(int i=0; i<(int)n; i++)
#define rep1(i, n) for(int i=1; i<(int)n; i++)
#define mp make_pair
#define pb push_back


/*---  Type ---*/
typedef long long ll;


/*--- Constants ---*/
template <typename T> const T INF = numeric_limits<T>::max() / 10;
const int MOD = (int)1e9 + 7;


// Floating
const double EPS = 1e-11;
#define EQ0(x) (abs(x) < EPS)
#define EQ(x, y) (abs(a-b) < EPS)

// -------------------------------------------------------------------------------------

int main() {
  char a, b;
  cin >> a >> b;
  if((a == 'H' && b == 'H') || (a == 'D' && b == 'D')) cout << "H" << endl;
  else cout << "D" << endl;
  return 0;
}

Measured memory_bytes: 256