akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
#include<string.h>
 
typedef long long int ll;
#define all(x) (x).begin(), (x).end()
 
using namespace std;

int nxt() {
    int x;
    cin >> x;
    return x;
}

ll nxtl(){
    ll x;
    cin>>x;
    return x;
}
 
void SieveOfEratosthenes(int n,vector <int> &primes) 
{ 
    // Create a boolean array "prime[0..n]" and initialize 
    // all entries it as true. A value in prime[i] will 
    // finally be false if i is Not a prime, else true. 
    bool prime[n+1]; 
    memset(prime, true, sizeof(prime)); 
  
    for (int p=2; p*p<=n; p++) 
    { 
        // If prime[p] is not changed, then it is a prime 
        if (prime[p] == true) 
        { 
            // Update all multiples of p greater than or  
            // equal to the square of it 
            // numbers which are multiple of p and are 
            // less than p^2 are already been marked.  
            for (int i=p*p; i<=n; i += p) 
                prime[i] = false; 
        } 
    } 
  
    // Print all prime numbers 
    for (int p=2; p<=n; p++) 
       if (prime[p]) 
          primes.push_back(p);
} 
 
ll max(ll a,ll b)
{
    if(a>b)
        return a;
    return b;
}
 
ll power(ll x, ll y,ll mod) 
{ 
    ll temp; 
    if( y == 0) 
        return 1; 
    temp = power(x, y/2,mod); 
    if (y%2 == 0) 
        return (temp*temp)%mod; 
    else
        return (((x*temp)%mod)*temp)%mod; 
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n=nxt(),m=nxt();
    vector <vector <int> > v;
    vector <int> row;
    vector <int> price(m);
    vector <int> num;
    num.resize(m,0);
    v.resize(m,row);
    for(int i=0;i<m;i++)
    {
        cin>>price[i];int x=nxt();
        v[i].resize(x);
        for(int j=0;j<x;j++){
            cin>>v[i][j];
            num[i]+=power(2,v[i][j]-1,1e9);
        }
    }

    int c=power(2,n,1e9);
    vector <vector <int> > dp;
    vector <int> row2(c);
    dp.resize(m,row2);
    dp[0][0]=0;
    //cout<<"came\n";
    for(int i=1;i<c;i++)
    {
        if(i&(~num[0]))
            dp[0][i]=-1;
        else
            dp[0][i]=price[0];

    }

    
    for(int i=1;i<m;i++)
    {
        dp[i][0]=0;
        for(int j=1;j<c;j++)
        {
            int x=dp[i-1][j];
            int y=dp[i-1][j&(~num[i])];
            if(x==-1&&y==-1)
                dp[i][j]=-1;
            else
            {
                if(x==-1)
                    dp[i][j]=y+price[i];
                else if(y==-1)
                    dp[i][j]=x;
                else
                    dp[i][j]=min(x,y+price[i]);
            }
            
        }
    }

    //for(int i=0;i<m;i++){
     //   for(int j=0;j<c;j++)
    //        cout<<dp[i][j]<<" ";
   //     cout<<endl;
   // }

    cout<<dp[m-1][c-1]<<endl;
    
    return 0;   
}


 
 


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

int main()
{
	int n, a, b;
	cin >> n >> a >> b;
	int sm,bi;

	if ( (a==1 && b==2) || (a==n && b==n-1) || (b == 1 && a == 2) || (b == n && a == n - 1))
	{
		cout << "Borys\n";
	}

	else
	{
		if ((max(a, b) - min(a, b) - 1) % 2 == 0)
		{
			cout << "Borys\n";
		}

		else
		{
			cout << "Alice\n";
		}
	}

	return 0;
}

Measured memory_bytes: 256
import random
def is_prime(q, k=5):
    q = abs(q)
    if q == 2: return True
    if q < 2 or q & 1 == 0: return False
    d = (q - 1) >> 1
    while d & 1 == 0:
        d >>= 1
    for i in range(k):
        a = random.randint(1, q - 1)
        t = d
        y = pow(a, t, q)
        while t != q - 1 and y != 1 and y != q - 1:
            y = pow(y, 2, q)
            t <<= 1
        if y != q - 1 and t & 1 == 0:
            return False
    return True

q = int(input())
l, r = [0]*q, [0]*q
for i in range(q):
    il, ir = map(int, input().split())
    l[i], r[i] = il, ir

cnt = [0] * (10**5+1)
cnt[0], cnt[1], cnt[2] = 0, 0, 0
for i in range(3, 10**5+1):
    if i % 2 == 0:
        cnt[i] = cnt[i-1]
    else:
        if is_prime(i):
            if is_prime((i+1)//2):
                cnt[i] = cnt[i-1] + 1
            else:
                cnt[i] = cnt[i-1]
        else:
            cnt[i] = cnt[i-1]

for i in range(q):
    print(cnt[r[i]] - cnt[l[i]-1])


Measured memory_bytes: 12972
#include <bits/stdc++.h>
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define sol (k+k)
#define sag (k+k+1)
#define orta ((bas+son)/2)
#define mod 1000000007
#define inf 1000000009
#define N 1000005
using namespace std;

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

int n, k, q, ek, a[N];

int main() {
	// freopen("in.txt", "r", stdin);
	// freopen("out.txt", "w", stdout);
	scanf("%d %d %d",&n ,&k, &q);
	for(int i = 1; i <= n; i++)
		a[i] = k;
	while(q--){
		int x;
		scanf("%d",&x);
		ek--;
		a[x]++;
	}
	for(int i = 1; i <= n; i++)
		a[i] += ek;
	for(int i = 1; i <= n; i++)
		if(a[i] <= 0)
			printf("No\n");
		else
			printf("Yes\n");
	return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
using ll = long long;

template <class T, class F>
T UpperBound(T i0, T i1, F f) {
    while (i0 < i1) {
        T i = i0 + (i1 - i0) / 2;
        if (f(i)) i0 = i + 1; else i1 = i;
    }
    return i0;
}

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

    int n;
    cin >> n;

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

    vector<int> b(a);
    sort(b.begin(), b.end());

    ll th = ((ll)n * (n + 1) / 2 + 1) / 2;
    vector<int> c(n * 2 + 1);

    auto h = UpperBound<int>(1, n, [&](auto h) {
        int j = b[h];
        ll r = 0;
        int s = n, t = 0;
        fill(c.begin(), c.end(), 0);
        c[s]++;
        t++;
        for (int i = 0; i < n; i++) {
            if (a[i] >= j) {
                t += c[++s];
            } else {
                t -= c[s--];
            }
            r += t;
            c[s]++;
            t++;
        }
        return r >= th;
    });

    cout << b[h - 1] << endl;

    return 0;
}

Measured memory_bytes: 1792
X = int(input())
for i in range(40):
  if i*i > X:
    a = i-1
    break
ans2 = a*a
for i in range(40):
  if i **3 > X:
    b = i-1
    break
ans3 = b**3
for i in range(40):
  if i **4 > X:
    b = i-1
    break
ans4 = b**4
for i in range(40):
  if i **5 > X:
    b = i-1
    break
ans5 = b**5
for i in range(40):
  if i **6 > X:
    b = i-1
    break
ans6 = b**6
for i in range(40):
  if i **7 > X:
    b = i-1
    break
ans7 = b**7
for i in range(40):
  if i **8 > X:
    b = i-1
    break
ans8 = b**8
for i in range(40):
  if i **9 > X:
    b = i-1
    break
ans9 = b**9
print(max(ans2,ans3,ans4,ans5,ans6,ans7,ans8,ans9))

Measured memory_bytes: 3064
#include <cstdio>
#include <algorithm>
#include <utility>
#include <vector>
#include <cstring>

using namespace std;

int n,p[2][2002],cache[2002][2002];
int ps[2][2002][4002];

int DP(int a,int b) {
	int &ret=cache[a][b];
	if(ret!=-1) return ret;

	if(a==n+1 && b==n+1) return ret=0;
	ret = 1e9;

	if(a<=n) ret = min(ret, DP(a+1,b) + ps[0][n][p[0][a]]-ps[0][a][p[0][a]] + ps[1][n][p[0][a]]-ps[1][b-1][p[0][a]]);
	if(b<=n) ret = min(ret, DP(a,b+1) + ps[1][n][p[1][b]]-ps[1][b][p[1][b]] + ps[0][n][p[1][b]]-ps[0][a-1][p[1][b]]);
	
	return ret;
}

int main() {
	scanf("%d",&n);
	for(int i=1;i<=n*2;i++) {
		char ch;
		int a,b;
		scanf(" %c %d",&ch,&b);
		if(ch=='W') a=0;
		else a=1;

		p[a][b] = i;
		ps[a][b][i] = 1;
	}
	for(int i=0;i<2;i++) for(int j=1;j<=n;j++) for(int k=1;k<=n*2;k++)
		ps[i][j][k] += ps[i][j-1][k] + ps[i][j][k-1] - ps[i][j-1][k-1];

	memset(cache,-1,sizeof(cache));
	printf("%d\n",DP(1,1));

	return 0;
}


Measured memory_bytes: 78720
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <iomanip>
#include <random>
#include <cstdio>
#include <cmath>
#include <climits>
#include <map>
#include <queue>
using namespace std;
typedef long long ll;
#define rep(i, n) for(int i = 0; i < (int) n; i++)

int main() {
    string s;
    cin >> s;
    if (s[2] == s[3] && s[4] == s[5]) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}

Measured memory_bytes: 256
/* ---------- STL Libraries ---------- */
// IO library
#include <cstdio>
#include <fstream>
#include <iomanip>
#include <ios>
#include <iostream>

// algorithm library
#include <algorithm>
#include <cmath>
#include <numeric>
#include <random>
#include <cstring>

// container library
#include <array>
#include <bitset>
#include <deque>
#include <map>
#include <unordered_map>
#include <queue>
#include <set>
#include <string>
#include <tuple>
#include <vector>
#include <stack>

/* ---------- Namespace ---------- */
using namespace std;

/* ---------- Type ---------- */
using ll = long long;
#define int ll
#define P pair<ll, ll>

/* ---------- Constants  */
const double PI = 3.141592653589793238462643383279;
const ll MOD = 1e9 + 7;
const int INF = 1LL << 55;

struct SegmentTree {
private:
    int n;
    vector<int> node;

public:
    SegmentTree(vector<int> v) {
        int sz = v.size();
        n = 1;
        while (n < sz) n *= 2;
        node.resize(2 * n - 1, INF);
        for (int i = 0; i < sz; i++) node[i + n - 1] = v[i];
        for (int i = n - 2; i >= 0; i--) node[i] = min(node[2 * i + 1], node[2 * i + 2]);
    }

    int getmin(int a, int b, int k = 0, int l = 0, int r = -1) {
        if (r < 0) r = n;
        if (r <= a || b <= l) return INF;
        if (a <= l && r <= b) return node[k];

        int vl = getmin(a, b, 2 * k + 1, l, (l + r) / 2);
        int vr = getmin(a, b, 2 * k + 2, (l + r) / 2, r);
        return min(vl, vr);
    }
};

/* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */
signed main() {
    int N, x;
    cin >> N >> x;
    vector<int> A(N);
    for (int i = 0; i < N; i++) cin >> A[i];

    SegmentTree sg = SegmentTree(A);

    int ret = INF;
    for (int i = 0; i < N; i++) {
        int cost = i * x;
        for (int j = 0; j < N; j++) { // [j, j + i]の区間で最小のAを選ぶ
            if (j + i < N) {
                cost += sg.getmin(j, i + j + 1);
            } else {
                cost += min(sg.getmin(j, N), sg.getmin(0, (j + i) % N + 1));
            }
        }
        ret = min(ret, cost);
    }
    cout << ret << endl;

    return 0;
}

Measured memory_bytes: 256
import numpy as np


class UnionFind:
    def __init__(self, n):
        self.table = [-1] * n

    def _root(self, x):
        stack = []
        tbl = self.table
        while tbl[x] >= 0:
            stack.append(x)
            x = tbl[x]
        for y in stack:
            tbl[y] = x
        return x

    def find(self, x, y):
        return self._root(x) == self._root(y)

    def unite(self, x, y):
        r1 = self._root(x)
        r2 = self._root(y)
        if r1 == r2:
            return
        d1 = self.table[r1]
        d2 = self.table[r2]
        if d1 <= d2:
            self.table[r2] = r1
            self.table[r1] += d2
        else:
            self.table[r1] = r2
            self.table[r2] += d1

    def get_size(self, x):
        return -self.table[self._root(x)]


n = int(input())
ppp = list(map(int, input().split()))
MOD = 10 ** 9 + 7
uft = UnionFind(n)
base = 0
undefined = []
for i, p in enumerate(ppp):
    if p == -1:
        undefined.append(i)
        continue
    p -= 1
    if not uft.find(i, p):
        base += 1
        uft.unite(i, p)

if len(undefined) == 0:
    print(base % MOD)
    exit()
elif len(undefined) == 1:
    c = uft.get_size(undefined[0])
    others = n - c
    print((base * (n - 1) + others) % MOD)
    exit()

m = len(undefined)
dp = np.zeros(m + 1, dtype=np.int64)  # 閉路のパターン数
dp[0] = 1
additional = 0  # 閉路を考慮せずに追加される辺数

for i in undefined:
    c = uft.get_size(i)
    dp[1:] += dp[:-1] * c
    dp %= MOD
    additional += n - c
dp = dp.tolist()

duplicated = 0
pat = pow(n - 1, m, MOD)
inv = pow(n - 1, MOD - 2, MOD)
loop_permutation = 1
loop_other_pattern = pat * inv * inv % MOD
for loop_size in range(2, m + 1):
    duplicated = (duplicated + dp[loop_size] * loop_permutation * loop_other_pattern) % MOD
    loop_other_pattern = loop_other_pattern * inv % MOD
    loop_permutation = loop_permutation * loop_size % MOD

ans = (base * pat + additional * pat * inv - duplicated) % MOD

print(ans)


Measured memory_bytes: 27688
import numpy as np

N = int(input())

A = list(map(int, input().split()))
A = np.array(A)
A_abs = np.abs(A)
M = np.sum(A_abs)
m = np.min(A_abs)

if np.sum(A < 0) % 2 == 0:
	print(M)
else:
	print(M - 2 * m)

Measured memory_bytes: 38108
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<long long> vll;
typedef vector<pair<int,int>> vp;
typedef pair<int,int> pii;
#define INF (int)(1e9)
#define MAXX 1.1529215e+18
#define inf 999999
#define EPS (1e-7)
#define rep(i,n) for(int i=0; i<(int)(n);i++)
#define REP(i,n) for(int i=1;i<=(int)(n);i++)
#define FOR(i,k,n) for(int i=(k);i<(int)(n);i++)
#define ALL(a)  a.begin(),a.end()
#define RALL(a) a.begin(),a.end(),greater<int>()
#define ROT(a) a.begin(),a.begin()+1,a.end()
#define RROT(a) a.begin(),a.end()-1,a.end()
#define PB push_back
#define MP make_pair
#define PI acos(-1.0)
#define sz(a) a.size()
const ll MOD = 1e9+7;
const int MAX = 10000000;
template<typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { if (a > b) { a = b; return 1; } return 0; }
template<typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { if (a < b) { a = b; return 1; } return 0; }
template<typename T> T gcd(T a, T b) { if (b == 0) return a; return gcd(b, a % b); }
//cout << 'H' << endl;
//next_permutation(ALL(p));
//typedef priority_queue<int> pque;//これは大きい順
//typedef priority_queue<int, vector<int>, greater<int>> pque;//これは小さい順
//factorizeは、素因数分解用の関数

int main(){
	int k,n;
	cin >> k >> n;
	vector<int> a(n);
	rep(i,n) cin >> a[i];
	sort(ALL(a));

	int max = 0;
	rep(i,n-1){
		chmax(max, a[i+1]-a[i]);
	}
	chmax(max, k-a[n-1]+a[0]);
	cout << k-max << endl;

  return 0;
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define Rint register int
using namespace std;
typedef long long LL;
const int N = 1 << 19, mod = 924844033, G = 5, Gi = 554906420;
int fac[N], invfac[N];
inline int kasumi(int a, int b){
	int res = 1;
	while(b){
		if(b & 1) res = (LL) res * a % mod;
		a = (LL) a * a % mod;
		b >>= 1;
	}
	return res;
}
inline void init(int m){
	fac[0] = 1;
	for(Rint i = 1;i <= m;i ++) fac[i] = (LL) i * fac[i - 1] % mod;
	invfac[m] = kasumi(fac[m], mod - 2);
	for(Rint i = m;i;i --) invfac[i - 1] = (LL) invfac[i] * i % mod;
}
int n, siz[N], A[N], B[N], head[N], to[N << 1], nxt[N << 1];
inline void add(int a, int b){
	static int cnt = 0;
	to[++ cnt] = b; nxt[cnt] = head[a]; head[a] = cnt;
}
inline void dfs(int x, int f = 0){
	siz[x] = 1;
	for(Rint i = head[x];i;i = nxt[i])
		if(to[i] != f){
			dfs(to[i], x);
			siz[x] += siz[to[i]];
		}
}
int rev[N];
inline int calrev(int len){
	int limit = 1, L = -1;
	while(limit <= len){limit <<= 1; L ++;}
	for(Rint i = 0;i < limit;i ++) rev[i] = (rev[i >> 1] >> 1) | ((i & 1) << L);
	return limit;
}
inline void NTT(int *A, int limit, int type){
	for(Rint i = 0;i < limit;i ++)
		if(i < rev[i]) swap(A[i], A[rev[i]]);
	for(Rint mid = 1;mid < limit;mid <<= 1){
		int Wn = kasumi(type == 1 ? G : Gi, (mod - 1) / (mid << 1));
		for(Rint j = 0;j < limit;j += mid << 1){
			int w = 1;
			for(Rint k = 0;k < mid;k ++, w = (LL) w * Wn % mod){
				int x = A[j + k], y = (LL) w * A[j + k + mid] % mod;
				A[j + k] = (x + y) % mod;
				A[j + k + mid] = (x - y + mod) % mod;
			}
		}
	}
	if(type == -1){
		int inv = kasumi(limit, mod - 2);
		for(Rint i = 0;i < limit;i ++) A[i] = (LL) A[i] * inv % mod;
	}
}
int main(){
	scanf("%d", &n);
	init(n << 1);
	for(Rint i = 1;i < n;i ++){
		int x, y;
		scanf("%d%d", &x, &y);
		add(x, y); add(y, x);
	}
	dfs(1);
	for(Rint i = 2;i <= n;i ++) ++ A[siz[i]], ++ A[n - siz[i]];
	for(Rint i = 0;i <= n;i ++){
		A[i] = (LL) A[i] * fac[i] % mod;
		B[i] = invfac[n - i];
	}
	int limit = calrev(n << 1);
	NTT(A, limit, 1); NTT(B, limit, 1);
	for(Rint i = 0;i < limit;i ++) A[i] = (LL) A[i] * B[i] % mod;
	NTT(A, limit, -1);
	for(Rint i = n + 1;i <= (n << 1);i ++) printf("%d\n", ((LL) n * fac[n] % mod * invfac[i - n] % mod * invfac[(n << 1) - i] % mod - (LL) A[i] * invfac[i - n] % mod + mod) % mod);
}

Measured memory_bytes: 24448
#include <ctype.h>
#include <string.h>
#include <stdio.h>
#define N 1005

char G[N][N];
int row, col, n, dir[2][4], vis[N][N];

typedef struct { int r, c;} point;
point que[1000005], ps[10];

int in(point p) {
    return 0 <= p.r && p.r < row && 0 <= p.c && p.c < col;
}

int bfs(point s, point t) {
    int head = 0, tail = 1;
    for (int i = 0; i < row; ++i) memset(vis[i], -1, col * sizeof(int));
    vis[s.r][s.c] = 0;
    for (que[0] = s; head != tail;) {
        point p = que[head++];
        for (int i = 0; i < 4; ++i) {
            point near = {p.r + dir[0][i], p.c + dir[1][i]};
            if (in(near) && G[near.r][near.c] != 'X' && vis[near.r][near.c] < 0) {
                vis[near.r][near.c] = vis[p.r][p.c] + 1;
                if (near.r == t.r && near.c == t.c) return vis[near.r][near.c];
                que[tail++] = near;
            }
        }
    }
    return -1;
}

int solve(void) {
    int ans = 0;
    for (int i = 0; i < row; ++i) {
        for (int j = 0; j < col; ++j) {
            if (isdigit(G[i][j])) ps[G[i][j] - '0'] = (point){i, j};
            else if (G[i][j] == 'S') ps[0] = (point){i, j};
        }
    }
    for (int i = 0; i < n - 1; ++i) ans += bfs(ps[i], ps[i+1]);
    return ans;
}

int main(void) {
    dir[0][0] = dir[1][2] = 1;
    dir[0][1] = dir[1][3] = -1;
    scanf("%d%d%d", &row, &col, &n); ++n;
    for (int i = 0; i < row; ++i) scanf("%s", G[i]);
    printf("%d\n", solve());
}


Measured memory_bytes: 9652
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <sstream>
#include <stack>
#include <string>
#include <unordered_set>
#include <vector>

using namespace std;

#define ll long long
#define P pair<int, int>
#define FOR(i, N) for (int i = 0; i < (int)N; i++)
#define FORIN(i, a, b) for (int i = a; i < (int)b; i++)
#define ALL(x) (x).begin(), (x).end()
#define LAST(x) (x)[(x).size() - 1]
#define GI(name) \
  int(name);     \
  scanf("%d", &(name))
#define GI2(name1, name2) \
  int(name1), (name2);    \
  scanf("%d %d", &(name1), &(name2))
#define GI3(name1, name2, name3) \
  int(name1), (name2), (name3);  \
  scanf("%d %d %d", &(name1), &(name2), &(name3))
#define GVI(name, size)    \
  vector<int>(name)(size); \
  FOR(i, (size)) scanf("%d", &(name)[i])
#define GS(name) \
  string(name);  \
  cin >> (name);
#define MOD 1000000007
#define DEBUG(...) debug(__LINE__, ":" __VA_ARGS__)

string to_string(string s) {
  return s;
}

template <class T>
string to_string(vector<T> v) {
  string ret = "{";
  FOR(i, v.size() - 1) { ret += to_string(v[i]) + ","; }
  if (v.size() > 0) {
    ret += to_string(LAST(v));
  }
  ret += "}";
  return ret;
}

void debug() {
  cerr << endl;
}

template <class Head, class... Tail>
void debug(Head head, Tail... tail) {
  cerr << to_string(head) << " ";
  debug(tail...);
}

void print() {
  cout << endl;
}

template <class Head, class... Tail>
void print(Head head, Tail... tail) {
  cout << to_string(head);
  print(tail...);
}

int main() {
  GI2(N, M);
  vector<int> cnt(N, 1), prov(N);
  prov[0] = 1;
  FOR(i, M) {
    GI2(x, y);
    x--;
    y--;
    if (prov[x] == 1 && cnt[x] == 1) {
      prov[x] = 0;
      prov[y] = 1;
    } else if (prov[x] == 1 && cnt[x] > 1) {
      prov[y] = 1;
    }
    cnt[x]--;
    cnt[y]++;
  }
  int ans = 0;
  FOR(i, N) if (prov[i]) ans++;
  print(ans);
  return 0;
}

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

a, b, c = 0, 0, 0

for e in A:
    if e % 2 == 0:
        if e % 4 == 0:
            c += 1
        else:
            b += 1
    else:
        a += 1

print('Yes' if c - a + (b == 0) >= 0 else 'No')


Measured memory_bytes: 14252
from fractions import gcd

n=int(input())
a_1=list(map(int,input().split()))
a_2=list(reversed(a_1))
l=[0]
r=[0]

for i in range(n):
    l.append(gcd(l[i],a_1[i]))  

for i in range(n):    
    r.append(gcd(r[i],a_2[i]))
    
r=list(reversed(r))

m=[]
for i in range(n):
   m.append(gcd(l[i],r[i+1])) 

print(max(m))


Measured memory_bytes: 16152
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>

using namespace std;

/*
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;
*/

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

/*
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()
*/

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-9;

void solve() {
    string s;
    cin >> s;
    int n = s.size();
    bool first = false;
    if(s[0] == s[n - 1] && n % 2 == 0) first = true;
    else if(s[0] != s[n - 1] && n % 2 == 1) first = true;
    cout << (first ? "First" : "Second") << endl; 
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}


Measured memory_bytes: 512
import itertools

N = int(input())

ans = 0
for i in range(3, len(str(N))+1) :
    for ptn in itertools.product([3,5,7], repeat = i) :
        if (3 not in ptn) or (5 not in ptn) or (7 not in ptn) :
            continue
        p = int("".join(list(map(str,ptn))))
        if p <= N :
            ans += 1
print(ans)


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

int main(){
	int A[5][4][11], n;
	for ( int i = 1; i <= 4; i++ )
	for ( int j = 1; j <= 3; j++ )
	for ( int k = 1; k <= 10; k++ ) A[i][j][k] = 0;

	cin >> n;
	for ( int i = 0; i < n; i++ ){
		int b, f, r, v;
		cin >> b >> f >> r >> v;
		A[b][f][r] += v;
	}
	
	for ( int f = 1; f <= 4; f++ ){
		if ( f > 1 ) cout << "####################\n";
		for ( int b = 1; b <= 3; b++ ){
			for ( int r = 1; r <= 10; r++ ) {
				cout << " " << A[f][b][r];
			}
			cout << endl;
		}
	}
	
	return 0;
}


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

int main(){
    int W,H,N;
    cin>>W>>H>>N;
    int count = 0;//白の面積
    vector<vector<string>>data(W,vector<string>(H));
    for(int w = 0;w < W;w++){
        for(int h = 0;h < H;h++){
            data.at(w).at(h) = "白";
        }
    }
    for(int i = 0;i < N;i++){//長方形の色をぬりつぶす処理
        vector<int> a(3);
        for(int i = 0;i < 3;i++){
            cin>>a.at(i);
        }
        if(a.at(2) == 1){//パターン１の処理
            for(int w = 0;w < a.at(0);w++){
                for(int h = 0;h < H;h++){
                    data.at(w).at(h) = "黒";
                }
            }
        }
        if(a.at(2) == 2){//パターン２の処理
            for(int w = 0;w < W;w++){
                for(int h = 0;h < H;h++){
                    if(w >= a.at(0)){
                        data.at(w).at(h) = "黒";
                    }
                }
            }
        }
        if(a.at(2) == 3){//パターン３の処理
            for(int w = 0;w < W;w++){
                for(int h = 0;h < a.at(1);h++){
                    data.at(w).at(h) = "黒";
                }
            }
        }
        if(a.at(2) == 4){//パターン４の処理
            for(int w = 0;w < W;w++){
                for(int h = 0;h < H;h++){
                    if(h >= a.at(1)){
                        data.at(w).at(h) = "黒";
                    }
                }
            }
        }
    }
    for(int w = 0;w < W;w++){//白の面積を求める処理
        for(int h = 0;h < H;h++){
            if(data.at(w).at(h) == "白"){
                count++;
            }
        }
    }
    cout<<count<<endl;
}

Measured memory_bytes: 3896
from collections import deque
d = deque()

n = int(input())
a = list(input().split())

for i in range(n):
    if i%2 ==0:
        d.append(a[i])
    else:
        d.appendleft(a[i])
if n%2 == 1:
    d.reverse()
print(" ".join(d))

Measured memory_bytes: 26564
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>
#define cases long long t;cin>>t;while(t--)
#define f_io ios::sync_with_stdio(false); cin.tie(0)
#define foi(a,n) for(long long i=a;i<n;i++)
#define foj(a,n) for(long long j=a;j<n;j++)
#define fok(a,n) for(long long k=a;k<n;k++)
#define ll long long
#define MOD 1000000007
#define INF 1000000000
using namespace std;
//using namespace __gnu_pbds;
//typedef tree<ll,null_type,less<ll>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;

int main()
{
    f_io;
    ll a,b,c;
    cin >> a >> b >> c;
    swap(a,b);
    swap(a,c);
    cout << a <<" "<< b<<" " << c;
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <iomanip>
#include <cstring>
#include <string.h>
#include <iterator>
#include <math.h>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
#include <tuple>
#include <limits.h>
#include <string>
#include <bitset>
#include <map>
#include <numeric>
#include<unordered_map>


#define endl cout<<"\n"
#define lli long long int
#define ld long double
#define M_PI (3.14159265358979323846264338327950288)
#define MOD (1000000007)

using namespace std;

//fast-exponentiation-lli
unsigned lli expo_fast(lli a, lli b) {
	a = a;
	lli result = 1;
	while (b) {
		//multiplyint(tos(result), a);
		if (b & 1)result = (result * a);
		b >>= 1;
		a = (a*a);
	}
	return (result);
}


void take_in(vector<lli> *arr) {
	for (int i = 0; i < arr->size(); i++)cin >> (*(arr))[i];
}


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

}

/* Iterative Function to calculate (x^y)%p in O(log y) */
unsigned lli power(lli x, unsigned lli y, lli p)
{
	lli res = 1;      // Initialize result 
	x = x % p;  // Update x if it is more than or equal to p 
	while (y > 0) {
		// If y is odd, multiply x with result 
		if (y & 1)res = (res*x) % p;
		// y must be even now 
		y = y >> 1;
		x = (x*x) % p;
	}
	return res;
}

char c[1001][1001];

int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	int n, m; cin >> n >> m;
	vector<vector<lli>> dp(n + 1, vector<lli>(m + 1,0));
	dp[1][1] = 1;
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			cin >> c[i][j];
		}
	}
	for (int i = 1; i <= n; i++) {
		for (int j = 1; j <= m; j++) {
			if (i == 1 && j == 1)continue;
			if (c[i][j] == '#') {
				dp[i][j] = 0;
				continue;
			}
			dp[i][j] = ((i > 1) ? dp[i - 1][j] : 0) + ((j > 1) ? dp[i][j - 1] : 0);
			dp[i][j] %= MOD;
		}
	}
	cout << dp[n][m];
	//system("PAUSE");
}


Measured memory_bytes: 9088
import java.util.Scanner;
class Main
{
	public static void main(String[] args)
	{
		Scanner scan=new Scanner(System.in);

		while(true)
		{
			int a=scan.nextInt();
			String op=scan.next();
			int b=scan.nextInt();

			if(op.equals("?"))
			{
				break;
			}
			else if(op.equals("+"))
			{
				System.out.println(a+b);
			}
			else if(op.equals("-"))
			{
				System.out.println(a-b);
			}
			else if(op.equals("*"))
			{
				System.out.println(a*b);
			}
			else if(op.equals("/"))
			{
				System.out.println(a/b);
			}
		}
	}
}

Measured memory_bytes: 26180
#include <iostream>
#include <vector>
#include <array>
#include <list>
#include <queue>
#include <set>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <string>
#include <sstream>
#include <algorithm>
#include <random>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <cassert>
#include <climits>
#include <bitset>

#define FOR_LT(i, beg, end) for (int i = beg; i < end; i++)
#define FOR_LE(i, beg, end) for (int i = beg; i <= end; i++)
#define FOR_DW(i, beg, end) for (int i = beg; end <= i; i--)

using namespace std;

int ath[100001] = { 0 };
int bth[100001] = { 0 };

struct Demand {
	int a;
	int b;
};

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

	vector<Demand> demands;
	FOR_LT(i, 0, m) {
		int a, b; cin >> a >> b;
		ath[a]++;
		bth[b]++;

		demands.push_back({ a,b });
	}
	sort(demands.begin(), demands.end(), [](const auto& l, const auto& r) {
		return l.a < r.a;
	});

	int ans = 0;
	FOR_LE(i, 2, n) {
		if (bth[i] != 0) {
			ans++;

			auto it = demands.begin();
			while (it != demands.end() && it->a < i) {
				ath[it->a]--;
				bth[it->b]--;

				it++;
			}

			demands.erase(demands.begin(), it);
		}
	}

	cout << ans << endl;


	return 0;
}

Measured memory_bytes: 2168
#ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#pragma comment(linker, "/STACK:268435456")
#pragma warning( disable : 6031)
#pragma warning( disable : 4244)
#pragma warning( disable : 26451)
#endif
#ifndef _MSC_VER
#pragma GCC target ("sse4.2")
#endif
#ifdef _MSC_VER
#  include <intrin.h>
#  define __builtin_popcount __popcnt
#  define __builtin_popcountll __popcnt64
#endif
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <cstdint>
#include <climits>
#include <cassert>
#include <string>
#include <vector>
#include <iostream>
#include <map>
#include <stack>
#include <set>
#include <queue>
#include <numeric>
#include <algorithm>
#include <random>
#include <utility>
#include <bitset>
#include <cmath>
#include <sstream>
#include <functional>
#include <iomanip>
#include <random>
#include <unordered_map>
#include <unordered_set>
#include <chrono>
#include <array>

#define all(a) (a).begin(),(a).end()
#define sz(a) (int)(a).size()
#define eps (1e-15)
#define ar array

using namespace std;

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

typedef long long ll;
typedef vector<int> vi;
typedef vector< vi > vvi;
typedef vector<double> vd;
typedef vector< vd > vvd;
typedef vector< string > vs;
typedef pair< int, int > pii;
typedef pair<ll, ll> pll;
typedef vector< pii > vpii;
typedef vector< pll > vpll;
typedef vector<ll> vl;
typedef vector<vector<long long>> vvl;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef tuple<int, int, int> tiii;
const long long mod = int(1e9) + 7;
const int INF = 1e9;
const ll LINF = 1e18;


int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cout << setprecision(18) << fixed;
#ifdef LOCAL_MACHINE
	freopen("input.txt", "rt", stdin);
	freopen("output.txt", "wt", stdout);
#endif
	int n;
	cin >> n;
	string s;
	cin >> s;
	int wc = 0, rc = 0;
	for (auto& c : s) {
		if (c == 'W')
			wc++;
		else
			rc++;
	}
	int res = min(wc, rc);
	int cnt1 = 0, cnt2 = 0;;
	for (int i = 0; i < rc; i++)
		if (s[i] == 'W')
			cnt1++;

	for (int i = 0; i < wc; i++) {
		if (s[n - i - 1] == 'R')
			cnt2++;
	}
	res = min(res, cnt1);
	res = min(res, cnt2);
	cout << res;
	return 0;
}

Measured memory_bytes: 3780
n = int(input())
p = [float(x) for x in input().split()]

dp = [[0 for _ in range(n+1)] for __ in range(n+1)]

dp[0][0] = 1

for i in range(1,n+1):
    for j in range(i+1):
        if j == 0:
            dp[i][j] = (1-p[i-1])*dp[i-1][j]
        else:
            dp[i][j] = (1-p[i-1])*dp[i-1][j] + p[i-1]*dp[i-1][j-1]

print(sum(dp[n][(n+1)//2:]))



Measured memory_bytes: 261512
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long a, b, c, d;
    long long ans=0;
    cin >> a >> b >> c >> d;
    ans += (b/c - (a - 1)/c);
    ans += (b/d - (a - 1)/d);
    long long k;
    long long r;
    r = c * d;
    if(d>c)
        swap(d, c);
    while(k=c%d){
        c = d;
        d = k;
    }
    r = r / d;
    ans -= (b/r - (a - 1)/r);
    ans = (b - a + 1) - ans;
    cout << ans << endl;
}


Measured memory_bytes: 256
//#pragma GCC optimize(2)
//#pragma GCC optimize(3)
//#pragma GCC optimize(4)
//#pragma GCC optimize("unroll-loops")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC optimize("Ofast,no-stack-protector")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include<bits/stdc++.h>
//#include <bits/extc++.h>
#define fi first
#define se second
#define db double
#define mp make_pair
#define pb push_back
#define mt make_tuple
#define pi acos(-1.0)
#define ll long long
#define vi vector<int>
#define mod 1000000007
#define ld long double
//#define C 0.5772156649
#define ls l,m,rt<<1
#define rs m+1,r,rt<<1|1
#define pll pair<ll,ll>
#define pil pair<int,ll>
#define pli pair<ll,int>
#define pii pair<int,int>
#define ull unsigned long long
#define bpc __builtin_popcount
//#define base 1000000000000000000
#define fin freopen("a.txt","r",stdin)
#define fout freopen("a.txt","w",stdout)
#define fio ios::sync_with_stdio(false);cin.tie(0)
#define mr mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
inline ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
inline void sub(ll &a,ll b){a-=b;if(a<0)a+=mod;}
inline void add(ll &a,ll b){a+=b;if(a>=mod)a-=mod;}
template<typename T>inline T const& MAX(T const &a,T const &b){return a>b?a:b;}
template<typename T>inline T const& MIN(T const &a,T const &b){return a<b?a:b;}
inline ll qp(ll a,ll b){ll ans=1;while(b){if(b&1)ans=ans*a%mod;a=a*a%mod,b>>=1;}return ans;}
inline ll qp(ll a,ll b,ll c){ll ans=1;while(b){if(b&1)ans=ans*a%c;a=a*a%c,b>>=1;}return ans;}

using namespace std;
//using namespace __gnu_pbds;

const ull ba=233;
const db eps=1e-6;
const ll INF=0x3f3f3f3f3f3f3f3f;
const int N=300000+10,maxn=10000000+10,inf=0x3f3f3f3f;

int s[20][20],p[20];
int main()
{
    int n,m;scanf("%d%d",&n,&m);
    for(int i=1;i<=m;i++)
    {
        int k;scanf("%d",&k);
        while(k--)
        {
            int x;scanf("%d",&x);
            s[i][--x]=1;
        }
    }
    for(int i=1;i<=m;i++)scanf("%d",&p[i]);
    int ans=0;
    for(int i=0;i<(1<<n);i++)
    {
        bool ok=1;
        for(int j=1;j<=m;j++)
        {
            int f=0;
            for(int k=0;k<n;k++)if(((i>>k)&1)&&s[j][k])f^=1;
            if(f!=p[j])ok=0;
        }
        if(ok)ans++;
    }
    printf("%d\n",ans);
    return 0;
}
/********************

********************/


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

int n, s, mx, t1, t2;
int main()
{
	int i;
	cin >> n;
	for (i = 1; i <= n; i++) {
		scanf ("%d %d", &t1, &t2);
		if (t1 == t2) s++;
		else s = 0;
		mx = max(mx, s);
	}
	if (mx >= 3) cout << "Yes" <<endl;
	else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3756
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <cmath>
#include <random>
#include <iomanip>
#include <functional>
#include <list>
using namespace std;

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

	int cnt[505][505] = {};
	for (int train = 0; train < m; train++)
	{
		int l, r;
		cin >> l >> r;
		cnt[l][r]++;
	}

	for (int sz = 1; sz < n; sz++)
		for (int l = 1; l <= n; l++)
		{
			int r = l + sz;
			cnt[l][r] += cnt[l + 1][r] + cnt[l][r - 1] - cnt[l + 1][r - 1];
		}

	while (q--)
	{
		int l, r;
		cin >> l >> r;

		cout << cnt[l][r] << '\n';
	}
}


Measured memory_bytes: 1920
#include <iostream>
#include <climits>
#include <stack>
#include <queue>
#include <string>
#include <random>
#include <utility>
#include <cmath>
#include <string.h>
#include <iomanip>
#include <stdlib.h>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
struct edge{int to,cost;};
vector<int> G[100005];
 
long long int n,m,i,j=1,t;
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1,};
 
std::vector<P> tree[100010];
long long int dp[100005];
bool used[100005];
char s[100005];
ll ans=0;
bool flag=false;





int main(){
	cin>>s;
	n=strlen(s);
	for(i=0;i<n-2;i++){
		if(s[i]==s[i+1] || s[i]==s[i+2] || s[i+1]==s[i+2]){
			flag = true;
			break;
		}
	}
	if(n==2 && s[0]==s[1])cout<<1<<" "<<2;
	else if(flag){
		cout<<i+1<<" "<<i+3;
	}else{
		cout<<-1<<" "<<-1;
	}
	cout<<endl;
	return 0;
}

Measured memory_bytes: 4992
#include <stdio.h>
#include <string.h>
int main(){
  int n,m,i,j;
  char s[101][101],t[101][101];
  scanf("%d",&n);
  for(i=0;i<n;i++){
      scanf("%s",s[i]);
  }
  scanf("%d",&m);
  for(i=0;i<m;i++){
      scanf("%s",t[i]);
  }
  int ans=0;
  for(i=0;i<n;i++){
      int cnt=0;
      for(j=0;j<n;j++){
          if(strcmp(s[i],s[j])==0){
              cnt++;
          }
      }
      for(j=0;j<m;j++){
          if(strcmp(s[i],t[j])==0){
              cnt--;
          }
      }
      if(cnt>ans){
          ans=cnt;
      }
  }
  printf("%d",ans);
    return 0;
}

Measured memory_bytes: 128
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int H = sc.nextInt();
		int W = sc.nextInt();
		char a[][] = new char[H][W];
		for (int i=0;i<H;i++) {
			String s= sc.next();
			for (int j=0;j<W;j++) {
				a[i][j] = s.charAt(j);
			}
		}
		int c[][] = new int[H][W];
		if (a[0][0]=='#') {
			c[0][0] =1;
		}
		for (int i=1;i<H;i++) {
			if (a[i][0]!='#'||a[i-1][0]=='#') {
				c[i][0] = c[i-1][0];
			} else {
				c[i][0] = c[i-1][0] +1;
			}
		}
		for (int i=1;i<W;i++) {
			if (a[0][i]!='#'||a[0][i-1]=='#') {
				c[0][i] = c[0][i-1];
			} else {
				c[0][i] = c[0][i-1] +1;
			}
		}
		for (int i=1;i<H;i++) {
			for (int j=1;j<W;j++) {
				int left=c[i][j-1];
				int up = c[i-1][j];
				if (a[i][j]!='#') {
					c[i][j]=Math.min(c[i-1][j], c[i][j-1]);
				} else  {
					if (a[i-1][j] != '#') {
						up = c[i-1][j] +1;
					}
					if (a[i][j-1] != '#') {
						left = c[i][j-1] +1;
					}
					c[i][j]=Math.min(up,left);
				}
			}
		}
		System.out.println(c[H-1][W-1]);

	}


}

Measured memory_bytes: 22356
#include<iostream>
#include<string>
using namespace std;
string ch;
int cnts,cnt;
int main(){
	cin>>ch;
	int i=0;
	for(int i=0;i<ch.length();i++){
		if(ch[i]=='S'){
			cnts++;
		}
		if(cnts&&ch[i]=='T'){
			cnts--;
			cnt+=2;
		}
	}
	cout<<ch.length()-cnt<<endl;
	return 0;
}

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

using namespace std;

int main()
{
    int n;
    cin>>n;
    n=n%10;
    if(n==2||n==4||n==5||n==7||n==9)
        cout<<"hon"<<endl;
    else
        if(n==0||n==1||n==6||n==8)
        cout<<"pon"<<endl;
    else
        cout<<"bon"<<endl;
}


Measured memory_bytes: 3632
N,x = map(int,input().split())
a = [0] + list(map(int,input().split()))
b = [0]
for i in range(1,N):
  b.append(a[i]+a[i+1])

cnt = 0  
for i in range(1,N):
  if b[i] > x:
    c = b[i] - x
    if a[i+1] >= c:
      cnt += c
      if i+1 <= N-1:
        b[i+1] -= c
    else:
      if i+1 <= N-1:
        b[i+1] -= a[i+1]
      cnt += c
print(cnt)    

Measured memory_bytes: 14252
n = int(input())
c = []
s = []
f = []
for i in range(n - 1):
    C, S, F = map(int, input().split())
    c.append(C)
    s.append(S)
    f.append(F)
for i in range(n - 1):
    ans = 0
    for j in range(i, n - 1):
        if ans < s[j]:
            ans = s[j]
        elif ans % f[j] == 0:
            pass
        else:
            ans += f[j] - ans % f[j]
        ans += c[j]
    print(ans)
print(0)


Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2e5+5;
int n,a[N],f,zero,z;
vector<int>v1,v2;
int main()
{
    scanf("%d",&n);
    for(int i=1;i<=n;i++) scanf("%d",&a[i]),a[i]-=i;
    ll ans=0;
    for(int i=1;i<=n;i++) ans+=abs(a[i]);
    for(int i=1;i<=n;i++)
        if(a[i]<0) v1.push_back(-a[i]);
        else if(a[i]>0) v2.push_back(a[i]);
        else zero++;
    sort(v1.begin(),v1.end());
    sort(v2.begin(),v2.end());
    if(v1.size()>v2.size()+zero)
    {
        int tep=v2.size()+zero,thi=v1.size(),res=0;
        for(int i=0;i<v1.size();i++)
        {
            if(thi<=tep) break;
            ans-=(ll)(thi-tep)*(v1[i]-res);
            thi--;tep++;
            res=v1[i];
        }
    }
    else if(v2.size()>v1.size()+zero)
    {
        int tep=v1.size()+zero,thi=v2.size(),res=0;
        for(int i=0;i<v2.size();i++)
        {
            if(thi<=tep) break;
            ans-=(ll)(v2[i]-res)*(thi-tep);
            thi--;tep++;
            res=v2[i];
        }
    }
    printf("%lld\n",ans);
}


Measured memory_bytes: 2168
#include<iostream>
using namespace std;
int main(){
  int day,mmax,jmax;
  int j,m,jd=0,md=0;
  cin>>day>>jmax>>mmax>>j>>m;
  while(1){
    jmax-=j;
    jd++;
    if(jmax<=0){
      break;
    }
  }while(1){
    mmax-=m;
    md++;
    if(mmax<=0){
      break;
    }
  }
  if(jd>=md){
    day-=jd;
  }if(jd<md){
    day-=md;
  }
  cout<<day<<endl;
  return 0;
}

Measured memory_bytes: 1160
import math

def judgePrimeNumber(n):
    if n == 1:
        return False

    for k in range(2, int(math.sqrt(n)) + 1):
        if n % k == 0:
            return False

    return True

X = int(input())

while judgePrimeNumber(X) == False:
    if X % 2 == 0:
        X += 1
    else:
        X += 2

print(X)

Measured memory_bytes: 3060
#include<iostream>
#include<algorithm>
using namespace std;
int main(){
	int a[10];
	for(int i=0;i<10;i++)cin>>a[i];
	int t=90000;
	for(int i=t;i;i--){
		for(int j=i;j;j--){
			if(i+j==2)sort(a,a+10);
		}
	}
	for(int i=9;i>6;i--)cout<<a[i]<<endl;
	return 0;
}

Measured memory_bytes: 3132
#include<iostream>
using namespace std;
int main(){
    int n,m,l;
    cin >> n >> m >> l;
    long A[100][100],B[100][100],C[100][100];
    for(int i = 0;i < n; i ++){
        for(int j = 0; j < m; j ++){
            cin >> A[i][j];
        }
    }
    for(int i = 0;i < m; i ++){
        for(int j = 0; j < l; j ++){
            cin >> B[i][j];
        }
    }
    for(int i = 0;i < n; i ++){
        for(int j = 0; j < l; j ++){
            C[i][j] = 0;
            for(int k = 0; k < m; k ++){
                C[i][j] += A[i][k]*B[k][j];
            }
        }
    }
    for(int i = 0;i < n; i ++){
        for(int j = 0; j < l; j ++){
            if (j == l-1) cout << C[i][j] << endl;
            else cout << C[i][j] << " ";
        }
    }  
    return 0;
}


Measured memory_bytes: 3304
#include <cctype>
#include <iostream>
#include <string>
using namespace std;

int main() {
	string s;
	int K;
	cin >> s >> K;
	for (char& i : s) {
		if (i != 'a' && 'z' + 1 - i <= K) {
			K -= 'z' + 1 - i;
			i = 'a';
		}
	}
	s.back() = (s.back() - 'a' + K) % 26 + 'a';
	cout << s;
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
//#include <boost/multiprecision/cpp_int.hpp>
//namespace mp = boost::multiprecision;

using namespace std;

const double PI = 3.14159265358979323846;
typedef long long ll;
const double EPS = 1e-9;
#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
typedef pair<ll, ll> P;
const ll INF = 10e17;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
#define ret() return 0;

double equal(double a, double b) {
    return fabs(a - b) < DBL_EPSILON;
}

std::istream &operator>>(std::istream &in, set<int> &o) {
    int a;
    in >> a;
    o.insert(a);
    return in;
}

std::istream &operator>>(std::istream &in, queue<int> &o) {
    ll a;
    in >> a;
    o.push(a);
    return in;
}

bool contain(set<int> &s, int a) { return s.find(a) != s.end(); }

//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
//const ll mod = 1e10;

typedef priority_queue<ll, vector<ll>, greater<ll> > PQ_ASK;

int main() {
    int n;
    cin >> n;
    vector<ll> v(n);
    rep(i, n) cin >> v[i];

    v.erase(unique(v.begin(), v.end()), v.end());
    n = v.size();

    if (n == 1) {
        cout << 1000 << endl;
        ret();
    }

    vector<ll> yens = {1000}, stocks = {0};

    rep(i, n) {
        if (i == n - 1 || v[i] > v[i + 1]) {
            ll addYen = stocks.back() * v[i];
            yens.push_back(yens.back() + addYen);
            stocks.push_back(0);
        } else {
            ll addStock = yens.back() / v[i];
            yens.push_back(yens.back() - v[i] * addStock);
            stocks.push_back(stocks.back() + addStock);
        }
    }
    ll ans = *max_element(yens.begin(), yens.end());
    cout << ans << endl;

}


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

#define sz(x) (int)x.size() 
#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--) 

#ifdef LOCAL
#define err(...) fprintf(stderr, __VA_ARGS__)
#else
#define err(...) while(false) {}
#endif

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

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

int const MAX = 1e5 + 41;
int const INF = 1e9 + 41;

int n;
int a[MAX];

void solve() {
	map<int, int> q1, q2;
	for (int i = 1; i <= n; i += 2) {
		q1[a[i]]++;
	}
	for (int i = 2; i <= n; i += 2) {
		q2[a[i]]++;
	}

	vpii v1, v2;
	for (auto z : q1) {
		v1.pb(mp(z.second, z.first));
	}
	for (auto z : q2) {
		v2.pb(mp(z.second, z.first));
	}

	v1.pb(mp(0, -1));
	v2.pb(mp(0, -2));

	sort(v1.begin(), v1.end());
	sort(v2.begin(), v2.end());

	int ans = INF;

	fi(0, 1) {
		fj(0, 1) {
			int x = v1[sz(v1) - 1 - i].second;
			int y = v2[sz(v2) - 1 - j].second;
			if (x == y) continue;
			int cur1 = (n + 1) / 2 - v1[sz(v1) - 1 - i].first;
			int cur2 = n / 2 - v2[sz(v2) - 1 - j].first; 
			int cur = cur1 + cur2;
			ans = min(ans, cur);
		}
	}
	printf("%d\n", ans);
}

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

	scanf("%d", &n);
	fi(1, n) {
		scanf("%d", &a[i]);
	}
	solve();		

	
#ifdef LOCAL
	err("ELAPSED TIME: %.3Lf\n", (ld) clock() / CLOCKS_PER_SEC);
#endif	
	
	return 0;
}

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

#define watch(x) cout << (#x) << " is " << (x) << "\n"
#define watch2(x,y) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<"\n"
#define watch3(x,y,z) cout <<(#x)<<" is "<<(x)<<" and "<<(#y)<<" is "<<(y)<<" and "<<(#z)<<" is "<<(z)<<"\n"

#define ll long long
#define ff first
#define ss second
#define null NULL
#define all(c) (c).begin(),(c).end()
#define nl "\n"

#define ld long double
#define eb emplace_back
#define pb push_back
#define pf push_front
#define mod 1000000007

typedef vector<ll> vl;
typedef vector< vl > vvl;
typedef pair< ll, ll> pll;
typedef map< ll, ll> mll;

#define pie_value 3.14159265358979323846

int main() {

	// Use ctrl+shift+b ( second option )
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);

#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	freopen("error.txt" , "w" , stderr);
#endif

	string s, t;
	cin >> s >> t;

	ll n1 = s.length();
	ll n2 = t.length();

	ll min_v = INT_MAX;
	for (ll i = 0; i <= n1 - n2; i++) {
		ll c = 0;
		ll id = i;
		for (ll j = 0; j < n2; j++) {
			if (s[id] == t[j]) {
				c++;
			}
			id++;
		}

		min_v = min(min_v, n2 - c);
		//watch2(c, min_v);
	}

	cout << min_v << nl;


	return 0;
}


Measured memory_bytes: 3572