akhauriyash/Code-Regression huggingface dataset:
#include<iostream>
#include<vector>
#include<string>
#include<cmath>
#include<algorithm>
#include<numeric>
#include<map>
#include<unordered_map>
#include<queue>
#include<deque>
 
using namespace std;
using ll=long long;
#define rep(i,n)  for(ll i=0;i<n;++i)
#define all_map(itr,mp) for(auto itr=mp.begin();itr!=mp.end();itr++)
#define ALL(a) (a).begin(),(a).end()
 
int main(){
    ll n, m;
    cin >> n >> m;
    if(m < n)cout << "No";
    else cout << "Yes";
}

Measured memory_bytes: 256
#include<map>
#include<set>
#include<bitset>
#include<cstdio>
#include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<string>
#include<chrono>
#include<stack>
#include<fstream>
#include<list>
#define REP(i,x,y) for(ll i=x;i<=y;i++)
#define SIZE(a) ll(a.size())
#define vll vector<ll> 
#define MEMSET(a, n, m) for(ll i=0;i<=n;i++) a[i] = m
#define BIT(n) (ll(1)<<n)
#define UNIQUE(v) v.erase(unique(v.begin(),v.end()),v.end()) 
#define UNIQUE_ARRAY(a,n) n = unique(a + 1, a + x + 1) - a - 1
#define SORT(a,n) sort(a+1,a+n+1)
#define SORT_O(a,n,order) sort(a+1,a+n+1,order)
#define PER(i,y,x) for(ll i=y;i>=x;i--)
typedef long long ll;
using namespace std;

/*
struct point
{
long long dist; long long name;
bool operator<(const point& rhs) const {
return dist > rhs.dist;
}
};
*/

ll const MAX = 1e3 + 5;
ll dp[MAX][MAX] = {};
bool grid[MAX][MAX] = {};

ll const MOD = 1e9 + 7;

int main() {
	ll h, w;
	cin >> h >> w;
	REP(i, 1, h) {
		REP(j, 1, w) {
			char c; cin >> c;
			grid[i][j] = (c == '.');
		}
	}
	dp[1][1] = 1;
	REP(i, 1, h) {
		REP(j, 1, w) {
			if (i == 1 && j == 1)continue;
			if (grid[i][j]) {
				dp[i][j] = (dp[i - 1][j] + dp[i][j - 1]) % MOD;
			}
			else {
				dp[i][j] = 0;
			}
		}
	}
	cout << dp[h][w] << endl;
}

Measured memory_bytes: 9088
#include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<iomanip>
#include<bitset>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<ll,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define fi first
#define sc second
#define rep(i,x) for(ll i=0;i<x;i++)
#define repn(i,x) for(ll i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

const int MAX = 510000;
const int MOD = 1000000007;

// MAXの値に注意 !!!!!
long long fac[MAX], finv[MAX], inv[MAX];

// a^n mod を計算する
long long modpow(long long a, long long n, long long mod) {
    long long res = 1;
    while (n > 0) {
        if (n & 1) res = res * a % mod;
        a = a * a % mod;
        n >>= 1;
    }
    return res;
}


// テーブルを作る前処理
void COMinit() {
    fac[0] = fac[1] = 1;
    finv[0] = finv[1] = 1;
    inv[1] = 1;
    for (int i = 2; i < MAX; i++){
        fac[i] = fac[i - 1] * i % MOD;
        inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
        finv[i] = finv[i - 1] * inv[i] % MOD;
    }
}

// 二項係数計算
long long COM(int n, int k){
    if (n < k) return 0;
    if (n < 0 || k < 0) return 0;
    return fac[n] * (finv[k] * finv[n - k] % MOD) % MOD;
}

int main() {
    // 前処理
    COMinit();
    ll N , M; cin >> N >> M;
    ll ans = 0;
    for(ll i = 0; i <= N; i+= 2){
      ans += COM(N , i) * fac[M] % MOD * finv[M - i] % MOD
       * fac[M - i] % MOD * fac[M - i] % MOD
       * finv[M - N] % MOD * finv[M - N] % MOD;
       ans %= MOD;
    }
    for(ll i = 1; i <= N; i+= 2){
      ans -= COM(N , i) * fac[M] % MOD * finv[M - i] % MOD
       * fac[M - i] % MOD * fac[M - i] % MOD
       * finv[M - N] % MOD * finv[M - N] % MOD;
      ans += MOD;
      ans %= MOD;
    }
    ans %= MOD;
    cout << ans << endl;
}


Measured memory_bytes: 15596
import java.io.BufferedReader
import java.io.InputStream
import java.io.InputStreamReader
import java.io.PrintWriter
import java.lang.StringBuilder
import java.util.*

fun PrintWriter.solve(sc: FastScanner) {
    val n = sc.nextInt()
    val m = sc.nextInt()
    val size = (n - 1) / 2
    val ans = Array(size) { Array(2) { 0 } }
    if (n % 2 == 1) {
        for (i in 0 until size) {
            ans[i][0] = i + 1
            ans[i][1] = size * 2 - i
        }
    } else {
        for (i in 0 until size / 2) {
            ans[i][0] = i + 1
            ans[i][1] = n - 1 - i
        }
        for (i in size / 2 until size) {
            ans[i][0] = i + 1
            ans[i][1] = size * 2 - i
        }
    }
    for (i in 0 until m) {
        println(ans[i].joinToString(" "))
    }
}

fun main(args: Array<String>) {
    val writer = PrintWriter(System.out, false)
    writer.solve(FastScanner(System.`in`))
    writer.flush()
}

class FastScanner(s: InputStream) {
    private var st = StringTokenizer("")
    private val br = BufferedReader(InputStreamReader(s))

    fun next(): String {
        while (!st.hasMoreTokens()) st = StringTokenizer(br.readLine())

        return st.nextToken()
    }

    fun nextInt() = next().toInt()
    fun nextLong() = next().toLong()
    fun nextLine() = br.readLine()
    fun nextDouble() = next().toDouble()
    fun ready() = br.ready()
}

Measured memory_bytes: 60876
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.PriorityQueue;
import java.util.Queue;
import java.util.Scanner;
import java.util.stream.IntStream;

public class Main {

	public static void main(String[] args) {
		try (Scanner scanner = new Scanner(System.in)) {
			int n = scanner.nextInt();
			@SuppressWarnings("unchecked")
			List<Path>[] paths = new List[n];
			IntStream.range(0, n).forEach(i -> paths[i] = new ArrayList<>());
			IntStream.range(0, n - 1).forEach(i -> {
				paths[i].add(new Path(i, i + 1, 1));
				paths[i + 1].add(new Path(i + 1, i, 1));
			});
			int x = scanner.nextInt() - 1, y = scanner.nextInt() - 1;
			paths[x].add(new Path(x, y, 1));
			paths[y].add(new Path(y, x, 1));
			int[][] costs = new int[n][];
			IntStream.range(0, n).forEach(i -> costs[i] = dijkstra(paths, i, n));
			int[] answer = new int[n - 1];
			Arrays.fill(answer, 0);
			IntStream.range(0, n).forEach(i -> IntStream.range(0, i).forEach(j -> answer[costs[i][j] - 1]++));
			Arrays.stream(answer).forEach(System.out::println);
		}
	}

	/**
	 * @param pathLists ノード間の連結パス一覧の配列
	 * @param src       開始ノード
	 * @param n         ノードの数
	 * @return 開始ノードからの距離の配列
	 */
	private static int[] dijkstra(List<Path>[] pathLists, int src, int n) {
		int[] distances = new int[n];
		Arrays.fill(distances, Integer.MAX_VALUE);
		// 最短距離が確定したかどうか
		boolean[] fixed = new boolean[n];
		Arrays.fill(fixed, false);
		// 出発地点までの距離を0とする
		distances[src] = 0;
		Queue<Path> queue = new PriorityQueue<>();
		queue.add(new Path(src, src, 0));
		while (!queue.isEmpty()) {
			int now = queue.poll().to;
			if (!fixed[now]) {
				fixed[now] = true;
				for (Path path : pathLists[now]) {
					if (!fixed[path.to] && distances[path.to] > distances[now] + path.cost) {
						distances[path.to] = distances[now] + path.cost;
						queue.add(new Path(path.to, path.to, distances[path.to]));
					}
				}
			}
		}
		return distances;
	}

	/**
	 * ノード間の一つのパスを表すクラス
	 */
	private static class Path implements Comparable<Path> {
		/** 開始ノード */
		@SuppressWarnings("unused")
		int from;
		/** 終了ノード */
		int to;
		/** 移動コスト */
		int cost;

		Path(int from, int to, int cost) {
			super();
			this.from = from;
			this.to = to;
			this.cost = cost;
		}

		@Override
		public int compareTo(Path path) {
			return this.cost - path.cost;
		}
	}
}


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

int p,n[6];
int m[] = {1,5,10,50,100,500};
int changeMemo[1000001];

//ツ催渉ャツづ個津楪銭ツづ個鳴青板づーツ陛板つキ
int change(int x){
	int res = 0;
	for(int i=5;i>=0;i--){
		res += x / m[i];
		x -= m[i] * (x / m[i]);
	}
	return res;
}

//ツ篠ゥツ閉ェツつェツ篠敖づづつ「ツづゥツ硬ツ嘉敖づ可ソツ格ツづーツつソツづ・ツつ、ツづ支ツ閉・ツつヲツづゥツつゥツづ個板サツ津ィ
int pay(int x){
	int res = 0;

	for(int i=5;i>=0;i--){
		int tmp = x / m[i];

		if(tmp <= n[i]){
			res += tmp;
			x -= m[i] * tmp;
		}
		else{
			res += n[i];
			x -= m[i] * n[i];
		}
	}

	return x==0 ? res : -1;
}

int main(void){
	while(scanf("%d",&p),p){
		int sum = 0;
		for(int i=0;i<6;i++){
			scanf("%d",&n[i]);
			sum += n[i] * m[i];
		}

		int ans = 999999999;
		for(int i=p;i<=sum;i++){
			int tmp = pay(i);
			if(tmp != -1){
				if(i!=p){
					if(changeMemo[i-p]==0) changeMemo[i-p] = change(i-p);
					tmp += changeMemo[i-p];
				}
				if(ans > tmp) ans = tmp;
			}
		}

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

	return 0;
}

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

int main() {
  string s;
  cin >> s;
  int n = s.size();
  int x = 0;
  for (int i = 0; i < n; i++) {
    if (i % 2 == 0 && (s.at(i) == 'R' || s.at(i) == 'U' || s.at(i) == 'D')) {
		continue;
    }
    else if (i % 2 == 1 && (s.at(i) == 'L' || s.at(i) == 'U' || s.at(i) == 'D')) {
		continue;
    }
      x++;
      cout<<"No"<<endl;
      break;
  }
  if (x == 0)
    cout<<"Yes"<<endl;
  
}


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

#define MOD_1_000_000_007 (1000000007LL)
#define LINF (1LL<<60)
#define rep(i, n)   for (long long i = 0; i <  (long long)(n); i++)
#define rep1(i, n)  for (long long i = 1; i <  (long long)(n); i++)
#define rep2(i, n)  for (long long i = 2; i <  (long long)(n); i++)
#define rep0c(i, n) for (long long i = 0; i <= (long long)(n); i++)
#define rep1c(i, n) for (long long i = 1; i <= (long long)(n); i++)
#define rep2c(i, n) for (long long i = 2; i <= (long long)(n); i++)
#define repc0(n, i) for (long long i = (long long)(n); i >= 0; i--)
#define repc1(n, i) for (long long i = (long long)(n); i >= 1; i--)
#define repc2(n, i) for (long long i = (long long)(n); i >= 2; i--)
#define REP(i, n, m) for (long long i = (long long)(n); i < (long long)(m); i++)

namespace solver {
  using namespace std;
  typedef long long ll;

  ll N;
  set<string> S;

  void init() {
    scanf("%lld", &N);
    rep(i, N) {
      string s;
      cin >> s;
      S.insert(s);
    }
  }

  void solve() {
    cout << S.size() << endl;
  }
}

int main() {
  solver::init();
  solver::solve();
  return 0;
}

Measured memory_bytes: 19320
#include<stdio.h>
#include<string.h>

int main(){
	char str[1001];
	char order[32];
	char p[1001];
	int a,b;
	int q,loop;
	int i,j;
	
	scanf("%s",str);
	scanf("%d",&q);
	for(loop=1;loop<=q;loop++){
		scanf("%s %d %d",order,&a,&b);
		if(strcmp(order,"print")==0){
			for(i=a;i<=b;i++){
				printf("%c",str[i]);
			}
			printf("\n");
		}
		else if(strcmp(order,"reverse")==0){
			j=0;
			for(i=a;i<=b;i++){
				p[j]=str[b-j];
				j++;
			}
			j=0;
			for(i=a;i<=b;i++){
				str[i]=p[j];
				j++;
			}
		}
		else{
			scanf("%s",p);
			j=0;
			for(i=a;i<=b;i++){
				str[i]=p[j];
				j++;
			}
		}
	}
	
	return 0;
}

Measured memory_bytes: 572
#include<bits/stdc++.h>
typedef long long ll;
typedef long double ld;
#define FASTIO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define PRECISION std::cout << std::fixed << std::setprecision(2);
  
using namespace std;
 
const ll inf = 1e18;
const ll N = 15;
const ll bits = 63;
const ll mod = 1e9+7;
const ld pi = 3.14159265358979323846;



int main(){
    // FASTIO;

    string s,t;

    int n;
    cin>>n;

    cin>>s>>t;

    for(int i=0;i<s.size();i++){
        cout<<s[i]<<t[i];
    }

    cout<<"\n";

    


    

}


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

#define rep(i, n) for(int i = 0; i<(n); i++)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
using namespace std;
using ll = long long;


int main() {
    int N;
    string P, Q;
    cin >> N;
    rep(_, N) {
        string s;
        cin >> s;
        P += s;
    }

    rep(_, N) {
        string s;
        cin >> s;
        Q += s;
    }

    vector<int> v(N);
    rep(i, N) v[i] = i + 1;
    set<string> se;
    do {
        string S;
        rep(i, N) S += v[i] + '0';
        se.insert(S);
    } while (next_permutation(v.begin(), v.end()));

    int a = distance(se.begin(), se.find(P));
    int b = distance(se.begin(), se.find(Q));
    cout << abs(a - b) << endl;
}


Measured memory_bytes: 3968
N = int(input())

L = [list(input()) for _ in range(N)]

dic = []
flag = {}
res = 0
for i in range(N):
    L[i].sort()

    if str(L[i]) in flag:
        flag[str(L[i])] += 1
        res += flag[str(L[i])]
    else:
        dic.append(L[i])
        flag[str(L[i])] = 0

print(res)


Measured memory_bytes: 43780
import itertools
n = int(input())
data = []
for x in range(n):
    for y in range(int(input())):
        k, l = map(int, input().split())
        data.append((x, k - 1, l))
ans = 0
for i in itertools.product([1,0], repeat=n):
    s = sum(list(i))
    if ans > s:
        continue
    for g in data:
        if i[g[0]] == 1 and i[g[1]] != g[2]:
            s = 0
            break
    ans = max(ans, s)
print(ans)

Measured memory_bytes: 3064
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define Int int64_t
#define dump(x) cout << (x) << endl
Int mod = 1e9+7;

int main() {
    Int n, m;
    cin >> n >> m;
    vector<Int> v[11];
    vector<Int> k(m);
    for (Int i = 0; i < m; i++) {
        cin >> k[i];
        for (Int j = 0; j < k[i]; j++) {
            Int s;
            cin >> s;
            v[i].emplace_back(s);
        }
    }
    vector<Int> p(m);
    for (Int i = 0; i < m; i++) cin >> p[i];
    Int res = 0;
    for (Int bit = 0; bit < (1<<n); bit++) {
        bool all = true;
        for (Int i = 0; i < m; i++) {
            Int cnt = 0;
            for (Int j = 0; j < k[i]; j++) {
                if (bit & (1<<(v[i][j] - 1))) cnt++;
            }
            //dump(cnt);
            if (cnt % 2 != p[i]) all = false;
        }
        if (all) res++;
    }
    dump(res);
    return 0;
}

Measured memory_bytes: 256
import static java.lang.System.*;
import java.util.*;

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

        int n = sc.nextInt();
		int q = sc.nextInt();
		
		String s = sc.next();
		int[] count = new int[n];
		Arrays.fill(count, 0);
		for(int i=1; i<n; i++) {
			if(s.charAt(i-1) == 'A' && s.charAt(i) == 'C') count[i] = count[i-1] + 1;
			else count[i] = count[i-1];
		}
		
		for(int i=0; i<q; i++) {
			int l = sc.nextInt()-1;
			int r = sc.nextInt()-1;
			
			out.println(count[r]-count[l]);
		}
	}
}


Measured memory_bytes: 67016
#include "bits/stdc++.h"
using namespace std;
#define ll long long int
#define rep(i,n) for( int i = 0; i < n; i++ )
#define rrep(i,n) for( int i = n; i >= 0; i-- )
#define REP(i,s,t) for( int i = s; i <= t; i++ )
#define RREP(i,s,t) for( int i = s; i >= t; i-- )
#define dump(x)  cerr << #x << " = " << (x) << endl;
#define INF 2000000000
#define mod 1000000007
#define INF2 1000000000000000000
#define int long long

vector<int> A(500010);
int dp[500010][5];

int cost(int i, int s) {
    if (s == 0 || s == 4) return A[i];
    else if (s == 1 || s == 3) {
        if (A[i] % 2 == 0 && A[i] > 0) return 0;
        else if (A[i] > 0) return 1;
        else return 2;
    }
    else {
        if (A[i] % 2 == 0) return 1;
        else return 0;
    }
}


signed main(void)
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    int L; cin >> L;
    rep(i, L) cin >> A[i];
    rep(i, 500010) rep(j, 5) dp[i][j] = INF;
    dp[0][0] = 0; 
    rep(i, L) {
        rep(j, 5)  {
            REP(k, j, 4) {
                dp[i + 1][k] = min(dp[i + 1][k], dp[i][j] + cost(i, k));
            }
        }
    }
    /*
    rep(i, L + 1) {
        rep(j, 5) {
            cout << dp[i][j] << " ";
        }
        cout << endl;
    }
    */
    int ans = INF;
    rep(i, 5) ans = min(ans, dp[L][i]);
    cout << ans << endl;

    return 0;
}


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

int main() {
    int n;
    string s;
    cin >> s;
    n = s.size();
    vector<int> ans(n);
    rep(ri,2){ // R と L を入れ替えて、 solve R を使い回す
        { // solve R
            int cnt = 0;
            rep(i,n){
                if(s[i]=='R') cnt++;
                else{ // s[i]=='L' 切り替わりタイミングを見つけたら、それまでの精算を
                    ans[i] += cnt/2;
                    ans[i-1] += (cnt+1)/2;
                    cnt=0;
                }
            }

        }

        // 左から右へカウントしていきたいので、ans も s も s の内容も全て逆転させてもう一度
        reverse(ans.begin(), ans.end());
        reverse(s.begin(),s.end());
        rep(i,n){
            if(s[i]=='L') s[i] = 'R';
            else s[i] = 'L';
        }
    }

    rep(i,n){
        printf("%d%c", ans[i], i==n-1?'\n':' ');
    }

    return 0;
}

Measured memory_bytes: 1024
#include <iostream>

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

	int64_t sum = 0;
	for (int i = 0; i < M; i++)
	{
		int temp;
		std::cin >> temp;
		sum += temp;
	}

	if (sum <= N)
	{
		std::cout << N - sum << std::endl;
	}
	else
	{
		std::cout << -1 << std::endl;
	}

	return 0;
}

Measured memory_bytes: 3616
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String {
            bytes
                .by_ref()
                .map(|r| r.unwrap() as char)
                .skip_while(|c| c.is_whitespace())
                .take_while(|c| !c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, [ $t:tt ]) => {
        {
            let len = read_value!($next, usize);
            (0..len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
        }
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

use std::cmp::min;

fn main() {
    input!{
        s: chars
    }
    let mut a1 = 0;
    let mut a2 = 0;
    for i in 0..s.len() {
        if i % 2 == s[i].to_digit(10u32).unwrap() as usize {
            a1 += 1;
        } else {
            a2 += 1;
        }
    }
    println!("{}", min(a1, a2));
}


Measured memory_bytes: 4352
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    int N;
    cin >> N;
    vector<int> ps{2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97};
    vector<int> a(ps.size());
    for ( int i = 0; i < ps.size(); i++ ) {
        int r = N;
        while ( r > 0 ) {
            r /= ps[i];
            a[i] += r;
        }
    }

    int c74 = 0, c24 = 0, c14 = 0, c4 = 0, c2 = 0;
    for ( int i = 0; i < ps.size(); i++ ) {
        if ( a[i] >= 74 ) c74++;
        if ( a[i] >= 24 ) c24++;
        if ( a[i] >= 14 ) c14++;
        if ( a[i] >= 4 ) c4++;
        if ( a[i] >= 2 ) c2++;
        else break;
    }

    ll ans = 0;
    ans += c74;
    if ( c2 >= 1 ) ans += c24 * ( c2 - 1 );
    if ( c4 >= 1 ) ans += c14 * ( c4 - 1 );
    if ( c2 >= 3 && c4 >= 2 ) ans += c4 * ( c4 - 1 ) / 2 * ( c2 - 2 );

    cout << ans << '\n';
    return 0;
}

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

using namespace std;

int main() {
int H,W;
cin>>H>>W;
char s[60][60];
int a=0;
for(int i=1;i<=H;i++){
   for(int j=1;j<=W;j++){
      cin>>s[i][j];
   }
}
for(int i=1;i<=H;i++){
   for(int j=1;j<=W;j++){
      if(s[i][j]=='#'&&s[i-1][j]!='#'&&s[i+1][j]!='#'&&s[i][j-1]!='#'&&s[i][j+1]!='#'){
         a++;
      }
   }
}
if(a==0){
   cout<<"Yes"<<endl;
}
else{
   cout<<"No"<<endl;
}


   return 0;
}






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

namespace D
{
    class Program
    {
        static Tree[] tree;
        static void Main(string[] args)
        {
            int[] NQ = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
            int N = NQ[0];
            int Q = NQ[1];

            tree = new Tree[N + 1];
            for (var i = 0; i <= N; i++)
            {
                tree[i] = new Tree();
            }

            // 木構造作成
            List<Tuple<int, int>> AB = Enumerable.Range(0, N - 1)
                .Select(i =>
                {
                    int[] ab = Console.ReadLine().Split().Select(j => int.Parse(j)).ToArray();
                    return new Tuple<int, int>(ab[0], ab[1]);
                }).ToList();
            for (var i = 0; i < N - 1; i++)
            {
                tree[AB[i].Item1].children.Add(AB[i].Item2);
            }
            for (var i = 0; i < Q; i++)
            {
                int[] PQ = Console.ReadLine().Split().Select(j => int.Parse(j)).ToArray();
                tree[PQ[0]].counter += PQ[1];
            }
            for (var i = 1; i < N + 1; i++)
            {
                foreach (var j in tree[i].children)
                {
                    tree[j].counter += tree[i].counter;
                }
            }
            for (var i = 1; i <= N; i++)
            {
                Console.Write($"{tree[i].counter} ");
            }
        }

        static void AddParam(HashSet<int> children, int param)
        {
            foreach (var i in children)
            {
                if (tree[i].children.Count != 0)
                {
                    AddParam(tree[i].children, param);
                }
                tree[i].counter += param;
            }
        }
    }

    class Tree
    {
        public int parent;
        public HashSet<int> children = new HashSet<int>();
        public long counter;
    }
}


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

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> vi;
typedef vector<vi> vii;
typedef vector<string> vs;
typedef vector<bool> vb;
typedef vector<vb> vbb;
typedef pair<int, int> pii;
typedef long long ll;
typedef unsigned long long ull;

//container util
//------------------------------------------
#define all(a)  (a).begin(),(a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define pb push_back
#define mp make_pair
#define iter(i,c) for(auto i=(c).begin(); i!=(c).end(); ++i)

//repetition
//------------------------------------------
#define loop(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  loop(i,0,n)

//constant
//--------------------------------------------
const double eps = 1e-10;
const double pi  = acos(-1.0);
const double inf = (int)1e8;

// output vector
// ------------------------------------------
namespace std {
    template<typename T> ostream & operator<<(ostream& os, vector<T> const& v){
        for(auto it=v.begin(); it!=v.end(); ++it){
            os << *it << (it+1==v.end() ? "" : ",");
        }
        return os;
    }
}

//clear memory
#define clr(a) memset((a), 0 ,sizeof(a))

int lcm(int a,int b){
   return a*b/__gcd(a,b);
}
 
vb pn((int)1e4+10); 
void prime_number(int n){
   fill(all(pn),true);
   pn[0]=false;pn[1]=false;
   loop(i,2,n/2+1){
      if(!pn[i]) continue;
      for(int j=2;i*j<=n;j++){
         pn[i*j]=false;
      }
   }
}

int main(){
   int n,ans;
   
   while(cin>>n){
      if(n==0) break; ans=0;
      
      for(int i=1;pow(5,i)<=n;i++){
         ans+=n/pow(5,i);
      }
      
      cout<<ans<<endl;
   }
   
   return 0;
}

Measured memory_bytes: 1244
#include <iostream>
#include <string>
using namespace std;
int main(){
	int n;
	string r[52]={"a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};
	while(cin>>n){
		if(n==0) break;
		int a[n];
		for(int i=0;i<n;i++){
			cin>>a[i];
		}
		string s;
		cin>>s;
		int len=s.size();
		for(int i=0;i<len;i++){
			string si=s.substr(i,1);
			for(int j=0;j<52;j++){
				if(r[j]==si){
					cout<<r[(j-a[i%n]+52)%52];
					break;
				}
			}
		}
		cout<<endl;
	}
    return 0;
}

Measured memory_bytes: 1212
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Linq;
using System.Collections.Generic;

class Program
{
    const string Yes = "Yes";
    const string No = "No";
    const long Mod = 1000000007;
    static void Main(string[] args) {
#if DEBUG
        MyDebugger.Test(process, "../TextFile1.txt");
        //MyDebugger.Test(process, "../TextFile2.txt");
        //MyDebugger.MakeTestCase("../TextFile2.txt");
#else
        object ret = process(new StreamReader(Console.OpenStandardInput()));
        Console.WriteLine(ret);
#endif
    }

    static object process(TextReader input) {
        var n = int.Parse(input.ReadLine());
        var ary = ToIntArray(input.ReadLine(), n-1);

        var y = new long[n+1];

        foreach(int x in ary) {
            y[x]++;
        }

        var buil = new StringBuilder();
        for(int i = 1; i <= n; i++) {
            buil.AppendLine(y[i].ToString());
        }

        return buil;
    }

    static long[] ToIntArray(string strs, int n) {
        var ret = new long[n];
        var spl = strs.Split(' ');
        for (int i = 0; i < n; i++)
            ret[i] = long.Parse(spl[i]);
        return ret;
    }
}


Measured memory_bytes: 45904
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pll;
#define Max 1000001
#define inf INT_MAX
#define llinf LONG_LONG_MAX
#define rep(i,a,b) for(i=a;i<=b;i++)
#define rrep(i,a,b) for(i=a;i>=b;i--)
#define fast ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define pb push_back
#define pf push_front
#define F first
#define S second
#define ub upper_bound
#define lb lower_bound
#define all(v) v.begin(),v.end()
#define PI 3.14159265358979311599796346854418516159057617187500
const ll N=1e5+5,mod=1000000007;
ll f(ll n)
{
	ll ans=0;
	while(n)
	{
		n/=10;
		ans++;
	}
	return ans;
}
signed main()
{
    fast;
    ll pro=1,temp,t,n,m,k,i,j,l,r,mid,x,y,z,rem,carry=0,ind,ans=0,mx=-llinf,mn=llinf,cnt=0,curr=0,prev,sum=0,flag=1,i1=-1,i2=-1;
    cin>>n;
    rep(i,1,n)
    {
    	if(f(i)%2)
    	{
    		ans++;
    	}
    }
    cout<<ans;
	return 0;
} 

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define INF 2000000000
#define MOD 1000000007
#define MAXN 200005
#define REP(temp, init_val, end_val) for (int temp = init_val; temp <= end_val; ++temp)
#define REPR(temp, init_val, end_val) for (int temp = init_val; temp >= end_val; --temp)
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> intpair;
int read(){
    int f = 1, x = 0;
    char c = getchar();
    while (c < '0' || c > '9'){if(c == '-') f = -f; c = getchar();}
    while (c >= '0' && c <= '9')x = x * 10 + c - '0', c = getchar();
    return f * x; 
}
inline int lowbit(int x){
    return x & (-x);
}
inline int modadd(int x, int y){
    return (x + y >= MOD ? x + y - MOD: x + y);
}
inline int sgn(int x){
    return (x < 0 ? -1: (x > 0 ? 1: 0));
}
template<typename T>
T gcd(T a, T b){
    return (!b) ? a: gcd(b, a % b);
}
int poww(int a, int b){
    int res = 1;
    while (b > 0){
        if (b & 1) res = 1ll * res * a % MOD;
        a = 1ll * a * a % MOD, b >>= 1;
    }
    return res;
}
const int dx[] = {-1, 0, 1, 0}, dy[] = {0, 1, 0, -1};
const int ddx[] = {-1, -1, -1, 0, 0, 1, 1, 1}, ddy[] = {-1, 0, 1, -1, 1, -1, 0, 1};

/*--------------------------------------------------------------------*/
/*--------------------------------------------------------------------*/

int n;
void init(){
    n = read();
}
void solve(){
    if (n >= 30) cout << "Yes" << endl;
    else cout << "No" << endl;
}
int main(){
    init();
    solve();
    return 0;
}

Measured memory_bytes: 3620
#include <iostream>

using namespace std;

int main(){
	int N;
	while(cin >> N){
		int cnt = 0, prev = 0;
		int res = 0;
		for(int i=0;i<N;i++){
			int A; cin >> A;
			if(A != prev){
				prev = A;
				res += cnt / 2;
				cnt = 1;
			} else {
				++cnt;
			}
		}
		res += cnt / 2;
		cout << res << endl;
	}
}


Measured memory_bytes: 256
import java.util.*;

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

    int N = sc.nextInt();
    int H[] = new int[N];
    int max = 0;
    
    for(int i=0; i<N; i++){
      H[i]=sc.nextInt();
      
      if(max - H[i] > 1){
        System.out.println("No");
        return;
      }
      
      max = Math.max(max, H[i]);
    }
    
    System.out.println("Yes");
  }
} 
    

Measured memory_bytes: 59564
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		//List<String> list= new ArrayList<String>(Arrays.asList(s.split("")));
		//List<Integer> list=new ArrayList<Integer>();
		//Integer[] array = new Integer[m];
		double d = sc.nextDouble();
		int n = sc.nextInt();
		d = Math.pow(100, d);
		if(n==100) {
			System.out.println((int)d*n+(int)d);
		}
		else {
			System.out.println((int)d*n);
		}
	}
}

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

int main(){
  int a,b,c;
  cin>>a>>b>>c;
  cout<<a*b/2<<endl;
  return 0;
}

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

ll gcd(ll a, ll b) { return b?gcd(b,a%b):a;}
ll lcm(ll a, ll b) { return a/gcd(a,b)*b;}


int main(){
  ll n, k;
  cin >> n >> k;
  vector<ll> p(n);
  rep(i,n) cin >> p[i];
  sort(p.begin(), p.end(), less<ll>());

  ll ans = 0;
  rep(i,k){
    ans += p[i];
  }

  cout << ans << endl;

  return 0;
} 



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

struct Card{
  char suit, value;
};

void bubbleSort(struct Card A[], int N){
  for(int i = 0; i < N; i++){
    for(int j = N - 1; j >= i + 1; j--){
      if(A[j].value < A[j - 1].value){
        Card t = A[j]; A[j] = A[j - 1]; A[j - 1] = t;
      }
    }
  }
}

void selectionSort(struct Card A[], int N){
  for(int i = 0; i < N; i++){
    int minj = i;
    for(int j = i; j < N; j++){
      if(A[j].value < A[minj].value)
        minj = j;
    }
    Card t = A[i]; A[i] = A[minj]; A[minj] = t;
  }
}

void print(struct Card A[], int N){
  for(int i = 0; i < N; i++){
    if(i > 0)
      cout << " ";
    cout << A[i].suit << A[i].value;
  }
  cout << endl;
}
       

bool isStable(struct Card C1[], struct Card C2[], int N){
  for(int i = 0; i < N; i++){
    if(C1[i].suit != C2[i].suit)
      return false;
  }
  return true;
}

int main(){
  Card C1[100],C2[100];
  int N;
  char ch;
  cin >> N;
  for(int i = 0; i < N; i++)
    cin >> C1[i].suit >> C1[i].value;

  for(int i = 0; i < N; i++)
    C2[i] = C1[i];

  bubbleSort(C1,N);
  selectionSort(C2,N);
  print(C1,N);
  cout << "Stable" << endl;
  print(C2,N);
  if(isStable(C1,C2,N)){
    cout << "Stable" << endl;
  }else{
    cout << "Not stable" << endl;  
  }
  return 0;
}



Measured memory_bytes: 3100
/**
 * code generated by JHelper
 * More info: https://github.com/AlexeyDmitriev/JHelper
 * @author Rishabhdeep Singh
 */

// doot diddly donger cuckerino Hahahahahah
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#pragma GCC target("popcnt")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace __gnu_pbds;
using namespace __gnu_cxx;
using namespace std;

// @formatter:off
#define PB              push_back
#define EB              emplace_back
#define F               first
#define S               second
#define all(x)          (x).begin(), (x).end()
#define rall(x)         rbegin(x), rend(x)
#define sz(x)           (long long) (x).size()
#define NL              << '\n'
#define IOS             ios::sync_with_stdio(false);cin.tie(NULL); cout << fixed << setprecision(12);
#define IN_REP          int tt; cin >> tt; while(tt--)
#define sim             template<typename T
#define ris             return *this
#define dor             > debug & operator <<
#define eni(x)          sim > typename enable_if<sizeof dud<T>(0) x 1, debug&>::type operator<<(T i)
sim> struct rge { T b, e; };
sim> rge<T> range(T i, T j) { return rge<T>{i, j}; }
sim> auto dud(T *x) -> decltype(cerr << *x, 0);
sim> char dud(...);
struct debug {
#ifdef LOCAL
  ~debug() { cerr << endl; }
  eni(!=) { cerr << boolalpha << i; ris; }
  eni(==) { ris << range(all(i)); }
  sim, typename U dor(pair<U, T> d) { ris << "(" << d.first << ", " << d.second << ")"; }
  sim dor(rge<T> d) { *this << "["; for (auto it = d.b; it != d.e; ++it) *this << ", " + 2 * (it == d.b) << *it; ris << "]"; }
#else
  sim dor(const T&) { ris; }
#endif
};
#define pr(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

using ll = long long;
using ull = unsigned long long;
using ld = long double;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using vi = vector<int>;
using vb = vector<bool>;

using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using vpii = vector<pii>;
using vpll = vector<pll>;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

const ld PI = acos(-1);

template<typename T> T gcd(T x, T y) { return (y == 0) ? x : gcd(y, x % y); }
template<typename T> void mini(T& x, T y) { x = min(x, y); }
template<typename T> void maxi(T& x, T y) { x = max(x, y); }
template<typename T, typename U> string to_string(pair<T, U> p) { return to_string(p.F) + " " + to_string(p.S); }
mt19937 rnd(chrono::high_resolution_clock::now().time_since_epoch().count());
// @formatter:on


class ALucky7 {
 public:

  auto solveOne(istream &cin, ostream &cout) {
    string s;
    cin >> s;
    return count(all(s), '7');
  }

  void solve(std::istream& cin, std::ostream& cout) {
//	int t;
//	cin >> t;
//    for(int tc = 1; tc <= t; ++tc) {
      auto res = solveOne(cin, cout);
      cout << (res ? "Yes" : "No") << '\n';
//    }
  }
};

int main() {
    IOS;
	ALucky7 solver;
	std::istream& in(std::cin);
	std::ostream& out(std::cout);
	solver.solve(in, out);
	return 0;
}


Measured memory_bytes: 3660
#include<iostream>
#include<string>
#include<sstream>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<cmath>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
#include<numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
using ll = long long;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;
int dx[4] = {1,0,-1,0}, dy[4] = {0,1,0,-1};

int main()
{

    int X,Y,A,B,C;
    cin >> X >> Y >> A >> B >> C;
    // ll p[A],q[B],r[C];
    // ll p[100005]={},q[100005]={},r[100005]={};
    vector<ll> p,q,r;
    // for(int i=0; i<A; ++i) cin >> p[i];
    // for(int i=0; i<B; ++i) cin >> q[i];
    // for(int i=0; i<C; ++i) cin >> r[i];
    for(int i=0; i<A; ++i)
    {
        ll tmp; cin >> tmp;
        p.push_back(tmp);
    }
    for(int i=0; i<B; ++i)
    {
        ll tmp; cin >> tmp;
        q.push_back(tmp);
    }
    for(int i=0; i<C; ++i)
    {
        ll tmp; cin >> tmp;
        r.push_back(tmp);
    }

    // sort(p,p+A,greater<ll>());
    // sort(q,q+B,greater<ll>());
    // sort(r,r+C,greater<ll>());
    sort(p.begin(),p.end(),greater<ll>());
    sort(q.begin(),q.end(),greater<ll>());
    sort(r.begin(),r.end(),greater<ll>());

    vector<ll> all;
    for(int i=0; i<X; ++i)  all.push_back(p[i]);
    for(int i=0; i<Y; ++i)  all.push_back(q[i]);
    for(int i=0; i<C; ++i)  all.push_back(r[i]);

    sort(all.begin(),all.end(), greater<ll>());
    ll ans = 0;
    for(int i=0; i<X+Y; ++i) ans += all[i];
    
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 8688
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using PII = pair<ll, ll>;
#define FOR(i, a, n) for (ll i = (ll)a; i < (ll)n; ++i)
#define REP(i, n) FOR(i, 0, n)
#define ALL(x) x.begin(), x.end()
template<typename T> void chmin(T &a, const T &b) { a = min(a, b); }
template<typename T> void chmax(T &a, const T &b) { a = max(a, b); }
struct FastIO {FastIO() { cin.tie(0); ios::sync_with_stdio(0); }}fastiofastio;
#ifdef DEBUG_ 
#include "../program_contest_library/memo/dump.hpp"
#else
#define dump(...)
#endif
const ll INF = 1LL<<60;


// 「SとS[i:|S|-1]の最長共通接頭辞の長さ」を記録した配列AをO(|S|)で構築する
// aaabaaaab
// 921034210
vector<ll> Zalgo(vector<ll> s) {
    vector<ll> v(s.size());
    v[0] = s.size();
    int i = 1, j = 0;
    while (i < s.size()) {
        while (i+j < s.size() && s[j] == s[i+j]) ++j;
        v[i] = j;
        if (j == 0) { ++i; continue;}
        int k = 1;
        while (i+k < s.size() && k+v[k] < j) v[i+k] = v[k], ++k;
        i += k; j -= k;
    }
    return v;
}


int main(void) {
    ll n;
    cin >> n;
    vector<ll> a(n), b(n);
    REP(i, n) cin >> a[i];
    REP(i, n) cin >> b[i];

    vector<ll> A(a), B(b);
    REP(i, n) {
        A[i] = a[i] ^ a[(i+1)%n];
        B[i] = b[i] ^ b[(i+1)%n];
    }

    vector<ll> v(3*n+1);
    REP(i, n) v[i] = B[i];
    v[n] = -1;
    REP(i, n) {
        v[n+1+i] = A[i];
        v[2*n+1+i] = A[i];
    }

    auto ret = Zalgo(v);
    vector<ll> ans;
    FOR(i, n+1, 2*n+1) {
        if(ret[i] >= n) {
            ans.push_back(i-n-1);
        }
    }
    
    REP(i, ans.size()) {
        cout << ans[i] << " " << (a[ans[i]%n] ^ b[0]) << endl;
    }

    return 0;
}

Measured memory_bytes: 22704
#include <iostream>
#include<vector>
#include<algorithm>
#include<string>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
int main(){
cin.tie(0);
ios::sync_with_stdio(false);

	int N;
	cin>>N;
	string S[100];
	REP(i,N){
		cin>>S[i];
	}
	FOR(i,1,N){
		if(S[i][0]!=S[i-1][S[i-1].size()-1]){
			cout<<"No"<<endl;
			return 0;
		}
	}
	REP(i,N-1){
		FOR(j,i+1,N){
			if(S[i]==S[j]){
				cout<<"No"<<endl;
				return 0;
			}
		}
	}
	cout<<"Yes"<<endl;
	
	return 0;
}

Measured memory_bytes: 256
#include<stdio.h>
#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std; 

int main(void){
  int N,K;
  cin >> N >> K;
      int d;
      int m;
  vector<bool> sunuke(N,false);
  for(int a=0;a<K;a++){
    cin >> d;
        for(int p=0;p<d;p++){
            cin >>m;
            sunuke[m-1]=true;
        }
    }
    int ans=0;
    for(int a=0;a<N;a++){
        if(!sunuke[a])ans++;
    }
    cout << ans<<endl;
}


Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <map>

using namespace std;
using ll = long long int;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<ll> dp(n + 1, 0);
    map<int, int> a;
    for(int i = 0; i < m; i++)
    {
        int temp;
        cin >> temp;
        a[temp] = 1;
    }
    if(a.count(1) == 0) dp[1] = 1;
    if(a.count(2) == 0) dp[2] = 1 + dp[1];
    ll mod = 1000000007;
    for(int i = 3; i <= n; i++)
    {
        if(a.count(i) == 0)
        {
            dp[i] = (dp[i - 1] + dp[i - 2]) % mod;
        }
    }
    cout << dp[n] << endl;
}

Measured memory_bytes: 5760
/*  In the name of ALLAH */

#include<bits/stdc++.h>
using namespace std;
/*******  All Required define Pre-Processors and Constants    *******/

#define int long long
#define ull unsigned long long 
#define ld long double
#define mem(a, b) memset(a, (b), sizeof(a))
#define rep(i, j, k) for (int i = j ; i < k ; ++i)
#define rrep(i, j, k) for (int i = j; i > k; --i)
#define all(cont) cont.begin(), cont.end()
#define rall(cont) cont.end(), cont.begin()
#define foreach(i, a) for(auto i: a)
#define forEach(it, l) for (auto it = l.begin(); it != l.end(); it++)
#define in(A, B, C) assert( B <= A && A <= C)
#define debug(a) cout << #a << ": " << a << endl
#define Flag(n) cout << "here " << n << endl
#define w(x) int x;cin>>x;while(t--)
#define mp make_pair
#define pb push_back

#define endl '\n';
#define io ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int POSITIVE_INFINITY = 9223372036854775807;
const int NEGATIVE_INFINITY = -9223372036854775807;
const int MOD = 1000000007;
const ld PI = acos(-1.0);
 

#define TRACE
#ifdef TRACE
#define see(...) __f(#__VA_ARGS__,__VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1){
    cerr<<name<<" : "<<arg1<<endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args){
    const char* comma=strchr(names+1,',');cerr.write(names,comma-names)<<" : "<<arg1<<" | ";__f(comma+1, args...);
}
#else
#endif
int n,m,x;

bool  check_sum(int sum[], int target){
    for(int i = 1; i <=m;i++){

        if(sum[i]<target)return false;
    }
    return true;
}


int32_t main() {
    io;
    // freopen("input.txt","r",stdin); 
    // freopen("output.txt","w",stdout);
    cin>>n>>m>>x;
    int arr[n][m+1];
    for(int i = 0;i <n;i++){
        for(int j = 0; j <=m;j++){
            cin>>arr[i][j];
        }
    }
    int ans = numeric_limits<int>::max();
    for(int i = 0 ; i <(1<<n);i++){
        
        set<int>st;

        int temp =i;
        for(int j = 0 ; j < n;j++){
            if(temp&1){
                st.insert(j);
            }
            temp>>=1;
        }
        //st will contain the rows to add;
        int sum[m+1];
        rep(tt,0,m+1)sum[tt]=0;
        for(auto it : st){
            for(int index = 0 ; index<=m;index++){
                sum[index]+=arr[it][index];
            }
        }
        // see(i);
        bool possible = check_sum(sum,x); 
        // see(possible);
        // if(possible){
        //     cout<<"Yes\n";
        // }
        if(possible){
            ans= min(ans,sum[0]);
        }

    }
    if(ans!=numeric_limits<int>::max())
    cout<<ans<<" ";
    else {
        cout<<-1<<endl;
    }

 

 
    
 
    return 0;
}


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


int main()
{
    string S, T;

    cin >> S >> T;

    if (S.size() == T.size() - 1) {
        if (S == T.erase(S.size())) {
            cout << "Yes" << endl;
        } else {
        cout << "No" << endl;

        }
    } else {
        cout << "No" << endl;
    }


}

Measured memory_bytes: 3628
/**
 * @author derrick20
 */
import java.io.*;
import java.util.*;

public class Main {
    public static void main(String args[]) throws Exception {
        FastScanner sc = new FastScanner(System.in);
        PrintWriter out = new PrintWriter(System.out);

        int H = sc.nextInt();
        int W = sc.nextInt();
        int[][] grid = new int[H][W];
        for (int i = 0; i < H; i++) {
            String s = sc.next();
            for (int j = 0; j < W; j++) {
                if (s.charAt(j) == '#') {
                    grid[i][j] = -1;
                }
            }
        }

        int[][] dp = new int[H][W];
        int mod = (int) 1e9 + 7;
        dp[0][0] = 1;
        for (int r = 0; r < H; r++) {
            for (int c = 0; c < W; c++) {
                if (grid[r][c] == -1) continue;
                if (r > 0) {
                    dp[r][c] += dp[r - 1][c];
                    dp[r][c] %= mod;
                }
                if (c > 0) {
                    dp[r][c] += dp[r][c - 1];
                    dp[r][c] %= mod;
                }
            }
        }
        out.println(dp[H - 1][W - 1]);
        out.close();
    }

    static class FastScanner {
        BufferedReader br;
        StringTokenizer st;

        FastScanner(InputStream s) {
            br = new BufferedReader(new InputStreamReader(s));
        }

        FastScanner(FileReader s) {
            br = new BufferedReader(s);
        }

        String next() throws IOException {
            while (st == null || !st.hasMoreTokens()) st = new StringTokenizer(br.readLine());
            return st.nextToken();
        }

        String nextLine() throws IOException { return br.readLine(); }

        double nextDouble() throws IOException { return Double.parseDouble(next()); }

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

        long nextLong() throws IOException { return Long.parseLong(next()); }
    }
}

Measured memory_bytes: 34040
#include <bits/stdc++.h>
using namespace std;
// #include "prettyprint.hpp"
typedef long long ll;
typedef double db;

#define fast_io() ios_base :: sync_with_stdio(0); cin.tie(0); cout.tie(0)

const ll LINF = LLONG_MAX, MOD = 1e9 + 7, N = 1e5 + 5, LG = 20;
const int INF = INT_MAX;
const db PI = acos(-1), EPS = 1 / db(1e6);

void test() {
    int n; cin >> n;
    map<int, int> mp;
    for (int i = 0; i < n; ++i) {
        int k; cin >> k;
        ++mp[k];
    }
    // debug(mp);
    int k = (mp.rbegin()) -> first, cnt = 0;
    for (auto itr = mp.begin(); itr != mp.end(); ++itr) {
        int key = itr->first, val = itr->second;
        for (int i = 2 * key; i <= k; i += key) {
            if (mp.count(i)) mp[i] = 0;
        }
        if (val == 1) ++cnt;
    }
    // debug(mp);
    cout << cnt << "\n";;
}

int main() {
      fast_io();
      #ifdef HOME
            freopen("input.txt", "r", stdin);
            freopen("output.txt", "w", stdout);
      #endif
      cout << fixed << setprecision(15);
      int t = 1;
      // cin >> t;
      for (int i = 1; i <= t; ++i) {
          test();
      }
      #ifdef HOME
          cout << "Time: " << (int)(clock() * 1000. / CLOCKS_PER_SEC) << "ms";
      #endif
      return 0;
}


Measured memory_bytes: 12876
#include <bits/stdc++.h>
using i64 = long long;
using std::cout;
using std::endl;
using std::cin;

int main() {
	int n, k; scanf("%d%d", &n, &k);
	for(int i = 1; i <= n; i += 2) k--;
	
	if(k > 0) printf("NO\n");
	else printf("YES\n");
	return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>

using namespace std;

#define FOR(i,a,b) for(long long i=(a);i<(b);i++)
#define REP(i,N) for(long long i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define fi first
#define se second

#define PI acos(-1.0)
#define INF 1000000007
#define EPS 1e-10

typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<double, double> PD;
typedef pair<string, ll> PS;
typedef vector<ll> V;

int table[10000];
int n;

int main(){
	for (int i = 0; i <= 1000; i++){
		for (int j = 0; j <= 1000; j++){
			table[i + j]++;
		}
	}
	while (cin >> n){
		ll sum = 0;
		REP(i, n + 1){
			//cout << table[i] << " " << table[n - i] << endl;
			sum += table[i] * table[n - i];
		}
		cout << sum << endl;
	}
}

Measured memory_bytes: 1168
<?php
//error_reporting(0);
$b = trim(fgets(STDIN));
//$S = trim(fgets(STDIN));
//list($A,$B) =  explode(" ",trim(fgets(STDIN)));
//$B = explode(" ",trim(fgets(STDIN)));

switch($b) {
case 'A':
  printf("%s\n",'T');
  break;
case 'T':
  printf("%s\n",'A');
  break;
case 'C':
  printf("%s\n",'G');
  break;
case 'G':
  printf("%s\n",'C');
  break;
}


Measured memory_bytes: 4728