akhauriyash/Code-Regression huggingface dataset:
import java.io.*;
import java.util.*;
public class Main {

	public static void main(String[] args) {
		InputReader in = new InputReader();
		int x = in.nextInt();
		int a = in.nextInt();
		if (x<a)
			System.out.println(0);
		else
			System.out.println(10);
	}
	
	static class InputReader {
		public BufferedReader br;
		public StringTokenizer st;
		
		public InputReader() {
			br = new BufferedReader(new InputStreamReader(System.in));
			st = null;
		}
		
		public String next() {
			while (st == null || !st.hasMoreTokens()) {
				try {
					st = new StringTokenizer(br.readLine());
				}
				catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return st.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}

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

#define N 100000+1

int n;
int an[N];

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

	int ans = 0;
	for( int i = 1; i < N - 1; i++ ) {
		ans = max( ans, an[i - 1] + an[i] + an[i + 1] );
	}

	cout << ans << endl;

	return 0;
}


Measured memory_bytes: 640
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
char s[50][50];
int h, w;
void count(int i, int j){
  if(0<=i && i<h && 0<=j && j<w && s[i][j]!='#') s[i][j]+=1;
}

int main(void){
  int i, j;
  char c[50];
  scanf("%d %d",&h,&w);
  for(i=0;i<h;i++) for(j=0;j<w;j++) s[i][j]='0';
  for(i=0;i<h;i++){
    scanf("%s",c);
    for(j=0;j<w;j++){
      if(c[j]=='#'){
	s[i][j]='#';
	count(i-1,j-1);
	count(i-1,j);
	count(i-1,j+1);
	count(i,j-1);
	count(i,j+1);
	count(i+1,j-1);
	count(i+1,j);
	count(i+1,j+1);
      }
    }
  }
  for(i=0;i<h;i++){
    for(j=0;j<w;j++){
      printf("%c",s[i][j]);
    }
    printf("\n");
  }
  return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <iomanip>
#include <cassert>
#include <algorithm>
#include <string>
#include <queue>
#include <cstring>
#include <cmath>

using namespace std;

namespace fastinput
{
	/** Interface */

	inline int readChar();
	template <class T = int> inline T readInt();
	template <class T> inline void writeInt(T x, char end = 0);
	inline void writeChar(int x);
	inline void writeWord(const char *s);

	/** Read */

	static const int buf_size = 16384;

	inline int getChar() {
		static char buf[buf_size];
		static int len = 0, pos = 0;
		if (pos == len)
			pos = 0, len = fread(buf, 1, buf_size, stdin);
		if (pos == len)
			return -1;
		return buf[pos++];
	}

	inline int readChar() {
		int c = getChar();
		while (c <= 32)
			c = getChar();
		return c;
	}

	template <class T>
	inline T readInt() {
		int s = 1, c = readChar();
		T x = 0;
		if (c == '-')
			s = -1, c = getChar();
		while ('0' <= c && c <= '9')
			x = x * 10 + c - '0', c = getChar();
		return s == 1 ? x : -x;
	}

	/** Write */

	static int write_pos = 0;
	static char write_buf[buf_size];

	inline void writeChar(int x) {
		if (write_pos == buf_size)
			fwrite(write_buf, 1, buf_size, stdout), write_pos = 0;
		write_buf[write_pos++] = x;
	}

	template <class T>
	inline void writeInt(T x, char end) {
		if (x < 0)
			writeChar('-'), x = -x;

		char s[24];
		int n = 0;
		while (x || !n)
			s[n++] = '0' + x % 10, x /= 10;
		while (n--)
			writeChar(s[n]);
		if (end)
			writeChar(end);
	}

	inline void writeWord(const char *s) {
		while (*s)
			writeChar(*s++);
	}

	struct Flusher {
		~Flusher() {
			if (write_pos)
				fwrite(write_buf, 1, write_pos, stdout), write_pos = 0;
		}
	} flusher;
}

using namespace fastinput;

int main()
{
	::ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
	string s;
	cin >> s;
	cout << s.substr(0, 4) << " " << s.substr(4) << endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <bitset>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <utility>
#include <vector>
#include <complex>
#include <string.h>
#include <numeric>
using namespace std;

//#define int long long
#define reps(i,s,n) for(int (i)=(s);(i)<(n);++(i))
#define rep(i,n) reps(i,0,n)
#define rept(i,n) rep(i,(n)+1)
#define repst(i,s,n) reps(i,s,(n)+1)
#define reprt(i,n,t) for(int (i)=(n);(i)>=(t);--(i))
#define repr(i,n) reprt(i,n,0)
#define each(i,v) for(auto &(i):(v))
#define eachr(i,v) for(auto &(i)=(v).rbegin();(i)!=(v).rend();(i)++)
#define all(c) (c).begin(),(c).end()
#define rall(c) (c).rbegin(),(c).rend()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define tmax(x,y,z) max(x,max(y,z))
#define tmin(x,y,z) min(x,min(y,z))
#define chmin(x,y) x=min(x,y)
#define chmax(x,y) x=max(x,y)
#define ln '\n'
#define bln(i,n) (((i)==(n)-1)?'\n':' ')
#define dbg(x) cout<<#x" = "<<(x)<<ln<<flush
#define dbga(x,n) {cout<<#x" : ";for(int (i)=0;i<(n);++i){cout<<((x)[i])<<(i==((n)-1)?'\n':' ')<<flush;}}
#define zero(a) memset(a,0,sizeof(a))
#define unq(a) sort(all(a)),a.erase(unique(all(a)),a.end())
#define endl "\n"

//typedef complex<double> P;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<string> vst;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vector<int> > mat;

const ll inf = (ll)1e9+10;
const ll linf = (ll)1e18+10;
const ll mod = (ll)(1e9+7);
const int dx[] = {0, 1, 0, -1};
const int dy[] = {1, 0, -1, 0};
const int ddx[] = {0, 1, 1, 1, 0, -1, -1, -1};
const int ddy[] = {1, 1, 0, -1, -1, -1, 0, 1};
const double eps = 1e-10;

ll mop(ll a,ll b,ll m=mod) {ll r=1;a%=m;for(;b;b>>=1){if(b&1)r=r*a%m;a=a*a%m;}return r;}
ll gcd(ll a,ll b) {return b?gcd(b,a%b):a;}
ll lcm(ll a,ll b) {return a/gcd(a,b)*b;}
bool ool(int x,int y,int h,int w) {return((x<0)||(h<=x)||(y<0)||(w<=y));}
bool deq(double a,double b) {return abs(a-b)<eps;}

struct oreno_initializer {
	oreno_initializer() {
		cin.tie(0);
		ios::sync_with_stdio(0);
	}
} oreno_initializer;



int n;
double a, res;
string s;

signed main() {
	cin >> n;
	rep(i,n) {
		cin >> a >> s;
		if (s=="BTC") a *= 380000.0;
		res += a;
	}
	printf("%.14lf\n", res);
}

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

using namespace std;

#define int long long
#define MOD 1000000007

#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define RFOR(i, a, b) for (int i = (b)-1; i >= (a); i--)
#define rep(i, n) for (int i = 0; i < (n); i++)
#define rep1(i, n) for (int i = 1; i < (n); i++)
#define rrep(i, n) for (int i = (n)-1; i >= 0; i--)
#define all(i) (i).begin(), (i).end()
#define rall(i) (i).begin(), (i).end(), greater<int>()

#define elif else if
#define eb emplace_back
#define pb push_back
#define mp make_pair
#define fst first
#define sec second
template <typename T>
void print(T x)
{
    std::cout << x << '\n';
}

//typedef long long ll;
#define TENNINE 1000000005
#define TENFIVE 100005
//#define int long long

int r;

signed main()
{
    cin >> r;

    cout << 3 * r * r << endl;

    return 0;
}


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

long long a[100005];

int main() {
  int n;
  cin >> n;
  a[0] = 0;
  a[n+1] = 0;
  for (int ni = 1; ni <= n; ni++) {
    cin >> a[ni];
  }
  long long sum = 0;
  for (int ni = 0; ni <= n; ni++) {
    sum += abs(a[ni] - a[ni + 1]);
  }
  for (int ni = 1; ni <= n; ni++) {
    cout << sum - abs(a[ni - 1] - a[ni]) - abs(a[ni] - a[ni + 1]) + abs(a[ni - 1] - a[ni + 1]) << "\n";
  }
  return 0;
}

Measured memory_bytes: 2048
#include<bits/stdc++.h>
#include<atcoder/all>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std; using namespace atcoder;
void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T& a, const T& b) { if (a < b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T& a, const T& b) { if (b < a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     @hamayanhamayan0
　　　　／　　　＼　 　  |　|
　　　 /　　 /￣￣￣￣/　　|
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿
　 　　　＼/＿＿＿＿/　（u　⊃
---------------------------------------------------------------------------------------------------*/














int K;
string acl = "ACL";
//---------------------------------------------------------------------------------------------------
void _main() {
	cin >> K;

	string ans = "";
	rep(k, 0, K) ans += acl;
	cout << ans << endl;
}







Measured memory_bytes: 3604
#include <iostream>
#include <cmath>
#include <climits>
#include <string>
#include <numeric>
#include <vector>
#include <queue>
#include <map>
#include <algorithm>
#include <functional>
#include <iomanip>

using namespace std;
using ll = long long;

template<typename T> void print(T t) { cout << t << endl; }

bool check(int a, int s, int c) {
	for (int ss = 1; ss < s; ss++) a /= 10;
	return a % 10 == c;
}
int main() {
	int N, M;
	cin >> N >> M;
	vector<int> s(M), c(M);
	for (int i = 0; i < M; i++) {
		cin >> s[i] >> c[i];
	}

	int minA[4] = { 0, 0, 10, 100 };
	int maxA[4] = { 0, 9, 99, 999 };
	for (int a = minA[N]; a <= maxA[N]; a++) {
		bool ok = true;
		for (int i = 0; i < M; i++) {
			if (!check(a, N-s[i]+1, c[i])) {
				ok = false;
					break;
			}
		}
		if (ok) {
			print(a);
			return 0;
		}
	}

	print(-1);
	return 0;
}



Measured memory_bytes: 3628
#include<stdio.h>

int main() {
	int a,b;
	int k;
	int i, j=0;

	scanf("%d%d%d", &k, &a, &b);
	for ( i = a; i <= b; i++) {
		if (i % k == 0) {
			j = 1;
			break;
		}
			
	}
	if (j == 1)
		printf("OK\n");
	else
		printf("NG\n");

}


Measured memory_bytes: 1648
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file 
//#include <ext/pb_ds/tree_policy.hpp> 
#define int long long
#define pb push_back
#define ff first
#define ss second
#define ii insert
#define ld long double
#define ppb pop_back
#define nuenxfiu ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
#define input freopen("input.txt", "r", stdin),freopen("output.txt", "w", stdout);
#define TT int testcases;cin>>testcases;while(testcases--)
#define mk make_pair
#define MAX ((int)2e9+17)
#define N 200005
#define mod ((int)1e9+7)
#define MOD 1000003
//int fact[1000007]={0};
int fpow(int n, int k, int p = mod) {int r = 1; while(k > 0) {if (k & 1) r = r * n%p; n = n * n%p; k = k >> 1;} return r;}
int expo(int x,int y){ int res=1; while(y) {if(y%2) res=(res*x%mod)%mod; x=(x*x)%mod; y/=2; } return res;}
int sub(int a, int b) {return (a%mod - b%mod + mod)%mod;}
int mul(int a, int b) {return ((a%mod)*(b%mod) + mod)%mod;}
int inv(int x) {return expo(x, mod-2);}
using namespace std;





void solve()
{
	int a,v,b,w,t;
	cin>>a>>v>>b>>w>>t;

	
	if(a>b)
	{
		int x=a-v*t;
		int y=b-w*t;
		if(x<=y)
		cout<<"YES"<<endl;
		else
		cout<<"NO"<<endl;
	}
	else
	{
		int x=a+v*t;
		int y=b+w*t;
		if(x>=y)
		cout<<"YES"<<endl;
		else
		cout<<"NO"<<endl;
	}
}
signed main()
{
    
	nuenxfiu
	//TT
	solve();
     return 0;
}

Measured memory_bytes: 3628
import java.util.*;

//バイナリハックイージー / Unhappy Hacking (ABC Edit)
public class Main {
	public static void main(String[] args){
		Scanner scn=new Scanner(System.in);
		String s=scn.nextLine();
		String res="";
		int len=s.length();
		scn.close();
		
		for(int i=0;i<len;i++){
			switch(s.charAt(i)){
			case '0':
				res+="0";
				break;
			case '1':
				res+="1";
				break;
			case 'B':
				if(res.length()>0)
					res=res.substring(0, res.length()-1);
				break;
			}
		}
		System.out.println(res);
	}
}

Measured memory_bytes: 23892
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
int main()
{
    int n,a,b;
    scanf("%d%d%d",&n,&a,&b);

    LL l = 1LL*a*(n-1) + b;
    LL r = 1LL*b*(n-1) + a;

    //cout<<"l="<<l<<" "<<"r="<<r<<endl;

    if(l > r)
    {
        puts("0");
        return 0;
    }
    else printf("%lld\n",(r-l+1));
    return 0;
}


Measured memory_bytes: 256
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include <set>
#include <vector>
#include <queue>
#include <numeric>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <map>
using namespace std;


int main() {
	map<string, int> mymap;
	int n;
	cin >> n;
	for (int i = 0; i < n; ++i) {
		string s;
		cin >> s;
		int res = mymap.count(s);
		if (res == 0) {
			mymap[s] = 1;
		}
		else {
			mymap[s]++;
		}
	}
	int m;
	cin >> m;
	for (int i = 0; i < m; ++i) {
		string s;
		cin >> s;
		int res = mymap.count(s);
		if (res == 0) {
			mymap[s] = -1;
		}
		else {
			mymap[s]--;
		}
	}
	int r = 0;
	for(auto val : mymap){
		r = max(r, val.second);
	}
	cout << r << endl;
	return 0;
}

Measured memory_bytes: 256
import math
N=int(input())
f_list=[[int(thing) for thing in input().split()] for i in range(N)]

def distance(f_1,f_2):
    return math.sqrt((f_1[0]-f_2[0])**2+(f_1[1]-f_2[1])**2)
l=[]
for i in range(N-1):
    for j in range(i+1,N):
        l.append(distance(f_list[i],f_list[j]))
print((N-1)*sum(l)/len(l))

Measured memory_bytes: 3064
A = int(input())
B = int(input())
C = int(input())
X = int(input())

s = 0

for a in range(0, A + 1):
    for b in range(0, B + 1):
        for c in range(0, C + 1):
            y = 500 * a + 100 * b + 50 * c
            if y == X:
                s += 1

print(s)

Measured memory_bytes: 3060
n , m = map(int, input().split())
k=[]
z=[]
for i in range(m):
    t = list(map(int,input().split()))
    k.append(t[0])
    z.append(t[1:])
p = list(map(int,input().split()))
s = [list(map(int,bin(x)[2:].zfill(n))) for x in range(2**n)]

ans =0
for i in s:
    light=0
    for j in range(m):
        b=0
        for l in range(k[j]):
            if i[z[j][l]-1]==1:
                b+=1
        if b%2==p[j]:
            light+=1
    if light==m:
        ans+=1
print(ans)


Measured memory_bytes: 3188
#include<bits/stdc++.h>
using namespace std;
int main()
{
  int flag=0;
  string s;
  cin>>s;
  for(int i=0; i<s.size(); i++){
    for(int j=i+1; j<s.size(); j++){
      if(s[i]==s[j]){
	flag=1;
      }
    }
  }
  if(flag==1){
    cout<<"no"<<'\n';
  }else{
    cout<<"yes"<<'\n';
  }
  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 N,M;

int dfs(int i, int cnt,
    bitset<500> cur, vector<bitset<500>> &bs){
    if(N == i) return cur.count() == 0 ? cnt : 0;
    return max(dfs(i+1,cnt,cur,bs), dfs(i+1,cnt+1,cur^bs[i],bs));
}

int main(void){
    while(cin>>N>>M, N|M){
        vector<bitset<500>> bs(N);
        rep(i,N) cin>>bs[i];
        if(N <= 23){
            cout<<dfs(0,0,bitset<500>(""),bs)<<endl;
        }else{
            vector<int> cur(1<<M),nxt(1<<M);
            rep(i,N){
                int bit = bs[i].to_ullong();
                nxt[bit] = max(cur[bit],cur[0]+1);
                rep(mask,1<<M)if(cur[mask]){
                    nxt[bit^mask] = max(nxt[bit^mask],cur[mask]+1);
                    nxt[mask] = max(nxt[mask],cur[mask]);
                }
                // cur = nxt;
                swap(cur,nxt);
            }
            cout<<cur[0]<<endl;
        }
    }
    return 0;
}



Measured memory_bytes: 11168
#include <bits/stdc++.h>
using namespace std;
int n, mn = -1;
int digit(int x) {
	int sum = 0;
	while (x != 0) {
		sum += x % 10;
		x /= 10;
	}
	return sum;
}
int main() {
	cin >> n;
	for (int i = 1; i <= (n + 1) / 2; i ++) {
		int a = digit(i), b = digit(n - i);
		if (mn == -1) mn = a + b;
		else mn = min(mn, a + b);
	}
	cout << mn;
	return 0;
}


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

#define REP(i,n) for(ll i=0;i<ll(n);++i)
#define RREP(i,n) for(ll i=ll(n)-1;i>=0;--i)
#define FOR(i,m,n) for(ll i=m;i<ll(n);++i)
#define RFOR(i,m,n) for(ll i=ll(n)-1;i>=ll(m);--i)
#define ALL(v) (v).begin(),(v).end()
#define UNIQUE(v) v.erase(unique(ALL(v)),v.end());
#define INF 1000000001ll
#define MOD 1000000007ll
#define EPS 1e-9

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


using namespace std;

using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;

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

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	char c;
	cin >> c;
	if (c == 'A')cout << 'T' << endl;
	else if (c == 'T')cout << 'A' << endl;
	else if (c == 'C')cout << 'G' << endl;
	else cout << 'C' << endl;
}


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

int main() {
    string s,t;
    cin>>s>>t;

    int count=0;
    rep(i,3) {
        if (s[i]==t[i])count++;
    }

    cout<<count<<endl;
}


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

int n, q, com, b, e, f;

int main() {
    cin >> n;
    int a[n], t[10*n], u[10*n];
    for (int i=0; i<n; i++) {
        cin >> a[i]; t[i] = a[i]; u[i] = a[i];
    }
    for (int j=1; j<10; j++) {
        for (int i=0; i<n; i++) {
            if (i + (1 << j) <= n) t[j*n+i]=min(t[(j-1)*n+i],t[(j-1)*n+i+(1<<(j-1))]);
            else t[j*n+i] = t[(j-1)*n+i];
        }
    }
    for (int j=1; j<10; j++) {
        for (int i=0; i<n; i++) {
            if (i + (1 << j) <= n) u[j*n+i]=max(u[(j-1)*n+i],u[(j-1)*n+i+(1<<(j-1))]);
            else u[j*n+i] = u[(j-1)*n+i];
        }
    }
    cin >> q;
    for (int i=0; i<q; i++) {
        cin >> com >> b >> e;
        e=e-1;
        f=9;
        if (e-b < 512) f=8;
        if (e-b < 256) f=7;
        if (e-b < 128) f=6;
        if (e-b < 64) f=5;
        if (e-b < 32) f=4;
        if (e-b < 16) f=3;
        if (e-b < 8) f=2;
        if (e-b < 4) f=1;
        if (e-b < 2) f=0;
        if (com == 0) cout << min(t[f*n+b],t[f*n+e+1-(1<<f)]) << endl;
        if (com == 1) cout << max(u[f*n+b],u[f*n+e+1-(1<<f)]) << endl;
    }
}


Measured memory_bytes: 3176
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

int main() {

    int h, w, m; cin >> h >> w >> m;
    vector<int> rowNum(h, 0);
    vector<int> columnNum(w, 0);
    set<pair<int, int>> s;
    for (int i = 0; i < m; i++) {
        int H, W; cin >> H >> W;
        H--;
        W--;
        rowNum[H]++;
        columnNum[W]++;
        s.insert({ H,W });
    }
    int rowNumMax = -1;
    int columnNumMax = -1;
    for (int i = 0; i < h; i++) {
        chmax(rowNumMax, rowNum[i]);
    }
    for (int i = 0; i < w; i++) {
        chmax(columnNumMax, columnNum[i]);
    }
    vector<int> rowNumMaxIndex;
    vector<int> columnNumMaxIndex;
    for (int i = 0; i < h; i++) {
        if (rowNumMax == rowNum[i]) {
            rowNumMaxIndex.push_back(i);
        }
    }
    for (int i = 0; i < w; i++) {
        if (columnNumMax == columnNum[i]) {
            columnNumMaxIndex.push_back(i);
        }
    }
    for (auto y : rowNumMaxIndex) {
        for (auto x : columnNumMaxIndex) {
            if (s.find({ y,x }) == s.end()) {
                cout << rowNumMax + columnNumMax << endl;
                return 0;
            }
        }
    }
    cout << rowNumMax + columnNumMax - 1 << endl;
    return 0;
}

Measured memory_bytes: 23856
#[allow(unused_imports)]
use std::cmp;

// Input macro from https://qiita.com/tanakh/items/0ba42c7ca36cd29d0ac8
macro_rules! input {
  (source = $s:expr, $($r:tt)*) => {
    let mut iter = $s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
  ($($r:tt)*) => {
    #[allow(unused_mut)]
    let mut s = {
      use std::io::Read;
      let mut s = String::new();
      std::io::stdin().read_to_string(&mut s).unwrap();
      s
    };
    let mut iter = s.split_whitespace();
    input_inner!{iter, $($r)*}
  };
}

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

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

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

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

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

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

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

fn main() {
  input! {
    a: usize,
    p: usize,
  }
  let p = p + a * 3;
  println!("{}", p / 2);
}


Measured memory_bytes: 4352
#include <algorithm>
#include <iostream>
#include <string>
#define INF (1e9)
using namespace std;

int main(){
  int d[10]={0,0,1,2,0,-1,2,0,1,2},cnt,ans,c;
  string s;
  while(1){
    cin>>s;
    if(s=="#") break;
    ans=INF;
    for(int i=0;i<2;i++){
      c=i;
      cnt=0;
      for(int j=1;j<s.size();j++){
	int k=s[j-1]-'0',t=s[j]-'0';
	if((!c&&d[k]>d[t])||(c&&d[k]<d[t])) cnt++;
	else c=!c;
      }
      ans=min(ans,cnt);
    }
    cout<<ans<<endl;
  }
  return 0;
}

Measured memory_bytes: 1316
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long unsigned int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define Rep(x,y) for(int x = 0; x < y; x++)
#define Repe(x,y,z) for(int x = z; x < y; x++)

int main() {

    int h,w;
    int a[502][502];

    int ans = 0;
    int cnt = 0;
    vector<pair<int,int>> f1;
    vector<pair<int,int>> f2;

    bool odd[502][502] = {{}};

    scanf("%d %d", &h, &w);

    Rep(i, h){
        Rep(j, w){
            scanf("%d", a[i+1] + j+1);
            if( a[i+1][j+1] % 2 == 1) odd[i+1][j+1] = true;
            cnt += a[i+1][j+1];
        }
    }

    bool hap = false;
    pair<int,int> from;
    pair<int,int> to;
    Repe(i, h+1, 1){
        if( i % 2 == 1 ){
            for (int j = 1; j <= w; j++){
                if( i == h && j == w) break;
                from.first = i; from.second = j;
                if( j != w ){
                    to.first = i; to.second = j+1;
                }else{
                    to.first = i+1; to.second = j;
                }
                f1.push_back(from);
                f2.push_back(to);
                if( hap ){
                    if( odd[i][j] ){
                        hap = false;
                        f1.pop_back();
                        f2.pop_back();
                    }
                }else{
                    if( odd[i][j] ){
                        hap = true;
                    }else{
                        f1.pop_back();
                        f2.pop_back();
                    }
                }
            }
        }else{
            for (int j = w; j > 0; j--){
                if( i == h && j == 1) break;
                from.first = i; from.second = j;
                if( j != 1 ){
                    to.first = i; to.second = j-1;
                }else{
                    to.first = i+1; to.second = j;
                }
                f1.push_back(from);
                f2.push_back(to);
                if( hap ){
                    if( odd[i][j] ){
                        hap = false;
                        f1.pop_back();
                        f2.pop_back();
                    }
                }else{
                    if( odd[i][j] ){
                        hap = true;
                    }else{
                        f1.pop_back();
                        f2.pop_back();
                    }
                }
            }
        }
    }
    printf ("%d\n", f1.size());
    
    while( !f1.empty() ){
        printf("%d %d %d %d", f1.back().first, f1.back().second, f2.back().first, f2.back().second);
        f1.pop_back();
        f2.pop_back();
        printf ("\n");
    }

    return 0;
}



Measured memory_bytes: 5484
package main

import "fmt"

func main() {
	var a, b, k int
	fmt.Scan(&a, &b, &k)
	if k<=a{
		a = a - k
	}else if k<=a+b{
		b = b - (k-a)
		a = 0
	}else{
		a = 0
		b = 0
	}
	fmt.Println(a, b)
}

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

using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};

struct SuffixArray {
  int N, k;
  string S;
  vector<int> sa, rank, tmp;
  vector<int> lpc, rank_lpc;
  SuffixArray(string S) : S(S) {
    N = S.size();
    sa.resize(N+1), rank.resize(N+1), tmp.resize(N+1);
    construct_sa();
  }

  bool compare_sa(int i, int j) {
    if (rank[i] != rank[j]) {
      return rank[i] < rank[j];
    } else {
      int ri = i + k <= N ? rank[i + k] : -1;
      int rj = j + k <= N ? rank[j + k] : -1;
      return ri < rj;
    }
  }

  void construct_sa() {
    for (int i = 0; i <= N; i++) {
      sa[i] = i;
      rank[i] = i < N ? S[i] : -1;
    }

    for (k = 1; k <= N; k *= 2) {
      sort(sa.begin(), sa.end(), [&] (const int & i, const int & j) { return compare_sa(i, j); });

      tmp[sa[0]] = 0;
      for (int i = 1; i <= N; i++) {
        tmp[sa[i]] = tmp[sa[i-1]] + (compare_sa(sa[i-1], sa[i]) ? 1 : 0);
      }
      for (int i = 0; i <= N; i++) rank[i] = tmp[i];
    }
  }

  bool contain(string T) {
    int left = 0, right = N;
    while (left - right > 1) {
      int mid = (left + right) / 2;
      (S.compare(sa[mid], T.length(), T) < 0 ? left : right) = mid;
    }
    return S.compare(sa[right], T.length(), T) == 0;
  }

  void construct_lpc() {
    lpc.resize(N), rank_lpc.resize(N+1);
    for (int i = 0; i <= N; i++) rank_lpc[sa[i]] = i;

    int h = 0;
    lpc[0] = 0;
    for (int i = 0; i < N; i++) {
      int j = sa[rank[i] - 1];

      if (h > 0) h--;
      for (; j + h < N and i + h < N; h++) {
        if (S[j + h] != S[i + h]) break;
      }

      lpc[rank[i] - 1] = h;
    }
  }
};

int main() {
  // use scanf in CodeForces!
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int K; cin >> K;
  string S; cin >> S;
  int N = S.size();
  SuffixArray sa(S);

  vector<int> cand;
  int L = ((int)S.size() + K) / (K + 1);
  REP(i, sa.sa.size()) {
    if (sa.sa[i] + L <= N) cand.push_back(sa.sa[i]);
  }

  function<bool (int)> check = [&](int mid) {
    int cnt = 0, cur = 0, prev = 0;
    while (cur < N) {
      if (sa.rank[cur] <= sa.rank[cand[mid]]) {
        cur += L;
      } else {
        cur += L - 1;
      }
      cnt++;
      if (cnt - 1 > K) return false;
    }
    return cnt - 1 <= K;
  };

  int left = -1, right = cand.size() - 1;
  while (left + 1 < right) {
    int mid = (left + right) / 2;
    (check(mid) ? right : left) = mid;
  }

  cout << S.substr(cand[right], L) << endl;

  return 0;
}


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

using namespace std;
int main(){
  long n,m;
  cin >> n >> m;
   
  long res=0;
  vector<long> t(n+1);
  for(int i=0;i<n;i++){
   cin >> t[i];
  }
  t[n]=t[n-1]+m;
  
  for(int i=0;i<n;i++){
   res+=min(t[i]+m,t[i+1])-t[i];
  }
  
  
 cout << res << endl;
  
  
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
int a,b;
b=0;
cin>>a;
b=a%10;
if(b==2)
{

cout<<"hon";
}
if(b==4)
{

cout<<"hon";
}
if(b==5)
{

cout<<"hon";
}
if(b==7)
{

cout<<"hon";
}
if(b==9)
{

cout<<"hon";
}
if(b==0)
{

cout<<"pon";
}
if(b==1)
{

cout<<"pon";
}
if(b==6)
{

cout<<"pon";
}
if(b==8)
{

cout<<"pon";
}
if(b==3)
{

cout<<"bon";
}
return 0;

}

Measured memory_bytes: 3636
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <set>
#include <vector>
#include <numeric>
#include <algorithm>
#include <string>
#include <complex>
 
#include <cassert>
#include <cstdlib>
#include <cmath>
#include <cstdio>
#include <cstring>
 
#define REP(i,e) for(int i=0;i<(int)(e);i++)
#define FOR(i,b,e) for(int i=(int)(b);i<(int)(e);i++)
#define ALL(c) (c).begin(), (c).end()
#define EACH(it,c) for(__typeof((c).begin()) it=(c).begin();it!=(c).end();++it)
#define RALL(c) (c).rbegin(), (c).rend()
#define ALLA(a,n) ((a)+0), ((a)+n)
 
using namespace std;
 
typedef long long ll;
typedef vector<int> vint;
typedef vector<long long> vll;
typedef vector<string> vstring;
typedef vector<double> vdouble;
 
template<class T>void pp(T v,int n){ REP(i,n)cout<<v[i]<< ' ' ; cout << endl; }
template<class T>void pp(T v){ EACH(it,v) cout << *it << ' ' ; cout << endl;  }
template<class T>T& ls(T& a,T b){ if(b<a) a=b; return a; }
template<class T>T& gs(T& a,T b){ if(b>a) a=b; return a; }
inline ll to_i(const string& s){ll n;sscanf(s.c_str(),"%lld",&n);return n;}
inline string to_s(ll n){char buf[32];sprintf(buf,"%lld",n);return string(buf);}

int main() {
  int n;
  while (cin >> n) {
    vector<pair<pair<string,int>, int > > v(n);
    REP(i,n) {
      cin >> v[i].first.first >> v[i].first.second;
      v[i].second = i + 1;
      v[i].first.second *= -1;
    }
    sort(ALL(v));
    REP(i,n) cout << v[i].second << endl;
  }
}


Measured memory_bytes: 256
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <ctime>

#include <queue>
#include <stack>
#include <map>
#include <set>

#include <cmath>
#include <algorithm>
#include <cstring>
#include <functional>
#include <cctype>
#include <numeric>

using namespace std;

template<typename T> ostream& operator<<(ostream& os, const vector<T>& v){
    os << "{ ";
    for(typename vector<T>::const_iterator it=v.begin(); it!=v.end(); ++it)
        os << '"' << *it << '"' << (it+1==v.end() ? "" : ", ");
    os << " }";
    return os;
}

typedef vector<int> vi;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vb> vvb;
typedef long long ll;
typedef unsigned uint;
typedef unsigned long ul;
typedef unsigned long long ull;

#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define loop(i,a,b) for(int i=(a); i<(int)(b); i++)
#define rep(i,b) loop(i,0,b)
#define repi(i,b) loop(i,1,b+1)
#define pb push_back
#define mp make_pair

pair<int,int> solve(const vvb& G){
    // 0 is free
    // 1 is obstacle
    int h = G.size(), w = G[0].size();
    vvi dp(h,vi(w));
    rep(y,h)rep(x,w){
        if(!G[y][x]) {
            if(x!=0) dp[y][x] = dp[y][x-1]+1;
            else dp[y][x] = 1;
        } else {
            dp[y][x] = 0;
        }
    }

    const int inf = 1<<30;
    int tans = 0;
    pair<int,int> ans;
    rep(x,w)rep(y,h){
        int th = 0;
        int tw = inf;
        loop(cy,y,h){
            th++;
            tw = min(tw, dp[cy][x]);
            if(th * tw > tans){
                tans = th*tw;
                ans = make_pair(tw,th);
            }
        }
    }
    return ans;
}

int main(){
    int h,w;
    while(cin>>h>>w, w||w){
        vs G(h);
        rep(i,h) cin>>G[i];
        vvb isobs(h,vb(w));
        rep(i,h)rep(j,w) isobs[i][j] = G[i][j]=='*';
        auto ans = solve(isobs);
        cout << ans.first * ans.second << endl;
    }
}

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

int main() {
	int n;
	cin >> n;
	string s;
	cin >> s;
	int l = 0, r = n-1;
	int cnt = 0;
	while (l < r) {
		while (l < n) {
			if (s[l] == 'W') break;
			else l++;
		}
		while (r >= 0) {
			if (s[r] == 'R') break;
			else r--;
		}
		if (r > l) {
			cnt+=1;
			s[r] = 'W';
			s[l] = 'R';
		}
	}
	cout << cnt;
}


Measured memory_bytes: 3744
#include <iostream>
using namespace std;
int main(void){
    
    int N, A;
    cin >> N >> A;
    
    int amari = N % 500;
    
    if(amari <= A){
        cout << "Yes" << endl;
    }
    else{
        cout << "No" << endl;
    }
    
    
}


Measured memory_bytes: 3132
#include <stdio.h>
#include <math.h>
int main()
{
	unsigned int N;
	int cont = 2, num = 0;
	
	scanf("%d", &N);
	int N2 = N;
	while (N > 0) {
		num += (N % 10) * pow(10, cont);
		N /= 10;
		cont--;
	}
	if (num == N2)
		printf("Yes");
	else
		printf("No");
		
	return 0;
} 

Measured memory_bytes: 384
import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

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;

int calc(long[][] a) {
    if (a.length == 1) return 1;

    int ans = int.max;
    int n = cast(int)a.length;
    for (int i = 0; i < n; i++) {
        for (int j = 0; j < n; j++) {
            if (i == j) continue;

            long dx = a[i][0] - a[j][0];
            long dy = a[i][1] - a[j][1];
            int match = 0;
            foreach (k; 0..n) {
                foreach (m; 0..n) {
                    if (k == m) continue;
                    if (a[k][0] - a[m][0] == dx && a[k][1] - a[m][1] == dy) {
                        match++;
                    }
                }
            }
            int cost = n - match;
            ans = min(ans, cost);
        }
    }
    return ans;
}

void main() {
    int n = readint;
    long[][] a;
    for (int i = 0; i < n; i++) {
        a ~= reads!long;
    }
    writeln(calc(a));
}


Measured memory_bytes: 256
N, M = list(map(int,input().split()))
A = []
S = [0 for i in range(N+1)]
S[0] = 1
for i in range(M):
  s = int(input())
  A.append(s)
  S[s] = -1
for i in range(N+1):
  if S[i] == -1:
    continue
  if i+1 <= N:
    if S[i+1] == 0:
      S[i+1] = S[i]
    elif S[i+1] > 0:
      S[i+1] += S[i]
  if i+2 <= N:
    if S[i+2] == 0:
      S[i+2] = S[i]
    elif S[i+2] > 0:
      S[i+2] += S[i]
print (S[-1]%1000000007)

Measured memory_bytes: 460056
use std::io::*;
const MOD: usize = 1_000_000_007;

fn pow(mut x: usize, mut e: usize) -> usize {
    let mut res = 1;
    while e > 0 {
        if e & 1 == 1 {
            res = res * x % MOD;
        }
        x = x * x % MOD;
        e >>= 1;
    }
    res
}

fn main() {
    let mut s: String = String::new();
    std::io::stdin().read_to_string(&mut s).ok();
    let mut itr = s.trim().split_whitespace();
    let n: usize = itr.next().unwrap().parse().unwrap();
    let k: usize = itr.next().unwrap().parse().unwrap();

    let mut memo: Vec<usize> = vec![0; 200010];
    for i in 1..k + 1 {
        memo[i] = pow(k / i, n);
    }
    let mut ans = 0;
    for i in (1..k + 1).rev() {
        let mut j = i * 2;
        while j <= k {
            memo[i] = (memo[i] + MOD - memo[j]) % MOD;
            j += i;
        }
    }
    for i in 1..k + 1 {
        ans = (ans + i * memo[i] % MOD) % MOD;
    }

    println!("{}", ans);
}


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

int main() {
    int n,k;cin>>n>>k;
    int a[n];
    for (int i=0;i<n;i++)
        cin>>a[i];
    sort(a,a+n);
    ll ans=0;
    for (int i=0;i<n-k;i++)
        ans+=a[i];
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 1024
//#include <math.h>
#include <bits/stdc++.h>
#include<stdio.h>
//#include <string.h>
using namespace std;

int main(void){
    long X;
    cin >> X;
    long money =100;
    long year=0;
    for(;;){
        year ++;
        money = money*1.01;
        if(money>=X){
            break;
        }
    }
    cout << year <<endl;
    
    return 0;
}





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

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

using namespace std;

int main(){
	int h,w; cin>>h>>w;
	int d[10][10];
	rep(i,10) rep(j,10) cin>>d[i][j];

	rep(k,10) rep(i,10) rep(j,10) d[i][j]=min(d[i][j],d[i][k]+d[k][j]);

	int ans=0;
	rep(i,h) rep(j,w) {
		int a; cin>>a;
		if(a!=-1) ans+=d[a][1];
	}
	cout<<ans<<endl;

	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <iomanip>
#include <string>
#include <map>
#include <math.h>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <set>
#include <queue>
#include <sstream>
#include <stack>
#include <deque>
#include <memory.h>
#include <cassert>
#include <ctime>
#include <climits>
#include <list>
#include <time.h>
#include <unordered_map>
#include <bitset>
#include <exception>

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef unsigned long long ull;
#define pb push_back
#define mp make_pair
#define FILE "file"
#define lc v << 1
#define rc (v << 1) + 1
#define inf 1e+9
#define linf ll(1e+18)
#define dinf 1e+14

typedef long long ll;
#define pb push_back
#define mp make_pair

const int maxn = 10;
int c[maxn][maxn];

void solve()
{
    int x, y, z;
    cin >> x >> y >> z;
    x -= 2 * z;
    int c = x / (y + z);
    int d = (x - c * (y + z));
    cout << c + (y <= d);
}

int main()
{
    ios_base::sync_with_stdio(false);cin.tie(0), cout.tie(0);
    //freopen(FILE ".in", "r", stdin);freopen(FILE ".out", "w", stdout);
    //freopen("file.in", "r", stdin);freopen("file.out", "w", stdout);
    int t = 1;
    //cin >> t;
    
    while(t--)
    {
        solve();
    }
    
    return 0;
}


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,n) for(int i=(int)(j);i<(int)(n);i++)
#define REP(i,j,n) for(int i=(int)(j);i<=(int)(n);i++)
#define MOD 1000000007
#define int long long
#define ALL(a) (a).begin(),(a).end()
#define vi vector<int>
#define vii vector<vi>
#define pii pair<int,int>
#define priq priority_queue<int>
#define disup(A,key) distance(A.begin(),upper_bound(ALL(A),(int)(key)))
#define dislow(A,key) distance(A.begin(),lower_bound(ALL(A),(int)(key)))
#define tii tuple<int,int,int>
signed main(){
  int A,B,C; cin>>A>>B>>C;
  string ans="No";
  if(A<=C&&C<=B)
    ans="Yes";
  cout<<ans<<endl;
  }


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

int main() {
	int A, B; cin >> A >> B; A--, B--;
	cout << "100 100" << endl;
	for (int i = 0; i < 50; ++i) {
		for (int j = 0; j < 100; ++j) {
			if (A > 0 && (i % 2 == 0) && (j % 2 == 1)) {
				cout << '.';
				A--;
			}
			else {
				cout << '#';
			}
		}
		cout << endl;
	}

	for (int i = 0; i < 50; ++i) {
		for (int j = 0; j < 100; ++j) {
			if (B > 0 && (i % 2 == 1) && (j % 2 == 1)) {
				cout << '#';
				B--;
			}
			else {
				cout << '.';
			}
		}
		cout << endl;
	}

	return 0;
}

Measured memory_bytes: 256
N=int(input())
A,B=list(map(int,input().split()))
vec=[0,0,0]
for P in list(map(int,input().split())):
    if P<=A:
        vec[0]+=1
    elif P>B:
        vec[2]+=1
    else:
        vec[1]+=1
print(min(vec))

Measured memory_bytes: 3064
#include<iostream>
#include <algorithm>
#include <vector>
#include <deque>
using namespace std;


int main()
{
    // 整数の入力
    int N,K;
    cin >> N >> K;
    if (K == 1){
        cout << 0 << endl;
    }else{
        cout << N - K << endl;
    }

    return 0;
}

Measured memory_bytes: 256
#pragma GCC optimize(2)
#pragma GCC optimize(3)   
#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector < ll > vl;
typedef vector < vl > vvl;
typedef pair < ll, ll > pll;
typedef vector < pair < ll, ll > > vpll;
#define kill freopen("input.txt", "r", stdin);freopen("output.txt", "w", stdout);
#define pb push_back
#define fo(i,n) for(ll i=0;i<n;i++)
#define rev(i,n) for(ll i=n-1;i>=0;i--)
#define all(c) c.begin(), c.end()
#define go(c,it) for(auto it=(c).begin(); it!=(c).end(); it++)
#define back(c,it) for(auto it=(c).rbegin(); it!=(c).rend(); it++)
#define fi first
#define se second
#define MOD 998244353
#define Boost() ios_base::sync_with_stdio(false);cin.tie(NULL)
#define MOD1 1000000007
#define MOD3 999999937
ll power(ll a, ll b){ll res=1;a=a%MOD1;while(b>0){if(b&1){res=(res*a)%MOD1;}a=(a*a)%MOD1;b>>=1;}return res;}
ll fermat_inv(ll y){return power(y,MOD1-2);}
ll gcd(ll a, ll b){return (b==0)?a:gcd(b,a%b);}
#define oo INT_MAX

void solve(){
    ll n,m,k;
    cin>>n>>m>>k;
    char a[n][m];
    fo(i,n)fo(j,m){cin>>a[i][j];}
    ll ans = 0;
    fo(i,(1LL<<n)){
        fo(j,(1LL<<m)){
            set<ll> r,c;
            fo(row,n){
                if(i&(1LL<<row))r.insert(row);
            }
            fo(col,m){
                if(j&(1LL<<col))c.insert(col);
            }
            ll b = 0;
            fo(ii,n){
                fo(jj,m){
                    if(a[ii][jj]=='#'){
                        if(r.find(ii)!=r.end())continue;
                        if(c.find(jj)!=c.end())continue;
                        b++;
                    }
                }
            }
            if(b==k)ans++;
        }
    }
    cout<<ans;
}

int main(){
    Boost();
    #ifndef ONLINE_JUDGE 
    kill
    #endif
    ll T = 1;
    //cin>>T;
    while(T--){
        solve();
    }
    return 0;
}
 
 
 
 
 

Measured memory_bytes: 3656
#include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#include<utility>
#include<cstdio>
#include<set>
#include<string>
#include<map>
#include<queue>
#include<stack>
#include <bitset>
using namespace std;
const int mod=1e9+7;
#define rep(i,n) for(int i=0;i<n;i++)
#define rep2(i,x,n) for (int i= x;i<n;i++)
#define all(v) v.begin(), v.end()
#define nepe(v) next_permutation(all(v))
#define F first 
#define S second
#define PB push_back 
#define MP make_pair
using ll = long long;
using vi = vector<int>; 
using vvi = vector<vi>;
using vl=vector<long long>;
using vp =vector<pair<int,int>>;

typedef pair<int,int> P;
string s;
int k;
ll INF = 1000000000000;
int main(){
    ll X;
    cin >>X;
    ll A=100;
    ll ans=0;
    while(A<X){
        A =floor(1.01*A);
        ans ++;
    }
    cout <<ans<<endl;
}

Measured memory_bytes: 3740
#include<bits/stdc++.h>
#include<iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
typedef long long ll;
typedef long  l;
typedef pair<int,int> P;
const ll INF=100000000000000001;
const double PI=3.141592653589;


int main(){
  int a,b; cin>>a>>b;
  bool c=0;
  for(int i=1;i<=3;i++){
    if(a*b*i%2==1)
    c=1;
  }
  if(c)
  cout<<"Yes"<<endl;
  else
  cout<<"No"<<endl;

  return 0;
}


Measured memory_bytes: 256
//10
#include<iostream>
#include<algorithm>

using namespace std;

double in(){
  int n,m;
  cin>>n>>m;
  double ap=0;
  double p=0;
  while(m--){
    double v,r;
    cin>>v>>r;
    p+=v*r;
    ap+=r;
  }
  return p/ap;
}

int main(){
  int t;
  double m=0;
  cin>>t;
  while(t--){
    m=max(m,in());
  }
  cout<<((in()+0.0000001<m)?"YES":"NO")<<endl;
}

Measured memory_bytes: 1232
N=int(input())
A=list(map(int, input().split()))
if min(A)>=0:
  print(N-1)
  for i in range(1,N):
    print(i,i+1)
elif max(A)<=0:
  print(N-1)
  for i in range(N-1):
    print(N-i,N-1-i)
else:
  a,b=max(A),abs(min(A))
  print((N-1)*2)
  if a>=b:
    d=A.index(a)
    for i in range(N):
      if i!=d:
        print(d+1,i+1)
    for i in range(1,N):
      print(i,i+1)
  else:
    d=A.index(-b)
    for i in range(N):
      if i!=d:
        print(d+1,i+1)
    for i in range(N-1):
      print(N-i,N-1-i)


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

using namespace std;

int main()
{
    int a,b,f=0;
    cin>>a>>b;
    if(a==b) cout<<a<<endl;
    else
    {
        for(int i=0;i<13;i++)
        {
            if(i==a && i<=b)
                {
                    cout<<a<<endl;f=1;break;}
        }
        if(f==0)cout<<a-1<<endl;
    }
    return 0;
}


Measured memory_bytes: 256
#define _CRT_SECURE_NO_WARNINGS
#define mod 998244353
#include <iostream>
#include <vector>
#include <list>
#include <set>
#include <bitset>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <string>
#include <functional>
#include <algorithm>
#include <iterator>
#include <cstdio>
#include <utility>
#include <unordered_map>
#include <cmath>
#include <chrono>
using namespace std;

typedef pair<int, int> P;

#define dfor(i,a,b) for(int i=(a);i<(b);++i)
#define drfor(i,a,b) for (int i=(b)-1;i>=(a);i--)
#define drep(i,n) dfor(i,0,n)
#define drrep(i,n) drfor (i,n,0)
struct UnionFind {
	vector<int> data;
	UnionFind(int size) : data(size, -1) { }
	bool unite(int x, int y) {
		x = root(x); y = root(y);
		if (x != y) {
			if (data[y] < data[x]) swap(x, y);
			data[x] += data[y]; data[y] = x;
		}
		return x != y;
	}
	bool same(int x, int y) {
		return root(x) == root(y);
	}
	int root(int x) {
		return data[x] < 0 ? x : data[x] = root(data[x]);
	}
	int size(int x) {
		return -data[root(x)];
	}
	void reset(void) {
		drep(i, data.size()) data[i] = -1;
	}
};

int v[2][100001];

int main(void) {
	int n,j,m=0,mm=0,r=0,rr=0,k,l;
	scanf("%d", &n);
	drep(i, 100001) {
		v[0][i] = 0;
		v[1][i] = 0;
	}
	drep(i, n) {
		scanf("%d", &j);
		v[i%2][j]++;
	}
	drep(i, 100001) {
		if (v[0][i] > m) {
			r = m;
			m = v[0][i];
			k = i;
		}
		else if (v[0][i] > r) {
			r = v[0][i];
		}
		if (v[1][i] > mm) {
			rr = mm;
			mm = v[1][i];
			l = i;
		}
		else if (v[1][i] > rr) {
			rr = v[1][i];
		}
	}
	int res;
	if (k == l) {
		res = max(m + rr, mm + r);
	}
	else {
		res = m + mm;
	}
	printf("%d", n-res);
	
	return 0;
}

Measured memory_bytes: 1024
lines = []
while line = gets
    lines << line.chomp.split(' ').map(&:to_i)
end

N = lines[0][0]

b = []
for i in 1..N-1 do
  b.push(lines[1][i-1])
end

def min(x,y)
  if x > y then
    return y
  else
    return x
  end
end
  
ans = []
for i in 1..N do
  if i == 1 then
    ans.push(b[0])
  elsif i == N then
    ans.push(b[i-2])
  else
    ans.push(min(b[i-2], b[i-1]))
  end
end
    
result = 0
for i in 1..N do
  result += ans[i-1]
end
print result

Measured memory_bytes: 1788
#include <cstdio>
#include <cstring>

const int INF = 0x3f3f3f3f;
const int MAXN = 1e5 + 5, MAXS = ( 1 << 16 ) + 5;

template<typename _T>
void read( _T &x )
{
	x = 0;char s = getchar();int f = 1;
	while( s > '9' || s < '0' ){if( s == '-' ) f = -1; s = getchar();}
	while( s >= '0' && s <= '9' ){x = ( x << 3 ) + ( x << 1 ) + ( s - '0' ), s = getchar();}
	x *= f;
}

template<typename _T>
void write( _T x )
{
	if( x < 0 ){ putchar( '-' ); x = ( ~ x ) + 1; }
	if( 9 < x ){ write( x / 10 ); }
	putchar( x % 10 + '0' );
}

template<typename _T>
_T MIN( const _T a, const _T b )
{
	return a < b ? a : b;
}

int f[MAXS];
int w[MAXN];
int N, cnt;
bool vis[MAXS];

bool chk( const int S, const int b ) { return S >> b & 1; }

int DFS( const int S )
{
	if( ! S ) return f[S] = 0;
	if( vis[S] ) return f[S];
	vis[S] = true;
	for( int i = 1 ; i <= 15 ; i ++ )
		for( int j = i + 1 ; j <= 15 ; j ++ )
			if( chk( S, i - 1 ) && chk( S, j - 1 ) )
			{
				int t = S ^ ( 1 << i - 1 ) ^ ( 1 << j - 1 );
				int v = i ^ j, nxt = t ^ ( 1 << v - 1 );
				f[S] = MIN( f[S], DFS( nxt ) + 1 + chk( t, v - 1 ) );
			}
	return f[S];
}

int main()
{
	read( N );
	for( int i = 1, x, y, b ; i < N ; i ++ )
		read( x ), read( y ), read( b ),
		w[x + 1] ^= b, w[y + 1] ^= b;
	int sta = 0, tot = 0;
	for( int i = 1 ; i <= N ; i ++ )
		if( w[i] )
			tot += ( sta >> w[i] - 1 ) & 1, 
			sta ^= 1 << w[i] - 1;
	memset( f, 0x3f, sizeof f );
	write( DFS( sta ) + tot ), putchar( '\n' ); 
	return 0;
}
/*
3
0 1 1
0 2 1
*/

Measured memory_bytes: 2200
n, p = map(int, input().split())

def factorization(n):
    arr = []
    temp = n
    for i in range(2, int(-(-n**0.5//1))+1):
        if temp%i == 0:
            cnt = 0
            while temp%i == 0:
                cnt+=1
                temp//=i
            arr.append((i, cnt))
    
    if temp!=1:
        arr.append((temp, 1))
    
    if arr==[]:
        arr.append((n, 1))
    
    return arr

arr = factorization(p)
ans = 1
for f, v in arr:
    if v>=n:
        ans*=f**(v//n)
print(ans)


Measured memory_bytes: 9448