akhauriyash/Code-Regression huggingface dataset:
import java.util.Map;
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 c = sc.nextInt();
		int ans = a + b + c - Math.max(Math.max(a, b), c);
		System.out.println(ans);
	}
}


Measured memory_bytes: 23124
#include <iostream>
#include <cstdio>
using namespace std;
const int N = 200010;
int a[N];
int n, s;

int main()
{
	int n;
	long long res = 0;
	scanf("%d", &n);
	for(int i = 1; i <= n; i++)
		scanf("%d",&a[i]);
	int j = 0;
	long long tmp = 0, sum = 0;
	for(int i = 1; i <= n; i++)
	{
		while(j + 1 <= n && (tmp ^ a[j + 1]) == sum + a[j + 1])
		//找到最右边满足条件的右端点 
		{
			sum += a[j + 1];
			tmp ^= a[j + 1];
			j++;
		}
		if(tmp == sum)
			res += j - i + 1;
		sum -= a[i];
		tmp ^= a[i];
	}
	printf("%lld\n",res);
	return 0;
}

Measured memory_bytes: 1024
#include <iostream>
#include <cmath>
using namespace std;
int isPrime(int n){
    if (n==2||n==3) return 1;
    if (n%6!=1&&n%6!=5) return 0;
    float n_sqrt = floor(sqrt((float)n));
    for(int i=5;i<=n_sqrt;i+=6){
        if(n%i==0||n%(i+2)==0)
            return 0;
    }
    return 1;
}
int main(){
    int N;
    cin>>N;
    int temp;
    int count = 0;
    for (int i = 0;i<N;i++){
        cin>>temp;
        if(isPrime(temp))
            count+=1;
    }
    cout<<count<<endl;
}


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

int main() {
     int N, D;
     cin >> N >> D;
     int answer = 0;
     vector<vector<double>> vec(N, vector<double>(D, 0));
     for (int i = 0; i < N; i++) {
          for (int j = 0; j < D; j++) {
               double x;
               cin >> x;
               vec.at(i).at(j) = x;
          }
     }
     for (int i = 0; i < N-1; i++) {
          for (int k = 1; k < N-i; k++) {
               double range_2 = 0;
               for (int j = 0; j < D; j++) {
                    range_2 += pow( vec.at(i).at(j) - vec.at(i+k).at(j), 2.0 );
               }
               if (ceil( sqrt(range_2) ) == floor( sqrt(range_2) )){
                    answer++;
               }
          }
     }
     cout << answer << endl;
}

Measured memory_bytes: 256
long long G(long long x,long long y){return y?G(y,x%y):x;}
long long L(long long x,long long y){return x>y?(x/G(x,y)*y):(y/G(y,x)*x);}
n[3],a[3],m[3];main(i,x){
	for(;scanf("%d%d%d%d%d%d",a,m,a+1,m+1,a+2,m+2),*m;){
		for(i=3;i--;)for(x=n[i]=1;(x=a[i]*x%m[i])>1;n[i]++);
		printf("%lld\n",L(n[0],L(n[1],n[2])));
	}
}

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

#define MAXN 100010
#define ll long long
#define mod 1000000007

using namespace std;

int n, m, k, sum;
int ans, tot;

int a[MAXN];

string s;

bool cmp(int x, int y) {
	return x > y;
}

int main(){
	int t;
	scanf("%d%d", &n, &m);
	for (int i = 1; i <= n; i++) {
		scanf("%d", &a[i]);
		sum += a[i];
	}
	
	sort(a + 1, a + n + 1, cmp);
	
	if (a[m] * 4 * m < sum) cout << "No" << endl;
	else cout << "Yes" << endl;
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include<limits.h>
#include<iomanip>
#define rep(i, n) for(int i = 0; i < n; i++)
#define REP(i, m, n) for(int i = m; i < n; i++)
#define ALL(v) v.begin(),v.end()
#define RALL(v) v.rbegin(),v.rend()
#define check(v) rep(i,v.size()) cout << v[i] << " ";\
cout << endl
#define INF 1e8
typedef long long ll;
using namespace std;
//オーバーフローに気をつけろよおおおおおお
//確認忘れるなよおおおおおお

int sum(int n){
    int ans = 0;
    while(n){
        ans += n%10;
        n/=10;
    }
    return ans;
}
int main() {
    int n; cin >> n;
    int ans = INF;
    REP(i,1,n){
        int a = n-i;
        ans = min(ans,sum(i)+sum(a));
    }
    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
#define pb push_back
#define mp make_pair
#define ms memset
#define FOR(i, a, b) for(int i = a; i <= b; i++)

int main()
{
    int n; cin >> n;
    ll ans = 0;
    FOR(i,1,floor(sqrt(n))){
        ll divi = n/i; ll val = divi + i + 1; val *= (divi - i);
        val += i; val *= i;
        ans += val;
    }
    cout << ans << '\n';
    return 0;
}

Measured memory_bytes: 3620
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<algorithm>
#include<vector>
#include<queue>
using namespace std;
int main(void){
	long long a[50];
	int c, d;
	int k;
	long long n, m;
	int s, t;
	long long x, y, z;

	scanf("%lld", &n);
	x = n / 50;
	y = n % 50;
	for (int i = 0; i < 50; i++)a[i] = x + 49;
	for (int i = 0; i < y; i++)a[i] = a[i] + 51 - y;
	for (int i = y; i < 50; i++)a[i] = a[i] - y;

	printf("50\n");
	for (int i = 0; i < 49; i++)printf("%lld ", a[i]);
	printf("%lld\n", a[49]);

	return 0;
}


Measured memory_bytes: 128
#include <iostream>
#include <algorithm>

using namespace std;

#define N 410

int main() {
  int32_t n;
  cin >> n;

  auto a = new int64_t[N][N];
  for (int32_t j = 1; j <= n; ++j) {
    cin >> a[1][j];
  }
  for (int32_t i = 2; i <= n; ++i) {
    a[i][1] = a[i-1][1] + a[1][i];
    for (int32_t j = 2; j <= n - i + 1; ++j) {
      a[i][j] = a[i][j-1] + a[1][i+j-1] - a[1][j-1];
    }
  }

  auto dp = new int64_t[N][N];
  for (int32_t j = 1; j <= n; ++j) {
    dp[1][j] = 0;
  }

  for (int32_t i = 2; i <= n; ++i) {
    for (int32_t j = 1; j <= n - i + 1; ++ j) {
      dp[i][j] = dp[1][j] + dp[i-1][j+1];
      for (int32_t k = 2; k < i; ++k) {
        dp[i][j] = min(dp[i][j], dp[k][j] + dp[i-k][j+k]);
      }
      dp[i][j] += a[i][j];
    }
  }

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


Measured memory_bytes: 2816
#include<stdio.h>

int main()
{
	int a, b, c;

	scanf("%d %d %d", &a, &b, &c);

	if( a < b && b < c)
	{
		printf("Yes\n");
	}
	else
	{
		printf("No\n");
	}
	return 0;
}


Measured memory_bytes: 2036
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 1 << 100
def LI(): return list(map(int, sys.stdin.buffer.readline().split()))
def I(): return int(sys.stdin.buffer.readline())
def LS(): return sys.stdin.buffer.readline().rstrip().decode('utf-8').split()
def S(): return sys.stdin.buffer.readline().rstrip().decode('utf-8')
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 1000000007


n = I()
A = LI()


now = 0
for i in range(n):
    if A[i] == now + 1:
        now += 1

if now:
    print(n - now)
else:
    print(-1)

Measured memory_bytes: 71792
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#pragma GCC optimization ("unroll-loops")
#include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
#define ins insert
#define sz(x) (long long)x.size()
typedef long long ll;
typedef long double ld;
const int N = 1e5 + 5;
const ld pi = 3.141592653;
const ll MOD = 1e9 + 7;
const ll mod = 998244353;
const ll INF = __LONG_LONG_MAX__;

using namespace std;

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

int main()
{
        ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
        int T = 1;
        //cin>>T;
        while(T--)
        {
                ll x, k, d, ans;
                cin>>x>>k>>d;
                ll n =  abs(x), q = n/d;
                if(k<n/d) ans = n - k*d;
                else{
                        k = k-n/d;
                        n = n%d;
                        if(k%2!=0) ans = abs(n-d);
                        else ans=n;
                }
                cout<<ans;
        }
        return 0;
}

Measured memory_bytes: 3636
S = input()
ans = ''
t = ''
acgt = 'ACGT'
for s in S:
    if (s in acgt):
        t += s
    else:
        if (len(ans) < len(t)):
            ans = t
        t = ''

if (len(ans) < len(t)):
    ans = t
print(len(ans))

Measured memory_bytes: 3060
#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b;
  cin>>a>>b;
  if(a <= 5) 
    	cout<<0<<endl;
  else if(a >= 6 && a <= 12)
    cout<< b / 2<<endl;
  else
    cout<<b<<endl;
  return 0;
}

Measured memory_bytes: 256
import sys
 
n, k = map(int, input().split())
a = [int(x) for x in input().split()]
mod = pow(10, 9)+7
zero = 0
plus = []
minus = []
for i in range(n):
  if a[i] == 0:
    zero += 1
  elif a[i] > 0:
    plus.append(a[i])
  else:
    minus.append(a[i])
 
P, M = len(plus), len(minus)
plus.sort(reverse=True)
minus.sort()
ans = 1
if n == k:
  for i in range(n):
    ans *= a[i]
    ans %= mod
elif P+M < k:
  ans = 0
elif P == 0:
  if zero and k%2 == 1:
    ans = 0
  else:
    if k%2:
      minus.reverse()
    for i in range(k):
      ans *= minus[i]
      ans %= mod
else:
  q = 0
  if k%2:
    ans *= plus[0]
    ans %= mod
    q = 1
  judge = []
  for i in range((len(plus)-q)//2):
    judge.append(plus[2*i+q]*plus[2*i+q+1])
  for i in range(len(minus)//2):
    judge.append(minus[2*i]*minus[2*i+1])
  judge.sort(reverse=True)
  for i in range(k//2):
    ans *= (judge[i]%mod)
    ans %= mod

print(ans)

Measured memory_bytes: 31876
fun main(arr: Array<String>) {
    val n = readLine()!!.toInt()
    val r = readLine()!!.split(" ").map { it.toInt() }
    val cnt = mutableMapOf<Int, Int>()
    for(num in r) {
        for(j in (num-1..num+1)) {
            val tmp = (cnt[j]?:0)+1
            cnt[j] = tmp
        }
    }
    println(cnt.values.max())
}

Measured memory_bytes: 59048
#include <iostream>
#include <iomanip>
#include <string>
#include <stack>
#include <vector>
#include <math.h>
#include <stdio.h>
#include <algorithm>
#include <utility>
#include <functional>
#include <iterator>
#include <map>
#include <set>
#include <queue>
#include <list>
#include <regex>
using namespace std;
using pii  = pair<int,int>;
using ll=long long;
using ld=long double;
#define pb push_back
#define mp make_pair
#define sc second
#define fr first
#define stpr setprecision
#define cYES cout<<"YES"<<endl
#define cNO cout<<"NO"<<endl
#define cYes cout<<"Yes"<<endl
#define cNo cout<<"No"<<endl
#define rep(i,n) for(ll i=0;i<(n);++i)
#define Rep(i,a,b) for(ll i=(a);i<(b);++i)
#define rrep(i,n) for(int i=n-1;i>=0;i--)
#define rRep(i,a,b) for(int i=a;i>=b;i--)
#define crep(i) for(char i='a';i<='z';++i)
#define psortsecond(A,N) sort(A,A+N,[](const pii &a, const pii &b){return a.second<b.second;});
#define ALL(x) (x).begin(),(x).end()
#define debug(v) cout<<#v<<":";for(auto x:v){cout<<x<<' ';}cout<<endl;
#define endl '\n'
int ctoi(const char c){
  if('0' <= c && c <= '9') return (c-'0');
  return -1;
}
ll gcd(ll a,ll b){return (b == 0 ? a : gcd(b, a%b));}
ll lcm(ll a,ll b){return a*b/gcd(a,b);}
constexpr ll MOD=1000000007;
constexpr ll INF=1000000011;
constexpr ll MOD2=998244353;
constexpr ll LINF = 1001002003004005006ll;
constexpr ld EPS=10e-8;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
template<typename T> istream& operator>>(istream& is,vector<T>& v){for(auto&& x:v)is >> x;return is;}
template<typename T,typename U> istream& operator>>(istream& is, pair<T,U>& p){ is >> p.first; is >> p.second; return is;}
template<typename T,typename U> ostream& operator>>(ostream& os, const pair<T,U>& p){ os << p.first << ' ' << p.second; return os;}
template<class T> ostream& operator<<(ostream& os, vector<T>& v){
  for(auto i=begin(v); i != end(v); ++i){
    if(i !=begin(v)) os << ' ';
    os << *i;
  }
  return os;
}

map<ll,ll> m;

int main(){
  ll N,M,A[10][1007],X,Y,Z;
  cin >> N >> M;
  rep(j,N){
    cin >> X >> Y >> Z;
    rep(i,8){
      ll X1,Y1,Z1;
      if(i%2==0){
        X1=X;
      }
      else{
        X1=-X;
      }
      if(i%4>=2){
        Y1=Y;
      }
      else{
        Y1=-Y;
      }
      if(i>=4){
        Z1=Z;
      }
      else{
        Z1=-Z;
      }
      A[i][j]=X1+Y1+Z1;
    }
  }
  rep(i,8){
    sort(A[i],A[i]+N);
  }
  ll ma=-LINF;
  rep(i,8){
    ll sum=0;
    rRep(j,N-1,N-M){
      sum+=A[i][j];
    }
    ma=max(ma,sum);
  }
  cout << ma << endl;
}

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

int main () {
  int n;
  cin >> n;
  int a,b,c,d,e,f,g,h,i,s;
  a = n/100000000;
  b = n/10000000-10*a;
  c = n/1000000-100*a-10*b;
  d = n/100000-1000*a-100*b-10*c;
  e = n/10000-10000*a-1000*b-100*c-10*d;
  f = n/1000-100000*a-10000*b-1000*c-100*d-10*e;
  g = n/100-1000000*a-100000*b-10000*c-1000*d-100*e-10*f;
  h = n/10-10000000*a-1000000*b-100000*c-10000*d-1000*e-100*f-10*g;
  i = n-100000000*a-10000000*b-1000000*c-100000*d-10000*e-1000*f-100*g-10*h;
  
  s = a+b+c+d+e+f+g+h+i;
  
  if (n/s == (n+s-1)/s) {
    cout << "Yes" << endl;
  }
  else {
    cout << "No" << endl;
  }
  
}
  

Measured memory_bytes: 3584
x,y=map(int, input().split())

ans=0
if x==3:
    ans+=100000

elif x==2:
    ans+=200000

elif x==1:
    ans+=300000

if y==3:
    ans+=100000

elif y==2:
    ans+=200000

elif y==1:
    ans+=300000

if x==1 and y==1:
    ans+=400000

print(ans)

Measured memory_bytes: 9192
//g++ -std=gnu++14 a.cpp

#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <iostream>
#include <istream>
#include <iterator>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <tuple>
#include <iomanip>
#include <random>
#include <math.h>
//#include <ostream>


using namespace std;

#define ll long long
#define rep(i, n) for(ll i = 0; i < (n); i++)
ll MOD = 1e9 + 7;
int INF = 1 << 30;
ll INFL = 1LL << 60;

int main(){
  ll X;
  cin >> X;
  vector<ll> num(210,0);
  for(int i = 1;i <= 200;i++){
    num[i] = pow(i,5);
  }
  int ans1,ans2;
  rep(i,210){
    bool hantei = false;
    rep(j,210){
      if(X == num[i]+num[j]){
        ans1 = num[i];
        ans2 = num[j];
        cout << i << " " << (-1)*j << endl;
         hantei = true;
        break;
      }
      if(X == -num[i]+num[j]){
        ans1 = num[i];
        ans2 = num[j];
        cout << (-1)*i << " " << (-1)*j << endl;
        hantei = true;
        break;
      }
      if(X == num[i]-num[j]){
        ans1 = num[i];
        ans2 = num[j];
        cout << (-1)*i << " " << j << endl;
        hantei = true;
        break;
      }
      if(X == -num[i]-num[j]){
        ans1 = num[i];
        ans2 = num[j];
        cout << (-1)*i << " " << j << endl;
        hantei = true;
        break;
      }
    }
    if(hantei)break;
  }
  return 0;

 }


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

namespace MyProgram
{
    public class Program
    {	
        public static void Main(string[] args)
        {
            int[] n = Console.ReadLine().Split(' ').Select(s => int.Parse(s)).ToArray();
            int N = n[0];
            int A = n[1];
            int B = n[2];
            
            int ans = 0;
            
            string ss = "";
            char c;
            int x;
            int y;
            for(int i = 1 ; i <= N ; i++)
            {
                ss = i.ToString();
                y = 0;
                for(int j = 0 ; j < ss.Length ; j++)
                {
                    c = ss[j];
                    x = (int)(c-'0');
                    y += x;
                    
                }
                if(A <= y && y <= B)
                {
                    ans += i;
                }
            }
            
            Console.WriteLine(ans);
        }
    }
}

Measured memory_bytes: 13396
#include<bits/stdc++.h>
using namespace std;
const int N=1000010;
int n, m, a[N];
int main(){
	scanf("%d%d", &n, &m);
	for(int i=1; i<=2*n; ++i)scanf("%d",&a[i]);
	sort(a+1,a+n*2+1);
	int l=0, r=n;
	while(l<r){
		int mid=(l+r)>>1;
		bool flag=1;
		for(int i=1; i<=n-mid; ++i)if(a[mid*2+i]+a[2*n-i+1]<m)flag=0;
		if(!flag)l=mid+1; else r=mid;
	}
	int ans=0;
	
	for(int i=1; i<=l; ++i)ans=max(ans,(a[i]+a[l*2-i+1])%m);
	for(int i=1; i<=n-l; ++i)ans=max(ans,(a[l*2+i]+a[2*n-i+1])%m);
	printf("%d",ans);
	return 0;
}

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

#define rep(X,N) for(ll X = 0; X < (N); X++)
#define PI (acos(-1.0))
#define pback push_back
#define mpair make_pair
#define MODN 1000000007
#define ALL(V) (V).begin(),(V).end()
#define INT_MAX_HALF (INT_MAX / 2)
#define EPS (1e-10)

using namespace std;
typedef long long ll;

map<string, int> m;


int main(){

    long double l;
    cin >> l;

    cout << setprecision(20) << pow(l / 3, 3.0) << endl;

    return 0;
}


Measured memory_bytes: 640
#define _USE_MATH_DEFINES
#include <stdio.h>
#include <iostream>
#include <string>
#include <vector>
#include <utility>
#include <algorithm>
#include <queue>
#include <list>
#include <stack>
#include <math.h>
#include <map>
#include <unordered_map>
#include <set>
using namespace std;

#define ll long long
#define ull unsigned long long

#define	max	1000000007

ll gcd(ll a, ll b) {
	if (a < b)
		swap(a, b);
	while (ll r = a % b)
		a = b, b = r;
	return b;
}

class mod
{
public:
	ll val;

	mod(ll v)
	{
		val = v % max;
	}

	mod()
	{
		val = 0;
	}

	void operator -=(const mod &v)
	{
		val -= v.val;

		if (val < 0)
			val += max;
	}

	void operator +=(const mod &v)
	{
		if (val + v.val >= max)
			val -= max;
		val += v.val;
	}

	void operator +=(ll &v)
	{
		if (val + v >= max)
			val -= max;
		val += v;
	}

	void operator *=(const mod &v)
	{
		val *= v.val;
		val %= max;
	}

	void operator *=(ll &v)
	{
		val *= v;
		val %= max;
	}

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

	void operator /=(const mod &v)
	{
		val *= modinv(v.val);
		val %= max;
	}

	void operator /=(ll &v)
	{
		val *= modinv(v);
		val %= max;
	}
};

//	for priority queue
//	priority_queue<ipair, vector<ipair>, greater<ipair>>
using ipair = pair<int, pair<int, int>>;
bool operator>(const ipair a, const ipair b) { return a.first > b.first; };
bool operator<(const ipair a, const ipair b) { return a.first < b.first; };

int main()
{
	int n;
	cin >> n;
	ll a = 1;
	bool end = false;
	for (int i = 0; i < n; i++)
	{
		ll b;
		cin >> b;
		if (b == 0)
		{
			printf("0");
			return 0;
		}

		ll c = a * b;
		if (c < a || c < b || c > 1000000000000000000)
			end = true;
		a = c;
	}
	if (!end)
		printf("%lld", a);
	else
		printf("-1");
	return 0;
}


Measured memory_bytes: 3252
import sys
input = sys.stdin.readline
l = set()

sh,sw,m = map(int,input().split())
H = [0]*sh
W = [0]*sw
for i in range(m):
    h,w = map(int,input().split())
    l.add((h-1,w-1))
    H[h-1] += 1
    W[w-1] += 1

maxh = max(H)
maxw = max(W)
# print(H,W)
# print(maxh,maxw)

hlist = []
wlist = []

for i in range(sh):
    if H[i] == maxh:
        hlist.append(i)
for j in range(sw):
    if W[j] == maxw:
        wlist.append(j)
# print(hlist,wlist)

if len(hlist)*len(wlist) > m:
    print(maxh+maxw)
    exit()

ans = maxh+maxw-1
for i in hlist:
    for j in wlist:
        if (i,j) not in l:
            print(ans+1)
            exit()
print(ans)

Measured memory_bytes: 164256
use proconio::marker::*;
use proconio::*;
use std::cmp::*;

pub trait MoOperator {
    type Value;
    type Query;
    type Answer;
    fn init(&mut self);
    fn insert(&mut self, v: &Self::Value);
    fn delete(&mut self, v: &Self::Value);
    fn answer(&mut self, q: Self::Query) -> Self::Answer;
}

struct State {
    cnt: Vec<u32>,
    ans: usize,
}

impl MoOperator for State {
    type Value = usize;
    type Query = ();
    type Answer = usize;
    fn init(&mut self) {
        for c in self.cnt.iter_mut() {
            *c = 0;
        }
        self.ans = 0;
    }
    fn insert(&mut self, x: &Self::Value) {
        let c = &mut self.cnt[*x];
        if *c == 0 {
            self.ans += 1;
        }
        *c += 1;
    }
    fn delete(&mut self, x: &Self::Value) {
        let c = &mut self.cnt[*x];
        if *c == 1 {
            self.ans -= 1;
        }
        *c -= 1;
    }
    fn answer(&mut self, _q: Self::Query) -> usize {
        self.ans
    }
}

#[fastout]
fn run() {
    input! {
        n: usize,
        q: usize,
        c: [Usize1; n],
        ask: [(Usize1, usize); q],
    }
    let ask: Vec<_> = ask.into_iter().map(|(l, r)| (l, r, ())).collect();
    let mut answer = vec![0; q];
    let mut state = State {
        cnt: vec![0; n],
        ans: 0,
    };
    let size = n;
    let mut query = ask;
    let array = c;
    let batch = (size as f64 / (query.len() as f64).sqrt()).ceil() as usize;
    let mut q = vec![];
    std::mem::swap(&mut q, &mut query);
    let mut query = (0..(size / batch + 1)).map(|_| vec![]).collect::<Vec<_>>();
    for (i, (l, r, op)) in q.into_iter().enumerate() {
        query[l / batch].push((r, l, i, op));
    }
    state.init();
    let mut x = 0;
    let mut y = 0;
    for (i, mut query) in query.into_iter().enumerate() {
        query.sort_unstable_by_key(|p| p.0);
        if i & 1 == 1 {
            query.reverse();
        }
        for (r, l, k, op) in query.into_iter() {
            for v in array[min(x, l)..x].iter().rev() {
                state.insert(v);
                x = l;
            }
            for v in array[min(y, r)..r].iter() {
                state.insert(v);
                y = r;
            }
            for v in array[min(x, l)..l].iter() {
                state.delete(v);
                x = l;
            }
            for v in array[min(y, r)..y].iter().rev() {
                state.delete(v);
                y = r;
            }
            answer[k] = state.answer(op);
        }
    }
    for a in answer {
        println!("{}", a);
    }
}

fn main() {
    run();
}


Measured memory_bytes: 41636
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;


int main()
{
	int n;
	cin >> n;
	int answer = 0;
	int top = 0;
	int bottom = 0;
	int dbl = 0;

	for (int i = 0; i < n; i++) {
		string s;
		cin >> s;
		for (int j = 0; j < s.length() - 1; j++) {
			if (s.substr(j, 2) == "AB") answer++;
		}
		if (s.substr(0, 1) == "B") {
			if (s.substr(s.length() - 1, 1) == "A") dbl++;
			else top++;
		}
		else if (s.substr(s.length() - 1, 1) == "A") bottom++;
	}
	
	if (dbl > 0) {
		answer += dbl - 1;
		dbl = 1;
		if (top > 0) {
			answer++;
			top--;
		}
		if (bottom > 0) {
			answer++;
			bottom--;
		}
	}

	answer += min(top, bottom);

	cout << answer << endl;

    return 0;
}


Measured memory_bytes: 384
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		
		try (Scanner sc = new Scanner(System.in);) {
			
			String s = sc.next();
			String p = sc.next();
			
			String search = s;
			
			for(int i = 0; i < s.length(); i++) {
				
				search = s.substring(i) + s.substring(0, i);
				
				if(search.contains(p)) {
					System.out.println("Yes");
					return;
				}
			}
			
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 26252
#include <bits/stdc++.h>
#define FOR(i, n) for(ll i = 0; i < n; i++)
#define FORR(i, n) for(ll i = n; i >= 0; i--)
#define FORS(i, m, n) for(int i = m;i < n;i++)
#define ALL(v) accumulate(v.begin(),v.end(),0)
#define SORT(v) sort(v.begin(),v.end())
#define OUT(n) (cout << n << endl)
#define IN1(a) (cin >> a)
#define IN2(a,b) (cin >> a >> b)
#define IN3(a,b,c) (cin >> a >> b >> c)
#define IN4(a,b,c,d) (cin >> a >> b >> c >> d)
#define REVS(v) reverse(v.begin(),v.end())
#define PI 3.14159265359
using namespace std;
typedef long long ll;
int gcd(int a,int b){return b?gcd(b,a%b):a;}

int main(){
  int a,b;
  IN2(a,b);
  int ans;
  ans = a*b;
  OUT(ans);
}

Measured memory_bytes: 3628
import java.util.*;
import java.io.*;
import java.math.*;
 
public class Main {
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        String str = "";
        for(int i = 0; i < n; i++){
            str += String.valueOf(i+1);
        }
        String a = "";
        for(int i = 0; i < n; i++){
            a += sc.next();
        }
        String b = "";
        for(int i = 0; i < n; i++){
            b += sc.next();
        }
        int ansa = -1;
        int ansb = -1;
        int ind = 1;
        while(ansa < 0 || ansb < 0){
            if(str.equals(a)){
                ansa = ind;
            }
            if(str.equals(b)){
                ansb = ind;
            }
            str = nextPermutation(str);
            ind++;
        }
        System.out.println(Math.abs(ansa-ansb));
    }
    
    static String nextPermutation (String s) {

        ArrayList<Character> list = new ArrayList<>();
        for (int i=0; i<s.length(); i++) list.add(s.charAt(i));

        int pivotPos = -1;
        char pivot = 0;
        for (int i=list.size()-2; i>=0; i--) {
            if (list.get(i) < list.get(i+1)) {
                pivotPos = i;
                pivot = list.get(i);
                break;
            }
        }

        if (pivotPos==-1 && pivot==0) return "Final";

        int L = pivotPos+1, R = list.size()-1;
        int minPos = -1;
        char min = Character.MAX_VALUE;
        for (int i=R; i>=L; i--) {
            if (pivot < list.get(i)) {
                if (list.get(i) < min) {
                    min = list.get(i);
                    minPos = i;
                }
            }
        }

        Collections.swap(list, pivotPos, minPos);
        Collections.sort(list.subList(L, R+1));

        StringBuilder sb = new StringBuilder();
        for (int i=0; i<list.size(); i++) sb.append(list.get(i));

        return sb.toString();

    }
}

Measured memory_bytes: 45056
#include <algorithm>
#include <iostream>

using namespace std;

int main() {
	int n; cin >> n;
	int a_ = 0;
	long long ans = 0;
	while (n--) {
		int a; cin >> a;
		if (a_ > a)
			ans += a_ - a;
		else
			a_ = a;
	}
	cout << ans << '\n';
	return 0;
}


Measured memory_bytes: 3636
#include <bits/stdc++.h>
#include <unordered_map>
#include <unordered_set>
#define initdp(a, b)  for (int i = 0; i <= a; i++)   for (int j = 0; j <= b; j++) dp[i][j] = -1;
#define pb push_back
#define mpr make_pair
#define pii pair<int, int>
#define ll long long
#define pll pair<ll, ll>
#define all(arr) arr.begin(), arr.end()
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repd(i, n) for (int i = n - 1; i >= 0; i--)
#define fo(i, l, r) for (int i = l; i <= r; i++)
#define INF 1000000001
#define inf1 1000000000000000001
#define mod 1000000007
#define pie 3.14159265358979323846264338327950L
#define N 1000005
#define mid(l, r) l + (r - l) / 2
#define vec vector<int>
#define vecl vector<ll>
#define umap unordered_map<ll,ll>
#define yes cout << "Yes" << endl;
#define no cout << "No" << endl;
#define endl "\n"
using namespace std;




void solve(){
  
  int n,m;
  cin>>n>>m;

  vec arr(n+1);
  fo(i,1,n) {
    cin>>arr[i];
  }


  unordered_map<int,vec> mp;
  fo(i,1,m) {
    int a,b;
    cin>>a>>b;

    mp[a].pb(b);
    mp[b].pb(a);
  }

  int ans = 0;
  int vis[n+1];
  memset(vis,0,sizeof(vis));

  for(int i=1; i<=n; i++) {
      
      bool check = true;

      for(auto it : mp[i]) {
        if(arr[it] >= arr[i]) {
          check = false;
          break;
        }
      }

      if(check) ans++;

  }

  cout<<ans<<endl;


 
}
 
 
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cout<<fixed<<setprecision(20);
    int t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
}

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

int main() {
  long int k,a,b,x;
  cin>>k>>a>>b;
  x=1;

  while(k>0){
    if(x>=a && b-a>=2 && k>=2){
      k-=2;
      x+=b-a;
    }
    else{
      k-=1;
      x+=1;
    }
  }
  cout<<x<<endl;
} 

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
int m,d;
int main(){
	cin>>m>>d;
	if(d<10){
		puts("0");
		return 0;
	}
	int ans=0;
	for(int i=1;i<=m;i++)for(int j=10;j<=d;j++){
		int d10=j/10,d1=j%10;
		if(d10>=2&&d1>=2&&d1*d10==i){
			ans++;
		}
	}
	cout<<ans<<endl;
	return 0;
}

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

int main() {
	int a,b;
	cin >> a >> b;
	cout << a*b << " " << (a+b)*2 <<  endl;
}


Measured memory_bytes: 3092
n,m = map(int,input().split())
xl = list(map(int,input().split()))

xl = sorted(xl)

aidal = []
before_x = xl[0]
for idx,x in enumerate(xl):
    aida = x - before_x
    aidal.append((aida,idx))
    before_x = x
    
aidal = sorted(aidal,reverse=True)
aidal.pop()
ans = 0
before_x = xl[0]
new = sorted([i[1] for i in sorted(aidal[:n-1])])
for idx in new:
    ans += xl[idx-1] - before_x
    before_x = xl[idx]
    
ans += xl[-1] - before_x
print(ans)

Measured memory_bytes: 64680
#include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define vv(T) std::vector<std::vector<T>>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()

using namespace std;
using ll = long long;

int		main(void)
{
	ll x, k, d;
	cin >> x >> k >> d;
	ll ans = x;
	if (x > 0)
	{
		if (k <= x / d)
			ans = x - d * k;
		else
		{
			ll v = x / d;
			if ((k - v) % 2 == 1)
				ans = x - v * d - d;
			else
				ans = x - v * d;
		}
	}
	else
	{
		if (k <= abs(x / d))
		{
			ans = x + d * k;
		}
		else
		{
			ll v = abs(x / d);
			if ((k - v) % 2 == 1)
				ans = x + v * d + d;
			else
				ans = x + v * d;
		}
	}
	cout << abs(ans) << endl;
}



Measured memory_bytes: 3512
///スマホコーディング
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<int(n);++i)
typedef long long ll;
const int inf=1e9;
int main(){
  string s;cin>>s;
  if(s[0]==s[2])cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  return 0;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define Jai_Hind_Dosto ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)
#define mod 1000000007
#define carry_is_Live ll bakchodi; cin>>bakchodi; while(bakchodi--)
typedef  int ll;
#define pahli_fursat 0
#define mithai_ki_dukan 200
int main() {
    Jai_Hind_Dosto;
    //carry_is_Live
    {
          ll k;
          string s;
          cin>>k;
          cin>>s;
          ll n=s.length();
          if(k>=n){
              cout<<s<<endl;
          }
          else{
              cout<<s.substr(0,k);
              cout<<"..."<<endl;
          }
          
       
    }
	return pahli_fursat;
}


Measured memory_bytes: 3656
#include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < (ll)n; i++)
#define FOR(i, a, b) for(ll i = (a); i < (ll)b; i++)
#define ALL(obj) (obj).begin(), (obj).end()
#define INF (1ll << 60)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;
using vl = vector<ll>;
using vvl = vector<vl>;
typedef double db;
typedef string str;
typedef pair<ll, ll> p;
constexpr int MOD = 1000000007;
using ll = long long;
template <class T> inline bool chmin(T &a, T b) {
    if(a > b) {
        a = b;
        return true;
    }
    return false;
}
template <class T> inline bool chmax(T &a, T b) {
    if(a < b) {
        a = b;
        return true;
    }
    return false;
}

void print(const std::vector<int> &v) {
    std::for_each(v.begin(), v.end(), [](int x) { std::cout << x << " "; });
    std::cout << std::endl;
}

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

long long lcm(long long a, long long b) {
    long long temp = gcd(a, b);
    return temp ? (a / temp * b) : 0;
}

int main() {
    string S;
    cin >> S;
    int keta = S.length();
    //桁dpなのでは
    // dp[keta][ok]
    vector<vector<ll>> dp(keta + 1, vector<ll>(2, 0LL));
    for(int i = 0; i < keta; i++) {
        //うえのけたから埋めていきます
        int digit = S[i] - '0';
        dp[i + 1][1] = dp[i][1] + digit;
        if(i == 0) {
            dp[i + 1][0] = digit - 1;
        } else {
            dp[i + 1][0] = dp[i][0] + 9;
        }
        if(S[i] != '0') {
            chmax(dp[i + 1][0], dp[i][1] + digit - 1);
        }
        // cout << dp[i][1] << ":" << dp[i][0] << endl;
    }
    cout << max(dp[keta][1], dp[keta][0]);
    return 0;
}

Measured memory_bytes: 256
def main():
    """"ここに今までのコード"""
    import sys
    input = sys.stdin.readline
    n,m=map(int,input().split())
    A=list(map(int,input().split()))
    #A.sort()
    if n==1:
        ans=(m//(A[0]//2)+1)//2
        print(int(ans))
        exit()
    from fractions import gcd
    kou=A[0]*A[1]//gcd(A[0],A[1])
    for a in A:
        kou=a*kou//gcd(a,kou)
        if (kou//a)%2==0:
            print(0)
            exit()
    kou//=2
    #print(kou)
    ans=(m//kou+1)//2
    print(int(ans))
if __name__ == '__main__':
    main()


Measured memory_bytes: 78176
#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 1000000007
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;}

signed main(){
    cin.tie(0);
    ios::sync_with_stdio(0);
    
    int n;cin>>n;
    vector<ll> x(n);
    rep(i,n){
        cin>>x[i];
    }

    ll cnt=0,ans=1;
    rep(i,n){
        if(x[i]>=cnt*2+1){
            // ok
            cnt++;
        }else{
            // ng
            ans=ans*(cnt+1)%mod;
        }
    }

    for(ll i=1;i<=cnt;i++) ans=ans*i%mod;
    cout<<ans<<endl;
    return 0;
}


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

int main() {
  
  int N;
  cin >> N;
  
  if (N==1) {
    cout << "Hello World" << endl;
  }
  else {
    int A, B;
    cin >> A >> B;
    
    cout << A+B << endl;
  }

return 0;
}

Measured memory_bytes: 3536
#include <iostream>
using namespace std;
int main(){
    long n;
    cin >> n;
    long long val=7%n;
    bool check=false;
        
            for(long i=1;i<10000000;i++){
                if(val==0){
                    cout << i;
                    check=true;
                    break;
                }
                val=(val*10+7)%n;
            }
            if(check==false){
               cout << "-1";
            } 
    return 0;
}

Measured memory_bytes: 3620
n=int(input())
a=list(map(int,input().split()))

# s[0]>0のとき
s=0
anse=0
for i in range(n):
    s+=a[i]
    if i%2==0 and s<=0:
        anse+=1-s
        s=1
    elif i%2==1 and s>=0:
        anse+=s+1
        s=-1

# s[0]<0のとき
s=0
anso=0
for i in range(n):
    s+=a[i]
    if i%2==0 and s>=0:
        anso+=s+1
        s=-1
    elif i%2==1 and s<=0:
        anso+=1-s
        s=1

ans=min(anse,anso)

print(ans)

Measured memory_bytes: 63728
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        long x = scan.nextLong();
        long happiness = 0;
        while (x > 4){
            if(x >= 500){
                long s = x/500;
                happiness += s*1000;
                x=x%500;
            }else if(x >= 5){
                long s = x/5;
                happiness += 5*s;
                x=x%5;
            }
        }
        System.out.println(happiness);
    }
}


Measured memory_bytes: 23124
#include<bits/stdc++.h>
#define ll long long 
#define MM(arr,x) memset(arr,x,sizeof(arr))
#define INF 0x3f3f3f3f
#define Maxn 1e5+10;
using namespace std;
int a[200050],n,k;
bool check(int mid)
{
	int ans=0;
	for(int i=1;i<=n;i++)
	{
		if(a[i]>mid) ans+=a[i]/mid;
		if(ans>k) return 0;
	}
	return 1;
}
int main()
{
	ios::sync_with_stdio(0);
	cin>>n>>k;
	int l=1,r=-1;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
		r=max(a[i],r);
	}
	while(l<=r)
	{
		int mid=(l+r)>>1;
		if(check(mid))
		{
			r=mid-1;
		}
		else l=mid+1;
	}
	cout<<r+1;
	return 0;
} 

Measured memory_bytes: 4384
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<vector>
#include<queue>
#include<bitset>
#include<string>
#include<stack>
#include<set>
#include<unordered_set>
#include<map>
#include<unordered_map>
#include<cstring>
#include<complex>
#include<cmath>
#include<iomanip>
#include<numeric>
#include<algorithm>
#include<list>
#include<functional>
#include<cassert>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define INF 98765432198765432
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c))
#define MEM0(a) memset(a,0,sizeof(a));
#define MEM_1(a) memset(a,-1,sizeof(a));
#define ALL(a) a.begin(),a.end()
#define SYNC ios_base::sync_with_stdio(false);cin.tie(0)
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll> Pll;
typedef pair<double, double> Pd;
typedef vector<int> Vi;
typedef vector<ll> Vll;
typedef vector<double> Vd;
typedef vector<Pi> VPi;
typedef vector<Pll> VPll;
typedef vector<Pd> VPd;
typedef tuple<int, int, int> iii;
typedef tuple<int, int, int, int> iiii;
typedef tuple<ll, ll, ll> LLL;
typedef vector<iii> Viii;
typedef vector<LLL> VLLL;
typedef complex<double> base;
const ll MOD = 1000000007;
ll POW(ll a, ll b, ll MMM = MOD) { ll ret = 1; for (; b; b >>= 1, a = (a*a) % MMM)if (b & 1)ret = (ret*a) % MMM; return ret; }
ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
ll lcm(ll a, ll b) { if (a == 0 || b == 0)return a + b; return a*(b / gcd(a, b)); }
int dx[] = { 0,1,0,-1 }, dy[] = { 1,0,-1,0 };
int ddx[] = { 0,0,1,1,1,-1,-1,-1 }, ddy[] = { 1,-1,1,0,-1,1,0,-1 };

int n;
char s[100002];
int d[100000][4];
int go(int N,int c)
{
	if(N==n)return c==3;
	int &ret=d[N][c];
	if(ret!=-1)return ret;
	ret=0;
	if(s[N]=='?')
	{
		
		ret=(ret+(3LL*go(N+1,c))%MOD)%MOD;
		if(c<3)ret=(ret+go(N+1,c+1))%MOD;
	}
	else
	{
		ret=(ret+go(N+1,c))%MOD;
		if(c==s[N]-'A')ret=(ret+go(N+1,c+1))%MOD;
	}
	return ret;
}
int main() {
	MEM_1(d);
	scanf("%s",s);
	n=strlen(s);
	printf("%d",go(0,0));
}

Measured memory_bytes: 8192
#include <iostream>
#include <functional>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <set>
#include <queue>
#include <map>
#include <iomanip>
#include <complex>
#include <random>
#include <bitset>
#include <list>
// #include <prettyprint.hpp>
using namespace std;
#define repi(i,n) for(int i=0;i<n;++i)
#define rep(i,n) for(ll i=0;i<n;++i)
#define repinvi(i,n) for(int i=n-1;i>=0;--i)
#define sll(n) scanf("%lld", &n);
#define sii(n) scanf("%d", &n);
#define slf(n) scanf("%lf", &n);
#define pll pair<ll,ll>
#define pii pair<int,int>
#define psi pair<si,si>
typedef long long ll;
typedef double lf;
typedef short int si;


void Main(){
    ll N;
    string S;
    sll(N);
    cin >> S;
    ll ans = 0;
    ll now_right_r = N - 1;
    ll now_left_w = 0;
    for(;now_left_w<N;++now_left_w){
        if(S[now_left_w]!='W'){
            continue;
        }
        while(S[now_right_r]!='R' && now_right_r>now_left_w){
            -- now_right_r;
        }
        if(now_right_r<=now_left_w){
            break;
        }
        S[now_right_r] = 'W';
        S[now_left_w] = 'R';
        // cout << "add, now_left_w"
        ++ ans;
    }

    cout << ans <<endl;
}

int main(){
    Main();
}

Measured memory_bytes: 3480
#include<bits/stdc++.h>
#define ll long long int
#define ar array
#define pb push_back
#define input(arr,n) for(int i = 0; i<n; i++) cin>>arr[i]
const int mod = 1e9+7;
ll power(ll a,ll b){ll r=1;for(;b;b>>=1){if(b&1)r=r*a%mod;a=a*a%mod;}return r;}
using namespace std;

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	int n,m, k;
	cin>>n>>m>>k;
	char c[n][m];
	for(int i= 0; i<n; i++)
		for(int j = 0; j<m; j++) cin>>c[i][j];

	int ans = 0;
	int a = (1<<n)-1,b = (1<<m)-1;
	for(int i = 0; i<=a; i++)
		for(int j = 0; j<=b; j++)
		{
			int cnt = 0;
			for(int k = 0; k<n; k++)
				for(int l = 0; l<m;l++)
				{
					if((i&(1<<k))||(j&(1<<l))) continue;
					else if(c[k][l]=='#')cnt++;
				}
			if(cnt==k) ans++;
		}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 3608
#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
struct ban
{
    int q, x;
};
bool operator<(const ban& a, const ban& b)
{
    return a.x < b.x;
}

int n, m;
int a[N];
ban b[N];

long long p[N];

int main()
{
    ios_base::sync_with_stdio(false);
    cin >> n >> m;
    for (int i = 1; i <= n; ++i)
        cin >> a[i];
    for (int i = 1; i <= m; ++i)
        cin >> b[i].q >> b[i].x;
    sort(a + 1, a + n + 1);
    sort(b + 1, b + m + 1);

    int j = 1;
    for (int i = m; i >= 1; --i)
    {
        for (int k = 0; k < b[i].q && j <= n; ++k, ++j)
        {
            p[j] = p[j - 1] + b[i].x;
        }
    }

    long long sum = 0;
    for (int i = 1; i <= n; ++i)
        sum += a[i];

    long long ans = sum;

    long long pp = 0;
    for (int i = 1; i <= n; ++i)
    {
        pp += a[i];
        ans = max(ans, sum - pp + p[i]);
    }
    cout << ans << endl;
    return 0;
}


Measured memory_bytes: 2176
#include <bits/stdc++.h>
#include <math.h>
#include <cmath>
 
using namespace std;
using ll =long long;
bool is_int_lround(double x){
  return std::lround(x)==x;
}
int ketasuu(int x){
  int n=0;
  while(x>0){
    x /=10 ;
    n ++;
  }
  return n;
}
ll gcd11(ll x, ll y){
  long long a= max(x,y), b=min(x,y), c=a%b;
  while( c!=0){
    a =b;
    b =c;
    c = a%b;
  }
  return b;
}

int ab(int x, int y){
  if(x>=y){
    return x-y;
  }
  else if(y>x){
    return y-x;
  }
}
int main(){
  int a,b;
  cin>> a >> b;
  int ans =0;
  for(int i=0; i<30; i++){
    ans++;
    if(a+(a-1)*i < b ){
      continue;
    }
    else if(a+(a-1)*i == b){
      break;
    }
    else{
      break;
    }
  }
  if(b==1){
    ans =0;
  }
  cout<<ans<<endl;
}

Measured memory_bytes: 256
package main

import (
	"fmt"
	"io"
	"os"
)

func answer(reader io.Reader, writer io.Writer) {
	var n int
	_, _ = fmt.Fscan(reader, &n)
	v := make([]int, n)
	for i := 0; i < n; i++ {
		var a int
		_, _ = fmt.Fscan(reader, &a)
		v[i] = a
	}
	ret := 0
	for i := 0; i < n; i++ {
		var a int
		_, _ = fmt.Fscan(reader, &a)
		if v[i]-a > 0 {
			ret += v[i] - a
		}
	}
	_, _ = fmt.Fprintf(writer, "%d", ret)
}

func main() {
	answer(os.Stdin, os.Stdout)
}


Measured memory_bytes: 512
package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

var sc = bufio.NewScanner(os.Stdin)

func next() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func max(nums ...int) int {
	s := -1 << 63
	for _, num := range nums {
		if s < num {
			s = num
		}
	}
	return s
}

func main() {
	sc.Split(bufio.ScanWords)

	a, b := nextInt(), nextInt()

	sum := a+b
	dif := a-b
	c := a*b

	fmt.Println(max(sum, dif, c))
}

Measured memory_bytes: 640
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

/**
 * @author Don Li
 */
public class Main {
    void solve() {
        int N = in.nextInt(), M = in.nextInt(), C = in.nextInt();
        int[] B = new int[M];
        for (int i = 0; i < M; i++) B[i] = in.nextInt();
        int[][] A = new int[N][M];
        for (int i = 0; i < N; i++) {
            for (int j = 0; j < M; j++) {
                A[i][j] = in.nextInt();
            }
        }
        
        int ans = 0;
        for (int i = 0; i < N; i++) {
            int sum = C;
            for (int j = 0; j < M; j++) {
                sum += A[i][j] * B[j];
            }
            if (sum > 0) ans++;
        }
        out.println(ans);
    }
    
    public static void main(String[] args) {
        in = new FastScanner(new BufferedReader(new InputStreamReader(System.in)));
        out = new PrintWriter(System.out);
        new Main().solve();
        out.close();
    }
    
    static FastScanner in;
    static PrintWriter out;
    
    static class FastScanner {
        BufferedReader in;
        StringTokenizer st;
        
        public FastScanner(BufferedReader in) {
            this.in = in;
        }
        
        public String nextToken() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    st = new StringTokenizer(in.readLine());
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }
        
        public int nextInt() {
            return Integer.parseInt(nextToken());
        }
        
        public long nextLong() {
            return Long.parseLong(nextToken());
        }
        
        public double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}


Measured memory_bytes: 21460
#include <bits/stdc++.h>
using namespace std;
using int64 = long long;
#define int int64
#define rep(i, n) for(int i=0; i<n; i++)
#define FOR(i, a, b) for(int i=a; i<b; i++)
#define SORT(x) sort(x.begin(), x.end())
#define GSORT(x) sort(x.begin(), x.end(), greater<int>())
#define mk make_pair
#define fi first
#define se second
#define pb push_back
#define ALL(x) x.begin(), x.end()
#define V(T) vector<T>
typedef pair<int, int> P;
typedef pair<P, P> PP;
typedef vector<int> vi;
typedef vector<vi> vvi;
int max(int a, int b) {if(b>a) return b; else return a;}
int min(int a, int b) {if(b<a) return b; else return a;}


signed main() {
    int N, A, B;
    cin >> N >> A >> B;

    cout << min(A*N, B) << endl;
    
    return 0;
}

Measured memory_bytes: 256