akhauriyash/Code-Regression huggingface dataset:
class Dice:
    def __init__(self):
        self.state =[1, 2, 3, 4, 5, 6]

    def setState(self, li):  # [top, S, E, W, N, under]
        self.state = li

    def move(self, str_direction):
        if str_direction == "N":
            self.state = [self.state[1], self.state[5],self.state[2],
                          self.state[3], self.state[0], self.state[4]]
        if str_direction == "W":
            self.state = [self.state[2], self.state[1], self.state[5],
                          self.state[0], self.state[4], self.state[3]]
        if str_direction == "E":
            self.state = [self.state[3], self.state[1], self.state[0],
                          self.state[5], self.state[4], self.state[2]]
        if str_direction == "S":
            self.state = [self.state[4], self.state[0], self.state[2],
                          self.state[3], self.state[5], self.state[1]]

    def rotate(self):
        self.state = [self.state[0], self.state[2], self.state[4],
                      self.state[1], self.state[3], self.state[5]]

    def sameDice1(self, dice1):
        set1 = list()
        for _ in range(4):
            for __ in range(4):
                set1.append(self.state)
                self.rotate()
            self.move("N")
        self.move("E")
        for _ in range(4):
            set1.append(self.state)
            self.rotate()
        self.move("E")
        self.move("E")
        for _ in range(4):
            set1.append(self.state)
            self.rotate()
        if dice1.state in set1:
            return "Yes"
        return "No"


def main():
    myd1, myd2 = Dice(), Dice()
    myd1.setState(list(map(int, input().split())))
    myd2.setState(list(map(int, input().split())))
    print(myd1.sameDice1(myd2))
    return

if __name__ == "__main__":
    main()

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

using namespace std;

#define MAX 45
#define PI acos(-1)
#define INF (1<<29)
typedef pair<double, double> P;

int N, M;
double memo[MAX][MAX][MAX];
vector<double> x, y;

double area(int a, int b, int c)
{
    vector<P> p(3);
    p[0] = P(x[a], y[a]);
    p[1] = P(x[b], y[b]);
    p[2] = P(x[c], y[c]);   
    
    double res = 0;
    for (int i = 1; i < 4; i++) {
	res += (p[i%3].first - p[i-1].first) * (p[i%3].second + p[i-1].second);
    }
    res /= 2.0;
    return abs(res);
}

double get_max_area(int L, int R, int m)
{
    if (m == M) {
        return 0;
    }    
    double &res = memo[L][R][m];
    if (res != -1) {
        return res;
    }
    for (int i = R+1; i < N; i++) {
        res = max(res, get_max_area(L, i, m+1) + area(L, R, i));
    }
    return res;
}

int main()
{
    double p;
    while (cin >> N >> M, N) {
        x.clear(); y.clear();
        x.resize(N); y.resize(N);
        for (int i = 0; i < N; i++) {
            cin >> p;
            p *= (2.0 * PI);
            x[i] = cos(p); y[i] = sin(p);
        }
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < N; j++) {
                for (int k = 0; k < N; k++) {
                    memo[i][j][k] = -1;
                }
            }
        }

        double mx = 0;
        for (int i = 0; i < N; i++) {
            for (int j = i+1; j < N; j++) {
                for (int k = j+1; k < N; k++) {
                    mx = max(mx, get_max_area(i, k, 3) + area(i, j, k));
                }
            }
        }
        printf("%.6f\n", mx);
    }
    return 0;
}

Measured memory_bytes: 4076
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long MOD = 998244353;

struct Robot
{
    ll X,D;
    bool operator<(const Robot& o)const&
    {
        return X < o.X;
    }
};
void solve(long long N, std::vector<long long> X, std::vector<long long> D){
    vector<Robot> dat;
    for(int i=0;i<N;++i)
    {
        dat.push_back({X[i],D[i]});
    }
    sort(dat.begin(),dat.end());
    vector<int> ActiveDis(N);
    ActiveDis[N-1] = N-1;
    stack<int> s;
    s.push(N-1);
    for(int i=N-2;i>=0;--i)
    {
        int res = i;
        while(!s.empty() && dat[i].X + dat[i].D > dat[s.top()].X)
        {
            res = ActiveDis[s.top()];
            s.pop();
        }
        ActiveDis[i] = res;
        s.push(i);
    }
    vector<ll> dp(N+1,0);
    dp[N] = 1;
    for(int i=N-1;i>=0;--i)
    {
        dp[i] += dp[i+1];
        dp[i] += dp[ActiveDis[i]+1];
        dp[i] %= MOD;
    }
    cout<<dp[0]<<endl;
}

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


Measured memory_bytes: 9708
import java.util.*;
import java.text.*;

class Main {
    public static void main(String[]args)throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        for(int i = 1; i <= n; i++) {
            int x = i;
            if((x % 3) == 0) {
                System.out.print(" " + i);
            } else {
                while(x != 0) {
                    if((x % 10) == 3) {
                        System.out.print(" " + i);
                        x = 0;
                    }
                    x = x / 10;
                }
            }
        }
        System.out.println();
    }
}



Measured memory_bytes: 28644
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
ans = 0
for i in range(N):
    if A[i]>B[i]:
        ans += B[i]
    else:
        ans += A[i]
        B[i]-=A[i]
        if A[i+1]>B[i]:
            ans+=B[i]
            A[i+1]-=B[i]
        else:
            ans+=A[i+1]
            A[i+1]=0
print(ans)

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

/* 大文字を小文字に変換 */
char tolower(char c) {return (c + 0x20);}
/* 小文字を大文字に変換 */
char toupr(char c) {return (c - 0x20);}

// if('A'<=s[i] && s[i]<='Z') s[i] += 'a'-'A';

/*
string s = "abcdefg"
s.substr(4) "efg"
s.substr(0,3) "abc"
s.substr(2,4) "cdef"

// イテレータ要素のインデックス
distance(A.begin(), itr);
*/

const int INF = 1000100100;

int tow[4] = {0, 1, 0, -1};
int toh[4] = {-1, 0, 1, 0};

int main()
{
    int h, w; cin >> h >> w;
    int mass[h][w];

    int wcnt = 0;

    rep(i,h){
        rep(j,w){
            char moji; cin >> moji;
            if(moji == '.'){
                mass[i][j] = 1;
                wcnt++;
            }else{
                mass[i][j] = 0;
            }
        }
    }

    int dis[h][w];
    rep(i,h) rep(j,w) dis[i][j] = INF;

    dis[0][0] = 0;
    queue<P> q;
    q.push(make_pair(0,0));

    while(!q.empty()){
        P u = q.front(); q.pop();
        rep(i,4){
            P v = make_pair(u.first+toh[i], u.second+tow[i]);
            if(v.first<0 || v.second<0 || v.first>=h || v.second>=w) continue;

            if(dis[v.first][v.second] == INF && mass[v.first][v.second] == 1){
                dis[v.first][v.second] = dis[u.first][u.second] + 1;
                q.push(v);
            }
        }
    }

    if(dis[h-1][w-1] == INF) cout << -1 << endl;
    else cout << (wcnt-dis[h-1][w-1]-1) << endl;
}

Measured memory_bytes: 3580
#include<stdio.h>
#define MAX 100000
#define SENTINEL 2000000000

typedef struct card{
    char suit;
    int value;
}card;

card L[MAX/2+2],R[MAX/2+2];

void merge(card A[],int n,int l,int m,int r){
    int i,j,k;
    int n1,n2;
    n1=m-l;
    n2=r-m;
    for(i=0;i<n1;i++)L[i]=A[l+i];
    for(i=0;i<n2;i++)R[i]=A[m+i];
    L[n1].value=R[n2].value=SENTINEL;
    i=j=0;
    for(k=l;k<r;k++){
        if(L[i].value<=R[j].value){
            A[k]=L[i++];
        }
        else{
            A[k]=R[j++];
        }
    }
}

void mergesort(card A[],int n,int l,int r){
    int mid;
    if(l+1<r){
        mid=(l+r)/2;
        mergesort(A,n,l,mid);
        mergesort(A,n,mid,r);
        merge(A,n,l,mid,r);
    }
}

int partition(card B[],int n,int p,int r){
    int i,j;
    card tmp,x;
    x=B[r];
    i=p-1;
    for(j=p;j<r;j++){
        if(B[j].value<=x.value){
            i++;
            tmp=B[i];
            B[i]=B[j];
            B[j]=tmp;
        }
    }
    tmp=B[i+1];
    B[i+1]=B[r];
    B[r]=tmp;
    return i+1;
}

void quick(card C[],int n,int p,int r){
    int q;
    if(p<r){
        q=partition(C,n,p,r);
        quick(C,n,p,q-1);
        quick(C,n,q+1,r);
    }
}

int main(){
    card A[MAX],B[MAX];
    int i,n,v,stable=1;
    char ch[10];

    scanf("%d",&n);
    for(i=0;i<n;i++){
        scanf("%s%d",ch,&v);
        A[i].suit=B[i].suit=ch[0];
        A[i].value=B[i].value=v;
    }
    mergesort(A,n,0,n);
    quick(B,n,0,n-1);

    for(i=0;i<n;i++){
        if(A[i].suit!=B[i].suit) stable=0;
    }

    if(stable==1){
        printf("Stable\n");
    }
    else{
        printf("Not stable\n");
    }
    for(i=0;i<n;i++){
        printf("%c %d\n",B[i].suit,B[i].value);
    }
    return 0;
}


Measured memory_bytes: 4076
s = input()

stack = []
for _s in s:
    if _s == "0":
        stack.append("0")
    elif _s == "1":
        stack.append("1")
    else:
        if len(stack) > 0:
            stack.pop(len(stack)-1)

res = ""
for s in stack:
    res += s
print(res)

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
#define min(a,b) ((a)<(b)?(a):(b))
#define max(a,b) ((a)>(b)?(a):(b))
#define REP(i,n) for(ll i=0;i<n;i++)
#define FOR(i,n1,n2) for(ll i=n1;i<n2;i++)
#define bFOR(i,n1,n2) for(ll i=n1;i>=n2;i--)
#define speed_up    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);

typedef long long int ll;
typedef pair<ll,ll> Pi;
typedef tuple<ll,ll,ll> Tu;
const int INF=(ll)(1LL<<30)-1;
const double INFd=100000000000.0;
const double PI=3.14151926535;
const ll INFl=(ll)9223372036854775807/2;
const int MAX=10000;
const ll MOD=(ll)1e9+7;
const ll tMOD=(ll)998244353;
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 dx[4]={0,-1,0,1},dy[4]={-1,0,1,0};
int mdx[8]={0,1,0,-1,1,1,-1,-1},mdy[8]={-1,0,1,0,1,-1,1,-1};


template<typename A, size_t N, typename T>
void Fill(A (&array)[N], const T &val){
    std::fill( (T*)array, (T*)(array+N), val );
}

int n,m;
int a[1010],b[1010];
int c[1010];
int dp[5000];
int main(){
	cin>>n>>m;
	REP(i,m){
		cin>>a[i]>>b[i];
		REP(j,b[i]){
			int t;
			cin>>t;
			t--;
			c[i]+=(1<<t);
		}
	}
	REP(i,5000)dp[i]=INF;
	dp[0]=0;
	REP(i,m){
		REP(j,5000){
			if(dp[j]==INF)continue;
			dp[j|c[i]]=min(dp[j|c[i]],dp[j]+a[i]);
		}
	}
	if(dp[(1<<n)-1]==INF){
		cout<<-1<<endl;
	}else{
		cout<<dp[(1<<n)-1]<<endl;
	}
	return 0;
}

Measured memory_bytes: 256
import math
n,k = map(int, input().split())

p = 0
p += max(0,(n - k) / n)

p += sum([ 1 / n * (1 / 2 ** math.ceil(math.log2(k/x))) for x in range(1,n - max(0,n - k)+1)])

print(p)





Measured memory_bytes: 3316
#!usr/bin/env python3

'''
time score 7.88 for list
time score 03.17 for deque
time score 03.22 for defaultdict(dict)

''' 

from collections import defaultdict
from collections import deque
#import time

def main():
    # Read stdin
    #start = time.clock()
    fl = input().split(" ")
    V = int(fl[0])
    E = int(fl[1])
    R = int(fl[2])
    # Adjacency list
    G = defaultdict(list)
    for i in range(E):
        s, t, w = [int(x) for x in input().split(" ")]
        G[s].append((t, w))
    # initialized
    d = {}
    INF = float('inf')
    # INF = 10001
    for i in range(V):
        d[i] = INF
    d[R] = 0
    # deque is better than list aka double link list O(1) for pop head and append
    q = deque([R])
    while q:
        # u = heappop(q)
        u = q.popleft()
        for v in G[u]:
            if d[v[0]] > d[u] + v[1]:
                d[v[0]] = d[u] + v[1]
                # heappush(q, v[0])
                q.append(v[0])
    #end = time.clock() - start
    for k in d.keys():
        if d[k] == float('inf'):
            print("INF")
        else:
            print(d[k])
    #print('Computation time : {}'.format(end))


if __name__ == '__main__':
    main()

Measured memory_bytes: 106788
#include <iostream>
#include <sstream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <string>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC target("avx512f,avx512dq,avx512cd,avx512bw,avx512vl")
#define pie 3.141592653589793238
using namespace std;

int main(void){
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int k, a, b, ans=0;
  cin >> k;
  cin >> a >> b;
  for(int i=a; i<=b; i++){
    if(i%k==0) ans=1;
  }
  if(ans)cout << "OK" << endl;
  else cout << "NG" << endl;
  
  return 0;
}

Measured memory_bytes: 3652
import java.util.*;

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

double min  = H[0];
int minidx = 0;
for(int i = 0;i < N;i++){
double tem = Math.abs(A -(T - H[i]*0.006));
if(min>tem){
min = tem;
minidx = i;
}
}
System.out.println(minidx + 1);

} 
}

Measured memory_bytes: 23124
class UnionFind:
    def __init__(self, n):
        self.n = n
        self.UF = [i for i in range(n)]
    def union(self,x,y):
        px = self.find(x)
        py = self.find(y)
        self.UF[px] = py
    def find(self, x):
        if self.UF[x] == x:
            return x
        self.UF[x] = self.find(self.UF[x])
        return self.UF[x]
 
n,m = [int(x) for x in input().split()]
UF = UnionFind(n)
for _ in range(m):
    a,b = [int(x) for x in input().split()]
    a -= 1
    b -= 1
    UF.union(a,b)
 
ANS = []
for i in range(n):
    if UF.find(i) != UF.find(0):
        ANS.append((0,i))
        UF.union(i, 0)
print(len(ANS))


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

int main(int argc, void **arg)
{
    int a, p;
    int psum = 0;

    scanf("%d %d", &a, &p);

    psum = a * 3 + p;

    printf("%d\n", psum / 2);

    return 0;
}


Measured memory_bytes: 128
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from collections import Counter
class Dubious_Document:
	def __init__(self):
		n=int(input())
		
		for i in range(n):
			S=input()
			if(i==0):
				temp=S
			else:
				temp = list((Counter(S) & Counter(temp)).elements())
		
		self.S=temp
	def solve(self):
		S=self.S
		return sorted(S)

if __name__ == '__main__':
	A=Dubious_Document()
	s=A.solve()
	
	if s:
		temp=""
		for i in range(len(s)):
			temp+=s[i]
		print(temp)
	else:
		print("\n")

Measured memory_bytes: 3316
#include <bits/stdc++.h>
#define show(x) std::cerr << #x << " = " << (x) << std::endl
using ll = long long;
template <typename T>
constexpr T MOD = static_cast<T>(1000000007);
template <typename T>
constexpr T INF = std::numeric_limits<T>::max() / 16;
int main()
{
    int N, A, B;
    std::cin >> N >> A >> B;
    std::cout << std::min(A, B) << " " << std::max(0, A + B - N) << std::endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
const int HOUSES = 4;
const int STORIES = 3;
const int ROOMS = 10;
int house[HOUSES][STORIES][ROOMS];
struct Die
{
	int A_One;
	int B_Two;
	int C_Three;
	int D_Four;
	int E_Five;
	int F_Six;
};
Die GoNorth(Die pips)
{
	int tmp = pips.A_One;
	pips.A_One = pips.B_Two;
	pips.B_Two = pips.F_Six;
	pips.F_Six = pips.E_Five;
	pips.E_Five = tmp;
	return pips;
}
Die GoSouth(Die pips)
{
	int tmp = pips.A_One;
	pips.A_One = pips.E_Five;
	pips.E_Five = pips.F_Six;
	pips.F_Six = pips.B_Two;
	pips.B_Two = tmp;
	return pips;
}
Die GoEast(Die pips)
{
	int tmp = pips.D_Four;
	pips.D_Four = pips.F_Six;
	pips.F_Six = pips.C_Three;
	pips.C_Three = pips.A_One;
	pips.A_One = tmp;
	return pips;
}
Die GoWest(Die pips)
{
	int tmp = pips.A_One;
	pips.A_One = pips.C_Three;
	pips.C_Three = pips.F_Six;
	pips.F_Six = pips.D_Four;
	pips.D_Four = tmp;
	return pips;
}
Die Roll(Die die, char c)
{
	if (c == 'N')
	{
		die = GoNorth(die);
	}
	else if (c == 'W')
	{
		die = GoWest(die);
	}
	else if (c == 'S')
	{
		die = GoSouth(die);
	}
	else
	{
		die = GoEast(die);
	}
	return die;
}
int main()
{
	int a, b, c, d, e, f;
	std::cin >> a >> b >> c >> d >> e >> f;

	Die die{ a,b,c,d,e,f };
	std::string g;
	std::cin >> g;
	for (int i = 0; i < g.size(); i++){
		die = Roll(die, g[i]);
	}
	std::cout << die.A_One << std::endl;
	return 0;
}


Measured memory_bytes: 3196
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <numeric>
#include <set>
#include <list>
#include <bitset>
#include <cstdlib>
using namespace std;

int main()
{
    int N;
    cin >> N;
    int ans = N;
    string s, t;
    cin >> s >> t;
    bool flag = false;
    for (int i = 0; i < N; i++)
    {
        bool tmp = true;
        for (int j = 0; j < (N - i); j++)
        {
            if (s[j + i] != t[j])
            {
                tmp = false;
                break;
            }
        }
        if (tmp)
        {
            ans += i;
            flag = true;
            break;
        }
    }
    if (flag)
    {
        cout << ans << endl;
    }
    else
    {
        cout << 2 * N << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <set>
#include <string>
#include <utility>
#include <functional>
#include <queue>
#include <cmath>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <iomanip>      // std::setprecision
#include <boost/optional.hpp>
#include <boost/range/irange.hpp>
#include <boost/range/algorithm.hpp>
#include <boost/range/numeric.hpp>
#include <boost/bimap/bimap.hpp>
#include <boost/bimap/multiset_of.hpp>
#include <boost/multi_array.hpp>
#include <boost/math/common_factor_ct.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/pending/disjoint_sets.hpp>
#include <boost/icl/interval_map.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/strong_components.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <boost/graph/kruskal_min_spanning_tree.hpp>
#include <boost/graph/graph_utility.hpp>
#include <boost/numeric/ublas/vector.hpp>

#define REP(i, N) for(int i=0; i<(N); i++)
#define REC(f, ...) const auto f = [&](const auto f, __VA_ARGS__)
using namespace std;
using namespace boost::math;
using namespace boost::numeric;
namespace bst = boost;

int main() {
  int N;

  cin >> N;
  vector<int> A(N),B(N),C(N-1);
  
  for (auto& i : A)
    cin >> i;
  for (auto& i : B)
    cin >> i;
  for (auto& i : C)
    cin >> i;
  int r = 0, prev = -1;
  
  for (auto i : A) {
    r += B[i-1];
    if (i - prev == 1)
      r += C[prev-1];
    prev = i;
  }

  cout << r << endl;

  return 0;
}


Measured memory_bytes: 256
import math

#n, a, b= map(int, input().split())
n, l  = map(int, input().split())
#h = list(map(int, input().split()))
#s = list(str(input()))
#n = int(input())
a = [""]*n
for i in range(n):
  a[i] = str(input())

#for i in range(n):
a.sort()
a = ''.join(a)
    
print(a)

Measured memory_bytes: 3060
#include<bits/stdc++.h>
//macros
using namespace std;
typedef long long ll;
typedef pair<int, int > Pii;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
typedef vector<ll> Vll;
#define pb push_back
#define rs resize 
#define rep(i, a, b) for(int i=(a); i<(b); i++)
const long long int mod = 1e9 + 7;
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define COUT(a) cout << a << endl

Vi d(51);
int main(){
    int N,res=0;
    cin >> N;
    d.rs(N);
    rep(i,0,N) cin >> d[i];

    rep(i,0,N){
        rep(j,i+1,N){
            res += d[i]*d[j];
        }
    }
    COUT(res);
}


Measured memory_bytes: 256
#include <iostream>
#include <cassert>
#include <climits>
#include <bitset>
#include <stack>
#include <queue>
#include <iomanip>
#include <limits>
#include <string>
#include <cmath>
#include <set>
#include <map>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
 
using namespace std;
typedef long long ll;
 
 
typedef pair<ll,ll> P;
long long int INF = 1e18;
double Pi = 3.141592653589;
const int mod = 1000000007;
// memset(a,0,sizeof(a)); →全部０にする
 
vector<ll> G[100005];
vector<P> tree[100010];
 
int dx[8]={1,0,-1,0,1,1,-1,-1};
int dy[8]={0,1,0,-1,1,-1,-1,1};
 
#define p(x) cout<<x<<endl;
#define el cout<<endl;
#define pe(x) cout<<x<<" ";
#define ps(x) cout<<fixed<<setprecision(25)<<x<<endl;
#define pu(x) cout<<x;
#define re(i,a,b) for(i=a;i<=b;i++);
#define pb push_back
#define lb lower_bound
#define ub upper_bound
 
ll rui(ll abc,ll bed){
	//aのb乗を計算する
	if(bed==0){return 1;}
	else{
		ll ced = rui(abc,bed/2);
		ced *= ced;
		ced %= mod;
		if(bed%2==1){ced*=abc; ced%=mod;}
		return ced;
	}
}
 
ll i,j,k,ii,jj;
ll n,m,sum,num;
ll ans=0;
ll a,b,c,d,e,h,w;
 
ll x[500005],y[500005],z[500005];
char s[500005],t[500005];
bool ok=false;
bool check[100005];
double kai[500005];
 
int main(){
    cin>>x[0]>>x[1]>>x[2];
  sort(x,x+3);
  p(x[2]-x[0]);
	return 0;
}

Measured memory_bytes: 7296
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
#include<cmath>
#include<random>

//使い方がよくわからない
#include<stack>
#include<queue>
#include<bitset>
#include<sstream>

#define rep(i,n) for(int i=0;i<(n);i++) 
#define rep1(i,n) for(int i=1;i<(n);i++)
#define co(x) cout << x << endl
#define cosp(x) cout << x << " "

using namespace std;
using ll = long long;

int main(int argc, const char *argv[]){
    ll n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    ll i1=0,i2=n-1;
    ll sum = 0;
    rep(i,n-1){
        if(sum<=0){
            sum += a[i1];
            i1++;
        }else{
            sum -= a[i2];
            i2--;
        }
    }
    ll ans = min(abs(sum-a[i1]),abs(sum+a[i1]));

    co(ans);
    return 0;
}

Measured memory_bytes: 1792
#include<bits/stdc++.h>
#define lld long long int
#define faster ios_base::sync_with_stdio(false);cin.tie(0);

using namespace std;

int main(){

  int d,n;
  cin>>d>>n;
  lld temp =1;
    for(int i = 1;i<=d;i++) temp = temp*100;

  lld ans = 0;
  for(int i = 0;i<n;i++) ans += temp;
  if(n==100) ans += temp;
  
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define sz(a) int((a).size())
#define pb push_back
#define all(c) (c).begin(),(c).end()
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
#define present(c,x) ((c).find(x) != (c).end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define LSOne(i) (i&(-i))
#define rep(i,a,b) for(int(i)=(a);(i)<(b);i++)
#define BUG(x) {cout<<#x<<" = "<<x<<endl;}
#define left(x) (x<<1)
#define right(x) ((x<<1) +1)
#define middle(s,e)(s+(e-s)/2)
#define size_tree(n) 2*(int)pow(2,ceil(log2(n)))
#define CL(A,I) (memset(A,I,sizeof(A)))
#define endl '\n'

static const int INF = 0x3f3f3f3f;
static const long long INFL = 0x3f3f3f3f3f3f3f3fLL;
static const long double epsilon = 1e-15;
static const long double pi = acos((long double) -1);
using namespace std;
inline void init_io(){ios_base::sync_with_stdio(false);cin.tie(NULL);}

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

const int maxn = 100004;
int arr[maxn];
int dp[maxn];
int n,k;
int solve(int idx)
{ 
    if(idx==n-1) return 0;
    if(~dp[idx]) return dp[idx];
    dp[idx] = 1e9+5;
    rep(i,idx+1,min(idx+1+k,n))
        dp[idx] = min(dp[idx], abs(arr[idx]-arr[i]) + solve(i));
    return dp[idx];
}

int main()
{
    CL(dp,-1);
    cin>>n>>k;
    rep(i,0,n)
        cin>>arr[i];
    cout<<solve(0);
    return 0;
}

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

const auto gcu = getchar_unlocked;
const auto pcu = putchar_unlocked;
#define _T template <typename T>
#define _HT template <typename H, typename... T>
#define _il inline
#define _in _il int in
#define _sc _il bool scan
_T T in(int c){T n=0;bool m=false;while(isspace(c)){c=gcu();}if(c=='-')m=true,c=gcu();
	do{n=10*n+(c-'0'),c=gcu();}while(c>='0'&&c<='9');return m?-n:n;}
_in() {return in<int>(gcu());}
_T T scan(T &n){int c=gcu();return c==EOF?false:(n=in<T>(c),true);}
_sc(char &c){c=gcu();gcu();return c!=EOF;}
#ifdef _GLIBCXX_STRING
_sc(string &s){int c;s="";
	for(;;){c=gcu();if(c=='\n'||c==' ')return true;else if(c==EOF)return false;s+=c;}}
#endif
_HT _sc(H &h, T&&... t){return scan(h)&&scan(t...);}
#define _ot _il void out
#define _ol _il void outl
_ot(bool b) {pcu('0'+b);}
_ot(const char *s){while(*s)pcu(*s++);}
_ot(char c){pcu(c);}
#ifdef _GLIBCXX_STRING
_ot(string s){for(char c:s)pcu(c);}
#endif
_T _ot(T n){static char buf[20];char *p=buf;if(n<0)pcu('-'),n*=-1;
	if(!n)*p++='0';else while(n)*p++=n%10+'0',n/=10; while (p!=buf)pcu(*--p);}
_ol(){out('\n');}
#ifdef _GLIBCXX_VECTOR
_T _ot(vector<T> &v){for(T &x:v)out(&x == &v[0]?"":" "),out(x);outl();}
#endif
_HT _ot(H&& h, T&&... t){out(h);out(move(t)...);}
template <typename... T> _ol(T&&... t){out(move(t)...);outl();}

#define all(o) o.begin(), o.end()

int main() {
	for (int N; (N = in());) {
		vector<int> K(N);
		for (int &k: K)
			k = in();
		if (find_if(all(K), [](int a){return a > 1;}) == K.end())
			outl("NA");
		else
			outl(count_if(all(K), [](int a){return a > 0;}) + 1);
	}
}


Measured memory_bytes: 2604
#!/usr/bin/env python3
from collections import defaultdict,deque
from heapq import heappush, heappop
from bisect import bisect_left, bisect_right
import sys, random, itertools, math
sys.setrecursionlimit(10**5)
input = sys.stdin.readline
sqrt = math.sqrt
def LI(): return list(map(int, input().split()))
def LF(): return list(map(float, input().split()))
def LI_(): return list(map(lambda x: int(x)-1, input().split()))
def II(): return int(input())
def IF(): return float(input())
def S(): return input().rstrip()
def LS(): return S().split()
def IR(n): return [II() for _ in range(n)]
def LIR(n): return [LI() for _ in range(n)]
def FR(n): return [IF() for _ in range(n)]
def LFR(n): return [LI() for _ in range(n)]
def LIR_(n): return [LI_() for _ in range(n)]
def SR(n): return [S() for _ in range(n)]
def LSR(n): return [LS() for _ in range(n)]
mod = 1000000007
inf = 1e10

#solve
def solve():
    s = S()
    k = II()
    ans = []
    for si in s[:-1]:
        x = (ord("a") - ord(si)) % 26
        if x <= k:
            k -= x
            ans.append("a")
        else:
            ans.append(si)
    ans.append(chr(ord("a") + (k - (ord("a") - ord(s[-1])) % 26) % 26))
    print("".join(ans))
    return


#main
if __name__ == '__main__':
    solve()


Measured memory_bytes: 47216
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define vi vector< int >
#define vb vector< bool >
#define vl vector< ll >
#define ss second
#define ff first
#define ll long long
#define pii pair< int,int >
#define pll pair< ll,ll >
#define sort(a) sort(a.begin(),a.end())
#define tri pair<int,pii>
#define vii vector<pii>
#define vll vector<pll>
#define viii vector<tri>
#define mod (998244353)
#define moddd (1000*1000*1000+9)
#define pqueue priority_queue< int >
#define pdqueue priority_queue< int,vi ,greater< int > >
#define flush fflush(stdout) 
#define primeDEN 727999983
//cout<<fixed<<setprecision(15)<<ans;
 
template <typename T>
void printvec(vector<T>& vec){
	for(int i=0;i<vec.size();i++){
		cout<<vec[i]<<" ";
	}
	cout<<endl;
}

vl twop;
vl fact;
vl ifact;
vl powern;

ll mypower(ll a,ll b){
	if(b==0) return 1;
	ll temp=mypower(a,b/2);
	temp=(temp*temp)%mod;
	if(b%2==0) return temp;
	else return (temp*a)%mod;
}

ll comb(ll a,ll b){
	ll ret=fact[a];
	ret=(ret*ifact[a-b])%mod;
	ret=(ret*ifact[b])%mod;
	return ret;
}

ll func(ll n,ll x,ll k){
	ll ret=0;
	ll sign=1,i;
	for(i=0;i<=x;i++){
		ll temp=sign;
		temp=(temp*twop[x-i])%mod;
		temp=(temp+mod)%mod;
		temp=(temp*comb(x,i))%mod;
		temp=(temp+mod)%mod;
		//temp=(temp*powern[k-x-i])%mod;
		if(k-x-i-1<0) continue;
		temp=(temp*comb(n+k-x-i-1,n))%mod;
		temp=(temp+mod)%mod;
		ret=(ret+temp)%mod;
		sign*=-1;
	}
	return ret;
}

int main(){
	std::ios::sync_with_stdio(false); 
	int ttt=1;
	//cin>>ttt;
	while(ttt--){
		ll k,n,i;
		cin>>k>>n;
		ll curr=1;
		for(i=0;i<5000;i++){
			twop.pb(curr);
			curr=(curr+curr)%mod;
		}
		curr=1;
		for(i=1;i<5000;i++){
			fact.pb(curr);
			curr=(curr*i)%mod;
		}
		for(i=0;i<fact.size();i++){
			ifact.pb(mypower(fact[i],mod-2));
		}
		for(i=0;i<5000;i++){
			powern.pb(mypower(i,n));
		}
		vl ans(2*k+1);
		for(i=2;i<=2*k;i++){
			if(i>k+1){
				ll diff=2*k-i+1;
				ll ansa;
				if(diff%2==0){
					diff=diff/2;
					ansa=func(n,diff,k);
				}
				else{
					diff=diff/2;
					ansa=func(n,diff,k-1);
					ansa=(ansa+func(n-1,diff,k-1))%mod;
				}
				ans[i]=ansa;
				continue;
			}
			// if(i==(k+1)){

			// 	continue;
			// }
			ll a=i;
			ll ansa;
			if(a%2==1){
				ansa=func(n,(a-1)/2,k);
			}
			else{
				ansa=func(n,(a-1)/2,k-1);
				ansa=(ansa+func(n-1,(a-1)/2,k-1))%mod;
			}
			ans[i]=ansa;
		}
		for(i=2;i<=2*k;i++){
			printf("%lld\n",ans[i]);
		}
	}
	return 0;
} 


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

typedef long long ll;

int main(){
  ll N,K;
  cin>>N>>K;
  vector<ll> H(N);
  for(int i=0; i<N; i++){
    cin>>H[i];
  }
  sort(H.begin(), H.end());
  ll sum=0;
  for(int i=0; i<N-K; i++){
    sum+=H[i];
  }
  cout <<sum<<endl;
}

Measured memory_bytes: 1792
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

int main()
{
    string s;
    cin >> s;
    if(s.substr(0, 4) == "YAKI")
        cout << "Yes" << endl;
    else
        cout << "No" << endl;

    return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<vector>
#include<map>
#include<list>
#include<stack>
#include<queue>
#include<climits> //INT_MIN/MAX


using namespace std;

#define FOR(i,s,e) for(int (i)=(s);(i)<(e);(i)++)
#define FORR(i,s,e) for(int (i)=(s);(i)>(e);(i)--)
#define MOD 1000000007
#define llong long long
#define debug(x) cout<<#x<<": "<<x<<endl

llong n;


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


    string c;
    cin >> c;
    if (c == "a" || c == "i" || c == "u" || c == "e" || c == "o")
        cout << "vowel" << endl;
    else cout << "consonant" << endl;

    return 0;
}

Measured memory_bytes: 764
# nの逆元のリスト
def inv_mod(n:int, mod:int) -> list:
    inv = [-1,1]
    for i in range(2,n+1):
        inv.append(mod - ((mod//i)*inv[mod%i]) % mod)
    return inv
       
# nの階乗のリスト
def fact(n:int, mod:int) -> list:
    fac = [1,1]
    res = 1
    for i in range(2,n+1):
        res = res*i%mod
        fac.append(res)
    return fac

# nの階乗の逆元のリスト
def fact_inv(n:int, inv:list, mod:int) -> list:
    facInv = [1,1]
    for i in range(2,n+1):
        facInv.append(facInv[i-1]*inv[i] % mod)
    return facInv
        
# 二項係数
def nCr(n:int, r:int, mod:int, fac:list, facInv:list) -> int:
    if not (0<=r and r<=n):
        return 0
    
    return ((fac[n]*facInv[r]) % mod) * facInv[n-r] % mod

N,A,B = map(int, input().split())
V = list(map(int, input().split()))

# 二項係数の準備
MOD = 9007199254740997
inv = inv_mod(N,MOD)
fac = fact(N,MOD)
facInv = fact_inv(N,inv,MOD)

V.sort(reverse=True)

max_avg = sum(V[:A])/A
print(max_avg)

ans = 0
if V[0] == V[A-1]:
    v = V.count(V[A-1])
    u = min(v,B)
    for i in range(A,u+1):
        ans += nCr(v,i,MOD,fac,facInv)

else:
    v_all = V.count(V[A-1])
    v_ch = V[:A].count(V[A-1])
    ans = nCr(v_all,v_ch,MOD,fac,facInv)

print(ans)

Measured memory_bytes: 3188
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

N,P=map(int,input().split())
A=list(map(lambda x: int(x)%2,input().split()))
B=[len(A)-sum(A),sum(A)]

ans=0
for i in range(P,B[1]+1,2):
  ans+=combinations_count(B[1],i)
ans*=2**B[0]
print(ans)

Measured memory_bytes: 3064
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn=205;
ll dis[maxn][maxn];
int n,m,r;
int no[10];
int x,y;
ll w;
int main() {
	memset(dis,0x3f3f3f3f,sizeof dis);
	cin>>n>>m>>r;
	for(int i=1;i<=r;i++)
		cin>>no[i];
	while(m--) {
		cin>>x>>y>>w;
		dis[x][y]=dis[y][x]=min(dis[x][y],w);
	}
	for(int k=1;k<=n;k++) {
		for(int i=1;i<=n;i++) {
			if(i==k)
				continue;
			for(int j=1;j<=n;j++) {
				if(j==i||j==k)
					continue;
				dis[i][j]=dis[j][i]=min(dis[i][j],dis[i][k]+dis[k][j]);
			}
		}
	}
	sort(no+1,no+r+1);
	ll mi=1e18;
	do {
		ll ans=0;
		for(int i=2;i<=r;i++) {
//			cout<<no[i]<<" "<<no[i-1]<<" "<<dis[no[i]][no[i-1]]<<endl;
			ans+=dis[no[i-1]][no[i]];
		}
		mi=min(mi,ans);
	}while(next_permutation(no+1,no+r+1));
	cout<<mi<<endl;
	return 0;
}

Measured memory_bytes: 640
#pragma region Macros
#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i)
#define REPR(i, n) for(int i=(n); i>=0; --i)
#define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i)
#define EACH(i, v) for(const auto& i : v)
#define ALL(x) (x).begin(),(x).end()
#define ALLR(x) (x).rbegin(),(x).rend()
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<class Value>using vec = vector< Value >;
using ll = long long;
using P = pair< long long, long long >;
#define fi first
#define se second
#define el endl
#pragma endregion


void Main();

int main(){
    std::cin.tie(nullptr);
    std::cout << std::fixed << std::setprecision(15);
    Main();
    return 0;
}

void Main(){
    int N;
    cin >> N;
    vec<int> v(N);
    REP(i, N){
        cin >> v[i];
    }
    sort(ALL(v));
    long double sum = v[0];
    FOR(i, N, 1){
        sum = (sum + v[i]) / 2.0;
    }
    cout << sum << el;
}



Measured memory_bytes: 256
#include <bits/stdc++.h>
#define bp __builtin_popcountll
#define pb push_back
#define in(s) freopen(s, "r", stdin);
#define out(s) freopen(s, "w", stdout);
#define inout(s, end1, end2) freopen((string(s) + "." + end1).c_str(), "r", stdin),\
		freopen((string(s) + "." + end2).c_str(), "w", stdout);
#define fi first
#define se second
#define bw(i, r, l) for (int i = r - 1; i >= l; i--)
#define fw(i, l, r) for (int i = l; i < r; i++)
#define fa(i, x) for (auto i: x)
using namespace std;
const int mod = 1e9 + 7, inf = 1061109567;
const long long infll = 4557430888798830399;
const int N = 20, MASK = (1 << 15) + 5;
typedef pair<int, int> ii;
int n, m, dp[N][MASK], cost[MASK];
vector<ii> g[N];
struct Edge {
	int u, v, c;
	Edge(int u = -1, int v = -1, int c = -1): u(u), v(v), c(c) {};
};
vector<Edge> e;
signed main() {
	#ifdef BLU
	in("blu.inp");
//	out("ans1.out");
	#endif
	ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	cin >> n >> m; 
	fw (i, 0, m) {
		int u, v, c;
		cin >> u >> v >> c;
		u--, v--;
		g[u].pb(ii(v, c)), g[v].pb(ii(u, c));
		e.pb(Edge(u, v, c));
	}
	fw (mask, 0, (1 << n)) {
		cost[mask] = 0;
		fa (j, e) {
			int u = j.u, v = j.v;
			if (((mask >> u) & 1) == ((mask >> v) & 1)) continue;
			cost[mask] += j.c;
//			if (mask == 7) cout << u + 1 << " " << v + 1 << " c = " << j.c << "\n";
		}
	}
	memset(dp, 63, sizeof dp);
	fw (layer, 0, (1 << n)) if (layer & 1) {
		//Assign this layer to voitex 0
		dp[0][layer] = cost[layer];
	}
	fw (mask, 0, (1 << n)) fw (i, 0, n) if (dp[i][mask] != inf) {
		int otherMask = ((1 << n) - 1) ^ mask;
		fa (j, g[i]) if (!(mask & (1 << j.fi))) {
			int v = j.fi;
			for (int submask = otherMask; submask >= 0; submask = ((submask - 1) & otherMask)) {
				if (submask == 0) break;
				if (!(submask & (1 << v))) continue;
				//Assign this submask to the next voitex.
				dp[v][mask | submask] = min(dp[v][mask | submask], dp[i][mask] + cost[submask] - 2 * j.se);
			}
		}
	}
	int finalAns = dp[n - 1][(1 << n) - 1];
	assert(finalAns % 2 == 0);
	cout << (finalAns >> 1);
	return 0;
}

Measured memory_bytes: 3072
#include<iostream>
#include<cstdio>
#include<vector>
using namespace std;
string a;
int s[26];
long long ans;
int main()
{
	cin>>a;
	for(int i=0;i<a.size();i++)
	{
		for(int j=0;j<26;j++)
		{
			if(a[i]-'a'==j)continue;
			ans+=s[j];
		}
		s[a[i]-'a']++;
	}
	printf("%lld",ans+1);
	return 0;
}

Measured memory_bytes: 640
import java.io.PrintWriter

fun main(args: Array<String>) {
    PrintWriter(System.out).use { out ->
        solve(out)
        out.flush()
    }
}

fun solve(out: PrintWriter) {
    val n = readInteger()
    val aList = readIntegerList()
    val aMap = mutableMapOf<Int, Int>()
    for (a in aList) {
        aMap[a] = (aMap[a]?: 0) + 1
    }

    var ans = 0
    for (key in aMap.keys) {
//        println("$key ${aMap[key]}")
        if (aMap[key]!! < key) {
            ans += aMap[key]!!
        } else if (aMap[key]!! > key) {
            ans += aMap[key]!! - key
        }
    }
    println(ans)
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
fun readDoubleList() = readStringList().map(String::toDouble)


Measured memory_bytes: 58224
from itertools import permutations
import math

def dist(area1, area2):
    return math.sqrt((area1[0] - area2[0]) ** 2 + (area1[1] - area2[1]) ** 2)


n = int(input())
area = [list(map(int, input().split())) for i in range(n)]
aind = [i for i in range(n)]
aind = list(permutations(aind, n))

total = 0
for inds in aind:
    temp = [dist(area[inds[i]], area[inds[i+1]]) for i in range(len(inds)-1)]
    total += sum(temp)
print(total / len(aind))


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

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

    vector<int> likeCount(m, 0);

    for (int p = 0; p < n; ++p)
    {
        int k;
        cin >> k;

        for (int i = 0; i < k; ++i)
        {
            int input;
            cin >> input;

            ++likeCount.at(input - 1);
        }
    }

    int ansCount = 0;

    for (const int &singleLikeCount : likeCount)
    {
        if (singleLikeCount == n)
        {
            ++ansCount;
        }
    }

    cout << ansCount << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <cstdlib>
#include <list>
#include <numeric>
#define rep(i,n) for(int i=0;i<n;i++)
#define all(x) (x).begin(),(x).end()
using namespace std;

int a=0, b = 0,c,d, n, k;
string s, t;


int main()
{
	cin >> n ;
	int sum = 0;
	rep(i,n)
	{
		cin >> a;
		sum += a-1;
	}
	cout << sum << endl;
	return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define forn(i, a, n) for(ll i = a; i < n; i++)

#include<iostream>
#include<string>


using namespace std;

typedef long long ll;
typedef pair<ll, ll> pll;

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

	string s;
	cin >> s;
	ll co = 0;
	for (char c : s)
		if (c == 'o')
			co++;
	co += 15 - s.size();

	if (co >= 8)
		cout << "YES";
	else
		cout << "NO";

	return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main()
{
    int i,j,k,l,m,n,a,b;
    scanf("%lld%lld",&a,&b);
    if(a+b==15)
    {
        printf("+");
        return 0;
    }
    else if(a*b==15)
    {
        printf("*");
        return 0;
    }
        printf("x");
        return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.util.stream.*;

public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int a = in.nextInt(), b = in.nextInt();
        if (a >= 13) {
            System.out.println(b);
        } else if (a >= 6) {
            System.out.println(b / 2);
        } else {
            System.out.println(0);
        }
    }
}


Measured memory_bytes: 23892
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main(){
	int n;
	
	while(cin >> n , n){
		int ret = 0;
		for(int i=1;i<=1000;i++){
			int sum = 0;
			for(int j=i;j<=1000;j++){
				sum += j;
				if(n == sum)ret++;
				if(n < sum)break;
			}
		}
		cout << ret-1 << endl;
	}
}

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

using namespace std;

int main() {

	int n,y;
	cin >> n >> y;

	for (int i = 0; i <= n; i++) {
		for (int j = 0; j <= n - i; j++) {
			int k = n - i - j;
			if (i * 10000 + j * 5000 + k * 1000 == y) {
				cout << i << " " << j << " " << k << endl;
				return 0;
			}

		}
	}
	cout << -1 << " " << -1 << " " << -1 << endl;
}

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

main(void) {
  ll n,x,m;cin>>n>>x>>m;
  vector<int> id(m,-1);
  vector<int> a;
  int len=0;
  ll tot=0;
  while(id[x]==-1){
    a.push_back(x);
    id[x]=len;
    len++;
    tot+=x;
    x=x*x%m;
  }
  int c=len-id[x];
  ll s=0;
  for(int i=id[x];i<len;i++) s+=a[i];
  ll ans=0;
  if(n<=len){
    rep(i,n) ans+=a[i];
  } else {
    ans+=tot;
    n-=len;
    ans+=s*(n/c);
    n%=c;
    rep(i,n) ans+=a[id[x]+i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 3952
s = input()
n = len(s)
dp = [[0]*2 for _ in range(n+1)]
for  i in range(1,n+1):
  if s[i-1] == "1":
    dp[i][0] = dp[i-1][1] + 1
    dp[i][1] = dp[i-1][0]
  else:
    dp[i][0] = dp[i-1][1] 
    dp[i][1] = dp[i-1][0] + 1
    
print(min(dp[n]))




Measured memory_bytes: 16500
use std::io::{stdin, Read, StdinLock};
use std::str::FromStr;
use std::iter::FromIterator;
use std::cmp::max;

fn main() {
    let cin = stdin();
    let mut scan = Scanner::new(cin.lock());
    let n = scan.read::<i64>();
    let k = scan.read::<i64>();
    let mut ret = 0;
    for b in 1..n + 1 {
        let p = n / b;
        let r = n % b;
        ret += p * max(0, b - k);
        ret += max(0, r + 1 - k);
    }
    if k == 0 {ret -= n;}
    println!("{}", ret);
}

// region template
#[allow(dead_code)]
fn iu(i: isize) -> usize { i as usize }

#[allow(dead_code)]
fn ui(i: usize) -> isize { i as isize }

#[allow(dead_code, deprecated)]
fn join<T: std::fmt::Display>(slice: &[T], sep: &str) -> String {
    let strings = slice.iter().map(|t| format!("{}", t)).collect::<Vec<_>>();
    strings.connect(sep)
}

#[allow(dead_code)]
fn arr<'a, S, T>(n: usize, mut f: S) -> Vec<T> where S: FnMut(usize) -> T + 'a {
    (0..n).map(|i| f(i)).collect::<Vec<T>>()
}

#[allow(dead_code)]
fn alt<S, T>(v: Vec<S>) -> T where T: FromIterator<S> {
    v.into_iter().collect::<T>()
}

#[allow(dead_code)]
fn dup<S, T>(v: &[S]) -> T where T: FromIterator<S>, S: Clone {
    v.iter().cloned().collect::<T>()
}

struct Scanner<'a> {
    cin: StdinLock<'a>,
}

#[allow(dead_code)]
impl<'a> Scanner<'a> {
    fn new(cin: StdinLock<'a>) -> Scanner<'a> {
        Scanner { cin: cin }
    }

    fn read1<T: FromStr>(&mut self) -> Option<T> {
        let token = self.cin.by_ref().bytes().map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect::<String>();
        token.parse::<T>().ok()
    }

    fn read<T: FromStr>(&mut self) -> T {
        self.read1().unwrap()
    }

    fn readn<T: FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect()
    }

    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}
// endregion

Measured memory_bytes: 4352
#include<iostream>
#include<cstdio>
#include<math.h>
#include<string>
#include<algorithm>
#include<functional>
#include<vector>
#include<set>
#include<map>
#define INF 999999
#define EPS 1.0e-6

using namespace std;

typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<int, P> PP;

ll h, w;
int n;
ll num[11];
int dx[3] = { -1,0,1 };
int dy[3] = { -1,0,1 };

int main()
{
	cin >> h >> w;
	cin >> n;
	ll a, b;
	vector<P> grid;
	for (int i = 0; i<n; i++) {
		cin >> a >> b;
		for (int i = 0; i<3; i++) {
			ll k = a + dx[i];
			for (int j = 0; j<3; j++) {
				ll l = b + dy[j];
				if (2 <= k && 2 <= l&&k < h&&l < w) {
					grid.push_back(P(k, l));
				}
			}
		}
	}
	sort(grid.begin(), grid.end());
	/*
	for (int i = 0; i<grid.size(); i++) {
		cout << grid[i].first << " " << grid[i].second << endl;
	}
	*/

	int i = 1;
	int cur = 1;
	while (i<grid.size()) {
		if (grid[i] == grid[i - 1]) {
			cur++;
			i++;
		}
		else {
			num[cur]++;
			cur = 1;
			i++;
			//cout << "a " << i << endl;
		}
	}
	if(!grid.empty())num[cur]++;
	
	ll sum = 0;
	for (int i = 1; i<10; i++) {
		sum += num[i];
	}
	
	num[0] = (h-2)*(w-2) - sum;
	for (int i = 0; i<10; i++) {
		cout << num[i] << endl;
	}

	return 0;
}

Measured memory_bytes: 18664
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
using namespace std;

int a,k,s,h=0,ansh=10000000;
int n,xm;

int main()
{
    int i;
    cin>>n>>k;
    for (i=1;i<=n;i++)
    {
    	scanf ("%d",&a);
    	if (a==1)
    	{
    		xm=i;
		}
	}
	if (xm<=k) 
	{
		int j=1;
		while (j<n)
		{
			j+=(k-1);
			h++;
		}
		cout<<h<<endl;
		return 0;
	}
	if (xm+k-1>=n)
	{
		int j=n;
		while (j>1)
		{
			j-=(k-1);
			h++;
		}
		cout<<h<<endl;
		return 0;
	}
	
	for (i=xm-k+1;i<=xm;i++)
	{
		h=1;
		s=i;
	    while (s>1)
	    {
	    	s=s-(k-1);
    		h++;
    	}
	    s=i+k-1;
	    while (s<n)
    	{
    		s+=(k-1);
    		h++;
    	}
    	if (h<ansh)
    	{
    		ansh=h;
    	} 
	}
	
	cout<<ansh<<endl;
    return 0;
}



Measured memory_bytes: 256
using System;
using System.Linq;
using System.Collections.Generic;
using static System.Console;

class Solver {
    Scanner sc = new Scanner();

    public void Solve() {
        var N = sc.nextInt();
        var a = sc.ArrayInt(N);
        WriteLine(a.Max() - a.Min());
    }
}



class Scanner {
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner() {
        s = new string[0];
        i = 0;
    }

    public string next() {
        if (i < s.Length) return s[i++];
        string st = Console.ReadLine();
        while (st == "") st = Console.ReadLine();
        s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
        if (s.Length == 0) return next();
        i = 0;
        return s[i++];
    }

    public int nextInt() {
        return int.Parse(next());
    }
    public int[] ArrayInt(int N, int add = 0) {
        int[] Array = new int[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextInt() + add;
        }
        return Array;
    }

    public long nextLong() {
        return long.Parse(next());
    }

    public long[] ArrayLong(int N, long add = 0) {
        long[] Array = new long[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextLong() + add;
        }
        return Array;
    }

    public double nextDouble() {
        return double.Parse(next());
    }

    public double[] ArrayDouble(int N, double add = 0) {
        double[] Array = new double[N];
        for (int i = 0; i < N; i++) {
            Array[i] = nextDouble() + add;
        }
        return Array;
    }
}

class Program {
    static void Main(string[] args) {
        Solver s = new Solver();
        s.Solve();
    }
}


Measured memory_bytes: 11220
x,y = map(int,input().split())
MOD = 10**9+7

def comb(n,r,mod):
    n1 = n+1
    numer = denom = 1
    for i in range(1,r+1):
        numer = numer*(n1-i)%mod
        denom = denom*i%mod
    return numer*pow(denom,mod-2,mod)%mod

if (x+y)%3 != 0 or (2*x-y)//3 < 0 or (2*y-x)//3 < 0:
    print(0)
else:
    n = (2*x-y)//3
    m = (2*y-x)//3
    
    print(comb(n+m,min(n,m),MOD))

Measured memory_bytes: 3064
n = int(input())
h = list(map(int, input().split()))
down = 0
for i in range(1, n):
    if h[i-1] > h[i]:
        down += h[i-1] - h[i]
    if h[i-1] < h[i]:
        down = 0
    if down >= 2:
        print("No")
        exit()
print("Yes")

Measured memory_bytes: 14224
x, y = map(int, input().split())

ans = 0

def calc(z):
    ans = 0
    if z == 1:
        ans += 300000
    elif z == 2:
        ans += 200000
    elif z == 3:
        ans += 100000
    
    return ans

if x == 1 and y == 1:
    ans += 400000

print(ans+calc(x)+calc(y))

Measured memory_bytes: 9136