akhauriyash/Code-Regression huggingface dataset:
void throwdice_N(int x[6]){
    int tmp;
    tmp = x[0];
    x[0] = x[1];
    x[1] = x[5];
    x[5] = x[4];
    x[4] = tmp;
}
void throwdice_E(int x[6]){
    int tmp;
    tmp = x[0];
    x[0] = x[3];
    x[3] = x[5];
    x[5] = x[2];
    x[2] = tmp;
}
void throwdice_S(int x[6]){
    int tmp;
    tmp = x[0];
    x[0] = x[4];
    x[4] = x[5];
    x[5] = x[1];
    x[1] = tmp;
}
void throwdice_W(int x[6]){
    int tmp;
    tmp = x[0];
    x[0] = x[2];
    x[2] = x[5];
    x[5] = x[3];
    x[3] = tmp;
}

#include <stdio.h>
int main(int argc, const char * argv[]) {
    int i, j, top, front, left, right, back, bottom, count=0, count1=0, count2=0, n=0;
    int top2, front2, left2, right2, back2, bottom2;
    int x[6], x2[6];
    int C=0;
    
    scanf("%d", &n);
    
    for(i=0; i<6; i++) {
        scanf("%d",&x[i]);
    }
    back = x[4];
    top = x[0];
    right = x[2];
    left = x[3];
    bottom = x[5];
    front =x[1];
    
    for(j=0; j<n-1; j++){
        
        for(i=0; i<6; i++) {
            scanf("%d",&x2[i]);
        }
        back2 = x2[4];
        top2 = x2[0];
        right2 = x2[2];
        left2 = x2[3];
        bottom2 = x2[5];
        front2 =x2[1];
        
        while (x2[1] != front) {
            
            if((x2[1] != back) &&
               (x2[1] != top) &&
               (x2[1] != right) &&
               (x2[1] != left) &&
               (x2[1] != bottom) &&
               (x2[1] != front) ){
                count++;
                break;
            }
            
            if (x2[2] == front || x2[3] == front) {
                throwdice_E(x2);
            }
            throwdice_N(x2);
        }
        while(x2[5] != bottom){
            if((x2[5] != back) &&
               (x2[5] != top) &&
               (x2[5] != right) &&
               (x2[5] != left) &&
               (x2[5] != bottom) &&
               (x2[5] != front) ){
                count1++;
                break;
            }
            if(0 < count) break;
            throwdice_E(x2);
            C++;
            if(C >= 4)break;
        }
        C=0;
        while (x2[0] != top) {
            if((x2[0] != back) &&
               (x2[0] != top) &&
               (x2[0] != right) &&
               (x2[0] != left) &&
               (x2[0] != bottom) &&
               (x2[0] != front) ){
                break;
            }
            if(0 < count) break;
            if(0 < count1) break;
            throwdice_E(x2);
            C++;
            if(C >= 4)break;
        }
        
        back2 = x2[4];
        top2 = x2[0];
        right2 = x2[2];
        left2 = x2[3];
        bottom2 = x2[5];
        front2 =x2[1];
        
        if(back == back2 &&
           top == top2 &&
           right == right2 &&
           left == left2 &&
           bottom == bottom2 &&
           front == front2){
            count2++;
        }
    }
    if(count2 == 0 ){
        printf("Yes\n");
    }else{
        printf("No\n");
    }
    
    return 0;
}

Measured memory_bytes: 580
local n = io.read("*n")
local v, c = {}, {}
for i = 1, n do v[i] = io.read("*n") end
for i = 1, n do c[i] = io.read("*n") end
local sum = 0
for i = 1, n do
  if(c[i] < v[i]) then sum = sum + v[i] - c[i] end
end
print(sum)


Measured memory_bytes: 1008
// 🐋💭
import Foundation

func readInts() -> [Int] {
    return readLine()!.split(separator: " ").map { Int($0)! }
}

func readInt() -> Int {
    return Int(readLine()!)!
}

func readDoubles () -> [Double] {
    return readLine()!.split(separator: " ").map { Double($0)! }
}

func readDouble() -> Double{
    return Double(readLine()!)!
}
///最大公約数を返す
func gcd(_ m:Int, _ n:Int) -> Int {
    if n == 0 {return m}
    return gcd(n, m % n)
}
///最小公倍数を返す
func lcm(_ m:Int, _ n:Int) -> Int {
    return m * n / gcd(m, n)
}

///素数判定(試し割り)
func isPrime(_ x:Int) -> Bool {
    if x <= 1 || x % 2 == 0 { return false }
    if x == 2 { return true }
    for i in stride(from: 3, to: Int(ceil(sqrt(Double(x)))), by: 2){
        if x % i == 0 {
            return false
        }
    }
    return true
}

//https://program-life.com/669
///実行速度の計測
func exectionTime(action: () -> Void) {
    let startDate = Date()
    action()
    let endDate = Date()
    print(endDate.timeIntervalSince(startDate))
}

// https://melheaven.hatenadiary.jp/entry/atcoder144
///約数の配列を返す
func makeDivisors(_ n:Int) -> [Int] {
    var divisors = [Int]()
    for i in 1..<Int(pow(Double(n), 0.5)) + 1 {
        if n % i == 0{
            divisors.append(i + n / i)
        }
    }
    
    return divisors
}

//https://riptutorial.com/ja/swift/example/14738/インデックスを知らずに配列から要素を削除する
extension Array where Element: Equatable {
    
    mutating func remove(_ element: Element) {
        _ = firstIndex(of: element).flatMap {
            self.remove(at: $0)
        }
    }
}

func binarySearch(rifgt:Int, key:Int, ary:[String]) -> Int{
    var left = 0
    var right = rifgt
    
    while abs(right - left) > 1 {
        let mid = left + (right - left) / 2
        
        if Int(ary[mid])! < key {
            left = mid
            
        } else {
            right = mid
        }
    }
    return left
}

func arrangement (prev:String, ary:[String], returnVal:[String]) -> [String] {
    var returnVal = returnVal
    if ary.count == 0 {
        returnVal.append(prev)
        return returnVal
    }
    
    for s in ary {
        let wprev = prev + s
        var wary = ary
        wary.remove(s)
        returnVal = arrangement(prev: wprev, ary: wary, returnVal: returnVal)
    }
    return returnVal
}

func main() {
    var s = readLine()!.map { String($0) }
    let zeroCount = s.filter { $0 == "0"}.count
    print(2 * min(zeroCount, s.count - zeroCount))
}
main()


Measured memory_bytes: 15980
package main

import "fmt"

func main() {
	var n, a, b int
	fmt.Scan(&n, &a, &b)

	var r int
	for i := 1; i <= n; i++ {
		s := sum(i)
		if a <= s && s <= b {
			r += i
		}
	}

	fmt.Println(r)
}

func sum(n int) int {
	var total int
	for n > 0 {
		total += n % 10
		n /= 10
	}
	return total
}


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

int n,v,u,k,d=0;
int l[110],f[110];
int b[110][110];
queue<int> q;
void bfs(int a)
{
	while(!q.empty()){
		a=q.front();q.pop();
		for(int i=1;i<=n;i++){
			if(b[a][i]==1&&f[i]==0){
				f[i]=1;
				q.push(i);
				l[i]=l[a]+1;
			}
		}
	}
	return ;
}
int main()
{	
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>u;
		cin>>k;
		for(int j=1;j<=k;j++){
			cin>>v;
			//cout<<v<<endl;
			b[u][v]=1;
		} 
	}
	
	
	//cout<<"@"<<b[1][3]<<"@"<<endl;
	l[1]=0;
	f[1]=1;
	q.push(1);
	bfs(1);
	for(int i=1;i<=n;i++){
		if(l[i]==0&&i!=1){
			cout<<i<<" "<<-1<<endl;
			continue;
		}
		cout<<i<<" "<<l[i]<<endl;
	}
	return 0;
 } 


Measured memory_bytes: 3140
#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long
const int md=998244353;
const int mx=4005;
int n,k;
ll exp(ll b, ll n){
	ll res = 1;
	for(;n;n>>=1,(b*=b)%=md)if(n&1)(res*=b)%=md;
	return res;
}
ll fact[mx]={1},invf[mx];
inline void init(int n){
	for(int i=1;i<=n;i++) fact[i]=(fact[i-1]*i)%md;
	invf[n]=exp(fact[n],md-2);
	for(int i=n;i>0;i--) invf[i-1]=(invf[i]*i)%md;
}
inline ll comb(int a,int b){return fact[a]*invf[a-b]%md *invf[b]%md;}
inline ll nkcom(int n,int k){return comb(n+k-1,n);}
inline ll calc(int n,int k,int t){
	ll ret=0;
	rep(i,t+1) ret=(ret+nkcom(n-i,k-t*2+i)*comb(t,i)%md*exp(2,i))%md;
	return ret;
}
int main(){
	scanf("%d%d",&k,&n);
	init(k+n);
	for(int i=1;i<2*k;i++){
		int t=min(i,2*k-i);
		printf("%lld\n",t&1 ?(calc(n-1,k-1,t/2)+calc(n,k-1,t/2))%md:calc(n,k,t/2));
	}
}


Measured memory_bytes: 384
#include "bits/stdc++.h"
using namespace std;
using ll = long long;

#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)

int main() {
	int num;
	cin >> num;
	if (num == 0) {
		cout << 1 << endl;
	}
	else if (num == 1) {
		cout << 0 << endl;
	}
}



Measured memory_bytes: 3636
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <queue>
#include <string>
#include <map>
#include <set>
#include <stack>
#include <tuple>
#include <deque>
#include <numeric>
#include <bitset>
#include <iomanip>
#include <cassert>
#include <chrono>
#include <random>
#include <limits>
#include <iterator>
#include <functional>
#include <sstream>
#include <complex>
using namespace std;

using ll = long long;
using ull = uint64_t;
using P = pair<int, int>;
constexpr double EPS = 1e-9;
constexpr int INF = 1001001001;
constexpr int mod = 1000000007;
// constexpr int mod = 998244353;

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

constexpr int m = 2019;

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

    string s;
    cin >> s;
    int n = s.length();
    
    vector<ll> dp(m, 0);
    dp[0] = 1;
    ll ans = 0;
    for(int i = 0; i < n; ++i){
        int num = s[i] - '0';
        vector<ll> nextdp(m, 0);
        for(int j = 0; j < m; ++j){
            if(!dp[j])  continue;
            int nj = (j * 10 + num) % m;
            nextdp[nj] += dp[j];
        }
        dp = move(nextdp);
        ans += dp[0]++;
    }
    cout << ans << endl;
}

Measured memory_bytes: 3760
object Main {
  import java.util.Scanner

  implicit class RichScanner(sc: Scanner) {
    def readStrings(n: Int): Array[String] = Array.fill(n) { sc.next() }
    def readInts(n: Int): Array[Int] = Array.fill(n) { sc.nextInt() }
    def readLongs(n: Int): Array[Long] = Array.fill(n) { sc.nextLong() }
    def readLineStrings: Array[String] = sc.nextLine().split(' ')
    def readLineInts: Array[Int] = readLineStrings.map(_.toInt)
    def readLineLongs: Array[Long] = readLineStrings.map(_.toLong)
  }

  def main(args: Array[String]): Unit = solve(new Scanner(System.in))

  def solve(sc: Scanner): Unit = {
    val Array(a, b, c) = sc.readLineInts
    if (a == b && b == c) {
      println("Yes")
    } else {
      println("No")
    }
  }
}


Measured memory_bytes: 25784
#include <iostream>
#include <vector>
using namespace std; 
int N = 100000;
bool prime[100000];
int result[100000];
void sieve() {
	for (int i = 0; i < N; i++)
		prime[i] = true;
	prime[1] = false;
	int i = 2;
	for (int i = 2; i < N; i++) {
		if (prime[i] == true) {
			int j = i + i;
			while (j < N) {
				prime[j] = false;
				j += i;
			}
		}
	}
	result[0] = 0;

	for (int i = 1; i < N; i++) {
		if (i%2 == 1 && prime[i] == true) {
			if (prime[(i+1)/2] == true)
				result[i] = result[i-1] + 1; 
			else 
			result[i] = result[i-1]; 
		
		}
		else {
			result[i] = result[i-1]; 
		}
	}

}
int main(void) {
	int q; cin >> q;
	sieve();
	// for (int i = 0; i < 10; i++)
	// 	cout << result[i] << endl;
	for (int i = 0; i < q; i++) {
		int l, r; cin >> l >> r;
		
		if (result[l] == result[l-1] )
			cout << result[r] - result[l] << endl;
		else 
			cout << result[r] - result[l] + 1<< endl;
	}



	return 0;
}

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

int main()
{
    ll k,n;
    cin>>k>>n;
    vector<ll> a(n);
    vector<ll> b(n);
    REP(i,n){
        cin>>a[i];
        b[i]=a[i];
    }
    REP(j,n-1){
        b[j+1]-=a[j];
    }
    b[0]=(k-a[n-1])+a[0];
    ll max=0;
    ll maxi=0;
    ll ans=0;
    REP(l,n){
        ans+=b[l];
        if(b[l]>max){
            max=b[l];
            maxi=l;
        }
    }
    ans-=b[maxi] ;
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3328
#include <bits/stdc++.h>
using namespace std;
#define debug(x) cerr<<#x<<'='<<x<<' '
#define f first
#define s second
typedef long long ll;
typedef pair<int,int> pi;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
	int N; string S;
	cin >> N >> S;
	int ans = 0;
	if (S == "ABC") {
		cout << 1;
		return 0;
	}
	for (int i = 0; i < N-2; ++i) {
		if (S.substr(i,3) == "ABC") ++ans;
	}
	cout << ans;
    return 0;
}


Measured memory_bytes: 256
#include<iostream>

using namespace std;

int main() {
	int a,b;
	char op;

	while(1) {
		cin >> a >> op >> b;
		if (op=='?') break;
		if (op =='+'){
			cout << a+b << endl;
		}else if (op =='-'){
			cout << a-b << endl;
		}else if (op =='*'){
			cout << a*b << endl;
		}else {
			cout << a/b << endl;
		}
	}
	return 0;
}


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

int main() {

    int a,b;
    
    for(int i = 0; ; i++){
        cin >> a >> b;
        if(a == 0 && b == 0){
            break;
        }

        for(int i = 0;i < a ; i++){
            for(int j = 0;j < b ; j++){
                if(((i+1)%2 != 0 && (j+1)%2 != 0) | ((i+1)%2 == 0 && (j+1)%2 == 0)) {
                    cout << "#";
                }
                else{
                    cout << ".";
                }
                
                if(j == b-1){
                    cout << endl;
                }
                
                if(i == a-1 && j == b-1){
                    cout << endl;
                }
            }
        }
    }
}


Measured memory_bytes: 3084
#include <cstdio>
#include <iostream>

using namespace std;

int main() {
	int n;
	scanf ("%d", &n);
	while (n--) {
		int a, b, c;
		scanf ("%d%d%d", &a, &b, &c);
		if (a + b > c && a + c > b && b + c > a) {
			a *= a, b *= b, c *= c;
			 if (a + b == c || a + c == b || b + c == a) printf ("YES\n");
			 else printf ("NO\n");
		}
		else printf ("NO\n");
	}
	return 0;
}

Measured memory_bytes: 0
#　Nはせんべいの枚数。Kは人
N,K= map(int, input().split())

#一人あたりに何枚のせんべいが行くかを問う。(7枚,４人なら1枚)
A = N//K

#何枚あまるか(7枚,4人なら3枚)
B = N % K

AB = abs(B-A)


if (N % K) != 0:
    print(1)
else:
    print(0)
    

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

using namespace std;

int main(void) {
    long n, k;
    cin >> n >> k;
    
    vector<pair<long,long>> v(n);
    for(auto &e: v) cin >> e.second >> e.first;
    for(auto &e: v) e.first *= -1;
    sort(v.begin(), v.end());
    for(auto &e: v) e.first *= -1;

    long r = 0, rr = 0;
    set<long> s;
    map<long,long> mi;
    map<long,long> cnt;
    {
        for(int i=0; i<k; i++) {
            rr += v[i].first;
            s.insert(v[i].second);
            cnt[v[i].second]++;
        }
        r = rr + s.size()*s.size();
    }

    {
        int j = k-1;
        for(int i=k; i<n; i++) {
            if(s.count(v[i].second) == 0) {
                while(j >= 0 && cnt[v[j].second] == 1) j--;
                if(j < 0) break;

                s.insert(v[i].second);
                rr -= v[j].first;
                rr += v[i].first;
                r = max(r, rr + (long)(s.size()*s.size()));

                j--;
            }
        }
    }

    cout << r << endl;
}


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

int main() {
	long long x, k, d, ans;
	cin >> x >> k >> d;
	if (x < 0) x = -x;
	long long i = x / d;
	if (i > k) {
		x -= k * d;
		cout << x << endl;
		return 0;
	}
	x -= i*d;
	k -= i;
	if (k % 2 == 0) ans = abs(x);
	else ans = abs(x - d);
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 3192
package main

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

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

func main() {
	sc.Split(bufio.ScanWords)
	defer out.Flush() // !!!!coution!!!! you must use Fprint(out, ) not Print()
	/* --- code ---*/
	// 令和C最大級に日本語がむずかしい かといって英語もむずかしい
	// スイッチの状態をbit全探索する
	n, m := nextInt(), nextInt()
	balbs := make([][]int, m)
	for i := 0; i < m; i++ {
		k := nextInt()
		balbs[i] = make([]int, k)
		for j := 0; j < k; j++ {
			balbs[i][j] = nextInt() - 1
		}
	}
	ans := 0
	ps := nextInts(m)
	// スイッチがn個あるのでそれのオンオフの状態 2^nぶん
	// ループでやるの毎回わけわからんな bit全探索慣れてない
	// もうなんかほとんど勘でやってる
	for i := 0; i < (1 << uint64(n)); i++ {
		ok := true
		for k := 0; k < m; k++ {
			c := 0
			for _, v := range balbs[k] {
				if 1&(i>>uint64(v)) == 1 {
					c += 1
				}
			}
			c %= 2
			if ps[k] != c {
				ok = false
			}
		}
		if ok {
			ans += 1
		}
	}
	fmt.Fprintln(out, ans)
}

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

func nextInt() int {
	a, _ := strconv.Atoi(next())
	return a
}

func nextFloat64() float64 {
	a, _ := strconv.ParseFloat(next(), 64)
	return a
}

func nextInts(n int) []int {
	ret := make([]int, n)
	for i := 0; i < n; i++ {
		ret[i] = nextInt()
	}
	return ret
}
func nextFloats(n int) []float64 {
	ret := make([]float64, n)
	for i := 0; i < n; i++ {
		ret[i] = nextFloat64()
	}
	return ret
}
func nextStrings(n int) []string {
	ret := make([]string, n)
	for i := 0; i < n; i++ {
		ret[i] = next()
	}
	return ret
}

func PrintOut(src interface{}, joinner string) {
	switch reflect.TypeOf(src).Kind() {
	case reflect.Slice:
		s := reflect.ValueOf(src)
		for idx := 0; idx < s.Len(); idx++ {
			fmt.Fprintf(out, "%v", s.Index(idx))
			if idx < s.Len()-1 {
				fmt.Fprintf(out, "%s", joinner)
			} else {
				fmt.Fprintln(out)
			}
		}
	default:
		fmt.Fprintln(out, "fuck")
	}
}


Measured memory_bytes: 640
import java.io.*;
import java.util.StringTokenizer;

public class Main {
    public static void main(String[] args) throws IOException {
        FastScanner in = new FastScanner();
        
        int n = in.nextInt();
        int m = in.nextInt();
        
        int matrix[][] = new int[n][m];
        
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                matrix[i][j] = in.nextInt() - 1;
            }
        }
        
        int curIndex[] = new int[n];
        int numPlayers[] = new int[m];
        
        
        int best = 301;
        
        for (int i = 0; i < n; i++) numPlayers[matrix[i][0]]++;
        
        for (int i = 0; i < m; i++) {
            int curMax = 0;
            int maxSport = -1;
            for (int j = 0; j < m; j++) {
                if (numPlayers[j] > curMax) {
                    curMax = numPlayers[j];
                    maxSport = j;
                }
            }
            
            if (curMax < best) best = curMax;
            
            numPlayers[maxSport] = -1;
            if (i == m-1) break;
            for (int j = 0; j < m; j++) if (numPlayers[j] != -1) numPlayers[j] = 0;
            
            for (int j = 0; j < n; j++) {
                while (numPlayers[matrix[j][curIndex[j]]] == -1) curIndex[j]++;
                numPlayers[matrix[j][curIndex[j]]]++;
            }
        }
        System.out.println(best);
    }

    public static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        public FastScanner(String s) {
            try {
                br = new BufferedReader(new FileReader(s));
            } catch (FileNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }

        public FastScanner() {
            br = new BufferedReader(new InputStreamReader(System.in));
        }

        String nextToken() {
            while (st == null || !st.hasMoreElements()) {
                try {
                    st = new StringTokenizer(br.readLine());
                } catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }

        String nextLine() {
            st = null;
            try {
                return br.readLine();
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            return null;
        }

        int nextInt() {
            return Integer.parseInt(nextToken());
        }

        long nextLong() {
            return Long.parseLong(nextToken());
        }

        double nextDouble() {
            return Double.parseDouble(nextToken());
        }
    }
}


Measured memory_bytes: 29828
#include <iostream>
#include <unordered_map>
#include <algorithm>


using namespace std;

int main() {
    while(true) {
        int a, b; cin >> a >> b;
        if(a == 0 && b == 0) break;
        unordered_map<int, int> map_a, map_b;
        for(int i = 0; i < a; ++i) {
            int e; cin >> e;
            map_a[e]++;
        }
        for(int i = 0; i < b; ++i) {
            int e; cin >> e;
            map_b[e]++;
        }
        for(auto p : map_a) {
            map_b[p.first] = max(map_b[p.first], p.second);
        }
        int ans = 0;
        for(auto p : map_b) {
            ans += p.first*p.second;
        }
        cout << ans << endl;
    }
    return 0;
}

// [Problem] Cubist Artwork
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=1295



Measured memory_bytes: 3028
$_ = <>;
$_ = <>;
chmop;
@v = split(" ");

$_ = <>;
chmop;
@c = split(" ");

$ans = 0;

for($i = 0; $i <= $#v; $i++){
  if($v[$i] - $c[$i] > 0){
    $ans += $v[$i] - $c[$i];
  }
}

print "$ans\n";



Measured memory_bytes: 512
H,W,K=map(int,input().split())
P=[]
for i in range(H):
    s=input()
    a=[]
    for j in range(W):
        a.append(s[j])
    P.append(a)
    
ans=0
for markR in range(2**H):
    for markC in range(2**W):
        black=0
        for i in range(H):
            for j in range(W):
                if (markR>>i)&1==0 and (markC>>j)&1==0 and P[i][j]=='#':
                    black+=1
        if black==K:
            ans+=1

print(ans)

Measured memory_bytes: 9132
#ifdef _DEBUG
#define _CRT_SECURE_NO_WARNINGS
#include "MyLib.h"
#else
#define main_C main
#include "bits/stdc++.h" 
#include <regex>
#define _USE_MATH_DEFINES
#include <math.h>
#define FOR(i,s,e) for (int i = int(s); i < int(e); ++i)
#define REP(i,e) FOR(i,0,e)
#define INF (INT_MAX/2)
#define EPS (1.0e-8)
#define MGN 8
#define LINF (LONG_MAX/2)
using namespace std;
typedef long long ll; typedef unsigned long long ull;
typedef vector<int> vi; typedef vector<vi> vvi;
typedef vector<ll> vl; typedef vector<vl> vvl;
typedef vector<double> vd; typedef vector<string> vs;
typedef pair<int, int> pii; typedef pair<ll, ll> pll;
typedef vector<bool> vb; typedef vector<vb> vvb;
template <typename T>
using keyVal = pair<string, T>;
template<typename T>
bool val_greater(const keyVal<T>& left, const keyVal<T>& right) {
    return left.second > right.second;
}
vs split(string str, char sep) {
    vs v; stringstream ss(str); string t;
    while (getline(ss, t, sep)) v.push_back(t);
    return v;}
vs re_search_g(string s, regex re) {
    vs ret; smatch mc; auto it = s.cbegin();
    while (regex_search(it, s.cend(), mc, re)) {
        ret.push_back(mc[0]);
        it += mc.position(0) + mc.length();}
    return ret;}
#endif

void init_global_C() {}


int main_C() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    
    string S; cin >> S;

    regex re("(dream|dreamer|erase|eraser)+");

    string ans = regex_match(S, re) ? "YES" : "NO";
    
    cout << ans << endl;  

    return 0;
}

Measured memory_bytes: 39888
import java.util.Scanner;

public class Main {
   public static void main(String[] args) {
      Scanner sc = new Scanner(System.in);
      
      while(sc.hasNext()) {
         double input = Double.parseDouble(sc.nextLine());
         double height = Math.pow(input,2) / (2.0 * 9.8);
         
         int floor = (int)Math.ceil((height + 5.0) / 5.0);
         System.out.println(floor);
      }
   }
}


Measured memory_bytes: 25992
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;
class Point {
public:
    Point(){};
    Point(int i, int x, int y) : id {i}, x {x}, y {y} {};
    int id;
    int x;
    int y;
};

class TwoDTree {
public:
    TwoDTree(){};
    TwoDTree(Point* p, TwoDTree* l, TwoDTree* r) : root {p}, left {l}, right {r} {};
    TwoDTree(vector<Point>& ps) {
        auto tree = const2DTree(ps.begin(), ps.end(), 0);
        root = tree->root;
        left = tree->left;
        right = tree->right;
    };
    typedef vector<Point>::iterator pIter;

    TwoDTree* const2DTree(pIter a, pIter b, int d){
        if(a >= b){
            return nullptr;
        }
        if(d%2){
            sort(a, b, [](Point p, Point q){ return p.y < q.y; });
        } else {
            sort(a, b, [](Point p, Point q){ return p.x < q.x; });
        }
        pIter mid = a + (b-a)/2;
        auto l = const2DTree(a, mid, d+1);
        auto r = const2DTree(mid+1, b, d+1);
        return new TwoDTree(&(*mid), l, r);
    };
    vector<Point> find(int x1, int x2, int y1, int y2){
        auto ps = new vector<Point>();
        find(x1, x2, y1, y2, 0, *ps);
        return *ps;
    };
    Point* root;
    TwoDTree* left;
    TwoDTree* right;
private:
    void find(int x1, int x2, int y1, int y2, int d, vector<Point>& vec){
        if(!root){
            return;
        }
        int rx = root->x;
        int ry = root->y;
        if(x1 <= rx && rx <= x2 && y1 <= ry && ry <= y2){
            vec.push_back(*root);
        }

        if(left){
            if(d%2 == 0 && rx >= x1){
                left->find(x1, x2, y1, y2, d+1, vec);
            } else if(d%2 == 1 && ry >= y1){
                left->find(x1, x2, y1, y2, d+1, vec);
            }
        }
        if(right){
            if(d%2 == 0 && rx <= x2){
                right->find(x1, x2, y1, y2, d+1, vec);
            } else if(d%2 == 1 && ry <= y2){
                right->find(x1, x2, y1, y2, d+1, vec);
            }
        }
    }
};

int main(){
    ios_base::sync_with_stdio(false);
    int n;
    cin >> n;
    auto ps = vector<Point>();
    int x, y;
    for(int i = 0; i < n; ++i){
        cin >> x >> y;
        ps.push_back(Point(i, x, y));
    }
    auto kdTree = TwoDTree(ps);
    int q;
    cin >> q;
    int sx, tx, sy, ty;
    for(int i = 0; i < q; ++i){
        cin >> sx >> tx >> sy >> ty;
        auto vs = kdTree.find(sx, tx, sy, ty);
        sort(vs.begin(), vs.end(), [](Point a, Point b){
                return a.id < b.id;
             });
        for(auto x : vs){
            printf("%d\n", x.id);
        }
        printf("\n");
    }
}

Measured memory_bytes: 34024
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<n; i++)
#define REP(i,m,n) for(ll i=(ll)(m);i<(ll)(n);i++)
long long mo = 1e9 + 7;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<class A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}cout << "\n";}
ld PI=3.14159265358979323846;

ll N;
vector<vector<ll>> G(201);
vector<vector<ll>> d(201,vector<ll>(201, 1e18));
void warshall_floyd(int n) { // nは頂点数
  for (int i = 0; i < n; i++)      // 経由する頂点
    for (int j = 0; j < n; j++)    // 開始頂点
      for (int k = 0; k < n; k++)  // 終端
        d[j][k] = min(d[j][k], d[j][i] + d[i][k]);
}
vector<ll> memo(201,-1);
bool dfs(ll v, bool c){
    if(memo[v] == -1){
        memo[v] = c;
        bool flag = true;
        for(auto& u:G[v]){
            flag = (flag && dfs(u, !c));
        }
        return flag;
    }else if(memo[v] == ll(c)){
        return true;
    }else{
        return false;
    }
}

int main(){
    ll N;
    cin >> N;
    vector<string> S(N);
    rep(i,N){
        cin >> S[i];
    }
    rep(i,N){
        d[i][i] = 0;
        rep(j,N){
            if(S[i][j] == '1'){
                G[i].push_back(j);
                d[i][j] = 1;
            }
        }
    }
    if(!dfs(0, false)){
        cout << -1 << endl;
        return 0;
    }
    ll ans = 0;
    warshall_floyd(N);
    rep(i,N){
        rep(j,N){
            cmax(ans, d[i][j]);
        }
    }
    cout << ans+1 << endl;
    /*
    rep(i,N){
        queue<Pll> que;
        vector<ll> memo(N+1,-1);
        que.push(Pll(i,1));
        bool flag = false;
        ll M = 0;
        while(!que.empty()){
            ll v = que.front().first;
            ll c = que.front().second;
            que.pop();
            memo[v] = c;
            //cout << c << endl;
            cmax(M,c);
            for(auto& u:G[v]){
                if(memo[u] == c - 1){
                    continue;
                }else if(memo[u] != -1){
                    flag = true;
                    break;
                }
                que.push(Pll(u,c+1));
            }
            if(flag) break;
        }
        if(flag) continue;
        cmax(ans, M);
    }
    cout << ans << endl;*/
}

Measured memory_bytes: 4388
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<vector>
#include<map>
#include<set>
#include<string>
#include<queue>
#include<stack>
using namespace std;
#define MOD 1000000007
#define INF (1<<29)
#define EPS (1e-10)
typedef long long Int;
typedef pair<Int, Int> P;

#define max(x, y) ((x)>(y)?(x):(y))
#define min(x, y) ((x)<(y)?(x):(y))

double solve(double a, double b, Int k){
  if(k == 0)return 0;
  return b + (k +0.5)*a +solve(a + 2*a/k, b + (b+1.5*a) / k, k-1);
}
Int n;
double d, x;
int main(){
  cin >> n >> d >> x;
  printf("%.10lf\n", solve(x, d-x, n));
  return 0;
}

Measured memory_bytes: 6528
#include<stdio.h>


int main(){

  int n, b, f, r, v;
  int nor[4][3][10]={};
  int i, j, k;

  scanf("%d", &n);

  for(i=0;i<n;i++){
    scanf("%d %d %d %d", &b, &f, &r, &v);
    nor[b-1][f-1][r-1]+=v;
  }

  for(i=0;i<4;i++){
    for(j=0;j<3;j++){
      for(k=0;k<10;k++){
	printf(" %d", nor[i][j][k]);
      }
      printf("\n");
    }
    if(i!=3) printf("####################\n");
  }
  
  return 0;
}

Measured memory_bytes: 612
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
    int Q;
    cin >> Q;
    int c[Q], a[Q], n[Q];
    for (int i = 0; i < Q; i++) {
        cin >> c[i] >> a[i] >> n[i];
    }
    int s = 0;
    for (int i = 0; i < Q; i++) {
        s = min(c[i], min(a[i], n[i]));
        c[i] -= s;
        a[i] -= s;
        n[i] -= s;
        int t = min(c[i] / 2, a[i]);
        s += t;
        c[i] -= t * 2;
        s += c[i] / 3;
        cout << s << "\n";
    }
    return 0;
}


Measured memory_bytes: 3100
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
typedef long long ll;
#define fr(i,n) for(int i=0;i<n;i++)
#define MM 998244353

int main(){
  int n,w[1000000]={},e[1000000]={},b[1000000]={};
  string s;
  cin>>n>>s;
  fr(i,n){
    if(s[i]=='W'){w[i+1]=w[i]+1;e[i+1]=e[i];}
    else{w[i+1]=w[i];e[i+1]=e[i]+1;}
  }
  fr(i,n) b[i]=w[i]+e[n]-e[i+1];
  sort(b,b+n);
  cout<<b[0];
//  fr(i,n+1) cout<<w[i]<<endl;
}

Measured memory_bytes: 12548
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef pair<P,int> T;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
#define pb push_back
#define mp make_pair
#define eps 1e-9
#define INF 2000000000
#define sz(x) ((int)(x).size())
#define fi first
#define sec second
#define all(x) (x).begin(),(x).end()
#define sq(x) ((x)*(x))
#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define repn(i,a,n) for(int (i)=(a);(i)<(int)(n);(i)++)
#define EQ(a,b) (abs((a)-(b))<eps)
#define dump(X) cout << #X << ' ' << X << endl
#define pe(X) cout << X << endl
template<class T> void chmin(T& a,const T& b){if(a>b)a=b;}
template<class T> void chmax(T& a,const T& b){if(a<b)a=b;}
int N,D;
int x[13][13];
bool check(int a,int b){
	int sum = 0;
	for(int i=0;i<D;i++){
		sum += sq(x[a][i]-x[b][i]);
	}
	int k = (int)sqrt(sum);
	if(k*k==sum)return true;
	if(sq(k-1)==sum)return true;
	if(sq(k+1)==sum)return true;
	return false;
}
int main(){
	cin >> N >> D;
	for(int i=0;i<N;i++){
		for(int j=0;j<D;j++){
			cin >> x[i][j];
		}
	}
	int ans = 0;
	for(int i=0;i<N;i++){
		for(int j=i+1;j<N;j++){
			if(check(i,j))ans++;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,k,n) for(int i = (int)(k); i < (int)(n); i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(a) a.begin(), a.end()
#define MS(m,v) memset(m,v,sizeof(m))
typedef long long ll;
typedef long double ld;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef pair<ll, ll> pii;
const int MOD = 1000000007;
const int INF = MOD + 1;
const ld EPS = 1e-12;
template<class T> T &chmin(T &a, const T &b) { return a = min(a, b); }
template<class T> T &chmax(T &a, const T &b) { return a = max(a, b); }

/*--------------------template--------------------*/

template <typename T>
class FenwickTree {
	const int n;
	vector<T> data;
public:
	FenwickTree(int n) : n(n), data(n, 0) {}
	void add(int i, T value) {
		for (; i < n; i |= i + 1) data[i] += value;
	}
	T sum(int i) {
		T s = 0;
		for (; i >= 0; i = (i&(i + 1)) - 1) s += data[i];
		return s;
	}
};

int main()
{
	int n; cin >> n;
	vector<pii> to(n + 1);
	vi l(n);
	ll sum = 0;
	REP(i, n)
	{
		int a; cin >> a;
		sum += a;
		to[i + 1] = pii(sum, i);
	}
	REP(i, n) cin >> l[i];
	sort(ALL(to));
	REP(i, n)
	{
		if (to[i + 1].first- to[i].first < l[i])
		{
			cout << -1 << endl;
			return 0;
		}
	}
	FenwickTree<ll> bit(n);
	ll ans = 0;
	FOR(i, 1, n + 1)
	{
		ans += i - bit.sum(to[i].second) - 1;
		bit.add(to[i].second, 1);
	}
	cout << ans << endl;
}

Measured memory_bytes: 5992
#include <bits/stdc++.h>
using namespace std;
int main(){
  int w,h,n;
  cin>>w>>h>>n;
  vector<int> x(n),y(n),a(n);
  for(int i=0;i<n;i++){
    cin>>x.at(i)>>y.at(i)>>a.at(i);
  }
  int p1=0,p2=w,p3=0,p4=h;
  for(int i=0;i<n;i++){
    if(a.at(i)==1)p1=max(p1,x.at(i));
    if(a.at(i)==2)p2=min(p2,x.at(i));
    if(a.at(i)==3)p3=max(p3,y.at(i));
    if(a.at(i)==4)p4=min(p4,y.at(i));
  }
  int X=p2-p1,Y=p4-p3;
  if(X<=0 || Y<=0){
    cout<<0<<endl;
  }
  else{
    cout<<X*Y<<endl;
  }
  return 0;
}


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

int main(){
  int N;
  string S;
  cin>>N>>S;
  
  //1番左がリーダー
  int count=0;
  for(int i=1;i<N;i++){
    if(S.at(i)=='E'){
      count++;
    }
  }
  //cout<<count<<endl;
  
  //左から2番目、3番目・・・がリーダー
  int min_n=count;
  for(int i=1;i<N;i++){
    if(S.at(i-1)=='W'){
      count++;
    }
    if(S.at(i)=='E'){
      count--;
    }
    min_n=min(min_n,count);
  }
  cout<<min_n<<endl;
  return 0;
}

Measured memory_bytes: 900
#include<bits/stdc++.h>
using namespace std;
#define inf 1e9
#define ll long long
#define ull unsigned long long
#define M 1000000007
#define P pair<int,int>
#define PLL pair<ll,ll>
#define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++)
#define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--)
#define rep(i,n) FOR(i,0,n)
#define rrep(i,n) RFOR(i,n,0)
#define all(a) a.begin(),a.end()
const int vx[4] = {0,1,0,-1};
const int vy[4] = {1,0,-1,0};
#define PI 3.14159265


void f(double r,int n){
  double hl[100]={};
  double hr[100]={};
  double h[100]={};
  double b = 20;
  double ans = 30.0;
  rep(i,n){
    int x,y;
    double z;
    cin>>x>>y>>z;
    x+=b; y+=b;
    FOR(j,x+1,y){
      hl[j]=max(hl[j],z);
      hr[j]=max(hr[j],z);
    }
    hr[x]=max(hr[x],z);
    hl[y]=max(hl[y],z);
  }
  rep(i,100){
    h[i] = min(hl[i],hr[i]);
    if(i==b-r&&hr[i]>hl[i]) h[i] = hr[i];
    if(i==b+r&&hr[i]<hl[i]) h[i] = hl[i];
  }

  double i =b-r;

  while(i<b+r+1){
    double x = r+h[(int)i]-sqrt(r*r-(i-b)*(i-b));
    ans = min(ans,x);
    i +=1.0;
  }

  printf("%lf\n",ans);
}



int main(){
  double r,n;
  while(1){
    cin>>r>>n;
    if(r==0) break;
    f(r,n);
  }

  return 0;
}


Measured memory_bytes: 3148
(eval-when (:compile-toplevel :load-toplevel :execute)
  (defparameter OPT
    #+swank '(optimize (speed 3) (safety 2))
    #-swank '(optimize (speed 3) (safety 0) (debug 0)))
  #+swank (progn (ql:quickload '(:cl-debug-print))))
#+swank (cl-syntax:use-syntax cl-debug-print:debug-print-syntax)

(deftype int32 () '(signed-byte 32))
(deftype int64 () '(signed-byte 64))


;;macros
(defmacro println (n)
  `(format t "~a~%" ,n))
(defmacro vint-out (vec)
  `(progn
     (rep i (length ,vec)
          (princ (vref ,vec i))
          (princ " "))
     (fresh-line)))
(defmacro aif (test-form then-form &optional else-form)
  `(let ((it ,test-form))
     (if it ,then-form ,else-form)))

;;vector
(defmacro vec (type &optional (num 100) (val 0))
  (let* ((g (gensym)))
    `(let* ((,g ,num))
       (make-array ,g :element-type ',type :initial-element ,val
                   :adjustable nil :fill-pointer ,g))))

(defmacro double-vec (type &optional (dim1 100) (dim2 100) (val 0))
  `(make-array '(,dim1 ,dim2) :element-type ',type :initial-element ,val))

(defmacro vint (&optional (num 0) (val 0))
  `(vec int32 ,num ,val))

(defmacro double-vec (type &optional (dim1 100) (dim2 100) (val 0))
  `(make-array '(,dim1 ,dim2) :element-type ',type :initial-element ,val))

(defmacro vref (vector pos &optional value)
  (let ((g (gensym)))
    `(let ((,g ,value))
       (if ,g
           (setf (aref ,vector ,pos) ,g)
           (aref ,vector ,pos)))))

(defmacro chvar (sym comp predicate)
  (let ((g (gensym)))
    `(let ((,g ,comp))
       (if (or (null ,sym) (not (funcall ,predicate ,sym ,g)))
           (setf ,sym ,g)))))

(defmacro chmax (sym comp &optional (predicate #'>))
  `(chvar ,sym ,comp ,predicate))

(defmacro chmin (sym comp &optional (predicate #'<))
  `(chvar ,sym ,comp ,predicate))

(defmacro defchangef (name op default-val)
  `(defmacro ,name (var &optional (val ,default-val))
     `(setq ,var (,',op ,val ,var))))
(defmacro read-str ()
  `(write-to-string (read)))

;;本体
(defvar n (read))
(defvar w (vint n))
(defun main ()
  (dotimes (i n)
    (vref w i (read)))
  (println
   (loop for i below n
      minimize
        (abs (- (loop for j below i sum (vref w j))
                (loop for j from i below n
                   sum (vref w j)))))))
  
#-swank(main)


Measured memory_bytes: 22496
#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1ll << 60;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
#define vvi vector<vector<int>>
#define vp vector<pair<int, int>>
#define vvp vector<vector<pair<int, int>>>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define itn int
#define asn ans
bool dbg = false;

int a[10];

void solve() {
}

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

    for (int i = 0; i < 7; i++) {
        cin >> a[i];
    }
    int ans = a[1] + a[0] / 2 * 2 + a[3] / 2 * 2 + a[4] / 2 * 2;
    if (a[0] && a[3] && a[4]) {
        a[0]--;
        a[3]--;
        a[4]--;
        chmax(ans, 3 + a[1] + a[0] / 2 * 2 + a[3] / 2 * 2 + a[4] / 2 * 2);
    }
    cout << ans << endl;

    solve();
    return 0;
}


Measured memory_bytes: 3584
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>   
using namespace std;
using namespace __gnu_pbds;
typedef long long ll; 
#define int long long
typedef unsigned long long lu;
typedef vector<ll> v;
typedef vector<vector<ll> > vv;
typedef vector<string>  vs;
typedef vector<pair<ll,ll>> vpr;
typedef long double ld;
#define f(i,n) for(ll i = 0; i < n; i++)
#define ff(i,n) for(ll i=1;i<=n;i++)
#define pb push_back
#define mp make_pair
#define endl "\n"
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define amax(x,y) if(y>x) x=y;
#define amin(x,y) if(y<x)x=y;
#define bg(x) x.begin()
#define sz(x) (ll)x.size()
#define in(x,n) for(ll i=0;i<n;i++)cin>>x[i]
#define out(x,n) for(ll i=0;i<n;i++)cout<<x[i]<<" " 
#define mxt(a) *(max_element(a.begin(),a.end()))
#define mnt(a) *(min_element(a.begin(),a.end())
#define tc ll t;cin>>t;while(t--)
typedef pair<ll,ll> pi;
#define yes cout<<"Yes\n";
#define no cout<<"No\n";
#define yesno(f) if(f) yes else no
const v dx = {1, -1, 0, 0};
const v dy = {0, 0, 1, -1};
const ll mod=1e9+7;
const ld PI = 2 * acos(0.0);
ll m(ll a){ return (a+mod)%mod;}
ll cel(ll x1,ll y1){if((x1%y1)==0)return x1/y1;else return x1/y1+1;}
ll power(ll a,ll b,ll m)
{
    if(b==0)
        return 1;
    ll d=power(a,b/2,m);
    d=(d*d)%m;
    if(b&1)
        d=(d*a)%m;
    return d;
}
// set_name.find_by_order(k) It returns to an iterator to the kth element (counting from zero) in the set in O(logn) time
// set_name.order_of_key(k) It returns to the number of items that are strictly smaller than our item k in O(logn) time.
/*string operations :
str.substr (x,y) : returns a substring str[x],str[x+1],...str[x+y-1]
str.substr (x) : returns a substring str[x],... end of string
str.find(qtr) : returns the first occurenece of qtr in str */
int solve(){}
int32_t main()
{
    ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
    string str;cin>>str;
    yesno((str[2]==str[3] && str[4]==str[5]));
    return 0;
}

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

int main(){
	int n;
	double bunbo, bunsi;
	cin >> n;
	bunbo = 0;
	bunsi = 0;
	for(int i=1; i<=n; i++){
		bunbo++;
		if(i%2==1){
			bunsi++;
		}
	}
	cout << fixed << setprecision(10);
	cout << bunsi / bunbo << endl;
	return 0;
}

Measured memory_bytes: 256
n,*t=map(int,open(0).read().split());A=t[:n];B=t[n:];r=0
c=1
while c:
 c=0
 for i in range(n):b=B[~-i%n]+B[-~i%n];t=(A[i]<B[i]>b)*(B[i]-A[i])//b;c+=t;B[i]-=t*b
 r+=c
print([-1,r][A==B])

Measured memory_bytes: 126968
#JMD
#Nagendra Jha-4096

 
import sys
import math

#import fractions
#import numpy
 
###File Operations###
fileoperation=0
if(fileoperation):
    orig_stdout = sys.stdout
    orig_stdin = sys.stdin
    inputfile = open('W:/Competitive Programming/input.txt', 'r')
    outputfile = open('W:/Competitive Programming/output.txt', 'w')
    sys.stdin = inputfile
    sys.stdout = outputfile

###Defines...###
mod=1000000007
 
###FUF's...###
def nospace(l):
    ans=''.join(str(i) for i in l)
    return ans
 
 
 
##### Main ####
s=str(input())
ans="AC"
if(s[0]!="A"):
    ans="WA"
c=0
index=-1
for i in  range(2,len(s)-1):
    if(s[i]=="C"):
        c+=1
        index=i
if(c!=1):
    ans="WA"

for i in range(len(s)):
    if(ord(s[i])<ord('a')):
        #print(ord(s[i]),ord('a'))
        if(i!=0 and i !=index):
            ans="WA"
print(ans)

    
    
#####File Operations#####
if(fileoperation):
    sys.stdout = orig_stdout
    sys.stdin = orig_stdin
    inputfile.close()
    outputfile.close()

Measured memory_bytes: 3064
n = int(input())
ans = 0
for i in range(1,n+1):
    ans += i*(n+1-i)

for i in range(n-1):
    a,b = map(int,input().split())
    if b < a:
        a,b = b,a
    ans -= a*(n+1-b)
print(ans)

Measured memory_bytes: 9204
#include <stdio.h>
#define true 1
#define false 0
int isPrime(int);
int main(){
  int num,i,x,res = 0;
  scanf("%d",&num);
  for(i = 0 ; i < num; i++){
    scanf("%d",&x);
    if(isPrime(x) == true)res++;
  }
  printf("%d\n",res);
}
int isPrime(int x){
  int i;
  if(x < 2) return false;
  for(i = 2 ; i*i <= x ; i++)if(x % i == 0)return false;
  return true;
}


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

#define forn(i, n) for (int i = 0; i < int(n); ++i)
#define for1(i, n) for (int i = 1; i <= int(n); ++i)
#define ms(a, x) memset(a, x, sizeof(a))
#define F first
#define S second
#define all(x) (x).begin(),(x).end()

using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
mt19937 gen(chrono::steady_clock::now().time_since_epoch().count());
template<typename... Args> void rd(Args&... args) {((cin >> args), ...);}
template<typename... Args> void write(Args... args) { ((cout << args << " "), ...); cout<<endl;}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    auto p=[](ll x){
        return x*x*x*x*x;
    };
    ll x;
    cin>>x;
    for(int a=0;a<=6000;a++){
        for(int b=-6000;b<a;b++){
            if(p(a)-p(b)==x){
                cout<<a<<' '<<b;
                return 0;
            }
        }
    }
    return 0;
}



Measured memory_bytes: 3616
#include <iostream>
#include <bitset>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
using namespace std;
using ll = long long int;
using dd = long double;
const ll MOD = 1e9 + 7;

vector<string> dfs(string s, ll depth, vector<char> symbol)
{
    vector<string> ret;
    if (depth == 0)
    {
        ret.push_back(s);
        return ret;
    }

    for (ll i = 0; i < symbol.size(); i++)
    {
        auto vec = dfs(s + symbol[i], depth - 1, symbol);
        for (auto &&e : vec)
        {
            ret.push_back(e);
        }
    }
    return ret;
}

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

int main()
{
    char c;
    cin >> c;

    bool ok = false;
    string boin = "aiueo";

    for (ll i = 0; i < boin.size(); i++)
    {
        if (c == boin[i])
        {
            ok = true;
        }
    }

    if (ok)
    {
        cout << "vowel" << endl;
    }
    else
    {
        cout << "consonant" << endl;
    }
}

Measured memory_bytes: 256
N=int(input())
H=list(map(int,input().split()))
H.append(10**9+1)
c=0
m=0
for i in range(N):
    if H[i]<H[i+1]:
        m=max(m,c)
        c=0
        continue
    else:
        c+=1
print(m)

Measured memory_bytes: 20504
#include <bits/stdc++.h>
using namespace std;
int main(){
  int h,w,n,ans=0;
  cin >> n >> h >> w;
  cout << (n-h+1)*(n-w+1) << endl;
  // char c[h][w];
  // bool f[h][w];
  // for(int i=0;i<h;i++){
  //   for(int j=0;j<w;j++){
  //     f[i][j]=true;
  //     cin >> c[i][j];
  //   }
  // }
  // int black[h][w]={},white[h][w]={};
  // for(int i=0;i<h;i++){
  //   for(int j=0;j<w;j++){
  //     int cnt=0;
  //     if(c[i][j]=='#'){
  //       black[i][j]++;
  //     }else{
  //       white[i][j]++;
  //     }
  //     if(i<h-1){
  //       if(c[i+1][j]!=c[i][j]){
  //         if(f[i][j]){
  //           black[i+1][j]+=black[i][j];
  //           white[i+1][j]+=white[i][j];
  //         }else{
  //           if(c[i][j]=='#'){
  //             black[i+1][j]++;
  //           }else{
  //             white[i+1][j]++;
  //           }
  //         }
  //         cnt++;
  //       }
  //     }
  //     if(j<w-1){
  //       if(c[i][j+1]!=c[i][j]){
  //         black[i][j+1]+=black[i][j];
  //         white[i][j+1]+=white[i][j];
  //         cnt++;
  //       }
  //     }
  //     if(cnt==2){
  //       f[i][j+1]=false;
  //     }
  //   }
  // }
  // for(int i=0;i<h;i++){
  //   for(int j=0;j<w;j++){
  //     if(c[i][j]=='#'){
  //       ans+=white[i][j];
  //       // cout << white[i][j] << ' ';
  //     }else{
  //       ans+=black[i][j];
  //       // cout << black[i][j] << ' ';
  //     }
  //     cout << black[i][j] << ',' << white[i][j] << ' ';
  //   }
  //   cout << endl;
  // }

  // cout << ans << endl;
  return 0;
}


Measured memory_bytes: 256
package main

import (
	"fmt"
)

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

	m := n[len(n)-1:]
	switch {
	case m == "3":
		fmt.Println("bon")
	case m == "0" || m == "1" || m == "6" || m == "8":
		fmt.Println("pon")
	default:
		fmt.Println("hon")
	}
}


Measured memory_bytes: 1756