akhauriyash/Code-Regression huggingface dataset:
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <string>

using namespace std;

int pow( int p, int x ) {
	if( p == 0 ) return 0;
	if( x == 1 ) return p;
	if( x == 0 ) return 1;
	if( x & 1 ) {
		int y = pow( p, ( x - 1 ) / 2 );
		return p * y * y;
	} else {
		int y = pow( p, x / 2 );
		return y * y;
	}
}

int main(void){

	while( true ) {
		int n;
		cin >> n;
		if( !n ) break;
		int ans = 0;
		while( pow( 5 , ans ) <= n ) {
			ans ++;
		}
		int sum = 0;
		for( int i = 1; i < ans; i++ )
			sum += n / pow( 5, i );
		cout << sum << endl;

	}

    return 0;
}

Measured memory_bytes: 1160
function Main(input) {
	input = input.split("\n");


    const num = Number(input[0]);

    if (input[1].length > num) {
         console.log(input[1].substr( 0, num ) + '...');
    } else {
        console.log(input[1]);
    }
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 29572
import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        int a, b, c;

        Scanner input = new Scanner(System.in);

        a = input.nextInt();
        b = input.nextInt();
        c = input.nextInt();

        if (a >= 1 && a <= 100 && b >= 1 && b <= 100 && c >= 1 && c <= 100) { 
            
            if (a != b && b != c && c != a) {

                System.out.println("3");
            } else if (a == b && b == c && c == a) {

                System.out.println("1");

            } else if (a == b || b == c || c == a) {

                System.out.println("2");
            }
        }

    }

}


Measured memory_bytes: 23124
#include <iostream>
#include <vector>
#include <cstring>

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

using namespace std;

int a[16][16];
int count = 0;
int n,m;

void dfs(int y,int x)
{
	if(a[y][x] == 0)
	{

		if(y == m-1)
		{
			count++;
			return;
		}
		if(x-1 >= 0 && y+1 < m)
		{
			if(a[y+1][x-1] != 2)
			{
				dfs(y+1,x-1);
			}
		}
		if(y+1 < m)
		{
			dfs(y+1,x);
		}
		if(x+1 < n && y+1 < m)
		{
			if(a[y+1][x+1] != 2)
			{
				dfs(y+1,x+1);
			}
		}
		return;
	}
	else if(a[y][x] == 1)
	{
		return;
	}
	else if(a[y][x] == 2)
	{
		if(y == m-2 || y == m-1)
		{
			count++;
			return;
		}
		else
		{
			dfs(y+2,x);
		}
	}
}

int main()
{
	while(cin >> n >> m)
	{
		if(n == 0 && m == 0)
		{
			break;
		}

		memset(a,0,sizeof(a));
		rep(i,m)
		{
			rep(j,n)
			{
				cin >> a[i][j];
			}
		}
		count = 0;
		rep(i,n) dfs(0,i);

		cout << count << endl;
	}
	return 0;
}

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

using namespace std;

const int OO = 1e9;
const double EPS = 1e-9;

#define ndl cout << '\n'
#define sz(v) int(v.size())
#define pb push_back
#define mp make_pair
#define fs first
#define sc second
#define present(a, x) (a.find(x) != a.end())
#ifdef LOCAL
#define db(...) ({cout << "> Line " << __LINE__  \
		<< ": "; _db(#__VA_ARGS__, __VA_ARGS__);})
#define RNG() rng()
#else
#define db(...) true
#define RNG() true
#endif

template<class T>
void _db(const char *dbStr, T e) {
	cout << dbStr << " = " << e << endl;
}
template<class T, class... L>
void _db(const char *dbStr, T e, L... r) {
  while(*dbStr != ',') cout << *dbStr++;
  cout << " = " << e << ','; _db(dbStr + 1, r...);
}
template<class S, class T>
ostream& operator<<(ostream& o, const map<S, T>& v) {
	o << "["; int i = 0;
	for (const pair<S, T>& pr : v) o << (!i++ ? "" : ", ") << "{"
	<< pr.fs << " : " << pr.sc << "}"; return o << "]";
}
template<template <class, class...> class S, class T, class... L>
ostream& operator<<(ostream& o, const S<T, L...>& v) {
	o << "["; int i = 0;
	for (const auto& e : v) o << (!i++ ? "" : ", ") << e;
	return o << "]";
}
template<class S, class T>
ostream& operator<<(ostream& o, const pair<S, T>& pr) {
	return o << "(" << pr.fs << ", " << pr.sc << ")";
}
ostream& operator<<(ostream& o, const string& s) {
	for (const char& c : s) o << c;
	return o;
}

template<class T> using V = vector<T>;
template<class T> using VV = V<V<T>>;
template<class T> using VVV = VV<V<T>>;
using ll = long long;
using pii = pair<int, int>;
using vi = V<int>;
using vii = V<pii>;
using vvi = VV<int>;
using mii = map<int, int>;
using umii = unordered_map<int, int>;
using si = set<int>;
using usi = unordered_set<int>;

const int MX = 705;
int N, M, mem[MX][MX << 1];
VV<bool> adj;
vi color;
vi moves;
int cnt[2];

int dp(int idx, int diff) {
	if (idx == sz(moves)) {
		int i = (N + diff) / 2, j = N - i;
		return i * (i - 1) / 2 + j * (j - 1) / 2;
	}
	int& ret = mem[idx][diff + N];
	if (ret != -1)
		return ret;
	return ret = min(dp(idx + 1, diff + moves[idx]), dp(idx + 1, diff - moves[idx]));
}

void dfs(int u, int clr) {
	db(u, clr);
	++cnt[clr];
	color[u] = clr;

	for (int v = 1; v <= N; ++v) {
		if (u == v || !adj[u][v])
			continue;
		if (color[v] == color[u]) {
			cout << "-1\n";
			exit(0);
		}
		if (color[v] == -1)
			dfs(v, !clr);
	}
}

int main() {
	#ifdef LOCAL
	auto stTime = clock();
//	freopen("in.txt", "r", stdin);
	mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
	#endif
	ios::sync_with_stdio(false);
	cout.precision(10);
	cin.tie(0);

	cin >> N >> M;

	adj.assign(N + 1, V<bool>(N + 1, 1));

	for (int i = 1; i <= M; ++i) {
		int u, v;
		cin >> u >> v;
		adj[u][v] = adj[v][u] = 0;
	}


	color.assign(N + 1, -1);

	for (int i = 1; i <= N; ++i) {
		if (color[i] == -1) {
			cnt[0] = cnt[1] = 0;
			dfs(i, 0);
			moves.pb(cnt[0] - cnt[1]);
		}
	}

	memset(mem, -1, sizeof(mem));

	cout << dp(0, 0) << '\n';

	#ifdef LOCAL
	cout << "\n\n\nExecution time: " <<
		(clock() - stTime) * 1e3 / CLOCKS_PER_SEC << " ms" << endl;
	#endif
	return 0;
}


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

int main(){
int x=0;
int p[100]={};
int n=0;
int dist=1000;
int ans=0;
int z[102]={};
for(int i=0;i<102;i++){
    z[i]=i;
}
scanf("%d %d",&x,&n);

if(n!=0){
for(int i=0;i<n;i++){
    scanf("%d",&p[i]);
z[p[i]]=10000;
}
}
if(n==100){
    if(x<51){
        ans=0;
    }else{
        ans=101;
    }

}else{
for(int i=0;i<102;i++){
    if(dist>=abs(x-z[i])){
        if(dist==abs(x-z[i])){
            if(ans<z[i]){
                z[i]=ans;
            }
        }
        dist=abs(x-z[i]);
        ans=z[i];
    }
}
}

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

return 0;

}

Measured memory_bytes: 1732
#include <bits/stdc++.h>
using namespace std;
const int INF = 1000000007;
 
int main(){
  cin.tie(nullptr);
  ios::sync_with_stdio(false);

  int N;
  cin >> N;
  string S;
  cin >> S;
  int countE[N] = {};
  for(int i=0;i<N;i++){
    if(i == 0){
      if(S[0] == 'E'){
        countE[0] = 1;
      }
      else{
        countE[0] = 0;
      }
    }
    else if(S[i] == 'E'){
      countE[i] = countE[i-1] + 1;
    }
    else{
      countE[i] = countE[i-1];
    }
  }
  int countW[N] = {};
  for(int i=N-1;i>=0;i--){
    if(i == N-1){
      if(S[N-1] == 'W'){
        countW[N-1] = 1;
      } 
      else{
        countW[N-1] = 0;
      }
    }
    else if(S[i] == 'W'){
      countW[i] = countW[i+1] + 1;
    }
    else{
      countW[i] = countW[i+1];
    }
  }
  int ans = 0;
  for(int i=0;i<N;i++){
    ans = max(ans, countE[i] + countW[i]);
  }
  cout << N - ans << endl;
}

Measured memory_bytes: 2964
import java.util.Scanner;
public class Main
{
  public static void main(String args[])
  {
    Scanner sc=new Scanner(System.in);
    String str=sc.next();
    String ans="";
    for(int i=0;i<str.length();i++)
    {
      char ch=str.charAt(i);
      if(ans.length()!=0 && ch=='B')
        ans=ans.substring(0,ans.length()-1);
      else if(ch=='0')
        ans=ans+"0";
      else if(ch=='1')
        ans=ans+"1";
    }
    System.out.println(ans);
  }
}

Measured memory_bytes: 21460
#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <string>
#include <cmath>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <set>

using namespace std;

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define SORT(c) sort((c).begin(), (c).end())
#define INF (ll)1e18
#define MOD (ll)1e9 + 7
#define pb push_back

typedef long long ll;
typedef long long int llt;
typedef pair<int, int> P;
typedef vector<int> V;
typedef map<int, int> M;

int main(void){
    cin.tie(0);
   	ios::sync_with_stdio(false);
    int k, s;
    cin >> k >> s;
    int cnt = 0;
    for (int x = 0; x <= k;x++){
        for (int y = 0; y <= k;y++){
            int z = s - x - y;
            if(0<=z&&z<=k)
                cnt++;
        }
    }
        cout << cnt << endl;
    return 0;
}

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

using namespace std;

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

#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)

const ll MOD = 1000000007;
const ll INF = (ll) 1e15;

ll solve(ll n) {
    ll x = 1;
    ll ret = 0;
    while (true) {
        if (x * x > n)
            break;
        ll y = 1;
        while (true) {
            if (x * x + y * y + x * y > n)
                break;
            ll z = 1;
            while (true) {
                ll s = x * x + y * y + z * z + x * y + y * z + z * x;

                if (s > n)
                    break;
                if (s == n)
                    ret++;
                z++;
            }
            y++;
        }
        x++;
    }
    return ret;
}

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

    REP(i, N) {
        cout << solve(i + 1) << endl;
    }
    return 0;
}

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

const double PI = 3.14159265358979323846;
//using namespace boost::multiprecision;
using namespace std;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 1e15;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

std::istream &operator>>(std::istream &in, set<int> &o) {
    ll a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
//const ll mod = 1e10;
typedef priority_queue<long long, vector<long long>, greater<long long> > PQ_ASK;

int main() {
    int n, m;
    cin >> n >> m;
    vector<int> count(n, 0);
    rep(i, m) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        count[a]++;
        count[b]++;
    }

    for (int i : count)
        if (i % 2 == 1) {
            cout << "NO" << endl;
            ret();
        }

    cout << "YES" << endl;
}

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

int main()
{
    long n,ans=0;
    cin >>n;
    
    for(int i=1;i<=n;i++){
        for(int j=1;j<=n;j++){
            for(int k=1;k<=n;k++){
                ans+= __gcd(i, __gcd(j,k));
            }
        }
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 3636
#include <bits/stdc++.h>
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define SORTR(v,n) sort(v, v+n, greater<int>());
#define SORTPairSecond(v, n) sort(v, v+n, pairCompareSecond);
#define int long long    // %d=>%lld, 1<<n  => 1LL<<n
#define pb push_back

using namespace std;
typedef long long ll;

typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, pii> piii;
typedef pair<ll, pll> plll;
bool pairCompareSecond(const pii& firstEl, const pii& secondEl) {
    return firstEl.second > secondEl.second;
}

const ll MOD = 1000000007;
const int INF = 1000000007;
// const int INF = 0x3f3f3f3f;
const ll LLINF = 0x3f3f3f3f3f3f3f3f;
// const ll LLINF = 1LL << 50;
const double PI = acos(-1);
const double EPS = 0.000000001;


double n, y;

signed main(){
    ios::sync_with_stdio(0);
    cin >> n >>  y;

    if( n*10000<y || n*1000>y){
        cout<< "-1 -1 -1"<< endl;
        return 0;
    }

    for(int i = 0;i < n+1;i++){
        for(int j = 0;j < n-i+1;j++){
            if((y-i* 10000-j* 5000)/1000.0 == n-i-j){
                cout<< i<< " "<< j<< " "<< n-i-j<< endl;
                return 0;
            }
        }
    }


    cout<< "-1 -1 -1"<< endl;

    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
#define pb push_back
#define fr(i,n) for(int i=0;i<n;i++)
#define Fr(i,n) for(int i=0;i++<n;)
#define ifr(i,n) for(int i=n-1;i>=0;i--)
#define iFr(i,n) for(int i=n;i>0;i--)

ll n,MOD,x,y,dp[100010]={},ans[100010]={},p[100010][2]={};
vector<ll> v[100010]={},fR[100010]={},bk[100010]={};
bool f[100010][2]={},vis[100010]={};

ll ad(ll x,ll y=0){
  return (x+y)%MOD;
}

ll mlt(ll x,ll y=1){
  return (x*y)%MOD;
}

void dfs(ll i=1){
  dp[i]=1;
  ll k=0;
  for(auto it=v[i].begin();it!=v[i].end();it++){
    if(*it!=p[i][0]){
      p[*it][0]=i;
      p[*it][1]=k++;
      dfs(*it);
      dp[i]=mlt(dp[i],ad(dp[*it],1));
    }
  }
}

void slv(ll i=1,ll pre=0){
  ans[i]=1;
  //cout<<i<<" "<<pre<<endl;
  if(i>1){
    ll kari=pre;
    kari=mlt(kari,fR[p[i][0]][p[i][1]]);
    kari=mlt(kari,bk[p[i][0]][p[i][1]+1]);
    //cout<<i<<" "<<kari<<endl;
    //cout<<p[i][0]<<" "<<p[i][1]<<endl;
    ans[i]=mlt(ans[i],ad(kari,1));
  }
  ll k=0;
  for(auto it=v[i].begin();it!=v[i].end();it++) if(*it!=p[i][0]) k++;
  fR[i].resize(k+1);
  fR[i][0]=1;k=0;
  for(auto it=v[i].begin();it!=v[i].end();it++){
    if(*it!=p[i][0]){
      fR[i][k+1]=mlt(fR[i][k],ad(1,dp[*it]));
      k++;
    }
  }
  bk[i].resize(k+1);
  bk[i][k]=1;
  for(auto it=v[i].end();it--!=v[i].begin();){
    if(*it!=p[i][0]){
      bk[i][k-1]=mlt(bk[i][k],ad(1+dp[*it]));
      k--;
    }
  }
  for(auto it=v[i].begin();it!=v[i].end();it++) if(*it!=p[i][0]) slv(*it,ans[i]);
  ans[i]=mlt(ans[i],dp[i]);
}

int main(){
  cin>>n>>MOD;
  Fr(i,n-1){cin>>x>>y;v[x].pb(y);v[y].pb(x);}
  dfs();
  slv();
  Fr(i,n) cout<<ans[i]<<endl;
  //fr(i,2) cout<<fR[2][i]<<endl;
}

Measured memory_bytes: 25344
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n)  for(long long i=0;i<(long long)(n);i++)
#define REP(i,k,n) for(long long i=k;i<(long long)(n);i++)
#define all(a) a.begin(),a.end()
#define pb push_back
#define eb emplace_back
#define lb(v,k) (lower_bound(all(v),k)-v.begin())
#define ub(v,k) (upper_bound(all(v),k)-v.begin())
#define fi first
#define se second
typedef long long ll;
typedef pair<ll,ll> P;
typedef tuple<ll,ll,ll> PP;
typedef multiset<ll> S;
typedef priority_queue<ll> PQ;
typedef priority_queue<P,vector<P>,greater<P>> SPQ;
using vi=vector<ll>;
using vvi=vector<vi>;
using vvvi=vector<vvi>;
const ll inf=1001001001001001;
const int INF=1001001001;
const int mod=1000000007;
const double pi=3.14159265358979323846;
template<class T> bool chmin(T&a,T b){if(a>b){a=b;return true;}return false;}
template<class T> bool chmax(T&a,T b){if(a<b){a=b;return true;}return false;}
template<class T> void out(T a){cout<<a<<endl;}
template<class T> void outp(T a){cout<<'('<<a.fi<<','<<a.se<<')'<<endl;}
template<class T> void outvp(T v){rep(i,v.size())outp(v[i]);}
template<class T> void outv(T v){rep(i,v.size()){if(i)cout<<' ';cout<<v[i];}cout<<endl;}
template<class T> void outvv(T v){rep(i,v.size()){rep(j,v[i].size()){if(j)cout<<' ';cout<<v[i][j];}cout<<endl;}}
int main(){
    ll n;cin>>n;
    cout<<180*(n-2)<<endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef int Int;
typedef pair<Int, Int> pii;
typedef pair<Int, double> pid;
typedef pair<double, double> pdd;
typedef pair<Int, pii> pip;
typedef pair<pii, Int> ppi;
typedef pair<double, Int> pdp;
typedef vector<Int> veci;
typedef vector<double> vecd;
typedef vector<int> veci;
typedef vector<ll> vecll;
typedef vector<double> vecd;
typedef vector<pii> vecpii;
typedef vector<ppi> vecppi;
typedef vector<veci> mati;
typedef vector<vecll> matll;
typedef vector<vecd> matd;
#define PB(x) push_back(x)
#define EB(x) emplace_back(x)
#define ALL(x) x.begin(),x.end()
#define SZ(x) (x).size()
#define CLR(x) memset(x,0,sizeof x)
#define pdebug() printf("%d\n",__LINE__)
#define REP(i, a, b) for(int i = (a);i <= (b);i++)
#define FORO(i, n) REP(i,0,(int)n-1)
#define FORI(i, n) REP(i,1,(int)n)
#define FORIT(i, t) for(auto i = t.begin();i != t.end();i++)
#define eps 1e-6
#define sqr(x) ((x)*(x))
#define dist(_a, _b) sqrt(sqr(_a.A-_b.A)+sqr(_a.B-_b.B))
#define norm(_a) sqrt(sqr(_a.A)+sqr(_a.B))
#define DEBUG 1
#if DEBUG
#define DUMP(a) do { std::cout << #a " = " << (a) << ", "; } while(false)
#define DUMPLN(a) do { std::cout << #a " = " << (a) << std::endl; } while(false)
#else
#define DUMP(a)
#define DUMPLN(a)
#endif
template<typename T, typename U>
inline void getMin(T &a, U b) { if (a > b) a = b; }
template<typename T, typename U>
inline void getMax(T &a, U b) { if (a < b) a = b; }
template<typename T>
vector<T> getVector(const int n) { return vector<T>(n); }
template<typename T>
vector<T> getVector(const int n, const T a) { return vector<T>(n, a); }
template<typename T>
vector<T> getEmptyVector() { return vector<T>(); }
template<typename T>
void appendAll(vector<T> &a, vector<T> b) { a.insert(a.end(), b.begin(), b.end()); }
template <class T1, class T2> ostream &operator<<(ostream &os, const pair<T1, T2> &a) { return os << "(" << a.first << ", " << a.second << ")"; };
// #define X first
// #define Y second
const int dx[4] = {1, -1, 0, 0};
const int dy[4] = {0, 0, 1, -1};
const ll MOD = 1000000007;
const int MAXN = 1 << 17;
const int inf = 1 << 27;
const ll llinf = 1LL << 50;
const int NIL = -inf;
int popcount(int x) { return __builtin_popcount(x); }

ll solve() {
    ll X, K, D;
    cin >> X >> K >> D;
    X = abs(X);
    if(X / D > K) return X - K * D;
    K -= (X / D);
    X -= (X / D) * D;
    if(K == 0) return X;
    return K % 2LL ? abs(X - D) : X;
}

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

    cout << solve() << endl;

    return 0;
}


Measured memory_bytes: 3648
n, a, b = map(int, input().split())
if (abs(a - b) % 2) == 0:
    print(abs(a - b) // 2)
else:
    a, b = min(a, b), max(a, b)
    ans1 = a - 1
    if b - a == 1:
        ans1 += 1
    else:
        ans1 += (b - a) // 2 + 1
    ans2 = n - b
    if b - a == 1:
        ans2 += 1
    else:
        ans2 += (n - (a + (n - b) + 1)) // 2 + 1
    print(min(ans1, ans2))

Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;

namespace AtCoder.A
{
    public class Program
    {
        public static void Main() { var r = GetResult(); Debug.WriteLine(r); Console.Write(r); }

        private static object GetResult()
        {
            var a = ReadLong();
            var s = ReadText();

            return a < 3200 ? "red" : s;
        }

        #region Console

        public static string ReadText() { return Console.ReadLine(); }
        public static List<string> ReadTexts() { return Console.ReadLine().Split(' ').ToList(); }
        public static long ReadLong() { return long.Parse(Console.ReadLine()); }
        public static List<long> ReadLongs() { return Console.ReadLine().Split(' ').Select(x => long.Parse(x)).ToList(); }

        #endregion
    }
}


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


int main(){
	cout<< setprecision(3) <<setiosflags(ios::fixed);

	
	double a,b,c,d,e,f;
	while(cin >> a,cin>>b,cin>>c,cin>>d,cin>>e,cin>>f){
	
	  cout<<(c*e-f*b)/(a*e-d*b)+0.0000001<<" "<< (c*d-f*a)/(b*d-a*e)+0.00000001<<'\n';
	}
	return 0;
	  
}

Measured memory_bytes: 1284
#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<math.h>
#include<map>
#include<set>
#include<bitset>
#include<vector>
#include<stack>
#include<queue>
#include<functional>
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
//Library
/*Union-Find木
int par[1000010], rankh[1000010];
void init(int n) {
	for (int i = 0; i <= n; i++) {
		par[i] = i;
		rankh[i] = 0;
	}
}
int find(int x) {
	if (par[x] == x)return x;
	else return par[x] = find(par[x]);
}
void unite(int x, int y) {
	x = find(x);
	y = find(y);
	if (x == y)return;
	if (rankh[x] < rankh[y])par[x] = y;
	else {
		par[y] = x;
		if (rankh[x] == rankh[y])rankh[x]++;
	}
}
bool same(int x, int y) {
	return find(x) == find(y);
}
template<typename t>
t GCD(t a, t b) {
	while (max(a, b) % min(a, b)) {
		if (a > b)a %= b;
		else b %= a;
	}
	return min(a, b);
}
Union-Find木end*/
//Library end
int main() {
	string s, p;
	cin >> s >> p;
	s = s + s;
	for (int i = 0; i < s.size() - p.size(); i++) {
		if (s.substr(i, p.size()) == p) {
			cout << "Yes" << endl;
			return 0;
		}
	}
	cout << "No" << endl;
	return 0;
}


Measured memory_bytes: 3188
a,b,c,x,y=map(int,input().split())
if 2*c>=a+b:
  print(a*x+b*y)
else:
  if 2*c<=a:
    if x>=y:
      print(2*x*c)
    else:
      if 2*c<=b:
        print(2*y*c)
      else:
        print(2*x*c+(y-x)*b)
  elif 2*c<=b:
    if y>=x:
      print(2*y*c)
    else:
      if 2*c<=a:
        print(2*x*c)
      else:
        print(2*y*c+(x-y)*a)
  else:
    if x<=y:
      print(2*c*x+(y-x)*b)
    else:
      print(2*c*y+(x-y)*a)

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

using namespace std;

int n, a, b;

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

    cin >> n >> a >> b;

    if (a <= b) {
        cout << max(0ll, (long long)(n - 2) * (long long)(b - a) + 1ll) << endl;
    } else {
        cout << 0 << endl;
    }

    return 0;
}


Measured memory_bytes: 256
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

A, B, C = map(int, input().split())

print(A if B == C else B if A == C else C)

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

using namespace std;

/*

        Bismillahir Rahmanir Rahim
        Problem :
        Problem Link :
        Topics :
        Solver : Masud Parves
        I Love Code More than Sharks Love Blood <3
*/


#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define SZ(a)           (int)a.size()
#define all(a)  a.begin(), a.end()
#define allr(a)  a.rbegin(), a.rend()


#define sf(a)           scanf("%d",&a)
#define sff(a,b)        scanf("%d %d",&a,&b)
#define sfff(a,b,c)     scanf("%d %d %d",&a,&b,&c)

#define f0(i,b) for(int i=0;i<(b);i++)
#define f1(i,b) for(int i=1;i<=(b);i++)
#define f2(i,a,b) for(int i=(a);i<=(b);i++)
#define fr(i,b,a) for(int i=(b);i>=(a);i--)

#define CIN ios_base::sync_with_stdio(0); cin.tie(NULL); cout.tie(NULL);
#define TEST_CASE(t) for(int zz=1 ; zz<=t ; zz++)
#define PRINT_CASE printf("Case %d: ",zz)
#define Debug(x)            cout<<#x " = "<<(x)<<endl
#define NOT_VISITED 0
#define IS_VISITED 1
#define WHITE 0
#define GRAY 1
#define BLACK 2



int fx[4]= {1,-1,0,0};
int fy[4]= {0,0,1,-1};

/*-----------------------Bitmask------------------*/
//int Set(int N,int pos){return N=N  (1<<pos);}
//int Reset(int N,int pos){return N= N & ~(1<<pos);}
//bool Check(int N,int pos){return (bool)(N & (1<<pos));}
/*------------------------------------------------*/


const double PI = acos(-1.0);
const double EPS = 1e-6;
const int MOD = (int)1e9+7;
const int maxn = (int)2e5+5;

typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef pair<ll, int> plli;
typedef pair<int, ll> pill;


int main() {
    CIN
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);

    ll S,C;
    cin >> S >> C;

    ll total=0LL;

    if(C>=S*2){
        total += S;
        ll rem = C-S*2;
        total+=rem/4;
    }else {
        total = C/2;
    }

    cout << total << endl;

    return 0;
}



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

public class Main {
	public static void main(String[] args) {
		 try {
		 BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
		
		 String x;
			x = buf.readLine();
		 int y = Integer.parseInt(x);
		int z = y*y*y;
		System.out.println(z);
			} catch (IOException e) {
				// TODO ????????????????????? catch ????????????
				e.printStackTrace();
			}
    }
}

Measured memory_bytes: 24288
#include<bits/stdc++.h>
using namespace std;
#define se second
#define fi first
#define ld long double
#define mod 998244353

int main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    setprecision(10);
    int n;
    cin>>n;
    ld pro=1.00000,deno;
    vector<ld > arr(n);
    for(int i=0;i<n;i++){
        cin>>arr[i];
        pro*=arr[i];
    }
    deno=pro;
    ld sum=0;
    for(int i=0;i<n;i++){
        setprecision(10);
        sum+=(deno/arr[i]);
    }
    pro/=sum;
    cout<<setprecision(16)<<pro;
    return 0;
}


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

int main() {
  ll x; cin >> x;
  ll a = 100;
  ll b = 0;
  while(a<x){
    a+=a/100;
    b++;
  }
  cout << b << endl;
  return 0;
}

Measured memory_bytes: 3632
#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;



vector<vector<ll>> dp;
vector<vector<ll>> edge;
vector<ll> A;

void merge(ll p,ll c){
    vector<ll> &ret=dp[p],&child=dp[c];
    vector<ll> P=dp[p];
    ret.resize(P.size()+child.size()-1);
    for(auto &i:ret){i=0;}
    for(int i=1;i<P.size();i++){
        for(int t=1;t<child.size();t++){
            ret[i+t]+=P[i]*child[t]%MOD;
            ret[i+t]%=MOD;
        }
    }
    for(int i=1;i<P.size();i++){
        ret[i]-=P[i]*child[0]%MOD;
        ret[i]%=MOD;
    }
    for(int i=1;i<ret.size();i++){ret[0]+=ret[i]*A[i]%MOD;}
    ret[0]%=MOD;
    if(ret[0]<0){ret[0]+=MOD;}
}

void dfs(ll w,ll p){
    dp[w]={0,1};
    for(auto &i:edge[w]){
        if(i==p){continue;}
        dfs(i,w);
        merge(w,i);
    }
}



int main(){
    ll n;
    cin>>n;
    A.resize(n+10,0);
    A[0]=1;
    for(int i=2;i<n+10;i++){
        A[i]=A[i-2]*(i-1);
        A[i]%=MOD;
    }
    edge.resize(n);
    dp.resize(n);
    for(int i=1;i<n;i++){
        ll x,y;
        cin>>x>>y;
        x--; y--;
        edge[x].push_back(y);
        edge[y].push_back(x);
    }
    dfs(0,-1);
    /*
    dp[0][0]%=MOD;
    if(dp[0][0]<0){dp[0][0]+=MOD;}
     */
    cout<<dp[0][0]<<endl;
    
    
    
    return 0;
}


Measured memory_bytes: 69376
#include<iostream>
#include<vector>

using namespace std;

vector<vector<int> > to;
vector<int> id;

void dfs(int nodeid,int treeid)
{
	id[nodeid]=treeid;
	for(int i=0;i<to[nodeid].size();i++)
	{
		int nxid=to[nodeid][i];
		if(id[nxid]==-1)dfs(nxid,treeid);
	}
}

int main()
{
	int n,m;
	cin >> n >> m;
	
	to=vector<vector<int> >(n);
	id=vector<int>(n,-1);
	
	for(int i=0;i<m;i++)
	{
		int x,y,z;
		cin >> x >> y >> z;
		x--;y--;
		to[x].push_back(y);
		to[y].push_back(x);
	}
	
	int ans=0;

	for(int i=0;i<n;i++)
	{
		if(id[i]==-1)
		{	
			ans++;
			dfs(i,ans);
		}
	}

	cout << ans << endl;

}


Measured memory_bytes: 9216
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <functional>
#include <queue>
#include <string>
#include <cstring>
#include <numeric>
#include <cstdlib>
#include <cmath>
using namespace std;

typedef long long ll;

#define INF 10e17 // 4倍しても(4回足しても)long longを溢れない
#define rep(i,n) for(int i=0; i<n; i++)
#define rep_r(i,n,m) for(int i=m; i<n; i++)
#define END cout << endl
#define MOD 1000000007
#define pb push_back
#define sorti(x) sort(x.begin(), x.end())
#define sortd(x) sort(x.begin(), x.end(), std::greater<int>())

int main() {
    int a,b,c;
    cin >> a >> b >> c;
    if (a == b and b == c and a == c) {
      cout << "Yes" << endl;

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


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<numeric>
#include<map>
#include<unordered_map>
#include<queue>
#include<deque>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()

#define MOD 1000000007

int main(){
    ll n;
    cin >> n;
    string s;
    cin >> s;
    
    ll ans = 0;
    rep(i, 10)rep(j, 10)rep(k, 10){
        string pas = "";
        pas+='0'+i;
        pas+='0'+j;
        pas+='0'+k;
        ll pos = 0;
        rep(l, n)if(s[l]==pas[pos])pos++;
        if(pos>=3)ans++;
    }
    cout  << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
int ans;
int main(void){
    string s; cin>>s;
    if(s.size()%2==0){
        for(int i=0;i<s.size()/2;i++){
            if(s[i]!=s[s.size()-1-i]) ans++;
        }
    }else{
        for(int i=0;i<s.size()/2;i++){
            if(s[i]!=s[s.size()-1-i]) ans++;
        }
    }
    cout<<ans<<endl;

}


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

int main()
{
  int strong[] = {0, 13, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
  int A, B;
  cin >> A >> B;
  if (strong[A] < strong[B])
    cout << "Bob";
  else if (strong[B] < strong[A])
    cout << "Alice";
  else
    cout << "Draw";
  return 0;
}


Measured memory_bytes: 256
#include <stdio.h>

int main()
{
 int N=0;
 char S[100005];
 int i;
 int zeros=0;
 int ones=0;
 int out;

 scanf("%s",&S);
 for(i=0;i<100005;i++)
 {
  if(S[i]=='0') 
  {
   zeros++;
   N++;
  }else if(S[i]=='1')
  {
   ones++;
   N++;
  }else{
   break;
  }
 }
 out=ones;
 if(ones>zeros) out=zeros;
 out=out*2;
 printf("%d\n",out);
 return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <algorithm>
#include <iostream>
#include <stdio.h>
#include <math.h>
typedef long long ll;
using namespace std;

int main() {
	ll n,k,a,ans=0;
	cin>>n>>k;
	for(int i=0;i<n;i++){
		cin>>a;
		ans+=min(a,k-a);
	}
	cout << ans*2<<endl;
	return 0;
}


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

const long double EPS = 1e-10;
const long long INF = 1e18;
const int MOD = (int)1e9 + 7;
const long double PI = acos(-1.0L);

int main() {  // TODO
  int n;
  cin >> n;
  vector<int> a(n + 1);
  rep(i, n) cin >> a[i + 1];
  int ans = 0;
  int e = 1;
  int i = 1;
  while (i <= n) {
    if (a[i] == e) {
      i++;
      e++;
    } else {
      i++;
      ans++;
    }
  }
  if (e == 1) {
    cout << -1 << endl;
  } else {
    cout << ans << endl;
  }

  return 0;
}

Measured memory_bytes: 4044
#include <bits/stdc++.h>
using namespace std;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n,a;cin>>n;
    int dp[n];fill(dp,dp+n,(int)2e9);
    for(int i=0;i<n;i++){cin>>a; *lower_bound(dp,dp+n,a)=a;}
    cout<<lower_bound(dp,dp+n,(int)2e9)-dp<<endl;
}


Measured memory_bytes: 3560
#include <stdio.h>
 
int main(){
    long long int x;
    scanf("%lld",&x);
 
    char name[100];
    int i=0;
    
    while(x!=0){
        x--;
        int b = x%26;
        name[i] ='a'+ b;
        x/=26;
        i++;
    }
 
    for(int k=i-1;k>=0;k--){
        printf("%c",name[k]);
    }
    
    return 0;
}

Measured memory_bytes: 1620
#include <bits/stdc++.h>
using namespace std;
#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge {c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define imie(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

const int nax = 2e5 + 5;
char sl[nax];

int dp[1<<26];
const int inf = 1e9 + 5;

int main() {
	for(int i = 0; i < (1 << 26); ++i)
		dp[i] = inf;
	dp[0] = 0;
	scanf("%s", sl);
	int n = strlen(sl);
	int mask = 0;
	for(int ii = 0; ii < n; ++ii) {
		char ch = sl[ii];
		mask ^= (1 << (ch - 'a'));
		//~ dp[mask]++;
		for(int x = 0; x < 26; ++x) {
			if(x < 3) debug() << imie(mask ^ (1 << x)) imie(dp[mask^(1<<x)]);
			dp[mask] = min(dp[mask], dp[mask^(1<<x)] + 1);
		}
		debug() << imie(mask) imie(dp[mask]);
	}
	printf("%d\n", max(1, dp[mask]));
}


Measured memory_bytes: 262528
#include<bits/stdc++.h>
using namespace std;
int main()
{
    char s[3];
    int i,count1=0,count2=0,len=0;
    cin>>s;
    len=strlen(s);
    for(i=0;i<len;i++)
    {
        if(s[i]=='A')
        count1++;
        else
        count2++;
    }
    if((count1==3)||(count2==3))
    cout<<"No";
    else
    cout<<"Yes";
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define ff first
#define ss second
#define quick                    \
    ios::sync_with_stdio(false); \
    cin.tie(0);
#define time cerr << (0.1 * clock()) / CLOCKS_PER_SEC << endl;
#define mod 1000000007
typedef long long ll;
typedef pair<ll, ll> pl;
#define forn(n) for (ll i = 0; i < ll(n); i++)

void solve() {
    string s;
    cin >> s;
    int n = s.length();
    vector<int> vr(n), vl(n);
    for (int i = 0; i < n; ++i) {
        if (s[i] == 'R') {
            vr[i] = i;
        } else {
            vr[i] = vr[i - 1];
        }
    }
    vl[n - 1] = n - 1;
    for (int i = n - 1; i >= 0; --i) {
        if (s[i] == 'L') {
            vl[i] = i;
        } else {
            vl[i] = vl[i + 1];
        }
    }
    vector<int> ans(n);
    for (int i = 0; i < n; ++i) {
        if (s[i] == 'R') {
            int dis = (vl[i] - i - 1) % 2;
            ans[vl[i] + dis - 1]++;
        } else {
            int dis = (i - vr[i] - 1) % 2;
            ans[vr[i] + 1 - dis]++;
        }
    }
    for (auto i : ans) {
        cout << i << " ";
    }
    cout << '\n';
}

int main() {
    quick;
    solve();
    // ll t;
    // cin >> t;
    // while (t--) {
    //     solve();
    // }
}

Measured memory_bytes: 4456
#include<iostream>
#include<algorithm>
using namespace std;
 
int b[1000];
 
int main(){
    int y[2][6];
    int x[6][6]={{0,3,5,2,4,0},{4,0,1,6,0,3},{2,6,0,0,1,5},{5,1,0,0,6,2},{3,0,6,1,0,4},{0,4,2,5,3,0}};
    int a[6];
    int MAX;
    
    for(int i=0;i<2;i++){
        for(int j=0;j<6;j++){
            cin>>y[i][j];
            b[y[i][j]] ++;
        }
    }
    for(int i=0;i<1000;i++){
        MAX=max(MAX,b[i]);
    }
    if(MAX>=6){
        cout<<"Yes"<<endl;
        goto Exit;
    }
    for(int i=0;i<6;i++){
        for(int j=0;j<6;j++){
            if(y[0][j]==y[1][i]){
                a[i]=j;
            }
        }
    }
    if(x[a[0]][a[1]]==a[2]+1){
        cout<<"Yes"<<endl;
        goto Exit;
    }
    cout<<"No"<<endl;
    Exit:;
    return 0;
}



Measured memory_bytes: 3112
import java.util.*;
import java.lang.*;
import java.math.*;
import java.io.*;

import static java.lang.Math.*;
import static java.util.Arrays.*;

public class Main{

	Scanner sc;

	static final int INF=1<<28;
	static final double EPS=1e-9;

	void run(){
		sc=new Scanner(System.in);
		for(; sc.hasNext();){
			String s=sc.next();
			int[][] a=new int[10][10];
			for(int i=0; i<10; i++)
				a[0][i]=s.charAt(i)-'0';
			for(int j=1; j<10; j++){
				for(int i=0; i<10-j; i++){
					a[j][i]=(a[j-1][i]+a[j-1][i+1])%10;
				}
			}
			println(""+a[9][0]);
		}
		sc.close();
	}

	void print(String s){
		System.out.print(s);
	}

	void println(String s){
		System.out.println(s);
	}

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

Measured memory_bytes: 12000
#include <iostream>
#include <algorithm>
#define MAX 1000000
#define INF (1 << 29)
using namespace std;


int h[MAX];
int dp[MAX];
int N;

void solve() {
	for(int i = 2; i <= N; i++) {
		if(i-1 > 0) {
			dp[i] = min(dp[i], dp[i-1]+abs(h[i]-h[i-1]));
		}
		if(i-2 > 0) {
			dp[i] = min(dp[i], dp[i-2] + abs(h[i]-h[i-2]));
		}
	}
}


int main() {
	cin >> N;
	for(int i = 0; i <= N; i++) {
		if(i > 0) {
			cin >> h[i];
			dp[i] = INF;
		} else {
			h[i] = 0;
			dp[i] = 0;
		}
	}

	dp[1] = 0;
	solve();
	cout << dp[N];
}



Measured memory_bytes: 4736
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

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

  while(true){
	int n, m; cin >> n >> m; if(n == 0 && m == 0) break;
	VI a(n), b(m);
	REP(i,n) cin >> a[i];
	REP(i,m) cin >> b[i];

	int tot1 = accumulate(ALL(a), 0);
	int tot2 = accumulate(ALL(b), 0);
	int sum = 999;
	PII ans;
	REP(i,n) REP(j,m)
	  if(tot1-a[i]+b[j] == tot2-b[j]+a[i])
		if(a[i] + b[j] < sum){
		  ans.first = a[i];
		  ans.second = b[j];
		  sum = a[i] + b[j];
		}
	if(sum != 999)
	  cout << ans.first << " " << ans.second << endl;
	else
	  cout << -1 << endl;
  }
  
  return 0;
}

Measured memory_bytes: 1196
#include<iostream>
#include<string>
#include<vector>
#include<cmath>
using namespace std;

int main() {
    long long a, sum = 1;
    long long n;
    cin >> n;
    bool exceed = false;
    long long max = pow(10, 18);
    for (int i = 0; i < n; i++) {
        cin >> a;
        if (a == 0) {
            cout << 0 << endl;
            return 0;
        }
        else if (exceed == false && a <= max/sum) {
            sum *= a;
        }
        else {
            exceed = true;
        }
    }
    if (exceed) {
        cout << -1 << endl;
    }
    else {
        cout << sum << endl;
    }
    return 0;
}


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


int main(){
    string s ;
    cin >> s ;
    rep(i,s.size()){
        if( s[i] == ',' )cout << ' ';
        else cout << s[i] ;
    }
}

Measured memory_bytes: 256
n = int(input())
S = []
for i in range(n):
    S.append(list(input()))

match = []
for i in range(n):
    if i == 0: match = S[i][:]
    else:
        match_tmp = []
        for j in match:
            for k in range(len(S[i])):
                if j == S[i][k]:
                    match_tmp.append(S[i][k])
                    S[i][k] = "out"
                    break
        match = match_tmp[:]

print("".join(sorted(match)))


Measured memory_bytes: 3064
<?php

fscanf(STDIN, "%d %d", $tax8, $tax10);

$arr8 = [];
$arr10 = [];
for ($i = 1; $i <= 101; ++$i) {
    $arr8[$i] = ceil($i / 0.08);
    $arr10[$i] = ceil($i / 0.1);
}

$min8 = $arr8[$tax8];
$max8 = $arr8[$tax8 + 1] - 1;

$range8 = range($min8, $max8);

$min10 = $arr10[$tax10];
$max10 = $arr10[$tax10 + 1] - 1;
$range10 = range($min10, $max10);

$result = -1;
foreach ($range8 as $var) {
    if (in_array($var, $range10)) {
        $result = $var;
        break;
    }
}

echo $result;


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

int main() {
  int va, vb, vc, x ,y;
  cin >> va >> vb >> vc >> x >> y;

  int sum = INT_MAX;

  for (int i = 0; i < 100001; i++) {
    int su = i * 2 * vc + max(0, x-i) * va + max(0, y-i) * vb;
    if (sum > su) {
      sum = su;
    }
  } 
  cout << sum << endl;
}

Measured memory_bytes: 3600
#include<bits/stdc++.h>
using namespace std;
typedef int64_t ll;
typedef long double ld;
const ll MOD=1000000007;
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define change(a,b) do{ll c=a; a=b; b=c;}while(0)
long long gcd(long long a,long long b){
    ll gcdmax=max(a,b);
    ll gcdmin=min(a,b);
    while(true){
        if(gcdmax%gcdmin==0)break;
        else gcdmax%=gcdmin;
        change(gcdmin,gcdmax);
    }
    return gcdmin;
}
ll powerup(ll N,ll P,ll M){
    if(P==0)return 1;
    else if(P%2==0){
        ll t=powerup(N,P/2,M);
        return t*t%M;
    }
    else return N*powerup(N,P-1,M)%M;
}
int main()
{
  ll A,B,C;
  cin>>A>>B>>C;
  ll X,Y;
  X=4*A*B;
  Y=(C-A-B)*(C-A-B);
  if(C-A-B<0)cout<<"No"<<endl;
  else if(X<Y) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}


Measured memory_bytes: 256
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author TM
 */


#include <bits/stdc++.h>

using namespace std;

class DBrickBreak {
public:
    void solve(std::istream &cin, std::ostream &cout) {
        int64_t n;
        cin >> n;
        vector<int64_t> v(n);
        for (int i = 0; i < n; ++i) {
            cin >> v[i];
        }
        int64_t need = 1;
        int64_t broken = 0;
        for (int i = 0; i < n; ++i) {
            if (need == v[i]) {
                need++;
            } else {
                broken++;
            }
        }
        if (broken != n) {
            cout << broken << endl;
        } else {
            cout << -1 << endl;
        }
    }
};


int main() {
    DBrickBreak solver;
    std::istream &in(std::cin);
    std::ostream &out(std::cout);
    solver.solve(in, out);
    return 0;
}


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

using namespace std;

int arr[100000];
int usedE[100001], usedO[100001];

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

	for(int i = 0; i < n; i++) scanf("%d", &arr[i]);

	for(int i = 0; i < n; i += 2) usedE[arr[i]]++;
	for(int i = 1; i < n; i += 2) usedO[arr[i]]++;

	int maxE;
	int maxE1 = 0, maxE2 = 0;
	for(int i = 0; i < n; i += 2) {
		if(maxE1 <= usedE[arr[i]]) {
			maxE = arr[i];
			maxE2 = maxE1;
			maxE1 = usedE[arr[i]];
			usedE[arr[i]] = -1;
		}
		else if(maxE2 < usedE[arr[i]]) {
			maxE2 = usedE[arr[i]];
		}
			
	}

	int maxO;
	int maxO1 = 0, maxO2 = 0;
	for(int i = 1; i < n; i += 2) {
		if(maxO1 <= usedO[arr[i]]) {
			maxO = arr[i];
			maxO2 = maxO1;
			maxO1 = usedO[arr[i]];
			usedO[arr[i]] = -1;
		}
		else if(maxO2 < usedO[arr[i]]) {
			maxO2 = usedO[arr[i]];
		}
	}

	int ans = -1;
	if(maxE == maxO) {
		//printf("test : %d %d %d %d\n", maxE1, maxE2, maxO1, maxO2);
		ans = min(n - maxE1 - maxO2, n - maxO1 - maxE2);
	}
	else {
		ans = n - maxE1 - maxO1;
	}

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


Measured memory_bytes: 1280
#include<bits/stdc++.h>
using namespace std;
#define inf INT_MAX
#define INF LLONG_MAX
#define ll long long
#define ull unsigned long long
#define M (int)(1e9+7)
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
#define IN(a,n) rep(i,n){ cin>>a[i]; }
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265
#define F first
#define S second
#define PB push_back
#define EB emplace_back
#define int ll
#define vi vector<int>
#define IP pair<int,P>
#define PP pair<P,P>

int n,ma,mb;
int dp[50][510][510];
int a[50],b[50],c[50];

signed main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout<<fixed<<setprecision(20);

  cin>>n>>ma>>mb;
  rep(i,50){
    rep(j,510){
      rep(k,510){
        dp[i][j][k]=inf;
      }
    }
  }

  rep(i,n){
    cin>>a[i]>>b[i]>>c[i];
  }

  dp[0][0][0]=0;
  rep(i,n){
    rep(j,450){
      rep(k,450){
        dp[i+1][j][k]=min(dp[i+1][j][k],dp[i][j][k]);
        if(j+a[i]>400||k+b[i]>400) continue;
        dp[i+1][j+a[i]][k+b[i]]=min(dp[i+1][j+a[i]][k+b[i]],dp[i][j][k]+c[i]);
      }
    }
  }

  int ans=inf;
  FOR(i,1,400){
    if(ma*i>400||mb*i>400) break;
    ans=min(ans,dp[n][ma*i][mb*i]);
  }

  cout<<(ans==inf?-1:ans)<<endl;



}

Measured memory_bytes: 101888
#include <bits/stdc++.h> 
using namespace std; 
char grid[1005][1004];
long long dp[1005][1005];
long long mod = 1e9 + 7;
int main(){
	int n , m;
	cin>>n>>m;
	for(int i = 0; i < n;  i++)
		for(int j =0;  j< m ; j++)	
			cin>>grid[i][j];
	
	if(grid[0][0] =='.')dp[0][0] = 1;
	for(int i = 0; i< n ; i++){
		for(int j=  0; j < m ; j++){
			if(grid[i][j] == '#')continue;
			if(i > 0 && grid[i-1][j] =='.'){
				dp[i][j] +=dp[i-1][j];
			}if(j > 0 && grid[i][j-1]=='.'){
				dp[i][j] += dp[i][j-1];
			}
			dp[i][j]%=mod;
		}
	}
	cout<<(dp[n-1][m-1])%(mod);
	return 0;
}  


Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int,int>
#define pll pair<ll, ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define ppi pair<pii,int>
#define pip pair<int,pii>
#define pdd pair<double, double>
#define f first
#define s second
#define MOD 1000000007
#define mkp make_pair
#define M_PI 3.14159265358979323846
#define FOR(i,l,r) for (int i=l;i<=r;i++)
#define LOR(i,l,r) for (ll i=l;i<=r;i++)
#define FORD(i,r,l) for (int i=r;i>=l;i--)
#define LORD(i,r,l) for (ll i=r;i>=l;i--)
#define INF 1000000000
#define CL(x) memset(x,0,sizeof(x))
#define DEB(x) cout << #x << " : " << x << '\n'
#define ALL(x) x.begin(), x.end()
#define SZ(x) x.size()
#define UI(x) (int)(x-'A')
#define LI(x) (int)(x-'a')
typedef long long ll;

#define MXN 100005
int N,M;
int ans;
bool vis[MXN];
vector<int> G[MXN];

void dfs(int u)
{
    vis[u]=1;
    for(int v : G[u])
    {
        if(!vis[v])dfs(v);
    }
}

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

    cin>>N>>M;
    int a,b,c;
    FOR(i,1,M)
    {
        cin>>a>>b>>c;
        G[a].pb(b);
        G[b].pb(a);
    }
    int Ans=0;
    FOR(i,1,N)
    {
        if(!vis[i])
        {
            Ans++;
            dfs(i);
        }
    }
    cout<<Ans<<'\n';

    return 0;
}


Measured memory_bytes: 8960
n,x,y=map(int,input().split())
ans=[0 for _ in range(n-1)]
x-=1
y-=1

for i in range(n-1):
  for j in range(i+1,n):
    a=j-i
    b=abs(x-i)+1+abs(y-j)


    mn=min(a,b)
    #print(i+1,j+1,a,b,mn)
    ans[mn-1]+=1
    



for x in ans:
  print(x)

#print(ans)


Measured memory_bytes: 3444
S = input()

strs = []

for i in range(2):
    for j in range(2):    
        for k in range(2):    
            for l in range(2):
                s = ''
                s += 'A' if i == 0 else ''
                s += 'KIH'
                s += 'A' if j == 0 else ''
                s += 'B'
                s += 'A' if k == 0 else ''
                s += 'R'
                s += 'A' if l == 0 else ''
                strs.append(s)

if S in strs:
    print('YES')
else:
    print('NO')


Measured memory_bytes: 3064