akhauriyash/Code-Regression huggingface dataset:
#define y1 askjdkasldjlkasd
#include <bits/stdc++.h>
#undef y1

using namespace std;

#define pb push_back
#define mp make_pair
#define fi(a, b) for(int i=a; i<=b; i++)
#define fj(a, b) for(int j=a; j<=b; j++)
#define fo(a, b) for(int o=a; o<=b; o++)
#define fdi(a, b) for(int i=a; i>=b; i--)
#define fdj(a, b) for(int j=a; j>=b; j--)
#define fdo(a, b) for(int o=a; o>=b; o--)
#define sz(x) (int)x.size()

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
typedef pair<ll, ll> pll;
typedef vector<pll> vpll;
typedef vector<ll> vll;

#ifdef LOCAL
#define err(...) fprintf(stderr, __VA_ARGS__)
#else
#define err(...) while (0)
#endif

double START_TIME;

void exit() {
#ifdef LOCAL	
	cerr << "TIME: " << setprecision(5) << fixed << (clock() - START_TIME) / CLOCKS_PER_SEC << endl;
#endif	
	exit(0);
}

template<typename A, typename B>
ostream& operator<<(ostream& os, pair<A, B> p) {
	os << "(" << p.first << ", " << p.second << ")";
	return os;
}

template<typename T>
ostream& operator<<(ostream& os, vector<T> v) {
	fi(0, sz(v) - 1) {
		os << v[i] << " ";
	}
	return os;
}

template<typename T>
ostream& operator<<(ostream& os, set<T> t) {
	for (auto z : t) {
		os << z << " ";
	}
	return os;
}

template<typename T1, typename T2>
ostream& operator<<(ostream& os, map<T1, T2> t) {
	cerr << endl;
	for (auto z : t) {
		os << "\t" << z.first << " -> " << z.second << endl;
	}
	return os;
}

#ifdef LOCAL
#define dbg(x) {cerr << __LINE__ << "\t" << #x << ": " << x << endl;}
#define dbg0(x, n) {cerr << __LINE__ << "\t" << #x << ": "; for (int ABC = 0; ABC < n; ABC++) cerr << x[ABC] << ' '; cerr << endl;}
#else
#define dbg(x) while(0){}
#define dbg0(x, n) while(0){}
#endif

#ifdef LOCAL
#define ass(x) if (!(x)) { cerr << __LINE__ << "\tassertion failed: " << #x << endl, abort(); }
#else
#define ass(x) assert(x)
#endif

///////////////////////////////////////////////////

const ll INF = 2e18;

ll mul(ll a, ll b) {
	if (a == 0 || b == 0) return 0;
	if (INF / a <= b) return INF;
	return a * b;
}

ll s;

ll getmaxdivisor(ll x) {
	ll res = x;
	for (ll i = 2; i * i <= x; i++) {
		if (x % i == 0) res = i;
	}
	return res;
}

void solve () {
	ll x1 = 0, y1 = 0, x2, y2, x3, y3;
	ll S;
	{
		ll l = 0;
		ll r = 1e9 + 41;
		while (r - l > 1) {
			ll h = (l + r) / 2;
			if (mul(h, h) >= s) {
				r = h;
			} else {
				l = h;
			}
		}
		S = r;
	}	
	dbg(S);
	while (true) {
		assert(S > 0);
		ll rem = S * S - s;		
		if (rem == 0) {
			x2 = y3 = S;
			x3 = y2 = 0;
			break;
		}
		ll resp = getmaxdivisor(rem);		
		if (resp > 1000 * 1000 * 1000) {
			S--;
		} else {
			x2 = y3 = S;
			x3 = resp;
			y2 = rem / resp;
			break;
		}
	}

	printf("%lld %lld %lld %lld %lld %lld\n", x1, y1, x2, y2, x3, y3);
	ll area = x2 * y3 - x3 * y2;
	assert(abs(area) == s);
}

int main() {
#ifdef LOCAL
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	START_TIME = (double)clock();
#endif

	scanf("%lld", &s);	
	solve();

	exit();
	return 0;
}





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

using namespace std;

typedef long long ll;

const int N = 1e5 + 1;
int cnt[N];

int main()
{
#ifdef ONPC
    freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
#else
    //freopen("a.in", "r", stdin);
    //freopen("a.out", "w", stdout);
#endif
    int n;
    cin >> n;
    for (int i = 0; i < n; i++)
    {
        cnt[abs(i - (n - i - 1))]++;
    }
    for (int i = 0; i < n; i++)
    {
        int x;
        cin >> x;
        cnt[x]--;
    }
    for (int i = 0; i < n; i++)
    {
        if (cnt[i] != 0)
        {
            cout << 0 << '\n';
            return 0;
        }
    }
    int b = 1;
    for (int t = 0; t < n / 2; t++)
    {
        b = (b * 2) % (1000000007);
    }
    cout << b << '\n';
}





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

long gcd(long x, long y){
	return y==0 ? x:gcd(y,x % y);
}
long lcm(long x, long y){
    long G = gcd(x,y);
    long a = x/G;
    long b = y/G;
    return a*b*G;
}
int main(void){
    // Your code here!
    long N,M;
    string S,T;
    cin >> N >> M;
    cin >> S >> T;
    
    long G_nm;
    G_nm = gcd(N,M);
    long L_nm;
    L_nm = lcm(N,M);
    
    long a = L_nm/N;
    long b = L_nm/M;
    
    long G_ab = lcm(a,b);
    
    long i;
    bool ret = true;
    for(i=0;((i*a<M) && (i*b<N));i++){
        if(T[i*a] == S[i*b]){
            continue;
        }else{
            ret = ret && false;
        }
    }
    if(ret){
        cout << L_nm << endl;
    }else{
        cout << "-1" << endl;
    }
    
    return 0;
}


Measured memory_bytes: 888
#include <iostream> // cout, endl, cin
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#define _GLIBCXX_DEBUG // check []
#define DIVISOR 1000000007

using namespace std;
typedef pair<int,int> pii;
typedef pair<int64_t, int64_t> pII;

template<typename T>
void cins(vector<T>& arr) { for(T& e: arr) cin >> e; }

#ifdef DEBUG
#define debug(fmt, ...) \
    printf("[debug: %s] " fmt, __func__, __VA_ARGS__)
#else
#define debugs(fmt, ...)
#endif

#define INF (1e+15)

int64_t calc_diff(pII left, pII right) {
    vector<int64_t> elem = { left.first, left.second, right.first, right.second };
    // for(auto e: elem) 
    // cout << endl;
    int64_t mmin = *min_element(elem.begin(), elem.end());
    int64_t mmax = *max_element(elem.begin(), elem.end());
    return mmax - mmin;
}

int main(void) {
    int num;
    cin >> num;
    vector<int64_t> cum(num+1);
    for(int i = 1; i <= num; i++) {
        cin >> cum[i];
        cum[i] += cum[i-1];
    }
    int64_t ans = INF;
    for(int i = 2; i < num-1; i++) {
        // first [0, i) second: [i, num)
        int64_t sum1 = cum[i];
        int64_t sum2 = cum[num] - sum1;
        auto pos1 = lower_bound(cum.begin(), cum.begin()+i, sum1/2);
        auto pos2 = lower_bound(cum.begin()+i, cum.end(), sum2/2+sum1);
        // [0, pos1] [pos1+1, i]
        int64_t p1 = *(pos1-1); int64_t q1 = sum1-p1;
        int64_t p2 = *(pos1); int64_t q2 = sum1-p2;
        pII left_cands[2] = {
            {p1, q1},
            {p2, q2},
        };
        int64_t r1 = *(pos2-1) - sum1; int64_t s1 = sum2 - r1;
        int64_t r2 = *(pos2) - sum1; int64_t s2 = sum2 - r2;
        pII right_cands[2] = {
            {r1, s1},
            {r2, s2},
        };

        for(pII left: left_cands) {
            for(pII right: right_cands) {
                ans = min(ans, calc_diff(left, right));
            }
        }
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4836
Program Batcoder1;
//uses crt;
var A:array[1..20] of integer;
    i,cnt,n:integer;
//------------------------------
begin
//clrscr;
readln(n);
for i:=1 to n do begin
                 read(A[i]);
                 end;
for i:=2 to n-1 do begin
                   if ((A[i]>A[i-1]) and (A[i]<A[i+1])) or ((A[i]<A[i-1]) and (A[i]>A[i+1])) then inc(cnt);
                   end;
Writeln(cnt);
end.


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

#define foru(i, l, r) for(int i = (l); i <= (r); ++i)
#define ford(i, l, r) for(int i = (l); i >= (r); --i)

#define maxn 200010

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//    freopen("abc.inp", "r", stdin); freopen("abc.out", "w", stdout);
    int x; cin >> x;
    cout << 1 - x;
    return 0;
}


Measured memory_bytes: 3580
n, m = (int(i) for i in input().split())
x = list(map(int, input().split()))
if(m <= n):
    print(0)
else:
    x.sort()
    out = list(map(lambda x,y: abs(x-y), x[:-1],x[1:]))
    out.sort()
    if(n==1):
        print(sum(out[0:]))
    else:
        print(sum(out[0:-(n-1)]))

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

int main(){
   int h,w;cin>>h>>w;
   char m[h+2][w+2];
   for(int i=1;i<=h;i++){
       for(int j=1;j<=w;j++){
           cin>>m[i][j];
       }
   }
   int dx[3]={-1,0,1};
   int dy[3]={-1,0,1};
   for(int i=1;i<=h;i++){
       for(int j=1;j<=w;j++){
           if(m[i][j]=='#'){
               cout<<m[i][j];continue;
           }
           int cnt=0;
           for(int k=0;k<3;k++){
               for(int l=0;l<3;l++){
                    if(m[i+dx[k]][j+dy[l]]=='#')cnt++;
               }
           }
           cout<<cnt;
       }
       cout<<endl;
   }
   cout<<endl;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<algorithm>
#include<iomanip>
#include<cmath>
#include<string>
#include<cstdlib>

using namespace std;

int main()
{
  long long K, X;
  cin >> K >> X;

  if(500*K>=X)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;


  return 0;
}



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

// int/long:		-2,147,483,648 - 2,147,483,647 (-2^31 <= int < 2^31)
// long/long long:	-9,223,372,036,854,775,808 - 9,223,372,036,854,775,807 (-2^63 <= long < 2^63)

// lower_bound(A.begin(), A.end(), N)
// upper_bound(...

// A.erase(unique(A.begin(), A.end()), A.end())

// bit: &/and, |/or, ^/xor, ~/not

// getline(cin, String)
// while (getline(cin, S)) {}

// cout <<fixed <<setprecision(10)

// priority_queue<int> q;
// priority_queue<int, vector<int>, less<int>> q; // Default: vector, less
// priority_queue<vector<int>, vector<vector<int>>, greater<vector<int>>> q;

// Graph
// Warshall-Floyd: Distance between each node, N^3
// Dijkstra: Distance from the start node, N^2
// DFS(Depth-First Search)

//
// Notes
//
// When specified less than N, try full scan.
// RE: empty vector
// Check Qs
// long/int
// xor -> count each bit
// Check values
// 	1,000,000 -> Loop
// 	100,000	-> vector(int:400KB, long:800KB) 

#define	INF (1<<30)
//1,073,741,824
//= 536,870,912 *2

#define	MOD 1000000007

#define	Rep0(i, n)	for (ll i=0; i<n; i++)
#define	Rep1(i, n)	for (ll i=1; i<=n; i++)
#define Sort(P)	sort(P.begin(), P.end())
#define Rev(P)	reverse(P.begin(), P.end())

int	main() {
	ll N, M;
	cin >>N >>M;
	vector<int> S(N+1, 0);
	Rep1(i, N)
		cin >>S.at(i);
	vector<int> T(M+1, 0);
	Rep1(i, M)
		cin >>T.at(i);
	vector<vector<ll>> DP(N+1, vector<ll> (M+1, 1));
	Rep1(i, N) {
		ll K=S.at(i);
		ll S=0;
		Rep1(j, M) {
			if (K==T.at(j)) {
				S +=DP.at(i-1).at(j-1);
				S %=MOD;
			}
			DP.at(i).at(j)=DP.at(i-1).at(j)+S;
			DP.at(i).at(j)%=MOD;
		}
	}
	cout <<DP.at(N).at(M) <<endl;
	return 0;
}



Measured memory_bytes: 31616
def main():
    s = input()
    sl = len(s)
    t = input()
    tl = len(t)

    # dp[s][t]: value
    dp = [[(0) for _ in range(tl + 1)] for _ in range(sl + 1)]

    for si in range(sl):
        for ti in range(tl):
            if s[si] == t[ti]:
                dp[si + 1][ti + 1] = dp[si][ti] + 1
            else:
                dp[si + 1][ti + 1] = max(dp[si + 1][ti], dp[si][ti + 1])

    # import pprint
    # print("dp={}".format(pprint.pformat(dp)))

    ret = []
    si, ti = sl, tl
    while 0 < si and 0 < ti:
        if dp[si][ti] == dp[si - 1][ti]:
            si -= 1
        elif dp[si][ti] == dp[si][ti - 1]:
            ti -= 1
        else:
            ret.insert(0, s[si - 1])
            si -= 1
            ti -= 1

    print("".join(ret))


main()


Measured memory_bytes: 120028
//om nama sivaya
#include<bits/stdc++.h>
#define ll long long
using namespace std;
void solve(){
    int n;
    cin>>n;
    ll a[n],su=0;
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=1;i<n;i++){
        if(a[i]<a[i-1]){
            su+=a[i-1]-a[i];
            a[i]=a[i-1];
        }
    }
    cout<<su;
}
int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int t=1;
    //cin>>t;
    while(t--)
    solve();
}

Measured memory_bytes: 5172
#include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<map>
#include<queue>
#include<cmath>
#define REP(i,a) for (int i = 0;i < (a);++i)
#define FOR(i,a,b) for (int i = (a);i < (b); ++i)
#define FORR(i,a,b) for (int i = (a);i >= (b); --i)
#define ALL(obj) (obj).begin(),(obj).end()
#define SORT(list) sort(ALL((list)));
#define MOD 1000000007
using namespace std;
using ll = long long;
int main(){
    int x,n;
    cin >> x >> n;
    vector<int>p(n);
    set<int>ii;
    REP(i,n){
        cin >> p[i];
        ii.insert(p[i]);
    }
    if(n==0){
        cout << x << endl;
        return 0;
    }

    int minnum = INT32_MAX;
    SORT(p);
    int answer;
    reverse(p.begin(),p.end());
    if(x < 1 or x > 101){
        cout << x-1 << endl;
    }else{
        FORR(i,101,0){
            if(abs(x-i) <= minnum){
                if(ii.find(i)!=ii.end())continue;
                answer = i;
                minnum = abs(x-i);
            }
        }
    }
    cout << answer << endl;
    return 0;
}

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

int main(void){
    int N,X;
    cin >> N >> X;
    int D[N];
    int sum = 0;
    int min = 1010;
    for(int i = 0 ; i < N ; i++){
        cin >> D[i];
        sum += D[i];
        if(min > D[i]) min = D[i];
    }
    int answer;
    answer = (X - sum) / min;
    cout << answer+N << endl;
    return 0;
}


Measured memory_bytes: 3184
#include <cstdio>
#include <algorithm>
#include <unordered_map>
typedef long long ll;
using namespace std;
int h, w, n;
unordered_map<ll, bool> board;
int cur_board[5][5];
ll ans[10];
int main() {
	scanf("%d%d%d", &h, &w, &n);
	ans[0] = (ll)(h - 2) * (w - 2);
	while(n--) {
		ll a;
		int b; scanf("%lld%d", &a, &b);
		if(board[a << 30 | b]) continue;
		for(int di = -2; di <= 2; di++) for(int dj = -2; dj <= 2; dj++) {
			if(1 <= a + di && a + di <= h && 1 <= b + dj && b + dj <= w)
				cur_board[di + 2][dj + 2] = board[(a + di) << 30 | (b + dj)];
			else
				cur_board[di + 2][dj + 2] = 0;
		}
		for(int i = 0; i < 5; i++) for(int j = 0; j < 5; j++) {
			if(i > 0) cur_board[i][j] += cur_board[i - 1][j];
			if(j > 0) cur_board[i][j] += cur_board[i][j - 1];
			if(i > 0 && j > 0) cur_board[i][j] -= cur_board[i - 1][j - 1];
		}
		for(int di = -1; di <= 1; di++) for(int dj = -1; dj <= 1; dj++) {
			int a_ = a + di, b_ = b + dj;
			if(2 <= a_ && a_ <= h - 1 && 2 <= b_ && b_ <= w - 1) {
				int c = cur_board[di + 3][dj + 3];
				if(di >= 0) c -= cur_board[di][dj + 3];
				if(dj >= 0) c -= cur_board[di + 3][dj];
				if(di >= 0 && dj >= 0) c += cur_board[di][dj];
				ans[c]--;
				ans[c + 1]++;
			}
		}
		board[a << 30 | b] = true;
	}
	for(int i = 0; i < 10; i++) printf("%lld\n", ans[i]);
	return 0;
}


Measured memory_bytes: 118096
#include "bits/stdc++.h"
#include <boost/range/irange.hpp>
using namespace std;
using boost::irange;

// 定義
typedef long long           ll;
typedef pair<ll, ll>        P;
#define ALL(x)              (x).begin(),(x).end()
#define REP(i, n)           for (ll i = 0 ; i < (ll)n ; ++i)
#define REPN(i, m, n)       for (ll i = m ; i < (ll)n ; ++i)
const ll                    INF = 2e9;
const ll                    INF_LL = 1LL<<60;
const ll                    MOD = 1e9 + 7;
namespace {
	ll Ceil(ll val, ll div)   { return (val + div - 1) / div; }
	ll CeilN(ll val, ll div)  { return Ceil(val, div) * div; }
	ll FloorN(ll x, ll n)     { return (x - x % n); }
	bool IsOdd(ll x)          { return ((x & 1) == 1); }
	bool IsEven(ll x)         { return ((x & 1) == 0); }
	template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
	template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
};

// 処理
void Solve()
{
	ll N, M, X;
	cin >> N >> M >> X;
	
	vector<ll> C(N);
	vector<vector<ll>> A(N, vector<ll>(M));
	REP(i, N) {
		cin >> C[i];
		REP(j, M) cin >> A[i][j];
	}

	ll ans = INF;
	ll bitMax = (ll)1 << N;
	REP(bitPtn, bitMax) {
		ll ansOne = 0;
		vector<ll> aSum(M, 0);
		REP(j, N) {
			if (bitPtn & (ll)1 << j) {
				ansOne += C[j];
				REP(k, M) {
					aSum[k] += A[j][k];				
				}
			}
		}

		bool isOk = true;
		for (auto one : aSum) {
			if (one < X) {
				isOk = false;
				break;
			}
		}

		if (isOk) {
			chmin(ans, ansOne);		
		}
	}
	
	if (ans == INF) ans = -1;
	cout << ans << endl;
}

// メイン
int main()
{
	cin.tie(nullptr);
	ios_base::sync_with_stdio(false);
	cout << fixed << setprecision(15);
	Solve();
	return 0;
}


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

int main() {
 int A1,A2,A3;
 cin >> A1>> A2 >>A3;
 if (A1+A2+A3>=22) {
   cout << "bust";
 }
 else {
   cout <<"win";
 }
}

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

int main(){
    int h,w;
    cin >> h >> w;
    char map[h][w];
    for(int i=0;i<h;i++){
        for(int j=0;j<w;j++){
            cin >> map[i][j];
        }
    }
  
    bool flag = true;
    vector<vector<char>> tmpmap(h,vector<char>(w));
    int height = 0;
    for(int i=0;i<h;i++){
        flag = false;
        for(int j=0;j<w;j++){
            if(map[i][j]!='.'){
                flag = true;;
                break;
            }
        }
        if(flag){
            for(int j=0;j<w;j++){
                tmpmap.at(height).at(j) = map[i][j];
            }
            height++;
        }
    }

    vector<vector<char>> tmpmap2(h,vector<char>(w));
    int width = 0;
    for(int i=0;i<w;i++){
        flag = false;
        for(int j=0;j<height;j++){
            if(tmpmap[j][i]!='.'){
                flag = true;
                break;
            }
        }
        if(flag){
            for(int j=0;j<height;j++){
                tmpmap2.at(j).at(width) = tmpmap[j][i];
            }
          width++;
          
        }
    }
    for(int i=0;i<height;i++){
        for(int j=0;j<width;j++){
            cout << tmpmap2[i][j];
        }
        cout << endl;
    }
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define IO_OP std::ios::sync_with_stdio(0); std::cin.tie(0);
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define EB emplace_back

using namespace std;

typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;

const int INF = 1e9 + 7;

int main()
{
	IO_OP;
	
	multiset<int> s;
	int n;
	cin >> n;
	for(int i=0;i<n;i++) {
		int t;
		cin >> t;
		if(s.size() && s.lower_bound(t)!=s.begin())
			s.erase(prev(s.lower_bound(t)));
		s.insert(t);
	}
	cout << s.size() << endl;
	
}



Measured memory_bytes: 4992
#include<bits/stdc++.h>
using namespace std;
const int maxm=1e7+10,maxn=210;
int n,a[maxn],b[maxn],m,ans;
int b1[maxn],b2[maxn],p1,p2;
bool np[maxm],vis[maxn],g[maxn][maxn],s[maxm];
int match[maxn];
vector<int> p;

void init(){
	np[0]=np[1]=1;
	for(int i=2;i<maxm;++i){
		if(!np[i]){
			p.push_back(i);
			//cerr<<i<<endl;
			//system("pause");
		}
		for(int j=0,j_end=p.size(),x;j<j_end&&(x=p[j]*i)<maxm;++j){
			np[x]=true;
			if(i%p[j]==0)break;
		}
	}
	np[2]=1;
}

bool dfs(int u){
	for(int i=1;i<=p2;++i)if(g[u][i]&&!vis[i]){
		vis[i]=1;
		if(!match[i]||dfs(match[i])){
			match[i]=u;
			return true;
		}
	}
	return false;
}
void solve(){
	init();
	cin>>n;
	for(int i=1;i<=n;++i){cin>>a[i];s[a[i]]=1;}
	for(int i=1;i<maxm;++i){
		if(s[i]!=s[i-1])b[++m]=i;//,cerr<<b[m]<<endl;
	}
	//cerr<<m<<endl;
	for(int i=1;i<=m;++i){
		if(b[i]&1)b1[++p1]=b[i];
		else b2[++p2]=b[i];
	}
	//cerr<<p1<<" "<<p2<<endl;
	for(int i=1;i<=p1;++i){
		for(int j=1;j<=p2;++j){
			if(!np[abs(b1[i]-b2[j])]){
				//cerr<<i<<" "<<j<<endl;
				g[i][j]=true;
			}
		}
	}
	
	for(int i=1;i<=p1;++i){
		memset(vis,0,sizeof vis);
		if(dfs(i))++ans;//match()
	}
	p1-=ans;p2-=ans;
	//cerr<<ans<<endl;
	ans+=p1/2*2+p2/2*2;
	ans+=p1%2*3;
	//cerr<<ans<<endl;
	cout<<ans<<endl;
}
int main(){
	/*#ifndef ONLINE_JUDGE
	freopen("a.in","r",stdin);
	freopen("a.out","w",stdout);
	#endif*/
	solve();
	
	return 0;
}

Measured memory_bytes: 21996
H,W=map(int,input().split(" "))

if H % 2 == 0 or W % 2 == 0:
  ans=H*W/2
else:
  if H % 2 == 1:
    ans=(H+1)/2*W - W//2
  elif W % 2 == 1:
    ans=(W+1)/2*H - H//2

if H == 1 or W == 1:
  ans=1
    
ans=int(ans)
print(ans)

Measured memory_bytes: 3060
#include<stdio.h>
int main(void){
  
    long long int a=0;
    long long int b=0;
    long long int c=2;
    long long int d=1;
    long long int r=0;
    

    long long int w=0;
    long long int p=1;
    scanf("%lld",&a);
 while (r<100)
 {
     if(a>=c){
         d=d+1;

     }else{
         r=100000000;
     }
     c=c*2;
 }
 for(w=0;w<d;w++){
     p=p*2;
 }
 p=p-1;
 
 
printf("%lld",p);
}





Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = (int) Math.ceil(n / 1.08);
        if ((int)Math.floor((double)x * 1.08) == n) {
            System.out.println(x);
        } else {
            System.out.println(":(");
        }
    }
}

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

#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)

int main() {
    fastio
    int x;
    cin >> x;
    int y = x/1.08;
    
    int i = (y-1)*1.08;
    int j = y*1.08;
    int k = (y+1)*1.08;
    
    
    // int i = (int)a;
    // int j = (int)b;
    // int k = (int)c;
    if(i == x){
        cout<<(int)y-1<<endl;
    }
    else if(j == x){
        cout<<(int)y<<endl;
    }
    else if(k == x)
        cout<<(int)y+1<<endl;
    else
        cout<<":("<<endl;
        
    
	return 0;
}






Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <algorithm>
#include <math.h>
#include <string>
#include <vector>
#include <cstdlib>
#include <utility>
#include <map>
#include <set>
#include <ios>
#include <iomanip>
#include <functional>
#include <queue>

#define int long long

int inf = (1LL <<  62);
using namespace std;

signed main(){
    int n, m, t;
    cin >> n >> m >> t;
    cout << (t / n) * m;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <math.h> 
#include <string>
#include <iomanip>
#include <queue>
using namespace std;
char map[60][60];
int d[60][60];
int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, -1, 1};
int h, w;
int search(int sx, int sy){
    queue<int> qx;
    queue<int> qy;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++) d[j][i] = -1;
    }
    qx.push(sx);
    qy.push(sy);
    d[sx][sy] = 0;

    while(qx.size() > 0){
        int x = qx.front();
        int y = qy.front();
        qx.pop();
        qy.pop();
        for(int i = 0; i < 4; i++){
            int nx = x + dx[i];
            int ny = y + dy[i];
            if(0 <= nx and 0 <= ny and nx < w and ny < h and map[nx][ny] == '.' and d[nx][ny] == -1){
            qx.push(nx);
            qy.push(ny);
            d[nx][ny] = d[x][y] + 1; 
            }
        }
    }
    return d[w-1][h-1];
}

int main(){
    cin >> h >> w;
    int wcounter = 0;
    int bcounter = 0;
    for(int i = 0; i < h; i++){
        for(int j = 0; j < w; j++){
            cin >> map[j][i];
            if(map[j][i] == '.') wcounter++;
            if(map[j][i] == '#') bcounter++;
        }
    }
    if(search(0,0) == -1) cout << -1 << endl;
    else cout << wcounter - search(0,0) - 1 << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <atcoder/all>
#define ll long long int
#define rep(i,n) for(ll i=0;i<n;i++)
#define vec vector<ll>
#define mat vector<vector<ll>>

using namespace std;
using namespace atcoder;

const ll mod=1000000007;//998244353;
const ll inf=LONG_LONG_MAX;
ll dx4[4]={1,0,-1,0};
ll dy4[4]={0,-1,0,1};
ll dx8[8]={1,0,-1,1,-1,1,0,-1};
ll dy8[8]={1,1,1,0,0,-1,-1,-1};

int main(){

  ll n;
  cin >> n;
  string t,s="ACL";
  for(ll i=0;i<n;i++)cout << s ;
  cout << endl;


  return 0;
}

Measured memory_bytes: 3660
main = do
  getLine
  s <- getLine
  print . g 1 $ f s
 
f [] = []
f [x] = [1]
f (x:y:zs)
  | x == y = 0 : f zs
  | otherwise = 1 : f (y:zs)
 
g p [0] = p %*% 6
g p [1] = p %*% 3
g p (0:0:zs) = g (p %*% 3) (0:zs)
g p (0:1:zs) = g (p %*% 2) (1:zs)
g p (1:0:zs) = g p (0:zs)
g p (1:1:zs) = g (p %*% 2) (1:zs)
 
(%*%) x y = x * y `mod` 1000000007

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


void solve(long long N, long long X, std::vector<long long> L){
    auto curr = 0l;
    int ans = 1, i=0;
    do{
        curr = curr + L[i];
        if(curr<=X)ans++;
        i++;
    }while(i<N);
    cout << ans << endl;
}

int main(){
    long long N;
    scanf("%lld",&N);
    long long X;
    scanf("%lld",&X);
    std::vector<long long> L(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&L[i]);
    }
    solve(N, X, std::move(L));
    return 0;
}


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

using namespace std;

#define N 100000

int n, a[N + 5], ans;
set<int> s;

int main() {
    scanf("%d", &n);
    for (int i = 1; i <= n; ++i) {
        scanf("%d", &a[i]);
        if (i & 1) s.insert(a[i]);
    }
    sort(a + 1, a + n + 1);
    for (int i = 1; i <= n; i += 2)
        if (!s.count(a[i]))
            ans++;
    printf("%d\n", ans);
    return 0;
}

Measured memory_bytes: 2944
n = int(input())
list_a = list(map(int, input().split()))

list_even_idx = [str(a) for i, a in enumerate(list_a) if i % 2 == 0]
list_odd_idx = [str(a) for i, a in enumerate(list_a) if i % 2 != 0]

if n % 2 == 0:
  result1 = " ".join(list_odd_idx[::-1])
  result2 = " ".join(list_even_idx)
  print(result1 + " " + result2)
else:
  result1 = " ".join(list_even_idx[::-1])
  result2 = " ".join(list_odd_idx)
  print(result1 + " " + result2)

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

int main(){
  int A,B,rs=0;
  cin >> A >> B;
  string rev,org;

  for(int i = A;i <= B;i++){
      org = to_string(i);
      rev = to_string(i);
      reverse(rev.begin(),rev.end());
      if(org == rev)
        rs++;
  }

  cout << rs << endl;
    

}

Measured memory_bytes: 256
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cctype>
using namespace std;

typedef long long ll;

#define REP(i,n,m) for(int i=n;i<m;i++)
#define rep(i,n) REP(i,0,n)

int main(){
  int size = 0;
  string s[100];

  while(1){
    getline(cin,s[size]);
    if(s[size] == "END_OF_TEXT") break;
    s[size] += '\n';
    size++;
  }

  string buff = "";
  int x = 0, y = 0;
  char op;

  while(cin>>op,op!='-'){
    if(op == 'a'){
      x = 0;
    }
    else if(op == 'e'){
      x = s[y].size() - 1;
    }
    else if(op == 'p'){
      x = 0;
      if(y != 0){
        y--;
      }
    }
    else if(op == 'n'){
      x = 0;
      if(y != size - 1){
        y++;
      }
    }
    else if(op == 'f'){
      if(x < s[y].size() - 1){
        x++;
      }
      else if(y != size-1){
        y++;
        x = 0;
      }
    }
    else if(op == 'b'){
      if(x != 0){
        x--;
      }
      else if(y != 0){
        y--;
        x = s[y].size() - 1;
      }
    }
    else if(op == 'd'){
      if(x != s[y].size() - 1){
        s[y].erase(s[y].begin() + x);
      }
      else if(y != size - 1){
        s[y].erase(s[y].end()-1);
        s[y] += s[y+1];
        for(int i=y+1;i<size-1;i++){
          s[i] = s[i+1];
        }
        size--;
      }
    }
    else if(op == 'k'){
      if(x != s[y].size() - 1){
        buff = s[y].substr(x,s[y].size()-x-1);
        s[y].erase(x,buff.size());
      }
      else if(y != size - 1){
        s[y].erase(s[y].end()-1);
        s[y] += s[y+1];
        for(int i=y+1;i<size-1;i++){
          s[i] = s[i+1];
        }
        size--;
        buff = "\n";
      }
    }
    else if(op == 'y'){
      if(buff == "\n"){
        for(int i=size;i>y;i--){
          s[i] = s[i-1];
        }
        size++;
        string tmp = s[y].substr(x);
        s[y+1] = tmp;
        s[y].erase(x,s[y].size()-x-1);
        y++;
        x = 0;
      }
      else if(buff != ""){
        s[y].insert(x,buff);
        x += buff.size();
      }
    }

    /*
    cout<<x<<","<<y<<endl;
    rep(i,size){
      cout<<s[i];
    }
    cout<<"--\n\n";
    */
  }

  rep(i,size){
    cout<<s[i];
  }
}

Measured memory_bytes: 0
import java.util.*;
import java.math.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int N = sc.nextInt();
    int[] A = new int[N];
    for (int i = 0; i < N; i++) A[i] = sc.nextInt();
    sc.close();

    boolean ans = true;
    for (int i = 0; i < N; i++)
      if (A[i] % 2 == 0 && A[i] % 3 != 0 && A[i] % 5 != 0) {
        ans = false;
        break;
      }
    System.out.println(ans ? "APPROVED" : "DENIED");
  }
}



Measured memory_bytes: 23892
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <iomanip>
#include <algorithm>
using namespace std;


int gcd(int a, int b) { return b ? gcd(b, a%b) : a; }

int main() {
	long long N, X;
	cin >> N >> X;

	long long minD;

	vector<long long> x(N);
	for (long long i = 0; i < N; i++) {
		cin >> x[i];
	}

	sort(x.begin(), x.end());
	minD = abs(x[0] - X);
	for (long long i = 0; i < N; i++) {
		minD = gcd(minD, abs(x[i] - X));
	}

	cout << std::setprecision(10) << minD << endl;

	return 0;
}

Measured memory_bytes: 1024
hp, atk, e_hp, e_atk = map(int, input().split())

count = 1
while hp > 0 and e_hp > 0 :
  if count % 2 == 1:
    e_hp -= atk 
  else:
    hp -= e_atk
  count += 1

if hp > 0 :
  print('Yes')
else:
  print('No')

Measured memory_bytes: 61660
#include <bits/stdc++.h>
#define REP(a, b) for(int a = 0; a < b; a++)
#define FOR(i, a, b) for(int i = a; i <= b; i++)
#define mp make_pair
#define f first
#define s second
#define pb push_back
using namespace std;

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

const ll INF = 1e11 + 1;
const ll MOD = 1e9 + 7;
const int MAXN = 1e5 + 100;

ll n, W;
ll DP[105][100005];
ll w[105], v[105];
ll maks;

ll rek(int pos, ll val) {
	if (pos == n) {
		if (val == 0) return 0;
		else return INF;
	}
	ll &ret = DP[pos][val];
	if (ret != -1) return ret;
	ret = INF;
	ret = min(ret, rek(pos + 1, val));
	if (v[pos] <= val) ret = min(ret, w[pos] + rek(pos + 1, val - v[pos]));
	if (pos == 0 && ret <= W) maks = max(maks, val);
	return ret;
}

int main() {
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios::sync_with_stdio(0); cin.tie(0);
	cin >> n >> W;
	REP(i, n) cin >> w[i] >> v[i];	
	memset(DP, -1, sizeof DP);
	FOR(i, 0, 100000) {
		rek(0, i);
	}
	cout << maks << '\n';
}

Measured memory_bytes: 82304
#include <iostream>
#include <utility>
#include <vector>
#include <queue>
#include <stack>
#include <array>
#include <algorithm>
#include <numeric>
#include <limits>
#include <string>
#include <regex>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

int main()
{
    int N;
    cin >> N;
    vector<int> P(N), Q(N), V(N);
    for (int i = 0; i < N; i++) cin >> P[i];
    for (int i = 0; i < N; i++) cin >> Q[i];
    for (int i = 0; i < N; i++) V[i] = i + 1;

    int ans = 0;

    string sp(N, '0'), sq(N, '0'), sv(N, '0');
    for (int i = 0; i < N; i++) sp[i] = P[i] + '0';
    for (int i = 0; i < N; i++) sq[i] = Q[i] + '0';

    int ip = stoi(sp);
    int iq = stoi(sq);
    //printf("%d %d\n", ip, iq);

    int a = -1;
    int b = -1;
    int index = 0;
    do {
        for (int i = 0; i < N; i++) sv[i] = V[i] + '0';
        int iv = stoi(sv);
        //printf("%d\n", iv);
        if (iv == ip) a = index;
        if (iv == iq) b = index;
        index++;
        if (a != -1 && b != -1) break;
    } while (next_permutation(V.begin(), V.end()));
    cout << abs(a - b) << endl;
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int n;
long long gcd(long long x,long long y)
{
    if (!y) return x;
    return gcd(y,x%y);
}
void solve()
{
    vector < long long > inp(n);
    int i;
    long long ans=0;
    for (i=0;i<n;i++)
        scanf("%lld",&inp[i]);
    for (i=0;i<n;i++)
        ans+=(inp[i]-1)%inp[i];
    printf("%lld\n",ans);
}
int main()
{
    while(~scanf("%d",&n))
        solve();
}

Measured memory_bytes: 256
import java.util.*

fun main(args:Array<String>){
    val n = readLine()!!.toInt()
    var a = readLine()!!.split(" ").map{it.toInt()}.toIntArray()
    val b = readLine()!!.split(" ").map{it.toInt()}
    var ans = 0L
    for(i in 0 until n){
        var k = Math.min(a[i], b[i])
        ans += k
        k = b[i] - k
        if(k > 0){
            k = Math.min(a[i + 1], k)
            ans += k
            a[i + 1] -= k
        }
    }
    println(ans)
}

Measured memory_bytes: 86688
import java.util.*;

public class Main{ //クラス名はMain
    public static void main(String[] args) {
			
			Scanner sc = new Scanner(System.in);
			
			// 文字列の入力
			int num = sc.nextInt();
      
      		int[] numbers = new int[num*2];
      		for(int i=0;i<num*2;i++){
              	numbers[i] =sc.nextInt();
            }
			
			/*--------------------------------*/
			String ans = "No";
      		int p = 0;
      		int count = 0;
      
      		for(int i=0;i<num;i++){
              if(numbers[p] == numbers[p+1]){
                count++;
              }else{
                count =0;
              }
              if(count == 3){
                ans ="Yes";
                break;
              }
              p+=2;
            }
      
      		System.out.println(ans);
    }
}



Measured memory_bytes: 36016
#include <bits/stdc++.h>
using namespace std;
using ll = int64_t;

void main_()
{
    ll N, K;
    vector<ll> As;
    cin >> N >> K;
    copy_n(istream_iterator<ll>(cin), N, back_inserter(As));

    vector<ll> balls(N);
    for (auto a : As) {
        balls[a - 1]++;
    }

    nth_element(begin(balls), begin(balls) + K, end(balls), greater<ll>());

    ll keep = accumulate(begin(balls), begin(balls) + K, 0LL);

    ll ans = N - keep;

    cout << ans << endl;
}

int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    main_();
    return 0;
}


Measured memory_bytes: 3568
fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val monsters = readLine()!!.split(" ").map { it.toInt() }
    val braves = readLine()!!.split(" ").map { it.toInt() }

    var total: Long = 0
    var morasi = monsters[0]

    (0 until n).forEach { i ->
        val brave = Brave(braves[i])
        total += brave.slay(morasi)
        val ns = brave.slay(monsters[i+1])
        total += ns
        morasi = monsters[i+1] - ns
    }
    print(total)
}

data class Brave(var power: Int) {
    fun slay(enemy: Int): Int {
        val currentPow = power
        return if (enemy >= power) {
            power = 0
            currentPow
        } else {
            power = currentPow - enemy
            enemy
        }
    }
}

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

int main(){
  int i,ans;
  string s;
  cin >> s;
  ans=(int)s.size();
  for(i=1;i<(int)s.size();i++){
    if(s[i-1]!=s[i]){
      ans=min(ans,max(i,(int)s.size()-i));
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 512
import java.util.*;
import java.math.*;
public class Main {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int k = in.nextInt();
		long ans = 0;
		for(int i = 1; i <= k; i++) {
			for(int j = 1; j <= k; j++) {
				for(int l = 1; l <= k; l++) {
					ans += gcd(gcd(i, j), l);
				}
			}
		}
		System.out.println(ans);
	}
	public static int gcd(int a, int b) {
		int na = Math.max(a, b);
		int nb = Math.min(a, b);
		if(na % nb != 0) {
			return gcd(nb, na % nb);
		}else return nb;
	}
} 


Measured memory_bytes: 35824
package main

import "fmt"

type Vertex struct {
	X int
	Y int
}

func main() {

	var w, h, x, y, r int
	fmt.Scan(&w, &h, &x, &y, &r)

	var top, bottom, left, right Vertex
	top 	= Vertex{x,y+r}
	bottom 	= Vertex{x,y-r}
	left 	= Vertex{x-r,y}
	right	= Vertex{x+r,y}

	if left.X >= 0 && top.Y <= h && right.X <= w && bottom.Y >= 0 {
		fmt.Println("Yes")
	} else {
		fmt.Println("No")
	}
}


Measured memory_bytes: 1180
n, m = map(int, input().split())
response_list = []
for _ in range(n):
    response = list(map(int, input().split()))
    response.pop(0)
    response_list.append(response)

cnt_list = [0]*m
for list in response_list:
    for i in list:
        cnt_list[i-1] += 1

ans = 0
for j in cnt_list:
    if j == n:
        ans += 1

print(ans)

Measured memory_bytes: 9196
#include<iostream>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<math.h>

using namespace std;

typedef long long ll;

#define rep(i, n) for (ll i = 0; i < n; i++)


bool sosu(ll n) {
	if (n == 2)return true;
	if (n % 2 == 0)return false;
	for (int i = 3; i <= sqrt(n); i++) {
		if (n % i == 0) {
			return false;
		}
	}
	return true;
}


signed main() {
	

	string a;

	cin >> a;

	if (a == "SUN") {
		cout << 7;
	}
	else if (a == "MON") {
		cout << 6;
	}
	else if (a == "TUE") {
		cout << 5;
	}
	else if (a == "WED") {
		cout << 4;
	}
	else if (a == "THU") {
		cout << 3;
	}
	else if (a == "FRI") {
		cout << 2;
	}
	else {
		cout << 1;
	}

	return 0;
}


Measured memory_bytes: 256
# coding=utf-8
from collections import deque
n = int(input())
deque = deque()
input_lines = [input().split() for x in range(n)]

for i in range(n):
    inp = input_lines[i]
    if inp[0] == 'deleteFirst':
        deque.popleft()
    elif inp[0] == 'deleteLast':
        deque.pop()
    elif inp[0] == 'insert':
        deque.appendleft(inp[1])
    else:
        if inp[1] in deque:
            deque.remove(inp[1])

print(' '.join(deque))

Measured memory_bytes: 557132
#include <stdio.h>
#include <string.h>

int main(){
 char a[10],b[10],c[10];
 int A,B,C;

 scanf("%s%s%s",a,b,c);

 A=strlen(a);
 B=strlen(b);

 if(a[A-1]==b[0]&&b[B-1]==c[0]){
  printf("YES");
 }else{
  printf("NO");
 }

 return 0;

}


Measured memory_bytes: 128
import re
nums=input()
s=input()
pfin=''
for idx,ns in enumerate(nums.split()):
  pttr='{},{}'.format(ns,ns)
  pfin+='\d{'+pttr+'}'
  if idx==0: pfin+='-'
print('Yes' if re.match(pfin,s) is not None else 'No')


Measured memory_bytes: 3188
/**
 * There is a start and there is no end in the space. ---Infinity.
 * It ruins and goes though there is also a start in stars. ---Finite.
 * Only the man who has wisdom can read the most foolish one from the history.
 * Fishes living in the sea doesn't know the life in the land.
 * It also ruins and goes if they have wisdom.
 * It funnier that man exceeds the speed of light than fish start living in the land.
 * It can be said that this is an final ultimatum from the god to the people who can fight.
 *
 * Steins;Gate
 */

#include <bits/stdc++.h>

const int N = 100010;

struct Edge {
    int nex, v;
}edge[N << 1]; int tp = 1;

int e[N], n, m, in[N], vis[N], stk[N], top, cnt, A, B;

inline void add(int x, int y) {
    tp++;
    edge[tp].v = y;
    edge[tp].nex = e[x];
    e[x] = tp;
    return;
}

void DFS(int x, int f) {
    if(f && x == A) {
        puts("Yes");
        exit(0);
    }
    else if(x == B) return;
    for(int i = e[x]; i; i = edge[i].nex) {
        int y = edge[i].v;
        if(y != f) DFS(y, x);
    }
    return;
}

int main() {
    scanf("%d%d", &n, &m);
    for(int i = 1, x, y; i <= m; i++) {
        scanf("%d%d", &x, &y);
        add(x, y);
        add(y, x);
        in[x]++;
        in[y]++;
    }
    int largeIn = 0, cnt = 0;
    for(int i = 1; i <= n; i++) {
        if(in[i] & 1) {
            puts("No");
            return 0;
        }
        if(largeIn < in[i]) {
            largeIn = in[i];
            cnt = 1;
        }
        else if(largeIn == in[i]) {
            cnt++;
        }
    }
    if(largeIn > 4) {
        puts("Yes");
        return 0;
    }
    else if(largeIn == 4 && cnt > 2) {
        puts("Yes");
        return 0;
    }
    else if(largeIn == 4 && cnt == 2) {
        for(int i = 1; i <= n; i++) {
            if(in[i] == 4) {
                if(!A) A = i;
                else {
                    B = i;
                    break;
                }
            }
        }
        DFS(A, 0);
    }
    puts("No");
    return 0;
}


Measured memory_bytes: 3328
#include <stdio.h>

int main(){
  int i, j;
  long long int a, b, c, d, k[4], e;
  scanf("%lld %lld %lld %lld",&a,&b,&c,&d);
  k[0] = a*c;
  k[1] = b*c;
  k[2] = a*d;
  k[3] = b*d;
  for(i=0;i<3;i++){
    for(j=i+1;j<4;j++){
      if(k[i]<k[j]){
        e = k[i];
        k[i] = k[j];
        k[j] = e;
      }
    }
  }
  printf("%lld",k[0]);
}

Measured memory_bytes: 1736
import sys
readline = sys.stdin.readline


def main():
    n, m = map(int, readline().rstrip().split())
    hList = list(map(int, readline().rstrip().split()))
    hAns = [1] * n
    for i in range(m):
        a, b = map(int, readline().rstrip().split())
        if hList[a - 1] > hList[b - 1]:
            hAns[b - 1] = 0
            continue
        if hList[a - 1] < hList[b - 1]:
            hAns[a - 1] = 0
            continue
        hAns[a - 1] = 0
        hAns[b - 1] = 0
    print(sum(hAns))


if __name__ == '__main__':
    main()


Measured memory_bytes: 20092
package main

import (
	"fmt"
)

func main() {
	var n int
	fmt.Scan(&n)
	var cnt int
	for a := 1; a < n; a++ {
		cnt += (n - 1) / a
	}
	fmt.Println(cnt)
}

func min(a, b int) int {
	if a < b {
		return a
	}
	return b
}

func max(a, b int) int {
	if a > b {
		return a
	}
	return b
}

func abs(a int) int {
	if a < 0 {
		return -a
	}
	return a
}


Measured memory_bytes: 1776
#include<stdio.h>

int main(){
  
  int n[3];
  int sum;
  sum = 0;
  
  for(int i = 0;i<3;i++)
  {
    scanf("%d",&n[i]);
    sum = sum + n[i];
  }
  
  if(sum >= 22){
    printf("%s\n","bust");
  }else{
    printf("%s\n","win");
  }
  return 0;
}

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

string next(string s){
	int it=s[0]-'0';
	int count=1;
	string ans="";
	for(int i=1;i<s.size();i++){
		if(it==s[i]-'0')count++;
		else{
			char tmp[256];
			sprintf(tmp,"%d",count);
			string t=string(tmp);
			ans += t;
			sprintf(tmp,"%d",it);
			t=string(tmp);
			ans += t;
			it=s[i]-'0';
			count=1;
		}
	}
	char tmp[256];
	sprintf(tmp,"%d",count);
	string t=string(tmp);
	ans += t;
	sprintf(tmp,"%d",it);
	t=string(tmp);
	ans += t;
	return ans;
}
int main(){
	int n;
	while(cin>>n&&n){
		string s;
		cin>>s;
		for(int i=0;i<n;i++)s=next(s);
		cout<<s<<endl;
	}
	return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
#define REP(i, n) for (int i = 0; i < (n); i++)
#define MOD 1000000007

using namespace std;
typedef long long ll;

ll dp[1100][1100];
char mp[1100][1100];
int main()
{
  int H, W; cin >> H >> W;
  REP(i, H) REP(j, W) cin >> mp[i][j];
  dp[0][0] = 1;
  REP(i, H) {
    REP(j, W) {
      if (mp[i][j] == '#') continue;
      (dp[i + 1][j] += dp[i][j])%=MOD;
      (dp[i][j + 1] += dp[i][j])%=MOD;
    }
  }

  cout << dp[H - 1][W - 1] << endl;

  return 0;
}

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

using namespace std;

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

    cout << fixed;
    cout.precision(10);

    int n; cin >> n;
    int cnt = (n + 1) / 2;
    double ans = 1.0 * cnt / n;
    cout << ans;

    return 0;
}


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

using namespace std;

const int MOD = 1000000007;
const int MOD_MAX = 200000;
using ll = long long;

ll fact_arr[MOD_MAX], finv_arr[MOD_MAX], inv_arr[MOD_MAX];
void comb_init() {
	fact_arr[0] = fact_arr[1] = 1;
    finv_arr[0] = finv_arr[1] = 1;
    inv_arr[1] = 1;
    for (int i = 2; i < MOD_MAX; i++){
        fact_arr[i] = fact_arr[i - 1] * i % MOD;
        inv_arr[i] = MOD - inv_arr[MOD % i] * (MOD / i) % MOD;
        finv_arr[i] = finv_arr[i - 1] * inv_arr[i] % MOD;
    }
}
class mint {
public:
	ll value;
	
	mint(ll a = 0) : value((a % MOD + MOD) % MOD) {}
	bool operator < (mint a) { return this->value < a.value; }
	bool operator > (mint a) { return this->value > a.value; }
	bool operator <= (mint a) { return this->value <= a.value; }
	bool operator >= (mint a) { return this->value >= a.value; }
	mint& operator += (const mint& a) { if ((this->value += a.value) > MOD) this->value -= MOD; return *this; }
	mint& operator -= (const mint& a) { if ((this->value -= a.value) < 0ll) this->value += MOD; return *this; }
	mint& operator *= (const mint& a) { (this->value *= a.value) %= MOD; return *this; }
	mint operator + (const mint a) const { mint ret(this->value); return ret += a; }
	mint operator - (const mint a) const { mint ret(this->value); return ret -= a; }
	mint operator * (const mint a) const { mint ret(this->value); return ret *= a; }
	mint pow(ll times) const {
		if (!times) return 1;
		mint ret = pow(times >> 1);
		ret *= ret;
		if (times & 1) ret *= *this;
		return ret;
	}
	mint inv() const { return pow(MOD - 2); }
	mint& operator /= (const mint& a) { return (*this) *= a.inv(); }
	mint operator / (const mint a) const { mint ret(this->value); return ret /= a; }
	friend ostream& operator << (ostream& os, const mint& m) { os << m.value; return os; }
};

int main() {
  int n; cin >> n;
  if (n <= 1) { 
    cout << 0 << endl;
    return 0;
  }
  mint ten = 10;
  mint nine = 9;
  mint eight = 8;
  mint two = 2;
  mint ans = ten.pow(n) - two * nine.pow(n) + eight.pow(n);
  cout << ans.value << endl;
}

Measured memory_bytes: 3596
#include<bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < int(n); ++i)
#define rrep(i,n) for (int i = int(n)-1; i >= 0; i--)
#define rep2(i,s,n) for (int i = int(s); i < int(n); ++i)
#define all(a) a.begin(),a.end()
#define rall(a) a.rbegin(),a.rend()
#define pb push_back
#define eb emplace_back
#define vi vector<int>
#define vvi vector<vector<int>>
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vd vector<double>
#define vs vector<string>
#define vc vector<char>
#define vb vector<bool>
#define vp vector<P>
using namespace std;
using ll = long long;
using P = pair<int,int>;
using LP = pair<ll,ll>;
template<class S,class T> istream& operator>>(istream &is,pair<S,T> &p) { return is >> p.first >> p.second; }
template<class S,class T> ostream& operator<<(ostream &os,const pair<S,T> &p) { return os<<'{'<<p.first<<","<<p.second<<'}'; }
template<class T> istream& operator>>(istream &is,vector<T> &v) { for(T &t:v){is>>t;} return is; }
template<class T> ostream& operator<<(ostream &os,const vector<T> &v) { os<<'[';rep(i,v.size())os<<v[i]<<(i==int(v.size()-1)?']':','); return os; }
void Yes(bool b) { cout << (b ? "Yes" : "No") << endl; }
void YES(bool b) { cout << (b ? "YES" : "NO") << endl; }
template<class T> bool chmin(T& a,T b) {if(a > b){a = b; return true;} return false;}
template<class T> bool chmax(T& a,T b) {if(a < b){a = b; return true;} return false;}
const int inf = 1001001001;
const ll linf = 1001001001001001001;

int dp[50][200010];

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    int n;
    ll k;
    cin >> n >> k;
    ll ori = k;
    vi a(n);
    cin >> a;
    vi mn(200010,inf);
    rep(i,n) chmin(mn[a[i]],i);
    dp[0][n] = 0;
    vi v(200010,-1);
    rrep(i,n) {
        if(v[a[i]] == -1) {
            dp[0][i] = mn[a[i]]+1;
        } else {
            dp[0][i] = dp[0][v[a[i]]+1];
        }
        v[a[i]] = i;
    }
    rep(i,49) rep(j,n+1) {
        dp[i+1][j] = dp[i][dp[i][j]];
    }
    int now = 0;
    k--;
    int pos = 0;
    while(k > 0) {
        if(k>>pos&1) {
            now = dp[pos][now];
            k -= 1LL<<pos;
        }
        pos++;
    }

    stack<int> sk;
    set<int> st;
    rep2(i,now,n) {
        if(st.count(a[i])) {
            while(true) {
                int l = sk.top();
                sk.pop();
                st.erase(l);
                if(l == a[i]) break;
            }
        } else {
            st.insert(a[i]);
            sk.push(a[i]);
        }
    }
    vi ans;
    while(sk.size()) {
        ans.pb(sk.top());
        sk.pop();
    }
    reverse(all(ans));
    for(int i : ans) cout << i << ' ';
    cout << endl;
}


Measured memory_bytes: 55828