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

struct Benri { Benri() { std::cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(12);}} benri;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using pii = pair<int, int>;
using vll = vector<long long>;
using vvll = vector<vll>;
using pll = pair<ll, ll>;
using ull = unsigned long long;

template <typename T> using PQ = priority_queue<T>;
template <typename T> using minPQ = priority_queue<T, vector<T>, greater<T>>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define mp make_pair
#define F first
#define S second

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

constexpr long long MOD = 1000000007;
//constexpr long long MOD = 998244353;
//constexpr int INF = 1001001001;
constexpr ll INF = 1001001001001001001ll;
constexpr double EPS = 1e-10;
using number = long long;


struct UnionFind {
    vector<int> par, rank;

    UnionFind(int n) : par(n , -1), rank(n, 0) { }
    void init(int n) { par.assign(n, -1), rank.assign(n, 0); }

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

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

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

int main() {
    ll N; cin >> N;
    UnionFind uf(2 * N);
    vvi G(N);
    rep(i, N) {
        rep(j, N) {
            char c; cin >> c;
            if (c == '1') {
                G[i].pb(j);
                uf.unite(i, j + N);
                uf.unite(i + N, j);
            }
        }
    }

    bool g = true;
    rep(i, N) {
        if (uf.same(i, i + N)) {
            g = false;
            break;
        }
    }
    if (!g) {
        cout << -1 << endl;
        return 0;
    }

    //各点をV1としてkを最大化する
    int ans = 1;
    vi col(N);
    rep(s, N) {
        col.assign(N, -1);
        queue<int> q;

        col[s] = 1;
        q.push(s);
        while (!q.empty()) {
            int v = q.front(); q.pop();
            chmax(ans, col[v]);

            for (auto nv : G[v]) {
                if (col[nv] != -1) continue;
                col[nv] = col[v] + 1;
                q.push(nv);
            }
        }
    }

    cout << ans << endl;
}

Measured memory_bytes: 512
#define _CRT_SECURE_NO_WARNINGS

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

/* define */
#define Yes(X) puts ( (X) ? "Yes" : "No")
#define YES(X) puts ( (X) ? "YES" : "NO")
#define FOR(i, a, b) for ( int i = (a); i < (b) ; i++)
#define REP(i, n) for ( int i = 0; i < (n) ; i++)
#define max(a, b) (((a) > (b)) ? (a) : (b))
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max3(a, b, c) ((max((a), (b)) > (c)) ? max((a), (b)) : (c))
#define min3(a, b, c) ((min((a), (b)) < (c)) ? min((a), (b)) : (c))

/* const */
const int MOD = 1000000007;

/* alias */
typedef long long ll;
typedef unsigned  u;

/* function */
int cmp(const void *a, const void *b) {
	return *(int*)a - *(int*)b;
}
int cmp2(const void *a, const void *b) {
	return *(int*)b - *(int*)a;
}
int gcd(int a, int b) {
	if (b != 0)return gcd(b, a % b);
	return a;
}
ll Lgcd(ll a, ll b) {
	if (b != 0) return Lgcd(b, a % b);
	return a;
}
int lcm(int a, int b) {
	return a / gcd(a, b) * b;
}
ll Llcm(ll a, ll b) {
	return a / Lgcd(a, b) * b;
}


/* main */
int main() {
	int n, a, r = MOD;
	scanf("%d", &n);
	REP(i, n) {
		int c = 0;
		for (scanf("%d", &a); a % 2 == 0; c++)a /= 2;
		r = min(r, c);
	}
	printf("%d",r);
	return 0;
}

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

int digit(int x)
{
    int y=0;
    while(x!=0){
        x/=10;
        y++;
    }
    return y;
}
int main(void)
{
    int a,n=0;
    cin >> a;
    for(int i=1;i<=a;i++)
    {
        if(digit(i)%2==1)
            n++;
    }
    cout << n;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = int_fast64_t;
using ull = uint_fast64_t;
using ld = long double;
#define rep(i, n) for (ll i = 0; i < n; ++i)
#define rep1(i, n) for (ll i = 1; i < n; ++i)
ull gcd(ull a, ull b) { return b ? gcd(b, a % b) : a; }
ull lcm(ull a, ull b) { return a / gcd(a, b) * b; }
template <typename T> void vecout(const T &v) {
  for (auto it = v.begin(); it != v.end();
       ++it, cout << (it != v.end() ? " " : "\n")) {
    cout << *it;
  }
}

void solve() {
  // main coding
  int INF=1e9;
  int n; cin>>n;
  vector<int> H(n);
  rep(i,n) cin>>H[i];
  vector<int> dp(n,INF);
  dp[0]=0;
  for(int i=0;i<n-2;++i) {
    dp[i+1]=min(dp[i]+abs(H[i+1]-H[i]),dp[i+1]);
    dp[i+2]=min(dp[i]+abs(H[i+2]-H[i]),dp[i+2]);
  }
  dp[n-1]=min(dp[n-2]+abs(H[n-1]-H[n-2]),dp[n-1]);
  cout<<dp[n-1]<<endl;
}

int main() {
  cout << fixed << setprecision(10);
  solve();
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int n, k, a[101];
bool dp[100100];

signed main() {
	cin >> n >> k;
	rep(i,n) cin >> a[i];
	rep(i,100100) rep(j,n) if (i+a[j]<=k) dp[i+a[j]] |= !dp[i];
	cout << (dp[k] ? "First" : "Second") << endl;
}

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

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

const ll INF = 1LL << 60;

int main(){
  ll k;
  cin >> k;
  ll a[100];
  FOR(i,5){
    cin >> a[i];
  }

  sort(a,a+5);

  ll x=a[0];
  ll ans=0;
  if(k%x==0){
    ans+=(k/x)+4;
  }else{
    ans+=(k/x)+5;
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
N = int(input())
a = [int(i) for i in input().split()]

color = [0] * 8
over = 0

for i in a:
    if 0 <= i <= 399:
        color[0] = 1
    elif 400 <= i <= 799:
        color[1] = 1
    elif 800 <= i <= 1199:
        color[2] = 1
    elif 1200 <= i <= 1599:
        color[3] = 1
    elif 1600 <= i <= 1999:
        color[4] = 1
    elif 2000 <= i <= 2399:
        color[5] = 1
    elif 2400 <= i <= 2799:
        color[6] = 1
    elif 2800 <= i <= 3199:
        color[7] = 1
    else:
        over += 1

mini = color.count(1)
maxi = color.count(1)

if over >= 1:
    if mini == 0:
        mini = 1

    maxi += over

print(mini, maxi)


Measured memory_bytes: 3064
import sys
def f(a,b):
  A=range(10)
  if b==1:x=1 if a in A else 0
  elif a<0 or a>b*9:x=0
  else:x=sum([f(a-e,b-1)for e in A])
  return x
for n in map(int,sys.stdin):
  print f(n,4)

Measured memory_bytes: 4212
#ifdef LOCAL
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;++i)
#define rrep(i,n) for(int i=n-1;i>=0;--i)
#define reps(i,a,b) for(int i=a;i<b;++i)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
template<typename T> inline bool chmax(T &a,T b){if(a<b){a=b;return 1;}return 0;}
template<typename T> inline bool chmin(T &a,T b){if(b<a){a=b;return 1;}return 0;}
template<typename T> vector<T> make_vec(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_vec(size_t a,Ts... ts){return vector<decltype(make_vec<T>(ts...))>(a,make_vec<T>(ts...));}
template<typename T,typename U,typename... V>
typename enable_if<is_same<T,U>::value>::type fill_v(U &u,const V... v){u=U(v...);}
template<typename T,typename U,typename... V>
typename enable_if<!is_same<T,U>::value>::type fill_v(U &u,const V... v){for(auto &e:u)fill_v<T>(e,v...);}

const int dx[] = { 1, 0, -1, 0 };
const int dy[] = { 0, 1, 0, -1 };
vector<string> grid;
vector<vector<bool>> seen;
int h, w;

void dfs(int i, int j, P &cnt) {
    seen[i][j] = true;
    char c = grid[i][j];
    if (c == '.') cnt.fi++;
    else cnt.se++;
    rep(k, 4) {
        int ni = i + dx[k], nj = j + dy[k];
        if (ni < 0 || h <= ni || nj < 0 || w <= nj) continue;
        if (seen[ni][nj]) continue;
        if (c != grid[ni][nj]) dfs(ni, nj, cnt);
    }
}

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

    cin >> h >> w;
    grid.resize(h);
    rep(i, h) cin >> grid[i];
    seen.resize(h, vector<bool>(w, false));
    ll ans = 0;
    rep(i, h) {
        rep(j, w) {
            if (!seen[i][j]) {
                P res = P(0, 0);
                dfs(i, j, res);
                ans += res.fi * res.se;
            }
        }
    }
    cout << ans << endl;
}


Measured memory_bytes: 16324
/*
  Compete against Yourself.
  Author - Aryan Choudhary (@aryanc403)
*/

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

#include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define fo(i,n)   for(i=0;i<(n);++i)
#define repA(i,j,n)   for(i=(j);i<=(n);++i)
#define repD(i,j,n)   for(i=(j);i>=(n);--i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define endl "\n"

typedef long long int lli;
typedef long double mytype;
typedef pair<lli,lli> ii;
typedef vector<ii> vii;
typedef vector<lli> vi;

clock_t time_p=clock();
void aryanc403()
{
#ifdef ARYANC403
    time_p=clock()-time_p;
    cerr<<"Time Taken : "<<(float)(time_p)/CLOCKS_PER_SEC<<"\n";
#endif
}

#ifdef ARYANC403
#include "/home/priank/codes/PastCodes/header.h"
#else
    #define dbg(args...)
#endif

const lli INF = 0xFFFFFFFFFFFFFFFL;

lli seed;
mt19937 rng(seed=chrono::steady_clock::now().time_since_epoch().count());
inline lli rnd(lli l=0,lli r=INF)
{return uniform_int_distribution<lli>(l,r)(rng);}

class CMP
{public:
bool operator()(ii a , ii b) //For min priority_queue .
{    return ! ( a.X < b.X || ( a.X==b.X && a.Y <= b.Y ));   }};

void add( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt==m.end())         m.insert({x,cnt});
    else                    jt->Y+=cnt;
}

void del( map<lli,lli> &m, lli x,lli cnt=1)
{
    auto jt=m.find(x);
    if(jt->Y<=cnt)            m.erase(jt);
    else                      jt->Y-=cnt;
}

bool cmp(const ii &a,const ii &b)
{
    return a.X<b.X||(a.X==b.X&&a.Y<b.Y);
}

const lli mod = 1000000007L;
// const lli maxN = 1000000007L;

    lli T,n,i,j,k,in,cnt,l,r,u,v,x,y;
    lli m;
    string s;
    vi a;
    //priority_queue < ii , vector < ii > , CMP > pq;// min priority_queue .

int main(void) {
    ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
    // freopen("txt.in", "r", stdin);
    // freopen("txt.out", "w", stdout);
// cout<<std::fixed<<std::setprecision(35);
// cin>>T;while(T--)
{

    cin>>n>>m;
    a.clear();
    a.resize(n+1,0);
    m*=2;

    while(m--)
    {
        cin>>in;
        a[in]^=1;
    }

    for(auto x:a)
        if(x)
        {
            cout<<"NO"<<endl;
            return 0;
        }

    cout<<"YES"<<endl;

}   aryanc403();
    return 0;
}


Measured memory_bytes: 1024
import java.util.*;


public class Main{
    public static void main(String[] args){

        Scanner sc = new Scanner(System.in);

        int a = sc.nextInt();
        String b = sc.next();
        String c = sc.next();

        for(int i=0;i<a;i++){
            System.out.print(b.substring(i,i+1)+c.substring(i,i+1));
        }

    }
}

Measured memory_bytes: 21204
#include<bits/stdc++.h>
#define FOR(i,a,b) for(int i = (a);i<=(b);i++)
#define ROF(i,a,b) for(int i = (a);i>=(b);i--)
#define MST(a,x) memset(a,x,sizeof(a))
#define ll long long
#define PB push_back
#define PH push
#define MP make_pair
#define FT first
#define SD second
#define N 2005
#define M 1000005
#define INF 1000000007
#define MOD1 1000000007
#define MOD2 1000000009
#define eps 1e-7
using namespace std;
vector<int>e[N];
pair<int,int>ep[N];
int d[N];
int num = 0;
void dfs(int u,int fa,int k)
{
    if(fa!=0)d[u] = d[fa]+1;
    if(d[u]>k)num++;
    for(auto v:e[u])
    {
        if(v == fa||d[v]!=-1)continue;
        dfs(v,u,k);
    }
}
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n,k;
    while(cin>>n>>k)
    {
        int x,y;
        FOR(i,1,n-1)
        {
            cin>>x>>y;
            e[x].PB(y);
            e[y].PB(x);
            ep[i] = MP(x,y);
        }
        int ans = INF;
        if(k%2 == 0)
        {
            FOR(i,1,n)
            {
                MST(d,-1);
                num = d[i] = 0;
                dfs(i,0,k/2);
                ans = min(ans,num);
            }
        }
        else
        {
            FOR(i,1,n-1)
            {
                MST(d,-1);
                int x = ep[i].FT,y = ep[i].SD;
                num = d[x] = d[y] = 0;
                dfs(x,0,(k-1)/2);
                dfs(y,0,(k-1)/2);
                ans = min(ans,num);
            }
        }
        cout<<ans<<endl;
    }
    return 0;
}



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

int main() {
    int n, m; cin >> n >> m;
    int WA[n + 1] = {0}, AC[n + 1] = {0};
    for (int i = 0; i < m; i++) {
        int p; string s;
        cin >> p >> s;
        if (s == "AC") AC[p-1] = 1;
        if (AC[p-1] == 0 && s == "WA") WA[p-1]++;
    }
    int sumac = 0, sumwa = 0; 
    for (int i = 0; i < n; i++) {
        if (AC[i] == 1) sumwa += WA[i];
        sumac += AC[i];
    }
    cout << sumac << " " << sumwa << endl; 
}

Measured memory_bytes: 1024
from heapq import heappush, heappop
N, M = map(int, input().split())
s = input()
q = [(0,N)]
INF = 10**9
dic = {}
for i in range(N-1, -1, -1):
  cnt, j = q[0]
  while j-i>M:
    heappop(q)
    cnt, j = q[0]
  heappush(q, (cnt,j))
  cnt += 1 if s[i]!='1' else INF
  heappush(q, (cnt,i))
  dic[i] = j

if cnt>=INF:
  print(-1)
else:
  x = 0
  while x!=N:
    y = dic[x]
    print(y-x)
    x = y

Measured memory_bytes: 29556
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <complex>
#include <cassert>
#include <exception>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<ll,ll> P;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<P> vp;
#define rep(i,a,n) for(ll i = (a);i < (n);i++)
#define per(i,a,n) for(ll i = (a);i > (n);i--)
#define lep(i,a,n) for(ll i = (a);i <= (n);i++)
#define pel(i,a,n) for(ll i = (a);i >= (n);i--)
#define clr(a,b) memset((a),(b),sizeof(a))
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define sz size()
#define endl "\n"
#define print(X) cout << (X) << "\n"
// #define input(X) getline(cin,X)
static const int INF = 1e+9+7;
static const ll INFL = 1e+18+7;
ll n,m,l;
string s,t;
ll d[200010],dp[300][300];
char field[200][200];

int main(){
  ll ans = 0;
  cin >> n;
  rep(i,0,n)cin >> d[i];
  rep(i,0,n){
    while(d[i]%2 == 0 && d[i] > 0){
      ans++;
      d[i]/=2;
    }
  }
  print(ans);
  return 0;
}

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

int main(){
	long long H;
	cin >> H;
	long long num = 1;
	long long ans = 0;
	while(H > 0){
		H /= 2;
		ans += num;
		num *= 2;
	}
	cout << ans << endl;
}


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

using namespace std;

typedef long long ll;

int main(){
	int n;
	cin >> n;
	std::vector<int> p(n);
	for (int i = 0; i < n; i++)
	{
		cin >> p[i];
	}
	int count=0;


	for (int i = 1; i < n-1; i++)
	{
		int minp = min(min(p[i-1],p[i]),p[i+1]);
		int maxp = max(max(p[i-1],p[i]),p[i+1]);
		if (minp < p[i] && p[i] < maxp )
		{
			count += 1;
		}
	}
	cout << count << endl;

	return 0;
}

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

 using namespace std;

 int main(){
 	int A[3];

 	cin >> A[0] >> A[1] >>A[2];

 	sort(A,A+3);

 	cout << A[0] << " " << A[1] << " " << A[2] << endl;
 	
 }

Measured memory_bytes: 1180
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vs = vector<string>;
using msi = map<string, int>;
using mii = map<int, int>;
using psi = pair<string, int>;
using pii = pair<int, int>;
using vlai = valarray<int>;
#define rep(i,n) for(int i=0;i<n;i++)
#define range(i,s,n) for(int i=s;i<n;i++)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define fs first
#define sc second
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define INF (ll)1E9
#define EPS 1E-9
#define MOD 1000000007
#define PI 3.1415926535897932384

template <class T>ostream &operator<<(std::ostream &o, const vector<T> &v)
{
	rep(i, v.size()) {
		o << (i > 0 ? " " : "") << v[i];
	}
	return o;
}

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

int main() {
	int n, l,  ans=0;
	cin >> n >> l;
	vi v(n),ansv;
	rep(i, n) {
		cin >> v[i];
	}
	bool sw = false;
	rep(i, n - 1) {
		if (v[i] + v[i + 1] >= l) {
			sw = true;
			ans = i+1;
			break;
		}
	}
	if (!sw) {
		cout << "Impossible" << endl;
		return 0;
	}
	for (int i = n-1; i > ans; i--) {
		ansv.push_back(i);
	}
	for (int i = 1; i < ans; i++) {
		ansv.push_back(i);
	}
	ansv.push_back(ans);
	printf("Possible\n");
	rep(i, n-1) {
		printf("%d\n",ansv[i]);
	}


}



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

int  main(){
    //freopen("inp.txt","r",stdin);
    ll n,h,w,res=0;
    cin>>n>>h>>w;
    for (int i=0;i<n;i++){
        ll hh,ww;
        cin>>hh>>ww;
        if (hh>=h && ww>=w) res++;
    }
    cout<<res;
}


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <deque>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>

using namespace std;

typedef long long ll;

#define MOD 1000000007

int main() {
  int l;
  cin >> l;
  double a = (1.0 * l) / 3.0;
  printf("%.10f\n", a * a * a);
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main() {
	int k, s;
	cin >> k >> s;
	int count = 0;
	for (int i = 0; i <= k; i++) {
		for (int j = 0; j <= k; j++) {
			int a = 0;
			a = s - i - j;
			if (0 <= a && a <= k) {
				count++;
			}
		}

	}
	cout << count << endl;	 
	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <deque>
#include <stack>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <numeric>
#include <functional>
#include <cctype>
#include <list>
#include <limits>
#include <cassert>
#include <random>
#include <time.h>
#include <unordered_set>
// #include <boost/multiprecision/cpp_int.hpp>



using namespace std;
using Int = long long;
// using namespace boost::multiprecision;

const double EPS = 1e-10;
long long const MOD = 1000000007;

typedef vector<int> vec;
typedef vector<vec> mat;

long long mod_pow(long long x, long long n) {
    long long res = 1;
    for (int i = 0;i < 60; i++) {
        if (n >> i & 1) res = res * x % MOD;
        x = x * x % MOD;
    }
    return res;
}

long long my_mod_pow(long long x, long long n) {
	long long ret = 1;
	for (; n > 0; n >>= 1, x = x * x % MOD) {
		if (n & 1) {
			ret = ret * x % MOD;
		}
	}
	return ret;
}

template<typename T>
T gcd(T a, T b) {
    return b != 0 ? gcd(b, a % b) : a;
}

template<typename T>
T lcm(T a, T b) {
    return a * b / gcd(a, b);
}

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

map<long long, long long> dp;

long long rec(long long H) {
    if (H == 1) return 1;
    if (dp[H] != 0) return dp[H];

    long long next_H = H/2;
    dp[H] = rec(next_H) * 2 + 1;
    return dp[H];
}

int main(void) {
    long long H; cin >> H;
    cout << rec(H) << endl;
}

Measured memory_bytes: 888
import java.util.*;

class Main {
    final Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        new Main().run();
    }

    private void run() {
        int n = sc.nextInt();

        int min = Integer.MAX_VALUE;
        int ans = 0;
        for (int i = 0; i < n; i++) {
            int p = sc.nextInt();
            if (min > p) ans++;
            min = Math.min(p, min);
        }
        System.out.println(ans);
    }
}


Measured memory_bytes: 62832
#include<bits/stdc++.h>
using namespace std;
int n,val[100009],ans,mask,cnt[16],good[1<<16],dp[1<<16];
int main() {
	scanf("%d",&n);
	for(int i=0;i<n-1;i++) {
		int a,b,c;
		scanf("%d%d%d",&a,&b,&c);
		val[a]^=c;
		val[b]^=c;
	}
	for(int i=0;i<n;i++) cnt[val[i]]++;
	for(int i=1;i<16;i++) {
		ans+=cnt[i]>>1;
		if(cnt[i]&1) mask|=1<<i;
	}
	for(int i=1;i<1<<16;i++) {
		int j=0;
		for(int k=0;k<16;k++)
			if(1<<k&i)
				j^=k;
		good[i]=j==0;
	}
	for(int i=2;i<1<<16;i+=2)
		for(int j=i;j;j=(j-1)&i)
			if(good[j])
				dp[i]=max(dp[i],dp[i^j]+1);
	printf("%d\n",ans+__builtin_popcount(mask)-dp[mask]);
	return 0;
}

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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
typedef long long ll;

const int INF = 1001001001;

int N, M, R;
int d[201][201];
int r[9];
int A, B, C;
int res;
bool used[9];

void dfs(int c, int las, int dist) {
    if (c == R + 1) {
        if (res > dist) res = dist;
        return;
    }
    for (int i = 1; i <= R; i++) {
        if (!used[i]) {
            used[i] = true;
            if (las == -1) dfs(c + 1, i, 0);
            else dfs(c + 1, i, dist + d[r[las]][r[i]]);
            used[i] = false;
        }
    }
}

int main() {
    cin >> N >> M >> R;
    for (int i = 1; i <= N; i++) for (int j = 1; j <= N; j++) if (i != j) d[i][j] = INF;
    for (int i = 1; i <= R; i++) cin >> r[i];
    for (int i = 1; i <= M; i++) {
        cin >> A >> B >> C;
        if (d[A][B] > C) d[A][B] = d[B][A] = C;
    }
    for (int k = 1; k <= N; k++)
        for (int i = 1; i <= N; i++)
            for (int j = 1; j <= N; j++)
                if (d[i][j] > d[i][k] + d[k][j])
                    d[i][j] = d[i][k] + d[k][j];

    res = INF;
    dfs(1, -1, 0);
    cout << res << endl;
}

Measured memory_bytes: 384
from collections import defaultdict
printn = lambda x: print(x,end='')
inn = lambda : int(input())
inl   = lambda: list(map(int, input().split()))
inm   = lambda:      map(int, input().split())
ins = lambda : input().strip()
DBG = True  and False
BIG = 10**18
R = 10**9 + 7

def ddprint(x):
  if DBG:
    print(x)

def rev(a,b):
    if b<0:
        return (-b,a)
    else:
        return (b,-a)

import math
n = inn()
ab = []
h = defaultdict(int)
badpairs = {}
ab0 = a0 = b0 = 0
for i in range(n):
    a,b = inm()
    if a==b==0:
        ab0 += 1
    elif a==0:
        a0 += 1
    elif b==0:
        b0 += 1
    else:
        g = math.gcd(a,b)
        a //= g
        b //= g
        if a<0:
            a = -a
            b = -b
        h[(a,b)] += 1
        ra,rb = rev(a,b)
        if (ra,rb) in h:
            badpairs[(a,b)] = badpairs[(ra,rb)] = 1
ddprint(h)
ddprint(badpairs)
#ddprint(f"a0 {a0} b0 {b0} ab0 {ab0}")
grps = []
g0 = 0
if a0>0 and b0>0:
    grps.append(pow(2,a0,R)+pow(2,b0,R)-1)
else:
    g0 += a0 + b0
ddprint(g0)
ddprint(grps)
done = {}
for a,b in h:
    if (a,b) in badpairs:
        if (a,b) not in done:
            ra,rb = rev(a,b)
            grps.append(pow(2,h[(a,b)],R)+pow(2,h[(ra,rb)],R)-1)
            done[(a,b)] = done[(ra,rb)] = 1
    else:
        g0 = (g0 + h[(a,b)]) % R
ddprint(g0)
prod = pow(2,g0,R)
for x in grps:
    prod = (prod * x)%R
print((ab0+prod-1)%R)


Measured memory_bytes: 122344
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Joy
 */

#include <bits/stdc++.h>
#define REP(i, N) for (int i = 0; i < (N); ++i)
#define ALL(x) (x).begin(), (x).end()
#define MOD 1000000007
#define PB push_back
#define MP make_pair
using namespace std;
typedef long long ll;
ll gcd(ll x, ll y) { return y ? gcd(y, x % y) : x; }

class DEvenRelation {
public:
	void solve(std::istream& in, std::ostream& out) {
        int N;
        in >> N;
        vector<vector<int>> to(N), cost(N);
        REP(i, N - 1) {
            int a, b, w;
            in >> a >> b >> w;
            a--;
            b--;
            to[a].PB(b); cost[a].PB(w);
            to[b].PB(a); cost[b].PB(w);
        }
        vector<int> ans(N, -1);
        queue<int> q;
        ans[0] = 0;
        q.push(0);
        while (!q.empty()) {
            int v = q.front();
            q.pop();
            REP(i, to[v].size()) {
                int u = to[v][i];
                int w = cost[v][i];
                if (ans[u] != -1) continue;
                ans[u] = (ans[v] + w) % 2;
                q.push(u);
            }
        }
        REP(i, N) {
            out << ans[i] << '\n';
        }
	}
};


int main() {
	DEvenRelation solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 11904
import qualified Data.Map as MP
import Data.Maybe

solve :: MP.Map Char Int -> String
solve mp
  | (x && y && z) = "YES"
  | otherwise = "NO"
  where
    a = fromJust $ MP.lookup 'a' mp
    b = fromJust $ MP.lookup 'b' mp
    c = fromJust $ MP.lookup 'c' mp
    x = (abs $ a - b) <= 1 
    y = (abs $ b - c) <= 1
    z = (abs $ c - a) <= 1

main = do
  s <- getLine
  let mp = foldl (\mp c -> MP.insert c 0 mp) MP.empty "abc"
  let mp' = foldl (\mp c -> MP.adjust (+1) c mp) mp s
  putStrLn $ solve mp'
  


Measured memory_bytes: 7932
#include <cstdint>
#include <stdexcept>
#include <utility>
#include <vector>

using namespace std;

vector<uint32_t> gn;

static uint64_t cnt;

static void insersion_sort(int32_t array[], size_t size, uint32_t interval)
{
  for (int32_t i = interval; i < size; i++) {
    int32_t val = array[i];
    int j = i - interval;
    while ((j >= 0) && array[j] > val) {
      array[j + interval] = array[j];
      j -= interval;
      cnt++;
    }
    array[j + interval] = val;
    // for (int32_t j = ((size - 1 - i) / interval) * interval + i; j >= i + interval; j -= interval) {
    //   if (array[j - interval] > array[j]) {
    //     uint32_t val = array[j - interval];
    //     array[j - interval] = array[j];
    //     array[j] = val;
    //     cnt++;
    //   }
    // }
  }
}

void shell_sort(int32_t array[], size_t size, void (*callback)(int32_t array[], uint32_t index, uint32_t index2))
{
  if ((array == nullptr) || (size == 0)) throw runtime_error("arguments error");

  gn.push_back(1);
  for (uint32_t i = 4; i < size; i = 3 * i + 1) {
    gn.push_back(i);
  }

  for (int32_t i = gn.size() - 1; i >= 0; i--) {
    insersion_sort(array, size, gn[i]);
  }
}

#if !defined(TEST)
#include <cstdio>

#define MAX_ARRAY_SIZE 1000000
static int32_t array[MAX_ARRAY_SIZE];

int32_t main(void)
{
  int32_t num;
  scanf("%d", &num);

  for (int32_t i = 0; i < num; i++) {
    scanf("%d", &array[i]);
  }

  shell_sort(array, num, nullptr);

  printf("%lu\n", gn.size());

  for (int32_t i = gn.size() - 1; i >= 0; i--) {
    printf("%d", gn[i]);
    if (i) printf(" ");
  }
  printf("\n");

  printf("%lu\n", cnt);

  for (int32_t i = 0; i < num; i++) {
    printf("%d\n", array[i]);
  }

  return 0;
}
#endif

Measured memory_bytes: 6652
#include <stdio.h>
#include <math.h>
 
using namespace std;
 
int main(){
    int n;
    double students[1000] = {0},sum,m,div;
 
    while(true){
        scanf("%d",&n);
        if(n == 0) break;
        div = sum = 0;
        for(int i = 0; i < n; i++){
            scanf("%lf",&students[i]);
            sum += students[i];
        }
        m = sum/n;
        for(int i = 0; i < n;i++){
            div += (students[i] - m)*(students[i] - m);
            students[i] = 0;
        }
        printf("%.8lf\n",sqrt(div/n));
    }
}


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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	string s, t;
	int q;
	cin >> s >> q;
	while (q--) 
	{
		int type;
		cin >> type;
		if (type == 1) swap(s,t);
		else 
		{
			int f; char c;
			cin >> f >> c;
			if (f == 1) t.push_back(c);
			else s.push_back(c);
		}
	}
	reverse(t.begin(), t.end());
	cout << t + s;
    return 0;
}

Measured memory_bytes: 1328
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
l=[list(map(int,input().split())) for i in range(k)]
mod=998244353
dp=[0]*n
dp[0]=1
dp2=[0,1]

for i in range(1,n):
  for j in range(k):
    dp[i]+=(dp2[max(i-l[j][0]+1,0)]-dp2[max(i-l[j][1],0)])%mod
  dp2.append((dp2[-1]+dp[i])%mod)
print(dp[-1]%mod)

Measured memory_bytes: 88540
import java.io.BufferedReader;
import java.io.*;
import java.util.*;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Collections;

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

        String s = sc.next();
        String t = sc.next();
        char[] work = new char[s.length()];
        char[] work2 = new char[t.length()];
        int count = 0;

        for(int i = 0; i < s.length(); i++){
                work[i] = s.charAt(i);
            }

        for(int i = 0; i < t.length(); i++){
                work2[i] = t.charAt(i);
        }

        for(int i = 0; i < 3; i++){
            if(work[i] == work2[i]){
                count++;
            }
        }
        System.out.println(count);

        

            
                


    }
}

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

int64_t ans;
 
void solve (int64_t s, int64_t h, int64_t w) {
    ans = min(ans, max(s, ((h + 1) / 2) * w) - min(s, (h / 2) * w));
    ans = min(ans, max(s, h * ((w + 1) / 2)) - min(s, h * (w / 2)));
}
 
signed main() { 
  int64_t h, w;
  cin >> h >> w;
  ans = h * w;
  solve((h / 3) * w, h - h / 3, w);
  solve(((h + 2) / 3) * w, h - (h + 2) / 3, w);
  solve(h * (w / 3), h, w - w / 3);
  solve(h * ((w + 2) / 3), h, w - (w + 2) / 3);
  cout << ans << '\n';
}


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

int main(void){
    string a,b;
    cin>>a>>b;
    if(a.size() > b.size()){
        cout<<"GREATER"<<endl;
    }else if(a.size() < b.size()){
        cout<<"LESS"<<endl;
    }else{
        if(a>b) cout<<"GREATER"<<endl;
        else if(a<b) cout<<"LESS"<<endl;
        else cout<<"EQUAL"<<endl;
    }
}


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

int n, m;
vector<int> g[100000];
int color[100000];

void dfs(int v, int id)
{
  if (color[v] != -1) return;
  color[v] = id;
  for (int i = 0; i < g[v].size(); i++) {
    dfs(g[v][i], id);
  }
}

signed main()
{
  int tmp1, tmp2;
  int q, s, t;

  cin >> n >> m;
  for (int i = 0; i < m; i++) {
    cin >> tmp1 >> tmp2;
    g[tmp1].push_back(tmp2);
    g[tmp2].push_back(tmp1);
  }

  fill(color, color + 100000, -1);

  int id = 1;
  for (int u = 0; u < n; u++) {
    dfs(u, id++);
  }

  cin >> q;
  for (int i = 0; i < q; i++) {
    cin >> s >> t;
    if (color[s] == color[t]) {
      cout << "yes" << endl;
    }
    else {
      cout << "no" << endl;
    }
  }

  return (0);
}

Measured memory_bytes: 12104
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
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; }
inline void init() { cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }

struct edge {
    int from, to; ll cost;
    edge(int s, int t, ll w = 0) : from(s), to(t), cost(w) {}
};
int main() {
    init();

    int n;
    cin >> n;
    vector<VI> a(n, VI(n)), wh(n, VI(n, -1));
    FOR(i, 0, n)FOR(j, 0, n - 1) {
        cin >> a[i][j];
        wh[i][--a[i][j]] = j;
    }

    int v = n * (n - 1) / 2;
    vector<vector<edge>> g(v);

    vector<VI> id(n, VI(n));
    int o = 0;
    FOR(i, 0, n)FOR(j, i + 1, n)id[i][j] = o++;

    FOR(i, 0, n)FOR(j, 0, n - 2) {
        int x = i, y = a[i][j], X = i, Y = a[i][j + 1];
        if (x > y)swap(x, y);
        if (X > Y)swap(X, Y);
        g[id[x][y]].emplace_back(id[x][y], id[X][Y]);
    }
    
    VI ans, len(v, 0), in(v, 0);
    for (auto es : g)for (edge e : es)in[e.to]++;
    queue<int> que;
    FOR(i, 0, v)if (in[i] == 0) {
        que.push(i);
        len[i] = 1;
    }

    while (!que.empty()) {
        int now = que.front(); que.pop();
        ans.push_back(now);
        for (edge next : g[now]) {
            if (--in[next.to] == 0) {
                que.push(next.to);
                chmax(len[next.to], len[now] + 1);
            }
        }
    }

    if (v == ans.size()) {
        int mlen = 0;
        for (int i : len)chmax(mlen, i);
        cout << mlen << "\n";
    }
    else cout << "-1\n";
}


Measured memory_bytes: 55040
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleTest
{
    static partial class Program
    {
  

        static void Main(string[] args)
        {
            var r = Int();
            Console.WriteLine(2*r * Math.PI);


        }

    }
    static partial class Program
    {
        public static int Int()
        {
            return int.Parse(Console.ReadLine());
        }
        public static int[] Ints()
        {
            return Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
        }
        public static long[] Longs()
        {
            return Console.ReadLine().Split(' ').Select(s => long.Parse(s)).ToArray();
        }
        public static int[][] MultiInts(int num)
        {
            var result = new int[num][];
            for(int i = 0; i < num; ++i)
            {
                result[i] = Ints();
            }
            return result;
        }
        public static T[] MultiItems<T>(int num, Func<string,T> parser)
        {
            var result = new T[num];
            for(int i =0; i < num; ++i)
            {
                result[i] = parser(Console.ReadLine());
            }
            return result;
        }
    }
}


Measured memory_bytes: 27576
const input = require('fs').readFileSync('/dev/stdin', 'utf8');

const list = input.split(' ');

const a = Number(list[0]);

const b = Number(list[1]);

const output = () => {
  if (a === 2 || b === 2) {
    console.log('No');
  } else {
    console.log('Yes');
  };
};

output();


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

typedef long long ll;

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

	int N;
	cin >> N;

	int max = 0;
	int count = 0;

	for(int i = 0; i < N; i++) {
		int p;
		cin >> p;
		count += p;
		if(p > max) max = p;
	}

	count -= max / 2;

	cout << count << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define fi first
#define se second
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int,int>P;
const double eps = 1e-8;
const int NINF = 0xc0c0c0c0;
const int INF  = 0x3f3f3f3f;
const ll  mod  = 1e9 + 7;
const ll  N = 1e6 + 5;

ll mx1=-1e18,mx2=-1e18,mx3=-1e18,mx4=-1e18,mi1=1e18,mi2=1e18,mi3=1e18,mi4=1e18;
int n;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++){
        ll x,y;cin>>x>>y;
        ll u=x+y,v=x-y,p=-x+y,q=-x-y;
        mx1=max(mx1,u);
        mi1=min(mi1,u);
        mx2=max(mx2,v);
        mi2=min(mi2,v);
        mx3=max(mx3,p);
        mi3=min(mi3,p);
        mx4=max(mx4,q);
        mi4=min(mi4,q);
    }
    cout<<max({mx1-mi1,mx2-mi2,mx3-mi3,mx4-mi4})<<'\n';
    return 0;
}

Measured memory_bytes: 3648
h, w = map(int, input().split())

s = []

s.append('.' * (w + 2))

for i in range(h):
  s.append('.' + input() + '.')
  
s.append('.' * (w + 2))
  
sol = 0
for i in range(1, h + 1):
  for j in range(1, w + 1):
    
    if s[i][j] == '#':
      if not '#' in [s[i-1][j], s[i+1][j], s[i][j-1], s[i][j+1]]:
        sol += 1
if sol > 0:
  print('No')
else:
  print('Yes')

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

typedef long long int LL;
#define REP(n) for(LL i = 0; i < (n); i++)
#define COUT(val) cout << (val) << endl
#define CIN(val) cin >> (val)
#define SORT(vec) sort(vec.begin(), vec.end())
#define SORT_GRE(vec) sort(vec.begin(), vec.end(), greater<LL>())

int main(){
    int a, b;
    cin >> a >> b;
    if(a <= 8 && b <= 8){
        cout << "Yay!" << endl;
    } else {
        cout << ":(" << endl;
    }
    return 0;
}


Measured memory_bytes: 256
# 2020/07/23
# AtCoder Beginner Contest 126 - C
import math

# Input
n, k = map(int,input().split())

ans = 0

# Calc
for i in range(1, n+1):
    idx = 1
    wval = i
    while(wval < k):
        wval = wval * 2
        idx = idx + 1
    
    ans = ans + (1/n) * (1/2) ** idx

# Output
print(ans*2)


Measured memory_bytes: 9204
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();
		int c = sc.nextInt();
		int d = sc.nextInt();

		System.out.println(Math.min(((n - 1) / a + 1) * b, ((n - 1) / c + 1) * d));
	}

}



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

#define FOR(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define RFOR(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define LL long long
#define INF INT_MAX

const double EPS = 1e-14;
const double PI  = acos(-1.0);


int main(){
  int n, m, x;
  cin >> n >> m >> x;

  vector<int> v(m);
  REP (i, m) {
    cin >> v[i];
  }

  int u = distance(v.begin(), lower_bound(v.begin(), v.end(), x));

  cout << min(u, m - u) << endl;
}


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

    string s; cin >> s;

    if(s[0]==s[1]&&s[1]!=s[2]&&s[2]==s[3]){
        cout << "Yes" << endl;
        return 0;
    }

    if(s[0]==s[2]&&s[1]!=s[2]&&s[1]==s[3]){
        cout << "Yes" << endl;
        return 0;
    }
    
    if(s[0]==s[3]&&s[1]!=s[3]&&s[1]==s[2]){
        cout << "Yes" << endl;
        return 0;
    }
    cout << "No" << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	string s;
	int r;
	cin>>s;
	for(int i=0;i<s.size();i++){
		if(s[i]=='C'){
			for(int j=i+1;j<s.size();j++){
				if(s[j]=='F'){
					cout<<"Yes";
					return 0;
				}
			}
		}
	}
	cout<<"No";
	return 0;
}


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

#if __has_include("print.hpp")
  #include "print.hpp"
#endif

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define ALL(x) (x).begin(), (x).end()
#define RALL(x) (x).rbegin(), (x).rend()
#define MOD 1000000007

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


int main(){
  ios::sync_with_stdio(false);
  cin.tie(0);
  ll n, m;
  cin >> n >> m;
  vector<p> v(m);
  ll l = -1, r = INT_MAX;
  rep(i, m){
    cin >> v[i].first >> v[i].second;
    l = max(l, v[i].first);
    r = min(r, v[i].second);
  }
  cout << max(0ll, min(r, n) - l + 1) << endl;
}


Measured memory_bytes: 1792
import Data.List
import qualified Data.Map as M

main = do
  [n,k] <- map read.words <$> getLine :: IO [Int]
  as    <- map read.words <$> getLine :: IO [Int]
  let ds = M.fromList $ zip [1..] $ map ((k+1)-) as
  putStr $ solve n k ds [] 0

solve :: Int -> Int -> M.Map Int Int -> [Int] -> Int -> String
solve n k ds acc step
  | step == k && able = show (n+k*(n-1)) ++ "\n" ++ unwords ( map show (ans n k acc 0) )
  | step == k && not able = "-1"
  | otherwise = solve n k (M.insert mk (mv-1) ds) (mk:acc) (step+1)
  where
  able = M.null $ M.filter (>0) ds
  p = if null acc then 0 else head acc
  (mk,mv) = M.foldlWithKey (\(mk,mv) k v -> if v > mv && k /= p then (k,v) else (mk,mv) ) (0,-100) ds
  ans n k (a:as) 0 = [ i | i <- [1..n], i /= a ] ++ a : ans n k (a:as) 1
  ans n k [a] _    = [ i | i <- [1..n], i /= a ]
  ans n k (a:b:as) step = [ i | i <- [1..n], i /= a, i /= b ] ++ b : ans n k (b:as) (step+1)


Measured memory_bytes: 1020
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int,int> pi;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define rep(i,a,b) for(int i=a;i<=b;i++)

const int INF = INT_MAX;

int main(){

	ios::sync_with_stdio(0);
	cin.tie(0);


	int n,k;cin>>n>>k;
	vi v;
	rep(i,1,n){
		int a;cin >> a;
		v.pb(a);
	}
	vi dp(n,INF);
	dp[0] = 0;
	for(int i=1;i<n;i++){
		for(int j=i-1;j>=i-k;j--){
			if(j>=0) dp[i] = min(dp[i],dp[j]+abs(v[i]-v[j]));
		}
		//dp[i] = min(dp[i-1]+abs(v[i]-v[i-1]),dp[i-2]+abs(v[i]-v[i-2]));
	}
	cout << dp[n-1];
	return 0;
}



Measured memory_bytes: 1144
# -*- coding: utf-8 -*-

import sys

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

def divisor_set(N: int) -> set:
    """ 約数の列挙・個数 """
    from math import sqrt

    # 1とその数はデフォで入れとく
    s = {1, N}
    # 終点はルート切り捨て
    for i in range(2, int(sqrt(N))+1):
        # 割り切れるなら、iとN/iを追加
        if N % i == 0:
            s.add(i)
            s.add(N // i)
    return s

def is_prime(num):
    """ 素数判定 """
    from math import sqrt

    if num < 2: 
        return False
    if num in [2, 3, 5]: 
        return True
    if num % 2 == 0 or num % 3 == 0 or num % 5 == 0:
        return False
    # 疑似素数(2でも3でも割り切れない数字)で次々に割っていく
    prime = 7
    step = 4
    num_sqrt = sqrt(num)
    while prime <= num_sqrt:
        if num % prime == 0:
            return False
        prime += step
        step = 6 - step
    return True

A, B = MAP()

adivs = divisor_set(A)
bdivs = divisor_set(B)
divs = adivs & bdivs

ans = 1
for div in divs:
    if is_prime(div):
        ans += 1

print(ans)


Measured memory_bytes: 5168
#include<bits/stdc++.h>
#include<string.h>
using namespace std;
int main(){
	string s;
	getline(cin,s);
	if(s.length()==19){
		for(int i=0;i<19;i++){
			if((i!=5) && (i!=13))
			if(s[i]<'a')
				return 0;
			if((i==5)||(i==13))
				s[i]=' ';
		}
	}
	printf("%19s\n",s.c_str());
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll N=55;
ll level,n,h[N],p[N];
inline ll solve(ll x,ll y)
{
	if(x==0)return 1;
	if(y==1)return 0;
	if(y>1&&y<=h[x-1]+1)//在第一层 
		return solve(x-1,y-1);//去掉第二层加上下面的 
	if(y==h[x-1]+2)return p[x-1]+1;//在中间 
	if(y>h[x-1]+2&&y<3+2*h[x-1])//在第二层 
		return p[x-1]+1+solve(x-1,y-2-h[x-1]);//去掉第一层+中间的+下面的 
	return p[x-1]*2+1;//最后正好 
}
int main()
{
	cin>>level;
	cin>>n;
	h[0]=1;
	p[0]=1;
	for(ll i=1;i<=level;i++)
	{
		h[i]=3+h[i-1]*2;
		p[i]=1+p[i-1]*2;
	}
	cout<<solve(level,n)<<endl;
	return 0;
}

Measured memory_bytes: 256
a,b = gets.chomp.split(" ").map(&:to_i)

x1 = a * 100 / 8.to_f
x2 = b * 100 / 10.to_f

if x1 > x2 then
  (1..x1.to_i * 100).each do |x|
    if (x * 0.08).to_i == a && (x * 0.1).to_i == b then
      puts x
      exit
    end
  end
else
  (1..x2.to_i * 100).each do |x|
    if (x * 0.08).to_i == a && (x * 0.1).to_i == b then
      puts x
      exit
    end
  end
end
puts -1




Measured memory_bytes: 1788
// AtCoder :: A - Disjoint Set Union
// https://atcoder.jp/contests/practice2/tasks/practice2_a

#include <bits/stdc++.h>
#include <atcoder/dsu>

using namespace std;
using namespace atcoder;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int N, Q;
    cin >> N >> Q;
    dsu D(N);
    for (int i{0}; i < Q; ++i) {
        int t, u, v;
        cin >> t >> u >> v;
        if (t == 0) {
            D.merge(u, v);
        } else {
            if (D.same(u, v)) {
                cout << "1\n";
            } else {
                cout << "0\n";
            }
        }
    }

    return EXIT_SUCCESS;
}


Measured memory_bytes: 3876
#include  <iostream>
#include  <stdio.h>
#include <algorithm>
#include <map>
#include <math.h>

using namespace std;
#include <vector>
#define rep(i,n) for (ll i = 0; i < (n) ; i++)
#define INF 1e9
#define llINF 1e18
#define base10_4 10000      //1e4
#define base10_5 100000     //1e5
#define base10_6 1000000    //1e6
#define base10_7 10000000   //1e7
#define base10_8 100000000  //1e8
#define base10_9 1000000000 //1e9

#define MOD 1000000007
#define pb push_back
#define ll long long
#define ull unsigned long long
#define vint vector<int>
#define vll vector<ll>

//#include <stack>
//#include <queue>

string ans_Yes = "Yes"; 
string ans_No = "No"; 
string ans_yes = "yes"; 
string ans_no = "no"; 

ll A;
ll B;
ll C;
ll N;
ll M;
ll K;

ll ltmp;
string stmp;
double dtmp;

int main(){

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    char X;
    cin >> X;

    char Y = X+1;
    cout <<  Y << endl;


    

}

Measured memory_bytes: 3616