akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;
int s[105];
int main(){
	int n;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&s[i]);
	//sort(s+1,s+1+n);
	
	int f=0;
	int ans=2e9;
	for(int i=1;i<=n;i++){
		int s1=0,s2=0;
		for(int j=1;j<i;j++)
			s1+=s[j];
		for(int j=i;j<=n;j++)
			s2+=s[j];
		ans=min(ans,abs(s1-s2));
	}
	printf("%d\n",ans);
	/*if(n%2==0){
		for(int i=0;i<n/2;i+=2){
			s1+=(s[i]+s[n-i-1]);
			s2+=(s[i+1]+s[n-i-2]); 
		}
		printf("%d\n",abs(s1-s2));
	}
	else{
		for(int i=0;i<n/2;i+=2){
			s1+=(s[i]+s[n-i-1]);
			s2+=(s[i+1]+s[n-i-2]); 
		}
		if(s1>s2)
			s2+=s[n/2];
		else s1+=s[n/2];
		printf("%d\n",abs(s1-s2));
	} */
}

Measured memory_bytes: 256
from collections import Counter

s = input()
n = len(s)
digits = [int(c) for c in s[::-1]]
a = [0] * (n + 1)
p = 2019

for i, digit in enumerate(digits):
    a[i + 1] = (digit * pow(10, i, p) + a[i]) % p

counter = Counter(a)
ans = 0
for count in counter.values():
    ans += count * (count - 1) // 2

print(ans)

Measured memory_bytes: 18040
#include <iostream>

using namespace std;

int main(){
    int A, B, C, D;
    cin >> A >> B >> C >> D;

    while(true){
        if(A <= 0 || C <= 0){
            break;
        }
        C = C-B;
        if(C <= 0){
            cout << "Yes" << endl;
            break;
        }
        A = A-D;
        if(A <= 0){
            cout << "No" << endl;
            break;
        }
    }

    return 0;
}

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

int main(){
    while(1){
        int x,y;
        cin >> x >> y;
        if(x==0 and y==0) break;
        cout << min(x,y) << " " << max(x,y) << endl;
    }
}





Measured memory_bytes: 2988
#include<bits/stdc++.h>
using namespace std;
bool iseven(string S)
{
	string T=S.substr(0,S.length()/2);
	string U=S.substr(S.length()/2);
	return T==U;
}
int main()
{
	string S;
	cin>>S;
	for(int i=S.length()-1;i>0;i--)
		if(iseven(S.substr(0,i)))
		{
			cout<<i<<endl;
			return 0;
		}
	return 0;
}


Measured memory_bytes: 256
#if 0
2019.12.17

令 k 为 a 的异或和。
不难发现每次操作 a[x] 等价于交换 a[x] 与 k ，
那么将 a, b 离散化后，判无解就很简单了，接下来假设一定有解。

对于 a[i] 和 b[i] ，如果 a[i] != b[i] ，连边 b[i] -> a[i] ，
这样建出来一个图，把 k 作为当前位置，考虑现在操作 a[x] 在图上的意义，

1) k 向 a[x] 有边，那么操作 a[x] 等价于删掉这条边并移动 k 到 a[x]
2) k 向 a[x] 无边，但存在 y 向 a[x] 有边，
那么操作 a[x] 等价于把 y -> a[x] 的一条边改为 y -> k ，并移动 k 到 a[x] 。

1) 操作后边数减一，2) 操作后边数不变，可以知道答案的一个下界就是边数，
现在的目标就是最小化 2) 操作的次数。

在有解的情况下，设 K 为 b 的异或和，任意时刻 k 的连边有两种情况：
i) k != K ，k 的出度一定比入度多 1
ii) k == K ，k 的出度恰好等于入度
原因：连边 (K, k) 后整张图所有点需要满足入度等于出度。
那么 k 没有出边当且仅当 k 是一个孤立的点且 k = K，
也就是说对于一个有 x 条边的联通块，一定可以通过 x 次 1) 操作将边删干净且 k 停留在 K 。
当 k = K 且被孤立的时候，就需要通过 2) 操作跳到另一个联通块，并且让该联通块与 K 联通。
由此就可以得到最少需要的 2) 操作次数了。
#endif
#include <cstdio>
#include <algorithm>
#define debug(...) fprintf(stderr, __VA_ARGS__)

typedef long long ll;

struct {
	inline operator int () { int x; return scanf("%d", &x), x; }
	inline operator ll () { ll x; return scanf("%lld", &x), x; }
	template<class T> inline void operator () (T &x) { x = *this; }
	template<class T, class ...A> inline void operator () (T &x, A &...a)
	{ x = *this; this -> operator ()(a...); }
} read;

const int maxn = 100005;
int a[maxn], b[maxn];
int tmp[maxn];
int tot[maxn];
int fa[maxn], size[maxn];

int find(int x) {
	if(fa[x] == x) return x;
	return fa[x] = find(fa[x]);
}

int main() {
	int n = read;

	for(int i = 1; i <= n; i ++) {
		a[i] = read;
		a[n + 1] ^= a[i];
	}

	for(int i = 1; i <= n + 1; i ++)
		tmp[i] = a[i];
	std::sort(tmp + 1, tmp + n + 2);

	for(int i = 1; i <= n + 1; i ++) {
		a[i] = int(std::lower_bound(tmp + 1, tmp + n + 2, a[i]) - tmp);
		++ tot[a[i]];
	}

	for(int i = 1; i <= n; i ++) {
		b[i] = read;
		int x = int(std::lower_bound(tmp + 1, tmp + n + 2, b[i]) - tmp);
		if(tmp[x] != b[i] or !tot[x]) return puts("-1"), 0;
		b[i] = x;
		-- tot[x];
	}

	for(int i = 1; i <= n + 1; i ++) {
		fa[i] = i;
		size[i] = 1;
	}

	int ans = -1;
	for(int i = 1; i <= n; i ++) {
		int x = find(a[i]), y = find(b[i]);
		if(a[i] != b[i]) {
			/* debug("%d - %d\n", tmp[a[i]], tmp[b[i]]); */
			fa[x] = y;
			if(x != y)
				size[y] += size[x];
			++ ans;
		}
	}

	for(int i = 1; i <= n + 1; i ++)
		if(fa[i] == i and size[i] > 1)
			++ ans;

	if(fa[a[n + 1]] == a[n + 1] and size[a[n + 1]] == 1)
		++ ans;

	printf("%d\n", ans == -1 ? 0 : ans);
}


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

int main() {
  int n;
  cin >> n;
  int a, b = INT_MAX, e = INT_MIN;
  REP(i, n) {
    cin >> a;
    b = min(a, b);
    e = max(a, e);
  }
  cout << e - b << endl;
  return 0;
}

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


#define file "file"
#define mp make_pair
#define pb push_back
typedef long long ll;
typedef complex<double> point;
typedef pair<int, int> pii;
typedef vector<int> vi;

#define DEBUG 0
#define dout if(DEBUG) cout


void solve(){
    int n;
    cin >> n;
    int a = 1;
    while(a <= n) a <<= 1;
    a /= 2;
    cout << a;
}

int main() {
    #ifdef NASTYA
        assert(freopen("input.txt", "r", stdin)); assert(freopen("output.txt", "w", stdout));
    #else
    // assert(freopen(file".in", "r", stdin)); assert(freopen(file".out", "w", stdout));
    #endif
    int t = 1;
    while(t--) {
        solve();
    }
    return 0;
}


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

using namespace std;

signed main()
{
    int h, w, d;
    cin >> h >> w >> d;
    char x[2][2] = {{'R', 'B'}, {'G', 'Y'}};
    char out[h][w];
    for(int i = 0; i < h; i++)
        for(int j = 0; j < w; j++)
        {
            int a = (i + j) % (2 * d);
            int b = (i - j) % (2 * d);
            if(b < 0)
                b += 2 * d;
            out[i][j] = x[a < d][b < d];
            cout << out[i][j];
            if(j + 1 == w)
                cout << "\n";
        }
    return 0;
}


Measured memory_bytes: 768
#include<cstdio>
#include<algorithm>
using namespace std;

typedef long long ll;

ll n, x[100001];
ll N, dat[400001], dp[100001];

void init() {
  N = 1;
  while (N < n + 1) N *= 2;
  for (int i = 0; i < 2 * N - 1; i++) dat[i] = 0;
}

void update(ll k, ll a) {
  k += N - 1;
  dat[k] = a;
  while (k > 0) {
    k = (k - 1) / 2;
    dat[k] = max(dat[k * 2 + 1], dat[k * 2 + 2]);
  }
}

ll query(ll a, ll b, ll k, ll l, ll r) {
  if (r <= a || b <= l) return -1;
  if (a <= l && r <= b) return dat[k];
  else {
    ll vl = query(a, b, k * 2 + 1, l, (l + r) / 2);
    ll vr = query(a, b, k * 2 + 2, (l + r) / 2, r);
    return max(vl, vr);
  }
}

ll seg(ll a) {
  //printf("a: %lld ",a);
  return query(0, a, 0, 0, N);
}


int main() {
  scanf("%lld", &n);
  init();
  for (int i = 1; i <= n; i++) scanf("%lld", &x[i]);
  for (int i = 1; i <= n; i++) {
    dp[i] = seg(x[i]) + x[i];
    update(x[i], dp[i]);
  }
  ll ans = 0;
  for (int i = 1; i <= n; i++) ans = max(ans, dp[i]);
  printf("%lld\n", n * (n + 1) / 2 - ans);
}


Measured memory_bytes: 6364
// G++ MACro.cpp -std=c++14
#include <bits/stdc++.h>
typedef long long ll;
const int INF = 1e9;
const int MOD = 1e9+7;
const ll LINF = 1e18;
using namespace std;
 
#define dump(x)  cout << #x << " = " << (x) << endl;
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) << endl
 
#define SANKOU(n,a,b) cout << ((n) ? (#a) : (#b) ) << endl
 
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)
 
#define FOREACH(x,a) for(auto& (x) : (a) )
 
#define WFA(d,v) REP(k,v)REP(i,v)REP(j,v)d[i][j]=min(d[i][j],d[i][k]+d[k][j])
 
#define SCOUT(x) cout<<(x)<<" "
#define ENDL cout<<endl
 
#define VECCIN(x) for(auto&youso_: (x) )cin>>youso_
#define VECIN2(x,y) REP(i,x.size())cin>>x[i]>>y[i]
#define VECCOUT(x) for(auto&youso_: (x) )cout<<youso_<<" ";cout<<endl
 
#define ALL(obj) (obj).begin(),(obj).end()
 
#define EXIST(n,x) (find(ALL(n),x)!=n.end())
#define UNIQUE(obj) sort(ALL( obj )); obj.erase(unique(ALL(obj)),obj.end())
#define COUT(x) cout<<(x)<<endl
void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}
#define CIN(...) int __VA_ARGS__;CINT(__VA_ARGS__)
#define SCIN(...) string __VA_ARGS__;CINT(__VA_ARGS__)
 
#include <boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision; // cpp_int
 
#define P pair<int,int>
#define V vector<int>
#define M map<int,int>
#define S set<int>
#define L list<int>
 
#define pb(a) push_back(a)
#define mp make_pair
 
vector<V> a;
int h,w;
bool Dfs(int x,int y,vector<V> m){
  m[x][y]=1;
  if(x==h-1&&y==w-1&&m==a)return true;
  if(x!=h-1&&a[x+1][y]&&Dfs(x+1,y,m))return true;
  if(y!=w-1&&a[x][y+1]&&Dfs(x,y+1,m))return true;
  return false;
}

int main(){
  cin>>h>>w;
  a = vector<V>(h,V(w,0));
  REP(i,h){
    SCIN(s);
    REP(j,w)if(s[j]=='#')a[i][j]=1;
  }
  Possible(Dfs(0,0,vector<V>(h,V(w,0))));
  return 0;
}


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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;

set<li> st;
li n;
PI a[100100];

int main() {
    li n, a, b;
    cin >> n >> a >> b;
    li res = 0;
    res += a * (n / (a + b));
    res += min(a, n % (a + b));
    cout << res << endl;

    return 0;
}

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

ll gcdExtended(ll a, ll b, ll *x, ll *y); 
  int modInverse(int b, int m) 
{ 
    ll x, y; // used in extended GCD algorithm 
    ll g = gcdExtended(b, m, &x, &y); 
  
    if (g != 1) 
        return -1; 
    return (x%m + m) % m; 
} 
  
ll modDivide(ll a, ll b, ll m) 
{ 
    a = a % m; 
    ll inv = modInverse(b, m); 
   return (inv * a) % m; 
} 
ll gcdExtended(ll a, ll b, ll *x, ll *y) 
{ 
    if (a == 0) 
    { 
        *x = 0, *y = 1; 
        return b; 
    } 
  
    ll x1, y1; // To store results of recursive call 
    ll gcd = gcdExtended(b%a, a, &x1, &y1); 
  
    // Update x and y using results of recursive 
    // call 
    *x = y1 - (b/a) * x1; 
    *y = x1; 
  
    return gcd; 
} 
  
ll power(ll x, ll y, ll m) 
{ 
    if (y == 0) 
        return 1; 
    int p = power(x, y/2, m) % m; 
    p = (p * p) % m; 
  
    return (y%2 == 0)? p : (x * p) % m; 
} 
  

ll findProductSum(ll A[], ll n) 
{ 
	ll array_sum = 0; 
	for (int i = 0; i < n; i++) 
		array_sum = array_sum + A[i]; 
    array_sum%=mod;
    
	ll array_sum_square = array_sum * array_sum; 
    array_sum_square%=mod;
    
	ll individual_square_sum = 0; 
	for (int i = 0; i < n; i++) {
		individual_square_sum += A[i]*A[i]; 
		individual_square_sum%=mod;}

	return modDivide(((array_sum_square - individual_square_sum)+mod)%mod,2,mod); 
} 
 
int main() 
{ 
	ll n;
	cin>>n;
	ll arr[n];
	for(int i=0;i<n;i++) cin>>arr[i];
	cout<<findProductSum(arr,n);
	return 0; 
} 


Measured memory_bytes: 5172
#include <cstdio>

bool ex[101];
int mp[5][5];

int main() {
  int n;
  for (int i = 1; i <= 3; i++)
    for (int j = 1; j <= 3; j++)
      scanf("%d", &mp[i][j]);
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int num;
    scanf("%d", &num);
    ex[num] = true;
  }
  for (int i = 1; i <= 3; i++) {
    bool ok = true;
    for (int j = 1; j <= 3; j++)
      if (!ex[mp[i][j]]) {
        ok = false;
        break;
      }
    if (ok) {
      puts("Yes");
      return 0;
    }
  }
  for (int j = 1; j <= 3; j++) {
    bool ok = true;
    for (int i = 1; i <= 3; i++)
      if (!ex[mp[i][j]]) {
        ok = false;
        break;
      }
    if (ok) {
      puts("Yes");
      return 0;
    }
  }
  if (ex[mp[1][1]] && ex[mp[2][2]] && ex[mp[3][3]]) {
    puts("Yes");
    return 0;
  }
  if (ex[mp[1][3]] && ex[mp[2][2]] && ex[mp[3][1]]) {
    puts("Yes");
    return 0;
  }
  puts("No");
  return 0;
}


Measured memory_bytes: 128
import sys

pre1 = [
    [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
    [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 1],
    [0, 2, 4, 6, 8, 1, 3, 5, 7, 9, 2],
    [0, 3, 6, 9, 3, 6, 9, 3, 6, 9, 3],
    [0, 4, 8, 3, 7, 2, 6, 1, 5, 9, 4],
    [0, 5, 1, 6, 2, 7, 3, 8, 4, 9, 5],
    [0, 6, 3, 9, 6, 3, 9, 6, 3, 9, 6],
    [0, 7, 5, 3, 1, 8, 6, 4, 2, 9, 7],
    [0, 8, 7, 6, 5, 4, 3, 2, 1, 9, 8],
    [0, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9],
]
pre2 = [
    [0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
    [0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 10],
    [0, 0, 1, 2, 3, 5, 6, 7, 8, 9, 11],
    [0, 0, 1, 2, 4, 5, 6, 8, 9, 10, 12],
    [0, 0, 1, 3, 4, 6, 7, 9, 10, 11, 13],
    [0, 0, 2, 3, 5, 6, 8, 9, 11, 12, 14],
    [0, 0, 2, 3, 5, 7, 8, 10, 12, 13, 15],
    [0, 0, 2, 4, 6, 7, 9, 11, 13, 14, 16],
    [0, 0, 2, 4, 6, 8, 10, 12, 14, 15, 17],
    [0, 0, 2, 4, 6, 8, 10, 12, 14, 16, 18],
]
m = int(input())
ans = -1
tmp = 0
for line in sys.stdin:
    d, c = map(int, line.split())
    round10 = pre2[d][-1]
    while c >= 10:
        c10, c9 = divmod(c, 10)
        ans += round10 * c10
        c = c10 + c9
    ans += pre2[d][c]
    after_d = pre1[d][c]
    tmp += after_d
    ans += 1
    if tmp >= 10:
        td, tm = divmod(tmp, 10)
        tmp = td + tm
        ans += 1
print(ans)


Measured memory_bytes: 3192
#include <stdio.h>
#include <map>
using namespace std;
int main() {map<int,int>RB;int i,j;map<int,int>::iterator it;while(scanf("%d",&i)!=EOF) {if (RB.count(i)) RB[i]++; else RB[i]=1;}
for (j=0,it=RB.begin();it!=RB.end();it++) if (j<(it->second)) j=it->second;for (it=RB.begin();it!=RB.end();it++) if ((it->second)==j) printf("%d\n",it->first);return 0;}

Measured memory_bytes: 0
#include <bits/stdc++.h>
#define pb push_back
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define db(x) (cerr << #x << ": " << (x) << '\n')
#define cps CLOCKS_PER_SEC
#define tests(t) int t; cin >> t; while(t--)
#define iceil(n, x) (((n) + (x) - 1) / (x))
#define ll long long
#define ld double
#define eb emplace_back
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define sz size()
#define all(v) (v).begin(), (v).end()
#define uni(v) sort(all(v)), (v).erase(unique(all(v)), (v).end())
#define fi first
#define se second
#define bitcount(x) __builtin_popcount(x)
#define PI acos(-1.0)
#define EPS 1e-9
#define mod 1000000007
#define bit(x) (1 << x)
#define par pair<int,int>
#define maxn 200005

using namespace std;
///All indexing is 0-based
using namespace __gnu_pbds;
template<class key, class cmp = std::less<key>>
using ordered_set = tree<key, null_type, cmp, rb_tree_tag, tree_order_statistics_node_update>;
///methods: find_by_order(k); & order_of_key(k);
///To make it an ordered_multiset, use pairs of (value, time_of_insertion)
///to distinguish values which are similar

ll may,N,a,b,c;
ld sol;

void busc_bin()
{
    ld ini = 0,fin = (ld)N;
    while(abs(fin-ini)>EPS )
    {
        ld tam = (fin-ini)/3.0;
        ld p1 = (ini+tam);
        ld p2 = (fin-tam);
        if(p2+p2>N){
            fin = p2;
            continue;
        }

        if(p1*p1*(ld)(N-2.0*p1) >  p2*p2*(ld)(N-2*p2))
            sol = p1*p1*(ld)(N-2.0*p1) , fin = p2;
        else
            sol = p2*p2*(ld)(N-2.0*p2) , ini = p1;
    }
}
int main()
{
    #ifdef acm
    freopen("a.in","r",stdin);
    #endif // acm
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    cin >> N;

    busc_bin();

    cout << fixed << setprecision(6) <<  sol ;


}


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

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

    vector<bool> f(n + 1,false);

    int m = 0;

    for(int i = n; i > 0; --i){
        int count = 0;
        for(int j = i + i; j <= n; j += i){
            if(f[j]) count++;
        }
        if(count % 2 != a[i]){
            f[i] = true;
            m++;
        } 
    }

    cout << m << endl;

    for(int i = 1; i <= n; ++i){
        if(f[i]){
            cout << i << " ";
        }
    }

    cout << endl;


    return 0;
}

Measured memory_bytes: 1792
N = int(input())
#N,K = map(int, input().split())
flag = False
lst = list(map(int, input().split()))
for elem in lst:
    if elem % 2 == 0:
        if ((elem % 3)==0) or ((elem % 5) ==0):
            pass
        else:
            flag = True
            break
if flag:
    print('DENIED')
else:
    print('APPROVED')

Measured memory_bytes: 38256
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int n,p=1;
  cin>>n;
  int a;
  while(n--)
  {
    cin>>a;
    if(a%2==0)
    {
      if(!(a%3==0||a%5==0))
        p=0;
    }
  }
  if(p)cout<<"APPROVED";
  else cout<<"DENIED";
}

Measured memory_bytes: 256
N,K=list(map(int,input().split()))
h=[]
z=[]
for _ in range(N):
  h_=int(input())
  h.append(h_)
h.sort()
for i in range(N-K+1):
  y=h[i+K-1]-h[i]
  z.append(y)
print(min(z))  

Measured memory_bytes: 11292
#include <iostream>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
#include <bitset>

using namespace std;
using lint = long long int;
long long int INF = 1001001001001001LL;
int inf = 1000000007;
long long int MOD = 1000000007LL;
double PI = 3.1415926535897932;

template<typename T1,typename T2>inline void chmin(T1 &a,const T2 &b){if(a>b) a=b;}
template<typename T1,typename T2>inline void chmax(T1 &a,const T2 &b){if(a<b) a=b;}

#define ALL(a) a.begin(),a.end()
#define RALL(a) a.rbegin(),a.rend()

/* do your best */

int main() {
  /*
  int l; cin >> l;
  int ans = 0;
  for (int x = 1; x <= l; x++) {
    for (int y = 1; y <= l; y++) {
      int z = l - x - y;
      if (z <= 0) continue;
      ans = max(ans, x * y * z);
    }
  }
  cout << ans << endl;
  */

  double l;
  cin >> l;
  double x = l / 3.0;
  printf("%.10f\n", x * x * x);
  return 0;
}


Measured memory_bytes: 256
def main(argv)
  s = gets.chomp
  w = gets.chomp.to_i
  
  t = ''
  i = 0
  while i < s.size do
    t += s[i]
    i += w
  end
  
  puts t
end

if self.to_s == 'main' then
  main(ARGV)
end

Measured memory_bytes: 2172
a, v = map(int, input().split())
b, w = map(int, input().split())
t = int(input())
if a<b:
    if a+v*t>=b+w*t:
        print("YES")
    else:
        print("NO")
elif a==b:
    print("YES")
else:
    if a-v*t<=b-w*t:
        print("YES")
    else:
        print("NO")

Measured memory_bytes: 9188
for e in iter(input,'0 0'):
 w,h=map(int,e.split())
 M=[[[1,0]*2 for _ in[0]*h]for _ in[0]*w]
 for i in range(1,w):
  for j in range(1,h):
   a,b,c,d=[*M[i-1][j][:2],*M[i][j-1][2:]]
   M[i][j]=[d,a+b,b,c+d]
 print((sum(M[w-2][h-1][:2])+sum(M[w-1][h-2][2:]))%10**5)


Measured memory_bytes: 7832
def main():
    def find(target):
        if parent[target] < 0:
            return target
        else:
            parent[target] = find(parent[target])
            return parent[target]

    def is_same(x, y):
        return find(x) == find(y)

    def union(x, y):
        root_x = find(x)
        root_y = find(y)
        if root_x == root_y:
            return
        if parent[root_x] > parent[root_y]:
            root_x, root_y = root_y, root_x
        parent[root_x] += parent[root_y]
        parent[root_y] = root_x

    # 今回これ使わないけど、どこに誰がいるのかはこれでわかる
    def members(n, x):
        root = find(x)
        return [i for i in range(n) if find(i) == root]

    def get_size(x):
        return -parent[find(x)]

    def get_root():
        return [i for i, root in enumerate(parent) if root < 0]
    
    n, m = map(int, input().split())
    parent = [-1 for _ in range(n)]
    for _ in range(m):
        a, b = map(lambda x: int(x) - 1, input().split())
        union(a, b)
    ans = len(get_root()) - 1
    print(ans)

if __name__ == '__main__':
    main()

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

  long int i;
  long int g=0;
  for(i=1;i<=N;i++){
    if(i%3!=0 && i%5!=0){
      g=g+i;
    }
  }
  
  cout << g << endl;
  return 0;
}

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

int a,b,c,d;
void solve() {
    if(d<a)cout<<d<<endl;
    else if(d<(a+b))cout<<a<<endl;
    else cout<<a-(d-a-b)<<endl;
}
int main() {
	cin>>a>>b>>c>>d;
	solve();
	return 0;
}

Measured memory_bytes: 3648
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define INF 9999999999
#define m0(x) memset(x,0,sizeof(x))
#define fill(x,y) memset(x,y,sizeof(x))
#define p(x) cout<<x<<endl;
#define pe(x) cout<<x<<" ";
#define int long long


using namespace std;


int dy[4] = { 0,0,1,-1 };
int dx[4] = { 1,-1,0,0 };
int dxx[8] = { 0,0,1,1,1,-1,-1,-1 };
int dyy[8] = { 1,-1,0,1,-1,0,1,-1 };




ll gcd(ll x, ll y) {
	ll m = max(x, y), n = min(x, y);
	if (m%n == 0)return n;
	else return gcd(m%n, n);
}
ll lcm(ll x, ll y) {
	return x / gcd(x, y)*y;
}

ll myPow(ll x, ll n, ll m) {
	if (n == 0)
		return 1;
	if (n % 2 == 0)
		return myPow(x * x % m, n / 2, m);
	else
		return x * myPow(x, n - 1, m) % m;
}

ll pow2(ll a, ll n) {//aのn乗を計算します。
	ll x = 1;
	while (n > 0) {//全てのbitが捨てられるまで。
		if (n & 1) {//1番右のbitが1のとき。
			x = x * a;
		}
		a = a * a;
		n >>= 1;//bit全体を右に1つシフトして一番右を捨てる。
	}
	return x;
}

long long nCr(int n, int r) {
	if (r > n / 2) r = n - r; // because C(n, r) == C(n, n - r)
	long long ans = 1;
	int i;

	for (i = 1; i <= r; i++) {
		ans *= n - r + i;
		ans /= i;
	}

	return ans;
}


const int MOD = 1000000007;

bool arr[1050000];
int sosuu[100010];
void Eratosthenes() {
	ll N = 1050000;
	int c = 0;
	for (int i = 0; i < N; i++) {
		arr[i] = 1;
	}
	for (int i = 2; i < sqrt(N); i++) {
		if (arr[i]) {
			for (int j = 0; i * (j + 2) < N; j++) {
				arr[i *(j + 2)] = 0;
			}
		}
	}

	for (int i = 2; i < N; i++) {
		if (arr[i]) {
			sosuu[c] = i;
			//cout << sosuu[c] << " ";
			c++;
		}
	}
	//cout << endl;
	//cout << c << endl;
}


int dp[41][410][410];
int N, Ma, Mb;
int a[50], b[50], c[50];

int inf = 100000;
signed main() {
	cin >> N >> Ma >> Mb;
	REP(i, 41) {
		REP(j, 410) {
			REP(k, 410) {
				dp[i][j][k] = inf;
			}
		}
	}
	//p(dp[0][0][0]);
	REP(i, N) {
		cin >> a[i] >> b[i] >> c[i];
	}
	dp[0][0][0] = 0;
	REP(i, N) {
		FOR(ma,	0, 410) {
			FOR(mb,0, 410) {
				if (dp[i][ma][mb] == inf)continue;
				dp[i + 1][ma][mb] = min(dp[i + 1][ma][mb], dp[i][ma][mb]);
				dp[i + 1][ma + a[i]][mb + b[i]] = min(dp[i][ma + a[i]][mb + b[i]], dp[i][ma][mb] + c[i]);
			}
		}
	}
	int ans = inf;
	FOR(mb,1, 10*N+1) {
		FOR(ma,1, 10*N+1) {
			if (ma*Mb == mb * Ma) {
				ans = min(ans, dp[N][ma][mb]);
				//pe(dp[N][ma][mb]);
			}
		}
		//cout << endl;
	}
	if (ans == inf)p(-1) else p(ans);
}

Measured memory_bytes: 55552
h, w = map(int, input().split())
s = [list(input()) for _ in range(h)]
d = [[1, 0], [-1, 0], [0, 1], [0, -1]]

for i in range(h):
    for j in range(w):
        if s[i][j] == "#":
            flg = False
            for x, y in d:
                if 0 <= x + j < w and 0 <= y + i < h:
                    if s[y+i][x+j] == "#":
                        flg = True
                        continue
            else:
                if not flg:
                    print("No")
                    exit()

print("Yes")

Measured memory_bytes: 39536
#include<bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rng(i,a,b) for(int i=int(a);i<int(b);i++)
#define rep(i,b) rng(i,0,b)
#define gnr(i,a,b) for(int i=int(b)-1;i>=int(a);i--)
#define per(i,b) gnr(i,0,b)
#define bg begin()
#define ed end()
#define all(x) x.bg,x.ed
#define pb push_back
#define eb emplace_back
using namespace std;
typedef long long ll;
template<class t,class u> void chmax(t&a,u b){if(a<b)a=b;}
template<class t,class u> void chmin(t&a,u b){if(b<a)a=b;}
template<class t> using vc=vector<t>;
template<class t> using vvc=vc<vc<t>>;
using pi=pair<int,int>;
using vi=vc<int>;
void yes(){ cout << "Yes" << endl; }
void no(){ cout << "No" << endl; }
int SIZE(string s){ return (int)s.size(); }

int main(){
    cout << fixed << setprecision(20);
    int n,m; cin >> n >> m;
    vi num(n,1);
    vc<bool> red(n,false); red[0] = true;
    rep(i,m){
        int x,y; cin >> x >> y;
        x--; y--;
        if(num[x] == 0) continue;
        if(red[x]){
            red[y] = true;
            if(num[x] == 1) red[x] = false;
        }
        num[x]--;
        num[y]++;
    }
    cout << accumulate(all(red),0) << endl;;
    return 0;
}

Measured memory_bytes: 640
N, K=map(int,input().split())
ab = []
for i in range(N):
    ab.append(list(map(int, input().split())))
ab.sort(key=lambda x:x[0])
for i in range(N):
    if K-ab[i][1]>0:
        K-=ab[i][1]
    else:
        print(ab[i][0])
        break


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

#ifdef LOCAL
#include "../dump.hpp"
#else
#define dump(...)
#define showvv(v)
#endif

using namespace std;

#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ROF(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define sz(x) ((int)(x).size())
#define pb push_back
#define fst first
#define snd second

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;

int main(){
  int n; cin >> n; string s; cin >> s;

  int d = 0, x = 1 << 29;
  rep(i,n){
    if(s[i] == '(') d++;
    else d--;
    x = min(x,d);
  }

  if(x < 0){
    s.insert(0,-x,'(');
    rep(i,d-x) s.pb(')');
  }else rep(i,d) s.pb(')');
  cout << s << endl;
}

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

using namespace std;

int main(void)
{
    int x, y;
    cin >> x >> y;

    vector<int> g0 = {1, 3, 5, 7, 8, 10, 12};
    vector<int> g1 = {4, 6, 9, 11};

    string ans;
    if(x == 2 || y == 2)
        ans = "No";
    else if((g0.end() != find(g0.begin(), g0.end(), x)) && (g0.end() != find(g0.begin(), g0.end(), y)))
        ans = "Yes";
    else if((g1.end() != find(g1.begin(), g1.end(), x)) && (g1.end() != find(g1.begin(), g1.end(), y)))
        ans = "Yes";
    else
        ans = "No";

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

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

int main(){
const int MAX_V=10000;
int prime[MAX_V+1];
	int i,k,v,n,p1,q1;
	for(i=2;i<=MAX_V;i++){
		prime[i]=1;
	}
	for(i=2;i*i<=MAX_V;i++){
		if(prime[i]){
			for(k=2*i;k<=MAX_V;k+=i){
				prime[k]=0;
			}
		}
	}
	prime[0]=0;
	prime[1]=0;
	while(1){
		scanf("%d",&v);
		if(v==0)break;
		if(prime[v]==0){
			while(1){
				v--;
				if(prime[v]==1)break;
			}
		}
		p1=v;
		q1=v;
		for(i=v-1;i>0;i--){
			if(prime[i]==1)q1=i;
			if(p1-q1==2){
				printf("%d %d\n",q1,p1);
				break;
			}else{
				p1=q1;
			}
		}
	}
	return 0;
}

Measured memory_bytes: 640
#include <iostream>
#include <string>
#include <vector>
#include <climits>
#include <set>
#include <algorithm>
#include <unordered_map>
#include <queue>
#include <iomanip>
#include <map>
#include <utility>
#include <numeric>
#include <chrono>
#include <ctime>
#include <bitset>
#include <iterator>
#include <cmath>
#include <stack>

#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define debug(x) cerr << #x << ": " << x << ", "
#define debugln(x) cerr << #x << ": " << x << '\n'

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

using namespace std;
using ll = long long;
using P = pair<ll, ll>;

typedef bitset<5200> bs;

constexpr ll mod = 1e9 + 7;
const double PI = acos(-1.0);

vector<double> fact(100001);

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

  int n; cin >> n;
  string a; cin >> a;
  string b; cin >> b;
  string c; cin >> c;

  int cnt = 0;

  rep(i, n) {
    if (a[i] == b[i] && b[i] == c[i]) {
      continue;
    } else if (a[i] == b[i] || b[i] == c[i] || c[i] == a[i]) {
      cnt++;
    } else {
      cnt+=2;
    }
  }

  cout << cnt << endl;
}

Measured memory_bytes: 1024
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,c) for (int i = 0; i < (int)c; i++)
#define all(v) v.begin(), v.end()
const int inf = 1000000000; //10^9
using ll = long long;
using P = pair<int,int>;
//加算代入演算子は+=！！！！！

int main() {
    ll x = 0, ans = 0, h1 = 0, h2 = 0;
    cin >> x;
    h1 = (x / 500) * 1000;
    h2 = ((x % 500) / 5) * 5;
    cout << h1 + h2 << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main(){
  int n,k,a[110],i,j,dp[100010];
  scanf("%d %d\n",&n,&k);
  for(i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(i=0;i<=k;i++){
    dp[i]=-1;
  }
  for(i=1;i<=k;i++){
    for(j=0;j<n;j++){
      if(i-a[j]>=0 && dp[i-a[j]]==-1){
        dp[i]=1;
        break;
      }
      dp[i]=-1;
    }
  }
  if(dp[k]==dp[0]){
    printf("Second\n");
  }
  else{
    printf("First\n");
  }
  return 0;
}

Measured memory_bytes: 512
import sys
N = int(input())


def query(num):
    print(num)
    return input()


result = [-1] * (N + 1)
result[0] = query(0)
result[N] = result[0]
edge = [0, N]
if result[0] == "Vacant":
    sys.stdout.flush()
else:
    for i in range(30):
        idx = int(abs(edge[0] - edge[1]) / 2) + min(edge)
        result[idx] = query(idx)
        if result[idx] == "Vacant":
            sys.stdout.flush()
            break
        for i in range(2):
            r = result[edge[i]]
            if abs(edge[i] - idx) % 2 == 0:
                if r != result[idx]:
                    if i == 0:
                        edge[1] = idx
                        break
                    else:
                        edge[0] = idx
                        break
            elif abs(edge[i] - idx) % 2 == 1:
                if r == result[idx]:
                    if i == 0:
                        edge[1] = idx
                        break
                    else:
                        edge[0] = idx
                        break
    sys.stdout.flush()


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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;
// const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


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

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

bool is_prime(int64_t x) {
  for(int64_t i = 2; i * i <= x; i++) {
    if(x % i == 0) return false;
  }
  return true;
}


int main() {
  int X;
  cin >> X;
  while(!is_prime(X)) ++X;
  cout << X << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(long i = 0; i < n; i++)
#define erep(i, n) for(long i = 1; i <= n; i++)
const long MOD = 1000000007;
#define all(a) a.begin(), a.end()
#define show(ans)  cout << ans << endl;


int main() {long N, M;
cin >> N >> M;
vector<pair<long, long>> v;
rep(i, M){
    long a1, b1;
    cin >> a1 >> b1;
    v.push_back(make_pair(b1, a1));
}
sort(all(v));
long end1 = 0;
long ans = 0;
rep(i, M){
    if(v[i].second < end1);
    else{
        end1 = v[i].first;
        ans++;
    }
}


show(ans);
  return 0;
 
}



Measured memory_bytes: 2420
#include <bits/stdc++.h>
using namespace std;
using lli = long long int;
const lli mod = 998244353;

const int M = 1e6;

vector<int> muSieve(int n){
	vector<int> Mu(n + 1, -1);
	Mu[0] = 0, Mu[1] = 1;
	for(int i = 2; i <= n; ++i)
		if(Mu[i])
			for(int j = 2*i; j <= n; j += i)
				Mu[j] -= Mu[i];
	return Mu;
}

const vector<int> Mu = muSieve(M);

int main(){
	ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	vector<lli> f(M+1);
	for(int i = 1; i <= M; ++i){
		for(int j = i; j <= M; j += i){
			f[j] = (f[j] + i * Mu[i]) % mod;
			if(f[j] < 0) f[j] += mod;
		}
	}

	vector<lli> inv(M+1);
	inv[1] = 1;
	for(int i = 2; i <= M; ++i){
		inv[i] = mod - (mod / i) * inv[mod % i] % mod;
	}

	int n;
	cin >> n;
	vector<lli> freq(M+1);
	for(int i = 0; i < n; ++i){
		int ai;
		cin >> ai;
		freq[ai]++;
	}

	vector<lli> g(M+1);
	for(int i = 1; i <= M; ++i){
		for(int j = i; j <= M; j += i){
			g[i] = (g[i] + j * freq[j] % mod) % mod;
		}
	}

	lli ans = 0;
	for(int d = 1; d <= M; ++d){
		ans = (ans + f[d] * g[d] % mod * g[d] % mod * inv[d] % mod - d * freq[d] % mod) % mod;
	}
	ans = ans * inv[2] % mod;
	if(ans < 0) ans += mod;
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 35456
#include<bits/stdc++.h>
using namespace std;
int main(){
  int A,B;
  int N;
  cin>>A>>B;
  if(A<=5){
    N=0;
  }
  else if(A>=13){
    N=B;
  }
  else{
    N=B/2;
  }
  cout<<N<<endl;
}


Measured memory_bytes: 256
//include
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <complex>

#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#include <stdexcept>

using namespace std;

// type alias
using ll = long long;
using ull = unsigned long long;
using comp = complex<double>;

const ll MOD = 1000000007LL;
const double PI = 3.14159265358979323846;

//conversion
//------------------------------------------
inline int toint(string s) { int v; istringstream sin(s); sin >> v; return v; }
template<class t> inline string tostring(t x) { ostringstream sout; sout << x; return sout.str(); }

// for loop
#define REP(i, n) for ((i) = 0;(i) < (ll)(n);(i)++)

//debug
#define DUMP(x)  cerr << #x << " = " << (x) << endl
#define DEBUG(x) cerr << #x << " = " << (x) << " (l" << __line__ << ")" << " " << __file__ << endl

int solve() {
	ll n, k;
	string s, t;
	cin >> s >> t;

	for (ll i = 0; i < s.size(); ++i) {
		if (s[i] != t[i]) {
			cout << "No" << endl;
			return 0;
		}
	}

	cout << "Yes" << endl;

	return 0;
}

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

	solve();

	return 0;
}


Measured memory_bytes: 3652
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define pf push_front
#define mod 1000000007
#define endl '\n'
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

int main()
{
    ll n,i;
    cin>>n;
    ll arr[n];
    for(i=0;i<n;i++)
    {
        cin>>arr[i];
    }
    ll x=1;
    ll ans=0;
    for(i=0;i<n;i++)
    {
        if(arr[i]==x)
        {
            x++;
        }
        else
        {
            arr[i]=-1;
            ans++;
        }
    }
    if(ans==n)
    {
        ans=-1;
    }
    cout<<ans<<endl;
}


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

int main() {
    int N, A ,B;
    cin >> N >> A >> B;
    int total = 0;

    for(int i = 1; i <= N; i++) {
        int sum = 0;
        int n = i;
        while(n > 0) {
            sum += n % 10;
            n /= 10;
        }
        if(A <= sum && sum <= B) total += i;
    }

    cout << total << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <queue>
#include <tuple>
#include <set>
using namespace std;
using llong = long long;

llong n, m, s, t;
vector<vector<llong>> g;
vector<llong> min_cost[2];
vector<llong> is_prime;
set<llong> st;

void bfs() {
		min_cost[0].resize(n + 1, -1);
		min_cost[1].resize(n + 1, -1);

		queue<pair<llong, llong>> que;
		que.push(make_pair(0, s));
		min_cost[0][s] = 0;

		while (!que.empty()) {
				auto state = que.front();
				llong pos = state.second;
				llong is_odd = state.first;
				que.pop();

				for (auto v:g[pos]) {
						llong npos = v;
						llong ncost = min_cost[is_odd][pos] + 1;

						if (min_cost[is_odd ^ 1][npos] == -1) {
								min_cost[is_odd ^ 1][npos] = min_cost[is_odd][pos] + 1;
								que.push(make_pair(is_odd ^ 1, npos));
						}
				}
		}
}

void f() {
		is_prime.resize(200001, 0);
		for (int i = 2; i <= 200000; i++) {
				if (is_prime[i] == 0) {
						for (int j = i + i; j <= 200000; j += i) {
								is_prime[j] = 1;
						}
						st.insert(i);
				}
		}
		st.insert(-1);
}

int main() {
		f();

		cin >> n >> m >> s >> t;
		g.resize(n + 1, vector<llong>());

		for (int i = 0; i < m; i++) {
				llong a, b;
				cin >> a >> b;
				g[a].push_back(b);
				g[b].push_back(a);
		}

		bfs();

		if (min_cost[0][t] == 2) {
				cout << 2 << endl;
				return 0;
		}

		if (min_cost[1][t] == 1) cout << 3 << endl;
		else cout << *(st.lower_bound(min_cost[1][t])) << endl;

		return 0;
}



Measured memory_bytes: 12900
#include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mp make_pair
#define st first
#define nd second
#define pii pair<int,int>

using namespace std;

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

    ll d,t,s; cin>>d>>t>>s;
    if(t * s >= d) cout<<"Yes";
    else cout<<"No";
    return 0;
}


Measured memory_bytes: 3648
import sys
sys.setrecursionlimit(10000000)
def input():
    return sys.stdin.readline()[:-1]
from bisect import *
from collections import *
from heapq import *
from math import *
from itertools import *

N, x = map(int, input().split())
A = list(map(int, input().split()))
m = A.copy()
ans = sum(m)
for k in range(1, N):
    for i in range(N):
        m[i] = min(m[i], A[i-k])
    ans = min(ans, sum(m) + k*x)
print(ans)


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

int main() {
  bool have_cards[4][13];
  std::memset(have_cards, 0, sizeof have_cards);
  int n;
  cin >> n;

  char design;
  int rank;
  while (n-- != 0) {
    cin >> design >> rank;
    switch (design) {
    case 'S':
      have_cards[0][rank-1] = true;
      break;
    case 'H':
      have_cards[1][rank-1] = true;
      break;
    case 'C':
      have_cards[2][rank-1] = true;
      break;
    case 'D':
      have_cards[3][rank-1] = true;
      break;
    }
  }

  for (int i = 0; i < 4; i++) {
    for (int j = 0; j < 13; j++) {
      if (!(have_cards[i][j])) {
        switch (i) {
        case 0:
          cout << "S" << " " << j + 1 << endl;
          break;
        case 1:
          cout << "H" << " " << j + 1 << endl;
          break;
        case 2:
          cout << "C" << " " << j + 1 << endl;
          break;
        case 3:
          cout << "D" << " " << j + 1 << endl;
          break;
        }
      }
    }
  }
  return 0;
}



Measured memory_bytes: 3128
#include <iostream>

using namespace std;

int main(void){
	int b,r,g,c,s,t;
	
	while(cin >> b >> r >> g >> c >> s >> t){
		if((b|r|g|c|s|t) == 0) break;
		
		int ret=100;
		int bg = b*5+r*3;
		int ng = t - bg - s;

		ret += b * 6 * 15 + r * 4 * 15 + g * 7 + c * 2;
		ret -= 3*ng + 2*bg;
		
		cout << ret << endl;
		
	}
}

Measured memory_bytes: 0
#include <iostream>
using namespace std;
int main(void){
    int a, b, c;
    cin >> a >> b >> c;
    int max = a;
    if(b > max) max = b;
    if(c > max) max = c;

    if(max == a) cout << "A" << endl;
    else if(max == b) cout << "B" << endl;
    else cout << "C" << endl;
}



Measured memory_bytes: 3108
/**
 * @copyright (c) 2020 Daisuke Hashimoto
 */

#include <bits/stdc++.h>
using namespace std;
using Pair = pair<int64_t, int64_t>;
constexpr int64_t kInf = INT64_MAX / 2L;

// std::cout << std::setprecision(20) << 1.1 << endl;

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

  int64_t N;
  cin >> N;
  // const int64_t L = static_cast<int64_t>(T.length());
  vector<vector<pair<int64_t, bool>>> A(N);
  for (int64_t i = 0; i < N; ++i) {
    int64_t a;
    cin >> a;
    for (int64_t j = 0; j < a; ++j) {
      int64_t x, y;
      cin >> x >> y;
      A[i].emplace_back(x - 1, (y == 1));
    }
  }
  int64_t result = 0;
  for (int64_t b = 0; b < (1L << N); ++b) {
    bitset<15> bs(b);
    bool is_okay = true;
    for (int64_t i = 0; i < N; ++i) {
      // cerr << b << ", " << i << " " << __LINE__ << endl;
      if (bs[i]) {
        for (auto p : A[i]) {
          if (bs[p.first] != p.second) {
            is_okay = false;
          }
        }
      }
      if (!is_okay) {
        break;
      }
    }
    if (is_okay) {
      result = max(result, static_cast<int64_t>(bs.count()));
    }
  }
  cout << result << endl;
  return 0;
}


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

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<long long> sums(N);
  long long sum = 0;
  for (int i = 0; i < N; ++i) {
    int a;
    cin >> a;
    sum += a;
    if (i == 0) {
      sums[i] = a;
    } else {
      sums[i] += sums[i - 1] + a;
    }
  }

  long long ans = 1e18;
  for (int i = 0; i < N - 1; ++i) {
    long long x = sums[i];
    long long y = sum - sums[i];
    ans = min(ans, abs(x - y));
  }
  cout << ans << endl;
  return 0;
}



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

using namespace std;
using ll = long long;

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

    ll n;
    cin >> n;

    string ans;

    while(n != 0) {
        n--;
        ans.push_back('a' + n % 26);
        n /= 26;
    }
    reverse(ans.begin(), ans.end());

    cout << ans << "\n";

    return 0;
}

Measured memory_bytes: 3648
#include <iostream>
#include<iomanip>
#include <deque>
using namespace std;
int main(){
    int n,mem=0;
    cin >> n;
    bool syonin = true;
    for(int i=0;i<n;i++){
        cin >> mem;
        if(mem%2==0&&mem%3!=0&&mem%5!=0){
            syonin = false;
            break;
        }
    }
    if(syonin == true){
        cout << "APPROVED" << endl;
    }else{
        cout << "DENIED" << endl;
    }
}


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

int main(){
  vector<vector<int>> A(4, vector<int>(4, 0));

  for(int i = 0; i < 4; i++){
    for(int j = 0; j < 4; j++){
      if(i == 0 && j >= 1){
        cin >> A[i][j];
      }else if(j == 0 && i >= 1){
        A[i][j] = A[j][i];
      }else if(i != 0 && j != 0){
        A[i][j] = abs(A[i][0] - A[0][j]);
      }
    }
  }

  vector<int> sum(4, 0);
  for(int i = 1; i < 4; i++){
    for(int j = 1; j < 4; j++){
      sum[i] += A[i][j];
    }
  }

  sort(sum.begin(), sum.end());

  cout << sum[1] << endl;

  return 0;

}

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

int bubbleSort(int A[], int N){
    int sw = 0;
    bool flag = 1;
    for(int i = 0; flag; ++i){
        flag = 0;
        for(int j = N - 1; j >= i + 1; --j){
            if(A[j] < A[j - 1]){
                swap(A[j], A[j - 1]);
                flag = 1;
                sw++;
            }
        }
    }
    return sw;
}


int main(){
    int A[100], N, sw;
    cin >> N;
    for(int i = 0; i < N; ++i) cin >> A[i];

    sw = bubbleSort(A, N);

    for(int i = 0; i < N; ++i){
        if(i) cout << " ";
        cout << A[i];
    }
    cout << endl;
    cout << sw << endl;

    return 0;
}


Measured memory_bytes: 3112
t[80000],j,c;main(i){for(;++i<256;)for(j=i;t[j+=i]=j<4e4;);for(;c=j=scanf("%d",&i)*i/2;printf("%d\n",c-1))for(;j>1;)c-=t[j]|t[i-j--];}

Measured memory_bytes: 0
#include <iostream>
#include <iomanip>


int main()
{
	double n;
	int k;
	double ans = 0.0;
	double pro_individual = 1.0;
	std::cin >> n >> k;
	double prob = 1 / n;
	for (int i = 1; i <= n; i++)
	{
		int a = i;
		while (a < k)
		{
			a *= 2;
			pro_individual *= 0.5;
		}
		ans += pro_individual;
		pro_individual = 1.0;
	}
	ans *= prob;
	std::cout << std::fixed << std::setprecision(15) << ans << '\n';	
}



Measured memory_bytes: 256