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

const char WHITE = '.';
const char BLACK = '#';

int A;
int B;
char field[100][100];

int main() {
  scanf("%d%d", &A, &B);
  puts("100 100");
  for (int i=0; i<50; i++) {
    for (int j=0; j<100; j++) {
      field[i][j] = WHITE;
      field[i+50][j] = BLACK;
    }
  }

  --A;
  --B;
  for (int i=1; i<49; i+=2) {
    for (int j=1; j<99; j+=2) {
      if (!B) goto L_END1;
      field[i][j] = BLACK;
      --B;
    }
  }

L_END1:
  for (int i=51; i<99; i+=2) {
    for (int j=1; j<99; j+=2) {
      if (!A) goto L_END2;
      field[i][j] = WHITE;
      --A;
    }
  }

L_END2:
  for (int i=0; i<100; i++) {
    for (int j=0; j<100; j++) {
      printf("%c", field[i][j]);
    }
    puts("");
  }
}


Measured memory_bytes: 256
#include <stdio.h>
 
using namespace std;
 
struct Node{
    Node(){
        left_child = right_child = parent = -1;
    };
    int left_child,right_child,parent;
};
 
void preORDER(Node order[],int id){
    printf(" %d",id);
    if(order[id].left_child != -1) preORDER(order,order[id].left_child );
    if(order[id].right_child != -1) preORDER(order,order[id].right_child );
}
 
void inORDER(Node order[],int id){
    if(order[id].left_child != -1) inORDER(order,order[id].left_child );
    printf(" %d",id);
    if(order[id].right_child != -1) inORDER(order,order[id].right_child );
}
 
void postORDER(Node order[],int id){
    if(order[id].left_child != -1) postORDER(order,order[id].left_child );
    if(order[id].right_child != -1) postORDER(order,order[id].right_child );
    printf(" %d",id);
}
 
int main(){
    int n,id,left,right,root_id;
    scanf("%d",&n);
    Node order[n];
    for(int i = 0; i < n; i++){
        scanf("%d %d %d",&id,&left,&right);
        if(left != -1){
            order[id].left_child = left;
            order[left].parent = id;
        }
        if(right != -1){
            order[id].right_child = right;
            order[right].parent = id;
        }
    }
 
    for(root_id = 0; root_id < n; root_id++){
        if(order[root_id].parent == -1) break;
    }
 
    printf("Preorder\n");
    preORDER(order,root_id);
    printf("\n");
 
    printf("Inorder\n");
    inORDER(order,root_id);
    printf("\n");
 
    printf("Postorder\n");
    postORDER(order,root_id);
    printf("\n");
}


Measured memory_bytes: 2692
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define mt make_tuple
#define min_3(a,b,c) min(a,min(b,c))
#define max_3(a,b,c) max(a,max(b,c))
#define nout(ans) cout << (ans) << "\n"
#define sout(ans) cout << (ans) << " "
using namespace std;

const double pi = 3.14159265359;
const ll INF = 1e12;
const ll MOD = 1e9 + 7;
const ll N = 1e5 + 5; 
/*
Decimal Places: cout << fixed << setprecision(n) << ans << endl
*/

bool compare(const pair<int, int>&i, const pair<int, int>&j)
{
    return i.second < j.second;
}

ll raise(ll a, ll b) {
    ll res = 1;
    while (b > 0) {
        if (b & 1)
            res = res * a;
        a = a * a;
        b >>= 1;
    }
    return res;
}


ll n, W, v[102], w[102], dp[N][102];

void solve()
{
    cin >> n >> W;
    for (int i=1; i<=n; ++i) cin >> w[i] >> v[i];
    // dp[i][j] = max value we can get for weight i from the first j elements
    for (int i=0; i<=W; ++i) {
        for (int j=1; j<=n; ++j) {
            dp[i][j] = dp[i][j-1];
            if (i>=w[j]) {
                dp[i][j] = max(dp[i][j], dp[i-w[j]][j-1] + v[j]);
            }
        }
    }nout(dp[W][n]);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);
    int t = 1;
    //cin >> t;
    for (int i=1; i<=t; i++)
    {
        solve();
    }
    return 0;
}

Measured memory_bytes: 83176
//quming
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
typedef long long ll;
const int N=2e5+5;
const double Pi=acos(-1.0);
ll k,l,r,mid,ans,st[N];int a[N],b[N],n;
bool ck(){
	R ll res=0;
	fp(i,1,n)st[i]=mid/b[i];
	fp(i,1,n)res+=max(0ll,a[i]-st[i]);
//	fp(i,1,n){
//		printf("%d %d %lld\n",a[i],b[i],st[i]);
//	}
	return res<=k;
}
int main(){
//	freopen("testdata.in","r",stdin);
	scanf("%d%lld",&n,&k);
	fp(i,1,n)scanf("%d",&a[i]);
	fp(i,1,n)scanf("%d",&b[i]);
	sort(a+1,a+1+n),sort(b+1,b+1+n),reverse(b+1,b+1+n);
	l=0,r=1e18,ans=1e18;
//	mid=12;
//	printf("%d\n",ck());
	while(l<=r){
		mid=(l+r)>>1;
		ck()?(ans=mid,r=mid-1):l=mid+1;
	}
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 3328
def North(dice):
    w = dice[0]
    dice[0] = dice[1]
    dice[1] = dice[5]
    dice[5] = dice[4]
    dice[4] = w
    return dice
def East(dice):
    w = Dice[1]
    dice[1] = dice[2]
    dice[2] = dice[4]
    dice[4] = dice[3]
    dice[3] = w
    return dice

def West(dice):
    w = dice[0]
    dice[0] = dice[2]
    dice[2] = dice[5]
    dice[5] = dice[3]
    dice[3] = w
    return dice

maxloop = 4
Ncnt = 0
Ecnt = 0
Wcnt = 0

Dice = input().split()
q = int(input())

CopyDice = Dice

for i1 in range(q):
    Nloop = True
    Eloop = True
    Wloop = True
    Ncnt = 0
    Ecnt = 0
    Wcnt = 0
    I = input().split()
    top = I[0]
    front = I[1]
    while Eloop:
        while Nloop:
            while Wloop:
                if Dice[0] == top and Dice[1] == front:
                    print(Dice[2])
                    Nloop = False
                    Eloop = False
                    Wloop = False
                    break
                Dice = West(Dice)
                Wcnt += 1
                if Wcnt == maxloop:
                    Wloop = False
            Dice = North(Dice)
            Wcnt = 0
            Wloop = True
            Ncnt += 1
            if Ncnt == maxloop:
                Nloop = False
        Dice = East(Dice)
        Ncnt = 0
        Nloop = True
        Ecnt += 1
        if Ecnt == maxloop:
            Eloop = False
    Dice = CopyDice

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

using namespace std;

typedef long long ll;

//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
#define M 3001


int m,n;
int MAT[M][M];
char str1[M],str2[M];


int LCS( )
{
    for(int i=0;i<=m;i++)
    {
        for(int j=0;j<=n;j++)
        {
            if(i==0||j==0)
            {
                MAT[i][j]=0;
            }
            else if(str1[i-1]==str2[j-1])
            {
                MAT[i][j]=1+MAT[i-1][j-1];
            }
            else
            {
                MAT[i][j]=max(MAT[i-1][j],MAT[i][j-1]);
            }
        }
    }
    return MAT[m][n];
}


int main( )
{
    scanf("%s %s",&str1,&str2);


    m=strlen(str1);
    n=strlen(str2);

//    memset(dp,-1,sizeof(dp));
//    int indx=lcs(m,n);
    int indx=LCS();

    if(indx==0){
        printf(" \n");
        return 0;
    }

    int i=m,j=n;
    char ans[indx+1];
    ans[indx]='\0';

    while(i>0&&j>0)
    {
        if(str1[i-1]==str2[j-1])
        {
            ans[indx-1]=str1[i-1];
            i--,j--,indx--;
        }
        else if(MAT[i-1][j]>MAT[i][j-1])
        {
            i--;
        }
        else
        {
            j--;
        }
    }
    printf("%s\n",ans);

    return 0;
}


Measured memory_bytes: 35456
#include <stdio.h>

int main() 
{
    int debut = 100000;
    int n;
    scanf("%d", &n);
    for (int i = 0; i < n; i++) {
        debut += debut / 20;
        if (0  < debut % 1000) {
            debut = debut / 1000 * 1000 + 1000;
        }
    }
    printf("%d\n", debut);
    return 0;
}



Measured memory_bytes: 2060
#include "bits/stdc++.h"

using namespace std;
using int64 = long long int;

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

	unordered_map<char, int> map;
	for (auto c : s)
	{
		map[c]++;
	}

	bool ans = map.size() == 2 && all_of(map.begin(), map.end(), [](auto &p) { return p.second == 2; });
	cout << (ans ? "Yes" : "No") << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#include<boost/variant.hpp>
using namespace std;
typedef long long ll;
typedef vector<boost::variant<bool, ll, int, string, double, char*, const char*>> any;
template<typename T> inline void pr(const vector<T> &xs){
	for(int i=0; i<xs.size()-1; i++) cout<<xs[i]<<" ";
	(xs.empty()?cout:(cout<<xs[xs.size()-1]))<<endl;
}
#ifdef DEBUG
#define debug(...) pr(any{__VA_ARGS__})
#define debugv(x) pr((x))
#else
#define debug(...)
#define debugv(x)
#endif

ll dp[6005][2];
int main() {
	long long N;
    scanf("%lld",&N);
    long long T;
    scanf("%lld",&T);
    std::vector<long long> A(N);
    std::vector<long long> B(N);
    for(int i = 0 ; i < N ; i++){
        scanf("%lld",&A[i]);
        scanf("%lld",&B[i]);
    }

	vector<pair<ll, ll>> AB(N);
	for(int i=0; i<N; i++) AB[i]={A[i], B[i]};
	sort(AB.begin(), AB.end());
	//for(int i=0; i<N; i++) AB[i].second = -AB[i].second;

	ll ans = 0;
	for(int i=0; i<N; i++){
		for(int t=0; t<T; t++){
			ans = max(ans, dp[t][i%2]+AB[i].second);
			dp[t][(i+1)%2] = dp[t][i%2];
			if(t-AB[i].first>=0) dp[t][(i+1)%2] = max(dp[t][(i+1)%2], dp[t-AB[i].first][i%2]+AB[i].second);
		}
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 384
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;

#define REP(i, n) for (int i = 0; i < (n); i++)
//#define int long long
#define FOR(i, m, n) for (int i = (m); i < (n); i++)
#define all(x) x.begin(), x.end()
using pii = pair<int, int>;
using ll = long long;
using ld = long double;
using pdii = pair<ld, pii>;
char A[505][505];
constexpr ld INF = 1e13;
constexpr int dx[4] = {0, 0, -1, 1}, dy[4] = {1, -1, 0, 0};
constexpr ld EPS = 1e-11;
ld ans;
int W, H;
int sx, sy, gx, gy;
ld dp[505][505];
bool done[505][505];
using pdi = pair<ld, int>;
priority_queue<pdi, vector<pdi>, greater<pdi>> que;
ld calcerr(ld mid) {
    REP(i, H) REP(j, W) {
        dp[i][j] = INF;
        done[i][j] = false;
    }

    REP(i, H) REP(j, W) {
        if (A[i][j] == '*') {
            dp[i][j] = mid;
            que.push({mid, i * W + j});
        }
    }

    dp[gx][gy] = 0;
    done[gx][gy] = true;
    que.push({0, gx * W + gy});
    while (!que.empty()) {
        pdi p = que.top();
        que.pop();
        int x = p.second / W, y = p.second % W;
        done[x][y] = true;
        // if (res > dp[x][y]) continue;
        // dp[x][y] = min(dp[x][y], res);
        REP(k, 4) {
            int ni = x + dx[k], nj = y + dy[k];
            if (ni >= 0 && ni < H && nj >= 0 && nj < W && A[ni][nj] != '#' && A[ni][nj] != '*' && !done[ni][nj]) {
                if (dp[x][y] + 1 < dp[ni][nj]) {
                    dp[ni][nj] = dp[x][y] + 1;
                    que.push({dp[ni][nj], ni * W + nj});
                }
            }
        }
    }
    ld sum = 0;
    int cnt = 0;
    REP(i, H) {
        REP(j, W) {
            if (A[i][j] != '#' && A[i][j] != '*' && A[i][j] != 'g' && done[i][j]) {
                cnt++;
                sum += dp[i][j];
            }
        }
    }
    ld res = (sum / cnt);

    ans = dp[sx][sy];
    return abs(res - mid);
}
const ld phi = (3 - sqrtl(5)) / 2.0;

bool solve() {
    cin >> W >> H;
    REP(i, H) REP(j, W) {
        cin >> A[i][j];
        if (A[i][j] == 's') {
            sx = i, sy = j;
        }
        if (A[i][j] == 'g') {
            gx = i, gy = j;
        }
    }

    ld l = 1, r = 1e10;
    ld m1, m2, e1, e2;
    int las = 0;
    REP(_, 86) {
        m1 = l + phi * (r - l), m2 = r - phi * (r - l);
        swap(e1, e2);
        if (las == 0) {
            e1 = calcerr(m1);
            e2 = calcerr(m2);
        } else if (las == 1) {
            e2 = calcerr(m2);
        } else {
            e1 = calcerr(m1);
        }
        if (e1 > e2) {
            l = m1;
            las = 1;
        } else {
            r = m2;
            las = 2;
        }
    }
    cout << fixed << setprecision(15) << ans << endl;
}

signed main() {
    // while (solve())
    solve();
}



Measured memory_bytes: 8908
#define _USE_MATH_DEFINES
 
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

void small(int kami[10][10], int x, int y){
	kami[y][x]++;
	if(x-1>=0){
		kami[y][x-1]++;
	}
	if(x+1<=9){
		kami[y][x+1]++;
	}
	if(y-1>=0){
		kami[y-1][x]++;
	}
	if(y+1<=9){
		kami[y+1][x]++;
	}
}

void middle(int kami[10][10], int x, int y){
	if(x-1>=0 && y-1>=0){
		kami[y-1][x-1]++;
	}
	if(x-1>=0 && y+1<=9){
		kami[y+1][x-1]++;
	}
	if(x+1<=9 && y-1>=0){
		kami[y-1][x+1]++;
	}
	if(x+1<=9 && y+1<=9){
		kami[y+1][x+1]++;
	}
}

void large(int kami[10][10], int x, int y){
	if(x-2>=0){
		kami[y][x-2]++;
	}
	if(x+2<=9){
		kami[y][x+2]++;
	}
	if(y-2>=0){
		kami[y-2][x]++;
	}
	if(y+2<=9){
		kami[y+2][x]++;
	}
}

int main(){
	int kami[10][10]={0};
	char c;
	int x, y, s;

	while( cin>> x >> c >> y >> c >> s ){
		switch( s ){
		case 3:
			large(kami, x, y);
		case 2:
			middle(kami, x, y);
		case 1:
			small(kami, x, y);
		}
	}

	int max = 0;
	int count = 0;
	for(int i=0;i<10;i++){
		for(int j=0;j<10;j++){
			if(kami[i][j]==0){
				count++;
			}else if(max<kami[i][j]){
				max=kami[i][j];
			}
		}
	}

	cout << count << endl;
	cout << max << endl;
	return 0;
}

Measured memory_bytes: 1160
#include <stdio.h>
#include <stdlib.h>

int main (void) {
    int a[3];
    scanf("%d%d%d", &a[0], &a[1], &a[2]);
    if ( a[0]+a[1]+a[2] >= 22 )
        printf("bust\n");
    else
        printf("win\n");
    return EXIT_SUCCESS;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define dum(x) cout<<#x<<'='<<x<<endl
#define ll long long
using namespace std;

int main() {
  ll x;
  cin >> x;
  ll ans = x / 11 * 2;
  if (x % 11 != 0) {
    if (x % 11 <= 6) {
      ans += 1;
    } else {
      ans += 2;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 256
class UnionFind():
    def __init__(self, n):
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        if self.parents[x] < 0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)

        if x == y:
            return

        if self.parents[x] > self.parents[y]:
            x, y = y, x

        self.parents[x] += self.parents[y]
        self.parents[y] = x

    def size(self, x):
        return -self.parents[self.find(x)]

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

    def members(self, x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        return len(self.roots())

    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}

    def __str__(self):
        return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())


n, m = map(int, input().split())
uf = UnionFind(n+1)
P = list(map(int, input().split()))
for _ in range(m):
    a, b = map(int, input().split())
    uf.union(a, b)

pos = dict()  # 整数pのインデックス
for i, p in enumerate(P):
    pos[p] = i+1
    
ans = 0
for i, p in enumerate(P):  
    if p == i + 1:  # 整数pとインデックスが一致している
        ans += 1
    else:  # 一致していないとき、入れ替え可能か
        index = pos[i+1]
        if uf.same(i+1, index):
            ans += 1
print(ans)

Measured memory_bytes: 22364
package main

import (
	"fmt"
	"sort"
)

type Student struct {
	Id  int
	Order int
}

type Students []Student

func (s Students) Len() int           { return len(s) }
func (s Students) Less(i, j int) bool { return s[i].Order < s[j].Order }
func (s Students) Swap(i, j int)      { s[i], s[j] = s[j], s[i] }

func main() {
	var n int
	fmt.Scan(&n)
	students := make([]Student, n)
	for i := 0; i < n; i++ {
		var order int
		fmt.Scan(&order)
		students[i] = Student{
			Id: i,
			Order: order,
		}
	}
	// go 1.6
	sort.Sort(Students(students))

	// go 1.8以降で使用可能
	/*

	students := make([]Student, 0)
		for i := 0; i < n; i++ {
			var order int
			fmt.Scan(&order)
			tmpStudent := Student{
				Id: i,
				Order: order,
			}
			students = append(students, tmpStudent)
		}

	sort.Slice(students, func(i, j int) bool {
		//interface内の降順ソート
		return students[i].Order < students[j].Order
	})
	*/
	for i := 0; i < n; i++ {
		if i == n - 1 {
			fmt.Println(students[i].Id + 1)
		} else {
			fmt.Print(students[i].Id + 1, " ")
		}
	}
}

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

#define ll long long
#define rep(A,B,C) for(A=B;A<C;++A)
#define pii pair<int,int>
#define pll pair<ll,ll>

#define fi first
#define se second
#define all(A) A.begin(),A.end()

using namespace std;

/////////////////////////////////////////////////////
#define MOD (ll)(1e9+7)
#define vv vector


ll N;
ll i, j, k;
ll X[202020],Y[202020];

ll ans;
int main(){
    scanf("%lld", &N);
    map<ll,vv<ll>> xya,xyb;
    rep(i,0,N){
        scanf("%lld%lld", &X[i], &Y[i]);
        ll a = X[i] + Y[i];
        xya[a].push_back(i);
        ll b = X[i] - Y[i];
        xyb[b].push_back(i);
    }
    ans = 0;
    {
        auto ba = xya.begin();
        auto ea = xya.end();
        --ea;

        ans = abs(ba->fi - ea->fi);
    }
    {
        auto bb = xyb.begin();
        auto eb = xyb.end();
        --eb;
        ans = max(ans, abs(bb->fi - eb->fi));
    }
    printf("%lld\n", ans);

    return 0;
}

Measured memory_bytes: 50616
#include <stdio.h>

int main(void){
	long n, i, a, y, count=0;
	
	scanf("%ld", &n);
	
	for(i=0; i<n; i++){
		scanf(" %ld", &a);
		int flag=0;
		
		for(y=1; 2*y*(y+1)<=a; y++){
			if((a-2*y*(y+1))%(2*y+1)==0){
				flag=1;
				break;
			}
		}
		
		if(flag==0) ++count;
	
	}
	printf("%ld\n", count);

	return 0;
}

Measured memory_bytes: 596
#include<iostream>
using namespace std;
int main(){
  int x, t, n, k, s = 0;
  cin >> n >> x >> t;
  if(n % x == 0){
    s = n / x;
  }
  else{
    s = n / x + 1;
  }
  k = s * t;
  cout << k << "\n";
}

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

#define ld long double
#define ll long long
#define ALL(a)  (a).begin(),(a).end()
#define spa << " " <<
ll MOD = 1e9+7;
void chmin(ll &a, ll b) { if (a > b) a = b; }
void chmax(ll &a, ll b) { if (a < b) a = b; }

int main(){
  ll i, j, f, ib;
  string str;
  cin >> str;
  ll n;
   n = stoll(str);
  ll result = 0;
  for(i = 0; i < str.size(); i++)
    result += str[i] - '0';
  
  
  for(i = 0; i < str.size(); i++){
    if(n % 10 == 0)
      n /= 10;
    else if(n % 10 == 1 && i == str.size() - 1)
      result = 10;
    else 
      break;
  }

    
  cout << result << endl;
  return 0;
}

Measured memory_bytes: 256
import java.util.*;
import java.math.*;
public class Main {
    static final int MOD = 1_000_000_007; // 10^9+7
    //static final int MAX = 2_147_483_646; // intの最大値
    static final int INF = 1_000_000_000; // 10^9
    static final int MAX = 10_000_000;
    public static void main(String args[]) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = sc.nextInt();
        char[][] a = new char[n][n];
        char[][] b = new char[m][m];
        for(int i = 0;i < n;i++){
            a[i] = sc.next().toCharArray();
        }
        for(int i = 0;i < m;i++){
            b[i] = sc.next().toCharArray();
        }
        for(int i = 0;i <= n-m;i++){
            for(int j = 0;j <= n-m;j++){
                //i,j成分が一致するときに全探索する
                if(a[i][j] == b[0][0]){
                    boolean poyo = false;
                    for(int s = 0;s < m;s++){
                        for(int t = 0;t < m;t++){
                            if(a[i+s][j+t]!=b[s][t]){
                                poyo = true;
                                break;
                            }
                        }
                        if(poyo)break;
                    }
                    if(!poyo){
                        System.out.println("Yes");
                        return;
                    }
                }
            }
        }
        System.out.println("No");

    }       
}






Measured memory_bytes: 21584
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define INF 98765432198765432
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset(a,0,sizeof(a));
#define MEM_1(a) memset(a,-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<int, int, int, int> iiii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const ll MOD = 1000000007;
ll POW(ll a, ll b, ll MMM = MOD) { ll ret = 1; for (; b; b >>= 1, a = (a*a) % MMM)if (b & 1)ret = (ret*a) % MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1 }, dy[] = { 1,0,-1,0 };
int ddx[] = { 0,0,1,1,1,-1,-1,-1 }, ddy[] = { 1,-1,1,0,-1,1,0,-1 };

Vi v;
int main() {
	int n,m;
	scanf("%d%d",&n,&m);
	for(int i=1;i*i<=m;i++)
	{
		if(m%i==0)
		{
			v.pb(i);
			if(i*i!=m)v.pb(m/i);
		}
	}
	sort(v.rbegin(),v.rend());
	for(int x:v)
	{
		if(1LL*x*n>1LL*m)continue;
		return !printf("%d",x);
	}
}

Measured memory_bytes: 256
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;

namespace LogicSummoner
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = GetNumber();
            var nums = GetNumbers2(N);
            System.Console.WriteLine("{0} {1} {2}", nums.Min(), nums.Max(), nums.Sum());
        }

        //static StreamReader Console = new StreamReader("input.txt");

        static int GetNumber()
        {
            return int.Parse(Console.ReadLine().Trim());
        }

        static double GetDounble()
        {
            return double.Parse(Console.ReadLine().Trim());
        }

        static List<int> GetNumbers(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToList();
        }

        static List<long> GetNumbers2(int n = 0)
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(x => long.Parse(x)).ToList();
        }

        static List<string> GetStrings()
        {
            return Console.ReadLine().Trim().Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries).ToList();
        }
    }
}

Measured memory_bytes: 11152
#include <cstdint>
#include <iostream>
#include <vector>

using namespace std;

static uint64_t calc_count(vector<long long> &vec, int64_t sign)
{
  unsigned long long count = 0;

  long long total = vec[0];
  if (total == 0) {
    total = sign;
    count++;
  } else {
    if ((sign * total) < 0) {
      count += abs(sign - total);
      total = sign;
    }
  }

  for (uint64_t i = 1; i < vec.size(); i++) {
    sign *= -1;

    total += vec[i];

    if ((total == 0) || ((sign * total) < 0)) {
      count += abs(sign - total);
      total = sign;
    }
  }

  return count;
}

int32_t main()
{
  uint64_t N;
  cin >> N;

  vector<long long> vec;

  for (uint64_t i = 0; i < N; i++) {
    long long val;
    cin >> val;
    vec.push_back(val);
  }

  cout << min(calc_count(vec, 1), calc_count(vec, -1)) << endl;
  return 0;
}


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

int main() {
    int a, b, k;
    cin >> a >> b;
    if(a%2!=b%2){
        printf("IMPOSSIBLE");
    }
    else {
        k = (a+b)/2;
        cout << k << endl;
    }
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < n; i++)
#define rrep(i, n) for (int i = n - 1; i >= 0; i--)
using namespace std;
#define INF ((1<<30)-1)
#define LINF (1LL<<60)
#define EPS (1e-10)
typedef long long ll;
typedef pair<ll, ll> P;
const int MOD = 1000000007;
const int MOD2 = 998244353;


int main(){
    int x, y;
    cin >> x >> y;
    bool flag = false;
    rep(i, 100) rep(j, 100){
        if (i * 2 + j * 4 == y && i + j == x) flag = true;
    }

    if (flag) cout<< "Yes" << endl;
    else cout << "No" << endl;
    return 0;
}


Measured memory_bytes: 3576
def flatten_by_extend(nested_list):
  flat_list = []
  for e in nested_list:
    flat_list.extend(e)
  return flat_list


n, k = input().split(' ')
n = int(n)
k = int(k)
a = []
for i in range(k):
  d = int(input())
  a.append(list(map(int, input().split())))

a = set(flatten_by_extend(a))
print(n - len(a))


Measured memory_bytes: 9252
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<pii,int> ppii;
typedef pair<int,pii> pipi;
typedef pair<ll,ll> pll;
typedef pair<ll,pll> plpl;
typedef tuple<ll,ll,ll> tl;
ll mod=1000000007;
ll mod2=998244353;
ll inf=1000000000000000000;
#define rep(i,m,n) for(int i=m;i<n;i++)
#define rrep(i,n,m) for(int i=n;i>=m;i--)
ll lmax(ll a,ll b){
    if(a<b)return b;
    else return a;
}
ll lmin(ll a,ll b){
    if(a<b)return a;
    else return b;
}
int main(){
    ll n,k;cin>>n>>k;
    double ans=0;
    rep(i,1,n+1){
        double sum=1.0/(double)n;
        ll now=i;
        for(;;){
            if(now>=k)break;
            sum*=0.5;
            now*=2;
        }
        ans+=sum;
    }
    cout<<fixed<<setprecision(12)<<ans<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#define mc 999999999
#define pc -1000000000

int main(){
  long long i,j,h,w,sh,sw,v,t=0,p,q;
  long long arr[512]={0};
  scanf("%lld%lld%lld%lld",&h,&w,&sh,&sw);
  if(h%sh==0 && w%sw==0){
    printf("No\n");return 0;
  }
  if(w%sw!=0){
  arr[0]=0;
  for(i=1;i<sw;i++){
    arr[i]=114514;
  }
  for(i=sw;i<=w;i++){
    arr[i]=arr[i-sw]-1;
  }
  printf("Yes\n");
  for(i=0;i<h;i++){
    for(j=1;j<=w;j++){
      if(j!=1){printf(" ");}
      printf("%lld",arr[j]-arr[j-1]);
    }
    printf("\n");
  }
  }
  else{
  arr[0]=0;
  for(i=1;i<sh;i++){
    arr[i]=114514;
  }
  for(i=sh;i<=h;i++){
    arr[i]=arr[i-sh]-1;
  }
  printf("Yes\n");
  for(i=1;i<=h;i++){
    for(j=1;j<=w;j++){
      if(j!=1){printf(" ");}
      printf("%lld",arr[i]-arr[i-1]);
    }
    printf("\n");
  }
  }
  return 0;
}


Measured memory_bytes: 2048
#include <bits/stdc++.h>
#include <ext/numeric>

using namespace std;
using namespace __gnu_cxx;

#define all(v)   v.begin(), v.end()
#define endl "\n"
#define pb push_back
#define F first
#define S second
#define THINK_TWICE_CODE_ONCE cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);
#define to_str to_string
#define isOdd(n)    (n&1)
#define LLMAX LLONG_MAX
#define LLMIN LLONG_MIN
#define IMN INT_MIN
#define IMX INT_MAX
#define pow(n, m) power((ll)n, (ll)m)
#define numOfDigits(n)  ((n)? (ll)(log10(n)+1) : 1)

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef double dd;
typedef string str;
typedef vector<int> vecint;
typedef vector<ll> vecll;
typedef pair<int, int> pii;

int main()
{
    THINK_TWICE_CODE_ONCE
    //freopen("test cases\\.txt", "r", stdin) ;
    str s; cin>>s;
    if(s[2]==s[3] && s[4]==s[5])cout<<"Yes";
    else cout<<"No";
    return 0;
}







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

#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long

using namespace std;


int main() {
	ll a,b,k;
	cin>>a>>b>>k;
	if(k<a) cout<<a-k<<" "<<b<<endl;
	else if(k<=a+b) cout<<0<<" "<<b-(k-a)<<endl;
	else cout<<0<<" "<<0<<endl;
}

Measured memory_bytes: 256
def resolve():
    N, K = map(int, input().split())
    S = input()
    S_ = []
    for i in range(N):
        a = S[i]
        if i != K - 1:
            S_.append(a)
        else:
            S_.append(a.lower())

    S_ = ''.join(S_)
    print(S_)

resolve()

Measured memory_bytes: 3060
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
using namespace std;

typedef long long ll;

bool prime[100001];
bool plike[100001];
ll plcnt[100001];

int main(){
  for(ll i = 2; i<400; ++i){
    if(prime[i]){
      continue;
    }

    ll j = i;
    while(i + j <=100001){
      prime[i+j] = true;
      j+=i;
    }
  }
  plike[0] = plike[1] = plike[2] = true;
  ll cnt = 0;
  for(ll i=3;i<100001;++i){
    plike[i] = prime[(i+1)/2] || prime[i];
    if(!plike[i]){
      cnt+=1;
    }
    plcnt[i] = cnt;
  }

  for(int i=0;i<1000;++i){
    if(!plike[i]){
      //cerr<<i<<",";
    }
  }
  //cerr<<endl;

  for(int i=0;i<1000;++i){
    //cerr<<plcnt[i]<<",";
  }

  ll Q;
  cin >> Q;
  for(ll i=0;i<Q;++i){
    ll l,r;
    cin >> l >> r;
    cout<< plcnt[r] - plcnt[l-1]<<endl;
  }
  
  return 0;
}

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

int main(){
  int N,M;
  cin >> N >> M;
  vector<vector<int>> info(M);
  for(int i=0;i<M;i++){
    int k; cin >> k;
    for(int j=0;j<k;j++){
      int s; cin >> s;
      info.at(i).push_back(s-1);
    }
  }
  int ans=0,sum=0;
  vector<int> p(M);
  for(int i=0;i<M;i++){
    cin >> p.at(i);
  }
  for(int bit=0;bit < (1<<N);bit++){
    for(int i=0;i<M;i++){
      int count=0;
      for(int j=0;j<info.at(i).size();j++){
        if(bit & (1<<info.at(i).at(j))){
          count++;
        }
      }
      if(p.at(i)==count%2){
        sum++;
      }
    }
    if(sum==M){
      ans++;
    }
    sum = 0;
  }
  cout << ans << endl;
}  

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

int main() {
  string a, b;
  int x;

  cin >> a >> b;
  x = stoi(a + b);
  for (int i = 4; i < 317; i++) {
    if (i * i == x) {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <math.h>
#include <vector>
using namespace std;
int main()
{
    int A, B, K, itr;
    int count = 0;
   
    cin >> A >> B >> K;
for (int i = min(A,B); i >= 1; i--)
{
   if ( A%i==0 && B%i==0)
   {
       count++;
   }
   if (count==K)
   {
           
    cout << i << endl;
    return 0;
}
   }

}




Measured memory_bytes: 3600
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <deque>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>

#define FOR(i,k,n) for (int (i)=(k); (i)<(n); ++(i))
#define rep(i,n) FOR(i,0,n)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fst first
#define snd second
#define all(v) begin(v), end(v)
#define debug(x) cerr<< #x <<": "<<x<<endl
#define debug2(x,y) cerr<< #x <<": "<< x <<", "<< #y <<": "<< y <<endl

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vvi;
typedef vector<ll> vll;
typedef vector<vector<ll> > vvll;
template<class T> using vv=vector<vector< T > >;
// cout pair
template<typename T1, typename T2> ostream& operator<<(ostream& s, const pair<T1, T2>& p) {
  s << p.first << " " << p.second << "\n"; return s;
}

// cout vector<pair>
template<typename T1, typename T2> ostream& operator<<(ostream& s, const vector<pair<T1, T2> >& vp) {
  int len = vp.size(); s << "\n";
  for (int i = 0; i < len; ++i) { s << vp[i]; }
    s << "\n"; return s;
}

// cout vector
template<typename T> ostream& operator<<(ostream& s, const vector<T>& v) {
  int len = v.size(); s << "\n";
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  s << "\n"; return s;
}

// cout deque
template<typename T> ostream& operator<<(ostream& s, const deque<T>& v) {
  int len = v.size(); s << "\n";
  for (int i = 0; i < len; ++i) {
    s << v[i]; if (i < len - 1) s << "\t";
  }
  s << "\n"; return s;
}

// cout 2-dimentional vector
template<typename T> ostream& operator<<(ostream& s, const vector< vector<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) { s << vv[i]; }
  return s;
}

// cout 2-dimentional deque
template<typename T> ostream& operator<<(ostream& s, const deque< deque<T> >& vv) {
  int len = vv.size();
  for (int i = 0; i < len; ++i) { s << vv[i]; }
  return s;
}

int n, k;
vector<vector<int> > child;
int ans;
vi a;

int solve(int x) {
  int len = child[x].size();
  if (len == 0) {
    return 0;
  }
  int ret = -5;
  rep (i, len) {
    int s = solve(child[x][i]);
    ret = max(ret, s);
  }
  ret += 1;
  if (x != 0 && ret == k-1 && a[x] != 0) {
    ans += 1;
    ret = -1;
  }
  return ret;
}

int main() {
  scanf("%d %d", &n, &k);
  a.resize(n);
  rep (i, n) {
    scanf("%d", &a[i]);
    a[i] -= 1;
  }
  ans = 0;

  if (k == 1) {
    rep (i, n) {
      if (a[i] != 0) {
        ans += 1;
      }
    }
    printf("%d\n", ans);
    return 0;
  }

  if (a[0] != 0) {
    ans += 1;
    a[0] = 0;
  }
  child.resize(n);
  FOR (i, 1, n) {
    child[a[i]].pb(i);
  }

  solve(0);
  printf("%d\n", ans);

  return 0;
}


Measured memory_bytes: 12416
H,W=map(int,input().split())
S=[input() for _ in range(H)]
visited_place=[[-1]*W for _ in range(H)]
visited_place[0][0]=1
stack=[[0,0]]
kazu=0
for a in S:
    kazu+=a.count('.')
def bfs(S,visited_place,stack):
    while len(stack)>0:
        h,w=stack.pop()
        for x,y,in ([1,0],[-1,0],[0,1],[0,-1]):
            new_h=h+x
            new_w=w+y
            if new_w<0 or new_w>=W or new_h<0 or new_h>=H:
                continue
            if S[new_h][new_w]=='.' and visited_place[new_h][new_w]==-1:
                visited_place[new_h][new_w]=visited_place[h][w]+1
                stack.insert(0,[new_h,new_w])
    return visited_place[H-1][W-1]
if bfs(S,visited_place,stack)==-1:
    print(-1)
else:
    answer=kazu-bfs(S,visited_place,stack)
    print(answer)


Measured memory_bytes: 3064
#include <stdio.h>
int main(void){

int n,a,i,min=1000000,max=-1000000;
    
    
    long long sum=0;

    
        scanf("%d\n",&n);
        
            for(i=1;i<=n;i++){
        
                scanf("%d ",&a);
        
            if(0<n&&n<=10000){
                
                if(a < min){
                    min = a;
                }
                
                if(max < a){
                    max = a;
                }
                        sum+=a;
                }
            }
                printf("%d %d %lld\n",min,max,sum);
                return 0; 
}



Measured memory_bytes: 2140
#include "bits/stdc++.h"
using namespace std;
int main() {
	long long N;
	cin >> N;
	long long sum = 0;
	long long tmp = N;
	while (tmp != 0) {
		sum += tmp % 10;
		tmp /= 10;
	}
	if (N % sum == 0) {
		cout << "Yes" << endl;
	}
	else {
		cout << "No" << endl;
	}
}

Measured memory_bytes: 256
/*|In The Name Of Allah|*/

#include <bits/stdc++.h>

using namespace std;

const int N = 1e5+5;

const int mod = 1e9+7;

int n;
int m;
long long cm[N];
long long rm[N];
map < long long , long long > cnt;

int main(){
    scanf("%d%d" , &n , &m);
    for(int i = 1; i <= n; i++){
        int x;
        scanf("%d" , &x);
        cm[i] = cm[i - 1] + x;
    }
    for(int i = 0; i <= n; i++){
        rm[i] = cm[i] % m;
        cnt[rm[i]]++;
    }
    long long ans = 0;
    for(auto v : cnt){
        ans += v.second * (v.second - 1) / 2;
    }
    printf("%lld\n" , ans);
}

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

//create arrays outside of main()

int a[5];

int main(){

    int H, W, h, w;
    cin >> H >> W;
    cin >> h >> w;

    int whiteCells = H*W;

    int whiteLeft = whiteCells-h*W-H*w+h*w;

    cout << whiteLeft;

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <cstdio>
#include <cstdlib>
#include <string>
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
#include <bitset>
#include <cmath>
#include <limits>
#include <iostream>
#include <map>
#include <set>
#include <tuple>
#include <iomanip>
#include <functional>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int,ll> pil;
typedef pair<ll,int> pli;
typedef pair<ll,ll> pll;

template<class T,class U>constexpr bool chmin(T&a,const U b){if(a<=b)return false;a=b;return true;}
template<class T,class U>constexpr bool chmax(T&a,const U b){if(a>=b)return false;a=b;return true;}
#define bit(n,k) ( (n>>k)&1 )

//デバッグ
template<class T>
void Vout(vector<T> &V){
    cout<<"\nstart\n";
    const int sz=V.size();
    for(int i=0;i<sz;i++){
        cout<<i<<" "<<V[i]<<'\n';
    }
    cout<<"end\n"<<endl;
}

template<class T>
void VPout(vector<T> &V){
    cout<<"\nstart\n";
    const int sz=V.size();
    for(int i=0;i<sz;i++){
        cout<<i<<" "<<V[i].first<<" "<<V[i].second<<'\n';
    }
    cout<<"end\n"<<endl;
}


//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++


constexpr int MAX=1<<30;
constexpr ll INF=1LL<<62;
constexpr int MOD=1e9+7;
int dx[]={1,-1,0,0},dy[]={0,0,-1,1};

//__builtin_popcount(S);
//#define int ll
//vector<vector<int>> data(3, vector<int>(4));
//vector.resize(a,vector<int>(b,-1));
//vector<vector<vector<要素の型>>> 変数名(要素数1, vector<vector<要素の型>>(要素数2, vector<要素の型>(要素数3, 初期値)));




signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr); 
    cout<<fixed<<setprecision(10);
    
    ll n;int K;
    cin>>n>>K;
    ll cnt[12]={};
    ll sum=0;
    for(int i=1;i<=11;i++){
        for(int k=1;k<=5;k++){
            ll t=0;
            for(int j=0;j<3;j++){
                for(int l=0;l<3;l++){
                    t+=(7*(i+j)+(k+l)-7);
                }
            }
            if(t%11==K) cnt[i]++;
        }
        sum+=cnt[i];
    }
    ll ret=sum*((n-2)/11);
    for(int i=1;i<=(n-2)%11;i++){
        ret+=cnt[i];
    }
    cout<<ret<<endl;
}

Measured memory_bytes: 256
N,M = map(int,input().split())
H = list(map(int,input().split()))
 
rlist = {n:[] for n in range(1,N+1)}
cnt = 0
for m in range(1,M+1):
  A,B = map(int,input().split())
  rlist[A].append(B)
  rlist[B].append(A)
  
for k,v in rlist.items():
  if len(v) == 0:
    cnt += 1
  else:
    for i in v:
      if H[k-1] <= H[i-1]:
        break
    else:
      cnt += 1
      
print(cnt)

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

int D[200000];
int T[200000];
int N,M;
int main(){
  cin >> N;
  for (int i=0;i<N;i++){
    cin >> D[i];
  }
  cin >> M;
  for (int i=0;i<M;i++){
    cin >> T[i];
  }
  sort(D,D+N);
  sort(T,T+M);
  
  //Setting is done, now the curtain lifts
  if (N<M){//Special case
    cout << "NO";
    return 0;
  }
  int j=0;
  for (int i=0;i<N;i++){
    if (D[i] == T[j]){
      j += 1;
      if (j == M){
      	cout << "YES"; //reached target
      	break;
      }
    
    }
    else if(D[i] > T[j]){
      cout << "NO";
      break;
    }
  }
  return 0;
}

Measured memory_bytes: 1792
#include<iostream>
#include<stdlib.h>
#include<vector>
#include<math.h>
#include<algorithm>
#include<string>
using namespace std;

int main(){

	// #ifndef ONLINE_JUDGE
	// freopen("input.txt","r",stdin);
	// freopen("output.txt","w",stdout);
	// #endif
	int a,b;
	cin>>a>>b;

	if(a>=13)
		cout<<b;
	else
		if(a>=6 && a<=12)
			cout<<b/2;
		else
			cout<<0;
	return 0;

}

Measured memory_bytes: 256
#include <bits/stdc++.h>
typedef long long ll;

using namespace std;

void dfs(int s, int cnt, int& res, vector<bool>& visited, vector<vector<bool>>& d) {
	if (cnt == visited.size()) { ++res; }

	for (int i = 0; i < d.size(); ++i) {
		if (!d[s][i] || visited[i]) { continue; }

		visited[i] = true;
		dfs(i, cnt + 1, res, visited, d);
		visited[i] = false;
	}
}

int main() {
	int N, M;
	cin >> N >> M;
	vector<vector<bool>> d(N, vector<bool>(N, false));
	for (int i = 0; i < M; ++i) {
		int a, b;
		cin >> a >> b;
		d[a - 1][b - 1] = true;
		d[b - 1][a - 1] = true;
	}

	int res = 0;
	vector<bool> visited(N, false);
	visited[0] = true;
	for (int i = 0; i < N; ++i) {
		if (d[0][i]) {
			visited[i] = true;
			dfs(i, 2, res, visited, d);
			visited[i] = false;
		}
	}

	cout << res << endl;

	return 0;
}


Measured memory_bytes: 256
#include <stdio.h>
#include <cmath>
#include <algorithm>
#include <cfloat>
#include <stack>
#include <queue>
#include <vector>
#include <string>
#include <iostream>
#include <set>
#include <map>
#include <time.h>
using namespace std;
typedef long long int ll;
typedef unsigned long long int ull;
typedef pair<int,int> P;
typedef pair<ll,pair<ll,ll> > p;
#define BIG_NUM 2000000000
#define MOD 998244353
#define EPS 0.000000001
#define bit(n,k) ((n>>k)&1) /*nのk bit目*/
const int MAX = 510000;

ll fac[MAX],finv[MAX],inv[MAX];
//http://drken1215.hatenablog.com/entry/2018/06/08/210000
//テーブルを作る前処理　O(n)
//pが素数でなくてはならない
void COMinit(){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for(int i=2;i<MAX;i++){
        fac[i]=fac[i-1]*i%MOD;
        inv[i]=MOD-inv[MOD%i]*(MOD/i)%MOD;
        finv[i]=finv[i-1]*inv[i]%MOD;
    }
}
//二項係数計算
ll COM(int n,int k){
    if(n<k) return 0;
    if(n<0 || k<0) return 0;
    return fac[n]*(finv[k]*finv[n-k]%MOD)%MOD;
}

int main(){
    COMinit();
   ll N,A,B;
   ll K,sum=0;
   cin>>N>>A>>B>>K;
   for(ll i=0;i<=N;i++){
       if((K-i*A)%B==0 && (K-i*A)/B<=N){
           int numB=(K-i*A)/B;
           sum+=COM(N,i)*COM(N,numB);
           sum%=MOD;
       }
   }
   cout<<sum<<endl;
}



Measured memory_bytes: 12160
#include <iostream>
#include <cstring>
#include <string>    
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
ll n, a, b, c, q, k, x, y, ans[100008];
vector<vector<P>> e;

void dfs(ll from, ll at, ll dst){

	ans[at] = ans[from] + dst;
	
	for(ll i = 0; i < e[at].size(); i++){
		ll next = e[at][i].first;
		if(next != from){
			dfs(at, next, e[at][i].second);
		}
	}
}

int main(){
	cin >> n;
	e.resize(n+1);
	
	for(ll i = 1; i <= n-1; i++){
		cin >> a >> b >> c;
		e[a].push_back(P(b, c));
		e[b].push_back(P(a, c));
	}
	
	cin >> q >> k;

	ans[0] = 0;
	dfs(0, k, 0);
	
	for(ll j = 1; j <= q; j++){
		cin >> x >> y;
		cout << ans[x] + ans[y] << endl;
	}
	
	return 0;
}

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

static const int N = 100;

int main() {
  int n, p[N + 1], m[N + 1][N + 1];
  cin >> n;
  for ( int i = 1; i <= n; i++ ) {
    cin >> p[i - 1] >> p[i];
  }

  for ( int i = 1; i <= n; i++ ) m[i][i] = 0;
  for ( int l = 2; l <= n; l++ ) {
    for ( int i = 1; i <= n - l + 1; i++ ) {
      int j = i + l - 1;
      m[i][j] = (1 << 21);
      for ( int k = i; k <= j - 1; k++ ) {
        m[i][j] = min(m[i][j], m[i][k] + m[k + 1][j] + p[i - 1] * p[k] * p[j]);
      }
    }
  }

  cout << m[1][n] << endl;

  return 0;
}

Measured memory_bytes: 3096
#pragma GCC optimize("Ofast")
#include"bits/stdc++.h"
using namespace std;

int main() {
	char c;
	cin >> c;
	if (c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u') {
		cout << "vowel" << endl;
	}
	else {
		cout << "consonant" << endl; 
	}
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <stdio.h>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cassert>
#include <exception>
#include <numeric>
using namespace std;
typedef long long ll;
typedef string str;
typedef pair<ll, ll> Pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<char> vc;
typedef vector<str> vs;
typedef vector<Pll> vp;
typedef vector<bool> vb;
#define rep(i, a, n) for (ll i = (a); i < (n); ++i)
#define rrep(i, a, n) for (ll i = (a); i > (n); --i)
#define erep(i, a, n) for (ll i = (a); i <= (n); ++i)
#define rerep(i, a, n) for (ll i = (a); i >= (n); --i)
#define all(c) (c).begin(), (c).end()
#define pb push_back
#define mp make_pair
#define sz(x) ((int)x.size())
#define SORT(x) sort(all(x))
#define RSORT(x) sort(all(x),greater<ll>())
#define vec_max(V) *max_element(all(V))
#define vec_min(V) *min_element(all(V))
#define vec_sum(V) accumulate(all(V), 0LL)
#define print(X) cout << (X) << "\n"
#define _ << " " <<
#define Yes print("Yes")
#define No print("No")
static const int INF = 1e+9+7;

int main(){
	int N;
	cin >> N;
    
	int ans = 0;
	
	erep(i,1,N){
		if(to_string(i).length() % 2 == 1){
          ans++;
        }
	}
	
	print(ans);
	
 return 0;
}


Measured memory_bytes: 256
# coding: utf-8
_ = input()
n = list(map(int, input().split()))

op_cnt = len(n) - 1  # すき間の個数

out = 1000000
for t in range(len(n)-1):
    s1 = sum(n[:t+1])
    s2 = sum(n[t+1:])
    
    out = min(abs(s1-s2), out)
    #print(t, out,s1, s2)

print(out)

Measured memory_bytes: 3060
//#include "stdafx.h"
#include<bits/stdc++.h> 
#include<iostream>
#include<queue>
#include<string>
#include<algorithm>
using namespace std;
string a,b;
int main()
{
	cin>>a>>b;
	reverse(a.begin(),a.end());
	if(a==b)
		cout<<"YES\n";
	else
		cout<<"NO\n";

	return 0;
}



Measured memory_bytes: 3568