akhauriyash/Code-Regression huggingface dataset:
/*
このコード、と～おれ!
Be accepted!
∧＿∧　
（｡･ω･｡)つ━☆・*。
⊂　　 ノ 　　　・゜+.
　しーＪ　　　°。+ *´¨)
 　　　　　　　　　.· ´¸.·*´¨) ¸.·*¨)
		  　　　　　　　　　　(¸.·´ (¸.·'* ☆
*/

#include <cstdio>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstring>
#include <vector>
#include <numeric>
#include <iostream>
#include <random>
#include <map>
#include <unordered_map>
#include <queue>
#include <regex>
#include <functional>
#include <complex>
#include <list>
#include <cassert>
#include <iomanip>
#include <set>
/*多倍長整数/cpp_intで宣言
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
*/

//#pragma gcc target ("avx2")
//#pragma gcc optimization ("o3")
//#pragma gcc optimization ("unroll-loops")
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define rep1(i, n) for(int i = 1; i <= (n); ++i)
#define rep2(i, n) for(int i = 2; i < (n); ++i)
#define repr(i, n) for(int i = n; i >= 0; --i)
#define reprm(i, n) for(int i = n - 1; i >= 0; --i)
#define printynl(a) printf(a ? "yes\n" : "no\n")
#define printyn(a) printf(a ? "Yes\n" : "No\n")
#define printYN(a) printf(a ? "YES\n" : "NO\n")
#define printim(a) printf(a ? "possible\n" : "imposible\n")
#define printdb(a) printf("%.50lf\n", a) //少数出力
#define printdbd(a) printf("%.16lf\n", a) //少数出力(桁少なめ)
#define prints(s) printf("%s\n", s.c_str()) //string出力
#define all(x) (x).begin(), (x).end()
#define allsum(a, b, c) ((a + b) * c / 2.0) //等差数列の和、初項,末項,項数
#define pb push_back
#define priq priority_queue
#define rpriq priq<int, vector<int>, greater<int>>
#define deg_to_rad(deg) (((deg)/360.0)*2.0*PI)
#define rad_to_deg(rad) (((rad)/2.0/PI)*360.0)
#define Please return
#define AC 0
#define addf(T) [](T a, T b){return (a + b);}
#define minf(T) [](T a, T b){return min(a, b);}
#define maxf(T) [](T a, T b){return max(a, b);}
#define nopf(T) [](T a){return a;}
#define manhattan_dist(a, b, c, d) (abs(a - c) + abs(b - d)) /*(a, b) から (c, d) のマンハッタン距離 */


using ll = long long;

constexpr int INF = 1073741823;
constexpr int MINF = -1073741823;
constexpr ll LINF = ll(4661686018427387903);
constexpr ll MOD = 1000000007;
const long double PI = acos(-1.0L);

using namespace std;

void scans(string& str) {
	char c;
	str = "";
	scanf("%c", &c);
	if (c == '\n')scanf("%c", &c);
	while (c != '\n' && c != -1 && c != ' ') {
		str += c;
		scanf("%c", &c);
	}
}

void scanc(char& str) {
	char c;
	scanf("%c", &c);
	if (c == -1)return;
	while (c == '\n') {
		scanf("%c", &c);
	}
	str = c;
}

double acot(double x) {
	return PI / 2 - atan(x);
}

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

ll lcm(ll number1, ll number2) {
	return number1 / gcd(number1, number2) * number2;
}

ll LSB(ll n) { return (n & (-n)); }

/*-----------------------------------------ここからコード-----------------------------------------*/



int main() {

	int a, b;
	scanf("%d%d", &a, &b);
	int ans = -1;
	repr(i, 114514) {
		if ((int)(i * 0.08) == a && (int)(i * 0.1) == b)ans = i;
	}
	printf("%d\n", ans);

	Please AC;
}


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

#define FOR(i, a, b) for(int i = (a); i < (b); ++i)
#define REP(i, n) for(int i = 0; i < (n); ++i)
#define REPr(i, n) for(int i = (n)-1; i >= 0; --i)
#define FORq(i, m, n) for(int i = (m); i <= (n); ++i)
#define FORqr(i, m, n) for(int i = (n); i >= (m); --i)
#define MP make_pair
#define SIN(x, S) (S.count(x) != 0)
#define M0(x) memset(x, 0, sizeof(x))
#define FILL(x, y) memset(x, y, sizeof(x))
#define MM(x) memset(x, -1, sizeof(x))
#define ALL(x) (x).begin(), (x).end()
#define DB(x) cerr << #x << " = " << x << endl
#define DB2(x, y)                                                              \
    cerr << "(" << #x << ", " << #y << ") = (" << x << ", " << y << ")\n";
#define DEBUG                                                                  \
    int x12345;                                                                \
    cin >> x12345;
typedef pair<int, int> PII;
typedef pair<long long, long long> PLL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<long long> VL;
typedef long long ll;
typedef long long integer;
///////////////////////////////////////////////
const long long MOD = 1e9 + 7;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}

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

///////////////////////////////////////////////
/// 🍈( '-' 🍈 |AC|

vector<int> par(200002);
vector<VI> child(200002);
vector<int> ans(200002);


int main() {
    int N;
    cin >> N;
    REP(i,200001){
        ans[i] = -1;
    }

    REP(i,N-1){
        cin >> par[2 + i];
        child[par[2 + i]].push_back(2+i);
    }

    for (size_t i = 1; i <= N ; i++) {
        cout << child[i].size() << "\n";
    }
}

Measured memory_bytes: 15608
#include <bits/stdc++.h>
using namespace std;
#define itn int
#define nibu(K,x) binary_search(K.begin(),K.end(),x)
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define sz(x) x.size()
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define out(x) cout<<x<<endl
#define put(x) out(x)
#define in(x) cin>>x
#define maxx(a,b,c) max(a,max(b,c))
#define minn(a,b,c) min(a,min(b,c))
using ll = long long;
using vl = vector<ll>;
using vs = vector<string>;
const double pi = 3.14159265358979;
const ll mod = 1000000007;



int main() {
ll N;
  in(N);
  vl A(N);
  ll ans =101010101010;
  ll sum =0;
  rep(i,N){
    in(A[i]);
    sum += A[i];
  }
  ll wa=0;
  rep(i,N){
    sum -= A[i];
    wa += A[i];
    ans = min(ans,abs(sum-wa));
  }
  out(ans);
}


Measured memory_bytes: 1792
#include<stdio.h>

int
main()
{
        int A[4], B[4];
        int i;
        int chk[10];
        char buf[16];
        int hit, blow;

        while (gets(buf), !feof(stdin)) {
                sscanf(buf, "%d %d %d %d", &A[0], &A[1], &A[2], &A[3]);
                gets(buf);
                sscanf(buf, "%d %d %d %d", &B[0], &B[1], &B[2], &B[3]);
                for (i = 0; i < 10; i++)
                        chk[i] = 0;
                for (i = 0; i < 4; i++)
                        chk[A[i]]++;
                for (i = 0; i < 4; i++)
                        chk[B[i]]++;
                for (blow = 0, i = 0; i < 10; i++)
                        if (chk[i] == 2)
                                blow++;
                hit = !(A[0] ^ B[0]) + !(A[1] ^ B[1]) + !(A[2] ^ B[2]) + !(A[3] ^ B[3]);
                blow -= hit;
                printf("%d %d\n", hit, blow);
        }

        return 0;
}

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

#define int long long
typedef pair<int, int> P;
#define mod 1000000007
#define INF (1LL<<60)
 
#define rep(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define repi(itr, ds) for (auto itr = ds.begin(); itr != ds.end(); itr++)
#define YES puts("YES")
#define Yes puts("Yes")
#define NO  puts("NO")
#define No  puts("No")
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
 
const int dx[4] = { 1, 0, -1, 0 };
const int dy[4] = { 0, 1, 0, -1 };
 
 
#if 1
//-------------
// DUMPマクロ
// https://www.creativ.xyz/dump-cpp-652/
 
// vector
template <typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    for (T& x : vec) is >> x;
    return is;
}
// pair
template <typename T, typename U>
ostream& operator<<(ostream& os, pair<T, U>& pair_var) {
    os << "(" << pair_var.first << ", " << pair_var.second << ")";
    return os;
}
// vector
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    os << "{";
    for (int i = 0; i < vec.size(); i++) {
        os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
    }
    os << "}";
    return os;
}
// map
template <typename T, typename U>
ostream& operator<<(ostream& os, map<T, U>& map_var) {
    os << "{";
    repi(itr, map_var) {
        os << *itr;
        itr++;
        if (itr != map_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
// set
template <typename T>
ostream& operator<<(ostream& os, set<T>& set_var) {
    os << "{";
    repi(itr, set_var) {
        os << *itr;
        itr++;
        if (itr != set_var.end()) os << ", ";
        itr--;
    }
    os << "}";
    return os;
}
 
#define DUMPOUT cerr
 
void dump_func() {
    DUMPOUT << endl;
}
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&& ... tail) {
    DUMPOUT << head;
    if (sizeof...(Tail) > 0) {
        DUMPOUT << ", ";
    }
    dump_func(std::move(tail)...);
}
#ifdef _DEBUG
#define DEB
#define dump(...)                                                              \
    DUMPOUT << "  " << string(#__VA_ARGS__) << ": "                            \
            << "[" << to_string(__LINE__) << ":" << __FUNCTION__ << "]"        \
            << endl                                                            \
            << "    ",                                                         \
        dump_func(__VA_ARGS__)
#else
#define DEB if (false)
#define dump(...)
#endif
#endif



signed main() {

    int x,y,z;
    cin>>x>>y>>z;
    
    // y+2z, 2y+3z, 3y+4z
    // z+(y+z)n
    cout << (x-z)/(y+z) << endl;
    
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <cstdio>
#include <vector>
#include <stdio.h>
#include <algorithm>
#include <functional>
#include <queue>
#include <math.h>
#include <cmath>
#include <unordered_map>

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


const string YES = "Yes";
const string NO = "No";



// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long X;
    scanf("%lld",&X);
    long long Y;
    scanf("%lld",&Y);

    string ans="No";
    for(int i=0;i<=X;i++){
        if(Y==(i*4)+((X-i)*2)){
            ans="Yes";
            break;
        }else if(Y<(i*4)+((X-i)*2)){
            break;
        }      
    }
    cout<<ans<<endl;

    return 0;
}


Measured memory_bytes: 3684
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Kamol Paul
 */

#include <iostream>
#include <fstream>

#include <bits/stdc++.h>
using namespace std;
#define long long long
typedef pair < long , long > pii;

class CFennecVsMonster {
public:
	void solve(std::istream& in, std::ostream& out) {
	    int n,k;
	    in>>n>>k;
	    vector<long> data(n);
	    for(long& x: data) in>>x;

	    sort(data.begin(),data.end());

	    reverse(data.begin(),data.end());
	    int lol=0;
	    long ans=0;
	    for(long xx : data){
	        if(k>lol);
            else ans+=xx;
            lol++;
	    }
	    out<<ans<<endl;

	}
};


int main() {
    ios_base::sync_with_stdio(false);cin.tie(NULL);
	CFennecVsMonster solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 1920
#include<bits/stdc++.h>
#define maxn (1<<23)
#define LL long long
using namespace std;

const double Pi = 3.1415926535897932384626433832795;
int n;

struct cplx
{
	double r,i;
	cplx(double r=0,double i=0):r(r),i(i){}
	cplx operator +(const cplx &B)const{ return cplx(r+B.r,i+B.i); }
	cplx operator -(const cplx &B)const{ return cplx(r-B.r,i-B.i); }
	cplx operator *(const cplx &B)const{ return cplx(r*B.r-i*B.i,r*B.i+i*B.r); }
	cplx conj()const{ return cplx(r,-i); }
}w[maxn]={1},A[maxn],B[maxn];

int r[maxn];
LL arr[maxn];
inline void FFT(cplx A[maxn],int lgn,int tp)
{
	int n = 1<<lgn;
	if(tp==1) for(int i=1;i<n;i++) r[i] = (r[i>>1]>>1) + ((i&1)<<(lgn-1));
	for(int i=1;i<n;i++) if(i < r[i]) swap(A[i],A[r[i]]);
	for(int L=2;L<=n;L<<=1)
	{
		int l = L>>1;w[1] = cplx(cos(Pi/l),sin(Pi/l)*tp);
		for(int i=2;i<l;i++) w[i] = w[i-1] * w[1];
		for(int st=0;st<=n;st+=L)
			for(int k=0;k<l;k++)
			{
				cplx tmp = w[k] * A[st + k + l];
				A[st + k + l] = A[st + k] - tmp , A[st + k] = tmp + A[st + k];
			}
	}
	if(tp==-1)
		for(int i=0;i<n;i++) A[i].r/=n;
}

int main()
{
	scanf("%d",&n);
	int lgn = 0;
	for(;4*n*n>(1<<lgn);lgn++);
	int len = 1<<lgn;
	LL sumcnt = 0;
	for(int i=0;i<n;i++)
		for(int j=0;j<n;j++)
		{
			int tmp;scanf("%d",&tmp);
			arr[0] += tmp * (tmp - 1) / 2;
			sumcnt += tmp;
			A[2*n*i+j].r = tmp,A[len/2-2*n*i-j].i=tmp;
		}
		
	FFT(A,lgn,1);
	for(int i=0;i<len;i++) 
	{
		cplx a = A[i] , b = A[(len-i) & (len-1)].conj();
		B[i] = (a+b)*(a-b)*cplx(0,-0.25);
	}	
	FFT(B,lgn,-1);
	
	double ans = 0 , sum = 0;
	for(int i=len/2+1;i<len;i++)
	{
		int dx = (i-len/2) % (2 * n) > n ? (i-len/2) % (2 * n) - 2 * n :(i-len/2) % (2 * n),
		dy = (i-len/2-dx) / (2 * n);
		LL val = (LL)(B[i].r+0.5);
		ans += sqrt(dx*dx+dy*dy) * val;
		arr[dx*dx+dy*dy] += val;
	} 
	printf("%.10lf\n",ans/(1ll*(sumcnt)*(sumcnt-1)/2	));
	for(int i=0,k=10000;i<=n*n*2 && k;i++)
		if(arr[i] > 0)
		{
			printf("%d %lld\n",i,arr[i]);
			k--;
		}
}


Measured memory_bytes: 430556
#include <bits/stdc++.h>
using namespace std;
// type alias
typedef long long LL;
typedef pair<int,int> II;
typedef tuple<int,int,int> III;
typedef vector<int> VI;
typedef vector<string> VS;
typedef unordered_map<int,int> MAPII;
typedef unordered_set<int> SETI;
template<class T> using VV=vector<vector<T>>;
// minmax
template<class T> inline T SMIN(T& a, const T b) { return a=(a>b)?b:a; }
template<class T> inline T SMAX(T& a, const T b) { return a=(a<b)?b:a; }
// repetition
#define FORE(i,a,b) for(int i=(a);i<=(b);++i)
#define REPE(i,n)  for(int i=0;i<=(n);++i)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  for(int i=0;i<(n);++i)
#define FORR(x,arr) for(auto& x:arr)
#define SZ(a) int((a).size())
// collection
#define ALL(c) (c).begin(),(c).end()
// DP
#define MINUS(dp) memset(dp, -1, sizeof(dp))
#define ZERO(dp) memset(dp, 0, sizeof(dp))
// stdout
#define println(args...) fprintf(stdout, ##args),putchar('\n');
// debug cerr
template<class Iter> void __kumaerrc(Iter begin, Iter end) { for(; begin!=end; ++begin) { cerr<<*begin<<','; } cerr<<endl; }
void __kumaerr(istream_iterator<string> it) { (void)it; cerr<<endl; }
template<typename T, typename... Args> void __kumaerr(istream_iterator<string> it, T a, Args... args) { cerr<<*it<<"="<<a<<", ",__kumaerr(++it, args...); }
template<typename S, typename T> std::ostream& operator<<(std::ostream& _os, const std::pair<S,T>& _p) { return _os<<"{"<<_p.first<<','<<_p.second<<"}"; }
#define __KUMATRACE__ true
#ifdef __KUMATRACE__
#define dump(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); __kumaerr(_it, args); }
#define dumpc(ar) { cerr<<#ar<<": "; FORR(x,(ar)) { cerr << x << ','; } cerr << endl; }
#define dumpC(beg,end) { cerr<<"~"<<#end<<": "; __kumaerrc(beg,end); }
#else
#define dump(args...)
#define dumpc(ar)
#define dumpC(beg,end)
#endif

// $ cp-batch TakahashiCalendar | diff TakahashiCalendar.out -
// $ g++ -std=c++14 -Wall -O2 -D_GLIBCXX_DEBUG -fsanitize=address TakahashiCalendar.cpp && ./a.out

/*
 
 8/26/2019
 
 16:30-
 
 */

int M,D;

void solve() {
  int res=0;
  FORE(m,1,M)FORE(d,1,D) {
    int d1=d/10,d2=d%10;
    if(d1<2||d2<2) continue;
    res+=d1*d2==m;
  }
  cout<<res<<endl;
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout<<setprecision(12)<<fixed;
  
  cin>>M>>D;
  solve();
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <string> 
#include <cmath>  
#include <cstdlib>
#include <ctime>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
#include <set>
#include <functional>

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

using namespace std;
using ll = long long;

int main() {
	int N;
	cin >> N;
	vector<ll> L(100);
	L[0] = 2;
	L[1] = 1;
	if (N == 1) {
		cout << L[1] << endl;
		return 0;
	}
	FOR(i, 2, N + 1) L[i] = L[i - 1] + L[i - 2];
	cout << L[N] << endl;
	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <ctime>
#include <functional>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

#define REP(i,n)   for (int i = 0; i < (n); ++i)
#define SORT(a)    sort((a).begin(), (a).end());
#define UNIQ(a)    SORT(a);(a).erase(unique((a).begin(), (a).end()), (a).end());
#define FIND(a,x)  find((a).begin(), (a).end(), (x)) != (a).end()
#define REVERSE(a) reverse((a).begin(), (a).end());

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

const int MOD = 1000000007; // 10^9 + 7
const int INF = 1000000000;
const int dx[4] = {0, 0, -1, 1};
const int dy[4] = {-1, 1, 0, 0};

int H, W, N;
int mins[1000][1000];

int getMinPath(string m[], int sy, int sx, int gy, int gx) {
  queue<tuple<int, int, int>> q; q.push(make_tuple(sy, sx, 0));

  mins[sy][sx] = 0;

  while (!q.empty()) {
    tuple<int, int, int> t = q.front(); q.pop();
    int y = get<0>(t);
    int x = get<1>(t);
    int c = get<2>(t);

    // cout << "y = " << y << ", x = " << x << ", c = " << c << endl;

    if (y == gy && x == gx) return c;

    mins[y][x] = c;

    REP(i, 4) {
      int nx = x + dx[i];
      int ny = y + dy[i];

      if (0 <= nx && nx < W && 0 <= ny && ny < H && m[ny][nx] != 'X' && c + 1 < mins[ny][nx]) {
        q.push(make_tuple(ny, nx, c + 1));
        mins[ny][nx] = c + 1;
      }
    }
  }

  assert(false);
  return -1;
}

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

  cin >> H >> W >> N;
  string m[H]; REP(i, H) cin >> m[i];
  vector<P> v(N + 1);
  int ans = 0;

  REP(i, H)REP(j, W) {
    int n = m[i][j] - '0';
    P p = make_pair(i, j);

    if (1 <= n && n <= N)
      v[n] = p;
    else if (m[i][j] == 'S')
      v[0] = p;
  }

  // for (int i = 0; i < v.size(); i++) {
  //   cout << "(" << v[i].first << "," << v[i].second << ")" << endl;
  // }

  for (int i = 1; i <= N; i++) {
    REP(i, H)REP(j, W) mins[i][j] = INF;

    ans += getMinPath(m, v[i - 1].first, v[i - 1].second, v[i].first, v[i].second);
  }

  cout << ans << endl;
}


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

int main() {
    string s;
    cin >> s;
    string ans = "Good";
    for (int i = 0; i < 3; i++) {
        if (int(s[i]) == int(s[i + 1])) {
            ans = "Bad";
            break;
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(0);
	cin.tie(0); cout.tie(0);
	int H, W, K; cin >> H >> W >> K; 
	char C[7][7]; 
	for(int i = 0; i < H; i++){
		for(int j = 0; j < W; j++){
			cin >> C[i][j]; 
		}
	}
	int ans = 0; 
	for(int bit = 0; bit < (1 << (H + W)); bit ++){
		char D[7][7] = {}; 
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				D[i][j] = C[i][j]; 
			}
		}
		for(int i = 0; i < H; i++){
			if((bit >> i) & 1) continue;
			for(int j = 0; j < W; j++){
				D[i][j] = '.'; 
			}
		}
		for(int i = 0; i < W; i++){
			if((bit >> (i + H)) & 1) continue;
			for(int j = 0; j < H; j++){
				D[j][i] = '.'; 
			}
		}
		int cnt = 0; 
		for(int i = 0; i < H; i++){
			for(int j = 0; j < W; j++){
				if(D[i][j] == '#') cnt ++;  
			}
		}
		if(cnt == K) ans ++; 
	}
	cout << ans << "\n"; 
}

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

#define ll long long
#define fornum(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

using namespace std;

/////////////////////////////////////////////////////

ll N;
string S[202020];
ll i, j, k;
ll ans = 1;
int main(){
    scanf("%lld", &N);
    fornum(i,0,N){
        cin >> S[i];
    }
    sort(S, S + N);
    string s = S[0];
    j = 0;
    fornum(i,1,N+1){
        if(s!=S[i]){
            ans = max(ans,i - j);
            j = i;
            s = S[i];
        }
    }
    s = S[0];
    j = 0;
    fornum(i,1,N+1){
        if(s!=S[i]){
            if(ans==i-j){
                
                cout << s << endl;
            }
            j = i;
            s = S[i];
        }
    }

    return 0;
}

Measured memory_bytes: 14336
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
using namespace std;
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vc = vector<char>;
using vb = vector<bool>;
using vs = vector<string>;
using vll = vector<long long>;
using vp = vector<pair<int, int>>;
using vvi = vector<vector<int>>;
using vvc = vector<vector<char>>;
using vvll = vector<vector<long long>>;
template<class T> inline bool chmax(T &a, T b) { if (a<b) {a=b; return 1;} return 0;}
template<class T> inline bool chmin(T &a, T b) { if (b<a) {a=b; return 1;} return 0;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    string s, t;
    cin >> s >> t;
    ll n = sz(s);
    vvi cnt(26);
    rep(i, n) {
        cnt[s[i]-'a'].pb(i);
    }
    ll now = -1;
    ll m = sz(t);
    rep(i, m) {
        int idx = t[i] - 'a';
        if (sz(cnt[idx]) == 0) {
            cout << -1 << endl;
            return 0;
        }
        int x = upper_bound(cnt[idx].begin(), cnt[idx].end(), now%n) - cnt[idx].begin();
        if (x == sz(cnt[idx])) {
            now = (now + n) / n * n + cnt[idx][0];
        } else {
            now = now / n * n + cnt[idx][x];
        }
    }
    cout << now+1 << endl;
}


Measured memory_bytes: 1228
#include <stdio.h>

int main(){
  char line[100];
  int a, b, c;
  fgets(line, sizeof(line), stdin);
  sscanf(line, "%d %d %d", &a, &b, &c);
  int i;
  int count;
  for(i=a; i<=b; ++i){
	if(c%i==0)
	  ++count;
}
  printf("%d\n", count);
  return 0;
}



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

using namespace std;
typedef long long ll;
typedef pair<ll, ll> p_ll;

template<class T>
void debug(T itr1, T itr2) { auto now = itr1; while(now<itr2) { cout << *now << " "; now++; } cout << endl; }
#define repr(i,from,to) for (int i=(int)from; i<(int)to; i++)
#define all(vec) vec.begin(), vec.end()
#define rep(i,N) repr(i,0,N)
#define per(i,N) for (int i=(int)N-1; i>=0; i--)

const ll MOD = pow(10,9)+7;
const ll LLINF = pow(2,61)-1;
const int INF = pow(2,30)-1;

vector<ll> fac;
void c_fac(int x=pow(10,6)+10) { fac.resize(x,true); rep(i,x) fac[i] = i ? (fac[i-1]*i)%MOD : 1; }
ll inv(ll a, ll m=MOD) { ll b = m, x = 1, y = 0; while (b!=0) { int d = a/b; a -= b*d; swap(a,b); x -= y*d; swap(x,y); } return (x+m)%m; }
ll nck(ll n, ll k) { return fac[n]*inv(fac[k]*fac[n-k]%MOD)%MOD; }
ll gcd(ll a, ll b) { if (a<b) swap(a,b); return b==0 ? a : gcd(b, a%b); }
ll lcm(ll a, ll b) { return a/gcd(a,b)*b; }


int main() {
  ll N; cin >> N;

  if (N==2) { cout << 1 << endl; return 0; }
  ll result = 2;
  for (ll i=2; i*i<=N-1; i++) {
    if ((N-1)%i==0) {
      if (i*i==N-1) result++;
      else result += 2;
      // cout << i << " " << (N-1)/i << endl;
    }
  }
  for (ll i=2; i*i<=N; i++) {
    ll now = N; while (now%i==0) now /= i;
    if (N%i==0&&now%i==1) {
      result++;
      // cout << i << " " << N/i << endl;
    }
  }
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String input = sc.nextLine();
    if(input.equals("AAA") || input.equals("BBB")) {
      System.out.println("No");
    }else{
      System.out.println("Yes");
    }
  }
}

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

public class Main {

	public static void main(String[] args) throws NumberFormatException, IOException {
		// TODO Auto-generated method stub
		BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
		int N = Integer.parseInt(reader.readLine());
		int [][] grid = new int[2][N];
		for(int i=0;i<2;i++) {
			String [] temp = reader.readLine().split("[ ]");
			for(int j=0;j<N;j++) {
				grid[i][j] = Integer.parseInt(temp[j]);
			}
		}
		System.out.println(solution(grid, N));
	}
	
	public static int solution(int [][] grid, int N) {
		for(int i=1;i>=0;i--) {
			for(int j=N-1;j>=0;j--) {
				int current=0;
				if(j+1<N) {
					current= Math.max(current, grid[i][j+1]);
				}
				if(i+1<2) {
					current= Math.max(current, grid[i+1][j]);
				}
				
				grid[i][j]+=current;
			}
		}
		return grid[0][0];
	}

}


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

int main() {
  int n;
  cin >> n;

  int x = n * 100 / 108;

  while (x * 108 / 100 < n) {
    x++;
  }
  if (x * 108 / 100 == n) cout << x << endl;
  else cout << ":(" << endl;

  return 0;
}

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

namespace atcoder
{
    public class Program
    {
        public static void Main(string[] args)
        {
            var buffer = Console.ReadLine().Split();
            Console.WriteLine(int.Parse(buffer[0]) * int.Parse(buffer[1]));
        }
    }
}


Measured memory_bytes: 27500
#include<stdio.h>
int main(){
    int n, i, x;
    scanf("%d",&n);
    
    for(i=1;i<=n;i++){
        x=i;
        if(x%3==0){
            printf(" %d", i);
        }
        else{
            do{
                if(x%10==3){
                    printf(" %d", i);
                    x=0;
                }
                x /= 10;
            }while( x );
        }
    }
    printf("\n");
    return 0;
}


Measured memory_bytes: 2044
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <vector>

using namespace std;
typedef long long LL;
const int N = 10;
char g[N][N];
vector<int> a,b;
int n_r[N],n_c[N];
int n,m,k;

int main()
{
    scanf("%d%d%d",&n,&m,&k);
    for(int i=0;i<n;i++)
        scanf("%s",g[i]);
    
    int sum = 0;
    for(int i=0;i<n;i++)
        for(int j=0;j<m;j++)
            if(g[i][j]=='#')
            {
                n_r[i] ++;
                n_c[j] ++;
                sum ++;
            }
    
    int ans = 0;
    for(int i=0;i<1<<n;i++)
    {
        for(int j=0;j<1<<m;j++)
        {
            int res = 0;
            for(int k=0;k<n;k++)
                if(i >> k & 1)
                {
                    a.push_back(k);
                    res += n_r[k];
                }
            
            for(int k=0;k<m;k++)
                if(j >> k & 1)
                {
                    b.push_back(k);
                    res += n_c[k];
                }
            for(auto t : a)
                for(auto p : b)
                    if(g[t][p]=='#')
                        res --;
            a.clear();
            b.clear();
            if(sum - res == k) ans++;
        }
    }
    printf("%d\n",ans);
    return 0;
}

Measured memory_bytes: 3820
n = int(input())
aa =list(map(int, input().split()))

list1 =[0] * n
cnt = 1  
for i in range(n-1):
  if aa[i+1] > aa[i]:
    list1[i+1] = 1
  elif aa[i+1] < aa[i]:
    list1[i+1] = -1
  elif aa[i+1] == aa[i]:    
    list1[i+1] = 0

while 1 in list1 and -1 in list1:
  del list1[:max(list1.index(1), list1.index(-1))]
  list1[0] = 0
  cnt += 1
  
print(cnt)


Measured memory_bytes: 20432
package main

import (
	"fmt"
)

func main() {

	var L int
	fmt.Scanf("%d", &L)

	var max float64
	max = (float64(L) / 3.0) * (float64(L) / 3.0) * (float64(L) / 3.0)
	fmt.Printf("%f\n", max)

}


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

typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll, ll> P;
typedef pair<ll, pair<ll, ll> > P3;

const ll MOD = ll(1e9 + 7);
const ll LLINF = LLONG_MAX;
const int IINF = INT_MAX;
const int MAX_N = int(1e8) + 5;
const int MAX_A = int(15e6);
const double EPS = 1e-8;
const int di[] = {0, 1, 0, -1}, dj[] = {1, 0, -1, 0};
string dir = "RDLU";
#define REP(i, n) for (ll i = 0; i < n; i++)
#define REPR(i, n) for (int i = n; i >= 0; i--)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define SORT(v) sort((v).begin(), (v).end())
#define SORTR(v) sort((v).rbegin(), (v).rend())
#define ALL(v) (v).begin(), (v).end()

struct edge{
    int to, cost;
};

int n, m;
int s, g, vv, pp;
int dmin[25];
vector<edge> G[25];

void dijkstra(){
    fill(dmin,dmin+n,IINF);
    dmin[s] = 0;
    priority_queue<P,vector<P>,greater<P> > que;
    que.push(P(0,s));

    while(!que.empty()){
        P p = que.top();
        que.pop();
        if(p.first > dmin[p.second])continue;
        int v = p.second;
        for(auto e : G[v]){
            if(dmin[e.to] > dmin[v] + e.cost){
                dmin[e.to] = dmin[v] + e.cost;
                que.push(P(dmin[e.to],e.to));
            }
        }
    }
}



int main() {
    cin >> n >> m;
    REP(i,m+1){
        string ss;
        cin >> ss;
        vector<int> ls;
        int bg = 0;
        while(ss.find(',', bg) != ss.npos){
            bg = ss.find(',', bg);
            ls.push_back(bg);
            bg++;
        }
        int a, b, c, d;
        a = stoi(ss.substr(0,ls[0]));
        b = stoi(ss.substr(ls[0]+1,ls[1]-ls[0]));
        c = stoi(ss.substr(ls[1]+1,ls[2]-ls[1]));
        d = stoi(ss.substr(ls[2]+1,ss.size()-ls[2]));

        a--;
        b--;
        if(i<m){
            G[a].push_back({b,c});
            G[b].push_back({a,d});
        }
        else{
            s = a;
            g = b;
            vv = c;
            pp = d;
        }
    }
    int ans = pp;
    dijkstra();
    ans += dmin[g];
    swap(s,g);
    dijkstra();
    ans += dmin[g];
    cout << vv - ans << endl;

    return 0;
}



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

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    
    int n, l;
    cin >> n >> l;
    
    vector<int> a(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> a[i];
    }
    
    for (int i = 1; i < n; i++) {
        if (a[i] + a[i +1] >= l) {
            cout << "Possible" << '\n';
            for (int j = 1; j < i; j++) {
                cout << j << '\n';
            } 
            for (int j = n - 1; j >= i; j--) {
                cout << j << '\n';
            }
            break;    
        }
        if (i == n - 1) {
            cout << "Impossible" << '\n';
        }
    }
    
    return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



#define SIZE  1005

int N,K;
ll dp[2][SIZE][SIZE];
ll MID[2][SIZE][SIZE];
ll A[SIZE];


int main(){

	scanf("%d %d",&N,&K);

	for(int i = 0; i < N; i++){

		scanf("%lld",&A[i]);
	}

	sort(A,A+N);

	int CURRENT = 0,NEXT = 1;

	for(int left = 0; left <= N-1; left++){
		for(int right = left; right <= N-1; right++){

			if(left == right){

				dp[CURRENT][left][right] = 0;

			}else{

				dp[CURRENT][left][right] = HUGE_NUM;
			}
		}
	}

	ll ans = HUGE_NUM;
	int right,L,R;

	for(int height = 1; height <= K; height++){

		for(int left = 0; left <= N-1; left++){
			for(int right = left; right <= N-1; right++){

				if(left == right){

					MID[CURRENT][left][right] = left;
					dp[NEXT][left][right] = dp[CURRENT][left][right];

				}else{

					dp[NEXT][left][right] = HUGE_NUM;
				}
			}
		}

		for(int length = 2; length <= N; length++){
			for(int left = 0; left+length-1 <= N-1; left++){

				right = left+length-1;

				L = MID[CURRENT][left][right-1];
				R = MID[CURRENT][left+1][right];

				for(int mid = L; mid <= R; mid++){

					if(dp[NEXT][left][right] > dp[CURRENT][left][mid]+dp[CURRENT][mid+1][right]+(A[right]-A[mid])){
						dp[NEXT][left][right] = dp[CURRENT][left][mid]+dp[CURRENT][mid+1][right]+(A[right]-A[mid]);
						MID[CURRENT][left][right] = mid;
					}
				}
			}
		}

		ans = min(ans,dp[NEXT][0][N-1]);

		swap(CURRENT,NEXT);
	}

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

	return 0;
}



Measured memory_bytes: 29764
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int k = sc.nextInt();
        int[] a = new int[n];
        for (int i = 0; i < n; i++) {
            a[i] = sc.nextInt();
        }
        int count = 0;
        for (int i = 0; i < n; i++) {
            int b = Math.abs(a[i] - k);
            if (a[i] < b) {
                count += 2 * a[i];
            } else {
                count += 2 * b;
            }
        }
        System.out.println(count);
    }
}

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

using namespace std;

#define ll long long int
#define ld long double
#define pb push_back
#define all(v) v.begin(),v.end()
#define sz(x) ((int)(x).size())
#define fi first
#define se second
#define deb(x) cout<< #x << '=' << x <<endl
#define MOD 1000000007

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

    int n;
    cin>>n;
    ll x[n] , y[n];
    for(int i = 0; i < n; i++){
        cin>>x[i]>>y[i];
    }
    ll mn1 = INT_MAX, mx1 = INT_MIN , mn2 = INT_MAX , mx2 = INT_MIN;
    for(int i = 0; i < n; i++){
        mx1 = max(mx1, x[i] + y[i]);
        mn1 = min(mn1 , x[i] + y[i]);
        mx2 = max(mx2 , x[i] - y[i]);
        mn2 = min(mn2 , x[i] - y[i]);
    }
    cout<<max(mx1 - mn1 , mx2 - mn2);
}

Measured memory_bytes: 6748
s = int(input())

a_1 = s
a_2 = 0
i = 2

dict = {}
dict[s] = 1
while(1000000):
  if a_1 % 2 == 0:
    a_2 = int(a_1 / 2)
  else:
    a_2 = 3 * a_1 + 1
#  print("a_1",a_1)
  if a_2 in dict:
    print(i)
    break
  else:
    dict[a_2] = i
  i += 1
  a_1 = a_2
  

Measured memory_bytes: 3060
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#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 <ctime>
#include <string.h>
#define s(n)                        scanf("%d",&n)
#define sc(n)                       scanf("%c",&n)
#define sl(n)                       scanf("%I64d",&n)
#define sf(n)                       scanf("%lf",&n)
#define ss(n)                       scanf("%s",n)
#define INF                         (int)1e9
#define EPS                         1e-9
#define bitcount                    __builtin_popcount
#define gcd                         __gcd
#define forall(i,a,b)               for(int i=a;i<b;i++)
#define foreach(v, c)               for( typeof( (c).begin()) v = (c).begin();  v != (c).end(); ++v)
#define all(a)                      a.begin(), a.end()
#define in(a,b)                     ( (b).find(a) != (b).end())
#define pb                          push_back
#define fill(a,v)                    memset(a, v, sizeof a)
#define sz(a)                       ((int)(a.size()))
#define mp                          make_pair
#define MOD                         1000000007
typedef long long ll;
/*For you see , each day i love you
 more.Today more than yesterday
  less than tomorrow.*/
using namespace std;

int main()
{
	int h,w,k;
	cin>>h>>w>>k;
	
	vector<string> vec;
	
	for(int i = 0;i<h;i++)
	{
		string str;
		cin>>str;
		vec.push_back(str);
	}
	
	int count = 0;
	int end_h = (1<<h)-1;
	int end_w = (1<<w)-1;
	
	for(int i = 0;i<=end_h;i++)
	{
		for(int j = 0;j<=end_w;j++)
		{
			int black = 0;
			for(int l = 0;l<h;l++)
			{
				for(int m = 0;m<w;m++)
				{
					if(i&(1<<l) && j&(1<<m) && vec[l][m] == '#') black++;
				}
			}
			
			if(black == k) count++;
		}	
	}
	
	
	cout<<count<<endl;
	
	return 0;
}

Measured memory_bytes: 3564
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <cmath>
#include <iostream>
using namespace std;
void MaximumSum() {
	long long A, B, C,K;
	cin >> A >> B >> C;
	cin >> K;
	for (size_t i = 0; i < K; i++)
	{
		if (A > B && A > C) {
			A *= 2;
		}
		else if (B > C) {
			B *= 2;
		}else{
			C *= 2;
		}
	}
	cout << (A + B + C);
}
int main() {
	MaximumSum();
	return 0;
}

Measured memory_bytes: 256
S = input().strip()
a = S[0]
b = S[1]
c = S[2]
d = S[3]

for op1 in ["+", "-"]:
    for op2 in ["+", "-"]:
        for op3 in ["+", "-"]:
            cal = a + op1 + b + op2 + c + op3 + d
            left = int(eval(cal))
            if left == 7:
                print(cal + "=7")
                exit()



Measured memory_bytes: 38384
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define MD 1000000007
#define INF 1ll<<60
typedef pair<ll, ll> P;
template <typename T>
std::string tostr(const T &t){std::ostringstream os;os << t;return os.str();}
int dx[4]={1, 0, -1, 0}, dy[4]={0, 1, 0, -1};

ll nCr(ll n,ll r){
    if(r>n) return 0;
    if(r*2>n) r=n-r;
    if(r==0) return 1;
    ll ans=n;
    for(ll i=2;i<=r;i++){
        ans*=(n-i+1);
        ans/=i;
    }
    return ans;
}

int main(){
    int n;
    cin>>n;
    map<string,int> mp;
    for(int i=0;i<n;i++) {
        string s;
        cin>>s;
        sort(s.begin(),s.end());
        if(mp.count(s)) mp[s]++;
        else mp[s]=1;
    }
    ll ans=0;
    for(auto itr=mp.begin();itr!=mp.end();itr++) {
        ans+=nCr(itr->second,2);
    }
    cout<<ans<<endl;
    return 0;
}


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

using namespace std;

int main()
{
    int n, x;
    cin >> x >> n;

    vector <bool> Have(102);

    while(n--)
    {
        int y;
        scanf("%d", &y);
        Have[y] = true;
    }

    int Ans = 0;

    for(int y = 0; y < 102; y++)
        if(!Have[y])
            if(abs(Ans - x) > abs(y - x))
                Ans = y;

    cout << Ans << endl;
}


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

int gcd(int a, int b){
	while(a){
		int t=b%a;
		b=a;
		a=t;
	}return b;
}

int main(){
	ios::sync_with_stdio(0);
	int n, k;
	cin>>n>>k;
	int maxi=0;
	int nwd=0;
	for(int i=0; i<n; i++){
		int x;
		cin>>x;
		maxi = max(maxi, x);
		nwd = gcd(nwd, x);
	}
	if(k<=maxi && k%nwd == 0)
		cout<<"POSSIBLE\n";
	else
		cout<<"IMPOSSIBLE\n";
	return 0;
}


Measured memory_bytes: 256
#include <algorithm>
#include<iostream>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<string>
#include <sstream>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>
using lll = long long;
using ull = unsigned long long;
using namespace std;


int main(){
  lll ii,jj,kk;
  vector<int> ret;
  int n;
  vector<int> x,y;
  int seq[10];
  int prevX,prevY,curX,curY;
  cin >> n;

  x.resize(n);
  y.resize(n);

  for(ii=0;ii<n;ii++){
    cin >> x[ii] >> y[ii];
    seq[ii] = ii;
  }
  double dist;
  double sum;
  lll cnt = 0;
  sum =0;
  do{
    dist = 0;
    for(ii=0;ii<n;ii++){
      //cout << seq[ii] << "\t" ;
      curX = x[seq[ii]];
      curY = y[seq[ii]];
      
      if(ii !=0){
        dist += sqrt(pow(curX-prevX,2) + pow(curY-prevY,2));
      }

      prevX = x[seq[ii]];
      prevY = y[seq[ii]];
    }
    sum += dist;
    cnt++;
    //cout << endl;
  }while(next_permutation(seq,seq+n));


  printf("%lf\n",sum/cnt);
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>

int main(void) {

    int a, b;
    std::cin >> a >> b;

    if (a <= 5) {
        std::cout << "0" << std::endl;
        return 0;
    }
    else if (a >= 13) {
        std::cout << b << std::endl;
        return 0;
    }
    else {
        std::cout << b/2 << std::endl;
    }

    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
int main(void){
    // Your code here!
    int a,u;
    cin>>a;
    for(int i= 0;i*i<=a;i++){
        u = i*i;
    }
    cout<<u<<endl;
    return 0;
}


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

int main()
{
  int sum,n,i;
  int data[1000];
  double m,a2;

  scanf("%d",&n);
  while(n!=0){
  sum=0;
  for (i=0;i<n;i++){
    scanf("%d",&data[i]);
    sum+=data[i];
  }
  m=(double)sum/n;
  a2=0;
  for (i=0;i<n;i++){
    a2+=pow(data[i]-m,2);
  }
  printf("%lf\n",sqrt(a2/n));
  scanf("%d",&n);
  }
  return 0;
}

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

using namespace std;

#define PI 3.14159265358979323846264338327950L

int main(void)
{
    unsigned long long A, ans = 1, N;
    bool flg0 = false, flg_1 = false;

    cin >> N;

    ans=1;
    for (long long i = 0; i < N; i++)
    {
        cin >> A;
        if (A == 0)
        {
            flg0 = true;
            break;
        }

        if (ans  > 1000000000000000000/A)
        {
            flg_1 = true;
        }
        ans = ans * A;
    }

    if(flg0){
        cout<<0<<endl;
    }else if(flg_1){
        cout<<-1<<endl;
    }else{
        cout<<ans<<endl;
    }

    return 0;
}


Measured memory_bytes: 3608
#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<string.h>

#ifdef LOCAL
#define eprintf(...) fprintf(stderr, __VA_ARGS__)
#else
#define NDEBUG
#define eprintf(...) do {} while (0)
#endif
#include<cassert>

using namespace std;

typedef long long LL;
typedef vector<int> VI;

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define EACH(i,c) for(__typeof((c).begin()) i=(c).begin(),i##_end=(c).end();i!=i##_end;++i)

template<class T> inline void amin(T &x, const T &y) { if (y<x) x=y; }
template<class T> inline void amax(T &x, const T &y) { if (x<y) x=y; }
template<class Iter> void rprintf(const char *fmt, Iter begin, Iter end) {
    for (bool sp=0; begin!=end; ++begin) { if (sp) putchar(' '); else sp = true; printf(fmt, *begin); }
    putchar('\n');
}

int N;
VI G[2011];
int A[2011];
int par[2011];
int depth[2011];
bool fix[2011];
bool sorted[2011];
int leaf[2011];

void dfs(int v) {
    EACH (e, G[v]) {
	depth[*e] = depth[v] + 1;
	dfs(*e);
    }
}

void MAIN() {
#ifdef LOCAL
    N = 2000;
    REP (i, N) rand();
    for (int i=1; i<N; i++) {
	par[i] = rand() % i;
	G[par[i]].push_back(i);
    }
    REP (i, N) A[i] = i;
    random_shuffle(A, A+N);
#else
    scanf("%d", &N);
    REP (i, N-1) {
	int p;
	scanf("%d", &p);
	G[p].push_back(i+1);
	par[i+1] = p;
    }
    REP (i, N) scanf("%d", A+i);
#endif

    dfs(0);

    VI ans;

    while (1) {
	for (int v=N; v--;) {
	    fix[v] = (v == A[v]);
	    EACH (e, G[v]) if (!fix[*e]) {
		fix[v] = false;
		break;
	    }

	}
	if (fix[0]) break;

	for (int v=N; v--;) {
	    leaf[v] = -1;
	    if (!fix[v]) {
		int cnt = 0;
		leaf[v] = v;
		sorted[v] = true;
		EACH (e, G[v]) if (!fix[*e]) {
		    if (leaf[*e] == -1) {
			leaf[v] = -1;
			break;
		    }
		    leaf[v] = leaf[*e];
		    if (depth[A[v]] > depth[A[*e]]) sorted[v] = false;
		    cnt++;
		}
		if (cnt > 1) leaf[v] = -1;
	    }
	}

	int value = A[0];
	int w;
	if (leaf[value] != -1) {
	    int x = leaf[value];
	    while (1) {
		if (leaf[A[x]] != leaf[value]
			|| depth[A[x]] < depth[value]
			|| !sorted[x]) {
		    w = x;
		    break;
		} else {
		    if (x == 0) exit(-1);
		    x = par[x];
		}
	    }
	} else {
	    w = -1;
	    REP (v, N) {
		if (!fix[v] && leaf[A[v]] != -1) {
		    if (leaf[A[v]] != leaf[v] || !sorted[v]) {
			if (w == -1 || depth[w] < depth[v]) w = v;
		    }
		}
	    }
	}

	ans.push_back(w);
	while (1) {
	    swap(A[w], value);
	    if (w == 0) break;
	    w = par[w];
	}
    }
    printf("%d\n", (int)ans.size());
    REP (i, ans.size()) printf("%d\n", ans[i]);
#ifdef LOCAL
    rprintf("%d", A, A+N);
    printf("%d\n", (int)ans.size());
#endif
}

int main() {
    int TC = 1;
//    scanf("%d", &TC);
    REP (tc, TC) MAIN();
    return 0;
}



Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<utility>
#include<set>
#include<stack>
#include<list>
#include<deque>
#include<bitset>
#include<iomanip>
#include<cstring>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<climits>
#include<cmath>
#include<cctype>


#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define ren(i,a,b) for(int i=a;i>=b;i--)
#define ff first
#define ss second
#define pll pair<long long int,long long int>
#define pii pair<int,int>
#define vll vector<long long int>
#define vii vector<int>
#define gi(n) scanf("%d",&n)
#define gll(n) scanf("%lld",&n)
#define gstr(n) scanf("%s",n)
#define gl(n) cin >> n
#define oi(n) printf("%d",n)
#define oll(n) printf("%lld",n)
#define ostr(n) printf("%s",n)
#define ol(n) cout << n
#define os cout<<" "
#define on cout<<"\n"
#define o2(a,b) cout<<a<<" "<<b
#define all(n) n.begin(),n.end()
#define present(s,x) (s.find(x) != s.end())
#define cpresent(s,x) (find(all(s),x) != s.end())
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
using namespace std;

typedef unsigned long long int ull;
typedef long long int ll;
typedef vector<vector<ll> > mat;

int main()
{ios_base::sync_with_stdio(false);
int n,m,c[100005]={0},r[100005]={0};
r[1]=1;
cin>>n>>m;
rep(i,1,n)
c[i]=1;
while(m--)
{
	int x,y;
	cin>>x>>y;
	c[x]--;c[y]++;
	if(r[x]==1)
	{
		r[y]=1;
		if(c[x]==0)
		r[x]=0;
	}
	
}
int ans=0;
rep(i,1,n)
ans+=r[i];
ol(ans);
return 0;
}


Measured memory_bytes: 1024
#include<iostream>
#include<cstdio>
#include<vector>
#include<queue>
#include<map>
#include<string>
#include<algorithm>
#include<functional>
#define ll long long
#define inf  1999999999
#define pa pair<int,int>
using namespace std;

int nibun(int a[],int d,int l,int h){
//cout<<"l="<<l<<" h="<<h<<" ";

if(h-l<=1 && a[h]>d) return l;
else if(h-l<=1) return h;
else{
int m=(l+h)/2;
if(a[m]>=d) nibun(a,d,l,m-1);
else nibun(a,d,m,h);

}
}


int main(){
int n,w;
int a[100010];
int dp[100010];
cin>>n;
for(int i=0;i<n+1;i++)dp[i]=inf;
dp[0]=-1;
for(int i=0;i<n;i++) cin>>a[i];
dp[1]=a[0];
int length=1;
for(int i=1;i<n;i++){
int k=nibun(dp,a[i],0,n+1);
//cout<<k<<endl;
if(dp[k]<a[i]) dp[k+1]=a[i];
if(dp[length+1]!=inf) length++;
//for(int b=0;b<n+1;b++) cout<<dp[b]<<" ";
//cout<<endl;
}

cout<<length<<endl;
return 0;
}

Measured memory_bytes: 1940
import java.util.*;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
  int a = sc.nextInt();
  int b = sc.nextInt();
  double c  = ((double)a + (double)b)/2.0;
  System.out.println((int)Math.ceil(c));
}
}


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

using ll = long long;

int main() {
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	clock_t start = clock();
#endif

	ll S; cin>>S;
	ll d = ceil(S/1e9);	
	cout << 0 << " " << 0 << " " << ll(1e9) << " " << 1 << " " << (d*ll(1e9)-S) << " " << d << endl;

#ifdef LOCAL
	cout << setprecision(12) << (long double)(clock()-start) / CLOCKS_PER_SEC << endl;
#endif
	
	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <vector>
#include <cmath>
using namespace std;

int a[10];

int main() {
    int x, y;
    scanf("%d%d", &x, &y);
    if(y % 2 == 1) {
        printf("No\n");
        return 0;
    }
    if(y < 2 * x || y > 4 * x){
        printf("No\n");
        return 0;
    }
    printf("Yes\n");

	return 0;
}


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


//main関数
int main() {
	long long N,K;
	scanf("%lld %lld",&N,&K);
	
	long long A[N];
	for( long long i=0; i<N; i++ ) {
		scanf("%lld",&A[i]);
		A[i] = A[i] -1;
	}
	
	long long array[N];
	for( long long i=0; i<N; i++ ) {
		array[i] = -1;
	}
	
	long long memory = 0;
	long long sakoda = 1;
	long long amari = 0;
	
	for( long long i=0; i<N ; i++ ) {
		if (array[memory] != -1) {
			sakoda = i - array[memory];
			amari = array[memory];
			K = K - amari;
			K = K % sakoda;
			break;
		}
		array[memory] = i;
		memory = A[memory];
		if( i == K ){
			break;
		}
	}
	
	for(long long i=0;i<N;i++){
		if( array[i] - amari == K ) {
			printf("%lld",i+1);
			return 0;
		}
	}
}



Measured memory_bytes: 4836