akhauriyash/Code-Regression huggingface dataset:
import heapq
from enum import Enum, auto

class Color(Enum):
    WHITE = auto()
    GRAY = auto()
    BLACK = auto()

class Node:
    def __init__(self, n, w):
        self.n = n
        self.w = w

    def __lt__(self, node):
        return self.w < node.w

color = []      # 探索状態
d = []          # コスト

# input
V, E, r = list(map(int, input().split(' ')))
adj_list = [[] for i in range(V)]
for i in range(E):
    s, t, d = list(map(int, input().split(' ')))
    adj_list[s].append([t, d])

def dijkstra(s):
    global d, color
    color = [Color.WHITE for i in range(V)]
    d = [float('inf') for i in range(V)]
    d[s] = 0

    pqueue = [Node(s, 0)]
    while len(pqueue) >= 1:
        u = heapq.heappop(pqueue).n
        color[u] = Color.BLACK

        for v, w in adj_list[u]:
            if color[v] != Color.BLACK:
                if d[u] + w < d[v]:
                    d[v] = d[u] + w
                    color[v] = Color.GRAY
                    heapq.heappush(pqueue, Node(v, d[v]))

dijkstra(r)
for w in d:
    if w == float('inf'):
        print('INF')
    else:
        print(w)



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

int pow(int x){
	int i,ans=1;
	for(i=1;i<=x;i++) ans=ans*2;
	return ans;
}

int main() {
	// your code goes here
	int n,k,v[60],lp[60],lm[60],rm[60],rp[60],i,j,h,x,y,z,l,r,sl[60]={0},slp[60],slm[60],sr[60]={0},srp[60],srm[60],ans=0;
	cin >> n >> k;
	for(i=1;i<=n;i++) cin >> v[i];
	sl[1]=v[1]; slp[1]=max(v[1],0); slm[1]=max(-v[1],0);
	if(v[1]<0) lm[1]=1;
	for(i=2;i<=n;i++) {
		sl[i]=sl[i-1]+v[i];
		slp[i]=slp[i-1]+max(0,v[i]);
		slm[i]=slm[i-1]+max(0,-v[i]);
		lm[i]=lm[i-1];
		if(v[i]<0) lm[i]++;
	}
	sr[1]=v[n]; srp[1]=max(v[n],0); srm[1]=max(-v[n],0);
	if(v[n]<0) rm[1]=1;
	for(i=2;i<=n;i++) {
		sr[i]=sr[i-1]+v[n+1-i];
		srp[i]=srp[i-1]+max(0,v[n+1-i]);
		srm[i]=srm[i-1]+max(0,-v[n+1-i]);
		rm[i]=rm[i-1];
		if(v[n+1-i]<0) rm[i]++;
	}
	for(i=1;i<=min(n,k);i++){
		for(j=0;j<=i;j++){
			int keep;
			vector<int> vv;
			keep=sl[j]+sr[i-j];
			for(x=1;x<=j;x++) vv.push_back(v[x]);
			for(x=1;x<=(i-j);x++) vv.push_back(v[n+1-x]);
			sort(vv.begin(),vv.end());
			for(x=0;x<k-i;x++){
				if(vv[x]>=0) break;
				keep=keep-vv[x];
			}
			ans=max(ans,keep);
		}
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define fs first
#define sc second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define ALL(A) A.begin(),A.end()
#define RALL(A) A.rbegin(),A.rend()
typedef long long LL;
typedef pair<LL,LL> P;
const LL mod=1000000007;
const LL LINF=1LL<<60;
const int INF=1<<30;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
 

int main(){
    LL n,k;cin >> n >> k;
    vector<LL> a(n);
    for (int i = 0; i < n; i++) {
        cin >> a[i];
    }
    LL ans = 0;
    for (int i = 0; i < n; i++) {
        LL v=0,b=0;
        for (int j = 0; j < n; j++) {
            if(j<i){
                if(a[i]>a[j]) v++;
            }
            else{
                if(a[i]>a[j]) b++;
            }
        }
        ans = (ans + ((k-1)*k/2%mod)*(v+b))%mod;
        ans = (ans + b * k ) %mod;
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#include <numeric> 
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define endl "\n"
#define int long long int
#define mod 1000000007
#define INT_BITS 16
#define INF 10000000
#define pi 3.141592
#define watch(x) cout<<(#x)<<"="<<(x)<<"\n" 
#define pb push_back
//__builtin_popcount

#ifndef ONLINE_JUDGE
    #include "debug.cpp"
#endif


int32_t main()
{
    #ifndef ONLINE_JUDGE
    freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    #endif
    // fast;

   int n;
   cin>>n;

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

   reverse(b,b+n);

   int flag=0;
   int c=-1;
  for(int i=0;i<n;i++)
  {
        if(a[i]==b[i])
        {
            c=a[i];
            break;
        }
  }

  int l=0,r=-1;

  for(int i=0;i<n;i++)
  {
        if(a[i]==c && b[i]==c)
        {
            l=i;
            break;
        }
  }


  for(int i=n-1;i>=0;i--)
  {
        if(a[i]==c && b[i]==c)
        {
            r=i;
            break;
        }
  }

  for(int i=0;i<n;i++)
  {
        if(a[i]!=c && b[i]!=c && l<=r)
        {
            swap(b[i],b[l]);
            l++;
        }
  }

  if(l<=r)
  {
        cout<<"No"<<endl;
        return 0;
  }
    

  cout<<"Yes"<<endl;
  for(int i=0;i<n;i++)
  {
    cout<<b[i]<<" ";
    //assert(b[i]!=a[i])
  }
    
cout<<endl;

 return 0;

}


Measured memory_bytes: 6640
#include <stdio.h>
#include <stdlib.h>

void push(int);
int pop();

int top = 0,array1[100];
  
int main(){
  char array2[100];
  int n1,n2;

  while(scanf("%s",array2)!= EOF){
    if(array2[0] == '+'){
      n1 = pop();
      n2 = pop();
      push(n1+n2);
    }
    else if(array2[0] == '-'){
      n2 = pop();
      n1 = pop();
      push(n1-n2);
    }
    else if(array2[0] == '*'){
      n1 = pop();
      n2 = pop();
      push(n1*n2);
    }
    else{
      
      push(atoi(array2));
    }
  }
  printf("%d\n",pop());
  
  return 0;
}
  
void push(int n){
  top++;
  array1[top] = n;
}

int pop(){
  top--;

  return array1[top+1];
}



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

using namespace std;

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

int64_t dp[4][2];

int main(){
  int n;
  cin >> n;
  vector<int> a(n);
  REP(i, n) cin >> a[i];
  REP(i, n){
    if(i % 2 == 0){
      dp[0][1] = dp[1][0] + a[i];
      dp[2][1] = dp[3][0] + a[i];
      dp[2][0] = max(dp[1][0], dp[1][1]);
    }else{
      dp[1][1] = dp[2][0] + a[i];
      dp[3][0] = max(dp[2][0], dp[2][1]);
      dp[1][0] = dp[0][1];
    }
  }
  if(n % 2 == 0){
    cout << max(dp[1][0], dp[1][1]) << endl;
  }else{
    cout << max(dp[2][0], dp[2][1]) << endl;
  }
  return 0;
}

Measured memory_bytes: 4048
n = int(input())
a = list(map(int, input().split()))
q = int(input())
from collections import Counter
x = Counter(a)
r = sum(a)
for i in range(q):
    b, c = map(int, input().split())
    m = 0
    if b in x:
        m = x[b]
        x.pop(b)
        if c in x:
            x[c] += m
        else:
            x[c] = m
    r += m*(c-b)
    print(r)

Measured memory_bytes: 21012
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define Rreps(i,n,e) for(int i = n - 1; i >= e; --i)
#define Rrep(i,n) Rreps(i,n,0)
#define ALL(a) a.begin(), a.end()
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B;
string S;
//const ll MOD = 998244353;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

vec a(0);
bool ok(ll kind){
    map<ll,ll> st;
    ll last = 0;
    st[0] = 0;
    //rep(i,N) st[a[i]] = 0;
    rep(i,N){
        if(a[i] > 1e+6) continue;
        if(last > a[i]){
            for(auto ite = st.rbegin(); ite->fi > a[i] && ite != st.rend(); ++ite) st.erase(ite->fi);//ite->se = 0;
            ++st[a[i]];
        }else if(last == a[i]){
            ++st[a[i]];
        }
        ll see = a[i];
        while(st[see] >= kind && see != 0) {
            st.erase(see);
            --see;
            ++st[see];
        }
        if(see == 0) {
            st.clear();
            return false;
        }
        last = a[i];
    }
    st.clear();
    return true;
}
int main(){
    cin>>N;
    rep(i,N) cin>>A, a.push_back(A);
    ll lb = 0, ub = 2e+5;
    while(ub - lb > 1){
        ll cen = (ub + lb)/2;
        (ok(cen) ? ub : lb) = cen;
        //cout<<cen<<endl;
    }
    cout<<ub<<endl;
}


Measured memory_bytes: 14320
#include<cstdio>
#include<string>
#include<algorithm>
 
using namespace std;
int h[100000];
 
int main(){
	int n,k;
	scanf("%d %d",&n,&k);
	for(int i = 0;i<n;i++){
		scanf("%d",&h[i]);
	}
	k--;
	sort(h,h+n);
	int min = h[k] - h[0];
	for(int i = 1;i<n-k;i++){
		int t = h[k+i] - h[i];
		if(t<min)min = t;
	}
	printf("%d\n",min);
	
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define pb push_back
const int N = 1e6+6;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    cout<<fixed<<setprecision(12);
    long double l;
    cin>>l;
    l/=3;
    cout<<l*l*l<<endl;
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int h[24]={0,1,2, 4,5,6, 8,9,10, 0,4,8, 1,5,9, 2,6,10, 0,5,10, 2,5,8};
  int i;
  char s[12];
  while(1){
    scanf("%c",&s[0]);
    if(s[0]=='0')break;
    for(i=1;i<12;i++){
      scanf("%c",&s[i]);
    }
    for(i=0;i<8;i++){
      if(s[h[i*3]]==s[h[i*3+1]]
	 &&s[h[i*3]]==s[h[i*3+2]]
	 &&s[h[i*3]]!='+'){
	printf("%c\n",s[h[i*3]]);
	break;
      }
    }
    if(i==8){
      printf("NA\n");
    }
  }
  return 0;
}

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

int main(){
  int n, a, b;
  cin >> n >> a >> b;
  int total = 0;
  for(int i = 1; i <= n; i++){
    int sum = 0, temp = i;
    while(temp > 0){
      sum += temp % 10;
      temp /= 10;
    }
    if(sum >= a && sum <= b){
      total += i;
    }
  }
  cout << total << endl;
  return 0;
}

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

// #define int long long

#define pb          push_back
#define F           first
#define S           second
#define endl        "\n"
#define rep(i,a,b)  for(int i = a; i < (int)b; i++)
#define req(i,a,b)  for(int i = (int)b - 1; i >= a; i--)
#define all(a)      (a).begin(),(a).end()
#define ret(x)      {cout << x << endl; return;}
#define sz(x)       (int)x.size()
#define type(x)     typeid(x).name()

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

int gcd(int a, int b) {return b?gcd(b,a%b):a;}

#ifdef LOCAL
	#define wa(x)       cerr << (#x) << " --- " << (x) << endl
	#define pvi(v)      {for(auto it:v) cerr << it << " "; cerr << endl;}
	#define line1	    cerr << "---------------------------" << endl;
#else
	#define wa //
	#define line1 //
	#define pvi //
	#define printf //
#endif

void solve();
signed main() {
	ios_base::sync_with_stdio(false); cin.tie(NULL);
	cout << fixed << setprecision(10);

	int t=1; 
	// cin>>t;
	while(t--) {solve();line1;}
	printf("Time : %fms\n", (1000*(double)clock())/CLOCKS_PER_SEC);
	return 0;
}

//___________________________________________________________________________________________________

void solve() {
	string a,b;
	cin >> a >> b;
	int la = a.size();
	int lb = b.size();

	// dp[i][j] : 
	// Length of LCS when we consider the first i characters 
	// of string_a and first j characters of string_b.
	vector<vi> dp(la+1, vi(lb+1,0));

	rep(i,1,la+1){
		rep(j,1,lb+1){
			if(a[i-1] == b[j-1]) dp[i][j] = max(dp[i][j], dp[i-1][j-1]+1);
			else dp[i][j] = max({dp[i][j], dp[i-1][j], dp[i][j-1]});
		}
	}

	int i=la, j=lb;
	string ans = {};
	while(i != 0 || j != 0){
		if(i>0 && j>0 && a[i-1] == b[j-1]){
			ans += a[i-1];
			i--, j--;	
		}
		else if(j>0 && dp[i][j] == dp[i][j-1]) j--;
		else if(i>0 && dp[i][j] == dp[i-1][j]) i--;	
	}

	reverse(all(ans));
	cout<<ans<<endl;
}


Measured memory_bytes: 38516
#include <cmath>
#include<iostream>
#include<vector>
#include<algorithm>
#include<functional>
#include<queue>
#include<set>
#include<map>
#include<bitset>
#include<iomanip>
#include<stack>
#include<set>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll mod = 1000000007;

int main() {
	int n;
	cin >> n;
	P d[10005];
	for (int i = 0; i < n; i++) {
		cin >> d[i].first >> d[i].second;
	}
	for (int i = 0; i < n - 2; i++) {
		if (d[i].first == d[i].second && d[i + 1].first == d[i + 1].second && d[i + 2].first == d[i + 2].second) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3788
#include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<queue>
#include<set>
#include<map>
#include<stack>
#include<bitset>
#include<assert.h>

#define pb push_back
#define mp make_pair
#define fi first
#define se second

using namespace std;

template<typename T>inline bool upmin(T &x,T y) { return y<x?x=y,1:0; }
template<typename T>inline bool upmax(T &x,T y) { return x<y?x=y,1:0; }

typedef unsigned int u32;
typedef long long LL;
typedef unsigned long long ULL;
typedef long double lod;
typedef pair<int,int> PR;
typedef vector<int> VI;

const lod pi=acos(-1);
const int oo=1<<30;
const LL OO=1e18;
const int mod=998244353;

int qpow(int x,int y) {
	int ans=1;
	while (y) {
		if (y&1) ans=1LL*ans*x%mod;
		x=1LL*x*x%mod;y>>=1;
	}
	return ans;
}

int gi() {
	int w=0;bool q=1;char c=getchar();
	while ((c<'0'||c>'9') && c!='-') c=getchar();
	if (c=='-') q=0,c=getchar();
	while (c>='0'&&c <= '9') w=w*10+c-'0',c=getchar();
	return q? w:-w;
}

namespace io {
	const int L=(1<<21)+1;
	char ibuf[L],*iS,*iT,obuf[L],*oS=obuf,*oT=obuf+L-1,c,st[55];int f,tp;
#define gc() (iS==iT?(iT=(iS=ibuf)+fread(ibuf,1,L,stdin),(iS==iT?EOF:*iS++)):*iS++)
	inline void flush() {
		fwrite(obuf,1,oS-obuf,stdout);
		oS=obuf;
	}
	inline void putc(char x) { *oS++=x; if (oS==oT) flush(); }
	template<class I> inline void gi(I&x) {
		for (f=1,c=gc();c<'0'||c>'9';c=gc()) if (c=='-') f=-1;
		for (x=0;c<='9'&&c>='0';c=gc()) x=x*10+(c&15); x*=f;
	}
	template<class I> inline void print(I x) {
		if (!x) putc('0');
		if (x<0) putc('-'),x=-x;
		while (x) st[++tp]=x%10+'0',x/=10;
		while (tp) putc(st[tp--]);
	}
	inline void gs(char*s, int&l) {
		for (c=gc();c<'a'||c>'z';c=gc());
		for (l=0;c<='z'&&c>='a';c=gc()) s[l++]=c;
		s[l]=0;
	}
	inline void ps(const char*s) { for (int i=0,n=strlen(s);i<n;i++) putc(s[i]); }
	struct IOFLUSHER{ ~IOFLUSHER() { flush(); } } _ioflusher_;
};
using io::putc;
using io::gi;
using io::gs;
using io::ps;
using io::print;

int C[300001];
int inv[300001];
int main()
{
	LL n,a,b,k,ans=0;
	gi(n),gi(a),gi(b),gi(k);
	inv[0]=inv[1]=1;
	for (int i=2;i<=n;i++)
		inv[i]=mod-1LL*(mod/i)*inv[mod%i]%mod;
	C[0]=1;
	for (int i=1;i<=n;i++)
		C[i]=1LL*C[i-1]*(n-i+1)%mod*inv[i]%mod;
	for (int i=0,j=n;i<=n&&i*a<=k;i++) {
		while (i*a+j*b>k) j--;
		if (i*a+j*b==k)
			ans=(ans+1LL*C[i]*C[j])%mod;
	}
	print(ans);
	return 0;
}


Measured memory_bytes: 6400
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<unordered_map>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF ((1<<30)-1)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()




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

	long long x, k, d;
	cin >> x >> k >> d;

	x = abs(x);

	long long m = x / d;
	if (k < m) {
		cout << x - k * d << endl;
		return 0;
	}

	k -= m;
	x %= d;

	if (k & 1) {
		cout << -(x - d) << endl;
	}
	else {
		cout << x << endl;
	}


	return 0;
}


Measured memory_bytes: 3648
//
//  main.c
//  ITP1_10_C
//
//  Created by k16031kk on 2018/05/29.
//  Copyright © 2018年 AIT. All rights reserved.
//

#include <stdio.h>
#include <math.h>

int main(int argc, const char * argv[]) {
    // insert code here...
    int n;
    //double a;
    while(1) {
        scanf("%d", &n);
        if(n==0) break;
        
        int s[1000];
        double sum=0;
        for(int i=0; i<n; i++) {
            scanf("%d", &s[i]);
            sum+=s[i];
        }
        double m=sum/n;
        double a=0;
        for(int i=0; i<n; i++) {
            a+=pow(s[i]-m, 2);
        }
        a=sqrt(a/n);
        printf("%lf\n", a);
    }
    
    return 0;
}



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

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

#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 x[510][510], imos[510][510]; //l nomi ruiseki wa
int main()
{
    m0(x);
    m0(imos);
    int n,m,qqq;
    cin>>n>>m>>qqq;
    vector<int> l(m),r(m);

    for(int i = 0; i < m; i++)
    {
        cin>>l[i]>>r[i];
        x[l[i]][r[i]]++;
    }
    for(int li = 0; li < 505; li++)
    {
        for(int ri = 1; ri < 505; ri++)
        {
            imos[li][ri]=imos[li][ri-1]+x[li][ri];
        }
    }
    
    for(int qq = 0; qq < qqq; qq++)
    {
        int p,q;
        cin>>p>>q;
        int ans=0;
        for(int ll = p; ll <= q; ll++)
        {
            ans+=imos[ll][q]-imos[ll][p-1];
        }
        cout<<ans<<endl;
    }
    

    return 0;
}

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

using ll = long long;
using Vi = vector<int>;
using Vl = vector<ll>;
using Pii = pair<int, int>;
using Pll = pair<ll, ll>;

constexpr int I_INF = numeric_limits<int>::max();
constexpr ll L_INF = numeric_limits<ll>::max();

//==================================

int main() {
#ifdef FASTIO
    cin.tie(0), cout.tie(0);
    ios::sync_with_stdio(false);
#endif
#ifdef FILEINPUT
    ifstream ifs("./in_out/input.txt");
    cin.rdbuf(ifs.rdbuf());
#endif

    string S;
    cin >> S;

    ll ans = 0;
    for (ll i = 0; i < 4; i++) {
        if (S[i] == '+')
            ++ans;
        else
            --ans;
    }

    cout << ans << "\n";

    return 0;
}

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

class Problem
{
private:
	// Variables
	int a, b, c, d;
	
public:
	// Methods
	void input ()
	{
		cin >> a >> b >> c >> d;
	}
	
	void process ()
	{
		
	}
	
	void output ()
	{
		cout << ( a+b > c+d ? "Left" : ( a+b == c+d ? "Balanced" : "Right" )) << endl;
	}
};

int main ()
{
	Problem problem;
	problem.input();
	problem.process();
	problem.output();
	return 0;
}

Measured memory_bytes: 256
n=gets.to_i
k=n.times.map{gets.split}
k = k.map.with_index(1){|m,i| [m[0], m[1].to_i, i]}
k.sort!{|a,b|b[1] <=> a[1]}
i = 0
k.sort_by! {|v| [v[0], i += 1] }
puts k.map{|m|m[2]}

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

int main() {
  ll N, q_1900;
  cin >> N >> q_1900;
  ll q_100 = N - q_1900;
  ll total = 100 * q_100 + 1900 * q_1900;
  ll result = total * pow(2, q_1900);
  cout << result << endl;
}

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

int main() {
  int D; cin >> D;
  
  if(D == 22){
    cout << "Christmas Eve Eve Eve" << endl;
  }
  if(D == 23){
    cout << "Christmas Eve Eve" << endl;
  }
  if(D == 24){
    cout << "Christmas Eve" << endl;
  }
  if(D == 25){
    cout << "Christmas" << endl;
  }
}

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

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vs = vector<string>;
using vvl = vector<vl>;
using pll = pair<ll,ll>;
using vb = vector<bool>;

const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;

#define sz(c) ll((c).size())
#define all(c) begin(c),end(c)
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define xx first
#define yy second

#define has(c,i) ((c).find(i) != end(c))
#define FOR(i,a,b) for (int i=(a); i<(b); i++)
#define FORD(i,a,b) for (int i=int(b)-1; i>=(a); i--)

#define rv(type,name,count) vector<type> name(count); FOR(_i,0,count) cin >> name[_i];
#define grid(type,name,c1,c2) vector<vector<type>> name(c1, vector<type>(c2)); FOR(_i,0,c1)FOR(_j,0,c2)cin >> name[_i][_j];

int main() {
	ll n;
	cin >> n;
	vector<double> poss(n+1);
	poss[0] = 1;
	FOR(kk,0,n) {
		vector<double> p2(n+1);
		double p;
		cin >> p;
		p2[0] = poss[0] * (1-p);
		FOR(i,1,n+1) {
			p2[i] = p * poss[i-1] + (1-p) * poss[i];
		}
		
		swap(poss, p2);
	}
	double d = 0;
	FOR(i, n / 2 + 1, n + 1) {
		d += poss[i];
	}
	cout << setprecision(15) << fixed << d << endl;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const LL MOD = 1000000007;
#define fr(i,n) for(i = 0; i <n; i++)
#define rep(i,n) for(i = 1; i <= n; i++)
#define lcm(x, y) ((x) * (y) / __gcd((x), (y)))
#define pb push_back
#define all(c) (c).begin(), (c).end()
#define debug(x) cout << #x << " : " << x << endl
#define part cout << "----------------------------------\n";
#include <iostream>

int dx[] = {1, 1, 0, -1, -1, -1, 0, 1}; // trick to explore an implicit 2D grid
int dy[] = {0, 1, 1, 1, 0, -1, -1, -1}; // S,SE,E,NE,N,NW,W,SW neighbors  //GO FOR EVEN FOR 4 moves

#define fastinput                     \
    ios_base::sync_with_stdio(false); \
    cin.tie(NULL);                    \
    cout.tie(NULL);

LL cal(LL x,LL y)
{
    return x*x+y*y;
}

int main()
{
    fastinput;
    LL n,i,j,k,t,temp,tc;
    LL lim;
    cin>>n>>lim;
    LL cnt=0;
    while(n--)
    {
        cin>>j>>k;
        if(cal(j,k)<=lim*lim)
        {
            cnt++;
        }
    }
    cout<<cnt<<endl;

    return 0;
}


Measured memory_bytes: 3648
#include <iostream>
#include <string>
#include <typeinfo>

using namespace std;

int main(void){

	string n,a,b,c;
	cin >> n;
	int ans = 1000;
	for(int i = 0; i <= n.size()-3; i++){
		a = n[i];
		b = n[i+1];
		c = n[i+2];
		ans = min(ans,abs(753 - stoi(a)*100 - stoi(b)*10 - stoi(c)));
	}
	printf("%d\n", ans);

	return 0;

}


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

using namespace std;

typedef long long int ll;
typedef pair<int,int> P;

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

const ll mod = 1e9+7;
const ll INF = 1e9;

ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
bool valid(int lx,int ux,int ly,int uy,int x,int y){
	return lx<=x&&x<ux&&ly<=y&&y<uy; 
}
ll power(ll x,ll p){
	if(p==0)return 1;
	ll res=power(x*x%mod,p/2);
	if(p%2==1)res=res*x%mod;
	return res;
}

int n;
vector<int> a,ans,dp,used;
vector<vector<int>> g;

void dfs(int cur){
	used[cur]=1;

	int pos = lower_bound(all(dp), a[cur]) - dp.begin();
	int res;
	if(pos==dp.size()){
		dp.push_back(a[cur]);
		res=-1;
	}else{
		res=dp[pos];
		dp[pos]=a[cur];
	}

	ans[cur]=dp.size();
	for(auto x:g[cur]){
		if(used[x]==0)dfs(x);
	}

	if(res==-1) dp.pop_back();
	else dp[pos]=res;
}


int main(){

	cin>>n;
	a.resize(n);
	used.resize(n,0);
	ans.resize(n,1);
	g.resize(n);
	rep(i,n){
		cin>>a[i];
		a[i]--;
	}
	rep(i,n-1){
		int u,v;
		cin>>u>>v;
		u--;v--;
		g[u].push_back(v);
		g[v].push_back(u);
	}
	dfs(0);
	for(auto x:ans)cout<<x<<endl;

	return 0;
}

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

int main(){
  
	int N, a[3];
  	cin >> N;
  
  	for(int i = 0; i < 3; i++){
    	a[i] = N % 10;
      	N /= 10;
    }
  
  	if((a[0] == 7) || (a[1] == 7) || (a[2] == 7))	cout << "Yes";
  	else cout << "No";
  
  	return 0;
}

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	ll n,w1,w2,ans;
	cin>>n;
	cin>>w1;
	ans=w1;
	for(int i=0;i<n-1;i++){
		cin>>w2;
		ans=w2/__gcd(w2,ans)*ans;
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

func main() {
	var H, W int
	fmt.Scan(&H, &W)

	A := make([]int, H*W)
	for i := 0; i < H*W; i++ {
		fmt.Scan(&A[i])
	}

	move := func(p, q int) {
		A[p]--
		A[q]++
	}

	R := make([]int, 0)

	for i := 0; i < H; i++ {
		for j := 0; j < W; j++ {
			p := i*W + j
			if A[p]%2 == 0 {
				continue
			}
			if j+1 < W {
				R = append(R, i+1, j+1, i+1, j+2)
				move(p, p+1)
				continue
			}
			if i+1 < H {
				R = append(R, i+1, j+1, i+2, j+1)
				move(p, (i+1)*W+j)
				continue
			}
		}
	}

	fmt.Println(len(R) / 4)
	for i := 0; i < len(R); i += 4 {
		fmt.Println(R[i], R[i+1], R[i+2], R[i+3])
	}
}


Measured memory_bytes: 17024
if __name__ == "__main__":
    n = int(input())
    s = dict()
    for _ in range(n):
        tmp = input()
        if tmp in s:
            s[tmp] += 1
        else:
            s[tmp] = 1

    m = int(input())
    t = dict()
    for _ in range(m):
        tmp = input()
        if tmp in t:
            t[tmp] += 1
        else:
            t[tmp] = 1

    ans = 0
    for ss in s:
        if ss in t:
            tmp = s[ss] - t[ss]
        else:
            tmp = s[ss]
        if tmp > ans:
            ans = tmp

    print(ans)


Measured memory_bytes: 3064
#![allow(unused_macros, unused_imports, dead_code)]

use std::io;

fn read_line() -> String {
    let mut s = String::new();
    io::stdin().read_line(&mut s).unwrap();
    s
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    let mut s = String::new();
    io::stdin().read_line(&mut s).ok();
    s.trim().split_whitespace().map(|e| e.parse().ok().unwrap()).collect()
}

macro_rules! from_line {
    ($($a:ident : $t:ty),+) => {
        $(let $a: $t;)+
        {
            let _line = read_line();
            let mut _it = _line.trim().split_whitespace();
            $($a = _it.next().unwrap().parse().unwrap();)+
            assert!(_it.next().is_none());
        }
    };
}

fn main() {
    let C: Vec<Vec<i32>> = (0..3).map(|_| read_vec()).collect();

    let mut ok: bool = false;
    for i in 0..101 {
        for j in 0..101 {
            for k in 0..101 {
                if C[0][0] - i == C[0][1] - j && C[0][0] - i == C[0][2] - k {
                    if C[1][0] - i == C[1][1] - j && C[1][0] - i == C[1][2] - k {
                        if C[2][0] - i == C[2][1] - j && C[2][0] - i == C[2][2] - k {
                            ok = true;
                        }
                    }
                }
            }
        }
    }

    println!("{}", if ok { "Yes" } else { "No" });
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
int main () {
    long long n, m, d;
    cin >> n >> m >> d;
    long long k;
    if (n-1 < d+d || d == 0) {
        k = 0;
    }
    else {
        k = n-d-d;
    }
    long double a = (n+k)*(m-1);
    a /= n*n;
    printf("%.10Lf\n", a);
}

Measured memory_bytes: 256
//#pragma warning(disable:4996)
#include <iostream>
#include <vector>
#include <limits.h>
#include <algorithm>
#include <string>
#include <math.h>
#include <limits.h>
#include <queue>
#include <map>
#include <set>
#include <iomanip>
#include <bitset>
#include <cassert>
#include <random>
#include <functional>
#include <stack>
#include <iomanip>
#include <cassert>
//#include <boost/multiprecision/cpp_int.hpp>
#include <complex>
#include <cstdio>
#include <list>
#include <bitset>
//#include <stdio.h>

//< in.txt > out.txt
using namespace std;
//std::ios::sync_with_stdio(false);
//std::cin.tie(0);
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
typedef long long LL;
typedef long double LD;
//typedef boost::multiprecision::cpp_int bigint;
typedef pair<LL, LL> PLL;
typedef pair<int, int> PI;
typedef pair<LD, LL> pdl;
typedef pair<LD, LD> pdd;
typedef vector<LL> VLL;
typedef vector<VLL> VVLL;
typedef vector<int> VI;
typedef vector<vector<int>> VVI;
template<class T>
using V = vector<T>;
template<class T>
using VV = vector<vector<T>>;
typedef unsigned long long ULL;

int main() {
	std::cin.tie(0);
	std::ios::sync_with_stdio(false);
	string S;
	cin >> S;
	if (S == "RRR")cout << 3 << "\n";
	else if (S == "RRS" || S == "SRR")cout << 2 << "\n";
	else if (S == "RSS" || S == "SRS" || S == "SSR"
		|| S == "RSR")cout << 1 << "\n";
	else cout << 0 << "\n";
	return 0;
}

Measured memory_bytes: 3224
X, K, D = list(map(int, input().split()))

pos_min = X - K * D
pos_max = X + K * D

if X <= K * D and X >= -K * D:
    if K % 2 == 0:
        print(min([X % (2 * D), 2 * D - X % (2 * D)]))
    else:
        print(min([(X - D) % (2 * D), 2 * D - (X - D) % (2 * D)]))
elif pos_min > 0:
    print(pos_min)
else:
    print(-pos_max)

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

int main(void){
    int d, n;
    cin >> d >> n;
    if(n==100)n++;// 100は100で割り切れてしまう
    if(d==0){
        cout << n << endl;
    }else{
        cout << (int)powf(100.0, d)*n << endl;
    }
    return 0;
}


Measured memory_bytes: 256
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)
	var current int
	switch s {
	case "SUN":
		current = 0
	case "MON":
		current = 1
	case "TUE":
		current = 2
	case "WED":
		current = 3
	case "THU":
		current = 4
	case "FRI":
		current = 5
	case "SAT":
		current = 6
	}
	fmt.Println(7 - current)
}


Measured memory_bytes: 512
#include <iostream>

using namespace std;

int main(){
    long long x;
    cin >> x;
    
    long long ans;
    if(x % 11 == 0){
        ans = (x/11)*2;
    }else if(x % 11 <= 6){
        ans = (x/11)*2+1;
    }else{
        ans = (x/11)*2+2;
    }

    cout << ans << endl;


    return 0;
}

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

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author SimplyDivine
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        FastReader in = new FastReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        TaskC solver = new TaskC();
        solver.solve(1, in, out);
        out.close();
    }

    static class TaskC {
        public void solve(int testNumber, FastReader in, PrintWriter out) {
            long mod = (long) 1e9 + 7;
            long n = in.nextLong();
            long m = in.nextLong();
            if (m > n) {
                m ^= n;
                n ^= m;
                m ^= n;
            }
            long ans = (StupidMath.fact(n, mod) * StupidMath.fact(m, mod)) % mod;
            if (n == m) {
                ans = (ans * 2) % mod;
            } else if ((n - m) >= 2) {
                out.println(0);
                return;
            }
            out.println(ans);
        }

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader(InputStream i) {
            br = new BufferedReader(new
                    InputStreamReader(i));
        }

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

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

    }

    static class StupidMath {
        static long fact(long n, long mod) {
            long fact = 1;
            for (long i = 2; i <= n; i++) {
                fact = (fact * i) % mod;
            }
            return fact;
        }

    }
}



Measured memory_bytes: 22996
using System.Collections.Generic;
using static System.Console;
using static System.Convert;

class Program
{
    static void Main(string[] args)
    {
        var num = ToInt32(ReadLine());
        var r = new HashSet<int>();
        for(var i = 0; i < num; i++)
        {
            r.Add(ToInt32(ReadLine()));
        }
        WriteLine(r.Count);
    }
}

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

using namespace std;

int cnt[4];
long double p[303][303][303], ev[303][303][303];

int main () {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  int N, x;
  cin >> N;
  for (int i = 0; i < N; ++i) {
    cin >> x;
    ++cnt[x];
  }
  p[cnt[1]][cnt[2]][cnt[3]] = 1;
  for (int c = N; c >= 0; --c)
    for (int b = N; b >= 0; --b)
      for (int a = N; a >= 0; --a) {
        if (a == 0 && b == 0 && c == 0)
          continue;
        if (a + b + c > N)
          continue;
        long double p_waste = (double) (N - (a + b + c)) / N;
        long double ev_waste = p_waste / (1 - p_waste) + 1;
        ev[a][b][c] += ev_waste * p[a][b][c];
        if (a != 0) {
          long double p_go = (long double) a / (a + b + c);
          p[a - 1][b][c] += p[a][b][c] * p_go;
          ev[a - 1][b][c] += ev[a][b][c] * p_go;
        }
        if (b != 0) {
          long double p_go = (long double) b / (a + b + c);
          p[a + 1][b - 1][c] += p[a][b][c] * p_go;
          ev[a + 1][b - 1][c] += ev[a][b][c] * p_go;
        }
        if (c != 0) {
          long double p_go = (long double) c / (a + b + c);
          p[a][b + 1][c - 1] += p[a][b][c] * p_go;
          ev[a][b + 1][c - 1] += ev[a][b][c] * p_go;
        }
      }
  cout << fixed << setprecision(13) << ev[0][0][0];
}


Measured memory_bytes: 424228
#include <bits/stdc++.h>
using namespace std;
using lint = long long;
template<class T = int> using V = vector<T>;
template<class T = int> using VV = V< V<T> >;

int main() {
  cin.tie(nullptr); ios::sync_with_stdio(false);
  lint k, x, y; cin >> k >> x >> y;
  bool bx = false, by = false;
  if (x < 0) bx = true, x = -x;
  if (y < 0) by = true, y = -y;

  if (~k & 1 and x + y & 1) return cout << -1 << '\n', 0;
  V< pair<lint, lint> > res;
  auto dfs = [&](const auto& dfs, lint sx, lint sy) -> void {
    assert(sx <= x and sy <= y);
    if (sx == x and sy == y) return;
    lint d = abs(x - sx) + abs(y - sy);
    if (d % k) {
      lint a;
      if (k & 1) {
        a = (d + k - 1) / k * k - d;
        if (a & 1) a += k;
      } else {
        a = (d + k - 1) / k * k - d;
        assert(~a & 1);
      }
      a >>= 1;
      if (sy + k - a <= y) {
        lint tx = sx - a, ty = sy + k - a;
        res.emplace_back(tx, ty);
        dfs(dfs, tx, ty);
      } else if (sx + k - a <= x) {
        lint tx = sx + k - a, ty = sy - a;
        res.emplace_back(tx, ty);
        dfs(dfs, tx, ty);
      } else {
        if (k & 1) {
          res.emplace_back(sx - k, sy);
          dfs(dfs, sx - k, sy);
        } else {
          a += k >> 1;
          if (sy + k - a <= y) {
            lint tx = sx - a, ty = sy + k - a;
            res.emplace_back(tx, ty);
            dfs(dfs, tx, ty);
          } else if (sx + k - a <= x) {
            lint tx = sx + k - a, ty = sy - a;
            res.emplace_back(tx, ty);
            dfs(dfs, tx, ty);
          } else assert(false);
        }
      }
    } else {
      lint tx, ty;
      if (sx + k <= x) tx = sx + k, ty = sy;
      else tx = x, ty = sy + k - (x - sx);
      res.emplace_back(tx, ty);
      dfs(dfs, tx, ty);
    }
  };
  dfs(dfs, 0, 0);

  cout << res.size() << '\n';
  for (auto p : res) {
    cout << (bx ? -p.first : p.first) << ' ' << (by ? -p.second : p.second) << '\n';
  }
}

Measured memory_bytes: 16876
@a=map~~<>,1..<>;
@c=<>;
for(@a){
	($a,$b)=glob;
	$m=inf;
	$z=@c;
	$i=0;
	for(@c){
		$i+=/ /;
		$t=abs($`-$a)+abs$'-$b;
		$t<$m&&($m=$t,$z=$i)
	}
	print$z,$/
}


Measured memory_bytes: 768
import java.io.PrintWriter

val pw = PrintWriter(System.out)

fun main(args : Array<String>) {
    func()
    pw.flush()
}

fun func() {
    val (a, b, t) = listOfInt()
    val count = ((t+0.5)/a).toInt()
    println(b*count)
}

// 入力取得
fun next() = readLine()!!
fun nextInt() = next().toInt()
fun nextLong() = next().toLong()
fun nextDouble() = next().toDouble()
fun listOfString() = next().split(" ")
fun listOfInt() =listOfString().map { it.toInt() }

Measured memory_bytes: 38056
/*
	author: parv2809
*/

#include<bits/stdc++.h>
#define int long long int
#define mod 1000000007
#define inf 1e18
#define fo(i,y,n,inc)	for(int i=y;i<n+y;i+=inc)
#define cin(t) int t;cin>>t
#define w(t) while(t--)
#define nl cout<<endl;
#define pii pair<int,int>
#define mp make_pair
#define pb push_back
#define ft(i) (i&(-1*i))
#define arrIn(arr,size)		for(int i=0;i<size;i++){cin>>arr[i];}
#define arrOut(arr,size,seperater)	for(int i=0;i<size;i++){cout<<arr[i]<<seperater;}
using namespace std;

int max(int a, int b) {
	if (a > b)
		return a;
	return b;
}

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

int powmd(int a, int b) {
	if (b == 1)	return a;
	if (b == 0)	return 1;

	int half = powmd(a, b / 2);
	int ans = half * half;
	ans %= mod;
	if (b & 1) {
		ans *= a;
	}
	ans %= mod;
	return ans;
}

void fastIO() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL); cout.tie(NULL);
}

struct line {
	int slope, intercept;

	void init(int s, int i) {
		slope = s;
		intercept = i;
	}

	int x_intersection(line& l1) {
		// slope*x0 + intercept = l1.slope*x0 + l1.intercept
		return ceil((double)(l1.intercept - intercept) / (double)(slope - l1.slope));
	}

	int value_at_x(int x) {
		return (slope * x + intercept);
	}

};

class convex_hull_trick {
public:
	deque<pair<line, int> > dq;

	void add_line(line& l) {
		if (dq.empty()) {
			dq.push_back(make_pair(l, 0));
			return;
		}
		while (!dq.empty()) {
			int x0 = l.x_intersection(dq.back().first);
			if (x0 <= dq.back().second)
				dq.pop_back();
			else
				break;
		}
		int x0 = l.x_intersection(dq.back().first);
		dq.push_back(make_pair(l, x0));
	}

	int query(int x) {
		while (dq.size() > 1) {
			if (x >= dq[1].second)
				dq.pop_front();
			else
				break;
		}
		return dq[0].first.value_at_x(x);
	}

};

int solve(vector<int>& heights, int c) {
	int n = heights.size();
	vector<int> dp(n);
	dp[0] = 0;

	convex_hull_trick custom_ds;
	line l;
	l.init((-2 * heights[0]), (heights[0]*heights[0]));
	custom_ds.add_line(l);

	for (int i = 1; i < n; i++) {
		dp[i] = heights[i] * heights[i] + c + custom_ds.query(heights[i]);
		l.init((-2 * heights[i]), (dp[i] + heights[i]*heights[i]));
		custom_ds.add_line(l);
	}
	return dp[n - 1];
}

int32_t main() {

	fastIO();
	int t = 1;
	w(t) {

		int n, c;
		cin >> n >> c;

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

		cout << solve(heights, c);
	}

	return 0;
}

// cout << "Case #" << i << ": " << answer << endl;

Measured memory_bytes: 9396
#include <iostream>

int main()
{
   int a,b,c,d,e,f;
       std::cin>>a>>b>>c>>d>>e>>f;
    if(a+b*5+c*10+d*50+e*100+f*500>=1000){
        std::cout<<1<<std::endl;
    }else{
        std::cout<<0<<std::endl;
    }
    return 0;
}

Measured memory_bytes: 1160
package main

import (
	"bufio"
	"fmt"
	"math/big"
	"os"
	"strconv"
	"strings"
)

var sc = bufio.NewScanner(os.Stdin)

func stringsFiledsToUint64s() []uint64 {
	sc.Scan()
	r := []uint64{}
	ss := strings.Fields(sc.Text())
	for _, s := range ss {
		i, e := strconv.ParseUint(s, 10, 64)
		if e != nil {
			panic(e)
		}
		r = append(r, uint64(i))
	}
	return r
}

func nextUint64() uint64 {
	sc.Scan()
	i, e := strconv.ParseUint(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func stringsFiledsToInt64s() []int64 {
	sc.Scan()
	r := []int64{}
	ss := strings.Fields(sc.Text())
	for _, s := range ss {
		i, e := strconv.ParseInt(s, 10, 64)
		if e != nil {
			panic(e)
		}
		r = append(r, int64(i))
	}
	return r
}

func nextInt64() int64 {
	sc.Scan()
	i, e := strconv.ParseInt(sc.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return i
}

func main() {
	// _ = nextInt64()
	// inputs := stringsFiledsToInt64s()
	// for _, i := range inputs {
	// 	if i == 0 {
	// 		fmt.Print(0)
	// 		return
	// 	}
	// }
	sc.Split(bufio.ScanWords)

	n := int(nextInt64())
	a := make([]int64, n)

	for i := 0; i < n; i++ {
		a[i] = nextInt64()
		if a[i] == 0 {
			fmt.Println("0")
			return
		}
	}

	ans := big.NewInt(1)
	for _, i := range a {
		ans.Mul(ans, big.NewInt(i))
		if ans.Cmp(big.NewInt(1e18)) > 0 {
			fmt.Print(-1)
			return
		}
	}
	fmt.Print(ans)
	// sc.Split(bufio.ScanWords)

	// n := int(nextint64())
	// a := make([]int64, n)

	// for i := 0; i < n; i++ {
	// 	a[i] = nextint64()
	// 	if a[i] == 0 {
	// 		fmt.Println("0")
	// 		return
	// 	}
	// }

	// var ans int64 = 1
	// for i := 0; i < n; i++ {
	// 	ans *= a[i]
	// 	if ans > 1e18 || ans < a[i] {
	// 		fmt.Println("-1")
	// 		return
	// 	}
	// }
	// fmt.Println(ans)
}


Measured memory_bytes: 5920
package main

import "fmt"

func main() {
	var w, h, x, y, uniq int
	fmt.Scan(&w, &h, &x, &y)
	if x+x == w && y+y == h {
		uniq = 1
	}
	fmt.Println(float64(w)*float64(h)/2, uniq)
}


Measured memory_bytes: 512
#A
M, D = map(int, input().split())

result = 0

def djudge(d, m):
    if d <= 9:
        d1 = d
        d10 = 0
    else:
        strd = str(d)
        d1 = int(strd[1])
        d10 = int(strd[0])
    if d1 * d10 == m and d1>=2 and d10 >=2:
        return True
    else:
        return False

for m in range(1, M+1):
    for d in range(1, D+1):
        if djudge(d, m):
            result += 1
print(result)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define mit map<pii,int>::iterator
#define sit set<int>::iterator
#define itrm(g,x) for(mit g=x.begin();g!=x.end();g++)
#define itrs(g,x) for(sit g=x.begin();g!=x.end();g++)
#define ltype int
#define rep(i,j,k) for(ltype(i)=(j);(i)<=(k);(i)++)
#define rap(i,j,k) for(ltype(i)=(j);(i)<(k);(i)++)
#define per(i,j,k) for(ltype(i)=(j);(i)>=(k);(i)--)
#define pii pair<int,int>
#define fi first
#define se second
#define mpr make_pair
#define pb push_back
#define fastio ios::sync_with_stdio(false)
const int inf=0x3f3f3f3f,mod=1000000007;
const double pi=3.1415926535897932,eps=1e-6;
int n,m,l=400002,r=400001;vector<pii> v2[500005];
bool vis[500005];
map<pii,int> ids;
struct node{
    int x,cst;
}que[1000005];
int bfs(){
    que[++r]=(node){1,0};
    while(r>=l){
        node cur=que[l];l++;int x=cur.x;
        if(vis[cur.x]) continue;
        vis[cur.x]=1;
        if(cur.x==n) return cur.cst;
        rap(i,0,v2[x].size()){
            int to=v2[x][i].fi,cst=v2[x][i].se;
            if(vis[to]) continue;
            if(cst) que[++r]=(node){to,cur.cst+1};
            else que[--l]=(node){to,cur.cst};
        }
    }
    return -1;
}
int cnt;
int check(int x,int y){
    pii o=mpr(x,y);
    if(!ids[o]) ids[o]=++cnt;
    return ids[o];
}
void add(int x,int y,int v){v2[x].pb(mpr(y,v));}
int main()
{
    scanf("%d%d",&n,&m);
    cnt=n;
    rep(i,1,m){
        int t1,t2,t3;
        scanf("%d%d%d",&t1,&t2,&t3);
        int n1=check(t1,t3),n2=check(t2,t3);
        add(t1,n1,0);add(n1,t1,1);add(t2,n2,0);add(n2,t2,1);
        add(n1,n2,0);add(n2,n1,0);
    }
    printf("%d\n",bfs());
    return 0;
}

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

int gcd(int x,int y){
  if(y==0){
    return x;
  }
  return gcd(y,x%y);
}

int main(){
  int x,y,temp;
  cin>>x>>y;

  if(x<y){
    swap(x,y);
  }

  cout<<gcd(x,y)<<"\n";

  return 0;
}



Measured memory_bytes: 3124
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, n;
  cin >> N;
  bool p[4] = {false};
  
  char a[N];
  for(n=0; n<N; n++){
    cin >> a[n];
  }
  
  for(n=0; n<N; n++){
    if(a[n]=='P'){
      p[0] = true;
    }
    if(a[n]=='W'){
      p[1] = true;
    }
    if(a[n]=='G'){
      p[2] = true;
    }
    if(a[n]=='Y'){
      p[3] = true;
    }
  }
  if(p[0]&&p[1]&&p[2]&&p[3]){
    cout << "Four" << endl;
  }else{
    cout << "Three" << endl;
  }
  
}

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

int main(){
    int n; cin >> n;
    int64_t power = 1;
    rep(i,n){
        power *= i+1;
        power %= 1000000000+7;
    }
    cout << power << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; 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 sz(x) (int)(x).size()
#define uni(x) x.erase(unique(rng(x)),x.end())
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define EPS (1e-10)
#define equals(a, b) (fabs((a)-(b)) < EPS)
using namespace std;
typedef long long int ll;
typedef pair<int,int> P;
typedef set<int> S;
typedef queue<int> Q;
typedef queue<P> QP;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
typedef vector<double> vd;
typedef pair<double,double> PD;
typedef pair<int,P> ed;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
const int MOD = 1000000007;
  
int main() {
  vi r(3);
  rep(i,3) {
    cin >> r[i];
  }
  sort(rng(r));
  cout << r[0]+r[1] << endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
using ll =long long;
#define SORT(i) sort((i).begin(),(i).end())
#define INF 2000000000
constexpr ll mod = 1000000007;

int main() {
	int N, A;
	cin >> N >> A;
	N *= N;
	cout << N - A << "\n";


	return 0;
}

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

const int MAX_N = 1000;
const int MAX_V = MAX_N * (MAX_N - 1) / 2;
int id[MAX_N][MAX_N];
int a[MAX_N][MAX_N];
vector<int> edge[MAX_V];

int toId(int i, int j)
{
    if (i > j) swap(i, j);
    return id[i][j];
}

int depth[MAX_V];
int dfs(int v)
{
    if (depth[v] > 0) return depth[v];
    depth[v] = 1;
    for (int u : edge[v])
    {
        depth[v] = max(depth[v], dfs(u) + 1);
    }
    return depth[v];
}

int main()
{
    int n;
    cin >> n;
    int numV = 0;
    for (int i = 0; i < n; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            id[i][j] = numV++;
        }
    }

    vector<int> deg(numV, 0);
    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n - 1; j++)
        {
            cin >> a[i][j];
            a[i][j] = toId(i, a[i][j] - 1);
        }
    }

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < n - 2; j++)
        {
            edge[a[i][j]].push_back(a[i][j + 1]);
            deg[a[i][j + 1]]++;
        }
    }
    
    // DAGかどうか判定
    stack<int> st;
    for (int i = 0; i < numV; i++)
    {
        if (deg[i] == 0) st.push(i);
    }
    int ans = 0;
    while(!st.empty())
    {
        int i = st.top(); st.pop();
        ans++;
        for (int j : edge[i])
        {
            if (--deg[j] == 0)
            {
                st.push(j);
            }
        }
    }

    if (ans != numV)
    {
        cout << -1 << endl;
        return 0;
    }    
    
    ans = 0;
    int tmp;
    for (int i = 0; i < numV; i++)
    {
        tmp = dfs(i);
        if (tmp == -1)
        {
            cout << -1 << endl;
            return 0;
        }
        else if (tmp > ans) ans = tmp;
    }
    cout << ans << endl;
    return 0;    
}

Measured memory_bytes: 39424
#include<iostream>
#include<vector>
#include<cctype>
#include<cstdio>
#include<cstring>
using namespace std;


int main() {
    char s[201],t[101],p[101];
    scanf("%s %s", s, p);
    
    strcpy(t,s);
    strcat(s,t);
    if (strstr(s,p) == NULL) printf("No\n");
    else printf("Yes\n");
    
    return 0;
}


Measured memory_bytes: 3160