akhauriyash/Code-Regression huggingface dataset:
#![allow(unused_imports)]
#![allow(non_snake_case)]
use std::cmp::*;
use std::collections::*;
use std::io::Write;

#[allow(unused_macros)]
macro_rules! debug {
    ($($e:expr),*) => {
        #[cfg(debug_assertions)]
        $({
            let (e, mut err) = (stringify!($e), std::io::stderr());
            writeln!(err, "{} = {:?}", e, $e).unwrap()
        })*
    };
}

fn main() {
    let n = read::<usize>();
    let a = read_vec::<i64>();

    let mut g = a[0];
    for i in 1..n {
        g = gcd(g, a[i]);
    }
    if g != 1 {
        println!("not coprime");
        return;
    }
    let primes = get_primes(1001);
    // debug!(primes.len());

    let mut used_primes = HashSet::new();

    'outer: for num in a {
        let mut num = num;
        for &p in &primes {
            if num % p == 0 {
                if used_primes.contains(&p) {
                    println!("setwise coprime");
                    return;
                }
                used_primes.insert(p);
            }
            while num % p == 0 {
                num /= p;
            }
            if num == 1 {
                continue 'outer;
            }
        }
        if num == 1 {
            continue;
        }
        let p = num;
        if used_primes.contains(&p) {
            println!("setwise coprime");
            return;
        }
        used_primes.insert(p);
    }
    println!("pairwise coprime");
}

fn gcd(a: i64, b: i64) -> i64 {
    if b == 0 {
        return a;
    }
    gcd(b, a % b)
}

fn get_primes(n: i64) -> Vec<i64> {
    let mut is_prime = vec![true; n as usize + 1];
    let mut primes = Vec::new();
    is_prime[0] = false;
    is_prime[1] = false;

    for i in 2..n + 1 {
        if is_prime[i as usize] {
            primes.push(i);
            let mut j = 2 * i;
            while j < n {
                is_prime[j as usize] = false;
                j += i;
            }
        }
    }
    primes
}

fn read<T: std::str::FromStr>() -> T {
    let mut s = String::new();
    std::io::stdin().read_line(&mut s).ok();
    s.trim().parse().ok().unwrap()
}

fn read_vec<T: std::str::FromStr>() -> Vec<T> {
    read::<String>()
        .split_whitespace()
        .map(|e| e.parse().ok().unwrap())
        .collect()
}


Measured memory_bytes: 21596
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, s, e) for (int i = (int)(s); i <= (int)(e); i++)
#define printYesNo(is_ok) puts(is_ok ? "Yes" : "No");
#define SORT(v) sort(v.begin(), v.end());
#define RSORT(v) sort(v.rbegin(), v.rend());
#define REVERSE(v) reverse(v.begin(), v.end());

template <typename T>
void printlnVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << endl;
  }
}

template <typename T>
void printVector(T v)
{
  rep(i, v.size())
  {
    cout << v[i] << " ";
  }
  cout << endl;
}

int main()
{
  long long X, Y;
  cin >> X >> Y;
  if (Y == X || X % Y == 0)
  {
    cout << -1 << endl;
    return 0;
  }

  cout << (Y - 1) * X << endl;
  return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(int)(n);i++)
int main(){
  int x,y;
  cin>>x>>y;
  REP(i,101){
      REP(j,101){
          if ((i+j!=0)&&(2*i+4*j==y)&&(i+j==x)){
              cout<<"Yes";
            return 0;
          }
      }
  }
  cout<<"No"<<endl;
}


Measured memory_bytes: 3628
s = list(input())
t = list(input())
s = sorted(s)
t = sorted(t, reverse=True)
flag = False
same = True
for i in range(min(len(s), len(t))):
    if(s[i] < t[i]):
        flag = True
        break
    elif(s[i] > t[i]):
        same = False

if (flag):
    print("Yes")
else:
    if(same and len(s) < len(t)):
        print("Yes")
    else:
        print("No")

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define fi first
#define se second
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = 1; i <= (n); ++i)
#define drep(i,n) for(int i = (n)-1; i >= 0; --i)
#define srep(i,s,t) for (int i = s; i < t; ++i)
#define rng(a) a.begin(),a.end()
#define maxs(x,y) (x = max(x,y))
#define mins(x,y) (x = min(x,y))
#define limit(x,l,r) max(l,min(x,r))
#define lims(x,l,r) (x = max(l,min(x,r)))
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define pb push_back
#define sz(x) (int)(x).size()
#define pcnt __builtin_popcountll
#define uni(x) x.erase(unique(rng(x)),x.end())
#define snuke srand((unsigned)clock()+(unsigned)time(NULL));
#define show(x) cout<<#x<<" = "<<x<<endl;
#define PQ(T) priority_queue<T,v(T),greater<T> >
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define newline puts("")
#define v(T) vector<T>
#define vv(T) v(v(T))
using namespace std;
typedef long long int ll;
typedef unsigned uint;
typedef unsigned long long ull;
typedef pair<int,int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<P> vp;
inline int in() { int x; scanf("%d",&x); return x;}
template<typename T>inline istream& operator>>(istream&i,v(T)&v)
{rep(j,sz(v))i>>v[j];return i;}
template<typename T>string join(const v(T)&v)
{stringstream s;rep(i,sz(v))s<<' '<<v[i];return s.str().substr(1);}
template<typename T>inline ostream& operator<<(ostream&o,const v(T)&v)
{if(sz(v))o<<join(v);return o;}
template<typename T1,typename T2>inline istream& operator>>(istream&i,pair<T1,T2>&v)
{return i>>v.fi>>v.se;}
template<typename T1,typename T2>inline ostream& operator<<(ostream&o,const pair<T1,T2>&v)
{return o<<v.fi<<","<<v.se;}
template<typename T>inline ll suma(const v(T)& a) { ll res(0); for (auto&& x : a) res += x; return res;}
const double eps = 1e-10;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;
#define dame { puts("-1"); return 0;}
#define yn {puts("Yes");}else{puts("No");}
const int MX = 200005;
#define RET(ans) {cout<<ans<<endl;return 0;} 

    // 二次元ベクターの基本
    /*
    vector<vector<int>> dp; // 宣言
    dp.resize(n); // 1次元めの要素数決定
    dp[i].push_back(int); // プッシュバック
    rep(i,n){
        sort(dp[i].begin(),dp[i].end()); // 二次元めを昇順ソート
    }
    */

    // 整数スキャン（複数）
    /*
    int x,y,z;
    scanf("%d%d%d",&x,&y,&z);

    // n個の整数のスキャン
    /*
    ll a[n] = {};
    rep(i,n){
        scanf("%lld",&a[i]);
    }
    */

    // 文字列スキャン
    /*
    string s; cin >> s;
    */

    // n個の文字列スキャン
    /*
    vector<string> slist;
    rep(i,n){
        string s; cin >> s;
        slist.push_back(s);
    }
    */

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

    int a[n];
    a[0] = 0;
    srep(i,1,n){
        if(s[i]=='C'&&s[i-1]=='A'){
            a[i] = a[i-1] + 1;
        }else{
            a[i] = a[i-1];
        }
    }

    rep(i,q){
        int l,r;
        cin >> l >> r;
        cout << a[r-1] - a[l-1] << endl;
    }
    return 0;
}
 
 


Measured memory_bytes: 1408
#include "bits/stdc++.h"

#define REP(i, n ,N) for(ll i = (n); i < (N); i++)
#define p(s) cout<<(s)<<endl
#define p2(a, b) cout<<(a)<<" "<<(b)<<endl
using namespace std;
typedef long long ll;
ll mod = 1e9+7;
ll inf = 1e18;

ll L, R;
int main(){
	ll ans = inf;
	cin >> L >> R;
	REP(i,L,min(L+2019, R)+1){
		REP(j,i+1,min(L+2019, R)+1){
			ans = min(ans, i * j % 2019);
		}
	}
	p(ans);
	return 0;
}

Measured memory_bytes: 256
N = int(input())
A = list(map(int,input().split()))
A.sort()
ans = 0
hoge = sum(A)
p = 0
for i in range(N-1):
    hoge -= A[i]*2
    if hoge > ans:
        ans = hoge
        p = i
print(ans)
hoge = A[0]
for i in range(p+1,N-1):
    print(hoge,A[i])
    hoge -= A[i]
print(A[N-1],hoge)
hoge = A[N-1] - hoge
for i in range(1,p+1):
    print(hoge,A[i])
    hoge -= A[i]

Measured memory_bytes: 14264
import java.util.*;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		int a, b, h, m;
		a = sc.nextInt();
		b = sc.nextInt();
		h = sc.nextInt();
		m = sc.nextInt();

		final double rad_per_min_720 = 11 * 2 * Math.PI;

		int min = h * 60 + m;
		double rad_dif = rad_per_min_720 * min / 720;

		double c_pow = a * a + b * b - 2 * a * b * Math.cos(rad_dif);
		double c = Math.sqrt(c_pow);

		System.out.println(c);
	}

}


Measured memory_bytes: 35968
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int d[105],vis[105];
int main()
{
	int n,k;cin>>n>>k;
	for(int i=1;i<=k;i++)
	{
		cin>>d[i];
		for(int j=1;j<=d[i];++j)
		{int x;cin>>x;
			vis[x]=1; 
		}
	}int num=0;
	for(int i=1;i<=n;++i)
	if(vis[i]==0) num++;
	cout<<num;
 } 

Measured memory_bytes: 3596
S=list(input())
BEST_ODD = ['R', 'U', 'D']
BEST_EVEN = ['L', 'U', 'D']
ANS = 'Yes'
for i,s in enumerate(S):
  o_or_e = (i + 1) % 2
  if o_or_e == 0 and s in BEST_EVEN:
    pass
  elif o_or_e == 1 and s in BEST_ODD:
    pass
  else:
    ANS = 'No'
    break
print(ANS)

Measured memory_bytes: 3060
#include <algorithm>
#include <iostream>
#include <queue>
#define INF (1e9)
#define H 60
#define W 30
using namespace std;
typedef pair<int,int> P;
typedef pair<char,P> P1;
typedef pair<int,P1> P2;
int dijkstra(int,int,char);
int w,h,dl[H][W],dr[H][W],ans;
char s[H][W];

int main(){
  while(1){
    cin>>w>>h;
    if(!w&&!h) break;
    for(int i=0;i<h;i++)
      for(int j=0;j<w;j++) cin>>s[i][j];
    ans=INF;
    for(int i=0;i<w;i++)
      if(s[h-1][i]=='S') ans=min(ans,min(dijkstra(h-1,i,'l'),dijkstra(h-1,i,'r')));
    if(ans==INF) cout<<-1<<endl;
    else cout<<ans<<endl;    
  }
  return 0;
}

int dijkstra(int sy,int sx,char lr){
  priority_queue<P2> q;
  for(int i=0;i<h;i++)
    for(int j=0;j<w;j++) dl[i][j]=dr[i][j]=INF;
  q.push(P2(0,P1(lr,P(sy,sx))));
  if(lr=='l') dl[sy][sx]=0;
  else dr[sy][sx]=0;
  while(!q.empty()){
    P2 t=q.top(); q.pop();
    char c=t.second.first;
    int cost=-t.first,y=t.second.second.first,x=t.second.second.second;
    int dy[9]={0,0,0,-1,-1,-2,1,1,2},dx[9]={1,2,3,1,2,1,1,2,1};
    if(c=='l'&&dl[y][x]<cost) continue;
    if(c=='r'&&dr[y][x]<cost) continue;
    for(int i=0;i<9;i++){
      int ny,nx;
      ny=y+dy[i];
      if(c=='l') nx=x+dx[i];
      else nx=x-dx[i];
      if(ny<0||nx<0||h<=ny||w<=nx||s[ny][nx]=='X'||s[ny][nx]=='S') continue;
      if(s[ny][nx]=='T'){
	if(c=='l') dr[ny][nx]=min(dr[ny][nx],cost);
	else dl[ny][nx]=min(dl[ny][nx],cost);
      }
      else if(c=='l'&&dr[ny][nx]>cost+s[ny][nx]-'0'){
	dr[ny][nx]=cost+s[ny][nx]-'0';
	q.push(P2(-dr[ny][nx],P1('r',P(ny,nx))));
      }
      else if(c=='r'&&dl[ny][nx]>cost+s[ny][nx]-'0'){
	dl[ny][nx]=cost+s[ny][nx]-'0';
	q.push(P2(-dl[ny][nx],P1('l',P(ny,nx))));
      }
    }
  }
  int res=INF;
  for(int i=0;i<w;i++)
    if(s[0][i]=='T') res=min(res,min(dl[0][i],dr[0][i]));
  return res;
}

Measured memory_bytes: 1228
from collections import deque
n,m=map(int,input().split())
s=deque(input())
a=0
for i in range(n+1):
  if s[i]=="1":
    a=a+1
    if a==m:
      print(-1)
      break
  else:
    a=0
if a==0:
  b=deque([])
  d=n
  while d>0:
    if d<=m:
      b.appendleft(d)
      d=0
    else:
      i=m
      while i>0:
        if s[d-i]=="1":
          i=i-1
        else:
          b.appendleft(i)
          d=d-i
          for j in range(i):
            s.pop()
          break
  for i in range(len(b)):
    print(b[i],end=" ")

Measured memory_bytes: 5104
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

public class Main {
	public static void main(String[] args) throws NumberFormatException, IOException {
		int period = Integer.parseInt(new BufferedReader(new InputStreamReader(System.in), 32).readLine());
		int val = 100;//壱百千円
		for (; 0 < period; period--) {
			val = val * 105 % 100 == 0 ? (int) (val * 1.05) : (int) (val * 1.05) + 1;
		}
		System.out.println(val * 1000);
	}
}

Measured memory_bytes: 16844
#include<bits/stdc++.h>
using namespace std;
#define lop(i,n) for(ll i=0;i<n;i++)
#define lop1(i,n) for(ll i=1;i<=n;i++)
#define lopr(i,n) for(ll i=n-1;i>=0;i--)
#define ll long long int
#define pb push_back
#define all(v) v.begin(),v.end()
#define IOS  ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endl '\n'
#define F first
#define S second	
#define mem(arr,val) memset(arr,val,sizeof(arr))
#define pii pair<int,int>
#define pll pair<ll,ll>
#define LCM(a,b) (a*b)/__gcd(a,b)
#define mii map<int,int>
#define mll map<ll,ll>
#define ub upper_bound
#define lb lower_bound
#define sz(x) (ll)x.size()
#define ld long double
#define pcnt(x) __builtin_popcountll(x)
const long long I1=1e9;
const long long I2=1e18;
const int32_t M1=1e9+7;
const int32_t M2=998244353;
template<typename T,typename T1>T maxn(T &a,T1 b){if(b>a)a=b;return a;}
template<typename T,typename T1>T minn(T &a,T1 b){if(b<a)a=b;return a;}

void solve()
{
  //code begins from here//
 ll n,k;
 cin>>n>>k;
 ll a[n+1];
 ll dp[k+1]={0};
 lop1(i,n) {cin>>a[i];dp[a[i]]=1;}
 lop1(i,k)
 {
     if(dp[i]==1) continue;
     dp[i]=2;
     lop1(j,n)
     {
        if (i+a[j]<=k) dp[i+a[j]]=1;
     }
 }
 cout<<(dp[k]==1?"First":"Second")<<endl;
}

signed main()
{
    IOS;
    #ifdef MODULO
        initialize();
    #endif
    #ifdef SIEVE
        sieve();
    #endif
    int testcase=1;
    //cin>>testcase;
    while(testcase--) solve();
    return 0;
}

Measured memory_bytes: 4440
H,W,A,B = (int(n) for n in input().split())

S = [[0 for i in range(W)] for j in range(H)]

if A > W/2 or B > H/2:
    print('No')
else:
    for i in range(H):
        for j in range(W):
            if (i<B and j<A) or (B<=i and A<=j):
                S[i][j] = 1

#    for i in range(H):
#        print(' '.join(map(str,S[i])))
    for s in S:
        print(''.join(map(str,s)))

Measured memory_bytes: 12916
#include <iostream>
#include <cassert>
#include <queue>
 
#define INF 922337203685477580
typedef long long ll;
 
using namespace std;
 
int main() {
  int n;
  cin >> n;
 
  ll a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
 
  ll op = 0LL;
  ll sum = 0LL;
 
  // positive
  for (int i = 0; i < n; i++) {
    sum += a[i];
 
    if (i % 2 == 0 && sum <= 0) {
      op += 1 - sum;
      sum = 1;
    } else if (i % 2 == 1 && sum >= 0) {
      op += sum + 1;
      sum = -1;
    }
  }
 
  ll op_m = op;
  sum = 0LL;
  op = 0LL;
  // negative
  for (int i = 0; i < n; i++) {
    sum += a[i];
 
    if (i % 2 == 1 && sum <= 0) {
      op += 1 - sum;
      sum = 1;
    } else if (i % 2 == 0 && sum >= 0) {
      op += sum + 1;
      sum = -1;
    }
  }
 
  op = min(op, op_m);
  cout << op << endl;
  return 0;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
#define fori(x,a,b) for (int x=a;x<=b;x++)
#define ll long long
using namespace std;
const int maxn=10e5+10;
ll a[maxn],b[maxn],c[maxn],n,f[maxn][4];
int main ()
{
    cin>>n;
    fori(i,1,n) cin>>a[i]>>b[i]>>c[i];
    fori(i,1,n)
    {
        f[i][1] = max(f[i-1][2]+a[i],f[i-1][3] + a[i]);
        f[i][2] = max(f[i-1][1]+b[i],f[i-1][3]+b[i]);
        f[i][3] = max(f[i-1][1]+c[i],f[i-1][2]+c[i]);
    }
    cout<<max({f[n][1],f[n][2],f[n][3]});
}


Measured memory_bytes: 12544
#include "bits/stdc++.h"
using namespace std;

int main()
{
	int N, M, sum = 0;
	cin >> N >> M;
	vector<int> L(M);
	vector<int> abs(M-1);

	for (int i = 0; i < M; i++){
		cin >> L[i];
	}
	sort(L.begin(), L.end());
	
	for (int i = 0; i < M-1; i++) {
		abs[i] = L[i+1] - L[i];
	}
	sort(abs.begin(), abs.end());

	for (int i = 0; i < M-N; i++) {
		sum += abs[i];
	}

	cout << sum;
	
	return 0;
}

Measured memory_bytes: 1024
#include<stdio.h>

int main()
{
    long long a,num;
    int digit=1,flag=0,b,ans;
    scanf("%lld",&a);
    while(a>=10)
    {
        num=a%10;
        if(num!=9)flag=1;
        a/=10;
        digit++;
    }
    b=(int)(a);
    ans=(b-flag)+(digit-1)*9;
    printf("%d",ans);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
const ll mod = 1e9+7;

int main(){
    int n;
    cin >> n;
    vector<int> h(n);
    int ans = 0;
    int cnt = 0;
    for(int i = 0; i < n; i++) cin >> h[i];
    for(int i = 0; i < n-1; i++){
        if(h[i] < h[i+1]){
            ans = max(cnt,ans);
            cnt = 0;
        }
        else cnt++;
    }
    ans = max(ans,cnt);
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
using namespace std;
#define int ll
#define ll long long int
#define ff first
#define ss second
#define u128 __int128
#define pb push_back

#define N 100010
#define MOD 1000000007
#define mod 998244353

int32_t main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.precision(10);

	int a, b;
	cin >> a >> b;
	cout << max(0ll, a - 2 * b);
	return 0;	 
}



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

int main() {
  int N, D; cin >> N >> D;

  int Ans = 0;
  int CoverRange = D*2+1;

  while( N>0 ) {
    N -= CoverRange;
    Ans++;
  }

  cout << Ans <<endl;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) (((x) < 0)?-(x):(x))
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

using cat = long long;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

cat gcd(cat a, cat b) {
	if(a > b) swap(a, b);
	return (a == 0) ? b : gcd(b%a, a);
}

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

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N, M;
	string S, R;
	cin >> N >> M >> S >> R;
	cat L = lcm(N, M);
	map<cat, char> str;
	for(int i = 0; i < N; i++) str[i*(L/N)] = S[i];
	for(int i = 0; i < M; i++) {
		auto it = str.find(i*(L/M));
		if(it != str.end() && it->ss != R[i]) {
			cout << "-1\n";
			return 0;
		}
		str[i*(L/M)] = R[i];
	}
	cout << L << "\n";
	return 0;
}

// look at my code
// my code is amazing


Measured memory_bytes: 12544
n,m=map(int,raw_input().split())
c=map(int,raw_input().split())
dp=[[0]+[float('inf')]*n]+[[0]+[float('inf')]*n for i in xrange(m)]
for i in xrange(m):
    for j in xrange(n+1):
        if c[i]>j:
            dp[i+1][j]=dp[i][j]
        else:
            dp[i+1][j]=min(dp[i][j],dp[i+1][j-c[i]]+1)
print(dp[m][n])

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

//#define int long long
struct Fast {Fast(){cin.tie(0);ios::sync_with_stdio(0);}} fast;
//const int MOD = 1e9 + 7;
using intpair = pair<int, int>;

#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define reps(i, n, m) for (int i = (int)(n); i <= (int)(m); i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define rALL(obj) (obj).rbegin(), (obj).rend()
#define ceiv(a, b) ((int)((a) + (b) - 1)/(int)(b))

signed main(){
    int n, m;
    cin >> n >> m;
    vector<int> h(n);
    rep(i,n) cin >> h[i];
    
    set<int> good;
    rep(i,n) good.insert(i);
    
    rep(i,m){
        int a, b;
        cin >> a >> b;
        a--; b--;
        if(h[a] > h[b]){
            good.erase(b);
        }else if(h[a] < h[b]){
            good.erase(a);
        }else{
            good.erase(a);
            good.erase(b);
        }
    }
    
    cout << good.size() << endl;
}

Measured memory_bytes: 8348
W, H, N = map(int, input().split())
board = []
for i in range(0, H):
	lst = []
	for j in range(0, W):
		lst.append(1)
	board.append(lst)
for i in range(0, N):
	x, y, a = map(int, input().split())
	X = [0, 0]
	Y = [0, 0]
	if a == 1:
		X = [0, x]
		Y = [0, H]
	elif a == 2:
		X = [x, W]
		Y = [0, H]
	elif a == 3:
		X = [0, W]
		Y = [0, y]
	else:
		X = [0, W]
		Y = [y, H]
	for j in range(Y[0], Y[1]):
		for k in range(X[0], X[1]):
			board[j][k] = 0
cnt = 0
for i in range(0, H):
	for j in range(0, W):
		cnt += board[i][j]
print(cnt)

Measured memory_bytes: 44016
#include<iostream>
#include<stdio.h>
#include<string.h>
#include<cmath>
using namespace std;


int main()
{
    string s, t;
    cin >> s >> t;
    s += t[t.size() - 1];
    if (s == t) cout << "Yes\n";
    else cout << "No\n";
}

Measured memory_bytes: 3624
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for (ll i = (begin); i < (end); i++)
#define REP(i, n) FOR(i, 0, n)
#define IFOR(i, begin, end) for (ll i = (begin)-1; i >= (end); i--)
#define IREP(i, n) IFOR(i, n, 0)
#define SORT(a) sort(a.begin(), a.end())                 //昇順
#define ISORT(a) sort(a.begin(), a.end(), greater<ll>()) //降順
#define REVERSE(a) reverse(a.begin(), a.end())
#define debug(x) cout << #x << "=" << x << endl;
#define vdebug(v)                                                              \
  cout << #v << "=(" << v[0];                                                  \
  FOR(i_debug, 1, v.size()) { cout << "," << v[i_debug]; }                     \
  cout << ")" << endl;
#define mdebug(m)                                                              \
  cout << #m << "=" << endl;                                                   \
  REP(i_debug, m.size()) {                                                     \
    REP(j_debug, m[i_debug].size()) { cout << m[i_debug][j_debug] << ","; }    \
    cout << endl;                                                              \
  }
#define Lower_bound(v, x)                                                      \
  distance(v.begin(), lower_bound(v.begin(), v.end(), x))
#define Upper_bound(v, x)                                                      \
  distance(v.begin(), upper_bound(v.begin(), v.end(), x))
#define Max(a, b) a = max(a, b)
#define Min(a, b) a = min(a, b)

#define ll long long
#define ld long double
#define f first
#define s second
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define INF 1000000000000000000

using vec = vector<ll>;
using mat = vector<vec>;
using Pii = pair<ll, ll>;
using PiP = pair<ll, Pii>;
using PPi = pair<Pii, ll>;
using bvec = vector<bool>;
using Pvec = vector<Pii>;

template <typename T> void readv(vector<T> &a) { REP(i, a.size()) cin >> a[i]; }
void readv_m1(vector<int> &a) {
  REP(i, a.size()) {
    cin >> a[i];
    a[i]--;
  }
}

ll mod = 1000000007;

int main() {
  ll N;
  cin >> N;
  vec X(N);
  REP(i, N) { cin >> X[i]; }

  vec Xsort = X;
  SORT(Xsort);

  ll ansL = Xsort[N / 2 - 1];
  ll ansR = Xsort[N / 2];

  REP(i, N) {
    if (X[i] < ansL || X[i] == ansL)
      cout << ansR << endl;
    else if (X[i] > ansR || X[i] == ansR)
      cout << ansL << endl;
  }
  return 0;
}

Measured memory_bytes: 5376
#include <bits/stdc++.h>
#define int long long
#define ALL(v) (v).begin(),(v).end()
#define pb push_back
#define rep(i,a,n) for(int i=a;i<n;i++)
#define repr(i,a,n) for(int i=a;i>n;i--)
#define leng(n) (int)(log10(n)+1)
#define INF 9000000000000000000
using namespace std;

int gcd(int a,int b){return b?gcd(b,a%b):a;}  //  最大公約数gcd
int lcm(int a,int b){return a/gcd(a,b)*b;}  //  最小公倍数lcm

signed main() {
  int a, b, c;
  cin >> a >> b >> c;
  if (abs(a-b) > abs(a-c)) cout << 'B' << endl;
  else cout << 'A' << endl;
}


Measured memory_bytes: 256
import java.util.Scanner;

class Main {

    private static Scanner sc = new Scanner(System.in);

    public static void main(String[] args) {
        int a = sc.nextInt(), b = sc.nextInt(), x = sc.nextInt();
        if (x >= a && x <= a + b) {
            System.out.println("YES");
        }else{
            System.out.println("NO");
        }
    }
}


Measured memory_bytes: 21844
implicit none
integer(8) :: i,j,a,b
integer :: n
read *,n

do i = 1, 3500
   do j = i, 3500
      a = n*i*j
      b = 4*i*j - n*i - n*j
      if (b <= 0) cycle
      if (mod(a,b) == 0) then
         if (a/b > 0) then
            print '(i0,1x,i0,1x,i0)',i,j,a/b
            stop
         endif
      endif
   enddo
enddo
end

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

using namespace std;

#define int long long
#define all(v) (v).begin(), (v).end()
#define resz(v, ...) (v).clear(), (v).resize(__VA_ARGS__)
#define reps(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
#define rep(i, n) reps(i, 0, n)

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

using Pi = pair<int, int>;
using Ti = tuple<int, int, int>;
using vint = vector<int>;

const int inf = 1LL << 55;
const int mod = 1e9 + 7;

signed main() {
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);

  int n, y;
  cin >> n >> y;
  rep(i, n+1) {
    rep(j, n+1) {
      int k = n-i-j;
      if(k < 0) continue;
      if(10000*i+5000*j+1000*k == y) {
	cout << i << " " << j << " " << k << endl;
	return 0;
      }
    }
  }
  cout << -1 << " " << -1 << " " << -1 << endl;

  return 0;
}


Measured memory_bytes: 256
#include<iostream>
using namespace std;
int main(){
    int x;
    cin >> x;
    int y, z;
    for(int i = 1;i <= x;i++){
        y = i / 10;
        z = i /100;
        if(i % 3 == 0){
            cout << " " << i;
        } else if(i % 10 == 3){
            cout << " " << i;
        } else if(i / 10 == 3){
            cout << " " << i;
        } else if((y % 10 == 3) ||(z % 10 == 3) || (y / 10 == 3) || (z / 10 == 3)){
            cout << " " << i;
        }
    }
    cout << endl;
    return 0;
}


Measured memory_bytes: 3108
#include <stdio.h>

int main()
{
	int i, N, a[101];
	scanf("%d", &N);
	for (i = 1; i <= N; i++) scanf("%d", &(a[i]));
	
	int flag[8] = {}, any = 0;
	for (i = 1; i <= N; i++) {
		if (a[i] < 3200) flag[a[i] / 400]++;
		else any++;
	}
	
	int min = 0;
	for (i = 0; i < 8; i++) if (flag[i] > 0) min++;
	
	printf("%d %d\n", (min > 0)? min: 1, min + any);
	fflush(stdout);
	return 0;
}

Measured memory_bytes: 128
n,a,b=gets.split.map(&:to_i)
if n == 1
  if a == b
    puts 1
  else
    puts 0
  end
else
  min = a + b + (n - 2) * a
  max = a + b + (n - 2) * b
  puts [max - min + 1, 0].max
end


Measured memory_bytes: 1788
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;

char s[105];
int cnt1[1000];
int cnt2[1000];
int main()
{
	int n;
	cin>>n>>s;
	memset(cnt1,0,sizeof(cnt1));
	memset(cnt2,0,sizeof(cnt2));
	for(int i=0;i<n;i++)
	{
		cnt1[s[i]]++;
	}
	int ans=0;
	int tem=0;
	for(int i=0;i<n;i++)
	{
		cnt2[s[i]]++;
		if(cnt2[s[i]]==1)
		{
			tem++;
		}
		if(cnt2[s[i]]==cnt1[s[i]])
		{
			tem--;
		}
		if(tem>ans)	ans=tem;
	}
	
	cout<<ans<<endl;
	
	return 0;
}

Measured memory_bytes: 256
for _ in range(int(input())):
    a = input()
    b = input()
    if len(a) < len(b):
        a, b = b, a
    indices = []
    for cb in b:
        bgn_idx = 0
        for i, cur_idx in enumerate(indices):
            chr_idx = a.find(cb, bgn_idx) + 1
            if not chr_idx:
                break
            if chr_idx < cur_idx:
                indices[i] = chr_idx
            bgn_idx = cur_idx
        else:
            chr_idx = a.find(cb, bgn_idx) + 1
            if chr_idx:
                indices.append(chr_idx)
    print(len(indices))


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

public class Main {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int n = scan.nextInt();
		String num[] = new String[n];

		for (int i = 0; i < n; i++) {
			num[i] = scan.next();
		}

		String num2[] = num.clone();

		for (int i = 0; i < n; i++) {
			for (int j = n - 1; j >= i + 1; j--) {
				if (num2[j].charAt(1) < num2[j - 1].charAt(1)) {
					String tmp = num2[j];
					num2[j] = num2[j - 1];
					num2[j - 1] = tmp;
				}
			}
		}

		for (int i = 0; i < n; i++) {
			System.out.print(num2[i]);
			if (i != n - 1)
				System.out.print(" ");
		}

		System.out.println();
		System.out.println("Stable");
		
		for (int i = 0; i < n; i++) {
			int mini = i;
			for (int j = i; j < n; j++) {
				if (num[j].charAt(1) < num[mini].charAt(1)) {
					mini = j;
				}
			}

			if (mini != i) {
				String tmp = num[i];
				num[i] = num[mini];
				num[mini] = tmp;
			}
		}

		boolean isStable = true;
		
		for (int i = 0; i < n; i++) {
			if (num[i] != num2[i])
				isStable = false;
			
			System.out.print(num[i]);
			if (i != n - 1)
				System.out.print(" ");
		}
		System.out.println();
		if (isStable) {
			System.out.println("Stable");
		}
		else {
			System.out.println("Not stable");
		}
		
		scan.close();
	}

}

Measured memory_bytes: 17336
#include<cstdio>
#include<cstring>
using namespace std;

int main(){
    char number[1001];
    
    while(1){
        scanf("%s", number);
        int sum=0;
        if(number[0]=='0') {
            break;
        }    
        for(int i=0; i<strlen(number); i++){
            
            sum += (number[i]-'0');
        }
    
    printf("%d\n", sum);
    
    }
    
    return 0;
    
}


Measured memory_bytes: 2672
from sys import stdin
A,B=[int(x) for x in stdin.readline().rstrip().split()]
S=(stdin.readline().rstrip())
flag=True
if S[:A].isdecimal() != True:
    flag = False
elif S[A:A+1] != "-":
    flag = False
elif S[A+1:].isdecimal() != True:
    flag = False

if flag:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
const int inf=0x3f3f3f;

int main()
{
   int n,x=0;cin>>n;
   string s;cin>>s;
   int ans=0;
   for (int i=0;i<(int)s.size();i++)
   {
   	   if (s[i]=='I')  ++x;
   	   if (s[i]=='D')  x--;
   	   ans=max(ans,x);
   }
   cout<<ans<<endl;
}

Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#include<bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define E "\n"

using namespace std;
const long long MOD = (long long)1e9 + 7;

int h, n, a;
long long sum;

int main()
{
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> h >> n;
    for (int i = 0; i < n; i++) {
        cin >> a;
        sum += a;
    }
    if (sum >= h) cout << "Yes" << E;
    else cout << "No" << E;
    //system("pause");
    return 0;
}

Measured memory_bytes: 256
<?php
$n = (int)trim(fgets(STDIN));
$input = explode(' ', trim(fgets(STDIN)));

$ds = [];
foreach ($input as $v) {
	$ds[] = (int)$v;
}
sort($ds);

$small = $ds[(int)($n / 2 - 1)];
$large = $ds[(int)($n / 2)];

echo $large - $small;

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

typedef long long LL;

int main() {
    LL N;
    cin >> N;
    vector<LL> A(N);
    for (int i =0; i<N; i++)
        cin >> A[i];

    LL sum = 0, pairs = 0;
    for (LL i = 0;i<N;i++)
    {
        sum += (A[i]);
        if (A[i] == 0 || i == N -1) {
            pairs += floor(sum /2);
            sum = 0;
        }
    }

    cout << pairs;
    return 0;
}


Measured memory_bytes: 1024
n = int(input())
ab = [list(map(int, input().split())) for _ in range(n)]

ab.sort(key=lambda ab: ab[1], reverse=True)
time = ab[0][1]
for [a, b] in ab:
    time = min(time, b)
    time -= a
    if time < 0:
        print("No")
        exit(0)

print("Yes")

Measured memory_bytes: 53852
#include <bits/stdc++.h>
#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using bint = boost::multiprecision::cpp_int;
using ll = long long;
using pint = pair<int, int>;
using pll = pair<ll, ll>;
#define rep(i,n) for (int i = 0; i < (n); i++)
#define repSE(i,s,n) for (int i = (s); i < (n); i++)
#define rrepSE(i,s,e) for (int i = (s); i > (e); i--)
#define ssort(v) sort(v.begin(), v.end())
#define gsort(v) sort(v.rbegin(), v.rend())
template<typename T> istream &operator>>(istream &is, vector<T> &vec){ for (auto &v : vec) is >> v; return is; }
template<typename T> ostream &operator<<(ostream &os, const vector<T> &vec){ os << "["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const deque<T> &vec){ os << "deq["; for (auto v : vec) os << v << ","; os << "]"; return os; }
template<typename T> ostream &operator<<(ostream &os, const set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_set<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T> ostream &operator<<(ostream &os, const unordered_multiset<T> &vec){ os << "{"; for (auto v : vec) os << v << ","; os << "}"; return os; }
template<typename T1, typename T2> ostream &operator<<(ostream &os, const pair<T1, T2> &pa){ os << "(" << pa.first << "," << pa.second << ")"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename TK, typename TV> ostream &operator<<(ostream &os, const unordered_map<TK, TV> &mp){ os << "{"; for (auto v : mp) os << v.first << "=>" << v.second << ","; os << "}"; return os; }
template<typename T> bool chmax(T &m, const T q) { if (m < q) {m = q; return true;} else return false; }
template<typename T> bool chmin(T &m, const T q) { if (q < m) {m = q; return true;} else return false; }
#define DEBUG_PRINT(var) std::cout << #var << " = " << var << "\n";

const ll MD = 60;

const ll MOD = ll(1e9) + 7;

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

int main()
{
    int n;
    cin >> n;
    vector<ll> a(n);
    rep(i,n) cin >> a[i];
    vector<vector<int>> m(MD+1, vector<int>(2));
    rep(j,MD+1) rep(i,n) {
        int bit = a[i]>>j&1;
        m[j][bit]++;
    }
    ll ans = 0;
    rep(j,MD+1) {
        ll add = modpow(2,j,MOD) * m[j][0] % MOD;
        add = add * m[j][1] % MOD;
        ans = (ans + add) %MOD;
    }
    cout << ans << "\n";
    return 0;
}


Measured memory_bytes: 2560
#include<iostream>
#include<sstream>
#include<fstream>
#include<string>
#include<vector>
#include<deque>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<algorithm>
#include<functional>
#include<utility>
#include<bitset>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cstdio>

using namespace std;

#define REP(i,n) for(int i=0;i<int(n);i++)
#define foreach(c,itr) for(__typeof((c).begin()) itr=(c).begin();itr!=(c).end();itr++)
typedef long long ll;
typedef pair<int,int> P;

int par[100010];
int p[100010];
vector<int> v[100010];

void init(int n){
	REP(i,n){
		par[i]=i;
	}
}

int find(int x){
	if(par[x]==x){
	   return x;
	}else{
	  return par[x]=find(par[x]);
	}
}

void unite(int x,int y){
	x=find(x); y=find(y);
	if(x==y) return;

	par[x]=y;
}

bool same(int x,int y){
	return find(x)==find(y);
}


int main(void){
	          int i,j;

	      	  cin.tie(0);  ios_base::sync_with_stdio(false);

	      	  int N,M;
	      	  cin >> N >> M;

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

	      	  init(N);
	      	  for(i=0;i<M;i++){
	      		  int x,y;
	      		  cin >> x >> y;
	      		  x--;
	      		  y--;
	      		  unite(x,y);
	      	  }

	      	  for(i=0;i<N;i++){
	      		  int f=find(i);
	      		  v[f].push_back(i);
	      	  }

	      	  int ans=0;
	      	  for(i=0;i<N;i++){
	      		  int m=v[i].size();
	      		  if(m==0) continue;
	      		  sort(v[i].begin(),v[i].end());
	      		  for(j=0;j<m;j++){
	      			  if(binary_search(v[i].begin(),v[i].end(),p[v[i][j]])){
	      				  ans++;

	      			  }
	      		  }
	      	  }

	      	  cout << ans << endl;

	          return 0;
}


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

int data[100];
int count=0;
void BubbleSort(int[],int);

int main(){

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

	for(i=0; i<n; i++){
		cout<<data[i];
		if(i==n-1)cout<<endl;
		else cout<<" ";
	}
	
	cout<<count<<endl;

return 0;
	
}

void BubbleSort(int data[],int n){

	int i,j,suspend;
	
	for(i=0; i<n; i++){
		for(j=n-1; j>=i+1; j--){
			if(data[j]<data[j-1]){
				suspend=data[j];
				data[j]=data[j-1];
				data[j-1]=suspend;
				count++;
			}
		}
	}
}

Measured memory_bytes: 1160
#include<string>
#include<iostream>
#include<algorithm>
#include<set>
#include<math.h>
#include<vector>
#include<sstream>
#include<queue>
#include<functional>
#include<bitset>
#include<cstdio>
#include<iomanip>
#include<map>
#include<unordered_map>
#include<unordered_set>
#include <string.h>
using ll = long long;
 
#define rep(i, n) for(ll i = 0; i < (int)(n); i++)
#define reps(i,x) for(ll i=1;i<=(int)(x);i++)
#define rrep(i,x) for(ll i=((int)(x)-1);i>=0;i--)
#define rreps(i,x) for(ll i=(int)(x);i>0;i--)
#define all(x) (x).begin(),(x).end()
#define m0(x) memset(x,0,sizeof(x))
#define vll vector<ll>
#define vi vector<int>
#define mp make_pair
#define vpll vector<pair<ll,ll>>
#define vpi vector<pair<int,int>>
#define mod 1000000007 
using namespace std;
int c[3][3];
int main() {
  rep(i,3){
    rep(j,3){
      cin >> c[i][j];
    }
  }
  int a[3];
  rep(i,3){
    rep(j,3){
      if(i ==j)continue;
      int b =c[i][0] - c[j][0];
      reps(k,2){
        if(c[i][k] - b != c[j][k]){
          cout << "No" << endl;
          return 0;
        }
      }
    }
  }
  cout << "Yes" << endl;
}


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

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

double EPS=1e-9;
int INF=1000000005;
long long INFF=1000000000000000005ll;
double PI=acos(-1);
int dirx[8]={ -1, 0, 0, 1, -1, -1, 1, 1 };
int diry[8]={ 0, 1, -1, 0, -1, 1, -1, 1 };
const ll MOD = 1000000007;

#define DEBUG fprintf(stderr, "====TESTING====\n")
#define VALUE(x) cerr << "The value of " << #x << " is " << x << endl
#define OUT(x) cout << x << endl
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define READ(x) for(auto &(z):x) cin >> z;
#define FOR(a, b, c) for (int(a)=(b); (a) < (c); ++(a))
#define FORN(a, b, c) for (int(a)=(b); (a) <= (c); ++(a))
#define FORD(a, b, c) for (int(a)=(b); (a) >= (c); --(a))
#define FORSQ(a, b, c) for (int(a)=(b); (a) * (a) <= (c); ++(a))
#define FORC(a, b, c) for (char(a)=(b); (a) <= (c); ++(a))
#define EACH(a, b) for (auto&(a) : (b))
#define REP(i, n) FOR(i, 0, n)
#define REPN(i, n) FORN(i, 1, n)
#define MAX(a, b) a=max(a, b)
#define MIN(a, b) a=min(a, b)
#define SQR(x) ((ll)(x) * (x))
#define RESET(a, b) memset(a, b, sizeof(a))
#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define ALL(v) v.begin(), v.end()
#define ALLA(arr, sz) arr, arr + sz
#define SIZE(v) (int)v.size()
#define SORT(v) sort(ALL(v))
#define REVERSE(v) reverse(ALL(v))
#define SORTA(arr, sz) sort(ALLA(arr, sz))
#define REVERSEA(arr, sz) reverse(ALLA(arr, sz))
#define PERMUTE next_permutation
#define TC(t) while (t--)
#define FAST_INP  ios_base::sync_with_stdio(false);cin.tie(NULL)


void solve() {

}

int main()
{
    FAST_INP;
//    #ifndef ONLINE_JUDGE
//    freopen("input.txt","r", stdin);
//    freopen("output.txt","w", stdout);
//    #endif
//
//    int tc; cin >> tc;
//    TC(tc) solve();
	string s, t;
	cin >> s >> t;
	int m=s.size(), n=t.size(), ans=INT_MAX;
	REP(i,m-n+1){
		int cnt=n;
		REP(j,n){
			cnt-=(s[i+j]==t[j]);
		}
		MIN(ans,cnt);
	}
	OUT(ans);
    return 0;
}

Measured memory_bytes: 3640
h,w,k=map(int,input().split())
a=[[i for i in input()] for i in range(h)]
anss=0

for H in range(2**h):
    for W in range(2**w):
        ans=0
        for i in range(h):
            for j in range(w):
                if not((H>>i)&1):
                    if not((W>>j&1)):
                        if a[i][j]=="#":
                            ans+=1
                    
        if ans==k:
            anss+=1

print(anss)

Measured memory_bytes: 73824
import std;

int calc(int k) {
    int sum = 0;
    foreach (a; 1..k+1) {
        foreach (b; 1..k+1) {
            foreach (c; 1..k+1) {
                sum += gcd(a, gcd(b, c));
            }
        }
    }
    return sum;
}

void main() {
    int k; scan(k);
    writeln(calc(k));
}

void scan(T...)(ref T a) {
    string[] ss = readln.split;
    foreach (i, t; T) a[i] = ss[i].to!t;
}
T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;


Measured memory_bytes: 3724
#include "bits/stdc++.h"
using namespace std;

void dump_left(multimap<long, long, greater<long>> &left) {
  for (auto &&var : left)
    cout << var.first << endl;
}

void dump_right(multimap<long, long> &right) {
  for (auto &&var : right)
    cout << var.first << endl;
}

int main(int argc, char **argv) {
  int Q;
  cin >> Q;

  int qtype;
  long asum = 0, bsum = 0;
  long aprev = 0;

  multimap<long, long, greater<long>> left;
  multimap<long, long> right;

  // point: make minimum dupication in making sum a.
  for (int i = 0; i < Q; i++) {
    cin >> qtype;
    if (qtype == 1) {
      long a, b;

      cin >> a >> b;

      bsum += b;
      if (left.size() > 0) {
        if (left.begin()->first <= a && a <= right.begin()->first) {
          asum += 0;
        } else {
          if (abs(left.begin()->first - a) < abs(right.begin()->first - a)) {
            asum += abs(left.begin()->first - a);
          } else {
            asum += abs(right.begin()->first - a);
          }
        }
      } else {
        asum = 0;
      }

      // Insert new a and b
      left.insert(make_pair(a, b));
      right.insert(make_pair(a, b));

      if (left.begin()->first > right.begin()->first) {
        // swap
        pair<long, long> tmpleft = *left.begin();
        pair<long, long> tmpright = *right.begin();

        left.erase(left.begin());
        right.erase(right.begin());

        left.insert(tmpright);
        right.insert(tmpleft);
      }

    } else if (qtype == 2) {
      auto ans = left.begin()->first;
      cout << ans << " " << asum + bsum << endl;
    }
  }

  return 0;
}


Measured memory_bytes: 25216
#include <iostream>
using namespace std;
int main(void){
    int a,b;
    cin>>a>>b;
    int c=0,s=1;
    while(s<b){
        if(c==0)s+=a-1;
        else{
            s+=a-1;
        }
        c++;
    }
    
    cout << c;
    
    
}


Measured memory_bytes: 256
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#include <climits>
#include <cstring>
#include <cassert>

#define rep(i, m, n) for(int i=int(m);i<int(n);i++)
#define all(c) begin(c),end(c)

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

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

typedef long long int ll;
using ll = long long int;
using ull = long long unsigned int;
using Int = long long int;
using uInt = long long unsigned int;
using Double = long double;
using namespace std;
#define INF (1 << 30) - 1
#define INFl (ll)5e15
#define DEBUG 0
#define dump(x)  cerr << #x << " = " << (x) << endl
#define MOD 1000000007


//edit
class Solve {
public:
    void solve() {
        Int N;
        string S;
        cin >> N;
        cin >> S;

        Int ans = 0;
//        Int r = 0, g = 0, b = 0;
        vector<Int> rgb(26, 0);
        for (auto e : S) {
            rgb[e - 'A']++;
        }

        ans += rgb['r' - 'a'] * rgb['g' - 'a'] * rgb['b' - 'a'];
        rep(i, 0, N) {
            rep(j, i + 1, N) {
                if ((i + j) % 2 == 0) {
                    int k = (i + j) / 2;
                    string s;
                    s += S[i];
                    s += S[j];
                    s += S[k];
                    sort(all(s));
                    string rgb = "RGB";
                    sort(all(rgb));
                    if (s == rgb) {
                        ans--;
                    }
                }
            }
        }

        cout << ans << endl;


    }
};


int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
//    std::ifstream in("input.txt");
//    std::cin.rdbuf(in.rdbuf());

    Solve().solve();


    return 0;
}


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

int main()
{
  ll n, k, s; cin >> n >> k >> s;
  rep(i, k) {
    if (i > 0) cout << " ";
    cout << s;
  }
  rep(i, n-k) {
    if (s < 1000000000) cout << " " << s+1;
    else cout << " 1";
  }
  cout << endl;

  return 0;
}


Measured memory_bytes: 1280
import java.util.*;


public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long a = sc.nextLong();
        long b = sc.nextLong();

        System.out.println(lcm(a, b));
    }

    private static long lcm(long m, long n) {
        return m * n / gcd(m, n);
    }

    private static long gcd(long m, long n) {
        if(m < n) return gcd(n, m);
        if(n == 0) return m;
        return gcd(n, m % n);
    }
}

Measured memory_bytes: 21972
#include <stdio.h>

int main() {
  int a, b;
  scanf("%d %d", &a, &b);

  if (a < b) {
    puts("a < b");
  } else if (a > b) {
    puts("a > b");
  } else {
    puts("a == b");
  }

  return 0;
}

Measured memory_bytes: 580
#include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (int)(n); i++)
#define rrep(ri,n) for(int ri = (int)(n-1); ri >= 0; ri--)
#define rep2(i,x,n) for(int i = (int)(x); i < (int)(n); i++)
#define rrep2(ri,x,n) for(int ri = (int)(n-1); ri >= (int)(x); ri--)
#define repit(itr,x) for(auto itr = x.begin(); itr != x.end(); itr++)
#define rrepit(ritr,x) for(auto ritr = x.rbegin(); ritr != x.rend(); ritr++)
#define ALL(x) x.begin(), x.end()
using ll = long long;
using namespace std;

int main(){
  map<int, int> mp;
  int n;
  cin >> n;
  rep(i, n){
    int a;
    cin >> a;
    mp[a]++;
    if(mp[a] == 3) mp[a] = 1;
  }
  int c2 = 0, ans = 0;
  repit(itr, mp){
    ans++;
    if(itr->second == 2) c2++;
  }
  if(c2 % 2 == 0) cout << ans << endl;
  else cout << ans-1 << endl;

  return 0;
}

Measured memory_bytes: 8320
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
using namespace std;
#define Fio                           \
    ios_base::sync_with_stdio(false); \
    cin.tie(nullptr);                 \
    cout.tie(nullptr)
#define f(i, n) for (long long int i = 0; i < n; i++)
#define ll long long int
#define fo(i, a, b) for (long long int i = a; i <= b; i++)
#define w(t)  \
    int t;    \
    cin >> t; \
    while (t--)
#define vi vector<int>
#define vl vector<long long int>
#define vvi vector<vector<int>>
#define vvl vector<vector<long long int>>
#define mii map<int, int>
#define umii unordered_map<int, int>
#define mll map<ll,ll>
#define umll unordered_map<ll,ll>
#define newl cout<<"\n"
#define pb push_back
#define mp make_pair
#define fi first
#define se second
const ll inf = 1e9 + 7;
const ll modc = 998244353;
#define MAX 100002

int vis[MAX];
int dp[MAX];
vi adj[MAX];

void dfs(int node){
	vis[node] = 1;
	dp[node] = 0;
	for(auto child: adj[node]){
		if(!vis[child])dfs(child);
		dp[node] = max(dp[node],1+dp[child]);
	}
}

int main(){
	int n,m;
	cin>>n>>m;
	f(i,m){
		int x,y;
		cin>>x>>y;
		adj[x].pb(y);
	}
	fo(i,1,n){
		if(!vis[i])dfs(i);
	}
	int ans = 0;
	fo(i,1,n)ans = max(ans,dp[i]);
	cout<<ans;
}

Measured memory_bytes: 12376