akhauriyash/Code-Regression huggingface dataset:
#include <stdio.h>

int main(void){

	int a, b, c, temp;

	scanf("%d %d %d", &a, &b, &c);

	temp = a;
	a = (a > b)? b : a;
	b = (temp > b)? temp : b;
	
	temp = b;
	b = (b > c)? c : b;
	c = (temp > c)? temp: c;
	
	temp = a;
	a = (a > b)? b : a;
	b = (temp > b)? temp : b;

	printf("%d %d %d\n", a, b, c);

	return 0;
}

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

int main() {
  int n,m;
  cin >> n;
  vector<string> ns(n);
  for (int i=0; i<n; i++) cin >> ns.at(i);
  cin >> m;
  vector<string> ms(m);
  for (int i=0; i<m; i++) cin >> ms.at(i);
  vector<string> nns(1);
  nns.at(0) = ns.at(0);
  for (int i=0; i<n; i++) {
    int none=0;
    for (int j=0; j<nns.size(); j++) {
      if (nns.at(j) != ns.at(i)) none++;
    }
    if (none) nns.push_back(ns.at(i));
  }
  int max=0,s=0,c;
  for (int i=0; i<nns.size(); i++) {
    c=0;
    for (int j=0; j<ns.size(); j++) {
      if (ns.at(j) == nns.at(i)) c++;
    }
    for (int j=0; j<ms.size(); j++) {
      if (ms.at(j) == nns.at(i)) c--;
    }
    if (s < c) s=c;
  }
  cout << s << endl;
}

Measured memory_bytes: 256
#include<iostream>
using namespace std;
int numStones;
int heights[100005],b[100005];
int main(){
	cin>>numStones;
	for(int i=1;i<=numStones;i++){
	    cin>>heights[i];
	}
	b[2]=abs(heights[1]-heights[2]);
	for(int i=3;i<=numStones;i++){
	    b[i]=min(b[i-1]+abs(heights[i-1]-heights[i]),b[i-2]+abs(heights[i-2]-heights[i]));
	}
	cout<<b[numStones];
	return 0;
}

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

const ll inf = 2e18;

ll solve(int l, int r, vector<ll>& a, vector<vector<ll>>& dp) {
	if (l == r)return 0;
	ll &res = dp[l][r];
	if (res != -1)return res;
	res = inf;
	ll sum = 0, ans;
	for (int i = l; i <= r; i++)sum += a[i];

	for (int i = l; i < r; i++) {
		ans = solve(l, i, a, dp) + solve(i + 1, r, a, dp) + sum;
		res = min(res, ans);
	}

	return res;
}

int main() {


	int n;
	cin >> n;
	vector<vector<ll>> dp(n, vector<ll>(n, -1));
	vector<ll>a(n);
	for (auto & c : a)cin >> c;

	ll ans = solve(0, n - 1, a, dp);

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 4916
#include <bits/stdc++.h>
using namespace std;
int n,k;
int a[1010]; 

int main(){
	cin>>n>>k;
	for(int i=1;i<=n;i++){
		cin>>a[i];	
	}
	sort(a+1,a+n+1);
	int ans=0;
	for(int i=1;i<=k;i++)ans+=a[i];
	cout<<ans;
	return 0;
}

Measured memory_bytes: 3616
import java.util.Scanner;
public class Main{
  public static void main(String args[]){
 Scanner enter = new Scanner(System.in);
  int n = enter.nextInt();
  String s = String.valueOf(n);
  
  if(s.contains("7")){
    System.out.println("Yes");
  }
  else{
    System.out.println("No");
  }
  }
}

Measured memory_bytes: 35596
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <numeric>
#include <utility>
#include <random>
#include <chrono>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>

using namespace std;

using LL = long long;
using ULL = unsigned long long;
using PII = pair<int, int>;
using PIL = pair<int, LL>;
using PLL = pair<LL, LL>;
// const int mod = 1e9 + 7;
// const int mod = 998244353;

inline void quickread() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
}

LL tree[200010];
int h[200010], a[200010];
int n;

inline int lowbit(int x) {
    return x & (-x);
}

inline LL query(int x) {
    LL ret = 0;
    while (x) {
        ret = max(ret, tree[x]);
        x -= lowbit(x);
    }
    return ret;
}

inline void update(int x, LL v) {
    while (x <= n) {
        tree[x] = max(tree[x], v);
        x += lowbit(x);
    }
}

inline void work() {
    cin >> n;
    LL ans = 0;
    for (int i = 0; i < n; ++i) {
        cin >> h[i];
    }
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    for (int i = 0; i < n; ++i) {
        LL value = query(h[i]);
        ans = max(ans, value + a[i]);
        update(h[i], value + a[i]);
    }
    cout << ans << "\n";
}

int main() {
    // freopen("input.txt", "r", stdin);
    quickread();
    work();
    return 0;
}

Measured memory_bytes: 3328
#include <stdio.h>
int main(void)
{
    int a,b,c;
    scanf("%d %d %d",&a,&b,&c);
    if (a==1&&b==0&&c==0)
    {
        printf("Close\n");
    }
    else if (a==0&&b==1&&c==0)
    {
        printf("Close\n");
    }
    else if (a==a&&b==1&&c==0)
    {
        printf("Open\n");
    }
    else if (a==0&&b==0&&c==1)
    {
        printf("Open\n");
    }
    else if (a==0&&b==0&&c==0)
    {
        printf("Close\n");
    }
    return 0;
}

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

public class Main {
    public static final long mod = (long)1e9+7;
    public static final long INF = Long.MAX_VALUE/2;
    public static final int inf = Integer.MAX_VALUE/2;
    //abc58c
    static void solve(InputReader in, PrintWriter out){
        int n = in.ni();
        int[] alp_now;
        int[] alp_min = new int[26];
        for (int i = 0; i < n; i++) {
            alp_now = new int[26];
            char[] s = in.ns().toCharArray();
            for (int j = 0; j < s.length; j++) {
                alp_now[s[j]-'a']++;
            }
            for (int j = 0; j < 26; j++) {
                if(i==0) alp_min[j] = alp_now[j];
                else alp_min[j] = Math.min(alp_min[j], alp_now[j]);
            }
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 26; i++) {
            for (int j = 0; j < alp_min[i]; j++) {
                sb.append((char)('a'+i));
            }
        }
        out.println(sb.toString());
    }

    public static void main(String[] args){
        InputReader in = new InputReader(System.in);
        PrintWriter out = new PrintWriter(System.out);
        solve(in, out);
        out.close();
    }
    public static class InputReader{
        private BufferedReader br;
        private StringTokenizer st;
        public InputReader(InputStream is){
            br = new BufferedReader(new InputStreamReader(is));
            st = null;
        }
        public String ns(){
            if(st == null || !st.hasMoreTokens()){
                try{
                    st = new StringTokenizer(br.readLine());
                }catch (Exception e){
                    throw new RuntimeException(e);
                }
            }
            return st.nextToken();
        }
        public int ni(){
            return Integer.parseInt(ns());
        }
        public long nl(){
            return Long.parseLong(ns());
        }
        public double nd(){
            return Double.parseDouble(ns());
        }
        public char nc(){
            return ns().toCharArray()[0];
        }
        public int[] ni(int n){
            int[] a = new int[n];
            for (int i = 0; i < n; i++) {
                a[i] = ni();
            }
            return a;
        }
        public long[] nl(int n){
            long[] a = new long[n];
            for (int i = 0; i < n; i++) {
                a[i] = nl();
            }
            return a;
        }
        public double[] nd(int n){
            double[] a = new double[n];
            for (int i = 0; i < n; i++) {
                a[i] = nd();
            }
            return a;
        }
    }
}

Measured memory_bytes: 22612
import java.io.*;
import java.util.*;
import java.lang.*;

public class Main {
    public static MyScanner scan;
    public static PrintWriter out;
    public static void main(String[] args) {
        scan=new MyScanner();
        out=new PrintWriter(new BufferedOutputStream(System.out));

        int t=1;
//        int t=scan.nextInt();
        while(t-->0) {

            int d=scan.nextInt(),time=scan.nextInt(),s=scan.nextInt();
            out.println(((d+s-1)/s<=time)?"Yes":"No");

        }
        out.close();
    }

    //scanner
    public static class MyScanner {
        BufferedReader br;
        StringTokenizer st;

        public MyScanner() {
            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;
        }
    }
}

Measured memory_bytes: 25400
n, k = map(int, input().split())

if k == 0:
  print(n**2)
  exit()

ans  = 0

for b in range(1,n+1):

  # 連続部分
  if b - k > 0:
    ans += (n // b) * (b-k)
    
  # 繰り返し範囲外
  if ((n - (n // b)*b) - (k-1)) > 0:
    ans += ((n - (n // b)*b) - (k-1))


  
  
print(ans)

Measured memory_bytes: 3064
# ABC149
# B Greesy Takahashi
# takはA枚、aokiはB枚、TAKはK回
a, b, k = map(int, input().split())
if k > a:
    if k - a > b:
        print(0,0)
    else:
        print(0,b - (k - a))
else:
    print(a-k,b)


Measured memory_bytes: 9088
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define countof(array) (sizeof(array) / sizeof(array[0]))
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,n,s) for(int i = s; i < (n); ++i)
#define rsrep(i,n,s) for(int i = (n)-1; i >= s; --i)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define aall(a) (a), (a)+countof(a)//for array sorting
#define raall(a) (a), (a)+countof(a), greater<>()
#define show(x) cout<<#x<<" = "<<x<<endl;
#define vfind(v, a) find(all(v), a) != v.end()
#define yn(f) { if (f) puts("YES"); else puts("NO"); }
#define yns(f) { if (f) puts("Yes"); else puts("No"); }
#define show_ary(...) { cout<<#__VA_ARGS__<<" = "; for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define show_pair(...) cout<<#__VA_ARGS__<<" = "<<endl; for (const auto& x : (__VA_ARGS__)) { cout<<"  "<<x.fi<<" : "<<x.se<<endl; }
#define out_ary(...) { for (const auto& x : (__VA_ARGS__)) { cout<<x<<" "; } cout<<endl; }
#define argmax(v) distance((v).begin(), max_element(all(v)))
#define argmin(v) distance((v).begin(), min_element(all(v)))
#define vmax(v) *max_element(all(v))
#define vmin(v) *min_element(all(v))
typedef long long int ll;
typedef pair<int, int> P;
typedef vector<P> vpair;
typedef vector<int> vint;
typedef vector<ll> vll;
typedef vector<double> vdouble;
typedef vector<string> vstr;
typedef vector<bool> vbool;
typedef vector<vint> vvint;
typedef vector<vll> vvll;
typedef vector<vstr> vvstr;
typedef vector<vbool> vvbool;
const ll LINF = 2000000000000000000ll;
const int INF = 1000000100;
const ll MOD = 1e9+7;

int main() {
    ll n, m;
    cin >> n >> m;
    vector<pair<ll, ll>> shop(n);
    rep(i, n) {
        cin >> shop[i].fi >> shop[i].se;
    }
    sort(all(shop));
    ll ans = 0;
    rep(i, n) {
        if (m <= 0) break;
        ll mn = min(m, shop[i].se);
        ans += shop[i].fi * mn;
        m -= mn;
    }

    cout << ans << endl;
    return 0;
}

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


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define rep(i,s,f) for(i=s;i<f;i++)
#define db cout<<'h'<<'i'<<endl 
#define pb push_back
#define pii pair<int,int>
#define F first
#define S second
#define B begin()
#define E end()
#define vi vector<int>
#define vii vector<pair<int,int>>
#define boost ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define PI 3.14159265
#define mod 1000000007
#define mod2 998244353
#define space 100005
//<<fixed << setprecision(9)

int main()
{
    int n,i,j,t;
    boost;

    cin>>n;
    int arr[n+1];
    
    int idx[n+1];
    rep(i,1,n+1)
    {
        cin>>arr[i];
        idx[arr[i]]=i;
    }
    set<int> p;
    set<int>::iterator it;
    p.insert(idx[n]);
    int s,ss,g,gg;
    ll l,r;
    ll ans=0;
    for(i=n-1;i>=1;i--)
    {
        p.insert(idx[i]);
        it=p.find(idx[i]);
        auto jt=it;

        if(it!=p.begin()) 
        {
            it=prev(it,1);
            s=*it;
            if(it==p.begin())
            {
                l=s;
            }
            else
            {
                it=prev(it,1);
                ss=*it;
                l=s-ss;
            }
            it=jt;
            if(*it==*p.rbegin())
            {
                r=n-idx[i]+1;
            }
            else
            {
                it++;
                r=*it-idx[i];
            }
            ans+=l*r*i;
        }
        it=jt;
        if(*it!=*p.rbegin())
        {
            it++;
            if(*it==*p.rbegin())
            {
                r=n-*it+1;
            }
            else
            {
                g=*it;
                it++;
                gg=*it;
                r=gg-g;
            }
            it=jt;
            if(it==p.begin()) l=idx[i];
            else
            {
                it=prev(it,1);
                l=idx[i]-*it;
            }
            ans+=l*r*i;
        }
    }
    cout<<ans;

    return 0;
}



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

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

int eval(int x) {
	int ret=0;
	while(x)
		ret+=x%10, x/=10;
	return ret;
}

int main() {
	cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
	int n,a,b; cin>>n>>a>>b;
	int ret=0;
	for (int x=1; x<=n; x++) {
		int s=eval(x);
		if(a<=s&&s<=b)
			ret+=x;
	}
	cout << ret << endl;
	return 0;
}


Measured memory_bytes: 256
function MainB(input) {
	input = input.split("\n");
	var mod10 = 10;
	var dish = 0;
	var total = 0;
	for(var i in input){
		var tmp = input[i] % 10;
		if(tmp != 0 && tmp < mod10){
			mod10 = tmp;
			dish = i;
		}
		total += Math.ceil(input[i] / 10) * 10;
	}

	if(mod10 != 10) total = total - 10 + mod10;

	console.log('%d',total);
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
MainB(require("fs").readFileSync("/dev/stdin", "utf8"));

Measured memory_bytes: 7372
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
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;}
#define ALL(a) (a).begin(), (a).end()
#define FOR(i, a, b) for (int i=(a);(i)<(b);(i)++)
#define REP(i, n) for (int i=0;(i)<(n);(i)++)
#define REPS(i, n) for (int i=1;(i)<=(n);(i)++)
#define RREP(i, n) for (int i=(x-1);(i)>=0;(i)--)
#define RREPS(i, n) for (int i=n;(i)>0;(i)--)
#define len(x) ((int)(x).size())
#define print(x) (cout<<(x)<<"\n")
const int MOD = 1e9+7;

int extgcd(int a, int b, int& x, int& y) {
    int d = a;
    if (b!=0) {
        d = extgcd(b, a%b, y, x);
        y -= (a/b) * x;
    } else {
        x = 1; y= 0;
    }
    return d;
}

ll modpow(ll x, ll k, ll m) {
    ll ans=1, p=x;
    while (k) {
        if (k&1) ans=ans*p%m;
        p=p*p%m;
        k>>=1;
    }
    return ans;
}

ll modinv(ll x, ll m) {
    return modpow(x, m-2, m);
}

// test
// AGC028-B
signed main() {
    cin.tie(0);
   	ios::sync_with_stdio(false);

    int n; cin>>n;
    vector<ll> a(n); REP(i, n) cin>>a[i];

    vector<ll> inv(n+1);
    FOR(i, 1, n+1) {
        inv[i] = (inv[i-1]+modinv(i, MOD))%MOD;
    }


    ll ans = 0;
    ll f = 1;
    REP(i, n) {
        ans = (ans + a[i]*(inv[i+1]+inv[n-i]-1)%MOD)%MOD;
        f = f*(i+1)%MOD;
    }

    print(ans*f%MOD);
}

Measured memory_bytes: 1792
#define _CRT_SECURE_NO_WARNINGS
#include"bits/stdc++.h"
#ifdef _DEBUG
#define DBG(n) n
#else
#define DBG(n)
#endif
#define INF         1e9
#define INFLL       1e18
#define EPS         1e-9
#define REP(i,n)    for(ll i=0,i##_len=(n);i<i##_len;++i)
#define REP1(i,n)   for(ll i=1,i##_len=(n);i<=i##_len;++i)
#define REPR(i,n)   for(ll i=(n)-1;i>=0;--i)
#define REPR1(i,n)  for(ll i=(n);i>0;--i)
#define REPC(i,obj) for(auto i:obj)
#define ALL(obj)    (obj).begin(),(obj).end()
#define SETP(n)     cout << fixed << setprecision(n)
using namespace std;
using ll = long long;
template<typename T = ll>inline T in() { T ret; cin >> ret; return ret; }

signed main()
{
	ll h, m, s;
	while (cin >> h >> m >> s, h != -1) {
		ll byou = h * 3600 + m * 60 + s;

		ll a = 7200 - byou;
		h = a / 3600, m = (a - h * 3600) / 60, s = a % 60;
		printf("%02d:%02d:%02d\n", h, m, s);
		a *= 3;
		h = a / 3600, m = (a - h * 3600) / 60, s = a % 60;
		printf("%02d:%02d:%02d\n", h, m, s);
	}
}


Measured memory_bytes: 3152
#include <bits/stdc++.h>
#define INF (1<<30)
#define MOD 1000000007
#define l_ength size
using ll = long long;
using namespace std;

int main(){
	int a, b;
	cin >> a >> b;
	if( a * b % 2 == 0 ){
		cout << "No" << endl;
	} else {
		cout << "Yes" << endl;
	}
	return 0;
}

Measured memory_bytes: 256
/// @file

#include <algorithm>
#include <iostream>
#include <vector>

namespace {

bool run(std::istream& is, std::ostream& os);
}  // unnamed namespace

/// @brief エントリポイント
#ifdef _TEST
static int run()
#else
int main()
#endif
{
  try {
    if (run(std::cin, std::cout) == false) {
      std::cerr << "main funciton error.\n";
      return EXIT_FAILURE;
    }
  } catch (const std::exception& e) {
    std::cerr << "catch exception\n";
    std::cerr << e.what() << "\n";
    return EXIT_FAILURE;
  }

  return EXIT_SUCCESS;
}

namespace {

/// @brief 実行処理
bool run(std::istream& is, std::ostream& os)
{
  const std::string WINNER_YOU("first");
  const std::string WINNER_RUNRUN("second");

  long n;
  is >> n;

  std::vector<long> a(n);
  for (long i = 0; i < n; ++i) is >> a[i];

  auto itOdd = std::find_if(a.begin(), a.end(), [](long val) { return val % 2; });

  const std::string* WINNER = &WINNER_YOU;
  if (itOdd == a.end()) WINNER = &WINNER_RUNRUN;

  os << *WINNER << "\n";

  return true;
}
}  // unnamed namespace


Measured memory_bytes: 1024
/*
Author : N_o_o_B
Created : April 22 2020 21:18:13 
*/
#include <bits/stdc++.h>
using namespace std;
/*
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
*/
#define TRACE
#ifdef TRACE
#define trace(...) { cerr<<"[ "; __trace__(#__VA_ARGS__, __VA_ARGS__);}
#undef endl
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const pair<Arg1,Arg2> &x) {
    return out<<"("<<x.first<<","<<x.second<<")";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const vector<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
ostream& operator << (ostream& out, const set<Arg1> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1,typename Arg2>
ostream& operator << (ostream& out, const map<Arg1,Arg2> &a) {
    out<<"[";for(const auto &x:a)out<<x<<",";return out<<"]";
}
 
template <typename Arg1>
void __trace__(const string name, Arg1&& arg1){
    cerr << name << " : " << arg1 << " ] " << endl;
}
 
template <typename Arg1, typename... Args>
void __trace__(const string names, Arg1&& arg1, Args&&... args){
    const string name = names.substr(0,names.find(','));
    cerr<<name<<" : "<<arg1<<" | ";
    __trace__(names.substr(1+(int)name.size()), args...);
}
#else
    #define trace(args...)
#endif
 
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vii;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<pair<ll,ll>> vll;
typedef vector<vl> vvl;
//typedef tree<pii, null_type, less<pii>, rb_tree_tag, tree_order_statistics_node_update> oset;
#define fori(i,n) for(int i=0;i<n;i++)
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define repd(i,a,b) for(int i=a;i>=b;i--)
#define ford(i,n)  for(int i=n-1;i>=0;i--)
#define trav(x,a) for(auto& x:a)
#define all(x) x.begin(),x.end()
#define pb push_back
#define endl '\n'
#define sz(a) (int)a.size()
#define fi first
#define se second
clock_t time_p=clock();
void time_taken()
{
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
}
//const ll mod=998244353;
const ll mod=1e9+7;
const ll INF=1e18;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);cout.tie(NULL);
    cout.precision(12);cout << fixed;

    string s;
    cin >> s;
    int n = sz(s);
    int ans = 753;
    fori(i,n-2){
        int num = 0;
        rep(j,i,i+2){
            num = num*10 + (s[j]-'0');
        }
        ans = min(ans,int(abs(num-753)));
    }
    cout << ans << endl;


    time_taken();
    return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.math.*;
import java.lang.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		// 整数の入力
		int n = sc.nextInt();
		List<Integer> list = new ArrayList<>(n);
		List<Integer> sortedList = new ArrayList<>(n);
		for (int i = 0; i < n; i++) {
			int a = Integer.parseInt(sc.next());
			list.add(a);
			sortedList.add(a);
		}
		Collections.sort(sortedList);

		// System.out.println(sortedList);

		int prevP =0;
		int count =0;
		for (int i = 0; i < n; i++) {
			int currentP = list.get(i);
			int currentPSorted = sortedList.get(i);
			// System.out.println(currentP);
			// System.out.println(currentPSorted);

			if(currentP == currentPSorted){

			}else{
				count++;
			}
		}
		
		// System.out.println(count);


			System.out.println(count <= 2 ? "YES" : "NO" );

	}



}


Measured memory_bytes: 21716
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()
}

fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> {
	(0..n).map(|_| read_vec()).collect()
}

pub trait LexicalPermutation {
	/// Return `true` if the slice was permuted, `false` if it is already
	/// at the last ordered permutation.
	fn next_permutation(&mut self) -> bool;
}
impl<T> LexicalPermutation for [T] where T: Ord {
	/// Original author in Rust: Thomas Backman <serenity@exscape.org>
	fn next_permutation(&mut self) -> bool {
		// These cases only have 1 permutation each, so we can't do anything.
		if self.len() < 2 { return false; }

		// Step 1: Identify the longest, rightmost weakly decreasing part of the vector
		let mut i = self.len() - 1;
		while i > 0 && self[i-1] >= self[i] {
			i -= 1;
		}

		// If that is the entire vector, this is the last-ordered permutation.
		if i == 0 {
			return false;
		}

		// Step 2: Find the rightmost element larger than the pivot (i-1)
		let mut j = self.len() - 1;
		while j >= i && self[j] <= self[i-1]  {
			j -= 1;
		}

		// Step 3: Swap that element with the pivot
		self.swap(j, i-1);

		// Step 4: Reverse the (previously) weakly decreasing part
		self[i..].reverse();

		true
	}
}

fn main() {
	let s: String = read();

	let s: Vec<char> = s.chars().collect();

	let ans = if s[2] == s[3] && s[4] == s[5] {
		"Yes"
	} else {
		"No"
	};
	println!("{}", ans);
}


Measured memory_bytes: 4352
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

var (
	sc = bufio.NewScanner(os.Stdin)
	mod int = 1e9 + 7
)

func init() {
	sc.Split(bufio.ScanWords)
}

func main() {
	s := getString()

	flag1 := true
	flag2 := true

	for i := 0; i < len(s); i++ {
		if i % 2 == 0 {
			if s[i] == 'L' {
				flag1 = false
			}
		} else {
			if s[i] == 'R' {
				flag2 = false
			}
		}
	}

	if flag1 && flag2 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}

func getInt() int {
	sc.Scan()
	str := sc.Text()
	value, _ := strconv.Atoi(str)
	return value
}

func getString() string {
	sc.Scan()
	return sc.Text()
}

func abs(a int) int {
	return int(math.Abs(float64(a)))
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func min(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton min() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Min(float64(res), float64(nums[i])))
	}
	return res
}

func max(nums ...int) int {
	if len(nums) == 0 {
		panic("funciton max() requires at least one argument.")
	}
	res := nums[0]
	for i := 0; i < len(nums); i++ {
		res = int(math.Max(float64(res), float64(nums[i])))
	}
	return res
}

func strSearch(a []string, b string) bool {
	for i := 0; i < len(a); i++ {
		if a[i] == b {
			return true
		}
	}
	return false
}

func printIntArray(array []int) {
	strArray := fmt.Sprint(array)
	fmt.Println(strArray[1 : len(strArray) - 1])
}

func calcMod(x int) int {
	return x % mod
}


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



typedef long long int ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,x,t;
    cin>>n;
    ll a[n+1];
    ll i = 1 ;
    while(i<=n)
    {
        cin>>a[i];
        i++;
    }
    ll sum = 0 ;
    i=2;
    while(i<=n)
    {
        if(a[i]>=a[i-1])
        {
            
        }
        else
        {
            ll g = abs(a[i]-a[i-1]);
            sum=sum+g;
            
            
            a[i]=a[i-1];
        }
        
        i++;
    }
    
    cout<<sum  ; 
    
    
    return 0;
}

Measured memory_bytes: 5164
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> l_l;
typedef pair<int, int> i_i;
typedef pair<ll, l_l> lll;
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;
}

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
const ll mod = 1000000007;
struct UnionFind {
    vector<int> par;
    vector<int> rank;
    vector<ll> Size;
    UnionFind(int n = 1) {
        init(n);
    }

    void init(int n = 1) {
        par.resize(n + 1); rank.resize(n + 1); Size.resize(n + 1);
        for (int i = 0; i <= n; ++i) par[i] = i, rank[i] = 0, Size[i] = 1;
    }

    int root(int x) {
        if (par[x] == x) {
            return x;
        }
        else {
            int r = root(par[x]);
            return par[x] = r;
        }
    }

    bool issame(int x, int y) {
        return root(x) == root(y);
    }

    bool merge(int x, int y) {
        x = root(x); y = root(y);
        if (x == y) return false;
        if (rank[x] < rank[y]) swap(x, y);
        if (rank[x] == rank[y]) ++rank[x];
        par[y] = x;
        Size[x] += Size[y];
        return true;
    }

    ll size(int x){
        return Size[root(x)];
    }
};

priority_queue<lll, vector<lll>, greater<lll>> que;

int main() {
    ll N, Q;
    cin >> N >> Q;
    UnionFind uni(N);
    while(Q--) {
        ll A, B, C;
        cin >> A >> B >> C;
        que.push({C, {A, B}});
        que.push({C+1, {(A+1)%N, B}});
    }
    ll ans = 0;
    while(uni.size(1) != N) {
        lll now = que.top();
        que.pop();
        ll a = now.second.first;
        ll b = now.second.second;
        ll c = now.first;
        if(uni.merge(a, b)) {
            ans += c;
            que.push({c+2, {(a+1)%N, (b+1)%N}});
        }
    }
    cout << ans << endl;
    return 0;
}


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

class Main {
 	public static void main(String args[]) throws IOException {
     	BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
      	int N = Integer.parseInt(br.readLine());
      	boolean flag = false ;
      	for(int i=0;i<N;i++) {
         	int tmp = Integer.parseInt(br.readLine());
          	if(tmp%2 != 0) {
             	System.out.println("first");
             	return;
            }
        }
        System.out.println("second");
    }
}

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

using namespace std;

typedef long long ll;
const ll INF = 1LL<<60;

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

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

ll modpow(ll a, ll n, ll mod) {
  ll res = 1;
  while (n > 0) {
    if (n & 1) res = res * a % mod;
    a = a * a % mod;
    n >>= 1;
  }
  return res;
}

const ll MOD = 1e9+7;

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

  int N;
  cin >> N;
  vector<ll> a(N);
  for(int i = 0; i < N; i++) cin >> a[i];
  
  ll ans = 1;
  queue<ll> q;

  int cnt = 0;
  while(cnt < N){
    
    q.push(a[cnt]);
    ll top = q.back();
    if(top < 2 * q.size() - 1){
      ans = (ans * q.size()) % MOD;
      q.pop();
    }
    cnt++;
  }

  for(ll i = 1; i <= q.size(); i++){
    ans = (ans * i) % MOD;
  }

  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 1920
let
  N, M = map(x -> parse(Int, x), split(readline()))
  range = map(x -> parse(Int, x), split(readline()))
  while (M=M-1) > 0 L, R = map(x -> parse(Int, x), split(readline())); range = [max(range[1], L), min(range[2], R)] end
  print((range[1] > range[2]) ? 0 : range[2] - range[1] + 1)
end


Measured memory_bytes: 165972
n = int(input())
ac = 0
wa = 0
tle = 0
re = 0
for _ in range(n):
    s = input()
    if s == "AC":
        ac += 1
    elif s == "WA":
        wa += 1
    elif s == "TLE":
        tle += 1
    elif s == "RE":
        re += 1
print("AC x " + str(ac))
print("WA x " + str(wa))
print("TLE x " + str(tle))
print("RE x " + str(re))


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

#define N 10

int main() {
    int r, d, x;

    cin >> r >> d >> x;
    int a[N];

    for (int i = 0; i < N; i++) {
        a[i] = r * x - d;
        x = a[i];
    }

    for (int i = 0; i < N; i++) {
        cout <<  a[i] << endl;
    }
}

Measured memory_bytes: 256
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <functional>
using namespace std;

#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repl(i,0,n)
#define mp(a,b) make_pair((a),(b))
#define pb(a) push_back(a)
#define all(x) (x).begin(),(x).end()
#define dbg(x) cout<<#x"="<<(x)<<endl
#define fi first
#define se second

#define INF 2147483600

int main(){
  set<int> s;
  int a,b,c;
  cin>>a>>b>>c;
  s.insert(a);s.insert(b);s.insert(c);

  cout<<s.size()<<endl;

  return 0;
}


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

#define INF 1000000

using namespace std;

int N, M;
vector<int> path[50];
int pre[50], low[50];
int order_count;
int bridge_count;

void dfs(int n, int par) {
  pre[n] = low[n] = order_count++;

  for (int i = 0; i < path[n].size(); i++) {
    int j = path[n][i];
    if(j == par) continue;
    if (low[j] == INF) {
      dfs(j, n);
    }
    if (low[n] > low[j]) {
      low[n] = low[j];
    }
  }

  if (par != -1 && pre[n] == low[n]) {
    bridge_count++;
  }
}

int main() {
  int a, b;
  scanf("%d %d", &N, &M);
  for (int i = 0; i < M; i++) {
    scanf("%d %d", &a, &b);
    a--; b--;
    path[a].push_back(b);
    path[b].push_back(a);
  }

  for (int i = 0; i < N; i++) {
    pre[i] = low[i] = INF;
  }
  order_count = 0;
  bridge_count = 0;
  dfs(0, -1);

  // for (int i = 0; i < N; i++) {
  //   printf("pre[%d] = %d, low[%d] = %d\n", i + 1, pre[i], i + 1, low[i]);
  // }

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

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, a, n) for(int i = a; i < n; i++)
#define REP(i, n) rep(i, 0, n)
#define repb(i, a, b) for(int i = a; i >= b; i--)
#define all(a) a.begin(), a.end()
#define int long long
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef pair<int, int> P;
const int mod = 1000000007;
const int INF = 1e12;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, k;
    cin >> n >> k;
    vector<int> a(n), d(n);
    rep(i, 0, n){
        cin >> a[i];
        a[i]--;
        d[a[i]]++;
    }
    sort(all(d));
    int ans = 0;
    rep(i, 0, n - k) ans += d[i];
    cout << ans << endl;
}

Measured memory_bytes: 3456
#include<stdio.h>
int main()
{	
	char a[21];
	while(gets(a)!=NULL)
	{
		int i=20;

		while(a[i--]!='\0')
			;
		for(;i>=0;i--)
			printf("%c",a[i]);
		printf("\n");
	}

    return 0;
}

Measured memory_bytes: 524
object Main extends App {

  import scala.io.StdIn._

  solve
  def solve:Unit = {
    val n = readLine.trim.toInt
    if (n == 0) return
    val words = Array.tabulate(n) { _ ⇒ readLine.trim.split(' ') }.flatten.groupBy(s ⇒ s).mapValues(_.length).toArray
    val k = readLine.head
    val filtered = words.filter(_._1.head == k)
    if (filtered.isEmpty) {
      println("NA")
    }else{
      val w = filtered.sortWith((a, b) ⇒ if (a._2 == b._2) a._1 < b._1 else a._2 > b._2).map(_._1)
      if (w.length > 5) println(w.take(5).mkString(" "))
      else println(w.mkString(" "))
    }
    solve
  }
  implicit class Extension[T](val value :T) extends AnyVal {
    @inline
    def let[A](@inline func: T ⇒ A): A = func(value)
    @inline
    def also(@inline func: T ⇒ Unit): T = {func(value); value}
  }
}


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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

template<class T1, class T2> void chmin(T1 &a, T2 b){if(a>b)a=b;}
template<class T1, class T2> void chmax(T1 &a, T2 b){if(a<b)a=b;}

using Pi = pair<int, int>;
using Ti = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

int ans = 0;
vint b;
void dfs(int idx, const int& n, const vint& a) {
  if(idx == n) {
    int mul = 1;
    for(int i = 0; i < n; i++) {
      mul *= b[i];
    }
    if(mul%2 == 0) ans++;
    return;
  }
  for(int i = -1; i <= 1; i++) {
    b.push_back(a[idx]+i);
    dfs(idx+1, n, a);
    b.pop_back();
  }
}

signed main()
{
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n;
  cin >> n;
  vint a(n);
  rep(i, n) cin >> a[i];
  dfs(0, n, a);
  cout << ans << endl;

  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#define N 105
using namespace std;

int a, b;
char c[N][N];
int main()
{
	int i, j;
	cin >> a >> b;
	cout << "100 100\n";
	for (i = 0; i < 50; i++) for (j = 0; j < 100; j++) c[i][j] = '#';
	for (i = 50; i < 100; i++) for (j = 0; j < 100; j++) c[i][j] = '.';
	a--, b--;
	for (i = 0; i < 50; i += 2) for (j = 0; j < 100 && a; j += 2, a--) c[i][j] = '.';
	for (i = 51; i < 100; i += 2) for (j = 0; j < 100 && b; j += 2, b--) c[i][j] = '#';
    for (i = 0; i < 100; i++, puts("")) for (j = 0; j < 100; j++) printf("%c", c[i][j]);
    return 0;
}

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

int min(int A,int B){
    return A<B?A:B;
}

int MAX(int A,int B){
    return A>B?A:B;
}

int main(void){
    int n,ans=0,max=0;
    scanf("%d",&n);
    for (int i=0; i<n; i++){
        int h;
        scanf("%d\n",&h);
        if (h>=max){
            ans++;
            max=h;
        }
    }
    printf("%d\n",ans);
    return 0 ;
}

Measured memory_bytes: 128
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <cmath>
#include <iomanip>

using namespace std;
using ll = long long;
using vi = vector<int>;

#define in(v) v; cin >> v;
#define rep(i,n) for(int i=0,_i=(n);i<_i;++i)
#define all(f,c,...) (([&](decltype((c)) cccc) { return (f)(begin(cccc), end(cccc), ## __VA_ARGS__); })(c))
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;}

// debug
template<class T>ostream& operator<<(ostream& os,const vector<T>& vec){os<<"{";for(size_t i=0;i<vec.size();++i)os<<(i?", ":"")<<vec[i];os<<"}";return os;}
ostream& operator<<(ostream& os,const vector<char>&v){for(size_t i=0;i<v.size();++i)os<<v[i];return os;}
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>& rhs){os<<"("<<rhs.first<<", "<<rhs.second<<")";return os;}

#ifdef LOCAL
void debug() {cerr << "\n";}
template<class First> void debug(const First& first) {cerr<<first<<"\n";}
template<class First, class... Rest> void debug(const First& first, const Rest&... rest) {cerr<<first<<",";debug(rest...);}
void debug2() {cerr << "\n";}
template<class First> void debug2(const First& first) {cerr<<first<<" ";}
template<class First, class... Rest> void debug2(const First& first, const Rest&... rest) {cerr<<first<<" ";debug2(rest...);}
#else
#define debug(...) 42
#define debug2(...) 42
#endif

int main() {
  ll in(X);

  ll x = 100;
  rep(i, 1000000) {
    x *= 1.01;
    if (x >= X) {
      cout << i+1 << endl;
      return 0;
    }
  }

  return 0;
}


Measured memory_bytes: 3640
#include <iostream>
//#include <set>
//#include <map>
//#include <iomanip>
//#include <algorithm>
//#include <numeric>
//#include <queue>
//#include <stack>
//#include <math.h>
#include <vector>
//#include <unordered_map>
//#include <string>
typedef long long LL;
//typedef long double LD;
using namespace std;

#define MOD 1000000007

int main() {
    int n;
    vector<int> x;
    int tmp_x;
    double tmp_center=0;
    LL ans=MOD;
    LL tmp_ans;
    cin >> n;
    for(int i=0; i<n; i++){
        cin >> tmp_x;
        x.push_back(tmp_x);
        tmp_center+=tmp_x;
    }
    tmp_center/=n;
    for(int i=(int)tmp_center-1; i<=(int)tmp_center+1; i++){
        tmp_ans=0;
        for(int j=0; j<n; j++){
            tmp_ans+= (x[j]-i)*(x[j]-i);
        }
        if(tmp_ans<ans){
            ans=tmp_ans;
        }
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        String inputnum;

        while(true) {
            inputnum = sc.next();
            int ans = 0;

            if(inputnum.equals("0"))
                break;

            for(int i =0; i < inputnum.length(); i++) {
                ans += Character.getNumericValue(inputnum.charAt(i));
            }
            System.out.println(ans);
        }
    }
}


Measured memory_bytes: 26304
#include <iostream>
#include <algorithm>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <vector>
#include <array>
#include <stack>
#include <list>
#include <queue>
#include <deque>
#include <climits>
#include <utility>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <set>
#include <complex>
#include <numeric>

#include <time.h>
#include <float.h>

#define loop(i, start, end) for(int i = (start); i <= (end); i++)
#define loopRev(i, start, end) for(int i = (start); i >= (end); i--)
#define FLASH ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define testCases(t) cin >> t; while(t--)
#define PN(n) cout << (n)
#define PN1(n) cout << (n) << " "
#define PN2(a, b) cout << (a) << " " << (b) << " "
#define PN3(a, b, c) cout << (a) << " " << (b) << " " << (c) << " "
#define PNN1(n) cout << (n) << endl
#define PNN2(a, b) cout << (a) << " " << (b) << endl
#define PNN3(a, b, c) cout << (a) << " " << (b) << " " << (c) << endl
#define PrintObject(ar) for(auto var: ar) cout << var << " "; cout << endl
#define PrintMap(map) for(auto var: map) PNN2(var.first, var.second)
#define IN1(n) cin >> n
#define IN2(a, b) cin >> a >> b
#define IN3(a, b, c) cin >> a >> b >> c
#define ALL(s) s.begin(), s.end()
#define ENTER PNN1("")
#define llPair std::pair<lli, lli>
#define iiPair std::pair<int, int>
// #define ONLINE_JUDGE

typedef long long int lli;
typedef long int li;
typedef unsigned long long int ulli;
typedef long double ld;

using namespace std;

template <typename T>
T ii() {
	T a;
	IN1(a);
	return a;
}

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

	int n;
	IN1(n);
	lli ans = 1, MAX = (lli) 1e18;
	vector<lli> ar(n);
	for(auto &it: ar) {
		IN1(it);
		if(it == 0) {
			PNN1(0);
			return 0;
		}
	}

	for(auto it: ar) {
		if(it > MAX / ans) {
			PNN1(-1);
			return 0;
		}

		ans *= it;
	}

	PNN1(ans);

	return 0;
}


Measured memory_bytes: 3972
#include <bits/stdc++.h>
using namespace std;
struct Fast {
    Fast() {
        cin.tie(0);
        ios::sync_with_stdio(false);
        cout << fixed << setprecision(20);
    }
} fast;
template <typename A, size_t N, typename T> void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
// long long mod = 998244353;
#define REP(i, n) for (long long i = 0; i < (n); i++)
#define rep(i, a, n) for (long long i = a; i < (n); i++)
typedef long long ll;
typedef pair<ll, ll> P;
long long mod = 1000000007;
long long modpow(long long m, long long n, long long modvalue) {
    if (n == 0) return 1;
    if (n % 2 == 0) {
        long long t = modpow(m, n / 2, modvalue);
        return t * t % modvalue;
    } else {
        return modpow(m, n - 1, modvalue) * m % modvalue;
    }
}

long long moddiv(long long a, long long b, ll modvalue) { return (a * modpow(b, mod - 2, modvalue)) % modvalue; }

const ll INF = 1LL << 60;

string change_binary(long long a) {
    string ret;
    for (int i = 31; i >= 0; i--) {
        ret += (a >> i & 1) + '0';
    }
    return ret;
}

ll nCkmod(ll n, ll k, ll modvalue) {
    ll numera = 1;
    for (int i = n; i > n - k; i--) {
        numera *= i;
        numera %= modvalue;
    }
    ll denomi = 1;
    REP(i, k) {
        denomi *= (i + 1);
        denomi %= modvalue;
    }
    return moddiv(numera, denomi, modvalue);
}

map<ll, ll> cnt;
void primeFactors(long long n) {
    while (n % 2 == 0) {
        cnt[2]++;
        n = n / 2;
    }
    for (int i = 3; i <= sqrt(n); i = i + 2) {
        while (n % i == 0) {
            cnt[i]++;
            n = n / i;
        }
    }
    if (n > 2) {
        cnt[n]++;
    }
}
int main() {
    int n, m;
    cin >> n >> m;
    ll now = 0;
    for (int i = 1; i * i <= m; i++) {
        if (m % i == 0 && m / i >= n) {
            now = max(now, (ll)i);
        }
        if (m % i == 0 && m / (m / i) >= n) {
            now = max(now, (ll)m / i);
        }
    }
    cout << now << endl;
}

Measured memory_bytes: 3676
a = list(map(int, input().split()))
if a[0] * a[1] * a[2] % 2:
    ans = 10 ** 19
    for i in range(3):
        ans = min(ans, min(a[i], a[(i + 1) % 3]) * a[(i + 2) % 3])
    print(ans)
else:
    print(0)


Measured memory_bytes: 3060
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;

#[allow(dead_code)]
struct Scanner<'a> {
    cin: StdinLock<'a>,
}
#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn input<T: FromStr>(&mut self) -> T {
        self.read().unwrap()
    }
}

fn main() {
    let cin = stdin();
    let cin = cin.lock();
    let mut sc = Scanner::new(cin);
    let (a, b): (i32, i32)= (sc.input(), sc.input());
    println!("{}", if (a * b) % 2 == 0 { "Even" } else { "Odd" });
}


Measured memory_bytes: 4352
def main():
    s=input()
    a=int(s[0])
    b=int(s[1])
    c=int(s[2])
    d=int(s[3])
    ansst=""
    def rec3(ans):
        if ans+d==7:
            ansst="+"+str(d)+"=7"
            return ansst
        if ans-d==7:
            ansst="-"+str(d)+"=7"
            return ansst
        return ""
    def rec2(ans):
        ansst=rec3(ans+c)
        if ansst:
            ansst="+"+str(c)+ansst
            return ansst
        ansst=rec3(ans-c)
        if ansst:
            ansst="-"+str(c)+ansst
            return ansst
        return ""

    def rec(ans):
        ansst=rec2(ans+b)
        if ansst:
            ansst=str(a)+"+"+str(b)+ansst
            return ansst
        ansst=rec2(ans-b)
        if rec2(ans-b):
            ansst=str(a)+"-"+str(b)+ansst
            return ansst
        return False
    print(rec(a))
    
if __name__=='__main__':
    main()


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i = (a); i <= (b); i++)
#define rng(a) a.begin(), a.end()
#define sz(x) (int)(x).size()
#define se second
#define fi first
#define prev            ioyhhhhhhyoi    
#define next          sdNNNmNNNNNNNmds. 
#define y0          -hNNNNy_yNNNNNN_lNh-
#define y1          mNNNNNdtdNNNNNNtsNNm
#define yn          mNNNNNNNNy--:smNNNms
#define tm          .+oooooosyysooooo+- 
#define read               :yhy/        
#define rank              :mNmo         
#define index              ... 
#define pb push_back
#define pcnt __builtin_popcountll
#define rrep(i,a,b) for(int i = (b); i >= (a); i--)
#define rall(x,a) for(auto x : a)
#define MOD 1000000007
#define endl "\n"
typedef long long ll;
using namespace std;

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int a, b;
    cin >> a >> b;
    if(a - b & 1) {
        cout << "IMPOSSIBLE" << endl;
    } else {
        cout << (a + b) / 2 << endl;
    }
    return 0;
}


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

struct KMP {
    vector<long long> pat;
    vector<int> fail;

    // construct
    KMP(const vector<long long> &p) { init(p); }
    void init(const vector<long long> &p) {
        pat = p;
        int m = (int)pat.size();
        fail.assign(m + 1, -1);
        for (int i = 0, j = -1; i < m; ++i) {
            while (j >= 0 && pat[i] != pat[j]) j = fail[j];
            fail[i + 1] = ++j;
        }
    }

    // the period of S[0:i]
    int period(int i) { return i - fail[i]; }

    // the index i such that S[i:] has the exact prefix p
    vector<int> match(const vector<long long> &S) {
        int n = (int)S.size(), m = (int)pat.size();
        vector<int> res;
        for (int i = 0, k = 0; i < n; ++i) {
            while (k >= 0 && S[i] != pat[k]) k = fail[k];
            ++k;
            if (k >= m) res.push_back(i - m + 1), k = fail[k];
        }
        return res;
    }
};

int main() {
    int n;
    cin >> n;
    vector<ll> a(n), b(n);
    rep(i, n) cin >> a[i];
    rep(i, n) cin >> b[i];
    vector<ll> da(n * 2), db(n);
    for (int i = 0; i < n * 2; ++i) {
        int j = i % n;
        int k = (i + 1) % n;
        da[i] = a[j] ^ a[k];
        if (i < n) db[i] = b[j] ^ b[k];
    }
    KMP kmp(db);
    auto v = kmp.match(da);
    for (auto k : v) {
        if (k < n) cout << k << " " << (a[k] ^ b[0]) << endl;
    }
}

Measured memory_bytes: 14828