akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;using ll=long long;using vi=vector<int>;using vvi=vector<vi>;using vl=vector<ll>;using vvl=vector<vl>;using P=pair<int,int>;using PL=pair<ll,ll>;using vp=vector<P>;using vpl=vector<PL>;
template<typename T>constexpr auto inf=numeric_limits<T>::max()/2;constexpr int INF=inf<int>,MOD=1000000007;constexpr ll LINF=inf<ll>;
#define _ol3(_1,_2,_3,name,...)name
#define _rep(i,n)_repi(i,0,n)
#define _repi(i,a,b)for(int i=a,i##_l=(b);i<i##_l;++i)
#define REP(...)_ol3(__VA_ARGS__,_repi,_rep,)(__VA_ARGS__)
#define REPR(i,n)for(int i=n-1;i>=0;--i)
#define REPA(i,v)REP(i,v.size())
#define all(v)(v).begin(),(v).end()
#define bit(n)(1ll<<(n))
#define uniq(v)sort(all(v));v.erase(unique(all(v)),v.end())
#define F first
#define S second
#define endl '\n'
#define cho(n,a,b)cout<<((n)?a:b)<<endl
void YES(int n){cho(n,"YES","NO");}void Yes(int n){cho(n,"Yes","No");}void Poss(int n){cho(n,"Possible","Impossible");}
void _print(ostream&){}template<class T,class...U>void _print(ostream&s,T&&t,U&&...u){s<<t<<(sizeof...(u)?' ':'\n');_print(s,u...);}
template<class...T>void print(T&&...t){_print(cout,t...);}
#ifndef LOCAL
struct osd{template<class T>osd&operator<<(const T&t){return*this;}};osd cer_;
#define dprint(...)
#define cerr cer_
#else
template<class...T>void dprint(T&&...t){_print(cerr,t...);}
#endif
template<class T>void chmax(T&a,const T&b){if(a<b)a=b;}template<class T>void chmin(T&a,const T&b){if(a>b)a=b;}
template<class T>ostream&operator<<(ostream&o,const vector<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>istream&operator>>(istream&i,vector<T>&v){for(T&j:v)i>>j;return i;}
template<class T,class U>ostream&operator<<(ostream&o,const pair<T,U>&p){return o<<p.F<<' '<<p.S;}
template<class T,class U>istream&operator>>(istream&i,pair<T,U>&p){return i>>p.F>>p.S;}
template<class T>ostream&operator<<(ostream&o,const set<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>ostream&operator<<(ostream&o,const multiset<T>&v){for(auto&&i:v)o<<i<<' ';return o;}
template<class T>vector<T>&operator<<(vector<T>&v,const T&t){v.push_back(t);return v;}
template<class T>set<T>&operator<<(set<T>&v,const T&t){v.insert(t);return v;}
template<class T>multiset<T>&operator<<(multiset<T>&v,const T&t){v.insert(t);return v;}

int main(){
    cin.tie(0);ios::sync_with_stdio(0);cout<<fixed<<setprecision(10);
    ll n,m,d;
    cin>>n>>m>>d;

    cout<<(d?2.0:1.0)*(n-d)/(n*n)*(m-1)<<endl;
    return 0;
}


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

int main(){
        string w;
        int sCount['z' - 'a' + 1] = {};
        cin >> w;
        rep(i,w.length()){
                sCount[w[i]-'a']++;
        }
        rep(i,'z' - 'a' + 1){
                if(sCount[i] % 2 == 1) {
                        cout << "No" << endl;
                        return 0;
                }
        }

        cout << "Yes" << endl;
        return 0;
}


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

int main() {
    ll N;cin>>N;
    ll 	ans=0,t=10;
    while(t<=N){
        ans += N/t;
        t *= 5;       
    }
    if(N%2!=0)cout << 0 << endl;
    else cout << ans << endl;
}

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

int main() {
 long long N,x;
  cin>>N>>x;
  vector<long long> a(N);
  long long b=0;
  for (long long &X: a) {cin>>X;b+=X;}
  sort(a.begin(),a.end());
  long long sum=0,count=0;
  if(b<x) cout<<N-1<<endl;
  else{
  for(long long i=0;i<N;i++){
    sum+=a[i];
    if(sum<=x) count++;
    else break;
  	}
  cout<<count<<endl;
  }
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Set<Integer> set = new HashSet<Integer>();
        
        for (int i = 0; i < n; i++) {
            set.add(sc.nextInt());
        }
        
        if (set.size() == n) {
            System.out.println("YES");
        } else {
            System.out.println("NO");
        }
    }
}


Measured memory_bytes: 100732
#include<bits/stdc++.h>
using namespace std;
char a[15];
int sum;
int main(){
	cin>>a;
	for(int i=0;i<15;i++)
		if(a[i]!='o'&&a[i]!='x')
			a[i]='o';
	for(int i=0;i<15;i++)
		if(a[i]=='o')
			sum++;
	if(sum>=8)cout<<"YES";
	else cout<<"NO"; 
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] array = new int[n];
        int sum = 0;
        for (int i = 0; i < n; i++) {
            array[i] = sc.nextInt();
            sum += array[i];
        }
        
        Arrays.sort(array);
        
        if (sum % 10 != 0) {
            System.out.println(sum);
            return;
        }
        
        for (int i = 0; i < n; i++) {
            if (array[i] % 10 != 0) {
                System.out.println(sum - array[i]);
                return;
            }
            
            if (i == n - 1) {
                System.out.println(0);
                return;
            }
        }
    }
}


Measured memory_bytes: 22100
#
# abc167 c
#
import sys
from io import StringIO
import unittest


class TestClass(unittest.TestCase):
    def assertIO(self, input, output):
        stdout, stdin = sys.stdout, sys.stdin
        sys.stdout, sys.stdin = StringIO(), StringIO(input)
        resolve()
        sys.stdout.seek(0)
        out = sys.stdout.read()[:-1]
        sys.stdout, sys.stdin = stdout, stdin
        self.assertEqual(out, output)

    def test_入力例_1(self):
        input = """3 3 10
60 2 2 4
70 8 7 9
50 2 3 9"""
        output = """120"""
        self.assertIO(input, output)

    def test_入力例_2(self):
        input = """3 3 10
100 3 1 4
100 1 5 9
100 2 6 5"""
        output = """-1"""
        self.assertIO(input, output)

    def test_入力例_3(self):
        input = """8 5 22
100 3 7 5 3 1
164 4 5 2 7 8
334 7 2 7 2 9
234 4 7 2 8 2
541 5 4 3 3 6
235 4 8 6 9 7
394 3 6 1 6 2
872 8 4 3 7 2"""
        output = """1067"""
        self.assertIO(input, output)


def resolve():
    N, M, X = map(int, input().split())
    CA = [list(map(int, input().split())) for _ in range(N)]

    ans = float("inf")
    for bit in range(1 << N):
        S = [0]*(M+1)
        for i, ca in enumerate(CA):
            if (1 << i) & bit == 1 << i:
                S = list(map(sum, zip(S, ca)))
        for s in S[1:]:
            if s < X:
                break
        else:
            ans = min(ans, S[0])

    if ans == float("inf"):
        ans = -1

    print(ans)


if __name__ == "__main__":
    # unittest.main()
    resolve()


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


using namespace std;


int main(void) {
    int N;
    cin >> N;
    vector<int> A(N), B(N);
    for (int i = 0; i < N; i++) {
        cin >> A[i] >> B[i];
    }
    sort(A.begin(), A.end());
    sort(B.begin(), B.end());

    int ans = 0;
    if (N % 2 == 1) {
        int l, r;
        l = A[N / 2];
        r = B[N / 2];
        ans += r - l + 1;
    } else {
        int l, r;
        l = A[N / 2] + A[N / 2 - 1];
        r = B[N / 2] + B[N / 2 - 1];
        ans += r - l + 1;
    }
    cout << ans << endl;
}


Measured memory_bytes: 4784
#include <iostream>
#define rep(i,n) for (int i = 0; i < (n); ++i) 
#define MAX 500000
#define SENTINEL 2000000000
typedef long long ll;
using namespace std;

int L[MAX/2+5], R[MAX/2+5];
int cnt;

void merge(int A[], int left, int mid, int right)
{
    int n1 = mid - left;
    int n2 = right - mid;
    rep(i,n1) L[i] = A[left+i];
    rep(i,n2) R[i] = A[mid+i];

    L[n1] = R[n2] = SENTINEL;
    int i = 0;
    int j = 0;
    for(int k = left; k < right; ++k){
        ++cnt;
        if(L[i] <= R[j]) {
            A[k] = L[i++];
        } else {
            A[k] = R[j++];
        } 
    }
}

void mergeSort(int A[], int left, int right)
{
    if (left + 1 < right){
        int mid = (left + right) /2;

        mergeSort(A, left, mid);
        mergeSort(A, mid, right);
        merge(A, left, mid, right);
    }
}

int main()
{
    int n, A[MAX];
    cnt = 0;

    cin >> n;
    rep(i, n) cin >> A[i];

    mergeSort(A, 0, n);

    rep(i,n){
        if(i > 0) cout << " ";
        cout << A[i];
    }

    cout << endl;

    cout << cnt << endl;

    return 0;
}


Measured memory_bytes: 6912
#include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;

typedef long long int ll;
typedef struct node
{
    int x,y;
    ll h;
}model;
model a[105];

ll MAX(ll a,ll b)
{
    if(a > b) return a;
    else return b;
}

int cmp(model m,model n)
{
    return m.h<n.h;
}

int main()
{
    int n;
    int i,j,k;
    int p;
    int cx,cy;
    ll H;

    scanf("%d",&n);
    for(i = 0;i < n;i++)
    {
        scanf("%d%d%lld",&a[i].x,&a[i].y,&a[i].h);
    }
    //sort(a,a+n,cmp);
    p = 0;
    while(a[p].h == 0)
    {
        p++;
    }

    int flag;
    for(i = 0;i <= 100;i++)
    {
        for(j = 0;j <= 100;j++)
        {
            flag = -1;
            cx = i,cy = j;
            H = a[p].h+abs(cx-a[p].x)+abs(cy-a[p].y);

            for(k = 0;k < n;k++)
            {
                int temp = H-abs(cx-a[k].x)-abs(cy-a[k].y);
                if(temp < 0) temp = 0;
                if(a[k].h != temp)
                {
                    break;
                }
            }
            if(k == n)
            {
                flag = 1;
                break;
            }
        }
        if(flag == 1) break;
    }
    printf("%d %d %lld\n",cx,cy,H);

    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define dbg(x) #x "=" << x << " "
#define fore(i,a,b) for(int i=a,gon=b;i<gon;++i)
#define pb push_back
#define F first
#define S second
typedef double lf;
typedef long long ll;
typedef pair<int, int> pii;

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    #ifdef LOCAL
        freopen("in.txt", "r", stdin);
        //freopen("out.txt", "w", stdout);
    #else
        #define endl '\n'
    #endif
    int n, m;
    cin >> n >> m;
    string s;
    while (n--) {
        cin >> s;
        cout << s << endl << s << endl;
    }
}


Measured memory_bytes: 256
#include<iostream>
#include<cstdio>
#include<vector>
#include<utility>
#include<cstring>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<limits>
#include <bitset>      


#define LL long long
#define f first
#define s second
#define pb push_back
#define mp make_pair


using namespace std;

const LL max_LL = numeric_limits<LL>::max(); 

LL dp[100005];
int h[100005];
int n;

 

int main(){

    cin >> n;

    memset(dp, -1, sizeof dp);

    for(int i = 0; i < n; i++) cin >> h[i];

    LL res = max_LL;

    dp[0] = 0;
    dp[1] = abs(h[0] - h[1]);

    for(int i = 2; i < n; i++){
        dp[i] = min(dp[i-1] + abs(h[i] - h[i-1]), dp[i-2] + abs(h[i] - h[i-2]));
     }
    

    cout << dp[n-1];
    
    return 0;

}


Measured memory_bytes: 1408
<?php
fscanf(STDIN, "%d", $N);

$map = explode(" ", trim(fgets(STDIN)));

foreach($map as $value){
    @$list[$value] += 1;
}
$sum = 0;
foreach($list as $key => $value){
    $sumlist[$key] = $value * ($value-1 ) / 2;
    $sum += $value * ($value-1 ) / 2;
}

foreach($map as $value){
    if($list[$value] == 1){
        echo $sum.PHP_EOL;
    }else {
        echo $sum - ($sumlist[$value]) + (($list[$value] -1) * ($list[$value] -2) /2).PHP_EOL;
    }

}

Measured memory_bytes: 29808
import std.stdio, std.conv, std.array, std.string;
import std.algorithm;
import std.container;

void main() {
  auto N = readln.chomp.to!int;
  auto Hn = readln.split.to!(int[]);

  int prev = Hn[0];
  int count = 0;
  int max_count = 0;
  foreach(h; Hn[1..Hn.length]) {
    if (h > prev) {
      count = 0;
      prev = h;
      continue;
    }
    if (max_count < ++count) max_count = count;
    prev = h;
  }
  writeln(max_count);
}


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

const int mod = 1000000007;

int main() {
  string s;
  cin >> s;
  if(s[0]==s[1]&&s[1]==s[2]){
    cout << "No" << endl;
  }else{
    cout << "Yes" << endl;
  }
}

Measured memory_bytes: 256
#include <stdio.h>

int field[105][105];

int main(){

	int W,H,N;

	scanf("%d %d %d",&W,&H,&N);

	int i,j,k;

	for(i=0;i<N;i++){
		int x,y,a;
		scanf("%d %d %d",&x,&y,&a);
		if(a==1){
			for(j=0;j<H;j++){
				for(k=0;k<x;k++){
				field[j][k]=1;
				}
			}
		}
		else if(a==2){
			for(j=0;j<H;j++){
				for(k=x;k<W;k++){
				field[j][k]=1;
				}
			}
		}
		else if(a==3){
			for(j=0;j<y;j++){
				for(k=0;k<W;k++){
				field[j][k]=1;
				}
			}
		}
		else{
			for(j=y;j<H;j++){
				for(k=0;k<W;k++){
				field[j][k]=1;
				}
			}
		}
	}
	int ans=0;
	for(i=0;i<H;i++){
		for(j=0;j<W;j++){
			if(field[i][j]==0){ans++;}
		}
	}
	printf("%d\n",ans);

	return 0;
}

Measured memory_bytes: 256
#include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <memory>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <sstream>
#include <unordered_map>
#include <vector>


#define INF 4000000000000000000LL
#define MOD 1000000007
#define ALL(x) std::begin(x), std::end(x)


int main(int argc, char** argv)
{
  std::cin.tie(0);
  std::ios_base::sync_with_stdio(0);

  std::cout << std::fixed << std::setprecision(6);
  std::cerr << std::fixed << std::setprecision(6);

  long long N, A[5];

  std::cin >> N;

  for (int i = 0; i < 5; i ++)
    std::cin >> A[i];

  long long a = *std::min_element(A, A + 5);

  std::cout << (N + a - 1) / a + 4 << std::endl;

  return 0;
}


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

#define all(x) (x).begin(), (x).end()
#define sz(x) (int)(x).size()

typedef long long ll;
typedef array<int, 3> tri;
typedef long double ld;

template <class T> istream& operator>>(istream& I, vector<T>& v) {for (T &e: v) I >> e; return I;}
template <class T> ostream& operator<<(ostream &O, const vector<T>& v) {for (const T &e: v) O << e << ' '; return O;}





void _main() {
        int n; cin >> n;
        int grid[2][n], dp[2][n];
        for (int i = 0; i < 2; i++) {
                for (int j = 0; j < n; j++) {
                        cin >> grid[i][j];
                        dp[i][j] = grid[i][j];
                }
        }

        for (int i = 0; i < 2; i++) {
                for (int j = 0; j < n; j++) {
                        dp[i][j] += max(i ? dp[i - 1][j] : 0, j ? dp[i][j - 1] : 0);
                }
        }

        cout << dp[1][n - 1];
}




signed main() {
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//        freopen("input.txt", "r", stdin);
        int _t = 1;
//        cin >> _t;
        while (_t--) _main();
        return 0;
}


Measured memory_bytes: 3640
#include<bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define INF 1000000000
#define mod 998244353
using ll=long long;
const ll LINF=1001002003004005006ll;
int dx[]={1,0,-1,0};
int dy[]={0,1,0,-1};
ll gcd(ll a,ll b){return b?gcd(b,a%b):a;}
template<class T>bool chmax(T &a,const T &b){if(a<b){a=b;return true;}return false;}
template<class T>bool chmin(T &a,const T &b){if(b<a){a=b;return true;}return false;}

ll dp[3010][6100],ans;

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

    ll n,s;cin>>n>>s;
    vector<ll> a(n);
    rep(i,n) cin>>a[i];
    rep(i,n){
        dp[i][0]++;
        for(int j=3000;j>=0;j--){
            dp[i+1][j]+=dp[i][j];
            dp[i+1][j]%=mod;
            dp[i+1][j+a[i]]+=dp[i][j];
            dp[i+1][j+a[i]]%=mod;
        }
        ans+=dp[i+1][s]*(n-i)%mod;
        ans%=mod;
        dp[i+1][s]=0;
    }
    cout<<ans<<endl;
    return 0;
}


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

//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef vector<bool> VB;
typedef vector<PII> VP;


//REPEAT
//------------------------------------------
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define RFOR(i, m, n) for(int i = m;i > n;i--)
#define REP(i,n)  FOR(i,0,n)
#define RREP(i,m)  RFOR(i,m,0)

//container util
//------------------------------------------
#define pb(a) push_back(a)
#define fst first
#define snd second
#define SORT(V) sort((V).begin(),(V).end())
#define REV(V) reverse((V).begin(),(V).end())

//constant
//------------------------------------------
const int MOD = 1000000007;
const int INF = 1061109567;
const double EPS = 1e-10;
const double PI  = acos(-1.0);
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

//grobal variable
//------------------------------------------

//def function, class
//------------------------------------------

//main
//------------------------------------------
signed main(){
  int A, K;
  string S;
  cin >> A >> S >> K;

  char mozi=S.at(K-1);
  REP(i, S.size()){
    if(S.at(i)==mozi){
      continue;
    }else{
      S.at(i)='*';
    }
  }
  cout << S << endl;
  return 0;
}


Measured memory_bytes: 256
ll=[]
p=[]
a,b=map(int,input().split())
for i in range(a):
    l=input().rstrip().split()
    l=list(map(int,l))
    ll+=l
    #print(ll)
#print(ll)
LL=[str(a) for a in ll]
for i in range(0,a*b,b):
    print(' '.join(LL[i:i+b]),sum(ll[i:i+b]))
    
for i in range(0,a):    
    ll.insert(i+b*(i+1),sum(ll[i+b*i:i+b*(i+1)]))
#print(ll)
for j in range(b+1):
    J=[]
    for i in range(j,a*(b+1),b+1):
        J.append(ll[i])
    #print(J)
    p.append(sum(J))
    #print(p)
LL=[str(a) for a in p]
print(' '.join(LL))


Measured memory_bytes: 6208
#include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(long long i = 0; i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()

const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);

int main(void)
{
    ll n; cin>>n;
    ll ans=INF;
    for(int i=1;i<=sqrt(n);i++){
        ll a,b;
        if(n%i==0){
            a=i-1;
            b=n/i-1;
        }
        ans=min(ans,a+b);
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3676
#include <iostream>
#include <vector>
#include <string.h>
#include <set>
#include <map>
#include <unordered_map>
#include <assert.h>
#include <algorithm>
#include <queue>
#include <bitset>
#include <stack>
#include <chrono>
#include <random>
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define ll long long
#define INF 1000000000000000000
#define MOD 1000000007
#define rnd mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define FIO ios_base::sync_with_stdio(false); cin.tie(NULL);
#define uid uniform_int_distribution <int>
using namespace std;
// Read the question carefully and see all the given sample tests
// Think about the correctness before implementing

int main() {
	int n;
	cin >> n;
	vector <int> A(n + 2);
	int sum = 0;
	A[0] = 0, A[n + 1] = 0;
	for (int i = 1; i <= n; i++) {
		cin >> A[i];
		sum += abs(A[i] - A[i - 1]);
	}
	sum += abs(A[n + 1] - A[n]);
	for (int i = 1; i <= n; i++) {
		int t = abs(A[i - 1] - A[i + 1]) - (abs(A[i] - A[i + 1]) + abs(A[i] - A[i - 1]));
		cout << sum + t << "\n";
	}
}


Measured memory_bytes: 1664
N,M,C = map(int,input().split())
B = list(map(int,input().split()))
A = [list(map(int,input().split())) for i in range(N)]
ABC = [sum([ A[n][i]*B[i] for i in range(M)]) + C for n in range(N)]
res = len([i for i in ABC if i>0])
print(res)

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

#define fr first
#define sc second
#define OK puts("OK");
#define pb push_back
#define mk make_pair

using namespace std;

typedef long long ll;

const int inf = (int)1e9 + 7;
const int N = (int)1e5 + 7;

int n,a[51],u[56];
int res = 0;
int main () {
        cin >> n;

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

        n ++;

        for (int i = 0; i <= 12; i ++) {
                if (u[a[i]] > 2) {
                        cout << 0 << endl;
                        return 0;
                }
        }
        if (u[0] == 2 || n > 25) {
                cout << 0;
                return 0;
        }
        if (n >= 24) {
                cout << 1 << endl;
                return 0;
        }
        sort (a + 1,a + n + 1);

        for (int i = 0; i < (1 << n); i ++) {
                deque<int> v1,v;
                for (int j = 1; j <= n; j ++) {
                        if ((1 << (j - 1)) & i)
                                v1.push_front(24 - a[j]);
                        else
                                v.pb(a[j]);
                }
                for (int j = 0; j < v1.size(); j ++) {
                        v.pb(v1[j]);
                }
                int ans = inf;
                for (int j = 0; j < v.size(); j ++) {
                        ans = min(ans,min(abs(v[j] - v[j + 1]),abs(24 - abs(v[j] - v[j + 1]))));
                }
                ans = min(ans,min(abs(v[0] - v[v.size() - 1]),abs(24 - abs(v[0] - v[v.size() - 1]))));
                res = max(res,ans);
        }

        cout << res << endl;
}


Measured memory_bytes: 256
#include<stdio.h>
#define MAX_H 5000000

void maxHeapify(int*,int,int);
void buildMaxHeap(int*,int);
void swap(int*,int*);

int main(){
  int H,i,a[MAX_H];
  scanf("%d",&H);
  for (i = 0 ; i < H ; i++) {
    scanf("%d",&a[i]);
  }
  buildMaxHeap(a,H);
  for(i = 0 ; i < H ; i++){
    printf(" %d",a[i]);
  }
  printf("\n");
  return 0;
}

void maxHeapify(int *A,int i,int H){
  int l = i*2+1, r = i*2+2;
  int largest;
  if(l <= H && A[l] > A[i]){
    largest = l;
  }else{ largest = i; }

  if(r <= H && A[r] > A[largest]){
    largest = r;
  }
  if(largest != i){
    swap(&A[i],&A[largest]);
    maxHeapify(A,largest,H);
  }
}

void buildMaxHeap(int *A,int H){
  int i;
  for(i = H/2 ; i >= 0 ; i--){
    maxHeapify(A,i,H);
  }
}

void swap(int *a,int *b){
  int tmp;
  tmp = *a;
  *a = *b;
  *b = tmp;
}



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

using namespace std;

int main() {

	int a,b;
	cin >> a >> b;

	if (a >= 13) {
		cout << b << endl;
	}
	else if (a >= 6) {
		cout << b / 2 << endl;
	}
	else {
		cout << 0 << endl;
	}

}

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

#define var auto
#define long long long
using namespace std;

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

	int h, n;
	cin >> h >> n;

	vector<long> attacks(h + 1, LONG_MAX / 2);
	for (size_t i = 0; i < n; i++)
	{
		int a, b;
		cin >> a >> b;
		long mag = 0;
		for (size_t j = 0; j < h + 1; j += a)
		{
			attacks[j] = min(attacks[j], mag);
			mag += b;
		}
		attacks[h] = min(attacks[h], mag);
	}
	vector<long> res(h + 1, LONG_MAX / 2);
	res[0] = 0;
	for (size_t power = 0; power < h + 1; power++)
	{
		var magic = attacks[power];
		for (int j = h; j >= h + 1 - power; j--)
		{
			res[h] = min(res[h], res[j] + magic);
		}
		for (int j = h - power; j >= 0; j--)
		{
			res[j + power] = min(res[j + power], res[j] + magic);
		}
	}
	cout << res[h] << endl;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO 自動生成されたメソッド・スタブ
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int X = sc.nextInt();
		int T = sc.nextInt();

		int answer = 0;

		if(N % X == 0) {
			answer = (N / X) * T;
		}else {
			answer = (N / X + 1) * T;
		}

		System.out.println(answer);
	}

}


Measured memory_bytes: 27068
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define ld long double
#define pi pair<ll,ll>
#define pii vector<pair<ll,ll> >
#define v vector
#define vi vector<ll>
#define f(a,i,n) for(int i=a;i<n;i++)
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define MAX 1000001
#define all(x) x.begin(),x.end()
const ll inf=(ll) 1e18;
 
ll gcd(ll a, ll b) {ll r; while (b) {r = a % b; a = b; b = r;} return a;}
ll lcm(ll a, ll b) {return a / gcd(a, b) * b;}
ll fpow(ll n, ll k, int p = MOD) {ll r = 1; for (; k; k >>= 1) {if (k & 1) r = r * n % p; n = n * n % p;} return r;}
int inv(int a, int p = MOD) {return fpow(a, p - 2, p);}
ll spf[MAX+1];
  void sieve()//complexity = approx 3*10^6
    {
        f(1,i,MAX) {spf[i]=i;} 
        for(ll i=2;i<MAX;i+=2){spf[i]=2;}
        for(ll i=3;i<MAX;i+=2)
        {
            if(spf[i]==i) //if i is prime mark its multiples with spf as i
            {
                for(ll j=i*i;j<MAX;j+=i)
                {
                    spf[j]=min(i,(ll)spf[j]);
                }
            }
        }
    }
int main()
{
    ll n, k;
    cin >> n >> k;
    vi a(n);
    f(0, i, n) cin >> a[i];
    vi dp(n, INT_MAX);
    dp[0] = 0;
    f(0, i, n) {
        f(1, j, k + 1) {
            if(i - j >= 0) 
                dp[i] = min(dp[i], dp[i - j] + abs(a[i] - a[i - j]));
        }
    }
    cout << dp[n - 1] << endl;
} 

Measured memory_bytes: 4816
#include <iostream>
#include <cstdio>
#include <set>
using  namespace std;
#define ll long long 
const int maxx = 105;
int a[maxx];
set<int> s;
int main()
{
	
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		s.insert(a[i]);
	}	
	cout<<s.size()<<endl; 
	
	
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main(){
  string s; cin>>s;
  for(int i=0; i<s.size(); i++){
    if(s.at(i) == '9'){
      cout<<"Yes"<<endl;
      return 0;
    }
  }
  cout<<"No"<<endl;
}


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

typedef vector<vector<long long>> Matrix;
long long INF = 100000000000000;

Matrix WF(Matrix & ADJ, int L){
    int N = ADJ.size();
    Matrix ADJ2(N, vector<long long>(N, INF));
    for (int k = 0; k < N; k++){        
        for (int i = 0; i < N; i++){
            for (int j = 0; j < N; j++){
                long long dist = ADJ[i][k] + ADJ[k][j];
                if(ADJ[i][j] > dist){
                    ADJ[i][j] = dist;
                }
            }     
        }
    }
    
    for (int i = 0; i < N; i++){        
        for (int j = 0; j < N; j++){   
            if (ADJ[i][j] <= L){
                ADJ2[i][j] = 1;
            }            
        }
    }
    
    for (int i = 0; i < N; i++){      
        ADJ2[i][i] = 0;
    }    

    for (int k = 0; k < N; k++){        
        for (int i = 0; i < N; i++){
            for (int j = 0; j < N; j++){
                long long dist = ADJ2[i][k] + ADJ2[k][j];
                if(ADJ2[i][j] > dist){
                    ADJ2[i][j] = dist;
                }
            }     
        }
    }
    
    
    return ADJ2;
    
}

int main(){
    
    int N, M, L;
    cin >> N >> M >> L;
    
    Matrix ADJ(N, vector<long long>(N, INF));
    
    for (int i = 0; i < M; i++){
        int from, to;
        long long dist;
        cin >> from >> to >> dist;
        
        ADJ[from - 1][to - 1] = dist;       
        ADJ[to - 1][from - 1] = dist;     
        
    }
    for (int i = 0; i < N; i++){
        ADJ[i][i] = 0;
    }
    
    Matrix ADJ2 = WF(ADJ, L);
    
    /*
    for (int i = 0; i < N; i++){
        for (int j = 0; j < N; j++){
            cout << ADJ2[i][j] << " ";         
        }
        cout << endl;        
    }*/
    
    int Q;
    cin >> Q;
    vector<vector<int>> ORDER(Q, vector<int>(2,-1));
    
    for(int i = 0; i < Q; i++){
        int from, to;
        cin >> from >> to;
        ORDER[i][0] = from - 1;
        ORDER[i][1] = to - 1;
        
        
    }
    for(int i = 0; i < Q; i++){
        int from = ORDER[i][0], to = ORDER[i][1];
        if (ADJ2[from][to] >= INF) cout << -1 << endl;
        else cout << ADJ2[from][to] - 1<< endl;
        
    }
        
    
    return 0;
    
}

Measured memory_bytes: 6912
#include <bits/stdc++.h>
#define REP(i,a,b) for(int i=(a);i<(b);i++)
#define RREP(i,a,b) for(int i=(a);i>=(b);i--)
typedef long long ll; typedef long double ld;
using namespace std;
const int INF=1e9, MOD=1e9+7, around[]={0,1,1,-1,-1,0,-1,1,0,0};
const ld PI=abs(acos(-1));
int n,m;

int main(){
	cin >> n >> m;
	
	ll s=1;
	if(n==m){
		RREP(i,n,1) (s*=i)%=MOD;
		RREP(i,n,1) (s*=i)%=MOD;
		(s*=2)%=MOD;
	}else if(n==(m+1) or m==(n+1)){
		RREP(i,n,1) (s*=i)%=MOD;
		RREP(i,m,1) (s*=i)%=MOD;
	}else{
		s=0;
	}
	
	cout << s << endl;
	return 0;
}


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

int main() {
    int N;
    cin >> N;
    int X[N];
    for(int i = 0; i < N; ++i) cin >> X[i];
    
    //Σ(X-P)2 = Σ(X2- 2PX - P2)
    int sum = 0, sum2 = 0, sum2a = 0;
    int P;
    
    for(int i = 0; i < N; ++i) sum += X[i];
    P = sum / N;//floor

    for(int i = 0; i < N; ++i){
        sum2 += (X[i] - P) * (X[i] - P);
        sum2a += (X[i] - P - 1) * (X[i] - P - 1);
    }
    if(sum2a < sum2) sum2 = sum2a;

    cout << sum2 << endl;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <limits.h>
#include <string.h>
#define ll long long int

#include <stdio.h>

int N, Q;
char S[114514];
int l[114514], r[114514];



int main(void) {
	int i;
	int h[114514];
	if (scanf("%d%d", &N, &Q) != 2) return 1;
	if (scanf("%114513s", S) != 1) return 1;
	for (i = 0; i < Q; i++) {
		if (scanf("%d%d", &l[i], &r[i]) != 2) return 1;
	}
	h[0] = 0;
	for (i = 1; i < N; i++) {
		h[i] = h[i - 1] + (S[i - 1] == 'A' && S[i] == 'C');
	}
	for (i = 0; i < Q; i++) {
		printf("%d\n", h[r[i] - 1] - h[l[i] - 1]);
	}
	return 0;
}


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

#define N 200010
#define mod 1000000007

using namespace std;

int n,x,y,ans=1,tot,min1,min2,c[N],w[N],minc[N],numc[N];
int fac[N],inv[N];

void getmin()
{
	for(int i=1;i<=n;i++)
	{
		if(minc[i]<minc[min1])
		{
			min2=min1;
			min1=i;
		}
		else if(minc[i]<minc[min2])
			min2=i;
	}
}

int poww(int a,int b)
{
	int ans=1;
	while(b)
	{
		if(b&1)
			ans=(1ll*ans*a)%mod;
		a=(1ll*a*a)%mod;
		b>>=1;
	}
	return ans;
}

void preC()
{
	fac[0]=1;
    for(int i=1;i<=n;i++)
        fac[i]=1ll*i*fac[i-1]%mod;
    inv[n]=poww(fac[n],mod-2);
    for(int i=n-1;i>=0;i--)
        inv[i]=1ll*inv[i+1]*(i+1)%mod;
}

int C(int n,int m)
{
    return ((1ll*fac[m]*inv[m-n])%mod*inv[n])%mod;
}

int main()
{
	memset(minc,127,sizeof(minc));
	scanf("%d%d%d",&n,&x,&y);
	for(int i=1;i<=n;i++)
	{
		scanf("%d%d",&c[i],&w[i]);
		minc[c[i]]=min(minc[c[i]],w[i]);
	}
	getmin();
	for(int i=1;i<=n;i++)
	{
		if(w[i]+minc[c[i]]<=x)
			w[i]=minc[c[i]];
		if((c[i]==min1&&minc[min2]+w[i]<=y)||(c[i]!=min1&&minc[min1]+w[i]<=y))
		{
			numc[c[i]]++;
			tot++;
		}
	}
	preC();
	for(int i=1;i<=n;i++)
	{
		if(numc[i])
		{
			ans=(1ll*ans*C(numc[i],tot))%mod;
			tot-=numc[i];
		}
	}
	printf("%d\n",ans);
	return 0;
}

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

string s,t;
ll dp[3005][3005];
ll solve(ll idx,ll idy)
{
	if(idx<0 || idy<0)
		return 0;
	
	if(dp[idx][idy]!=-1)
		return dp[idx][idy];
	
	if(s[idx]==t[idy])
	{
		dp[idx][idy]=solve(idx-1,idy-1)+1;
	}
	else
	{
		dp[idx][idy]=max(solve(idx,idy-1),solve(idx-1,idy));
	}
	return dp[idx][idy];
}

int main()
{
	ll n,i,j,k,x,y,m;
	cin >> s;
	cin >>t;

	memset(dp,-1,sizeof(dp));

	

	solve(s.size()-1,t.size()-1);

	
	i=s.size()-1;
	j=t.size()-1;
	string final="";
	
	if(s.size()==1)
	{
		for(i=0;i<t.size();i++)
		{
			if(t[i]==s[0])
			{
				cout << s << endl;
				return 0;
			}
		}
		printf("\n");
		return 0;
	}
	if(t.size()==1)
	{
		for(i=0;i<s.size();i++)
		{
			if(s[i]==t[0])
			{
				cout << t << endl;
				return 0;
			}
		}
		printf("\n");
		return 0;
	}

   i = s.size()-1, j = t.size()-1; 
   while (i > 0 && j > 0) 
   {
	    if (s[i] == t[j]) 
	    { 
	        final+=s[i];
	        i--; j--;  
	    } 
  	
	  	else		
	    {
	     	if (dp[i-1][j] > dp[i][j-1]) 
	         i--; 
	      	else
	         j--; 
	 	}
   } 

   if(i>=0 && j>=0)
   {
   		if(i==0)
   		{
   			for(k=0;k<=j;k++)
   				if(s[i]==t[k]){
   					final+=s[i];break;}
   		}
   		else if(j==0)
   		{
			for(k=0;k<=i;k++)
   				if(t[j]==s[k]){
   					final+=t[j];break;}   			
   		}
   }


		
	reverse(final.begin(),final.end());
	cout << final << endl;

}

Measured memory_bytes: 71040
using System;

namespace ABC057_C_Digits_in_Multiplication
{
	internal class Program
	{
		public static void Main(string[] args)
		{
			long n = long.Parse(Console.ReadLine());
			long a;
			long b;

			int resultLength = n.ToString().Length;
			for (long i = 1; i <= Math.Sqrt(n); i++)
			{
				if (n % i == 0)
				{
					a = i;
					b = n / i;
					int length;
					if (a.ToString().Length <= b.ToString().Length)
						length = b.ToString().Length;
					else
						length = a.ToString().Length;

					if (resultLength > length)
						resultLength = length;
				}
			}
			
			Console.WriteLine(resultLength);
		}
	}
}

Measured memory_bytes: 11092
a,b = map(int,input().split())
s = input()
Num = [str(i) for i in range(10)]

flag = True

for i in range(a):
    if s[i] not in Num:
        flag = False
        break
if s[a] != '-':
    flag = False
for i in range(a+1,a+b):
    if s[i] not in Num:
        flag = False
        break

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

Measured memory_bytes: 3064
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 *
 * @author anand.oza
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        CSwitches solver = new CSwitches();
        solver.solve(1, in, out);
        out.close();
    }

    static class CSwitches {
        public void solve(int testNumber, InputReader in, PrintWriter out) {
            int n = in.nextInt(), m = in.nextInt();

            int[][] s = new int[m][];

            for (int i = 0; i < m; i++) {
                int k = in.nextInt();
                s[i] = new int[k];
                for (int j = 0; j < k; j++) {
                    s[i][j] = in.nextInt() - 1;
                }
            }

            int[] p = new int[m];

            for (int i = 0; i < m; i++) {
                p[i] = in.nextInt();
            }

            int answer = 0;
            for (int perm = 0; perm < (1 << n); perm++) {
                boolean valid = true;
                for (int i = 0; i < m; i++) {
                    int sum = p[i];
                    for (int j : s[i]) {
                        sum += getBit(perm, j);
                    }
                    valid &= (sum % 2 == 0);
                }
                if (valid) answer++;
            }

            out.println(answer);
        }

        static int getBit(int bits, int i) {
            return (bits >> i) & 1;
        }

    }

    static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }

        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

    }
}



Measured memory_bytes: 23380
#include <stdio.h>
int main(){

    long long i,j,k,n,m,l,a,b;
    long long A[101][101]={{0}};
    long long B[101][101]={{0}};
    long long C[101][101]={{0}};

    scanf("%lld %lld %lld",&n,&m,&l);

    for(j=0;j<n;j++){
        for(i=0;i<m;i++){
            scanf("%lld",&a);
            A[j][i]=a;
        }
    }

    for(j=0;j<m;j++){
        for(i=0;i<l;i++){
            scanf("%lld",&b);
            B[j][i]=b;
        }
    }

    for(i=0;i<n;i++){
        for(j=0;j<l;j++){
	        C[i][j]=0;
	        for(k=0;k<m;k++){
	            C[i][j]+=A[i][k]*B[k][j];
	        }
        }
    }


    for(i=0;i<n;i++){
        for(j=0;j<l;j++){
	        printf("%lld",C[i][j]);
	        if(j!=l-1){
	            printf(" ");
	        }
        }
    printf("\n");
    } 

    return 0;

}


Measured memory_bytes: 2104
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

public class prog
{
    public static void Main()
    {
        char[] c = Console.ReadLine().ToCharArray();
        int[] N = new int[c.Length];


        for(int i = 0 ; i < c.Length-1; i++){
            if(c[i] == 'R' && c[i+1] == 'L'){
                N[i]++;
                N[i+1]++;
                N[i] += Lcount(c, i+1);
                N[i] += Rcount(c, i-1);
                N[i+1] += Lcount(c, i+2);
                N[i+1] += Rcount(c, i);
            }
        }
        
        string s = string.Join(" ", N);
        Console.WriteLine(s);
        
    }
    public static int Lcount(char[] c, int index){
        if(index >= c.Length) return 0;
        int cnt=0 ,a =0;
        while(c[index] == 'L'){
            a++;
            if(a % 2 == 0) cnt++;
            index++;
            if(index == c.Length) break;
        }
        return cnt;
    }
    public static int Rcount(char[] c, int index){
        if(index < 0) return 0;
        int cnt=0 ,a =0;
        while(c[index] == 'R'){
            a++;
            if(a % 2 == 0) cnt++;
            index--;
            if(index < 0) break;
        }
        return cnt;
    }
}

Measured memory_bytes: 15328
import sys
rs = lambda: sys.stdin.readline().rstrip()
ri = lambda: int(rs())
rf = lambda: float(rs())
rs_ = lambda: [_ for _ in rs().split()]
ri_ = lambda: [int(_) for _ in rs().split()]
rf_ = lambda: [float(_) for _ in rs().split()]

N, D = ri_()
print(-(-N//(2*D+1)))

Measured memory_bytes: 38256
#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0;i < (n);i++)
using ll = long long;
const ll MOD=1000000007;
const double pi=acos(-1);





int main() 
{
  ll N; cin>>N;
  map<ll,ll> list;
  vector<ll> A(N);
  rep(i,N)
  {
    cin>>A.at(i);
    if(list.count(A.at(i))) {list.at(A.at(i))++; continue;}
    list[A.at(i)]=1;
  }
  ll ans=0;
  for(auto p:list)
  {
    ll hoge=p.second;
    ans+=hoge*(hoge-1)/2;
  }
  rep(k,N)
  {
    ll a=A.at(k);
    ll count=list.at(a);
    cout<<ans-(count-1)<<endl;
  }  
  return 0;
}


Measured memory_bytes: 12760
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int n, a[N], c[N][3];
int mem[N][3];

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

	cin >> n;

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

	for (int i = n - 1; i >= 0; i--) {
		for (int j = 0; j < 3; j++) {
			for (int k = 0; k < 3; k++) {
				if (k == j) continue;
				mem[i][j] = max(mem[i][j], mem[i + 1][k] + c[i][k]);
			}
		}
	}

	int ans = 0;
	for (int i = 0; i < 3; i++) {
		ans = max(ans, mem[0][i]);
	}

	cout << ans << '\n';

	return 0;
}


Measured memory_bytes: 2560
loop {
	n, l = gets.split.map &:to_i
	break if n == 0

	schedule = [0] * 86401
	(1..n).each {
		s, t, u = gets.split.map &:to_i
		(s..t-1).each{|i|
			schedule[i] = u
		}
	}


	events = []
	w = 0
	(0..86400).each{|i|
		if i > 0 && schedule[i] != schedule[i-1]
			events << [i, w]
			w = 0
		end
		
		w += schedule[i]		
	}

	events << [86400, 0]
	check = -> pump {
		w = l
		log = []
		2.times {
			t0 = 0
			events.each{|t, c|
				w += pump * (t - t0) - c
				return false if w < 0
				w = l if w > l
				t0 = t
			}
			log << w
		}
		return log[0] == log[1]
	}

	min = 0
	max = events.map(&:last).inject(:+)

	until (max - min).abs < 0.0000001
		c = (min + max) / 2.0
		if check[c]
			max = c
		else
			min = c
		end
	end
	printf("%.7f\n", min)
}

Measured memory_bytes: 36600
#include<bits/stdc++.h>
using namespace std;
typedef  long long  ll;
ll inf=1000000000000000000,mod=1000000007,BS,k;

int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        #ifndef ONLINE_JUDGE
            freopen("input.txt","r",stdin);
            freopen("output.txt","w",stdout);
        #endif
        ll n,m,k;cin>>n>>m>>k;
        char arr[n][m];
        for(ll i=0;i<n;i++)for(ll j=0;j<m;j++)cin>>arr[i][j];
        ll sum,ans=0;
        for(ll i=0;i<(1<<n);i++){
            for(ll j=0;j<(1<<m);j++){
                sum=0;
                for(ll kk=0;kk<n;kk++){
                    for(ll kk1=0;kk1<m;kk1++){
                        if(i&(1<<kk)||j&(1<<kk1))
                        continue;
                        if(arr[kk][kk1]=='#')
                        sum++;
                    }
                }
                if(sum==k)
                ans++;
            }
        }
        // for(ll i=0;i<(1<<n);i++){
        //     sum=0;
        //     for(ll kk=0;kk<n;kk++){
        //         for(ll kk1=0;kk1<m;kk1++){
        //             if(i&(1<<kk))
        //             continue;
        //             if(arr[kk][kk1]=='#')
        //             sum++;
        //         }
        //     }
        //     if(sum==k)
        //     ans++;
        // }
        cout<<ans;


}


Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
int main(){
  string S;
  cin >> S;
  
  int ans = S.size();
  
  for (int i = 0; i < 2; i++){
    
    
    int cnt = 0;
    for (int j = 0; j < S.size(); j++){
      if ( j % 2 == 0 && S[j] != (char)(i + '0') )cnt++;
      if ( j % 2 == 1 && S[j] == (char)(i + '0') )cnt++;
    }
    ans = min(ans, cnt);
  }
  cout << ans << endl;
}
  
      
    
    

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

using namespace std;

using int64 = long long;
const int mod = 1e9 + 7;
// const int mod = 998244353;

const int64 infll = (1LL << 62) - 1;
const int inf = (1 << 30) - 1;

struct IoSetup {
  IoSetup() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(10);
    cerr << fixed << setprecision(10);
  }
} iosetup;


template< typename T1, typename T2 >
ostream &operator<<(ostream &os, const pair< T1, T2 > &p) {
  os << p.first << " " << p.second;
  return os;
}

template< typename T1, typename T2 >
istream &operator>>(istream &is, pair< T1, T2 > &p) {
  is >> p.first >> p.second;
  return is;
}

template< typename T >
ostream &operator<<(ostream &os, const vector< T > &v) {
  for(int i = 0; i < (int) v.size(); i++) {
    os << v[i] << (i + 1 != v.size() ? " " : "");
  }
  return os;
}

template< typename T >
istream &operator>>(istream &is, vector< T > &v) {
  for(T &in : v) is >> in;
  return is;
}

template< typename T1, typename T2 >
inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }

template< typename T1, typename T2 >
inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

template< typename T = int64 >
vector< T > make_v(size_t a) {
  return vector< T >(a);
}

template< typename T, typename... Ts >
auto make_v(size_t a, Ts... ts) {
  return vector< decltype(make_v< T >(ts...)) >(a, make_v< T >(ts...));
}

template< typename T, typename V >
typename enable_if< is_class< T >::value == 0 >::type fill_v(T &t, const V &v) {
  t = v;
}

template< typename T, typename V >
typename enable_if< is_class< T >::value != 0 >::type fill_v(T &t, const V &v) {
  for(auto &e : t) fill_v(e, v);
}

template< typename F >
struct FixPoint : F {
  FixPoint(F &&f) : F(forward< F >(f)) {}

  template< typename... Args >
  decltype(auto) operator()(Args &&... args) const {
    return F::operator()(*this, forward< Args >(args)...);
  }
};

template< typename F >
inline decltype(auto) MFP(F &&f) {
  return FixPoint< F >{forward< F >(f)};
}

int main() {
  int N;
  cin >> N;
  vector< int > dp(N + 1);
  for(int i = 1; i <= N; i++) {
    for(int j = i; j <= N; j += i) dp[j]++;
  }
  int64 ret = 0;
  for(int i = 1; i <= N; i++) ret += 1LL * dp[i] * i;
  cout << ret << "\n";
}



Measured memory_bytes: 42268
#include <iostream>
using namespace std;int n;
void maxHeapify(int *A,int i){
    int l=2*i;
    int r=2*i+1;
    int largest;
    if(l<=n&&A[l]>A[i]){
        largest=l;
    }
    else {
        largest=i;
    }
    if(r<=n && A[r] > A[largest]){
        largest = r;
    }
    if (largest!=i){
        int c=A[i];
        A[i]=A[largest];
        A[largest]=c;
        maxHeapify(A, largest);
    }
}
void buildMaxHeap(int *A){
    for(int i=n/2;i>=1;i--){
        maxHeapify(A, i);
    }
}
int main(){
    cin>>n;
    int a[n+1];
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    buildMaxHeap(a);
    for(int i=1;i<=n;i++){
        cout<<" "<<a[i];
    }
    cout<<endl;
    return 0;
}


Measured memory_bytes: 4956
#include<queue>
#include<stack>
#include<math.h>
#include<cmath>
#include<bitset>
#include<stdio.h>
#include<string>
#include<map>
#include<algorithm>
#include<vector>
#include<iostream>
#include<utility>
#include<functional>
#include<deque>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
int main(){
  char s;
  cin >> s;
  if(s>='a' && s<='z'){
    cout << "a" << endl;
  }
  else{
    cout << "A" << endl;
  }
  return 0;
}

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

using namespace std;

typedef long long ll;
#define fi first
#define se second
#define pb push_back

const int N = 2000006, M = 1000000007;
ll fact[N], infact[N];

ll power(int x, int y) {
    if (y == 0) {
        return 1;
    }
    ll temp = power(x, y >> 1);
    temp *= temp;
    temp %= M;
    if (y & 1) {
        temp *= x;
        temp %= M;
    }
    return temp;
}

void init() {
    fact[0] = infact[0] = 1;
    for (int i = 1; i < N; i++) {
        fact[i] = (fact[i-1] * i) % M;
        infact[i] = power(fact[i], M - 2);
    }
}

ll C(int n, int r) {
    if (r > n) return 0;
    ll ret = fact[n];
    ret *= infact[n-r];
    ret %= M;
    ret *= infact[r];
    ret %= M;
    return ret;
}

ll calc(int x, int y) {
    ll ret = 0;
    for (int i = 1; i <= y; i++) {
        ret += C(i + x + 1, i + 1);
    }
    ret -= y;
    ret += M;
    ret %= M;
    return ret;
}

int main() {
    //ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    init();
    int x1, y1, x2, y2;
    scanf("%d %d %d %d", &x1, &y1, &x2, &y2);
    ll res = calc(x2, y2);
    res -= calc(x1 - 1, y2);
    res += M;
    res %= M;
    res -= calc(x2, y1 - 1);
    res += M;
    res %= M;
    res += calc(x1 - 1, y1 - 1);
    res %= M;
    printf("%lld", res);
    return 0;
}


Measured memory_bytes: 35036
#include<bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define se second
#define int long long
#define pb push_back
#define mod 1000000007
#define pll pair<long long,long long>
using namespace std;
long long power(long long a,long long b){
    long long ans=1;
    while(b>0){
        if(b&1){ans=(ans*a)%mod;}
                a=(a*a)%mod;
                b>>=1;
        }
    return ans;
        
}
bool prime(int n){
    for(int i=2;i*i<=n;i++){
        if(n%i==0)return false;
    }
    return true;
}
int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    string s;
    cin>>s;
    int x=0;
    int n=s.size();
    for(int i=0;i<n;i++){
        x+=(s[i]-'0');
    }
    if(x%9==0)cout<<"Yes";
    else cout<<"No";
    return 0;
}

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

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

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

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

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

Measured memory_bytes: 256