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

#define fastio 			ios::sync_with_stdio(0);	cin.tie(0); cout.tie(0);  cout<<fixed;  cout<<setprecision(12);
#define randomINT 		mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
#define	newl 			cout<<"\n"
#define DISP(as)		for(auto it : as) cout<<it<<" ";newl;
#define all(x)         	(x).begin(),(x).end()
#define mset(x,val)    	memset(x,val,sizeof(x))
#define newl           	cout<<"\n"
#define pb             	push_back
#define mp             	make_pair
#define f 				first
#define s 				second
#define dline          cerr<<"///REACHED///\n";
#define deb1(x)        cerr<<#x<<" = "<<x<<'\n';
#define deb2(x,y)      cerr<<'['<<#x<<','<<#y<<"] = "<<'['<<x<<','<<y<<']'<<'\n';
#define deb3(x,y,z)    cerr<<'['<<#x<<','<<#y<<','<<#z<<"] = "<<'['<<x<<','<<y<<','<<z<<']'<<'\n';

typedef long long 				ll;
typedef long double 			ld;
typedef vector<ll> 				vll;
typedef pair<ll , ll> 			pll;
typedef pair<ld, ld> 			pld;
typedef unordered_map<ll, ll> 	um;
typedef vector<pll> 			vpll;

const ll 	MAX5 	= 	1e+5 + 7;
const ll 	MAX7 	= 	1e+7 + 7;
const ll 	MAXN 	= 	MAX7;
const ll   	INF   	=  	0x7f7f7f7f7f7f7f7f;
const int  	INFi 	=  	0x7f7f7f7f;
const ll 	MOD		=  	1e9 + 7;


// <------------- Declare Variables Here ------------> //

ll T = 1;
ll n, x, m, k, u, v;
string s, t;

// <------------- Implement Functions Here ----------> //



// <------------- Start of main() -------------------> //

void MAIN() {
	cin>>n>>m>>k;
	vll f;
	for(ll i=1;i<=n;i++) {
		if(n%i==0 && m%i==0) f.pb(i);
	}
	k--;
	reverse(all(f));
	cout<<f[k];
}

int main() {
	fastio; randomINT;
	//cin >> T;
	while (T--) {
		MAIN();
	}
	return 0;
}

Measured memory_bytes: 3600
/* DELAPAN.3gp */
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <utility>
#include <numeric>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <cassert>
using namespace std;

#ifdef DEBUG
	#define debug(...) printf(__VA_ARGS__)
	#define GetTime() fprintf(stderr,"Running time: %.3lf second\n",((double)clock())/CLOCKS_PER_SEC)
#else
	#define debug(...) 
	#define GetTime() 
#endif

//type definitions
typedef long long ll;
typedef double db;
typedef pair<int,int> pii;
typedef vector<int> vint;

//abbreviations
#define A first
#define B second
#define MP make_pair
#define PB push_back

//macros
#define REP(i,n) for (int i = 0; i < (n); ++i)
#define REPD(i,n) for (int i = (n)-1; 0 <= i; --i)
#define FOR(i,a,b) for (int i = (a); i <= (b); ++i)
#define FORD(i,a,b) for (int i = (a); (b) <= i; --i)
#define FORIT(it,c) for (__typeof ((c).begin()) it = (c).begin(); it != (c).end(); it++)
#define ALL(a) (a).begin(),(a).end()
#define SZ(a) ((int)(a).size())
#define RESET(a,x) memset(a,x,sizeof(a))
#define EXIST(a,s) ((s).find(a) != (s).end())
#define MX(a,b) a = max((a),(b));
#define MN(a,b) a = min((a),(b));

inline void OPEN(const string &s) {
	freopen((s + ".in").c_str(), "r", stdin);
	freopen((s + ".out").c_str(), "w", stdout);
}

/* -------------- end of DELAPAN.3gp's template -------------- */

int n, avg, a[55];
ll dp[55][2525];

int main(){
	scanf("%d%d", &n, &avg);
	FOR(i, 1, n) {
		scanf("%d", &a[i]);
	}

	dp[0][0] = 1;
	FOR(i, 1, n) {
		FORD(k, n, 1) {
			FORD(s, 2500, a[i]) {
				dp[k][s] += dp[k - 1][s - a[i]];
			}
		}
	}
	ll ans = 0;
	FOR(i, 1, n) {
		ans += dp[i][avg * i];
	}
	printf("%lld\n", ans);
	
	return 0;
}


Measured memory_bytes: 1280
#include <bits/stdc++.h>
#define LOCAL
using namespace std;
template <typename A, typename B>
ostream& operator <<(ostream& out, const pair<A, B>& a) {
out << "(" << a.first << "," << a.second << ")";
return out;
}
template <typename T, size_t N>
ostream& operator <<(ostream& out, const array<T, N>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T>
ostream& operator <<(ostream& out, const vector<T>& a) {
out << "["; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "]";
return out;
}
template <typename T, class Cmp>
ostream& operator <<(ostream& out, const set<T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& v : a) { out << (first ? "" : ", "); out << v; first = 0;} out << "}";
return out;
}
template <typename U, typename T, class Cmp>
ostream& operator <<(ostream& out, const map<U, T, Cmp>& a) {
out << "{"; bool first = true;
for (auto& p : a) { out << (first ? "" : ", "); out << p.first << ":" << p.second; first = 0;} out << "}";
return out;
}
#ifdef LOCAL
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
#else
#define trace(...) 42
#endif
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
cerr << name << ": " << arg1 << endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');
cerr.write(names, comma - names) << ": " << arg1 << " |";
__f(comma + 1, args...);
}
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
#define int long long
using P = pair<int,int>;
//#########################################
signed main(){
    int n;cin >> n;
    map<string,int> cnt;
    while(n--){
        string s;cin >> s ;
        cnt[s]++;

    }
    cout << "AC" << " " << "x" << " " << cnt["AC"] << endl;
    cout << "WA" << " " << "x" << " " << cnt["WA"] << endl;
    cout << "TLE" << " " << "x" << " " << cnt["TLE"] << endl;
    cout << "RE" << " " << "x" << " " << cnt["RE"] << endl;
    return 0;
}


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

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

using namespace std;

const int INF=1<<29;

int solve(vector<int> x,vector<int> y,vector<int> dir){
	int n=x.size(),ans=INF;

	// -> <-
	map<int,set<int>> X;
	rep(i,n) if(dir[i]==2) {
		X[y[i]].emplace(x[i]);
	}
	rep(i,n) if(dir[i]==0) {
		auto it=X[y[i]].lower_bound(x[i]);
		if(it!=X[y[i]].end()){
			ans=min(ans,5*(*it-x[i]));
		}
	}

	// →
	//   ↑
	map<int,set<int>> D;
	rep(i,n) if(dir[i]==1) {
		D[x[i]+y[i]].emplace(x[i]);
	}
	rep(i,n) if(dir[i]==0) {
		auto it=D[x[i]+y[i]].lower_bound(x[i]);
		if(it!=D[x[i]+y[i]].end()) ans=min(ans,10*(*it-x[i]));
	}

	return ans;
}

int main(){
	int n; scanf("%d",&n);
	vector<int> x(n),y(n),dir(n);
	rep(i,n){
		char c; scanf("%d%d %c",&x[i],&y[i],&c);
		if(c=='R') dir[i]=0;
		if(c=='U') dir[i]=1;
		if(c=='L') dir[i]=2;
		if(c=='D') dir[i]=3;
	}

	int ans=INF;
	rep(_,4){
		ans=min(ans,solve(x,y,dir));
		rep(i,n){
			tie(x[i],y[i])=make_pair(-y[i],x[i]);
			dir[i]=(dir[i]+1)%4;
		}
	}

	if(ans<INF) printf("%d\n",ans);
	else        puts("SAFE");

	return 0;
}


Measured memory_bytes: 44968
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

template<int Modulo = MOD> struct Mint {
	Int val;
	constexpr Mint(Int v = 0) noexcept : val(v% Modulo) {
		if (val < 0) v += Modulo;
	}
	constexpr int getmod() { return Modulo; }
	constexpr Mint operator - () const noexcept { return val ? Modulo - val : 0; }
	constexpr Mint operator + (const Mint& r) const noexcept { return Mint(*this) += r; }
	constexpr Mint operator - (const Mint& r) const noexcept { return Mint(*this) -= r; }
	constexpr Mint operator * (const Mint& r) const noexcept { return Mint(*this) *= r; }
	constexpr Mint operator / (const Mint& r) const noexcept { return Mint(*this) /= r; }
	constexpr Mint& operator += (const Mint& r) noexcept {
		val += r.val;
		if (val >= Modulo) val -= Modulo;
		return *this;
	}
	constexpr Mint& operator -= (const Mint& r) noexcept {
		val -= r.val;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr Mint& operator *= (const Mint& r) noexcept {
		val = val * r.val % Modulo;
		return *this;
	}
	constexpr Mint& operator /= (const Mint& r) noexcept {
		Int a = r.val, b = Modulo, u = 1, v = 0;
		while (b) {
			Int t = a / b;
			a -= t * b; swap(a, b);
			u -= t * v; swap(u, v);
		}
		val = val * u % Modulo;
		if (val < 0) val += Modulo;
		return *this;
	}
	constexpr bool operator == (const Mint& r) const noexcept {
		return this->val == r.val;
	}
	constexpr bool operator != (const Mint& r) const noexcept {
		return this->val != r.val;
	}
	friend ostream& operator << (ostream& os, const Mint<Modulo>& x) noexcept {
		return os << x.val;
	}
	friend istream& operator >> (istream& is, Mint<Modulo>& x) noexcept {
		Int tmp; is >> tmp;
		x = Mint<Modulo>(tmp);
		return is;
	}
	friend constexpr Mint<Modulo> modpow(const Mint<Modulo>& a, Int n) noexcept {
		Mint res(1), tmp = a;
		while (n > 0) {
			if (n & 1) res *= tmp;
			tmp *= tmp;
			n >>= 1;
		}
		return res;
	}
};

using mint = Mint<>;

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N, M, R;
	cin >> N >> M >> R;

	vector<Int> r(R);
	for (Int i = 0; i < R; i++) {
		cin >> r[i];
		r[i]--;
	}
	sort(r.begin(), r.end());

	vector<vector<Int>> dis(N, vector<Int>(N,INF));
	Int a, b, c;
	for (Int i = 0; i < M; i++) {
		cin >> a >> b >> c;
		a--;
		b--;
		dis[a][b] = c;
		dis[b][a] = c;
	}

	for (Int k = 0; k < N; k++) {
		for (Int i = 0; i < N; i++) {
			for (Int j = 0; j < N; j++) {
				dis[i][j] = min(dis[i][j], dis[i][k] + dis[k][j]);
			}
		}
	}

	Int ans = INF;
	Int temp;
	do {
		temp = 0;
		for (Int i = 0; i < R-1; i++) {
			temp += dis[r[i]][r[i + 1]];
		}
		ans = min(ans, temp);
	} while (next_permutation(r.begin(), r.end()));

	cout << ans << "\n";

}

Measured memory_bytes: 640
#include<cstring>
#include<string>
#include<vector>
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<stack>
#include<queue>
#include<cmath>
#include<algorithm>
#include<list>
#include<set>
#include<map>
#include<complex>
#include<sstream>
#include<climits>

#define rep(X,Y) for (int (X) = 0;(X) < (Y);++(X))
#define all(X) (X).begin(),(X).end()
#define fi first
#define sc second
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

int main() {
  int a, b, c;
  cin >> a >> b;
  if (a%2 == 0 || b%2 == 0) {
    cout << "No" << endl;
  } else {
    cout << "Yes" << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
# define ll int64_t
# define str string
# define rep(i,n) for(ll i=0;i<n;i++)
# define rrep(i,n) for(ll i=1;i<=n;i++)
# define ALL(x) (x).begin(), (x).end()
# define SZ(x) ((int)(x).size())
# define pb push_back
# define mod 1000000007
# define PI 3.141592653589793
# define vec vector
#define dump(x) cerr<<#x<<"="<<x<<endl
using namespace std;

#define INF 2000000000
#define MAX_V 10



bool compare_by_b(pair<string,ll> a,pair<string,ll> b){
    if(a.second != b.second) return a.second<b.second;
    else return a.first<b.first;
}

bool my_compare(pair<string,ll> a,pair<string,ll> b){
    if(a.first != b.first) return a.first<b.first;
    if(a.second != b.second) return a.second>b.second;
    else return true;
}

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

ll factorial(ll n){
    ll x=1;
    rrep(i,n) (x*=i)%=mod;
    return x;
}

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

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


int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    ll a,b,c,k;
    cin>>a>>b>>c>>k;
    if(a>=k){
        cout<<k<<endl;
        return 0;
    }
    else if(a+b>=k){
        cout<<a<<endl;
        return 0;
    }else{
        ll sum=0;
        sum=a;
        sum-=(k-(a+b));
        cout<<sum<<endl;
    }
    return 0;
}


Measured memory_bytes: 3652
#include <iostream>
#include <vector>
#include <map>
#include <string>

using namespace std;

class Dice {
	public:
		map<char, int> dice;
		Dice();
		Dice(int _I, int _II, int _III, int _IV, int _V, int _VI);
		int GetNumber(char c);
		void roll_E();
		void roll_N();
		void roll_S();
		void roll_W();
};

Dice::Dice() {
}

Dice::Dice(int _I, int _II, int _III, int _IV, int _V, int _VI) {
	dice['T'] = _I;
	dice['S'] = _II;
	dice['E'] = _III;
	dice['W'] = _IV;
	dice['N'] = _V;
	dice['B'] = _VI;
}

int Dice::GetNumber(char c) {
	return dice[c];
}

void Dice::roll_E() {
	map<char, int> tmp = dice;	
	dice['T'] = tmp['W'];
	dice['E'] = tmp['T'];
	dice['W'] = tmp['B'];
	dice['B'] = tmp['E'];
}

void Dice::roll_N() {
	map<char, int> tmp = dice;	
	dice['T'] = tmp['S'];
	dice['S'] = tmp['B'];
	dice['N'] = tmp['T'];
	dice['B'] = tmp['N'];
}

void Dice::roll_S() {
	map<char, int> tmp = dice;	
	dice['T'] = tmp['N'];
	dice['S'] = tmp['T'];
	dice['N'] = tmp['B'];
	dice['B'] = tmp['S'];
}

void Dice::roll_W() {
	map<char, int> tmp = dice;	
	dice['T'] = tmp['E'];
	dice['E'] = tmp['B'];
	dice['W'] = tmp['T'];
	dice['B'] = tmp['W'];
}

bool same(Dice d1, Dice d2) {
	string r = "NNNNWNNNENNNENNNWNNNWNNN";
	for (unsigned int i = 0; i < r.size(); i++) {
		if (r[i] == 'S') {
			d2.roll_S();
		}
		if (r[i] == 'E') {
			d2.roll_E();
		}
		if (r[i] == 'W') {
			d2.roll_W();
		}
		if (r[i] == 'N') {
			d2.roll_N();
		}
		if (d1.dice['T'] == d2.dice['T'] and d1.dice['E'] == d2.dice['E'] and d1.dice['W'] == d2.dice['W'] and d1.dice['N'] == d2.dice['N'] and d1.dice['S'] == d2.dice['S'] and d1.dice['B'] == d2.dice['B']) {
			return true;
		}
	}
	return false;
}

int main() {
	int n;
	cin >> n;
	vector<Dice> Dices(n);
	for (int i = 0; i < n; i++) {
		int I, II, III, IV, V, VI;
		cin >> I >> II >> III >> IV >> V >> VI;
		Dice dice(I, II, III, IV, V, VI);
		Dices[i] = dice;
	}

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (i == j) continue;
			if (same(Dices[i], Dices[j])) {
				cout << "No" << endl;
				return 0;
			}
		}
	}

	// std::cout << "\e[38;5;0m\e[48;5;40m --- end ---  \e[m" << std::endl; // debug
	cout << "Yes" << endl;
	return 0;
}



Measured memory_bytes: 3224
#include <bits/stdc++.h>
using namespace std;using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;using ld=long double;template<typename T>void _(const char*s,T h){cerr<<s<<" = "<<h<<"\n";}template<typename T,typename...Ts>void _(const char*s,T h,Ts...t){int b=0;while(((b+=*s=='(')-=*s==')')!=0||*s!=',')cerr<<*s++;cerr<<" = "<<h<<",";_(s+1,t...);}// break continue pop_back 998244353
#define int ll
#define pii pll
#define f first
#define s second
#define pb emplace_back
#define forn(i,n) for(int i=0;i<(n);++i)
#define sz(a)((int)(a).size())
#define sqr(x) ((x)*(x))
struct init{init(){cin.tie(0);iostream::sync_with_stdio(0);cout<<fixed<<setprecision(10);cerr<<fixed<<setprecision(5);}~init(){
#ifdef LOCAL
#define dbg(...) _(#__VA_ARGS__,__VA_ARGS__)
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#else
#define dbg(...) 
#endif
}}init;template<typename T,typename U>void upx(T&x,U y){if(x<y)x=y;}template<typename T,typename U>void upn(T&x,U y){if(x>y)x=y;}mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());const int D=4,dx[]={+1,0,-1,0},dy[]={0,+1,0,-1};
const int B=18,N=1<<B,OO=1e9;
pii mx[N][2];
int a[N];
void f(int i,pii v){
    forn(j,2)if(mx[i][j].s==v.s)return;
    upx(mx[i][1],v);
    if(mx[i][0]<mx[i][1])swap(mx[i][0],mx[i][1]);
}
int32_t main(){
    int b;cin>>b;
    int n=1<<b;
    forn(i,n){
        cin>>a[i];
        mx[i][0]={a[i],i};
        mx[i][1]={-OO,-1};
    }
    forn(i,n){
        forn(j,b){
            if(i>>j&1){
                int t=i^(1<<j);
                forn(k,2)f(i,mx[t][k]);
            }
        }
    }
    for(int k=1;k<n;++k){
        int ans=mx[k][0].f+mx[k][1].f;
        forn(j,b){
            if(k>>j&1){
                int s=k^(1<<j);
                int z=(1<<j)-1;
                s|=z;
                upx(ans,mx[s][0].f+mx[s][1].f);
            }
        }
        cout<<ans<<'\n';
    }
    return 0;
}

Measured memory_bytes: 13860
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define inf 0x7f7f7f7f7f7f7f7f
#define ll long long
using namespace std;
const int mod=1e9+7;
const int maxn=1e5;
int n;
int f[maxn+8],g[maxn+8];
ll A,B;
ll a[maxn+8];

ll read()
{
    ll x=0,f=1;char ch=getchar();
    for (;ch<'0'||ch>'9';ch=getchar()) if (ch=='-') f=-1;
    for (;ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
    return x*f;
}

int main()
{
    n=read(),A=read(),B=read();
    for (int i=1;i<=n;i++) a[i]=read();a[0]=-inf,a[n+1]=inf;
    f[0]=g[0]=1;
    int j_a=0,j_b=0,pre_a=0,pre_b=0;
    for (int i=1;i<=n;i++)
	{
	    //printf("Time:%d\n",i);
	    if (a[i]-a[i-1]<A) pre_a=i-1;
	    if (a[i]-a[i-1]<B) pre_b=i-1;
	    j_a++;while(j_a<i&&a[i+1]-a[j_a]>=A) j_a++;j_a--;
	    j_b++;while(j_b<i&&a[i+1]-a[j_b]>=B) j_b++;j_b--;
	    //printf("%d %d\n",pre_a,pre_b);
	    if (j_a>=pre_b) g[i]=pre_b?(f[j_a]-f[pre_b-1])%mod:f[j_a];
	    if (j_b>=pre_a) f[i]=pre_a?(g[j_b]-g[pre_a-1])%mod:g[j_b];
	    //printf("check:%d %d\n",f[i],g[i]);
	    f[i]=(f[i]+f[i-1])%mod;
	    g[i]=(g[i]+g[i-1])%mod;
	}
    int ans=((((f[n]-f[n-1])%mod+g[n])%mod-g[n-1])%mod+mod)%mod;
    printf("%d\n",ans);
    return 0;
}


Measured memory_bytes: 1792
N = int(input())
h = list(map(int, input().split()))
h.append(0)

res = 0
while True:
    if max(h) == 0:
        break
    for i in range(N):
        if h[i] > 0:
            l = i
            break
    for j in range(i+1, N+1):
        if h[j] == 0:
            r = j
            break
    
    x = min(h[l:r])
    for i in range(l, r):
        h[i] -= x
    res += x

print(res)


Measured memory_bytes: 3188
N = int(input())
A = list(map(int, input().split()))

average = sum(A) // N
ans1 = 0
for i in A:
    ans1 += (i-average)**2
ans2 = 0
for i in A:
    ans2 += (i-average-1)**2
ans = min(ans1, ans2)

print(ans)


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

int main() {
  string o,e;
  cin >> o >> e;
  int n = 2* o.size();
  
  if(o.size() == e.size()){
    for(int i=0;i<n;i++){
      if(i%2 == 0){
        cout << o.at(i/2);
      }
      else {
        cout << e.at(i/2);
      }
    }
    cout << endl;
  }
  else{
    for(int i=0;i<n-1;i++){
      if(i%2 == 0){
        cout << o.at(i/2);
      }
      else {
        cout << e.at(i/2);
      }
    }
  }
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
//#include <string>
#include <string.h>
#include <math.h>
//#include <vector>

using namespace std;


int main() {
  long int A, B, C;
  long long int K; 

  long int cnt=0;  
  long long int tmp;

  cin >> A >> B >> C >> K;

  if(K%2==1) cout << B-A;
  else cout << A-B;
  
  return 0;
}


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

namespace ABC118B
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                Console.SetIn(new StreamReader(args[0]));
            }

            new Program().calc();
        }

        void calc()
        {
            var temp = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            var n = temp[0]; // 人数
            var m = temp[1]; // 食べ物の種類数
            var foodPopularity = new List<int>(); // その食べ物を好きな人の数

            for (int i = 0; i < m; i++)
            {
                foodPopularity.Add(0);
            }

            for (int i = 0; i < n; i++)
            {
                var personalData = Console.ReadLine().Split(' ').Select(int.Parse).Skip(1);

                foreach (int favoriteFood in personalData)
                {
                    foodPopularity[favoriteFood - 1]++;
                }
            }

            Console.WriteLine(foodPopularity.Count(x => x == n));
        }
    }
}


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

using namespace std;

struct Vector2D{
    double x;
    double y;
};
//???????????????(??????????????¨??????)
#define Vertex2D Vector2D

//?????????????????????(a-b)
Vector2D sub_vector( const Vector2D& a, const Vector2D& b )
{
    Vector2D ret;
    ret.x = a.x - b.x;
    ret.y = a.y - b.y;
    return ret;
}

// ????§???¢??¨?????????????????????(2D?????´???)
// ?????????    0:????§???¢????????´???????????????    1:????§???¢????????´???????????????
int hittest_point_polygon_2d( Vertex2D A, Vertex2D B, Vertex2D C, Vertex2D P ) {

    //??????????????¨??????????????????
    //ABC???????§???¢????????????????????§??????????????\...
    
    Vector2D AB = sub_vector(B, A);
    Vector2D BP = sub_vector(P, B);

    Vector2D BC = sub_vector(C, B);
    Vector2D CP = sub_vector(P, C);

    Vector2D CA = sub_vector(A, C);
    Vector2D AP = sub_vector(P, A);

    //??????    Z?????????????¨????????????°????????§???
    double c1 = AB.x * BP.y - AB.y * BP.x;
    double c2 = BC.x * CP.y - BC.y * CP.x;
    double c3 = CA.x * AP.y - CA.y * AP.x;

    if( ( c1 > 0 && c2 > 0 && c3 > 0 ) || ( c1 < 0 && c2 < 0 && c3 < 0 ) ) {
        //????§???¢????????´???????????????
        return 0;
    }

    //????§???¢????????´???????????????
    return 1;

}

int main(){
	
	Vertex2D A, B, C, P, Q;
	
	int n;
	
	cin >> n;
	
	for(int loop = 0; loop < n; loop++){
		cin >> A.x >> A.y >> B.x >> B.y >> C.x >> C.y >> P.x >> P.y >> Q.x >> Q.y;
		if((hittest_point_polygon_2d(A, B, C, P) + hittest_point_polygon_2d(A, B, C, Q)) % 2 == 1){
			printf("OK\n");
		}else{
			printf("NG\n");
		}
	}
	
	return 0;
}

Measured memory_bytes: 1184
// 余分な cout << endl; を削除
// %13lf を %.13lf に
#include<cmath>  // hypot
#include<set>    // multiset
#include<tuple>
#include<vector>
#include<iostream>
using namespace std;
#define df 0
#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
typedef long int li;

template<typename T>
void print_item(T x) {cout << x;}
// pair 型の print (map 含む)
template<typename F,typename S>
void print_item(pair<F,S> x) {
  printf("(");
  print_item(x.first);
  printf(",");
  print_item(x.second);
  printf(")");
}

void print_item(tuple<int,int,int> x) {
  printf("(%d,%d;%d)",get<0>(x),get<1>(x),get<2>(x));
}

// vector 型
template<typename T>
void print(vector<T>& vec,string str=""){
  if(str!="") cout << str << ":";
  for(T x: vec) {print_item(x); cout << " ";}
  cout << endl;
}
// set 型
template<typename T>
void print(set<T>& vec,string str=""){
  if(str!="") cout << str << ":";
  for(T x: vec) {print_item(x); cout << " ";}
  cout << endl;
}

int main(){
  if(df) printf("*debug mode*\n");
  tuple<int,int,int> s[2];
  rep(i,2){
    int x,y; cin >>x >>y;
    s[i]=make_tuple(x,y,0);
  }
  int n; cin >>n;
  vector<tuple<int,int,int>> node;
  rep(i,n){
    int x,y,r; cin >>x >>y >>r;
    node.push_back(make_tuple(x,y,r));
  }
  node.push_back(s[1]);
  if(df)print(node,"node");
  set<pair<double,int>> que;
  vector<int> seen(n+1,0);
  auto calc=[&](tuple<int,int,int> v1,tuple<int,int,int> v2) ->double
	    {
	      double dx=get<0>(v1)-get<0>(v2),dy=get<1>(v1)-get<1>(v2);
	      if(df)printf("calc(%lf,%lf)\n",dx,dy);
	      return max((double)0,hypot(dx,dy)-get<2>(v1)-get<2>(v2));
	    };
  vector<double> dist(n+1,0);
  rep(i,n){
    double d=calc(s[0],node.at(i));
    que.insert(make_pair(d,i));
    dist.at(i)=d;
  }
  if(df) print(dist,"dist");
  double d=calc(s[0],s[1]);
  que.insert(make_pair(d,n));
  dist.at(n)=d;

  auto erase=[&](int v){
	       auto y=que.find(make_pair(dist.at(v),v));
	       que.erase(y);
	     };
  auto add=[&](int v){
	     que.insert(make_pair(dist.at(v),v));
	   };
  
  while(not que.empty()){
    if(df)print(que,"que");
    auto x=*(que.begin());
    if(x.second==n)break;
    seen.at(x.second)=1;
    que.erase(x);
    if(df)printf("see:[%d]%lf\n",x.second,x.first);
    rep(v,n+1){
      if(seen.at(v))continue;
      double d=calc(node.at(x.second),node.at(v));
      if(df)printf("v%d->%lf\n",v,d); 
      if(d+x.first>dist.at(v))continue;
      erase(v);
      dist.at(v)=d+x.first;
      add(v);
    }
    
  }
  printf("%.15lf",que.begin()->first);
  
}

/// confirm df==0 ///


Measured memory_bytes: 384
#include <stdio.h>
 
int main()
{
    int a, b, c, tmp;
    scanf("%d %d %d", &a, &b, &c);
    while(1){
    if (a > b) {
        tmp = a;
        a = b;
        b = tmp;
    }
    else if (b > c) {
        tmp = b;
        b = c;
        c = tmp;
    }
    else if (a > b) {
        tmp = a;
        a = b;
        b = tmp;
    }
    else break;
    }
    printf("%d %d %d\n", a, b, c);
    return 0;
}



Measured memory_bytes: 2048
while str = gets
  a, b, c, d, e, f = str.split(' ').map(&:to_f)
  x = (b*f - e*c)/(b*d - e*a)
  y = (c - a*x)/b
  x = 0.0 if x.round(3) == -0.000
  y = 0.0 if y.round(3) == -0.000
  puts sprintf('%.3f %.3f', x.round(3), y.round(3))
end

Measured memory_bytes: 8808
#include <iostream>
#include <string>
#include <cstdlib>
#include <cmath>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <algorithm>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <assert.h>
#include <unordered_map>
#include <fstream>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<double> vd;
typedef pair<ll,ll> P;
typedef pair<int,int> pii;
typedef vector<P> vpl;
typedef tuple<ll,ll,ll> tapu;
#define rep(i,n) for(int i=0; i<(n); i++)
#define REP(i,a,b) for(int i=(a); i<(b); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
const int inf = 1<<30;
const ll linf = 1LL<<62;
const int MAX = 510000;
ll dy[8] = {1,-1,0,0,1,-1,1,-1};
ll dx[8] = {0,0,1,-1,1,-1,-1,1};
const double pi = acos(-1);
const double eps = 1e-7;
template<typename T1,typename T2> inline bool chmin(T1 &a,T2 b){
	if(a>b){
		a = b; return true;
	}
	else return false;
}
template<typename T1,typename T2> inline bool chmax(T1 &a,T2 b){
	if(a<b){
		a = b; return true;
	}
	else return false;
}
template<typename T> inline void print(T &a){
    rep(i,a.size()) cout << a[i] << " ";
    cout << "\n";
}
template<typename T1,typename T2> inline void print2(T1 a, T2 b){cout << a << " " << b << "\n";}
template<typename T1,typename T2,typename T3> inline void print3(T1 a, T2 b, T3 c){
	cout << a << " " << b << " " << c << "\n";
}
const int mod = 1e9 + 7;
//const int mod = 998244353;

int main(){
	ll n,m; cin >> n >> m;
	vvl G(n,vl(n,linf));
	rep(i,m){
		ll u,v,d; cin >> u >> v >> d;
		G[u][v] = d;
	}
	rep(i,n) G[i][i] = 0;
	rep(k,n) rep(i,n) rep(j,n){
		if(G[i][k] != linf && G[k][j] != linf){
			chmin(G[i][j], G[i][k] + G[k][j]);
		}
	}
	rep(i,n){
		if(G[i][i] != 0){
			puts("NEGATIVE CYCLE");
			return 0;
		}
	}
	rep(i,n){
		rep(j,n){
			if(G[i][j] == linf) cout << "INF";
			else cout << G[i][j];
			cout << (j != n-1 ? " " : "\n"); 
		}
	}
}


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

using namespace std;

int main() {
  string s;
  cin >> s;
  int cnt[26]{};
  for (int i = 0; i < 4; i++) {
    cnt[s[i] - 'A']++;
  }
  int k = 0;
  for (int i = 0; i < 26; i++) {
    if (cnt[i] == 2) {
      k++;
    }
  }
  cout << (k == 2 ? "Yes\n" : "No\n");
  
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>

void inp_str(int*);

int main(void) {

    int P,Q,R;
    scanf("%d %d %d", &P, &Q, &R);

int ans=300;
int temp;
temp=P+Q;
if(temp<ans) {ans=temp;}
temp=Q+R;
if(temp<ans) {ans=temp;}
temp=R+P;
if(temp<ans) {ans=temp;}


printf("%d\n",ans);

    return 0;

}


void inp_str(int instr[]){
char *ptr;
int z,i,count;
char str[100]={'\0'};
char *ln;

fgets(str, 100, stdin); // 入力："123456\n"
ln = strchr(str, '\n'); /* 改行文字を検索 */
if (ln != NULL) { /* 改行が読み取られていたかどうか */
   *ln = '\0';    /* 改行文字を終端文字に置き換える */
}
else {            /* 入力ストリーム上に文字が残ってる場合 */
   while (1) {    /* 改行文字が読み取られるまで空読みする */
       z = getchar();
      if (z == '\n' || z == EOF) break;
   }
}
	count=0;
    ptr = strtok(str, " ");
    i = atoi(ptr);
    instr[count]=i;
    count=count+1;
    // 2回目以降
    while(ptr != NULL) {
        // strtok関数により変更されたNULLのポインタが先頭
        ptr = strtok(NULL, " ");
        // ptrがNULLの場合エラーが発生するので対処
        if(ptr != NULL) {
		    i = atoi(ptr);
    instr[count]=i;
    		count=count+1;
        }
    }
}



Measured memory_bytes: 128
kaisu =  gets.chomp.to_i
num = gets.chomp.split(" ").map(&:to_i)
count = 0

while true do
    if num.map{|i| i % 2}.include?(1)
        break
    else
        num = num.map{|i| i / 2}
        count += 1
    end
end

puts count

Measured memory_bytes: 1916
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string>
#include<string.h>
#include<math.h>
#include<stdlib.h>
#include<vector>
#include<queue>
#include<map>
#include<iomanip>
#include<set>
#define rep(index,num) for(int index=0;index<num;index++)
#define rep1(index,num) for(int index=1;index<=num;index++)
#define brep(index,num) for(int index=num-1;index>=0;index--)
#define brep1(index,num) for(int index=num;index>0;index--)
#define scan(argument) cin>>argument
#define prin(argument) cout<<argument<<endl
#define kaigyo cout<<endl
#define eps 1e-7
#define mp(a1,a2) make_pair(a1,a2)
#define ALL(a) (a).begin(),(a).end()
#define rALL(a) (a).rbegin(),(a).rend()
typedef long long ll;
typedef long double ld;
using namespace std;
typedef pair<ll,ll> pll;
typedef pair<int,int> pint;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<pint> vpint;
typedef vector<pll> vpll;
ll INFl=1e+18+1;
int INF=1e+9+1;
int main(){
	string T[7]={"SUN","MON","TUE","WED","THU","FRI","SAT"};
	string S;
	scan(S);
	rep(i,7){
		if(S==T[i]){
			prin(7-i%7);
			return 0;
		}
	}
	return 0;
}


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

int main() {
	string	sa, sb;
	cin >> sa >> sb;
	sa += sa;
	if (sa.find(sb) == -1)
		cout << "No" << endl;
	else
		cout << "Yes" << endl;
}



Measured memory_bytes: 3212
N = int(input())
lis = list(map(int,input().split()))
c = [i for i in lis]
c.sort()
num = [0 for i in range(2 * 10 ** 5+2)]
for i in c:
  num[i] += 1
ans = 0
for i in num:
    ans += i * (i-1) // 2
for i in lis:
  t = num[i]
  print(ans - t + 1)

Measured memory_bytes: 25644
import java.io.*;
import java.math.BigInteger;
import java.util.*;

/**
 * @author Tran Anh Tai
 * @template for CP codes
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }
    // main solver
    static class Task{
        static int MOD = 1000000007;
        public void solve(InputReader in, PrintWriter out){
            long n = in.nextLong();
            int d = 1;
            long cur =26;
            long total = 26;
            while (total < n){
                cur *= 26;
                total += cur;
                d++;
            }
            n -= total / 26;
            String r = "";
            for (int i = 0; i < d; i++){
                int x = (int)(n % 26);
                n /= 26;
                r =  (char)(x +'a')+ r;
            }
            out.println(r);
        }
    }
    // fast input reader class;
    static class InputReader {
        BufferedReader br;
        StringTokenizer st;

        public InputReader(InputStream stream) {
            br = new BufferedReader(new InputStreamReader(stream));
        }

        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                String line = null;
                try {
                    line = br.readLine();
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
                if (line == null) {
                    return null;
                }
                st = new StringTokenizer(line);
            }
            return st.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(nextToken());
        }
        public long nextLong(){
            return Long.parseLong(nextToken());
        }
    }
}

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

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

using namespace std;
using lint=long long;

template<class G>
class Fenwick_tree{
	vector<G> a;
public:
	Fenwick_tree(int n):a(n){}
	void add(int i,G val){
		for(i++;i<=a.size();i+=i&-i) a[i-1]+=val;
	}
	G sum(int l,int r)const{
		if(l==0){
			G res{};
			for(;r>0;r-=r&-r) res+=a[r-1];
			return res;
		}
		return sum(0,r)-sum(0,l);
	}
	int lower_bound(G val)const{
		if(val<=G{}) return 0;
		int x=0,k;
		for(k=1;k<=a.size();k<<=1);
		for(k>>=1;k>0;k>>=1) if(x+k<=a.size() && a[x+k-1]<val) val-=a[x+k-1], x+=k;
		return x;
	}
	int upper_bound(G val)const{
		if(val<G{}) return 0;
		int x=0,k;
		for(k=1;k<=a.size();k<<=1);
		for(k>>=1;k>0;k>>=1) if(x+k<=a.size() && a[x+k-1]<=val) val-=a[x+k-1], x+=k;
		return x;
	}
};

const long long INF=1LL<<61;

int main(){
	int n,k; scanf("%d%d",&n,&k);

	Fenwick_tree<lint> F_plus(n),F_minus(n);
	rep(i,n){
		int a; scanf("%d",&a);
		if(a>0) F_plus .add(i, a);
		if(a<0) F_minus.add(i,-a);
	}

	lint ans=-INF;
	rep(i,n-k+1){
		lint mid=F_plus.sum(i,i+k)-F_minus.sum(i,i+k);
		ans=max(ans,F_plus.sum(0,i)+max(mid,0LL)+F_plus.sum(i+k,n));
	}
	printf("%lld\n",ans);

	return 0;
}


Measured memory_bytes: 1792
#include<iostream>
#include<algorithm>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<queue>
using namespace std;
#define mem(a,b) memset(a,b,sizeof(a))
typedef long long LL;
typedef pair<int,int> PII;
#define X first
#define Y second
inline int read()
{
	int x=0,f=1;char c=getchar();
	while(!isdigit(c)){if(c=='-')f=-1;c=getchar();}
	while(isdigit(c)){x=x*10+c-'0';c=getchar();}
	return x*f;
}
int a,b,c,k;
int P(int A,int C)
{
	int tmp=A;
	for(int i=1;i<=C;i++)tmp*=2;
	return tmp;
} 
int main()
{
	a=read();b=read();c=read();k=read();
	int tb=1,tc=1;
	for(int i=0;i<=k;i++)
	{
		for(int j=0;j<=i;j++)
		{
			tb=P(b,j),tc=P(c,i-j);
//			printf("%d %d %d\n",a,tb,tc);
			if(tb>a && tc>tb)
			{
				puts("Yes");
				return 0;
			}
		}
	}
	puts("No");
	return 0;
}
/*

*/


Measured memory_bytes: 3060
#include <stdio.h>
#define MAX 2000
#define false 0
#define true 1

int solve(int, int);
int n,A[MAX];


int main(){

	int i,q,x;

	scanf("%d",&n);
	for(i = 0; i < n; i++) scanf("%d",&A[i]);
	scanf("%d",&q);
	for(i = 0; i < q; i++){
		scanf("%d",&x);
		if(solve(0,x) == false) printf("no\n");
		else printf("yes\n");
	}
	return 0;
}

   int solve(int i, int m){

   	int res;

   if(m == 0) return true;
   if(i >= n) return false;
   res = solve(i + 1, m) || solve(i + 1, m - A[i]);
    return res;

}



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

using namespace std;

long long arr[55];

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

    int i,n;
    long long j=1,sum=0;
    cin>>n;
    for(i=0;i<n;i++){
        cin>>arr[i];
    }
    sort(arr,arr+n);
    sum = arr[0];
    for(i=1;i<n;i++){
        sum += (arr[i]*j);
        j*=2;
    }
    cout<<fixed<<setprecision(10)<<(double)sum/(double)j<<'\n';
    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
  char c[12];
  rep(i,12)cin >> c[i];
  rep(i,12){
    if(i==4)cout << ' ' << c[i];
    else if(i==11)cout << c[i] << endl;
    else cout << c[i];
  }
return 0;}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <set>
#include <map>
#include <unordered_map>
#include <vector>
#include <queue>
#include <string>
#include <iomanip>
#include <stdio.h>
#include <cstring>
#include <random>
#include <chrono>
#include <bitset>
#include <fstream>
#include <sstream>

using namespace std;

typedef long long ll;
typedef long double ld;

ll big = 1000000007ll;
float likeabutterfly;
string likeabee;
ll n,m,q,h,k,w;
ll T;

ll mod(ll i){
if(i < 0)return mod(i+big*big);
if(i < big)return i;
return i%big;
}

ll upp(ll i, ll j){
if(j == 0)return 1;
if(j%2 == 0){
    ll h = upp(i,j/2);
    return mod(h*h);
}
return mod(i*upp(i,j-1));
}

ll A[314] = {0};

ll f(ll i, ll pre){
if(i == n-1) return pre;


//cout << i << " " << pre << "  - " << upp(2 , n-i-1)*pre + f(i+1 , A[i+1]) + f(i+1 , 10*pre + A[i+1]) << "\n";
return upp(2 , n-i-2)*pre + f(i+1 , A[i+1]) + f(i+1 , 10*pre + A[i+1]);
}


int main()
{
    ll c1,c2,c3,c4,c5,c6;
    ll a,b,d,e,g;
    ll x,y,z;
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    string s;
    cin >> s;

    for(c1 = 0; c1 < s.length(); c1++){
        if(s[c1] == '1'){A[c1] = 1;}
        if(s[c1] == '2'){A[c1] = 2;}
        if(s[c1] == '3'){A[c1] = 3;}
        if(s[c1] == '4'){A[c1] = 4;}
        if(s[c1] == '5'){A[c1] = 5;}
        if(s[c1] == '6'){A[c1] = 6;}
        if(s[c1] == '7'){A[c1] = 7;}
        if(s[c1] == '8'){A[c1] = 8;}
        if(s[c1] == '9'){A[c1] = 9;}
    }
    n = s.length();

    cout << f(0,A[0]) << "\n";

	return 0;
}



Measured memory_bytes: 256
using System;
class MainClass
{
    public static void Main(string[] args)
    {
        int num = int.Parse(Console.ReadLine());
        int a = num/2;
        if( num % 2 ==0)
        {
            num = a * a;
        }
        else
        {
            num = a * (a + 1);
        }

        Console.WriteLine(num);
    }
}


Measured memory_bytes: 11092
#include <queue>
#include <cstdio>
#include <iostream>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
#include <iomanip>
#include <stack>
#include <time.h>
using namespace std;
typedef long long int ll;

#define EPS (1e-9)
#define INF (1e9)
#define PI (acos(-1))
#define REP(i,n) for(int i=0;i<n;i++)

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

ll beki(ll a, ll b) {
	ll tmp = 1;
	REP(i, b) tmp *= a;
	return tmp;
}

int N;
double A[110];

int main() {
	cin >> N;
	REP(i, N) cin >> A[i];
	double recSum = 0;
	REP(i, N) recSum += double(1) / A[i];
	cout << fixed;
	cout << setprecision(15) << double(1) / recSum << endl;

}


Measured memory_bytes: 256
h, w, k = map(int, input().split())
c = [input() for _ in range(h)]

ans = 0
for hi in range(2 ** h):
    hs = set()
    for hj in range(h):
        if (hi >> hj) & 1:
            hs.add(hj)
    for wi in range(2 ** w):
        ws = set()
        for wj in range(w):
            if (wi >> wj) & 1:
                ws.add(wj)
        cnt = 0
        for i in range(h):
            if i in hs:
                continue
            for j in range(w):
                if j in ws:
                    continue
                if c[i][j] == "#":
                    cnt += 1
        if cnt == k:
            ans += 1
print(ans)


Measured memory_bytes: 74276
#include <bits/stdc++.h>
#define mod 1000000007
#define sp ' '
#define intmax 2147483647
#define llmax 9223372036854775807
#define nyan "(=^･ω･^=)"
#define mkp make_pair
#define lP pair<ll, ll>
#define iP pair<int,int>
typedef long long ll;
using namespace std;

int A, B;
int main() {
	cin >> A >> B;
	if (B%A == 0)cout << A + B << endl;
	else cout << B - A << endl;
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>

int linearSearch();

int main(){
  int s,t,i,j,A[10001],key,C=0;
  scanf("%d",&s);
  for(i=0; i<s; i++) scanf("%d",&A[i]);
  scanf("%d",&t);
  for(j=0; j<t; j++){
    scanf("%d",&key);
    if(linearSearch(key, s, A) != -1) C++;
  }
  printf("%d\n",C);
}

int linearSearch(int key, int n, int A[]){
  int i=0;
  A[n] = key;
  while(A[i] != key) i++;
  if(i!=n) return i;
  else return -1;
}


Measured memory_bytes: 2108
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
ll mod=1e9;

int main(){
  int n,a[100000];
  cin>>n;
  for (int i(0);i<n;i++) cin>>a[i];
  ll b[100000]={0};
  b[0]=a[0];
  for (int i(1);i<n;i++) b[i]=b[i-1]+a[i];
  ll ans(1e18);
  ll sub(0);
  ll sum(0);
  for (int i(0);i<n;i++){
    if (i%2==0){
      if (b[i]+sub<=0){
        sum+=(1-(b[i]+sub));
        sub+=(1-(b[i]+sub));
      }
    }else{
      if (b[i]+sub>=0){
        sum+=(b[i]+sub+1);
        sub-=(b[i]+sub+1);
      }
    }
  }
  ans=min(sum,ans);
  sum=0;sub=0;
  for (int i(0);i<n;i++){
    if (i%2!=0){
      if (b[i]+sub<=0){
        sum+=(1-(b[i]+sub));
        sub+=(1-(b[i]+sub));
      }
    }else{
      if (b[i]+sub>=0){
        sum+=(b[i]+sub+1);
        sub-=(b[i]+sub+1);
      }
    }
  }
  ans=min(sum,ans);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 1408
#include<bits/stdc++.h>
using namespace std;
pair<int,int> v[(int)1e5+10];
int main(){
	long long n,k,i,j;
	cin>>n>>k;
	for(i=0;i<n;i++){
		int t1,t2;
		cin>>t1>>t2;
		v[i].first=t1;
		v[i].second=t2;
		
	}
	sort(v,v+n);
	long long pre=0,ans;
	for(i=0;i<n;i++){
		if(pre<k&&k<=pre+v[i].second){
			ans=v[i].first;
			break;
		}
		pre+=v[i].second;
	}
	cout<<ans;
}


Measured memory_bytes: 1024
#include <iostream>
#include<algorithm>
#include <vector>
using namespace std;
int main(){
  int a,b,c,d,e,f,sum;
  vector<int> w,s;
  cin >> a>> b>> c>> d>>e>>f;
  for(int i=0;i<f;i++){
    for(int j=0;j<f;j++){
      if(i==0&&j==0) continue;
      sum=i*100*a+j*100*b;
      if(sum>f) continue;
      w.push_back(sum);
    }
  }
  sort(w.begin(),w.end());
  w.erase(unique(w.begin(),w.end()),w.end());
  for(int i=0;i<=f;i++){
    for(int j=0;j<=f;j++){
      sum=i*c+j*d;
      if(sum>f) continue;
      s.push_back(sum);
    }
  }
  sort(s.begin(),s.end());
  s.erase(unique(s.begin(),s.end()),s.end());
  int ws=w.size();int ss=s.size();double di,ans=-1;
  int wa,sa;
  for(int i=0;i<ws;i++){
    for(int j=0;j<ss;j++){
     if(s[j]+w[i]<=f){
       if(s[j]<=((w[i]/100)*e)){
         di=(double)(100*s[j])/(w[i]+s[j]);
         if(ans<di){
           wa=w[i];sa=s[j];
           ans=di;
         }
       }
     }
    }
  }
  cout <<wa+sa<<" "<<sa<<endl;
}


Measured memory_bytes: 1400
import sys
from collections import defaultdict
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline

def main():
    N, *A = map(int,read().split())
    d = defaultdict(int)
    for a in A:
        d[a] +=1
    if len(A)==len(d):
        result = 'YES'
    else:
        result = 'NO'

    return result

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



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


int N;
int A[233] , B[233];
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);

    cin >> N;
    int s = 0;

    for (int i = 1 ;  i <= N ; i++)
        cin >> A[i];
    for (int i = 1 ;  i <= N ; i++)
        cin >> B[i];
        
    for (int i = 1 ; i <= N ; i++)
    {
        
        if ( A[i] > B[i]) 
         s += A[i] - B[i];
    }

    cout << s << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define rep( i, n, m ) for(int i = ( n ); i < ( m ); i++)
#define rep_d( i, n, m ) for(int i = ( n ) - 1; i >= ( m ); i--)
#define ARRAY_LENGTH( array ) ( sizeof( array ) / sizeof( array[ 0 ] ))

template <class T> bool chmax( T& a, T b );
template <class T> bool chmin( T& a, T b );
int* eratosthenes( int N );
template <class T> void cumulative_sum( T array, size_t N );

const ll INF = 1LL << 60;
const int k_mod = 1e9 + 7;

int main( void ){
	int N;
	cin >> N;
	vector <int> vec( N );
	int minimum_abs = k_mod;
	ll sum = 0;
	int num_minus = 0;
	rep( i, 0, N ){
		int input;
		cin >> input;
		if (input < 0)
			num_minus++;
		minimum_abs = min( minimum_abs, abs( input ));
		sum += abs( input );
	}
	if (num_minus % 2 == 1)
		sum -= minimum_abs << 1;
	cout << sum << endl;
}

int* eratosthenes( int N ){
	int* prime_array = new int[ N + 1 ];
	int lim = N;
	prime_array[ 0 ] = 0;
	prime_array[ 1 ] = 0;
	rep( i, 2, N + 1 ){
		prime_array[ i ] = 1;
	}
	rep( i, 2, lim ){
		if (prime_array[ i ] == 0)
			continue;
		lim = N / i;
		for(int j = i * 2; j < N + 1; j += i){
			prime_array[ j ] = 0;
		}
	}
	return prime_array;
}
template <class T> void cumulative_sum( T array, size_t N ) {
	rep( i, 1, N + 1 ){
		array[ i ] += array[ i - 1 ];
	}
}
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;
}


Measured memory_bytes: 640
#include <iostream>
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define pii std::pair<int,int>
#define pli std::pair<ll,int>
#define pil std::pair<int,ll>
#define psi std::pair<string,int>
#define pll std::pair<ll,ll>
#define pci std::pair<char,int>
#define sll(x) scanf("%lld",&x)
#define prll(x) printf("%lld ",x)
#define pri(x) printf("%d ",x)
#define si(x) scanf("%d",&x)
#define pb push_back
#define vll std::vector<ll>
#define vpi std::vector<std::pair<int,int>>
#define vi std::vector<int>
#define vvi std::vector<std::vector<int>>
#define vvpil std::vector<std::vector<std::pair<int,ll>>>
#define vlpii std::vector<std::list<pii>>
#define vlpil std::vector<std::list<pil>>
#define li std::list<int>
#define lpil std::list<pil>
#define Endl printf("\n")
#define vli vector<list<int>>
#define vvll vector<vector<ll>>
#define mp make_pair
#define ma 100000000
#define imie(...) "[" << #__VA_ARGS__": " << (__VA_ARGS__) << "] "
const ll  INF=10000000000000;
const ll mod = 1e9 + 7;
using namespace std;
int n ;

void add(ll& a , ll b){
    a += b ;
    if(a >= mod) a -= mod;
}
void sub(ll& a , ll b){
    a -= b ;
    if(a<0) a += mod ;
}
ll mul(ll a , ll b) {return (a * b) % mod;}
struct M{
    vector<vector<ll>> t;
    M(){
        t.resize(n,vll(n));
    }
    M  operator*(const M& b) const{
        M c = M();
        for(int i = 0 ; i < n ; i++){
            for(int j = 0 ; j < n ;j++){
                for(int k = 0 ; k < n ; k++){
                    add(c.t[i][j] , mul(t[i][k] , b.t[k][j]) );
                }
            }
        }
        return c;

    }
};
M I;
M Pow(M x, ll y){

    if(y == 0 ){
        return I;
    }
    M z = Pow(x , y / 2);
    if(y % 2) return z * z * x;
    return z * z;
}
int main()
{
   ll k ;
    cin >> n >> k;
    M input = M();
    I = M();
    for(int i = 0 ; i < n ; i++) for(int j = 0 ; j < n ;j++) cin >> input.t[i][j];
    for(int i = 0 ; i < n ; i++){I.t[i][i] = 1;}
    I = I * Pow(input , k );
    ll ans = 0;
    for(int i = 0 ; i < n ;i++) for(int j = 0 ; j < n ;j++) add(ans, I.t[i][j]) ;
    cout << ans;
    return 0;
}


Measured memory_bytes: 1664