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

#define FAST ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0);srand(time(NULL))
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define el endl
#define INF LONG_LONG_MAX
#define MINF LONG_LONG_MIN
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define RFOR(i,a,b) for(ll i=a;i>b;i--)
#define gcd(a,b) __gcd((a),(b))
#define lcm(a,b) (a*b)/gcd(a,b)
#define PI 3.141592653589793
#define MOD 1000000007

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;

ll b_power(ll a,ll b);            // a^b
ll min_div(ll n);                 // minimum divisor from 2 to ....n
int is_prime(ll n);               // is prime!
ll ncr(ll n, ll c);		  // ncr(combination)

// ---------------------------------------------------------------------------------------------------
int main() {
        FAST;
		ll r,b,g,n;
		cin >> r >> b >> g >> n;
		ll cnt = 0;
		for(int i=0 ; i<=n ; i++){
			ll nr = i*r;
				if(nr==n)
					cnt++;
				else{			
				for(int j=0; j<=n ; j++){
					ll nb = j*b;
					if(nr + nb == n){
						cnt++;
						break;
					}
					ll temp = n - nr - nb;
					if(temp%g==0 && temp>0)
						cnt++;
				}
			}
		}
		cout << cnt;
   
}

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

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

ll min_div(ll n)
{
    for(ll i=2;i*i<=n;i++){
        if(n%i==0){
            return i;
        }
    }
    return n;
}

int is_prime(ll n)
{
    if(n==2)
        return 1;
    for(ll i=2; i*i <= n; i++)
    {
        if(n%i==0)
        return 0;
    }
    
    return 1;
}

ll ncr( ll n, ll c){
    ll t=1;
    c = min(c,n-c);
    for(ll i=1; i<=c ;i++)
        t= (t*(n-i+1))/i;
    return t;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <cstdio>
#include <queue>
#include <stack>

using namespace std;

int main(){
  string S;
  cin >> S;
  vector<string> nums;
  for(int i=0;i<S.length(); ++i) nums.push_back(S.substr(i, 1));

  long sum = 0;
  string ssum = "";
  for(int i=0;i<(1 << (nums.size()-1));++i){
    ssum = nums[0];
    for(int k=0;k<nums.size()-1;++k){
      if(i & (1 << k)){
        sum += stol(ssum);
        ssum = "";
      }
      ssum += nums[k+1];
    }
    sum += stol(ssum);
  }
  cout << sum << endl;
}

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

int main() {
  int N, M;
  cin >> N >> M;
  vector<int> A(M);
  for (int i = 0; i < M; ++i)
    cin >> A[i];
  vector<vector<int>> B(M, vector<int>(N));
  for (int i = 0; i < M; ++i)
    for (int j = 0; j < N; ++j)
      cin >> B[i][j];

  vector<int> ans(N);
  for (int i = 0; i < M; ++i)
    for (int j = 0; j < N; ++j)
      if (B[i][j] == A[i])
        ++ans[j];
      else
        ++ans[A[i] - 1];

  for (int i = 0; i < N; ++i)
    cout << ans[i] << endl;
}


Measured memory_bytes: 3160
x = int(input())
ans = 0


for i in range(1, 100):
    if i**2 > x:
        ans = (i - 1)**2
        break

for i in range(1, 100):
    if i**3 > x:
        ans = max(ans, (i - 1)**3)
        break

for i in range(1, 100):
    if i**5 > x:
        ans = max(ans, (i - 1)**5)
        break

for i in range(1, 100):
    if i**7 > x:
        ans = max(ans, (i - 1)**7)
        break

print(ans)

Measured memory_bytes: 3064
from functools import lru_cache

@lru_cache(maxsize = None)
def canProd(i,m):
     
    if m == 0:
        return True
    if i >= n:
        return False
 
    res = canProd(i+1,m) or canProd(i+1,m-a[i])
    return res
 
 
n = int(input())
a = [int(x) for x in input().split()]
q = int(input())
m = [int(x) for x in input().split()]

rs = [None]*2001

maxm = max(m)
minm = min(m)

for i in range(minm,maxm+1):
    if canProd(0,i):
        rs[i] = "yes"
    else:
        rs[i] = "no"

for i in m:
    print(rs[i])

Measured memory_bytes: 19792
#include <iostream>
#include <algorithm>
#include <string>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include <queue>
#include <stack>
#include <cmath>
#include <map>
#include <iomanip>
#include <set>
using namespace std;

#define rep(i, s) for (int i = 0; i < s; ++i)
#define all(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define VEC(a, n) vector<int>a(n)
#define PQ(a) priority_queue<int>a
#define PQmin(a) priority_queue< int, :vector<int>, greater<int> >a
#define PAIR pair<int, int>
/*
sort(sp.begin(), sp.end(), [](PAIR l, PAIR r){
        return l.first<r.first || (l.first==r.first && l.second > r.second);
        });
*/

typedef long long  ll;

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

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





int main() {
    int n;
    string s;
    cin>>n;
    cin>>s;
    if(n%2!=0){
        cout<<"No"<<endl;
        return 0;
    }
    string t,u;
    for(int i=0;i<n/2;i++){
        t.push_back(s.at(i));
    }
    for(int i=n/2;i<n;i++){
        u.push_back(s.at(i));
    }
    if(t==u){
        cout<<"Yes"<<endl;
    }
    else{
        cout<<"No"<<endl;
    }



    return 0;
}

Measured memory_bytes: 256
#include<stdio.h>

int main(){
  int a[5],k,i,j,flag = 1;
  for(i = 0;i < 5;i++){
    scanf("%d",&a[i]);
  }scanf("%d",&k);
  for(i = 1;i < 5;i++){
    for(j = 0;j < i;j++){
      if(a[i]-a[j] > k||a[j]-a[i] > k){flag = 0;}
    }
  }if(flag){printf("Yay!\n");}
  else{printf(":(\n");}
  return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define fi first
#define se second
#define pb push_back
#define rep(i, s, n) for (int i = s; i < n; i++)
#define rrep(i, s, n) for (int i = (n)-1; i >= (s); i--)
#define REP(i,n) for(int i = 0;i < n; i++)
#define all(a) a.begin(),a.end()
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const long long MOD = 1000000007, INF = 1e18;
 
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
 
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return true;}return false;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return true;}return false;}
 
template<typename T>vector<T>
make_v(size_t a){return vector<T>(a);}
template<typename T,typename... Ts>
auto make_v(size_t a,Ts... ts){
	return vector<decltype(make_v<T>(ts...))>(a,make_v<T>(ts...));
}
 
template<typename T,typename V>
typename enable_if<is_class<T>::value==0>::type
fill_v(T &t,const V &v){t=v;}
 
template<typename T,typename V>
typename enable_if<is_class<T>::value!=0>::type
fill_v(T &t,const V &v){
	for(auto &e:t) fill_v(e,v);
}

int N;

signed main(){
	IOS();
	cin>>N;
	vector<int>w(N);
	int sum = 0;
	rep(i,0,N){
		cin>>w[i];
		sum += w[i];
	}
	int ans =INF;
	int tmp = 0;
	rep(i,0,N){
		sum -= w[i];
		tmp += w[i];
		chmin(ans,abs(sum-tmp));
	}
	cout<<ans<<endl;
}

Measured memory_bytes: 256
#include <stdio.h>
 
int main(int argc, char *argv[])
{
        int H, W;
        int i, j;
 
        while (1) {
                scanf("%d %d", &H, &W);
                if (H == 0 && W == 0) break;
 
                for (i = 0; i < H; i++) {
                        for (j = 0; j < W; j++) {
                                printf("#");
                        }
                        printf("\n");
                }
                printf("\n");
        }
 
        return 0;
}

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

int main()
{
  long double a, b, x, ans;
  cin >> a >> b >> x;
  long double c = a * a * b * 0.5;
  if (c >= x)
  {
    long double l = (2.0 * x) / (a * b);
    ans = atanl((long double)(b / l)) * 180.0 / M_PI;
  }
  else
  {
    int64_t y = (a * a * b) - x;
    long double l = (2.0 * y) / (a * a);
    ans = atanl((long double)(l / a)) * 180.0 / M_PI;
  }
  cout << fixed << setprecision(10) << ans << endl;
}

Measured memory_bytes: 3852
#include <cstdio>
#include <cstring>
#include <cassert>
#include <algorithm>
#include <vector>
#include <iostream>
#include <ctime>
#include <unistd.h>

using namespace std;

#define TRACE(x) cerr << #x <<  " = " << x << endl
#define _ << " " <<
#define FOR(i, a, b) for (int i=(a); i<(b); i++)
#define REP(i, n) FOR(i, 0, n)

#define X first
#define Y second

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

const int MOD = 1e9 + 7;

int add(int a, int b) {
  return (a+b) % MOD;
}

int sub(int a, int b) {
  return (a-b+MOD) % MOD;
}

int mul(int a, int b) {
  return (int) (((ll) a * b) % MOD);
}

int invv(int a) {
  int r=1, e=MOD-2;
  for (; e; e/=2, a=mul(a, a))
    if (e&1) r = mul(r, a);
  return r;
}

const int MAX = 1<<19;
int p[MAX];
int n;
int pref[MAX];

int main()
{
  pref[0] = 0;
  FOR(i, 1, MAX)
    pref[i] = add(pref[i-1], invv(i));

  scanf("%d", &n);
  int sol=0;
  REP(i, n) {
    scanf("%d", &p[i]);
    sol = add(sol, mul(p[i], sub(pref[i+1], 1)));
    sol = add(sol, mul(p[i], sub(pref[n-i], 1)));
    sol = add(sol, p[i]);
  }

  FOR(i, 1, n+1) sol = mul(sol, i);
  printf("%d\n", sol);

  return 0;
}



Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  string s;
  cin >> s;
  int ans = 0;
  rep(i,s.size()-1){
    if(s.at(i+1)==s.at(i)){
      s.at(i+1)='1'+'0'-s.at(i);
      ans++;
    }
  }
  cout << ans << endl;
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
typedef long long ll;
 
int main(){
    int n;cin>>n;
    ll ans=0;
    vector<int> a(n);
    vector<int> b(n);
    vector<int> c(n);
    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<n;i++) cin>>b[i];
    for(int i=0;i<n;i++) cin>>c[i];
    sort(a.begin(),a.end());
    sort(c.begin(),c.end());
    for(int i=0;i<n;i++){
        auto iter=lower_bound(a.begin(),a.end(),b[i]);
        ll index1=iter-a.begin();
        auto it=upper_bound(c.begin(),c.end(),b[i]);
        ll index2=it-c.begin();
        ans+=index1*(n-index2);
    }
    cout<<ans<<endl;
}

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

typedef long long ll;
#define REP(i,n) for(int i=0,_n=(int)(n);i<_n;++i)
#define ALL(v) (v).begin(),(v).end()
#define CLR(t,v) memset(t,(v),sizeof(t))
template<class T1,class T2>ostream& operator<<(ostream& os,const pair<T1,T2>&a){return os<<"("<<a.first<<","<<a.second<< ")";}
template<class T>void pv(T a,T b){for(T i=a;i!=b;++i)cout<<(*i)<<" ";cout<<endl;}
template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}


int nextInt() { int x; scanf("%d", &x); return x;}
int N;
string tbl[610];
int a[610][610];
int b[610][610];

int get(int x0, int y0, int x1, int y1) {
  return b[x1][y1] - b[x1][y0] - b[x0][y1] + b[x0][y0];
}

int main2() {
  cin >> N;
  REP(i, N) {
    string s; cin >> s;
    tbl[i] = (s+s);
    tbl[i + N] = (s+s);
  }
  // REP(i, 2*N) {
    // cout << tbl[i] << endl;
  // }

  int ans = 0;
  
  for (int d = -(N-1); d <= N-1; d++) {
    const int si = max(-d, 0);
    const int sj = max(d, 0);

    CLR(a, 0);
    CLR(b, 0);
    REP(i, 2*N) REP(j, 2*N) {
      int i2 = j - sj + si;
      int j2 = i - si + sj;
      if (0 <= i2 && i2 < 2*N && 0 <= j2 && j2 < 2*N && tbl[i][j] == tbl[i2][j2]) {
        a[i][j] = 1;
      }
    }
    // cout << si << " " << sj << endl;
    // REP(i, 2*N+1) {
      // pv(a[i], a[i]+2*N+1);
    // }
    // cout << "b=" << endl;
    REP(i, 2*N) REP(j, 2*N) {
      b[i+1][j+1] = a[i][j] + b[i+1][j] + b[i][j+1] - b[i][j];
    }
    // REP(i, 2*N+1) {
      // pv(b[i], b[i]+2*N+1);
    // }

    for (int i = si, j = sj; i < N && j < N; i++, j++) {
      // cout << i << " " << j << endl;
      if (get(i, j, i+N, j+N) == N*N) { ans++; }
    }
  }
  cout << ans << endl;
  return 0;
}

int main() {
  for (;!cin.eof();cin>>ws)
    main2();
  return 0;
}


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

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  vector<int> B(N);
  for(int i=1;i<N;i++){
    cin >> A.at(i);
  }
  
  sort(A.begin(),A.end());
  
  for(int i=1;i<N;i++){
    B.at(A.at(i)-1)++;
  }
  
  for(int i=0;i<N;i++){
    cout << B.at(i) << endl;
  }
  
  return(0);
}

Measured memory_bytes: 4840
#include <bits/stdc++.h>
#define LL long long
#define pi pair <int, int>
#define FAST_READ ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;





int main()
{
    FAST_READ;

    int a[105];
    int b[105];
    int n;
    cin >> n;
    int s = 0, s2 = 0;
    for(int i = 0; i < n; i++){
        cin >> a[i];
    }
    for(int i = 0; i < n; i++){
        cin >> b[i];
    }

    int sum;
    int Max = INT_MIN;
    for(int i = 0; i < n; i++){
        sum = 0;
        for(int k = 0; k <= i; k++) sum += a[k];
        for(int j = i; j < n; j++){
            sum += b[j];
        }
        Max = max(Max, sum);
    }

    cout << Max << "\n";
    return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <vector>
#include <cmath>
#include <iomanip>
#include <bitset>
#include <string>
#include <cstring>
#include <stdlib.h>
using namespace std;
//cout <<  << endl;
typedef long long int ll;
typedef long double ld;

using Graph = vector<vector<ll>>;

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

#define MAX_N 2010

const long long INF = 1LL << 60;

//境界値に注意！！！
int main() {
    ll n,i=1;
    cin >> n;
    while(i*i<=n){
        ++i;
    }
    cout << (i-1)*(i-1) << endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define double long double
#define N 3011

using namespace std;

double p[N], dp[N][N], pre[N];
int n;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	cin >> n;
	for(int i=0; i<n; i++) {
		cin >> p[i];
	}
	pre[0] = 1 - p[0];
	for(int i=1; i<n; i++) pre[i] = pre[i-1] * (1 - p[i]);
	for(int i=0; i<n; i++) {
		for(int j=0; j<=i+1; j++) {
			if(j == 0) dp[i][j] = pre[i];
			else if(i == 0) dp[i][j] = p[i];
			else dp[i][j] = dp[i-1][j] * (1 - p[i]) + dp[i-1][j-1] * p[i];
		}
	}
	double ans = 0;
	for(int i=(n+1)/2; i<=n; i++) {
		ans += dp[n-1][i];
	}
	cout << fixed << setprecision(10) << ans << endl;
	return 0;
}


Measured memory_bytes: 139776
import sys
from itertools import accumulate

N, K = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]

current_arr = A
if K > 41:
    print(*([N]*N))
else:
    for _ in range(K):
        imos = [0] * N
        ruiseki = [0] * (N+1)
        for i, ai in enumerate(current_arr):
            imos[max([0, i-ai])] += 1
            if i+ai+1 < N:
                imos[i+ai+1] -= 1
        for j, im in enumerate(imos):
            ruiseki[j+1] = ruiseki[j] + im
        current_arr = ruiseki[1:]
#print(imos)
#print(ruiseki)
#print(*accumulate(imos))
    print(*current_arr)


Measured memory_bytes: 172072
import itertools
n, k = map(int,input().split())
a = [i for i in range(2,n+1)]
a_comb = list(itertools.combinations(a,2))
if k > (n-1)*(n-2) // 2:
    print(-1)
else:
    ans = []
    for i in range(2, n+1):
        ans.append((1, i))
    for i in range((n-1)*(n-2)//2 - k):
        ans.append((a_comb[i][0], a_comb[i][1]))
    print(len(ans))
    for i in range(len(ans)):
        print(ans[i][0], ans[i][1])




Measured memory_bytes: 4356
#define _LIBCPP_DEBUG 0
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
ll MOD = 1e9 + 7;

int main(void){

    //int N,K; cin>>N>>K;
    int N; cin>>N;
    int fst=0,snd=0;
    vector<int> A(N);
    for (int i = 0; i < N; ++i) {
        int tmp; cin>>tmp;
        A[i]=tmp;
        if(tmp>=fst){
            swap(fst,snd);
            fst = tmp;
        }else if(tmp > snd){
            snd = tmp;
        }
    }

    for (int i = 0; i < N; ++i) {
        if(A[i]!=fst) cout<<fst<<endl;
        else cout<<snd<<endl;
    }

}

Measured memory_bytes: 2432
#include<iostream>
#include<string>
#include<vector>
#include<utility>
#include<algorithm>
using namespace std;
typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);

    int n, W;

    cin>>n>>W;
    vector<pair<int, int> > item(n);
    for(int i =0; i<n; i++)
        cin>>item[i].first>>item[i].second;

    vector<vector<ll> > dp(n,vector<ll> (W+1));

    for(int i =0; i< n; i++)
    {
        for(int j = 0; j<=W; j++)
        {
            if(i==0)
            {
                if(j>=item[i].first)
                    dp[i][j] = item[i].second;
            }
            else 
            {
                if(j>=item[i].first)
                    dp[i][j] = max(dp[i-1][j], item[i].second + dp[i-1][j - item[i].first]);
                else
                    dp[i][j] = dp[i-1][j];

            }   

        }
    }

    cout<<dp[n-1][W]<<"\n";
}

Measured memory_bytes: 79488
#include <vector>
#include <iostream>
using namespace std;
char **Sdata;
int H, W, K;

int MaxVerticalBar (int offset, vector<int> RegionEdge, int BarNumber)
{
	int MAX = offset;
	vector<int> Chocolates (BarNumber+1, 0);
	int ChocoEnd = 0;		

	for (MAX = offset; MAX < W; MAX++)
	{
		for (int i = 0; i <= BarNumber; i++)
			for (int i2 = RegionEdge[i]; i2 < RegionEdge [i+1]; i2++)
			{	
				Chocolates [i] += (int) (Sdata [i2] [MAX] - '0');
				if (Chocolates [i] > K)
				{
					if (MAX != 0)
						return MAX-1;
					else
						return 0;
				}
			}
	}
	return MAX;
};

int main(void)
{
    cin >> H >> W >> K;

	Sdata = new char * [H];
	for (int i = 0; i < H; i++)
	{
		Sdata [i] = new char [W];
		for (int j = 0; j < W; j++)
			cin >> Sdata[i][j];
	}
	int BarNumber = 0;
	vector<int> RegionEdge (H+1, 0);
	int WorldRecord = H + W;
	for (int UnderBar = 0; UnderBar < (1 << (H-1)); UnderBar++)
	{
		BarNumber = 0;
		for (int i = 0; i < H; i++)
		{
			if (((UnderBar >> i) & 1) != 0)
			{
				RegionEdge [BarNumber+1] = i+1;
				BarNumber++;
			}
		}
		RegionEdge [BarNumber+1] = H;

		if (BarNumber < WorldRecord)
        {
          int answer = BarNumber;
		  for (int offset = 0; offset < W; offset++)
		  {
			  int VerticalBar;
			  VerticalBar = MaxVerticalBar (offset, RegionEdge, BarNumber);
			  if (VerticalBar != W)
			    answer++;
			  if (WorldRecord <= answer)
			    break;
			  offset = VerticalBar;
		  }
	
		  if (WorldRecord > answer)
			  WorldRecord = answer;
		}
	}
	
	cout << WorldRecord << endl;
	
	for (int i = 0; i < H; i++)
		delete [] Sdata [i];
	delete [] Sdata;
}


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

typedef long long ll;

ll A, B;
int C, D;

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

int main(void) {
	cin >> A >> B >> C >> D;

	ll lcmCD = (ll)C / gcd((ll)C, (ll)D) * (ll)D;
	ll BdivC = B / C;
	ll BdivD = B / D;
	ll BdivCD = B / lcmCD;
	ll AdivC = (A - 1) / C;
	ll AdivD = (A - 1) / D;
	ll AdivCD = (A - 1) / lcmCD;

	ll cntB = B - BdivC - BdivD + BdivCD;
	ll cntA = (A - 1) - AdivC - AdivD + AdivCD;
	ll ans = cntB - cntA;

	cout << ans << '\n';
	return 0;
}


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

int main(){
	int i,num[5];
	for(i = 0;i < 5;i++){
		scanf("%d",&num[i]);
	}
	printf("%d\n",num[0] - std::max((num[1] - 1) / num[3],(num[2] - 1) / num[4]) - 1);
	return 0;
}

Measured memory_bytes: 1024
#include "math.h"
#include <set>
#include <algorithm>
#include <complex>
#include <cstdio>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <vector>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
using namespace std;
typedef long long int lli;
using P = complex<lli>;
int check(int a, int b, int c)
{
    return (a & 1) || (b & 1) || (c & 1);
}
int main()
{
    lli a, b, c;
    cin >> a >> b >> c;
    lli cnt = 0;
    while (!check(a, b, c)) {
        lli d = b / 2 + c / 2;
        lli e = a / 2 + c / 2;
        lli f = b / 2 + a / 2;
        a = d, b = e, c = f;
        cnt++;
        if (cnt > 1e6)
            break;
        //        cout << a << " " << b << " " << c << endl;
    }
    cout << (cnt > 1e6 ? -1 : cnt) << endl;
}


Measured memory_bytes: 256
def main():
    global s,ide_ele,num,seg
    n = int(input())
    s = list(input())
    for i in range(n):
        s[i] = ord(s[i])-97
    ide_ele = 0
    num = 2**(n-1).bit_length()
    seg = [[ide_ele for _ in range(2*num)] for _ in range(26)]
    for i in range(n):
        seg[s[i]][i+num-1] = 1
    for a in range(26):
        for i in range(num-2,-1,-1) :
            seg[a][i] = max(seg[a][2*i+1],seg[a][2*i+2])
    q = int(input())
    for _ in range(q):
        QUERY = list(input().split())
        QUERY[0], QUERY[1] = int(QUERY[0]), int(QUERY[1])
        if QUERY[0] == 1:
            x = ord(QUERY[2])-97
            k = QUERY[1]-1
            pre = s[k]
            s[k] = x
            k += num-1
            seg[pre][k] = 0
            seg[x][k] = 1
            while k:
                k = (k-1)//2
                seg[pre][k] = max(seg[pre][k*2+1],seg[pre][k*2+2])
                seg[x][k] = max(seg[x][k*2+1],seg[x][k*2+2])
        if QUERY[0] == 2:
            P, Q = QUERY[1]-1, int(QUERY[2])
            if Q <= P:
                print(ide_ele)
                break
            P += num-1
            Q += num-2
            ans = ide_ele
            for i in range(26):
                res = ide_ele
                p,q = P,Q
                while q-p > 1:
                    if p&1 == 0:
                        res = max(res,seg[i][p])
                    if q&1 == 1:
                        res = max(res,seg[i][q])
                        q -= 1
                    p = p//2
                    q = (q-1)//2
                if p == q:
                    res = max(res,seg[i][p])
                else:
                    res = max(max(res,seg[i][p]),seg[i][q])
                ans += res
            print(ans)

if __name__ == "__main__":
    main()

Measured memory_bytes: 438324
#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
long long int zenxor=0;
long long int lis[300000];
int main(){
    int N;
    cin>>N;
    for(int i=0;i<N;i++){
        long long int a;
        cin>>a;
        zenxor^=a;
        lis[i]=a;
    }
    for(int i=0;i<N;i++){
        cout<<(zenxor^lis[i]);
        if(i!=N-1)cout<<" ";
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 5076
#include<stdio.h>
int BubbleSort(int A[],int N){
  int i,j,temp,cnt=0;
  for(i=0;i<N-1;i++){
    for(j=N-1;j>=1;j--){
      if(A[j]<A[j-1]){
	temp = A[j];
	A[j]=A[j-1];
	A[j-1] = temp;
	cnt++;
      }
    }
  }
  return cnt;
}
int main(){
  int A[100],N,i,j,cnt;
  scanf("%d",&N);
    for(i=0;i<N;i++) scanf("%d",&A[i]);
    cnt = BubbleSort(A,N);

    for(i=0;i<N;i++){
      if(i>0) printf(" ");
      printf("%d",A[i]);
    }
    printf("\n%d\n",cnt);
      return 0;
}



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

#define rep(i,s,n) for (int i = (int)s; i < (int)n; i++)
#define ll long long
#define ld long double
#define pb push_back
#define eb emplace_back
#define All(x) x.begin(), x.end()
#define Range(x, i, j) x.begin() + i, x.begin() + j
#define lbidx(x, y) lower_bound(x.begin(), x.end(), y) - x.begin()
#define ubidx(x, y) upper_bound(x.begin(), x.end(), y) - x.begin()
#define llbidx(x, y, z) lower_bound(x.begin(), x.end(), z) - lower_bound(x.begin(), x.end(), y) // 二要素間の距離
#define deg2rad(deg) ((((double)deg)/((double)360)*2*M_PI))
#define rad2deg(rad) ((((double)rad)/(double)2/M_PI)*(double)360)
#define Find(set, element) set.find(element) != set.end()
#define Decimal(x) printf("%.10f\n", x) // 小数点を10桁まで表示
// debug用
#define PrintVec(x) for (auto elementPrintVec: x) { cout << elementPrintVec << " "; } cout << "\n";
#define debug(x) cerr << #x << ": " << (x) << "\n";
#define endl "\n"
// gcj print用
#define Case(x) printf("Case #%d: ", x);

typedef pair<int, int> PI;
typedef pair<ll, ll> PLL;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<vector<vector<int>>> vvvi;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef vector<vector<vector<int>>> vvvl;
typedef vector<PI> vpi;
typedef vector<vector<PI>> vvpi;
typedef vector<vector<vector<PI>>> vvvpi;
typedef vector<PLL> vpl;
typedef vector<vector<PLL>> vvpl;
typedef vector<vector<vector<PLL>>> vvvpl;

int POWINT(int x, int n) {
  int ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

ll POWLL(ll x, int n) {
  ll ret = 1;
  while (n > 0) {
    if (n & 1) ret *= x;
    x *= x;
    n >>= 1;
  }
  return ret;
};

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

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

void print() {
  cout << endl;
}

template <class T>
void print(vector<T> &vec) {
  for (auto& a : vec) {
    cout << a;
    if (&a != &vec.back()) cout << " ";
  }
  cout << endl;
}

template <class T>
void print(vector<T> &vec, ll k){
   ll n = vec.size();
   k = min(k, n);
   rep(i, 0, k-1) cout << vec[i] << " ";
   cout << vec[k-1] << endl;
}

template <class T>
void print(vector<vector<T>> &df) {
  for (auto& vec : df) {
    print(vec);
  }
}

template<class T, class U>
void print(pair<T,U> &p){
  cout << p.first << " " << p.second << "\n";
}

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

  int r, g; cin >> r >> g;
  cout << 2 * g - r << endl;

  return 0;
};


Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
int main(void){
	char s[200],t[200];
	scanf("%s",s);
	int i=1,j;
	while(1){
		int l=strlen(s)- 2*i;
		strncpy(t,s,l);
		t[l]='\0';
		for(j=0;j<l/2;j++){if(t[j]!=t[l/2+j]){i++;break;}}
		if(j==l/2){printf("%d",strlen(t));return 0;}
	}
}

Measured memory_bytes: 128
import static java.lang.Character.*;

import java.util.Scanner;

public class Main{

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		String N = sc.next();
		
		long t = 0;
		for(int i = 0; i < N.length(); i++)
			t += getNumericValue(N.charAt(i));
		
		if(t % 9 == 0)
			System.out.println("Yes");
		else
			System.out.println("No");
	}

}


Measured memory_bytes: 40408
#include<iostream>
#include<cstdio>
#include<cstring>
#include <cstdlib>  
#include <math.h>
#include <cmath>
#include<complex>
#include<cctype>
#include<string>
#include<set>
#include<iomanip>
#include <map>
#include<algorithm>
#include <functional>
#include<vector>
#include<climits>
#include<stack>
#include<queue>
#include<bitset>
#include <deque>
#include <climits>
#include <typeinfo>
#include <utility> 
#include <numeric>
using namespace std;
using Complex = complex<double>;
using ll = long long;
template<typename T>using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
const ll inf = 1145141919810364364LL;
const double EPS = 1e-10;
double PI = acos(-1.0);
#define all(x) (x).begin(),(x).end()
#define puts(x) cout << x << endl
#define rep(i,m,n) for(ll i = m;i < n;++i)
#define pb push_back
#define fore(i,a) for(auto &i:a)
#define rrep(i,m,n) for(ll i = m;i >= n;--i)


struct Segmenttree {
	static const int N = 1 << 18;
	vector<ll>seg;
	vector<ll>idx;
	void st(ll p, ll v) {
		p += N - 1;
		seg[p] = v;
		idx[p] = p - N + 1;
		while (p > 0) {
			p = (p - 1) / 2;
			seg[p] = min(seg[2 * p + 1], seg[2 * p + 2]);
			if (seg[2 * p + 1] > seg[2 * p + 2])idx[p] = idx[2 * p + 2];
			else if (seg[2 * p + 1] < seg[2 * p + 2])idx[p] = idx[2 * p + 1];
			else idx[p] = min(idx[2 * p + 1], idx[2 * p + 2]);
		}
	}
	pair<ll, ll> query(ll l, ll r, ll a, ll b, ll k) {
		if (r <= a || b <= l)return { inf,inf };
		if (l <= a && b <= r)return { seg[k],idx[k] };
		ll m = (a + b) / 2;
		auto p1 = query(l, r, a, m, 2 * k + 1);
		auto p2 = query(l, r, m, b, 2 * k + 2);
		if (p1.first < p2.first) return p1;
		else if (p1.first > p2.first)return p2;
		else return { p1.first,min(p1.second,p2.second) };
	}

	void init() {
		seg.resize(2 * N);
		idx.resize(2 * N);
		for (int i = 0; i < 2 * N; i++)seg[i] = inf;
	}
	//[l,r]
	ll get(int l, int r) {
		return query(l, r + 1, 0, N, 0).first;
	}
	ll getidx(int l, int r) {
		return query(l, r + 1, 0, N, 0).second;
	}
	pair<ll, ll>getp(int l, int r) {
		return query(l, r + 1, 0, N, 0);
	}
};

ll h[101010];

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

	int N;
	cin >> N;
	Segmenttree seg = Segmenttree();
	seg.init();

	for (int i = 0; i < N; i++) {
		cin >> h[i];
		seg.st(i, h[i]);
	}

	ll ans = 0;
	for (int i = 0; i < N; i++) {
		//右
		int ok = i; int ng = N;
		while (ng - ok > 1) {
			int mid = (ng + ok) / 2;
			if (seg.get(i, mid) >= h[i])ok = mid;
			else ng = mid;
		}
		ll right = ok;
		//左
		ok = i; ng = -1;
		while (ok - ng > 1) {
			int mid = (ng + ok) / 2;
			if (seg.get(mid,i) >= h[i])ok = mid;
			else ng = mid;
		}
		ll left = ok;
		ans = max(ans,h[i]*(right - left + 1));
	}
	puts(ans);
	

	return 0;
}


Measured memory_bytes: 11812
#include<bits/stdc++.h>
#define mod 998244353
using namespace std;
typedef long long int ll;
#define f(i, n) for(int i = 0; i < n; ++i)
#define pb push_back

void input(){
    ll r; cin >> r;
    cout << 3 * r * r << endl;
}
int main()
{
 input();
 return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
#define endl "\n"
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define MOD 1000000007
#define MOD9 1000000009
#define pi 3.1415926535
#define ms(s, n) memset(s, n, sizeof(s))
#define prec(n) fixed<<setprecision(n)
#define eps 0.000001
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define forr(i,p,n) for(ll i=p;i<n;i++)
#define MAXN 500003
typedef long long ll;

using namespace std;
ll mult(ll a,ll b, ll p=MOD){return ((a%p)*(b%p))%p;}
ll add(ll a, ll b, ll p=MOD){return (a%p + b%p)%p;}
ll fpow(ll n, ll k, ll p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n%p; n = n * n%p;} return r;}
ll inv(ll a, ll p = MOD) {return fpow(a, p - 2, p);}
ll inv_euclid(ll a, ll m = MOD){ll m0 = m;ll y = 0, x = 1;if (m == 1)return 0;while (a > 1){ll q = a / m;ll t = m;m = a % m, a = t;t = y;y = x - q * y;x = t;}if (x < 0)x += m0;return x;}




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

vector<ll>v;
 ll sum=0,act=0,k,n,q,f;
cin>>n;
v.reserve(n);
ll dp[n]={0};
forr(i,0,n)
    {
        cin>>f;
        v.pb(f);
      
    }
    dp[n-1]=0;
    dp[n-2]=abs(v[n-1]-v[n-2]);
    if(n==2)
    {
        sum=abs(v[0]-v[1]);
        cout<<sum<<endl;
        return 0;
    }
  sum=0;
    
    
    for(ll i=n-3;i>=0;i--)
    {
      dp[i]=min(dp[i+1]+abs(v[i]-v[i+1]),dp[i+2]+abs(v[i]-v[i+2])); 
    }
    cout<<dp[0]<<endl;

return 0;
}


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

int main() {
	string line;
	cin>>line;
	int len=line.length();
	bool phrase=true;
	string a="dream";
	string b="dreamer";
	string c="eraser";
	string d="erase";
	while (line.length()>0){
		if (line.substr(len-5,5)==d or line.substr(len-5,5)==a){
			line=line.substr(0,len-5);
			len -= 5;
		} 
		else if (line.substr(len-6,6)==c){
			line=line.substr(0,len-6);
			len -= 6;
		} 
		else if (line.substr(len-7,7)==b){
			 line=line.substr(0,len-7);
			 len -=7;
		}
		else {
			phrase=false;
			break;
		}
	}
	if (phrase==true){
		cout << "YES" << endl;
	}
	else{
		cout << "NO" << endl;
	}
}

Measured memory_bytes: 512
#include <bits//stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(obj) begin(obj), end(obj)
int n;
int main(void) {
    cin >> n; vector<int> p(n+1), tmp(n+1);
    rep(i, n) cin >> p[i];
    rep(i, n) tmp[p[i]] = 1 + tmp[p[i] - 1];
    cout << n - *max_element(ALL(tmp)) << endl;
}

Measured memory_bytes: 4812
#include <bits/stdc++.h>
using namespace std;
int main(void){
  int n,m;
  const int NMMAX = 50;
  cin >> n >> m;
  int a[NMMAX],b[NMMAX];
  for(int i=0;i<m;i++){
    cin >> a[i] >> b[i];
  }
  int count[NMMAX];
  for(int i=0;i<NMMAX;i++){
    count[i] = 0;
  }
  for(int i=0;i<m;i++){
    count[a[i]-1]++;
    count[b[i]-1]++;
  }
  for(int i=0;i<n;i++){
    cout << count[i] << endl;
  }
  return 0;
}

Measured memory_bytes: 3632
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
INF = 10**9


"""
UnionFind
要素を素集合(互いに素)に分割して管理するデータ構造
O(α)<O(log)
逆アッカーマン関数
"""

class UnionFind():

    def __init__(self,n):
        self.n = n
        self.parents = [-1]*n #各要素の親要素の番号を格納するリスト
    
    #要素xが属するグループの根を返す
    def find(self,x):
        if self.parents[x]<0:
            return x
        else:
            self.parents[x] = self.find(self.parents[x])
            return self.parents[x]
    
    #要素xと要素yが属するグループを併合する   
    def union(self,x,y):
        x = self.find(x)
        y = self.find(y)

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

    #要素xが属するグループのサイズを返す
    def size(self,x):
        return -self.parents[self.find(x)]
    
    #要素x,yが同じグループかどうかを返す
    def same(self,x,y):
        return self.find(x) == self.find(y)
    
    #要素xと同じグループのメンバーを返す
    def members(self,x):
        root = self.find(x)
        return [i for i in range(self.n) if self.find(i) == root]
    
    #すべての根の要素を返す
    def roots(self):
        return [i for i,x in enumerate(self.parents) if x<0]
    
    #グループの数を返す
    def group_count(self):
        return len(self.roots())
    
    def all_group_members(self):
        return {r: self.members(r) for r in self.roots()}
    
    def __str__(self):
        return "\n".join("{}: {}".format(r,self.members(r)) for r in self.roots())


if __name__ == "__main__":
    n,m = map(int,input().split())
    uf = UnionFind(n)
    for i in range(m):
        a,b = map(int,input().split())
        a-=1
        b-=1
        uf.union(a,b)
    ans = 0
    for i in range(n):
        c = uf.size(i)
        ans = max(ans,c)
    print(ans)

Measured memory_bytes: 76292
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rrep(i, n) for (int i = (n - 1); i >= 0; i--)
#define ALL(v) v.begin(), v.end()
using namespace std;
using P = pair<int, int>;
typedef long long ll;


int main() {
  string s, t;
  cin >> s >> t;
  int n = s.size();
  int m = t.size();
  vector<vector<int>> dp(n+1, vector<int>(m+1, 0));
  rep(i, n){
    rep(j, m){
      if(s[i] == t[j]){ 
        dp[i+1][j+ 1] = dp[i][j] + 1;
      }else{ 
          dp[i+1][j+ 1] = max(dp[i+1][j], dp[i][j+1]);
      }
    }
  }
  string ans = "";
  int i = n;
  int j = m;
  while(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-1];
      i--;
      j--;
    }
  }
  reverse(ALL(ans));
  cout << ans << endl;
}


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

int main() {
    int n;
    int p[60];
    int count = 0;

    cin >> n;

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

    for (int i = 0; i < n; i++) {
        if (p[i] != (i + 1)) {
            count++;
        }
    }

    cout << ((count > 2) ? "NO" : "YES") << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using ll = long long;
int h, w, k, vs[3005][3005], r, c, v;
ll dp[3005][3005][4];
inline void chmax(ll &a, ll b){if(a<b) a=b;}
int main(){
	scanf("%d%d%d", &h, &w, &k);
	rep(i,k){
		scanf("%d%d%d", &r, &c, &v);
		vs[r-1][c-1] = v;
	}
	dp[0][0][1] = vs[0][0];
	rep(i,h) rep(j,w){
		ll m = 0;
		rep(l,4){
			chmax(m, dp[i][j][l]);
			chmax(dp[i][j+1][l], dp[i][j][l]);
			if(l) chmax(dp[i][j+1][l], dp[i][j][l-1]+vs[i][j+1]);
		}
		dp[i+1][j][0] = m;
		dp[i+1][j][1] = m + vs[i+1][j];
	}
	ll ans = 0;
	rep(l,4) chmax(ans,dp[h-1][w-1][l]);
	printf("%lld\n", ans);
}

Measured memory_bytes: 320576
//  cout << char(i+48) << endl;//なぜかaは47と得る時がある。+48で出力もaにできる。
//  cout << char(97) << endl;//アスキーコードでaを出力
// sort(b.begin(), b.end());//bという配列を小さい方からソート
// reverse(b.begin(), b.end());//bという配列をリターン
// 10桁でdouble出力するパターン１ 
// printf("%.10f\n", ma);
// 10桁でdouble出力するパターン２
//cout << fixed << setprecision(10);
//  cout << ma << endl;

/*01 02 03 12 13 23　と６回見ていくパターン 
for(int i=0;i<n-1;i++){
  for(int j=i+1;j<n;j++){
    }
  }
*///vector<vector<int>> data(3, vector<int>(4));//int型の2次元配列(3×4要素の)の宣言
//int64_t a;
//10のi乗pow(10, i);
/*string s; stringでの文字列を数字型に変える方法
  cin >> s;
  rep(i,s.size()-2) {
  int a= (s.at(i)-'0')*100 + (s.at(i+1)-'0')*10+ s.at(i+2) -'0';
    */
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main(){
  int n;
  cin >> n;
  int count = 0;
  for(int i = 0;i<30; i++){
    for(int k = 0; k<20;k++){
      if(n == 4*i + 7*k)count++;
    }
  }
  if(count >=1) cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
}

Measured memory_bytes: 256
import java.util.Scanner;
public class Main {
	public static void main(String[] args) {
		Scanner s=new Scanner(System.in);
		int n;
		double x1,x2,x3,y1,y2,y3,xp,yp,r,a1,a2,b1,b2,c1,c2,a,b;
		n=s.nextInt();
		for(int i=0;i<n;i++){
			x1=s.nextDouble();
			y1=s.nextDouble();
			x2=s.nextDouble();
			y2=s.nextDouble();
			x3=s.nextDouble();
			y3=s.nextDouble();
			
			a1=2*(x1-x2);//a
			b1=2*(y1-y2);//b
			//c
			c1=(x1*x1)-(x2*x2)+(y1*y1)-(y2*y2);
			a2=2*(x2-x3);//d
			b2=2*(y2-y3);//e
			c2=(x2*x2)-(x3*x3)+(y2*y2)-(y3*y3);
			
			if(c1*b2-b1*c2==0 ||a1*b2-a2*b1==0)xp=0;
			else
			xp=(c1*b2-b1*c2)/(a1*b2-a2*b1);
			if(c1*a2-c2*a1==0 ||a2*b1-a1*b2==0)yp=0;
			else
			yp=(c1*a2-c2*a1)/(a2*b1-a1*b2);
			
			a=xp-x1;
			a=a*a;
			b=yp-y1;
			b=b*b;
			r=Math.sqrt(a+b);
			if(r==0)
				r=0;
			System.out.printf("%.3f %.3f %.3f\n",xp,yp,r);
		}//for
	}
}

Measured memory_bytes: 12000
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    int n,m;
    while(cin>>n>>m)
    {
        int k;
        cin>>k;
        string ch[n];
        for(int i=0;i<n;i++)
        {
            cin>>ch[i];
        }
        int h=(1<<n);
        h--;
        int w=(1<<m);
        w--;
        int res=0;
        for(int i=0;i<h;i++)
        {
            for(int j=0;j<w;j++)
            {
                int tmp[n][m];
                memset(tmp,0,sizeof tmp);
                for(int k=0;k<n;k++)
                {
                    int val=(1<<k);
                    if((val&i))
                    {
                        for(int l=0;l<m;l++)
                        {
                            tmp[k][l]=1;
                        }
                    }
                }
                for(int k=0;k<m;k++)
                {
                    int val=(1<<k);
                    if((val&j))
                    {
                        for(int l=0;l<n;l++)
                        {
                            tmp[l][k]=1;
                        }
                    }
                }
                int tot=0;
                for(int k=0;k<n;k++)
                {
                    for(int l=0;l<m;l++)
                    {
                        if(tmp[k][l]==0 && ch[k][l]=='#')
                        {
                            tot++;
                        }
                    }
                }
                if(tot==k)
                {
                    res++;
                }
            }
        }
        cout<<res<<endl;
    }
    return 0;
}


Measured memory_bytes: 3600
/**
 * Created by hiramekun at 20:54 on 2019-09-07.
 */
#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using vb = vector<bool>;
using P = pair<ll, ll>;
template<typename T> using pq = priority_queue<T>;
template<typename T> using minpq = priority_queue<T, vector<T>, greater<T>>;
template<typename T, typename K> using ump = unordered_map<T, K>;
const ll dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const ll mod = 1000000007;
const ll inf = ll(1e9);
const ll e5 = ll(1e5);
const ll ll_inf = ll(1e9) * ll(1e9);

#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define repr(i, n) for(ll i = ll(n - 1); i >= 0; i--)
#define each(i, mp) for(auto& i:mp)
#define eb emplace_back
#define F first
#define S second
#define all(obj) (obj).begin(), (obj).end()

template<class T>
ostream &operator<<(ostream &out, const vector<T> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << ' ';
    return out;
}

template<class T>
istream &operator>>(istream &in, vector<T> &list) {
    ll n = list.size();
    rep(i, n) in >> list[i];
    return in;
}

template<class T>
ostream &operator<<(ostream &out, const vector<vector<T>> &list) {
    ll n = list.size();
    rep(i, n) out << list[i] << '\n';
    return out;
}

/* ------------- ANSWER ------------- */
/* ---------------------------------- */

void solve() {
    ll n;
    cin >> n;
    cout << n * n * n << '\n';
}

int main() {
#ifdef MY_DEBUG
    while (true) {
#endif
        solve();
#ifdef MY_DEBUG
    }
#endif
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
using namespace std;
int main(void){
    // Your code here!
    long long int s,c;
    cin>>s>>c;
    
    long long int ans=0;
    
    if(s*2<=c){
        c-=s*2;
        ans+=s;
        ans+=c/4;
    }else{
        ans+=c/2;
    }
    
    cout<<ans<<endl;
    return 0;
}


Measured memory_bytes: 256
# ABC126C - Dice and Coin
n, k = list(map(int, input().rstrip().split()))
ans = 0
for i in range(1, n + 1):
    if i >= k:
        ans += 1 / n
    else:
        m = 1
        while i * 2 ** m < k:
            m += 1
        ans += 1 / n * (0.5) ** m
print(ans)

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

const ll m = pow(10,9) + 7;
vector<ll> fac(2001);
vector<ll> ifac(2001);

ll mpow(ll a, ll n){
  ll ans = 1;
  while(n!=0){
    if (n & 1) ans = ans*a%m;
    a = a*a%m;
    n = n >> 1;
  }
  return ans;
}

void COMinit(){
  fac[0]=1;
  ifac[0]=1;
  for(int i=0;i<2000;i++){
    fac[i+1]=fac[i]*(i+1) % m;
    ifac[i+1] = ifac[i]*mpow(i+1,m-2)%m;
  }
}

ll comb(ll a, ll b){
  if(a == 0 && b == 0){
    return 1;
  }
  if(a < b || a < 0) {
    return 0;
  }
  ll tmp = ifac[a-b]*ifac[b]%m;
  return tmp*fac[a]%m;
}

int main(){
  ll N,K;
  cin >> N >> K;
  COMinit();
  for(int i=1;i<=K;i++){
    ll ans = 0;
    ans = comb(N-K+1,i)*comb(K-1,i-1) % m;
    cout << ans << endl;
  }
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"runtime/debug"
	"strconv"
)

var in = NewScanner(os.Stdin, 0)

/* this is port of top c++ answer to test go performance */
func main() {
	debug.SetGCPercent(-1)
	n, d := in.Int(), in.Int()
	a := in.Array1Int(n)
	ans := 0
	for i := 1; i <= n; i++ {
		ans += a[i]
	}
	ans += d * (n - 1)
	f := make([]int, n+1)
	f[1] = a[1]
	for i := 2; i <= n; i++ {
		Eln(i, n)
		f[i] = Min2(a[i], f[i-1]+d)
	}
	g := make([]int, n+1)
	g[n] = a[n]
	for i := n - 1; i >= 1; i-- {
		g[i] = Min2(a[i], g[i+1]+d)
	}
	for i := 2; i <= n-1; i++ {
		ans += Min2(f[i], g[i])
	}
	Pln(ans)
}

const M7 = 1000000007

type Scanner struct {
	*bufio.Scanner
}

func NewScanner(r io.Reader, max int) *Scanner {
	s := bufio.NewScanner(r)
	s.Split(scanWords)
	if max <= 0 {
		max = 1048576
	}
	s.Buffer([]byte{}, max)
	return &Scanner{s}
}
func (s *Scanner) Int() int {
	s.Scan()
	i, e := strconv.ParseInt(s.Text(), 10, 64)
	if e != nil {
		panic(e)
	}
	return int(i)
}
func (s *Scanner) Array1Int(n int) []int {
	r := make([]int, n+1)
	for i := 1; i <= n; i++ {
		r[i] = s.Int()
	}
	return r
}
func isSpace(b byte) bool {
	return b == ' ' || b == '\n' || b == '\r' || b == '\t'
}
func scanWords(data []byte, atEOF bool) (advance int, token []byte, err error) {
	start := 0
	for start < len(data) && isSpace(data[start]) {
		start++
	}
	for i := start; i < len(data); i++ {
		if isSpace(data[i]) {
			return i + 1, data[start:i], nil
		}
	}
	if atEOF && len(data) > start {
		return len(data), data[start:], nil
	}
	return start, nil, nil
}
func Min2(a, b int) int {
	if a < b {
		return a
	}
	return b
}
func Eln(s ...interface{}) {
	fmt.Fprintln(os.Stderr, s...)
}
func Pln(s ...interface{}) {
	fmt.Println(s...)
}

type ByteSlice []byte
type IntSlice []byte


Measured memory_bytes: 12032
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) v.begin(), v.end()
#define MOD 1000000007
const int INF = 1LL<<30;

int main(){
    int n,m;
    cin>>n>>m;
    vector<ll> x(n),y(n),z(n);
    rep(i,n){
        cin>>x[i]>>y[i]>>z[i];
    }

    ll ans=-1LL<<60;
    rep(bit,8){
        vector<ll> tmp(n,0);
        rep(i,n){
            if(bit & 1<<0) tmp[i]+=x[i];
            else tmp[i]-=x[i];
            if(bit & 1<<1) tmp[i]+=y[i];
            else tmp[i]-=y[i];
            if(bit & 1<<2) tmp[i]+=z[i];
            else tmp[i]-=z[i];
        }
        sort(all(tmp));
        reverse(all(tmp));
        ll st=0;
        rep(i,m){
            st+=tmp[i];
        }
        ans=max(ans,st);
    }

    cout<<ans<<endl;
}

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

int main() {
  ll n, m, d;
  cin >> n >> m >> d;
  cout << fixed;
  if(d==0){
    cout << setprecision(10) << (double) (m-1)/n << endl;
  }else{
    cout << setprecision(10) << 2.0 * (n-d) * (m-1) / n / n << endl;
  }
}





Measured memory_bytes: 256
def f s;if s.empty? then [1,0] else (1..s.size).map{|i|l=s[0...i].to_i;b,r=f(s[i..-1]);[b, b*l+r]}.reduce([0,0]){|(x,y),(a,b)|[x+a, y+b]}end end
puts (f gets.chomp)[1]

Measured memory_bytes: 1788
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
ll mod =1000000007;
/*"itob" int to "N"base */           template<typename TypeInt> string itob(const TypeInt v, int base){static const char table[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";string ret;static numeric_limits<TypeInt> t;TypeInt n = v;if (t.is_signed) {if (v < 0) n *= -1;}while (n >= base) {ret += table[n%base];n /= base;}ret += table[n];if (t.is_signed) {if (v < 0 && base == 10) ret += '-';}reverse(ret.begin(), ret.end());return ret;}
/*"chmin" a = MAX*/                  template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
/*"chmax" a = MIN*/                  template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
/*"ctoi"  char to int*/              int ctoi(char c) {return c-'0';}
/*"gcd"   MAX*/                      int gcd(ll a,ll b){return b?gcd(b,a%b):a;}
/*"lcm"   MIN*/                      int lcm(ll a,ll b){return a*b/gcd(a,b);}
/*"primecheck"If prime,return true.*/bool primecheck(ll n){if(n < 2) return false;else{for(int i = 2; i * i <= n; i++){if(n % i == 0) return false;}return true;}}
string  reverserange(string s,ll a,ll b){reverse(s.begin()+a-1,s.begin()+b); return s;}
int main(){
string s;
cin >> s;
if(s=="SUN")cout<<7<<endl;
else if(s=="MON")cout<<6<<endl;
else if(s=="TUE")cout<<5<<endl;
else if(s=="WED")cout<<4<<endl;
else if(s=="THU")cout<<3<<endl;
else if(s=="FRI")cout<<2<<endl;
else if(s=="SAT")cout<<1<<endl;
}





Measured memory_bytes: 256
N,M= list(map(int,input().split(" ")))
yobos = []

for _ in range(M):
     yobos.append(list(map(int, input().split(" "))))
yobos.sort(key=lambda x:x[1])
right = yobos[0][1]
ans = 1
for yobo in yobos[1:]:
    if yobo[0] >= right:
        right = yobo[1]
        ans += 1
print(ans)




Measured memory_bytes: 65368
N, D = map(int, input().split())
X = [0 for i in range(N)]
for i in range(N):
    X[i] = list(map(int, input().split()))

count = 0
for i in range(N):
    for j in range(i+1, N):
        total = 0
        for k in range(D):
            total += (X[i][k]-X[j][k])**2   
        if total**0.5 == int(total**0.5):
                count += 1

print(count)

Measured memory_bytes: 3064