akhauriyash/Code-Regression huggingface dataset:
h, w, k = map(int, input().split(' '))
c = [input() for x in range(h)]
cnt = 0
for m in range(2**(h+w)):
    cc = c.copy()
    for ij in range(h+w):
        if ((m >> ij) & 1):
            if ij in range(h):
                cc[ij] = '.'*w
            if ij in range(h,h+w):
                for t in range(h):
                    cc[t] = cc[t][:ij-h]+'.'+cc[t][ij+1-h:]
    num = sum(cc[s].count('#') for s in range(h))
    if num == k:
        cnt += 1
print(cnt)

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

int main(){
	int k,s ;
	cin >> k >> s ;
	int ans = 0 ;
	for(int i=0;i<=k;i++){
		for(int j=0;j<=k;j++){
			int y = s-i-j ;
			if(0<=y&&y<=k) ans++ ;
		}
	}
	cout << ans << endl ;
}

Measured memory_bytes: 256
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int a = sc.nextInt();
		int b = sc.nextInt();
		int k = sc.nextInt();

		int max = Math.max(a, b);

		List<Integer> list = new ArrayList<Integer>();

		for (int i = 1; i <= max; i++) {
			if (a % i == 0 && b % i == 0) {
				list.add(i);
			}
		}
		System.out.println(list.get(list.size() - k));

	}
}


Measured memory_bytes: 23764
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#define repi(i,a,b) for(ll i=(a);i<(b);++i)
#define rep(i,a) repi(i,0,a)
#define repdi(i,a,b) for(ll i=(a)-1;i>=(b);--i)
#define repd(i,a) repdi(i,a,0)
#define itr(it,a) for( auto it = (a).begin(); it != (a).end(); ++it )
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define endl '\n'
#define debug(x) std::cerr << #x << " = " << (x) << endl;

using ll = long long;
using P = std::pair<ll, ll>;

constexpr ll INF = 1ll<<60;

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

template<class S, class T>
std::ostream& operator<< ( std::ostream& out, const std::pair<S,T>& a )
{ std::cout << '(' << a.first << ", " << a.second << ')'; return out; }

template<class T>
std::ostream &operator<< ( std::ostream& out, const std::vector<T>& a )
{ std::cout << '['; rep( i, a.size() ){ std::cout << a[i]; if( i != a.size()-1 ) std::cout << ", "; } std::cout << ']'; return out; }

ll N, M;
std::vector<ll> G[100010];
ll Q;
ll v[100010], d[100010], c[100010];
bool memo[100010][20];
ll ans[100010];

void func( ll ver, ll dist, ll col ) {
  if( memo[ver][dist] )
    return;

  bool &ret = memo[ver][dist];

  if( !ans[ver] )
    ans[ver] = col;

  if( !dist )
    return;

  for( auto u : G[ver] )
    func( u, dist-1, col );

  ret = true;

  return;
}

int main() {
  std::cin >> N >> M;

  rep( i, M ) {
    ll a, b;
    std::cin >> a >> b;
    --a; --b;

    G[a].emplace_back( b );
    G[b].emplace_back( a );
  }

  std::cin >> Q;

  rep( q, Q ) {
    std::cin >> v[q] >> d[q] >> c[q];
    --v[q];
  }

  repd( q, Q ) {
    func( v[q], d[q], c[q] );
  }

  rep( i, N )
    std::cout << ans[i] << endl;

  return 0;
}

Measured memory_bytes: 14504
import sys


stdin = sys.stdin
def ns(): return stdin.readline().rstrip()
def ni(): return int(stdin.readline().rstrip())
def nm(): return map(int, stdin.readline().split())
def nl(): return list(map(int, stdin.readline().split()))


def main():
    n, k = nm()
    A = nl()
    print((n - 1) // (k - 1) if (n - 1) %
          (k - 1) == 0 else (n - 1) // (k - 1) + 1)


if __name__ == '__main__':
    main()


Measured memory_bytes: 20632
#include<bits/stdc++.h>
using namespace std;
int main(){
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int t;
    t=1;
     while(t--){
         char a;
         cin>>a;
         if(a>=91)
         cout<<"a\n";
         else
         cout<<"A\n";
	 }
}

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

const int MAXN = 302;

double dp[MAXN][MAXN][MAXN];
int N,vis[MAXN][MAXN][MAXN];

double solve(int x,int y,int z){
	
	if(vis[x][y][z]) return dp[x][y][z];
	//printf("Solving %d %d %d\n",x,y,z);
	vis[x][y][z] = 1;

	if(x == 0 && y == 0 && z == 0) return dp[x][y][z] = 0;

	int soma = x + y + z;
	double convertido = (double)soma;
	double tot = (N - soma)/convertido;
	
	//printf("Tot antes %d %d %d %d %lf\n",N - soma,x,y,z,tot);

	if(x != 0) tot += x*((solve(x-1,y,z) + 1)/convertido);
	if(y != 0) tot += y*((solve(x+1,y-1,z) + 1)/convertido);
	if(z != 0) tot += z*((solve(x,y+1,z-1) + 1)/convertido);

	//printf("Tot (%d,%d,%d) = %lf\n",x,y,z,tot);

	return dp[x][y][z] = tot;

}

int main(){

	int a[4] = {0,0,0,0};

	cin >> N;

	for(int i = 1;i<=N;i++){
		int x;
		cin >> x;
		a[x]++;
	}

	printf("%.9lf\n",solve(a[1],a[2],a[3]));

	return 0;
}

Measured memory_bytes: 321792
#include<stdio.h>
#include <iostream>
#include <math.h>
#include <numeric>
#include <vector>
#include <map>
#include <functional>
#include <stdio.h>
#include <array>
#include <algorithm>
#include <string>
#include <string.h>
#include <assert.h>
#include <stdio.h>
#include <queue>
#include<iomanip>
#include<bitset>
#include<stack>
#include<set>
#include<limits>
#include <complex>
#include<cstdlib>
using namespace std;

int memo[203][203][6];
int field[203][203];
int sx, sy, gx, gy;

pair<int, int>tmove(const int x,const int y, const int way) {
	if ((x % 2)) {
		if (way == 0) {
			return{ x,y + 1 };
		}
		else if (way == 1) {
			return{ x + 1,y };
		}
		else if (way == 2) {
			return{ x + 1,y - 1 };
		}
		else if (way == 3) {
			return{ x,y - 1 };
		}
		else if (way == 4) {
			return{ x - 1,y - 1 };
		}
		else if (way == 5) {
			return{ x - 1,y };
		}
		else {
			return{ x,y };
		}
	}
	else {
		if (way == 0) {
			return{ x,y + 1 };
		}
		else if (way == 1) {
			return{ x + 1,y+1 };
		}
		else if (way == 2) {
			return{ x + 1,y };
		}
		else if (way == 3) {
			return{ x,y - 1 };
		}
		else if (way == 4) {
			return{ x - 1,y };
		}
		else if (way == 5) {
			return{ x - 1,y+1 };
		}
		else {
			return{ x,y };
		}
	}
}

struct a {
	int y;
	int x;
	int t;
	int ign;
};
class Compare {
public:
	//keiroが昇順に並ぶ
	bool operator()(const a&l, const a&r) {
		return l.ign> r.ign;
	}
};

int main() {
	memset(memo, 9999999, sizeof(memo));
	memset(field, false, sizeof(field));
cin >> sx >> sy >> gx >> gy;
	sx += 101; sy += 101; gx += 101; gy += 101;
	int n; cin >> n;
	for (int i = 0; i < n; ++i) {
		int x, y; cin >> x >> y;
		x += 101; y += 101;
		field[y][x] = true;
	}

	int lx, ly; cin >> lx >> ly;
	for (int i = 100-lx; i < 103+lx; ++i) {
		field[100 - ly][i] = true;
		field[102 + ly][i] = true;
	}
	for (int j = 100 - ly; j < 103 + ly; ++j) {
		field[j][100 - lx] = true;
		field[j][102 + lx] = true;
	}

	priority_queue<a,vector<a>,Compare>que;
	que.push(a{ sy,sx,0,0 });
	memo[sy][sx][0] = 0;
	while (!que.empty()) {
		a atop(que.top());
		que.pop();
		int order = abs((atop.y-101)*(atop.x-101)*atop.t) % 6;
		for (int i = 0; i < 7; ++i) {
			int ign = atop.ign + 1;
			if (i == order) {
				ign--;
			}
			pair<int, int>za(tmove(atop.x, atop.y, i));
			if (!field[za.second][za.first]) {
				if (memo[za.second][za.first][(atop.t + 1) % 6]==-1||memo[za.second][za.first][(atop.t + 1) % 6]>ign) {
					memo[za.second][za.first][(atop.t + 1) % 6] = ign;
					que.push(a{ za.second,za.first,(atop.t + 1) % 6,ign });
				}
			}
		}
	}

	int amin = 99999999;
	for (int i = 0; i < 6; ++i) {
		amin= min(amin, memo[gy][gx][i]);	
	}
	if (amin == 99999999) {
		cout << -1 << endl;
	}
	else {
		cout << amin << endl;
	}
	
	return 0;
}

Measured memory_bytes: 4408
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<map>
#include<cstring>
using namespace std;

#define rep(i,n) for(int i=0;i<n;i++)
#define REP(n) rep(i,n)
#define all(n) n.begin(),n.end()

const int MAXN = 256, R = 0, B = 1, RB = 2, LB = 3;

char tile[MAXN][MAXN];
int dp[4][MAXN][MAXN];

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

int main()
{
    int n;
    while(cin >> n && n)
    {
        rep(j,n)rep(i,n) cin >> tile[i][j];

        memset(dp, 0, sizeof(dp));

        rep(j,n)rep(i,n)rep(k,4)
            if(i + dx[k] <0 || i+dx[k] ==n || j+dy[k] <0 || j+dy[k] == n)
                dp[k][i][j] = tile[i][j] - '0';
            else
            {
                if(tile[i+dx[k]][j+dy[k]] == '0') 
                    dp[k][i][j] = tile[i][j] - '0';
                else
                    dp[k][i][j] = dp[k][i+dx[k]][j+dy[k]] + tile[i][j] - '0';
            }

        int ans = 0;
        rep(j,n)rep(i,n)rep(k,4)ans = max(ans, dp[k][i][j]);

        cout << ans << endl;


    }
    return 0;
}

Measured memory_bytes: 2256
#include<bits/stdc++.h>
using namespace std;
template <typename T> inline void read(T &x)
{
	int f = 1; x = 0; char c = getchar();
	for (; !isdigit(c); c = getchar()) if (c == '-') f = -1;
	for (; isdigit(c); c = getchar()) x = (x << 3) + (x << 1) + (c ^ 48);
	x *= f;
}
int n, x, t;
int main(){
	read(n); read(x); read(t);
	printf ("%d\n", t * ((n - 1) / x + 1));
  return 0;
}

Measured memory_bytes: 3744
#include <iostream>     
                        
int main() {            
    int x, y, z = 0;    
    std::cin >> x >> y >> z;
                        
    if(x < y && y < z) {
        std::cout << "Yes" << std::endl;
    }                   
    else {              
        std::cout << "No" << std::endl;
    }                   
                        
    return 0;           
}

Measured memory_bytes: 1156
#include <bits/stdc++.h>
#define rep(i,m,n) for(int i=m; i<n; i++)
#define co(n) cout << n << endl
using namespace std;
int main(){
  int n, a, b;
  cin >> n;
  if(n==1){
    co("Hello World");
  }
  else{
    cin >> a >> b;
    co(a+b);
  }
  
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <algorithm>
#include <stack>
#include <string>
#include <queue>
#include <cstdlib>
using namespace std;

int main() {

	queue< pair<string, int> > que;
	string name;
	int n, q, t;
	cin >> n >> q;

	for(int i = 0; i < n; i++) {
		cin >> name >> t;
		que.push(make_pair(name, t));
	}

	pair<string, int> u;
	int elapse = 0, a;

	while( !que.empty() ) {
		u = que.front(); que.pop();
		a = min(u.second, q);
		elapse += a;
		u.second -= a;
		if(u.second > 0) que.push(u);
		else cout << u.first << " " << elapse <<endl;
	}
	return 0;
}

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

int main() {
  int a, b, c;
  cin >> a >> b >> c;
  cout << c << " " << a << " " << b << endl;

  return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define gc getchar
#define pb push_back
#define eb emplace_back
#define all(x) (x).begin(),(x).end()
#define x1 uvuvwevwevwe
#define y1 onyetenyevwe
#define x2 ugwemubwem
#define y2 ossas
typedef long long LL;
typedef long double LD;
typedef pair<int,int> pii;
template <typename T> void scan(T &angka){
	angka=0;char input=gc();T kali=1;
	while(!(48<=input&&input<=57)){	if(input=='-')	kali=-1;input=gc();}
	while(48<=input&&input<=57)	angka=(angka<<3)+(angka<<1)+input-48,input=gc();angka*=kali;
}
template <typename T1,typename T2> void scan(T1 &angka1,T2 &angka2){
	scan(angka1);scan(angka2);
}
int panjang;
char input[5005];
int k;
vector <string> daftar;
int main()
{
	cin>>input>>k;
	panjang=strlen(input);
	for(int i=0;i<panjang;i++)
	{
		string temp="";
		for(int j=i;j<min(panjang,i+min(panjang,5));j++)
		{
			//cout<<"dari "<<i<<" "<<j<<endl;
			temp+=input[j];
			daftar.pb(temp);
		}
	}
	sort(all(daftar));
	daftar.resize(unique(all(daftar))-daftar.begin());
	cout<<daftar[k-1]<<endl;
}


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

int main(){
    int n;  cin >> n;
    vector<ll> city(n+1), brave(n);
    for(int i=0; i<n+1; i++)  cin >> city.at(i);
    for(int i=0; i<n; i++) cin >> brave.at(i);

    ll cnt=0;
    for(int i=0; i<n; i++){
        if(city.at(i) <= brave.at(i)){
            brave.at(i) -= city.at(i);
            cnt += city.at(i);
        }else{
            cnt += brave.at(i);
            brave.at(i) = 0;
        }
        if(city.at(i+1) <= brave.at(i)){
            cnt += city.at(i+1);
            city.at(i+1) = 0;
        }else{
            cnt += brave.at(i);
            city.at(i+1) -= brave.at(i);
        }
    }
    cout << cnt << endl;
}

Measured memory_bytes: 1792
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>

using namespace std;

int main() {
	int n;
	cin >> n;
	vector< vector<long long int> > a(n, vector<long long int>(n));
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			cin >> a[i][j];
		}
	}
	vector< vector<long long int> > b = a;
	for (int k = 0; k < n; k++) {
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				b[i][j] = min(b[i][j], b[i][k] + b[k][j]);
			}
		}
	}
	bool h = true;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (a[i][j] != b[i][j]) {
				h = false;
			}
		}
	}
	if (h) {
		for (int k = 0; k < n; k++) {
			for (int i = 0; i < n; i++) {
				for (int j = 0; j < n; j++) {
					if (b[i][k] != 0 && b[j][k] != 0 && b[i][j] == b[i][k] + b[k][j]) {
						b[i][j] = 0;
					}
				}
			}
		}
		long long int ans = 0;
		for (int i = 0; i < n; i++) {
			for (int j = i + 1; j < n; j++) {
				ans += b[i][j];
			}
		}
		cout << ans << endl;
	}
	else {
		cout << -1 << endl;
	}
	return 0;
}

Measured memory_bytes: 1664
s=input()
p=True
t=""
l=s
while p==True:
    p=False
    f=l[0:8]
    if f=="dreamera":
        t +="dream"
        l=l[5:]
        p=True
    f=l[0:7]
    if p==False and f=="dreamer":
        t += "dreamer"
        l=l[7:]
        p=True
    f=l[0:6]
    if p==False and f=="eraser":
        t+="eraser"
        l=l[6:]
        p=True
    f=l[0:5]
    if p==False and f=="erase":
        t+="erase"
        l=l[5:]
        p=True
    if p==False and f=="dream":
        t+="dream"
        l=l[5:]
        p=True
if s==t:
    print("YES")
else:
    print("NO")

Measured memory_bytes: 9168
import java.util.*;

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

        int a = scan.nextInt();
        int[][] map = new int[a][2];
        double ans=0;
        for(int i=0;i<a;i++){
            map[i][0]=scan.nextInt();
            map[i][1]=scan.nextInt();
        }
        int k = 1;
        for(int i=1;i<a-1;i++){k*=i;}
        for(int i=0;i<a;i++){
            for(int j=i+1;j<a;j++){
                ans += Math.sqrt((double)Math.pow(map[i][0]-map[j][0],2)+(double)Math.pow(map[i][1]-map[j][1],2));
            }
        }
        int p = 1;
        for(int i=1;i<a+1;i++){p*=i;}
        ans/=p;
        ans=ans* 2 * (a-1)*k;
        System.out.println(ans);
    }
}

Measured memory_bytes: 21844
S = str(input())

X = []
ans = 0

for s in S:
    X.append(s)

X_even = X[1::2]
X_odd = X[::2]

for a in X_even:
    if a == 'L' or a == 'U' or a == 'D':
        pass
    else:
        ans += 1

for a in X_odd:
    if a == 'R' or a == 'U' or a == 'D':
        pass
    else:
        ans += 1
if ans >= 1:
    print('No')
else:
    print('Yes')

Measured memory_bytes: 3064
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n * 2];
        for (int i = 0; i < 2 * n; i++) {
            arr[i] = sc.nextInt();
        }
        Arrays.sort(arr);
        long sum = 0;
        for (int i = 0; i < n; i++ ) {
            sum += Math.min(arr[i * 2], arr[i * 2 + 1]);
        }
        System.out.println(sum);
    }
}


Measured memory_bytes: 21588
const int isDebugMode = 1;
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<long long, long long> P;
struct edge{long long to,cost;};
const int inf = 1 << 27;
const long long INF = 1LL << 60;
const int COMBMAX = 1001001;
const long long MOD = 1000000007;
const long long dy[] = {-1, 0, 0, 1};
const long long dx[] = {0, -1, 1, 0};
string abc = "abcdefghijklmnopqrstuvwxyz";
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define eachdo(v, e) for (const auto &e : (v))
#define all(v) (v).begin(), (v).end()
#define lower_index(v, e) (long long)distance((v).begin(), lower_bound((v).begin(), (v).end(), e))
#define upper_index(v, e) (long long)distance((v).begin(), upper_bound((v).begin(), (v).end(), e))
long long mpow(long long a, long long n, long long mod = MOD){long long res = 1; while(n > 0){if(n & 1)res = res * a % mod; a = a * a % mod; n >>= 1;} return res;}
void pt(){cout << endl; return;}
template<class Head> void pt(Head&& head){cout << head; pt(); return;}
template<class Head, class... Tail> void pt(Head&& head, Tail&&... tail){cout << head << " "; pt(forward<Tail>(tail)...);}
void dpt(){if(!isDebugMode) return; cout << endl; return;}
template<class Head> void dpt(Head&& head){if(!isDebugMode) return; cout << head; pt(); return;}
template<class Head, class... Tail> void dpt(Head&& head, Tail&&... tail){if(!isDebugMode) return; cout << head << " "; pt(forward<Tail>(tail)...);}
template<class T> void debug(T v){if(!isDebugMode) return; rep(i, v.size()) cout << v[i] << " " ; cout << endl;}
template<class T> void debug2(T v){if(!isDebugMode) return; rep(i, v.size()){rep(j, v[i].size()) cout << v[i][j] << " " ; cout << endl;}}
template<class T1, class T2> inline bool chmin(T1 &a, T2 b){if(a > b){a = b; return true;} return false;}
template<class T1, class T2> inline bool chmax(T1 &a, T2 b){if(a < b){a = b; return true;} return false;}
template<class T1, class T2> long long recgcd(T1 a, T2 b){return a % b ? recgcd(b , a % b) : b;}
bool valid(long long H, long long W, long long h, long long w) { return 0 <= h && h < H && 0 <= w && w < W; }

ll max_a = 1001001;

int main(){
    ll N; cin >> N;
    vector<ll> a(N);
    rep(i, N) cin >> a[i];
    vector<ll> list(max_a, -1);
    vector<ll> cont(max_a, INF);
    for(ll i = 2; i < max_a; ++i){
        for(ll c = i; c < max_a; c += i){
            if(!~list[c]){
                list[c] = i;
            }
        }
    }

     
    bool isPair = true;
    rep(i, N){
        ll num = a[i];
        for(; list[num] != -1; ){
            if(cont[list[num]] < i){
                isPair = false;
                break;
            } 
            cont[list[num]] = i;
            num /= list[num];
        }
        if(!isPair) break;
    }
    if(isPair){
        pt("pairwise coprime");
    }else{
        ll num = *a.begin();
        rep(i, N - 1){
            num = recgcd(num, a[i + 1]);
        }
        pt(num == 1 ? "setwise coprime" : "not coprime");
    }
    return 0;
}

Measured memory_bytes: 26636
#include <stdio.h>

int main(void){

  int n, i, ii, b, v, rr, f;
  int r[120] = {0};

  scanf("%d", &n);

  for(i = 0; i < n; i++){
    scanf("%d%d%d%d", &b, &f, &rr, &v);
    switch(b){
    case 1:
      r[rr+f*10-11] += v;
      break;
    case 2:
      r[rr+f*10+19] += v;
      break;
    case 3:
      r[rr+f*10+49] += v;
      break;
    case 4:
      r[rr+f*10+79] += v;
      break;
    }
    for(ii = 0; ii < 120; ii++){
      if(r[ii] < 0) r[ii] = 0;
      if(r[ii] > 9) r[ii] = 9;
    }
  }

  for(i = 0; i < 120; i++){
    if((i != 0) && (i % 10 == 0)) printf("\n");
    if((i != 0) && (i % 30 == 0)) printf("####################\n");
    if((0 <= i) && (i < 120)) printf(" %d", r[i]);
  }
  printf("\n");
  return 0;
}

Measured memory_bytes: 612
n=int(input())

yakusu=[0]*(n+1)

for i in range(1,n+1):
    for j in range(1,n+1):
        if i*j<=n:
            yakusu[i*j]+=1
        else:
            break

ans=0
for i,v in enumerate(yakusu):
    ans+=i*v

print(ans)

        




    






Measured memory_bytes: 145924
#include<bits/stdc++.h>
using namespace std;
const int N = 1001;
const string ans[] = {"DENIED","APPROVED"};
int dp[N], n, p = 1; 
inline void add(int d) {
  for (int x = d; x < N; x += d)
		++dp[x]; }
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0), cin >> n, add(6), add(10);
	for (int a, i = 0; i < n and p; ++i)
    	if (cin >> a, a%2 == 0 and dp[a] == 0)
        	p = 0;
  	cout << ans[p]; }

Measured memory_bytes: 256
// 基本テンプレート

#include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
#include <functional>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define int long long int

template<typename T> void chmax(T &a, T b) {a = max(a, b);}
template<typename T> void chmin(T &a, T b) {a = min(a, b);}
template<typename T> void chadd(T &a, T b) {a = a + b;}

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

int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
constexpr ll INF = 1001001001001001LL;
constexpr ll MOD = 1000000007LL;

int cnt[26];

signed main() {
    int H, W; cin >> H >> W;
    rep(i,0,H) rep(j,0,W) {
        char c; cin >> c;
        int x = c - 'a';
        cnt[x]++;
    }

    int two = 0, four = 0, one = 0;
    rep(i,0,26) {
        while(cnt[i] >= 4) {
            four++;
            cnt[i] -= 4;
        }
        while(cnt[i] >= 2) {
            two++;
            cnt[i] -= 2;
        }
        while(cnt[i] >= 1) {
            one++;
            cnt[i] -= 1;
        }
    }
    // printf("two = %lld, four = %lld, one = %lld\n", two, four, one);

    bool x = H%2, y = W%2;
    bool ok = true;
    if(x&&y) {
        if(two > H/2 + W/2) ok = false;
        if(one > 1) ok = false;
    }
    else if(x) {
        if(two > W/2) ok = false;
        if(one) ok = false;
    }
    else if(y) {
        if(two > H/2) ok = false;
        if(one) ok = false;
    }
    else {
        if(two || one) ok = false;
    }
    cout << (ok ? "Yes" : "No") << endl;
    return 0;
}

Measured memory_bytes: 256
fun main(args: Array<String>) {
    readLine()?.split(" ")?.map { it.toInt() }?.let {
        val d = it[0]
        val t = it[1]
        val s = it[2]
        if (d <= t * s) {
            println("Yes")
        } else {
            println("No")
        }
    }
}

Measured memory_bytes: 36364
#include <cstdio>
#include <cstdint>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>

int main() {
  char buf[1024];
  scanf("%s", buf);
  std::string s = buf;
  std::string u = s;
  std::string nyan = "AIDUNYAN";
  std::string aizu = "AIZUNYAN";
  std::sort(nyan.begin(), nyan.end());
  for (size_t i = 0; i < s.length(); ++i) {
    std::string t = s.substr(i);
    if (t.length() < nyan.length()) break;
    t = t.substr(0, nyan.length());
    std::sort(t.begin(), t.end());
    if (t == nyan) {
      for (size_t j = 0; j < aizu.length(); ++j)
        u[i+j] = aizu[j];
    }
  }

  printf("%s\n", u.c_str());
}



Measured memory_bytes: 2824
#pragma GCC optimize(3)
#include<bits/stdc++.h>
#define MAXN 100005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int n,m,tot=0;
vector<int> G[MAXN];
bool vis[MAXN];
int ord[MAXN],ans[MAXN];
P E[MAXN];
void dfs(int v)
{
    vis[v]=true;
    for(auto to:G[v]) if(!vis[to]) dfs(to);
    ord[v]=++tot;
}
int main()
{
    scanf("%d%d",&n,&m);
    m=n-1+m;
    for(int i=0;i<m;i++)
    {
        int u,v;
        scanf("%d%d",&u,&v);
        E[i]=P(u,v);
        G[u].push_back(v);
    }
    memset(ans,0,sizeof(ans));
    memset(vis,false,sizeof(vis));
    for(int i=1;i<=n;i++) if(!vis[i]) dfs(i);
    ord[0]=INF;
    for(int i=0;i<m;i++) 
    {
        int u=E[i].F,v=E[i].S;
        if(ord[u]<=ord[ans[v]]) ans[v]=u;
    }
    for(int i=1;i<=n;i++) printf("%d\n",ans[i]);
    return 0;
}



Measured memory_bytes: 9728
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
    ll i=1,j,k,n,a,c,b,r,p,cnt=0,s=1;
    cin>>n;
    while(n>1)
    {
        n=n/2;
        i=i*2;
        s+=i;
    }
    cout<<s<<endl;
    return 0;
}


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

bool dp[101][10001];

int main() {

    int n;

    cin >> n;

    int s[n];

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

    for(int i=0; i<101; i++){
        for(int j=0; j<10001; j++){
            dp[i][j] = false;
        }
    }

    dp[0][0] = true;

    for(int i=1; i<=n; i++){
        for(int j=0; j<10001; j++){
            dp[i][j] = dp[i-1][j];
            if(j-s[i-1] >= 0 && dp[i-1][j-s[i-1]]){
                dp[i][j] = true;
            }

        }
    }

    int ans = 0;

    for(int i=0; i<10001; i++){
        if(dp[n][i] && i%10 != 0){
            ans = i;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 1280
#include <iostream>
#include <cstdio>
#include <cstring>
const int N=2e5+5;
int n,q;
char ch[N];

inline int nxi(){
	int x=0;
	char c;
	while((c=getchar())>'9'||c<'0');
	while(x=x*10-48+c,(c=getchar())>='0'&&c<='9');
	return x;
}

template <class T,size_t S> class _Que{
	protected:
		T q[S];
		int hd,tl;
	public:
		_Que(){
			hd=tl=0;
		}
		inline int front(){
			return q[hd];
		}
		inline void pop_front(){
			if(++hd==S) hd=0;
		}
		inline void pop_back(){
			if(--tl==-1) tl=S-1;
		}
		inline void push_front(T x){
			if(--hd==-1) hd=S-1;
			q[hd]=x;
		}
		inline void push_back(T x){
			q[tl++]=x;
			if(tl==S) tl=0;
		}
};
_Que <bool,N> que;

inline bool step(const bool rev){
	if(que.front()^rev){
		que.pop_front();
		que.push_front(0^rev);
		return 0;
	}
	else{
		que.pop_front();
		que.push_back(rev);
		return 1;
	}
}

int main(){
	//1:'A', 2:'B'
	n=nxi(),q=nxi();
	scanf("%s",ch+1);
	for(int i=1; i<=n; ++i){
		que.push_back(ch[i]=='A');
	}
	int rev=0;
	for(int i=1; i<=std::min(q,n<<1); ++i){
		rev^=step(rev);
	}
	if(q>(n<<1)&&q&1) rev^=step(rev);
	for(int i=1; i<=n; ++i){
		putchar(que.front()^rev?'A':'B');
		que.pop_front();
	}
	puts("");
	return 0;
}

Measured memory_bytes: 768
import java.util.Scanner;

public class Main{
    public static void main (String [] args){
       Scanner sc = new Scanner(System.in);
       String p ="+";
       String m ="-";
       String t ="*";
       String d ="/";
       String q ="?";
       while(true){
       int a =sc.nextInt();
       String str = sc.next();
       int b =sc.nextInt();
        if(str.equals(q)){
        break;
        }   
        if(str.equals(p)){
           int ans =a+b;
           System.out.println(ans);
        }
        if(str.equals(m)){
           int ans =a-b;
           System.out.println(ans);
        }
        if(str.equals(t)){
            int ans =a*b;
            System.out.println(ans);
        }
        if(str.equals(d)){
            int ans =a/b;
            System.out.println(ans);
        }
       }
       sc.close();
    }
}



Measured memory_bytes: 26288
#include <iostream>
using namespace std;
int main() {
    int a, b;
    cin >> a >> b;
    int r = 0;
    for(auto i = 0; i != 2; ++i) {
        if(a >= b)
            r += a--;
        else
            r += b--;
    }
    cout << r << endl;
    return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <utility>
#include <cstring>
#include <iomanip>
#include <numeric>
#include <cmath>
#include <queue>
#include <map>
using namespace std;
typedef long long ll;
const int INF = 1<<30; 
const int MOD = 1e9 + 7;
const int dy[] = {1, 0, -1, 0};
const int dx[] = {0, 1, 0, -1};
int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int n;
    cin >> n;
    if(n == 25) cout << "Christmas" << endl;
    else if(n == 24) cout << "Christmas Eve" << endl;
    else if(n == 23) cout << "Christmas Eve Eve" << endl;
    else cout << "Christmas Eve Eve Eve" << endl;
    return 0;
}



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

int main() {
    int N, K;
    cin >> N >> K;
    
    int heights[N];
    for (int i = 0; i < N; ++i)
	cin >> heights[i];

    int dp[N];
    memset(dp, 0, sizeof(dp));
    // f(n) = min(f(n-1) + abs(heights[n] - heights[n-1]),
    //            f(n-2) + abs(heights[n] - heights[n-2]), ...
    //            f(n-k) + abs(heights[n] - heights[n-k]))
    for (int i = 1; i < N; ++i) {
	int lowest = INT_MAX;
	for (int j = 1; j <= K and i-j >= 0; ++j)
	    lowest = min(lowest, dp[i-j] + abs(heights[i] - heights[i-j]));
	dp[i] = lowest;
	//cout << i << " " << dp[i] << endl;
    }
    cout << dp[N-1] << endl;
}


Measured memory_bytes: 1024
#include <iostream>
#include <iomanip>
#include <vector>
#include <set>
#include <string>
#include <queue>
#include <algorithm>
#include <map>
#include <cmath>
#include <numeric>
#include <list>
#include <stack>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <tuple>
#include <deque>
#include <complex>
#include <bitset>
#include <atcoder/all>

using namespace std;
using namespace atcoder;

typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vpii;

typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef pair<long long, long long> pll;
typedef vector<pll> vpll;

typedef long double ld;
typedef vector<ld> vld;

typedef vector<bool> vb;

#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, n) for (ll i = 1; i <= (n); i++)
#define rrep(i, n) for (ll i = (n) - 1; i >= 0; i--)
#define rreps(i, n) for (ll i = (n); i >= 1; i--)
#define all(v) (v).begin(), (v).end()

template <class T> void chmin(T& a, T b) { a = min(a, b);}
template <class T> void chmax(T& a, T b) { a = max(a, b);}

constexpr int INF = 1 << 30;
constexpr ll INFL = 1LL << 60;
constexpr ll MOD = 1000000007;
constexpr ld EPS = 1e-12;
ld PI = acos(-1.0);

void solve() {
    ll n;
    cin >> n;
    using tup = tuple<ll, ll, ll>;
    bool debug = false;
    vector<tup> vtup, vtup2, vtup3;
    vll yi(n), yi2(n), yi3(n);
    rep(i, n) {
        ll x, y;
        cin >> x >> y;
        --x, --y;
        vtup.emplace_back(x, y, i);
        vtup2.emplace_back(y, x, i);
        vtup3.emplace_back(n-1-x, n-1-y, i);
        yi[y] = i;
        yi2[x] = i;
        yi3[n-1-y] = i;
    }
    sort(vtup.begin(), vtup.end());
    dsu d(n);
    set<ll> st; // set for y
    rep(i, n) st.insert(i);
    rep(i, n) {
        ll x, y, idx;
        tie(x, y, idx) = vtup[i];
        auto j = st.lower_bound(y + 1);
        st.erase(y);
        if(j == st.end()) continue;
        d.merge(idx, yi[*j]);
    }
    sort(vtup2.begin(), vtup2.end());
    st.clear();
    rep(i, n) st.insert(i);
    rep(i, n) {
        ll x, y, idx;
        tie(x, y, idx) = vtup2[i];
        auto j = st.lower_bound(y + 1);
        st.erase(y);
        if(j == st.end()) continue;
        d.merge(idx, yi2[*j]);
    }
    sort(vtup3.begin(), vtup3.end());
    st.clear();
    rep(i, n) st.insert(i);
    rep(i, n) {
        ll x, y, idx;
        tie(x, y, idx) = vtup3[i];
        auto j = st.lower_bound(y + 1);
        st.erase(y);
        if(j == st.end()) continue;
        d.merge(idx, yi3[*j]);
    }
    rep(i, n) cout << d.size(i) << endl;
    return;
}

int main() {
    std::cin.tie(nullptr);
    std::ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(15);
    solve();
}

Measured memory_bytes: 32204
#include <bits/stdc++.h>
using namespace std;
const long long int mod = 1000000007;


int main() {
	int A, B, K,cnt=0;
	cin >> A >> B >> K;
	for (size_t i = 100; i > 0; i--)
	{
		if (A % i == 0 && B % i == 0) { cnt++; }
		if (cnt == K) { cout << i; return 0; }
	}
}

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

vector<int> prime(int x) {
    vector<int> out(x);
    vector<int> out2(x);
    for (int n = 2; n <= x; n++) {
        out2.at(n-2) = n;
    }
    out.at(0) = 2;
    int j = 1;
    for (int k = 3; k*k <= x; k++) {
        bool f = true;
        for (int i = 2; i*i <= k; i++) {
            if (k%i==0) {
                f = false;
                break;
            }
        }
        if (f) {
            out.at(j) = k;
            j ++;
        }
    }
    for (int i = 0; i < j; i++) {
        int num = out.at(i);
        bool ff = true;
        for (int k = num-2; k<=x-2; k+=num){
            out2.at(k) = 0;
        }
    }
    out2.at(0) = 2;
    return out2;
}

int main() {
  int n;
  int count = 0;
  cin >> n;
  vector<int> p(n);
  p = prime(55555);
  for(int x:p){
    if (x>0) {
      if (count == n)
        break;
      if (x%5==1) {
        count ++;
        if (count<n) {
          cout << x << ' ';
        }
        else {
          cout << x << endl;
        }
      }
      
    }
	}
  return 0;
}

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

int main() {
	int x[2], y[2];
	int dx, dy;

	cin >> x[0] >> y[0] >> x[1] >> y[1];
	
	dx = x[1] - x[0];
	dy = y[1] - y[0];

	cout << x[1] - dy << " " << y[1] + dx << " ";
	cout << x[0] - dy << " " << y[0] + dx << endl;
}

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

using namespace std;

#define FOR(i, x, y) for(int i = (x); i < (y); ++i)
#define REP(i, x, y) for(int i = (x); i <= (y); ++i)
#define PB push_back
#define MP make_pair
#define PH push
#define fst first
#define snd second
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef long double ldb;
typedef pair<int, int> pii;

const int maxn = 2e5 + 5;

int n;
ll ans, ans2;
string s[maxn];
vector<ull> p[maxn];

class HashMap{
public:
	static const int MOD = 1e6 + 3;
	int tot;
	int head[MOD], nxt[maxn], dat[maxn];
	ull val[maxn];
	HashMap(){ tot = 0; memset(head, -1, sizeof(head)); }
	inline void update(ull h){
		int v = h % MOD;
		for(int i = head[v]; ~i; i = nxt[i]) if(val[i] == h){
			++dat[i];
			return;
		}
		nxt[tot] = head[v];
		dat[tot] = 1;
		val[tot] = h;
		head[v] = tot++;
		return;
	}
	inline int query(ull h){
		int v = h % MOD;
		for(int i = head[v]; ~i; i = nxt[i]) if(val[i] == h)
			return dat[i];
		return 0;
	}
}mp;

int main(){
	cin >> n;
	FOR(i, 0, n){
		cin >> s[i];
		reverse(s[i].begin(), s[i].end());
	}
	FOR(i, 0, n){
		ull h = 0;
		FOR(j, 0, s[i].size()){
			(h *= 31) += s[i][j] - 'a' + 1;
			p[i].PB(h);
		}
//		printf("i = %d h = %llu\n", i, h);
		mp.update(h);
	}
	FOR(i, 0, n){
		int msk = 0;
		for(int j = s[i].size() - 1; j >= 0; --j){
			FOR(k, 0, 26) if(msk >> k & 1){
				if(j < s[i].size() - 2)
					ans += mp.query(p[i][j] * 31 + (k + 1));
			}
			msk |= 1 << (s[i][j] - 'a');
		}
		FOR(k, 0, 26) if(msk >> k & 1){
			if(s[i].size() > 1)
				ans += mp.query(k + 1);
		}
		ans2 += mp.query(p[i][s[i].size() - 1]);
		--ans2;
	}
	printf("%lld\n", ans + ans2 / 2);
	return 0;
}


Measured memory_bytes: 34904
n,m=map(int,input().split())
a=[]
a = set(int(input()) for _ in range(m))
#for i in range(m):
#  a.append(int(input()))
b=[0 for x in range(n+1)]
b[0]=1
for i in range(1,n+1):
  if i in a:
    continue
  x=b[i-1]
  if i>1:x+=b[i-2]
  b[i]=x
print(b[n]%(10**9+7))

Measured memory_bytes: 460056
N,M = map(int,input().split())
ks = [list(map(int,input().split())) for _ in range(M)]
p = list(map(int,input().split()))

ans = 0

for i in range(2**N):
    switch = [0]*N
    
    for j in range(N):
        if (i>>j & 1):
            switch[j] = 1
    
    n_on_light = 0
    
    for x in range(M):
        n_on_switch_for_one_light = 0
        for k in range(ks[x][0]):
            n_on_switch_for_one_light += switch[ks[x][k+1]-1]
        if n_on_switch_for_one_light%2 == p[x]:
            n_on_light += 1
    
    if n_on_light == M:
        ans += 1
    
print(ans)

Measured memory_bytes: 3064
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vi;
#define REP(i, n) for (ll i = 0; i < (n); ++i)
#define OUT(x) cout << (x) << endl;
#define OUTA(a, n) \
    REP(i, n) { cout << (a[i]) << (i == n - 1 ? "\n" : " "); }
#define ALL(a) (a).begin(), (a).end()
#define SORT(a) sort(ALL(a))
#define RSORT(a) \
    SORT(a);     \
    reverse(ALL(a))

const ll INF = 1e18;
const ll MOD = 1e9 + 7;

ll T, X;

int main()
{
    cin >> T >> X;
    double ans = (double)T / X;
    OUT(ans);
}

Measured memory_bytes: 256
import math as m

n = int(input())

x = n / 1.08
x1 = round(x, 0)

n1 = m.floor(x1 * 1.08)
n2 = m.floor((x1+1) * 1.08)

# print('x',x, 'x1', x1, 'n1', n1,'n2', n2)

if x == x1:
    print(int(x))
elif n1 == n:
    print(int(x1))
elif n2 == n:
    print(int(x1+1))
elif n1 < n < n2:
    print(':(')

Measured memory_bytes: 3064
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<string>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#include<map>
using std::cin;using std::cerr;
using std::max;using std::min;
#define N 200005
#define ll long long
#define db double
#define dbg1(x) cerr<<#x<<"="<<(x)<<" "
#define dbg2(x) cerr<<#x<<"="<<(x)<<"\n"
int n,cnt;ll ans;
char s[N];
int main()
{
	scanf("%s",s+1),n=strlen(s+1);
	for(int i=1;i<=n;i++)
		if(s[i]=='W') ans+=i-cnt-1,cnt++;
	printf("%lld\n",ans);
	return 0;
}

Measured memory_bytes: 384
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#define N 200005
using namespace std;
typedef long long ll;
typedef double db;
int n,a[N];
ll ans;
int main()
{
	scanf("%d",&n);
	for(int i=1;i<=n;++i) scanf("%d",&a[i]);
	if(a[1]!=0){printf("-1\n");return 0;}
	for(int i=2;i<=n;++i)
	{
		if(a[i]<=a[i-1]) ans+=a[i];
		else if(a[i]==a[i-1]+1) ans++;
		else {printf("-1\n");return 0;}
	}
	cout<<ans<<endl;
	return 0;
}


Measured memory_bytes: 1024
import itertools as itr

def call(n):
    def devided_3(x):
        return x % 3 == 0

    def has_3(x):
        return '3' in str(x)

    data = filter(lambda x: devided_3(x) or has_3(x), range(1, n+1))
    [print(' {0}'.format(i), end='') for i in data]
    print()

if __name__ == '__main__':
    n = int(input())
    call(n)

Measured memory_bytes: 6792
#include <iostream>

using namespace std;

int main(void) {
	int num, i, a, c = 0;
	long long ans = 0;
	cin >> num;
	for (i = 0; i < num; i++) {
		scanf("%d", &a);
		if (c == 1 && a > 0) {
			a--;
			ans++;
		}
		ans += a >> 1;
		if (a & 1)
			c = 1;
		else
			c = 0;
	}
	cout << ans << "\n";
	return 0;
}

Measured memory_bytes: 256
#include <cmath>
#include <iostream>
#include <vector>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <bitset>
#include <algorithm>
#include <functional>
#include <utility>
#include <iomanip>

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

using namespace std;

typedef pair<int, int> P;

const int INF = 1e15;
const int MOD = 1e9+7;

signed main(){
    int n;
    cin >> n;
    vector<int> a(1);
    cin >> a[0];
    rep(i, n-1){
        int x;
        cin >> x;
        if(a[a.size()-1] == x){
            continue;
        }
        a.push_back(x);
    }


    int ans = 1;
    for(int i = 1; i < (int)a.size()-1; i++){
        int x = a[i-1] - a[i];
        int y = a[i] - a[i+1];

        if(x > 0 && y < 0 || x < 0 && y > 0){
            ans++;
            i++;
        }
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 1400
#include <iostream>
#include <cstdio>
#include <math.h>
#include <algorithm>
#include <queue>
#include <deque>
#include <stack>
#include <string>
#include <string.h>
#include <vector>
#include <set>
#include <map>
#include <bitset>
#include <stdlib.h>
#include <cassert>
#include <time.h>
#include <numeric>
#include <iomanip> 
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef tree<int,null_type,less<int>,rb_tree_tag, tree_order_statistics_node_update> indexed_set;
typedef vector<int> vi;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define sz(v) (int)v.size()
#define ll long long int
#define ld long double
#define pii pair<int, int>
#define pll pair<ll, ll>
#define fill(a,v) memset(a,v,sizeof(a));
#define all(v) v.begin(),v.end()
#define rep(i, a, b) for(int i = a; i < b; i++)
#define __ freopen("input.txt","r",stdin);freopen("output.txt","w",stdout);

#define trarr(a,n) rep(i,0,n) cerr<<a[i]<<" \n"[i==n-1];
#define trmat(g,n,m) rep(i,0,n)rep(j,0,m) cerr<<g[i][j]<<" \n"[i==m-1];
#define tr(...) cerr<<__FUNCTION__<<' '<<__LINE__<<" = ";trace(#__VA_ARGS__, __VA_ARGS__)
template<typename S, typename T> 
ostream& operator<<(ostream& out,pair<S,T> const& p){out<<'('<<p.ff<<", "<<p.ss<<')';return out;}
template<typename T>
ostream& operator<<(ostream& out,vector<T> const& v){
int l=v.size();for(int i=0;i<l-1;i++)out<<v[i]<<' ';if(l>0)out<<v[l-1];return out;}
template<typename T>
void trace(const char* name, T&& arg1){cout<<name<<" : "<<arg1<<endl;}
template<typename T, typename... Args>
void trace(const char* names, T&& arg1, Args&&... args){
const char* comma = strchr(names + 1, ',');cout.write(names, comma-names)<<" : "<<arg1<<" | ";trace(comma+1,args...);}

const ld PI = acos(-1);
const ld EPS = 1e-9;
const int inf = 1e9+10;
const ll INF = 1e18+10;
const int P = 1e9+7;
const int N = 2e5+10;

void solve(int _t){
	int h, w, k;
	cin >> h >> w >> k;
	int g[h][w];
	int tc = 0;
	rep(i, 0, h){
		string s;
		cin >> s;
		rep(j, 0, w)
		{
			if(s[j] == '.') g[i][j] = 0;
			else{
				g[i][j] = 1;
				tc++;
			} 
		}
	}
	int ans = 0;
	for(int c1 = 0; c1 < (1<<h); c1++){
		for(int c2 = 0; c2 < (1<<w); c2++){
			vi v1, v2;
			rep(i, 0, h){
				if((c1&(1<<i)) > 0){
					v1.pb(i);
				}
			}
			rep(j, 0, w){
				if((c2&(1<<j))>0){
					v2.pb(j);
				}
			}
			int cnt1 = 0;
			int tmp[7][7];
			rep(i, 0, h) rep(j, 0, w) tmp[i][j] = g[i][j];
			for(int i = 0; i < sz(v1); i++){
				for(int j = 0; j < w; j++){
					tmp[v1[i]][j] = 0;
				}
			}
			int cnt2 = 0;
			for(int i = 0; i < sz(v2); i++){
				for(int j = 0; j < h; j++){
					tmp[j][v2[i]] = 0;
				}
			}
			rep(i, 0, h) rep(j, 0, w) cnt1+=tmp[i][j];
				// tr(v1,v2, cnt1, cnt2);
			if(k == (cnt1)){
				ans++;
			}

		}
	}
	cout<<ans<<endl;
}
int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int t = 1;
	// cin >> t;
	rep(test, 1, t+1){
		solve(test);
	}
	return 0;
}  

Measured memory_bytes: 3648
package main

import "fmt"

func main() {
	var s string
	fmt.Scan(&s)

	if s[0] == 'a' ||
		s[0] == 'i' ||
		s[0] == 'u' ||
		s[0] == 'e' ||
		s[0] == 'o' {
		fmt.Println("vowel")
	} else {
		fmt.Println("consonant")
	}
}


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

#if DEBUG && !ONLINE_JUDGE
    #include "header.h"
#else
    #define debug(args...)
#endif

typedef vector<int> vi;
typedef pair<int,int> ii;
typedef long long lli;
typedef long double ld;

#define pb push_back
#define all(x) x.begin(),x.end()
#define SZ(x) (int)(x).size()
#define fi first
#define se second
#define lb lower_bound
#define ub upper_bound
#define rep(i,a,b) for(auto i=(a);i<b;i++)

#define INF (int)1e9
#define EPS 1e-9
#define MOD 1000000007
void preprocess(void) {
    return;
}
lli dp[1001][1001];
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.precision(20);
    //freopen("input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    preprocess();
    int n,m; 
    cin>>n>>m;
    vector<string> ar(n+1);
    rep(i,1,n+1) {
        cin>>ar[i];
    }
    memset(dp,0,sizeof dp);
    dp[1][1] = 1;
    rep(i,1,n+1) {
        rep(j,1,m+1) {
            if(ar[i][j-1] == '#') continue;
            if(i>=1) dp[i][j] += dp[i-1][j];
            dp[i][j] %= MOD;
            if(j>=1) dp[i][j] += dp[i][j-1];
            dp[i][j] %= MOD;
        }
    }
    debug(dp[2][1]);
    cout<<dp[n][m]<<endl;

}



Measured memory_bytes: 9088
/* 
	Author: ankrypt
*/
#include <bits/stdc++.h>

using namespace std;

int n;
int maxValueOfI;
long long ans;

int main()
{
	scanf("%d", &n);
	for(int i = 0; i <= sqrt(n); i++)
	{
		maxValueOfI = max(i, maxValueOfI);
	}
	ans = maxValueOfI * maxValueOfI;
	printf("%lld\n", ans);
	return 0;
}
/*
	Powered by Buggy Plugin
*/


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

int main(int argc, char const *argv[])
{
    string mum;
    cin>>mum;
    int num=700;
    
    if (mum[0]=='o') {
        num+=100;
    }
    if (mum[1]=='o') {
        num+=100;
    }
    if (mum[2]=='o') {
        num+=100;
    }
    cout<<num<<endl;
    
    
    return 0;
}


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

int n, k;
int a[155];

bool win[100055];

int main() {
	cin >> n >> k;
	
	for (int i = 0; i < n; i++) {
		cin >> a[i];
	}
	
	for (int i = 1; i <= k; i++) {
		for (int j = 0; j < n; j++) if (a[j] <= i) {
			if (!win[i - a[j]]) {
				win[i] = true;
				break;
			}
		}
	}
	
	puts(win[k] ? "First" : "Second");
}


Measured memory_bytes: 384
struct Scanner {
    private var elements = [String]()
    private var index = 0

    mutating func peek() -> String {
        while elements.count == index {
            elements = readLine()!.split(separator: " ").map(String.init)
            index = 0
        }
        return elements[index]
    }

    mutating func next() -> String {
        let value = peek()
        index += 1
        return value
    }

    mutating func nextInt() -> Int {
        return Int(next())!
    }

    mutating func nextDouble() -> Double {
        return Double(next())!
    }
}

var scanner = Scanner()
let X = abs(scanner.nextInt())
let K = scanner.nextInt()
let D = scanner.nextInt()

if Double(K) * Double(D) >= 1e18 || X <= K * D {
    let count = X / D
    if count % 2 == K % 2 {
        print(X - D * count)
    } else {
        print(D * (count + 1) - X)
    }
} else {
    print(X - K * D)
}



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

#define mod 1000000007
#define modd 998244353
#define PI 3.1415926
#define ll long long
#define ld long double
#define pb push_back
#define popb pop_back
#define beg begin()
#define en end()
#define sz(v) (int)((v).size())
#define all(v) (v).begin(),(v).end()
#define ub upper_bound
#define lb lower_bound
#define ff first
#define ss second
#define endl "\n"
#define forn(i,a,n) for(int i=a;i<int(n);++i)
#define forb(i,a,n) for(int i=int(n)-1;i>=a;--i)
#define cout(ans) cout<< ans << "\n"
#define couts(ans) cout<< ans <<" "
#define maxx *max_element
#define minn *min_element


void speed()
{
    ios_base::sync_with_stdio(false); 
    cin.tie(NULL); 
    cout.tie(NULL);
}


ll c[400005];
ll neg[400005];
void solve()
{
   ll n;cin>>n;
   int flag=0;
   vector<char>ans;
   while(n>0)
   {
        n--;
        char c='a'+(n%26);  
        ans.pb(c);
        n/=26;
        
   }
   forb(i,0,sz(ans))
   {
        cout<<ans[i];
   }
   cout<<endl;
}


int main()
{   
    speed();
    int tc=1;
//    cin>>tc;
    while(tc--)
    {
        solve();
    }
}

Measured memory_bytes: 3600