akhauriyash/Code-Regression huggingface dataset:
import numpy as np
from collections import defaultdict
from collections import Counter
from collections import OrderedDict
#key = {1:2, 2:5, 3:5, 4:4, 5:5, 6:6, 7:3, 8:7, 9:6}
# A = int(input())
# B = int(input())
# C = int(input())
#S = input()
#A = map(int, input().split())  #
a = [int(i) for i in input().split()] 
a.sort()
if a[0] == a[1] and a[1] == a[2] and a[0] == a[2]:
    print("Yes")
else:
    print("No")

Measured memory_bytes: 12492
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
using namespace std;
#define ALL(x) (x).begin(),(x).end()
#define SZ(x) long long((x).size())
#define OUT(x) cout << (x) << endl
typedef long long ll;
typedef vector<ll> V;
typedef vector<vector<ll>> VV;
typedef pair<ll, ll> P;
typedef map<string, ll> M;
typedef unordered_map<ll, ll> HM;
typedef set<ll> S;
typedef multiset<ll> MS;
typedef queue<ll> Q;

int main(){
    int n; cin>>n;
    double ans=0;
    for(int i=0; i<n; i++){
        double a; cin>>a;
        ans += 1.0 / a;
    }
    OUT(1.0/ans);
}


Measured memory_bytes: 256
require 'pp'

##################

inputType = :singleLine
#  inputType = :nLines

def main(s)
  r = []
  c = 0
  while !(s =~ /^S*$/)
    ppp "s=",s
    if (s =~ /(R+)(.*)$/) then
      x = $1.size
      s = $2
      if (x > c) then
        c = x
      end
    end
  end
  r.push c.to_s
  return r
end

###################

TEST=false

def ppp(msg, val)
  if (TEST) then
    print msg
    pp val
  end
end

target = nil
if (ARGV.size == 0) then
  f = STDIN
end
if (ARGV.size > 0) then
  f = open(ARGV[0])
end
if (ARGV.size > 1) then
  target = ARGV[1].to_i
end

t = 1
ng = []
while true
  if (inputType == :singleLine) then
    a = f.gets
    if ! a then
      exit
    end
    a.chomp!
    query = a
  elsif (inputType == :nLines) then
    a = f.gets
    if ! a then
      exit
    end
    n = a.chomp.to_i
    query = n.map { | i |
      f.gets.chomp
    }    
  end
  
  aa = f.gets
  if ! aa then
    r = main(query) 
    r.each { | x | puts x }
    exit
  elsif ( aa.chomp == "---") then
    oks = []
    while true
      s = f.gets.chomp
      if (s == "---") then
        break
      end
      oks.push s
    end

    if (target == nil || t == target) then
      if target then
        TEST = true
      end

      puts "--- " + t.to_s + " ---"
      ppp("QUERY=", query)
      r = main(query)    

      if r.join('\n') == oks.join('\n') then
        puts "RESULT:"
        r.each { | x | puts x }
        puts "OK"
      else
        puts "RESULT:NG"
        r.each { | x | puts x }
        puts "NG!!!!!!!!!"
        ng.push t
      end
    end
  end
  t = t + 1
end
puts "---"
puts "NG targes = " + ng.to_s


Measured memory_bytes: 14628
#include <iostream>
using namespace std;
bool b[14][14];
int r[]={-1,0,0,1}, l[]={0,1,-1,0};

int func(int a[14][14], int x, int y){
	if(a[x][y] == 0 || a[x][y] == -1 || b[x][y])return 0;
	b[x][y] = true;
	for(int i = 0;i < 4;i++)func(a, x+r[i], y+l[i]);
	return 0;
}

int main(){
	int a[14][14];
	string s;
	
	while(cin >> s){
		if(s == "")cin >>s;
		fill((int*)a, (int*)(a+14), -1);
		fill((int*)b, (int*)(b+14), 0);
		int ans = 0;
		
		for(int i = 1;i <= 12;i++){
			if(i != 1)cin >> s;
			for(int j = 1;j <= 12;j++)a[i][j] = s[j-1]-'0';
		}
		
		for(int i = 1;i <= 12;i++){
			for(int j = 1;j <= 12;j++){
				if(!b[i][j] && a[i][j]){func(a, i, j);ans++;}
			}
		}
		cout << ans << endl;
	}
	return 0;
}

Measured memory_bytes: 3156
#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
//#define N 1000005
typedef long long ll;
const ll LLINF=1ll<<60;
// const int mx=1e5+7;
// int n;
//vector<int> a(mx),b(mx);
// vector<int> g[mx];
// int deg[mx];
// vector<int> adj[mx];
//vector<int> ans;
//---dfs--
//bool visited[mx];
//vector<ll> val(mx,0);

// void dfs(int s,int e,int c1,int c2){
// 	if(a[s]^c1!=b[s]) {ans.push_back(s), c1^=1;}
// 	for(auto u:adj[s]){
// 		if(u!=e){
// 			dfs(u,s,c2,c1);
// 		}
// 	}
// }
//---dfs---

//---primes---
// const int N = 1e7 + 10;

// bool prime[N];
 
// int spf[N];
 
// void calc(){
// 	for(int i = 2; i<1e4; i++){
// 		if(prime[i])
// 			continue;
// 		spf[i] = i;
// 		for(int j = i * i; j < N; j += i){
// 			prime[j] = 1;
// 			spf[j] = i;
// 		}
// 	}
// 	for(int i = 2; i < N; i++)
// 		if(!spf[i])
// 			spf[i] = i;
// }

// vector<pair<int,int>> getp(int x){
// 	int curr=x;
// 	vector<pair<int,int>> ans;
// 	while(curr>1){
// 		int a=spf[curr];
// 		int count=0;
// 		while(curr%a==0){ curr/=a; count++;}
// 		ans.push_back(make_pair(a,count));
// 	}
// 	return ans;
// }

// bool ispr(int n) {
// 	if(n==1) return false;
//     for (int i=2;i*i<=n;++i){
//         if(n%i==0){
//             return false;
//         }
//     }
//     return true;
// }
//---primes---

//---segment_tree---
// int upd(int t,int val,int l,int r,int y, int z){
// 	if(y<l||y>r) return tr[val];
// 	if(l==r) return tr[val]=z;
// 	int s=(l+r)/2;
// 	upd(t^1,2*val+1,l,s,y,z);
// 	upd(t^1,2*val+2,s+1,r,y,z);
// 	if(t) tr[val]=tr[2*val+1]|tr[2*val+2];
// 	else tr[val]=tr[2*val+1]^tr[2*val+2];
// 	return tr[val];
// }
//int query(){}
//---segment_tree---


int main(){
	ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);cout<<setprecision(25);
	int T=1;
	//cin>>T;
	while(T--){
		ll n;
		cin>>n;
		vector<ll> a(n);
		for(ll i=0;i<n;i++) cin>>a[i];
		ll sum=0;
		for(ll i=1;i<n;i++){
			if(a[i]<a[i-1]){
				sum+=a[i-1]-a[i];
				a[i]=a[i-1];
			}
		}
		cout<<sum<<"\n";
 	}
}

Measured memory_bytes: 4712
using System;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int max = int.Parse(Console.ReadLine());
            int[] numbers = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int[] order = new int[max];
            for(int i = 0;i < max;i++)
            {
                order[ numbers[i] -1 ] = i + 1;
            }

            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            for (int j = 0;j < order.Length;j++)
            {
                sb.Append( order[j].ToString());
                if(j < order.Length - 1)
                {
                    sb.Append(" ");
                }

            }

            Console.WriteLine(sb);
        }
    }
}


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

//#define int long long
#define ll long long
#define all(v) (v).begin(), (v).end()
#define rep(i,n) for(int i=0;i<n;++i)
#define rep1(i,n) for(int i=1;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << end
#define EPS (1e-7)
#define gearup ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
typedef pair<ll, ll> P;
typedef vector<ll> vl;
typedef vector<vector<ll> > vvl;
typedef vector<vector<vector<ll> > > vvvl;
ll MOD = 1000000007;
const long long L_INF = 1LL << 60;
const int INF = 2147483647; // 2^31-1
const double PI = acos(-1);
//cout<<fixed<<setprecision(10);

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;}
template<class T> void debug(T v){rep(i,v.size()) cout<<v[i]<<" ";cout<<endl;}
const ll dx[8] = {1, 1, 0, -1, -1, -1, 0, 1};
const ll dy[8] = {0, 1, 1, 1, 0, -1, -1, -1};

signed main()
{   
    gearup;
    int a,b,q;cin >> a >> b >> q;
    vl s(a+2,L_INF),t(b+2,L_INF);
    s[0]=-L_INF;t[0]=-L_INF;
    rep1(i,a+1) cin >> s[i];
    rep1(i,b+1) cin >> t[i];
    rep(i,q){
        ll x; cin >> x;
        ll s_idx = lower_bound(all(s),x) - s.begin();
        ll t_idx = lower_bound(all(t),x) - t.begin();
        ll res = L_INF;
        for(int j=s_idx-1;j<= s_idx;j++){
            for(int k=t_idx-1;k<= t_idx;k++){
                res = min(res,abs(x-s[j])+abs(s[j]-t[k]));
                res = min(res,abs(x-t[k])+abs(s[j]-t[k]));
            }
        }
        cout << res << endl;
    }
}


Measured memory_bytes: 2944
#include <iostream>
#define INF 1000000005;
using namespace std;

int merge(long long int*, int, int, int);
int mergeSort(long long int*, int, int);

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

  int ans;
  ans = mergeSort(a, 0, n);

  for(int i=0; i<n; i++){
    cout << a[i];
    if(i!=n-1) cout << " ";
  }
  cout << endl << ans << endl;

  return 0;
}

int merge(long long int* a, int left, int mid, int right){
  int n1=mid-left, n2=right-mid;
  long long int l[n1+1], r[n2+1];
  for(int i=0; i<n1; i++) l[i] = a[left+i];
  for(int i=0; i<n2; i++) r[i] = a[mid+i];
  l[n1]=INF; r[n2]=INF;

  int i=0, j=0;
  int count=0;
  for(int k=left; k<right; k++){
    if(l[i]<=r[j]){
      a[k] = l[i];
      i++;
    }else{
      a[k] = r[j];
      j++;
    }
    count++;
  }
  return count;
}

int mergeSort(long long int* a, int left, int right){
  int count=0;
  if(left+1<right){
    int mid = (left+right)/2;
    count += mergeSort(a, left, mid);
    count += mergeSort(a, mid, right);
    count += merge(a, left, mid, right);
  }
  return count;
}



Measured memory_bytes: 10836
#include<iostream>
#include<algorithm>
#include<climits>
#include<cmath>
#include<vector>
#include<queue>
using namespace std;

vector<long long> num;
long long Q[int(1e7)];
int l=1,r=0;
inline void prepare() {
    for(register int i=1;i<10;i++)
        Q[++r]=i;
    while(r>l) {
        long long cur=Q[l++];
        if(cur>1e11) return;
        num.push_back(cur);
        int back=cur%10;

        Q[++r]=cur*10ll+back;
        if(back!=0) Q[++r]=cur*10ll+back-1;
        if(back!=9) Q[++r]=cur*10ll+back+1;
    }
}

signed main() {
    prepare();
    int k;
    cin>>k;
    sort(num.begin(),num.end()) ;
    cout<<num[k-1]<<endl;
}

Measured memory_bytes: 22892
#include "bits/stdc++.h"
using namespace std;
#define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i))
#define rep(i,j) FOR(i,0,j)
#define each(x,y) for(auto &(x):(y))
#define mp make_pair
#define mt make_tuple
#define all(x) (x).begin(),(x).end()
#define debug(x) cout<<#x<<": "<<(x)<<endl
#define smax(x,y) (x)=max((x),(y))
#define smin(x,y) (x)=min((x),(y))
#define MEM(x,y) memset((x),(y),sizeof (x))
#define sz(x) (int)(x).size()
#define pb push_back
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<ll> vll;

template<int MOD>
class ModInt {
public:
    ModInt() :value(0) {}
    ModInt(long long val) :value((int)(val<0 ? MOD + val%MOD : val%MOD)) { }

    ModInt& operator+=(ModInt that) {
        value = value + that.value;
        if (value >= MOD)value -= MOD;
        return *this;
    }
    ModInt& operator-=(ModInt that) {
        value -= that.value;
        if (value<0)value += MOD;
        return *this;
    }
    ModInt& operator*=(ModInt that) {
        value = (int)((long long)value * that.value % MOD);
        return *this;
    }
    ModInt &operator/=(ModInt that) {
        return *this *= that.inverse();
    }
    ModInt operator+(ModInt that) const {
        return ModInt(*this) += that;
    }
    ModInt operator-(ModInt that) const {
        return ModInt(*this) -= that;
    }
    ModInt operator*(ModInt that) const {
        return ModInt(*this) *= that;
    }
    ModInt operator/(ModInt that) const {
        return ModInt(*this) /= that;
    }
    ModInt pow(long long k) const {
        if (value == 0)return 0;
        ModInt n = *this, res = 1;
        while (k) {
            if (k & 1)res *= n;
            n *= n;
            k >>= 1;
        }
        return res;
    }
    ModInt inverse() const {
        long long a = value, b = MOD, u = 1, v = 0;
        while (b) {
            long long t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        return ModInt(u);
    }
    int toi() const { return value; }

private:
    int value;
};
typedef ModInt<1000000007> mint;
ostream& operator<<(ostream& os, const mint& x) {
    os << x.toi();
    return os;
}

mint dp[1000001], sm[1000001];

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    
    int n;
    cin >> n;

    dp[1] = sm[1] = n;
    dp[2] = n + n*(n - 1ll);
    sm[2] = dp[1] + dp[2];
    for (int i = 3; i <= n; ++i) {
        dp[i] = sm[i - 3] + dp[i - 1] + n - i + 2 + (n - 1ll)*(n - 1ll);
        sm[i] = dp[i] + sm[i - 1];
    }
    
    cout << dp[n] << endl;
}


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

int main(){
    ll N;
    cin >> N;
    vector<ll> decade, other;
    rep(i, 0, N){
        ll s;
        cin >> s;
        if(s % 10 == 0) decade.push_back(s);
        else other.push_back(s); 
    }
    sort(other.begin(), other.end());
    ll ans = accumulate(decade.begin(), decade.end(), 0LL);
    if(other.size() == 0){
        ans = 0;
    }else{
        ll sum = accumulate(other.begin(), other.end(), 0LL);
        if(sum % 10 != 0) ans += sum;
        else ans += sum - other[0];
    }
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 256
// ABC154_B
#include <iostream>
#include <string>
#include <vector>
#include <iterator>
#include <tuple>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>  // std::greater<T>()
#include <utility>  // std::swap()
#include <numeric>  // accumulate(ALL(vec), 0)  0 は初期値
#include <bitset>  // static_cast<std::bitset<8>>
#include <sstream>  // std::stringstream
#include <cmath>
#include <cstring>  // std::memset
#include <climits>  // INT_MIN
#include <cctype>  // std::isdigit()
#include <iomanip>
using namespace std;

typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> pll;
#define rep(i, n) for (ll i=0; i < n; i++)  // 0 ~ n-1
#define rep1(i, n) for (ll i=1; i <= n; i++)  // 1 ~ n
#define repr(i, n) for (ll i=n-1; i >= 0; i++)  // n-1 ~ 0
#define all(vec) (vec).begin(), (vec).end()
#define sum(vec) accumulate(all(vec), 0LL)  // 0 は初期値
#define min_vec(vec) min_element(all(vec))  // iterator: * を先頭につける
#define max_vec(vec) max_element(all(vec))  // iterator: * を先頭につける
#define idx(vec, element_iter) distance((vec).begin(), element_iter)
const ll INF = 1LL<<60;  // 10^18（const int inf = 1<<29;）
const double PI = acos(-1);

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    cout << fixed << setprecision(20);
    
    // input(sunippets: inpv, inpn, inps)
    ll N, M;
    cin >> N >> M;
    
    // calculation
    cout << (N+M-1)/M << "\n";
    
    return 0;
}



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

int main() {
  string stri;
  cin >> stri;
  int k=0;
  if(stri.size()-stri.size()/2*2==1){
    cout << "No" << endl;
  } else {
  for(int j=0; j<stri.size()/2; j++){
  	if(stri.at(2*j) != 'h' || stri.at(2*j+1) != 'i') {
   		cout << "No" << endl;
    	k=1;
    	break;
  	}
  }
  if(k==0){
  	cout << "Yes" << endl;
  	}
  }
}


Measured memory_bytes: 256
//#include <cstdio>
#include <iostream>

#include <cstring>

#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
//#include <queue>
//#include <stack>
#include <cassert>

using namespace std;

#define SZ(a) int((a).size())
#define REP(i,n) for(int i=0,_n=(n);i<_n;++i)
#define FOR(i,a,b) for(int i=(a),_b=(b);i<=_b;++i)

#define DEBUG(x) cerr << #x << ": " << x << endl

typedef long long llong;
typedef vector<int> VI;
typedef vector<VI> VVI;

const int MOD = 1e9 + 7;

VI F, inv, invF;
void precompute(int N) {
   F.resize(N+1);
   F[0] = 1;
   for (int i = 1; i <= N; ++i)
      F[i] = (F[i-1] * 1LL * i) % MOD;

   inv.resize(N+1);
   invF.resize(N+1);

   inv[0]  = inv[1] = 1;
   invF[0] = invF[1] = 1;
   for (int i = 2; i <= N; ++i) {
      inv[i] = (MOD - (MOD / i) * 1LL * inv[MOD % i] % MOD) % MOD;
      invF[i] = (invF[i-1] * 1LL * inv[i]) % MOD;
   }
}

llong nCk(int n, int k) {
   if (n < 0 || k < 0 || k > n)  // invalid n or k
      return 0;
   long long res = F[n];
   res = (res * invF[k]) % MOD;
   res = (res * invF[n-k]) % MOD;
   return res;
}


int main(int argc, char* argv[]) {
   ios_base::sync_with_stdio(false); 
   cin.tie(nullptr);

   int N, K;
   cin >> N >> K;

   VI A(N);
   REP(i, N)
      cin >> A[i];

   sort(A.begin(), A.end());
   
   precompute(2*N);
   
   llong add_max = 0, sub_min = 0;
   REP(i, N) {
      add_max = (add_max + A[i] * nCk(i, K-1)) % MOD;
   // cerr << A[i] << " * " << nCk(i, K-1) << endl;

      sub_min = (sub_min + A[i] * nCk(N-i-1, K-1)) % MOD;
   }

   llong res = (add_max - sub_min) % MOD;
   if (res < 0)
      res += MOD;
   cout << res << endl;

   return 0;
}


Measured memory_bytes: 3072
package main

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

func solve() {
	n, q := getInt(), getInt()
	graph := make([][]int, n)
	for i := 0; i < n-1; i++ {
		a, b := getInt()-1, getInt()-1
		graph[a] = append(graph[a], b)
		graph[b] = append(graph[b], a)
	}

	seen := make([]bool, n)

	operations := make([]int, n)
	for i := 0; i < q; i++ {
		p, x := getInt()-1, getInt()
		operations[p] += x
	}

	ans := make([]int, n)
	var dfs func(int, int)
	dfs = func(now, sum int) {
		if seen[now] {
			return
		}
		seen[now] = true

		sum += operations[now]
		ans[now] += sum

		for _, next := range graph[now] {
			dfs(next, sum)
		}
	}
	dfs(0, 0)

	for _, a := range ans {
		fmt.Fprintln(wr, a)
	}
}

// -----------------------------------------

const (
	inf = 1 << 60
	// mod = 1000000007
)

var (
	sc = bufio.NewScanner(os.Stdin)
	wr = bufio.NewWriter(os.Stdout)
)

func main() {
	maxBufSize := int(1e8)
	sc.Buffer(make([]byte, 4096), maxBufSize)
	sc.Split(bufio.ScanWords)
	solve()
	wr.Flush()
}

func getInt() (ret int) {
	sc.Scan()
	ret, err := strconv.Atoi(sc.Text())
	if err != nil {
		panic(err)
	}
	return
}

func getIntSlice(n int) (ret []int) {
	ret = make([]int, n)
	for i := range ret {
		ret[i] = getInt()
	}
	return
}

func getString() (ret string) {
	sc.Scan()
	ret = sc.Text()
	return
}

func getRunes() (ret []rune) {
	ret = []rune(getString())
	return
}


Measured memory_bytes: 77568
#include <bits/stdc++.h>
using namespace std;
template<typename T1,typename T2> inline void chmin(T1 &a,T2 b){if(a>b) a=b;}
template<typename T1,typename T2> inline void chmax(T1 &a,T2 b){if(a<b) a=b;}
using Int = long long;
const char newl = '\n';


template<typename T,T MOD = 1000000007>
struct Mint{
  static constexpr T mod = MOD;
  T v;
  Mint():v(0){}
  Mint(signed v):v(v){}
  Mint(long long t){v=t%MOD;if(v<0) v+=MOD;}

  Mint pow(long long k){
    Mint res(1),tmp(v);
    while(k){
      if(k&1) res*=tmp;
      tmp*=tmp;
      k>>=1;
    }
    return res;
  }

  static Mint add_identity(){return Mint(0);}
  static Mint mul_identity(){return Mint(1);}

  Mint inv(){return pow(MOD-2);}

  Mint& operator+=(Mint a){v+=a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator-=(Mint a){v+=MOD-a.v;if(v>=MOD)v-=MOD;return *this;}
  Mint& operator*=(Mint a){v=1LL*v*a.v%MOD;return *this;}
  Mint& operator/=(Mint a){return (*this)*=a.inv();}

  Mint operator+(Mint a) const{return Mint(v)+=a;}
  Mint operator-(Mint a) const{return Mint(v)-=a;}
  Mint operator*(Mint a) const{return Mint(v)*=a;}
  Mint operator/(Mint a) const{return Mint(v)/=a;}

  Mint operator-() const{return v?Mint(MOD-v):Mint(v);}

  bool operator==(const Mint a)const{return v==a.v;}
  bool operator!=(const Mint a)const{return v!=a.v;}
  bool operator <(const Mint a)const{return v <a.v;}

  static Mint comb(long long n,int k){
    Mint num(1),dom(1);
    for(int i=0;i<k;i++){
      num*=Mint(n-i);
      dom*=Mint(i+1);
    }
    return num/dom;
  }
};
template<typename T,T MOD> constexpr T Mint<T, MOD>::mod;
template<typename T,T MOD>
ostream& operator<<(ostream &os,Mint<T, MOD> m){os<<m.v;return os;}


template<typename T> void drop(const T &x){cout<<x<<endl;exit(0);}

//INSERT ABOVE HERE
const int MAX = 303;
using M = Mint<int, 998244353>;

M dp[MAX][MAX][MAX]={};
M ac[MAX][MAX]={};

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

  string s;
  cin>>s;
  int k;
  cin>>k;

  chmin(k,MAX-1);

  while(!s.empty() and s.front()=='1') s.erase(s.begin());
  while(!s.empty() and s.back() =='0') s.erase(--s.end());
  if(s.empty()) drop(1);

  vector<int> vs;
  for(char c:s){
    if(c=='0') vs.emplace_back(0);
    if(c=='1') vs.back()++;
  }

  int n=vs.size();
  vector<int> sm(n+1,0);
  for(int i=0;i<n;i++)
    sm[i+1]=sm[i]+vs[i];

  for(int x=0;x<MAX;x++) dp[0][x][0]=M(1);

  for(int i=0;i<n;i++){
    for(int j=sm[i];j<MAX;j++){
      int need=sm[i+1]-j;

      for(int d=0;d<vs[i];d++){
        for(int c=0;c<MAX;c++)
          if(need<=d and j+d<MAX and c+(vs[i]-d)<MAX)
            dp[i+1][j+d][c+(vs[i]-d)]+=dp[i][j][c];
      }
    }

    for(int j=0;j<MAX;j++)
      for(int c=0;c<MAX;c++)
        ac[j][c]=M(0);

    for(int j=sm[i];j+1<MAX;j++)
      for(int c=0;c<MAX;c++)
        ac[j+1][c]=ac[j][c]+dp[i][j][c];

    for(int j=sm[i];j+1<MAX;j++)
      for(int c=0;c<MAX;c++)
        dp[i+1][j][c]+=ac[max(j-vs[i]+1,0)][c];
  }



  M ans{0};
  for(int c=0;c<=k;c++)
    ans+=dp[n][sm[n]][c];
  cout<<ans<<newl;
  return 0;
}


Measured memory_bytes: 112676
n = int(input())
found = True
ti,xi,yi = 0,0,0
for _ in range(n):
  t,x,y = map(int,input().split())
  rt = abs(x-xi)+abs(y-yi)
  if rt > (t-ti) or (t-ti-rt)&1:
    found = False
  ti,xi,yi = t,x,y
print("Yes" if found else "No")

Measured memory_bytes: 9192
import java.io.*;
import java.util.*;
class Main {
  public static void main(String[] args) throws IOException {
    int w, h, x, y, r;
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    String[] input = br.readLine().split(" ");
    List<Integer> list = new ArrayList<Integer>();
    for (String f : input) {
      list.add(Integer.parseInt(f));
    }
    w = list.get(0);
    h = list.get(1);
    x = list.get(2);
    y = list.get(3);
    r = list.get(4);
    if (x <= 0 || y <= 0) {
      System.out.println("No");
    }
    else if (0 <= (x + r) && (x + r) <= w && 0 <= (y + r) && (y + r) <= h) {
      System.out.println("Yes");
    }
    else {
      System.out.println("No");
    }
  }
}

Measured memory_bytes: 24452
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
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; }
const ll INF=1LL<<60;
const int inf=1<<30;
const int mod=1e9+7;
const int MOD=998244353;
class mint{
    public:
        long long x;
 
    constexpr mint(long long _x = 0) : x((_x%mod+mod)%mod) {}
    constexpr mint operator-() const{
        return mint(-x);
    }
    constexpr mint& operator+=(const mint& a){
        if((x += a.x) >= mod) x -= mod;
        return *this;
    }
    constexpr mint& operator-=(const mint& a){
        if((x += mod-a.x) >= mod) x -= mod;
        return *this;
    }
    constexpr mint& operator*=(const mint& a){
        (x *= a.x) %= mod;
        return *this;
    }
    constexpr mint operator+(const mint& a) const{
        mint res(*this);
        return res+=a;
    }
    constexpr mint operator-(const mint& a) const{
        mint res(*this);
        return res-=a;
    }
    constexpr mint operator*(const mint& a) const{
        mint res(*this);
        return res*=a;
    }
    constexpr mint pow(long long x) const{
        if(!x) return 1;
        mint a = pow(x>>1);
        a *= a;
        if(x&1) a *= *this;
        return a; 
    }
    constexpr mint inv() const{
        return pow(mod-2);
    }
    constexpr mint& operator/=(const mint& a){
        return (*this) *= a.inv();
    }
    constexpr mint operator/(const mint& a) const{
        mint res(*this);
        return res/=a;
    }
    friend ostream& operator<<(ostream& os, const mint& m){
        os << m.x; return os;
    }
};
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,a,b;cin >> n >> a >> b;
    vector<ll> h(n);
    for(int i=0;i<n;i++){
        cin >> h[i];
    }
    ll l=0,r=1e9+10;
    while(r-l>1){
        ll mid=(l+r)/2;
        ll c=a-b;
        ll sum=0;
        for(int i=0;i<n;i++){
            sum+=(max(0LL,h[i]-mid*b)+c-1)/c;
        }
        if(sum<=mid){
            r=mid;
        }
        else{
            l=mid;
        }
    }
    cout << r << endl;
}

Measured memory_bytes: 1024
#include<bits/stdc++.h>
using namespace std;
int main(){
  int a,b,c;
  cin>>a>>b>>c;
  int tmp=min(a,b);
 vector<int>res;

  for(int i=1;i<=tmp;i++){
    if(a%i==0&&b%i==0)res.push_back(i);
  }
  reverse(res.begin(),res.end());
  cout<<res[c-1]<<endl;
}

Measured memory_bytes: 256
#include<bits/stdc++.h>
#define int unsigned long long
using namespace std;
int f[1001000],X,Y;
long long ans,n;
char S[1001000];
map<int,int>mp;
signed main(){
	scanf("%lld%s",&n,S+1);
	X=1;
	int base=233,inv=7204522363551799129;
	for(int i=1;i<=n;i++){
		if(S[i]=='+')f[i]=f[i-1]+X;
		if(S[i]=='-')f[i]=f[i-1]-X;
		if(S[i]=='<')f[i]=f[i-1],X=X*base;
		if(S[i]=='>')f[i]=f[i-1],X=X*inv;
		mp[f[i]]++;		
	}
	X=1,Y=0;
	for(int i=1;i<=n;i++){
		ans=ans+mp[f[n]*X+Y];
		if(S[i]=='+')Y=Y+X;
		if(S[i]=='-')Y=Y-X;
		if(S[i]=='<')X=X*base;
		if(S[i]=='>')X=X*inv;
		mp[f[i]]--;
	}
	printf("%lld\n",ans);
}

Measured memory_bytes: 34816
#include <bits/stdc++.h>
#define int long long
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define F first
#define S second

using namespace std;
typedef pair<int,int> P;

int MOD=998244353;

signed main() {
  int n,m;cin>>n>>m;
  if(n==m)cout<<"Yes"<<endl;
  else cout<<"No"<<endl;
  
}

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

using namespace std;

int main() {
	int n;
	cin >> n;
	int ans = 0;
	int c = 1000;
	long long int a;
	for (int i = 0; i < n; i++) {
		cin >> a;
		int d = 0;
		while (a % 2 == 0) {
			d++;
			a /= 2;
		}
		c = min(d, c);
	}
	ans = max(ans, c);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <cstdio>
#include <algorithm>
#include <queue>
using namespace std;

typedef pair<int, int> P;

int main(){
    int m,n;
    priority_queue<P> ranq;
    while( scanf("%d,%d", &m, &n) , m ){
        ranq.push( P(n, m) );
    }
    int rank[101], s = 1000000, i = 0;
    while( !ranq.empty() ){
        P a = ranq.top();
        ranq.pop();
        if( a.first < s ){
            i++;
            s = a.first;
        }
        rank[a.second] = i;
    }
    while( scanf("%d", &n) != EOF ) printf("%d\n", rank[n]); 
    return 0;
}

Measured memory_bytes: 1032
import java.io.BufferedReader;
import java.io.InputStreamReader;

public class Main {

	public static void main(String[] args) throws Exception {
		// TODO 自動生成されたメソッド・スタブ
		BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
		String W = in.readLine();
		String[] Ws = W.split(" ");

		int a = Integer.parseInt(Ws[0]);
		int b = Integer.parseInt(Ws[1]);

		String A="";
		String B="";

		for(int i=0;i<b;i++){
			A+=a;
		}

		for(int i=0;i<a;i++){
			B+=b;
		}
		String ans;
		if(A.compareTo(B) <=0){
			ans=A;
		}else{
			ans=B;
		}

		System.out.println(ans);



	}


}


Measured memory_bytes: 22612
#include<iostream>	// 入出力
#include<stdio.h>	// printf()が使える 小数は%fで
#include<math.h>	// 数学の関数
#include<vector>	// 配列
#include<string>	// 文字列
#include<map>		// 連想配列
#include<stack>		// スタック
#include<queue>		// キュー
#include<algorithm> // ソートとか

using namespace std;

using ll = long long;




int main()
{
	string s;

	cin >> s;

	for (int i = 1; i <= s.size(); ++i)
	{

		if (i % 2 == 1)
		{

			cout << s[i-1] << flush;

		}

	}

	cout << endl;

	return 0;
}

Measured memory_bytes: 512
#include<iostream>
#include<algorithm>
#include<climits>
#include<vector>
#include<utility>
#include<cmath>
#include<string>
#include<cstring>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define prin(arg) std::cout<<arg<<"\n"
#define prin2(arg1,arg2) std::cout<<arg1<<" "<<arg2<<"\n"
#define fill(arg,n) std::memset(arg,n,sizeof(arg))
using std::cin;
typedef long long ll;
typedef std::pair<int,int> pi;
typedef std::vector<int> vi;
const int INF=1e+9;
const ll INFLL=1e+17;
int N;
std::string s;
char d[100010];
//di,di-1,siからdi+1を求める
char next(char d1,char d2,char s1){
  if(d1==d2){
    if(s1=='o') return 'S';
    else return 'W';
  }
  else{
    if(s1=='o') return 'W';
    else return 'S';
  }
}

void solve(){
  d[0]='S';d[1]='S';
  rep1(i,N-1){
    d[i+1]=next(d[i],d[i-1],s[i]);
  }
  if(d[0]==d[N]&&next(d[0],d[N-1],s[0])==d[1]){
    rep(i,N) std::cout<<d[i];
    std::cout<<"\n";
    return ;
  }
  d[0]='S';d[1]='W';
  rep1(i,N-1){
    d[i+1]=next(d[i],d[i-1],s[i]);
  }
  if(d[0]==d[N]&&next(d[0],d[N-1],s[0])==d[1]){
    rep(i,N) std::cout<<d[i];
    std::cout<<"\n";
    return ;
  }
  d[0]='W';d[1]='S';
  rep1(i,N-1){
    d[i+1]=next(d[i],d[i-1],s[i]);
  }
  if(d[0]==d[N]&&next(d[0],d[N-1],s[0])==d[1]){
    rep(i,N) std::cout<<d[i];
    std::cout<<"\n";
    return ;
  }
  d[0]='W';d[1]='W';
  rep1(i,N-1){
    d[i+1]=next(d[i],d[i-1],s[i]);
  }
  if(d[0]==d[N]&&next(d[0],d[N-1],s[0])==d[1]){
    rep(i,N) std::cout<<d[i];
    std::cout<<"\n";
    return ;
  }  
  prin(-1);
  return ;
}
int main(){
  cin>>N;
  cin>>s;
  solve();
  return 0;
}


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

int main(){
    int n;
    cin>>n;
    vector<int>v(n+1),a(n+1);
    for(int i=1;i<=n;i++){
        cin>>v[i];
        a[v[i]]=i;
    }
    for(int i=1;i<=n;i++)cout<<a[i]<<' ';
    cout<<'\n';
}


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

int main(){
    char b; cin >> b;
    if(b == 'A') cout << 'T' << endl;
    if(b == 'T') cout << 'A' << endl;
    if(b == 'G') cout << 'C' << endl;
    if(b == 'C') cout << 'G' << endl;

}
   

Measured memory_bytes: 256
def main():
  n ,mods = 0, [1]+[0]*2019
  for i, j in enumerate(reversed(input())):
    n = (n+int(j)*pow(10, i, 2019))%2019
    mods[n] += 1
  print(sum([i*(i-1)//2 for i in mods]))
main()

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

#define ll long long int

struct node{
    int v,w;
};

node arr[101];
ll dp[101][100001],n,w;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin>>n>>w;
    for(int i=1;i<=n;i++)
        cin>>arr[i].w>>arr[i].v;
    for(int i=1;i<=n;i++)
    {
        for(int j=1;j<=w;j++)
        {
            if(j<arr[i].w)
                dp[i][j]=dp[i-1][j];
            else
                dp[i][j]=max(dp[i-1][j],dp[i-1][j-arr[i].w]+arr[i].v);
            //cout<<dp[i][j]<<" ";
        }
        //cout<<endl;
    }
    cout<<dp[n][w]<<endl;
    return 0;
}


Measured memory_bytes: 78336
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <climits>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <numeric>
#include <iostream>

using namespace std;

#define FOR(i, a, b)   for(int i = (a); i < (b); ++i)
#define RFOR(i, a, b)  for(int i = (a); i > (b); --i)
#define rep(i, n)	   for(int i = 0; i < (n); ++i)
#define all(c)		   begin(c), end(c)
#define rall(c)		   rbegin(c), rend(c)
#define SZ(a)		   ((ll) a.size())

typedef long long		   ll;
typedef unsigned long long ull;


int main(){
  ll N,K;
  cin >> N >> K;
  ll ans=0;
  ll tmp1,tmp2;
  if(K==0) cout << N*N;
  else{
  FOR(i,K+1,N+1){
    tmp1=N/i;
    tmp2=N%i;
    ans+=(i-K)*tmp1;
    if(tmp2>=K) ans+=(tmp2-K+1);
  }
  cout << ans;
}
}


Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
#define Would
#define you
const long long INF = 9999999999999999999;
const int MOD = 1e9 + 7;
const double pi = 3.141592653589793238;

int main() {
	long long a, b, k[55], l[55], mon;
	cin >> a >> b;
	vector<long long> n, m;
	for (int i = 0; i < a; ++i) {
		cin >> k[i] >> l[i];
		n.push_back(k[i]);
		m.push_back(l[i]);
	}
	sort(n.begin(), n.end());
	sort(m.begin(), m.end());
	long long ans = (abs(n[a - 1] - n[0]))*(abs(m[a - 1] - m[0]));
	for (int i = 0; i < a; ++i) {
		for (int j = i + 1; j < a; ++j) {
			for (int kk = 0; kk < a; ++kk) {
				for (int ll = kk + 1; ll < a; ++ll) {
					mon = 0;
					for (int mm = 0; mm < a; ++mm) {
						if (n[i] <= k[mm] && k[mm] <= n[j] && m[kk] <= l[mm] && l[mm] <= m[ll]) { ++mon; }
					}
					if (mon >= b) { ans = min(ans, (abs(n[j] - n[i]))*(abs(m[ll] - m[kk]))); }
				}
			}
		}
	}
	cout << ans << endl;
}

Measured memory_bytes: 256
#include <iostream>
#include "bits/stdc++.h"
using namespace std;
#define print(x) cout<<x<<endl;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,a) for(ll i=0;i<a;i++)
#define jkl ll debug = 0;
#define RREP(i,a) for(ll i=a;i>0;i--)
#define rrep(i,a,b) for(ll i=a-1;i>=b;i--)
#define printall(n,array) {for(ll i=0;i<n;i++){cout<<array[i]<<" ";}cout<<endl;}
#define U() cout<<endl;
#define mp make_pair
typedef long long ll;
typedef pair<ll, ll> Pi;
typedef pair<ll, Pi> V;
typedef vector<ll> VE;
const ll mod = 1e9 + 7; //10^9+7

int main() {
    ll n;
    cin >> n;
    vector<double> x(n);
    vector<string> u(n);
    REP(i, n)cin >> x[i] >> u[i];
    double ans = 0;
    REP(i, n){
        if(u[i] == "JPY"){
            ans += x[i];
        }else{
            ans += x[i] * 380000;
        }
    }
    print(ans);
}

Measured memory_bytes: 256
'use strict';
(function(stdin) {
  var inputs = stdin.toString().trim().split('\n');
  var params = inputs[0].split(' ').map(Number);

  (function(W, H, x, y, r) {
    var xMin = 0 <= x - r;
    var yMin = 0 <= y - r;
    var xMax = 0 <= W - (x + r);
    var yMax = 0 <= H - (y + r);
    var result = xMin && yMin && xMax && yMax ? 'Yes' : 'No';
    // ????????????????????????
    console.log(result);
  }(params[0], params[1], params[2], params[3], params[4]));

}(require('fs').readFileSync('/dev/stdin', 'utf8')));

Measured memory_bytes: 15580
#include <bits/stdc++.h>
using namespace std;
#define modulo 1000000007
#define mod(x) (((long long)x)%modulo)



int main(){
	int N;
	cin>>N;
	vector<long long> A(N);
	vector<long long> B(N);
	for(int i=0;i<N;i++)cin>>A[i]>>B[i];
	reverse(A.begin(),A.end());
	reverse(B.begin(),B.end());
	long long ans = 0;
	
	for(int i=0;i<N;i++){
		A[i]+=ans;
		A[i]%=B[i];
		ans+=(B[i]-A[i])%B[i];
	}
	
	cout<<ans<<endl;
	
	
	
	return 0;
}


Measured memory_bytes: 1792
#include<bits/stdc++.h>
using namespace std;
 
int main() {
	int n;
	cin>>n;
	int a[n+1]={};
	for(int i=1;i<105;i++)
	{
	    for(int j=1;j<105;j++)
	    {
	        for(int k=1;k<105;k++)
	        {
	            long long v=i*i+j*j+k*k+i*j+j*k+k*i;
	            if(v<=n)
	            a[v]++;
	        }
	    }
	}
	for(int i=1;i<=n;i++)
	cout<<a[i]<<"\n";
	
	return 0;
}

Measured memory_bytes: 3592
import java.io.*;
import java.util.*;
class Main{
    public static void main(String[] args) throws Exception {
		hayami saori = new hayami();
		int n = saori.saori_hayami();
		int k = saori.saori_hayami();
		int[] h = new int[n];
		for(int i = 0;i < n;i++){
			h[i] = saori.saori_hayami();
		} 
		int ans = 0;
		for(int i = 0;i < n;i++){
			if(h[i] >= k){
				ans++;
			}
		}
		System.out.println(ans);
		
    }
}

class hayami implements Closeable {
	private final InputStream in = System.in;
	private final byte[] hayami = new byte[1024];
	private int Hayami = 0;
	private int saori = 0;
	private boolean HayamiSaori() {
		if (Hayami < saori) {
			return true;
		}else{
			Hayami = 0;
			try {
				saori = in.read(hayami);
			} catch (IOException e) {
				e.printStackTrace();
			}
			if (saori <= 0) {
				return false;
			}
		}
		return true;
	}
	private int SaoriHayami() { 
		if (HayamiSaori()) {
            return hayami[Hayami++];
         }else{
             return -1;
         }
	}
	private static boolean hayami_saori(int hayami) { 
		return 33 <= hayami && hayami <= 126;
	}
	public boolean hayamisaori() { 
		while(HayamiSaori() && !hayami_saori(hayami[Hayami])) Hayami++; return HayamiSaori();
	}
	public String nextHayami() {
		if (!hayamisaori()) throw new NoSuchElementException();
		StringBuilder hayamin = new StringBuilder();
		int saori = SaoriHayami();
		while(hayami_saori(saori)) {
			hayamin.appendCodePoint(saori);
			saori = SaoriHayami();
		}
		return hayamin.toString();
	}
	public long saorihayami() {//nextLong
		if (!hayamisaori()) throw new NoSuchElementException();
		long hayami = 0;
		boolean misao = false;
		int saori = SaoriHayami();
		if (saori == '-') {
			misao = true;
			saori = SaoriHayami();
		}
		if (saori < '0' || '9' < saori) {
			throw new NumberFormatException();
		}
		while(true){
			if ('0' <= saori && saori <= '9') {
				hayami *= 10;
				hayami += saori - '0';
			}else if(saori == -1 || !hayami_saori(saori)){
				return misao ? -hayami : hayami;
			}else{
				throw new NumberFormatException();
			}
			saori = SaoriHayami();
		}
	}
	public int saori_hayami() {//nextInt
		long hayami = saorihayami();
		if (hayami < Integer.MIN_VALUE || hayami > Integer.MAX_VALUE) throw new NumberFormatException();
		return (int) hayami;
	}
	public double Hayamin() { //nextDouble
		return Double.parseDouble(nextHayami());
	}
	public void close() {
		try {
			in.close();
		} catch (IOException e) {
		}
    }
    
}

Measured memory_bytes: 23608
#include<stdio.h>

int main() {
	int n = 0;
	int m = 0;
	int c = 0;
	int t = 0;
	int v[101];
	scanf("%d %d", &n, &m);
	for (int i = 0; i < n; i++) {
		scanf("%d", &v[i]);
	}
	for (int i = 0; i < n; i++) {
		t = t + v[i];
	}
	for (int i = 0; i < n; i++) {
		if (v[i] >= (float)t / (4 * m)) {
			c = c + 1;
		}
	}
	if (c >= m) {
		printf("Yes");
	}
	else {
		printf("No");
	}
	return 0;
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int N, K, A, B, X = 1;
  cin >> N >> K;
  
  for (int i = 0; i < N; i++) {
    A = X * 2;
    B = X + K;
    if (A < B) {
      X = A;
    }
    else {
      X = B;
    }
  }
  cout << X << endl;
}

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

public class Main {
	public static void main(String[] args) {
		Scanner kb = new Scanner(System.in);
		int n = kb.nextInt();
		String k = "YES";
		ArrayList<Integer> a = new ArrayList<>();
		for (int i = 0; i < n; i++) {
			int j = kb.nextInt();
			a.add(j);
		}
		Collections.sort(a);
		//System.out.println(a.get(0));
		//System.out.println(a.get(1));
		for (int i = 0; i < n - 1; i++) {
			//System.out.println(i);
			//System.out.println(a.get(i).equals(a.get(i + 1)));
			if (a.get(i).equals(a.get(i + 1))) {
				k = "NO";
				break;
			}
		}
		System.out.println(k);
		kb.close();
	}
}


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

int main(){
	int H,W,K;
	cin >> H >> W >> K;
	vector<string> c(H);
	for(auto &i:c)cin >> i;
	long long ans=0;
	
	for(int bit=0;bit<(1<<(H+W));bit++){
		vector<int> remain(H+W);
		int b=bit;
		for(int i=0;i<H+W;i++){
			remain[i]=(b%2==1);
			b/=2;
		}
		int count=0;
		for(int i=0;i<H;i++)for(int j=0;j<W;j++){
			if(remain[i] && remain[H+j] && c[i][j]=='#')count++;
		}
		if(count==K)ans++;
	}
	cout << ans << endl;
	return 0;
}

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

using namespace std;

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

	if(a%2 == 0 || b%2 == 0 || c%2 == 0) {
		puts("0");
	} else {
		printf("%lld\n", min(a * 1ll * c,min(a * 1ll * b, b * 1ll * c)));
	}
}

Measured memory_bytes: 256
using System;
using System.Linq;

namespace AtCoder
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().Split(' ').Select(x => int.Parse(x));
            var a = input.First();
            var b = input.Skip(1).First();
            var c = input.Skip(2).First();

            var min = Math.Min(a, b);
            var max = Math.Max(a, b);
            if (min <= c && c <= max)
            {
                Console.WriteLine("Yes");
                return;
            }
            Console.WriteLine("No");
        }
    }
}


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

int shop[110][110];
int p[110][12];
int main(){
  int n;
  cin >> n;
  for(int i = 0; i < n; i++){
    for(int j = 0; j < 10; j++){
      cin >> shop[i][j];
    }
  }
  for(int i = 0; i < n; i++){
    for(int j = 0; j < 11; j++){
      cin >> p[i][j];
    }
  }
  int ans = -1e9;
  for(int bit = 1; bit < (1 << 10); bit++){
    int tmp = 0;
    for(int i = 0; i < n; i++){
      int cnt = 0;
      for(int j = 0; j < 10; j++){
        if((bit >> j & 1) && shop[i][j]) cnt++;
      }
      tmp += p[i][cnt];
    }
    ans = max(ans, tmp);
  }
  cout << ans << endl;
  return 0;
}


Measured memory_bytes: 384
import java.util.*;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int w = sc.nextInt();
		int h = sc.nextInt();
		int minx = 0;
		int maxx = w;
		int miny = 0;
		int maxy = h;
		int n = sc.nextInt();
		for(int i = 0; i < n; i++) {
			int x = sc.nextInt();
			int y = sc.nextInt();
			int mode = sc.nextInt();
			if(mode == 1) {
			    if(minx < x) {
				minx = x;
			    }
			} else if(mode == 2) {
			    if(maxx > x) {
				maxx = x;
			    }
			} else if(mode == 3) {
			    if(miny < y) {
				miny = y;
			    }
			} else {
			    if(maxy > y) {
				maxy = y;
			    }
			}
		}
		if(minx < maxx && miny < maxy) {
			System.out.println((maxx-minx) * (maxy-miny));
		} else {
			System.out.println(0);
		}
	}
}


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

int inf = (1 << 30);
int mod = 1e9;

int main(){

    int N, M;
    cin >> N >> M;
    vector<int> a(M), b(M);
    for(int i = 0; i < M; i++) cin >> a[i] >> b[i];

    vector<int> from1(N + 1), toN(N + 1);
    for(int i = 0; i < M; i++){
        if(a[i] == 1) from1[b[i]] = 1;
        if(b[i] == N) toN[a[i]] = 1;
    }

    string ans = "IMPOSSIBLE";
    for(int i = 0; i < N; i++){
        if(from1[i] == 1 && toN[i] == 1){
            ans = "POSSIBLE";
            break;
        }
    }

    cout << ans << endl;

    return 0;
}

Measured memory_bytes: 3328
#include <iostream>

using namespace std;

int main(void){

  int year,month,day;
  while( cin >> year >> month >> day ){
   if( 1989 < year || ( year == 1989 && 1 <= month && 8 <= day ) ){
     cout << "heisei" <<" "<< year-1988 << " " << month << " " << day << endl;
    }
    else if( 1926 < year || ( year == 1926 && 12 <= month && 25 <= day) ){
      cout <<"showa"<<" "<< year-1925 <<" "<<month <<" "<< day << endl;
    }
    else if( 1912 < year || ( year == 1912 && 7 <= month && 30 <= day )){
      cout <<"taisho"<<" "<< year-1911 <<" "<< month <<" "<< day << endl;
    }
    else if( 1868 < year || ( year == 1868 && 9 <= month && 8 <= day ) ){
      cout <<"meiji" <<" "<< year-1867 <<" "<< month <<" "<< day << endl;
      }
    else cout << "pre-meiji" << endl;
  }

  return 0;
}

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

using namespace std;
#define all(a)a.begin(),a.end()
using ll=long long;
const int INF = 1<<30;
const ll INFll =1LL<<62;
const int mod = int(1e9)+7;
using V = vector<ll>;
using P = pair<ll,ll>;

int main(){
   map<ll,ll>a;
   ll n;cin >>n;
   ll col=0;
    for (int i = 0; i < n; ++i) {
        int x;cin >>x;
        if(x>=3200)col++;
        else a[x/400]++;
    }
    if(a.empty())cout <<1<<" ";
    else cout<<a.size()<<" ";
    cout <<col+a.size()<<endl;
    return 0;
}

Measured memory_bytes: 256
#include "bits/stdc++.h"
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
const ll INF = 1LL << 60;
const ll MOD = 1000000007;
template <class T>
bool chmax(T &a, const T &b) {
    return (a < b) ? (a = b, 1) : 0;
}
template <class T>
bool chmin(T &a, const T &b) {
    return (b < a) ? (a = b, 1) : 0;
}
template <class C>
void print(const C &c, std::ostream &os = std::cout) {
    std::copy(std::begin(c), std::end(c), std::ostream_iterator<typename C::value_type>(os, " "));
    os << std::endl;
}

int main() {
    int n, m;
    cin >> n >> m;
    vector<pii> ab(m);
    for (int i = 0; i < m; ++i) {
        cin >> ab[i].first >> ab[i].second;
    }
    auto f = [](pii l, pii r) { return l.second < r.second; };
    sort(ab.begin(), ab.end(), f);
    int ret = 0;
    int prev = -1;
    for (int i = 0; i < m; ++i) {
        if (prev <= ab[i].first) {
            ret++;
            prev = ab[i].second;
        }
    }
    cout << ret << "\n";
    return 0;
}

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

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

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

typedef long long ll;
typedef long double R;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

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

// Problem Specific Parameter:

int main() {
  string s; cin >> s;
  int flag = 0;
  for(int i = 0; i < s.length(); i++) {
    if(flag == 0 && s[i] == 'C') flag = 1;
    else if(flag == 1 && s[i] == 'F') {
      cout << "Yes" << endl;
      return 0;
    }
  }
  cout << "No" << endl;

  return 0;
}


Measured memory_bytes: 256