akhauriyash/Code-Regression huggingface dataset:
class Square
  attr_reader :squares

  def initialize
    @squares = build_two_dimensions
  end

  def build_two_dimensions
    Array.new(10) { [] }.map { Array.new(10) { 0 } }
  end

  def update(x, y, size)
    range = case size
            when 1
              small_range
            when 2
              middle_range
            when 3
              large_range
            else
              []
            end

    range.each do |a, b|
      increment(x + a, y + b)
    end
  end

  def zero_count
    @squares.flatten.select(&:zero?).count
  end

  def max
    @squares.flatten.max
  end

  private

  def large_range
    middle_range.concat [[-2, 0], [0, -2], [0, 2], [2, 0]]
  end

  def middle_range
    small_range.concat [[-1, -1], [-1, 1], [1, -1], [1, 1]]
  end

  def small_range
    [[-1, 0], [0, -1], [0, 0], [0, 1], [1, 0]]
  end

  def increment(x, y)
    @squares[x][y] += 1 if x.between?(0, 9) && y.between?(0, 9)
  end
end

lines = STDIN.read.split("\n")
square = Square.new
lines.each do |line|
  x, y, size = line.split(',').map(&:to_i)
  square.update(x, y, size)
end
puts square.zero_count
puts square.max

Measured memory_bytes: 8624
n = int(input())
import collections
dat = list(map(int, input().split()))
dat.sort()
#print(dat)
c = collections.Counter(dat)
keys = c.keys()
keys = list(keys)
keys.sort()
buf = []
for k in keys:
    buf.append( (c[k]-1) % 2)
#print(buf)
total = sum(buf)
if total % 2 == 1:
    print(len(buf) - 1)
else:
    print(len(buf))


Measured memory_bytes: 64936
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
typedef long long lint;
typedef pair<lint,lint> pp;
typedef vector<pp> vecP;
typedef vector<vecP> graph;

int N,Q,K;
const int MAX_N = 100010;
int par[MAX_N][20],height[MAX_N];
lint dist[MAX_N];
graph path;

void dfs(int v,int p,lint h){
	dist[v] = h;
	par[v][0] = p;
	for(int i=0;i<(int)path[v].size();i++){
		int u = path[v][i].first;
		if(u==p)continue;
		dfs(u,v,h+path[v][i].second);
	}
}

void init(){
	dfs(1,1,0);
	for(int i=1;i<20;i++){
		for(int j=1;j<=N;j++){
			par[j][i] = par[par[j][i-1]][i-1];
		}
	}
	for(int i=1,x;i<=N;i++){
		x=i;
		for(int j=19;j>=0;j--){
			if(par[x][j] != 1){
				x = par[x][j];
				height[i] += 1<<j;
			}
		}
	}
}

int LCA(int x,int y){
	if(height[x] < height[y])swap(x,y);
	int dif = height[x] - height[y];
	for(int i=19;i>=0;i--){
		if(dif>>i&1)x = par[x][i];
	}
	if(x==y)return x;
	for(int i=19;i>=0;i--){
		if(par[x][i]!=par[y][i]){
			x = par[x][i];
			y = par[y][i];
		}
	}
	return par[x][0];
}

lint getDist(int x,int y){
	int z = LCA(x,y);
	return dist[x]+dist[y]-2*dist[z];
}

int main(){
	scanf("%d",&N);
	path.assign(N+1,vecP());
	int x,y,z;
	for(int i=0;i<N-1;i++){
		scanf("%d%d%d",&x,&y,&z);
		path[x].push_back({y,z});
		path[y].push_back({x,z});
	}

	init();

	scanf("%d%d",&Q,&K);
	for(int i=0;i<Q;i++){
		scanf("%d%d",&x,&y);
		printf("%lld\n",getDist(x,K)+getDist(y,K));
	}
	return 0;
}

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

int main() {
    int n, m, j=0; cin >>n;
    vector<int> a(n);
    for (int i=0; i<n; i++) cin >> a.at(i);
    cin >>m;
    vector<int> b(m);
    for (int i=0; i<m; i++) cin >> b.at(i);
    if (a.at(n-1) < b.at(m-1)) {
        cout << 0 << endl;
        return 0;
    }
    for (int i=0; i<m; i++) {
        while(j<n) {
            if (b.at(i) == a.at(j)) break;
            if (b.at(i) < a.at(j)) {
                cout << 0 << endl;
                return 0;
            } 
            j++;
        }
    }
    cout << 1 << endl;
}




Measured memory_bytes: 4320
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
using namespace std;
typedef long long ll;

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

int main(){
    ll a,b,g;
    scanf("%lld%lld",&a,&b);
    g=gcd(a,b);
    vector<ll> ans,div;
    ll r=sqrt(g);
    for(ll i=1;i<=r;i++){
        if(g%i==0){
            div.push_back(i);
            if(i*i!=g){
                div.push_back(g/i);
            }
        }
    }
    sort(div.begin(),div.end());
    for(int i=0;i<div.size();i++){
        int flag=1;
        for(int j=0;j<ans.size();j++){
            if(gcd(div[i],ans[j])!=1){
                flag=0;
                break;
            }
        }
        if(flag){
            ans.push_back(div[i]);
        }
    }
    printf("%ld\n",ans.size());
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll INF = 1e18;
#define rep(i,m,n) for(ll i = (m); i <= (n); i++)
#define zep(i,m,n) for(ll i = (m); i < (n); i++)
#define rrep(i,m,n) for(ll i = (m); i >= (n); i--)
#define print(x) cout << (x) << endl;
#define printa(x,m,n) for(ll i = (m); i <= n; i++){cout << (x[i]) << " ";} cout<<endl;

int main(){
	cin.tie(0); ios::sync_with_stdio(false);
	
	double l;
	cin >> l;
	
	double ans = (l/3)*(l/3)*(l/3);
	cout << fixed << setprecision(20) << ans << endl;
	return 0;
}

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

using namespace std;

int main()
{
	int n, m = 2e9;
	cin >> n;
	long r = 0;
	for (int i = 0; i < n; i++) {
		int a, b;
		scanf("%d%d", &a, &b);
		r += b;
		if (a > b) m = min(m, b);
	}
	cout << (m > 1e9 ? 0 : r - m) << endl;
	return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
typedef long long lli;
const int maxn = 5e5 + 50;
typedef pair<int, int> P;

void solve();
int main()
{
	int t = 1;
//	cin >> t;
	for(int i=0; i<t; i++)
	{
		solve();
		cout << '\n';
	}
	return 0;
}

// type below

void solve()
{
	string str; cin >> str;
	int k; cin >> k;
	priority_queue<string, vector<string>, greater<string> > Q;
	set<string> S;
	for(int i=0; i<str.size(); i++)
	{
		string tmp = "";
		for(int k=0; k<5; k++)
		{
			if(i + k >= str.size()) break;
			tmp += str[i + k];
			if(S.count(tmp)) continue;
			S.insert(tmp);
			Q.push(tmp);
		}
	}
	while(k > 1)
	{
//		cout << Q.top() << '\n';
		Q.pop();
		k --;
	}
	cout << Q.top() << '\n';
	return;
}

Measured memory_bytes: 1792
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
typedef long long int ll;

int main()
{
    vector<int>a;
	int b;
	while(cin >> b){
		if(b==0){
			printf("%d\n",a[a.size()-1]);
			a.pop_back();
		}
		else{
			a.push_back(b);
		}
	}
    return 0;
}

Measured memory_bytes: 1192
import java.util.Scanner;
class Main{
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);

        int n = scanner.nextInt();
        int x;

        for(int i = 1; i <= n; i++){
            x = i;
            if(x % 3 == 0){
                System.out.print(" "+i);
                continue;
            }
            while(true){
                if(x%10==3){
                    System.out.print(" "+i);
                    break;
                }
                if(x/10 == 0)break;
                else x/= 10;
            }
        }
        System.out.println("");
    }
}



Measured memory_bytes: 28836
#include<iostream>
#include<string>

using namespace std;

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

int main(){
    int n;
    cin >> n;
    string s[n];
    rep(i, n) cin >> s[i];
    int a[n][26];
    rep(i, n)rep(j, 26) a[i][j] = 0;
    string al = "abcdefghijklmnopqrstuvwxyz";
    rep(i, n)rep(j, s[i].size())rep(k, 26){
        if (s[i][j] == al[k]){
            a[i][k]++;
            continue;
        }
    }
    int ans[26];
    rep(i, 26) ans[i] = 1000000;
    rep(i, n)rep(j, 26){
        ans[j] = min(ans[j], a[i][j]);
    }
    rep(i, 26)rep(j, ans[i]){
        cout << al[i];
    }
    cout << endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
map<int,int >cnt;
   int n;
   cin>>n;
   for(int i=0;i<n;i++){
    int a;
    cin>>a;
    cnt[a]++;
   }
   int ans=0;
   for(auto u:cnt){
    if(u.second>=u.first) ans+=(u.second-u.first);
    else ans+=u.second;
   }
   cout<<ans<<endl;
}

Measured memory_bytes: 8128
#include<bits/stdc++.h>
using namespace std;
#define ll long long
typedef pair<ll,ll> P;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define M 1000000007
#define all(a) (a).begin(),(a).end()
#define rep(i,n) reps(i,0,n)
#define reps(i,m,n) for(int i=(m);i<(n);i++)
int main(){
  string s,t;
  cin>>s>>t;
  rep(i,min((int)s.size(),(int)t.size()))cout<<s[i]<<t[i];
  if(s.size()>t.size())cout<<s[s.size()-1];
}

Measured memory_bytes: 256
<?php
list($n) = ints();
$a[0] = ['a'];
$i = 1;
while (!isset($a[$n - 1])) {
    foreach ($a[$i - 1] as $v) {
        for ($j = 0; $j < 26; ++$j) {
            $a[$i][] = $v . chr(97 + $j);
            if (strpos($v, chr(97 + $j)) === false) break;
        }
    }
    ++$i;
}
echo implode(PHP_EOL, $a[$n - 1]);
function ints()
{
    return array_map('intval', explode(' ', trim(fgets(STDIN))));
}


Measured memory_bytes: 28824
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <cmath>
#include <vector>
#include <string>
#include <algorithm>
#include <cstdlib>
#include <limits>
#include <numeric>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;

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

	if ((n % 500) <= a)cout << "Yes" << endl;
	else cout << "No" << endl;

	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, w;
    cin >> n >> w;
    vector<ll> dp(w + 1, 0), wt(n), vl(n);
    // dp[i] - highest value with weight i

    for(int i = 0; i < n; i++) {
        cin >> wt[i] >> vl[i];
    }
    for(int item = 0; item < n; item++) {
        for(int weight = w; weight >= wt[item]; weight--) {
            dp[weight] = max(dp[weight], dp[weight-wt[item]] + vl[item]);
        }
    }

    ll answer = 0;
    for(int i = 0; i <= w; i++) {
        answer = max(answer, dp[i]);
    }
    cout << answer;
    return 0;
}


Measured memory_bytes: 3976
#include <stdio.h>

int main(void)
{
	int num[101] = { 0 };
	int temp;
	int i, max = 0;
	
	while (scanf("%d", &temp) != EOF){
		num[temp]++;
		if (max <= num[temp]){
			max = num[temp];
		}
	}
	
	for (i = 0; i < 100; i++){
		if (num[i] == max){
			printf("%d\n", i);
		}
	}
	
	return (0);
}

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

int main()
{
  int n,i,u,k,j;
  int *U;
  int G[103][103];

  /* 初期化 */
  for(i = 0;i < 103;i++){
    for(j = 0;j < 103;j++){
      G[i][j] = 0;
    }
  }

  scanf("%d",&n);

  for(i = 0;i < n;i++){
    scanf("%d",&u);
    scanf("%d",&k);

    U = (int *)malloc(sizeof(int) * k);
    if(U == NULL) exit(0);

    for(j = 0;j < k;j++){
      scanf("%d",&U[j]);
      G[u][U[j]] = 1;
    }
  }

  /* 出力 */
  for(i = 1;i <= n;i++){
    for(j = 1;j <= n;j++){
      printf("%d",G[i][j]);
      if(j != n) printf(" ");
    }
    printf("\n");
  }

  return 0;
}

Measured memory_bytes: 644
q = int(input())

import sys
input = sys.stdin.readline
# ヒープキュー（最小値・最大値の取得）
from heapq import heappop,heappush
left = []
right = []

lsum = 0
rsum = 0
q1_num = 0
b = 0
for _ in range(q):
    qs = tuple(map(int, input().split()))
    if(qs[0]==1):
        b += qs[2]
        if(q1_num == 0):
            heappush(left, qs[1] * -1)
            lsum += qs[1]
            q1_num += 1
            continue
        elif(q1_num%2==1):
            tmp = heappop(left) * -1
            lsum -= tmp

        else:
            tmp = heappop(right)
            rsum -= tmp
        less =  min(tmp, qs[1])
        more =  max(tmp, qs[1])
        heappush(left, less * -1)
        heappush(right, more)
        lsum += less
        rsum += more
        q1_num += 1

    else:
        num = rsum - lsum + b
        tmp = heappop(left) * -1
        if(q1_num%2==1):
            num += tmp
        heappush(left, tmp * -1)
        print(' '.join(map(str, [tmp, num])))

Measured memory_bytes: 94040
#include <bits/stdc++.h>
#include <cmath>
#include <numeric>
using namespace std;
#define rep(i,a,b) for(int64_t i=(a); i<(b); ++i) // a ≦ i < b 
#define Rrep(i,a,b) for(int64_t i=(a);i>=(b);--i) // reverse repeat. a から b まで減少．
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend() //逆イテレータ
#define INF 1000000000000000
#define MOD 1000000007LL
#define RANGE(a,b,c) (a).begin()+(b),(a).begin()+(c) // [b,c) イテレータ
using PII = pair<int64_t, int64_t>;
using VI = vector<int64_t>;
using VVI = vector<VI>;
using VS = vector<string>;
using VP = vector<PII>;
using i64 = int64_t;
template<typename T> void invec(vector<T> &A){for(T& a : A) cin >> a;} // input vector

i64 attackcnt(i64 H){
    if (H == 1) return 1;

    return 1 + attackcnt(H/2) * 2;

}

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

i64 H; cin >> H;

cout << attackcnt(H) << "\n";

}
// 書いて考える．場合分け．情報整理．
// 境界，出力文字列 チェック．行末にスペース入れない．
// 可読性優先．高速化次点．
// まずは全探索，分割，次にDP
// 制限を見る．境界に注意．求めたい量の変域．動かせる量．
// 偶奇，逆から，ソート，出現回数，出現位置，DP， 余事象，包除
// データ構造． 問題の特徴量．単調性，二分探索
// 存在判定：構成方法，入力の特徴
// gcd, lcm ,素因数分解．
// 例外を十分に含む一般化．想像力の限界
// 小さい系から例示
// 代数的処理．前処理によるクエリ高速化．
// 始めは過剰に例示・場合分けしてもいい．各場合を確実に対処．
// 自明な例から処理，除外．
// 小数のときは，精度の設定する．doubel 変数に数値を入力するときは 123. とする．
// テストケース作成は数表あり
// 実行エラー：vector添え字超え．0割り．



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

using namespace std;

int main() {

    int n;
    cin >> n;
    long long ans[n][3];
    cin >> ans[0][0] >> ans[1][0] >> ans[2][0];
    for (int i = 1; i < n; i++) {
        int x, y, z;
        cin >> x >> y >> z;
        ans[0][i] = x + max(ans[1][i - 1], ans[2][i - 1]);
        ans[1][i] = y + max(ans[0][i - 1], ans[2][i - 1]);
        ans[2][i] = z + max(ans[0][i - 1], ans[1][i - 1]);
    }
    cout << max(ans[0][n - 1], max(ans[1][n - 1], ans[2][n - 1]));
    return 0;
}


Measured memory_bytes: 2432
li = input()
li_a = []
count = 0

for i in li:
    if i in li_a:
        count += 1
    li_a.append(i)
li_a = list(set(li_a))
if len(li_a) == 2 and count == 2:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 2940
#include <algorithm>
#include <iostream>
#include <map>
#include <numeric>
#include <set>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <queue>
#include <bitset>
#define MOD (1000000007l)
#define rep(i, n) for(long i = 0; i < (n); i++)

using namespace std;

long foo(long arg) {
  long ans = 1;
  while (arg / 10) {
    ans++;
    arg /= 10;
  }
  return ans;
}

void solve() {
  long N;
  cin >> N;
  long ans = 0;
  for (long i = 1; i <= N; i++) if (foo(i) % 2 != 0) ans++;
  cout << ans << endl;
}

int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout.precision(12);
  solve();
  return 0;
}


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

int main() {
    int a, b;
    cin >> a >> b;
    int l1 = floor(a/0.1);
    int r1 = floor(a/0.07);

    for(int i = l1; i < r1; i++) {
        if(floor(i*0.08) == a && floor(i*0.1) == b) {
            cout << i;
            return 0;
        }
    }
    cout << -1;
}

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

using namespace std;

string addHeadChar(string str1,char insertStr){
	return insertStr + str1;
}

string addTailChar(string str1,char insertStr){
	return str1 + insertStr;
}

string reverseString(string str){
	string result;
	for(int i =str.length()-1; i >=0; i--){
		result.push_back(str[i]);
	}
	return result;
}

int main()
{
	int reverseMode = 1;
	string S,head,tail;
	int Q;
	cin>>S;
	cin>>Q;
	for(int i = 0; i < Q; i++){
		int T,F;
		char C;
		cin>>T;
		if(T == 1){
			reverseMode = reverseMode * -1;
		}else if( T == 2){
			cin>>F>>C;
			if( reverseMode == 1){
				if( F == 1){
					//S = addHeadChar(S,C);
					head.push_back(C);
				}else if (F == 2){
					//S = addTailChar(S,C);
					tail.push_back(C);
				}
			}else if(reverseMode == -1){
				if( F == 2){
					//S = addHeadChar(S,C);
					head.push_back(C);
				}else if (F == 1){
					//S = addTailChar(S,C);
					tail.push_back(C);
				}
			}
		}
	}
	reverse(head.begin(),head.end());
	S = head + S + tail;
	if(reverseMode == -1){
		reverse(S.begin(),S.end());
	}
	cout<<S<<endl;
	
	return 0;
}



Measured memory_bytes: 1348
#include <bits/stdc++.h>
#define be(v) (v).begin(),(v).end()
#define pb(q) push_back(q)
typedef long long ll;
using namespace std;
const ll mod=1000000007, INF=mod*mod*3LL;
#define doublecout(a) cout<<fixed<<setprecision(10)<<a<<endl;


int solve(int i, int j, int d){
	i %= (d * 2);
	j %= (d * 2);
	int ret = 0;
	if(i >= d) i -= d, ret ^= 1;
	if(j >= d) j -= d, ret ^= 1;
	if(i + j < d / 2 - 1 || i + j >= d * 3 / 2 - 1) ret ^= 0;
	else if(j - i > d / 2 || i - j >= d / 2) ret ^= 1;
	else ret ^= 2;
	return ret;
}
int main() {
    cin.tie(0);
    cout.tie(0);
    ios::sync_with_stdio(false);
    int h, w, d;
    cin >> h >> w >> d;
    string t = "RYGB";
    string s;
    if(d & 1){
    	for(int i=0;i<h;i++){
    		s = "";
    		for(int j=0;j<w;j++){
    			s += t[(i & 1) * 2 + (j & 1)];
    		}
    		cout << s << endl;
    	}
    	return 0;
    }
    for(int i=0;i<h;i++){
    	s = "";
    	for(int j=0;j<w;j++){
    		s += t[solve(i, j, d)];
    	}
    	cout << s << endl;
    }
    return 0;
}


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


#define li          long long int
#define rep(i,to)   for(li i=0;i<((li)(to));i++)
#define repp(i,start,to)    for(li i=(li)(start);i<((li)(to));i++)
#define pb          push_back
#define sz(v)       ((li)(v).size())
#define bgn(v)      ((v).begin())
#define eend(v)     ((v).end())
#define allof(v)    (v).begin(), (v).end()
#define dodp(v,n)       memset(v,(li)n,sizeof(v))
#define bit(n)      (1ll<<(li)(n))
#define mp(a,b)     make_pair(a,b)
#define rin rep(i,n)
#define EPS 1e-12
#define ETOL 1e-8
#define MOD 1000000007
typedef pair<li, li> PI;

#define INF bit(60)

#define DBGP 1


#define idp if(DBGP)
#define F first
#define S second
#define p2(a,b)     idp cout<<a<<"\t"<<b<<endl
#define p3(a,b,c)       idp cout<<a<<"\t"<<b<<"\t"<<c<<endl
#define p4(a,b,c,d)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<endl
#define p5(a,b,c,d,e)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<endl
#define p6(a,b,c,d,e,f)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<endl
#define p7(a,b,c,d,e,f,g)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<endl
#define p8(a,b,c,d,e,f,g,h)     idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<endl
#define p9(a,b,c,d,e,f,g,h,i)       idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<endl
#define p10(a,b,c,d,e,f,g,h,i,j)        idp cout<<a<<"\t"<<b<<"\t"<<c<<"\t"<<d<<"\t"<<e<<"\t"<<f<<"\t"<<g<<"\t"<<h<<"\t"<<i<<"\t"<<j<<endl
#define foreach(it,v)   for(__typeof((v).begin()) it=(v).begin(); it!=(v).end(); ++it)
#define p2p(x)      idp p2((x).F, (x).S)
#define dump(x,n)   idp{rep(i,n){cout<<x[i]<<" ";}puts("");}
#define dump2(x,n)  idp{rep(i,n){cout<<"["<<x[i].F<<" , "<<x[i].S<<"] ";}puts("");}
#define dumpi(x)    idp{foreach(it, x){cout<<(*it)<<" ";}puts("");}
#define dumpi2(x)   idp{foreach(it, x){cout<<"["<<(it)->F<<" , "<<(it)->S<<"] ";}puts("");}

#define read2d(a,w,h)   rep(i,h)rep(j,w)cin>>a[i][j]
#define dump2d(a,w,h)   rep(i,h){rep(j,w)cout<<a[i][j]<<" ";puts("");}

typedef pair<li, li> PI;



int main() {
    li a;
    double b;
    cin >> a >> b;
    li bb = (b+EPS) * 100;
    cout << (li)(bb * a / 100) << endl;

    return 0;
}

Measured memory_bytes: 3700
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <utility>
#include <algorithm>
#include <cmath>
#include <climits>
#include <iomanip>
#include <queue>
#include <stack>

using namespace std;

typedef long long ll;

ll mod = 998244353;

int main() {
    int n, k;  cin >> n >> k;
    vector<ll> l(k), r(k);
    for (int i = 0; i < k; i++)
        cin >> l[i] >> r[i];

    vector<ll> f(n, 0), sum(n+1, 0);
    f[0] = 1;
    sum[1] = 1;
    for (int i = 1; i < n; i++) {
        for (int j = 0; j < k; j++) {
            int p = max(i-r[j], (ll)0), q = max(i-l[j]+1, (ll)0);
                f[i] = (f[i] + sum[q] - sum[p] + mod) % mod;
        }
        sum[i+1] = (sum[i] + f[i]) % mod;
    }

    cout << f[n-1] << endl;
    return 0;
}

//小数点精度
//cout << fixed << std::setprecision(15) << y << endl;

Measured memory_bytes: 6388
#include"bits/stdc++.h"
using namespace std;
using ll=long long;
template<typename T=ll>inline T in(istream&is=cin){T ret;is>>ret;return ret;}
template<typename T>inline auto vec2(typename vector<T>::size_type h,typename vector<T>::size_type w,T v=T()){return vector<vector<T>>(h,vector<T>(w,v));}

class mod_int{
private:
    unsigned long long num;
public:
    static constexpr auto mod=static_cast<unsigned long long>(1e9+7);
    static mod_int pow(mod_int x,unsigned long long y)
    {
        return y==0?1:y%2==0?pow(x*x,y/2):x*pow(x,y-1);
    }
    mod_int()=default;
    mod_int(unsigned long long n):num(n%mod)
    {
    }
    explicit operator unsigned long long()const
    {
        return num;
    }
    bool operator==(const mod_int&mi)const
    {
        return num==mi.num;
    }
    bool operator!=(const mod_int&mi)const
    {
        return !operator==(mi);
    }
    mod_int operator~()const
    {
        return pow(*this,mod-2);
    }
    mod_int operator+(const mod_int&mi)const
    {
        return num+mi.num;
    }
    mod_int operator-(const mod_int&mi)const
    {
        return num+mod-mi.num;
    }
    mod_int operator*(const mod_int&mi)const
    {
        return num*mi.num;
    }
    mod_int operator/(const mod_int&mi)const
    {
        return num*(~mi).num;
    }
    mod_int&operator+=(const mod_int&mi)
    {
        return*this=operator+(mi);
    }
    mod_int&operator-=(const mod_int&mi)
    {
        return*this=operator-(mi);
    }
    mod_int&operator*=(const mod_int&mi)
    {
        return*this=operator*(mi);
    }
    mod_int&operator/=(const mod_int&mi)
    {
        return*this=operator/(mi);
    }
};

int main()
{
    ll n=in(),a=in(),b=in();

    mod_int nca=1,fac_a=1;
    for(int i=0;i<a;++i){
        nca*=n-a+1+i;
        fac_a*=i+1;
    }
    nca/=fac_a;

    mod_int ncb=1,fac_b=1;
    for(int i=0;i<b;++i){
        ncb*=n-b+1+i;
        fac_b*=i+1;
    }
    ncb/=fac_b;
    
    cout<<static_cast<unsigned long long>(mod_int::pow(2,n)-1-nca-ncb)<<endl;
}


Measured memory_bytes: 256
#include<stdio.h>
int main(void){
	int a[100][100],b[100],c[100]={0},n,m,i,j,k;
	scanf("%d %d",&n,&m);
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			scanf("%d",&a[i][j]);
		}
	}
	for(k=0;k<m;k++){
		scanf("%d",&b[k]);
	}
	for(i=0;i<n;i++){
		for(j=0;j<m;j++){
			c[i]+=a[i][j]*b[j];
		}
	}
	for(k=0;k<n;k++){
		printf("%d\n",c[k]);
	}
	return 0;
}

Measured memory_bytes: 640
//Lunlun Number

#include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define int long long
#define rep(i,x,y) for(ll i=x;i<y;i++)
#define nvarep(n,a) ll n;cin>>n;vector<ll>a(n);rep(i,0,n)cin>>a[i]
#define vecrep(n,a,type) vector<type>a(n);rep(i,0,n)cin>>a[i]
#define lcm(a,b) (a/__gcd(a, b)*b)
#define range(a) (a).begin(),(a).end() 
#define pb push_back
#define mp make_pair
#define nnn "\n"
#define spa " "
using p = pair<ll, string>;
using graph = vector<vector<ll>>;
const int inf = 2147483647;//2*10^9
const ll INF = 9223372036854775807;//9*10^18

vector<int>a;

void dfs(string s){
    if(s.size()>10)return;
    int n = s.size();
    rep(i,(s[n-1]=='0'?0:-1),(s[n-1]=='9'?1:2)){
        string t = s;
        t.pb(s[n-1]+i);
        a.pb(stoll(t));
        dfs(t);
    }
}
signed main (){
    rep(i,1,10){
        a.pb(i);
        dfs(to_string(i));
    }
    sort(range(a));
    int k;cin>>k;
    cout<<a[k-1]<<nnn;
    return 0;
}

Measured memory_bytes: 11516
using System;
using System.Text;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using static System.Console;
using static System.Math;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            new Program().Solve(new ConsoleInput(Console.In, ' '));
#if DEBUG
            ReadLine();
#endif
        }

        void Solve(ConsoleInput cin)
        {
            int n = cin.ReadInt;
            int k = cin.ReadInt;
            List<int> h = new List<int>();

            for (int i = 0; i < n; i++)
            {
                h.Add(cin.ReadInt);
            }

            h.Sort();
            int diff = int.MaxValue;

            for (int i = 0; i < n - k + 1; i++)
            {
                int tmp = h[i + k - 1] - h[i];
                if (diff > tmp)
                {
                    diff = tmp;
                }

                if(diff == 0)
                {
                    break;
                }
            }

            Console.WriteLine(diff);
        }

        class ConsoleInput
        {
            private readonly System.IO.TextReader _stream;
            private char _separator = ' ';
            private Queue<string> inputStream;

            public ConsoleInput(System.IO.TextReader stream, char separator = ' ')
            {
                this._separator = separator;
                this._stream = stream;
                inputStream = new Queue<string>();
            }

            public string Read
            {
                get
                {
                    if (inputStream.Count != 0) return inputStream.Dequeue();
                    string[] tmp = _stream.ReadLine().Split(_separator);
                    for (int i = 0; i < tmp.Length; ++i)
                        inputStream.Enqueue(tmp[i]);
                    return inputStream.Dequeue();
                }
            }

            public string ReadLine { get { return _stream.ReadLine(); } }
            public int ReadInt { get { return int.Parse(Read); } }
            public long ReadLong { get { return long.Parse(Read); } }
            public double ReadDouble { get { return double.Parse(Read); } }
            public string[] ReadStrArray(long N) { var ret = new string[N]; for (long i = 0; i < N; ++i) ret[i] = Read; return ret; }
            public int[] ReadIntArray(long N) { var ret = new int[N]; for (long i = 0; i < N; ++i) ret[i] = ReadInt; return ret; }
            public long[] ReadLongArray(long N) { var ret = new long[N]; for (long i = 0; i < N; ++i) ret[i] = ReadLong; return ret; }
        }
    }
}


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

#define NIL -1
#define MAX 500001

typedef struct{
  int right;
  int left;
  int key;
} Node;

void Insert(Node*,int,int);
void PreOrder(Node*,int);
void InOrder(Node*,int);

int main(void){
  int i, n, k, count=0;
  char state[8];
  Node T[MAX];

  scanf("%d", &n);
  for(i = 0; i < n; i++){
    scanf("%s", state);

    if(state[0] == 'i'){

      scanf("%d",&k);
      Insert(T, count, k);
      count++;

    } else if(state[0] == 'p'){

      if(count > 0){
        InOrder(T,0);
        printf("\n");
        PreOrder(T,0);
        printf("\n");
      }

    }
  }
  return 0;
}

void Insert(Node *T,int count, int k){
  int x, y;

  T[count].key = k;
  T[count].left = NIL;
  T[count].right = NIL;

  if(count == 0) return;

  x = 0;
  while(x!=NIL){
    y = x;

    if(k < T[x].key) x = T[x].left;
    else x = T[x].right;

  }

  if(k < T[y].key) T[y].left = count;
  else T[y].right = count;

  return;
}

void PreOrder(Node *T, int u){

  if(u == NIL) return;

  printf(" %d", T[u].key);
  PreOrder(T, T[u].left);
  PreOrder(T, T[u].right);

  return;
}

void InOrder(Node *T, int u){

  if(u == NIL) return;

  InOrder(T, T[u].left);
  printf(" %d", T[u].key);
  InOrder(T, T[u].right);

  return;
}

Measured memory_bytes: 6460
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <functional>
#include <math.h>
#include <stdlib.h>
#include <map>
#include <deque>
#include <list>
#include <sys/timeb.h>
#include <fstream>
#include <set>

using namespace std;

#define repr(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define rep(i,n) repr(i,0,n)
#define reprrev(i,a,b) for(int i=(int)(b)-1;i>=(int)(a);i--)
#define reprev(i,n) reprrev(i,0,n)
#define repi(itr,ds) for(auto itr=ds.begin();itr!=ds.end();itr++)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define mp make_pair
#define mt make_tuple
#define INF 1050000000
#define INFL 1100000000000000000LL
#define EPS (1e-10)
#define MOD 1000000007
#define PI 3.1415926536
#define RMAX 4294967295

typedef long long ll;
typedef pair<int, int> Pi;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<char> vc;
typedef vector<string> vs;
typedef vector<double> vd;
typedef vector<Pi> vPi;
typedef vector<vector<int> > vvi;
typedef vector<vector<bool> > vvb;
typedef vector<vector<ll> > vvll;
typedef vector<vector<char> > vvc;
typedef vector<vector<string> > vvs;
typedef vector<vector<double> > vvd;
typedef vector<vector<Pi> > vvPi;
typedef priority_queue<int, vector<int>, greater<int> > pqli;
typedef priority_queue<ll, vector<ll>, greater<ll> > pqlll;
typedef priority_queue<Pi, vector<Pi>, greater<Pi> > pqlP;
struct Edge {
	int from, to, cost;
	bool operator<(Edge e) {
		return cost < e.cost;
	}
};
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;
template <class T>
using vec = vector<T>;
template<class T>
using pql = priority_queue<T, vector<T>, greater<T>>;
string debug_show(Pi a) {
	return "(" + to_string(a.first) + "," + to_string(a.second) + ")";
}

template<class T>
struct augEdge {
	T from, to;
	int cost;
	bool operator<(augEdge e) { return cost < e.cost; }
	bool operator>(augEdge e) { return cost > e.cost; }
};
template<class T>
using augGraph = vector<augEdge<T>>;


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

	int a, b;
	cin >> a >> b;
	int ans = a*b / 2;
	cout << ans << endl;

	return 0;
}



Measured memory_bytes: 256
"""
AtCoder :: Beginner Contest 174 :: Repsept
https://atcoder.jp/contests/abc174/tasks/abc174_c
"""
import sys


def get_multiplier(d, p):
    for m in range(0, 10):
        if (d * m) % 10 == p:
            return m
    return - 1


def solve(K):
    soln = 0
    t = 0
    d = K % 10
    m = get_multiplier(d, 7)
    if m == -1:
        return -1
    t = t + (K * m)
    while t % 10 == 7:
        t //= 10
        soln += 1
    while(t):
        p = 7 - (t % 10)
        if p < 0:
            p = 17 - (t % 10)
        m = get_multiplier(d, p)
        if m == -1:
            return -1
        t += (m * K)
        while t % 10 == 7:
            t //= 10
            soln += 1
    return soln


def main():
    """Main program."""
    K = int(sys.stdin.readline())
    print(solve(K))


if __name__ == '__main__':
    main()


Measured memory_bytes: 9216
#include <iostream>
#include <string>
#include <set>
using namespace std;         
int main() {
  int N;
  cin >> N;
  string S[N];
  set<string> st;
  for (int i = 0; i < N; ++i) {
    cin >> S[i];
    st.insert(S[i]);
  }
  cout << st.size() << endl;
}

Measured memory_bytes: 25400
#include<iostream>

using namespace std;

int main()
{
    int A, B, C, X, co, cnt;
    cin >> A >> B >> C >> X;
    cnt = 0;
    for(int i=0; i<=A; i++){
        for(int j=0; j<=B; j++){
            for(int k=0; k<=C; k++){
                co = 500*i + 100*j + 50*k;
                if(co == X){
                    cnt++;
                }
            }
        }
    }
    cout << cnt;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <iostream>
#define Re register int

int N,K,A[105],f[100005];

template <typename T> inline void read(T &var)
{
	T x=0; int w=0; char ch=0;
	while (!isdigit(ch)) w|=ch=='-',ch=getchar();
	while (isdigit(ch)) x=(x<<1)+(x<<3)+(ch^48),ch=getchar();
	var=w?-x:x;
}
int main(int argc, char const *argv[])
{
	read(N),read(K);
	for (Re i=1; i<=N; ++i) read(A[i]);
	for (Re i=1; i<=K; ++i)
		for (Re j=1; j<=N; ++j)
			if (i-A[j]>=0) f[i]|=f[i-A[j]]^1;
	printf("%s\n",f[K]?"First":"Second");
	return 0;
}

Measured memory_bytes: 640
import java.io.IOException;
import java.io.InputStream;
import java.util.*;

public class Main {

    public static void main(String[] args) {
        FastScanner fs = new FastScanner();
        int N = fs.nextInt();
        int Y = fs.nextInt();

        for (int i = 0; i <= N; ++i) {
            for (int j = 0; j <= N-i; ++j) {
                int k = N - i - j;
                int total = 10000*i + 5000*j + 1000*k;
                if (k >= 0 && total == Y) {
                    System.out.println(i + " " + j + " " + k);
                    System.exit(0);
                }
            }
        }

        System.out.println(-1 + " " + -1 + " " + -1);
    }
}

class FastScanner {
    private final InputStream in = System.in;
    private final byte[] buffer = new byte[1024];
    private int ptr = 0;
    private int buflen = 0;

    private boolean hasNextByte() {
        if (ptr < buflen) {
            return true;
        }else{
            ptr = 0;
            try {
                buflen = in.read(buffer);
            } catch (IOException e) {
                e.printStackTrace();
            }
            if (buflen <= 0) {
                return false;
            }
        }
        return true;
    }

    private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1;}
    private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126;}
    public boolean hasNext() { while(hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte();}

    public String next() {
        if (!hasNext()) throw new NoSuchElementException();
        StringBuilder sb = new StringBuilder();
        int b = readByte();
        while(isPrintableChar(b)) {
            sb.appendCodePoint(b);
            b = readByte();
        }
        return sb.toString();
    }

    public long nextLong() {
        if (!hasNext()) throw new NoSuchElementException();
        long n = 0;
        boolean minus = false;
        int b = readByte();
        if (b == '-') {
            minus = true;
            b = readByte();
        }
        if (b < '0' || '9' < b) {
            throw new NumberFormatException();
        }
        while(true){
            if ('0' <= b && b <= '9') {
                n *= 10;
                n += b - '0';
            }else if(b == -1 || !isPrintableChar(b)){
                return minus ? -n : n;
            }else{
                throw new NumberFormatException();
            }
            b = readByte();
        }
    }

    public int nextInt() {
        long nl = nextLong();
        if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException();
        return (int) nl;
    }

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




Measured memory_bytes: 37128
#include <bits/stdc++.h>
using namespace std;
 
#define REP(i, a, b) for(int i = (a); i <= (b); i++)
#define PER(i, a, b) for(int i = (a); i >= (b); i--)
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define all(S) (S).begin(), (S).end()
#define pf push_front
#define pb push_back
#define mk make_pair
#define S second
#define F first
typedef long long ll;
typedef long double lf;
typedef pair<int, ll> il;
const int MAX = 3e3+3;
char a[MAX], b[MAX];
int pd[MAX][MAX];
string s;

string solve() {
	int N = strlen(a);
	int M = strlen(b);
	REP(i, 1, N) REP(j, 1, M) {
		pd[i][j] = max(pd[i-1][j], pd[i][j-1]);
		if(a[i-1] == b[j-1]) pd[i][j] = pd[i-1][j-1] + 1;
	}
	int i = N, j = M;
	while(i >= 1 && j >= 1) {
		if(a[i-1] == b[j-1]) s.pb(a[i-1]), i--, j--;
		else if(pd[i-1][j] > pd[i][j-1]) i--;
		else j--;
	}
	reverse(all(s));
	return s;
}

int main(int argc, char *argv[]) {
	scanf("%s %s", a, b);
	printf("%s\n", solve().c_str());
	return 0;
}


Measured memory_bytes: 35456
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;

int main()
{
    ll N;
    cin >> N;
    vector<ll> A(N);
    
    for(ll i = 0; i < N; i++)
    {
        ll tmp;
        cin >> tmp;
        tmp -= i+1;
        A[i] = tmp;
    }

    sort(A.begin(),A.end());
    ll middle = A[N / 2];
    ll ans = 0;

    for(ll i = 0; i < N; i++)
    {
        ans += abs(middle - A[i]);
    }
    
    cout << ans << endl;

}

Measured memory_bytes: 1792
#include <stdio.h>
int main()
{
  int y,m,d;
  while((scanf("%d%d%d",&y,&m,&d))!=EOF){
    if(y < 1868 || y == 1868 && m < 9 || y == 1868 && m == 9 && d < 8)
      printf("pre-meiji\n");
    else if(y < 1912 || y == 1912 && m < 7 || y == 1912 && m == 7 && d < 30)
      printf("meiji %d %d %d\n", y-1867,m,d);
    else if(y < 1926 || y == 1926 && m < 12 || y == 1926 && m == 12 && d < 25)
      printf("taisho %d %d %d\n", y-1911,m,d);
    else if(y < 1989 || y == 1989 && m == 1 && d < 8)
      printf("showa %d %d %d\n", y-1925,m,d);
    else
      printf("heisei %d %d %d\n",y-1988,m,d);
  }
  return 0;
}

Measured memory_bytes: 0
#include <iostream>
#include <vector>
using namespace std;
int n,dmax;
int m[300];

bool visited[300];
bool isVisit[300];
bool isGoal;
void dfs(int p){
  if(visited[p])return ;
  visited[p] = true;
  isVisit[p] = true;
  if(p == n+1){
    isGoal = true;
    return;
  }
  for(int i = 1; i <= dmax && p+i <= n+1; i++){
    int np = p+i;
    if(np > n + 1)np = n + 1;
    if(np < 0)np = 0;

    np = np + m[np];
    if(np > n + 1)np = n + 1;
    if(np < 0) np = 0;
  
    dfs(np);
  }
}
void solve(){
  fill(isVisit, isVisit+300, false);
  isVisit[0] = true;
  for(int i = 0 ; i <= n; i++){
    if(!isVisit[i])continue;
    isGoal = false;
    fill(visited, visited+300, false);
    dfs(i);
    if(!isGoal){
      break;
    }
  }
  cout << (isGoal?"OK":"NG") << endl;
}
int main(){
  while( cin >> dmax, dmax ){
    cin >> n;
    fill(m, m+300, 0);
    for(int i = 0 ; i < n ;i++){
      cin >> m[i+1];
    }
    solve();
  }
  
  return 0;
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using VI = vector<int>;
using VL = vector<ll>;
#define FOR(i,a,n) for(int (i)=(a);(i)<(n);(i)++)
#define eFOR(i,a,n) for(int (i)=(a);(i)<=(n);(i)++)
#define rFOR(i,a,n) for(int (i)=(n)-1;(i)>=(a);(i)--)
#define erFOR(i,a,n) for(int (i)=(n);(i)>=(a);(i)--)
#define SORT(i) sort((i).begin(),(i).end())
#define rSORT(i,a) sort((i).begin(),(i).end(),(a))
#define all(i) (i).begin(),(i).end()
constexpr ll INF = 1000000000;
constexpr ll LLINF = 1LL << 60;
constexpr ll mod = 1000000007;
constexpr ll MOD = 998244353;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; }return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; }return 0; }
inline void init() { cin.tie(nullptr); cout.tie(nullptr); cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(15); }

class BIT {
    int size;
    VL dat;
public:
    void init(int in) {
        size = in;
        dat.clear();
        dat.resize(size, 0);
    }
    ll sum(int i) {
        ll ret = 0;
        while (i >= 0) {
            ret += dat[i];
            i = (i & (i + 1)) - 1;
        }
        return ret;
    }
    void add(int i, ll x) {
        while (i <= size) {
            dat[i] += x;
            i |= i + 1;
        }
    }
};

int main() {
    int n;
    cin >> n;
    VI a(n), sorted(n);
    FOR(i, 0, n) {
        cin >> a[i];
        sorted[i] = a[i];
    }
    SORT(sorted);
    int ok = 0, ng = n;
    BIT bit;

    ll border = (((ll)n * (n + 1) / 2) + 1) / 2;
    while (ng - ok > 1) {
        int mid = (ng + ok) / 2;
        int midnum = sorted[mid];
        bit.init(2 * n + 1);
        int sum = 0;
        bit.add(sum + n, 1);
        ll result = 0;
        FOR(i, 0, n) {
            sum += (a[i] >= midnum ? 1 : -1);
            result += bit.sum(sum + n);
            bit.add(sum + n, 1);
        }
        if (result >= border)ok = mid;
        else ng = mid;
    }
    cout << sorted[ok] << endl;
}


Measured memory_bytes: 2688
N = int(input())
R = [tuple()] * N
for i in range(N):
    x, l = map(int, input().split())
    R[i] = (x-l, x+l)
R = sorted(R, key=lambda x: x[1])
res = 0
prev = -float('inf')
for l, r in R:
    if l >= prev:
        prev = r
        res += 1
print(res)


Measured memory_bytes: 18984
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <complex>
#include <iomanip>
#include <queue>
//定数
#define MOD 1000000007
//マクロ
#define rep(i,n)    for(int (i)=0;(i)<(n);(i)++)
#define reprev(i,n) for(int (i)=(n-1);(i)>=0;(i)--)
#define max3(a,b,c) max(a,max(b,c))
#define min3(a,b,c) min(a,min(b,c))

#define vsort(v) sort((v).begin(), (v).end());

typedef unsigned long long int ull;
typedef long long lint;

using namespace std;




int main(){
    int M, D;
    int d10, d1;
    int count=0;

    //入力
    cin >> M >> D;
    

    for(int i=2; i <= D; i++) {
        d10 = i/10;
        d1  = i%10;
        if(d10>=2 && d1>=2 && d1*d10 <= M) count++;
    }
    cout << count << endl;
    

    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
 int main(){
 int n,k,num_count=1;
 cin>>n>>k;
 while(n>=k){
   n/=k;
   num_count++;
 }
cout<<num_count<<endl;
 }

Measured memory_bytes: 256
#include<stdio.h>

int main(){

    int n;
    scanf("%d", &n);
    int S[n] = {0};
    for(int i=0; i<n; i++){
        scanf("%d", &S[i]);
    }
    int q;
    scanf("%d", &q);
    int T[q] = {0};
    for(int i=0; i<q; i++){
        scanf("%d", &T[i]);
    }

    int counter = 0;
    for(int i=0; i<q; i++){
        for(int j=0; j<n; j++){
            if(S[j]==T[i]) {
                counter++;
                break;
            }
        }
    }

    printf("%d\n", counter);
    return 0;
}


Measured memory_bytes: 2720
#include <stdio.h>
#include<math.h>
int i;
int j;
int k=2;
int a;
int max=1;
int main(){
scanf("%d",&i);
for(j=2;j<i;j++){
k=2;
while(1){
a=pow(j,k);
if(a>i)break;
if(max<a)max=a;
k++;
}
}
printf("%d",max);
}


Measured memory_bytes: 128
typedef long long LL;
LL modp(LL a,LL n,LL p){
	LL r=1;
	while(n>0){
		if(n%2)r=r*a%p;
		a=a*a%p;n/=2;
	}
	return r;
}

main(){
	LL a,b,c,d,ans=0,p=998244353,dp[2][3003],i,j,s;
	scanf("%ld%ld%ld%ld",&a,&b,&c,&d);
	for(i=0;i<c;i++)dp[0][i]=0;
	dp[0][a-1]=modp(b,(c-a),p);
	for(i=b;i<d;i++){
		s=0;
		for(j=a-1;j<c;j++){
			dp[1][j]=(dp[0][j]*(j+1)%p+s)%p*modp(modp(i,c-j-1,p),p-2,p)%p*modp(i+1,c-j-1,p)%p;
			s=(s+dp[0][j])%p;
		}
		for(j=a-1;j<c;j++)dp[0][j]=dp[1][j];
	}
	for(i=a-1;i<c;i++)ans=(ans+dp[0][i])%p;
	printf("%ld",ans);
}

Measured memory_bytes: 1736
#include <iostream>
#include <algorithm>
#include <functional>
#include <cmath>
#include <utility>
#include <tuple>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <queue>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef vector<vector<int>> vvi;
#define rep(i,n) for (int i=0;i<n;i++)

ll mod = 1e9+7;

//約数列挙
vector<int> div(int a){
    vector<int> x;
    for (int i=1;i<=sqrt(a);i++){
        if (a%i==0){
            if (i*i==a) x.push_back(i);
            else{
                x.push_back(i);
                x.push_back(a/i);
            }
        }
    }
    return x;
}

//最大公約数
int gcd(int a,int b){
    if (a<b) swap(a,b);
    if (b==0) return a;
    else gcd(b,a%b);
    return 0;
}

//階乗
ll fact(ll a){
    if (a==1) return a;
    return (a*fact(a-1))%mod;
}

int main(){
    int n,k;
    cin >> n >> k;
    vector<int> x(n);
    rep(i,n){
        cin >> x[i];
    }
    ll ans = INT64_MAX;
    if (n-k>0){
        rep(i,n-k+1){
            ll len = min(abs(x[i]),abs(x[i+k-1]));
            if (x[i]<0 && x[i+k-1]>0) len += abs(x[i])+x[i+k-1];
            else len += abs(x[i+k-1]-x[i]);
            ans = min(ans,len);
        }
    } else {
        ans = min(abs(x[0]),abs(x[n-1]));
        if (x[0]<0 && x[n-1]>0) ans += abs(x[0])+x[n-1];
        else ans += abs(x[n-1]-x[0]);
    }
    cout << ans << endl;
    return 0;
}

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

signed main(){
    string a,s,c;
    cin >> a >> s >> c;
    cout << "A" << s[0] << "C" << endl;
}

Measured memory_bytes: 256
#include<stdio.h>
int main()
{
	int t,n,i;
	for(i=0;i<4;i++){
		scanf("%d%d",&t,&n);
		switch(t){
		case 1:
			printf("%d\n",6000*n);
			break;
		case 2:
			printf("%d\n",4000*n);
			break;
		case 3:
			printf("%d\n",3000*n);
			break;
		default:
			printf("%d\n",2000*n);
		}
	}
	return 0;
}

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

using namespace std;
typedef long long ll;
typedef long int li;
typedef long double lb;
#define rep(i,j,n) for (ll i = j; i < (n); i++)
#define repr(i,j,n) for(ll i = j; i >= (n); i--)
#define all(x) (x).begin(),(x).end()
#define CLR(mat,f) memset(mat, f, sizeof(mat))
#define IN(a, b, x) (a<=x&&x<b)
#define out(ans) cout << ans << endl
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
typedef pair<ll,ll>P;
const ll mod=1e9+7;
const ll INF = 1LL<<60;

int main(){

  ll w,h;cin>>w>>h;
  ll x,y,r;cin>>x>>y>>r;
  if(IN(0,w+1,x+r)&&IN(0,w+1,x-r)&&IN(0,h+1,y+r)&&IN(0,h+1,y-r))out("Yes");
  else out("No");


  return 0;
}



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

using ll = long long;

int main(){
	ll ans = 0;
	int N;cin >> N;
	int H,W;cin >> H >> W;
	for(int i = 0;i < N;i++){
		int X,Y;cin >> X >> Y;
		if(X >= H && Y >= W)ans++;
	}
	cout<<ans<<endl;
}

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

const int MOD = 1e9 + 7;

int main() {
    // freopen("input.txt", "r", stdin);

    int W, H;
    cin >> H >> W;

    int ways = 0;
    vector<vector<int>> grid(H + 1, vector<int>(W + 1, 0));
    grid[0][1] = 1;

    for (int i = 1; i <= H; i++) {
        for (int j = 1; j <= W; j++) {
            char c;
            cin >> c;
            if (c == '#') {
                grid[i][j] = 0;
            } else {
                grid[i][j] = grid[i - 1][j] + grid[i][j - 1];
                if (grid[i][j] > MOD)
                    grid[i][j] -= MOD;
            }
        }
    }

    int ans = grid[H][W];
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 4224
#include <bits/stdc++.h>
using namespace std;
 
int main(){
  long long int n;
  cin >> n;
  long long int k=0;
  for(long long int i=1; i<100000; i++){
    k += i;
    if(n<=k){
      cout << i << endl;
      break;
    }
  }
  return 0;
}

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

  
int main() {
  int N;
  string S;
  cin >> N >>S;
  int m= S.size();
 string al = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
  for(int i=0;i<m;i++){
    for(int j=0;j<26;j++){
	if (S[i] == al[j]) {
     if(j + N >= 26){
       cout <<al[j+N-26];
    }
     else{
       cout <<al[j+N];
     }
    }
  }
  }
}

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

int main() {
  int m, f, r;

  for (int i = 0; i < 50 ; i++) {
    cin >> m >> f >> r;
    if(m == -1 && f == -1 && r == -1){
      break;
    }
    if(m == -1 || f == -1){
      cout << "F" << endl;
      continue;
    }

    if(m+f >= 80){
      cout << "A" << endl;
      continue;
    }

    if(m+f >= 65 && m+f < 80){
      cout << "B" << endl;
      continue;
    }

    if(m+f >= 50 && m+f < 65){
      cout << "C" << endl;
      continue;
    }

    if(m+f >= 30 && m+f < 50){
      if(r >= 50){
        cout << "C" << endl;
        continue;
      }else{
        cout << "D" << endl;
        continue;
      }
    }

    if(m+f < 30){
      cout << "F" << endl;
      continue;
    }
  }
}



Measured memory_bytes: 3096