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

int main() {
    int N, M;
    cin >> N >> M;
    vector<int> ac(N), wa(N);
    int p;
    string S;
    for (int i = 0; i < M; i++) {
        cin >> p >> S;
        if (S == "AC") ac[p - 1] = 1;
        else if (ac[p - 1] == 0) wa[p - 1]++;
    }

    int A = 0, P = 0;
    for (int i = 0; i < N; i++) {
        if (ac[i] == 1) {
            A++;
            P += wa[i];
        }
    }

    cout << A << " " << P << endl;
}

Measured memory_bytes: 1024
a,b,c = map(int,input().split())
k = int(input())
d = 0
for i in range(k+1):
    if b <= a:
        b *= 2
    elif c <= b:
        c *= 2
    else:
        d = 1
if d == 0:
    print("No")
else:
    print("Yes")

Measured memory_bytes: 9176
#include <cstdio>
#include <cstring>

int n;
int a[123456];

int main()
{
	scanf("%d",&n);
	for (int i = 0; i < n; ++i)
	{
		scanf("%d", a + i);
		--a[i];
	}
	int answer = 0;
	for (int i = 0; i < n; ++i)
	{
		if (a[a[i]] == i)
		{
			++answer;
		}
	}
	printf("%d\n",answer / 2);
}

Measured memory_bytes: 512
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define REP(i,n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i,n) for(int i=n; i>-1; --i)
#define ALL(a) (a).begin(),(a).end()
#define INIT(a,n,x); REP(i,(n)){ (a)[i]=(x); }
#define CINA(a,n); REP(i,(n)){ cin >> (a)[i]; }
#define INIT2(a,n,m,x); REP(i,(n)){ REP(j,(m)){(a)[i][j]=(x);} }
#define CINA2(a,n,m); REP(i,(n)){ REP(j,(m)){cin >> (a)[i][j];} }
#define Liny "Yes\n"
#define Linn "No\n"
#define LINY "YES\n"
#define LINN "NO\n"

#define umap unordered_map
//cout << setfill('0') << right << setw(4) << 12; // "0012"
int keta(ll x){ if(x<10){return 1;} else{return keta(x/10) + 1;}}
int keta_wa(ll x){ if(x<10){return x;} else{return keta_wa(x/10) + x%10;} }
int ctoi(char c){ return ( (c>='0' && c<='9')? c - '0': 0 );}
ll gcd(ll a,ll b){if(a<b)swap(a,b); return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b){if(a<b){swap(a,b);} return a*b /gcd(a,b);}

int main(){
  int N; cin >> N;
  ld v[N]; CINA(v,N);
  sort(v,v+N);
  ld r = v[0];
  for(int i=1;i<N;i++){
    r = (r+v[i])/2;
  }
  cout << r;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    void solve(){
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int a = scan.nextInt();
        System.out.println(n % 500 <= a ? "Yes" : "No");
    }
    
    public static void main(String[] args){
        new Main().solve();
    }
}


Measured memory_bytes: 35828
#include <bits/stdc++.h>
#include <iomanip>
 
using namespace std;
 
typedef long long LL;
typedef long double LD;
typedef pair<int, int> PII;
typedef pair<LL, LL> PLL;
typedef pair<LD, LD> PLDLD;
typedef vector<int> VI;
typedef vector<char> VB;
 
#define FOR(i,a,b) for(int i=(a);i<(int)(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define CLR(a) memset((a), 0 ,sizeof(a))
#define ALL(a) a.begin(),a.end()
 
const LD eps=1e-5;
//const long long INF=(LL)(1e9)*(LL)(1e9);
const int INF=1e9;
 
template<class T>
void chmin(T& a, const T& b)
{
	if(a>b)
		a=b;
}
template<class T>
void chmax(T& a, const T& b)
{
	if(a<b)
		a=b;
}
 
const LL pow(const LL p, const LL q)
{
	LL t=1;
	REP(i,q)
		t*=p;
	return t;
}

//print for container
/*
template<typename T, typename U = typename T::iterator>
void print(const T container)
{
		auto&& first=begin(container), last=end(container);
		auto&& back=prev(last);
		for(auto e=first; e!=last; e=next(e))
			cout<<*e<<" \n"[e==back];
}*/

template<typename Head>
void print(const Head& head)
{
	cout<<head<<endl;
}

template<typename Head, typename... Tail>
void print(const Head& head, const Tail&... tail)
{
	cout<<head<<" ";
	print(tail...);
}

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

template<typename T>
T read()
{
	T t;
	cin>>t;
	return t;
}


int main()
{
	int n,m;
	cin>>n>>m;
	int ans=0;
	ans+=(n-m)*100;
	ans+=m*1900;
	ans*=(1<<m);
	cout<<ans<<endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <numeric>
#include <cmath>
#include <limits>
#include <stdio.h>
#include <iomanip>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
using namespace std;
using ll = long long;
#define rep(i, n) for (long long i = 0; i < (long long)(n); i++)
ll Max(ll(a), ll(b), ll(c)) {
	return max(max(a, b), c);
}
ll Min(ll(a), ll(b), ll(c)) {
	return min(min(a, b), c);
}





int main() {

	ll K, A, B;
	cin >> K >> A >> B;
	if (A + 2 >= B)cout << K + 1 << endl;
	else {
		cout << (B - A) * max(ll(0), (K - A + 1) / 2)+1+K- 2*max(ll(0), (K - A + 1) / 2) << endl;
	}
}


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


int main() {
  int X;
  cin >> X;

  assert(400 <= X && X <= 1999);
  int kyu;
  if (X < 600) kyu = 8;
  else if (X < 800) kyu = 7;
  else if (X < 1000) kyu = 6;
  else if (X < 1200) kyu = 5;
  else if (X < 1400) kyu = 4;
  else if (X < 1600) kyu = 3;
  else if (X < 1800) kyu = 2;
  else if (X < 2000) kyu = 1;
  else throw runtime_error("what's?");

  cout << kyu << endl;
  return 0;
}


Measured memory_bytes: 3628
lines = []
while line = gets
    lines << line.chomp.split(' ').map(&:to_i)
end

N = lines[0][0]
K = lines[0][1]

hp = lines[1].sort.reverse

for i in 1..K do
  hp[i-1] = 0
end

num_attack = 0
for i in 1..N do
  num_attack += hp[i-1]
end

print num_attack

Measured memory_bytes: 22500
import java.util.Scanner;

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

    static void solve(Scanner sc) {
        int a = sc.nextInt();
        int b = sc.nextInt();
        int c = sc.nextInt();
        int d = sc.nextInt();

        if (d <= a || b <= c) {
            System.out.println(0);
            return;
        }

        if (c <= a) {
            if (d <= b) {
                System.out.println(d - a);
            } else {
                System.out.println(b - a);
            }
        } else if (c < b) {
            if (d <= b) {
                System.out.println(d - c);
            } else {
                System.out.println(b - c);
            }
        }
    }
}

Measured memory_bytes: 22612
n = int(input())
A = list(map(int, input().split()))

l = [[] for i in range(n)]

for i in range(n):
    l[i] = [A[i], i+1]

l.sort()

ans = [0 for i in range(n)]
for i in range(n):
    ans[i] = l[i][1]

print(*ans)

Measured memory_bytes: 68844
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cstdio>
#include<cmath>
#include<deque>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<string>
#include<tuple>
#include<utility>
#include<vector>
using namespace std;

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

#define rep(i, a, n)  for(int i=a; i<n; i++)
#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 PER(i, n) for(int i=(int)(n)-1; i>= 0; i--)
#define PERS(i, n)  for(int i=(int)(n); i>0; i--)
#define FOR(i, c) for(__typeof((c).begin()) i = (c).begin(); i!=(c).end(); i++)
#define RFOR(i, c)  for(__typeof((c).rbegin()) i=(c).rbegin(); i!=(c).end(); i++)
#define ALL(container)  (container).begin(), (container).end()
#define RALL(container) (container).rbegin(), (container).rend()
#define SZ(container) (container).size()
#define FILL0(n)  setfill('0') << right << setw(n)
#define mp(a, b)  make_pair(a, b)
#define toLower(c)  c+0x20
#define toUpper(c)  c-0x20
#define pb  push_back
#define eb  emplace_back

const int INF = 1e9;
const long long LLINF = 1e18;
const int MOD = 1000000007;

int main(){
  int cnt = 0;
  ll yen = 100.0;
  ll x; cin >> x;
  while(yen<x){
    yen *= 1.01;

    cnt++;
  }
  cout << cnt << endl;
  return 0;
}


Measured memory_bytes: 3636
#include <algorithm>
#include <bitset>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <stack>
#include <stdio.h>
#include <string>
#include <utility>
#include <vector>

using namespace std;

// 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();
}

// math
//-------------------------------------------
template <class T> inline T sqr(T x) { return x * x; }

// typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

// container util
//------------------------------------------
#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c)                                                             \
  for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORT(c) sort((c).begin(), (c).end())

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

// constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);

// clear memory
#define CLR(a) memset((a), 0, sizeof(a))

// debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x)                                                               \
  cerr << #x << " = " << (x) << " (L" << __LINE__ << ")"                       \
       << " " << __FILE__ << endl;

const string YES = "Yes";
const string NO = "No";

void solve(std::string S) {
    SORT(S);
    if(S[0]==S[1] && S[2]==S[3] && S[0]!=S[2]&& S[0]!=S[3] &&S[1]!=S[2] && S[1] !=S[3]){
      cout<<"Yes"<<endl;
    }
    else{
      cout<<"No"<<endl;
    }
}

int main() {
  std::string S;
  std::cin >> S;
  solve(S);
  return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
#define mod ((int)1e9+7)
#define lim 1000000000000000007
#define lim1 18446744073709551615  //Unsigned
#define sq(a) ((a)*(a))
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define mms(v,i) memset(v,i,sizeof(v))
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define REPN(i,a,b) for (int i = a; i >= b; i--)
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> pi;
typedef pair<ll,ll> PL;
typedef pair<ll,int> PLI;
typedef pair<int,ll> PIL;
typedef pair<int,pair<int,int> > pii;
typedef pair<double,double> pdd;
typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> indexed_set;
ll power(ll a,ll b) {
   ll res=1;
   while(b){
      if(b%2==1) res=(res*a)%mod;
      a=(a*a)%mod;
      b>>=1;
   }
   return res;
}
ll gcdll(ll a,ll b) {
    if (b==0) return a;
    return gcdll(b,a%b);
}
int gcd(int a,int b) {
    if (b==0) return a;
    return gcd(b,a%b);
}

struct custom_hash {
    static uint64_t splitmix64(uint64_t x) {
        // http://xorshift.di.unimi.it/splitmix64.c
        x += 0x9e3779b97f4a7c15;
        x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
        x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
        return x ^ (x >> 31);
    }

    size_t operator()(uint64_t x) const {
        static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count();
        return splitmix64(x + FIXED_RANDOM);
    }
};

const int N = (int)2e5+5;
const int M = (int)3e3+5;
const int Q = 301;
const int logN = 19;

void solve() {
    int n,m;
    cin>>n>>m;
    for(int i=0,a;i<m;i++) {
        cin>>a;
        n -= a;
    }
    if(n<0) cout<<-1;
    else cout<<n;
}
int main() {
    //freopen("output.txt","r",stdin);
    //freopen("output.txt","w",stdout);

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

    int T=1;
    //cin>>T;
    REP(TC,1,T) {
        //cout<<"Case #"<<TC<<": ";
        solve();
        //cout<<"\n";
    }
}


Measured memory_bytes: 3560
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) x.begin(), x.end()
using namespace std;
typedef long long ll;
const int inf = 1000000000; //10^9
const ll inff = 1000000000000000000; //10^18

int main(){
    int n;
    string s;
    cin >> n >> s;
    int ans = 0;

    for(int i = 0; i < 1000; i++) {
        int a[3] = {i / 100, (i / 10) % 10, i % 10};
        int cou = 0;
        for(int j = 0; j < n; j++) {
            if(a[cou] == (s[j] - '0')) cou++;
            if(cou == 3) break;
        }
        if(cou == 3) ans++;
    }

    cout << ans << endl;

    return 0;
}

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

using namespace std;

int main(){
  long n,k;
   cin >>n >> k;
  vector<long> v(n);
  for(long i=0;i<n;i++) cin >> v[i];
  
  long r=min(n,k);
  
  long res=0;
  
  for(long a=0;a<=r;a++){
    for(long b=0;b<=r-a;b++){
       long sum=0;
       vector<long> w;
      
       for(long i=0;i<a;i++){
        w.push_back(v[i]);
         sum+=v[i];
       } 
       for(long i=0;i<b;i++){
        w.push_back(v[n-1-i]);
         sum+=v[n-1-i];
       }
      
       sort(w.begin(),w.end());
      
      for(long i=0;i<k-a-b&&i<w.size();i++) sum-=min(w[i],long(0));
      
      res=max(res,sum);
    }
  }
    
  cout << res << endl;
  
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip> 
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <queue>
#include <stack>
#include <vector>
#include <map>
#include <set>
#include <functional>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <bitset>

using namespace std;


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

	long long a, b, c, n, x, y;
	cin >> n;
	for (a = 1; a <= 3500; a++) {
		for (b = a; b <= 3500; b++) {
			x = n * a * b;
			y = 4 * a * b - n * (a + b);
			if ((y > 0) && (x % y == 0)) {
				c = x / y;
				goto outer;
			}
		}
	}
outer:;
	cout << a << " " << b << " " << c << "\n";
		
	return 0;
}


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

int main() {
  int N, L;
  cin >> N >> L;
  vector<string> S(N);
  for (int i = 0; i < N; i++) cin >> S[i];

  // 文字列をソート
  for (int i = 0; i < N-1; i++) {
    int min = i;
    for (int j = i+1; j < N; j++) {
      if (S[min] > S[j]) min = j;
    }
    // swap
    string temp = S[i];
    S[i] = S[min];
    S[min] = temp;
  }

  for (int i = 0; i < N; i++) cout << S[i];
  cout << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <map>
#include <string>
#include <sstream>
#include <math.h>

using namespace std;
//for (int i = 0; i < N; i++){}


int main() {
    long long X;
	cin >> X;
    int res = 0;
    int i = 0;
    while(res < X){
        res += i;
        if(res >= X){
            cout << i << endl;
        }
        i++;
    }
}

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

int main() {
    int n;
    scanf("%d", &n);
    vector<string> s(n);
    rep(i, n) {
        cin >> s[i];
        sort(s[i].begin(), s[i].end());
    }
    sort(s.begin(), s.end());
    long cnt = 0;
    // for (int i = 0; i < n - 1; i++) {
    //     for (int j = i + 1; j < n; j++) {
    //         if (s[i] == s[j]) cnt++;
    //     }
    // }
    long ans = 0;
    if (n == 2) {
        if (s[0] == s[1]) {
            ans = 1;
        }
    } else {
        rep(i, n-1) {
            if (s[i] == s[i+1]) {
                cnt++;
            } else {
                ans += cnt * (cnt + 1) / 2;
                cnt = 0;
            }
            if (i == n-2) {
                ans += cnt * (cnt + 1) / 2;
            }
        }
    }
    cout << ans << endl;
    // string s = "acornistnt";
    // sort(s.begin(), s.end());
    // cout << s << endl;
}

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

void Main()
{
  int N; cin >> N;
  vector<string> S(N);
  vector<ll> cnt(5);
  rep(i,N) {
    cin >> S[i];
    //cout << S[i] << "\n";
    
    if (S[i][0] == 'M') cnt[0]++;
    else if (S[i][0] == 'A') cnt[1]++;
    else if (S[i][0] == 'R') cnt[2]++;
    else if (S[i][0] == 'C') cnt[3]++;
    else if (S[i][0] == 'H') cnt[4]++;
  }
  ll ans = 0;
 
  ans += cnt[0] * cnt[1] * cnt[2];
  ans += cnt[0] * cnt[1] * cnt[3];
  ans += cnt[0] * cnt[1] * cnt[4];
  ans += cnt[0] * cnt[2] * cnt[3];
  ans += cnt[0] * cnt[2] * cnt[4];
  ans += cnt[0] * cnt[3] * cnt[4];
  ans += cnt[1] * cnt[2] * cnt[3];
  ans += cnt[1] * cnt[2] * cnt[4];
  ans += cnt[1] * cnt[3] * cnt[4];
  ans += cnt[2] * cnt[3] * cnt[4];
  
  cout << ans << "\n";
}

int main()
{
  cin.tie(nullptr);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(20);
  Main();
  return 0;
}


Measured memory_bytes: 5760
#include <cstdio>
#include <vector>
using namespace std;

int main(){
	int n, k;
	while( scanf("%d %d", &n, &k), n && k ){
		vector<int> data(n);
		for( int i=0; i<n; i++ ){
			scanf("%d", &data[i]);
		}
		int ans = 0;
		int sum = 0;
		for( int i=0; i<k; i++ ) sum += data[i];
		for( int i=k; i<n; i++ ){
			sum += data[i] - data[i-k];
			ans = max(ans, sum);
		}
		printf("%d\n", ans);
	}
}

Measured memory_bytes: 1268
#pragma warning disable

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Text.RegularExpressions;
using System.Diagnostics;
using System.Numerics;
using System.Collections;
using System.Timers;

static class MainClass
{
    public static void Main(string[] args)
    {
        var abcd = Console.ReadLine().SplittedStringToInt32List();
        var a = abcd[0];
        var b = abcd[1];
        var c = abcd[2];
        var d = abcd[3];
        var min = a > c ? a : c;
        var max = b > d ? d : b;
        Console.WriteLine(max -min >= 0? max - min : 0);
        Console.ReadLine();
    }

    #region ライブラリ

    #region 文字列処理

    public static int ToInt32(this string str) => int.Parse(str);
    public static BigInteger ToBigInteger(this string str) => BigInteger.Parse(str);
    public static List<string> SplittedStringToList(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).ToList();
    public static List<int> SplittedStringToInt32List(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();

    public static List<BigInteger> SplittedStringToBigInteger(this string str) => str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(x => BigInteger.Parse(x)).ToList();
    #endregion
    #region DeepClone
    public static T DeepClone<T>(this T src)
    {
        using (var memoryStream = new MemoryStream())
        {
            var binaryFormatter
              = new BinaryFormatter();
            binaryFormatter.Serialize(memoryStream, src);
            memoryStream.Seek(0, SeekOrigin.Begin);
            return (T)binaryFormatter.Deserialize(memoryStream);
        }
    }
    #endregion

    public static int Gcd(int a,int b)
    {
        if (b == 0)
            return a;
        return Gcd(b, a % b);
    }
    public static BigInteger Gcd(BigInteger a, BigInteger b)
    {
        if (b == 0)
            return a;
        return Gcd(b, a % b);
    }


    public static BigInteger Factorial(int n)
    {
        var dp = new BigInteger[n];
        dp[0] = 1;
        for (int i = 1; i < n; i++)
        {
            dp[i] = dp[i - 1] * (i + 1);
        }
        return dp[n - 1];
    }

    #endregion

}


Measured memory_bytes: 13268
import itertools
import math

n = int(input())
xy = [list(map(int,input().split())) for i in range(n)]
q = list(itertools.permutations(range(n)))
m = len(q)

k_sum = 0

for i in range(m):
  for j in range(n-1):
    a = xy[q[i][j]][0] - xy[q[i][j+1]][0]
    x = a**2
    b = xy[q[i][j]][1] - xy[q[i][j+1]][1]
    y = b**2
    k_sum += math.sqrt(x+y)
    
print(k_sum/m)

Measured memory_bytes: 13920
#include <iostream>
#include <string>
#include <stdio.h>
#include <sstream>
using namespace std;

int main(){
    string s;
    cin >> s;
   
    if( atoi(s.substr(0,4).c_str()) <= 2019){
        if( atoi(s.substr(5,7).c_str()) > 4 && atoi(s.substr(0,4).c_str()) == 2019){
            cout << "TBD" << endl;
        }else{
            cout << "Heisei" << endl;
        }
    }else{
        cout << "TBD" << endl;
    }
}

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

#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 bitcount    __builtin_popcountll
#define si(x)       scanf("%d",&x)
#define su(x)       scanf("%u",&x)
#define sll(x)      scanf("%lld",&x)
#define sl(x)       scanf("%ld",&x)     
#define sc(x)       scanf("%c",&x)
#define ss(x)       scanf("%s",x)
#define sf(x)       scanf("%f",&x)
#define slf(x)      scanf("%lf",&x)
#define pri(x)      printf("%d\n",x)
#define prl(x)      printf("%lld\n",x)
#define ll          long long int
#define pb          push_back
#define mp          make_pair
#define pii         pair<int,int>
#define pll         pair<long long,long long>
#define pil         pair<int,long long>
#define pli         pair<long long,int>
#define vi          vector<int>
#define vl          vector<long long>
#define all(a)      (a).begin(),(a).end()
#define F           first
#define S           second
#define sz(x)       (int)x.size()
#define rep(i,a,b)  for(int i=a;i<=b;i++)
#define repl(i,a,b) for(long long i=a;i<=b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define rrepl(i,a,b) for(long long i=a;i>=b;i--)
#define M           1000000007

const int maxn=62;

ll pow2[maxn];

void init(){
    pow2[0]=1;
    rep(i,1,maxn-1){
        pow2[i]=2*pow2[i-1];
    }
}

void solve(){
    init();
    ll n,p,z,y,x;
    sll(x); sll(y);
    z=y/x;
    rep(i,0,maxn-2){
        if(z>=pow2[i] and z<pow2[i+1]){
            pri(i+1);
            return;
        }
    }

}
int main()
{
    //ios_base::sync_with_stdio(false);
    //cin.tie(NULL);
    //cout.tie(NULL);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    int t=1;
    //si(t);
    while(t--){
        solve();
    }
    
    return 0;
}

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


int main() {
    int n;
    std::cin >> n;

    auto sorted_strings = std::unordered_map<std::string, uint64_t>();

    for(int i = 0; i < n; ++i) {
        std::string s;
        std::cin >> s;
        std::sort(s.begin(), s.end());

        ++sorted_strings[s];
    }

    uint64_t answer = 0;

    for(const auto x: sorted_strings) {
        const auto y = x.second;
        answer += y * (y - 1) / 2;
    }

    std::cout << answer << std::endl;

    return 0;
}


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

using namespace std;

int main(){
  int k;
  string s;
  cin >> k;
  cin.ignore();
  cin >> s;
  cin.ignore();

  if(s.size() <= k){
    cout << s << endl;
    return 0;
  }

  for (int i = 0; i < k; i++){
    cout << s[i] << flush;
  }
  cout << "..." << endl;
  return 0;
}


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

// #define int long long
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i = (int)(m); i < (int)(n); ++i)
#define ireps(i, m, n) for (int i = (int)(m); i <= (int)(n); ++i)
#define SORT(v, n) sort(v, v + n);
#define REVERSE(v, n) reverse(v, v+n);
#define vsort(v) sort(v.begin(), v.end());
#define all(v) v.begin(), v.end()
#define mp(n, m) make_pair(n, m);
#define cout(d) cout<<d<<endl;
#define coutd(d) cout<<std::setprecision(10)<<d<<endl;
#define cinline(n) getline(cin,n);
#define replace_all(s, b, a) replace(s.begin(),s.end(), b, a);
#define PI (acos(-1))
#define FILL(v, n, x) fill(v, v + n, x);
#define sz(x) int(x.size())

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vs = vector<string>;
using vpll = vector<pair<ll, ll>>;

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

const ll INF = 1e15;
const int MOD = 1e9+7;
const ll LINF = 1e18;


char G[1005][1005];
ll dist[1005][1005];
ll dp[1005][1005];

const ll dy[] = {0, 1, 0, -1, -1, 1, 1, -1};
const ll dx[] = {1, 0, -1, 0, 1, 1, -1, -1};

inline bool inside(ll y, ll x, ll H, ll W) {
    return (y >= 0 && x >= 0 && y < H && x < W);
}

signed main()
{
  cin.tie( 0 ); ios::sync_with_stdio( false );
  ll h,w; cin>>h>>w;
  rep(i,h) rep(j,w) cin>>G[i][j];
  memset(dist,-1,sizeof(dist));
  queue<pll> q;
  q.emplace(0,0);
  dp[0][0]=1;
  dist[0][0]=0;
  while(!q.empty()){
    ll y=q.front().first;
    ll x=q.front().second;
    q.pop();
    rep(i,2){
      ll ny=y+dy[i];
      ll nx=x+dx[i];
      if(inside(ny,nx,h,w)&&G[ny][nx]=='.'){
        if(dist[ny][nx]==-1){
          q.emplace(ny,nx);
          dist[ny][nx]=dist[y][x]+1;
        }
        (dp[ny][nx]+=dp[y][x])%=MOD;
      }
    }
  }
  
  cout<<dp[h-1][w-1]<<endl;
}

Measured memory_bytes: 17024
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		String c = sc.next();
		if(a.substring(a.length()-1).equals(b.substring(0,1)) && b.substring(b.length()-1).equals(c.substring(0,1))) {
			System.out.println("YES");
		}
		else {
			System.out.println("NO");
		}
	}
}

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

using namespace std;
using ll = long long;
using pii = pair<int, int>;

int main() {
  cin.tie(0);
  ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(10);
  
  int N, M;
  cin >> N >> M;

  vector<vector<int>> G(N);
  for (int i = 0; i < M; i++) {
    int a, b;
    cin >> a >> b;
    a--, b--;
    G[a].emplace_back(b);
    G[b].emplace_back(a);
  }

  vector<int> ord(N - 1);
  iota(ord.begin(), ord.end(), 1);
  
  int ans = 0;
  do {
    int now = 0;
    bool yes = true;
    for (int &i : ord) {
      for (auto &u : G[now]) if (u == i) {
        now = u;
        break;
      }
      yes &= now == i;
    }
    ans += yes;
  } while (next_permutation(ord.begin(), ord.end()));
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FAST ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define vi vector <int>
#define pf push_front
#define pb push_back
#define fi first
#define se second
#define mp make_pair
#define el "\n"
#define all(v) v.begin(),v.end()
#define ull unsigned long long
#define int long long
#define MAXN   10000001
const int no_of_chars = 256;
const int mod = 1e9 + 7;
int i, j;
int fastpow(int x, int y)
{
	int res = 1;
	x %= mod;
	while (y)
	{
		if (y & 1)
			res = (res * x) % mod;
		x = (x * x) % mod;
		y = (y >> 1);
	}
	return res;
}

int prod(int x, int y)
{
	int res = 0;
	x %= mod;
	while (y)
	{
		if (y & 1)
			res = (res + x) % mod;
		x = (x * 2) % mod;
		y = y >> 1;
	}
	return res;
}

int32_t main()
{
	FAST;

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

	int t = 1;
	//cin >> t;
	while (t--) {
		int n;
		cin >> n;
		int a = n % 10;
		if (a == 2 || a == 5 || a == 7 || a == 9 || a == 4)
			cout << "hon" << endl;
		else if (a == 0 || a == 6 || a == 1 || a == 8)
			cout << "pon" << endl;
		else if (a == 3)
			cout << "bon" << endl;
	}
	return 0;
}


Measured memory_bytes: 3652
N, M = map(int, input().split())
AC_list = set()
WA_list = {}
WA = 0
AC = 0
for i in range(M):
    p, S = map(str, input().split())
    p = int(p)

    if S == "AC":
        if p in AC_list:
            continue
        else:
            AC += 1
            AC_list.add(p)
    elif S == "WA":
        if p not in AC_list:
            if p not in WA_list:
                WA_list[p] = 1
            else:
                WA_list[p] += 1
        else:
            continue

for key, val in WA_list.items():
    if key in AC_list:
        WA += val
    else:
        continue

print(AC, WA)

Measured memory_bytes: 50392
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

using namespace std;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = n-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define rrep1(i,n) for(int i = (n); i >= 1; --i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(vec) for(auto v : vec) cerr << v << " "; cerr << endl;
#define debug2D(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << v << " "; cerr << endl; } 
#define debugP(vec) for(auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl;
#define debug2DP(vec2D) for(auto vec : vec2D) { for (auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl; } 

typedef long long ll;

constexpr ll INF = 1000000000; //10^10
//const ll MOD = 998244353;
constexpr ll MOD = 1000000007;

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

pair<ll,int> dfs(vector<vector<int>> &g, int n, int par, int v, int d) {
  ll ans0 = 1;

	if (v == n-1) {
		return {1, d};
	}

	int nLength = -1;
	for (int w : g[v]) {
	  if (w == par) continue;
		auto _dfs = dfs(g, n, v, w, d + 1);
		ll verN = _dfs.first;
		int length = _dfs.second;

		chmax(nLength, length);
		if (length == -1 || d + 1 <= length / 2) {
			ans0 += verN;
		}
		
	}

	return {ans0, nLength};
}

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

	ll n; cin >> n;
	vector<vector<int>> graph(n, vector<int>());
	rep(i, n - 1) {
		int a, b;
		cin >> a >> b;
		a--;b--;
		graph[a].push_back(b);
		graph[b].push_back(a);
	}

	ll FScore = dfs(graph, n, -1, 0, 0).first;
	cerr << FScore << endl;
	if (FScore > n - FScore) cout << "Fennec" << endl;
	else cout << "Snuke" << endl;
}

Measured memory_bytes: 13568
import java.util.Scanner;
public class Main {
	static Scanner scan=new Scanner(System.in);
	static int gcd (int a, int b) {return b>0?gcd(b,a%b):a;}
	static long lcm (int a, int b) {return a*b/gcd(a,b);}
	static int max(int a,int b) {return a>b?a:b;}
	static int min(int a,int b) {return a<b?a:b;}
	static long factorial(int i) {return i==1?1:i*factorial(i-1);}
	static int lower_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<=key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static int upper_bound(int a[],int key) {
		int low=0,high=a.length;
		while(low<high) {
			int mid=((high-low)/2)+low;
			if(a[mid]<key)low=mid+1;
			else high=mid;
		}
		return high;
		}
	static boolean isPrime (int n) {
		if (n==2) return true;
		if (n<2 || n%2==0) return false;
		double d = Math.sqrt(n);
		for (int i=3; i<=d; i+=2)if(n%i==0){return false;}
		return true;
	}
	
	
		public static void main(String[] args) {
			Scanner scan=new Scanner(System.in);
			int a=scan.nextInt();
			System.out.println(3*a*a);
		}
}

Measured memory_bytes: 22996
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vint;
typedef pair<int,int> pint;
typedef vector<pint> vpint;
#define rep(i,n) for(int i=0;i<(n);i++)
#define REP(i,n) for(int i=n-1;i>=(0);i--)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
#define each(it,v) for(__typeof((v).begin()) it=(v).begin();it!=(v).end();it++)
#define all(v) (v).begin(),(v).end()
#define eall(v) unique(all(v), v.end())
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define chmax(a, b) a = (((a)<(b)) ? (b) : (a))
#define chmin(a, b) a = (((a)>(b)) ? (b) : (a))
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll INFF = 1e18;

int n;
int a[110];
int memo[10];
int main(void){
	cin >> n;
	rep(i, n){
		cin >> a[i];
	}
	rep(i, n){
		int d = a[i];
		if(1 <= d && d <= 399) memo[0]++;
		else if(400 <= d && d <= 799) memo[1]++;
		else if(800 <= d && d <= 1199) memo[2]++;
		else if(1200 <= d && d <= 1599) memo[3]++;
		else if(1600 <= d && d <= 1999) memo[4]++;
		else if(2000 <= d && d <= 2399) memo[5]++;
		else if(2400 <= d && d <= 2799) memo[6]++;
		else if(2800 <= d && d <= 3199) memo[7]++;
		else if(3200 <= d) memo[8]++;
	}
	// rep(i, 9) printf("%d ", memo[i]);
	// printf("\n");
	int cnt = 0;
	rep(i, 8) if(memo[i] > 0)cnt++;
	if(cnt != 0){
		printf("%d %d\n", cnt, cnt + memo[8]);
	}else{
		printf("%d %d\n", 1, cnt + memo[8]);
	}
	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<iomanip>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<functional>
#include<map>
#include<cstdlib>
#include<complex>
#include<numeric>
#include<set>
#include<deque>
#include<queue>

using namespace std;
using Int = long long;
Int INF = 1LL << 60;
const Int MOD = 1000000000 + 7;

template <class T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
	for (const auto& e : vec) os << e << (&e == &vec.back() ? "\n" : " ");
	return os;
}
template <class T>
ostream& operator<<(ostream& os, const set<T>& st) {
	for (const auto& e : st) os << e << " ";
	return os;
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& p) {
	os << "(" << p.first << "," << p.second << ")";
	return os;
}
template <class T1, class T2>
ostream& operator<<(ostream& os, const map<T1, T2>& mp) {
	for (const auto& e : mp) os << e << " ";
	return os;
}

#ifdef _DEBUG
template <class T>
void dump(const char* str, T&& h) { cerr << str << " = " << h << "\n"; };
template <class Head, class... Tail>
void dump(const char* str, Head&& h, Tail&&... t) {
	while (*str != ',') cerr << *str++; cerr << " = " << h << "\n";
	dump(str + (*(str + 1) == ' ' ? 2 : 1), t...);
}
#define DMP(...) dump(#__VA_ARGS__, __VA_ARGS__)
#else 
#define DMP(...) ((void)0)
#endif

int main() {

	cin.tie(nullptr);
	ios::sync_with_stdio(false);

	Int N, K, R, S, P;
	string T;
	cin >> N >> K >> R >> S >> P >> T;

	vector<vector<Int>> dp(N+1, vector<Int>(3));

	//初期化（modKのそれぞれを初期化する必要がある？）
	for (Int i = 0; i < K; i++) {
		if (T[i] == 's') {
			dp[i+1][0] = R;
		}
		else if (T[i] == 'r') {
			dp[i+1][2] = P;
		}
		else {
			dp[i+1][1] = S;
		}
	}

	for (Int i = 0; i < K; i++) {
		Int temp = K;
		while (temp+i+1<=N) {
			//グーを出す場合
			if (T[i+temp]=='s') {
				dp[i + temp + 1][0] = max(dp[i + (temp - K) + 1][1] + R, dp[i + (temp - K) + 1][2] + R);
			}
			else  {
				dp[i + temp + 1][0] = max(dp[i + (temp - K) + 1][1], dp[i + (temp - K) + 1][2]);

			}

			//チョキを出す場合
			if (T[i+temp]=='p') {
				dp[i + temp + 1][1] = max(dp[i + (temp - K) + 1][0] + S, dp[i + (temp - K) + 1][2] + S);

			}
			else {
				dp[i + temp + 1][1] = max(dp[i + (temp - K) + 1][0] , dp[i + (temp - K) + 1][2] );

			}

			//パーを出す場合
			if (T[i+temp]=='r') {
				dp[i + temp + 1][2] = max(dp[i + (temp - K) + 1][0] + P, dp[i + (temp - K) + 1][1] + P);

			}
			else {

				dp[i + temp + 1][2] = max(dp[i + (temp - K) + 1][0], dp[i + (temp - K) + 1][1]);

			}

			temp += K;
		}
	}

	DMP(dp);

	Int ans = 0;
	for (Int i = N; i >= N-K+1; i--) {
		ans += max({ dp[i][0],dp[i][1],dp[i][2] });
	}
	cout << ans << "\n";
}


Measured memory_bytes: 5840
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/graph/edge.hpp"


template <typename T> struct edge {
  int to;
  T cost;
};

#line 2 "/mnt/c/Users/leafc/dev/compro/lib/graph/dijkstra.hpp"
#include <climits>
#include <limits>
#include <queue>
#include <vector>

#ifndef DIJKSTRA
#define DIJKSTRA

// sからの各頂点への最短距離を返す。計算量はO(E logV)
template <class T> std::vector<T> dijkstra(const int s, const std::vector<std::vector<edge<T>>> &g) {
  std::priority_queue<std::pair<T, int>, std::vector<std::pair<T, int>>, std::greater<std::pair<T, int>>> q;

  constexpr T MAX = std::numeric_limits<T>::max();
  std::vector<T> d(g.size(), MAX);
  d[s] = 0;
  q.push(std::make_pair(d[s], s));

  while (!q.empty()) {
    const auto p = q.top();
    q.pop();

    const int v = p.second;
    if (d[v] < p.first)
      continue;

    for (const auto e : g[v]) {
      const int u = e.to;
      const T next_cost = d[v] + e.cost;
      if (d[u] <= next_cost)
        continue;
      d[u] = next_cost;
      q.push(std::make_pair(d[u], u));
    }
  }
  return d;
}

#endif
#line 1 "/mnt/c/Users/leafc/dev/compro/lib/template.hpp"


#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < n; i++)
#define FOR(i, m, n) for (int i = m; i < n; i++)
#define ALL(v) (v).begin(), (v).end()
#define coutd(n) cout << fixed << setprecision(n)
#define ll long long int
#define vl vector<ll>
#define vi vector<int>
#define MM << " " <<

using namespace std;

template <class T> void say(bool val, T yes = "Yes", T no = "No") { cout << (val ? yes : no) << endl; }

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

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


#line 4 "abc164_e.cpp"

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

  int n, m, s;
  cin >> n >> m >> s;
  int ms = 5000;
  vector<vector<edge<ll>>> g(ms * n);

  REP(i, m) {
    int u, v;
    cin >> u >> v;
    u--;
    v--;
    int a;
    ll b;
    cin >> a >> b;
    REP(j, ms - 1) {
      if (j - a >= 0) {
        g[j * n + u].push_back({(j - a) * n + v, b});
        g[j * n + v].push_back({(j - a) * n + u, b});
      }
    }
    g[(ms - 1) * n + u].push_back({(ms - 1) * n + v, b});
    g[(ms - 1) * n + v].push_back({(ms - 1) * n + u, b});
  }

  REP(i, n) {
    int c, d;
    cin >> c >> d;
    REP(j, ms) { g[j * n + i].push_back({min((ms - 1) * n + i, (j + c) * n + i), d}); }
  }

  s = min(s, ms);
  auto ans = dijkstra(min((ms - 1) * n, s * n), g);
  FOR(i, 1, n) {
    ll tmp = std::numeric_limits<ll>::max();
    REP(j, ms) { chmin(tmp, ans[i + j * n]); }
    cout << tmp << endl;
  }
}


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

int main() {
	int n;
	float a[100];
	cin >> n;
	float ans = 0;
	for(int i=0; i!=n; i++){
		cin >>a[i];
		ans += 1.0 / a[i];
	}
	ans = 1 / ans;
	cout << ans << '\n';
	return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> Pll;
typedef pair<P,P> PP;
#define rep(i,a,n) for(int i = a;i < n;i++)
#define repr(i,a,n) for(int i = n-1;i >= a;i--)
#define ALL(v) v.begin(), v.end()
#define LINF (ll)1e17
#define INF (int)1e9
#define MOD (ll)1e9+7
#define sMOD 1e5
#define fs first
#define sc second

ll gcd(ll a,ll b){
	if(!b) return a;
	return gcd(b,a%b);
}

void YNout(bool check){
	if(check)cout << "Yes" << endl;
	else cout << "No" << endl;
	
	return;
}

void Yayout(bool check){
	if(check) cout << "Yay!" << endl;
	else cout << ":(" << endl;
	
	return;
}
/*
template <typename T>
void vecout(vector<T>& vecout_vec){
	
	rep(i,0,vecout_vec.size()){
		cout << vecout_vec.at(i) << endl;
	}
	
	return ;
}

template <typename T>
void vecin(vector<T>& vecin_vec, ll n){
	
	ll temp ;
	
	rep(i,0,n){
		cin >> temp;
		vecin_vec.push_back(temp);
		
	}
}

template <typename T>
void in(T& literal_in, T& literal_in2, ...){
	cin >> literal_in;
	in(literal_in2, ...);
	
	return;
}

template <typename T>
void in(T& literal_in){
	
	cin >> literal_in;
	
	return;
}

template <typename T>
void out(T& literal_out, T& literal_out2, ...){
	cout << literal_out << endl;
	out(literal_out2, ...);
	
	return;
}

template <typename T>
void out(T& literal_out){
	
	cout << literal_out << endl;
	
	return;
}
*/
signed main(){
	ll a,b,c,n;
	cin >> a >> b;
	
	if(a >= 13) cout << b << endl;
	else if(5 < a)cout << b/2 << endl;
	else cout << 0 << endl;
	return 0;
}


Measured memory_bytes: 764
import java.util.Scanner;


public class Main {
	int w,h;
	int[][] field;
	int sx,sy;
	Scanner stdin=new Scanner(System.in);
	int[] dx={-1,0,1,0};
	int[] dy={0,-1,0,1};
	int count;
	
	
	
	public void Solve(){
		w=1;
		while(true){
			
			count=0;
			w=stdin.nextInt();
			h=stdin.nextInt();
			if(w==0&&h==0)break;
			field=new int [h][w];
			
			for(int i=0;i<h;i++){
				String str=stdin.next();
				for(int j=0;j<w;j++){
					char c=str.charAt(j);
					if(c=='.') field[i][j]=1;
					if(c=='#') field[i][j]=0;
					if(c=='@'){
						field[i][j]=1;
						sx=i;
						sy=j;
					}
				}
			}
			//System.out.println(sx+"s"+sy);
			dfs(sx,sy);
			System.out.println(count);
			
			
			
		}
		
		
		
		
	}
	public void dfs(int x,int y){
		count++;
		field[x][y]=0;
		for(int i=0;i<4;i++){
			int xx=x+dx[i];
			int yy=y+dy[i];
			
			
			if(xx>=0&&xx<h&&yy>=0&&yy<w){
				if(field[xx][yy]==1){
					//System.out.println(xx+ " "+yy);
					dfs(xx,yy);
				}
			}
		}
		
	}
	
	
	
	public static void main(String args[]){
		Main m=new Main();
		m.Solve();
	}
}

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

#define MOD 998244353

struct test {
    long long N;
    char X[2*100000+1];
    long long a;
} testdata[] = {
    {
        3,
        "111",
        40
    },
    {
        6,
        "110101",
        616
    },
    {
        30,
        "001110011011011101010111011100",
        549320998
    },
    {
        9,
        "101111111",
        6832
    },
};

#define CHAR_BIT    8
void printb(unsigned long long v) {
    unsigned long long mask = (long long)1 << (sizeof(v) * CHAR_BIT - 1);
    do putchar(mask & v ? '1' : '0');
    while (mask >>= 1);
}

int
divider(long long N, long long *div, int isFilter)
{
    int i, stop;
    int j=0;
    long long n = 2 * N;

    stop = n;
    
    for (i=2; i<stop; i++) {
        if (n%i==0) {
            if (isFilter==0 || ((i&1)==0 && ((n/i)&1)==1)) {
                div[j++] = i;
            }
        }
    }
    return j;
}

void
solver(long long N, char *X)
{
    long long div[2*100000], tdiv;
    int subTotal[2*100000];
    int numDiv;
    int i, j, k;
    long long targetNum = 0, subNum;
    long long result = 0;
    char bit;
    
    bzero(div, sizeof(div));
    bzero(subTotal, sizeof(subTotal));
    numDiv = divider(N, div, 1);

    for (i=0; i<N; i++) {
        targetNum = targetNum<< 1;
        targetNum |= X[i]-'0';
        targetNum = targetNum % MOD;
    }
    targetNum++;

    for (i=0; i<numDiv; i++) {
        subNum = 0;
        tdiv = div[i]/2;
        for(j=0; j<tdiv; j++) {
            subNum = subNum<< 1;
            subNum |= X[j]-'0';
            subNum = subNum % MOD;
        }
        for(k=j; k<strlen(X); k++) {
            if ((k/tdiv)&1) {
                if (1-X[k%tdiv]+2*'0' != X[k]) {
                    if (X[k]=='1')
                        subNum++;
                    break;
                }
            }
            else {
                if (X[k%tdiv] != X[k]) {
                    if (X[k]=='1')
                        subNum++;
                    break;
                }
            }
        }
        if (k==strlen(X))
            subNum++;
        subNum = subNum % MOD;

        for (j=0; j<i; j++) {
            if (div[i]%div[j]==0 && (div[i]/div[j])&1==1) {
                subNum -= subTotal[div[j]];
                if (subNum<0) {
                    subNum += MOD;
                }
            }
        }
        subTotal[div[i]] = subNum;
        targetNum -= subNum;
        if (targetNum<0)
            targetNum += MOD;
        result = (result + subNum * div[i])%MOD;

//        printf("%lld: %lld -> %lld\n", div[i], subNum, result);
    }
    result = (result + (targetNum * 2 * N)) % MOD;

    printf("%lld\n", result);
}

int
main(int argc, char *argv[])
{
    int i;
    int N;
    char X[2*100000+1];

//    N = 2*100000;
//    for (i=0; i<N; i++) {
//        X[i] = '1';
//    }
//    solver(N, X);

//    for (i=2; i<4; i++) {
//        solver(testdata[i].N, testdata[i].X);
//        printf("ans %lld\n", testdata[i].a);
//    }
    scanf("%d", &N);
    scanf("%s", X);
    solver(N, X);
    return 0;
}


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

#define mem( arr, i ) fill( arr, arr + sizeof (arr), i )
#define MEM( arr, i ) memset( arr, i, sizeof (arr) )
#define Push push_back
#define Pair make_pair
#define ALL(x) (x).begin(), (x).end()
#define X first
#define Y second
#define ACCEL ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
typedef unsigned long long ull;
typedef long long lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
typedef vector<int> vcI;
typedef vector<lli> vcL;
typedef vector<pii> vPI;
typedef vector<pll> vPL;
typedef vector<vcL> vvL;
//typedef priority_queue<T> prior_S<T>;
//typedef priority_queue< T, vector<T>, greater<T> > prior_B<T>;
const double PI = 3.141592653589793;
const lli I_MAX = 1LL << 60;
      lli   mod = 1000000007;

/// templates ///

const lli maxN = 2E5;

vcL inv( maxN+5, 1 );
vcL fac( maxN+5, 1 );

void ADD(lli &x, lli y) {
	x += y;
	if ( x >= mod ) x -= mod;
	if ( x < 0 ) x += mod;
}

void MUL(lli &x, lli y) {
	x *= y;
	x = ( x%mod + mod ) % mod;
}

lli mypow(lli b, lli e) {
	lli ans = 1;
	while (e) {
		if ( e&1 ) MUL( ans, b );
		MUL( b, b );
		e >>= 1;
	}
	return ans;
}

lli modinv(lli n) {
	return mypow( n, mod-2 );
}

void calcInv(lli n) {
	for (int i = 2; i <= n; ++i) {
		inv[i] = (mod-mod/i) * inv[ mod%i ] % mod;
	}
}

void calcFac(lli n) {
	for (int i = 2; i <= n; ++i) {
		fac[i] = fac[ i-1 ] * i % mod;
	}
}

lli cm(lli a, lli b) {
	lli ans = 1;
	if ( a < b ) return 0;

	MUL( ans, inv[ fac[ a-b ] ] );
	MUL( ans, inv[ fac[b] ] );
	MUL( ans, fac[a] );

	return ans;
}

lli Lucas(lli n, lli m) {
	if ( m == 0 ) return 1;
	return cm( n%mod, m%mod ) * Lucas( n/mod, m/mod ) % mod;
}

lli doLucas(lli n, lli m) {
	calcInv(mod);
	calcFac(mod);
	return Lucas( n, m );
}

/// coding area ///

void precal() {

	return;
}

void solve() {
	lli n = 1, m, sum = 0, ans = 0, cnt = 0;
	string s;
	cin >> s;
	
	if ( s[0] == s[1] or s[1] == s[2] or s[2] == s[3] ) cout << "Bad\n";
	else cout << "Good\n";
}

int main() {
	precal();
	int t = 1;
	#ifdef LOCAL
		t = INT_MAX;
	#else
		ACCEL;
	#endif
//	cin >> t;
	for (int i = 1; i <= t; ++i) {
//		printf("Case #%d: ", i );
		solve();
	}
	return 0;
}



Measured memory_bytes: 3328
#include<stdio.h>
int main()
{
  int n,a,b,c,d,e=0;
  scanf("%d",&n);
  a=n%10;n/=10;b=n%10;n/=10;c=n%10;n/=10;d=n%10;
  if(a==b)
  {
    if(b==c)
    {
      e=1;
    }
  }
  else if(b==c)
  {
    if(c==d)
    {
      e=1;
    }
  }
  if(e==1)
  {
    printf("Yes");
  }
  else
  {
    printf("No");
  }
  return 0;
}
  


Measured memory_bytes: 128