akhauriyash/Code-Regression huggingface dataset:
-- {-# LANGUAGE BangPatterns #-}
-- {-# LANGUAGE ScopedTypeVariables #-}
-- {-# LANGUAGE FlexibleContexts #-}
-- {-# LANGUAGE ViewPatterns #-}
-- {-# LANGUAGE OverloadedStrings #-}

import qualified Data.Vector as V
import qualified Data.Vector.Unboxed as VU
import qualified Data.Vector.Unboxed.Mutable as VUM
-- import qualified Data.Vector.Algorithms.Merge as VAM
-- import qualified Data.Heap as HP
import qualified Data.ByteString.Char8 as BC
import qualified Data.Map as MP
import qualified Data.Set as ST
import qualified Data.Sequence as SQ
import Data.Array
import Data.Array.Unboxed
import Data.Array.ST
import Data.Array.IO
import Data.Maybe
import Data.Ratio
import Data.Char
import Data.Bits
import Data.List
import Data.Tuple
import Data.Functor
import Data.IORef
import Data.STRef
import Control.Applicative
import Control.Monad
import Control.Monad.ST
import Debug.Trace

--------------------------------------------------------------------------
solve a b = 1 + (ceiling $ (rest / (a - 1)))
    where
        rest = b - a

main = do
    [a,b] <- singleLineToDoubleL
    print $ solve a b
--------------------------------------------------------------------------

-- Input Util
int :: IO Int
int = readLn 

double :: IO Double
double = readLn 

str :: IO String
str = getLine

strBC :: IO BC.ByteString
strBC = BC.getLine

singleLineToIntL :: IO [Int]
singleLineToIntL = getLine >>= return . map read . words

singleLineToDoubleL :: IO [Double]
singleLineToDoubleL = getLine >>= return . map read . words

singleLineToIntV :: Int -> IO (VU.Vector Int)
singleLineToIntV n = BC.getLine >>= return . VU.unfoldrN n (BC.readInt . BC.dropWhile isSpace)

singleLineToDoubleV :: Int -> IO (VU.Vector Double)
singleLineToDoubleV n = BC.getLine >>= return . VU.fromList . map (read . BC.unpack) . BC.words

multipleLinesToIntL :: Int -> IO [Int]
multipleLinesToIntL n = replicateM n readLn

multipleLinesToDoubleL :: Int -> IO [Double]
multipleLinesToDoubleL n = replicateM n readLn

multipleLinesToIntV :: Int -> IO (VU.Vector Int)
multipleLinesToIntV n = VU.replicateM n readLn

multipleLinesToDoubleV :: Int -> IO (VU.Vector Double)
multipleLinesToDoubleV n = VU.replicateM n (BC.getLine >>= return . read . BC.unpack)

multipleLinesToTupleL :: Int -> IO [(Int, Int)]
multipleLinesToTupleL n = replicateM n (getLine >>= return . (\[a,b] -> (a,b)) . map read . words)

multipleLinesToTupleV :: Int -> IO (VU.Vector (Int, Int))
multipleLinesToTupleV n = VU.replicateM n $ do
    bs <- strBC
    let
        Just (a, bs') = BC.readInt $ BC.dropWhile isSpace bs
        Just (b, _) = BC.readInt $ BC.dropWhile isSpace bs'
    return (a,b)

-- others
strToChr :: String -> Char
strToChr [x] = x

chrToStr :: Char -> String
chrToStr x = [x]

m1 :: Int -> Int
m1 x = subtract 1 x

toDouble :: Int -> Double
toDouble x = fromIntegral x

toInt :: Double -> Int
toInt x = floor x

Measured memory_bytes: 508
#include <bits/stdc++.h>
#define inf 0x3f3f
using namespace std;
const int maxn=1e3+10;
vector<int>g[maxn];
int n,x[maxn];
int dp[maxn][5010],f[5010];
int dfs(int p){
    dp[p][0]=0;
    for (auto u:g[p]){
        int w=dfs(u),v=x[u];

        memcpy(f,dp[p],sizeof(f));
        memset(dp[p],0x3f3f,sizeof(dp[p]));

        for (int i=0; i<=x[p]; i++){
            if(i+w<=x[p])
                dp[p][i+w]=min(dp[p][i+w],f[i]+v);
            if(i+v<=x[p])
                dp[p][i+v]=min(dp[p][i+v],f[i]+w);
        }
    }
    int ans=dp[0][0];
    for (int i=0; i<=x[p]; i++)
        ans=min(dp[p][i],ans);
    return ans;
}

int main(){
    scanf("%d",&n);
    memset(dp,0x3f3f,sizeof(inf));
    for (int p,i=2; i<=n; i++) {
        scanf("%d",&p);
        g[p].push_back(i);
    }
    for (int i=1; i<=n; i++) scanf("%d",&x[i]);
    int ans=dfs(1);
    if(ans<dp[0][0])puts("POSSIBLE");
    else puts("IMPOSSIBLE");
    return 0;

}


Measured memory_bytes: 19456
def main(f, e):
    if 0 <f <13:
        if 0<e<13:
            print("AMBIGUOUS")
        else:
            print("MMYY")
    else:
        if 0<e<13:
            print("YYMM")
        else:
            print("NA")
if __name__ == "__main__":
    S = input()

    a = int(S[:2])
    b = int(S[2:])
    main(a, b)
        


Measured memory_bytes: 38384
#include<iostream>

using namespace std;
string str,ans;
char t[6][7]={
  {' ',' ',' ',' ',' ',' ',' '},
  {' ','a','f','k','p','u','z'},
  {' ','b','g','l','q','v','.'},
  {' ','c','h','m','r','w','?'},
  {' ','d','i','n','s','x','!'},
  {' ','e','j','o','t','y',' '}
};
bool check(char a,char b){
  if('1'<=a&&a<='6'){}else return false;
  if('1'<=b&&b<='5'){}else return false;
  return true;
}

int main(){
  while(cin>>str){
    ans="";
    for(int i=0;i<(int)str.size();i+=2){
      if(check(str[i],str[i+1])){
	ans.push_back(t[str[i+1]-'0'][str[i]-'0']);
      }else{
	ans="NA";
	break;
      }
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1188
#include <stdio.h>
#include <algorithm>
#include <utility>

using namespace std;

#define debug(args...) fprintf(stderr, args)

const int MAXN = 2e5 + 10, INF = 2e9;

int n, v[MAXN];
long long int l[MAXN], r[MAXN], ans;

int main() {
	scanf("%d", &n);
	
	for(int i = 1; i <= n; i++) {
		scanf("%d", &v[i]);
	}
	
	v[0] = v[n+1] = -INF;
	
	for(int i = 1; i <= n; i++) {
		int cur = i - 1;
		
		while(v[cur] >= v[i]) {
			cur = l[cur];
		}
		
		l[i] = cur;
	}
	
	for(int i = n; i > 0; i--) {
		int cur = i + 1;
		
		while(v[cur] >= v[i]) {
			cur = r[cur];
		}
		
		r[i] = cur;
	}
	
	for(int i = 1; i <= n; i++) {
		long long int trange = (r[i] - i) * (i - l[i]);
		
		ans += trange * v[i];
	}
	
	printf("%lld\n", ans);
}

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

int main () {
  int n, a[201];
  int ans = -1;
  bool flag = true;

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

  while (flag) {
    for (int i = 0; i < n; i++) {
      if (a[i] % 2 != 0) {
        flag = false;
        break;
      } else a[i] /= 2;
    }
    ans++;
  }

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

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

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
//const ll mod = 1000000007;
int N;
string S[100050];
int compare[100005][27][27];
int lose[100005];
inline int moji(char in) {
    return (int)(in - 'a');
}

void solve(vector<int> &v, int index) {
    if(v.size() <= 1) return;
    //cout << index << " " << S[v[0]][index] << endl;
    vector<int> now_v[27];
    for(int i = 0; i < v.size(); i++) {
        if(S[v[i]].size() == index) {
            now_v[26].push_back(v[i]);
            continue;
        }
        now_v[moji(S[v[i]][index])].push_back(v[i]);
    }
    /*
    for(int i = 0; i <= 25; i++) {
        if(!now_v[i].empty()) {
            //cout << "SIZE OF " << (char)('a' + i) << " " << now_v[i].size() << endl;
        }
    }
    */
    for(int i = 0; i <= 25; i++) {
        for(int j = 0; j <= 25; j++) {
            if(i == j) continue;
            for(int index_i = 0; index_i < now_v[i].size(); index_i++) {
                compare[now_v[i][index_i]][j][i] += now_v[j].size();
            }
        }
    }
    if(!now_v[26].empty()) {
        for(int i = 0; i <= 25; i++) {
            for(int index_i = 0; index_i < now_v[i].size(); index_i++) {
                lose[now_v[i][index_i]] += now_v[26].size();
            }
        }
    }
    for(int i = 0; i <= 25; i++) {
        solve(now_v[i], index + 1);
    }
    return;
}

int main() {
    //cout.precision(10);
    cin >> N;
    for(int i = 1; i <= N; i++) {
        cin >> S[i];
    }
    vector<int> v(N);
    for(int i = 0; i < N; i++) {
        v[i] = i + 1;
    }
    solve(v, 0);
    /*
    for(char one = 'a'; one <= 'z'; one++) {
        for(char two = 'a'; two <= 'z'; two++) {
            if(compare[4][moji(one)][moji(two)] == 0) continue;
            cout << one << " " << two << " " << compare[4][moji(one)][moji(two)] << endl;
        }
    }
    cout << lose[4] << endl;
    */
    int Q;
    cin >> Q;
    while(Q--) {
        int k;
        cin >> k;
        string p;
        cin >> p;
        int ans = 1;
        ans += lose[k];
        for(int i = 0; i < 26; i++) {
            for(int j = i + 1; j < 26; j++) {
                ans += compare[k][moji(p[i])][moji(p[j])];
            }
        }
        cout << ans << endl;
    }
    return 0;
}


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

int main(){
	int n,m,a,b,ans;
	while(1){
		cin>>n>>m;
		if(n==0) break;
		ans=0;
		vector<pair<int,int> > D;
		for(int i=0;i<n;i++){
			cin>>b>>a;
			D.push_back(make_pair(a,b));
		}
		sort(D.begin(),D.end(),greater<pair<int,int> >());
		for(int i=0;i<n;i++){
			if(m<0) m=0;
			if(m-D[i].second<0){
				ans+=(D[i].second-m)*D[i].first;
				m=0;
			}
			else m-=D[i].second;
		}
		cout<<ans<<endl;
	}
	return 0;
}


Measured memory_bytes: 3196
#include<bits/stdc++.h>   
using namespace std;    
int main(){
  int x;
  cin>>x;
  if(x==3){
    cout<<"YES"<<endl;
  }

  else if(x==5){
    cout<<"YES"<<endl;
  }

  else if(x==7){
    cout<<"YES"<<endl;
  }
  else{
    cout<<"NO"<<endl;
  }
}



  
  

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

#define int long long

#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define FORR(i,m,n) for(int i=m;i>=n;i--)
#define pb(x) push_back(x) 
#define SORT(x) sort((x).begin(),(x).end())
#define INF 99999999999
 
using namespace std;


vector<vector<int> > v(100, vector<int>());
int n, m;
int cnt;

int bfs(int u, vector<bool> flag){
    bool f=true;
    REP(i, n){
        if(!flag[i+1]){
            f=false;
        }
    }

    if(f){
        cnt++;
        return 0;
    }

    REP(i, v[u].size()){
        if(!flag[v[u][i]]){
            flag[v[u][i]]=true;
            bfs(v[u][i], flag);
            flag[v[u][i]]=false;
        }
    }

    return 0;
}

int32_t main(){
    cin >> n >> m;
    REP(i, m){
        int a, b;
        cin >> a >> b;
        v[a].pb(b);
        v[b].pb(a);
    }
    
    cnt=0;
    vector<bool> flag(100, false);
    flag[1]=true;
    bfs(1, flag);

    cout << cnt << endl;
}

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

#define N 1001

using namespace std;

int main(){
	int V, d;
	
	while(cin >> V >> d){
		vector <int> f(V);
		int temp1, temp2;
		for(int i = 0; i < V; i++){
			if(i == 0)
				f[i] = temp1 = 2;
			else if(i == 1)
				f[i] = temp2 = 3;
			else{
				f[i] = (temp1 + temp2) % N;
				temp1 = temp2;
				temp2 = f[i];
			}
		}
		
		sort(f.begin(), f.end());
		
		int count = 1;
		for(int i = 0; i < V - 1; i++)
			if(f[i + 1] - f[i] >= d)
				count++;
		
		cout << count << endl;
	}
	
	return 0;
}

Measured memory_bytes: 1216
import scala.io.StdIn.readLine

object Main extends App {
  val (squareInfo, circleInfo) = readLine.split(" ").map(_.toInt).splitAt(2)
  val (w, h) = (squareInfo(0), squareInfo(1))
  val (x, y, r) = (circleInfo(0), circleInfo(1), circleInfo(2))

  if (x >= r && x <= w - r && y >= r && y <= h - r) println("Yes") else println("No")

}



Measured memory_bytes: 44136
#include <bits/stdc++.h>
#define all(a) (a).begin(),(a).end()
#define rep(i,n) for(ll (i)=0,(i##_len)=(n);(i)<(i##_len);(i)++)
#define rep2(i,a,b) for(ll (i)=(a),(i##_len)=(b);(i)<=(i##_len);(i++))
#define rrep(i,n) ll(i)=(n);ll now=-1;while((i)--&&(now++||1))
#define Yes(n) cout<<((n)?Yes:No)<<"\n"
#define vll vector<ll>
#define pb push_back
using namespace std;
using ll = long long;

static inline void ignore_ret(int x) {}
template<class T> bool chmax(T&a,const T&b){if(a<b){a=b;return true;}return false;}
template<class T> bool chmin(T&a,const T&b){if(a>b){a=b;return true;}return false;}
template<class T> T abs(T x){return max(x,-x);}
template<class T> T gcd_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=gcd(r,v.at(i));return r;}
template<class T> T lcm(T m,T n) {return m*n/gcd(m,n);}
template<class T> T lcm_vec(vector<T>v){T r=v.at(0);for(T i=1;i<v.size();i++)r=lcm<T>(r,v.at(i));return r;}
template<class T> T factorial(T n){if(n==0)return 1;T r=1;for(T i=2;i<=n;i++)r*=i;return r;}
template<class T> T nCr(T n,T k){return factorial<T>(n)/(factorial<T>(k)*factorial<T>(n-k));}
template<class T> T dot_product(vector<T>u,vector<T>v){T r=0;for(T i=0;i<u.size();i++)r+=u.at(i)*v.at(i);return r;}
template<class T> T sum(vector<T>v){return reduce(all(v),0LL);}

// Template ends here

ll substring(ll n, ll S) {
    ll digits = 1 + floor(log10(S));
    ll r = (S % ll(pow(10, digits - n))) / pow(10, digits - n - 3);
    return r;
}

void solve(ll S){
    ll ans = LLONG_MAX, digits = 1 + floor(log10(S));
    rep(i, digits - 2) chmin(ans, abs(substring(i, S) - 753));
    cout << ans << "\n";
}

int main() {
    ll S;
    ignore_ret(scanf("%lld",&S));
    solve(S);
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
const long long LINF = 1e18;
#define dump(x)  cout << 'x' << ' = ' << (x) << ` `;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOREACH(x,a) for(auto& (x) : (a) )
typedef long long ll;
using namespace std;
typedef pair<ll, ll> P;

template<typename T>
void print(const vector<T> &x) {
    int n = x.size();
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x) {
    int n = x.size();
    rep(i,n) {
        rep(j,x[i].size()) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

template<typename T>
void print(const vector<T> &x, int n) {
    rep(i,n) {
        cout << x[i];
        if (i!=n-1) cout<<" ";
        else cout << endl;
    }
}

template<typename T>
void print(const vector<vector<T>> &x, int n, int m) {
    rep(i,n) {
        rep(j,m) {
            cout << x[i][j] << " ";
        }
        cout << endl;
    }
}

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

void input_init() {
    cin.tie(0); ios::sync_with_stdio(false);
}

class union_find {
private:
    vector<ll> par;
    vector<ll> ran;
    vector<ll> m_size;
public:
    union_find(ll n);
    ll find(ll x);
    void unite(ll x, ll y);
    bool same(ll x, ll y);
    ll size(ll x);
};

union_find::union_find(ll n){
    par.resize(n);
    ran.resize(n, 0);
    m_size.resize(n, 1);
    rep(i,n) par[i] = i;
};

ll union_find::find(ll x) {
    if (par[x] == x) return x;
    else return par[x] = find(par[x]);
};

void union_find::unite(ll x, ll y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    ll t = size(x)+size(y);
    m_size[x] = m_size[y] = t;
    if (ran[x] < ran[y]) {
        par[x] = y;
        //size[y] += size[x];
    } else {
        par[y] = x;
        //ize[x] += size[y];
        if (ran[x]==ran[y]) ran[x]++;
    }
};

ll union_find::size(ll x) {
    if (par[x] == x) return m_size[x];
    return size(par[x] = find(par[x]));
}

bool union_find::same(ll x, ll y) {
    return (find(x) == find(y));
};

int main(int argc, char const *argv[]) {
    int n,m; cin>>n>>m;
    union_find uf(n);
    rep(i,m) {
        int a,b; cin>>a>>b;
        --a,--b;
        uf.unite(a,b);
    }

    int ans = 0;
    rep(i,n) chmax(ans, (int)uf.size(i));

    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 8004
import numpy as np

n = int(input())
A = list(map(int,input().split()))
A = np.array([a-i for i,a in enumerate(A,1)])
A = np.sort(A)

#中央値
if n % 2:
	z = A[n//2]
else:
	x = A[n//2-1]
	y = A[n//2]
	z = (x+y)//2

Z = np.array([z]*n)
# print(A,Z)
print(abs(np.sum(abs(A-Z))))

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

using namespace std;

int main ()
{
    int n;
    int a[100];
    while (cin >> n) {
        memset(a,0,sizeof(a));
        int j = 0;
        while (n) {
            a[j++] = n%10;
            n /= 10;
        }
        if ((a[0] == a[1]&&a[0] == a[2]&&a[1] == a[2])||(a[1] == a[2]&&a[1] == a[3]&&a[2] == a[3]))
            cout << "Yes" << endl;
        else
            cout << "No" << endl;
    }
}


Measured memory_bytes: 256
def main():
    s = 0
    n = int(input())
    gd1s = []
    combs = {}
    for i in range(1, n+1):
        for j in range(1, n+1):
            try:
                gd1 = combs[(i, j)]
                combs[(j, i)] = gd1
                gd1s.append(gd1)
            except:
                gd1 = gcd(i, j)
                gd1s.append(gd1)
                combs[(i, j)] = gd1

    for k in range(1, n+1):
        for g in gd1s:
            s += combs[(g,k)]
    print(s)

def gcd(a, b):
    while b:
        a, b = b, a % b
    return a

if __name__ == "__main__":
    main()

Measured memory_bytes: 12796
#include <bits/stdc++.h>
using namespace std;
#define SELECTER(_1, _2, _3, SELECT, ...) SELECT
#define REP1(i, n) for(int (i)=0; (i)<(n); (i)++)
#define REP2(i, a, b) for(int (i)=(a); (i)<(b); (i)++)
#define REP(...) SELECTER(__VA_ARGS__, REP2, REP1,) (__VA_ARGS__)
#define MOD 1'000'000'007

template <class T> ostream& operator<<(ostream& os, const vector<T>& v){ os << "{"; for(size_t i=0; i<v.size(); i++) os << v[i] << (i+1==v.size() ? "" : ", "); os << "}"; return os; }
template <class T, class U> ostream& operator<<(ostream& os, const pair<T, U>& p){ return os << "{" << p.first << ", " << p.second << "}"; }

class Comb{
    // テーブルを作るのに O(NlogN)
    // 計算は O(1)
    int N;
    vector<long long> fact_num, fact_den;
    long long bipow(long long n, long long m) {
        if (m == 0) return 1;
        if (m % 2 == 0) {
            n = (n * n) % MOD;
            return bipow(n, m / 2) % MOD;
        } else
            return (n * bipow(n, m - 1)) % MOD;
    }
    void set_table(){
        fact_num.resize(N+1, 0);
        fact_den.resize(N+1, 0);
        vector<long long> fact_denpow(N+1, 0);

        fact_num[0] = 1;
        for(int i=1; i<=N; i++) fact_num[i] = (fact_num[i-1] * i) % MOD;
        for(int i=0; i<=N; i++) fact_denpow[i] = bipow(i, MOD-2);
        fact_den[0] = 1;
        for(int i=1; i<=N; i++) fact_den[i] = (fact_den[i-1] * fact_denpow[i]) % MOD;
    }
public:
    Comb(int N): N(N) { set_table(); }
    // nCk
    long long calc(long long n, long long k){
        if(k > n) return 0;
        return ((fact_num[n] * fact_den[k]) % MOD * fact_den[n-k]) % MOD;
    }
};

int main(){
    int H, W, N;
    cin >> H >> W >> N;
    vector<pair<int, int>> rc(N);
    REP(i, N) cin >> rc[i].first >> rc[i].second;

    rc.emplace_back(H, W);
    REP(i, N+1){
        rc[i].first--;
        rc[i].second--;
    }
    sort(rc.begin(), rc.end());

    Comb comb(H+W);

    vector<long long> dp(N+1);
    for(int i=0; i<=N; i++){
        int r, c;
        r = rc[i].first;
        c = rc[i].second;

        long long tot = comb.calc(r+c, r);
        REP(j, i){
            int r2, c2;
            r2 = rc[j].first;
            c2 = rc[j].second;
            if(r2 <= r && c2 <= c){
                tot += MOD - (dp[j] * comb.calc(r+c-r2-c2, r-r2)) % MOD;
                tot %= MOD;
            }
        }
        dp[i] = tot;
    }
    cout << dp[N] << endl;
    return 0;
}

Measured memory_bytes: 4992
#include <bits/stdc++.h>
        using namespace std;
        #define int long long
const int MAX = 1000001;
const int MOD = 1000000007;
   
        signed main() {
           int a,b;
           cin>>a>>b;
           if(a==1)a=14;
           if(b==1)b=14;
           if(a>b){
               cout<<"Alice";return 0;
           }
           if(b>a){
               cout<<"Bob";
               return 0;
           }
           cout<<"Draw";
           return 0;
         return 0;

        }


Measured memory_bytes: 256
X = int(input())


def is_prime(x):
    i = 2
    while i ** 2 <= x:
        if x % i == 0:
            return False
        i += 1
    return x != 1


i = X
while True:
    if is_prime(i):
        print(i)
        exit(0)
    else:
        i += 1

Measured memory_bytes: 2940
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define ALL(a) (a.begin(), a.end())
using ll = long long;
template<typename T> void Out(T x) { cout << x << endl; }

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int a, b;
  cin >> a >> b;
  for (int i = 1; i <= 1000; i++) {
    if ((i * 8 / 100) == a && (i / 10) == b ) {
      Out(i); return 0;
    }
  }
  Out(-1);
  return 0;
}


Measured memory_bytes: 256
/*Arnab's Code
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp(a,b) make_pair(a,b)
#define vll vector<ll>
#define vii vector<int>
#define pll pair<ll,ll>
#define pii pair<int,int>
#define take(a,n) for(ll i=0;i<n;i++)cin>>a[i]
#define takes(a,n,st) for(ll i=st;i<n+st;i++)cin>>a[i]
ll sum(ll a[],ll n,ll s){ for(ll i=0;i<n;i++)s+=a[i]; return s;}
#define mod 1000000009
ll power(ll x, ll y, ll p)  {  
    ll res = 1;  
    x = x % p;   
    if (x == 0) return 0;  
    while (y > 0){  
        if (y & 1)  
            res = (res*x) % p;  
        y = y>>1;
        x = (x*x) % p;  
    }  
    return res;  
}
void solve(){
	ll n,i,x,cur,tot;
	cin>>n;
	cur=0;
	tot=0;
	for(i=0;i<n;i++){
		cin>>x;
		if(x!=0){
			cur+=x;
		}
		else{
			tot+=(cur/2);
			cur=0;
		}
	}
	tot+=(cur/2);
	cout<<tot;
	return;
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	#ifndef ONLINE_JUDGE
		freopen("input.txt","r",stdin);
		freopen("output.txt","w",stdout);
	#endif
	ll t,T;
//	cin>>T;
	T=1;
	for(t=1;t<=T;t++){
//		cout<<"Case #"<<t<<": ";
		solve();
	}
	return 0;
}

Measured memory_bytes: 3664
#include<bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 7;
int A, B, n, X, Y;
int a[maxn], b[maxn];
char s[maxn], t[maxn];

bool check(int N, int x) {
	int l = 1, r = N;
	for (int i = n; i >= 1; --i) {
		if(b[i] == 1) l = max(1, l - 1);
		if(b[i] == -1) r = min(N, r + 1);
		if(a[i] == 1) --r;
		if(a[i] == -1) ++l;
		if(l > r) return 0;
	}
	return (x >= l && x <= r);
}

int main() {
	scanf("%d%d%d%d%d", &A, &B, &n, &X, &Y);
	scanf("%s%s", s + 1, t + 1);
	int fl = 0;
	for (int i = 1; i <= n; ++i) {
		a[i] = b[i] = 0;
		if(s[i] == 'U') a[i] = -1;
		if(s[i] == 'D') a[i] = 1;
		if(t[i] == 'U') b[i] = -1;
		if(t[i] == 'D') b[i] = 1;
	}
	if(!check(A, X)) fl = 1;
	for (int i = 1; i <= n; ++i) {
		a[i] = b[i] = 0;
		if(s[i] == 'L') a[i] = -1;
		if(s[i] == 'R') a[i] = 1;
		if(t[i] == 'L') b[i] = -1;
		if(t[i] == 'R') b[i] = 1;
	}
	if(!check(B, Y)) fl = 1;
	if(fl) printf("NO\n");
	else printf("YES\n");
	return 0;
}

Measured memory_bytes: 5684
def orderN(N,L,ices):
    upPeak = L - ices[0]
    downPeak = L - ices[0]
    peaks = []
    for i in range(len(ices)):
        if i < N-1:
            if ices[i] < ices[i+1]:
                peaks.append(downPeak)
                downPeak = L - ices[i+1]
                upPeak += L - ices[i+1]
            elif ices[i] > ices[i+1]:
                peaks.append(upPeak)
                upPeak = L - ices[i+1]
                downPeak += L - ices[i+1]
        elif i == N-1:
            peaks.append(upPeak)
            peaks.append(downPeak)
    print(max(peaks))

N,L = map(int,input().strip().split())
ices = []
while True:
    ice = int(input().strip())
    ices.append(ice)
    if len(ices) == N:
        break

orderN(N,L,ices)

Measured memory_bytes: 15656
import sys
ns = lambda: sys.stdin.readline().rstrip()
ni = lambda: int(ns())
nm = lambda: map(int, sys.stdin.readline().split())
nl = lambda: list(nm())

n, m = nm()
ab = [nl() for i in range(m)]
ans = [0 for i in range(n)]
for i in range(m):
    ans[ab[i][0] - 1] += 1
    ans[ab[i][1] - 1] += 1
for i in range(n):
    print(ans[i])


Measured memory_bytes: 3064
#include <iostream>
#include <string>
#include <cmath>

using namespace std;

int main()

{
    int n, m, X, Y;
    cin >> n >> m >> X >> Y;
    int x[n], y[m];
    int max_x = -200;
    int min_y = 200;

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

        cin >> x[i];
        if (x[i] > max_x)
        {
            max_x = x[i];
        }
    }
    for (int i = 0; i < m; i++)
    {
        cin >> y[i];
        if (y[i] < min_y)
        {
            min_y = y[i];
        }
    }
    bool yes = true;
    int count = 0;

    if (max_x >= min_y)
    {
        cout << "War";
        return 0;
    }
    else if (max_x >= X && min_y <= Y)
    {
        cout << "No War";
    }
    else
    {
        cout << "War";
    }
}


Measured memory_bytes: 384
/* ex7_3
  terakura */

  #include <stdio.h>
  #include <stdlib.h>

  int main(void){
      int  height, width, i, j, *row_white, *col_white;
      char **input ;
      scanf("%d %d", &height, &width);

      //各行の配列へのポインタ分のメモリ領域を確保
      input = (char**)calloc(height, sizeof(char*));
      if(input == NULL){
          exit(1);
      }

      //各列の配列へのポインタ分のメモリ領域を確保
      for(i = 0; i < height; i++){
          input[i] = (char*)calloc(width, sizeof(char));

          if(input == NULL){
              exit(1);
          }
      }

      //メモリ領域を確保
      row_white = (int*)calloc(height, sizeof(int));
      if(row_white == NULL){
          exit(1);
      }

      //メモリ領域を確保
      col_white = (int*)calloc(width, sizeof(int));
      if(col_white == NULL){
          exit(1);
      }


      //マスに白と黒を入力
      for(i = 0; i < height; i++){
          for(j = 0; j < width; j ++){
              scanf(" %c", &input[i][j]);
          }
      }

      //白いマスのみからなるrowを探す
      for(i = 0; i < height; i++){
          for(j = 0; j < width; j ++){
             if (input[i][j] == '#')break;

             //もし白いマスのみからなるrowが見つかったらrow_white[i] = 1として印をつける
             if (j == width - 1){
                 row_white[i] = 1;
             }

          }
      }

      //白いマスのみからなるcolを探す
      for(j = 0; j < width; j++){
          for(i = 0; i < height; i ++){
             if (input[i][j] == '#')break;

             //もし白いマスのみからなるcolが見つかったらcol_white[i] = 1として印をつける
             if (i == height - 1){
                 col_white[j] = 1;
             }

          }
      }

      //白黒を出力
      for(i = 0; i < height; i++){

          //row_white[i] = 1ならばそのrowをスキップ
          if (row_white[i] == 1) continue;

          //col_white[i] = 1ならばそのcolをスキップ
          for(j = 0; j < width; j ++){
              if (col_white[j] == 1) continue;

              printf("%c", input[i][j]);
          }
          printf("\n");
      }


      //メモリの解放
      for(i = 0; i < height; i++){
          free(input[i]);
      }
      free(input);
      free(row_white);
      free(col_white);

      return 0;


  }


Measured memory_bytes: 1676
def equal_or_wildcard(s: str, t: str)->bool:
    for cs, ct in zip(s, t):
        if cs != '?' and cs != ct:
            return False
    return True


def dubious_document2(S: str, T: str)->str:
    ns, nt = len(S), len(T)
    for i in range(ns - nt, -1, -1):
        if equal_or_wildcard(S[i:i+nt], T):
            return (S[:i] + T + S[i+nt:]).replace('?', 'a')
    return 'UNRESTORABLE'


if __name__ == "__main__":
    S = input()
    T = input()
    ans = dubious_document2(S, T)
    print(ans)


Measured memory_bytes: 3064
#include <algorithm>
#include <complex>
#include <iostream>
#include <numeric>
#include <string>
#include <vector>
using namespace std;

int main()
{
    int n, x;
    cin >> n >> x;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    sort(a.begin(), a.end());
    int ans = 0;
    for (int i = 0; i < n; i++) {
        x -= a[i];
        if (x < 0) break;
        ans++;
    }
    if (x > 0) ans--;
    cout << ans << endl;
    return 0;
}

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

const string a2p = "peach";
const string p2a = "apple";

int main()
{
  string s;
  vector<string> output;
  while (cin >> s) {
    if (s.find("apple") != string::npos) {
      int rev = s.find("apple");
      for (int i = 0; i < 5; ++i)
	s[i+rev] = a2p[i];
    } else if (s.find("peach") != string::npos) {
      int rev = s.find("peach");
      for (int i = 0; i < 5; ++i)
	s[i+rev] = p2a[i];
    }
    output.push_back(s);
  }

  for (int i = 0; i < output.size()-1; ++i)
    cout << output[i] << " ";
  cout << output[output.size()-1] << endl;
  return 0;
}

Measured memory_bytes: 0
#include<bits/stdc++.h>
using namespace std;
int main(){
	ios::sync_with_stdio(false);
	int a[5];
	cin>>a[0]>>a[1]>>a[2];
	sort(a,a+3);
	int k;
	cin>>k;
	for(int i=1;i<=k;i++){
		a[2]*=2;
	}
	cout<<a[0]+a[1]+a[2]<<endl;
	return 0;
}

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

int main() {
  int k;
  cin >> k;
  int x = 7%k;
  set<int> s;
  for (int i = 1; i <= k; ++i) {
    if (x == 0) {
      cout << i << endl;
      return 0;
    }
    x = (x*10+7)%k;
  }
  cout << -1 << endl;
  return 0;
}

Measured memory_bytes: 3584
n,k=map(int,input().split())
A=list(map(int,input().split()))
cnt=0
s=1
M=[0]
B=[False]*(n+1)
while cnt<n:
    s=A[s-1]
    if not B[s-1]:
        B[s-1]=True
    else:
        break
    M.append(s-1)
    cnt+=1
x=M.index(s-1)
y=len(M)-x

if k<=x:
    print(M[k]+1)
else:
    N=M[x:]
    print(N[(k-x)%y]+1)

Measured memory_bytes: 95628
#include <bits/stdc++.h>
using namespace std;
int n,dp[200004];
int main(){
	memset (dp,-1,sizeof(dp));
	cin>>n;
	int ans=0;
	for (int i=1;i<=n;i++){
		int x;scanf("%d",&x);
		if (x==1){
			dp[x]=1;
			ans=max(ans,1);
			continue;
		}
		if (dp[x-1]==-1) continue; 
		dp[x]=dp[x-1]+1;
		ans=max(ans,dp[x]);
	}
	if (ans==0){
		puts("-1");return 0;
	}
	cout<<n-ans;
}

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

int main(int argc, const char * argv[]) {
    int a, b, x;
    int m, n;
    
    cin >> a>>b;
    x = b - a;
    m = 0;
    for (int i = 1; i <= x; i++){
        m = m+i;
    }
    n = m -b;
    cout << n;
    
    cout<< endl;
    return 0;
}


Measured memory_bytes: 256
main:: IO ()
main = do
    [n,a,b,c,d] <- (map read . words) <$> getLine
    putStrLn $ if solve (n-1) (b-a) (c,d) then "YES" else "NO"

solve :: Int -> Int -> (Int, Int) -> Bool
solve n' k (c,d) = any f [n'*d, n'*d-(c+d) .. 0]
  where
    k' = abs k
    f x = x-(d-c)*n' <= k' && k' <= x

ok :: Int -> (Int,Int) -> Bool
x `ok` (xmin, xmax)
  | x > 0     = xmin <= x && x <= xmax
  | otherwise = (-xmax) <= x && x <= (-xmin)


Measured memory_bytes: 1020
#include<stdio.h>


int main (void){
	long long int a = 0;
	long long int b = 0;
	long long int x = 0;
	long long int counter = 0;
	long long int reserve = 0;

	scanf("%lld",&a);
	scanf("%lld",&b);
	scanf("%lld",&x);

	reserve = (b / x);
	counter = ((a - 1) / x);

	if(a == 0){
		counter = -1;
	}

	printf("%lld\n",reserve - counter);
}

Measured memory_bytes: 128
#include <iostream>
using namespace std;
int main(void){
    int a, b;
    cin >> a >> b;
    if (a > b){
        cout << "a > b";
    }else if (a < b){
        cout << "a < b";
    }else{
        cout << "a == b";
    }
    cout << "\n";
    return 0;
}

Measured memory_bytes: 1128
import java.util.Scanner;

public class Main {

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

	    int N=gi();
	    int[][] A=new int[2][N];

        for(int i=0; i<2;i++) {
        	for(int j=0; j<N;j++) {
                A[i][j]=gi();
            }
        }

        int max=A[0][0];
        for(int i=0; i<N;i++) {
            max+=A[1][i];
        }
        
        int t=max;
        for(int i=1; i<N;i++) {
            t=t-A[1][i-1] + A[0][i];
            if(t>max) {
            	max=t;
            }
        }

	    System.out.print(max);
	}

	// 文字列として入力を取得
	public static String gs() {
		return scanner.next();
	}

	// intとして入力を取得
	public static int gi() {
		return Integer.parseInt(scanner.next());
	}

	// longとして入力を取得
	public static long gl() {
		return Long.parseLong(scanner.next());
	}

	// doubleとして入力を取得
	public static double gd() {
		return Double.parseDouble(scanner.next());
	}
}

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

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

  int ans = 0;
  rep(_, N) {
    ll X, Y;
    cin >> X >> Y;
    if (X * X + Y * Y <= D * D) ans++;
  }
  cout << ans << endl;
  return 0;
}

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

#define ll long long

using namespace std;
ll N;
ll P;


void comb(vector<vector <long long int> > &v){
  for(int i = 0;i <v.size(); i++){
    v[i][0]=1;
    v[i][i]=1;
  }
  for(int k = 1;k <v.size();k++){
    for(int j = 1;j<k;j++){
      v[k][j]=(v[k-1][j-1]+v[k-1][j]);
    }
  }
}



int main(){
    
  ll inp;
  ll odd=0,even=0;
  ll a,b;
  ll result=0;

  
  cin >> N >> P;
  
  for(ll i = 0;i<N;i++){
    cin >> inp;
    if((inp%2)==1) odd++;
    else even++;
  }

  vector<vector<long long int> > v(N+1,vector<long long int>(N+1,0));
  comb(v);

  b = 0;
  for(ll i = 0;i<= even;i++){
    b+=v[even][i];
  }
  if(P){//oddから奇数
    for(ll i =1;i<=odd;i+=2){
      a=v[odd][i];
      result += (a*b);
    }
  }
  else{//oddから偶数
    for(ll i=0;i<=odd;i+=2){
      a = v[odd][i];
      result += (a*b);
    }
    
  }
  cout << result << endl;
  return 0;
}


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

int main()
{
    int n;
    cin >> n;
    vector<int> a(100001);
    vector<int> b(100001);
    for(int i=0; i<n; i++) cin >> a.at(i);
    for(int i=0; i<n; i++) b.at(a.at(i)-1) = i+1; 
    for(int i=0; i<n; i++) cout << b.at(i) << endl;
}

Measured memory_bytes: 1664
#include<stdio.h>
int main()
{
	int d, w;
	int i, j, k;
	int e[12][12];
	int ui, uj, si, sj;
	int ans[102], count;
	int min;
	for (k = 0;; k++)
	{
		scanf("%d %d", &d, &w);
		if (d == 0 && w == 0)
			break;
		for (i = 0; i < d; i++)
			for (j = 0; j < w; j++)
				scanf("%d", &e[i][j]);
		ans[k] = 0;
		for (ui = 0; ui < d - 1; ui++)
		{
			for (uj = 0; uj < w - 1; uj++)
			{
				for (si = ui + 1; si < d; si++)
				{
					for (sj = uj + 1; sj < w; sj++)
					{
						min = 102;
						for (i = ui; i <= si; i++)
						{
							if (min > e[i][uj])
								min = e[i][uj];
							if (min > e[i][sj])
								min = e[i][sj];
						}
						for (j = uj; j <= sj; j++)
						{
							if (min > e[ui][j])
								min = e[ui][j];
							if (min > e[si][j])
								min = e[si][j];
						}
						count = 0;
						for (i = ui + 1; i < si; i++)
						{
							for (j = uj + 1; j < sj; j++)
							{
								if (e[i][j] >= min)
								{
									count = -1;
									break;
								}
								count += min - e[i][j];
							}
							if (count < 0)
								break;
						}
						if (ans[k] < count)
							ans[k] = count;
					}
				}
			}
		}
	}
	for (i = 0; i < k; i++)
		printf("%d\n", ans[i]);
	return 0;
}


Measured memory_bytes: 2140
//url:
//problem name: 

#include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < (n); ++i)
template<class T> inline bool chmin(T& a, T b) {if (a > b) {a = b;return true;}return false;}
template<class T> inline bool chmax(T& a, T b) {if (a < b) {a = b;return true;}return false;}
using namespace std;
using ll = long long;
using P = pair<int,int>;
using Pl = pair<long long,long long>;
using veci = vector<int>;
using vecl = vector<long>;
using vecveci = vector<vector<int>>;
using vecvecl = vector<vector<long long>>;

int main() {
    string S;
    cin >> S;
    int N = S.size();
    int cnt1 = 0;
    int cnt0 = 0;
    for(char c:S) {
        if(c == '1') cnt1++;
        else cnt0++;
    }
    cout << min(cnt1,cnt0)*2 << endl;
}


Measured memory_bytes: 512
#pragma GCC optimize("O3")
#pragma GCC target ("sse4")

#include "bits/stdc++.h"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/rope"

using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define F0R(i, a) for(int i = 0; i < (a); ++i)
#define pb push_back
#define mp make_pair
#define sz(x) (int)x.size()
#define f first
#define s second

template <class T> using Tree = tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

struct custom_hash 
{
    static uint64_t splitmix64(uint64_t x) 
    {
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const 
    {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

int main()
{
    // freopen("input.txt", "r", stdin);
    // freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int a, b, c;
    cin >> a >> b >> c;
    cout << max(c - (a - b), 0);
    return 0;
}

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

int main() {
    ll q, h, s, d;
    cin >> q >> h >> s >> d;
    ll n;
    cin >> n;
    ll ans = 0;
    ll mn = min({8*q, 4*h, 2*s, d});
    if(mn == 8*q){
        cout << n * q * 4 << endl;
    }else if(mn == 4 * h){
        cout << n * h * 2 << endl;
    }else if(mn == 2 * s){
        cout << n * s << endl;
    }else{
        ll ans = n / 2 * d;
        if(n % 2 == 1){
            ll mn = min({4*q, 2*h, s});
            ans += mn;
        }
        cout << ans << endl;
    }
    
}

Measured memory_bytes: 3640
x, n = map(int, input().split())
p = list(map(int, input().split()))
d = [0]*102
for i in p: d[i] = 1
if d[x] == 0:
    print(x)
else:
    i = 1
    while True:
        if x-i>=0:
            if d[x-i] == 0:
                print(x-i)
                break
        if x+i<=101:
            if d[x+i] == 0:
                print(x+i)
                break
        i += 1

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

struct _point
{
    int l,r;
}p[100010];
bool cmp(_point a,_point b)
{
    if(a.l==b.l)
    return a.r>b.r;
    return a.l<b.l;
}

int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    for(int i=0;i<m;i++)
    scanf("%d%d",&p[i].l,&p[i].r);

    sort(p,p+m,cmp);

    int cnt=1;
    int nowr;
    nowr=p[0].r;
    for(int i=1;i<m;i++)
    {
        if(p[i].l<nowr&&p[i].r>nowr)///交叉
        {
            continue;
        }
        else if(p[i].r<=nowr)///包含
        {
            nowr=p[i].r;
        }
        else if(p[i].l>=nowr)///相离
        {
            nowr=p[i].r;
            cnt++;
        }
    }
    printf("%d\n",cnt);
    return 0;
}


Measured memory_bytes: 1024
L, R = map(int, input().split())
MOD = 10 ** 9 + 7
l = '{:060b}'.format(L)[::-1]
r = '{:060b}'.format(R)[::-1]

memo = [[[[-1 for l in range(2)] for k in range(2)] for j in range(2)] for i in range(60)]

def f(pos, flagX, flagY, flagZ):
    if pos == -1:
        return 1
    if memo[pos][flagX][flagY][flagZ] != -1:
        return memo[pos][flagX][flagY][flagZ]
    ret = 0
    # x 0, y 0
    if flagX or l[pos] == '0':
        ret += f(pos - 1, flagX, 1 if r[pos] == '1' else flagY, flagZ)
    # x 0, y 1
    if (flagX or l[pos] == '0') and (flagY or r[pos] == '1') and flagZ:
        ret += f(pos - 1, flagX, flagY, flagZ)
    # x 1, y 1
    if flagY or r[pos] == '1':
        ret += f(pos - 1, 1 if l[pos] == '0' else flagX, flagY, 1)
    ret %= MOD
    memo[pos][flagX][flagY][flagZ] = ret
    return ret

ans = f(59, 0, 0, 0)
print(ans)


Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define in insert
#define sz(x) ((in)(x).size())
using namespace std;
const int N = 1e5 + 123;
ll a[N];

void read_file()
{
    freopen("text.in","r",stdin);
    freopen("text.out","w",stdout);
}

void solve()
{
    int n;
    cin >> n;
    for (int i = 1; i <= n; i++) cin >> a[i];
    for (int i = 2; i <= n; i++)
    {
        if (a[i - 1] > a[i])
        {
            for (int j = i - 1; j >= 1; j--)
            {
                if (a[j] - a[i] > 1)
                {
                    cout << "No\n";
                    return;
                }
            }
        }

    }
    cout << "Yes\n";
}

int main()
{
    solve();
    //cerr << printf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
    return (0);
}




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

int main(){
    ll n,k;
    cin >> n >> k;
    string s;
    cin >> s;
    ll count=0;
    for(ll i=0;i<n-1;i++){
        if(s[i]!=s[i+1]) count++;
    }
    ll res=min(n-1,n-1-count+2*k);
    cout << res << endl;
    return 0;
}


Measured memory_bytes: 3752
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S,T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main(){
    cin>>N;
    set<ll> beki;
    beki.insert(1);
    reps(i,2,32){
        ll temp = i*i;
        while(temp <= N){
            beki.insert(temp);
            temp *= i;
        }
    }
    auto ite = beki.upper_bound(N);
    --ite;
    cout<<*ite<<endl;
}


Measured memory_bytes: 256
package main

import "fmt"

var k, n int
var as []int

func main() {
	fmt.Scan(&k, &n)
	as = make([]int, n)
	for i := range as {
		fmt.Scan(&as[i])
	}
	ans := as[n-1] - as[0]
	for i := 1; i < n; i++ {
		chmin(&ans, k + as[i-1] - as[i])
	}
	fmt.Println(ans)
}

const INF = 1 << 60

func chmax(a *int, b int) {
	if *a < b {
		*a = b
	}
}

func chmin(a *int, b int) {
	if *a > b {
		*a = b
	}
}


Measured memory_bytes: 6784
#if defined(LOCAL)
const double _max_double_error = 1e-9;
#include "testutils.h"
#define L(x...) (debug(x, #x))
#define I(x, ...) (x)
#define C(x...) CHECK(x)
#else
#define L(x, ...) (x)
#define I(x, ...) (x)
#define C(x, ...) ;
#endif
#include <algorithm>
#include <vector>
#include <string>
#include <iomanip>
#include <iostream>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <math.h>
#include <limits>
#include <numeric>
#include <queue>
#include <memory>

using namespace std;
using vi = vector<int>; using vvi = vector<vi>; using vvvi = vector<vvi>;
using ii = pair<int,int>; using lu = unsigned long long; using l = long long;
using vs = vector<string>; using vii = vector<ii>;
using vl = vector<l>; using vvl = vector<vl>; using vvvl = vector<vvl>;
using ll = pair<l,l>; using vll = vector<ll>; using vvll = vector<vll>;
using vb = vector<bool>; using vvb = vector<vb>;
using vd = vector<double>; using vvd = vector<vd>;
using mll = unordered_map<l, l>; using sl = unordered_set<l>;
const l INF = numeric_limits<l>::max();
const double EPS = 1e-10; const double PI = M_PI;
const l e0=1, e3=1000, e5=100000, e6=10*e5, e7=10*e6, e8=10*e7, e9=10*e8;
const char lf = '\n';
#define all(x) begin(x), end(x)
#define F(a,b,c) for (l a = l(b); a < l(c); a++)
#define B(a,b,c) for (l a = l(c) - 1; a >= l(b); a--)
#define VVL(x, a, b, i) vvl x(a, vl(b, l(i)));
#define VVVL(x, a, b, c, i) vvvl x(a, vvl(b, vl(c, l(i))));

void solve(istream& in, ostream& out);
int main(int argc, char **argv) {
  ios_base::sync_with_stdio(false); cin.tie(0);
  cout << fixed << setprecision(15);
#if defined(LOCAL)
  tst::test_init(argc, argv);
  // _generate_random_test = generate_random;
  // _solve_brute = solve_brute;
  // _player_b = player_b;
  // _custom_solution_checker = solution_checker;
  tst::maybe_run_tests(cin, cout);
#else
  solve(cin, cout);
#endif
}
const l MOD = e9 + 7; // end of template

void solve(istream& in, ostream& out) {
  l a, b; in >> a >> b;
  out << (a * b % 2 ? "Yes" : "No") << lf;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Locale;

final class Main {

    private Main() {
    }

    public static void main(final String[] argv) throws IOException {
        final BufferedReader inputReader =
                new BufferedReader(new InputStreamReader(System.in));
        int[] count = new int[101];
        Arrays.fill(count, 0);
        while (true) {
            String input = inputReader.readLine();
            if (input == null) {
                break;
            }
            count[Integer.parseInt(input)]++;
        }
        int max = 0;
        for (int i = 0; i < count.length; i++) {
            if (max < count[i]) {
                max = count[i];
            }
        }
        for (int i = 0; i < count.length; i++) {
            if (max == count[i]) {
                System.out.println(i);
            }
        }
    }
}

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

int main() {
  string S;
  cin >> S;
  bool same = false;
  sort(S.begin(),S.end());
  for(int i = 0; i < S.size(); ++i){
    if(S[i]==S[i+1]) same = true;
  }
  if(!same) cout << "yes" << endl;
  else cout << "no" << endl;
}

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

int master[4][3][10];

int main()
{
	int len;
	std::cin>>len;
	
	for(int i=0;i<len;i++)
	{
	    int b;
	    int f;
	    int r;
	    int v;
	    std::cin>>b>>f>>r>>v;
	    
	    master[b-1][f-1][r-1]+=v;
	}

    for(int i=0;i<4;i++)
    {
        for(int j=0;j<3;j++)
        {
            for(int k=0;k<10;k++)
            {
                std::cout<<" "<<master[i][j][k];
            }
            std::cout<<"\n";
        }
        if(i!=3) std::cout<<"####################\n";
    }
}


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

int main(){
    string S;
    cin >> S;
    int N = S.size(), MOD = 1000000007;

    ll dp[100010][4]{};
    for(int i = N; i >= 0; --i){
        for(int j = 3; j >= 0; --j){
            if(i == N){
                dp[i][j] = (j == 3 ? 1 : 0);
            }else{
                dp[i][j] = dp[i+1][j] * (S[i] == '?' ? 3LL : 1LL);
                if(j < 3 && (S[i] == '?' || S[i] == "ABC"[j])){
                    dp[i][j] += dp[i+1][j+1];
                }
                dp[i][j] %= MOD;
            }
        }
    }
    cout << dp[0][0] << endl;
}


Measured memory_bytes: 3584
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;


int main() {
	int N;
	cin >> N;
	vector<double> AA(N, 0);
	
	for(int i = 0; i < N; i++){
		
		cin >> AA[i];		
	}
	
	
	sort(AA.begin(), AA.end());	
	
	//for(int i = 0; i < N; i++){		
	//	cout << AA[i] << " ";		
	//}	
	
	
	double B = AA[0];
	for(int i = 1; i < N; i++){	
		B =(B + AA[i])/2;
		
	}
	
	cout << B << endl;	

	
	
    return 0;
}


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

int main(){
    int n;
    const int mod=256;
    while(cin>>n,n){
        vector<int> v(n);
        rep(i,n){
            cin>>v[i];
        }
        vector<int> R(n+1);
        vector<int> O(256,0);
        long double ans=1e100;
        int s,a,c;
        rep(S,16){
            rep(A,16){
                rep(C,16){
                    R[0]=S;
                    reep(i,1,n+1){
                        R[i]=(A*R[i-1]+C)%mod;
                    }
                    rep(i,256) O[i]=0;
                    rep(i,n){
                        O[(v[i]+R[i+1])%mod]++;
                    }
                    long double tmp=0;
                    rep(i,256){
                        if(O[i]==0) continue;
                        double t=(double)O[i]/n;
                        tmp-=t*log(t);
                    }
                    if(ans>tmp){
                        s=S;
                        a=A;
                        c=C;
                        // cout<<s<<" "<<a<<" "<<c<<" "<<tmp<<endl;
                        ans=tmp;
                    }
                }
            }
        }
        cout<<s<<" "<<a<<" "<<c<<endl;
    }
}

Measured memory_bytes: 1240