akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<algorithm>
#define fo(i,a,b) for(i=a;i<=b;i++)
using namespace std;
typedef long long ll;
const int maxn=300+10,mo=1000000007;
int f[maxn][maxn][maxn],h[maxn],go[maxn],dis[maxn],nxt[maxn];
int i,j,k,l,r,t,n,m,ans,tot;
void add(int x,int y,int z){
    go[++tot]=y;
    dis[tot]=z;
    nxt[tot]=h[x];
    h[x]=tot;
}
int main(){
    scanf("%d%d",&n,&m);
    fo(i,1,m){
        scanf("%d%d%d",&l,&r,&t);
        if (r==1&&t!=1){
            printf("0\n");
            return 0;
        }
        add(r,l,t);
    }
    f[1][0][0]=1;
    fo(i,1,n-1){
        fo(j,0,i)
            fo(k,j,i)
                if (f[i][j][k]){
                    if (j||k){
                        (f[i+1][k][i]+=f[i][j][k])%=mo;
                        (f[i+1][j][i]+=f[i][j][k])%=mo;
                    }
                    else (f[i+1][0][i]+=f[i][j][k])%=mo;
                    (f[i+1][j][k]+=f[i][j][k])%=mo;
                }
        t=h[i+1];
        while (t){
            l=go[t];
            fo(j,0,i)
                fo(k,j,i){
                    r=1;
                    if (j>=l) r++;
                    if (k>=l) r++;
                    if (r!=dis[t]) f[i+1][j][k]=0;
                }
            t=nxt[t];
        }
    }
    fo(j,0,n)
        fo(k,j,n){
            r=1;
            if (j) r++;
            if (k) r++;
            if (r==1) (ans+=(ll)f[n][j][k]*3%mo)%=mo;
            else (ans+=(ll)f[n][j][k]*6%mo)%=mo;
        }
    (ans+=mo)%=mo;
    printf("%d\n",ans);
}

Measured memory_bytes: 112896
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define MAX(a,b) (a>b?a:b)
#define MIN(a,b) (a<b?a:b)
#define VEC(kata, num) (kata*)malloc(num * sizeof(kata))
#define DB puts("ok")
#define SENTINEL 1000000007
typedef long long lli;

lli f(lli a, lli b) {
    if(a==0) {
        if(b%2==0) {
            if(((b+1)/2)%2==0) {
                return b ^ 0;
            } else {
                return b ^ 1;
            }
        } else {
            if(((b+1)/2)%2==0) {
                return 0;
            } else {
                return 1;
            }
        }
    } else {
        return f(0, a-1) ^ f(0, b);
    }
}

int main()
{
    lli a, b;
    scanf("%lld%lld",&a,&b);
    printf("%lld",f(a,b));

    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define PI arccos(-1)
#define rep(i, N) for (int i = 0; i < (N); i++)
#define REP(i, a, N) for (int i = a; i < (N); i++)
#define rrep(i, N, k) for (int i = (N); i >= (k); i--);
#define all(x) (x).begin(), (x).end()
#define vi vector<int>
#define pi pair<int, int>
#define pl pair<ll, ll>
template<class T> istream &operator>>(istream&is,vector<T>&v){for(auto &elemnt:v)is>>elemnt;return is;}
template<class T,class U> istream &operator>>(istream&is,pair<T,U>&p){is>>p.first>>p.second;return is;}
const int MOD = 1e9+ 7;
const int INF = numeric_limits<int>::max() - (int)1e8;
const ll INFLL = numeric_limits<ll>::max() - (ll)1e17;

int main() {
    ll N, M;
    cin >> N >> M;
    vector<ll> A(M);
    cin >> A;
    ll ans = N - accumulate(A.begin(), A.end(), 0LL);
    if (ans < 0) {
        cout << -1 << endl;
    } else {
        cout << ans << endl;
    }
}


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

int main() {
    int n,temp,maxi1,maxi2;
    cin>>n;
    vector<int> a(n),b(n);
    rep(i,n) {
        cin>>a[i];
        b[i]=a[i];
    }
    sort(a.begin(),a.end());
    maxi1=a[n-2],maxi2=a[n-1];
    rep(i,n) {
        if (b[i]!=maxi2) cout<<maxi2<<endl;
        else cout<<maxi1<<endl;
    }
}

Measured memory_bytes: 3200
import math
n = int(input())
n_rev = int(math.sqrt(n))

cnt = 0
for i in range(1, n_rev + 1):
    if ((n - 1) // i - i) * 2 + 1 >= 0:
        cnt += ((n - 1) // i - i) * 2 + 1

print(cnt)


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

int main(){
  int N,K,R,S,P;
  string hands;
  cin >> N >> K;
  cin >> R >> S >> P;
  cin >> hands;

  int ans= 0;
  for(int mod=0; mod< K; mod++){
    char hand= hands.at(mod);
    int dpR= (hand=='s') ? R : 0;
    int dpP= (hand=='r') ? P : 0;
    int dpS= (hand=='p') ? S : 0;
    int bufR, bufP, bufS;
    for(int i=K+ mod; i<N; i+=K){
      hand= hands.at(i);
      bufR= (hand=='s') ? R+ max(dpP, dpS) : max(dpP, dpS);
      bufP= (hand=='r') ? P+ max(dpS, dpR) : max(dpS, dpR);
      bufS= (hand=='p') ? S+ max(dpR, dpP) : max(dpR, dpP);
      dpR= bufR; dpP= bufP; dpS= bufS;
    }
    ans+= max(dpR, max(dpP, dpS));
  }

  cout << ans << endl;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
#define ll long long
#define ld long double
#define MOD 1000000007
#define nl cout << bl
#define rt ll Q[100005] = {0}
#define mp make_pair
#define test() \
    ull t;     \
    cin >> t;  \
    while (t--)
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define s(ar, n) sort(ar, ar + n)
#define rs(ar, n) sort(ar, ar + n, greater<ll>())
#define oa(a, n)               \
    for (ll i = 0; i < n; i++) \
        cout << a[i] << " ";
#define cn(a, n)               \
    for (ll i = 0; i < n; i++) \
        cin >> a[i];
#define ov(a, n)                    \
    for (ll i = n - 1; i >= 0; i--) \
        cout << a[i] << " ";        \
    nl
#define ovp(a, n)              \
    for (ll i = 0; i < n; i++) \
        cout << a[i].ff << " " << a[i].ss << bl;
#define maxa(ar, N) *max_element(ar, ar + N)
#define mina(ar, N) *min_element(ar, ar + N)
#define present(c, x) ((c).find(x) != (c).end())
#define fastio()                  \
    ios_base::sync_with_stdio(0); \
    cin.tie(0);                   \
    cout.tie(0)
typedef pair<int, int> pii;
ll fast_exp(ll base, ll exp)
{
    ll res = 1;
    while (exp > 0)
    {
        if (exp % 2 == 1)
            res = (res * base) % MOD;
        base = (base * base) % MOD;
        exp /= 2;
    }
    return res % MOD;
}
ll fib(ll n)
{
    if (n < 2)
        return n;
    ll a = 0, b = 1, pre;
    int i = 1;
    while (i < n)
    {
        pre = (a + b) % MOD;
        a = b;
        b = pre;
        i++;
    }
    return pre;
}
ll fac(ll n)
{
    if (n % 2 == 0)
        return 2;

    for (ll i = 3; i * i <= n; i += 2)
    {
        if (n % i == 0)
            return i;
    }

    return n;
}
ll fact(ll n)
{
    if (n > 1)
        return n * fact(n - 1);
    else
        return 1;
}
bool sortbysec(const tuple<int, int, int> &a,
               const tuple<int, int, int> &b)
{
    return (get<1>(a) < get<1>(b));
}
int main()
{
    int n, k;
    cin >> n >> k;
    int a[n];
    cn(a, n);
    sort(a, a + n);
    ll ans = 0;
    for (int i = 0; i < k; i++)
    {
        ans += a[i];
    }
    cout << ans << "\n";
}

Measured memory_bytes: 3628
from sys import stdin

n = int(stdin.readline().rstrip())
point = 0
kaisuu = 1
a = n

if n == 1:
    moto = 1
    point += 1
elif n == 2:
    moto = 2
    point += 1
elif n == 4:
    moto = 4
    point += 1
else:
    moto = 4
while point <2:
    if a % 2 == 0:
        a = a//2
        kaisuu += 1
        if a == moto:
            point += 1
    else:
        a = a*3+1
        kaisuu += 1
        if a == moto:
            point += 1

print(kaisuu)

Measured memory_bytes: 3064
loop do
    n = gets.to_i
    break if n == 0

    k = nil 
    sum = 0 
    (1..12).each do |i| 
        sum += gets.split.map(&:to_i).inject(:-)
        k = i if !k && sum >= n
    end 

    puts k ? k : 'NA'
end

Measured memory_bytes: 8724
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
//    freopen("input.txt", "r", stdin);
    string s;
    cin >> s;
    if (s.size() % 2) {
        cout << "No";
        return 0;
    }
    for (int i = 0; i < s.size(); i += 2) {
        if (s[i] != 'h' || s[i + 1] != 'i') {
            cout << "No";
            return 0;
        }
    }
    cout << "Yes";
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int digit(int n){
    int digitsum = 0;
    while(n){
        digitsum += n % 10;
        n = n / 10;
    }
    return digitsum;
}
 
int main(){
    int n;
    cin >> n;
    int ans = 1000000;
    for(int i = 1; i < n; i++){
        if(ans > digit(i) + digit(n-i)){
            ans = digit(i) + digit(n-i);
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3536
x=input()
n=0
w=0
s=0
e=0
for i in range(len(x)):
    if x[i]=="N":
        n+=1
    elif x[i]=="W":
        w+=1
    elif x[i]=="S":
        s+=1
    else:
        e+=1

f=1
if n:
    if s:
        pass
    else:
        f=0
if s:
    if n:
        pass
    else:
        f=0
if w:
    if e:
        pass
    else:
        f=0
if e:
    if w:
        pass
    else:
        f=0

if f:
    print("Yes")
else:
    print("No")


Measured memory_bytes: 38256
import itertools as it

N, M = map(int, input().split())
ab = tuple(set(map(int, input().split())) for _ in range(M))

P = it.permutations(range(1, N + 1), N)

res = 0
for p in P:
    if p[0] == 1:
        for i in range(N - 1):
            if not(set({p[i], p[i + 1]}) in ab):
                break
        else:
            res += 1

print(res)

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

#define int long long int
#define fastio ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);

const int mod = 1e9 + 7;
const int N = 2e5 + 5;
const int inf = 1e16 + 2;


void solve(int z) {
    int n , m , k ;
    string s , s1 ;
    cin >> k >> n >> m;
    for(int i = 1 ; i * k <= m ; i ++) {
        if(i * k >= n and i * k <= m) {
            cout << "OK" <<'\n';
            return;
        }
    }
    cout << "NG";
    cout << '\n';
}

/*
 */

int32_t main()
{
    fastio
    int testcase = 1;
    //cin >> testcase;
    int x = 1;
    while(testcase --) {
        solve(x ++);
    }
    
    return 0;
}
 



Measured memory_bytes: 3612
/*Q-3---AlSing Programming Contest(2020)
Let f(n) be the number of triples of integers(x,y,z) that satisfy both of the following conditions:-
1>1≤x,y,z
2>(x^2)+(y^2)+(z^2)+(x.y)+(y.z)+(z.x)=n

Given an integer-N,find each of f(1),f(2),f(3),…,f(N(1≤N≤10^4)

Example-->
N=20 --> 0
		 0
		 0
		 0
		 0
  		 1
		 0
		 0
		 0
		 0
		 3
		 0
		 0
		 0
		 0
		 0
		 3
		 3
		 0
		 0
*For n=6,only(1,1,1) satisfies both of the conditions.Thus,f(6)=1.
*For n=11,three triples,(1,1,2);(1,2,1);and(2,1,1) satisfy both of the conditions.Thus,f(11)=3.
*For n=17,three triples,(1,2,2);(2,1,2);and(2,2,1) satisfy both of the conditions.Thus,f(17)=3.
*For n=18,three triples,(1,3,1);(1,1,3);and(3,1,1) satisfy both of the conditions.Thus,f(18)=3.*/

//EASY QUESTION
#include <bits/stdc++.h>
#define M 1000000007
#define ll long long
using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
	ll n{0};
	cin>>n;

	ll count[n+1];
	memset(count,0,sizeof(count));

	for(ll x=1;x<=100;x++){
		for(ll y=1;y<=100;y++){
			for(ll z=1;z<=100;z++){
				ll temp=(x*x)+(y*y)+(z*z)+(x*y)+(x*z)+(y*z);
				if(temp<=n)
					count[temp]++;
			}
		}
	}

	for(ll i=1;i<=n;i++)
		cout<<count[i]<<endl;

	return 0;
}



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

#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define all(x) (x).begin(),(x).end()
using ll = long long;
string char_to_string(char val) {
  return string(1, val);
}
int char_to_int(char val) {
  return val - '0';
}
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;
}
int vector_finder(std::vector<ll> vec, int number) {
  auto itr = std::find(vec.begin(), vec.end(), number);
  size_t index = std::distance( vec.begin(), itr );
  if (index != vec.size()) { // 発見できたとき
    return 1;
  }
  else { // 発見できなかったとき
    return 0;
  }
}

int main() {
  int q; cin >> q;
  vector<string> X(q), Y(q); REP(i, q) cin >> X[i] >> Y[i];
  vector<vector<int>> dp(1010, vector<int>(1010));
  for(int i = 0; i < q; ++i) {
    REP(a, 1010) {
      REP(b, 1010) {
        dp[a][b] = 0;
      }
    }
    for(int k = 0; k < X[i].size(); ++k) {
      for(int m = 0; m < Y[i].size(); ++m) {
        if(X[i][k] == Y[i][m]) dp[k + 1][m + 1] = max(dp[k + 1][m + 1], dp[k][m] + 1);
        dp[k + 1][m + 1] = max(dp[k + 1][m + 1], dp[k + 1][m]);
        dp[k + 1][m + 1] = max(dp[k + 1][m + 1], dp[k][m + 1]);
      }
    }
    cout << dp[X[i].size()][Y[i].size()] << endl;
  }
}


Measured memory_bytes: 6764
#include<bits/stdc++.h>
#define F first
#define S second
#define MP make_pair
#define pb push_back
#define endl '\n'

using namespace std;

typedef long long LL;
typedef pair< int, int > P;
typedef pair< LL, LL > LP;
typedef pair< int, P > iP;
typedef pair< P, P > PP;

static const int INF = INT_MAX;
static const LL LINF = LLONG_MAX;
static const int MIN = INT_MIN;
static const LL LMIN = LLONG_MIN;
static const int MOD = 1000000007;
static const int SIZE = 100005;

int dx[] = {0, -1, 1, 0};
int dy[] = {-1, 0, 0, 1};

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    LL h, w;
    cin >> h >> w;
    LL res = INF;
    LL tmpw = w / 2;
    for( LL i = 1; i < h; ++i ) {
        LL a, b, c;
        a = i * w;
        b = ( h - i ) * tmpw;
        c = ( h - i ) * ( w - tmpw );
        LL mi = abs( max( a, max( b, c ) ) - min( a, min( b, c ) ) );
        res = min( res, mi );

        b = ( h - i ) / 2 * w;
        c = ( ( h - i ) - ( ( h - i ) / 2 ) ) * w;
        mi = ( abs( max( a, max( b, c ) ) - min( a, min( b, c ) ) ) );
        res = min( res, mi );

    }
    
    LL tmph = h / 2;
    for( LL i = 1; i < w; ++i ) {
        LL a, b, c;
        a = i * h;
        b = ( w - i ) * tmph;
        c = ( w - i ) * ( h - tmph );
        LL mi = abs( max( a, max( b, c ) ) - min( a, min( b, c ) ) );
        res = min( res, mi );

        b = ( w - i ) / 2 * h;
        c = ( ( w - i ) - ( ( w - i ) / 2 ) ) * h;
        mi = abs( max( a, max( b, c ) ) - min( a, min( b, c ) ) );
        res = min( res, mi );

    }

    cout << res << endl;
    return 0;
}


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

int main(){
    int N, K; cin >> N >> K;
    long double prob=0.0;
//    cout << (long double) 1.0/3.0 << endl;
    for(int i=1; i<=N; i++){
        long double prob1= (long double) 1.00000000/N;
        int a =i;
        while(a < K){
            prob1*=0.50000000;
            a*=2;
        }
//        cout << prob1 << endl;
        prob +=prob1;
    }
    cout << fixed << setprecision(12) << prob << endl;
}

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

int n,m;
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin>>n>>m;
    vector <int> a(n);
    int sum=0;
    for (int i=0; i<m; i++){
        cin>>a[i];
        sum+=a[i];
    }
    
    if (sum>n) cout<<-1;
    else cout<<n-sum;
    
    
    
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 7164
#include <iostream>
#include <string>
#include <map>
#include <queue>
#include <algorithm>
#include <vector>
#include <math.h>
#include <bitset>
#include <cmath>
#include <set>

#define rep(i,s,n)for(int i = s;i<n;i++)
#define repe(i,s,n)for(int i = s;i<=n;i++)
#define rep_r(i,s,n)for(int i = n-1;i>=0;i--)
#define rep_re(i,s,n)for(int i = n;i>=0;i--)
using namespace std;
typedef long long ll;
static const ll MOD = 1e9 + 7;
static const ll INF = 1e25;
static const ll MAX_M = 100001;

ll N[200001] = {};
int main() {
	ll n, x; cin >> n >> x;

	if (x == 1 || x == 2 * n - 1) {
		cout << "No" << endl;
		return 0;
	}

	cout << "Yes" << endl;
	N[n - 2] = x - 1;
	N[n - 1] = x;
	N[n] = x + 1;
	ll pos = 0;

	for (int i = 1; i <= 2 * n - 1;) {
		if (i == x || i == x - 1 || i == x + 1) {
			i++; continue;
		}
		if (N[pos] != 0) {
			pos++;
			continue;
		}
		N[pos] = i;
		pos++;
		i++;
	}

	rep(i, 0, 2 * n - 1) {
		cout << N[i] << endl;
	}
	return 0;
}

Measured memory_bytes: 3072
#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < (n); i++)
#define REP1(i, n) for(int i = 1; i <= (n); i++)
#define REPD(i,a,b) for (int i=(a);i<=(b);i++)
#define ALL(v) (v).begin(), (v).end()
using namespace std;
typedef long long ll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef set<int> si;
typedef vector<si> vsi;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<int, int> pi;
typedef queue<int> qi;
typedef queue<pi> qpi;
typedef pair<ll, ll> pll;
typedef queue<pll> qpll;
typedef vector<pi> vpi;
typedef vector<pll> vpll;
const int mod = 1000000007;
const int INF = 1001001001;
// 小数点　<< fixed << setprecision(0) <<
// sort降順　sort(ALL(),greater<int>());
// 円周率　M_PI
// 文字判定　isupper islower
// 文字変換　
// 順列　do {} while(next_permutation(ALL(X)));
// 最大値　LLONG_MAX
// a内でx以上　auto iter = lower_bound(ALL(a), x);
// a内でxより大きい　auto iter = upper_bound(ALL(a), x);
int dx[8] = {1, 0, -1, 0, 1, 1, -1, -1};
int dy[8] = {0, 1, 0, -1, 1, -1, 1, -1};
struct edge {
    int from; //出発点
    int to;   //到達点
    int cost; //移動コスト
};
typedef struct edge se;
typedef vector<edge> ve;
unsigned Euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return Euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

vpll PrimeFactorization(ll n) {
  vpll res;
  for (ll i=2; i*i<=n; i++) {
    if(n%i!=0) continue;
    ll ex=0;
    while(n%i==0) {
      ex++;
      n/=i;
    }
    res.push_back(pll(i,ex));
  }
  if(n!=1) res.push_back(pll(n,1));
  return res;
}

int main() {
  int n;
  cin >> n;
  int ans=n%1000;
  if(ans!=0) ans=1000-ans;
  cout << ans << endl;
  return 0;
}


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

int main(){
    int n;
    cin>>n;
    vector<int64_t> a(n);
    for(int i=0;i<n;i++){
        int64_t x;
        cin>>x;
        a[i]=x-i;
    }
    sort(a.begin(),a.end());

    
    // for(auto &p:a) cout<<p<<endl;


    int j=(n-1)/2;
    int64_t sum=0;
    for(int i=0;i<n;i++){
        sum+=abs(a[i]-a[j]);
    }
    cout<<sum;
}

Measured memory_bytes: 1792
n = gets.to_i
input = gets.split.map(&:to_i)

P = Struct.new("P", :idx, :num)
a = Array.new(n)

for i in 0...n
    a[i] = P.new(i+1, input[i])
end

a = a.sort do |x, y|
    x.num <=> y.num
end

a.each do |x|
    puts x.idx
end

Measured memory_bytes: 18672
#include <queue>
#include <cmath>
#include <cstdio>
#include <vector>
#include <cstring>
#include <iostream>
#include <algorithm>
#define set0(x) memset(x,0,sizeof(x))
#define FF first
#define SS second
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
typedef pair<ll,ll> pll;
template<typename T> void read(T &x){
	x = 0;char ch = getchar();int f = 1;
	while(!isdigit(ch)){if(ch == '-')f*=-1;ch=getchar();}
	while(isdigit(ch)){x = x*10+ch-48;ch=getchar();}x*=f;
}
int n,ea = 0,bb = 0,cut = 1,ans = 0;
char S[20];
int main() {
	cin>>n;
	for(int ee=0;ee<n;ee++){
		cin>>S;
		int cc = strlen(S);
		for(int i=0;i<cc-1;i++){
			if(S[i] == 'A' && S[i+1] == 'B')ans++;
		}
		if(S[0] == 'B')bb++;
		if(S[cc-1] == 'A')ea++;
		if(S[0] == 'B'^S[cc-1] == 'A' )cut = 0;
	}
	if(bb == 0 || ea == 0)cut = 0;
	cout<<ans+min(bb,ea)-cut<<endl;
	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
#define rep(i, n) for(int i=0; i<(n); ++i)
#define FOR(i, m, n) for(int i=(m); i<(n); ++i)
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define Cout(x) cout << (x) << endl
#define dump(x) cerr << #x << " = " << (x) << endl;
typedef long long LL;
typedef vector<int> VI;
typedef vector<long long> VL;
typedef vector<string> VS;
typedef vector<vector<int>> VVI;
typedef pair<int, int> PII;
const int inf = (int)1e9;
const long long mod = (long long)1e9 + 7;
const double pi = acos(-1.0);

template <class T>void Sort(vector<T> & a) { sort(a.begin(), a.end()); }
template <class T>void ReSort(vector<T>& a) { sort(a.rbegin(), a.rend()); }
template <class T>void Reverse(vector<T>& a) { reverse(a.begin(), a.end()); }
template <class T>void Unique(vector<T>& a) { a.erase(unique(a.begin(), a.end()), a.end()); }
template <class T>T Sum(vector<T> a, T init = 0) { return accumulate(a.begin(), a.end(), init); }

//INPUT//
void CINPUT() {}
template<class H, class ...T> void CINPUT(H&& h, T&& ...t) { cin >> h; CINPUT(forward<T>(t)...); }
#define in(...) int __VA_ARGS__; CINPUT(__VA_ARGS__);
#define In(T,...) T __VA_ARGS__; CINPUT(__VA_ARGS__);
#define Vin(T,name,n) int n; cin>>n; vector<T> name(n); rep(i,n)cin>>name[i];
#define VIn(T,name,n) vector<T> name(n); rep(i,n)cin>>name[i];
#define VIn2(T,name,name2,n) vector<T> name(n),name2(n); rep(i,n)cin>>name[i]>>name2[i];

//OUTPUT//
void print() { cout << endl; }
template <class H> void print(H&& h) { cout << h << endl; }
template <class H, class... T> void print(H&& h, T&& ... t) { cout << h << " "; print(forward<T>(t)...); }
template<class T>void out(T n) { cout << n << endl; }
template<class T>void out(vector<T> a, string sep = " ", string end = "\n") { for (int i = 0; i < (int)a.size(); ++i)cout << a[i] << (i == (int)a.size() - 1 ? end : sep); }
void yes(bool f) { puts(f ? "yes" : "no"); }
void Yes(bool f) { puts(f ? "Yes" : "No"); }
void YES(bool f) { puts(f ? "YES" : "NO"); }
void poss(bool f) { puts(f ? "possible" : "impossible"); }
void Poss(bool f) { puts(f ? "Possible" : "Impossible"); }
void POSS(bool f) { puts(f ? "POSSIBLE" : "IMPOSSIBLE"); }

int main() {
	in(n, m);
	VIn2(int, a, b, m);
	rep(i, n) {
		int ans = 0;
		rep(j, m)ans += a[j] == i + 1 || b[j] == i + 1;
		out(ans);
	}
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <utility>
#include <deque>
#include <stack>
#include <bitset>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<char> vc;
typedef vector<ll> vl;
typedef queue<int> qi;
typedef queue<ll> ql;
typedef pair<ll,ll> pll;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
#define rep(i,n) for (int i=0;i<n;++i)
#define mp make_pair
#define pb push_back
#define pf push_front
#define F first
#define S second
#define read(x) scanf("%d",&x)
ll c[100005],k[100005];
int n,m;
ll a[100005];
int main(){
	ios::sync_with_stdio(false);
	cin>>n>>m;
	for (int i=1;i<=n;++i){
		cin>>a[i];
	}
	for (int i=2;i<=n;++i){
		ll x=a[i-1],y=a[i];
		if (x<y){
			c[0]+=y-x;
			c[x+1]-=y-x;
			c[x+1]+=y+1;k[x+1]-=1;
			c[y+1]-=y+1;k[y+1]+=1;
			c[y+1]+=y-x;
			c[m+1]-=y-x;
		}
		else{
			c[0]+=y+1;k[0]-=1;
			c[y+1]-=y+1;k[y+1]+=1;
			c[y+1]+=m+y-x;
			c[x+1]-=m+y-x;
			c[x+1]+=m+y+1;k[x+1]-=1;
			c[m+1]-=m+y+1;k[m+1]+=1;
		}
	}
	ll mn=1e15;
	for (ll i=1;i<=m;++i){
		c[i]+=c[i-1];k[i]+=k[i-1];
		//cout<<"i:"<<i<<"  "<<c[i]<<"  "<<k[i]<<endl;
		mn=min(mn,c[i]+k[i]*i);
	}
	cout<<mn;
	return 0;
}

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

#define INF 100000000
typedef pair<int, int> P;
typedef pair<int, P> P2;

int main(){
	while(true){
	int c, n, m, s, d;
	vector<P>es[105];
	cin >> c >> n >> m >> s >> d;
	if(n == 0) return 0;
	int dp[105][15] = {0};
	for(int i = 0; i < 105; i++){
		for(int j = 0; j < 15; j++){
			dp[i][j] = INF;
		}
	}
	s--; d--;
	dp[s][0] = 0;
	for(int i = 0; i < m; i++){
		int a, b, f;
		cin >> a >> b >> f;
		a--; b--;
		es[a].push_back(P(b, f));
		es[b].push_back(P(a, f));
	}
	int res = INF;
	queue<P2>que;
	que.push(P2(0, P(s, 0)));
	while(!que.empty()){
		P2 p2 = que.front();
		que.pop();
		int v = p2.second.first;
		int nowc = p2.first;
		int nowchi = p2.second.second;
		if(v == d){
			res = min(res, nowc);
			continue;
		}
		for(int u = 0; u < es[v].size(); u++){
			int to = es[v][u].first;
			int cost = es[v][u].second;
			if(dp[to][nowchi] > nowc + cost){
				dp[to][nowchi] = nowc + cost;
				//cout << to << endl;
				que.push(P2(dp[to][nowchi], P(to, nowchi)));
			}
			if(nowchi + 1 <= c){
				if(dp[to][nowchi + 1] > nowc + (cost / 2)){
					dp[to][nowchi + 1] = nowc + (cost / 2);
					que.push(P2(dp[to][nowchi + 1], P(to, nowchi + 1)));
				}
			}
		}
	}
	cout << res << endl;
}
}



Measured memory_bytes: 3104
X, N = map(int, input().split())
A = list(map(int, input().split()))

tmp = 1000
result = []
result2 = []
for i in range(0, 102):
    if i in A:
        continue

    hoge = abs(X - i)
    if hoge <= tmp:
        tmp = hoge
        result2.append(tmp)
        result.append(i)

result3 = []
for i, v in enumerate(result2):
    if v == min(result2):
        result3.append(result[i])

print(min(result3))


Measured memory_bytes: 9192
/*Function Template*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
const int MAX = 510000;
const int MOD = 1000000007;
#define rep(i, n) for(ll i = 0; i < (n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
ll fac[MAX], finv[MAX], inv[MAX];


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;
}
// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (ll i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }

}
ll Len(ll n) {
  ll s=0;
  while(n!=0) s++, n/=10;
  return s;
}


ll Sint(ll n) {
  ll m=0,s=0,a=n;
  while(a!=0) s++, a/=10;
  for(ll i=s-1;i>=0;i--) m+=n/((ll)pow(10,i))-(n/((ll)pow(10,i+1)))*10;
  return m;
}


ll Svec(vector<ll> v){
  ll n=0;
  for(ll i=0;i<v.size();i++) n+=v[i];
  return n;
}


ll GCD(ll a,ll b){
  ll r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return b;
}


ll LCM(ll a,ll b){
  ll c=a,d=b,r,tmp;
/*自然数 a > b を確認・入替*/
  if(a<b){
    tmp=a,a=b,b=tmp;
  }
/*ユークリッドの互除法*/
  r=a%b;
  while(r!=0){
    a=b,b=r,r=a%b;
  }
  return c/b*d;
}


ll Factorial(ll n){
  ll m=1;
  while(n>=1) m*=n,n--;
  return m;
}

vector<pair<char,ll>> runlength(string s,vector<pair<char,ll>> p){
  ll x=1;
  if(s.size()==1){
    p.push_back(pair<char,ll>(s[0],1));
    return p;
  }
  for(ll i=0;i<s.size()-1;i++){
    if(s[i]==s[i+1]){
      x++;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[i],x));
      }
    }else{
      p.push_back(pair<char,ll>(s[i],x));
      x=1;
      if(i==s.size()-2){
        p.push_back(pair<char,ll>(s[s.size()-1],x));
      }
    }
  }
  return p;
}


ll COM(ll n,ll k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

const int MAX_N=100010;
vector<bool> sieve_of_eratosthenes(){
  vector<bool> isPrime(MAX_N+1,true);
  for(int i=2;i<=MAX_N;i++){
    if(isPrime[i]){
      for(int j=2*i;j<=MAX_N;j+=i){
        isPrime[j]=false;
      }
    }
  }
  return isPrime;
}







/*↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓*/
int main() {
  IOS;
  ll n;
  cin>>n;
  ll a,b;
  ll cnt1=0,cnt2=0,cnt3=0;
  cin>>a>>b;
  vector<ll> v(n);
  rep(i,n) cin>>v[i];
  rep(i,n){
    if(v[i]<=a) cnt1++;
    else if(a+1<=v[i] && v[i]<=b) cnt2++;
    else if(b+1<=v[i]) cnt3++;
  }
  cout<<min(cnt1,min(cnt2,cnt3))<<endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include <iomanip>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <cmath>
#include <sstream>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
#define all(c) (c).begin(), (c).end()
#define loop(i,a,b) for(ll i=a; i<ll(b); i++)
#define rep(i,b) loop(i,0,b)
#ifdef DEBUG
#define dump(...) (cerr<<#__VA_ARGS__<<" = "<<(DUMP(),__VA_ARGS__).str()<<" ["<<__LINE__<<"]"<<endl)
struct DUMP:ostringstream{template<class T>DUMP &operator,(const T&t){if(this->tellp())*this<<", ";*this<<t;return *this;}};
#else
#define dump(...)
#endif

int main(){
    ll L;
    while(cin>>L&&L){
        vi t;
        int ans=1;
        for(ll i=2;i*i<=L;i++){
            t.push_back(0);
            while(L%i==0){
                t.back()++; L/=i;
            }
            t.back()=t.back()*2+1;
            //            t.push_back(2*n+1);
        }
        if(L!=1)ans*=3;
        rep(i,t.size())ans*=t[i];
        cout<<ans/2+1<<endl;
    }
}

Measured memory_bytes: 8920
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define INF (INT_MAX / 4)
#define REP(i, n) for (ll i = 0, i##_len = (n); i < i##_len; ++i)
#define ALL(a) (a).begin(), (a).end()
/* clang-format off */
#define TIMER_S(start) chrono::system_clock::time_point start = chrono::system_clock::now();
#define TIMER_E(end) chrono::system_clock::time_point end = chrono::system_clock::now();
#define TIME(start, end) cout << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count()) << "ms" << "\n";
/* clang-format on */

int main() {
  int n, ans;
  cin >> n;
  for (int i = 1; i <= n;i++){
    if (((int)log10(i) + 1) % 2 == 1) ans++;
  }
  cout << ans << "\n";
  return 0;
}


Measured memory_bytes: 256
#pragma GCC optimize("O4")
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define sz(x) ((int)x.size())
//#define MOD (ll)(998244353)
#define MOD (ll)(1e9+7)
#define INF (1e17)
#define int ll
#define EPS (1e-6)
using namespace std;
using ll=long long;
using pii=pair<int,int>;

int gcd(int a,int b) { return b==0?a:gcd(b,a%b); }
int lcm(int a,int b) { return a/gcd(a,b)*b; }
int fpow(int b,int p){
	b%=MOD;
	int ans=1;
	while(p>0){
		if(p&1) ans=(ans*b)%MOD;
		p/=2;
		b=(b*b)%MOD;
	}
	return ans;
}

int dp[3010][6010];

int32_t main() {
#ifdef LOCAL_TEST
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\input.in","r",stdin);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\output.out","w",stdout);
	freopen("E:\\Jimmy\\2 Coding\\1 C++\\error.out","w",stderr);
#endif
	ios::sync_with_stdio(false);
	cin.tie(0);

	//code...
	auto s=clock();
	int n,t; cin>>n>>t;
#define w first
#define v second
	vector<pii> dish(n);
	for(auto &i:dish) cin>>i.w>>i.v;
	sort(all(dish));
	int mx=dish.back().w;
	for(auto &i:dish) cerr<<'('<<i.w<<','<<i.v<<")\n";
	memset(dp,sizeof(dp),0);
	For(i,1,n){
		For(j,0,t-1){
			dp[i][j+dish[i-1].w]=dp[i-1][j]+dish[i-1].v;
		}
		For(j,0,t+mx-1) dp[i][j]=max(dp[i][j],dp[i-1][j]);
		//For(j,0,t+mx-1) cerr<<dp[i][j]<<" \n"[j==t+mx-1];
	}
	int ans=-INF;
	For(j,0,t+mx-1) ans=max(ans,dp[n][j]);
	cout<<ans<<"\n";
	cerr<<clock()-s<<"\n";
	cerr<<CLOCKS_PER_SEC<<"\n";
	return 0;
}


Measured memory_bytes: 141568
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  
  int n, ans;
  
  cin >> n;
  
  if (n < 10) {
    ans = n;
    cout << ans << endl;
  }
  
  else if (n < 100 && n >= 10) {
    ans = 9; // more than 9, less than 100
    cout << ans << endl;
  }
  
  else if (n < 1000 && n >= 100) {
    ans = n-90; // 89+1 (ie not count 10-99)
    cout << ans << endl;
  }
 
  else if (n < 10000 && n >= 1000) {
    ans = 909; // 89+1(ie not count 10-99) 8999+1(ie 1000-9999)
    cout << ans << endl;
  }
 
  else if (n < 100000 && n >= 10000) {
    ans = n-9090; // 89+1(ie not count 10-99) 8999+1(ie 1000-9999)
    cout << ans << endl;
  }

  else if (n == 100000) {
    ans = 90909; // 89+1(ie not count 10-99) 8999+1(ie 1000-9999)
    cout << ans << endl;
  }
  
  else {
  }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  string s;
  cin >> N;
  cin >> s;

  int r = 0;
  int b = 0;
  for ( int i = 0; i < N; i++ )
  {
     if ( s[i] == 'R' ) 
         r++;
     else
        b++;
   }
   if ( r > b ) 
    cout << "Yes";
   else 
    cout << "No";
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (n);i++)
typedef pair<int,int> P;
//queueバージョン O(n^2)
//貪欲に試合ができるかを見ていく?

int main(){
    int n;
    cin >> n;
    vector<vector<int>> a(n,vector<int>(n-1));
    rep(i,n){
        rep(j,n-1){
            cin>>a[i][j];
            a[i][j]--;
        }
        reverse(a[i].begin(),a[i].end());//vectorの後ろが対戦相手になるように
    }
    vector<P> q;
    //試合できるかの確認
    auto check = [&](int i){
        if(a[i].size()==0)return;
        int j = a[i].back();
        if(a[j].size() == 0)return;
        if(a[j].back()==i){
            P p(i,j);
            if(p.second<p.first)swap(p.first,p.second);
            q.push_back(p);
        }
    };
    rep(i,n){
        check(i);
    }
    int day = 0;
    while(q.size()>0){
        day++;
        sort(q.begin(),q.end());
        q.erase(unique(q.begin(),q.end()),q.end());//重複削除
        vector<P> prevq;
        swap(prevq,q);//prevに前のqueueを入れてqを空に
        for(P p : prevq){
            int i = p.first,j = p.second;
            a[i].pop_back();
            a[j].pop_back();
        }
        for(P p : prevq){
            int i = p.first,j = p.second;
            check(i);
            check(j);
        }
    }
    rep(i,n){
        if(a[i].size()!=0){
            cout << "-1" << endl;
            return 0;
        }
    }
    cout << day << endl;
    return 0;
}

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

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> ii;
typedef vector<int> vi;

#define SZ(x) ((int)x.size())

const int N = (int)1e5+5;
int n, m, res, dp[N];
bool mark[N];
vector<int> g[N];

void dfs(int u, int p) {
	for (int v : g[u]) if (v != p) {
		dfs(v, u);
		dp[u] = max(dp[u], dp[v] + 1);
	}
	if (u != 1 && !mark[u] && dp[u] == m - 1)
		++res, dp[u] = -1;
}

int main() {
	scanf("%d%d", &n, &m);
	for (int i = 1, u; i <= n; ++i) {
		scanf("%d", &u);
		if (i > 1) {
			g[u].push_back(i);
			if (u == 1) mark[i] = true;
		} else res += (u != 1);
	}
	dfs(1, 0);
	printf("%d", res);
	return 0;
}


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

using namespace std;

#define MAX_N 100000
#define MAX_S 30

double dp[MAX_N+1][MAX_S+1];

int main(){
    double P[MAX_N],power[MAX_S];
    dp[0][0] = 1; P[0] = 1;
    power[0] = 1;
    for(int i = 1 ; i < MAX_S ; i++){
        power[i] = power[i-1]/2;
    }
    for(int i = 0 ; i < MAX_N-1 ; i++){
        for(int j = 0 ; j < MAX_S ; j++){
            if(dp[i][j] == 0) continue;
            dp[i+1][j+1] += dp[i][j]*power[j];
            dp[i+1][0] += dp[i][j]*(1-power[j]);
        }
        double res = 0;
        for(int j = 0 ; j < MAX_S ; j++){
            res += dp[i+1][j]*power[j];
        }
        P[i+1] = res + P[i];
    }
    int n;
    while(cin >> n,n){
        printf("%.10f\n",P[n-1]);
    }
    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i ++) {
    cin >> a.at(i);
  }

  int count = 0;
  while (true) {
    for (int i = 0; i < n; i ++) {
      if (a.at(i) % 2 == 1){
        cout << count << endl;
        return 0;
      }
    }

    for (int i = 0; i < n; i ++) {
      a.at(i) /= 2;
    }
    count ++;
  }
}


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

int main(void){
  long long int a,b,c,d,r,tc,td,tmp;
  scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
  tc = c;
  td = d;
  if(tc<td){
    tmp = tc;
    tc = td;
    td = tmp;
  }
  r = tc%td;
  while(r!=0){
    tc = td;
    td = r;
    r = tc%td;
  }
  //printf("%lld %lld %lld\n",b,b/c+b/d,b/(c*d/td));
  printf("%lld\n",(b-(b/c+b/d)+(b/(c*d/td)))-((a-1)-((a-1)/c+(a-1)/d)+((a-1)/(c*d/td))));
  return 0;
}

Measured memory_bytes: 128
#define _CRT_SECURE_NO_WARNINGS 1

#include <iostream>
#include <string>
#include <string.h>
#include <limits>
#include <utility>
#include <vector>
#include <algorithm>
#include <functional>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <chrono>

using namespace std;

namespace
{

}

#if 1
int main()
{
	bool isExist[10];

	for (int i = 0; i < 10; i++)
	{
		isExist[i] = false;
	}

	char a, b, c, d;
	cin >> a >> b >> c >> d;

	isExist[a - '0'] = true;
	isExist[b - '0'] = true;
	isExist[c - '0'] = true;
	isExist[d - '0'] = true;

	if (isExist[1] && isExist[9] && isExist[7] && isExist[4])
	{
		cout << "YES";
	}
	else
	{
		cout << "NO";
	}
}
#endif


Measured memory_bytes: 256
#include<algorithm>
#include<complex>
#include<ctype.h>
#include<iomanip>
#include<iostream>
#include<fstream>
#include<map>
#include<math.h>
#include<numeric>
#include<queue>
#include<set>
#include<stack>
#include<stdio.h>
#include<string>
#include<string>
#include<vector>

using namespace std;
typedef long long ll;

#define FOR(i,a,b) for(ll i=(a);i<(b);++i)
#define ALL(v) (v).begin(), (v).end()
#define p(s) cout<<(s)<<endl
#define p2(s, t) cout << (s) << " " << (t) << endl
#define br() p("")
#define pn(s) cout << (#s) << " " << (s) << endl
#define p_yes() p("YES")
#define p_no() p("NO")

const ll mod = 1e9 + 7;
const ll inf = 1e18;

template < typename T >
void vprint(T &V){
	for(auto v : V){
    	cout << v << " ";
	}
	cout << endl;
}

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

    // input
    ll N, A, B, C, D;
    cin >> N >> A >> B >> C >> D;

    FOR(plus, 0, N){
        ll minus = N-1-plus;
        
        ll right = D * plus - C * minus;
        ll left  = C * plus - D * minus;
        
        if(left<=B-A && B-A<=right){
            p_yes();
            return 0;
        }
    }   

    p_no();
    return 0;
}

Measured memory_bytes: 256
#!/usr/bin/python3

#標準出力からの読み込み

n = int(input())
a = [int(s) for s in input().split(" ")]
output = 1

if a.count(0) >= 1:
    output = 0
else:
    number = 1
    for i in a:
        number = number*i
        output = number
        if number > 1000000000000000000:
            output = -1
            break;
        
print(output)


Measured memory_bytes: 21708
var
	L,R,ans,tmp,M,i,j:Longint;
begin
	read(L,R);
	M:=2019;
	ans:=M;
	if L+2018<=R then begin
		writeln(0);
		exit;
	end;
	for i:=L to R do begin
		for j:=1 to 50 do begin
			if i+j>R then break;
			tmp:=i mod M*(i+j)mod M;
			if ans>tmp then ans:=tmp;
		end;
	end;
	writeln(ans);
end.

Measured memory_bytes: 128
//
/*==========================================================*/
/*    Template ver 2017-0720    |    Created by JollyBee    */
/* DOMINUS pascit me, et nihil mihi deerit (Psalmorum 23:1) */
/*==========================================================*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<pii> vii;
const double EPS=(double)1e-9;
const double PI=(double)acos(-1.0);
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define FOR(i,n) for(int i=0;i<n;i++)
#define REPP(i,l,r,c) for(int i=l;i<=r;i+=c)
#define REP(i,l,r) REPP(i,l,r,1)
#define FORD(i,n) for(int i=n-1;i>=0;i--)
#define REVV(i,l,r,c) for(int i=l;i>=r;i-=c)
#define REV(i,l,r) REVV(i,l,r,1)
//random
int irand(int lo, int hi){
    return (((double)rand())/(RAND_MAX+1.0)) * (hi-lo+1) + lo;
}
//ll to string
string toString(ll x) {
    stringstream ss;
    ss << x;
    return ss.str();
}
//string to ll
ll toNumber(string S) {
    ll ret;
    sscanf(S.c_str(),"%lld",&ret);
    return ret;
}
// std::fill(start, end, value);
// for(auto it: DS){}

const int INF=(int)2e9;
const ll MOD=(ll)1e9+7;
/*==========================================================*/
/*                     END OF TEMPLATE                      */
/* DOMINUS pascit me, et nihil mihi deerit (Psalmorum 23:1) */
/*==========================================================*/

int ask(const string& sa, const string& sb){
    puts(sa.c_str()); puts(sb.c_str()); fflush(stdout);
    char response[5]; scanf("%s", response);
    if(response[0] == 'e') exit(0);
    return response[0] == 'T';
}

int solve(string& sa, string& sb, int& is_from_back){
    FOR(i,4){
        string ta,tb;
        if(is_from_back){
            ta = sa + ".#"[i&1?1:0];
            tb = sb + ".#"[i&2?1:0];
        } else {
            ta = ".#"[i&1?1:0] + sa;
            tb = ".#"[i&2?1:0] + sb;
        }
        if(ask(ta,tb) == 1){
            sa = ta;
            sb = tb;
            return 0;
        }
    }
    // fail
    return is_from_back = 0;
}

int main(){
    scanf("%*d");
    string sa="", sb="";
    int is_from_back = 1;
    while(1) solve(sa,sb, is_from_back);
    return 0;
}


Measured memory_bytes: 724
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
const int N=200005,mod=998244353;
int n,tot,ans,now,x[N],y[N],hx[N],hy[N],bx[N],by[N],root[N],pw2[N],ch[N*30][2],sumv[N*30];
void update(int y,int &x,int l,int r,int k){
	x=++tot;
	sumv[x]=sumv[y]+1;
	if(l==r){
		return;
	}
	ch[x][0]=ch[y][0];
	ch[x][1]=ch[y][1];
	int mid=(l+r)/2;
	if(k<=mid){
		update(ch[y][0],ch[x][0],l,mid,k);
	}else{
		update(ch[y][1],ch[x][1],mid+1,r,k);
	}
}
int query(int y,int x,int l,int r,int L,int R){
	if(sumv[x]-sumv[y]==0){
		return 0;
	}
	if(L<=l&&R>=r){
		return sumv[x]-sumv[y];
	}
	int mid=(l+r)/2,res=0;
	if(L<=mid){
		res+=query(ch[y][0],ch[x][0],l,mid,L,R);
	}
	if(R>mid){
		res+=query(ch[y][1],ch[x][1],mid+1,r,L,R);
	}
	return res;
}
int get(int xl,int xr,int yl,int yr){
	if(xl>xr||yl>yr){
		return 0;
	}
	return query(root[xl-1],root[xr],1,hy[0],yl,yr);
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d%d",&x[i],&y[i]);
		hx[++hx[0]]=x[i];
		hy[++hy[0]]=y[i];
	}
	pw2[0]=1;
	for(int i=1;i<=n;i++){
		pw2[i]=pw2[i-1]*2%mod;
	}
	sort(hx+1,hx+hx[0]+1);
	hx[0]=unique(hx+1,hx+hx[0]+1)-hx-1;
	sort(hy+1,hy+hy[0]+1);
	hy[0]=unique(hy+1,hy+hy[0]+1)-hy-1;
	for(int i=1;i<=n;i++){
		x[i]=lower_bound(hx+1,hx+hx[0]+1,x[i])-hx;
		bx[x[i]]=i;
		y[i]=lower_bound(hy+1,hy+hy[0]+1,y[i])-hy;
		by[y[i]]=i;
	}
	for(int i=1;i<=hx[0];i++){
		update(root[i-1],root[i],1,hy[0],y[bx[i]]);
	}
	for(int i=1;i<=n;i++){
		now=pw2[n];
		now=(now-pw2[get(1,x[i]-1,1,hy[0])]+mod)%mod;
		now=(now-pw2[get(x[i]+1,hx[0],1,hy[0])]+mod)%mod;
		now=(now-pw2[get(1,hx[0],1,y[i]-1)]+mod)%mod;
		now=(now-pw2[get(1,hx[0],y[i]+1,hy[0])]+mod)%mod;
		now=(now+pw2[get(1,x[i]-1,1,y[i]-1)])%mod;
		now=(now+pw2[get(1,x[i]-1,y[i]+1,hy[0])])%mod;
		now=(now+pw2[get(x[i]+1,hx[0],1,y[i]-1)])%mod;
		now=(now+pw2[get(x[i]+1,hx[0],y[i]+1,hy[0])])%mod;
		now=(now-1+mod)%mod;
		ans=(ans+now)%mod;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 54144
S = list(input())

reS = list(reversed(S))

cnt = 0
cntA = 0
cntB = 0

for (i, j) in zip(S, reS):
    if i == j:
        cnt += 1
    else:
        print('No')
        break
    
if cnt == len(S):
    N = len(S)
    listA = []
    listB = []

    for i in range(0, (N-1)//2):
        listA.append(S[i])
    for j in range((N+3)//2 - 1, N):
        listB.append(S[j])

    reA = list(reversed(listA))
    reB = list(reversed(listB))

    for (i, j) in zip(listA, reA):
        if i == j:
            cntA += 1
        else:
            pass

    for (i, j) in zip(listB, reB):
        if i == j:
            cntB += 1
        else:
            pass

    if cntA == len(listA) and cntB == len(listB):
        print('Yes')
    else:
        print('No')

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll INF = 1e16;
const ll mod = 1000000007;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

int main() {
  ll w, a, b;
  cin >> w >> a >> b;
  if (a > b) {
    ll tmp = a;
    a = b;
    b = tmp;
  }
  if (b <= a+w) cout << 0 << endl;
  else cout << abs(a+w-b) << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
	int m;
	while(cin >> m , m){
		vector<int> data(m);
		rep(i,m)cin >> data[i];
		int n = 32;
		int lp = 0;
		while(n>0){
			n -= (n-1)%5;
			cout << n << endl;
			n -= data[lp%m];
			cout << (n<0?0:n) << endl;
			lp++;
		}
		
	}
}

Measured memory_bytes: 0
#include <iostream>
#include <cstring>
#include <stdlib.h>
#include <vector>
#include <algorithm>
#include <cmath>
#include <stack>
#include <queue>
#include <math.h>
#include <string>
#include <map>
#include <cstdlib>
#include <sstream>
#include <bitset>
using namespace std;

typedef long long ll;

int main()
{
    int N;
    cin >> N;
    vector<ll> A(N);
    for(int i=0; i<N; i++){
        cin >> A[i];
    }
    vector<ll> p_que;
    int ans=1;
    p_que.push_back(A[0]);
    for(int i=1; i<N; i++){
        auto itr=lower_bound(p_que.begin(), p_que.end(), A[i]);
        int dist=itr-p_que.begin();
        if(dist==0){
            ans++;
            p_que.insert(p_que.begin(), A[i]);
        }else{
            p_que[dist-1]=A[i];
        }
    }
    cout << ans << endl;
    

    return 0;
}

Measured memory_bytes: 2168
#include <iostream>
#include <vector>
#include <array>
#include <string>
#include <cmath>
#include <unordered_map>
#include <algorithm>
#include <iomanip>

using namespace std;


int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	
	int n, k;
	double ans = 0;
	
	cin >> n >> k;
	
	for (int i = 1; i <= n; ++i) {
		if (i <= k) {
			int q = ceil(log2(k * 1.0 / i));
			ans += pow(0.5, q);
		}
		else {
			ans += 1.0;
		}
	}

	cout << setprecision(10) << ans / n << endl;
	
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int a,b,c,k,sum=0;
	cin>>a>>b>>c>>k;
	if(a>=k){
		cout<<k<<endl;
		return 0;
	}
	k-=a;
	sum+=a;
	if(b>=k){
		cout<<sum<<endl;
		return 0;
	}
	k-=b;
	cout<<sum-min(k,c)<<endl;
	return 0;
}


Measured memory_bytes: 3624
MOD = 10 ** 9 + 7
def pow(n, k)
  k %= (MOD - 1)
  return 1 if k.zero?
  return pow(n, k - 1) * n % MOD if k.odd?
  return (pow(n, k / 2) ** 2) % MOD
end
def max(a,b); a > b ? a : b; end
  
N = gets.to_i
ab0 = 0
a0 = 0
b0 = 0
dp = Hash.new(0)

N.times.each do
  a,b = gets.split.map(&:to_i)
  if a.zero? && b.zero?
    # どの魚とも仲が悪い
    ab0 += 1
  elsif a.zero?
    # b == 0の魚と仲が悪い
    a0 += 1
  elsif b.zero?
    # a == 0 の魚と仲が悪い
    b0 += 1
  else
    # a/bでグループ分け
    # -b/aのグループと仲が悪い
    dp[a.to_r / b] += 1
  end
end

# 一旦 どの魚とも仲が悪いのは無視して、
# 仲が悪いグループのどちらかを選ぶ組み合わせを計算 2^a + 2^b - 1

used = {}
ans = (pow(2, a0) + pow(2,b0) - 1) % MOD
dp.keys.each do |k|
  next if used[k]
  used[k] = true
  used[-1/k] = true
  ans = ans * (pow(2, dp[k]) + pow(2, dp[-1/k]) - 1) % MOD
end
# 何も選ばない場合を除く + どの魚とも仲が悪いグループを足す
puts (ans - 1 + ab0 ) % MOD 


Measured memory_bytes: 62464
#include<bits/stdc++.h>
using namespace std;
int main()
{
	int n;
	cin>>n;
	if(n%2==0)cout<<fixed<<setprecision(10)<<1.0*(n/2)/n;
	else cout<<fixed<<setprecision(10)<<1.0*(n/2+1)/n;
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<string.h>
#include<cmath>
#include<vector>
#include<queue>
#include<algorithm>
#include<map>
#include<string>
#define mod 1000000007
#define ll long long
using namespace std;

int main()
{
	//freopen("test.in","r",stdin);
	//freopen("test.out","w",stdout);
	ll a,b;
	cin>>a>>b;
	if(a<=b)
	cout<<0<<endl;
	else
	cout<<a-b<<endl;
	return 0;
}


Measured memory_bytes: 256
x = int(input())
ans = 8
if x <= 599:
    ans = 8
elif x <= 799:
    ans = 7
elif x <= 999:
    ans = 6
elif x <= 1199:
    ans = 5
elif x <= 1399:
    ans = 4
elif x <= 1599:
    ans = 3
elif x <= 1799:
    ans = 2
else:
    ans = 1
print(ans)


Measured memory_bytes: 9176