akhauriyash/Code-Regression huggingface dataset:
n,k = map(int,input().split())
l = list(map(int,input().split()))

# xは求める長さ
def C(x):
    num = 0
    for i in range(n):
        # (a[i]-1)//x 回切る必要がある
        num += (l[i]-1)//x
    # k回以内に収まるか
    return num <= k

lb,ub = 0,max(l)
while ub-lb > 1:
    mid = (lb + ub + 1) // 2
    # 条件を満たすならxを小さくしていく
    if C(mid):
        ub = mid
    else:
        lb = mid
    # print(lb,ub)

print(ub)

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

int main()
{
  char num[1001];
  int t;
  int l;
  while(1)
    {
      scanf("%s", &num);
      l = strlen(num);
      if(num[0] == '0')
	{
	  break;
	}
      for(int i = 0; i < l; i++)
	{
	  t += num[i]-'0';
	}
      printf("%d\n", t);
      t=0;
    } 
}



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

int main(){
  int N;
  cin >> N;
  int D[N];
  rep(i,N) cin>>D[i];
  int M;
  cin >> M;
  int T[M];
  rep(i,M) cin>>T[i];
  sort(D,D+N);
  sort(T,T+M);
  int i=0,j=0;
  while(i<N and j<M){
    if(D[i]==T[j]){
      i++;
      j++;
    }
    else{
      i++;
    }
  }
  if(j==M) cout<<"YES"<<endl;
  else cout<<"NO"<<endl;
  return 0;
}

Measured memory_bytes: 1792
# https://atcoder.jp/contests/abc047/tasks/abc047_b

w, h, n = [int(i) for i in input().split()]

left = 0
right = w
bottom = 0
top = h

for _ in range(n):
    x, y, a = [int(i) for i in input().split()]
    if a == 1:
        left = max(left, x)
    elif a == 2:
        right = min(right, x)
    elif a == 3:
        bottom = max(bottom, y)
    elif a == 4:
        top = min(top, y)

if top <= bottom or right <= left:
    print(0)
else:
    print((right - left) * (top - bottom))


Measured memory_bytes: 62772
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,t,i;
int a[1000005];
int main()
{
	scanf("%d%d",&n,&t);
	for(i=1;i<=n;i++)scanf("%d",&a[i]);
	n++;a[n]=2e9;
	int ans=0;
	for(i=2;i<=n;i++)
		ans+=min(t,a[i]-a[i-1]);
	printf("%d\n",ans);
}


Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
#define p 1000000007
#define maxn 100005
#define int long long
int h,w,a,b,fac[maxn*2+5],inv[maxn*2+5];
inline int qpow(int x,int a)
{
	int ans=1;
	while(a)
	{
		if(a&1) ans=1ll*ans*x%p;
		x=1ll*x*x%p;
		a>>=1;
	}
	return ans;
}
inline void pre(int x=maxn*2)
{
	fac[0]=inv[0]=1;
	for(int i=1;i<=x;++i)
		fac[i]=1ll*fac[i-1]*i%p;
	inv[x]=qpow(fac[x],p-2);
	for(int i=x-1;i;--i)
		inv[i]=1ll*inv[i+1]*(i+1)%p;
}
inline int c(int x,int y)
{
	if(x<y) return 0;
	return 1ll*fac[x]*inv[y]%p*inv[x-y]%p;
}
signed main()
{
	scanf("%lld%lld%lld%lld",&h,&w,&a,&b);
	pre();
	int ans=c(h+w-2,h-1);
	for(int i=1;i<=b;++i)
		ans-=1ll*c(h-a+i-2,i-1)*c(w-i+a-1,a-1),ans%=p;
	ans=(ans%p+p)%p;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 3328
// AOJ DSL_4_A Union of Rectangles
// 2018.5.14 bal4u

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

#if 1
#define gc() getchar_unlocked()
#else
#define gc() getchar()
#endif
int in()
{
	int n = 0, c = gc();
	if (c == '-') {	c = gc();
		do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
		return -n;
	}
	do n = 10*n + (c & 0xf), c = gc(); while (c >= '0');
	return n;
}

#define MAX_N 2005
#define MAX   4005

int x1[MAX_N], y1[MAX_N], x2[MAX_N], y2[MAX_N];
int x[MAX], xs;
int y[MAX], ys;
char s[MAX][MAX];

int cmp(const void *a, const void *b) { return *(int *)a - *(int *)b; }

int xbsch(int a)
{
	int m, l = 0, r = xs;

    while (l < r) {
        m = (l + r) >> 1;
        if (x[m] < a) l = m + 1; else r = m;
    }
	return l;
}
int ybsch(int a)
{
	int m, l = 0, r = ys;

    while (l < r) {
        m = (l + r) >> 1;
        if (y[m] < a) l = m + 1; else r = m;
    }
	return l;
}

int uniq(int *a, int n)
{
	int i, j;
	
	for (i = 0, j = 1; j < n; j++) {
		while (j < n && a[j] == a[i]) j++;
		if (j < n) if (++i != j) a[i] = a[j];
	}
	return i+1;
}

int main()
{
	int N, i, r, c, r1, c1, r2, c2;
	long long ans;

	N = in(); xs = ys = 0;
	for (i = 0; i < N; i++) {
		x1[i] = c = in(), y1[i] = r = in();
		x[xs++] = c, y[ys++] = r;
		x2[i] = c = in(), y2[i] = r = in();
		x[xs++] = c, y[ys++] = r;
	}
	qsort(x, xs, sizeof(int), cmp); xs = uniq(x, xs);
	qsort(y, ys, sizeof(int), cmp); ys = uniq(y, ys);

	for (i = 0; i < N; i++) {
		c1 = xbsch(x1[i]), c2 = xbsch(x2[i]);
		r1 = ybsch(y1[i]), r2 = ybsch(y2[i]);
		for (r = r1; r < r2; r++) memset(s[r]+c1, 1, c2-c1);
	}

	ans = 0;
	for (r = 0; r < ys; r++) for (c = 0; c < xs; c++) {
		if (s[r][c]) {
			c1 = c++; while (s[r][c]) c++;
			ans += (long long)(x[c]-x[c1])*(y[r+1]-y[r]);
		}
	}
	printf("%lld\n", ans);
	return 0;
}



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

struct mint{
    static const long long MOD = 1000000007;

    long long v;

    mint() : v(0) {}
    mint(long long x){
        x = x % MOD;
        if(x < 0){ x += MOD; }
        v = x;
    }
    mint& operator+=(mint a){
        v += a.v;
        if(v >= MOD){ v -= MOD; }
        return *this;
    }
    mint& operator*=(mint a){
        v *= a.v;
        v %= MOD;
        return *this;
    }
    mint& operator-=(mint a){
        v -= a.v;
        if(v < 0){ v += MOD; }
        return *this;
    }
    mint& operator/=(mint a){
        return (*this) *= a.inv();
    }

    mint operator*(mint a) const{
        return mint(v) *= a;
    }

    mint operator+(mint a) const {
        return mint(v) += a;
    }

    mint operator-(mint a) const {
        return mint(v) -= a;
    }

    mint operator/(mint a) const {
        return mint(v) /= a;
    }

    mint pow(long long k) const {
        mint res(1),tmp(v);
        while(k){
            if(k&1) res *= tmp;
            tmp *= tmp;
            k >>= 1;
        }
        return res;
    }
    mint inv(){return pow(MOD - 2); }

    static mint comb(long long n, int k){
        mint res(1);
        for(int i = 0; i < k; ++i){
            res *= mint(n - i);
            res /= mint(i + 1);
        }
        return res;
    }

    static mint factorial(long long n){
        mint res(1);
        for(int i = n; i > 1; --i){
            res *= mint(i);
        }
        return res;
    }

    bool operator<(const mint &a) const {
        return v < a.v;
    };
};

mint operator*(long long l, mint r){ return r * l; }

std::ostream& operator<<(std::ostream& stream, const mint& m){
    stream << m.v;
    return stream;
}

void solve(long long N, std::vector<long long> C){
    sort(C.begin(), C.end());
    vector<mint> mC(N);
    REP(i, N){ mC.at(i) = mint(C.at(i)); }

    vector<mint> p2(N + 1);
    p2.at(0) = 1;
    REP(i, N){ p2.at(i + 1) = 2 * p2.at(i); }

    mint ans = 0;
    REP(i, N){
        // C_i を含む項の和を考える
        mint tmp = p2.at(N) * mC.at(i) * p2.at(i);
        mint tmp2 = 1;
        const ll j = N - i;
        tmp2 = p2.at(j - 1) + (j - 1) * p2.at(max(0LL, j - 2));
        ans += tmp * tmp2;
    }
    cout << ans << endl;
}

// Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools
int main(){
    long long N;
    scanf("%lld",&N);
    std::vector<long long> C(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&C[i]);
    }
    solve(N, std::move(C));
    return 0;
}


Measured memory_bytes: 4992
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner reader = new Scanner(System.in);
		int N = reader.nextInt();
		int a = N / 1000;
		int b = N % 1000 / 100;
		int c = N % 100 / 10;
		int d = N % 10;
		String ans = "";

		for (int i = 0; i < 2; i++) {
			int sum = a;
			String tmp = "" + a;

			if (i == 0) {
				sum += b;
				tmp += "+" + b;
			} else {
				sum -= b;
				tmp += "-" + b;
			}
			for (int j = 0; j < 2; j++) {
				String tmp2 = tmp;
				int sum2 = sum;
				if (j == 0) {
					sum2 += c;
					tmp2 += "+" + c;
				} else {
					sum2 -= c;
					tmp2 += "-" + c;
				}
				for (int k = 0; k < 2; k++) {
					String tmp3 = tmp2;
					int sum3 = sum2;
					if (k == 0) {
						sum3 += d;
						tmp3 += "+" + d;
					} else {
						sum3 -= d;
						tmp3 += "-" + d;
					}
					if (sum3 == 7) {
						ans = tmp3 + "=7";
						break;
					}
				}
			}
		}

		System.out.println(ans);
		reader.close();
	}
}





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

int main()
{
	long long N, K;
	cin >> N >> K;
	
	if (N == 0 or K == 1)
	{
		cout << 0 << endl;
		return 0;
	}
	else
	{
		cout << min(abs(N % K), abs(N - K * ((N / K) + 1))) << endl;
	}
	
	return 0;
}


Measured memory_bytes: 256
import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

k = int(input())
ans = 0

for a in range(1, k + 1):
    for b in range(1, k + 1):
        for c in range(1, k + 1):
           ans += gcd(a, b, c)

print(ans)

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

const long long MOD = 1000000007;
const long long INF = 1LL << 60;
const int INT_INF = 1000000000;

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

vector<pair<long long, int>> factorize(long long N)
{
  vector<pair<long long, int>> res;
  for (long long i = 2; i * i <= N; i++)
  {
    if (N % i != 0)
      continue;
    res.emplace_back(i, 0);
    while (N % i == 0)
    {
      N /= i;
      res.back().second++;
    }
  }
  if (N != 1)
    res.emplace_back(N, 1);
  return res;
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int N;
  cin >> N;
  ll sum = 0;
  int idx = -1;
  int nidx = -1;
  for (int i = 1; i <= N; i++)
  {
    sum += i;
    cerr << sum << endl;
    if (sum >= N)
    {
      idx = i;
      break;
    }
  }
  nidx = sum - N;
  for (int i = 1; i <= idx; i++)
  {
    if (i != nidx)
      cout << i << endl;
  }
  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
//---------------------------
using namespace std;
//---------------------------
#define REP(i,n) for(int i = 0; i < (n); i++)
#define P(x) cout << (x) << "\n"

#define MOD 1e9+7
#define PI acos(-1.0)
#define ll long long
#define INF 1000000001

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

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

  // ifstream in("input.txt");
  // cin.rdbuf(in.rdbuf());

  string s; cin>>s;
  int l=s.size();
  char endst;
  queue<char> q;
  if(s=="zyxwvutsrqponmlkjihgfedcba") {
    P(-1);
    return 0;
  }
  int alp[26]={};
  for(int i=0; i<l; i++) {
    alp[s[i]-97]=1;
    // P(s[i]-97);
  }
  if(l==26) {
    reverse(s.begin(),s.end());
    q.push(s[0]);
    for(int i=0; i<l-1; i++) {
      if(s[i]<s[i+1]) {
        q.push(s[i+1]);
      }
      if(s[i]>s[i+1]) {
        while(!q.empty()) {
          if(s[i+1]<q.front()) {
            s[i+1]=q.front();
            for(int j=l-1;j>=i+1;j--){
              cout<<s[j];
            }
            cout<<"\n";
            return 0;
          }else{
            q.pop();
          }
        }
      }
    }
  }
  for(int i=0; i<26; i++) {
    if(alp[i]==0) {
      endst=(char)('a'+i);
      break;
    }
  }
  P(s+endst);
  return 0;
}


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

int main()
{
	int n, m;
	int i, j;
	
	cin >> n >> m;
	int a[n][m];
	int b[m];
	int c[n];
	
	for(i=0;i<n;i++){
		c[i]=0;
	}
	
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			cin >> a[i][j];
		}
	}
	
	for(i=0;i<m;i++){
		cin >> b[i];
	}
	
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			c[i]+=a[i][j]*b[j];
		}
	}
	
	for(i=0;i<n;i++){
		cout << c[i] << endl;
	}
	
	return 0;
}

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

int main() {
  using P = pair<int, int>;
  int n;
  cin >> n;
  vector<P> v(n);
  for (auto &p : v) cin >> p.first >> p.second;
  sort(v.begin(), v.end());
  cout << v[n - 1].first + v[n - 1].second << endl;
  return 0;
}


Measured memory_bytes: 1024
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <set>
using namespace std;
typedef long long int ll;

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define YES cout << "YES" << endl
#define Yes cout << "Yes" << endl
#define yes cout << "yes" << endl
#define NO cout << "NO" << endl
#define No cout << "No" << endl
#define no cout << "no" << endl

const int INF = 1001001001;
const int mod = 1000000007;
#define PI 3.14159265359;

void P(int x) {cout << x << endl;}
void P(long x) {cout << x << endl;}
void P(double x) {cout << x << endl;}
void P(ll x) {cout << x << endl;}
void P(string x) {cout << x << endl;}
void P(char x) {cout << x << endl;}

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main() {
  string s;
  cin >> s;
  rep (i, s.size()) {
    if (s[i] == '1') cout << 9;
    else if (s[i] == '9') cout << 1;
    else cout << s[i];
  }
  cout << endl;

  return 0;
}



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


int main() {
    int N;
    cin >> N;
    ll dp[100005][3];
    ll happy[100005][3];

    for(int i = 1;i <= N;i++){
        cin >> happy[i][0] >> happy[i][1] >> happy[i][2];
    }
    for (int i = 1; i <= N; i++){
        for(int act = 0;act<3; act++){
            for (int prev = 0;prev<3;prev++){
                if (act == prev) continue;
                dp[i][act] = max(dp[i][act], dp[i-1][prev] + happy[i][act]);
                }
            }
        }
    ll ans = 0;
    rep(i,3) ans = max(ans,dp[N][i]);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 4992
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <queue>
#include <algorithm>

#include <bits/stdc++.h>
#include <cmath>
#include <limits>

using namespace std;
typedef long long LL;
using Graph = vector<vector<int>>;

typedef long long LL;
static LL INF = (1LL<<62);

int main(int argc, char* argv[]){
	cin.tie(0);
	ios::sync_with_stdio(false);

	LL K, A, B;
	cin >> K >> A >> B;
	LL ans = 0;

	if(A >= B - 1){
		ans = K+1;
		printf("%lld\n", ans);
		return 0;
	}

    if(K <= A - 1 || K == A){
		ans = K+1;
		printf("%lld\n", ans);
		return 0;
	}

	K -= (A - 1);
	ans = A;
	LL k = K / 2;
	ans += ((B - A) * k);
	LL r = K % 2;
	if(r != 0){
		ans++;
	}

	printf("%lld\n", ans);
	return 0;
}


Measured memory_bytes: 3752
import * as fs from 'fs';

export class Reader {
    lines: string[];
    currentLine: number;

    constructor() {
        this.lines = fs.readFileSync("/dev/stdin", "utf8").trim().split("\n");
        this.currentLine = 0;
    }

    readLine(): string {
        return this.lines[this.currentLine++];
    }

    readInt(): number {
        return Number(this.readLine());
    }

    readInts(): number[] {
        return this.readLine().split(" ").map(Number);
    }
}

let reader = new Reader();
let [N, X] = reader.readInts();

let patties: number[] = [1],
    layers: number[] = [1]

for(let i=0; i<N; i++) {
    patties.push(1+2*patties[i]);
    layers.push(3+2*layers[i]);
}

// return [eatenPaties, leftToEat]
function eatPatties(level: number, toEat: number): [number, number] {
    if (toEat <= 0)
        return [0, 0];
    if (toEat >= layers[level])
        return [patties[level], toEat-layers[level]];
    toEat -= 1;
    let eatenPatties: number = 0;
    if (toEat > 0) {
        [eatenPatties, toEat] = eatPatties(level-1, toEat);
        if (toEat > 0) {
            eatenPatties += 1;
            toEat -= 1;
            if (toEat > 0) {
                let [eatenPatties2, _] = eatPatties(level-1, toEat);
                eatenPatties += eatenPatties2;
            }
        }
    }
    return [eatenPatties, 0];
}

console.log(eatPatties(N, X)[0]);


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

using namespace std;
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define rep(i,n) for(int i=0;i<(n);i++)
constexpr int MOD = 1000000007;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
constexpr int dx[] = {1, 0, -1, 0, 1, 1, -1, -1};
constexpr int dy[] = {0, -1, 0, 1, 1, -1, -1, 1};

template <typename T> ostream &operator<<(ostream &os, const vector<T> &vec){os << "["; for (const auto &v : vec) {os << v << ","; } os << "]"; return os; }

void solve() {
  string s;
  cin >> s;
  if (s == "AKIHABARA") {
    cout << "YES" << endl;
    return;
  }

  for (int i = 0; i < s.size() + 1; i++) {
    string ss;
    for(int p = 0; p < s.size(); p++) {
      if (p == i) ss += "A";
      ss += s[p];
    }
    if (i == s.size()) ss += "A";
    if (ss == "AKIHABARA") {
      cout << "YES" << endl;
      return;
    }
  }
  for (int i = 0; i < s.size() + 1; i++) {
    for (int j = 0; j < s.size() + 1; j++) {
      string ss;
      for(int p = 0; p < s.size(); p++) {
        if (p == i) ss += "A";
        if (p == j) ss += "A";
        ss += s[p];
      }
      if (i == s.size()) ss += "A";
      if (j == s.size()) ss += "A";
      if (ss == "AKIHABARA") {
        cout << "YES" << endl;
        return;
      }
    }
  }
  for (int i = 0; i < s.size() + 1; i++) {
    for (int j = 0; j < s.size() + 1; j++) {
      for (int k = 0; k < s.size() + 1; k++) {
        string ss;
        for(int p = 0; p < s.size(); p++) {
          if (p == i) ss += "A";
          if (p == j) ss += "A";
          if (p == k) ss += "A";
          ss += s[p];
        }
        if (i == s.size()) ss += "A";
        if (j == s.size()) ss += "A";
        if (k == s.size()) ss += "A";

        if (ss == "AKIHABARA") {
          cout << "YES" << endl;
          return;
        }
      }
    }
  }
  if (s.size() != 5) {
    cout << "NO" << endl;
    return;
  }
  for (int i = 0; i < s.size() + 1; i++) {
    for (int j = 0; j < s.size() + 1; j++) {
      for (int k = 0; k < s.size() + 1; k++) {
        for (int l = 0; l < s.size() + 1; l++) {
          string ss;
          for(int p = 0; p < s.size(); p++) {
            if (p == i) ss += "A";
            if (p == j) ss += "A";
            if (p == k) ss += "A";
            if (p == l) ss += "A";
            ss += s[p];
          }
          if (i == s.size()) ss += "A";
          if (j == s.size()) ss += "A";
          if (k == s.size()) ss += "A";
          if (l == s.size()) ss += "A";

          if (ss == "AKIHABARA") {
            cout << "YES" << endl;
            return;
          }
        }
      }
    }
  }
  cout << "NO" << endl;
}

int main() {
  std::cin.tie(0);
  std::ios::sync_with_stdio(false);
  cout.setf(ios::fixed);
  cout.precision(16);
  solve();
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
int PREP = (cin.tie(nullptr), ios::sync_with_stdio(false), cout << fixed << setprecision(9), 0);
//int SEGV = getenv("D") || (exit(system("D= SEGFAULT_SIGNALS=all catchsegv ./prog.exe") >> 8), 0);
template <class T> void chmin(T &x, T y) { if (x > y) x = y; }
Int powi(Int x, Int y) {
    if (y == 0) return 1;
    if (y % 2 == 0) return powi(x * x, y / 2);
    return x * powi(x, y - 1);
}
Int solve(Int N, Int A, Int cnt) {
    Int t = pow(N, 1.0 / cnt);
    Int ok = cnt, ng = -1;
    while (abs(ok - ng) > 1) {
        Int mid = (ok + ng) / 2;
        Int tmp = powi(t + 1, mid) * powi(t, cnt - mid);
        if (tmp >= N) {
            ok = mid;
        } else {
            ng = mid;
        }
    }
    return (t + 1 + A) * ok + (t + A) * (cnt - ok);
}
int main() {
    Int N, A; cin >> N >> A;
    Int ans = 1e13;
    for (int n = 1; n <= 40; n++) {
        chmin(ans, solve(N, A, n));
    }
    cout << ans - A << '\n';
    return 0;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void)
{
  int n,m;
  int i;
  int a=0;
  char s[100],t[50];
  scanf("%d",&n);
  m=n/2;
  scanf("%s",s);
  
  if(n%2==1)
    a=1;
  else
  {
    for(i=0;i<m;i++)
    {
      if(s[i]==s[m+i])
      {a=0;
      //printf("DDD\n");
      }
      else
      {
        a=1;
        //printf("KKK\n");
        break;
      }
      
      
    }
  }
  //printf("%d",a);
  //putchar(s[2]);
  if(a==1)
    printf("No");
  else
    printf("Yes");
  
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
#define MAX 100
using namespace std;

int n;
int t;
vector<int> G[MAX];
bool used[MAX];
int d[MAX];
int f[MAX];

void DFS(int s) {
	if (used[s]) return;
	used[s] = true;
	d[s] = t++;
	for (int &v : G[s]) {
		DFS(v);
	}
	f[s] = t++;
}

int main()
{
	cin >> n;
	for (int i = 0, u, k; i < n; i++) {
		cin >> u >> k;
		for (int j = 0, v; j < k; j++) {
			cin >> v;
			G[u - 1].push_back(v - 1);
		}
	}
	t = 1;
	bool flag;
	do {
		flag = false;
		for (int i = 0; i < n; i++) {
			if (!used[i]) {
				DFS(i);
				flag = true;
				break;
			}
		}
	} while (flag);
	for (int i = 0; i < n; i++) {
		cout << i + 1 << ' ' << d[i] << ' ' << f[i] << endl;
	}
	return 0;
}

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

int main(){
	int a[3];
	cin >> a[0] >> a[1] >> a[2];
	sort(a,a+3);
	if(a[0]==5 && a[1]==5 && a[2]==7)cout << "YES" << endl;
	else cout << "NO" << endl;
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

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

        Scanner sc = new Scanner(System.in);
        String S = sc.next();
        int N = S.length();
        int one = 0;
        int zero = 0;
        
        for(int i = 0; i < N; i++){
            if(S.charAt(i) == '1'){
                one++;
            }
        }
        for(int i = 0; i < N; i++){
            if(S.charAt(i) == '0'){
                zero++;
            }
        }
        System.out.println(one < zero ? one * 2 : zero * 2);
    }
}


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

int ans;

int main(){
	int a,b,v,n,f;
	while(cin >> a >> b){
		if(a==0&&b==0){
			return 0;
		}
		
		vector<int> vec;
		for(int i=0;i<a+b;i++){
			cin >> v;
			vec.push_back(v);
		}
		vector<int> t,h;
		t.assign(&vec[0], &vec[a]);
		h.assign(&vec[a], &vec[a+b]);
		
		sort(t.begin(), t.end()); 
		sort(h.begin(), h.end()); 
		
		int totalt = 0;
		int totalh = 0; 
		for(int i=0;i<a;i++){
			totalt = totalt + t[i];
		}
		for(int i=0;i<b;i++){
			totalh = totalh + h[i];
		}
		
		f = 0;
		for(int i=0;i<a;i++){
			for(int j=0;j<b;j++){
				if(((totalt - t[i] + h[j]) == (totalh + t[i] - h[j])) && (f == 0)){
					cout << t[i] << " " <<h[j] << endl;
					f = 1;
				}
			}
		}
		if(f == 0){
		cout << -1 << endl;
		}
	}
	return 0;
}

Measured memory_bytes: 1224
#include <iostream>
#include <vector>
#include <cstdio>
#include <cstdlib>
using namespace std;

#define FOR(i,a,b) for(int i=int(a);i<int(b);i++)
#define REP(i,b) FOR(i,0,b)

int ScanToSum(void) {
	const int MAX_LEN = 1000 + 1;
	char buf[MAX_LEN] = {};
	scanf("%s", buf);
	string s(buf);
	if (s == "0") return 0;
	int sum = 0;
	REP(i, s.size()) {
		const char ctos[2] = {s[i]};
		sum += atol(ctos);
	}
	cout << sum << endl;
	return 1;
}

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

	while(ScanToSum()) {}
	return 0;
}



Measured memory_bytes: 3260
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N;
  int al=0;
  int bo=0;
  cin >> N;
  vector<int>vec(N);
  for (int X=0; X<N; X++){
    cin >> vec.at(X);
  }
  sort(vec.begin(), vec.end());
  reverse(vec.begin(), vec.end());
  for (int Y=0; Y<N; Y++){
    if (Y%2==0){
      al+=vec.at(Y);
    }
    else if (Y%2==1){
      bo+=vec.at(Y);
    }
  }
  cout << al-bo << endl;
}


Measured memory_bytes: 256
//C
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>

//C++
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>

//Others
template<class T> inline bool chmin(T& a, T b) {
	if (a > b) {
		a = b;
		return true;
	}
	return false;
}
template<class T> inline bool chmax(T& a, T b) {
	if (a < b) {
		a = b;
		return true;
	}
	return false;
}
const int dx[8] = { -1, 0, 1, -1, 1, -1, 0, 1 };
const int dy[8] = { 1, 1, 1, 0, 0, -1, -1, -1 };
const int lr[4] = { 0, 1, 0, -1 };
const int ud[4] = { 1, 0, -1, 0 };



//LOVE Ayane Sakura



using namespace std;



int main() {
	string s;
	cin >> s;
	if (s == "AAA" || s == "BBB") {
		cout << "No" << endl;
	}
	else {
		cout << "Yes" << endl;
	}
}



Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define fastio ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int main(){
	#ifndef ONLINE_JUDGE
        freopen("input.txt","r",stdin);
        freopen("output.txt","w",stdout);
    #endif
	fastio
	string s;
	cin>>s;
	int start=s.find('A');
	int end;
	for(int i=s.size()-1;i>=0;--i){
		if(s[i]=='Z'){
			end=i;
			break;
		}
	}
	cout<<end-start+1;	
	return 0;
}

Measured memory_bytes: 3688
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    int r,D,x;
    cin>>r>>D>>x;
    for(int i=0;i<10;i++)
    {
        int X;
        X=r*x-D;
        cout<<X<<endl;
        x=X;
    }
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <utility>
#include <queue>
#define INF 1e9+7
#define rep(i,m,n) for(int i=m;i<n;i++)
#define mrep(i,m,n) for(int i=m;i>n;i--)
#define NO cout<<"NO"<<endl;
#define YES cout << "YES"<<endl;
#define No cout << "No"<<endl;
#define Yes cout << "Yes"<<endl;
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;


//(int)'a'は97 (int)'A'は65 (int)'1'は49
//おまじない


int main() {

	ll ans = 0;
	int n;
	pair<int, int> om[2], em[2];
	int o[100000] = { 0 }, e[100000] = { 0 };

	cin >> n;
	rep(i, 0, n/2) {
		int a, b;
		cin >> a >> b;
		o[a - 1]++; e[b - 1]++;
	}

	om[0].first = 0; em[0].first = 0;
	om[0].second = 0; em[0].second = 0;
	om[1].first = 0; em[1].first = 0;
	om[1].second = 0; em[1].second = 0;

	for (int i = 0; i < 100000;i++) {
		if (om[0].second <= o[i]) {
			om[1].first = om[0].first;
			om[1].second = om[0].second;
			om[0].first = i;
			om[0].second = o[i];
		}
		else if (om[1].second <= o[i]) {
			om[1].second = o[i];
			om[1].first = i;
		}

		if (em[0].second <= e[i]) {
			em[1].first = em[0].first;
			em[1].second = em[0].second;
			em[0].first = i;
			em[0].second = e[i];
		}
		else if (em[1].second <= e[i]) {
			em[1].second = e[i];
			em[1].first = i;
		}
	}

	if (em[0].first != om[0].first) {
		ans=n - em[0].second - om[0].second;
	}
	else if (em[1].second > om[1].second) {
		ans=n - em[1].second - om[0].second;
	}
	else {
		ans= n - om[1].second - em[0].second;
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 1024
from math import ceil
dp = [1] + [0 for i in range(33)]
for i in range(0,30):
	for step in [1,2,3]:
		dp[i+step] += dp[i]
unit = 3650.
while 1:
	n = int(raw_input())
	if n == 0:
		break
	print int(ceil(dp[n] / unit))

Measured memory_bytes: 4356
def main():
    N = int(input())
    h = list(map(int, input().split()))
    dp = [0] * N
    dp[-2] = abs(h[-1] - h[-2])
    for i in range(N - 3, -1, -1):
        dp[i] = min(
            abs(h[i] - h[i + 1]) + dp[i + 1],
            abs(h[i] - h[i + 2]) + dp[i + 2]
        )
    print(dp[0])


main()


Measured memory_bytes: 52208
//header{{{
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
//#include<boost/multiprecision/cpp_int.hpp>
//#include<boost/math/common_factor_rt.hpp>
  
using namespace std;
//using namespace boost::multiprecision;  
//using namespace boost::math;

#define rep(i,n) for(int i=0;i<(n);++i)
#define reps(i,n) for(int i=1;i<=(n);++i)
#define all(x) (x).begin(),(x).end()
#define Fixed fixed << setprecision(12)
#define int int64_t
using pii = pair<int,int>;
constexpr int INF  = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr int mod1 = 1e9+7; 
constexpr int mod2 = 998244353;

template <class A, class B> inline bool chmax(A &a, const B &b) { return b > a && (a = b, true); }
template <class A, class B> inline bool chmin(A &a, const B &b) { return b < a && (a = b, true); }

template <class T> using min_heap = priority_queue<T,vector<T>,greater<T> >;
template <class T> using max_heap = priority_queue<T>;
template <class A, class B> using umap = unordered_map<A,B>;
  
inline int square(int a){ return a * a;}
inline int updiv(int a,int b){ return (a + b - 1) / b; }

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

struct Mo {

  int width;
  vector< int > left, right, order;
  vector< bool > v;

  Mo(int N, int Q) : width((int) sqrt(N)), order(Q), v(N) {
    iota(begin(order), end(order), 0);
  }

  void add(int l, int r) { /* [l, r) */
    left.emplace_back(l);
    right.emplace_back(r);
  }

  template<typename ADD, typename DEL, typename REM>
  void run(const ADD &add, const DEL &del, const REM &rem) {
    assert(left.size() == order.size());
    sort(begin(order), end(order), [&](int a, int b) {
      int ablock = left[a] / width, bblock = left[b] / width;
      if(ablock != bblock) return ablock < bblock;
      if(ablock & 1) return right[a] < right[b];
      return right[a] > right[b];
    });
    int nl = 0, nr = 0;
    auto push = [&](int idx) {
      v[idx].flip();
      if(v[idx]) add(idx);
      else del(idx);
    };
    for(auto idx : order) {
      while(nl > left[idx]) push(--nl);
      while(nr < right[idx]) push(nr++);
      while(nl < left[idx]) push(nl++);
      while(nr > right[idx]) push(--nr);
      rem(idx);
    }
  }
};

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

    int n, q;
    cin >> n >> q;

    vector<int> c(n), v(n+1), res(q);

    rep(i,n){
        cin >> c[i];
    }

    Mo mo(n, q);

    rep(i, q){
        int l, r;
        cin >> l >> r;
        mo.add(l-1, r);
    }

    int ret = 0;
    auto add = [&](int p){
        if(v[c[p]]++ == 0){
            ret++;
        }
    };
    auto del = [&](int p){
        if(v[c[p]]-- == 1){
            ret--;
        }
    };
    auto rem = [&](int p){
        res[p] = ret;
    };

    mo.run(add, del, rem);

    for(auto &&e : res){
        cout << e << '\n';
    }

    return 0;
}



Measured memory_bytes: 27432
#include <bits/stdc++.h>
#define ld long double
#define endl "\n"
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pb(x) push_back(x)
#define mp(a,b) make_pair(a,b)
#define ms(v,x) memset(v,x,sizeof(v))
#define all(v) v.begin(),v.end()
#define ff first
#define ss second
#define rep(i, a, b) for(int i = a; i < (b); ++i)
//#define per(i, a, b) for(int i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define td(v) v.begin(),v.end()
#define sz(v) (int)v.size()
//#define M   1000000007 // 1e9 + 7
#define int long long
using namespace std;
typedef vector<int> vi;
typedef long long ll;
typedef pair<int,int> pii;
inline ll mod(ll n, ll m ){ ll ret = n%m; if(ret < 0) ret += m; return ret; }
ll gcd(ll a, ll b){return (b == 0LL ? a : gcd(b, a%b));}
ll exp(ll a,ll b,ll m){
    if(b==0LL) return 1LL;
    if(b==1LL) return mod(a,m);
    ll k = mod(exp(a,b/2,m),m);
    if(b&1LL){
        return mod(a*mod(k*k,m),m);
    }
    else return mod(k*k,m);
}



int32_t main(){
 fastio;

 char c;
 cin>>c;
 cout << char(c+1)<<endl;
 
  // Math -> gcd it all
  // Did u check N=1? Did you switch N,M?
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define MOD (long long int)(1e9+7)
#define ll long long int
#define rep(i,n) for(int i=0; i<(int)(n); i++)
#define reps(i,n) for(int i=1; i<=(int)(n); i++)
#define REP(i,n) for(int i=n-1; i>=0; i--)
#define REPS(i,n) for(int i=n; i>0; i--)
#define FOR(i,a,b) for(int i=a; i<(int)(b); i++)
#define ALL(x) (x).begin(),(x).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define CLR(a) memset((a), 0 ,sizeof(a))
#define PB push_back
#define MP make_pair
#define SP << " " <<
const int INF = 1001001001;
const ll LINF = 100100100100100100;
const double EPS = 1e-10;
const long double PI  = acos(-1.0L);
typedef pair<int,int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VL;
#define chmax(a,b) a = (((a)<(b))?(b):(a))
#define chmin(a,b) a = (((a)>(b))?(b):(a))

__attribute__((constructor))
void initial(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(15);
}

signed main(){
	int w,a,b; cin>>w>>a>>b;
	if(abs(b-a)<=w) cout<<0<<endl;
	else cout<<min(abs(b-a-w),abs(a-b-w))<<endl;;
	return 0;
}


Measured memory_bytes: 256
def parse_formula(s, pointer):
    head = s[pointer]
    if head == "-":
        pointer += 1
        result, pointer = parse_formula(s, pointer)
        result = 2 - result
    elif head == "(":
        pointer += 1
        result_left, pointer = parse_formula(s, pointer)
        op, pointer = parse_op(s, pointer)
        result_right, pointer = parse_formula(s, pointer)
        result = calc(op, result_left, result_right)
        pointer += 1
    else:
        result = int(head)
        pointer += 1
    return result, pointer


def parse_op(s, pointer):
    return s[pointer], pointer + 1


calc_table1 = {(0, 0):0, (0, 1):0, (0, 2):0,
               (1, 0):0, (1, 1):1, (1, 2):1,
               (2, 0):0, (2, 1):1, (2, 2):2}
calc_table2 = {(0, 0):0, (0, 1):1, (0, 2):2,
               (1, 0):1, (1, 1):1, (1, 2):2,
               (2, 0):2, (2, 1):2, (2, 2):2}


def calc(op, left, right):
    if op == "*":return calc_table1[(left, right)]
    if op == "+":return calc_table2[(left, right)]


while True:
    formula = input()
    if formula == ".":
        break
    ans = 0
    for p in ("0", "1", "2"):
        sp = formula.replace("P", p)
        for q in ("0", "1", "2"):
            sq = sp.replace("Q", q)
            for r in ("0", "1", "2"):
                sr = sq.replace("R", r)
                if parse_formula(sr, 0)[0] == 2:
                    ans += 1
    print(ans)


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

using namespace std;

typedef unsigned int ui;
typedef long long ll;
typedef unsigned long long ull;

constexpr int MAXN = 100;

char s[MAXN + 2];

int main() {
	int N;
	cin >> N >> s;
	int red = 0;
	for(int i = 0; i < N; i++)
		red += s[i] == 'R';
	if(red > N - red)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}


Measured memory_bytes: 256
import scala.io.StdIn._
import scala.math._

object Main extends App with StdInHelper {
  val k = readInt
  val s = readLine

  if (k < s.length()) {
    println(s.take(k) + "...")
  } else {
    println(s)
  }
}

trait StdInHelper {
  def readInts = readLine.split(" ").map(_.toInt)
  def readLongs = readLine.split(" ").map(_.toLong)
}


Measured memory_bytes: 54732
#include<iostream>
#include<string.h>
#include<cstdio>
#include<algorithm>
#include<stack>
#include<queue>
#include<vector>
#include<cmath>
#include<utility>
#define ll long long int
#define ld long double
#define INF 1000000000
#define EPS 0.0000000001
#define rep(i,n) for(i=0;i<n;i++)
using namespace std;
typedef pair<int, int> P;

string str;

int main()
{
  bool prime[110000];
  int i,j;
  int n;
  while(1){
    cin>>n;
    if(n==0)break;
    rep(i,110000)
      prime[i]=false;
    for(i=2;i<110000;i++){
      if(prime[i])continue;
      for(j=2;i*j<110000;j++)
	prime[i*j]=true;
    }
    int ans=0;
    int num=0;
   
    for(i=2;i<110000;i++){
      if(prime[i])continue;
      num++;
      ans+=i;
      if(num==n)break;
    }
    cout<<ans<<endl;
  }
}

Measured memory_bytes: 3108
N = int(input())
A = list(map(int, input().split()))
 
ans = 0
right = sum(A)
left = 0
for i in range(len(A)):
  right -= A[i]
  left += A[i]
  if left > right:
    break
ans1 = abs(left - right)
ans2 = abs((right + A[i]) -  (left - A[i]))

print(min(ans1, ans2))

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

#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define BIT(X,i) ((X>>i)&1)
#define REP(i,a,b) for(int i = (a); i < (b); ++i)
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define SORT(a) sort(all(a))
#define RSORT(a) sort(rall(a))
#define ina(x,n) rep(x_i,n) cin>>x[x_i]
#define outa(x,n) rep(x_i,n) cerr<<x[x_i]<<" \n"[x_i==n-1]

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll, ll> pll;
typedef vector<pll> vll;

const int mod = 1e9+7;
const int inf = (1<<28);
const ll infl = (1LL<<60);

int main() {
  int n; cin >> n;
  vl a(n); ina(a,n);
  bool flag = true;
  rep(i,n) {
    if (a[i]%2==0 && a[i]%3!=0 && a[i]%5!=0) {
      flag = false;
    }
  }
  cout << (flag?"APPROVED":"DENIED") << endl;
  return 0;
}


Measured memory_bytes: 256
/**
 *   created: 28 April 2019  23:46:46
**/
#include<bits/stdc++.h>
using namespace std;

typedef vector<int> vi;
typedef pair<int , int> pii;
typedef vector< pair<int , int> > vii;
typedef long long ll;
typedef vector<long long> vl;
typedef pair<long long , long long> pll;
typedef vector< pair<long long , long long> > vll;

#define PB push_back
#define PPB pop_back
#define all(c) (c).begin,(c).end()
#define rep(i,a,b) for(int i = (int)(a); i < (int)(b); i++)
// #define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
#define INFLL 2000000000000000007
#define INF 2000000007
#define MOD 1000000007


#define TRACE

#ifdef TRACE
#define trace1(x)                cerr << #x << ": " << x << endl;
#define trace2(x, y)             cerr << #x << ": " << x << " | " << #y << ": " << y << endl;
#define trace3(x, y, z)          cerr << #x << ": " << x << " | " << #y << ": " << y << " | " << #z << ": " << z << endl;
#define trace4(a, b, c, d)       cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << endl;
#define trace5(a, b, c, d, e)    cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << endl;
#define trace6(a, b, c, d, e, f) cerr << #a << ": " << a << " | " << #b << ": " << b << " | " << #c << ": " << c << " | " << #d << ": " << d << " | " << #e << ": " << e << " | " << #f << ": " << f << endl;

#else

#define trace1(x)
#define trace2(x, y)
#define trace3(x, y, z)
#define trace4(a, b, c, d)
#define trace5(a, b, c, d, e)
#define trace6(a, b, c, d, e, f)

#endif


void optimizeIO()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
}

//                                        //AUTHOR: Kaushalesh Shukla

//=========================================================================================================
vector< vi > adj;
vl val;
vi vis;

ll dfs(int node,ll x){
	vis[node]=1;
	if(val[node]>=0)
		x = min(x,val[node]);
	for(int t : adj[node]){
		if(!vis[t])
			x = dfs(t,x);
	}
	return x;
}
int main()
{
	optimizeIO();
	int tt=1;
	// cin>>tt;
	while(tt--){
		int a,b;
		cin>>a>>b;
		if(a>=13)
			cout<<b;
		else if(a>5)
			cout<<b/2;
		else
			cout<<0;
	}
	return 0;
}





Measured memory_bytes: 256
#include <iostream>
#include <math.h>
#include <algorithm>
#include <vector>
#include <numeric>
#include <string>
using namespace std;
const double PI = acos(-1.0);
const string alp = "abcdefghijklmnopqrstuvwxyz";
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) FOR(i,0,n)
#define REP1(i,n) FOR(i,1,n+1)
#define SUM(c) accumulate((c).begin(),(c).end(),0)
#define UNIQ(c) (c).erase(unique((c).begin(), (c).end()), (c).end());
#define Yn(b) puts(b?"Yes":"No")
#define YN(b) puts(b?"YES":"NO")
 
bool isprime(int p) {
  if (p==1) return false;
  FOR(i,2,p) {
    if (p%i==0) return false;
  }
  return true;
}

int main(){
  int n,r,dp[100010];
  int c[]={1,6,9,36,81,216,729,1296,6561,7776,46656,59049};
  cin >> n;
  r = 0;
  dp[0]=0;
  REP1(i,n){
    dp[i]=100000;
    REP(j,12){
      if (i<c[j]) {
        j=13;
      } else {
        if(dp[i]>dp[i-c[j]]+1) {
          dp[i]=dp[i-c[j]]+1;
        }
      }
    }
  }
  cout << dp[n];
  return 0;
}

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

int main()
{
    int64_t X, t;
    cin >> X;
    t = 100;
    int64_t ans = 0;
    while (1)
    {
        if (t >= X)
        {
            cout << ans << endl;
            return 0;
        }
        t += t / 100;
        ans++;
    }
}

Measured memory_bytes: 3496
r, c = map(int, input().split())
a, b, ans = [], [], []
for i in range(r):
    a.append([int(x) for x in input().split()])
for i in range(c):
    b.append(int(input()))
for i in range(r):
    tmp = 0
    for j in range(c):
        tmp += a[i][j] * b[j]
    ans.append(tmp)
for x in ans:
    print(x)

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

using namespace std;

const int INF = 1e+9;

int cnt, n, s;

void dfs(int i, int sum, int num)
{
    if(sum == s && num == n)
    {
        cnt++;
        return;
    }
    
    if(i == 10 || num == n)
        return;

    dfs(i + 1, sum + i, num + 1);
    dfs(i + 1, sum, num);
}


int main()
{
    
    while(cin >> n >> s, n || s)
    {
        cnt = 0;
        dfs(0, 0, 0);
        cout << cnt << endl;
    }

    return 0;
}


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

#define FOR( i, m, n )  for( int (i) = (m); (i) < (n); (i)++ )
#define REP( i, n )     FOR( i, 0, n )
#define ALL( a )        (a).begin(), (a).end()             

int main() {
	int n;
	array<int, 5> tmp;

	while( 1 ) {
		cin >> n; if( n == 0 ) break;

		vector<array<int, 5>> p( n );
		REP( i, n ) {
			REP( j, 5 ) {
				cin >> tmp[j];
			}
			p[i] = tmp;
		}

		int m = 0, score = 0;
		while( 1 ) {
			FOR( i, m, n ) {
				int cnt = 0;
				REP( j, 5 ) {

					int tmp = p[i][j];
					if( j != 4 && p[i][j + 1] == tmp ) {
						cnt++;
					} else {
						if( cnt >= 2 ) {
							score += ( cnt + 1 ) * p[i][j];
							REP( k, cnt + 1 ) {
								if( i == 0 ) {
									p[i][j - k] = 0;
								} else {
									REP( l, i ) {
										p[i - l][j - k] = p[i - l - 1][j - k];
									}
									p[0][j - k] = 0;

								}

							}

						}
						cnt = 0;
					}

				}

			}
			m++;
			if( m == n ) break;
		}


		cout << score << endl;
	}

}


Measured memory_bytes: 3072
#include<algorithm>     //sort,二分探索,など
#include<bitset>        //固定長bit集合
#include<cmath>         //pow,logなど
#include<complex>       //複素数
#include<deque>         //両端アクセスのキュー
#include<fstream>       //ファイルストリーム（標準入力変更用）
#include<functional>    //sortのgreater
#include<iomanip>       //setprecision(浮動小数点の出力の誤差)
#include<iostream>      //入出力
#include<iterator>      //集合演算(積集合,和集合,差集合など)
#include<map>           //map(辞書)
#include<numeric>       //iota(整数列の生成),gcdとlcm(c++17)
#include<queue>         //キュー
#include<set>           //集合
#include<stack>         //スタック
#include<string>        //文字列
#include<unordered_map> //イテレータあるけど順序保持しないmap
#include<unordered_set> //イテレータあるけど順序保持しないset
#include<utility>       //pair
#include<vector>        //可変長配列

//名前
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef map<string, int> msi;
typedef map<string, ll> msll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pllll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
typedef vector<vector<ll>> vvll;
typedef vector<vector<string>> vvs;
typedef vector<vector<bool>> vvb;

//定数
const ll MOD = 1000000007;
const ll INF = 1000000000000000000;

//マクロ
#define rep(i,n) for(int i=0;i<n;i++)
#define reps(i,s,e) for(int i=s;i<e;i++)
#define repse(i,s,e) for(int i=s;i<=e;i++)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define in(x1) cin >> x1
#define in2(x1, x2) cin >> x1 >> x2
#define in3(x1, x2, x3) cin >> x1 >> x2 >> x3
#define inN(x, N) rep(i, N) in(x[i])
#define outl(x) cout << x << endl
#define out2l(x, y) cout << x << " " << y << endl 

//よく使う関数
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }

vector<int> eratosthenes(const int N)
{
    vector<bool> isPrime(N + 1, true);

    vector<int> P;
    for (int i = 2; i <= N; i++)
    {
        if (isPrime[i])
        {
            for (int j = 2 * i; j <= N; j += i)
            {
                isPrime[j] = false;
            }
            P.emplace_back(i);
        }
    }
    return P;
}

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

    //標準入力をファイルに変更
    //std::ifstream in("input.txt");
    //std::cin.rdbuf(in.rdbuf());

    int X;
    in(X);

    auto v = eratosthenes(100010);

    auto itr = lower_bound(all(v), X);

    outl(*itr);

    return 0;
}

Measured memory_bytes: 3748
n=int(input())
men=[0]*(n+1)
sta=[[[0]]]
for i in range(1,n+1):
  men[i]=int(input())
  xy=[list(map(int,input().split())) for j in range(men[i])]
  sta.append(xy)
ho=0
for bi in range(2**n):
  honest=[-1]*(n+1)
  honest[0]=0
  x=format(bi,'b')
  x='0'*(n-len(x)+1)+x
  ok='Yes'
  for i in range(1,n+1):
    if x[i]=='1':
      for j in range(men[i]):
        if sta[i][j][1]!=int(x[sta[i][j][0]]):
          ok='No'
  if ok=='Yes':
    ho=max(ho,x.count('1'))

print(ho)

Measured memory_bytes: 3064
#include<stdio.h>

long ruijo(int a){
	int i;
	long tmp=1;
	for(i=0;i<a;i++)tmp*=10;
	return tmp;
}

int main(){
	long n;scanf("%ld",&n);
	int kakui[4]={0,3,5,7},ans=0,count=0,keta[11]={-1};
	long tmp=0;
	while(n>=tmp){
		int i=0;
		for(i=0;i<11;i++)keta[i]=-1;
		i=0;
		int cpy=count;
		while(cpy>0){
			keta[i]=cpy%4;
			cpy-=keta[i];
			cpy=cpy/4;i++;
		}
	//	keta[i]=0;
//		for(i=0;i<10;i++)printf("%d,",keta[i]);
//		puts("OK");
		int flag[4]={0};
		tmp=0;
		for(i=0;keta[i]!=-1;i++){
				tmp+=ruijo(i)*kakui[keta[i]];
				flag[keta[i]]++;
		}
//		for(i=0;i<4;i++)printf("%d,",flag[i]);
//		printf("!!%ld\n",tmp);
		if(flag[1]!=0&&flag[2]!=0&&flag[3]!=0){
			if(flag[0]==0){
				if(n>=tmp)ans++;
//				puts("IN");
			}
		}
		count++;
	}
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 128