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

int main(){
 string s;
 cin >> s;
 int ans =s.size();
 for (int i =0 ; i<ans;i++) cout << 'x';
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#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 FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define llong long long
#define pb(a) push_back(a)
#define INF 999999999
using namespace std;
typedef pair<int, int> P;
typedef pair<llong, llong> LP;
typedef pair<int, P> PP;
typedef pair<llong, LP> LPP;

int dy[]={0, 0, 1, -1, 0};
int dx[]={1, -1, 0, 0, 0};

int main(){
  int a,b,c;
  cin >> a >> b >> c;
  int k;
  cin >> k;
  int m = max({a,b,c});
  if(a==m) cout << (a*pow(2,k) + b + c) << endl;
  else if(b==m) cout << (a + b*pow(2,k) + c) << endl;
  else if(c==m) cout << (a + b + c*pow(2,k)) << endl;
}


Measured memory_bytes: 512
#include <bits/stdc++.h>
#include <math.h>
using namespace std;
void ABC70(void);
void ABC71(void);
void ABC72(void);
void ABC73(void);
void ABC74(void);
void ABC75(void);
void ABC76(void);
void ABC77(void);
void ABC78(void);
void ABC79(void);

int main(void){
    ABC71();
}

void ABC71(){
    char c='a',ans='\0';
    string s;
    cin>>s;
    for(int i=0;i<26;i++){
        if(count(s.begin(),s.end(),c)==0){
            ans=c;
            break;
        }
        c+=1;
    }
    if(ans=='\0')cout<<"None"<<endl;
    else cout<<ans<<endl;
}

Measured memory_bytes: 512
def count(seq):
    seq = sorted(seq)
    if (seq[0] & 1) == 1 or (seq[1] & 1) == 1 or (seq[2] & 1) == 1:
        return 0
    x , y = [seq[1] - seq[0], seq[2] - seq[0]]
    if x == 0 and y == 0:
        return -1
    elif x == 0:
        k = x & -x
    elif y == 0:
        k = y & -y
    else:
        k = min(x & -x, y & -y)
    foo = 0
    while (k & 1) == 0:
        k >>= 1
        foo += 1
    return foo

def main():
    seq = [int(x) for x in raw_input().strip().split()]
    print count(seq)

if __name__ == '__main__':
    main()


Measured memory_bytes: 2692
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		while(true) {
			int n = sc.nextInt();
			int m = sc.nextInt();
			if (n == 0) {
				break;
			}
			int[] p = new int[n];
			for(int i=0;i<n;i++) {
				p[i] = sc.nextInt();
			}
			Arrays.sort(p);
			int ans = 0;
			for(int i=0;i<n%m;i++) {
				ans += p[i];
			}
			for(int i=0;i<n/m;i++) {
				for(int j=1;j<m;j++) {
					ans += p[n%m+m*i+j];
				}
			}
			System.out.println(ans);
		}
	}

}

Measured memory_bytes: 54340
#include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
#include<math.h>
typedef long long ll;

void add_bits(ll A, vector<int>& bits){
    int i = 0;
    while (true) {
        bits[i] += A % 2;
        A /= 2;
        if (A==0)
            break;
        ++i;
    }
}

int main(){
    ll N, K;
    cin >> N >> K;
    vector<ll> A(N, 0);
    int bit = 40; // 2^40 > 10e12
    vector<int> bits(bit, 0);
    ll sum = 0;
    for(size_t i = 0; i < N; i++)
    {
        cin >> A[i];
        sum += A[i];
        add_bits(A[i], bits);
    }
    // ith bitflip: weight=2^i, value=(N-2*bits[i])*2^i
    // max weight = K
    int ret = 0;
    vector<int> bits_K(bit, 0);
    add_bits(K, bits_K);
    ll best = 0;
    for(size_t i = 0; i < bit; i++)
    {
        vector<int> bits_K_temp = bits_K;
        ll order = 1;
        ll score = 0;
        bool can_flip = false;
        if (bits_K_temp[i] == 1) {
            bits_K_temp[i] = 0;
            can_flip = true;
        }
        for(size_t j = 0; j < bit; j++)
        {
            if (can_flip && j < i) {
                if (N - 2 * bits[j] > 0)
                    score += (N - 2 * bits[j]) * order;
            }
            else if (bits_K_temp[j] == 1)
                score += (N - 2 * bits[j]) * order;
            order <<= 1;
        }
        if (score > best)
            best = score;
    }
    cout << sum + best << endl;
    return 0;
}

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

int main(){
  	int N;
  cin>>N;
  N %= 10;
  switch(N){
    case 2:
    case 4:
    case 5:
    case 7:
    case 9:
      cout<<"hon"<<endl;
      break;
    case 0:
    case 1:
    case 6:
    case 8:
      cout<< "pon" <<endl;
      break;
    case 3:
      cout <<"bon"<<endl;
      break;
  }
	return 0;
}

Measured memory_bytes: 3632
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
#include <cstring>
using namespace std;

using ll = long long;
using P = pair<int, int>;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

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

    int N;
    cin >> N;
    vector<vector<int>> G(N, vector<int>(N, 1));
    for(int i = 0; i < N; ++i)  G[i][i] = 0;
    int K = 0, pow2 = 1;
    while(pow2 < N){
        pow2 <<= 1;
        ++K;
    }
    vector<int> mask(N);
    int cur = 0;
    for(int i = 0; i < N; ++i)  mask[i] = cur++;
    vector<vector<int>> ans(N, vector<int>(N));
    for(int k = 0; k < K; ++k){
        for(int i = 0; i < N; ++i){
            for(int j = i + 1; j < N; ++j){
                if(G[i][j] && ((mask[i] >> k & 1) ^ ((mask[j] >> k) & 1))){
                    ans[i][j] = k + 1;
                    G[i][j] = 0;
                }
            }
        }
    }
    for(int i = 0; i < N - 1; ++i){
        for(int j = i + 1; j < N; ++j){
            cout << ans[i][j];
            cout << ((j == N - 1) ? '\n' : ' ');
        }
    }
}

Measured memory_bytes: 5300
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

fn main() {
    input!{
        n: usize,
        k: usize
    }
    println!("{}", n - k + 1);
}


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

int main(void){
    int h, n;
    cin >> h >> n;
    vector<ll> a(n), b(n);
    rep(i, n) cin >> a[i] >> b[i];
    
    vector<ll> dp(2*h+1, -1);
    dp[0] = 0;
    
    for (int i = 0; i < n; i++)
        if (2*h < a[i])
            if (dp[2*h] == -1)
                dp[2*h] = b[i];
            else
                dp[2*h] = min(dp[2*h], b[i]);
    
    for (int i = 0; i < n; i++)
        for (int j = 1; j <= 2*h; j++)
            if (j >= a[i])
                if (dp[j-a[i]] != -1)
                    if(dp[j] == -1)
                        dp[j] = dp[j-a[i]] + b[i];
                    else
                        dp[j] = min(dp[j], dp[j-a[i]]+b[i]);

    ll ans = pow(10, 12);
    for (int i = h; i <= 2*h; i++)
        if (dp[i] != -1)
            ans = min(dp[i], ans);

    cout << ans << endl;
}

Measured memory_bytes: 384
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int r, g, b, n;
  cin >> r >> g >> b >> n;
  int ans = 0;
  for (int i = 0; i < n/r + 1; i++) {
    for (int j = 0; j < (n-i*r)/g + 1; j++) {
      int tmp = n;
      tmp -= i*r + j*g;
      if (tmp % b == 0) ans++;
    }
  }
  cout << ans << '\n';
}


Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
#include <cstring>
#include <math.h>
#include <bitset>
#include <queue>
#include <set>
#include <iomanip>
#include <math.h>
#include <assert.h>
// #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr long long int INFLL = 1001001001001001LL;
constexpr long long int infll = 1001001001001001LL;
constexpr int INF = 1000000007;
constexpr int inf = 1000000007;
const int mod = 1000000007;

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

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

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

inline double nCr(const int n, int r)
{
    if (n == 0)
    {
        return 0;
    }
    if (r == 0)
    {
        return 1;
    }
    if (r == 1)
    {
        return n;
    }
    if (n == r)
    {
        return 1;
    }

    if (r > n / 2)
    {
        r = n / 2;
    }

    double result = 1;
    for (double i = 1; i <= r; i++)
    {
        result *= (n - i + 1) / i;
    }

    return (result);
}

template <typename T>
T seinomi(T a)
{
    if (a > 0)
    {
        return a;
    }
    else
    {
        return 0;
    }
}

template <typename T>
map<T, T> soinsuubunkai(T n) //連想配列[素因数f.first][個数f.second]
{
    map<T, T> ret;
    for (T i = 2; i * i <= n; i++)
    {
        while (n % i == 0)
        {
            ret[i]++;
            n /= i;
        }
    }
    if (n != 1)
        ret[n] = 1;
    return ret;
}

template <typename T>
T ketasuu(T num)
{
    return std::to_string(num).length();
}

int kaizyou(int k)
{
    int sum = 1;
    for (int i = 1; i <= k; ++i)
    {
        sum *= i;
    }
    return sum;
}

template <class ForwardIt, class T>
void iota(ForwardIt first, ForwardIt last, T value)
{
    while (first != last)
    {
        *first++ = value;
        ++value;
    }
}

//nの階乗を計算
int factorial(int n)
{
    int answer = 1;
    while (n > 1)
    {
        answer *= n;
        n--;
    }
    return answer;
}
int comb(int n, int r)
{
    return factorial(n) / (factorial(r) * factorial(n - r));
}

long long modpow(long long a, long long n, long long mod)
{
    long long res = 1;
    while (n > 0)
    {
        if (n & 1)
            res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


template <typename T>
T amarinasi(T a,T b){
    if(a%b==0)
{
    return a/b;
}
else if(a%b>0)
{
    return a/b+1;
}
else
{
    return a/b-1;
}
}

//小数点以下10桁テンプレート（main関数内の最初に貼付け）
//std::cout << std::fixed << std::setprecision(10);

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

int main(){
ll n;
cin>>n;
ll h;
ll tmp=-infll;
ll sum=0;
for(int i=0;i<n;i++){
    cin>>h;
    if(chmax(tmp,h)||tmp==h){
        sum++;
    }

}
cout<<sum<<endl;
}












Measured memory_bytes: 256
#include<iostream>
#include<algorithm>
#include<cmath>
#include<string>
#include<array>
#include<vector>
#include<functional>
#include<unordered_map>
#include<map>
#include<numeric>
#include<limits>
#include<utility>
#include<queue>
#include<random>
using namespace std;

int main(){
    int a,b;
    
cin >> a >> b;
    
    if((a*b)%2 == 1){
    cout << "Odd" << endl;
    }
   else{cout << "Even"<<endl;}

    return 0;

}

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

typedef long long ll;
#define pii pair<int , int>
#define _FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define MAXX 100005

int n , X;
int x[MAXX];
int a[MAXX];

int gcd(int a , int b){
    while(a && b){
        if(a > b)   a %= b;
        else    b %= a;
    }
    return a + b;
}

int main()
{
    _FastIO;

    cin >> n >> X;
    for(int i = 0; i < n; i++){
        cin >> x[i];
        a[i] = abs(X - x[i]);
    }
    sort(a , a + n);
    int ans = a[0];
    for(int i = 1; i < n; i++){
        ans = gcd(ans , a[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 4400
#include<iostream>
#include<stdio.h>
#include<vector>
#include<algorithm>
#include<set>
#include<string>
#include<map>
#include<string.h>
#include<complex>
#include<math.h>
#include<queue>
#include<time.h>
using namespace std;
typedef long long int llint;
typedef pair<int, int> pint;
typedef vector<int> vint;
typedef vector<llint> vllint;
typedef vector<pair<int, int>> vpint;
typedef vector<pair<llint, llint>> vpllint;
#define rep(i,n) for(int i=0;i<n;i++)
#define drep(i,n) for(int i=n-1;0<=i;i--)
#define yes(ans) if(ans)cout<<"yes"<<endl;else cout<<"no"<<endl;
#define Yes(ans) if(ans)cout<<"Yes"<<endl;else cout<<"No"<<endl;
#define YES(ans) if(ans)cout<<"YES"<<endl;else cout<<"NO"<<endl;
#define POSSIBLE(ans) if(ans)cout<<"POSSIBLE"<<endl;else cout<<"IMPOSSIBLE"<<endl;

class UnionFind {
public:
	//親の番号を格納する。親だった場合は-(その集合のサイズ)
	vector<int> Parent;

	//作るときはParentの値を全て-1にする
	//こうすると全てバラバラになる
	UnionFind(int N) {
		Parent = vector<int>(N, -1);
	}

	//Aがどのグループに属しているか調べる
	int root(int A) {
		if (Parent[A] < 0) return A;
		return Parent[A] = root(Parent[A]);
	}

	//自分のいるグループの頂点数を調べる
	int size(int A) {
		return -Parent[root(A)];//親をとってきたい
	}

	//AとBをくっ付ける
	bool connect(int A, int B) {
		//AとBを直接つなぐのではなく、root(A)にroot(B)をくっつける
		A = root(A);
		B = root(B);
		if (A == B) {
			//すでにくっついてるからくっ付けない
			return false;
		}

		//大きい方(A)に小さいほう(B)をくっ付けたい
		//大小が逆だったらひっくり返しちゃう。
		if (size(A) < size(B)) swap(A, B);

		//Aのサイズを更新する
		Parent[A] += Parent[B];
		//Bの親をAに変更する
		Parent[B] = A;

		return true;
	}
};

//aとbの最大公約数を求めるよ
long long GCD(long long a, long long b) {
	if (b == 0) return a;
	else return GCD(b, a % b);
}

// 返り値: a と b の最大公約数
// ax + by = gcd(a, b) を満たす (x, y) が格納される
long long extGCD(long long a, long long b, long long& x, long long& y) {
	if (b == 0) {
		x = 1;
		y = 0;
		return a;
	}
	long long d = extGCD(b, a % b, y, x);
	y -= a / b * x;
	return d;
}

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

int main() {
	int n, k;
	cin >> n >> k;
	vllint a(n);
	rep(i, n) {
		cin >> a[i];
	}
	llint ans = 0;
	rep(i, min(k, n) + 1) {//選ぶ個数
		rep(j, i + 1) {//左から選ぶ個数
			vllint tmp;
			rep(l, j) {//左から
				tmp.push_back(a[l]);
			}
			rep(l, i - j) {//右から
				tmp.push_back(a[n - 1 - l]);
			}
			sort(tmp.begin(), tmp.end());
			llint cnt = 0;
			rep(l, i) {
				cnt += tmp[l];
			}
			rep(l, (min(i, k - i))) {
				if (tmp[l] < 0) {
					cnt -= tmp[l];
				}
			}
			ans = max(cnt, ans);
		}
	}
	cout << ans << endl;
	return 0;
}

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

typedef long long ll;
#define pb push_back
#define mp make_pair
#define pii pair <int,int>
#define in insert
#define X first
#define Y second
#define frn front
#define bc back
#define rep(i,a,b)for (ll (i) = (a); (i) < b(); ++(i))
#define _ << " " <<
#define sz(x) (int)x.size()
#define all(a) (a).begin(),(a).end()

using namespace std;

const int N = 1e5 + 2;
const double PI = 3.14;
const int MOD = 1e7 + 7;

string s,sol;

int main ()	{
	cin >>s;
	for (int i = 0; i < s.size(); ++i){
		if ((i+1)%2!=0)
			sol+=s[i];
	}
	cout <<sol<<endl;
	return 0;
}


Measured memory_bytes: 512
#include<bits/stdc++.h>
using namespace std;
#define all(vec) vec.begin(),vec.end()
typedef long long int ll;
typedef pair<int,int> P;
typedef pair<P,P> PP;
const ll MOD=10000;
const ll INF=1000000010;
const int MAX=100001;
int dx[8]={0,1,0,-1,1,-1,1,-1};
int dy[8]={1,0,-1,0,1,-1,-1,1};
int r[20][100010];
int main(){
	int n,q;ll l;cin>>n;
	int x[100010];
	for(int i=0;i<n;i++){
		cin>>x[i];
	}
	cin>>l>>q;
	for(int i=0;i<n;i++){
		int ok=i;int ng=n;
		while(ng-ok>1){
			int mid=(ok+ng)/2;
			if(x[mid]<=x[i]+l){
				ok=mid;
			}else{
				ng=mid;
			}
		}
		r[0][i]=ok;
	}
	for(int i=0;i<16;i++){
		for(int j=0;j<n;j++){
			r[i+1][j]=r[i][r[i][j]];
		}
	}
	while(q--){
		int a,b;
		cin>>a>>b;a--;b--;
		if(a==b){
			cout<<0<<endl;
			continue;
		}else if(a>b){
			swap(a,b);
		}
		int ans=0;
		for(int i=16;i>=0;i--){
			if(r[i][a]<b){
				ans+=1<<i;
				a=r[i][a];
			}
		}
		cout<<ans+1<<endl;
	}
	return 0;
}


Measured memory_bytes: 7808
#include <bits/stdc++.h>
#define rep(i, start, end) for (long long i = start; i < end; ++i)
#define repreverse(i, start, end) for (long long i = start; i >= end; --i)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(x) ((long long)(x).size())
#define lcm(a, b) ((a) / __gcd((a), (b)) * (b))
using namespace std;
using ll = long long;
using ld = long double;
using vll = vector<ll>;
using vllvll = vector<vll>;
using vc = vector<char>;
using pll = pair<ll, ll>;
template<class T> void print1d(T x,ll n=-1){if(n==-1)n=x.size();rep(i,0,n){cout<<x[i]<<' ';}cout<<'\n';}
template<class T> void print2d(T x,ll r=-1,ll c=-1){if(r==-1)r=x.size();if(c==-1)c=x[0].size();rep(i,0,r)print1d(x[i],c);}
template<class T, class U> bool haskey(T mp, U key) { return mp.find(key) != mp.end(); }
template<class T, class U> bool isin(T el, U container) { return find(all(container), el) != container.end(); }
template<class T> bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
template<class T> bool even(T n) { return ! (n & 1); }
template<class T> bool odd(T n) { return n & 1; }
template<class T> ll rup(T a, T b) { return a % b ? a / b + 1 : a / b; }
template<class T> ld deg2rad(T deg) { return M_PI * deg / 180.0; }
template<class T> ld rad2deg(T rad) { return 180.0 * rad / M_PI; }
const long double pi = M_PI;
const long long big = 1LL << 50;
const long long inf = 1LL << 60;
const long long mod = 1e9 + 7;
ll intpow(ll a, ll n, ll _mod=numeric_limits<ll>::max()) { ll p=1; while (n) { if (n&1) p=p*a%_mod; a=a*a%_mod; n>>=1; } return p; } 
ll modc(ll a, char op, ll b, ll _mod=mod) { a %= _mod; b %= _mod; ll res = 1; switch(op) {
        case '+': res = (a + b) % _mod; break;
        case '-': res = (a - b) % _mod; break;
        case '*': res = a * b % _mod; break;
        case '/': res = modc(a, '*', modc(b, '^', _mod-2, _mod), _mod); break;
        case '^': res = intpow(a, b, _mod); break;
        case 'P': rep(i, a-b+1, a+1) res = modc(res, '*', i, _mod); break;
        case 'C': res = modc(modc(a, 'P', b, _mod), '/', modc(b, 'P', b, _mod)); break; } if (res < 0) res += _mod; return res; }


int main()
{
        ll M, D;
        cin >> M >> D;

        ll ans = 0;
        rep(i, 1, M+1) {
                rep(j, 1, D+1) {
                        ll d1 = j % 10;
                        ll d10 = j / 10;
                        ll m = i;
                        if (d1 >= 2 and d10 >= 2 and d1 * d10 == m) ++ans;
                }
        }

        cout << ans << endl;
}


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

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

const double PI = 3.14159265358979323846;
const double EPS = 1e-12;
const ll INF = 1LL<<29;
const ll mod = 1e9+7;

#define rep(i, a, b) for(ll (i) = (a); (i) < (b);++i)

int main() {
	ll N, K;
	string S;
	cin >> N >> K >> S;
	ll seg = 1;
	rep(i,0,N-1) {
		if (S[i] != S[i+1]) {
			seg++;
		}
	}
	// cout << seg <<" "<< K << endl;
	int kari = min((seg-1)/2, K);
	seg -= 2*kari;
	K -= kari;
	// cout << seg <<" "<< K << endl;
	if (seg == 2 && K > 0) {
		seg--;
	}
	cout << N - seg << endl;
	
	// int ans = 0;
	// int cnt = 0;
	// ll kind = 0;
	// rep(i,0,N-1) {
	// 	if (S[i] == S[i+1]) {
	// 		cnt++;
	// 	}else{
	// 		kind++;
	// 		ans += cnt;
	// 		cnt = 0;
	// 	}
	// }
	// kind++;
	// ans += cnt;

	// if (kind == 1) {
	// 	cout << ans << endl;
	// 	return 0;
	// }

	// ans += 2 * min(kind - 2, K);
	// kind -= min(kind - 2, K);
	// K -= min(kind - 2, K);

	// if (K <= 2) {
	// 	ans += K;
	// 	// cout << ans << endl;
	// }
	// cout << ans << endl;
	return 0;
}


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

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define rep2(i, a, b) for (ll i = (a); i < (b); i++)
#define chmax(x, v) do { x = max(x, v); } while (0)
#define chmin(x, v) do { x = min(x, v); } while (0)
typedef uint64_t ull;
typedef int64_t ll;
typedef std::pair<ll, ll> PLL;

using namespace std;

signed main() {
  double L;
  cin >> L;
  printf("%.10f\n", (L*L*L/27.0));
  return 0;
}


Measured memory_bytes: 256
n,m,c = list(map(int, input().split()))
b = list(map(int, input().split()))
cnt = 0

for i in range(n):
  sum_ab = 0
  a = list(map(int, input().split()))
  for j in range(m):
    sum_ab += a[j]*b[j]
  if sum_ab+c > 0:
    cnt += 1
print(cnt)

Measured memory_bytes: 3060
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
#include<map>
#include<set>
#include<cstdio>
#include<cmath>
#include<deque>
#include<numeric>
#include<queue>
#include<stack>
#include<cstring>
#include<limits>
#include<functional>
#include<unordered_set>
#include<iomanip>
#include<cassert>
#include<regex>
#include<bitset>
#include<complex>
#include<chrono>
#include<random>
#define rep(i,a) for(int i=(int)0;i<(int)a;++i)
#define rrep(i,a) for(int i=(int)a-1;i>=0;--i)
#define REP(i,a,b) for(int i=(int)a;i<(int)b;++i)
#define RREP(i,a,b) for(int i=(int)a-1;i>=b;--i)
#define pb push_back
#define eb emplace_back
#define all(x) x.begin(),x.end()
using ll=long long;
constexpr ll mod = 1e9 + 7;
constexpr ll INF = 1LL << 60;

ll gcd(ll n, ll m) {
	ll tmp;
	while (m!=0) {
		tmp = n % m;
		n = m;
		m = tmp;
	}
	return n;
}

ll lcm(ll n, ll m) {
	return abs(n) / gcd(n, m)*abs(m);//gl=xy
}
 
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
 
using namespace std;

vector<vector<int>> grid_bfs(int h,int w,int x,int y,vector<string> &maze,char obstacle='#') {
  const int dx[] = { 1,0,-1,0}, dy[] = { 0,1,0,-1};//4方向移動
  const int init=1e7;
  vector<vector<int>>d(h,vector<int>(w,init));
	vector<vector<bool>>visited(h,vector<bool>(w));
  d[x][y]=0;
  deque<pair<int, int>>q;
	pair<int, int>p;
  q.emplace_back(x,y);
	while (!q.empty()) {
		p = q.front();
		q.pop_front();
		for (int i = 0; i < 4;++i) {
			int nx = p.first+dx[i]; int ny = p.second+dy[i];
			if (0 <= nx && nx < h && 0 <= ny && ny < w && !visited[nx][ny]) {
				if(maze[nx][ny]==obstacle){
					for(int a=-2;a<=2;++a){
						for(int b=-2;b<=2;++b){
							if(a==0&&b==0)continue;
							if(abs(dx[i]+a)>2||abs(dy[i]+b)>2)continue;
							if(0<=nx+a&&nx+a<h&&0<=ny+b&&ny+b<w&&maze[nx+a][ny+b]!='#'&&chmin(d[nx+a][ny+b],d[p.first][p.second]+1)){
								q.emplace_back(nx+a,ny+b);
							}
						}
					}
				}
				else {
					q.emplace_front(nx,ny),chmin(d[nx][ny],d[p.first][p.second]);
					visited[nx][ny]=true;
				}
			}
		}
	}
  return d;//initを含むことに注意
}

using P=pair<int,int>;
void solve(){
  int h,w;
  cin>>h>>w;
  vector<string>s(h);
  P start,goal;
	cin>>start.first>>start.second;
	start.first--;
	start.second--;
	cin>>goal.first>>goal.second;
	goal.first--;
	goal.second--;
  rep(i,h){
    cin>>s[i];
  }
  auto x=grid_bfs(h,w,start.first,start.second,s);
  if(x[goal.first][goal.second]==1e7)cout<<-1;
  else cout<<x[goal.first][goal.second];
}

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


Measured memory_bytes: 8872
def p(x):
 for i in range(7,int(x**.5+1),2):
  if x%i==0:return 0
 else:return 1
def f():
 n,c=map(int,input().split())
 s='9'*n
 if c<0:return(11,s+s)[n>1]
 for h in'9731':
  if n-1:
   for m in range(int(10**~-n),0,-1):
    if((int(h)+m-1)*2+c)%3:
     t=h+str(m-1).zfill(n-1)
     a=int(t+str(c)+t[::-1])
     if p(a):return a
  else:
   a=int(h+str(c)+h)
   if p(a):return a
 return s+b+s
print(f())


Measured memory_bytes: 5640
import java.util.Scanner;
public class Main{
	public static void main(String[] args){
		Scanner scan = new Scanner(System.in);
			int n = scan.nextInt();
			int m = scan.nextInt();
			int max = m;
			for(int i = 0;i < n;i++){
				int in = scan.nextInt();
				int out = scan.nextInt();
				if(m < 0){
					//continue;
					break;
				}
				m += in - out;
				if(max < m){
					max = m;
				}
			}
			System.out.println((m < 0)?0:max);
	}
}

Measured memory_bytes: 42044
#include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define all(x) (x).begin(),(x).end()
#define sz(x) ((int)(x).size())
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
typedef vector<bool> vb;
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 const INF = 1 << 30;


int main()
{
    int n;
    cin >> n;
    vector<int> a(n),b(n);
    rep(i,n) cin >> a[i];
    rep(i,n) cin >> b[i];

    vector<int> r(n+1,-1), l(n+1,-1);
    rep(i,n) r[a[i]] = i;
    drep(i,n) l[b[i]] = i;

    int d = 0;
    for(int i = 1; i <= n; ++i) {
        if(l[i] == -1 || r[i] == -1) continue;
        chmax(d, r[i]-l[i]+1);
    }

    rotate(b.begin(), b.begin() + n - d, b.end());

    rep(i,n) {
        if (a[i] == b[i]) {
            cout << "No\n";
            return 0;
        }
    }

    cout << "Yes\n";
    for (auto x : b) cout << x << " ";
    cout << "\n";
    return 0;
}

Measured memory_bytes: 6400
#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using vec=vector<ll>;
using mat=vector<vec>;
#define For(i,a,b) for(i=a;i<b;i++)
#define bFor(i,a,b) for(i=a;i>=b;i--)
#define rep(i,N) For(i,0,N)
#define rep1(i,N) For(i,1,N)
#define brep(i,N) bFor(i,N-1,0)
#define all(v) (v).begin(),(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define vsort(v) sort(all(v))
#define vrsort(v) sort(allr(v))
#define mod 1000000007
#define endl "\n"
#define output(v) do{bool f=0;for(auto i:v){cout<<(f?" ":"")<<i;f=1;}cout<<endl;}while(0)
using datas=pair<ll,ll>;
using tdata=pair<ll,datas>;

long mmid(long a,long b,long c){return a<b?(b<c?b:max(a,c)):(b>c?b:min(a,c));}

ll modinv(ll a) {
  ll b=mod,u=1,v=0,t;
  while(b){
    t=a/b;
    a-=t*b; swap(a,b);
    u-=t*v; swap(u,v);
  }
  return (u+mod)%mod;
}

ll moddevide(ll a,ll b){return (a*modinv(b))%mod;}

ll modncr(ll n,ll r){
  ll i,plus=1;
  rep(i,r){
    plus=(plus*(n-i))%mod;
    plus=moddevide(plus,i+1);
  }
  return plus;
}

ll modncrlistp[200000],modncrlistm[200000];

ll modncrs(ll n,ll r){
  ll i,j;
  if(modncrlistp[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistp[i])break;
    }
    if(i<0){
      modncrlistp[0]=1;
      rep1(i,n+1){
        modncrlistp[i]=(modncrlistp[i-1]*i)%mod;
      }
    }else{
      For(j,i+1,n+1){
        modncrlistp[j]=(modncrlistp[j-1]*j)%mod;
      }
    }
  }
  if(modncrlistm[n]==0){
    for(i=n;i>=0;i--){
      if(modncrlistm[i])break;
    }
    if(i<0){
      modncrlistm[0]=1;
      rep1(i,n+1){
        modncrlistm[i]=(modncrlistm[i-1]*modinv(i))%mod;
      }
    }else{
      For(j,i+1,n+1)modncrlistm[j]=(modncrlistm[j-1]*modinv(j))%mod;
    }
  }
  return (((modncrlistp[n]*modncrlistm[r])%mod)*modncrlistm[n-r])%mod;
}

ll gcd(ll a,ll b){if(!b)return a;return (a%b==0)?b:gcd(b,a%b);}

ll countdigits(ll n){
  ll ans=0;
  while(n){n/=10;ans++;}
  return ans;
}

ll sumdigits(ll n){
  ll ans=0;
  while(n){ans+=n%10;n/=10;}
  return ans;
}

vec eratosthenes(ll N){
  ll i;
  vec ch(N+1,1),p;
  ch[0]=ch[1]=0;
  rep(i,N+1){
    if(ch[i]){
      p.push_back(i);
      for(ll j=2;i*j<=N;j++){
        ch[i*j]=0;
      }
    }
  }
  return ch;
}
int main(){
  ll i,j,N;
  cin>>N;
  vector<ll> a(N),ans(N);
  string ss;
  brep(i,N){
    cin>>a[i];
  }
  rep(i,N){
    j=i/2;
    if(i%2){
      ans[N-j-1]=a[i];
    }else{
      ans[j]=a[i];
    }
  }
  output(ans);
  return 0;
}

Measured memory_bytes: 5248
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <numeric>
#include <queue>
#include <stack>
#include <map> 
#include <set>
#include <string>
#include <functional>
#include <list>
#include <random>
#include <time.h>
#include <iomanip>
#include <assert.h>
#include <numeric>
#define int long long
#define ll long long
#define double long double
#define mod 1000000007
#define MAXN (int)1e+5 * 2+1
#define LL_MAX 9223372036854775807	//ない環境用
#define LL_HALFMAX 9223372036854775807 / 2	//ない環境用
#define MIN -(9223372036854775807 / 2)
#define INF 9223372036854775807 / 2
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
#define REPS(i,x) for(int i=1;i<=(int)(x);i++)
#define RREP(i,x) for(int i=((int)(x)-1);i>=0;i--)
#define RREPS(i,x) for(int i=((int)(x));i>0;i--)
#define repl(i,a,b) for(int i=(int)(a);i<(int)(b);i++)
#define mp make_pair


using namespace std;

std::mt19937 mt((int)time(0));

int dx[4] = { 0, 1, 0, -1 }; // x軸方向への変位
int dy[4] = { 1, 0, -1, 0 }; // y軸方向への変位

using Weight = int;
using Flow = int;
struct Edge {
	int src, dst;
	Weight weight;
	Flow cap;
	Edge() : src(0), dst(0), weight(0) {}
	Edge(int s, int d, Weight w) : src(s), dst(d), weight(w) {}
};
using Edges = std::vector<Edge>;
using Graph = std::vector<Edges>;
using Array = std::vector<Weight>;
using Matrix = std::vector<Array>;

void add_edge(Graph &g, int a, int b, Weight w = 1) {
	g[a].emplace_back(a, b, w);
	g[b].emplace_back(b, a, w);
}
void add_arc(Graph &g, int a, int b, Weight w = 1) { g[a].emplace_back(a, b, w); }

int zi[5];

signed main() {

	int a[3], b[3];
	rep(i, 3) {
		cin >> a[i] >> b[i];
		zi[a[i]]++;
		zi[b[i]]++;
	}
	bool f = true;
	for (int i = 1; i <= 4; i++) {
		if (zi[i] >= 3) f = false;
	}
	if (f) cout << "YES\n";
	else cout << "NO\n";

	return 0;
}

Measured memory_bytes: 256
#include<iostream>
#include<cstring>
#include<algorithm>
#include<string>
#include<vector>
#include<cstdio>
#include<cmath>
#define pb(in,tmp) in.push_back(tmp)
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,b) loop(i,0,b)
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
using namespace std;
char in[200]={'\0'};
char out[5][6]={
  {'a','f','k','p','u','z'},
  {'b','g','l','q','v','.'},
  {'c','h','m','r','w','?'},
  {'d','i','n','s','x','!'},
  {'e','j','o','t','y',' '},
};
int main(){
  while(cin>>in){
    int co=0;
    rep(i,200)if(in[i]!='\0')co++;
	if(co%2){rep(i,co)in[i]='\0';cout<<"NA"<<endl;continue;}
	bool a=true;
	rep(i,co){
	  if(!i%2&&(in[i]<='0'||in[i]>'6'))a=false;
	  if(i%2&&(in[i]<='0'||in[i]>'5'))a=false;
	}
	if(!a){rep(i,co)in[i]='\0';cout<<"NA"<<endl;continue;}
	rep(i,co){
	  int a,b;
	  a=in[i]-'1';
	  i++;
	  b=in[i]-'1';
	  cout<<out[b][a];
	}
    cout<<endl;
	rep(i,co)in[i]='\0';
  }
}

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

int main() {
 int n,m; cin >> n >> m;
 vector<string> a(n),b(m);
 rep(i,n)cin >> a[i];
 rep(i,m)cin >> b[i];
 int d=n-m,cnt=0;;
  for(int i=0;i<d+1;i++){
    for(int j=0;j<d+1;j++){
       bool flag=1;
      if(a[i][j]==b[0][0]){
        for(int k=0;k<m;k++){
          for(int l=0;l<m;l++){
            if(a[i+k][j+l]!=b[k][l]){
              flag=0;
              break;
            }
          }
          if(!flag)break;
        }
        if(flag){
          cout << "Yes" <<endl;
          return 0;
        }
        }
      }
    }
     cout << "No" <<endl;
     return 0;
  }

Measured memory_bytes: 256
#include <bits/stdc++.h>
#include <chrono>
#include <random>
#define ll long long int
#define ull unsigned long long int
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define rep(i,n) for(ll i=0;i<n;i++)
#define loop(i,a,b) for(ll i=a;i<=b;i++)
#define inputv(arr,n) for(ll i=0;i<n;i++){ll value;cin>>value;arr.pb(value);}
#define sz(a) ((ll)(a).size())
#define len(a) ((ll)(a).length())
#define precise cout<<fixed<<setprecision(0); 
#define F first
#define S second
#define vi vector <int> 
#define pll pair<ll,ll>
#define vpll vector<pll>
#define vs vector <string>
#define vc vector <char>
#define vl vector <ll>
#define YES cout<<"Yes\n"
#define NO cout<<"No\n"
#define all(c) (c).begin(),(c).end()
#define max3(a,b,c) max(max(a,b),c)
#define min3(a,b,c) min(min(a,b),c)
#define IOS { ios :: sync_with_stdio(false); cin.tie(0); cout.tie(0); }
inline ll max(ll a,ll b)
{return ((a>b)?a:b);}
inline ll min(ll a,ll b)
{return ((a>b)?b:a);}
inline ll gcd(ll a ,ll b)
{if(b==0) return a;a%=b;return gcd(b,a);}
#define nl cout<<"\n"
using namespace std;
ll power(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll modInverse(ll a){return power(a,mod-2);}
const int N=500023;
// hashing for pairs
struct HASH{
  size_t operator()(const pair<int,int>&x)const{
    return hash<long long>()(((long long)x.first)^(((long long)x.second)<<32));
  }
};
//sort in reverse order
bool compare(ll x, ll y){
    return x>y;
}
void solve()
{
  ll n;
  cin>>n;
  ll arr[n];
  rep(i,n)
  {
    char ch;
    cin>>ch;
    if(ch=='W')
    {
      arr[i]=1;
    }
    else
    {
      arr[i]=0;
    }
    
  }
  ll ans=0,val=0;
  rep(i,n)
  {
    ans+=arr[i];
  }
  loop(i,n-ans,n-1)
  {
    val+=arr[i];
  }
  cout<<ans-val;nl;
  return;
}
int main()
{
    IOS;
    int T=1;
    //cin>>T;
    int t=0;
    while(t++<T)
    {
        //cout<<"Case #"<<t<<":"<<' ';
        solve();
        //cout<<'\n';
    }
    cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC << "ms\n";
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(M);
  vector<int> B(M);
  vector<vector<int>> komiti(N + 1, vector<int> ());

  for(int i = 0; i < M; ++i){
    cin >> A.at(i);
    cin >> B.at(i);

    komiti.at(A.at(i)).push_back(B.at(i));
    komiti.at(B.at(i)).push_back(A.at(i));
  }

  vector<int> guidePost(N + 1, -1);
  queue<int> que;
  for(auto v: komiti.at(1)){
    if(guidePost.at(v) == -1) {
      que.push(v);
      guidePost.at(v) = 1;
    }
  }

  while(!que.empty()){
    queue<int> que2;
    while(!que.empty()){
      int qf = que.front();
      que.pop();
      for(auto v: komiti.at(qf)){
        if(guidePost.at(v) == -1) {
          que2.push(v);
          guidePost.at(v) = qf;
        }
      }
    }
    que = que2;
  }

  for(int i = 1; i < N + 1; ++i){
    if(guidePost.at(i) == -1){
      cout << "No" << endl;
      return 0;
    }
  }

  cout << "Yes" << endl;
  for(int i = 2; i < N + 1; ++i){
    cout << guidePost.at(i) << endl;
  }  
}


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

int main() {
	int N, K, x, count = 0;
	cin >> N >> K;
	for (int i = 0; i < N; i++) {
		cin >> x;
		count += min(x, K - x);
	}
	cout << count * 2 << endl;
}

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

int main(){
    int n,r;
    cin >> n>>r;
    int ans=0;
    if(n>=10)
        ans = r;
    else{
        ans = r + 100*(10-n);
    }

    cout <<ans<<endl;
}






Measured memory_bytes: 3632
#include <bits/stdc++.h>
using namespace std;
using lint = long long int;
using P = pair<int, int>;
using PL = pair<lint, lint>;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define IFOR(i, begin, end) for(int i=(end)-1,i##_begin_=(begin);i>=i##_begin_;i--)
#define REP(i, n) FOR(i,0,n)
#define IREP(i, n) IFOR(i,0,n)
#define ALL(a)  (a).begin(),(a).end()
constexpr int MOD = 1000000007;
constexpr int INF = 2147483647;
void yes(bool expr) {cout << (expr ? "Yes" : "No") << "\n";}
int main()
{
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  lint N;
  cin >> N;
  vector<lint> A(N);
  REP(i, N) cin >> A[i];
  lint money = 1000;
  lint stock = 0;
  REP(i, N) {
    //cout << money << endl;
    if(i == N-1 || A[i+1] < A[i]) {
      money += stock * A[i];
      stock = 0;
    } else {
      if(stock == 0) {
        stock = money / A[i];
        money -= stock * A[i];
      }
    }
  }
  cout << money << endl;
}

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

int main() {
  
  int N; cin >> N;
  int64_t ans = 0;
  
  for(int i=1; i<=N; i++){
    if(i%3 != 0 && i%5 != 0){
      ans += i;
    }
  }
  
  cout << ans << endl;
  
}

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

int B[22];
int main()
{
	int N,M,C;
  	cin>>N>>M>>C;
  	for(int i=0;i<M;i++)
      cin>>B[i];
  	int ans = 0 ; 
  	for(int i=0;i<N;i++)
    {
      int res = C,x;
      for(int i=0;i<M;i++)
      {
        cin>>x;
        res+=(x*B[i]);
      }
      if(res>0)
        ans++;
    }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>

using namespace std;

int main() {
    int h, w;
    cin >> h >> w;
    vector<string> S(h);
    for (int i = 0; i < h; i++) cin >> S[i];

    int count[h + 2][w + 2];
    for (int i = 0; i < h + 2; i++) {
        for (int j = 0; j < w + 2; j++) {
            count[i][j] = h + w;
        }
    }
    for (int i = 0; i < h; i++) {
        for (int j = 0; j < w; j++) {
            if (S[i][j] == '#') {
                count[i + 1][j + 1] = 0;
            } else {
                count[i + 1][j + 1] = min(count[i][j + 1], count[i + 1][j]) + 1;
            }
        }
    }
    int ret = 0;
    for (int i = h; i > 0; i--) {
        for (int j = w; j > 0; j--) {
            count[i][j] = min(count[i][j], min(count[i][j + 1], count[i + 1][j]) + 1);
            ret = max(ret, count[i][j]);
        }
    }
    cout << ret << endl;
}


Measured memory_bytes: 5248
#include <algorithm>
#include <cstring>
#include <deque>
#include <iostream>
#include <limits>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define rep(i, a, n) for(int i = a; i < n; i++)
using namespace std;
using ll = long long;
using P = pair<int, int>;

int main()
{
    string s, t;
    cin >> s >> t;
    rep(i, 0, s.size()){
        if(s[i] != t[i]){
            cout << "No" << endl;
            return 0;
        }
    }
    cout << "Yes" << endl;
    return 0;
}


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

int main() {
  int K; cin >> K;
  int D = 1;
  deque<int> n; n.push_back(0);
  for (int k = 0; k < K; k++) {
    int d = D - 1;
    while (true) {
      if (d < 0) {
        n.push_front(1);
        D++; d = 0; break;
      }
      n[d]++;
      if (n[d] < 10 && (d == 0 || n[d] <= n[d-1] + 1))
        break;
      d--;
    }
    d++;
    for (; d < D; d++)
      n[d] = max(0, n[d-1]-1);
  }
  for (int d = 0; d < D; d++) cout << n[d];
  cout << endl;
}


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

int main(){
    int flag=1;
    int n,m;
    string s;
    map<string, int> m1;
    map<string, int>::iterator p;
    int ans=0;

    cin >>n;
    for (int i = 0; i < n; i++){
        cin >>s;
        p = m1.find(s);

        if(p != m1.end()){
            (p->second)++;
        }else{
            m1[s]=1;
        }

    }
    
    cin >>m;
    for (int i = 0; i < m; i++){
        cin >>s;
        p = m1.find(s);

        if(p != m1.end()){
            (p->second)--;
        }
    }

    for (p = m1.begin(); p !=m1.end(); p++){
        ans = max(ans,p->second);
    }
    
    cout << ans <<endl;
    //cout <<fixed<<setprecision(16)<< ans <<endl;

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


Measured memory_bytes: 256
#pragma gcc optimize("Ofast")
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(V) (V).begin(),(V).end()
#define SORT(V) sort(ALL(V)) //小さい方からソート
#define REV(V) reverse(ALL(V)) //リバース
#define RSORT(V) SORT(V);REV(V) //大きい方からソート
#define NPN(V) next_permutation(ALL(V)) //順列
#define pb(n) push_back(n)
#define endl '\n'
#define Endl '\n'
#define DUMP(x)  cout << #x << " = " << (x) << endl
#define YES(n) cout << ((n) ? "YES" : "NO"  ) << endl
#define Yes(n) cout << ((n) ? "Yes" : "No"  ) << endl
#define Yay(n) cout << ((n) ? "Yay!": ":(") << endl
#define RAPID cin.tie(0);ios::sync_with_stdio(false)
#define VSUM(V) accumulate(ALL(V), 0)
#define MID(a,b,c) (a) < (b) && (b) < (c)
#define MIDe(a,b,c) (a) <= (b) && (b) <= (c)
#define IN(n) cin >> n
#define IN2(a,b) cin >> a >> b
#define IN3(a,b,c) cin >> a >> b >> c 
#define IN4(a,b,c,d) cin >> a >> b >> c >> d
#define VIN(V) for(int i = 0; i < (V).size(); i++) {cin >> (V).at(i);}
#define OUT(n) cout << n << endl
#define VOUT(V) REP(i, (V).size()) {cout << (V)[i] << endl;}
#define VOUT2(V) REP(i, (V).size()) {cout << (V)[i] << " ";} cout<<endl;

// 型マクロ定義
#define int long long
#define P pair<ll,ll>
#define Vi vector<ll>
#define Vd vector<double>
#define Vs vector<string>
#define Vc vector<char>
#define M map<ll,ll>
#define S set<ll>
#define PQ priority_queue<ll>
#define PQG priority_queue<ll,V,greater<ll>
//

const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int gcd(int a,int b){return b != 0 ? gcd(b, a % b) : a;} //最大公約数
int lcm(int a, int b){return a * b / gcd(a, b);}
string toStrUp(string str){char diff = 'A'-'a';REP(i,str.size()) str[i] += diff;return str;}
string gCh(string str, int key){return str.substr(key,1);}

signed main() {
  RAPID;
  // デフォルト変数定義
  int n=0,m=0,a=0,b=0,c=0,d=0,x=0,y=0,z=0;
  string s="",t="";
  //

  // ここから
  IN2(a,b);
  string r1,r2;
  int r3,r4;
  REP(i,b){
    r1 += to_string(a);
  }
  REP(i,a){
    r2 += to_string(b);
  }
  if(r1 > r2){
    OUT(r2);
  }else {
    OUT(r1);
  }
}

Measured memory_bytes: 256
// #pragma GCC optimize("O3", "unroll-loops")
// #pragma GCC target("avx2")

#include <bits/stdc++.h>
using namespace std;

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds;

typedef long long int ll;
#define endl '\n'
#define ld long double
#define all(a) a.begin(),a.end()
#define int long long
#define pb push_back
#define pii pair <int, int>
#define ff first
#define ss second
#define sz(v) (int)v.size()
#define OST tree<pii, null_type,less<pii>, rb_tree_tag,tree_order_statistics_node_update>

const int INF = 1e15 + 0;
const int mod = 1e9 + 7;
//const int mod = 998244353;

set <int> s;

void give(int n){
  for(int i = 1; i*i <= n; i++){
    if(n%i) continue;
    s.insert(i); s.insert(n/i);
  }
}

int ok(int n, int i){
   while(n%i == 0){
       n/=i;
   }
   return((n-1)%i == 0);
}

signed main(){
    ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

    // #ifndef ONLINE_JUDGE
    //   freopen("input.txt", "r", stdin);
    //   freopen("output.txt", "w", stdout);
    // #endif
  int n; cin >> n;
  give(n-1);
  for(int i = 2; i*i <= n; i++){
    if(n%i) continue;
    if(ok(n,i))s.insert(i);
    if(ok(n,n/i))s.insert(i); 
  }
  cout << sz(s) << '\n';
}



Measured memory_bytes: 256
#include <unordered_set>
#include <string>
#include <cmath>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <iostream>
#include <queue>
#include <tuple>
#include <functional>
#include <set>

void run() {
	int N;
	std::cin >> N;
	int cnt[200];
	memset(cnt, 0, sizeof(cnt));
	for (int i = 0; i < N; ++i) {
		int d;
		std::cin >> d;
		++cnt[d];
	}
	int ans = 0;
	for (int v : cnt){
		if (v > 0)
			++ans;
	}
	std::cout << ans << std::endl;
}
int main() {
	run();
	return 0;
}


Measured memory_bytes: 888
# -*- coding: utf-8 -*-
import sys

s = (input().split(' '))

a,b = [int(i) for i in s]

price = 0

if 0 <= a <= 5:
    price = 0
elif 5 < a <= 12:
    price = b // 2
else:
    price = b

print(price)

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

int main(){
  int n;
  int l[2000];
  int ans=0;
  
  cin >> n;
  for(int i=0;i<n;i++)cin >> l[i];
  sort(l, l+n);
  
  for(int i = 0; i < n; i++){
    //最大の辺がl[i]
    for(int j = 0;j < i; j++){
      for(int k = j+1;k < i; k++){
          //三角形できるか
          if(l[k]+l[j]>l[i])ans++;
    }}
  }
  
  cout << ans;
  return 0;
}

Measured memory_bytes: 384
#include "bits/stdc++.h"
#include <math.h>
#include <time.h>
using namespace std;
void solve(){
    vector<string> day(7);
    day.at(0) = "SUN";
    day.at(1) = "MON";
    day.at(2) = "TUE";
    day.at(3) = "WED";
    day.at(4) = "THU";
    day.at(5) = "FRI";
    day.at(6) = "SAT";
    string s;
    cin >> s;
    for(int i = 0; i < 7; i++){
        if(day.at(i) == s){
            cout << 7 - i << endl;
        }
    }
}
int main(){
    solve();
    return 0;
}


Measured memory_bytes: 256