akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long cc;

cc N, K, Ans, i, j, k, a[200000], sub = 0;
cc judge[200000][35], kai[35], A = 0;

string S;


int main() {
	
	cin >> N >> K;
	K = K * 2 + 1;
	if (N%K == 0)
		Ans = N / K;
	else
		Ans=N / K + 1;
	cout << Ans << endl;
	return 0;
}

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

using ll = long long;
using ull = unsigned long long;
using st = string;
using ch = char;
using db = double;
using bl = bool;
using vll = vector<long long>;
using vdb = vector<db>;
using vvll = vector<vll>;
using vst = vector<st>;
using vch = vector<char>;
using pll = pair<ll, ll>;
using vpll = vector<pll>;
using vvpll = vector<vpll>;
#define rep(i, m, n) for (ll i = (ll)(m); i < (ll)(n); i++)
#define vrep(i, vec) for(auto& i : vec)
#define vin(vec) for(auto& i : vec) cin >> i
#define all(v) v.begin(), v.end()
template<class T> inline bool chmin(T& a, T b){if(a > b){a = b;return true;} return false;}
template<class T> inline bool chmax(T& a, T b){if(a < b){a = b;return true;} return false;}
const ll mod = 1000000007;
const ll inf = 1LL << 60;

ll modpow(ll a, ll n){
  ll ans = 1;
  while(n > 0){
    if(n & 1) ans = ans * a % mod;
    n >>= 1;
    a = a * a % mod;
  }
  return ans;
}

int main(){
  ll n;
  cin >> n;
  vdb x(n), y(n);
  rep(i, 0, n) cin >> x.at(i) >> y.at(i);
  vll v(n);
  iota(all(v), 0);
  db ans = 0;
  do{
    rep(i, 0, n - 1){
      ans += sqrt(modpow(x.at(v.at(i + 1)) - x.at(v.at(i)), 2) + modpow(y.at(v.at(i + 1)) - y.at(v.at(i)), 2));
    }
  }while(next_permutation(all(v)));


  rep(i, 1, n + 1) ans /= i;
  cout << fixed << setprecision(7);
  cout << ans << endl;
}

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

void scan(T...)(ref T args) {
    import std.stdio : readln;
    import std.algorithm : splitter;
    import std.conv : to;
    import std.range.primitives;

    auto line = readln().splitter();
    foreach (ref arg; args) {
        arg = line.front.to!(typeof(arg));
        line.popFront();
    }
    assert(line.empty);
}

void fillAll(R, T)(ref R arr, T value) {
    static if (is(typeof(arr[] = value))) {
        arr[] = value;
    }
    else {
        foreach (ref e; arr) {
            fillAll(e, value);
        }
    }
}

bool chmin(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x > arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}

bool chmax(T, U...)(ref T x, U args) {
    bool isChanged;

    foreach (arg; args) {
        if (x < arg) {
            x = arg;
            isChanged = true;
        }
    }

    return isChanged;
}



enum inf = 1_001_001_001;
enum infl = 1_001_001_001_001_001_001L;


void main() {
    int N, M;
    scan(N, M);
    auto e = new bool[][](N, N);
    foreach (i ; 0 .. M) {
        int ai, bi;
        scan(ai, bi);
        ai--, bi--;
        e[ai][bi] = e[bi][ai] = true;
    }
    auto p = iota(N).array;
    int ans;
    do {
        ans += f(N, p, e);
    } while (nextPermutation(p));

    writeln(ans);
}

int f(int N, int[] p, bool[][] e) {
    if (p.front != 0) {
        return false;
    }
    foreach (i ; 0 .. N - 1) {
        if (!e[p[i]][p[i + 1]]) {
            return false;
        }
    }
    return true;
}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cmath>
#include <vector>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <functional>

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

using namespace std;


int main(void) {
    string str;
    cin >> str;
    int n=str.length();
    REP(i,n){
        cout << str[n-i-1];
    }
    cout << endl;
    
    
    return 0;
}

Measured memory_bytes: 1172
x1,y1,x2,y2 = map(int,input().split())
x = abs(x2-x1)
y = abs(y2-y1)
if x1>x2:
    if y1>=y2:
        print(x2+y,y2-x,x1+y,y1-x)
    elif y1<y2:
        print(x2-y,y2-x,x1-y,y1-x)
elif x1==x2:
    if y1>y2:
        print(x2+y,y2+x,x1+y,y1+x)
    elif y1<y2:
        print(x2-y,y2-x,x1-y,y1-x)
elif x1<x2:
    if y1>=y2:
        print(x2+y,y2+x,x1+y,y1+x)
    elif y1<y2:
        print(x2-y,y2+x,x1-y,y1+x)

Measured memory_bytes: 3064
N, M = map(int, input().split())

MOD = 1000000007

p = [0]*(N+1)
for i in range(M):
    a = int(input())
    p[a] = -1

p[N] = 1
if p[N-1] != -1:
    p[N-1] = 1

for i in range(N-2, -1, -1):
    if p[i] == -1:
        continue
    if p[i+1] == -1 and p[i+2] == -1:
        p[i] = -1
    elif p[i+1] == -1:
        p[i] = p[i+2]
    elif p[i+2] == -1:
        p[i] = p[i+1]
    else:
        p[i] = p[i+1] + p[i+2]

    if p[i] > 0:
        p[i] %= MOD

ans = p[0]
if ans < 0:
    ans = 0

print(ans)



Measured memory_bytes: 45016
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
typedef long long int lli;
#define tc int t;cin>>t;while(t--)
#define f first
#define s second
#define pb push_back
#define vi vector<int>
#define vll vector<lli>


int main() {
   lli x,y,a,b,c,in;
   cin>>x>>y>>a>>b>>c;
   int cnt[3]={0};
   vector< pair<lli,lli> > vt;
   for(int i=0;i<a;i++)
   {
       cin>>in;
       vt.pb({in,0});
   }
   for(int i=0;i<b;i++)
   {
       cin>>in;
       vt.pb({in,1});
   }
   for(int i=0;i<c;i++)
   {
       cin>>in;
       vt.pb({in,2});
   }
   sort(vt.begin() ,vt.end(),greater<pair<int,int> > ());
   lli ans=0;
   for(int i=0;i<x+y;i++)
    {cnt[vt[i].s]++;
    ans+=vt[i].f;}
   if(cnt[0]<=x and cnt[1]<=y)
   {

   }
   else if(cnt[0]>x)
   {
       ans=0;
       cnt[0]=cnt[1]=cnt[2]=0;
       for(int i=0;i<a+b+c;i++)
       {
           if(vt[i].s==0 and cnt[0]<x)
           {
               cnt[0]++;
               ans+=vt[i].f;
           }
           else if(vt[i].s==1 and cnt[1]<y)
           {
               cnt[1]++;
               ans+=vt[i].f;
           }
           else if(vt[i].s==2 and cnt[1]<y)
           {
               cnt[1]++;
               ans+=vt[i].f;
           }
           if(cnt[0]==x and cnt[1]==y)
            break;
       }
   }
   else
   {
       ans=0;
       cnt[0]=cnt[1]=cnt[2]=0;
       for(int i=0;i<a+b+c;i++)
       {
           if(vt[i].s==1 and cnt[1]<y)
           {
               cnt[1]++;
               ans+=vt[i].f;
           }
           else if(vt[i].s==0 and cnt[0]<x)
           {
               cnt[0]++;
               ans+=vt[i].f;
           }
           else if(vt[i].s==2 and cnt[0]<x)
           {
               cnt[0]++;
               ans+=vt[i].f;
           }
           if(cnt[0]==x and cnt[1]==y)
            break;
       }
   }
   cout<<ans<<"\n";
   return 0;
}


Measured memory_bytes: 10476
//file_name:ABC47_A.cpp
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;

    // int scan
    /*
    int x;
    scanf("%d",&x);
    int y;
    scanf("%d",&y);
    int z;
    scanf("%d",&z);

    // matrix scan
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // string scan
    /*
    string s;
    cin >> s;
    */


int main() {
    ll a[3] = {};
    rep(i,3){
        scanf("%lld",&a[i]);
    }

    sort(a,a+3);

    if(a[2]==a[1]+a[0])yn;



    return 0;
}



Measured memory_bytes: 256
musics = []
times = []

n = int(input())

for i in range(n):
    s, t = input().split()
    musics.append(str(s))
    times.append(int(t))

x = str(input())

sleep = musics.index(x)

ans = sum(times) - sum(times[0:sleep+1])
print(ans)

Measured memory_bytes: 3064
import sys
sys.setrecursionlimit(10 ** 5)


def main():
    def DFS(v):
        if DP[v] == -1:
            res = 0
            for i in G[v]:
                res = max(res, DFS(i) + 1)

            DP[v] = res

        return DP[v]


    N, M = map(int, input().split())
    xy = [list(map(int, input().split())) for _ in range(M)]

    G = [[] for _ in range(N)]
    for x, y in xy:
        G[x - 1].append(y - 1)

    DP = [-1] * N
    for v in range(N):
        DFS(v)

    print(max(DP))


if __name__ == '__main__':
    main()

exit()


Measured memory_bytes: 92580
n=int(input())
p=list(map(int, input().split()))
c= 0
for i in range(1, n-1):
  if (p[i-1] < p[i] and p[i] < p[i+1]) or (p[i-1] > p[i] and p[i] > p[i+1]):
    c+=1
print(c)

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

using namespace std;

#define INF 2000000000
#define MOD 1000000007
typedef long long ll;
typedef pair<int, int> P;


int main()
{
	string o;
	string e;
	cin >> o >> e;
	int i = 0;
	int j = 0;
	string ret = "";
	int num = 1;
	while (true) {
		if (i>=o.size()&&j>=e.size()) {
			break;
		}
		if (num%2!=0) {
			ret += o[i];
			i++;
			num++;
		} else {
			ret += e[j];
			j++;
			num++;
		}
	}
	cout << ret << endl;

}


Measured memory_bytes: 256
#pragma region Macros
#include <bits/stdc++.h>
#define SORT(x) sort((x).begin(), (x).end())
#define RSORT(x) sort((x).rbegin(), (x).rend())
#define ALL(x) (x).begin(), (x).end()
#define REV(x) reverse(ALL(x))
#define rep(i, n) for (ll i = 0; i < n; i++)
#define reps(i, m, n) for (ll i = m; i < n; i++)
#define repr(i, m, n) for (ll i = m; i >= n; i--)
#define SP << " " <<
#define INF2 1000000000000000037
#define INF  1000000007
#define lwb(x,n) distance(x.begin(),lower_bound(ALL(x),(n)))
#define upb(x,n) distance(x.begin(),upper_bound(ALL(x),(n)))
#define fora(i, ...) if(ll i = -1) for(__VA_ARGS__) if(i++, true)
#ifdef _MY_DEBUG
#define CHOOSE(a) CHOOSE2 a
#define CHOOSE2(a0,a1,a2,a3,x,...) x
#define debug_1(x1) cout<<#x1<<": "<<x1<<endl
#define debug_2(x1,x2) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<endl
#define debug_3(x1,x2,x3) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<endl
#define debug_4(x1,x2,x3,x4) cout<<#x1<<": "<<x1<<", "#x2<<": "<<x2<<", "#x3<<": "<<x3<<", "#x4<<": "<<x4<<endl
#define de(...) CHOOSE((__VA_ARGS__,debug_4,debug_3,debug_2,debug_1,~))(__VA_ARGS__)
#else
#define de(...)
#endif
using namespace std;
using ll = long long;
using ld = long double;
template<class T = ll> using v = vector<T>;
template<class T = ll> using vv = vector<vector<T>>;
template<class T = ll> using vvv = vector<vector<vector<T>>>;
template<class T> bool maxi(T &a, const T &b){ if(a<b){a=b;return 1;}return 0;}
template<class T> bool mini(T &a, const T &b){ if(b<a){a=b;return 1;}return 0;}
template<class T> ll sumer(const T& a){ return accumulate(ALL(a),0LL); }
template<class T> void UNIQUE(vector<T> &a){ SORT(a);a.erase(unique(ALL(a)),a.end());}
template<class T, class U> ostream &operator<<(ostream &os, const pair<T,U> &pe) { os << pe.first << " " << pe.second; return os;}
template<class T> ostream &operator<<(ostream &os, const v<T> &ve) { rep(i,ve.size()) os<< (i?" ":"")<<ve[i]; return os;}
ll topbit(ll a) { return a==0?-1:63-__builtin_clzll(a);}
ll botbit(ll a) { return a==0?64:__builtin_ctzll(a);}
ll popcount(ll a) { return __builtin_popcountll(a);}
#define dame {cout<< retword <<"\n"; return;}
#pragma endregion
//--MODIFS---------------------------------
#pragma region Modifs
#define retword "-1"
#define MOD  1000000007
using P  = pair<ll,ll>;
using TP  = tuple<ll,ll,ll>;
#pragma endregion
//--GLOBAL---------------------------------

//--MAIN-----------------------------------
void Main() {
    ll X; cin>>X;
    ll now=100;
    reps(i,1,1000000){
        now+=now/100;
        if(now>=X) {
            cout<< i <<"\n";
            return;
        }
    }
}
//--START----------------------------------
int main() {
    cin.tie(nullptr);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    // ll Qkai; cin>>Qkai; rep(QQ,Qkai) Main();
    Main();
}
//-----------------------------------------

Measured memory_bytes: 3660
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <set>
#include <queue>

using namespace std;

#define lli long long int
#define REP(i,s,n) for(int i=s;i<n;i++)
#define DEBUG 0
#define MOD 1000000007
#define INF (1LL<<50)

lli flag[10];
lli data[10]={INF,2,5,5,4,5,6,3,7,6};
string dp[10010];
lli vis[10010];

string func(lli now){
	if(vis[now])return dp[now];

	if(DEBUG)cout<<"now="<<now<<endl;
	vis[now]=1;
	/*次の数は??*/
	string rtn="";
	for(lli i=9;i>=0;i--){
		string nextStr = "0";
		if(flag[i]==0)continue;
		nextStr[0] += i;
		lli useMatch = data[i];
		if(now-useMatch<0)continue;
		string afterStr=func(now-useMatch);
		if(afterStr=="-1")continue;
		string ans = nextStr + func(now-useMatch);
		if(rtn.size()==ans.size())rtn = max(ans,rtn);
		else if(rtn.size()<ans.size())rtn = ans;
	}
	if(rtn=="")rtn="-1";
	return dp[now]=rtn;
}


int main(){

	REP(i,0,10010)dp[i]="";
	lli data[10]={INF,2,5,5,4,5,6,3,7,6};
	vis[0]=1;

	lli n,m;
	cin>>n>>m;

	REP(i,0,m){
		lli a;
		cin>>a;
		flag[a]++;
	}

	cout<<func(n)<<endl;

	if(DEBUG)cout<<endl;
	if(DEBUG){
		REP(i,0,n){
			cout<<"i="<<i<<" dp[i]="<<dp[i]<<endl;
		}
	}

}


Measured memory_bytes: 43136
#include <iostream>
#include <vector>
#include <cstdlib>
#include <algorithm>
#include <numeric>
using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
typedef long long ll;
using vi = vector<int>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける
using vl = vector<ll>;  // long longの1次元の型に vl という別名をつける
using vvl = vector<vl>; // long longの2次元の型に vvl という別名をつける
int MOD = 1000000007; //10^9 + 7

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

// 無限大の値
const ll INF = 1LL << 60;

int main(void){
  ll n;
  cin >> n;
  int ans=10000000;
  for(int i=100000; i>0; i--){
    if(!(n%i==0))continue;
    ll b=n/i;
    int digi=1, digb=1, ci=i;
    while(b>=10){
      digb += 1;
      b /= 10;
    }
    while(ci>=10){
      digi += 1;
      ci /= 10;
    }
    ans = min(ans, max(digb, digi));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3632
#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>
#include<stdbool.h>
#define ll long long

int main(void){
	ll a, b;

	scanf("%lld%lld", &a, &b);

	if(b%a==0){
		printf("%lld\n", a+b);
	} else {
		printf("%lld\n", b-a);
	}
	return 0;
}

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

string s;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> s;
	for (int i=0;i<(int)s.size();i++){
		for (char c='a';c<='z';c++){
			int ok=1;
			for (int j=0;j+i<(int)s.size();j++){
				int now=0;
				for (int k=j;k<=j+i;k++){
					now|=s[k]==c;
				}
				ok&=now;
			}
			if (ok){
				cout << i << "\n";
				return 0;
			}
		}
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <algorithm>
#include <string>
using namespace std;
 
#define CASES int t;cin>>t;while(t--)
#define REP(i, val, b) for (int i = val; i < b; ++i)
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);
 
int main() {
	fastio
	int a, b, k;
	cin >> a >> b >> k;
	REP(i, a, (min(a+k,b+1))) cout << i << endl;
	// cout << endl;
	REP(i, (max(b-k+1,a+k)), b+1) cout << i << endl;
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(void){
  int N,i,j,n,mini=0,S=0,J=0,stability=0;
  int figure1[36],figure2[36],order1[36],order2[36];
  char symbol1[36],symbol2[36],K;
  scanf("%d",&N);
  for(i = 0 ; i < N ; i++){
    scanf(" %c%d",&symbol1[i],&figure1[i]);
  }
  for(n = 0 ; n < N ; n++){
    order1[n] = n;
  }
  for(i = 0 ; i < N ; i++){
    figure2[i] = figure1[i];
    order2[i] = order1[i];
    symbol2[i] = symbol1[i];
  }
  /*BubbleSort*/
  for(i = 0 ; i < N ; i++){
    for(j = N-1 ; j > i ; j--){
      if(figure1[j] < figure1[j-1]){
	S = figure1[j];
	K = symbol1[j];
	J = order1[j];

	figure1[j] = figure1[j-1];
	symbol1[j] = symbol1[j-1];
	order1[j] = order1[j-1];

	figure1[j-1] = S;
	symbol1[j-1] = K;
	order1[j-1] = J;
      }
    }
  }
  for(i = 0 ; i < N ; i++){
    printf("%c%d",symbol1[i],figure1[i]);
    if(i < N-1){
      printf(" ");
      if(figure1[i] == figure1[i+1]){
	if(order1[i] > order1[i+1]){
	  stability = 1;
	}
      } 
    }
    else printf("\n");
  }
  if(stability == 1){
    printf("Not stable\n");
  } else {
    printf("Stable\n");
  }
  stability = 0;
  
  /*SelectionSort*/
  for(i = 0 ; i < N ; i++){
    mini = i;
    for(j = i+1 ; j < N ; j++){
      if(figure2[j] < figure2[mini]){
	mini = j;
      }
    }
    S = figure2[i];
    K = symbol2[i];
    J = order2[i];

    figure2[i] = figure2[mini];
    symbol2[i] = symbol2[mini];
    order2[i] = order2[mini];

    figure2[mini] = S;
    symbol2[mini] = K;
    order2[mini] = J;
  }
  for(i = 0 ; i < N ; i++){
    printf("%c%d",symbol2[i],figure2[i]);
    if(i < N-1){
      printf(" ");
      if(figure2[i] == figure2[i+1]){
	if(order2[i] > order2[i+1]){
	  stability = 1;
	}
      } 
    }
    else printf("\n");
  }
  if(stability == 1){
    printf("Not stable\n");
  } else {
    printf("Stable\n");
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <math.h>
#include <iomanip>
#include <cmath>
#include <queue>
#include <stack>
#include <cstdlib>
#include <map>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;i++)
#define pie 3.141592653589793238462643383279
#define mod 1000000007
#define inf 10000000000000007
#define all(vec) vec.begin(),vec.end()
#define ggr getchar(); getchar();return 0;
int gcd(int x, int y) {
	if (y == 0)return x;
	return gcd(y, x % y);
}
int lcm(int x, int y) {
	return x / gcd(x, y) * y;
}
bool prime(int x) {
	for (int i = 2; i <= sqrt(x); i++) {
		if (x % i == 0)return false;
	}
	return true;
}

int h,w;
char c[55][55];
int ta[55][55];
int dx[4] = { 1,-1,0,0 }, dy[4] = { 0,0,1,-1 };
int cnt;

int bfs() {
	queue<pair<int, int>> que;
	rep(i, h) {
		rep(j, w) {
			ta[i][j] = inf;
		}
	}
	que.push({0,0});
	ta[0][0] = 0;
	while (que.size()) {
		pair<int, int> mu = que.front();
		que.pop();
		int x = mu.first, y = mu.second;
		if (x == h - 1 && y == w - 1)return cnt-(ta[x][y]-1);
		rep(i, 4) {
			int bx = x + dx[i], by = y + dy[i];
			if (bx >= 0 && bx < h && by >= 0 && by < w && c[bx][by] != '#' && ta[bx][by] == inf) {
				que.push({ bx,by });
				ta[bx][by] = ta[x][y] + 1;
			}
		}
	}
	return -1;
}

signed main() {
	cin>>h>>w;
	rep(i, h) {
		rep(j, w) {
			cin >> c[i][j];
            if(c[i][j]=='.')cnt++;
		}
	}
    cnt-=2;
	int ans = bfs();
	cout << ans << endl;
}


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

using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;


#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))

int dx4[4] = {1,0,-1,0}, dy4[4] = {0,1,0,-1};


int main()
{
    std::cout << std::fixed;
    std::cout << std::setprecision(10);
    ll n;
    cin>>n;
    vector<ll> x(n),y(n);
    for (int i = 0; i < n; i++)
    {
        cin>>x[i]>>y[i];
    }
    double ans=0;
    double cnt=n*(n-1)/2;
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < i; j++)
        {
            ans+=sqrt(pow(x[i]-x[j],2)+pow(y[i]-y[j],2));
        }
    }
    ans=ans/cnt*(n-1);
    cout<<ans<<endl;
    
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> iint;
typedef pair<ll,ll> llll;
const ll zero = 0;
const ll INF = 3000000000000000000; //10^18
const int inINF = 1000000000; //10^9
const ll MOD = 1000000007; //10^9+7
const ll MOD2 = 998244353;

int main(){
    int N, M; cin >> N >> M;
    vector<string> A(N);
    vector<string> B(M);
    for (int i = 0; i < N; i++) {
        cin >> A[i];
    }
    for (int i = 0; i < M; i++) {
        cin >> B[i];
    }

    bool check = false;
    bool tmp = true;
    for (int i = 0; i < N-M+1; i++) {
        for (int j = 0; j < N-M+1; j++) {
            tmp = true;

            for (int k = 0; k < M; k++) {
                for (int l = 0; l < M; l++) {
                    if(A[i+k][j+l] != B[k][l]){
                        tmp = false;
                        break;
                    }
                }
                if(tmp == false){
                    break;
                }
            }

            if(tmp == true){
                check = true;
            }

        }
    }

    if(check == true){
        printf("Yes\n");
    }
    else{
        printf("No\n");
    }

}


Measured memory_bytes: 3628
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include<bits/stdc++.h>
using namespace std;
#define rep(i,s,t) for(ll i = (ll)(s); i < (ll)(t); i++)
#define rrep(i,s,t) for(ll i = (ll)(s-1);(ll)(t) <= i; i--)
#define all(x) (x).begin(), (x).end()
typedef long long ll;
typedef long double ld;
typedef pair<ll,ll> Pll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
constexpr ll INF = numeric_limits<ll>::max()/4;
constexpr ll n_max = 2e5+10;
#define int ll

template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) {return '"' + s + '"';}
string to_string(const char *c) {return to_string((string) c);}
string to_string(bool b) {return (b ? "true" : "false");}
template <size_t N>
string to_string(bitset<N> v){
    string res = "";
    for(size_t i = 0; i < N; i++) res += static_cast<char>('0' + v[i]);
    return res;
}
template <typename A>
string to_string(A v) {
    bool first = true;
    string res = "{";
    for(const auto &x : v) {
        if(!first) res += ", ";
        first = false;
        res += to_string(x);
    }
    res += "}";
    return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p){return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";}

void debug_out() {cerr << endl;}
template<typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
    cerr << " " << to_string(H);
    debug_out(T...);
}

#ifdef LOCAL
#define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__)
#else
#define debug(...) 42
#endif

template<class T>
bool chmax(T &a, T b){if(a < b){a = b; return true;} return false;}
template<class T>
bool chmin(T &a, T b){if(a > b){a = b; return true;} return false;}

signed main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    string s;cin >> s;
    ll n = s.size();
    ll k; cin >> k;
    vector dp(n + 1, vector(2, vector<ll>(5)));
    dp[0][0][0] = 1;
    rep(i,0,n){
        ll t = s[i] - '0';
        rep(small, 0, 2){
            rep(j,0,k+1)rep(d,0,10){
                ll i_ = i + 1;
                ll small_ = small;
                ll j_ = j;
                if(!small && d > t)continue;
                if(t > d)small_ = 1;
                if(d != 0)j_++;
                dp[i_][small_][j_] += dp[i][small][j];
            }
        }
    }
    debug(dp);
    cout << dp[n][0][k] + dp[n][1][k] << "\n";
}

Measured memory_bytes: 3652
#include <iostream>
#include <iomanip>
#include <utility>
#include <cmath>
#include <random>
#include <vector>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <string>
#include <algorithm>
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 all(x) begin(x),end(x)
typedef long long ll;
typedef pair<int,int> ip;
typedef pair<ll,ll> lp;
const int inf = 1001001000;
const ll INF = 1LL<<60;
const int MOD = (int)1e9 + 7;

int main(){
	ll n,a,b,c,d,e;
	cin>>n>>a>>b>>c>>d>>e;
	ll once = min({a,b,c,d,e});
	ll ans = (n+once-1LL)/once + 4LL;
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int a, b, c, d;
  cin >> a >> b >> c >> d;
  
  if (a + b > c + d) {
    cout << "Left" << endl;
  }
  
  else if (a + b == c + d) {
    cout << "Balanced" << endl;
  }
  
  else {
    cout << "Right" << endl;
  }
}

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

#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
int h,w,dp[101][101];
string s[101];
void solve(){
    memset(dp,1,sizeof dp);
    cin>>h>>w;
    rep(i,0,h) cin>>s[i];
    rep(i,0,h){
        rep(j,0,w){
            if(i+j==0) dp[i][j]=s[i][j]=='#';
            else{
                if(i) dp[i][j]=min(dp[i][j],dp[i-1][j]+(s[i][j]=='#' and s[i][j]!=s[i-1][j]));
                if(j) dp[i][j]=min(dp[i][j],dp[i][j-1]+(s[i][j]=='#' and s[i][j]!=s[i][j-1]));
            }
        }
    }
    cout<<dp[h-1][w-1]<<endl;
}

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

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

using namespace std;

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	
	int ok = 1;
	string s;
	cin >> s;
	for(int i = 0; i < s.size(); i += 2){
		if(s[i] == 'L'){
			ok = 0;
			break;
		}
	}
	for(int i = 1; i < s.size(); i += 2){
		if(s[i] == 'R'){
			ok = 0;
			break;
		}
	}
	if(ok) cout << "Yes";
    else cout << "No";

	return 0;
}



Measured memory_bytes: 256
//
#include <bits/stdc++.h>
using namespace std;
#define INF 1000000000
#define MOD 1000000007
#define PI 3.14159265
#define EPS 1e-9
#define Pi acos(-1.0)
typedef pair<int, int> ii;
typedef long long ll;
typedef vector<ll> vll;
typedef pair<ll,ll> pll;
#define forr(i,a,b) for(int i=(a); i<(b); i++)
#define clean(arr,val) memset(arr,val,sizeof(arr))
#define forn(i,n) forr(i,0,n)
#define PB push_back
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<pll> vpll;

/*CODE START HERE*/

int n, d, x, a, ans;


int main(){
    ios::sync_with_stdio(0);
    cin >> n >> d >> x;
    ans = x;
    forn(i,n){
        cin >> a;
        ans += ((d-1)/a + 1);
    }
    cout << ans << "\n";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int N, Size;
string s[12];
 
 
int rec(int idx, int md, int sum, int used, vector< int >& conb) // ??´???, ??°????????????, ?????£?????°???
{
    for(int i = 0; i < N; i++) if(s[i].size() != 1 && conb[s[i][s[i].size() - 1]] == 0) return(0);
    if(idx == s[N - 1].size()) return(sum == 0);
     
    int ret = 0;
     
    for(int i = md; i < N - 1; i++) {
        if(s[i].size() <= idx) continue;
        if(conb[s[i][idx]] != -1) {
            sum += conb[s[i][idx]];
        } else {
            for(int j = 0; j < 10; j++) {
                if((used >> j) & 1) continue;
                conb[s[i][idx]] = j;
                ret += rec(idx, i + 1, sum + j, used|(1 << j), conb);
                conb[s[i][idx]] = -1;
            }
            return(ret);
             
        }
    }
     
    int digit = sum % 10;
     
    if(conb[s[N - 1][idx]] == -1) {
        if((used >> digit) & 1) return(0);
         
        conb[s[N - 1][idx]] = digit;
        ret = rec(idx + 1, 0, sum / 10, used|(1 << digit), conb);
        conb[s[N - 1][idx]] = -1;
         
    } else {
     
        if(digit != conb[s[N - 1][idx]]) return(0);
        ret = rec(idx + 1, 0, sum / 10, used, conb);
         
    }
    return(ret);
}
 
int main()
{
    while(cin >> N, N) {
        Size = 0;
        for(int i = 0; i < N; i++) {
            cin >> s[i];
            reverse(s[i].begin(), s[i].end());
            if(i != N - 1) Size = max< int >(Size, s[i].size());
        }
        vector< int > conb(128, -1);
        if(Size > s[N - 1].size()) cout << 0 << endl;
        else cout << rec(0, 0, 0, 0, conb) << endl;
    }
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
#define REP(i, n) for(int i=0; i<n; i++)
#define REPi(i, a, b) for(int i=int(a); i<int(b); i++)
#define MEMS(a,b) memset(a,b,sizeof(a))
#define mp make_pair
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
const ll MOD = 1e9+7;

int main(){
    ll N;
    cin >> N;
    vector<ll> A(N);
    ll minus = 0;
    ll sum = 0;
    REP(i,N){
        ll a;
        cin >> a;
        A[i] = a;
        if(a < 0) minus++;
        sum += abs(a);
    }

    ll ans = 0;

    if(minus % 2 == 0){
        ans = sum;
    }
    else{
        ll rem = 1e15;
        REP(i,N){
            ll a = A[i];
            chmin(rem, abs(a));
        }

        ans = sum - 2*rem;
    }

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


Measured memory_bytes: 4028
#include <iostream>
#include <cmath>
#include <iomanip>

using namespace std;

int main(){
  double a,b,c;
  double s,l ,h;

  cin >> a >> b >> c;
  c = (M_PI/180)*c;
  s = 0.5*a*b*sin(c);
  l = sqrt( a*a+b*b-2*a*b*cos(c));
  l += a+b;
  h = b*sin(c);
  cout << fixed << setprecision(5) << s << endl << l << endl << h << endl;
  return 0;
}

Measured memory_bytes: 3588
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 7;
const double pi = acos(-1);
const int mod = 998244353;
const double eps = 1e-8;
const int inf = 0x3f3f3f3f;

int main(){
	int n;
	scanf("%d",&n);
	int x = n / 500;
	n %= 500;
	int y = n / 5;
	n %= 5;
	cout << (ll)x * 1000 + y * 5 << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <utility>
#include <iomanip>
#include <cmath>
using namespace std;
#define REP(i,n) for (int i=0;i<(n);++i)
#define rep(i,a,b) for(int i=a;i<(b);++i)
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;}
using ll = long long;
constexpr ll INF = 1LL << 60;
constexpr ll MOD = 1e9 + 7;


int main() {
    cin.tie(0); ios_base::sync_with_stdio(false);
    int N;cin >> N;
    ll ans = 1;
    rep(i,2,N+1){
        ans = (ans*i)%MOD;
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
#include <set>
#include <map>
#include <list>
#include <stack>
#include <queue>
#include <cmath>
#include <ctime>
#include <cstdio>
#include <vector>
#include <string>
#include <bitset>
#include <cctype>
#include <cstdlib>
#include <cstring>
#include <utility>
#include <numeric>
#include <complex>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <cassert>
#include <iostream>
#include <iterator>
#include <algorithm>
using namespace std;
#define int long long
#define float double
//const int INF = 100000000000000000;

signed main(void){
  set<int> a;
  for(int i = 0; i < 3; i++){
    int a_;
    cin >> a_;
    a.insert(a_);
  }
  cout << a.size() << "\r\n";
}


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

int main(){
    ll n,a,b,ans=0;
    cin>>n;
    cin>>a>>b;
    ll tmp=a+b;
    if(n<=tmp){
        if(n<a)ans=n;
        else ans=a;
    }
    else{
        ll q=n/tmp;
        ll r=n%tmp;
        if(r>a)r=a;
        ans=a*q+r;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
N = int(input())
L = []
for l in range(N):
	L.append(int(input()))

maxL = max(L)
subL = L
num = ["n"] * N

if L.count(maxL) >= 2:
	for i in range(N):
		print(maxL)
		
else:	
	for i in range(N):
		if L[i] == maxL:
			L[i] = 0
			print(max(L))
		else:
			print(maxL)

Measured memory_bytes: 14196
N = int(input())
H = list(map(int,input().split()))

dp = [0 for i in range(N)]

dp[1] = abs(H[0] - H[1])

for i in range(2,N) :
    dp[i] = min(dp[i-1] + abs(H[i-1] - H[i]) , dp[i-2] + abs(H[i-2] - H[i]))

ans = dp[N-1]

print(ans)


Measured memory_bytes: 13980
#include <iostream>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <cstring>
#include <iomanip>
#include <cmath>
#include <tuple>
#include <map>
#include <unordered_map>
#include <queue>
using namespace std;
typedef long long ll;

ll table[1001];

int main(int argc, char *argv[])
{
	ll i, j;
	bool found = false;
	ll a, b, x;
	cin >> x;
	for (i = 0; i <= 1000; i++) {
		table[i] = i * i * i * i * i;
	}

	for (i = 0; i <= 1000; i++) {
		found = false;
		for (j = 0; j <= 1000; j++) {
			if (table[j] - table[i] == x) {
				a = j;
				b = i;
				found = true;
				break;
			} else if (table[j] + table[i] == x) {
				a = j;
				b = -i;
				found = true;
				break;
			} else if (table[i] - table[j] == x) {
				a = -j;
				b = -i;
				found = true;
				break;
			}
		}
		if (found)
			break;
	}
		 

	cout << a << " " << b << endl;
	return 0;
}


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

#define dump(...) cout<<"# "<<#__VA_ARGS__<<'='<<(__VA_ARGS__)<<endl
#define repi(i,a,b) for(int i=int(a);i<int(b);i++)
#define peri(i,a,b) for(int i=int(b);i-->int(a);)
#define rep(i,n) repi(i,0,n)
#define per(i,n) peri(i,0,n)
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple

using uint=unsigned;
using ll=long long;
using ull=unsigned long long;
using vi=vector<int>;
using vvi=vector<vi>;
using vl=vector<ll>;
using vvl=vector<vl>;
using vd=vector<double>;
using vvd=vector<vd>;
using vs=vector<string>;

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

template<typename Tuple>
void print_tuple(ostream&,const Tuple&){}
template<typename Car,typename... Cdr,typename Tuple>
void print_tuple(ostream& os,const Tuple& t){
	print_tuple<Cdr...>(os,t);
	os<<(sizeof...(Cdr)?",":"")<<get<sizeof...(Cdr)>(t);
}
template<typename... Args>
ostream& operator<<(ostream& os,const tuple<Args...>& t){
	print_tuple<Args...>(os<<'(',t);
	return os<<')';
}

template<typename Ch,typename Tr,typename C>
basic_ostream<Ch,Tr>& operator<<(basic_ostream<Ch,Tr>& os,const C& c){
	os<<'[';
	for(auto i=begin(c);i!=end(c);++i)
		os<<(i==begin(c)?"":" ")<<*i;
	return os<<']';
}

constexpr int INF=1e9;
constexpr int MOD=1e9+7;
constexpr double EPS=1e-9;

int main()
{
	for(int n;cin>>n&&n;){
		map<int,int> f;
		repi(i,1,n+1){
			int x=i;
			map<int,int> g;
			for(int k=2;k*k<=x;k++){
				for(;x%k==0;x/=k)
					g[k]++;
			}
			if(x>1)
				g[x]++;
			for(auto p:g)
				f[p.first]+=p.second;
		}
		ll res=1;
		for(auto p:f)
			(res*=p.second+1)%=MOD;
		cout<<res<<endl;
	}
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0;i < n;i++)
#define VSORT(v) sort(v.begin(), v.end())
#define VRSORT(v) sort(v.rbegin(), v.rend())
#define ll long long
using namespace std;
typedef pair<int, int> P;
typedef pair<ll, ll> LP;
typedef pair<int, P> PP;
typedef pair<ll, LP> LPP;
//typedef vector<unsigned int>vec;
//typedef vector<ll>vec;
//typedef vector<vec> mat;
typedef vector<vector<int>> Graph;

//const int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1};
//const int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1};
const int INF = 1000000000;
const ll LINF = 1000000000000000000;//1e18
const ll  MOD = 1000000007;
const double PI = acos(-1.0);
const double EPS = 1e-10;

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline void add(T &a, T b){a = ((a+b) % MOD + MOD) % MOD;};


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    vector<string> S(N);
    vector<int> t(N);
    REP(i,N) cin >> S[i] >> t[i];
    string X;
    cin >> X;
    ll ans = 0;
    bool ok = false;
    REP(i,N){
        if(S[i] == X){
            ok = true;
            continue;
        }
        if(ok) ans += t[i];
    }
    cout << ans << endl;
}

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

int main()
{
  int n;
  std::cin >> n;
  std::vector<float> v(n);
  for (int i = 0; i < n; i++)
  {
    std::cin>> v[i];
  }
  float accum = 0;
  bool flag = true;
  std::sort(v.begin(), v.end());
  while(flag)
  { 
    float first = v.front();
    float second = v.at(1);
    accum = (first+second)/2.0f;
    v.erase(v.begin());
    v.erase(v.begin());
    v.push_back(accum);
    std::sort(v.begin(), v.end());
    if(v.size()<=1)
    {
      flag = false;
    }
  }
  std::cout << accum << std::endl;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll mod=1000000007;

ll powmod(ll x, ll y){
  ll res=1;
  for(ll i=0; i<y; i++){
    res=res*x%mod;
  }
  return res;
}

int main(){
  ll n;
  cin>>n;
  
  ll ans = powmod(10,n)-powmod(9,n)*2+powmod(8,n);
  ans = ans%mod;
  ans=(ans+mod)%mod;
  cout<<ans;
}


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

int main() {
    ll n; cin >> n;
    ll max = 0;
    vector<ll> p;
    for (int i = 0; i < n; i++) {
        ll _p; cin >> _p;
        p.push_back(_p);
        if (max < _p) max = _p;
    }
    
    ll sum = 0;
    for (ll x: p) {
        sum += x;
    }
    sum -= ll(max/2);

    cout << sum << endl;
    return 0;
}


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

int main() {
  vector<int> a={0,0,0,0,0};
  int k;
  cin >> a.at(0) >> a.at(1) >> a.at(2) >> a.at(3) >> a.at(4) >> k;
  sort(a.begin(), a.end());
  if (a.at(4)-a.at(0) > k) {
    cout << ":(" << endl;
  }
  else {
    cout << "Yay!" << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)

int main() {
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    int tmp = b/a;
    if(tmp > c) cout << c;
    else cout << tmp;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>

#define repd(i, a, b) for (ll i = (a); i < (b); i++)
#define rep(i, n) repd(i, 0, n)

using namespace std;

namespace mp = boost::multiprecision;
using Bint = mp::cpp_int;

using ll = long long;
ll mod = pow(10, 9) + 7;

template <typename T> void output(T, ll);
ll gcd(ll, ll);
ll lcm(ll, ll);
Bint comb(Bint, Bint);
void prime_map(map<ll, ll> &, ll);

int main() {
    // source
    int n;
    cin >> n;
    string s[n];
    rep(i, n) { cin >> s[i]; }

    int m;
    cin >> m;
    string t[m];
    rep(i, m) { cin >> t[i]; }

    map<string, int> m_s;

    rep(i, n) {
        if (m_s[s[i]] == 0) {
            m_s[s[i]] = 1;
        } else {
            m_s[s[i]]++;
        }
    }
    rep(i, m) {
        if (m_s[t[i]] == 0) {
            m_s[t[i]] == -1;
        } else {
            m_s[t[i]]--;
        }
    }

    int ans = 0;
    for (auto iter = m_s.begin(); iter != m_s.end(); iter++) {
        ans = max(ans, iter->second);
    }

    cout << ans << endl;

    return 0;
}

Bint comb(Bint a, Bint b) {
    Bint ans = 1;

    if (a < b) {
        return 0;
    }

    rep(i, b) {
        ans *= a - i;
        ans /= i + 1;
    }

    return ans;
}

template <typename T> void output(T a, int precision) {
    if (precision > 0) {
        cout << setprecision(precision) << a << "\n";
    } else {
        cout << a << "\n";
    }
}

template <typename T> T min(T a, T b) {

    if (a < b) {
        return a;
    } else {
        return b;
    }
}

ll gcd(ll a, ll b) {
    if (b == 0) {
        return a;
    }
    return gcd(b, a % b);
}

ll lcm(ll a, ll b) { return a * b / gcd(a, b); }

void prime_map(map<ll, ll> &m, ll num) {

    if (num == 1) {
        return;
    }
    ll cache = num;
    repd(i, 2, sqrt(num) + 2) {
        if (num % i == 0) {
            if (m[i] == 0) {
                m[i] = 1;
            } else {
                m[i]++;
            }

            num /= i;
            break;
        }
    }
    if (cache == num) {
        if (m[num] == 0) {
            m[num] = 1;
        } else {
            m[num]++;
        }

        return;
    }
    prime_map(m, num);
    return;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
typedef vector<int> vi;
#define pb push_back
#define fastIO ios_base::sync_with_stdio(false); cin.tie(nullptr);
#define endl '\n'
#define deb(x) cout << #x << " "<< x << endl;
#define fo(i, n) for(int i=0; i<n; i++)
#define Fo(i, k, n) for(int i=k; i<n; i++)
#define all(x) x.begin(),x.end()
#define mod 1000000007

ll expo(ll a,ll b){ll r=1;a=a%mod;while(b){if(b%2)r=(r*a)%mod;a=(a*a)%mod;b=b/2;}
return r;}
struct greaterr
{
    template<class T>
    bool operator()(T const &a, T const &b) const { return a > b; }
};



/*vector<bool> sieve(10000007,true);

void help(){
     sieve[0] = false;
     sieve[1] = false;

     for(int i=2;i*i<=10000000;++i){
        if(sieve[i]){
            for(int j=i*i;j<=10000000;j+=i)
                sieve[j] = false;

        }
     }

}


ll exp(ll x,ll n)
{
    ll result=1;
    while(n>0)
    {
        if(n % 2 ==1)
            result=result * x;
        x=x*x;
        n=n/2;
    }
    return result;
}
*/
int main() {
   fastIO

   int n;
   cin>>n;

   double arr[n];

   fo(i,n)
     cin>>arr[i];


     double mul = 1.0;

     fo(i,n)
     {
         mul*= arr[i];
     }

     double sum = 0;

     fo(i,n)
     {
         sum+= mul/arr[i];
     }

      double ans = (mul)/sum;

     cout<<setprecision(14)<<fixed<<ans;


	return 0;
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, int> LP;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s, t;
	cin >> s >> t;
	int n = s.size(), m = t.size();
	if(n < m){
		cout << "UNRESTORABLE" << endl;
		return 0;
	}
	bool ok = false;
	for(int i = n-1; i >= 0; --i){
		bool match = true;
		for(int j = 0; j < m; ++j){
			if(i+j >= n){
				match = false;
				break;
			}
			if(s[i+j] == '?') continue;
			if(s[i+j] != t[j]) match = false;
		}
		if(match){
			for(int j = 0; j < m; ++j){
				s[i+j] = t[j];
			}
			ok = true;
			break;
		}
	}
	if(!ok){
		cout << "UNRESTORABLE" << endl;
		return 0;
	}
	rep(i,n){
		if(s[i] == '?') s[i] = 'a';
	}
	cout << s << endl;
	return 0;
}

Measured memory_bytes: 3616
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <functional>
#include <numeric>
#include <list>
#include <set>
#include <map>

#define v_exists(elem, v) find(v.begin(),v.end(),elem)!=v.end()
#define s_exists(elem, s) s.find(elem)!=s.end()

using namespace std;
const int MOD = 1000000007;

long gcd(long a, long b) {
    return b == 0 ? a : gcd(b, a % b);
}

long lcm( long m, long n ){
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;

	return ((m / gcd(m, n)) * n);
}


long kake(long x, long y){
	return x * y % MOD;
}

long fact_mod(long x){
	long ans = x;
	x-=1;
	while(x>1){
		ans = ans * x % MOD;
		x-=1;
	}
	return ans;
}



int main(){


	string s;
	cin >> s;
	std::map<char, std::vector<long>> m;

	for(string::size_type i = 0; i < s.size(); ++i) {
		if(m.find(s[i]) == m.end()){
			std::vector<long> v;
			v.push_back(i);
			m[s[i]] = v;
    	} else {
    		m[s[i]].push_back(i);
		}
	}

	map<char, std::vector<long>>::iterator it;

	for ( it =  m.begin(); it != m.end(); it++ ){

		if(it->second.size()==1){
			continue;
		}

		for( long i=1 ; i<(it->second).size(); i++){

			if(((it->second)[i]-(it->second)[i-1]+1)<=3){
				cout << (it->second)[i-1]+1 << " " << (it->second)[i]+1 << endl;
				return 0;
			}	
		}
	}

	cout << -1 << " " << -1 << endl;
	return 0;

}

Measured memory_bytes: 1784
#include <bits/stdc++.h>
typedef long long LL;
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)

using namespace std;
LL p = 1000000007ll;

int main(void)
{
  string s;
  cin >> s;
  bool ym=false,my=false;
  if('0'*10 + '0' < s[0]*10 + s[1]  && s[0]*10+s[1] <= '1'*10 + '2') my = true;
  if('0'*10 + '0' < s[2]*10 + s[3]  && s[2]*10+s[3] <= '1'*10 + '2') ym = true;
  if(ym && my) {
    s = "AMBIGUOUS";
  } else if(ym) {
    s = "YYMM";
  } else if(my) {
    s = "MMYY";
  } else {
    s = "NA";
  }
  cout << s << endl;
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <algorithm>
#include <math.h>
#include <iostream>
using namespace std;
int main ()
{
	int a,b,c,d;
	scanf("%i%i%i%i",&a,&b,&c,&d);
	int r=0;
	r+=min(a,b);
	r+=min(c,d);
	printf("%i",r);
	return 0;
}


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

#define REP(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) REP(i,0,n)
#define INF (1<<30)
#define INFLL (1<<62LL)

typedef long long ll;
typedef unsigned long long ull;

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int N, M;
  map<int, int> Ds;

  cin >> N;
  rep(i, N) {
    int D;
    cin >> D;
    Ds[D]++;
  }

  bool ok = true;
  cin >> M;
  rep(i, M) {
    int T;
    cin >> T;
    if (Ds[T] <= 0) ok = false;
    else Ds[T]--;
  }

  if (ok) cout << "YES" << endl;
  else cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 9600
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<queue>
#include<cstdio>
#include<cmath>
using namespace std;
#define int long long
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<=n;++i)
int MOD=1000000007;
signed main(){
    string s;cin>>s;
    int n=s.size();
    //reverse(s.begin(),s.end());
    bool flag=true;
    for(int i=n-1;i>0;i--){
        if(s[i]=='e'){
            if(s.substr(i-4,5)=="erase")i-=4;
        }
        else if(s[i]=='m'){
            if(s.substr(i-4,5)=="dream")i-=4;
            //cout<<i<<endl;
        }
        else{
            if(i<5){
                flag=false;
                break;
            }
            if(s.substr(i-5,6)=="eraser")i-=5;
            else if(s.substr(i-6,7)=="dreamer")i-=6;
            else {
                flag=false;
                break;
            }
        }
        if(i==0)break;
    }
    if(flag)cout<<"YES";
    else cout<<"NO";
    cout<<endl;
    return 0;
}

Measured memory_bytes: 512