akhauriyash/Code-Regression huggingface dataset:
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i = 0; i < (int)n; i++)
using ll = long long;

int main(){
  int n;
  cin >> n;
  string s, t;
  cin >> s >> t;
  string ans = "";
  rep(i,n) {
    ans += s[i];
    ans += t[i];
  }
  cout << ans << endl;
  return 0;
}

Measured memory_bytes: 256
import queue
import numpy as np
import math

n = int(input())
A = list(map(int, input().split()))
A = np.array(A,np.int64)
ans = 0

for i in range(60 + 1):
    a = (A >> i) & 1
    count1 = np.count_nonzero(a)
    count0 = len(A) - count1
    ans += count1*count0 * pow(2, i)
    ans%=1000000007

print(ans)

Measured memory_bytes: 68652
#include <iostream>
#include <algorithm>
// in a knapsack problem, when the storage is a limited integer,
// it's a good idea to have a 2-d array to store the maximum value.

using namespace std;
int main(){
  int n, weight, i, j;
  cin >> n >> weight;
  int v[n], w[n];
  for (i = 0; i < n; ++i){
    cin >> v[i] >> w[i];
  }
  int maxvalue[n][weight+1];

  for (i = 0; i < n; ++i){
    for (j = 0; j <= weight; ++j){
      maxvalue[i][j] = 0;
    }
  }

  for (i = 0; i < n; ++i){
    for (j = 0; j <= weight; ++j){
      if(i == 0 && j == 0){
        maxvalue[i][j] = 0;
      }else{
        if(i == 0){
          if(j < w[i]){
            maxvalue[i][j] = 0;
          }else{
            maxvalue[i][j] = v[i];
          }
        }else{
          if(j < w[i]){
            maxvalue[i][j] = maxvalue[i-1][j];
          }else{
            maxvalue[i][j] = max(maxvalue[i-1][j], v[i]+maxvalue[i-1][j-w[i]]);
          }         
        }
      }
    }  
  }

  cout << maxvalue[n-1][weight] << endl;

}

Measured memory_bytes: 5068
#include <iostream>
#include <math.h>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
using namespace std;
int main(){
  int N,M;
  cin>>N>>M;
  long long H[100001];
  int judge[100001];
  for(int i=1;i<=N;i++){
    cin>>H[i];
    judge[i]=0;
  }
  for(int i=0;i<M;i++){
    int a,b;
    cin>>a>>b;
    if(H[a]>=H[b]) judge[b]++;
    if(H[a]<=H[b]) judge[a]++;
  }
  int answer=0;
  for(int i=1;i<=N;i++){
    if(judge[i]==0) answer++;
  }
  cout<<answer<<endl;
  
  return 0;
}

Measured memory_bytes: 4808
#include <bits/stdc++.h>
#define rep(i,n)for(int i=0;i<(n);i++)
#define INF 0x3f3f3f3f
#define INFL 0x3f3f3f3f3f3f3f3f
#define MOD 1000000007
using namespace std;
typedef long long ll;
typedef pair<int,int>P;

int a[200000];
P p[200000];
int b[200000],c[200000];
int main(){
	int n,m;cin>>n>>m;
	rep(i,n){
		scanf("%d",&a[i]);
	}
	rep(i,m){
		scanf("%d%d",&b[i],&c[i]);
		p[i]=P(b[i],c[i]);
	}
	sort(p,p+m,[](P a,P b){return a.second>b.second;});
	priority_queue<int,vector<int>,greater<int>>que;
	rep(i,n){
		que.push(a[i]);
	}
	rep(i,m){
		rep(j,p[i].first){
			if(que.top()>=p[i].second)break;
			//~ int p=que.top();que.pop();
			que.pop();
			que.push(p[i].second);
		}
	}
	ll sum=0;
	while(!que.empty()){
		sum+=que.top();
		que.pop();
	}
	cout<<sum<<endl;
}

Measured memory_bytes: 2812
from numba import njit
import numpy as np
import heapq
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF=1<<18

@njit(cache=True)
def pos(W,h,w):
    return h * W + w


# @njit(cache=True)
def solve(H,W,Ch,Cw,Dh,Dw,G):
    Ch-=1
    Cw-=1
    Dh-=1
    Dw-=1

    s = (Ch,Cw)
    t = (Dh,Dw)

    hq = [(0,s)]
    heapq.heapify(hq)
    
    dist = [INF] *(H*W) # sからxでの最短距離
    dist[pos(W,*s)] = 0
    while hq: 
        d,x = heapq.heappop(hq) # sからxまでの最短経路を探索する
        if dist[pos(W,*x)] < d: continue

        h,w = x
        normal = set([(h-1,w),(h+1,w),(h,w+1),(h,w-1)])
        for dh in range(-2,3):
            for dw in range(-2,3):
                new_h,new_w = h+dh,w+dw
                e = (new_h,new_w)
                cost = 1

                if dh == 0 and dw == 0: continue
                if not (0<=new_h<H and 0<=new_w<W): continue
                if G[pos(W,*e)] == 1:  continue
                if e in normal:
                    cost -= 1
                
                if dist[pos(W,*e)] > dist[pos(W,*x)] + cost:
                    dist[pos(W,*e)] = dist[pos(W,*x)] + cost
                    heapq.heappush(hq,(dist[pos(W,*e)],e))

    # print(dist)
    if dist[pos(W,*t)] == INF: 
        dist[pos(W,*t)] = -1
        
    return dist[pos(W,*t)]



def main():
    H,W=mi()
    Ch,Cw=mi()
    Dh,Dw=mi()

    G = [0] * H*W
    for i in range(H):
        g = []
        for j,s in enumerate(list(input())):
            G[i*W+j] = s == "#"

    ans = solve(H,W,Ch,Cw,Dh,Dw,np.array(G))
    print(ans)

def cc_export():
    from numba.pycc import CC
    cc = CC('my_module')

    # basic types: https://numba.pydata.org/numba-doc/0.13/types.html
    cc.export('pos', '(i8,i8,i8,)')(pos)
    cc.export('solve', '(i8,i8,i8,i8,i8,i8,b1[:],)')(solve)
    cc.compile()

if __name__ == '__main__':
    try:
        from my_module import solve
        from my_module import pos
    except:
        cc_export()
        exit()

    main()

Measured memory_bytes: 108448
#include<iostream>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
#include<stack>
#include<cmath>
#include<iomanip>
#include<set>
#include<numeric>
#include<sstream>
#include<random>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < n; ++i)
#define rrep(i, st, n) for (int i = st; i < n; ++i)
using pii = pair<int, int>;
const int inf = 1e9 + 7;
int dy[] = {0, 0, -1, 1, -1, 1, -1, 1};
int dx[] = {1, -1, 0, 0, -1, 1, 1, -1};

int main() {
    int a, b, c; cin >> a >> b >> c;
    if (b - a == c - b) cout << "YES" << endl;
    else cout << "NO" << endl;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int sosuu[100]={11,31,41,61,71,101,131,151,181,191,211,241,251,271,281,311,331,401,421,431,461,491,521,541,571,601,631,641,661,691,701,751,761,811,821,881,911,941,971,991,1021,1031,1051,1061,1091,1151,1171,1181,1201,1231,1291,1301,1321,1361,1381};
int main(){ int n;cin>>n;for(int i=0;i<n;i++){cout<<sosuu[i]<<" "; }cout<<endl;return 0;}


Measured memory_bytes: 256
#include <stdio.h>
#include <math.h>

int main(){
    int x, p, tmp=0, max=0;
    
    scanf("%d", &x);
    
    if( x <= 3 ){ printf("1\n"); return 0; }
    
    //31^2=961
    for(int b=2; b<=31; b++){
        p=2;
        while( (int)pow(b,p) <= x ){
            tmp = (int)pow(b,p);
            p++;
        }
        if( max < tmp ){ max = tmp; }
    }
    printf("%d\n",max);
    return 0;
}

Measured memory_bytes: 2516
#include<iostream>
#include<string>
#include<algorithm>
#define SIZE_OF_ARRAY(array) (sizeof(array)/sizeof(array[0]))
#include<iostream>
#include<fstream>

using namespace std;

int main()
{

  char yosou[3];
  char real[3];

  for (int i = 0; i < 3;i++)
  {
    cin >> yosou[i];
  }

  for (int i = 0; i < 3;i++)
  {
    cin >> real[i];
  }

  int count = 0;

  for (int i = 0;i < 3;i++)
  {
    if(yosou[i] == real[i])
    {
      count++;
    }
  }
  cout << count << endl;
}



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

int main(){
    int n,m;
    cin >> n >> m;
    int a[100][100],b[100],c[100] = {0};

    for(int i = 0; i < n; ++i){
        for(int j = 0; j < m; ++j){
            cin >> a[i][j];
        }
    }

    for(int i = 0; i < m; ++i){
        cin >> b[i];
    }

    for(int i = 0; i < n; ++i){
        for(int j = 0; j < m; ++j){
            c[i] += a[i][j] * b[j];
        }
        cout << c[i] << endl;
    }
    
    return 0;
}

Measured memory_bytes: 3112
# -*- coding: utf-8 -*-

(N, M) = (int(i) for i in input().split())
A = [int(i) for i in input().split()]

# 大きい順に並べ替え
sorted_A = sorted(A, reverse=True)

# 先頭からM個の要素を抜き出す
m_ele = sorted_A[:M]

# 総得票数を求める
total_toku = sum(sorted_A)

# M回ループ
for m in m_ele:
    # 得票数 < 1 / 4 / M * 総得票数かチェック
    if m < 1 / 4 / M * total_toku:
        # そうならNoしてbreak
        print('No')
        break
# ループを全部抜けたらYes
else:
    print('Yes')

Measured memory_bytes: 3060
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;

int main(int argc, const char * argv[]) {
    // cinを高速にするためのおまじない
    cin.tie(0);
    ios::sync_with_stdio(false);

    /////////////////////
    // Write code below /
    /////////////////////
    int n;
    cin >> n;
    vector<int> vec(n);
    for(int i=0; i<n; i++){
        cin >> vec.at(i);
    }
    int b = 1;
    int counter = 0;
    for(int i=0; i<n; i++){
        b = vec.at(b - 1);
        counter++;
        if(b == 2){
            break;
        }
    }
    if(counter == n){
        cout << -1 << endl;
    } else {
        cout << counter << endl;
    }
}


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




int main(){
    ll N,K;cin>>N>>K;
    if(K%2==1){
        ll ko=N/K;
        cout<<ko*ko*ko<<endl;
        return 0;
    }
    else{
        ll ko=N/K;
        ll ko2=N/(K/2)-ko;
        cout<<ko*ko*ko+ko2*ko2*ko2<<endl;
    }
    
}







Measured memory_bytes: 256
# -*- coding: utf-8 -*-
# モジュールのインポート
import math

# 標準入力を取得
N, K = list(map(int, input().split()))
A = list(map(int, input().split()))

# 求解処理
ans = math.ceil((N - 1) / (K - 1))

# 結果出力
print(ans)

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

#define PI 3.14159265359
#define rep(i,a,n) for(int i=a;i<(int)n;++i)
#define SZ(x) ((int)(x).size())	//size() unsigned -> int
#define descsort(a) sort(a.begin(),a.end(),std::greater<int>())
using namespace std;
typedef long long ll;
const ll INF = 1e9 + 7;

int main(void)
{
    int n;
    cin>>n;
    int a=n/1000;
    if(n%1000) cout<<(a+1)*1000-n<<endl;
    else cout<<0<<endl;
    return 0;
}

Measured memory_bytes: 3608
//minamoto
#include<bits/stdc++.h>
#define R register
#define fp(i,a,b) for(R int i=(a),I=(b)+1;i<I;++i)
#define fd(i,a,b) for(R int i=(a),I=(b)-1;i>I;--i)
#define go(u) for(int i=head[u],v=e[i].v;i;i=e[i].nx,v=e[i].v)
template<class T>inline bool cmax(T&a,const T&b){return a<b?a=b,1:0;}
template<class T>inline bool cmin(T&a,const T&b){return a>b?a=b,1:0;}
using namespace std;
const int N=1e5+5;
int a[N],n,res;
int main(){
	scanf("%d",&n);
	fp(i,1,n)scanf("%d",&a[i]);
	fp(i,1,n)res+=(a[a[i]]==i);
	printf("%d\n",res>>1);
	return 0;
}

Measured memory_bytes: 640
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;

int a[1010];

int main() {
    ios_base::sync_with_stdio(0);
    int n, k; cin >> n >> k;
    for (int i=0;i<n;i++) cin >> a[i];
    sort(a, a+n);
    cout << accumulate(a, a+k, 0) << endl;
}


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

using namespace std;

#define rep(i,n) for(int i=0;i<(n);i++)
#define repa(i,a,n) for(int i=(a);i<(n);i++)
#define rrep(i,n) for(int i=(n)-1;i>=0;i--)
#define rrepa(i,a,n) for(int i=(n)-1;i>=(a);i--)
#define all(a) (a).begin(),(a).end()
#define MOD 1000000007
#define maxs(a,b) a=max(a,b);
#define mins(a,b) a=min(a,b);
#define max3(a,b,c) max(a,max(b,c)) 
#define mix3(a,b,c) mix(a,mix(b,c))

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef pair<int,int> pi;

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

    int ans=1;

    rep(i,n-1){
        if(s[i]!=s[i+1])ans++;
    }
    
    cout<<ans<<endl;
    
    return 0;
}

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

using namespace std;

int main()
{
  int M, N;
  string S[100];

  cin >> M >> N;
  for(int i = 0; i < M; i++) {
    cin >> S[i];
  }

  bool kill[100][100] = {{}};
  for(int i = 0; i < N; i++) kill[0][i] = true;
  for(int i = 0; i < M; i++) {
    for(int j = 0; j < N; j++) {
      if(S[i][j] != '-') {
        for(int k = -1; k <= 1; k++) {
          for(int l = -1; l <= 1; l++) {
            int y = i + k, x = j + l;
            if(y < 0 || x < 0 || y >= M || x >= N) continue;
            if(S[i][j] == 'o' && k != 0) continue;
            kill[y][x] = true;
          }
        }
      }
    }
  }

  int ret = 0;
  for(int i = 0; i < M; i++) {
    for(int j = 0; j < N; j++) {
      ret += kill[i][j] ^ 1;
    }
  }
  cout << ret << endl;
}

Measured memory_bytes: 3224
H, W = gets.split.map(&:to_i)
as = []
H.times do |i|
    as[i] = gets.split.map(&:to_i)
end

dp = Array.new(H+1){Array.new(H+1, 0)}
dp[0][0] = as[0][0]

(1...(H+W-2)).each do |k|
    mini = [1, k-W+1].max
    minj = [0, k-W+1].max
    maxi = [k, H-1].min
    maxi.downto(mini) do |i|
        (i-1).downto(minj) do |j|
            dp[i][j] = dp[i-1][j] if dp[i][j] < dp[i-1][j]
            dp[i][j] = dp[i][j-1] if dp[i][j] < dp[i][j-1]
            dp[i][j] = dp[i-1][j-1] if dp[i][j] < dp[i-1][j-1]
            dp[i][j] += as[i][k-i] + as[j][k-j]
        end
    end
end

puts dp[H-1][H-2] + as[H-1][W-1]

Measured memory_bytes: 2940
#include <cstdio>
char str[1005];
int f[128];
int main(){
	scanf("%s", str);
	for(int i = 0; str[i]; i ++){
		f[str[i]] = 1;
	}
	if(f['N'] ^ f['S'] == 0 && f['W'] ^ f['E'] == 0){
		puts("Yes");
	}else{
		puts("No");
	}
} 

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#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 fi first
#define se second
template<typename A, typename B> inline bool chmax(A &a, B b) { if (a<b) { a=b; return 1; } return 0; }
template<typename A, typename B> inline bool chmin(A &a, B b) { if (a>b) { a=b; return 1; } return 0; }
typedef long long ll;
typedef pair<int, int> pii;
const ll INF = 1ll<<30;
const ll longINF = 1ll<<60;
const ll MOD = 1000000007;
const double EPS = 1e-9;
const bool debug = 0;
//---------------------------------//

int N;
int a[112345], b[112345];

int main() {
	cin >> N;
	REP(i, N) scanf("%d", a + i);
	REP(i, N) scanf("%d", b + i);
	
	vector<pii> v;
	REP(i, N) v.emplace_back(a[i], 0);
	REP(i, N) v.emplace_back(b[i], 1);
	
	sort(ALL(v));
	
	ll ans = 1, cnt = 0;
	for (pii cur : v) {
		if (cur.se == 0) {
			if (cnt < 0) ans = ans * -cnt % MOD;
			cnt++;
		}
		else {
			if (cnt > 0) ans = ans * cnt % MOD;
			cnt--;
		}
	}
	
	cout << ans << endl;
	
	return 0;
}


Measured memory_bytes: 3188
#include "bits/stdc++.h"
#define rep(i,n) for(int i = 0; i < (n); ++i)
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
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; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);
    int n;
    cin >> n;
    for(int i = 1; i <= 9; ++i){
        for(int j = 1; j <= 9; ++j){
            if(i*j == n){
                cout << "Yes" << endl;
                return 0;
            }
        }
    }
    cout << "No" << endl;
	return 0;
}

Measured memory_bytes: 3652
#include<iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <cmath>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  	int N, A, B;
  	cin >> N >> A >> B;
  	cout << min(A*N, B) <<endl;
    
  	return 0;
}



Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <deque>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <cstring>
#include <iomanip>
 
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,n) for(int i=1;i<=(n);i++)
const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
 
using namespace std;    
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
	int a,b,sum=0;
  cin>>a>>b;
  if(a==1 && b==1) sum+=1000000;
  else{
	if(a==1 || b==1) sum+=300000;
    if(a==2) sum+=200000;
    if(b==2) sum+=200000;
    if(a==3) sum+=100000;
    if(b==3) sum+=100000;
  }
  cout<<sum<<'\n';
  return 0;
}

Measured memory_bytes: 256
import sys
input = sys.stdin.readline

H, W = [int(x) for x in input().strip().split()]
C = [0 for _ in range(10)]
for i in range(10):
    C[i] = [int(x) for x in input().strip().split()]

for k in range(10):
    for i in range(10):
        for j in range(10):
            if C[i][j] > C[i][k] + C[k][j]:
                C[i][j] = C[i][k] + C[k][j]
                isChanged = True

ans = 0
for h in range(H):
    W = [int(x) for x in input().strip().split()]
    for w in W:
        if w == -1:
            continue
        ans += C[w][1]

print(ans)


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

#ifdef LOCAL
#include "../dump.hpp"
#else
#define dump(...)
#endif

using namespace std;

#define rep(i,n) for(int i=0,i##_len=(n);i<i##_len;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define ROF(i,a,b) for(int i=(a)-1;i>=(b);i--)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend() //sortで大きい順
#define UNIQUE(v) v.erase(unique(all(v)),v.end())
#define SUM(a) accumulate(all(a),0)
#define pb push_back
#define fst first
#define snd second
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int,int> pii;
typedef long long ll;

int h,w;

void next(int &x, int &y){
  if(x % 2 == 0) y++;
  else y--;
  if(y == w){ x++; y--; }
  if(y == -1){ x++; y++; }
}

int main(){
  int n; cin >> h >> w >> n;
  vvi c(h,vi(w));

  int x = 0, y = 0;
  rep(k,n){
    int a; cin >> a;
    while(a){
      c[x][y] = k + 1;
      next(x,y);
      a--;
    }
  }
  rep(i,h){
    rep(j,w-1) cout << c[i][j] << " ";
    cout << c[i][w-1] << endl;
  }
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>
using namespace __gnu_pbds;
using namespace std;
typedef tree<
    pair<int, int>,
    null_type,
    less_equal<pair<int, int>>,
    rb_tree_tag,
    tree_order_statistics_node_update>
    ordered_set;
#define int long long
#define double long double
#define all(a) (a).begin(), (a).end()
#define x first
#define y second
#define lb(v, z) lower_bound(all(v), z)
#define ub(v, z) upper_bound(all(v), z)
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define rdp(i, a, b) for (int i = (a); i >= (b); i--)
#define rlt(i, a, b) for (int i = (a); i < (b); i++)
#define cns(z) cout << (z) << ' '
#define cnl(z) cout << (z) << '\n'
#define M1 1000000007
#define M2 998244353
#define MAXN 300005
#define INF (1ll << 60)
#define endl "\n"
#define garr(ip)       \
    for (auto &x : ip) \
        cin >> x;
#define parr(ip)          \
    for (auto &x : ip)    \
        cout << x << " "; \
    cout << endl;
#define nl cout << endl
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pair<int, int>> vp;

void solve(int testCaseNumber = 1)
{
    string s;
    cin >> s;
    if (s[2] == s[3] and s[4] == s[5])
        cnl("Yes");
    else
        cnl("No");
}

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    solve();
}

Measured memory_bytes: 3596
S = input()

n = len(S)
s = []
for c in S:
    s.append(c)

operator=[]    
for i in range(2**(n-1)):
    op = ['']*n
    for j in range(n-1):
        if (i>>j) & 1:
            op[n-1-1-j] = '+'

    operator.append(op)

F = []
for op in operator:
    f = "".join(a+b for a, b in zip(s,op))
    F.append(f.split('+'))

res = 0
for elem in F:
    sum_elem=0
    for i in elem:
        sum_elem+=int(i)
    res += sum_elem

print(res)

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

using namespace std;




int main() {
  int H, W;
  cin >> H >> W;
  
  string S[H+2];
  
  S[0] = string(W+2, '.');
  S[H+1] = string(W+2, '.');
  
  for (int i = 1; i < H+1; i++) {
    S[i] += '.';
    string s;
    cin >> s;
    S[i] += s;
    S[i] += '.';
  }
   
  for (int i = 1; i < H+1; i++) {
    for (int j = 1; j < W+1; j++) {
      if(S[i].at(j) == '.'){
        int count = 0;
        if (S[i].at(j-1) == '#') count++;
        if (S[i].at(j+1) == '#') count++;
        if (S[i-1].at(j-1) == '#') count++;
        if (S[i-1].at(j) == '#') count++;
        if (S[i-1].at(j+1) == '#') count++;
        if (S[i+1].at(j-1) == '#') count++;
        if (S[i+1].at(j) == '#') count++;
        if (S[i+1].at(j+1) == '#') count++;
        cout << count;
      } else {
        cout << S[i].at(j);
      }
    }
    cout << endl;
  }
}


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

using namespace std;

int solve(vector<vector<int> >& V, vector<int>& d, vector<int>& f, int cur, int timestamp) {
  bool change = false;
  for (int i = 0; i < V[cur].size(); ++i) {
    int next = V[cur][i] - 1;
    if (d[next] == 0) {
      ++timestamp;
      d[next] = timestamp;
      timestamp = solve(V, d, f, next, timestamp);
    }
  }
  ++timestamp;
  if (f[cur] == 0)
      f[cur] = timestamp;
  return timestamp;
}

int main(int argc, char* argv[]) {
  int n;
  cin >> n;

  vector<vector<int> > V(n);
  for (int i = 0; i < n; ++i) {
    int u, k;
    cin >> u >> k;
    vector<int> tmp(k);
    for (int j = 0; j < k; ++j)
      cin >> tmp[j];
    V[u - 1] = tmp;
  }

  vector<int> d(n);
  vector<int> f(n);
  int timestamp = 0;
  for (int i = 0; i < n; ++i) {
    if (d[i] == 0) {
      ++timestamp;
      d[i] = timestamp;
      timestamp = solve(V, d, f, i, timestamp);
    }
  }

  for (int i = 0; i < n; ++i) {
    cout << i + 1 << " " << d[i] << " " << f[i] << endl;
  }

  return 0;
}


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

int main() {
  int N;
  cin >> N;
  
  vector<int64_t> L(N+1);
  L.at(0) = 2;
  L.at(1) = 1;
  for (int i=2; i<=N; i++) {
    L.at(i) = L.at(i-1) + L.at(i-2);
  }
  cout << L.at(N) << endl;
  
}

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

int main(){
  string s;
  cin >> s;
  int counter = 0;
  if(s[0] == '1') counter++;
  if(s[1] == '1') counter++;
  if(s[2] == '1') counter++;
  
  cout << counter << endl;
}


Measured memory_bytes: 3580
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n=0;
		for(int i=0;i<5;i++) {
			if(sc.nextInt() == 0) {
				n = i+1;
			}
		}
		System.out.println(n);
	}

}


Measured memory_bytes: 35736
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)   FOR(i,0,n)
#define pb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pint;

ll x[51],y[51],xc[51],yc[51];
int main(){
    int n,k;
    cin>>n>>k;
    rep(i,n) cin>>x[i]>>y[i];
    rep(i,n) xc[i]=x[i],yc[i]=y[i];
    sort(x,x+n);
    sort(y,y+n);
    ll ans=LLONG_MAX;
    rep(xi,n)FOR(xj,xi+1,n)rep(yi,n)FOR(yj,yi+1,n){
        int cnt=0;
        rep(i,n){
            if(x[xi]<=xc[i]&&x[xj]>=xc[i]&&y[yi]<=yc[i]&&y[yj]>=yc[i]) ++cnt;
        }
        if(cnt>=k) ans=min(ans,(x[xj]-x[xi])*(y[yj]-y[yi]));
    }
    cout<<ans<<endl;
    return 0;
}

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

int main()
{
	int a, b;
	cin >> a >> b;
	if (a < b)
	{
		cout << "a < b" << endl;
	}
	if (a > b)
	{
		cout << "a > b" << endl;
	}
	if (a == b)
	{
		cout << "a == b" << endl;
	}

	return 0;
}

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


void solve(long long x){
    if(0 == x) {
        cout << 1 << endl;
    } else {
        cout << 0 << endl;
    }
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main(){
    long long x;
    scanf("%lld",&x);
    solve(x);
    return 0;
}


Measured memory_bytes: 3740
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ll n,k;
    cin>>n>>k;
    ll a[200005];
    for(ll i=0;i<n;i++)
    {
        cin>>a[i];
    }
    ll l=0,r=1e9;
    while(l+1<r)
    {
        ll m=(l+r)/2;
        ll s=0;
        for(ll i=0;i<n;i++)
        {
            s+=(a[i]+m-1)/m-1;
        }
        if(s<=k)
            r=m;
        else
            l=m;

    }
    cout<<r<<endl;
}


Measured memory_bytes: 5080
#include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <complex>
#include <stack>
#include <queue>
#include <list>
#include <unordered_map>
#include <utility>
#include <map>
#include <set>
using namespace std;

int main(){
    int a, b;
    cin >> a>> b;
    int ans = (a-1) * (b-1);
    cout << ans << endl;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vvi vector<vi>
#define vs vector<string>
#define pb push_back
#define P pair<int,int>
#define vp vector<P>
#define PP pair<P,int>
#define vpp vector<PP>
#define fi first
#define se second
#define INF (1<<30)
#define MOD 1000000007
#define REP(i,n) for(int i=0;i<n;i++)
#define REPR(i,n) for(int i=n;i>=0;i--)
#define FOR(i,m,n) for(int i=m;i<n;i++)
#define all(x) (x).begin(),(x).end()
int main(){
    int n;
    cin>>n;
    map<int,int> a;
    REP(i,n){
        int t;
        cin>>t;
        a[t]++;
    }
    
    int m;
    cin>>m;
    map<int,int> b;
    REP(i,m){
        int t;
        cin>>t;
        b[t]++;
    }
    for(auto i:b){
        if(i.se>a[i.fi]){
            cout<<"NO"<<endl;
            return 0;
        }
    }
    cout<<"YES"<<endl;
    return 0;
}

Measured memory_bytes: 19072
#include <algorithm>
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
using namespace std;
#define rep(i, n) for(int(i) = 0; (i) < (n); (i)++)
#define FOR(i, m, n) for(int(i) = (m); (i) < (n); (i)++)
#define All(v) (v).begin(), (v).end()
#define pb push_back
#define MP(a, b) make_pair((a), (b))
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const int INF = 1 << 30;
const ll LINF = 1LL << 60;
const int MOD = 1e9 + 7;

ll mod_pow(ll x, ll n, ll mod) {
    if(n == 0)
        return 1;
    ll res = mod_pow(x * x % mod, n / 2, mod);
    if(n & 1)
        res = res * x % mod;
    return res;
}

int main() {
    int N;
    string X;
    cin >> N >> X;
    int cnt = 0;
    rep(i, N) {
        if(X[i] == '1')
            cnt++;
    }
    if(cnt == 0) {
        rep(i, N) { cout << 1 << endl; }
    } else if(cnt == 1) {
        if(X[N - 1] == '1') {
            rep(i, N) {
                if(X[i] == '0') {
                    cout << 2 << endl;
                } else {
                    cout << 0 << endl;
                }
            }
        } else {
            rep(i, N) {
                if(X[i] == '0') {
                    if(i == N - 1) {
                        cout << 2 << endl;
                    } else {
                        cout << 1 << endl;
                    }
                } else {
                    cout << 0 << endl;
                }
            }
        }
    } else {
        ll mo1 = 0, mo2 = 0;
        for(int i = N - 1; i >= 0; i--) {
            if(X[i] == '1') {
                mo1 += mod_pow(2, N - i - 1, cnt + 1);
                mo2 += mod_pow(2, N - i - 1, cnt - 1);
                mo1 %= cnt + 1;
                mo2 %= cnt - 1;
            }
        }
        vector<int> mo(N);
        rep(i, N) {
            ll tmp = 0;
            if(X[i] == '1') {
                tmp = mo2;
                tmp -= mod_pow(2, N - i - 1, cnt - 1);
                tmp = (tmp + (cnt - 1)) % (cnt - 1);
            } else {
                tmp = mo1;
                tmp += mod_pow(2, N - i - 1, cnt + 1);
                tmp = tmp % (cnt + 1);
            }
            mo[i] = tmp;
        }
        vector<int> ans(N);
        rep(i, N) {
            int num = mo[i];
            int res = 1;
            if(X[i] == '1') {
                while(num > 0) {
                    num = num % __builtin_popcount(num);
                    res++;
                }
            } else {
                while(num > 0) {
                    num = num % __builtin_popcount(num);
                    res++;
                }
            }
            ans[i] = res;
        }
        rep(i, N) { cout << ans[i] << endl; }
    }
    return 0;
}

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

int main() {
    long long A, B, C, K, ret;
    cin >> A >> B >> C >> K;
    if (K <= A) {
        ret = K;
    }
    else {
        ret = A;
        K -= A;
        K -= B;
        if (K > 0) {
            ret -= K;
        }
    }
    cout << ret << endl;
}

Measured memory_bytes: 3632
#include <bits/stdc++.h>
#define endl "\n"
using namespace std;
typedef long long int lli;
int dp1[3001][3001];
int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); cout.tie(0);
    string s,t,ans="";
    cin>>s>>t;
    lli i,j,n1=s.length(),n2=t.length(),dp[n1][n2];
    memset(dp,0LL,sizeof(dp));
    
    for(i=0;i<n1;i++)
    {
        for(j=0;j<n2;j++)
        {
            if(s[i]==t[j])
            {
                if(i>0 && j>0)
                dp[i][j]=dp[i-1][j-1]+1;
                else
                dp[i][j]=1LL;
            }
            else
            {
                if(i>0)
                dp[i][j]=max(dp[i][j],dp[i-1][j]);
                if(j>0)
                dp[i][j]=max(dp[i][j],dp[i][j-1]);
            }
        }
    }
    
    i=n1-1,j=n2-1;
    while(i>=0 && j>=0)
    {
        if(i>0 && j>0)
        {
            if(dp[i][j]==dp[i-1][j])
            {
                i--;
            }
            else if(dp[i][j]==dp[i][j-1])
            {
                j--;
            }
            else
            {
                ans+=s[i];
                i--;
                j--;
            }
        }
        else
        {
            if(dp[i][j]) 
            {
                if(i>0) ans+=t[j];
                else    ans+=s[i];
            }
            break;
        }
    }
    
    reverse(ans.begin(), ans.end());
    cout<<ans;
    return 0;
}

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

int main()
{
	string a;
  	cin>>a;
  	for(int i=1 ; i<a.length() ; ++i)
    {
    	if(a[i]==a[i-1])
        {
        	cout<<"Bad"<<endl;
          	return 0;
        }
    }
  	cout<<"Good"<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>  
using namespace std;  
#define INF 0x3f3f3f3f  
typedef long long ll;  
const int N =  1e5 + 10;  
#define FI first
#define SE second
typedef pair<int, int>pii;
 int num[N];
 int dp[10011];
int main()  
{  
  // freopen("in.txt","r",stdin);
	int n;
	while (~scanf("%d", &n))
	{
		int sum = 0;
		for (int i = 1; i <= n; i++)
		{
			scanf("%d", num + i);
			sum += num[i];
		}
		memset(dp, 0, sizeof(dp));
		dp[0] = 1;
		for (int i = 1; i <= n; i++)
			for (int j = sum; j >= num[i]; j--)
				dp[j] |= dp[j-num[i]];
		while (sum > 0)
		{
			if (dp[sum] && sum % 10 != 0)
				break;
			sum--;
		}
		printf("%d\n", sum);
	} 
   return 0;  
}  

Measured memory_bytes: 256
#include<iostream>
#include<stdio.h>
#include<cstdio>
#include<bits/stdc++.h>
using namespace std;
	long long mod=1000000007;
	long long n,ans;
	char s1[100],s2[100];
int main(){
	cin>>n>>s1>>s2;
	ans=0;
	for (int i=0;i<strlen(s1);i++)
		if (s1[i]==s2[i]){
			if (i==0){
			
				ans=3;
			}else if (s1[i-1]==s2[i-1]){
				ans=(ans*2)%mod;
				}
		}else {
			if (i==0)
				ans=6;
			else{
				if (s1[i-1]==s2[i-1]){
					ans=(ans*2)%mod;	
				}else
					ans=(ans*3)%mod;
				
			}
			i++;
		}
		cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
 
using namespace std;
#define ff first
#define ss second
#define pii pair<int, int>
#define pll pair<long long , long long>
#define pb push_back
#define ll long long
#define ld long double
#define precision(x,d) cout<<fixed<<setprecision(d)<<x
#define fill(a,b) memset((a),(b),sizeof((a)))
#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL));
ll power(ll x,ll y,ll m){ll r=1;for(;y;y>>=1){if(y&1)r=r*x%m;x=x*x%m;}return r;}
const ll mod = 1e9 + 7;
 
int run_test(){
    int x, n;
    cin >> x >> n;
    int a[n];
    set<int> s;
    for(int i=0; i<n; i++){
        cin >> a[i];
        s.insert(a[i]);
    }
    int ab = 1000, p;
    for(int i=0; i<=101; i++){
        if(s.count(i) == 0){
            if(abs(x - i) < ab){
                ab = min(ab, abs(x - i));
                p = i;
            }
        }
    }
    cout << p;
    return 0;
}
 
int main(){
    FAST;
    ll t;
    t = 1;
 
    while(t--){
        run_test();
    }
}

Measured memory_bytes: 3600
w, h, n = map(int, input().split())

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

onelist = [0]
twolist = [w]
threelist = [0]
fourlist = [h]


for xl in xlist:
    if xl[2] == 1:
        onelist.append(xl[0])
    elif xl[2] == 2:
        twolist.append(xl[0])
    elif xl[2] == 3:
        threelist.append(xl[1])
    elif xl[2] == 4:
        fourlist.append(xl[1])

one = max(onelist)
two = min(twolist)
three = max(threelist)
four = min(fourlist)


if one > two:
    x = 0
else:
    x = two - one
if three > four:
    y = 0
else:
    y = four - three

if (x*y) < 0:
    print(0)
else:
    print(x*y)

Measured memory_bytes: 3064
# coding:utf-8

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

x_arr = []
x_list = input().split()
for xi in x_list:
    x_arr.append(int(xi))

y_arr = []
y_list = input().split()
for yi in y_list:
    y_arr.append(int(yi))

x_arr.sort()
y_arr.sort()

if(x_arr[-1]>x):
    xn = x_arr[-1]
else:
    xn = x


if(y_arr[0]<y):
    yn = y_arr[0]
else:
    yn = y

if(yn>xn):
    print('No War')
else:
    print('War')


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

#define rep(i, j) for (int i = 0; i < j; i++)
#define all(obj) (obj).begin(), (obj).end()
#define rall(obj) (obj).rbegin(), (obj).rend()
typedef long long int ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<vi> vvi;
typedef vector<pii> vpii;

int n, m;

int main() {

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(10);
    cout << fixed;

    cin >> n >> m;
    vvi a(n, vi(m, 0));
    rep(i, n) rep(j, m) {
        cin >> a[i][j];
        a[i][j]--;
    }

    int ans = n;

    vi is(n, 0);
    set<int> removed;
    rep(i, m) {
        vpii b(m);
        rep(j, m) b[j].second = j;
        rep(j, n) {
            b[a[j][is[j]]].first++;
        }

        sort(rall(b));
        ans = min(ans, b[0].first);
        removed.insert(b[0].second);

        // cout << b[0].second << " is inserted." << endl;
        rep(j, n) {
            for (auto it = removed.find(a[j][is[j]]); it != removed.end(); it = removed.find(a[j][is[j]])) {
                is[j]++;
            }
        }
    }

    // rep(i, n) {
    //    cout << i << " " << is[i] << endl;
    // }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
string s[2];
int n;
const long long MOD=1000000007;
int main(){
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin>>n>>s[0]>>s[1];
	int back=0;
	long long res=1;
	for(int i=0;i<n;i++){
		if(s[0][i]==s[1][i]){
			if(back==0)
				res*=3LL;
			if(back==1)
				res*=2LL;
			if(back==2)
				res*=1LL;
			back=1;
		}
		else{
			if(back==0)
				res*=6LL;
			if(back==1)
				res*=2LL;
			if(back==2)
				res*=3LL;
			back=2;
			i++;
		}
		res%=MOD;
	}
	cout<<res<<endl;
	return 0;
}


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

step_sum = 0
pre_height = a[0]
for i in a[1:]:
    if pre_height <= i:
        pre_height = i
    else:
        step_sum += pre_height - i

print(step_sum)


Measured memory_bytes: 32248
import Control.Applicative ((<$>))
import Control.Monad (unless)
import Data.ByteString.Char8 (ByteString)
import qualified Data.ByteString.Char8 as B
import Data.List (unfoldr)
import Data.Char (isSpace)

main :: IO ()
main = do
  n <- readLn
  unless (n == 0) $ do
    solve n <$> readil B.readInt <$> B.getLine >>= print
    main
    
solve :: Int -> [Int] -> Int
solve n xs = cnt 0 (n, xs)
  where f (c, as) = foldr g (1, [c]) as
          where g e (d, bs) | e == 1 = (d, bs)
                            | otherwise = (d+1, (e-1):bs)
        cnt i (c, as) | i > 10000 = (-1)
                      | isTriangle as = i
                      | otherwise = cnt (i+1) (f (c, as))

isTriangle :: [Int] -> Bool
isTriangle xs = head xs == 1 && all f (zip xs (tail xs))
  where f (a, b) = a + 1 == b
        
readil :: Integral a =>  (ByteString -> Maybe (a, ByteString)) -> ByteString -> [a]
readil f = unfoldr g
  where
    g s = do
      (n, s') <- f s
      return (n, B.dropWhile isSpace s')



Measured memory_bytes: 5484
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
import java.util.Scanner;
import java.util.TreeMap;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int a = sc.nextInt();
		int b = sc.nextInt();
		int t = sc.nextInt();
		
		System.out.println(t/a * b);

		
		
	}	

}



Measured memory_bytes: 23892
# AtCoder Beginner Contest 126
# https://atcoder.jp/contests/abc126
import sys
#import numpy as np

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in ss]
ss2nnn = lambda ss: [s2nn(s) for s in ss]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [sys.stdin.readline().rstrip() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N, K = i2nn()
    S = i2s()
    K -= 1
    s = S[:K] + S[K:K+1].lower() + S[K+1:]
    print(s)

main()


Measured memory_bytes: 3064
package main

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

func main() {
	_, m := getInt(), getInt()
	ps := make([]int, m)
	ys := make([]int, m)
	for i := 0; i < m; i++ {
		ps[i], ys[i] = getInt(), getInt()
	}

	cs := make(map[int][]int)
	for i := 0; i < m; i++ {
		cs[ps[i]] = append(cs[ps[i]], ys[i])
	}

	for k := range cs {
		sort.Ints(cs[k])
	}

	for i := 0; i < m; i++ {
		p := ps[i]
		id := sort.SearchInts(cs[ps[i]], ys[i]) + 1

		fmt.Printf("%06d%06d\n", p, id)
	}
}

// -----------------------------------------

var sc = bufio.NewScanner(os.Stdin)

func init() {
	// buf := 200001
	// sc.Buffer(make([]byte, buf), buf)
	sc.Split(bufio.ScanWords)
}

func getInt() int {
	i, err := strconv.Atoi(getString())
	if err != nil {
		panic(err)
	}
	return i
}

func getString() string {
	sc.Scan()
	s := sc.Text()
	return s
}


Measured memory_bytes: 16896
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>

using namespace std;

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

// container util
#define all(x) (x).begin(), (x).end()

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

// typedef
typedef long long lint;
typedef unsigned long long ull;
typedef complex<long double> Complex;
typedef pair<int, int> P;
typedef tuple<int, int, int> TP;
typedef vector<int> vec;
typedef vector<vec> mat;

// constant
const int MOD = (int)1e9 + 7;
const int INF = (int)1e18;
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};

// conversion
inline int toInt(string s) {
  int v;
  istringstream sin(s);
  sin >> v;
  return v;
}
template <class T>
inline string toString(T x) {
  ostringstream sout;
  sout << x;
  return sout.str();
}

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

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

  int m, d;
  cin >> m >> d;

  int res = 0;
  for (int i = 1; i <= m; i++) {
    for (int j = 11; j <= d; j++) {
      int d1 = j % 10;
      int d10 = j / 10;
      if (2 <= d1 && 2 <= d10) {
        if (i == d1 * d10) res++;
      }
    }
  }

  cout << res << endl;

  return 0;
}

Measured memory_bytes: 256
def divisors(n):
    res = []
    for i in range(1, int(n ** 0.5) + 1):
        if n % i == 0:
            res.append(i)
            if i != n // i:
                res.append(n // i)
    return len(res)
    
arr = [0, 0] + [1 if divisors(i) == 8 and i % 2 else 0 for i in range(2, 201)]
N = int(input())

print(sum(arr[: N + 1]))

Measured memory_bytes: 3060
fun main(args: Array<String>) {
    val (n, d) = readLine()!!.split(" ").map { it.toInt() }
    val canLook = d * 2 + 1
    var ans = n / canLook
    val a = n % canLook
    if (a != 0) ans += 1
    println(ans)
}

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

#define SIZE_OF_ARRAY(array) sizeof(array)/sizeof(array[0])
typedef long long ll;

vector<pair<long long, long long> > prime_factorize(long long N) {
    vector<pair<long long, long long> > res;
    for (long long a = 2; a * a <= N; ++a) {
        if (N % a != 0) continue;
        long long ex = 0; // 指数

        // 割れる限り割り続ける
        while (N % a == 0) {
            ++ex;
            N /= a;
        }

        // その結果を push
        res.push_back({a, ex});
    }

    // 最後に残った数について
    if (N != 1) res.push_back({N, 1});
    return res;
}

int main() {
    ll n; 
    cin >> n;
    ll ans = 0;
    vector<pair<ll, ll>> fac = prime_factorize(n);
    for(int i = 0; i < fac.size(); i++){
        pair<ll, ll> p = fac.at(i);
        ll num = p.second;
        for(ll k = 1; k <= p.second; k++){
            num -= k;
            if (num >= 0) ans++;
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
#define mod 1000000007 // 10^9+7
#define INF 99999999999 //10^12-1
#define dev 998244353 //tenka1
#define P pair<int,int>
#define prique priority_queue
int a[3],ans=0;
signed main(){
    cin>>a[0]>>a[1]>>a[2];
    sort(a,a+3);
    int x=a[2]-a[0];
    int y=a[2]-a[1];
    ans+=(x/2)+(y/2);
    if(x%2&&y%2)ans++;
    else if(x%2||y%2)ans+=2;
    cout<<ans<<endl;
    return 0;
}


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

namespace AtCoder_solve
{
    class Program
    {
        public const ulong mod = 1000000007;

        static void Main(string[] args)
        {
            var s = Console.ReadLine();
            var ans = "ARC";
            if (s == "ARC") ans = "ABC";
            Console.WriteLine(ans);



        }






    





        static public long Input()
        {
            return long.Parse(Console.ReadLine());
        }

        static public string[] Input2()
        {
            return Console.ReadLine().Split();
        }
        
        static public long[] Input3()
        {
            string[] data = Console.ReadLine().Split();
            long[] res = new long[data.LongLength];
            for(long i = 0; i < data.LongLength; i++)
            {
                res[i] = long.Parse(data[i]);
            }
            return res;
        }
        public static long Choose(long n, long a)
        {
            long x = 1;
            long y = 1;
            for (long i = 0; i < a; i++)
            {
                x *= n - i;
                y *= i + 1;
            }
            return x / y;
        }

        public static long Gcd(long a, long b)
        {
            long x = Math.Max(a, b);
            long y = Math.Min(a, b);
            if (x % y == 0) return y;
            else return Gcd(y, x % y);
        }
    }
}


Measured memory_bytes: 25888
import java.util.Scanner;

public class Main{
    public static void main(String[] args){
        int a, b, ans=0;
        String op="";
        Scanner s = new Scanner(System.in);
        do{
            a = s.nextInt();
            op = s.next();
            b = s.nextInt();
            if (op.equals("?")) break;
            if (op.equals("+")) ans=a+b;
            else if (op.equals("-")) ans=a-b;
            else if (op.equals("*")) ans=a*b;
            else if (op.equals("/")) ans=a/b;
            System.out.println(ans);
        } while (true);
    }
}


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

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}

int main(){
  ll n,k;
  cin >> n >> k;
  vector<ll> v(n);
  rep(i,n) cin >> v[i];

  ll limit = min(n,k);
  ll ans = -100000000000000;
  for(ll i = 1; i <= limit; i++){
    // cout << i << endl;
    for(ll a = 0; a <= i; a++){
      ll sum = 0;
      ll b = i-a;
      vector<ll> add;
      rep(j,a){
        sum += v[j];
        add.push_back(v[j]);
      }
      rep(j,b){
        sum += v[n-1-j];
        add.push_back(v[n-1-j]);
      }
      sort(add.begin(),add.end());

      for(ll j = 0; j < k-i;j++){
        if(add[j]>=0){
          break;
        }
        sum -= add[j];
      }
      ans = max(ans, sum);
      
    }
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int main(){
	int ar[5];
  	int k;
  	for(int i=0;i<5;i++){
    	cin>>ar[i];
    }
  	sort(ar,ar+5);
  	cin>>k;
  	if(ar[4]-ar[0]>k) cout<<":(";
  	else cout<<"Yay!\n";
}


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

using namespace std;
 
int main(){
    int n, c;
    scanf("%d", &n);
    int nums[n + 1];
  
    for(int i = 0; i <= n; i++) nums[i] = 0;
    for(int i = 0; i < n-1; i++){
        scanf("%d", &c);
        nums[c] ++;
    }
    
    for(int i = 1; i <= n; i++) cout << nums[i] << endl;
}


Measured memory_bytes: 4540