akhauriyash/Code-Regression huggingface dataset:
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<queue>
#include<vector>
#include<set>
#define fi first
#define se second
#define L(i,u) for (int i=head[u]; i!=0; i=nxt[i])
#define rep(i,a,b) for (int i=a; i<=b; i++)
#define per(i,a,b) for (int i=a; i>=b; i--)
using namespace std;
typedef long long ll;
typedef pair<int,int> Pii;
typedef vector<int> Vi;
template<class T> inline void read(T &x) {
	x=0; char c=getchar(); int f=1;
	while (c<'0'||c>'9') {if (c=='-') f=-1; c=getchar();}
	while (c>='0'&&c<='9') {x=10*x+c-'0'; c=getchar();} x*=f;
}
int n,a,b,k;

int main() {
	read(n); read(k); ll ans=0;
	if (k==0)  {printf("%lld",1LL*n*n); return 0;}
	rep(b,k+1,n) {
		int p=(n-b+1)/b,val=1LL*b*(p+1)+k;
		ans+=1LL*(p+1)*(b-1-k+1)+max(n-val+1,0);
	//	printf("%d %lld\n",b,ans);
	}
	printf("%lld",ans);
	return 0;
}

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

const LL MOD = 1000000007;
LL dp[3][100000];
LL q[100000];
LL pow3[100001];

void solve() {
    string s;
    cin >> s;
    int n = s.size();

    pow3[0] = 1ll;
    for (int i = 1; i <= n; i++) {
        pow3[i] = (pow3[i - 1] * 3ll) % MOD;
    }

    for (int i = 0; i < 3; i++) fill(dp[0], dp[0] + s.size(), -1);

    q[n - 1] = s[n - 1] == '?' ? 1 : 0;
    for (int i = n - 1; i-- > 0; ) {
        q[i] = q[i + 1] + (s[i] == '?' ? 1 : 0); 
    }

    if (s[n - 1] == 'A' || s[n - 1] == 'B') dp[0][n - 1] = 0;
    else dp[0][n - 1] = 1;
    for (int i = n - 1; i-- > 0; ) {
        if (s[i] == 'A' || s[i] == 'B') {
            dp[0][i] = dp[0][i + 1];
        } else if (s[i] == 'C') {
            dp[0][i] = (pow3[q[i + 1]] + dp[0][i + 1]) % MOD;
        } else { // '?'
            dp[0][i] = (pow3[q[i + 1]] + (dp[0][i + 1] * 3) % MOD) % MOD;
        }
    }

    dp[1][n - 1] = 0;
    for (int i = n - 2; i >= 0; i--) {
        if (s[i] == 'A' || s[i] == 'C') {
            dp[1][i] = dp[1][i + 1];
        } else if (s[i] == 'B') {
            dp[1][i] = (dp[0][i + 1] + dp[1][i + 1]) % MOD;
        } else {
            dp[1][i] = ((dp[1][i + 1] * 3) % MOD + dp[0][i + 1]) % MOD;
        }
    }

    dp[2][n - 1] = 0;
    dp[2][n - 2] = 0;
    for (int i = n - 3; i >= 0; i--) {
        if (s[i] == 'B' || s[i] == 'C') {
            dp[2][i] = dp[2][i + 1];
        } else if (s[i] == 'A') {
            dp[2][i] = (dp[1][i + 1] + dp[2][i + 1]) % MOD;
        } else {
            dp[2][i] = ((dp[2][i + 1] * 3) % MOD + dp[1][i + 1]) % MOD;
        }
    }

    cout << dp[2][0] << endl;
}

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    solve();
    return 0;
}


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

int main(void) {
	int A, B, C;
	int X, Y;
	const int INF = (int)2e9;

	cin >> A >> B >> C >> X >> Y;
	int min_ans = INF;
	int n = 2 * max(X, Y);
	for (int i = 0; i <= n; i += 2) {
		int pa = A * max(X - i / 2, 0);
		int pb = B * max(Y - i / 2, 0);
		int pc = C * i;
		int ans = pa + pb + pc;
		min_ans = min(ans, min_ans);
	}

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


Measured memory_bytes: 256
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
#define rep(i,n) for(int i=0;i<n;i++)
string s;
int cnt=0,ans=0;
char c[]={'A','T','G','C'};
signed main(){
    cin>>s;
    int l=s.size();
    rep(i,l){
        bool b=false;
        rep(j,4){
            if(s[i]==c[j])b=true;
        }
        if(b==true){
            cnt++;
            ans=max(cnt,ans);
        }
        else cnt=0;
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 256
loop.with_index do |_, k|
  n = gets.to_i
  break if n == 0
  p = []
  n.times{ p << gets.split.map(&:to_f) }
  p << p[0]
  n.times{ |i| p[i] += p[i+1] }
  p.pop
  s = p.map{ |x0, x1, y0, y1| x1*y0 - x0*y1 }.inject(:+) / 2
  puts "#{k+1} %.1f" % s
  gets
end

Measured memory_bytes: 8796
#include "bits/stdc++.h"
 
using namespace std;

using ll = long long;
using vll = vector<ll>;
using vvll = vector<vector<ll>>;
using vvvll = vector<vector<vector<ll>>>;
using vvvvll = vector<vector<vector<vector<ll>>>>;
using pl4 = pair<ll,ll>;
using str = string;
using vpl4 = vector<pair<ll,ll>>;

#define sz size()
#define be begin()
#define en end()
#define fi first
#define se second
#define pb push_back
#define mp make_pair

#define llin(x) ll (x);cin >>(x);
#define stin(x) str (x);cin >>(x);
#define vllin(x,n) vll (x)(n);FOR(i,0,n-1){cin >>(x)[i];}
#define vllin2(a,b,n) vll (a)(n);vll (b)(n);FOR(i,0,n-1){cin >>(a)[i]>>(b)[i];}
#define vllin3(a,b,c,n) vll (a)(n);vll (b)(n);vll (c)(n);FOR(i,0,n-1){cin >>(a)[i]>>(b)[i]>>(c)[i];}
#define vlling(x,n) (x).assign(n,0);FOR(i,0,n-1){cin >>(x)[i];}
#define vlling2(a,b,n) (a).assign(n,0);(b).assign(n,0);FOR(i,0,n-1){cin >>(a)[i]>>(b)[i];}
#define vlling3(a,b,c,n) (a).assign(n,0);(b).assign(n,0);(c).assign(n,0);FOR(i,0,n-1){cin >>(a)[i]>>(b)[i]>>(c)[i];}
#define vpl4in(x,n) vpl4 (x)((n),mp(0,0));FOR(i,0,n-1){cin >>x[i].fi>>x[i].se;}
#define FOR(i,a,b) for(ll i = a ; i <= b ; i++)
#define rFOR(i,b,a) for(ll i = a; i >= b ; i--)
#define SORT(x) sort(x.be, x.en)
#define rSORT(x) sort(x.rbegin(), x.rend())
#define say(x) cout<<(x);
#define sal(x) cout<<(x)<<endl;
#define says(x) cout<<(x)<<(' ');
#define sas cout<<(' ');
#define sayR(x) cout<<fixed<<setprecision(10)<<(x);
#define salR(x) cout<<fixed<<setprecision(10)<<(x)<<endl;
#define yn(a) cout <<((a)?"yes":"no")<<endl;
#define Yn(a) cout <<((a)?"Yes":"No")<<endl;
#define YN(a) cout <<((a)?"YES":"NO")<<endl;
#define Imp(a) cout <<((a)?"Possible":"Impossible")<<endl;
#define IMP(a) cout <<((a)?"POSSIBLE":"IMPOSSIBLE")<<endl;
#define pow(a,b) ll(pow(a,b))

ll MOD=998244353;


signed main(){
	llin(n);
	vllin(a,n);
	SORT(a);
	ll l=n-1-n%2;
	ll b=0;
	for(ll i=1;i<=n-1;i=i+2){
		if(a[i]>0){
			if(a[i-1]+a[i]<0){
				l=i;
			}else{
				l=i-2;
			}
			break;
		}
	}
	FOR(i,0,n-1){
		if(i<=l){
			b-=a[i];
		}else{
			b+=a[i];
		}
	}
	sal(b);
}


Measured memory_bytes: 1024
#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 N, D; cin >> N >> D;
    int d = D*2 + 1;
    int ans = (N-1)/d + 1;
    cout << ans << endl;

    return 0;
}

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

int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (auto& e : a) cin >> e;
  for (ll i = 0; i < n; i++) a[i] -= i;

  map<ll, ll> m;
  for (auto e : a) m[e]++;

  ll r = 0;
  for (ll i = 0; i < n; i++) {
    r += m[-(a[i] + 2 * i)];
    m[a[i]]--;
  }
  cout << r << endl;
}


Measured memory_bytes: 27484
#include<bits/stdc++.h>
using namespace std;
#define ll long long 
#define INF 999999999
#define rep(i,n) for(int i=0;i<n;i++)
const int MOD = 1000000007;
ll cnt =0,ans=0;

int main(){
int n;
    cin >> n;
string s;
map<string,int> mp;
for(int i=0;i<n;i++){
    cin >> s;
    mp[s]++;
}
cout << "AC x " << mp["AC"] << endl;
cout << "WA x " << mp["WA"] << endl;
cout << "TLE x " << mp["TLE"] << endl;
cout << "RE x " << mp["RE"] << endl;


}

Measured memory_bytes: 3592
#include<cstdio>
#include<stdio.h>   

int main(){
    int a = 0;
    char s[4];
    for(int i = 0;i < 4;i++){
        scanf("%c",&s[i]);
    }
    for(int i = 0;i < 4;i++){
        if(s[i] == '+') a++;
        else if(s[i] == '-') a--;
    }
    printf("%d",a);
}

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
const ll mod=1e9+7;

int main(){
  const int maxdigit=40;
  ll N,K;
  cin>>N>>K;
  vector<ll> A(N);
  for(ll i=0;i<N;i++){
    cin>>A[i];
  }
  ll dp[41][2];

  memset(dp,-1,sizeof(dp));
  dp[0][0]=0;

  for(ll i=0;i<maxdigit;i++){
    ll mask=1LL<<(maxdigit-i-1);
    ll one=0,zero=0;
    for(ll j=0;j<N;j++){
      if(A[j]&mask) zero++;
      else one++;
    }
    //既に小さいことは確定しているので大きい方を選ぶ
    if(dp[i][1]!=-1){
      dp[i+1][1]=max(dp[i+1][1],dp[i][1]+max(zero,one)*mask);
    }

    if(dp[i][0]!=-1){
      if(K&mask){
        dp[i+1][1]=max(dp[i+1][1],dp[i][0]+zero*mask);
        dp[i+1][0]=max(dp[i+1][0],dp[i][0]+one*mask);
      }else{
        dp[i+1][0]=max(dp[i+1][0],dp[i][0]+zero*mask);
      }
    }

  }
  cout<<max(dp[maxdigit][0],dp[maxdigit][1])<<endl;
  return 0;
}



Measured memory_bytes: 1024
#include <bits/stdc++.h>
using namespace std;
int main()
{
	int n,m=1,min,k;
	cin>>n;
	int r[n];
	cin>>r[0];
	min=r[0];
	for(int i=1;i<n;i++){
		cin>>r[i];
		k=r[i];
		if(k<min){
			min=k;
			m++;
		}
	}
	cout<<m;
}


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

int main() {
  long long W, H, x, y;
  cin >> W >> H >> x >> y;
  double A = W * H;
  A /= 2.0;
  
  int m = 0;
  if (2*x == W && 2*y == H) m = 1;
  
  cout << A << ' ' << m << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
using Int = long long;
struct UnionFind {
    vector<int> A;
    UnionFind(int n) : A(n, -1) {}
    int find(int x) {
        if (A[x] < 0) return x;
        return A[x] = find(A[x]);
    }
    void unite(int x, int y) {
        x = find(x), y = find(y);
        if (x == y) return;
        if (A[x] > A[y]) swap(x, y);
        A[x] += A[y];
        A[y] = x;
    }
};
template <class T>
struct SegTreeMin {
    vector<T> A;
    int N;
    T minval;
    SegTreeMin(int n, T minv) : minval(minv) {
        N = 1;
        while (N < n) N *= 2;
        A.assign(2*N, minval);
    }
    void set(int idx, T val) {
        idx += N;
        A[idx] = val;
        for (idx /= 2; idx > 0; idx /= 2) {
            A[idx] = min(A[2*idx+0], A[2*idx+1]);
        }
    }
    T query(int L, int R) { // [L, R)
        L += N, R += N;
        T ans = minval;
        while (L < R) {
            if (R & 1) ans = min(ans, A[--R]);
            if (L & 1) ans = min(ans, A[L++]);
            L /= 2, R /= 2;
        }
        return ans;
    }
};
int main()
{
    Int N, D; cin >> N >> D;
    vector<int> A(N); for (auto &a : A) cin >> a;
    vector<int> I(N); iota(begin(I), end(I), 0);
    sort(begin(I), end(I), [&](int i, int j) { return A[i] < A[j]; });
    vector<tuple<Int, int, int>> edges;
    auto add_edge = [&](int i, int j) {
        if (i == -1 || j == -1) return;
        edges.emplace_back(abs(i-j)*D+A[i]+A[j], i, j);
    };
    auto maxval = make_pair((Int)1e18, -1);
    using SegTree = SegTreeMin<pair<Int, int>>;
    auto S = SegTree(N, maxval);
    auto T = SegTree(N, maxval);
    for (int i = 0; i < N; i++) {
        auto p = S.query(0, I[i]);
        auto q = T.query(I[i], N);
        add_edge(I[i], p.second);
        add_edge(I[i], q.second);
        S.set(I[i], make_pair(-D * I[i] + A[I[i]], I[i]));
        T.set(I[i], make_pair(D * I[i] + A[I[i]], I[i]));
    }
    sort(begin(edges), end(edges));
    UnionFind uf(N);
    Int ans = 0;
    for (auto &tup : edges) {
        Int cost; int i, j; tie(cost, i, j) = tup;
        if (uf.find(i) != uf.find(j)) {
            uf.unite(i, j);
            ans += cost;
        }
    }
    cout << ans << '\n';
    return 0;
}


Measured memory_bytes: 28524
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		sc.useDelimiter(System.getProperty("line.separator"));
        String SStr = sc.next();

        int[] S = toIntAry(SStr, 2);
        int n = S[0];
        int k = S[1];

        int[] w = new int[n];
        for(int i=0; i<n; i++){
        	w[i] = sc.nextInt();
        }

        long ans = solve(w, k, n);

        System.out.println(ans);

	}

	private static long solve(int[] w, int k, int n) {
		long left = 0;
		long right = 100000 * 10000;
		long mid = 0;

		while(right-left>1){
			mid = (left+right)/2;
			//??°??????????????°????????????
			int v = check(mid,w,k,n);
			if(v>=n){
				//????????°????????????????????????mid?????§?????????
				right = mid;
			}else{
				//?????????????????´??????????????????mid????????????;
				left = mid;
			}
		}

		return right;
	}

	/**
	 * ?¨±??????maxWeight?????????????????????????????°??????????????¨??????????????????????????´????????????????????§?????§??????n?????????
	 * @param maxWeight
	 * @param w
	 * @param k
	 * @param n
	 * @return
	 */
	private static int check(long maxWeight, int[] w, int k, int n) {
		//???????????????????????????????????????
		int lacked =0;	//????????????????????°
		for(int i=0; i<k; i++){
			int weight = 0;	//?????????????????????
			while((weight+ w[lacked]) <= maxWeight){
				weight += w[lacked];
				//??????????????????+
				lacked++;
				if(lacked == n) return n;
			}
		}
		return lacked;
	}

	private static int[] toIntAry(String str, int n) {
        String[] tmp = str.split(" ");
        int[] A = new int[n];
        for (int i = 0; i < n; i++) {
			A[i] = Integer.parseInt(tmp[i]);
		}
        return A;
	}


}

Measured memory_bytes: 73432
// CODE © by 𝕌𝕥𝕜𝕒𝕣𝕤𝕙 𝔾𝕒𝕣𝕘
// Copying or sharing of this code without permission of the Author is strictly prohibited!!!
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define Speed ios::sync_with_stdio(0); cin.tie(0);
#define pb push_back
#define endl "\n"
int power(int x, int n, int mod) {int res = 1; x %= mod; while (n) {if (n & 1)res = (res * x) % mod; x = (x * x) % mod; n >>= 1;} return res;}
signed main() {
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin);
	// freopen("output.txt", "w", stdout);
#endif
	int a = 0, b = 0, c = 0, d = 0, i = 0, j = 0, k = 0, t = 0, n = 0, q = 0, tw;
	cin >> n >> tw;
	int dp[tw + 1][2], w[n], v[n];
	for (i = 0; i < n; i++)cin >> w[i] >> v[i];
	memset(dp, 0, sizeof(dp));
	for (i = 1; i <= tw; i++) {if (i >= w[0])dp[i][0] = v[0];}
	// cout << endl;
	for (int i = 1; i < n; i++) {
		if (i % 2 == 0) {
			for (int j = 1; j <= tw; j++) {
				if (j >= w[i])
					dp[j][0] = max(dp[j - w[i]][1] + v[i], dp[j][1]);
				else dp[j][0] = dp[j][1];
			}
		}
		else {
			for (int j = 1; j <= tw; j++) {
				if (j >= w[i])
					dp[j][1] = max(dp[j - w[i]][0] + v[i], dp[j][0]);
				else dp[j][1] = dp[j][0];
			}
		}
	}
	// for (i = 0; i < 2; i++) {
	// 	for (j = 0; j <= tw; j++)cout << dp[j][i] << " "; cout << endl;
	// }
	cout << dp[tw][(n - 1) % 2];
}

Measured memory_bytes: 5092
#![allow(unused_imports)]
#![cfg_attr(feature = "cargo-clippy", allow(redundant_field_names))]

use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, HashSet, VecDeque};
use std::io::{self, BufWriter, Read, Write};
use std::ops::{Add, Div, Mul, Sub};
use std::str::{self, FromStr};
use std::{cmp, fmt};

fn main() {
    let (n, k): (usize, usize) = {
        let mut sc = InputScanOnce::new(io::stdin(), 1024);
        (sc.next(), sc.next())
    };
    let (n, d) = (n - k, k - 1);
    println!("{}", (n + d - 1) / d + 1);
}

struct InputScanOnce {
    buf: Vec<u8>,
    pos: usize,
}

#[allow(dead_code)]
impl InputScanOnce {
    fn new<R: Read>(mut reader: R, estimated: usize) -> Self {
        let mut buf = Vec::with_capacity(estimated);
        let _ = io::copy(&mut reader, &mut buf).unwrap();
        InputScanOnce { buf: buf, pos: 0 }
    }

    #[inline]
    fn next<T: FromStr>(&mut self) -> T
    where
        T::Err: fmt::Debug,
    {
        let mut start = None;
        loop {
            match (self.buf[self.pos], start.is_some()) {
                (b' ', true) | (b'\n', true) => break,
                (_, true) | (b' ', false) | (b'\n', false) => self.pos += 1,
                (_, false) => start = Some(self.pos),
            }
        }
        let target = &self.buf[start.unwrap()..self.pos];
        unsafe { str::from_utf8_unchecked(target) }.parse().unwrap()
    }

    fn vec<T: FromStr>(&mut self, n: usize) -> Vec<T>
    where
        T::Err: fmt::Debug,
    {
        (0..n).map(|_| self.next()).collect()
    }

    fn pairs<T1: FromStr, T2: FromStr>(&mut self, n: usize) -> Vec<(T1, T2)>
    where
        T1::Err: fmt::Debug,
        T2::Err: fmt::Debug,
    {
        (0..n).map(|_| (self.next(), self.next())).collect()
    }

    fn trios<T1: FromStr, T2: FromStr, T3: FromStr>(&mut self, n: usize) -> Vec<(T1, T2, T3)>
    where
        T1::Err: fmt::Debug,
        T2::Err: fmt::Debug,
        T3::Err: fmt::Debug,
    {
        (0..n)
            .map(|_| (self.next(), self.next(), self.next()))
            .collect()
    }

    fn mat<T: FromStr>(&mut self, m: usize, n: usize) -> Vec<Vec<T>>
    where
        T::Err: fmt::Debug,
    {
        (0..m).map(|_| self.vec(n)).collect()
    }

    fn strings_as_mat<T, F: FnMut(u8) -> T>(&mut self, h: usize, mut f: F) -> Vec<Vec<T>> {
        (0..h)
            .map(|_| {
                let l = self.next::<String>();
                l.as_bytes().iter().cloned().map(&mut f).collect()
            })
            .collect()
    }
}


Measured memory_bytes: 4352
s = input()
n = len(s)
k = 0
tmp = set()
while k * 2 < n and len(tmp) < 2:
    tmp.add(s[n // 2 + k])
    tmp.add(s[(n - 1) // 2 - k])
    k += 1
print(n // 2 + k - (len(tmp) == 2))

Measured memory_bytes: 3188
#include <iostream>
#include <string>
#include <stack>

using namespace std;

string s;

bool solve(){
  stack<int> st;
  for(int i=0;i<s.size();i++){
    st.push(s[i]-'0');
  }
  bool res = false;
  while(st.size() != 1){
    res = !res;
    int a = st.top();
    st.pop();
    int b = st.top();
    st.pop();
    int sum = a + b;
    if(sum >= 10) st.push(sum/10);
    st.push(sum%10);
  }
  return res;
}

main(){
  int n;
  cin >> n;
  while(n--){
    cin >> s;
    if(solve()) cout << "Fabre wins.";
    else cout << "Audrey wins.";
    cout << endl;
  }
}

Measured memory_bytes: 0
#include <stdio.h>

int main(void){
    int N, i, j, b;
    scanf("%d", &N);
    b=0;
    for (i=1; i<=9; i++) {
        for (j=1; j<=9; j++) {
            if (N==i*j) {
                b=1;
                break;
            }
        }
        if (b==1) break;
    }
    if (b==1) printf("Yes");
    else printf("No");
    return 0;
}


Measured memory_bytes: 128
#include <bits/stdc++.h>
#define INF INT_MAX
#define ll  long long
#define ull unsigned long long
#define rep(i,n) for(ll i=0; i<n; ++i)
#define FOR(i, s, e) for(ll i=s; i<e; ++i)
#define MOD 1000000007
#define deg_to_rad(deg) (((deg)/360)*2*M_PI)
#define rad_to_deg(rad) (((rad)/2/M_PI)*360)
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if(a>b) {a=b; return true;} return false;}
template<class T> inline bool chmax(T& a, T b) { if(a<b) {a=b; return true;} return false;}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  double a, b, x; cin >> a >> b >> x;
  double h = x/(a*a);
  if(h < b/2) {
    h = (2*x) / (a*b);
    printf("%.10f\n", 90-rad_to_deg(atan(h/b)));
  } else {
    printf("%.10f\n",rad_to_deg(atan(2*(b-h)/a)));
  }
}

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

using namespace std;
using ll = long long;

int main(void) {
  int a, b, c;
  cin >> a >> b >> c;
  if (a == b && a != c) cout << "Yes" << endl;
  else if (b == c && b != a) cout << "Yes" << endl;
  else if (a == c && b != c) cout << "Yes" << endl;
  else cout << "No" << endl;
  return 0;
}


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

int N, K;

vector<int> d;
vector<vector<int>> A;


void input(){
    cin >> N >> K;
    d.resize(K);
    A.resize(K, vector<int>());
    for(int i = 0; i < K; i++){
        cin >> d[i];
        A[i].resize(d[i]);
        for(int j = 0; j < d[i]; j++){
            cin >> A[i][j];
        }
    }
}

void solve() {
    int ans = 0;
    for(int i = 1; i <= N; i++){
        bool have = false;
        for(auto v : A){
            for(auto p : v){
                if(p == i){
                    have = true;
                    break;
                }
            }
        }
        if(!have) ans++;
    }
    cout << ans << endl;
}
  
int main(){
    input();
    solve();
    return 0;
}

Measured memory_bytes: 3608
#include <iostream>
#include <cmath>
#include <string>
#include <string.h>
#include <cstdlib>
#include <iomanip>
#include <stdio.h>

using namespace std;

int main(){
  int count[26];
  char c;
  memset(count,0,sizeof(count));

  while(1){
    if(scanf("%c",&c)==EOF) {
        for(int i=0;i<26;i++){
            printf("%c : %d\n",i+'a',count[i]);
        }
        return 0;
    }
    if('A'<= c && c <='Z')
      count[c-'A']++;

    if('a'<= c && c <='z')
      count[c-'a']++;
  }

}


Measured memory_bytes: 3192
#include <iostream>
#include <vector>

using namespace std;

int main() {
    int a, b;
    cin >> a >> b;
    vector< vector<char> > board(100, vector<char>(100, '.'));
    for (int i = 0; i < 50; ++i) for (int j = 0; j < 100; ++j) board.at(i).at(j) = '#';
    for (int i = 0; i < a - 1; ++i) board.at((i / 50) * 2).at((i % 50) * 2) = '.';
    for (int i = 0; i < b - 1; ++i) board.at(99 - (i / 50) * 2).at((i % 50) * 2) = '#';
    cout << "100 100" << endl;
    for (int i = 0; i < board.size(); ++i) {
        for (int j = 0; j < board.at(i).size(); ++j) cout << board.at(i).at(j);
        cout << endl;
    }
    return 0;
}


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

int main()
{
	int a,b,c,d,e,k;

	cin >> a >> b >> c >> d >> e >> k;

	if (e-a<=k) {
		cout << "Yay!" << endl;
	}

	else {
		cout << ":(" << endl;
	}

	return 0;
}


Measured memory_bytes: 256
N, C = map(int,input().split())
x=["" for i in range(N)]
v=["" for i in range(N)]

for i in range(N):
    x[i], v[i] = map(int,input().split())

#時計回りの場合の最大
CalR=[0 for i in range(N)]
CalR[0]=v[0]-x[0]
for i in range(1,N):
    CalR[i]=CalR[i-1]+v[i]-x[i]+x[i-1]

MaxR=[0 for i in range(N+1)]

for i in range(1,N+1):
    if CalR[i-1]>=MaxR[i-1]:
        MaxR[i]=CalR[i-1]
    else:
        MaxR[i]=MaxR[i-1]

#反時計回りの最大
CalL=[0 for i in range(N)]
CalL[0]=v[N-1]-(C-x[N-1])
for i in range(1,N):
    CalL[i]=CalL[i-1]+v[N-i-1]+x[N-i-1]-x[N-i]

MaxL=[0 for i in range(N+1)]

for i in range(1,N+1):
    if CalL[i-1]>=MaxL[i-1]:
        MaxL[i]=CalL[i-1]
    else:
        MaxL[i]=MaxL[i-1]

#最初時計回りに進んだ場合の答え
AnsR=[0 for i in range(N)]

for i in range(N):
    AnsR[i]=CalR[i]-x[i]+MaxL[N-1-i]

#最初反時計回りに進んだ場合の答え
AnsL=[0 for i in range(N)]

for i in range(N):
    AnsL[i]=CalL[i]-(C-x[N-1-i])+MaxR[N-1-i]

print(max(max(AnsR),max(AnsL),max(CalR),max(CalL),0))


Measured memory_bytes: 30760
#include <iostream>
#include <vector>
#include <string>
#include <assert.h>
using namespace std;

int main(int argc, char*argv[])
{
  for(;;) {
    int n;
    cin >> n;
    if(n == 0) break;
    vector<vector<pair<int,int>>> lines;
    for(int i = 0; i <= n; i++) { // <=50
      vector<pair<int,int>> line;
      int m;
      cin >> m;
      for(int j = 0; j < m; j++) { // <=10
        int x, y, x0, y0;
        cin >> x >> y;
        if(j == 0) {
          x0 = x;
          y0 = y;
        }
        line.push_back(make_pair(x-x0, y-y0));
      }
      lines.push_back(line);
    }
    auto matchP =[&](pair<int,int> &s, pair<int,int>&t, int d, pair<int,int>&t0) {
      if(d == 0) {
        return s.first == (t.first - t0.first) && s.second == (t.second - t0.second);
      } else if(d == 1) {
        return s.first == -(t.second - t0.second) && s.second == (t.first - t0.first);
      } else if(d == 2) {
        return s.first == -(t.first - t0.first) && s.second == -(t.second - t0.second);
      } else if(d == 3) {
        return s.first == (t.second - t0.second) && s.second == -(t.first - t0.first);
      }
      assert(false);
    };
    auto match =[&](vector<pair<int,int>> &s, vector<pair<int,int>> &t) {
      if(s.size() != t.size()) return false;
      int k = s.size();
      // forward
      for(int d = 0; d < 4; d++) { // rotation
        int i = 0;
        for(; i < k; i++) {
          if(!matchP(s[i], t[i], d, t[0])) break;
        }
        if(i == k) return true;
      }
      // backward
      for(int d = 0; d < 4; d++) { // rotation
        int i = 0;
        for(; i < k; i++) {
          if(!matchP(s[i], t[k-1-i], d, t[k-1])) break;
        }
        if(i == k) return true;
      }
      return false;
    };
    for(int i = 1; i <= n; i++) {
      if(match(lines[0], lines[i])) {
        cout << i << endl;
      }
    }
    cout << "+++++" << endl;
  }
  
  return 0;
}

Measured memory_bytes: 3112
#include<stdio.h>
int main()
{
	int a,b;
	char s;
	scanf("%d %c %d",&a,&s,&b);
	if(s == '+')
		printf("%d\n",a + b);
	else
	{
		if(a >= b)
			printf("%d\n",a - b);
		else
			printf("-%d\n",b - a);
	}
	return 0;
}


Measured memory_bytes: 128
import sys
## io
IS = lambda: sys.stdin.readline().rstrip()
II = lambda: int(IS())
MII = lambda: list(map(int, IS().split()))
MIIZ = lambda: list(map(lambda x: x-1, MII()))
## dp
INIT_VAL = 0
MD2 = lambda d1,d2: [[INIT_VAL]*d2 for _ in range(d1)]
MD3 = lambda d1,d2,d3: [MD2(d2,d3) for _ in range(d1)]
## math
DIVC = lambda x,y: -(-x//y)
DIVF = lambda x,y: x//y

def main():
    print('2018'+IS()[4:])

if __name__ == '__main__':
    main()

Measured memory_bytes: 3064
#include <bits/stdc++.h>
#define F first
#define S second
#define X real()
#define Y imag()
using namespace std;
typedef long long ll;
typedef long double ld;
const ll mod=1e9+7;

ll can[101010];

int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin>>n;
	int c=0;
	int e=0;
	for (int i=0;i<n;i++){
		int x;
		cin>>x;
// 		cout<<c<<" "<<(i-c-1)*2+1<<" "<<e<<endl;
		while ((i-c-1)*2+1>e){
			c++;
		}
// 		cout<<c<<" "<<(i-c-1)*2+1<<" "<<e<<endl;
// 		cout<<c+1<<endl;
		can[i]=c+1;
		e=x;
	}
	ll v=1;
	ll t=0;
	for (int i=n-1;i>=0;i--){
		v*=(ll)(n-can[i]+1ll-t);
		v%=mod;
		t++;
	}
	cout<<v<<endl;
}

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

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

    std::vector<std::size_t> As(N+1), Bs(M+1);

    std::size_t Amax = N;
    As[0] = 0;
    Bs[0] = 0;
    for(std::size_t i=1; i<=N; ++i)
    {
        std::cin >> As[i];
        As[i] += As[i-1];

        if(K < As[i] && Amax == N)
        {
            Amax = i-1;
        }
    }

    for(std::size_t i=1; i<=M; ++i)
    {
        std::cin >> Bs[i];
        Bs[i] += Bs[i-1];
    }

    std::size_t max = 0;
    for(std::size_t i=0; i<=Amax; ++i)
    {
        const auto L     = K - As[i];
        const auto found = std::upper_bound(Bs.begin(), Bs.end(), L);

        max = std::max(max, i + std::distance(Bs.begin(), found) - 1);
    }
    std::cout << max << std::endl;

    return 0;
}


Measured memory_bytes: 6424
#include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int main() {
  int n, t1 = 0, t2 = 0, ans;
  cin >> n;
  vector<int> v(n);
  rep(i,n)
  {
    cin >> v[i];
    t1 += v[i];
  }
  ans = t1;
  rep(i,n)
  {
    t1 -= v[i];
    t2 += v[i];
    if (abs(t1 - t2) < ans) {
      ans = abs(t1 - t2);
    } else {
      break;
    }
  }
  cout << ans;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>

std::vector<int> H;

bool count(int i){
  for(int j=0; j<i; j++) if ( !(H[i] >= H[j]) ) return false;
  return true;
}


int main (void){
  int N; std::cin >> N ;

  H.resize(N);
  for(int i=0; i<N; i++) std::cin >> H[i];

  int ans = 0;
  for(int i=0; i<N; i++) if (count(i)) ans++;

  std::cout << ans << std::endl;
  return 0;
}

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

int main() {
	string S;
	cin >> S;
	int N = S.size();
	bool b = 1;
	for (int i = 0;i < N;i++) {
		if (S[i] != S[N - i - 1])b = 0;
	}
	int s = (N - 2) / 2;
	for (int i = 0;i <= s;i++) {
		if (S[i] != S[s - i])b = 0;
	}
	s += 2;
	for (int i = s;i < N;i++) {
		if (S[i] != S[N - 1 + s - i])b = 0;
	}
	if (b)cout << "Yes" << endl;
	else cout << "No" << endl;
}

Measured memory_bytes: 256
N = int(input())
p = list(map(int,input().split()))
q= []
count = 0
for i in range(N-1):
    if p[i]>p[i+1]:
        count += 1
        q.append(i)
if count == 0:
    print("YES")
elif count ==2:
    if q[0] == 0 and q[1]+1 ==N-1:
        if p[q[1]+1]<p[q[0]+1] and p[q[1]]<p[q[0]]:
            print("YES")
        else:
            print("NO")
    elif q[0] == 0:
        if p[q[1]+1]<p[q[0]+1] and p[q[1]]<p[q[0]] and p[q[0]]<p[q[1]+2]:
            print("YES")
        else:
            print("NO")
    elif q[1]+1 == N-1:
        if p[q[0]-1]<p[q[1]+1] and p[q[1]+1]<p[q[0]+1] and p[q[1]]<p[q[0]]:
            print("YES")
        else:
            print("NO")
    else:
        if p[q[0]-1]<p[q[1]+1] and p[q[1]+1]<p[q[0]+1] and p[q[1]]<p[q[0]] and p[q[0]]<p[q[1]+2]:
            print("YES")
        else:
            print("NO")
else:
    print("NO")


Measured memory_bytes: 3064
using System;
using System.Collections.Generic;
class Program
{
	static void Main(string[] args)
	{
		string[] str = Console.ReadLine().Split(' ');
		int a = int.Parse(str[0]);
		int b = int.Parse(str[1]);
		string s = "";
		if(a < b){
			s = "a < b";
		} else if(a > b){
			s = "a > b";
		} else {
			s = "a == b";
		}
		Console.WriteLine(s);
	}
}


Measured memory_bytes: 8836
X,N=map(int,input().split())
if N==0:
  print(X)
else:
  p=list(map(int,input().split()))
  for i in range(100):
    if X+i not in p:
      if X-i not in p:
        print(X-i)
        break
      print(X+i)
      break
    if X-i not in p:
      print(X-i)
      break

Measured memory_bytes: 9188
#include<bits/stdc++.h>
using namespace std;
int main(){
    int a,b,c,d;
    cin>>a>>b>>c>>d;
    int dis=abs(a-c);
    int mi=max(abs(b-a),abs(c-b));
    mi=min(mi,dis);
    if(mi<=d)cout<<"Yes"<<endl;
    else cout<<"No"<<endl;
}


Measured memory_bytes: 256
S = input()
MOD = 10**9+7

dp = [0]*13
dp[0] = 1

for s in S:
    prev = [x for x in dp]
    dp = [0]*13
    if s == "?":
        r = range(10)
    else:
        r = [int(s)]
    for i in range(13):
        for x in r:
            dp[(10*i+x)%13] += prev[i]
    dp = [x % MOD for x in dp]
print(dp[5])

Measured memory_bytes: 45736
n = input()
arr = []
for i in range(n):
    arr.append(input())
arr.sort()
if n % 2 == 0:
    arr1 = arr[0:n/2]
    arr2 = arr[n/2:n]
    n1 = arr1[-1]
    n2 = arr2[0]
    arr1.remove(n1)
    arr2.remove(n2)
    print (sum(arr2)-sum(arr1)) * 2 + n2 - n1
else:
    arr1 = arr[0:n/2]
    arr2 = arr[n/2+1:n]
    n1 = arr1[-1]
    n2 = arr2[0]
    n3 = arr[n/2]
    arr1.remove(n1)
    arr2.remove(n2)
    print (sum(arr2)-sum(arr1)) * 2 + n2 - n1 + max(n2-n3,n3-n1)

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

void Main()
{
    string s;
    cin >> s;
    int n = s.size();
    for(int i=0; i<(n-1)/2; ++i){
        if(s[i] != s[n-1-i]){
            cout << "No" << endl;
            return;
        }
    }
    for(int i=0; i<(n-1)/4; ++i){
        if(s[i] != s[n/2-1-i]){
            cout << "No" << endl;
            return;
        }
    }
    cout << "Yes" << endl;
}

int main(int argc, char **argv)
{
    Main();
    return 0;
}


Measured memory_bytes: 256
object Main {

  import java.util.Scanner
  
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val writer = new java.io.PrintWriter(System.out)
    writer.println(solve(sc))
    writer.flush()
  }

  def solve(sc: Scanner): String = {
    val (a, b) = (sc.nextInt(), sc.nextInt())
    debug(a, b)

    (if (a >= 13) {
      b
    } else if (a >= 6 && a <= 12) {
      b / 2
    } else {
      0
    }).toString
  }

  private def debug(x: Any): Unit = {
    if (System.getenv("LOCAL_DEBUG") != null) println(x)
  }
}


Measured memory_bytes: 25904
#include <bits/stdc++.h>
#include <iomanip>
using namespace std;
#define reps(i,s,n) for(int i = s; i < n; i++)
#define rep(i,n) reps(i,0,n)
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef vector<ll> vec;
typedef vector<vec> mat;

ll N,M,H,W,K,Q,A,B,L,R;
string S, T;
const ll MOD = (1e+9) + 7;
const ll INF = 1LL << 60;
typedef pair<ll,ll> P;

typedef vector<P> vp;
typedef vector<vp> matP;

int main() {
    ll C;
    cin>>A>>B>>C;
    cout<<(B-A == C-B ? "YES" : "NO")<<endl;
}

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

vector<bool> seen;
void dfs(vector<vector<bool>> &g, int v) {
	seen[v] = true;
	for(int i = 0; i < g[v].size(); i++) {
		if(!g[v][i]) continue;
		if(seen[i]) continue;
		dfs(g, i);
	}
}

int main() {
	int n, m;
	cin >> n >> m;
	vector<vector<bool>> g(n, vector<bool>(n));
	vector<pair<int, int>> lis(m);
	rep(i, m) {
		int a, b;
		cin >> a >> b;
		a--; b--;
		g[a][b] = true;
		g[b][a] = true;
		lis[i] = {a, b};
	}
	int ans = 0;
	rep(i, m) {
		vector<vector<bool>> now = g;
		int a = lis[i].first;
		int b = lis[i].second;
		now[a][b] = false;
		now[b][a] = false;
		seen.assign(n, false);
		dfs(now, 0);
		bool is_bredge = false;
		rep(j, n) {
			if(!seen[j]) is_bredge = true;
		}
		if(is_bredge) ans++;
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool chmax(T &a, T b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
inline bool chmin(T &a, T b)
{
    if (a > b)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef long long int ll;

#define EPS (1e-7)
#define INF (1e9)
#define PI (acos(-1))
#define MOD (1000000007)
#define ALL(v) (v).begin(), (v).end()
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};

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

ll dp[3000][3000];
ll rui[3000][3000];

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n, m;
    cin >> n >> m;
    vector<ll> s(n), t(m);
    for (ll i = 0; i < n; i++)
    {
        cin >> s[i];
    }
    for (ll i = 0; i < m; i++)
    {
        cin >> t[i];
    }

    for (int i = 0; i < 2010; i++)
    {
        rui[i][0] = 1;
        rui[0][i] = 1;
    }

    ll ans = 1;

    for (ll i = 0; i < n; i++)
    {
        for (ll j = 0; j < m; j++)
        {
            if (s[i] == t[j])
            {
                dp[i + 1][j + 1] = rui[i][j] % MOD;
            }
            rui[i + 1][j + 1] = (rui[i][j + 1] + rui[i + 1][j] + MOD - rui[i][j] + dp[i + 1][j + 1]) % MOD;
        }
    }

    for (ll i = 0; i <= n; i++)
    {
        for (ll j = 0; j <= m; j++)
        {
            ans += dp[i][j] % MOD;
        }
    }
    cout << ans % MOD << endl;
}

Measured memory_bytes: 96256
#include <iostream>
#include <iostream>
#include <algorithm>
#include <numeric>
#include <utility>
#include <map>
#include <unordered_map>
#include <set>
#include <vector>
#include <climits>
#include <cmath>
#include <stdlib.h>
using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> v(n);
    map<int, int> mp;
    for (int i = 0; i < n; i++)
    {
        cin >> v[i];
        mp[v[i]]++;
    }
    int ans = n;
    for (int i = 0; i < n; i++)
    {
        for (int x = 1; x * x <= v[i]; x++)
        {
            if (v[i] % x != 0)
                continue;
            if (mp.find(x) != mp.end())
            {
                if ((x == v[i] && mp[v[i]] > 1) || x != v[i])
                {
                    ans--;
                    break;
                }
            }
            else if (mp.find(v[i] / x) != mp.end())
            {
                if ((v[i] / x == v[i] && mp[v[i]] > 1) || v[i] / x != v[i])
                {
                    ans--;
                    break;
                }
            }
        }
    }
    cout << ans << endl;
}

Measured memory_bytes: 13408
#include<bits/stdc++.h>
using namespace std;
int main(){
  int n;
  cin >> n;
  string s;
  cin >> s;
  int cnt=1;
  for(int i=1;i<n;i++){
    if(s[i-1]!=s[i]){
      cnt++;
    }
  }
  cout << cnt << endl;
}

Measured memory_bytes: 512
#include<iostream>

using namespace std;

int main(void){
	
	int r,g,b;
	int sum=0;
	
	cin>>r>>g>>b;
	
	sum=r*100+g*10+b;
	
	if(sum%4==0)
			puts("YES");
	else
			puts("NO");
	
	
	
	return 0;
}


Measured memory_bytes: 256
#include<iostream>
#include<vector>
#include<cmath>
#include<string>
#include<algorithm>
#include<map>
#include<utility>
#include<cstdio>

using namespace std;
typedef pair<int,bool> Pair;

int main(){

  int ans = 0;
  int A,B;
	
  cin >> A >> B;
	
  if( A > (B*2)) cout << A - (B*2) << endl;
  else cout << "0" << endl;

  return 0;

}

Measured memory_bytes: 256
x = int(input())
dp = [1]+[0]*x
for i in range(1,x+1):
  for j in range(100,106):
    if i-j >= 0 and dp[i-j] == 1:
      dp[i] = 1
      break

if dp[x] == 1:
  print(1)
else:
  print(0)
  

Measured memory_bytes: 4596
#include <stdio.h>
#include <inttypes.h>

#define MOD_BY INT32_C(1000000007)

int32_t add(int32_t a, int32_t b) {
	return a + b - MOD_BY * (a + b >= MOD_BY);
}

int32_t sub(int32_t a, int32_t b) {
	return b == 0 ? a : add(a, MOD_BY - b);
}

int32_t mul(int32_t a, int32_t b) {
	int32_t r = 0;
	while (b > 0) {
		if (b & 1) r = add(r, a);
		a = add(a, a);
		b >>= 1;
	}
	return r;
}

int32_t n, m;
int32_t x[114514];
int32_t y[114514];

int32_t x_ruiseki[114514], y_ruiseki[114514];

int main(void) {
	int32_t i, k;
	int32_t xsum = 0, ysum = 0;
	if (scanf("%" SCNd32 "%" SCNd32, &n, &m) != 2) return 1;
	for (i = 1; i <= n; i++) {
		if (scanf("%" SCNd32, &x[i]) != 1) return 1;
		if (x[i] < 0) x[i] += MOD_BY;
		x_ruiseki[i] = add(x_ruiseki[i - 1], x[i]);
	}
	for (i = 1; i <= m; i++) {
		if (scanf("%" SCNd32, &y[i]) != 1) return 1;
		if (y[i] < 0) y[i] += MOD_BY;
		y_ruiseki[i] = add(y_ruiseki[i - 1], y[i]);
	}
	for (i = 1; i < n; i++) {
		xsum = sub(xsum, mul(sub(n, i), x[i]));
		xsum = add(xsum, sub(x_ruiseki[n], x_ruiseki[i]));
	}
	for (k = 1; k < m; k++) {
		ysum = sub(ysum, mul(sub(m, k), y[k]));
		ysum = add(ysum, sub(y_ruiseki[m], y_ruiseki[k]));
	}
	printf("%" PRId32 "\n", mul(xsum, ysum));
	return 0;
}

/*

\begin{eqnarray*}
&& \sum_{i=1}^{n-1} \sum_{j=i+1}^{n} \sum_{k=1}^{m-1} \sum_{l=k+1}^{m} (x_j - x_i) (y_l - y_k) \\
&=& \sum_{i=1}^{n-1} \sum_{j=i+1}^{n} (x_j - x_i) \sum_{k=1}^{m-1} \sum_{l=k+1}^{m} (y_l - y_k) \\
&=& \sum_{i=1}^{n-1} \left\{ -(n-i) x_i + \sum_{j=i+1}^{n} x_j \right\}
    \sum_{k=1}^{m-1} \left\{ -(m-k) y_k + \sum_{l=k+1}^{m} y_l \right\}
\end{eqnarray*}

*/


Measured memory_bytes: 1792
#include "bits/stdc++.h"
using namespace std;
#define REP(i, n) for(ll i = 0;i < n;i++)
#define ll long long
#define MOD 1000000007
#define llMAX 9223372036854775807
#define llMIN -9223372036854775808
using vi = vector<ll>; // intの1次元の型に vi という別名をつける
using vvi = vector<vi>; // intの2次元の型に vvi という別名をつける

ll H,W,K;

int main(){
  ll ans=9999999999;
  cin >> H >> W>>K;
  vvi data(W, vi(H));  // N * M の2次元配列
  string s;
  REP(i,H){
    cin>>s;
    REP(j,W){
      data[j][i]=s[j]-48;
    }
  }

  
  ll h=H;
  ll h2=1<<(H-1);


  for(ll i=0;i<h2;i++){
    ll sikiri=0;
    int hula=0;
    vi ptt(10,0);
    vi gk2(10,0);
    int w=0;
    for(ll j=0;j<h;j++){
      ptt[j]=w;
      if (i&(1<<j)){
        w++;
      }
    }


              for(ll k=0;k<W;k++){
                hula=0;
                vi gk(10,0);
                for(ll j=0;j<h;j++){
                  if (data[k][j]==1){
                    gk[ptt[j]]++;
                  }
                }

                for(ll j=0;j<h;j++){
                  if (gk[j]>K){
                    hula=1;
                    break;
                  }
                }
                if (hula==1)break;

                int fg=0;
                for(ll j=0;j<h;j++){
                  if ((gk2[j]+gk[j])>K){
                    fg=1;
                    break;
                  }
                }
                if (fg==1){
                  sikiri++;
                  for(ll j=0;j<h;j++)gk2[j]=gk[j];
                }else{
                  for(ll j=0;j<h;j++)
                    gk2[j]+=gk[j];
                }
              }

    if (hula==0)
      ans=min(ans,sikiri+w);
  }




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

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

#define pb(n) push_back(n)
#define fi first
#define se second
#define all(r) begin(r),end(r)
#define vmax(ary) *max_element(all(ary))
#define vmin(ary) *min_element(all(ary))
#define debug(x) cout<<#x<<": "<<x<<endl
#define fcout(n) cout<<fixed<<setprecision((n))
#define scout(n) cout<<setw(n)
#define vary(type,name,size,init) vector< type> name(size,init)
#define vvl(v,w,h,init) vector<vector<ll>> v(w,vector<ll>(h,init))
#define mp(a,b) make_pair(a,b)

#define rep(i,n) for(int i = 0; i < (int)(n);++i)
#define REP(i,a,b) for(int i = (a);i < (int)(b);++i)
#define repi(it,array) for(auto it = array.begin(),end = array.end(); it != end;++it)
#define repa(n,array) for(auto &n :(array))

using ll = long long;
using pii = pair<int,int> ;
using pll = pair<ll,ll> ;

template<typename T>
void O(T t){
  cout << t << endl;
}

const ll mod = 1e9+7;
constexpr ll inf = ((1<<30)-1)*2+1 ;
constexpr double PI = acos(-1.0) ;
double eps = 1e-10 ;
const int dy[] = {-1,0,1,0,1,-1,1,-1};
const int dx[] = {0,-1,0,1,1,-1,-1,1};

inline bool value(int x,int y,int w,int h){
  return (x >= 0 && x < w && y >= 0 && y < h);
}

int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  ll a,b,c;
  cin >> a >> b >> c;
  ll s = 0;
  rep(i,100){
    s += a;
    if(s % b == c){
      cout << "YES" << endl;
      return 0;
    }
  }
  cout << "NO" << endl;
  return 0;
}


Measured memory_bytes: 256
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <iomanip>

using namespace std;
int n;
double kq;
int main(){
    int dem;
    cin>>n;
    dem=n/2;
    if (n%2==1) dem++;
    cout << setprecision(10) << fixed;
    cout << (double)dem/(double)n;
    return 0;
}

Measured memory_bytes: 256
N, M = map(int, input().split())
count1 = 0
count2 = 0
lis = [0] * N
lis2 = [0] * N
for i in range(M):
  p, S = input().split()
  p = int(p)
  if lis[p-1] == 0 and S == "WA":
    lis2[p-1] += 1
  elif lis[p-1] == 0 and S == "AC":
    count1 += 1
    lis[p-1] = 1
  elif lis[p-1] == 1 and S == "WA":
    continue
  elif lis[p-1] == 1 and S == "AC":
    continue
for i in range(N):
  if lis[i] == 0:
    lis2[i] = 0
count2 = sum(lis2)
print(str(count1) + " " + str(count2))

Measured memory_bytes: 10456
#include <bits/stdc++.h>
const int INF = 1e9;
const int MOD = 1e9+7;
using LL = long long;
const LL LINF = 1e18;
const double EPS = 1e-10;
using namespace std;
#define COUT(v) cout<<(v)<<endl
#define CIN(n)  int(n);cin >> (n)
#define LCIN(n) LL(n);cin >> (n)
#define SCIN(n) string(n);cin >> (n)
#define YES(n) cout<<((n)? "YES" : "NO")<<endl
#define Yes(n) cout<<((n)? "Yes" : "No")<<endl
#define POSSIBLE(n) cout << ((n) ? "POSSIBLE" : "IMPOSSIBLE"  ) << endl
#define Possible(n) cout << ((n) ? "Possible" : "Impossible"  ) <<endl

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n) for(int i=0;i<(n);++i)
#define REPR(i,n) for(int i=n;i>=0;i--)

#define FOREACH(x,a) for(auto& (x) : (a) )

#define ALL(obj) (obj).begin(),(obj).end()

#define P pair<LL,LL>
#define I vector<int>
#define pb(v) push_back(v)
#define V vector
#define rt return
#define rmsame(a) sort(ALL(a)),a.erase(unique(ALL(a)), a.end())
#define ENDL cout<<endl

typedef string::const_iterator State;
class PalseError {};
class Edge{
public:
    int from,to,value;
    Edge(LL a,LL b,LL c){
        from = a;
        to = b;
        value = c;
    }
    Edge(LL a,LL b){
        from = a;
        to = b;
    }
};
int main(){
    CIN(N);

    vector<vector<set<long>>> vec(101, vector<set<long>>(101));
    for(int a = 0;a <= 100;a++){
        for(int b = 0;b <= 100;b++){
            vec.at(a).at(b).clear();
        }
    }
    REP(i,N){
        CIN(x);CIN(y);LCIN(h);
        if(h == 0LL)continue;
        for(int a = 0;a <= 100;a++){
            for(int b = 0;b <= 100;b++){
                long long ans = h + abs(x-a) + abs(y-b);
                vec.at(a).at(b).insert(ans);
            }
        }
    }
    V<pair<long long,pair<int,int>>> ansns;
    for(int x = 0;x <= 100;x++){
        for(int y = 0;y <= 100;y++){
            if(vec.at(x).at(y).size() == 1){
                long long h;
                for(long long i : vec.at(x).at(y)){
                    h = i;
                }
                if(h <= 0)continue;
                ansns.push_back(make_pair(h,make_pair(x,y)));

            }
        }
    }
    sort(ALL(ansns));
    //reverse(ALL(ansns));
    cout<<ansns.front().second.first<<" "<<ansns.front().second.second<<" "<<ansns.front().first<<std::endl;
    return 0;
}


Measured memory_bytes: 23808
#include<iostream>
#include<string>
#include<stdio.h>
#include<cctype>
#include<algorithm>
#include<climits>
#include<cmath>
#include<map>
#include<vector>
#define INF INT_MAX
using namespace std;

int X;

int main(){
	cin >> X;
	if (X >= 30){
		cout << "Yes" << endl;
	}
	else{
		cout << "No" << endl;
	}


	return 0;
}

Measured memory_bytes: 3636
#include<stdio.h>

main(void){
  
  int H,N,A,v,i;
  
  scanf("%d %d",&H,&N);
  v = 0;
  for(i = 0; i < N; i = i + 1){
    scanf("%d",&A);
    v = v + A;
  }
  if(H > v){
    printf("No");
  }
  else{
    printf("Yes");
  }
  return 0;
}
  
    

Measured memory_bytes: 128
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,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 mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int 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())
int main(){
	int n; vector<int>vec;
	cin>>n;
	rep(i,n){int a;cin>>a;vec.pb(a);}
	int cnt = 0;
	rep(i,n){
		bool bad = 0;
		rep(j,i){
			if(vec[j] > vec[i]) bad = 1;
		}
		if(!bad) cnt++;
	}
	cout<<cnt<<endl;
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <iomanip>

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;

#define REP(i,n) for(int i=0;i<(int)(n);++i)
#define REP2(i,s,e) for(int i=(int)(s);i<(int)(e);++i)
#define RREP(i,s,e) for(int i=(int)(s-1);i>=(int)(e);--i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin(),ie=(c).end();i!=ie;++i)
#define ALL(c) (c).begin(), (c).end()

int main() {
    int a[4];cin>>a[0];
    a[3] = a[0] % 10; a[0] /= 10;
    a[2] = a[0] % 10; a[0] /= 10;
    a[1] = a[0] % 10; a[0] /= 10;

    int size = 3;
    REP(i, 1 << size) {
        int x = a[0];
        REP(j, size) {
            if (i & (1 << j)) {
                x += a[j+1];
            } else {
                x -= a[j+1];
            }
        }

        if (x == 7) {
            cout << a[0] << ((i & (1 << 0)) ? "+" : "-")
                 << a[1] << ((i & (1 << 1)) ? "+" : "-")
                 << a[2] << ((i & (1 << 2)) ? "+" : "-")
                 << a[3] << "=7" << endl;
            return 0;
        }
    }
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
int main()
{
	std::ios::sync_with_stdio(false);
	std::cin.tie(0);
	int n,k;
	cin>>n>>k;
	int p[1001];
	for(int i=0;i<n;i++)
        cin>>p[i];
    sort(p,p+n);
    int z=0;
    for(int i=0;i<k;i++)
        z+=p[i];
    cout<<z<<endl;
	return 0;
}


Measured memory_bytes: 3664
#include <iostream>
#include <cmath>
#include <cstring>
#include <algorithm>
using namespace std;
int main()
{
	int n,k;
	while(cin>>n>>k){
		int a[n];
		for(int i=0;i<n;i++)
			cin>>a[i];
		int dp[n];
		dp[0]=0;
		dp[1]=abs(a[1]-a[0]);
		for(int i=2;i<n;i++){
			int minv=INT_MAX;
			for(int j=k;j>0;j--){
				if(i-j>=0)
					minv=min(dp[i-j]+abs(a[i]-a[i-j]),minv);
			}
			dp[i]=minv;
		}
		cout<<dp[n-1]<<endl;
			
	}
}




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

int main() {
	int N;
	cin >> N;
	vector<long long> A(N);
	for(int i = 0; i < N; i++)
		cin >> A.at(i);

	bool ans = false;
	sort(A.begin(), A.end());
	for(int i = 0; i < N - 1; i++) {
		if(A.at(i) == A.at(i + 1))
			ans = true;
	}

	if(ans)
		cout << "NO" << endl;
	else
		cout << "YES" << endl;
}

Measured memory_bytes: 1792
N=int(input())
ans=[[-1]*N for _ in range(N)]
for i in range(N-1):
    for j in range(i+1,N):
        for k in range(10):
            if ((i>>k)&1)^((j>>k)&1)==1:
                ans[i][j]=k+1
                break
for i in range(N-1):
    print(*ans[i][i+1:])

Measured memory_bytes: 48604
#include <iostream>

int main() {
	int A,B,C,D;
	std::cin >>A>>B>>C>>D;
	if (A*B == C * D) {
		std::cout << A * B;
	}
	else if (A*B < C*D) {
		std::cout << C * D;
	}
	else if (A*B > C*D) {
		std::cout << A * B;
	}
	return 0;
}

Measured memory_bytes: 256