akhauriyash/Code-Regression huggingface dataset:
# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub

sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2**62-1

def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input().strip()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


class UnionFind():
    def __init__(self):
        self.__table = {}
        self.__size = defaultdict(lambda: 1)
        self.__rank = defaultdict(lambda: 1)

    def __root(self, x):
        if x not in self.__table:
            self.__table[x] = x
        elif x != self.__table[x]:
            self.__table[x] = self.__root(self.__table[x])
        return self.__table[x]

    def root(self, x):
        return self.__table[x]

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

    def union(self, x, y):
        x = self.__root(x)
        y = self.__root(y)
        if x == y:
            return

        if self.__rank[x] < self.__rank[y]:
            self.__table[x] = y
            self.__size[y] += self.__size[x]
        else:
            self.__table[y] = x
            self.__size[x] += self.__size[y]
            if self.__rank[x] == self.__rank[y]:
                self.__rank[x] += 1

    def size(self, x):
        return self.__size[self.__root(x)]

    def num_of_group(self):
        g = 0
        for k, v in self.__table.items():
            if k == v:
                g += 1
        return g

@mt
def slv(N, M, K, AB, CD):
    f = UnionFind()
    for a, b in AB:
        f.union(a, b)

    direct = defaultdict(int)
    for a, b in AB:
        direct[a] += 1
        direct[b] += 1
    block = defaultdict(set)
    for c, d in CD:
        block[c].add(d)
        block[d].add(c)


    ans = []
    for i in range(1, N+1):
        cand = f.size(i)
        for u in block[i]:
            if f.same(i, u):
                cand -= 1
        cand -= direct[i]
        cand -= 1
        ans.append(cand)
    return ans



def main():
    N, M, K = read_int_n()
    AB = [read_int_n() for _ in range(M)]
    CD = [read_int_n() for _ in range(K)]
    print(*slv(N, M, K, AB, CD))

if __name__ == '__main__':
    main()


Measured memory_bytes: 150760
n = int(input())
ans = 0
a = 0
b = 0
ryou = 0
for _ in range(n):
    tmp = input()
    ans += tmp.count('AB')
    if tmp[0] == 'B':
        if tmp[-1] == 'A':
            ryou += 1
        else:
            b += 1
    elif tmp[-1] == 'A':
        a += 1

if ryou > 1:
    ans += (ryou-1)
    ryou = 1
if ryou == 1:
    if a >= 1:
        ans += 1
        a -= 1
    if b>=1:
        ans += 1
        b-=1
#print(ans)
ans += min(a,b)
#print(min(a,b))
print(ans)

Measured memory_bytes: 44528
#include <stdio.h>
 
int main(void){
	
	int a,b,c,d;
	
	scanf("%d %d %d %d",&a,&b,&c,&d);
	
	if(a + b > c + d){
	printf("Left\n");
	} else if(a + b < c + d){
	printf("Right\n");
	} else {
	printf("Balanced\n");
	}
	return 0;
}

Measured memory_bytes: 128
#include<iostream>
using namespace std;
int R,G,B,N,ans;
int main(){
  ans=0;
  cin >> R >> G >> B >> N;
  for (int i=0;i<=N/R;i++){
    for (int j=0;j<=N/G;j++){
      if ((i*R+j*G)<=N && (N-(i*R+j*G))%B==0) ans++;
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 888
#include<bits/stdc++.h>
#define rep(i,a,b) for(register int i=a;i<=b;++i)
#define rpd(i,a,b) for(register int i=a;i>=b;--i)
#define rep1(i,x) for(register int i=head[x];i;i=nxt[i])
typedef long long ll;
const int N=200+5;
using namespace std;
inline int read(){
    int x=0,f=1;char ch=getchar();
    while(!isdigit(ch)){if(ch=='-')f=-1;ch=getchar();}
    while(isdigit(ch)){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}
int n,ans;int a[N];
int main(){
	n=read()*2;rep(i,1,n)a[i]=read();
	sort(a+1,a+n+1);
	for(int i=1;i<=n;i+=2)ans+=a[i];
	printf("%d\n",ans);
	return 0;
}

Measured memory_bytes: 256
n=int(input())
mod=10**9+7

def sieve(n):
    prime=[]
    limit=n**0.5
    data=[i+1 for i in range(1,n)]
    while True:
        p=data[0]
        if limit<=p:
            return prime+data
        prime.append(p)
        data=[e for e in data if e%p!=0]
        
ans=1
prime=sieve(n+1)
for p in prime:
    cnt=0
    j=1
    while p**j<=n:
        cnt+=n//(p**j)
        cnt%=mod
        j+=1
    ans*=(cnt+1)
    ans%=mod
print(ans)



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

using namespace std;

int main() {

    int N; cin >> N;

    N = N - 100*(N/100);
    N = N - 10*(N/10);

    if(N == 2 || N==4 || N==5 || N==7 || N==9) {
        cout << "hon" << endl;
    }else if(N == 0||N==1||N==6||N==8) {
        cout << "pon" << endl;
    }else if(N==3){
        cout << "bon" << endl;
    }

    return 0;
}

Measured memory_bytes: 3632
macro_rules !input {(source =$s :expr ,$($r :tt ) *) =>{let mut iter =$s .split_whitespace () ;let mut next =||{iter .next () .unwrap () } ;input_inner !{next ,$($r ) *} } ;($($r :tt ) *) =>{let stdin =std ::io ::stdin () ;let mut bytes =std ::io ::Read ::bytes (std ::io ::BufReader ::new (stdin .lock () ) ) ;let mut next =move ||->String {bytes .by_ref () .map (|r |r .unwrap () as char ) .skip_while (|c |c .is_whitespace () ) .take_while (|c |!c .is_whitespace () ) .collect () } ;input_inner !{next ,$($r ) *} } ;}
macro_rules !input_inner {($next :expr ) =>{} ;($next :expr ,) =>{} ;($next :expr ,$var :ident :$t :tt $($r :tt ) *) =>{let $var =read_value !($next ,$t ) ;input_inner !{$next $($r ) *} } ;}
macro_rules !read_value {($next :expr ,($($t :tt ) ,*) ) =>{($(read_value !($next ,$t ) ) ,*) } ;($next :expr ,[$t :tt ;$len :expr ] ) =>{(0 ..$len ) .map (|_ |read_value !($next ,$t ) ) .collect ::<Vec <_ >>() } ;($next :expr ,chars ) =>{read_value !($next ,String ) .chars () .collect ::<Vec <char >>() } ;($next :expr ,usize1 ) =>{read_value !($next ,usize ) -1 } ;($next :expr ,$t :ty ) =>{$next () .parse ::<$t >() .expect ("Parse error" ) } ;}

fn main() {
   input! {
      n: usize,
      yy: usize,
   }
   for x in 0..n + 1 {
      for y in 0..n - x + 1 {
         let z = n - x - y;
         if 10000 * x + 5000 * y + 1000 * z == yy {
            println!("{} {} {}", x, y, z);
            return;
         }
      }
   }
   println!("-1 -1 -1");
}


Measured memory_bytes: 4352
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		String a = sc.next();
		String b = sc.next();
		int joined = Integer.parseInt(a + b);
		if (Math.floor(Math.sqrt(joined)) - Math.sqrt(joined) == 0) {
			System.out.println("Yes");
		} else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 39416
#include<stdio.h>

int main(void){
  int a,b;
  scanf("%d%d",&a,&b);
  a+=11;
  a%=13;
  b+=11;
  b%=13;
  if(a==b) puts("Draw");
  else puts(a<b?"Bob":"Alice");
  return 0;
}


Measured memory_bytes: 128
n = int(input())
A = list(map(int, input().split()))
bits = [0] * 60
MOD = 10**9 + 7

for a in A:
    div = a
    i = 0
    while True:
        div, mod = div // 2, div % 2
        bits[i] += mod
        i += 1
        if div == 0:
            break

ans = 0
for i in range(60):
    ans += bits[i] * (n-bits[i]) * 2 ** i % MOD
print(ans % MOD)


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

const long long MOD = 1000000007;
const long long INF = 1LL << 60;

int gcd(int a, int b)
{
  if (b == 0)
    return a;
  return gcd(b, a % b);
}

int main()
{
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  int K;
  cin >> K;
  ll ans = 0;

  for (int i = 1; i <= K; i++)
  {
    for (int j = 1; j <= K; j++)
    {
      for (int k = 1; k <= K; k++)
      {
        ans += gcd(i, gcd(j, k));
      }
    }
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 3640
package main

import "fmt"

func main() {
	// Code for A - November 30
	var M1, D1, M2, D2 int
	fmt.Scanf("%d %d", &M1, &D1)
	fmt.Scanf("%d %d", &M2, &D2)

	if M1 != M2 {
		fmt.Println("1")
	} else {
		fmt.Println("0")
	}

}


Measured memory_bytes: 1832
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string;

auto rdsp(){return readln.splitter;}
void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;}
void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);}
void readA(T)(size_t n,ref T[]t){t=new T[](n);auto r=rdsp;foreach(ref v;t)pick(r,v);}

void main()
{
  int n, m; readV(n, m);
  auto s = new int[][](m);
  foreach (i; 0..m) {
    auto rd = rdsp;
    int k; pick(rd, k);
    s[i] = new int[](k);
    foreach (j; 0..k) pick(rd, s[i][j]);
    --s[i][];
  }
  int[] p; readA(m, p);

  auto r = 0;
 loop: foreach (i; 0..(1<<n)) {
    foreach (j; 0..m) {
      auto c = s[j].count!(k => ((i>>k)&1) == 1);
      if (c%2 != p[j]) continue loop;
    }
    ++r;
  }

  writeln(r);
}


Measured memory_bytes: 256
from collections import deque
H,W = map(int,input().split())
Gd = [list(input()) for _ in range(H)]
INF = -1
direc = [[1,0],[-1,0],[0,1],[0,-1]]
def dfs(start):
  Dis = [[INF]*W for _ in range(H)]
  Dis[start[0]][start[1]]=0
  q = deque([])# スタック
  q.append(start)
  r = 0
  while len(q)!=0:
    h,w = q.popleft()# スタック取りだし（先頭）
    
    for d in direc:
      hs, ws = h + d[0], w + d[1]
      if not (0<=hs<H and 0<=ws<W):
        continue
      if Gd[hs][ws]=='.' and Dis[hs][ws]==INF:
          q.append([hs,ws])
          Dis[hs][ws] = Dis[h][w] + 1
          r = max(Dis[hs][ws],r)
  return r
ans = INF
for h in range(H):
  for w in range(W):
    if Gd[h][w]=='.':
      ans = max(ans,dfs([h,w]))
print(ans)


Measured memory_bytes: 3316
#include <algorithm>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <deque>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))

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

#define rep(i, e) for(int i = 0; i < e; i++)
#define repp(i, s, e) for(int i = s; i < e; i++)
#define MAX_N 100
#define Card_Max 36
#define p(a) printf("%d\n", a);
#define ll long long
#define ull unsigned long long
#define MAX 1e9
#define NIL -1

void print(vector<int> v) {
    rep(i, v.size()) {
        if(i)
            cout << " ";
        cout << v[i];
    }
    cout << endl;
}

int main() {
    string S;
    int cnt0 = 0, cnt1 = 0, minv = INF;
    cin >> S;
    rep(i, S.size()) {
        if(S[i] == '0') {
            cnt0++;
        } else {
            cnt1++;
        }
    }
    minv = min(cnt0, cnt1);
    cout << 2 * minv << endl;
}


Measured memory_bytes: 512
#include <inttypes.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(void)
{
    intmax_t H, A;
    intmax_t ans = 0;

    scanf("%jd%jd", &H, &A);

    ans = H / A + ((H % A) ? 1 : 0);

    printf("%jd\n", ans);

    return 0;
}


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

using namespace std;
typedef long long int ll;
typedef pair<int, int> ii;
#define DEBUG freopen("in.txt", "r", stdin);

struct fastio {
    fastio() {
        ios::sync_with_stdio(false);
        cout << setprecision(10) << fixed;
        cin.tie(0);
    }
};

fastio _fast_io;

const int N = 100 + 5;
int n;
int t[N], l[N], m[N], r[N];
double ans;
int cur;

double f(int i) {
    double lm = l[i];
    double rm = r[i];
    double ll = min(l[i], r[i]), rr = m[i];
    double t1, t2;
    while (ll + 1e-8 < rr) {
        double mm = (ll + rr) / 2;
        t1 = abs(mm - lm);
        t2 = abs(mm - rm);
        if (t1 + t2 <= t[i]) {
            ll = mm;
        } else {
            rr = mm - 1e-8;
        }
    }
    // cout << lm << ' ' << m[i] << ' ' << rm << " # " << ll << endl;
    t1 = abs(ll - lm);
    t2 = abs(ll - rm);
    return (t[i] - t1 - t2) * ll + (ll + l[i]) / 2 * t1 + (ll + r[i]) / 2 * t2;
}

int main() {
    cin >> n;
    for (int i = 0; i < n; ++i) {
        cin >> t[i];
    }
    for (int i = 0; i < n; ++i) {
        cin >> m[i];
        l[i] = r[i] = m[i];
    }
    r[n - 1] = 0;
    for (int i = n - 1; i >= 0; --i) {
        if (i < n - 1) {
            r[i] = min(r[i], l[i + 1]);
        }
        l[i] = min(l[i], r[i] + t[i]);
    }
    l[0] = 0;
    for (int i = 0; i < n; ++i) {
        if (i > 0)
            l[i] = min(l[i], r[i - 1]);
        r[i] = min(r[i], l[i] + t[i]);
    }
    for (int i = 0; i < n; ++i) {
        ans += f(i);
    }
    cout << ans << endl;
    return 0;
}


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

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<vector<pii> > vvpii;

#define pb push_back
#define endl '\n'
#define INF (int)1e9
#define EPS 1e-9
#define gcd __gcd
#define rs resize
#define FOR(i,a,b) for(int i = a; i < b; i++)
#define by(T, x) [](const T& a, const T& b) { return a.x < b.x; } //for struct sorting

void printV(vector<int> v){
	for(int i = 0; i < v.size(); i++){
		cout << v[i] << " " ;
	}
	cout << endl;
}

void print2V(vvi v){
	FOR(i, 0, v.size()){
		FOR(j, 0, v[i].size()){
			cout << v[i][j] << " ";
		}
		cout << endl;
	}
}

int n, dp[200000][3], arr[200000][3];

int fun(int cur, int prev){
	if(cur > n){
		return 0;
	}
	if(dp[cur][prev] != -1){
		return dp[cur][prev];
	}
	for(int i = 0; i < 3; i++){
		if(i == prev){
			continue;
		}
		dp[cur][prev] = max(dp[cur][prev], fun(cur+1, i)+arr[cur][i]);
	}
	return dp[cur][prev];
}

int main(){
	cin >> n;
	for(int i = 1; i <= n+10; i++){
		for(int j = 0; j < 3; j++){
			dp[i][j] = -1;
		}
	}
	
	for(int i = 1; i <= n; i++){
		cin >> arr[i][0] >> arr[i][1] >> arr[i][2];
	}
	cout << max({fun(1, 0), fun(1, 1), fun(1, 2)});
}

Measured memory_bytes: 11264
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cctype>
#include <cmath>
#include <cassert>
#include <cstdarg>
#include <sys/time.h>
#include <fstream>
//#include "cout.h"

using namespace std;

#define SZ(x) ((int)x.size())
#define MSET(x,a) memset(x, a, (int)sizeof(x))
#define PB push_back
#define VI vector < int >
#define PII pair < int, int >
#define LL long long
#define FOR(i,a,b) for (int i = (a); i < (b); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(), (v).end()
#define FIT(it,v) for (__typeof((v).begin()) it = (v).begin(); it != (v).end(); it++)
#define OUT(A) cout << #A << " = "<< (A) << endl
#define OUT2(A, B) cout << "(" << #A << ", " << #B << ") = (" << (A) << ", "<< (B) << ")" << endl
template<class T> void chmin(T &t, T f) { if (t > f) t = f; }
template<class T> void chmax(T &t, T f) { if (t < f) t = f; }

#define present(c, e) ((c).find((e)) != (c).end())
#define cpresent(c, e) (find(ALL(c), (e)) != (c).end())



void init() {

}

void input() {

}

void solve() {
  LL k, a, b;
  cin >> k >> a >> b;
  k++;
  if (a+2 < b) {
    if (k < a+2) {
      cout << k << endl;
      return;
    }
    k -= a;
    LL res = a+(k&1);
    res += k/2*(b-a);
    cout << res << endl;
  } else {
    cout << k << endl;
  }
}

int main() {
	init();
	input();
	solve();
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <utility>
#include <stack>
#include <queue>

using namespace std;

typedef pair<int, int> Pii;
typedef long long int ll;

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

  int n;
  cin >> n;
  vector<vector<pair<int, ll> > > edge(n);
  for (int i = 0; i < n-1; i++) {
    int a, b, c;
    cin >> a >> b >> c;
    edge[a-1].emplace_back(b-1, c);
    edge[b-1].emplace_back(a-1, c);
  }
  int q, k;
  cin >> q >> k;
  k--;
  vector<int> x(q), y(q);
  for (int i = 0; i < q; i++) {
    cin >> x[i] >> y[i];
    x[i]--;
    y[i]--;
  }

  vector<ll> distanceToK(n);
  vector<bool> visited(n);
  queue<pair<int, ll> > que;
  que.emplace(k, 0);
  while (!que.empty()) {
    auto now = que.front();
    que.pop();
    if (visited[now.first]) continue;
    visited[now.first] = true;
    distanceToK[now.first] = now.second;
    for (auto &z: edge[now.first]) {
      if (!visited[z.first]) que.emplace(z.first, now.second + z.second);
    }
  }

  vector<ll> ans(q);
  for (int i = 0; i < q; i++) ans[i] = distanceToK[x[i]] + distanceToK[y[i]];

  for (auto &z: ans) cout << z << endl;

  return 0;
}


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

using namespace std;
#define rep(i, n) for (ll i = 0; i < (n); ++i)
#define sz(x) ll(x.size())
typedef long long ll;
typedef pair<int, int> P;
//typedef pair<ll, ll> P;
const ll INF = 1001001001;

const int mod = 1000000007;

const int V = 100005;

vector<int> to[V * 2];
bool visited[V * 2];
vector<int> cnt;

void dfs(int v) {
    if (visited[v]) return;
    visited[v] = true;
    cnt[v / V]++;

    for (int u : to[v]) {
        dfs(u);
    }
}

int main() {
    int n;
    cin >> n;
    rep(i, n) {
        int x, y;
        cin >> x >> y;
        y += V;
        to[x].push_back(y);
        to[y].push_back(x);
    }
    ll ans = 0;
    rep(i, V * 2) {
        if (visited[i])continue;
        cnt = vector<int>(2);
        dfs(i);
        ans += (ll) cnt[0] * cnt[1];
    }
    ans -= n;
    cout << ans << endl;

}

Measured memory_bytes: 10240
#include <iostream>
#include <string>
#include <vector>
#include <cmath>

using namespace std;

const long long M = 1e9 + 7;

int main()
{
    int N;

    cin >> N;

    int p = N % 2;

    vector<int> cnt((N+1)/2, 0);

    bool f = true;

    if(p == 1)
    {
        int A;
        for (int i = 0; i < N;i++)
        {
            cin >> A;
            if(A % 2 == 1)
            {
                f = false;
                break;
            }
            cnt[A / 2]++;
        }
        if(cnt[0] != 1)
        {
            f = false;
        }
        int n = (N+1) / 2;
        for (int i = 1; i < n;i++)
        {
            if(cnt[i] != 2)
            {
                f = false;
                break;
            }
        }
    }
    else
    {
        int A;
        for (int i = 0; i < N; i++)
        {
            cin >> A;
            if (A % 2 == 0)
            {
                f = false;
                break;
            }
            cnt[A / 2]++;
        }
        int n = N / 2;
        for (int i = 0; i < n;i++)
        {
            if(cnt[i] != 2)
            {
                f = false;
                break;
            }
        }
    }

    long long pp = 1;
    int n = N / 2;
    for (int i = 0; i < n;i++)
    {
        pp *= 2;
        pp = pp % M;
    }
    long long ans = f == false ? 0LL : pp;
    cout << ans << endl;

    return 0;
}

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

using namespace std;

#define ll long long
#define sf scanf
#define pf printf 
#define nl printf("\n")
#define pi acos(-1)

int main()
{
    #ifndef ONLINE_JUDGE
        //freopen("in.txt","r",stdin);
        //freopen("out.txt","w",stdout);
    #endif

    ll n,m,x,sum=0;
    sf("%lld %lld",&n,&m);
    for(int i=0; i<m; i++){
        sf("%lld",&x);
        sum += x;
    }
    if(sum>n) pf("-1\n");
    else  pf("%lld\n",n-sum);
    return 0;
}

Measured memory_bytes: 3760
import java.io.*;
import java.util.*;

public class Main {


    public static InputReader in = new InputReader( System.in );
    public static PrintWriter out = new PrintWriter( System.out );
    public static void main( String[] atgs ) {

        new Main().solve();
        out.close();
        System.exit(0);
    }


    private void solve() {
        int a = in.nextInt();
        HashSet<String> set = new HashSet<>();
        while(a-->0)
        {
            String str = in.next();
            set.add(str);
        }
        System.out.print(set.size());
    }

    //Solution ends
    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader( InputStream stream ) {
            reader = new BufferedReader( new InputStreamReader( stream ), 32768 );
            tokenizer = null;
        }

        public String next() {
            while ( tokenizer == null || !tokenizer.hasMoreTokens( ) ) {
                try {
                    tokenizer = new StringTokenizer( reader.readLine( ) );
                } catch ( IOException e ) {
                    throw new RuntimeException( e );
                }
            }
            return tokenizer.nextToken( );
        }

        public int nextInt() {
            return Integer.parseInt( next( ) );
        }

        public long nextLong() {
            return Long.parseLong( next( ) );
        }

        public double nextDouble() {
            return Double.parseDouble( next( ) );
        }

        public String nextLine() throws IOException {
            return reader.readLine( );
        }
    }


}

Measured memory_bytes: 72088
#include <bits/stdc++.h>
using namespace std;
int main(){
  int N;
  cin >> N;
  vector<int> P(N);
  for (int i = 0; i < N; i++){
    cin >> P[i];
    P[i]--;
  }
  vector<int> Q(N);
  for (int i = 0; i < N; i++){
    Q[P[i]] = i;
  }
  int ans = 1;
  int curr = 1;
  for (int i = 1; i < N; i++){
    if (Q[i] > Q[i - 1]){
      curr++;
      ans = max(ans, curr);
    } else {
      curr = 1;
    }
  }
  cout << N - ans << endl;
}

Measured memory_bytes: 4812
#include <bits/stdc++.h>
        using namespace std;
        #define int long long int
        #define pb push_back
        #define mk make_pair
        #define ft first
        #define sc second
        #define ppb pop_back
        #define sz size
        #define forn(i,a,n) for(i=a;i<n;i++)
        #define M 998244353 
        #define inf 2e18

        bool compare(pair<int,int> a,pair<int,int> b){
            if(a.first==b.first)
                return a.second<b.second;
            return a.first<b.first;
        }

        signed main() {
 

        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        cout.tie(NULL);
        
        int n;
        cin>>n;
        set<string> s;
        string a;
        while(n--){
            cin>>a;
            s.insert(a);
        }
        cout<<s.size();

        return 0;
    }

Measured memory_bytes: 19196
#include <bits/stdc++.h>
using namespace std;
 
int main(){
	int N;
	int R_num = 0;
	int	B_num = 0;
	char s;
	cin >> N;
	for(int i = 0; i < N; i++){
		cin >> s;
		if(s == 'R'){
			R_num++;
		}else{
			B_num++;
		}
	}
	if(R_num > B_num){
		cout << "Yes" << endl;
	}else{
		cout << "No" << endl;
	}
}

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

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

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

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

/* do your best */

int main() {
  
  lint n, k; cin >> n >> k;
  lint ans = 0;
  while(n) {
    ans++;
    n /= k;
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
import math
mod = 10**9+7
n, m = map(int, input().split())
ans = 0
if n == m:
	ans = math.factorial(n)*math.factorial(m)*2
elif abs(n-m) >= 2:
	ans = 0
else:
	b = max(n,m)
	ans = math.factorial(b)*math.factorial(b-1)
print (ans%mod)

Measured memory_bytes: 5180
package main

import (
	"bufio"
	"fmt"
	"os"
	"sort"
	"strconv"
)

func main() {
	var N, X int
	fmt.Scan(&N, &X)
	arr := make([]int, N)
	sc := bufio.NewScanner(os.Stdin)
	sc.Split(bufio.ScanWords)
	w := X
	for i := range arr {
		sc.Scan()
		arr[i], _ = strconv.Atoi(sc.Text())
		w -= arr[i]
	}
	sort.Ints(arr)
	fmt.Println(w/arr[0] + N)
}

Measured memory_bytes: 640
#include<stdio.h>

int main(){
  int n,num;
  int a[40];
  int b[40];
  int c[40];
  
  scanf("%d",&n);
  
  for(int i=0;i<n;i++){
    scanf("%d",&a[i]);
  }
  for(int i=0;i<n;i++){
    scanf("%d",&b[i]);
  }
  for(int i=0;i<n-1;i++){
    scanf("%d",&c[i]);
  }
  
  for(int i=0;i<n;i++){
    num+=b[i];
    if(a[i+1]-a[i]==1){
      num+=c[a[i]-1];
    }
  }
  
  printf("%d",num);
  
  return 0;
}
  

Measured memory_bytes: 128
import itertools
N = int(input())
S = []
x = 0
y = 1
for i in range(N):
    Z = input()
    S.append(Z[0])

T = []

for j in "MARCH":
    T.append(S.count(j))

P = list(itertools.combinations(T,3))

for k in P:
    for l in range(3):
        y *= int(k[l])
    x += y
    y = 1

print(x)

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

auto main()->int{
  auto s = 0, l = 0;
  for(int i = 0;i < 3;i++){
    int tmp;
    std::cin >> tmp;
    if(tmp == 5) s++;
    else if(tmp == 7) l++;
  }
  
  if(s == 2 && l == 1) std::cout << "YES";
  else std::cout << "NO";
  std::cout << std::endl;
  
  return 0;
}

Measured memory_bytes: 256
import sys

stdin = sys.stdin

ni = lambda: int(ns())
na = lambda: list(map(int, stdin.readline().split()))
ns = lambda: stdin.readline().rstrip()  # ignore trailing spaces

n=ni()
d= [10*[0]for _ in range(10)]
ans = 0
for i in range(1,n+1):
  s = str(i)
  if s[0] == "0" or s[-1] == "0": continue
  d[int(s[0])][int(s[-1])] += 1
for i in range(1,10):
  for j in range(1,10):
    ans += d[i][j] * d[j][i]
print(ans)

Measured memory_bytes: 3064
#include "bits/stdc++.h"
using namespace std;
int main() {
    cin.tie(0); ios::sync_with_stdio(false);
    
    string str1, str2;
    cin >> str1 >> str2;
    
    int len1 = str1.length();
    int len2 = str2.length();
    
    for(int i = 0; i < len1 ; i ++){
        bool nomatch = false;
        for(int j = 0; j < len2; j ++){
            int k = i + j;
            k %= len1;
            if(j < len2 && str1[k] != str2[j]){
                nomatch = true;
            }
        }
        if(nomatch == false){
            cout << "Yes" <<endl;
            return 0;
        }
    }
    
    cout << "No" <<endl;
    
    
    
    
    
    return 0;
}

Measured memory_bytes: 3232
#include <bits/stdc++.h>
#define debug(x) cerr << #x << ": " << x << '\n';
using namespace std;
using ll = long long;
using P = pair<int, int>;
const int INF = (int)1e9;
const int MOD = (int)1e9 + 7;

int main(void){
	int N;
	cin >> N;
	vector<P> vec(N);
	for(int i = 0; i < N; i++){
		cin >> vec[i].second >> vec[i].first;
	}
	sort(vec.begin(), vec.end());

	int time = 0;
	bool res = true;
	for(auto p: vec){
		time += p.second;
		if(time > p.first) res = false;
	}

	cout << (res ? "Yes" : "No") << '\n';

	return 0;
}

Measured memory_bytes: 1792
#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdlib>
#include <utility>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
#define my_abs(x) ((x) < 0 ? -(x) : (x))
#define pb push_back
typedef long long ll; 
int main()
{
	// freopen("A.in", "r", stdin); 
	int a, b; 
	scanf("%d%d", &a, &b); 
	if (a + b == 15)
		puts("+"); 
	else if (a * b == 15)
		puts("*");
	else
		puts("x"); 
	return 0; 
}


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

int main() {
	int A, B, C, D;
	cin >> A >> B >> C >> D;
	if (abs(C - A) <= D) {
		cout << "Yes" << endl;
		return 0;
	}
	else if (abs(B - A) <= D && abs(C - B) <= D) {
		cout << "Yes" << endl;
		return 0;
	}
	cout << "No" << endl;
}

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

int main()
{
	ios_base::sync_with_stdio(false);
	int n;
	cin>>n;
	vector<pair<int,int> > vi;
	for(int i=0;i<n;i++)
	{
		int u,v;
		cin>>u>>v;
		vi.push_back({v,u});
	}
	int curr = 0;
	sort(vi.begin(),vi.end());
	bool poss = true;
	for(auto i:vi)
	{
		if(i.second+curr>i.first)
		{
			poss=false;
			break;
		}
		curr+=i.second;
	}
	if(poss)
		cout<<"Yes";
	else
		cout<<"No";
}

Measured memory_bytes: 2420
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdint>
#include <utility>
#include <cstring>
using namespace std;

int main() {
    uint64_t x[3],a[3][1000],k;
    for(int i = 0;i < 3;i++) cin >> x[i];
    cin >> k;
    for(int i = 0;i < 3;i++) {
        for(int j = 0;j < x[i];j++) {
            cin >> a[i][j];
        }
    }
    uint64_t b[1000000];
    for(int i = 0;i < x[1];i++) for(int j = 0;j < x[2];j++) b[j+(i*x[1])] = a[1][i] + a[2][j];
    sort(b,b+(x[1]*x[2]),greater<>());
    sort(a[0],a[0]+x[0],greater<>());
    uint64_t* c = a[0];
    uint64_t h[1000],v = x[0],w = x[1]*x[2];
    memset(h,0,sizeof(uint64_t[1000]));
    for(int i = 0;i < k;i++) {
        int mj = 0;
        for(int j = 0;j < v;j++) {
            if(h[j] < w && b[h[j]]+c[j] > b[h[mj]]+c[mj]) {
                mj = j;
            }
        }
        cout << b[h[mj]]+c[mj] << endl;
        h[mj]++;
    }
}

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

#ifdef _DEBUG
    #include "/home/v-o_o-v/deb.h"
    #define deb(x...)cerr << "[" << #x << "] = [";_print(x);
#else
    #define deb(x...)
#endif

#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
using ll = long long;



int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
   
    
    int n, ans = 0;
    cin >> n;
    map<int, int> cnt;
    for(int x = 1; x <= 150; x++){
        for(int y = 1; y <= 150; y++){
            for(int z = 1; z <= 150; z++){
                cnt[x * x + y * y + z * z + x * y + y * z + z * x]++;
            }

        }
    }
    for(int i = 1; i <= n; i++)cout << cnt[i] << '\n';
    return 0;
}
// Write Here


Measured memory_bytes: 7920
n,m = gets.split.map &:to_i
a = Array.new(m){ gets.split.map &:to_i }
b = gets.split.map &:to_i

ans = 0
[0,1].repeated_permutation(n) do |sw|
  chk = m.times.all? do |i|
    a[i][1..-1].map{|j|sw[j-1]}.inject(:+) % 2 == b[i]
  end
  ans += 1 if chk
end
puts ans

Measured memory_bytes: 2044
from collections import deque

n, m = map(int, input().split())

way = {}
for i in range(m):
    a, b = map(int, input().split())
    if a not in way:
        way[a] = []
    if b not in way:
        way[b] = []
    way[a].append(b)
    way[b].append(a)

queue = deque([1])
ok = set([1])
ans = [0] * (n+1)

while queue:
    now = queue.popleft()
    for i in way[now]:
        if i in ok:
            continue
        ans[i] = now
        queue.append(i)
        ok.add(i)

print("Yes")
for i in range(2, n+1):
    print(ans[i])


Measured memory_bytes: 119196
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>
 
using namespace std;
using std::cout;
using ll =long long;
bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}
ll gcd11(ll x, ll y){
  long long a= max(x,y), b=min(x,y), c=a%b;
  while( c!=0){
    a =b;
    b =c;
    c = a%b;
  }
  return b;
}

int ab(int x, int y){
  if(x>=y){
    return x-y;
  }
  else if(y>x){
    return y-x;
  }
}
int main(){
  int n;
  cin>> n;
  double x[n];
  string u[n];
  double ans =0;
  for(int i =0;i<n;i++){
    cin>>x[i]>>u[i];
    if(u[i]=="JPY"){
      ans +=x[i];
    }
    else{
      ans += 380000.0*x[i]; 
    }
  }
  cout <<ans<<endl;

}

Measured memory_bytes: 256
### constant

DELTA = 1.0e-10

### subroutines

def on_circle(r2, pol)
  min_d2 = Float::INFINITY
  min_i = nil

  pol.each_with_index do |pt, i|
    d2 = r2 - (pt[0] ** 2 + pt[1] ** 2)
    if min_d2 > d2
      min_d2 = d2
      min_i = i
    end
  end

  min_i
end

def rot_pt(pvx, pvy, x, y, th)
  c = Math.cos(th)
  s = Math.sin(th)
  x -= pvx
  y -= pvy
  [c * x - s * y + pvx, s * x + c * y + pvy]
end

### main

loop do
  n, r, q = gets.split.map(&:to_i)
  break if (n | r | q) == 0

  r2 = r * r

  pol = n.times.map{gets.split.map(&:to_f)}

  pvi = on_circle(r2, pol)

  q.times do
    #p pvi
    #puts "[" + pol.map{|pt| sprintf("[%.2f, %.2f]", *pt)}.join(', ') + "],"

    pvx, pvy = pol[pvi]
    pvth = Math.atan2(-pvy, -pvx) + Math::PI / 2

    min_th = Float::INFINITY
    min_i = nil

    for k in (1...n)
      i = (pvi + n - k) % n
      xi, yi = pol[i]
      thi = Math.atan2(yi - pvy, xi - pvx)

      th0 = 0.0
      th1 = pvth - thi
      th1 += Math::PI * 2 if th1 < 0.0
      #p [k, th0, th1]

      while th1 - th0 > DELTA
        #p [k, th0, th1]
        th = (th0 + th1) / 2
        x, y = rot_pt(pvx, pvy, xi, yi, th)
        pr2 = x * x + y * y

        if pr2 == r2
          th0 = th1 = th
        elsif pr2 > r2
          th1 = th
        else
          th0 = th
        end
      end

      th = (th0 + th1) / 2
      #p [i, dth]

      if min_th > th
        min_th = th
        min_i = i
      end
    end
    #p [min_i, min_th]

    for k in (1...n)
      i = (pvi + n - k) % n
      pol[i] = rot_pt(pvx, pvy, *pol[i], min_th)
    end

    pvi = min_i
    puts pol[pvi].join(' ')
  end
end

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

using namespace std;

typedef pair<int, int> P;
typedef long long ll;
#define rep(i, n) for(int i=0;i<(n);i++)
#define rep2(i, m, n) for(int i=m;i<(n);i++)
#define rrep(i, n, m) for(int i=n;i>=(m);i--)
using Graph = vector<vector<int>>;
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = {0, 1, 0, -1};
const ll MOD = 1000000007;
#ifdef __DEBUG

#include "cpp-pyprint/pyprint.h"

#endif

vector<ll> divisor(ll N) {
    vector<ll> res;
    for (ll i = 1L; i * i< N; ++i) {
        if (N % i == 0) {
            res.push_back(i);
            ll j = N / i;
            if (j != i)  {
                res.push_back(j);
            }
        }
    }
    sort(res.begin(), res.end());
    return res;
}

void Main() {
    int N, K;
    cin >> N >> K;
    vector<int> A(N);
    rep(i, N) cin >> A[i];
    ll sum = accumulate(A.begin(), A.end(), 0LL);

    vector<ll> target = divisor(sum);
    ll ans = 0;
    for(ll d: target) {
        vector<int> mod(N, 0);
        vector<int> modd(N, 0);
        rep(i, N) mod[i] = A[i] % d;
        sort(mod.begin(), mod.end());
        rep(i, N) modd[i] = d - mod[i];

        vector<ll> sum_p(N+1, 0LL);
        vector<ll> sum_m(N+1, 0LL);
        rep(i, N) {
            sum_p[i+1] += sum_p[i] + mod[i];
            sum_m[i+1] += sum_m[i] + modd[i];
        }
        rep(i, N){
            if (sum_p[i+1] - (sum_m[N] - sum_m[i+1]) == 0 && sum_p[i+1] <= K){
                ans = max(ans, d);
            }
        }
    }
    cout << ans << endl;

}

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    Main();
}


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

int r,g,b;

bool ok() { return r < g && g < b; }

signed main() {
  cin >> r >> g >> b;
  int k;
  cin >> k;

  if(ok()) {
    puts("Yes");
    return 0;
  }

  rep(i, k) {
    if(r >= g) g*=2;
    else if (g>=b) b*=2;
    if(ok()) {
      puts("Yes");
      return 0;
    }
  }
  puts("No");
}


Measured memory_bytes: 3632
#include <stdio.h>

#define MIN(x,y) ((x)<(y)?(x):(y))

typedef long long int ll;

int a[2000];

int dp[2000][2000];
ll dp2[2000];

int main(){
  int n, x, i, j;
  scanf("%d%d", &n, &x);
  for(i=0;i<n;i++){
    scanf("%d", a+i);
    dp2[0] += dp[i][0] = a[i];
  }

  for(j=1;j<n;j++){
    dp2[j] = (ll) j*x;
    for(i=0;i<n;i++){
      dp2[j] += dp[i][j] = MIN(dp[i][j-1], a[(i+n-j)%n]);
    }
    dp2[j] = MIN(dp2[j-1], dp2[j]);
  }

  printf("%lld\n", dp2[n-1]);
  return 0;
}


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

int main(){
  int n;
  char suits[4]={'S','H','C','D'};
  char suit;
  int num;
  int cards[4][13]={{}};

  cin >> n;
  for(int i=0; i<n; i++){
      cin >> suit >> num;
      if(suit=='S') cards[0][num-1]=1;
      else if(suit=='H') cards[1][num-1]=1;
      else if(suit=='C') cards[2][num-1]=1;
      else if(suit=='D') cards[3][num-1]=1;
  }

  for(int i=0; i<4; i++){
    for(int j=0; j<13; j++){
      if(cards[i][j]==0){
        cout << suits[i] << " " << j+1 << endl;
      }
    }
  }
}



Measured memory_bytes: 3088
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
#include <map>
using std::map;

#include <string>
using std::string;
map<string, int> memo;

int main (void) {
int n;

scanf("%lld", &n);
for (int i = 0; i < n; i++) {
string s;
cin >> s;

memo[s] += 1;
}


int maxv = 0;
for (const auto& x : memo) {
 int v = x.second;
 if (v > maxv) maxv = v;
 }
 for (auto it = memo.begin(); it != memo.end(); it++) {
 if (it->second == maxv) {
 cout << it->first << endl;
}}}

Measured memory_bytes: 25216
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int N = int.Parse(Console.ReadLine());

            int ans = 0;
            if (N < 10) {
                ans += N;
            } else {
                ans += 9;
            }
            if (100 <= N) {
                if (N < 1000) {
                    ans += N - 99;
                } else {
                    ans += 900;
                }
            }
            if (10000 <= N) {
                if (N < 100000) {
                    ans += N - 9999;
                } else {
                    ans += 90000;
                }
            }
            Console.WriteLine(ans);
        }
    }
}


Measured memory_bytes: 13140
# UnionFind
class UnionFind():
    def __init__(self, n):
        # uf.parentsで各ノードの親をリストで返す
        self.n = n
        self.parents = [-1] * n

    def find(self, x):
        # uf.find(x)で処理を行う
        #　要素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):
        # uf.union(x,y)で処理を行う
        # 要素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):
        # uf.size(x)で処理を行う
        # 要素xが属するグループの要素数を返す
        return -self.parents[self.find(x)]

    def same(self, x, y):
        # uf.same(x,y)で処理を行う
        # 要素x,yが同じグループに属するかどうかを返す
        return self.find(x) == self.find(y)

    def members(self, x):
        # uf.members(x)で処理を行う
        # 要素xが属するグループに属する要素をリストで返す
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]

    def roots(self):
        # uf.roots()で処理を行う
        #　すべての根の要素をリストで返す
        return [i for i, x in enumerate(self.parents) if x < 0]

    def group_count(self):
        # uf.group_count()で処理を行う
        # グループの数を返す
        return len(self.roots())

    def all_group_members(self):
        # all_group_members()で処理を行う
        # ｛ルート要素：[グループに属する要素のリスト]｝をdict型で返す
        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,k = map(int,input().split())
uf = UnionFind(n)
edge = []
anti_edge = [0]*(n+1)
for i in range(n+1):
    edge.append([])
for i in range(m):
    a,b = map(int,input().split())
    edge[a].append(b)
    edge[b].append(a)
    uf.union(a-1,b-1)
for i in range(k):
    c,d = map(int,input().split())
    if uf.same(c-1,d-1):
        anti_edge[c] += 1
        anti_edge[d] += 1
for i in range(n):
    size = uf.size(i)
    friend = len(edge[i+1])
    block = anti_edge[i+1]
    print(size-1-friend-block)





Measured memory_bytes: 114080
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buffer []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buffer = append(buffer, line...)
		if !isPrefix {
			break
		}
	}
	return string(buffer)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	r := io.tokens[io.nextToken]
	io.nextToken++
	return r
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) PrintLn(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntLn(a []int) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func (io *Io) PrintStringLn(a []string) {
	b := []interface{}{}
	for _, x := range a {
		b = append(b, x)
	}
	io.PrintLn(b...)
}

func main() {
	io := NewIo()
	defer io.Flush()

	A := io.NextInt()
	B := io.NextInt()

	if A >= 13 {
		io.PrintLn(B)
	} else if A >= 6 {
		io.PrintLn(B / 2)
	} else {
		io.PrintLn(0)
	}
}


Measured memory_bytes: 640
/* Author : Aaryan Srivastava ^__^ */ 
#include <bits/stdc++.h>
#include <random>
#include <chrono>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp> 
#define pb push_back
#define mp make_pair
#define ff first
#define ss second   
#define rep(i,n) for(int (i) = 0 ; i < (n) ; i++)
#define repA(i,x,y) for(int i = (x) ; i <= (y) ; i++)
#define repD(i,x,y) for(int i = (x) ; i >= (y) ; i--)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).end()
#define setval(a,val) memset(a,val,sizeof(a))
#define Randomize mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define trav(x , a) for(auto &x : a)
#define sz(a) ((int)a.size())
typedef long long ll ; 

#define int ll

using namespace std;

const int N = 3e5 +5 ;
const int mod = 1e9 + 7 ;
const ll inf = 1e18 ;
const int SZ = 101 ;
const double eps = 1e-9 ;
using namespace __gnu_pbds;
using ordered_set =  tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ;

typedef pair<int, int> pii; 
typedef pair<int , pii> ipii ;
typedef pair<pii , int> piii ; 
typedef unsigned long long ull ;
typedef long double ld;

ll po(ll x,ll y,ll p = mod) {ll res=1;x%=p;while(y>0){if(y&1)res=(res*x)%p;y=y>>1;x=(x*x)%p;}return res;}

void solve()
{
    int ans = 0 ;
    int k ;
    cin >> k ; 
    repA(a , 1 , k){
        repA(b , 1 , k) {
            repA(c , 1 , k){
                int g = 0 ;
                g = gcd(g , a);
                g = gcd(g , b);
                g = gcd(g , c);
                ans += g ;
            }
        }
    }
    cout << ans ;
}   

     
int32_t main(int32_t argc, char *argv[])
{
    ios::sync_with_stdio(0);    
    cin.tie(0); cout.tie(0);
    int TC = 1, t = 0;
    //cin >> TC ;
    while(t++ < TC)
    {
        //cout << "Case #" << t << ": " ;
        solve();
        cout << "\n" ;
    }
    return 0;
}

Measured memory_bytes: 3648
#include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>
using namespace std;
#define ll int64_t
const long MOD = 1e9 + 7;
const long LINF = 1e13;
const long LLINF = 1e18;
const long ALPHABET = 26;

template <class T>
void Swap(T& r, T& l) {
  T tmp = r;
  r = l;
  l = tmp;
}


int main() {

  long n, w, h, a, b, d;
  string s;

  cin >> n >> a ;
  // vector<long> a(n);


  bool ans = false;

  // int c = 0;
  // c = (a + b) - n;
  // if (c < 0)c = 0;

  if (a <= (n+1)/2 )ans = true;


  // cout << min(a, b) << " " << c;
  // cout << "YES" <<endl;
  if (ans){
    cout << "YES" <<endl;
  }else{
    cout << "NO" <<endl;
  }
  // cout << (ans)?"YES":"NO";
  // cout <<endl;


}




















Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rrep(i, n) for (int i = (int)(n - 1); i >= 0; i--)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define get_unique(x) x.erase(unique(all(x)), x.end());
typedef long long ll;
typedef complex<double> Complex;
const int INF = 1e9;
const ll MOD = 1e9 + 7;
const ll LINF = 1e18;
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 T>
vector<T> make_vec(size_t a) {
    return vector<T>(a);
}
template <class T, class... Ts>
auto make_vec(size_t a, Ts... ts) {
    return vector<decltype(make_vec<T>(ts...))>(a, make_vec<T>(ts...));
}

int main() {
    int h, a;
    cin >> h >> a;
    int ans = 0;
    while (h > 0) {
        h -= a;
        ans++;
    }
    cout << ans << endl;
}


Measured memory_bytes: 256
#include <cstdio>
const int mod = 1000000007;
int a[21];
int dp[1<<21], bc[1<<21];
int main() {
	int n;
	scanf("%d", &n);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			int x;
			scanf("%d", &x);
			a[i] |= x << j;
		}
	}
	for (int i = 1; i < 1 << 21; i++) {
		bc[i] = bc[i&(i-1)] + 1;
	}
	int m = (1 << n) - 1;
	dp[0] = 1;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < 1 << n; j++) {
			if (bc[j] != i) continue;
			int k = (j ^ m) & a[i];
			for (int l = k; l; l &= l - 1) {
				int nl = l & (l - 1), t = nl ^ l;
				dp[j|t] += dp[j];
				if (dp[j|t] >= mod) dp[j|t] -= mod;
			}
		}
	}
	printf("%d\n", dp[m]);
	return 0;
}


Measured memory_bytes: 16640