akhauriyash/Code-Regression huggingface dataset:
while True:
    n, m = map(int, input().split())
    if n == 0 and m == 0:
        break
    taro = [int(input()) for _ in range(n)]
    hanako = [int(input()) for _ in range(m)]
    trade_n = []
    trade_m = []
    for t in taro:
        for h in hanako:
            if (sum(taro) - t + h) == (sum(hanako) - h + t):
                trade_n.append(t)
                trade_m.append(h)
    if len(trade_n) >= 1:
        ans = [0, 100000]
        for i in range(len(trade_n)):
            ans[1] = min(trade_n[i] + trade_m[i], ans[1])
            if ans[1] == trade_n[i] + trade_m[i]:
                ans[0] = i
        print("{} {}".format(trade_n[ans[0]], trade_m[ans[0]]))
    elif len(trade_n) == 0:
        print(-1)



Measured memory_bytes: 5724
#include<cstdio>
int main()
{
	int n,i,a[20],cnt;
	scanf("%d",&n);
	for(i=0;i<n;i++) scanf("%d",&a[i]);
	cnt=0;
	for(i=1;i<n-1;i++){
		if(a[i-1]>=a[i]&&a[i+1]<=a[i]) cnt++;
		if(a[i-1]<=a[i]&&a[i+1]>=a[i]) cnt++;
	}
	printf("%d\n",cnt);
	return 0;
}


Measured memory_bytes: 1708
k = int(input())

from collections import deque
queue = deque(range(1,10))
count = 0

while count < k:
    tmp = queue.popleft()
    tail = tmp%10
    if tail != 0:
        queue.append(tmp*10+tail-1)
    queue.append(tmp*10+tail)
    if tail != 9:
        queue.append(tmp*10+tail+1)
    count += 1
    
print(tmp)


Measured memory_bytes: 11956
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>

#define MAX_N (200000)
#define INF (1000000000)

using namespace std;

int main(int argc, char *argv[]) {
  // read inputs
  int N;
  char cs[MAX_N + 1];
  scanf("%d", &N);
  scanf("%s", cs);

  // solve dp
  int dps[MAX_N + 1][2] = {};
  // initialize
  dps[0][0] = 0;
  dps[0][1] = INF;
  for (int i = 0; i < N; i++) {
    if (cs[i] == '.') {
      dps[i + 1][0] = dps[i][0];
      dps[i + 1][1] = min(dps[i][1], dps[i][0]) + 1;
    } else {
      dps[i + 1][0] = dps[i][0] + 1;
      dps[i + 1][1] = min(dps[i][0], dps[i][1]);
    }
  }
  printf("%d\n", min(dps[N][0], dps[N][1]));
  
  return 0;
}


Measured memory_bytes: 1920
#049 C

S = input()
A = 'dream'
B = 'dreamer'
C = 'erase'
D = 'eraser'

S=S[::-1]
A=A[::-1]
B=B[::-1]
C=C[::-1]
D=D[::-1]

tmp =""
for i in S:
    tmp +=i
    for j in [A,B,C,D]:
        if tmp == j:
            S=S.replace(tmp,"",1)
            tmp=""
if len(S)==0:
    print('YES')
else:
    print('NO')

Measured memory_bytes: 3316
#include <iostream>

long fact(int n);

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

    std::cout << fact(n) << std::endl;

    return 0;
}

long fact(int n)
{
    long ans = 1;
    while (n--) {
        ans *= (n + 1);
    }

    return ans;
}

Measured memory_bytes: 1160
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <cctype>
#include <string>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <algorithm>
#include <functional>
#include <iomanip>
#include <limits>

using namespace std;
typedef long long int ll;
void sayYes() { cout << "Yes" << endl; };
void sayNo() { cout << "No" << endl; };
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }                   // 最大公約数
ll lcm(ll a, ll b) { return a * b / gcd(a, b); };                      // 最小公倍数
ll getDigit(ll num) { return log10(num) + 1; }                         // 桁数
ll digitSum(ll n) { return (n < 10) ? n : digitSum(n / 10) + n % 10; } // 各桁の和
#define rep(i, n) for (ll i = 0; i < n; i++)

void Main()
{
    // int n;
    // cin >> n;
    // vector<int> a(n);
    // rep(i, n)
    // {
    //     cin >> a[i];
    // }
    ll a, b, n;
    cin >> a >> b >> n;
    ll max = 0;

    if (n > b)
    {
        for (ll x = b - 1; x <= b; ++x)
        {
            ll v = (ll)(a * x / b) - a * (ll)(x / b);
            max = v > max ? v : max;
        }
    }
    else
    {
        for (ll x = n - 1; x <= n; ++x)
        {
            ll v = (ll)(a * x / b) - a * (ll)(x / b);
            max = v > max ? v : max;
        }
    }

    // for (ll x = 0; x <= n || x <= b + 1; ++x)
    // {
    //     ll v = floor(a * x / b) - a * floor(x / b);
    //     max = v > max ? v : max;
    // }

    cout << max << endl;

    return;
}

signed main(void)
{
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}


Measured memory_bytes: 3672
class Node:
    def __init__(self):
        self.parent = -1
        self.sibling = -1

def dfs(v,d=0):
    G[v].depth,G[v].height = d,0
    if G[v].left != -1:
        G[v].height = max(G[v].height,dfs(G[v].left,d+1)+1)
    if G[v].right != -1:
        G[v].height = max(G[v].height,dfs(G[v].right,d+1)+1)
    return G[v].height

N = int(input()) 
G =[Node() for _ in range(N)]
for _ in range(N):
    idx,*children = [int(x) for x in input().split()] 
    G[idx].left,G[idx].right = children
    if G[idx].left != -1 and G[idx].right != -1:
        G[G[idx].left].sibling,G[G[idx].right].sibling  = G[idx].right,G[idx].left 
    if G[idx].left != -1 or G[idx].right != -1:
        G[idx].type = "internal node"
    else:
        G[idx].type = "leaf"
    for child in children:
        if child != -1:
            G[child].parent =idx
root = [i for i,x in enumerate(G) if x.parent == -1][0]
G[root].type = "root"
dfs(root)
for i,node in enumerate(G):
    print("node {}: parent = {}, sibling = {}, degree = {}, depth = {}, height = {}, {}".format(i,node.parent,node.sibling,(node.left != -1) + (node.right != -1),node.depth,node.height,node.type))



Measured memory_bytes: 5620
MAX = 10**6
MOD = 10**9+7

fac = [0] * (MAX+1)
finv = [0] * (MAX+1)
inv = [0] * (MAX+1)

def comb_init():
    fac[0] = fac[1] = 1
    finv[0] = finv[1] = 1
    inv[1] = 1
    for i in range(2, MAX+1):
        fac[i] = fac[i-1] * i % MOD
        inv[i] = MOD - inv[MOD%i] * (MOD // i) % MOD
        finv[i] = finv[i-1] * inv[i] % MOD

def comb(n, k):
    if n < k:
        return 0
    if n < 0 or k < 0:
        return 0
    return fac[n] * (finv[k] * finv[n-k] % MOD) % MOD


def prime_factorize(n):
    table = {}
    while n % 2 == 0:
        table[2] = table.get(2, 0) + 1
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            table[f] = table.get(f, 0) + 1
            n //= f
        else:
            f += 2
    if n != 1:
        table[n] = table.get(n, 0) + 1
    return table


if __name__ == '__main__':
    n, m = map(int, input().split())
    comb_init()
    prime_factor = prime_factorize(m)
    res = 1
    for v in prime_factor.values():
        res *= comb(v+n-1, n-1)
        res %= MOD
    print(res)


Measured memory_bytes: 127588
N = int(input())
dp = [[[[0] * 4 for _ in range(4)] for _ in range(4)] for _ in range(N+1)]
for i in range(4):
    for j in range(4):
        for k in range(4):
            if k == 1 and j == 0 and i == 2:
                pass
            elif k == 0 and j == 2 and i == 1:
                pass
            elif k == 0 and j == 1 and i == 2:
                pass
            else:
                dp[3][i][j][k] = 1
mod = 10**9 + 7

for i in range(4, N + 1):
    for j in range(4):
        for k in range(4):
            for l in range(4):
                for p in range(4):
                    if l == 1 and k == 0 and j == 2:
                        pass
                    elif l == 0 and k == 2 and j == 1:
                        pass
                    elif l == 0 and k == 1 and j == 2:
                        pass
                    elif p == 0 and k == 1 and j == 2:
                        pass
                    elif p == 0 and l == 1 and j == 2:
                        pass
                    else:
                        dp[i][j][k][l] += (dp[i - 1][k][l][p]) % mod

ans = 0
for i in range(4):
    for j in range(4):
        for k in range(4):
            ans += dp[N][i][j][k]

print(ans%mod)

Measured memory_bytes: 74700
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main() {
    
    long long N;
    long long count = 0;
    
    vector<long long> A;    
    vector<long long> B;
    
    cin >> N;
    
    
    for ( long long  i = 0; i < N; i++ ) {
        long long a;
        cin >> a;
        
        A.push_back(a);
    }
    
    sort( A.begin(), A.end() );
    
    for ( long long  i = 1; i < N; i++ ) {
        
        if ( A[i-1] == A[i] ) {
            B.push_back( A[i] );
        }
    }
    
    if ( !B.size() ) {
        cout << N << endl;
        return 0;
    }
    
    
    for ( ;; ) {
        
        if ( B.size() <= 2 ) { break; }
        if ( B.front() == B.back() ) { break;}
        
        B.erase( B.begin() );
        B.pop_back();
        
        count++;
    }
    
    if ( B.front() == B.back() ) {
        count += ( B.size() / 2 );
        count += B.size() % 2;
    }
    else if ( B.size() == 2 ) {
        
        bool is_between = false;
        for ( long long i = 0; i < N; i++ ) {
            if ( B[0] < A[i] && A[i] > B[1] ) {
                is_between = true;
                break;
            }
        }
        if ( is_between ) {
            count++;
        }
        else {
            count += 2;
        }
    }
    
    cout << N - ( count*2 ) << endl;
    
    
    return 0;
}

Measured memory_bytes: 2548
#include <bits/stdc++.h>
 
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define rrep(i, n) for(int i = ((int)(n)-1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define fill(x, y) memset(x, y, sizeof(x))
 
using namespace std;
 
template<class T>bool chmax(T &a, const T &b) { if(a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if(b<a) { a=b; return 1; } return 0; }
 
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> P;
 
const int INF = 1e9;
const int MOD = 1e9+7;
const double EPS = 1.0e-12;
const double PI = acos(-1.0);

ll dp[10010][110][2];

int main() {
	string k;
	int d;
	cin >> k >> d;
	//reverse(all(n));
	dp[0][0][0] = 1;
	for(int i = 0; i < k.size(); i++){
		int num = k[i]-'0';
		for(int j = 0; j < d; j++){
			for(int k = 0; k < 2; k++){
				for(int l = 0; l < 10; l++){
					if(k == 0 && num < l) continue;
					(dp[i+1][(j+l)%d][k||(num>l)] += dp[i][j][k]) %= MOD;
				}
			}
		}
	}
	cout << (dp[k.size()][0][0]+dp[k.size()][0][1]-1+MOD)%MOD << endl;
	return 0;
}

Measured memory_bytes: 17408
S = gets.chomp.split('').map(&:to_i)
N = S.length

ans = (N+1)/2
left = N/2 - 1
right = (N+1)/2
center = S[N/2]

while ans < N
    if S[left] == center && S[right] == center
        left -= 1
        right += 1
        ans += 1
    else
        break
    end
end
puts ans


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

int main()
{
	int a=0,b=0;
	for(int i=0;i<9;i++)
	{
		a++;
		b=0;
		for(int j=0;j<9;j++){
			b++;
			cout<<a<<"x"<<b<<"="<<a*b<<endl;
		}
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <cstdlib>
#include <algorithm>

using namespace std;

#define INF (1 << 20)
int N;
int L[8];
int B[3];

struct Banboo {
  int total;
  int count;
  Banboo() {
    total = 0;
    count = 0;
  }
};

int calc(int *V) {
  Banboo R[4];
  for (int i = 0; i < N; ++i) {
    R[V[i]].total += L[i];
    ++R[V[i]].count;
  }
  if (R[0].count == 0 || R[1].count == 0 || R[2].count == 0) {
    return INF;
  }
  int ret = 0;
  for (int i = 0; i < 3; ++i) {
    ret +=abs(R[i].total-B[i]) + (R[i].count-1) * 10;
  }
  return ret;
}

int main() {
  cin >> N;
  for (int i = 0; i < 3; ++i) {
    cin >> B[i];
  }

  for (int i = 0; i < N; ++i) {
    cin >> L[i];
  }

  int ans = INF;
  for (int i = (1 << 2 * N) - 1; i >= 0; --i) {
    int V[8];
    for (int j = 0; j < N; ++j) {
      V[j] = (i >> 2 * j) & 0x03;
    }
    int ret = calc(V);
    ans = min(ans, ret);
  }

  cout << ans << endl;

  return 0;
}



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

int main() {
	int x;
	int64_t n;
	int64_t a[3] = {2, 2, 2};
	cin >> x;
	for (int i = 0; i < x; i++) {
		n = a[0] + a[1] + a[2];
		a[0] = 1; a[1] = n; a[2] = n + 1;
	}
	cout << n << endl;
	return 0;
}


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

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef set<int> si;
typedef set<ll, ll> sll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef map<int, int> mii;
typedef map<int, ll> mil;
typedef map<ll, int> mli;
typedef map<ll, ll> mll;

#define FOR(i, a, b) for(ll i = (a); i < (b); i++)
#define rep(i, n) FOR(i, 0, n)
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define SORT(c) sort((c).begin(),(c).end())
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define PB push_back

#define dump(x)  cout << #x << " = " << (x) << endl
#define debug(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl

template<class T> T read() {
	T t;
	cin >> t;
	return t;
}

int main(){
	ll n;
	cin>>n;
	rep(i,n){
		ll c,a,n;
		cin>>c>>a>>n;
		ll ret=0;
		while(true){
			if(n>=1&&a>=1&&c>=1){
				n--;a--;c--;ret++;
			}
			else if(a>=1&&c>=2){
				a--;c-=2;ret++;
			}
			else if(c>=3){
				c-=3;ret+=1;
			}
			else{
				cout<<ret<<endl;
				break;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 1156
N,K = gets.split.map &:to_i
S = gets.chomp
arr = S.scan(/0+|1+/).map{ |s| s.size }
d = S[0].to_i
ss = [0]
arr.each{ |s| ss << (ss[-1] + s) }
p (0...arr.size).map{ |i|
  j = S[ss[i+1]-1] == "1" ? [i-2*K,0].max : [i-2*K+1,0].max
  # p [ S[ss[i+1]-1], ss[j..i+1] ]
  ss[i+1] - ss[j]
}.max


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

#define ln '\n'
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define FOR(i, a, b) for (int i = (a); i <= (int)(b); ++i)
#define FORR(i, a, b) for (int i = (a); i >= (int)(b); --i)
#define ALL(c) (c).begin(), (c).end()

typedef long long ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef vector<VI> VVI;
typedef vector<VL> VVL;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
typedef vector<P> VP;
typedef vector<PL> VPL;
typedef vector<string> VS;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    string s;
    cin >> s;
    REP(i, 3) {
        if (s[i] == s[i + 1]) {
            cout << "Bad" << ln;
            return 0;
        }
    }

    cout << "Good" << ln;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
const int maxn = 100100, lg = 20;
vector<int> to[maxn];
int solve(int u, int p){
	vector<int> cnt(lg, 0);
	for(int v : to[u]){
		if(v == p) continue;
		int msk = solve(v, u);
		for(int j = 0; j < lg; j++) if((msk>>j)&1) cnt[j]++;
	}
	int b = lg - 1;
	while(b >= 0 && cnt[b] <= 1) b--;
	int c = b + 1;
	while(cnt[c] == 1) c++;
	int msk = 1<<c;
	for(int j = c+1; j < lg; j++) msk |= cnt[j]<<j;
	return msk;
}
int main(){
	int n; cin >> n;
	for(int i = 0; i < n - 1; i++){
		int u, v; cin >> u >> v;
		to[u].push_back(v);
		to[v].push_back(u);
	}
	int msk = solve(1, 0);
	int b = 0;
	while(msk>>b) b++;
	cout << b - 1 << endl;
	return 0;
}



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

namespace v0_0005
{
    class Program
    {
        static List<int> div = new List<int>() { 2 };

        static void Main(string[] args)
        {
            string line;
            while (!string.IsNullOrEmpty(line = Console.ReadLine()))
            {
                var ab = line.Split(' ');
                var a = int.Parse(ab[0]);
                var b = int.Parse(ab[1]);
                int LCM = 1;
                int GCD = 1;

                int divVal;
                while ((divVal = GetDivisor(a, b)) != -1)
                {
                    a /= divVal;
                    b /= divVal;
                    GCD *= divVal;
                }
                LCM = GCD * a * b;

                Console.WriteLine("{0} {1}", GCD, LCM);
            }
        }

        static int GetDivisor(int a, int b)
        {
            foreach (var d in div)
            {
                if ((a % d == 0) && (b % d == 0))
                {
                    return d;
                }
            }

            for (int i = div.Min() + 1; i <= Math.Max(a, b); i++)
            {
                if ((a % i == 0) && (b % i == 0))
                {
                    if (!div.Contains(i))
                    {
                        div.Add(i);
                    }
                    return i;
                }
            }

            return -1;
        }
    }
}

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

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<pii> vpii;


int n, x, y, z, l, ng;
ll dp[41][1 << 16], ans;
const int mod = 1e9 + 7;

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    cin>>n>>x>>y>>z;

    l = x + y + z - 1;
    ng = (1 << (x + y + z - 1)) | (1 << (y + z - 1)) | (1 << (z - 1));

    dp[0][0] = 1;
    int mask = (1 << l) - 1;
    rep(i, n) for (int j = 1; j <= 10; j++) rep(k, 1 << l) {
        int x = (k << j) | (1 << (j - 1));
        if ((ng & x) != ng) {
            dp[i + 1][x & mask] = (dp[i + 1][x & mask] + dp[i][k]) % mod;
        }
    }

    ll ans = 1;
    rep(i, n) ans = (ans * 10) % mod;
    rep(i, 1 << l) ans = (ans - dp[n][i] + mod) % mod;
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 20736
#include<stdio.h>

int main(void)

{

    long sum;

    int min,max,a[10000],n,i;

    scanf("%d",&n); 

    for(i=0;i<n;i++)

    {

        scanf("%d",&a[i]);  

        if(i==0)

        {

            min=a[i];

            max=a[i];

        }

        else if(a[i]>max)

        {

            max=a[i];

        }

        else if(a[i]<min)

        {

            min=a[i];

        }

        sum+=a[i];

    }

    printf("%d %d %ld\n",min,max,sum);


    return 0;

} 

Measured memory_bytes: 636
#![allow(unused_imports)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;
use std::ops::Bound::*;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let mut a = vec![vec![]; n];
    for i in 0..n {
        a[i] = read_vec::<i64>();
    }

    let mut memo = vec![0; 1 << n];
    for state in 0..1 << n {
        let used = (0..n)
            .filter(|&x| (state >> x) & 1 == 1)
            .collect::<Vec<_>>();
        for i in 0..used.len() {
            for j in i + 1..used.len() {
                memo[state] += a[used[i]][used[j]];
            }
        }
    }

    let mut dp = vec![0; 1 << n];
    for state in 1..1 << n {
        dp[state] = memo[state];
        let mut state2 = state;
        loop {
            state2 = (state2 - 1) & state;
            if state2 == 0 {
                break;
            }
            dp[state] = max(dp[state], dp[state ^ state2] + memo[state2]);
        }
    }
    println!("{}", dp[(1 << n) - 1]);
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 3048
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  string N;
  cin >> N;
  bool ans = false;
  for(int i = 0; i < 3; i++){
    if(N.at(i) == '7'){
      ans = true;
    }
  }
  if(ans){
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}


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

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define itn long long

typedef long long ll;
typedef pair<ll,ll> p;


int main()
{
  // #define int long long

  int n;
  cin >> n;
  vector<int> v(n, 0);
  vector<int> rate;
  int over = 0;
  for (int i = 0; i < n; i++)
  {
    cin >> v[i];
    if(v[i] < 3200) rate.push_back(v[i] / 400);
    else over++;
  }
  set<int> s(rate.begin(), rate.end());
  vector<int> v2(s.begin(), s.end());
  sort(all(v2));

  int count = 0;
  for(int i : v2) count++;
  // if(count == 0) cout << 1 << " ";
  // else cout << count << " ";
  cout << max(count, 1) << " ";

  // cout << over << endl;


  for (int i = 0; i < over; i++)
  {
    count++;
  }

  cout << count << endl;
}

Measured memory_bytes: 256
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 1e2+5;

int n;
int vis[N];
int taken[N];
pair < int , int > red[N] , blue[N];

bool dfs(int u){
    if(vis[u])
        return false;
    vis[u] = true;
    for(int i = 1; i <= n; i++){
        if(red[u].first < blue[i].first && red[u].second < blue[i].second){
            if(!taken[i] || dfs(taken[i])){
                taken[i] = u;
                return true;
            }
        }
    }
    return false;
}

int main(){
    scanf("%d" , &n);
    for(int i = 1; i <= n; i++){
        int x , y;
        scanf("%d%d" , &x , &y);
        red[i] = {x , y};
    }
    for(int i = 1; i <= n; i++){
        int x , y;
        scanf("%d%d" , &x , &y);
        blue[i] = {x , y};
    }
    int ans = 0;
    for(int i = 1; i <= n; i++){
        memset(vis , 0 , sizeof vis);
        if(dfs(i)){
            ans++;
        }
    }
    printf("%d\n" , ans);
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF 1e9+7;
ll min(ll a,ll b){
  if(a>b){
    return b;
    }
      else{
        return a;
      }
  }
  
  ll max(ll a,ll b){
    if(a>b){
      return a;
    }
    else{
      return b;
    }
  }

ll power(ll a,ll b){
 ll ans=1;
 for(ll i=1;i<=b;i++){
ans*=a;
  }
  return ans;
}
int main(){
  ll K,X;
  cin>>K>>X;
  
  for(ll i=0;i<(K-1)*2+1;i++){
    cout<<X-K+1+i<<" ";
  }
  cout<<endl;
  
}


Measured memory_bytes: 256
#pragma GCC optimize "trapv" 
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define rep(i,a,n)     for(int i=a;i<n;i++)
#define rep3(n)        for(int i=0;i<n;i++)
#define inarr(arr,n)   rep(i,a,n)cin>>arr[i]
#define ll             long long int
#define pb             push_back
#define all(v)         v.begin(),v.end()
#define endl           "\n"
#define eb             emplace_back
#define x              first
#define y              second
#define gcd(a,b)       __gcd(a,b)
#define mem1(a)        memset(a,-1,sizeof(a))
#define pres(a,x)      a.find(x)!=a.end()
#define sz(a)          (int)a.size()
#define pii            pair<int,int>
#define IOS            ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ret            return 0
#define pi             3.1415926536
#define hell           1000000007
#define narak          998244353
#define elasped_time 1.0 * clock() / CLOCKS_PER_SEC
const int inf1=1e9;
const ll inf2=1e18;
const int N=100000;
using namespace std;
using namespace __gnu_pbds;
#define ordered_set tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update>
int dirs[4][2] ={{1,0},{-1,0},{0,1},{0,-1}};
int mex(set<int>&s){
    for(int i=0;;i++){
        if(s.count(i)==0)return i;
    }
    return 0;
}
int solve(){
  int n,k;cin>>n>>k;          
  int a[n];rep3(n)cin>>a[i];
  int dp[k+1];
  dp[0]=0;
  for(int i=1;i<=k;i++){
      set<int>s;
      for(int j=0;j<n;j++){
          if(a[j]>i)continue;
          s.insert(dp[i-a[j]]);
      }
      dp[i]=mex(s);
  }
  if(dp[k])cout<<"First";
  else cout<<"Second";
 ret;
}
int main(){
    IOS;
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    #ifdef cat
    cat();
    #endif
    int t=1;//cin>>t;
    while(t--){
        solve();
    }
    ret;
}
 

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define all(x) begin(x), end(x)
#define dbg(x) cerr << #x << " = " << x << endl
#define _ << ' ' <<
using namespace std;
using ll = long long;
using vi = vector<int>;

int a[3][3];

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    for (int i = 0; i < 3; ++i)
        for (int j = 0; j < 3; ++j)
            cin >> a[i][j];
    int n;
    cin >> n;
    for (int j = 0; j < n; ++j)
    {
        int x;
        cin >> x;
        for (int i = 0; i < 3; ++i)
            for (int j = 0; j < 3; ++j)
                if (a[i][j] == x)
                    a[i][j] = -1;
    }

    for (int i = 0; i < 3; ++i)
    {
        int num = 0;
        for (int j = 0; j < 3; ++j)
            if (a[i][j] == -1)
                num++;
        if (num == 3)
            return cout << "Yes", 0;
    }

    for (int i = 0; i < 3; ++i)
    {
        int num = 0;
        for (int j = 0; j < 3; ++j)
            if (a[j][i] == -1)
                num++;
        if (num == 3)
            return cout << "Yes", 0;
    }
    int num = 0;
    for (int i = 0; i < 3; ++i)
        if (a[i][i] == -1)
            num++;
    if (num == 3)
        return cout << "Yes", 0;
    num = 0;
    for (int i = 0; i < 3; ++i)
        if (a[i][2 - i] == -1)
            num++;
        if (num == 3)
        return cout << "Yes", 0;

        cout << "No";
}


Measured memory_bytes: 256
x = list(map(int, input().split()))
y = list(map(int, input().split()))
z = [[0, 1, 2, 3], [0, 2, 1, 1], [1, 0, 2, 1], [2, 0, 1, 0], [1, 2, 0, 0], [2, 1, 0, 1]]
succeed = False
for i in range(6):
    match = True
    order = [0, 0, 0]
    for j in range(3):
        if {x[j], x[-j-1]} != {y[z[i][j]], y[-z[i][j]-1]}:
            match = False
            break
        else:
            if x[j] == y[z[i][j]]:
                order[j] = 1
                if x[j] == x[-j-1]:
                    order[j] = 2
    if match:
        if 2 in order:
            succeed = True
            break
        if z[i][3] == 0 or z[i][3] == 3:
            if sum(order) % 2:
                succeed = True
                break
        if z[i][3] == 1:
            if not sum(order) % 2:
                succeed = True
                break
if succeed:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 7740
#include<stdio.h>

int main(void){
  int i,j,k;
  int prime[10000],sum[10000];
  int n;

  i = 1;
  k = 3;
  prime[0] = sum[0] = 2;
  while(i<10000){
    n = 1;
    for(j=0;prime[j]*prime[j]<=k;j++){
      if(!(k%prime[j])){
	n = 0;
	break;
      }
    }
    if(n){
      prime[i] = k;
      sum[i] = sum[i-1]+k;
      i++;
    }
    k+=2;
  }

  while(1){
    scanf("%d",&n);
    if(!n)break;
    printf("%d\n",sum[n-1]);
  }

  return 0;
}

Measured memory_bytes: 0
#include<iostream>

using namespace std;

int main()
{
  int a,b,c;
  
  cin>>a>>b>>c;
  
  if(a==b&&b!=c)
    printf("Yes\n");
  else if(a!=b&&b==c)
    printf("Yes\n");
  else if(a==c&&c!=b)
    printf("Yes\n");
  else
    printf("No\n");
  
  return 0;
}
           

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

using namespace std;

int main(int argc, const char *argv[]) {
  int h, w;
  cin >> h >> w;

  vector<string> m(h);
  for (int i = 0; i < h; ++i) {
    cin >> m[i];
  }

  bool ans = true;
  for (int i = 0; i < h && ans; ++i) {
    for (int j = 0; j < w && ans; ++j) {
      if (m[i][j] == '.') {
        continue;
      }

      bool ok = false;
      if (i != 0 && m[i - 1][j] == '#') {
        ok = true;
      }

      if (i != h - 1 && m[i + 1][j] == '#') {
        ok = true;
      }

      if (j != 0 && m[i][j - 1] == '#') {
        ok = true;
      }

      if (j != w - 1 && m[i][j + 1] == '#') {
        ok = true;
      }

      ans = ok;
    }
  }

  cout << (ans ? "Yes" : "No") << '\n';
  return 0;
}

Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.math.BigDecimal;
import java.util.TreeMap;

public class Main {

	/* several useful subroutines */
	private static BufferedReader brStdin = new BufferedReader(new InputStreamReader(System.in));
	private static String[] readBuf = null;
	private static int readPtr = 0;
	private static String getString() throws IOException {
		while ( readBuf == null || readPtr >= readBuf.length ) {
			readBuf = brStdin.readLine().split(" ");
			readPtr = 0;
		}
		return readBuf[readPtr++];
	}
	private static int getInt() throws IOException {
		return Integer.parseInt(getString());
	}
	private static long getLong() throws IOException {
		return Long.parseLong(getString());
	}
	private static BigDecimal getBD() throws IOException {
		return new BigDecimal(getString());
	}
	@SuppressWarnings("unused")
	private static String[] getStringArray(int size) throws IOException {
		String stringArray[] = new String[size];
		for (int i = 0; i < stringArray.length; i++) {
			stringArray[i] = getString();
		}
		return stringArray;
	}
	@SuppressWarnings("unused")
	private static int[] getIntArray(int size) throws IOException {
		int intArray[] = new int[size];
		for (int i = 0; i < intArray.length; i++) {
			intArray[i] = getInt();
		}
		return intArray;
	}
	@SuppressWarnings("unused")
	private static long[] getLongArray(int size) throws IOException {
		long longArray[] = new long[size];
		for (int i = 0; i < longArray.length; i++) {
			longArray[i] = getLong();
		}
		return longArray;
	}
	@SuppressWarnings("unused")
	private static BigDecimal[] getBDArray(int size) throws IOException {
		BigDecimal bdArray[] = new BigDecimal[size];
		for (int i = 0; i < bdArray.length; i++) {
			bdArray[i] = getBD();
		}
		return bdArray;
	}

	
	/* main routine */
	public static void main(String args[]) throws IOException {
		int n = getInt();
		TreeMap<Integer, Integer> ts = new TreeMap<Integer, Integer>();
		for ( int i = 0 ; i < n ; i++ ) {
			ts.put(getInt(), i+1);
		}
		for ( int v: ts.values()) {
			System.out.printf( "%d ", v );
		}
		System.out.println();
	}
}


Measured memory_bytes: 87884
#include<bits/stdc++.h>
#define rep(i, n) for(int i=0; i<n; i++)
#define repo(i, n) for(int i=1; i<=n; i++)
#define INF 1001001001
#define INFll 100100100100100
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << endl;

using namespace std;
using ull = unsigned long long;
using ll = long long;
using P = pair<int, int>;
const int mod = 1000000007;

struct UnionFind {
  vector<int> d;
  UnionFind(int n=0): d(n,-1) {}
  int find(int x) {
    if (d[x] < 0) return x;
    return d[x] = find(d[x]);
  }
  bool unite(int x, int y) {
    x = find(x); y = find(y);
    if (x == y) return false;
    if (d[x] > d[y]) swap(x,y);
    d[x] += d[y];
    d[y] = x;
    return true;
  }
  bool same(int x, int y) { return find(x) == find(y);}
  int size(int x) { return -d[find(x)];}
};


int main(){
  int n, m, k;
  cin >> n >> m >> k;
  vector<int> deg(n);
  vector<int> to[100005];
  UnionFind uf(n);
  rep(i, m){
    int a, b;
    cin >> a >> b;
    a--; b--;
    deg[a]++;
    deg[b]++;
    uf.unite(a, b);
  }
  rep(i, k){
    int c, d;
    cin >> c >> d;
    c--; d--;
    to[c].push_back(d);
    to[d].push_back(c);
  }
  rep(i, n){
    ll ans=uf.size(i)-deg[i]-1;
    for(int p: to[i]){
      if(uf.same(p, i)){
        ans--;
      }
    }
    cout << ans << endl;;
  }
  return 0;
}


Measured memory_bytes: 8936
#include <stdio.h>
#include <stdlib.h>
#include <math.h>



int calc(int N,int *a){
	int max=a[0];
	int min=a[0];
	for(int i=1;i<N;i++){
		if(max < a[i]){
			max=a[i];
		}
		if(min > a[i]){
			min=a[i];
		}
	}
	
	max-=min;
	min-=min;
	max++;
	min++;
	
	if((min+max)%2==0){
		return (min+max)/2-1;
	}else{
		return (min+max)/2;
	}
}

int main(void){
	int N;
	int *a;

	scanf("%d",&N);
	a=(int*)malloc(N*sizeof(int));
	for(int i=0;i<N;i++){
		scanf("%d",&a[i]);
	}

	int result=calc(N,a);

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


    return 0;
}


Measured memory_bytes: 2044
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include<inttypes.h>

typedef int32_t i32;
typedef int64_t i64;

typedef struct node {
  i32 index;
  i64 val;
} node;

typedef node deque_val;

typedef struct Deque {
  deque_val *array;
  size_t front;
  size_t last;
  size_t mask;
} Deque;

Deque* new_deque (void) {
  const size_t len = 2;
  Deque *d = (Deque *) calloc (len, sizeof (Deque));
  d->array = (deque_val *) calloc (len, sizeof (deque_val));
  d->front = d->last = 0;
  d->mask = len - 1;
  return d;
}

void init_deque (Deque *d) {
  d->front = d->last = 0;
}

void free_deque (Deque *d) {
  free (d->array);
  free (d);
}

int is_empty (Deque *d) {
  return d->front == d->last;
}

size_t get_size (Deque *d) {
  return (d->last + (~d->front + 1)) & d->mask;
}

void deque_realloc (Deque *d) {
  deque_val *array = (deque_val *) calloc (2 * (d->mask + 1), sizeof (deque_val));
  size_t k = 0;
  for (size_t i = d->front; i != d->last; i = (i + 1) & d->mask) {
    array[k++] = d->array[i];
  }
  free (d->array);
  d->array = array;
  d->front = 0;
  d->last = k;
  d->mask = 2 * d->mask + 1;
}

deque_val pop_front (Deque *d) {
  deque_val res = d->array[d->front];
  d->front = (d->front + 1) & d->mask;
  return res;
}

deque_val pop_back (Deque *d) {
  d->last = (d->last + d->mask) & d->mask;
  return d->array[d->last];
}

deque_val get_front (const Deque *d) {
  return d->array[d->front];
}

deque_val get_back (const Deque *d) {
  return d->array[(d->last + d->mask) & d->mask];
}

void push_front (Deque *d, const deque_val v) {
  if(((d->last + 1) & d->mask) == d->front) {
    deque_realloc (d);
  }
  d->front = (d->front + d->mask) & d->mask;
  d->array[d->front] = v;
}

void push_back (Deque *d, const deque_val v) {
  if(((d->last + 1) & d->mask) == d->front) {
    deque_realloc (d);
  }
  d->array[d->last] = v;
  d->last = (d->last + 1) & d->mask;
}

void run (void) {
  i32 n, m, k;
  scanf ("%" SCNi32 "%" SCNi32 "%" SCNi32, &n, &m, &k);
  i32 *a = (i32 *) calloc (n + 1, sizeof (i32));
  for (i32 i = 1; i <= n; ++i) {
    scanf ("%" SCNi32, a + i);
  }
  i64 *dp = (i64 *) calloc (n + 1, sizeof (i64));
  Deque *d = new_deque ();
  for (i32 i = 1; i <= k; ++i) {
    init_deque (d);
    push_back (d, (node){i - 1, dp[i - 1]});
    for (i32 j = i; j <= n; ++j) {
      node t = get_front (d);
      if (t.index < j - m) {
	pop_front (d);
	t = get_front (d);
      }
      i64 local = (i64) i * a[j] + t.val;
      while (!is_empty (d)) {
	t = get_back (d);
	if (t.val > dp[j]) break;
	pop_back (d);
      }
      push_back (d, (node) {j, dp[j]});
      dp[j] = local;
    }
  }
  i64 ans = 0;
  for (i32 i = n; i >= k; --i) {
    if (ans < dp[i]) {
      ans = dp[i];
    }
  }
  printf ("%" PRIi64 "\n", ans);
}

int main (void) {
  run ();
  return 0;
}


Measured memory_bytes: 1280
#include<bits/stdc++.h>
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> 
//lower_bound like o_set.find_by_order(val) strictly less then val
//upper_bound like o_set.order_of_key(MAX)– o_set.order_of_key(val)
//if u need multiset elements then use second parameter as time and think 
//typedef tree<pair<int, int>,null_type,less<pair<int, int>>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define endl '\n'
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define se second
#define fi first
#define pai acos(-1)
#define fn(i,x) for(i=0;i<x;i++)
#define fs(i,s,x) for(i=s;i<x;i++)
#define fr(i,x,s) for(i=x;i>=s;i--)
#define fit(itr,s) for(itr=s.begin();itr!=s.end();itr++)
#define W while
#define pp pair<ll,ll>
#define ppi pair<int,int>
#define vl vector<ll>
#define vll vector<pp >
#define vi vector<int>
#define vii vector<ppi>
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))
#define debug(x) cout<<#x<<" :: "<<x<<endl;
#define debug2(x,y) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<endl;
#define debug3(x,y,z) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<endl;
#define debug4(x,y,z,w) cout<<#x<<" :: "<<x<<"\t"<<#y<<" :: "<<y<<"\t"<<#z<<" :: "<<z<<"\t"<<#w<<" :: "<<w<<endl;
#define boost  ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
const int MAX=2e5+5;
const ll MM=1e16;
const ll mod=998244353;
int dx[]={-1,0,1,0};
int dy[]={0,1,0,-1};

ll expo(ll x,ll n,ll M=mod)
{
    ll ans=1;
    while(n>0)
    {
        if(n&1){ans=(ans*x)%M;}
                x=(x*x)%M;
                n>>=1;
    }
    return ans;
}
vector<string> v;
void fun(string s,int index,int last,string a)
{
    if(index==s.length())
    {
        v.pb(a);return;
    }
    if(last==1)
    {
        fun(s,index+1,0,a+s[index]);
        int val=a[a.size()-1]-'0';
        char c='0'+val+1;
        a[a.size()-1]=c;
        fun(s,index+1,1,a);
    }
    else if(last==0)
    {
        fun(s,index+1,0,a+s[index]);
        char c='1';
        a+=c;
        fun(s,index+1,1,a);   
    }
    
    
}

void solve()
{
    ll n,m,i,j,k;
    cin>>n;
    vl v(n+1,0);
    fs(i,1,n+1)
    {
        ll temp1=i*i;
        if(temp1>n)break;
        fs(j,1,n+1)
        {
            ll temp2=i*i+j*j+i*j;
            if(temp2>n)break;
            fs(k,1,n+1)
            {
                ll temp3=temp2+k*k+i*k+j*k;
                if(temp3>n)break;
                v[temp3]++;

            }
        }
    }
    fs(i,1,n+1)cout<<v[i]<<" ";
    cout<<endl;
    
    
}

int main()
{
  boost;
  ll t=1;
// cin>>t;
  while(t--)
  {
      solve();
  }
}


Measured memory_bytes: 3648
#include<iostream>
using namespace std;
int main(){
	int a, b,c;
	cin >> a >> b>>c;
	if (a>c){
		cout << 0 << endl;
	}
	else if (a + b < c){
		cout << "NA" << endl;
	}
	else {
		cout << c - a << endl;
	}
	return 0;
}


Measured memory_bytes: 3096
# -*- coding: utf-8 -*-
def f(n):
  return n//2 if n%2 == 0 else 1+3*n

a= []
a.append(int(input()))
for i in range(1000000):
  x = f(a[i])
  if x in a:
    print(len(a)+1)
    break
  a.append(x)


Measured memory_bytes: 2940
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;

class DisjointSet {
public:
    vector<int> p;

    DisjointSet(int n) {
        p.resize(n, 0);
        iota(p.begin(), p.end(), 0);
    }

    int findSet(int x) {
        if (p[x] == x) return x;
        return findSet(p[x]);
    }

    bool same(int x, int y) {
        return (findSet(x) == findSet(y));
    }

    void unite(int x, int y) {
        p[findSet(x)] = findSet(y);
    }
};

int main() {
    ios::sync_with_stdio(false);

    int n, q;
    cin >> n >> q;

    DisjointSet obj(n);
    int com, x, y;
    while (q --) {
        cin >> com >> x >> y;
        if (com == 0) {
            obj.unite(x, y);
        } else {
            cout << (int)obj.same(x, y) << endl;
        }
    }

    return 0;
}

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

int main(){
  int n;cin>>n;
  int t,x,y,T=0,X=0,Y=0;
  string ans="Yes";
  rep(i,n){
    cin>>t>>x>>y;
    T=t-T;
    X=abs(X-x);
    Y=abs(Y-y);
    if(X+Y>T||((X+Y)%2!=T%2))ans="No";
  }
  cout<<ans;
}

Measured memory_bytes: 3608
a11,a12,a13= map(int,input().split())
a21,a22,a23= map(int,input().split())
a31,a32,a33= map(int,input().split())
N = int(input())
num = []
for i in range(N):
    num.append(int(input()))

if (a11 in num and a12 in num and a13 in num) == True:
    print('Yes')
elif (a21 in num and a22 in num and a23 in num) == True:
    print('Yes')
elif (a31 in num and a32 in num and a33 in num) == True:
    print('Yes')
elif (a11 in num and a21 in num and a31 in num) == True:
    print('Yes')
elif (a12 in num and a22 in num and a32 in num) == True:
    print('Yes')
elif (a13 in num and a23 in num and a33 in num) == True:
    print('Yes')
elif (a11 in num and a22 in num and a33 in num) == True:
    print('Yes')
elif (a31 in num and a22 in num and a13 in num) == True:
    print('Yes')
else:
    print('No')

Measured memory_bytes: 3064
#include <algorithm>
#include <iostream>

double tree(double* a, int size) {
  if (size == 1)
    return a[0];
  else
    a[1] = (a[0] + a[1]) / 2.0f;
  return tree(a + 1, size - 1);
}

int main(int argc, char const* argv[]) {
  using namespace std;

  int n;
  double v[1000];

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

  sort(v, v + n);


  printf("%0.10f\n", tree(v, n));

  return 0;
}


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

#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")

using namespace std;
using namespace boost::multiprecision;

constexpr long long INF = LLONG_MAX;
constexpr long long MOD = 1000000007;
constexpr long double PI = M_PI;

#define FOR(i,r,n) for(ll i = (ll)(r); i < (ll)(n); ++i)
#define RFOR(i,n,r) for(ll i = (ll)(n-1); i >= r; --i)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,n,0)
#define ALL(x) x.begin(),x.end()
#define CALL(x) x.cbegin(),x.cend()
#define RALL(x) x.rbegin(),x.rend()
#define CRALL(x) x.crbegin(),x.crend()

#define cout cout << fixed << setprecision(12)
#define dbglf cerr << '\n'

#define ACCM(arr) accumulate(ALL(arr),0LL)
#define Yes(ex) cout << ((ex) ? "Yes" : "No") << endl
#define YES(ex) cout << ((ex) ? "YES" : "NO") << endl

using ll = long long int;
using ull = unsigned long long int;
using ld = long double;
using vi = vector<ll>;
using vvi = vector<vi>;
using vp = vector<pair<ll, ll>>;
using vs = vector<string>;
using vc = vector<char>;
using lst = list<ll>;
using pq = priority_queue<ll>;

template < typename T >
inline void veccin(vector<T>& v) {
    for (auto && e : v) { cin >> e; }
}

template < typename T >
inline void dbg(T a) { cerr << a << ' '; }

ll n, m, k;
//ld d;
string s/*1, s2, s3*/;
char c/*1, c2, c3*/;
bool flag = false;

/*--------------------template--------------------*/

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

    cin >> n;
	vi a(n); veccin(a);
	cpp_int ans = 1;
	sort(ALL(a));
	if(a[0]==0){cout << 0; return 0;}
	REP(i,n) {
    	ans *= a[i];
        if(ans>cpp_int(1e+18)) {
          ans=-1;break;
        }
    }
    cout << ans << endl;
}


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

int main(){

    ll int n;
    cin>>n;
    ll int arr[3][n];
    for(int i = 0;i<n;i++){
        cin>>arr[0][i]>>arr[1][i]>>arr[2][i];
    }
    ll int dp[3][n];
    memset(dp,0,sizeof(dp));
    dp[0][0] = arr[0][0];
    dp[1][0] = arr[1][0];
    dp[2][0] = arr[2][0];
    for(int i = 1;i<n;i++){

        for(int j = 0;j<3;j++){
            ll int val = 0;

            for(int k = 0;k<3;k++){

                if(k==j)
                    continue;

                val = max(val,dp[k][i-1]);
            }
            dp[j][i] = val+arr[j][i];
        }
    }
    ll int ans = 0;
    ans = max({dp[0][n-1],dp[1][n-1],dp[2][n-1]});
    cout<<ans<<endl;
}




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


int main(){
    int a,b,c,d,e,f;
    cin >> a >> b >> c >> d >> e >> f;
    
    vector<int> x, y;
    for(int i=0; 100*a*i<=f; i++){
        for(int j=0; 100*b*j<=f; j++){
            if(100*a*i+100*b*j<=f && i+j != 0)
                x.push_back(100*a*i+100*b*j);
        }
    }
    for(int i=0; c*i<=f; i++){
        for(int j=0; d*j<=f; j++){
            if(c*i+d*j<=f)
                y.push_back(c*i+d*j);
        }
    }
    
    double Ma=-1e5, AB=0,B=0;
    for(int i=0; i<x.size(); i++){
        for(int j=0; j<y.size(); j++){
            if(((double)y[j]/x[i])<=((double)e/100)){
                if((x[i]+y[j])<=f){
                    if(Ma < (100.0*y[j]/(x[i]+y[j]))){
                        Ma = 100.0*y[j]/(x[i]+y[j]);
                        AB = x[i]+y[j];
                        B = y[j];
                    }
                }
            }
        }
    }
    
    cout << AB <<" "<< B << endl;
}


Measured memory_bytes: 1400
#include <bits/stdc++.h>
#define REP(i, m, n) for(int (i) = (m); (i) < (n); ++i)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
using namespace std;
using Graph = vector<vector<int>>;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
typedef long long ll;
typedef pair<int, int> P;
typedef pair<ll, ll> PL;
const int MOD = 1e9+7;
const int INF = 1<<30;
const ll LINF = 1LL<<60;



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

    ll n;
    cin >> n;

    ll ans = 0;
    for (ll i = 1; i * i <= n; i++) {
        if (n % i == 0) {
            ll m = n / i - 1;
            if (m > 0 && m > i) ans += m;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
n, k = [int(i) for i in input().split(" ")]
dm = [[0 for j in range(0, 2 * k)] for i in range(0, 2 * k)]
s = [[0 for j in range(0, 2 * k + 1)] for  i in range(0, 2 * k + 1)]

for i in range(0, n):
    x, y, c = input().split(" ")
    x = int(x) % (2 * k)
    if c == "W":
        y = int(y) % (2 * k)
    else:
        y = (int(y) + k) % (2 * k)
    dm[x][y] += 1

for i in range(1, 2 * k + 1):
    for j in range(1, 2 * k + 1):
        s[i][j] = s[i][j - 1] + s[i - 1][j] - s[i - 1][j - 1] + dm[i - 1][j - 1]

def srect(i, j, r, l):
    global s
    return s[r][l] - s[r][j] - s[i][l] + s[i][j]

m = 0
for i in range(0, k):
    for j in range(0, k):
        aw = srect(0, j, i, j + k) + srect(i, 0, i + k, j) + srect(i, j + k, i + k, 2 * k) + srect(i + k, j, 2 * k, j + k)
        raw = n - aw
        if m < max(aw, raw):
            m = max(aw, raw)
print(m)

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

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,n) FOR(i,0,n)
#define RFOR(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define rrep(i,n) RFOR(i,n,0)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;

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

	ll n;
	cin >> n;

	ll a[n];
	rep(i, n) cin >> a[i];

	bool ok = true;
	rep(i, n) if(a[i] % 2 == 1) ok = false;

	cout << (ok ? "second" : "first") << endl;
}


Measured memory_bytes: 1024