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

// {U}{INT,LONG,LLONG}_{MAX,MIN}
#define INF         INT_MAX/3
#define LLINF       LLONG_MAX/3
#define MOD         (1000000007LL)
#define MODA(a, b)  a=((a)+(b))%MOD
#define MODP(a, b)  a=((a)*(b))%MOD
#define inc(i, l, r)   for(int i=(l);i<(r);i++)
#define dec(i, l, r)   for(int i=(r)-1;i>=(l);i--)
#define pb          push_back
#define se          second
#define fi          first
#define mset(a, b)  memset(a, b, sizeof(a))

using LL  = long long;
using G   = vector<vector<int>>;

int di[] = {0, -1, 0, 1};
int dj[] = {1, 0, -1, 0};
// }}}

int main() {
    cin.tie(0);ios::sync_with_stdio(false);
    string s;
    cin >> s;
    if(s == "ABC"){
        cout << "ARC" << endl;
    }else{
        cout << "ABC" << endl;
    }
    return 0;
}


Measured memory_bytes: 3612
using System;
using System.Collections.Generic;
using System.Linq;
using static AtCoder.Io;

namespace AtCoder
{
    class Program
    {
        static void Main()
        {
            var a = ReadNextInt();
            var b = ReadNextInt();
            var c = ReadNextInt();
            for (int i = 1; i <= b; i++)
            {
                if ( a * i % b == c)
                {
                    Console.WriteLine("YES");
                    return;
                }
            }
            Console.WriteLine("NO");
        }
    }

    public static class Io
    {
        public static string ReadString() => Console.ReadLine();
        public static string[] ReadStringArray() => ReadString().Split(' ');
        public static int ReadInt() => int.Parse(ReadString());
        public static long ReadLong() => long.Parse(ReadString());
        public static int[] ReadIntArray() => ReadStringArray().ParseInt().ToArray();
        public static long[] ReadLongArray() => ReadStringArray().ParseLong().ToArray();
        public static IEnumerable<int> ParseInt(this IEnumerable<string> source) => source.Select(int.Parse);
        public static IEnumerable<long> ParseLong(this IEnumerable<string> source) => source.Select(long.Parse);

        public static string[] Buffer = new string[] { };
        public static int Index;
        public static string ReadStringNext()
        {
            if (Buffer.Length == 0 || Buffer.Length <= Index - 1)
            {
                Buffer = ReadStringArray();
                Index = 0;
            }
            return Buffer[Index++];
        }
        public static int ReadNextInt() => int.Parse(ReadStringNext());
        public static long ReadNextLong() => long.Parse(ReadStringNext());
    }
}


Measured memory_bytes: 13140
#include<bits/stdc++.h>
#include <string>
using namespace std;
#include<chrono>
#define gc getchar_unlocked
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #x << "=" << x << "," << #y << "=" << y << endl
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define tr(it, a) for(auto it = a.begin(); it != a.end(); it++)
#define PI 3.1415926535897932384626
#define MAX(a,b) (a>b)?a:b
#define MIN(a,b) (a>b)?b:a
#define MIN3(a,b,c)         MIN(a,MIN(b,c))
#define MAX3(a,b,c)         MAX(a,MAX(b,c))
#define MIN4(a,b,c,d)       MIN(a,MIN(b,MIN(c,d)))
#define MAX4(a,b,c,d)       MAX(a,MAX(b,MAX(c,d)))
#define MAX5(a,b,c,d,e)     MAX(MAX3(a,b,c),MAX(d,e))
#define MIN5(a,b,c,d,e)     MIN(MIN3(a,b,c),MIN(d,e))
typedef pair<int, int>  pii;
typedef pair<ll, ll>  pl;
typedef vector<int>   vi;
typedef vector<ll>    vl;
typedef vector<pii>   vpii;
typedef vector<pl>    vpl;
typedef vector<vi>    vvi;
typedef vector<vl>    vvl;
int mpow(int base, int exp); 
void ipgraph(int m);
void DFS(int n);
bool isprime(ll n);
int gcd(int a,int b);
void rstgraph(int n);

const int mod = 1'000'000'007;
const int N = 3e5, M = N;
//=======================================================================================

vi g[N];
int vis[N];
int nodes=0;


void iluzn() {
 int n;
 cin>>n;
 int ans=0;
 
 for(int t=0;t<n;t++){
  int k;
  cin>>k;
  if((t+1)%2==1&&k%2==1)
    ++ans;


 }
 cout<<ans;
 }

 
 

  
int main() {
  // #ifndef ONLINE_JUDGE
  //   freopen("input.txt","r",stdin);
  //   freopen("out.txt","w",stdout);
  // #endif
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int t = 1;
    // cin >> t;
    while(t--) {
      iluzn();
      }
    return 0;
}
int mpow(int base, int exp) {
  base %= mod;
  int result = 1;
  while (exp > 0) {
    if (exp & 1) result = ((ll)result * base) % mod;
    base = ((ll)base * base) % mod;
    exp >>= 1;
  }
  return result;
}
bool isprime(ll n){
    if(n<=1)
        return false;
    if(n==2)
        return true;
    if(n%2==0)
        return false;
    ll rt = sqrt(n);
    for(ll i=3;i<rt;i+=2){
        if(n%i==0)
            return false;
    }
    return true;
}
int gcd(int a,int b){
    if(a%b){
        return gcd(b,a%b);
    }
    else{
        return b;
    }
}
void ipgraph(int m){
  int u, v;
  while(m--){
    cin>>u>>v;
    g[u].pb(v);
    g[v].pb(u);
  }
}

void DFS(int n)
{  ++nodes;
    vis[n] = 1;
    for(vector<int>::iterator i = g[n].begin(); i != g[n].end() ; i++)
    {
        if(!vis[*i])
            DFS(*i);
    }
}
void rstgraph(int n){
  int i;
  fo(i,n+1){
    g[i].clear();
    vis[i]=0;
  }
  nodes=0;
}

Measured memory_bytes: 10696
#include<bits/stdc++.h>
using namespace std;
int eratoes[1000005];
int counter[1000005];
void init(){
	for(int i=1; i<=1000000; i++){
		eratoes[i] = i;
	}
	for(int i=2; i*i<=1000000; i++){
		if(eratoes[i]==i){
			for(int j=i*i; j<=1000000; j+=i){
				eratoes[j] = i;
			}
		}
	}
}
int gcd(int a,int b){
	if(a<b) swap(a,b);
	while(b){
		int temp = a%b;
		a = b;
		b = temp;
	}
	return a;
}
void proccess(int a){
	vector<int>ret;
	while(a>1){
		ret.push_back(eratoes[a]);
		a/=eratoes[a];
	}
	sort(ret.begin(),ret.end());
	ret.erase(unique(ret.begin(),ret.end()),ret.end());
	for(int i=0; i<ret.size(); i++){
		counter[ret[i]]++;
	}
}
int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	init();
	int n;
	cin>>n;
	vector<int>arr(n);
	for(int i=0; i<n; i++) cin>>arr[i];
	int a = arr[0];
	for(int i=1; i<n; i++) a = gcd(a,arr[i]);
	if(a!=1) cout<<"not coprime";
	else{
		for(int i=0; i<n; i++) proccess(arr[i]);
		for(int i=2; i<=1000000; i++){
			if(counter[i]>=2){
				cout<<"setwise coprime";
				return 0;
			}
		}
		cout<<"pairwise coprime";
	}
}

Measured memory_bytes: 15060
/**
  * @brief atcoder
  * @author yao
  */
#include <cstdlib>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <utility>
#include <algorithm>
#include <functional>
#include <climits>
#define ft first
#define sd second
#ifdef DBG
#   define dbg_pri(x...) fprintf(stderr,x)
#else
#   define dbg_pri(x...) 0
#   define NDEBUG
#endif //DBG
#include <cassert>

typedef unsigned int uint;
typedef long long int lli;
typedef unsigned long long int ulli;

#define N 131072

int cnt[N];

int main()
{
    int n, q;
    lli sum = 0;
    scanf("%d", &n);
    for(int i=0;i<n;++i)
    {
        int k;
        scanf("%d", &k);
        ++cnt[k], sum += k;
    }
    scanf("%d", &q);
    for(int i=0;i<q;++i)
    {
        int b,c;
        scanf("%d%d", &b, &c);
        assert(b!=c);
        sum += (lli) cnt[b] * (c-b);
        cnt[c] += cnt[b], cnt[b] = 0;
        printf("%lld\n", sum);
    }
    return 0;
}


Measured memory_bytes: 2108
# -*- coding:utf-8 -*-
import sys
from fractions import gcd

def f(a, x):
    """1以上a以下で、xで割り切れるものの数"""
    return a // x

def lcm(a, b):
    """ aとbの最小公倍数を返す """
    return a*b // gcd(a, b)

def solve():
    A, B, C, D = list(map(int, sys.stdin.readline().split()))
    A -= 1

    # CでもDでも割り切れないもの
    b = B - f(B, C) - f(B, D) + f(B, lcm(C, D))
    a = A - f(A, C) - f(A, D) + f(A, lcm(C, D))
    print(b-a)


if __name__ == "__main__":
    solve()


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

int main() {
  int a, b, c, k, ans;
  cin >> a >> b >> c >> k;
  if (a >= k) ans = 1*k;
  else if (a+b >= k) ans = 1*a + 0*(k-a);
  else ans = 1*a + 0*b + (-1)*(k-a-b);
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3620
#include <stdio.h>

using namespace std;

int main(){
	int a,b;
	char op;
	while(true){
		scanf("%d %c %d",&a,&op,&b);
		if(op == '?') break;
		switch(op){
		case '+':
			printf("%d\n",a+b);
			break;
		case '-':
			printf("%d\n",a-b);
			break;
		case '/':
			printf("%d\n",a/b);
			break;
		case '*':
			printf("%d\n",a*b);
			break;
		}
	}
}



Measured memory_bytes: 2720
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef map<ll,ll>::iterator itll;
typedef long double ld;
typedef map<ll,ll> mapll;
typedef map<string,ll> mapstl;
#define con continue
#define pb push_back
#define fi first
#define se second
#define fr front()
#define one 1.0
#define inf 1000000000000000000
#define all(vl) vl.begin(),vl.end()
#define m_p make_pair 
#define sz(a) sizeof(a)
#define forn(mp,it) for(it = mp.begin();it!=mp.end();it++)
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	ll n;
	cin>>n;
	vector<ll> vl(n);
	ll ma = -1;
	for(int i=0;i<n;i++)cin>>vl[i];
	for(int i=0;i<n;i++){
		ll tmp = vl[i];
		if(ma-tmp>1)
		{
			cout<<"No\n";return 0;
		}
		ma = max(ma,tmp);
	}
	cout<<"Yes\n";
	return 0;
}

Measured memory_bytes: 3948
n = int(input())

n15 = n // 15
n5 = n // 5
n3 = n // 3

ans = n*(n+1)//2 - 5*n5*(n5+1)//2 - 3*n3*(n3+1)//2 + 15*n15*(n15+1)//2

print(ans)


Measured memory_bytes: 61516
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; ++i)
ll dx[4] = { 0, 1, 0, -1 };
ll dy[4] = { 1, 0, -1, 0 };
const ll INF = 1 << 21;
const ll MOD = 1e9 + 7;
static const int N = 100;
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;

int n; // 頂点の数
int M[N][N]; // グラフ
int color[N]; // 訪問状況
int d[N]; // 発見時刻
int f[N]; // 完了時刻
int tt; // 現在時刻
int nt[N]; // 隣接しているノード

// uに隣接するvを番号順に取得
int next(int u)
{
    for (int v = nt[u]; v < n; ++v) {
        nt[u] = v + 1; // M[u][v]があるときnt[u]=v+1となる
        if (M[u][v]) { // u->vに道があればvを返す
            return v;
        }
    }
    return -1;
}

// スタックを用いた深さ優先探索
void dfs_visit(int r)
{
    // ntを初期化
    for (int i = 0; i < n; ++i) {
        nt[i] = 0;
    }
    stack<int> S;
    S.push(r);
    color[r] = GRAY;
    d[r] = ++tt;

    while (!S.empty()) {
        int u = S.top();
        int v = next(u);
        if (v != -1) { // rから伸びるパスが会ったら
            if (color[v] == WHITE) { // まだ訪問したことがないノードのとき
                color[v] = GRAY; // ノードを訪問済みにする
                d[v] = ++tt; // 訪問済みのノードの時間を更新
                S.push(v); // 訪問済みのノードを格納する
            }
        } else { // rから伸びるパスがない時
            S.pop(); // スタックから取り出す
            color[u] = BLACK; // スタックの上にあるノードを訪問完了
            f[u] = ++tt; // 終了時間を更新
        }
    }
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int u, k, v;
    cin >> n;
    memset(M, 0, sizeof(M));

    for (int i = 0; i < n; ++i) {
        cin >> u >> k;
        u--;
        for (int j = 0; j < k; ++j) {
            cin >> v;
            v--;
            M[u][v] = 1;
        }
    }

    // 初期化
    for (int i = 0; i < n; ++i) {
        color[i] = WHITE;
        nt[i] = 0;
    }
    tt = 0;

    // 未訪問のuを始点として深さ優先探索
    for (int u = 0; u < n; ++u) {
        if (color[u] == WHITE) {
            dfs_visit(u);
        }
    }

    for (int i = 0; i < n; ++i) {
        cout << i + 1 << " " << d[i] << " " << f[i] << endl;
    }

    return 0;
}


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

int main () {

    double N, K;
    cin >> N >> K;

    double ans = 0.0;
    for (int i = 1; i <= N; i++) {

        double prob = 1.0;
        prob *= 1 / N;

        int necessary_wins = (int)ceil(log2(K / i));
        for (int j = 0; j < necessary_wins; j++) {
            prob *= 0.5;
        }

        ans += prob;
    }
    printf("%.18lf\n", ans);

    return 0;
}

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

#define M_PI       3.14159265358979323846   // pi

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<ll> VI;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> t3;
typedef tuple<ll, ll, ll, ll> t4;
typedef tuple<ll, ll, ll, ll, ll> t5;

#define rep(a,n) for(ll a = 0;a < n;a++)
#define repi(a,b,n) for(ll a = b;a < n;a++)

using namespace std;

static const ll INF = 1e15;

const ll mod = 1000000007;

int main() {
	ll n;
	cin >> n;
	ll ans = 0;
	for (ll i= 1; i <= n; i++) {
		ll c = n / i;
		ll item = c * (c + 1) / 2 * i;
		ans += item;
	}
	cout << ans << endl;
	return 0;
}


Measured memory_bytes: 3592
#include <iostream>
using namespace std;
int main(void){
	int t;
	while(cin>>t,t){
		int n,sum=0;
		cin>>n;
		for(int i=0,s,f;i<n;++i){
			cin>>s>>f;
			sum+=f-s;
		}
		if(t<=sum) cout<<"OK"<<endl;
		else cout<<t-sum<<endl;
	}
	return 0;
}

Measured memory_bytes: 1160
#include <iostream>

int get_GCD(u_int a, u_int b)
{
    while(a != 0 && b != 0){
        if(a >= b)
            a %= b;
        else
            b %= a;
    }
    return a != 0 ? a : b ;
}

inline int get_LCM(const u_int a, const u_int b, const u_int GCD)
{
    return a * (b / GCD);
}

int main()
{
    u_int a, b, GCD;
    while(std::cin >> a >> b){
            GCD = get_GCD(a, b);
            std::cout << GCD << " " << get_LCM(a, b, GCD) << std::endl;
    }    

    return 0;
}

Measured memory_bytes: 1156
import itertools

N = int(input())
P = list(map(int, (input().split())))
Q = list(map(int, (input().split())))

a = 0
b = 0
cnt = 0

tmp = sorted(P)

for x in itertools.permutations(tmp):
    cnt += 1

    if P == list(x):
        a = cnt

    if Q == list(x):
        b = cnt

print(abs(a - b))


Measured memory_bytes: 3064
t = int(input())
for _ in range(t):
    n = int(input())
    blocks = list(map(int, input().split()))
    maxv = minv = 0
    for i in range(1, n):
        maxv = max(maxv, blocks[i] - blocks[i-1])
        minv = max(minv, blocks[i-1] - blocks[i])
    print(maxv, minv)



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

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;
}

using namespace std;

int main() {
  int n;
  cin >> n;
  map<string, int> m;
  int maxCount = 0;
  rep(i, n) {
    string s;
    cin >> s;
    if (m.count(s) > 0) {
      m[s]++;
    } else {
      m[s] = 1;
    }
    if (maxCount < m[s]) maxCount = m[s];
  }

  vector<string> v;
  for (pair<string, int> p : m) {
    if (p.second == maxCount) v.push_back(p.first);
  }

  sort(v.begin(), v.end());
  for (string s : v) cout << s << endl;
  return 0;
}

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


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

	int n,k;
	cin>>n>>k;
	long long dp[n];
	int h[n];
	for(int i=0; i<n; i++)
	{
		int temp;
		cin>>temp;
		h[i] = temp;	
	}
	dp[0] = 0;
	for(int i=1; i<n; i++)
	{
		long long l = INT_MAX;
		for(int j=1; j<=k;j++)
		{
			if(i-j>=0)
			{
				l = min(l, dp[i-j]+abs(h[i-j]-h[i]));
			}
			else
				break;
		}
		dp[i] = l;
	}
	// for (int i = 0; i < n; ++i)
	// {
	// 	cout<<i<<" "<<h[i]<<" "<<dp[i]<<endl;
	// }
	cout<<dp[n-1];

	return 0;
}

Measured memory_bytes: 1408
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    ll h,w;
    cin>>h>>w;
    ll ans=0;
    ll c[10][10],a;
    for(int i=0;i<10;i++)for(int j=0;j<10;j++)cin>>c[i][j];
    for(int k=0;k<10;k++){
        for(int i=0;i<10;i++){
            for(int j=0;j<10;j++){
                c[i][j]=min(c[i][j],c[i][k]+c[k][j]);
            }
        }
    }
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin>>a;
            if(a!=-1){
                ans+=c[a][1];
            }
        }
    }
    cout <<ans<<endl;
    return 0;
}



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

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
int A[202020];
int B[202020];

int ok(int cur) {
	if(cur>2*N-1) return 0;
	
	int i;
	FOR(i,2*N-1) B[i]=A[i]>=cur;
	if(B[N-1]==B[N-2] || B[N-1]==B[N]) return B[N-1];
	int L=N-1,R=N-1;
	while(L>0 && B[L]!=B[L-1]) L--;
	while(R<2*N-1 && B[R]!=B[R+1]) R++;
	
	if(L==0 && R==2*N-1) return B[L];
	if((N-1)-L<=R-(N-1)) return B[L];
	return B[R];
}


void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,2*N-1) cin>>A[i];
	int cur=1;
	for(i=20;i>=0;i--) if(ok(cur+(1<<i))) cur+=1<<i;
	cout<<cur<<endl;
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n';
	FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	solve(); return 0;
}


Measured memory_bytes: 1920
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string str;
#define rep(i, n) for(int i=0; i<n; ++i)
#define REP(i, n) for(int i=1; i<=n; ++i)
#define all(obj) (obj).begin(), (obj).end()
using P = pair<int, int>;
const int inf = 1e9;
const ll INF = 1e18;
const ll MOD = 1e9+7;
const ll MAX = 1e9+7;

int main(){
    int n; cin >> n;
    int money = 0;
    while(money < n){
        money += 1000;
    }
    cout << money - n << endl;
    return 0;
}

Measured memory_bytes: 3636
// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define rep(i, n) for (int i = 0; i < n; ++i)
#define REP(i, n) for (int i = 0; i < n; ++i)
#define range(i,a,b) ((a)<=(i) && (i)<(b))
#define debug(x) cout << #x << ' ' << '=' << ' ' << (x) << endl;
#define fs first
#define sc second
#define pb push_back
typedef long long ll;
typedef pair<ll, ll> P;
typedef tuple<ll, ll, ll> T;
typedef priority_queue<ll> PQI;
typedef priority_queue<P> PQP;
typedef vector<vector<P>> pvec;
typedef vector<vector<ll>> vvec;
typedef vector<ll> vec;
const vector<int> dx = {0, -1, 0, 1, 1, 1, -1, -1};
const vector<int> dy = {1, 0, -1, 0, 1, -1, 1, -1};
const int MOD = (1000000007);
// const int MOD = (998244353);
// const int INF = (1 << 30);
const int INF = (1LL << 60);
const double EPS = (1 >> 30);
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b; return 1;} return 0;}



signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << fixed << setprecision(15);
    //---------------------------------------------
    
    int n,a,b;
    cin>>n>>a>>b;
    if(abs(a-b)%2==0){
        cout<<abs(a-b)/2<<endl;
    }
    else{
        cout<<min(a-1,n-b)+1+(b-a-1)/2<<endl;
    }
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <queue>
#include <cstdio>
#include <map>
#include <set>
#include <utility>
#include <stack>
#include <cstring>
#include <cmath>
#include <vector>
#include <ctime>
#include <ostream>
using namespace std;
typedef long long ll;
#define pb push_back
#define scand(n) scanf("%d",&n)
#define scanlld(n) scanf("%lld",&n)
#define scans(str) scanf("%s",str)
char str[150];
int main()
{
#ifdef LOCAL
    freopen("input.txt","r",stdin);
//    freopen("output.txt","w",stdout);
#endif // LOCAL
    int n;
    scand(n);
    scans(str);
    int ans=0,x=0;
    for(int i=0;i<n;++i)
    {
        if(str[i]=='I')
        {
            ++x;
            ans=max(x,ans);
        }
        else
            --x;
    }
    printf("%d",ans);
    return 0;
}


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

int ds(int x) {
  int res = 0;
  while (x) {
    res += x % 10;
    x /= 10;
  }
  return res;
}

int main() {
  int n;
  cin >> n;
  int ans = 1e9;
  for (int a = 1; a < n; a++) {
    int b = n - a;
    ans = min(ans, ds(a) + ds(b));
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3552
#include <iostream>
#include <algorithm>
#include <string>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <cmath>
using namespace std;
typedef long int li;
typedef long long int lli;

const int INF = 0xfffffff;

int main() {
	map<string, int> m;
	int n;
	cin >> n;
	string ans = "Yes";
	char last;
	for (int i = 0; i < n; i++) {
		string a;
		cin >> a;
		if (m[a] >= 1) ans = "No";
		m[a]++;
		if (i != 0 && last != a[0]) ans = "No";
		last = a[a.length() - 1];
	}
	cout << ans << endl;
}

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

int main()
{
    int n, m;
    int A[1010];
    scanf("%d %d", &n, &m);
    for (int i = 0; i < n; i++)
    {
        scanf("%d", &A[i]);
    }
    std::sort(A, A + n);

    int sum = 0;
    sum = std::accumulate(A, A + n, sum);
    // printf("%d", sum);
    double lower = (double)sum / (4 * m);
    int i;
    for (i = 0; i < n; i++)
    {
        if (A[i] >= lower)
        {
            break;
        }
    }
    // printf("\n%d\n", (n - i));
    if ((n - i) >= m)
    {
        printf("Yes");
    }
    else
    {
        printf("No");
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define uli unsigned long long int
#define rep(i, m, n) for (lli i = m; i < (n); i++)
#define repe(i, m, n) for (lli i = m; i <= (n); i++)
#define ALL(x) (x).begin(), (x).end()
#define SIZE(x) ((lli)(x).size())
#define MAX(x) *max_element(ALL(x))
#define _GLIBCXX_DEBUG
const lli INF = 2147483647;
const lli MINF = -2147483648;
const lli LINF = 9223372036854775807;
const lli MOD = 1000000007; //10^9+7
const long double PI = acos(-1);
#define SORT(n) sort(n.begin(), n.end())
#define SORTR(n) sort(n.begin(), n.end(), greater<int>())
#define REV(n) reverse(n.begin(), n.end())
#define Vec(K, L, N, S) vector<L> K(N, S)
#define rt sqrt
#define pb push_back
#define ppb pop_back
#define eb emplace_back
#pragma GCC optimize("Ofast")
using vi = vector<int>;
using vvi = vector<vi>;
using vvvi = vector<vvi>;
using vlli = vector<lli>;
using P = pair<lli, lli>;
// vector<P> vp;
// vp.emplace_back(a[i], b[i]);
using vs = vector<string>;
using ll = long long;
// vector入力
template <typename T>
istream &operator>>(istream &is, vector<T> &vec)
{
  for (T &x : vec)
    is >> x;
  return is;
}
// vector出力
template <typename T>
ostream &operator<<(ostream &os, vector<T> &vec)
{
  // os << '{';
  for (int i = 0; i < vec.size(); i++)
  {
    os << vec[i] << (i + 1 == vec.size() ? "" : "");
  }
  // os << '}';
  return os;
}
// aよりもbが大きいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmax(T &a, const T &b)
{
  if (a < b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}
// aよりもbが小さいならばaをbで更新する(更新されたならばtrueを返す)
template <typename T>
bool chmin(T &a, const T &b)
{
  if (a > b)
  {
    a = b; // aをbで更新
    return true;
  }
  return false;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  lli a, b, c, h, k, n, w, ans = 0, count = 0;
  string s, t;
  cin >> n;
  cin >> s;
  if (s.size() <= n)
  {
    cout << s << endl;
  }
  else
  {
    cout << s.substr(0, n) << "..." << endl;
  }
}

Measured memory_bytes: 3644
import itertools
l = [0,1,2,3,4]
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
li = [a,b,c,d,e]
ans =[]
time = 0
for k in itertools.permutations(l):
  time=0
  time += li[k[0]]
  for i in range(1,5):
    while time %10 !=0:
      time+=1
    time += li[k[i]]
  ans.append(time)
print(min(ans))

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
// #define int long long
#define pb push_back
#define fi first
#define se second
#define FF first
#define SS second
#define INF 2e18;
#define mp make_pair
#define ll long long
#define pii pair<int,int>
#define sd(x) scanf("%d",&x)
#define slld(x) scanf("%lld",&x)
#define pd(x) printf("%d\n",x)
#define plld(x) printf("%lld\n",x)
#define endl '\n'
#define fr(i, a, b) for(int i = a; i <= b; i++)
#define sz(s) (int)s.size()
#define all(x) x.begin(), x.end()
typedef long double f80;

signed main()
{
   // freopen("inp.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    ll n;
    cin >> n;
    cout << (n * (n - 1)) / 2;
    return 0;
}

Measured memory_bytes: 512
// वाह मोदी जी वाह!

#include<iostream>
#include<algorithm>
#include<bitset>

#include<cmath>
#include<cstring>
#include<climits>

#include<deque>
#include<vector>
#include<set>
#include<map>
#include<unordered_set>
#include<unordered_map>

#include<fstream>
#include<chrono>
using namespace std;

typedef long long LL;
typedef pair<LL,LL> p64;
typedef vector<LL> v64;

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define rep(i,s,e) for(long long i=s;i<=e;i++)
#define brep(i,s,e) for(long long i=s;i>=e;i--)
#define all(x) x.begin(),x.end()
#define mem(x,y) memset(x,y,sizeof(x))
#define DANGER std::ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)

int main()
{
    // DANGER;
    ofstream out("output.txt");

    auto start = chrono::high_resolution_clock::now();
    
    LL n;
    cin>>n;
    v64 a(n), b(n), c(n-1);
    for(auto &i:a) cin>>i;
    for(auto &i:b) cin>>i;
    for(auto &i:c) cin>>i;

    LL s = 0;
    rep(i,0,n-1)
    {
        s += b[a[i]-1];
        if( i<n-1 && a[i+1]==a[i]+1 ) s += c[a[i]-1];
    }

    cout<<s<<"\n";
    
    auto stop = chrono::high_resolution_clock::now();
    // auto duration = chrono::duration_cast<chrono::milliseconds>(stop - start); 
    // cout << "Time taken by function: " << duration.count() << " milliseconds" << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    int a,b,c; cin >> a >> b >> c;
    int ans;
    if (a == b && b == c) {
        ans = 1;
    } else if ((a == b && b != c) || (b == c && a != b) || (a == c && a != b)) {
        ans = 2;
    } else {
        ans = 3;
    }
    cout << ans << endl;
    return 0;
}

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

for i in range(10):
    for j in range(10):
        for k in range(10):
            c[j][k] = min(c[j][k], c[j][i] + c[i][k])

ans = 0
for i in range(h):
    a = list(map(int,input().split()))
    for j in range(w):
        if a[j] >= 0:
            ans += c[a[j]][1]
print(ans)

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

namespace MyProject
{
    class Program
    {
        static void Main(string[] args)
        {
#if Local
            var sw = new Stopwatch();
            sw.Start();
            Console.SetIn(new StreamReader("input.in"));
#endif

            var solver = new Solver();
            solver.Solve();
#if Local
            Console.WriteLine($"{sw.ElapsedMilliseconds}ms");
#endif
        }
    }

    class Solver
    {
        public void Solve()
        {
            var table = new Dictionary<int, int>();
            foreach (var x in Enumerable.Range(1, 10000))
            {
                if (x * x > 10000)
                {
                    continue;
                }

                foreach (var y in Enumerable.Range(1, 10000))
                {
                    if (y * y > 10000)
                    {
                        continue;
                    }

                    foreach (var z in Enumerable.Range(1, 10000))
                    {
                        if (z * z > 10000)
                        {
                            continue;
                        }

                        var ans = (x * x) + (y * y) + (z * z) + (x * y) + (y * z) + (z * x);
                        if (table.ContainsKey(ans))
                        {
                            table[ans]++;
                        }
                        else
                        {
                            table[ans] = 1;
                        }
                    }
                }
            }

            var N = int.Parse(Console.ReadLine());
            foreach (var i in Enumerable.Range(1, N))
            {
                Console.WriteLine(table.TryGetValue(i, out var val) ? val : 0);
            }
        }
    }
}


Measured memory_bytes: 30632
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>

typedef long long ll;

using namespace std;

int main(int argc, const char * argv[]) {
  string S,T;
  cin >> S >> T;
  ll ans = 0;
  for(int i=0; i<3;i++){
    if(S[i] == T[i]) ans++;
  }
  cout << ans;
}


Measured memory_bytes: 256
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<queue>
using namespace std;
inline int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0' || ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0' && ch<='9')x=x*10+ch-'0',ch=getchar();
    return x*f;
}
inline void write(int x)
{
    if(x<0)putchar('-'),x=-x;
    if(x>9)write(x/10);
    putchar(x%10+'0');
}
priority_queue<long long,vector<long long>,greater<long long> >q;
priority_queue<long long>Q;
struct point
{
	long long a,b,c;
}p[100010];
bool cmp(point a,point b){return a.a>b.a;}
long long l[100010],r[100010];
int main()
{
	int na=read(),nb=read(),nc=read(),n=na+nb+nc;
	long long ans=0,sb=0;
	for(int i=1;i<=n;i++)
	{
		p[i].a=read(),p[i].b=read(),p[i].c=read();ans+=p[i].c;
		p[i].a-=p[i].c,p[i].b-=p[i].c;sb+=p[i].b;
	}
	sort(p+1,p+n+1,cmp);
	long long sum=0;
	for(int i=1;i<=n;i++)
	{
		long long wy=p[i].a-p[i].b;
		if(q.size()<na)q.push(wy),sum+=wy;
		else
		{
			long long ul=q.top();
			if(ul<wy)
			{
				q.pop();sum-=ul;
				q.push(wy);sum+=wy;
			}
		}
		l[i]=sum;
	}
	sum=0;
	for(int i=n;i>=1;i--)
	{
		r[i]=sum;
		if(Q.size()<nc)Q.push(p[i].b),sum+=p[i].b;
		else
		{
			long long ul=Q.top();
			if(p[i].b<ul)
			{
				Q.pop();sum-=ul;
				Q.push(p[i].b);sum+=p[i].b;
			}
		}
	}
	long long he=ans;ans=0;
	for(int i=na;i<=na+nb;i++)ans=max(ans,he+sb+l[i]-r[i]);
	printf("%lld\n",ans);
    return 0;
}

Measured memory_bytes: 5108
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define lc 2 * v
#define rc 2 * v + 1
#define mid (s + e) / 2
#define ll long long
#define int long long
#define ld long double
#define pii pair <int , int>
#define pll pair <long long , long long>
#define FAST ios::sync_with_stdio(false);cin.tie(0);
// #pragma GCC optimize("Ofast")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2")

const int maxn = 1e5 + 10 , N = 1e5 + 5 , SQ = 600 , base = 1999 , mod = 1e9 + 7 , INF = 1e18 , lg = 17;

int n , w , a[maxn][2] , dp[110][maxn];

int32_t main() {
    FAST
    cin >> n >> w;
    for (int i = 0 ; i < n; ++i) {
        cin >> a[i][1] >> a[i][0];
    }
    for (int i = 0; i <= n; ++i) {
        for (int j = 0; j < maxn; ++j) {
            dp[i][j] = INF;
        }
    }
    dp[0][0] = 0;

    for (int i = 1; i <= n; ++i) {
        for (int val = 0; val < maxn; ++val) {
            int q = max(0ll , val - a[i - 1][0]);
            dp[i][val] = min(dp[i][val] , dp[i - 1][q] + a[i - 1][1]);

            dp[i][val] = min(dp[i][val] , dp[i - 1][val]);
        }
    }

    // cout << dp[n][10] << '\n';

    int l = 0 , r = maxn;
    while(l < r - 1) {
        int m = (l + r) / 2;
        if(dp[n][m] <= w) {
            l = m;
        }
        else {
            r = m;
        }
    }
    cout << l << '\n';
}


Measured memory_bytes: 82512
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,m,w=0;
	scanf("%d%d%d",&m,&a,&b);
	if(b>(a+m)){
		w=b-(a+m);
		printf("%d",w);
	}
	else if(a>(b+m)){
		w=a-(b+m);
		printf("%d",w);
	}
	else
       printf("%d",w);
}

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

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var sw = new StreamWriter(Console.OpenStandardOutput()) { AutoFlush = false };
            Console.SetOut(sw);
            new Program().Solve(new ConsoleInput(Console.In, ' '));
            Console.Out.Flush();
#if DEBUG
            ReadLine();
#endif
        }


        void Solve(ConsoleInput cin)
        {
            int M = 1000000007;

            int n = cin.ReadInt;
            int[] c = cin.ReadIntArray(n);

            int[] left = new int[200001];
            for (int i = 0; i <= 200000; i++) left[i] = -1;

            long[] dp = new long[n + 1];
            dp[0] = 1;

            for (int i = 0; i < n; i++)
            {
                dp[i + 1] = dp[i];

                if (i > 0
                    && c[i] != c[i - 1]
                    && left[c[i]] >= 0
                    && left[c[i]] < i - 1)
                {
                    dp[i + 1] += dp[left[c[i]] + 1];
                    dp[i + 1] %= M;
                }

                left[c[i]] = i;
            }

            Console.WriteLine(dp[n]);
        }

        class ConsoleInput
        {
            private readonly System.IO.TextReader _stream;
            private char _separator = ' ';
            private Queue<string> inputStream;

            public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
            {
                this._separator = separator;
                this._stream = stream;
                inputStream = new Queue<string>();
            }

            public string Read
            {
                get
                {
                    if (inputStream.Count != 0) return inputStream.Dequeue();
                    string[] tmp = _stream.ReadLine().Split(_separator);
                    for (int i = 0; i < tmp.Length; ++i)
                        inputStream.Enqueue(tmp[i]);
                    return inputStream.Dequeue();
                }
            }

            public string ReadLine { get { return _stream.ReadLine(); } }
            public int ReadInt { get { return int.Parse(Read); } }
            public long ReadLong { get { return long.Parse(Read); } }
            public double ReadDouble { get { return double.Parse(Read); } }
            public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
            public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
            public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        }
    }
}

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

bool Solve(int target, int dut[], int index, int max)
{
    bool ret;

    if (target == 0) {
        return true;
    }
    if (index == max) {
        return false;
    }

    ret = Solve(target, dut, index + 1, max) | Solve(target - dut[index], dut, index + 1, max);

    return ret;
}

int main(void)
{
    int i, j;
    int dut[200];
    int target;

    scanf("%d", &i);
    for (int k = 0; k < i; k++) {
        scanf("%d", &dut[k]);
    }
    scanf("%d", &j);
    for (int k = 0; k < j; k++) {
        scanf("%d", &target);
        if (Solve(target, dut, 0, i) == true) {
            printf("yes\n");
        }
        else {
            printf("no\n");
        }
    }

    return 0;
}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
#define int long long
#define FLASH ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end))) // rep(i, 1, 5) --> {1,2,3,4} // rep(i, 5, 1) --> {4,3,2,1} // rep(it, end(v), begin(v)) --> *it

using namespace std;

signed main()
{
    int n, m, k;
    cin >> n >> m >> k;
    vector<int> A(n);
    vector<int> B(m);
    rep(i, 0, n)
        cin >> A[i];
    rep(i, 0, m)
        cin >> B[i];
    vector<int> a(n+1);
    vector<int> b(m+1);
    a[0] = 0;
    rep(i, 0, n)
        a[i+1] = a[i] + A[i];
    b[0] = 0;
    rep(i, 0, m)
        b[i+1] = b[i] + B[i];
    int ans = 0;
    int j = m;
    // cout << "a";
    rep(i, 0, n + 1)
    {
        if (a[i] > k)
            break;
        while (b[j] > k - a[i])
            j--;
        // cout << i << " " << j << endl;
        ans = max(ans, i+j);
    }
    cout << ans;
    return 0;
}

Measured memory_bytes: 9596
//https://atcoder.jp/contests/abc079/tasks/abc079_c
#include<iostream>
#include<string>

using namespace std;

int main() {
    string S;
    cin >> S;

    int len = S.size();

    for (int bit = 0; bit < (1<<(len-1)); bit++) {
        int sum = S[0] - '0';
        string ans = "";
        ans += S[0];
        for (int i = 0; i < len-1; i++) {
            if ((bit & (1<<i)) > 0) {
                sum += S[i + 1] - '0';
                ans += "+";
                ans += S[i + 1];
            }
            else {
                sum -= S[i + 1] - '0';
                ans += "-";
                ans += S[i + 1];
            } 
        }
        if (sum == 7) {
            cout << ans + "=7" << endl;
            return 0;
        }
    }
}

Measured memory_bytes: 256
#include <iostream>

int main(){
  int A, B, C, D;
  
  std::cin >> A >> B >> C >> D;
  while(1){
    C = C - B;
    if(C<=0){
      std::cout << "Yes" << std::endl;
      break;
    }
    A = A - D;
    if(A<=0){    
      std::cout << "No" << std::endl;
      break;
    }
  }
  return 0;
}


Measured memory_bytes: 3128
import java.util.*;
import java.io.*;

public class Main {

    public static void main(String[] args) {
        FastReader sc = new FastReader();
        PrintWriter out = new PrintWriter(System.out);

        int n = sc.nextInt();
        while (n > 0) {
            int k = n % 10;
            if (k == 7) {
                out.println("Yes");
                out.flush();
                out.close();
                return;
            }
            n /= 10;
        }

//        long sum = 0;
//        for (int i = 1; i<= n; i++) {
//            if (i % 3 != 0 && i % 5 != 0) {
//                sum += i;
//            }
//        }
//        out.println(sum);
        out.println("No");
        out.flush();
        out.close();
    }

    private static void solve(double x, ArrayList<Long> arr, int n) {
        long sum = 0;
        for (int i = 0; i < n; i++) {
            sum += arr.get(i);
        }
        if (1.0 * sum / n >= x) System.out.println(n);
        else {
            Collections.sort(arr);
            long cur = 0;
            long people = 0;
            for (int i = n - 1; i >= 0; i--) {
                cur += arr.get(i);
                people++;
                if (1.0 * cur / people < x) {
                    System.out.println(people - 1);
                    return;
                }
            }
        }

    }

    static class FastReader {
        BufferedReader br;
        StringTokenizer st;

        public FastReader() {
            br = new BufferedReader(new
                    InputStreamReader(System.in));
        }

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

        int nextInt() {
            return Integer.parseInt(next());
        }

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

        double nextDouble() {
            return Double.parseDouble(next());
        }

        String nextLine() {
            String str = "";
            try {
                str = br.readLine();
            } catch (IOException e) {
                e.printStackTrace();
            }
            return str;
        }


    }
}

/**
 *x=3
 * 1 1 2 5
 */

/**
 *
 *  1+1
 **/

Measured memory_bytes: 32904
#include<bits/stdc++.h>
using namespace std;
#define  ft  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define  ll  long long
#define  pi  pair<int,int>
#define  pb  push_back
#define  F   first
#define  S   second
#define  B   begin()
#define  E   end()
const int N=2e5+3;
//string s,p;
//vector<int>v;
//map<int,int>mp;

int main()
{
    ft
    int t,i,j,n,m,x,l,r;
    cin>>x;
    if(x>=30)
    {
        cout<<"Yes\n";
    }
    else
    {
        cout<<"No\n";
    }
    return 0;
}



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

using ll = long long;
const ll LIM = 1000000000000000000;
//Loop
#define REP(i,a,b) for(ll (i)=(a);(i)<(b);(i)++)
#define RREP(i,a,b) for(ll (i)=(a);(i)>=(b);(i)--)
#define rep(i,n) REP(i,0,n)
#define rrep(i,n) RREP(i,n,0)

int main(void){
	ll n;
	ll a[100000];
	cin>>n;
	rep(i,n){
		cin>>a[i];
		if(a[i]==0){
			cout<<0<<endl;
			exit(0);
		}
	}

	ll ans = 1;
	rep(i,n){
		if((log10(ans)+log10(a[i]))>18){
			cout<<-1<<endl;
			exit(0);
		}
		ans*=a[i];
		if(ans>LIM){
			cout<<-1<<endl;
			exit(0);
		}
	}

	cout<<ans<<endl;

	return 0;
}

Measured memory_bytes: 4744
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SUM(x) std::accumulate(ALL(x), 0LL)
#define MIN(v) *std::min_element(v.begin(), v.end())
#define MAX(v) *std::max_element(v.begin(), v.end())
#define EXIST(v, x) (std::find(v.begin(), v.end(), x) != v.end())
#define FORV(i, v) for (auto i = v.begin(); i != v.end(); i++)
using namespace std;

using ll = long long;
using P = pair<int, 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; }
template<class T> inline void dump(vector<T> v) { for (auto& x : v) cerr << x << " "; cerr << endl; }
template<class T> inline void dump(vector<pair<T, T>> v) { for (auto& p : v) cerr << p.first << " " << p.second << endl; }
template<class T> inline void dump(vector<vector<T>> vv) { for (auto& v : vv) {for (auto& x : v) cerr << x << " "; cerr << endl;} }

const ll INF = 1e9;
const long long INFL = 1LL<<60;


int main() {
  int a, b;
  cin >> a >> b;

  int ans = a + b;
  chmax(ans, a - b);
  chmax(ans, a * b);

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 3580
#include <bits/stdc++.h>
#define REP(i, n) for(int 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 INF 1e9
#define ALL(v) v.begin(), v.end()

using namespace std;
typedef long long ll;

int main(){
    int h, w;
    cin >> h >> w;

    // vector<string> grid(h, "");
    string grid[50];
    REP(i, h) cin >> grid[i];

    int ct = 0;

    REP(i, h){
        REP(j, w){
            if (grid[i][j] == '#'){
                if ((i == 0 || grid[i-1][j] == '.') && (i == h-1 || grid[i+1][j] == '.')){
                    if ((j == 0 || grid[i][j-1] == '.') && (j == w-1 || grid[i][j+1] == '.')){
                        cout << "No" << endl;
                        return 0;
                    }
                }
                
            }
       
        }
    }
    cout << "Yes" << endl;
    return 0;

}

Measured memory_bytes: 256
S = input()
for i in range(0, len(S)):
    if (i % 2 == 0 and S[i] != 'R' and S[i] != 'U' and S[i] != 'D') or \
     (i % 2 == 1 and S[i] != 'L' and S[i] != 'U' and S[i] != 'D'):
        print('No')
        exit(0)
print('Yes')


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

typedef pair<int, int> P;


int w, h;
int xs, ys, xg, yg, n, c, d, x, y;
int dx[] = {1, 0, -1, 0}, dy[] = {0, 1, 0, -1};

void put_b(int a[][105]) {
  int X, Y;
  if(d == 0) X = 4, Y = 2;
  else X = 2, Y = 4 ;
  for(int i = 0; i < Y; i++)
    for(int j = 0; j < X; j++)
      a[y + i][x + j] = c;
}

bool bfs(int a[][105]) {
  int cs = a[ys][xs];
  if(cs != a[yg][xg]) return false;

  //cout << ys << xs << endl;
  queue<P> que;
  que.push(P(xs, ys));
  while(que.size()) {
    P p = que.front();
    que.pop();
    if(p.first == xg && p.second == yg) return true;
    for(int i = 0; i < 4; i++) {
      int nx = p.first + dx[i], ny = p.second + dy[i];
      if(0 < nx && nx <= w && 0 < ny && ny <= h && a[ny][nx] == cs) {
	que.push(P(nx, ny));
	a[ny][nx] = 0;
      }
    }
  }
  return false;
}
int main() {
  while(cin >> w >> h, w != 0 || h != 0) {
    int a[105][105] = {};
    cin >> xs >> ys;
    cin >> xg >> yg;
    cin >> n;
  
    while(n--) {
      cin >> c >> d >> x >> y;
      put_b(a);
    }
    /*
     for(int i = 0; i < h; i++){
      for(int j = 0; j < w; j++)
      cout << a[i][j];
      cout << endl;
      }
    */
    if(bfs(a) == true) cout << "OK" << endl;
    else cout << "NG" << endl;
  }
  return 0;
}

Measured memory_bytes: 1240
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <unordered_map>
 
using namespace std;
using ll = long long;
 
void _cin(){} template <class Head, class... Tail> void _cin(Head&& head, Tail&&... tail){ cin >> head; _cin(forward<Tail>(tail)...); }
void _cout(){ cout << "\n"; } template <class Head, class... Tail> void _cout(Head&& head, Tail&&... tail){ cout << head; _cout(forward<Tail>(tail)...); }
int gcd(int a, int b){ return (b == 0) ? a : gcd(b, a % b); }
 
#define Sq(x) (x)*(x)
#define For(i, n) for(int i = 0; i < (n); i ++)
#define Rep(n) For(_, n)
#define Range(c) c.begin(), c.end()
#define RevRange(c) c.rbegin(), c.rend()
#define Contains(c, x) (find(Range(c), x) != c.end())
#define Search(rb, re, x) distance(rb, find(rb, re, x))
#define Sort(a) sort(Range(a))
#define DeSort(a) sort(RevRange(a))
#define Reverse(c) reverse(Range(c))
#define Unique(a) a.erase(unique(Range(a)), a.end())
#define Cusum(T, xs, sxs) vector<T> sxs(xs.size()+1); For(i, (int)xs.size()) sxs[i+1] = sxs[i] + xs[i]
#define Cin(T, ...) T __VA_ARGS__; _cin(__VA_ARGS__)
#define Cins(T, n, xs) vector<T> xs(n); For(i, n) cin >> xs[i]
#define Cins2(T, n, xs, ys) vector<T> xs(n), ys(n); For(i, n) cin >> xs[i] >> ys[i]
#define Cins3(T, n, xs, ys, zs) vector<T> xs(n), ys(n), zs(n); For(i, n) cin >> xs[i] >> ys[i] >> zs[i]
#define Cinss(T, n, m, xs) Vec2(T, n, m, xs); For(i, n) For(j, m) cin >> xs[i][j]
#define Cinm(T, n, map) unordered_map<T, int> map; Rep(n){ Cin(T, x); map[x] ++; }
#define Cout(...) _cout(__VA_ARGS__)
#define Couts(xs) { for(const auto &e : xs) cout << e << " "; cout << "\n"; }
#define Coutyn(cond) Cout((cond) ? "yes" : "no")
#define CoutYn(cond) Cout((cond) ? "Yes" : "No")
#define CoutYN(cond) Cout((cond) ? "YES" : "NO")
#define vc vector
#define Mini(a, x) a = min(a, x)
#define Maxi(a, x) a = max(a, x)
 
// constexpr int MOD = 1e9+7;

int main(void){
    Cin(int, k, x);
    
    for(int i = -1000; i <= 1000; i ++){
        if(abs(i-x) < k) cout << i << " ";
    }
    cout << endl;
}


Measured memory_bytes: 256