akhauriyash/Code-Regression huggingface dataset:
from collections import Counter

N = int(input())
A = list(map(int, input().split()))

C = Counter(A)

cnt = 0
for v in C.values():
    if v > 1:
        cnt += v - 1

if cnt % 2 == 0:
    print(N - cnt)
else:
    print(N - cnt - 1)

Measured memory_bytes: 22052
class Main{
    public static void main(String[] a){
	int i=0, j=0;
	for(i=1; i < 10; i++) {
	    for(j=1; j < 10; j++) {
	    	System.out.println(i + "x" + j + "=" + i * j );
	    	}
	    }
    }
}


Measured memory_bytes: 24008
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
int main(){
 int n,min=0,ans=0;
  cin>>n;
  vector<int> a(n);
  rep(i,n)cin>>a.at(i);
  min=a.at(0);
  rep(i,n){
    if(min>=a.at(i)){
      min=a.at(i);
      ans++;
    }
  }
  cout<<ans<<endl;
}


Measured memory_bytes: 1024
#include <stdio.h>

int main() {

  int L,N,M;
  int i,j,k;
  int mon,sum,flag;

  while(1) {
    sum = 0;
    mon = 0;
    flag = 0;
    scanf("%d",&L);
    if(L == 0) break;

  for(i=0;i<12;i++) {
    scanf("%d %d",&M,&N);
    sum += M - N;

    if(sum >= L && flag == 0) {
      //  printf("ok\n");
      flag = 1;
      mon = i+1;
    }
  }
  
  if(mon == 0 ) printf("NA\n");
  else printf("%d\n",mon);
  }

  return 0;
 
}    

Measured memory_bytes: 612
#include<iostream>
using namespace std;
int main()
{
int a,b,c,n,s=0;
cin>>a>>b>>c>>n;
for(int i=0;i<=a;i++)
for(int j=0;j<=b;j++)
if ((n-i*500-j*100>=0)&&(n-i*500-j*100<=c*50))s++;
cout<<s<<endl;
return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

//AtCoder Beginner Contest 157
//B	Bingo
public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int[] A = new int[9];
		for (int i = 0; i < 9; i++) {
			A[i] = Integer.parseInt(sc.next());
		}
		int N = Integer.parseInt(sc.next());
		boolean[] c = new boolean[9];
		for (int i = 0; i < N; i++) {
			int b = Integer.parseInt(sc.next());
			for (int j = 0; j < 9; j++) {
				if (A[j] == b) {
					c[j] = true;
				}
			}
		}
		sc.close();

		if (c[0] && c[3] && c[6]) {
			System.out.println("Yes");
		}
		else if (c[1] && c[4] && c[7]) {
			System.out.println("Yes");
		}
		else if (c[2] && c[5] && c[8]) {
			System.out.println("Yes");
		}
		else if (c[0] && c[1] && c[2]) {
			System.out.println("Yes");
		}
		else if (c[3] && c[4] && c[5]) {
			System.out.println("Yes");
		}
		else if (c[6] && c[7] && c[8]) {
			System.out.println("Yes");
		}
		else if (c[0] && c[4] && c[8]) {
			System.out.println("Yes");
		}
		else if (c[2] && c[4] && c[6]) {
			System.out.println("Yes");
		}
		else {
			System.out.println("No");
		}
	}
}


Measured memory_bytes: 21972
import re
import sys

def check_upper_char(string):
    result = re.search('[A-Z]', string)
    return True if result else False

def in_onec(s):
    cnt = 0
    for i in range(len(s)):
        if s[i] == 'C':
            cnt += 1

    if cnt == 1:
        return True
    else:
        return False

s = input()

sub_s = s[2:-1]

if (s[0] == 'A') and in_onec(sub_s):
    s = s.replace('A', '')
    s = s.replace('C', '')
    if not check_upper_char(s):
        print('AC')
        sys.exit()
print('WA')

Measured memory_bytes: 3316
import sys
input = sys.stdin.readline
from collections import *

N, A, B = map(int, input().split())

if A>B:
    print(0)
    exit()

if N==1 and A!=B:
    print(0)
    exit()
    
low = A+B+(N-2)*A
high = A+B+(N-2)*B
print(high-low+1)

Measured memory_bytes: 38256
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include<map>
#include<tuple>
#include<algorithm>
#include<cmath>
#include<limits>
#include<set>
#include<queue>
using namespace std;
#define int long  long int
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int gcd(int a, int b) { return b ? gcd(b, a % b) : a; }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
typedef pair<int, int>P;
const int INF = 1e15;

signed main() {
	int N;
	cin >> N;
	vector<int>a(N);
	rep(i, N)cin >> a[i];
	sort(a.begin(), a.end());
	int ans = a[N - 1] - a[0];
	cout << ans;
}

Measured memory_bytes: 256
object Main {
  def main(args: Array[String]): Unit = {
    val str       = scala.io.StdIn.readLine
    val check_str = scala.io.StdIn.readLine
    var min_change = 10000000
    ( 0 until ( str.length - check_str.length + 1 ) ).foreach{ i=>
      var change_num = 0
      ( 0 until check_str.length ).foreach{ j =>
        if( str( i + j ) != check_str( j ) ) change_num += 1
      }
      if( change_num < min_change ) min_change = change_num
    }
 
    println( min_change )
  }
}

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

public class Main {

	public static void main(String[] args) throws Exception {
        // TODO ?????????????????????????????????????????????

        try (BufferedReader br = new BufferedReader(new InputStreamReader(System.in))) {
            String line;
            boolean first=true,second=true,ok=true;
            int i=0,length=0;
            while ((line = br.readLine()) != null) {
            	if(first){
            		length=Integer.parseInt(line);
            		first=false;
            	}else{
            		String[] ball=line.split(" ");
            		int a[]=new int[ball.length];
            		int b[]=new int[ball.length];
            		int ai=0,bi=0;
            		second=true;
            		ok=true;
            		
            		for(int k=0;k<ball.length;k++){
            			if(second){
            				a[ai]=Integer.parseInt(ball[k]);
            				b[bi]=0;
            				second=false;
            			}else{
            				int s=Integer.parseInt(ball[k]);
            				if(a[ai] < s && b[bi] < s){
            					if(Integer.min(s-a[ai],s-b[bi])==(s-a[ai])){
            						ai++;
            						a[ai]=s;
            					}else{
            						bi++;
            						b[bi]=s;
            					}
            				}else if(a[ai] < s){
            					ai++;
            					a[ai]=s;
            				}else if(b[bi] < s){
            					bi++;
            					b[bi]=s;
            				}else{
            					ok=false;
            					break;
            				}
            			}
            		}
            		if(ok){
            			System.out.println("YES");
            		}else{
            			System.out.println("NO");
            		}
            		i++;
            		if(i==length){
            			break;
            		}
            	}
            }
            
        }
    }
}

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

using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
#define mk make_pair
#define f first
#define s second

const int N = 2e3 + 7;
int t, res, n, m, ans;
vector<ii> a[N];
int way[N][N], gt[N];
bool pass[N], choos[N];

void djk(int u)
{
    priority_queue<ii, vector<ii>, greater<ii> > q; q.push(mk(0, u)); way[u][u] = 0;
    while(!q.empty())
    {
        ii tmp = q.top(); q.pop();
        if(tmp.f != way[u][tmp.s]) continue;
        ans = max(ans, tmp.f);
        for(int i = 0; i < a[tmp.s].size(); i ++)
        {
            int v = a[tmp.s][i].f, val = a[tmp.s][i].s;
            if(way[u][v] > val + tmp.f)
            {
                way[u][v] = val + tmp.f;
                q.push(mk(val + tmp.f, v));
            }
        }
    }
}
void dfs(int u, int root)
{
    if(pass[u]) return ; pass[u] = true; gt[u] = 0;
    for(int i = 0 ; i < a[u].size(); i ++)
    {
        int v = a[u][i].f, val = a[u][i].s;
        if(way[root][v] == way[root][u] + val)
        {
            dfs(v, root);
            gt[u] = max(gt[u], gt[v] + val);
        }
    }
    if(gt[u] + way[root][u] == ans) choos[u] = true;
//    cout << root << "  " << u << "  " << gt[u] << "  " << way[root][u] << "\n";
}

main()
{
#define file "r"
//    freopen(file".inp", "r", stdin);
//  freopen(file".out", "w", stdout);
    ios_base::sync_with_stdio(false);
    memset(way, 0x3f, sizeof(way));
    cin >> n >> m;
    for(int i = 1; i <= m; i ++)
    {
        int x, y, d; cin >> x >> y >> d;
        a[x].push_back(mk(y, d)); a[y].push_back(mk(x, d));
//        cout << x << "  " << y << "  " << d << "\n";
    }
//    return 0;
    for(int i = 1; i <= n; i ++) djk(i);
    for(int i = 1; i <= n; i ++)
    {
        for(int j = 1; j <= n; j ++) pass[j] = false;
        dfs(i, i);
    }
    for(int i = 1; i <= n; i ++) res += !choos[i];
    cout << res << "\n";
    for(int i = 1; i <= n; i ++)
        if(!choos[i]) cout << i << "\n";
//    cout << ans << "\n";
//    for(int i = 1; i <= n; i ++)
//    {for(int j = 1; j <= n; j ++) cout << way[i][j] << "  "; cout << "\n";}
    return 0;
}



Measured memory_bytes: 19104
#include<bits/stdc++.h>
using namespace std;
 
signed main(){
  int a,b;
  while(scanf("%d%d",&a,&b),a||b){
      for(int c=0;c<a;c++){
	  for(int d=0;d<b;d++){
	    if((c+d)&1)  printf(".");
	    else printf("#");
	      }
	      printf("\n");
	  }
	  printf("\n");
      }
}

Measured memory_bytes: 3140
#include <bits/stdc++.h>
using namespace std;
int main(){
    long long n,ans=0;
    cin>>n;
    long long l[n];
    for(int i=0;i<n;i++){
        cin>>l[i];
    }
    for(int i=0;i<n-2;i++){
        for(int j=i+1;j<n-1;j++){
            for(int k=j+1;k<n;k++){
                if(l[i]<l[j]+l[k]&&l[i]>abs(l[j]-l[k])){
                    if(l[i]!=l[j]&&l[i]!=l[k]&&l[k]!=l[j]){
                        ans++;
                    }
                }
            }
        }
    }
    cout<<ans<<endl;
    return 0;
}

Measured memory_bytes: 3636
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;

public class Main {
	private static final int MOD = 1000000007;

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int[] K = new int[N];
		int[][] A = new int[N][];
		for (int i = 0; i < N; i++) {
			K[i] = sc.nextInt();
			A[i] = new int[K[i]];
			for (int j = 0; j < K[i]; j++) {
				A[i][j] = sc.nextInt();
			}
		}

		int[] count = new int[M];
		for (int[] a : A) {
			for (int b : a) {
				count[b - 1]++;
			}
		}

		int sum = 0;
		for (int c : count) {
			if (c == N) {
				sum++;
			}
		}

		System.out.println(sum);
	}

	private static boolean isDebug = System.getProperty("sun.desktop") != null;

	private static void debug(Object... o) {
		if (isDebug) {
			System.err.println(Arrays.deepToString(o));
		}
	}

	public static class Scanner {
		private BufferedInputStream inputStream;

		public Scanner(InputStream in) {
			inputStream = new BufferedInputStream(in);
		}

		public int nextInt() throws IOException {
			int num = 0;

			int read = skip();
			do {
				num = num * 10 + (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(int[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
			}
		}

		public void fill(int[] a, int[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
				b[i] = nextInt();
			}
		}

		public long nextLong() throws IOException {
			long num = 0;

			int read = skip();
			do {
				num = num * 10 + (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(long[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
			}
		}

		public void fill(long[] a, long[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
				b[i] = nextLong();
			}
		}

		public long[] nextLong(int n) throws IOException {
			long[] array = new long[n];
			for (int i = 0; i < n; i++) {
				array[i] = nextLong();
			}

			return array;
		}

		public String next() throws IOException {
			StringBuilder builder = new StringBuilder();

			int read = skip();
			do {
				builder.append((char) read);
			} while ((read = inputStream.read()) > 0x20);

			return builder.toString();
		}

		private int skip() throws IOException {
			int read;
			while ((read = inputStream.read()) <= 0x20)
				;

			return read;
		}
	}
}

Measured memory_bytes: 22356
#include <iostream>
using namespace std;
int main() {
  int d;
  
  while(cin >> d) {
	int n = 600 / d;
	int sum = 0;
	for(int k = 0; k < n; ++k) {
	  sum += d * (k * d) * (k * d);
	}
	cout << sum << endl;
  }
  return 0;
}

Measured memory_bytes: 3096
#include <bits/stdc++.h>
using namespace std ;
int main()
{
	string s ;
	cin >> s ;
	if(s.size() % 2) cout << "No" << endl ;
	else
	{
		for(int i = 0 ;i < s.size() ;i += 2)
		 if(s[i] != 'h' || s[i + 1] != 'i')
		  {
				puts("No") ;
				return 0 ;
			}
		cout << "Yes"<< endl ;
 	}
 	return 0 ;
}


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

// --------------------------------------------------------------------------------
#define FASTIO	ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
#define ll long long 
#define mset(arr,val) memset(arr,val,sizeof(arr))
#define frepi(a,b) for(int i=a;i<=b;++i)
#define int long long
// --------------------------------------------------------------------------------

void solve_main()
{
	int n;cin>>n;
	int arr[n];frepi(0,n-1)cin>>arr[i];
	int ans=0;
	for(int i=0;i<n;++i){
		int x = arr[i];
		for(int j=i+1;j<n;++j){
			int y = arr[j];
			for(int k=j+1;k<n;++k){
				int z = arr[k];
				if(x==y || y==z || x==z)continue;
				if(x+y>z && x+z>y && y+z>x)ans++;
			}
		}
	}
	cout<<ans<<"\n";
}

int32_t main()
{
	FASTIO;
	#ifndef ONLINE_JUDGE
		freopen("/home/suryakant/input.txt","r",stdin);
		freopen("/home/suryakant/output.txt","w",stdout);
	#endif
	
    int t=1;
    //cin>>t;
    while(t--)
    {
    	solve_main();
    }    
}

Measured memory_bytes: 3612
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int a[N], h[N], cnt[N];
struct cmp {
	bool operator () (int i, int j) {
		return h[i] > h[j];
	}
};
int main() {
	int n;
	scanf("%d", &n);
	for (int i = 2; i <= n; ++ i) {
		scanf("%d", &a[i]);
		cnt[a[i]] ++;
	}
	priority_queue<int, vector<int>, cmp> q;
	for (int i = 1; i <= n; ++ i) if (cnt[i] == 0) q.push(i);
	while (!q.empty()) {
		int p = q.top(); q.pop();
		h[a[p]] = max(h[a[p]], h[p]) + 1;
		cnt[a[p]] --;
		if (cnt[a[p]] == 0) q.push(a[p]);
	}
	printf("%d\n", h[1]);
}



Measured memory_bytes: 1788
#include <stdio.h>

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

  if (a > b) {
	tmp = a;
	a = b;
	b = tmp;
  }
  
  if (a > c) {
	tmp = a;
	a = c;
	c = tmp;
  }

  if ( b > c) {
	tmp = b;
	b = c;
	c = tmp;
  }

  printf("%d %d %d\n", a, b, c);

  return 0;
}

Measured memory_bytes: 596
#include <cstdio>
#include <vector>
#include <stack>
#include <iostream>
#include <string>
#include <tuple>
#include <random>
#include <map>
#include <queue>
#include <set>
#include <complex>
#include <algorithm>
#include <cassert>
#include <iterator>
#include <numeric>

using namespace std;

typedef long double ld;
typedef long long ll;
typedef pair<ll, ll> P;

const ll INF = 1e15;
const double eps = 1e-6;
const ll MOD = 1000000007;

int cal(int base, int x) {
	if (base < x)
		return (x - base);
	int sa = abs(base - x);
	return (sa+1) / 2 + sa % 2;
}

int main() {
	ll Q;
	cin >> Q;
	for (int i = 0;i < Q;i++) {
		ll A, B;
		cin >> A >> B;
		if (B < A)
			swap(A, B);
		ll ans = A - 1;
		ll hoge = sqrt(A*B) - eps;
		ll left = hoge * (hoge + 1) < A * B ? hoge + 1 : hoge;
		ll right = hoge;
		if (A == B)
			cout << right * 2 << endl;
		else
			cout << left + right - 2 << endl;
	}
	return 0;
}


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

int main(){
    ll N;
    cin >> N;
    vector<ll> a(N),b(N);
    //ll suma=0;
    //ll sumb=0;
    rep(i,N){
        cin >> a[i];
        //suma += a[i];
    }
    rep(i,N){
        cin >> b[i];
        //sumb += b[i];
    }
    //ll nop = sumb - suma;*/
    ll cnta=0;
    ll cntb=0;
    rep(i,N){
        ll c = b[i] - a[i];
        if(c == 0){
            continue;
        }else if(c > 0){
            cntb += c / 2; 
        }else{
            cnta += -c;
        }
    }
    if(cntb >= cnta){
        cout << "Yes" << endl;
    }else{
        cout << "No" << endl;
    }
}

Measured memory_bytes: 384
#include<bits/stdc++.h>
using namespace std;
int main(){
	int n;
	cin >>n;
	string s;
	cin >>s;
	int sumr=0;
	int sumw=0;
	int sumq=0;
	int sumh=0;
	for(int i=0;i<n;i++){
		if(s[i]=='W')
			sumw++;
		if(s[i]=='R')
			sumr++;
	}
	string sq=s.substr(0,sumr-1);
	string sh=s.substr(sumr,n-1);
	for(int i=0;i<sumr;i++)
		if(s[i]=='W')
			sumq++;
	for(int i=sumr;i<n;i++)
		if(s[i]=='R')
			sumr++;
	int ans=min(sumq,sumr);
	cout <<ans;
}


Measured memory_bytes: 3904
let split_string ?(pattern="") = Str.split @@ Str.regexp pattern
let n = Scanf.sscanf (read_line ()) "%d" @@ fun n -> n
let a = read_line () |> split_string ~pattern:" " |> List.map int_of_string |> Array.of_list
let a = Array.init n @@ fun i -> a.(i) - i - 1

let () = 
  Array.sort compare a;
  Printf.printf "%d\n" @@ Array.fold_left (fun sum i -> sum + abs (i - a.(n / 2))) 0 a

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

using namespace std;


#define PI 3.14159265
#define int long long

const int MAXN = 1e5;

vector <char> used;

set <int> g[MAXN];
vector < set <int> > comp;
map <int, int> team;

void dfs(int v){

	comp[comp.size() - 1].insert(v);
	team[v] = comp.size() - 1;
	used[v] = true;

	for(int to : g[v]){
		if(!used[to]){
			dfs(to);
		}
	}
}



main(){

	int n, m, k; cin >> n >> m >> k;


	used.assign(n, false);

	vector <int> a(m), b(m), c(k), d(k);

	for(int i = 0; i < m; i++){
		cin >> a[i] >> b[i]; a[i]--, b[i]--;
		g[a[i]].insert(b[i]);
		g[b[i]].insert(a[i]);
	}

	vector < vector <int> > gk(n);

	for(int i = 0; i < k; i++){
		cin >> c[i] >> d[i]; c[i]--, d[i]--;
		gk[c[i]].push_back(d[i]);
		gk[d[i]].push_back(c[i]);
	}
	
	for(int i =  0; i < n; i++){
		if(!used[i]){
			comp.emplace_back(set<int>());
			dfs(i);
		}
	}

	vector <int> cnt(n);

	for(int i = 0; i < n; i++){
		for(int to : gk[i]){
			if(comp[team[i]].find(to) != comp[team[i]].end()){
				if(g[i].find(to) == g[i].end()){
					cnt[i]++;
				}
			}
		}
	}


	for(int i = 0; i < n; i++){
		cout << comp[team[i]].size() - 1 - g[i].size() - cnt[i] << " ";
	}
	cout << endl;

	
	
	return 0;
}

Measured memory_bytes: 39724
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using vl = vector<ll>;
using vvl = vector<vl>;
using pll = pair<ll,ll>;
using vpl = vector<pll>;
using vb = vector<bool>;
using vs = vector<string>;

const ll oo = 0x3f3f3f3f3f3f3f3fLL;
const double eps = 1e-9;

#define sz(c) ll((c).size())
#define all(c) begin(c),end(c)
#define rall(c) rbegin(c),rend(c)
#define mp make_pair
#define pb push_back
#define xx first
#define yy second
#define has(c,i) (c.find() != end(c))
#define FOR(i,a,b) for (ll i=(a); i<(b); i++)
#define FORD(i,a,b) for (ll i=ll(b)-1; i>=(a); i--)

#define DBG 1
#define TR(X) ({ if(DBG) cerr << "TR: " << (#X) << " = " << (X) << endl; })

template<class T, class U>
ostream& operator<<(ostream& os, pair<T,U> obj){
	os << "(" << obj.xx << ", " << obj.yy << ")";
	return os;
}

template<class T>
ostream& operator<<(ostream& os, vector<T> obj){
	os << "[";
	FOR(i,0,sz(obj)-1){
		os << obj[i] << ", ";
	}
	os << obj[sz(obj)-1] << "]";
	return os;
}


int main(void){
	cin.sync_with_stdio(false);
	cin.tie(NULL);

	map<string,ll> m;
	m["SAT"] = 1;
	m["FRI"] = 2;
	m["THU"] = 3;
	m["WED"] = 4;
	m["TUE"] = 5;
	m["MON"] = 6;
	m["SUN"] = 7;

	string s;
	cin >> s;
	cout << m[s] << endl;
}


Measured memory_bytes: 256
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
#define all(x) (x).begin(),(x).end()
#define ln '\n'
constexpr long long MOD = 1000000007LL;
//constexpr long long MOD = 998244353LL;
typedef long long ll;
typedef unsigned long long ull; 
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
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; }
///////////////////////////////////////////////////////////////////////////////////////////////////

int main() {
    ios::sync_with_stdio(false); cin.tie(nullptr);
    int H,W,K; cin >> H >> W >> K;
    vector<string> S(H);
    rep(i,H) cin >> S[i];

    vector<vector<int>> cnt(H, vector<int>(W+1));
    rep(i,H) {
        rep(j,W) {
            if (S[i][j]=='1') cnt[i][j+1] = 1;
            cnt[i][j+1] += cnt[i][j];
        }
    }

    int ans = 1e9;
    rep(mask,(1<<(H-1))) {
        vector<int> A(H);
        int val = __builtin_popcount(mask);
        bool check = false;
        int cur = 0;
        rep(j,W) {
            bool ok = false;
            rep(i,H) {
                A[i] = cnt[i][j+1] - cnt[i][cur];
                if (i and !(mask&(1<<(i-1)))) {
                    A[i] += A[i-1];
                }
                //if (mask==0)cout << A[i] << " ";
                if (A[i] > K) ok = true; 
            }
            //if (mask==0)cout << ln;
            if (ok) {
                val++;
                cur = j;
                rep(i,H) {
                A[i] = cnt[i][j+1] - cnt[i][cur];
                if (i and !(mask&(1<<(i-1)))) {
                    A[i] += A[i-1];
                }
                //if (mask==0)cout << A[i] << " ";
                if (A[i] > K) check = true; 
            }
            }
        }
        //if (mask==0) cout << val << ln;
        if(!check) chmin(ans,val);
    }

    cout << ans << ln;
}



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

using namespace std;
const int m=1e9+7;
bool a[1010][1010];
int dp[1010][1010];

int main () {
    ios::sync_with_stdio(false); cin.tie(0);
    int h,w; cin>>h>>w;
    for(int i=1;i<=h;i++) {
        for(int j=1;j<=w;j++) {
            char temp; cin>>temp;
            a[i][j]=(temp=='.'?true:false);
        }
    }
    dp[1][1]=1;
    for(int i=1;i<=h;i++) {
        for(int j=1;j<=w;j++) {
            if(i==1 and j==1) continue;
            if(!a[i][j]) {
                dp[i][j]=0;
            }
            else {
                if(a[i-1][j]) dp[i][j]=(dp[i][j]+dp[i-1][j])%m;
                if(a[i][j-1]) dp[i][j]=(dp[i][j]+dp[i][j-1])%m;
            }
        }
    }
    cout<<dp[h][w]<<endl;
}


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

#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i, c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define EXIST(s, e) ((s).find(e) != (s).end())
#define SORTASC(c) sort((c).begin(), (c).end())
#define SORTDESC(c, t) sort((c).begin(), (c).end(), std::greater<t>());
#define FOR(i, a, b) for (int i = (a); i < (b); ++i)
#define REP(i, n) FOR(i, 0, n)
#define VMAX(a) *max_element(ALL(a))
#define VMIN(a) *min_element(ALL(a))
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" \
                      << " " << __FILE__ << endl;

const double PI = acos(-1.0);

using ll = long long;
using namespace std;

int main()
{
    ll n;
    set<ll> st;

    cin >> n;
    
    REP(i, n){
        ll tmp;
        cin >> tmp;
        st.insert(tmp);
    }

    if (st.size()==n){
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
    
    return 0;
}

Measured memory_bytes: 9600
#include <iostream>
using namespace std;
int main () {
  int a, b,c ;
  cin >> a >> b >> c;
  int cnt = 0;
   for (int i = a;  i <= b; i ++) {
    if (c % i == 0 ) {
 cnt++;  
    }
  }
  cout << cnt << endl;
}

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

typedef long long ll;

int main()
{
    ll n, W;
    cin>>n>>W;
    ll values[n], weights[n];
    for(ll i=0; i<n; i++)
        cin>>weights[i]>>values[i];
    ll dp[n+1][W+1];
    for(ll i=0; i<=n; i++)
    {
        for(ll j=0; j<=W; j++)
        {
            if(i == 0 || j == 0)
                dp[i][j] = 0;
            else if(j >= weights[i-1] )
            {
                dp[i][j] = max( dp[i-1][j], values[i-1] + dp[i-1][ j - weights[i-1]] );
            }
            else
                dp[i][j] = dp[i-1][j];
        }
    }
    cout<<dp[n][W];
}


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

//{{{
/********************************************************************/
struct Fast {Fast(){std::cin.tie(0);ios::sync_with_stdio(false);}} fast;

typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<vector<int> > vii;
typedef queue<int> qi;
typedef stack<int> si;
typedef deque<int> dqi;

#define reps(i, a, b) for (int i = a; i < b; ++i)
#define rep(i, n) reps(i, 0, n)
#define REPS(i, a, b) reps(i, a, b)
#define REP(i, n) rep(i, n)
#define deps(i, a, b) for (int i = a; i >= b; --i)
#define dep(i, n) deps(i, n, 0)
#define DEPS(i, a, b) deps(i, a, b)
#define DEP(i, n) dep(i, n)

#define pf push_front
#define pb push_back
#define mp make_pair
#define fst first
#define FST fst
#define sec second
#define SEC sec
#define sz(obj) ((int)(obj).size())
#define all(v) (v).begin(), (v).end()
#define ALL(v) all(v)

const int INF = 999999999;
const int MOD = 1e9 + 7;
const int dx[] = {0, 1, 0, -1, 1, 1, -1, -1}, dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

//vector<string> split(const string &s, char delim) {
//  vector<string> elems;
//  string item;
//  for (char ch: s) {
//    if (ch == delim) {
//      if (!item.empty()) elems.push_back(item);
//      item.clear();
//    }
//    else item += ch;
//  }
//  if (!item.empty()) elems.push_back(item);
//  return elems;
//}

inline bool inside(int y, int x, int H, int W) {return y >= 0 && x >= 0 && y < H && x < W;}
inline int in() {int x; std::cin >> x; return x;}
template <typename T>
void print(std::vector<T>& v, char c = ' ') {
  REP(i, v.size()) {
    if (i != 0) std::cout << c;
    std::cout << v[i];
  }
  std::cout << endl;
}
template <typename T> void print(T x) { std::cout << x << '\n'; }

/****************************************************************/
//}}}

const int h = 12, w = 12;
int table[1005][1005];

void dfs(int y, int x) {
  if (!inside(y, x, h, w)) return;
  if (!table[y][x]) return;
  table[y][x] = 0;
  rep(i, 4) dfs(y + dy[i], x + dx[i]);
}

signed main()
{
  string tmp;
  while (cin >> tmp) {
    rep(i, 1005) fill(table[i], table[i] + 1005, 0);
    int ans = 0;
    rep(j, w) table[0][j] = (tmp[j] == '0') ? 0 : 1;
    reps(i, 1, h) {
      cin >> tmp;
      rep(j, w) table[i][j] = (tmp[j] == '0') ? 0 : 1;
    }
    rep(i, h) rep(j, w) {
      if (table[i][j]) {
        dfs(i, j);
        ans++;
      }
    }
    print(ans);
  }

  return (0);
}

Measured memory_bytes: 6944
A, B, C, D = map(int, input().split())
import fractions
def lcm(x, y):
    return (x*y)//fractions.gcd(x,y)
ret = 0
ret += B//C - (A-1)//C
ret += B//D - (A-1)//D
L = lcm(C, D)
ret -= B//L - (A-1)//L
print(B-A+1-ret)

Measured memory_bytes: 5048
N,K=map(int,input().split(" "))
h=[int(s) for s in input().split(" ")]

h.sort()
flag=1
i=0

if h[-1]<K:
    flag=0

if flag==1:
    while h[i]<K:
        i+=1

print(N-i if flag==1 else 0)

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


int main() {

  int64_t N, K;
  cin >> N >> K;
  
  int64_t NN = N%K;
  int64_t difNK=NN;
  
  bool larger = 1;
  
  while (larger) {
    
   if (difNK > K) difNK = difNK-K;
   else  difNK = K-difNK;
   
   if (difNK*2 < K) larger = 0;

  }
  
cout << difNK << endl;

}


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

int main(){
    int X, N;
    vector<int> a;
    cin >> X >> N;
    for(int i = 0; i < N; i++){
        int temp;
        cin >> temp;
        a.push_back(temp);
    }
    int k = 0;
    bool exists = false;
    while(true){
        k *= -1;
        exists = false;
        for(int i = 0; i < N; i++){
            if(X + k == a[i]){
                exists = true;
            }
        }
        if(!exists){
            break;
        }
        k *= -1;
        exists = false;
        for(int i = 0; i < N; i++){
            if(X + k == a[i]){
                exists = true;
            }
        }
        if(!exists){
            break;
        }
        k++;
    }
    cout << X + k << endl;
    return 0;
}

Measured memory_bytes: 3632
#include<bits/stdc++.h>
using namespace std;
int n,a,b;
char x[300][300];
int IsGood()
{
	int i,j;
	for(i=0;i<n;i++)
	{
		for(j=0;j<n;j++)
		{
			if(x[(i+a)%n][j]!=x[(j+a)%n][i])
				return 0;
		}
	}
	return 1;
}
int main()
{
	int i,j,s=0;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		getchar();
		for(j=0;j<n;j++)
		{
			scanf("%c",&x[i][j]);
		}
	}
	for(a=0;a<n;a++)
	{
		if(IsGood())
			s++;
	}
	printf("%d",s*n);
	return 0;
} 

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

#define hell                         1000000007
#define lcm(a,b)                     (a*b)/__gcd(a,b)
#define ll                           long long
#define vll                          vector<ll>
#define vi                           vector<int>
#define pll                          vector< pair<ll,ll> >
#define pb                           push_back
#define mp                           make_pair
#define all(v)                       v.begin(),v.end()
#define lbnd                         lower_bound
#define ubnd                         upper_bound
#define bs                           binary_search
#define F                            first
#define S                            second
#define rep(i,a,b)                   for(i=a;i<b;i++)
#define parr(a,n)                    for(ll it=0;it<n;it++) cout<<a[it]<<" ";cout<<endl;
#define pcont(a)                     for(auto it:a) cout<<it<<" ";cout<<endl;
#define ret(x)                       return cout<<x,0;
#define endl                           '\n'

/*constants*/
#define MAXN                         100005
#define PI                           3.14159265358979323846

/*debug*/
#define TRACE
#ifdef TRACE
#define trace(...) __f(#__VA_ARGS__, __VA_ARGS__)
    template <typename Arg1>void __f(const char* name, Arg1&& arg1){ std::cout << name << " : " << arg1 << '\n';}
    template <typename Arg1, typename... Args>void __f(const char* names, Arg1&& arg1, Args&&... args){const char* comma = strchr(names + 1, ','); std::cout.write(names, comma - names) << " : " << arg1<<" | ";__f(comma+1, args...);}
#else
#define trace(...)
#endif

using namespace std;


int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
	
	ll i,j,n,m,k,cnt=0,ans=0,t=1;
	cin>>n>>m;
	if(m%4==0) ans=m;
	else if(m%4==1)ans=1;	
	else if(m%4==2)ans=m+1;	
	else if(m%4==3)ans=0;	
	if(n==0) ret(ans)
	if((n-1)%4==0) ans^=(n-1);
	else if((n-1)%4==1)ans^=1;	
	else if((n-1)%4==2)ans^=n;	
	else if((n-1)%4==3)ans^=0;
	ret(ans)
	return 0;
}

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

signed main() {
    int N;
    scanf("%d", &N);
    int A[N];
    for(int i=0;i<N;i++){
        scanf("%d",&A[i]);
    }
    int alive = N;
    int round = 0;
    while(alive != 1){
        round += 1;
        alive=N;
        int attacker = round % N;
        if(A[attacker] == 0) continue;
        for (int i=0;i<N;i++){
            if(i==attacker)continue;
            A[i] = A[i] % A[attacker];
        }
        for (int i=0;i<N;i++){
            if (A[i] == 0) alive -=1;
        }
    }
    int answer=0;
    for(int i=0;i<N;i++){
        if(A[i] != 0) answer=A[i];
    }
    printf("%d\n", answer);
}


Measured memory_bytes: 512
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

int main() {
    
    int N;
    cin >> N;

    bool ans = false;
    for ( int i = 0; i < 100; i++ ) {
    for ( int j = 0; j < 100; j++ ) {
        if ( 4*i+7*j == N ) { ans = true; }
    }
    }
    cout << ( ans ? "Yes" : "No" ) << endl;
    return 0;
}

Measured memory_bytes: 256
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
int num,vet[20005],nex[20005],head[105],check[205],match[205],a[205],b[205],c[205],d[205];
inline int read()
{
	char ch=getchar(),last='!';
	while (ch<'0' || ch>'9') last=ch,ch=getchar();
	int ans=0;
	while (ch<='9' && ch>='0')
	{
		ans=ans*10+ch-48;
		ch=getchar();
	}
	if (last=='-') ans=-ans;
	return ans;
}
void add(int u,int v)
{
	//printf("add:%d %d\n",u,v);
	num++;
	vet[num]=v;
	nex[num]=head[u];
	head[u]=num;
}
bool dfs(int u)
{
	for (int i=head[u]; i; i=nex[i])
	{
		int v=vet[i];
		if (check[v]) continue;
		check[v]=1;
		if (match[v]==-1 || dfs(match[v]))
		{
			match[v]=u;
			match[u]=v;
			return 1;
		}
	}
	return 0;
}
int main()
{
	int n=read();
	for (int i=1; i<=n; i++) a[i]=read(),b[i]=read();
	for (int i=1; i<=n; i++) c[i]=read(),d[i]=read();
	for (int i=1; i<=n; i++)
	{
		for (int j=1; j<=n; j++)
		{
			if (a[i]<c[j] && b[i]<d[j]) add(i,j+n);
		}
	}
	int ans=0;
	for (int i=1; i<=n+n; i++) match[i]=-1;
	for (int i=1; i<=n; i++)
	{
		if (match[i]!=-1) continue;
		for (int j=1; j<=n+n; j++) check[j]=0;
		if (dfs(i))	ans++;
	} 
	printf("%d\n",ans);
	return 0;
}

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

#define fastIO ios_base::sync_with_stdio(false);cin.tie(NULL)
#define pb push_back
#define mp make_pair
#define mod 1000000007
#define int long long int

int32_t main()
{
	fastIO;
	
	int n,i,k;
	cin>>k>>n;
	int x=n/k;
	vector < int > v;
	if(n%k==0)
		return cout<<x,0;
	int r=sqrt(n);
	for(i=1;i<=r;i++)
	{
		if(n%i==0)
		{
			v.pb(i);
			v.pb(n/i);
		}
	}
	sort(v.begin(),v.end());
	int z=lower_bound(v.begin(),v.end(),x)-v.begin();
	if(v[z]>x)
		z--;
	cout<<v[z];
	return 0;
}

Measured memory_bytes: 256
#include <stdio.h>
#include <string.h>
#define CLEAR(b,i) ((b) & (~(1<<(i))))
#define TEST(b,i) ((b) & (1<<(i)))


int count(int n, int r, int flag) {
  int i, nr, res;
  if(n==1) {
    if(r<=9 && TEST(flag,r)) return 1;
    else return 0;
  }
  else {
    res = 0;
    for(i=0; i<10; ++i) {
      nr = r - n * i;
      if(nr<0) break;
      if(TEST(flag, i)) {
        res += count(n-1, nr, CLEAR(flag, i));
      }
    }
    return res;
  }
}

int main() {
  int n, s;
  while(scanf("%d %d", &n, &s) == 2) {
    printf("%d\n", count(n, s, 0x3ff));
  }
}



Measured memory_bytes: 1996
n = int(input())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
ans = 0
for i in range(n):
    ans += b[a[i] - 1]
    if i != 0:
        if a[i] == a[i - 1] + 1:
            ans += c[a[i] - 2]
print(ans)


Measured memory_bytes: 9176
#include <bits/stdc++.h>
#define int         long long
#define ll          long long
#define pb          push_back
#define pii         pair<int,int>
#define vi          vector<int>
#define vii         vector<pii>
#define mi          map<int,int>
#define mii         map<pii,int>
#define all(a)      (a).begin(),(a).end()
#define x           first
#define y           second
#define sz(x)       (int)x.size()
#define endl        '\n'
#define hell        1000000007
#define rep(i,a,b)  for(int i=a;i<b;i++)
using namespace std;
set<int> v;
bool cmp(int lhs,int rhs){
    int s1=0,s2=0,d1=lhs,d2=rhs;
    while(d1>0){
        s1+=d1%10;
        d1/=10;
    }
    while(d2>0){
        s2+=d2%10;
        d2/=10;
    }
    if(lhs*s2!=rhs*s1)
    return lhs*s2<rhs*s1;
    else return lhs<rhs;    
}
void solve(){
    rep(i,1,10){
        v.insert(i);
    }
    string temp="9";
    rep(i,1,20){
        rep(j,1,10*i){
            string cur=to_string(j);
            cur+=temp;
            if(sz(cur)<16){
                v.insert(stoll(cur));
            }
        }
        temp+='9';
    }
    vi vv(all(v));
    sort(all(vv),cmp);
    int k,cur=-1;
    cin>>k;
    for(auto i:vv){
        if(i>cur){
            cout<<i<<endl;
            k--;
            cur=i;
        }
        if(!k) break;
    }
}
 
signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t=1;
    // cin>>t;
    while(t--){
        solve();
    }
    return 0;
}

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

int main(){

long long  h,n;
cin >> h >> n;
long long a[n];
rep(i,n)cin >> a[i];
long long sum=0;
rep(i,n)sum+=a[i];
if(h-sum>0)cout << "No" << endl;
else cout << "Yes" << endl;
}




Measured memory_bytes: 1152
#include<bits/stdc++.h>
using namespace std;
#define ll long long
ll i,j;
int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    string s;
    cin>>s;
    ll f=0;
    if((s[0]==s[1] && s[1]==s[2])||(s[1]==s[2] && s[2]==s[3]))
        cout<<"Yes"<<endl;
    else
        cout<<"No"<<endl;
}



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

ll gcd(ll a,ll b){
    if(a<b)return gcd(b,a);
    if(a%b==0)return b;
    return gcd(b ,a%b);
}
int main(){
    ll n,a,b;
    cin >> n >> a >> b;
    ll ans = 0;
    ll x;cin >> x;

    for(int i=1;i<n;i++){
        ll y;cin >> y;
        ll d = y - x;
        ans += min(a*d ,b);
        x = y;
    }

    cout << ans << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ll long long
#define P pair<int,int>
#define fi first
#define se second
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1000000000000000000
#define MOD 1000000007
#define all(v) v.begin(),v.end()
#define pb push_back
int dx[]={0,1,0,-1},dy[]={1,0,-1,0};
int kaijo[2000010];
struct edge{int to,cost;};
int gcd(int a,int b){
    if(b==0)return a;
    return gcd(b,a%b);
}
int lcm(int a,int b){
    return a/gcd(a,b)*b;
}
bool prime(int a){
    if(a==1)return false;
    for(int i=2;i*i<=a;i++){
        if(a%i==0)return false;
    }
    return true;
}
void init_fact(){
    kaijo[0]=1;
    for(int i=1;i<=2000000;i++){
        kaijo[i]=kaijo[i-1]*i;
        kaijo[i]%=MOD;
    }
}
int modpow(int a,int b){
    if(b==0)return 1;
    if(b%2)return modpow(a,b-1)*a%MOD;
    int memo=modpow(a,b/2);
    return memo*memo%MOD;
}
int comb(int a,int b){
    if(!kaijo[0])init_fact();
    return kaijo[a]*modpow(kaijo[a-b],MOD-2)%MOD*modpow(kaijo[b],MOD-2)%MOD;
}
int inv(int x){
    x=modpow(x,MOD-2);
    return x;
}
bool kosa(double ax,double ay,double bx,double by,double cx,double cy,double dx,double dy){
    double ta=(cx-dx)*(ay-cy)+(cy-dy)*(cx-ax);
    double tb=(cx-dx)*(by-cy)+(cy-dy)*(cx-bx);
    double tc=(ax-bx)*(cy-ay)+(ay-by)*(ax-cx);
    double td=(ax-bx)*(dy-ay)+(ay-by)*(ax-dx);
    return tc*td<0&&ta*tb<0;
}
double dist(double ax,double ay,double bx,double by){
    return sqrt((bx-ax)*(bx-ax)+(ay-by)*(ay-by));
}
int q,sumb,diff;
priority_queue<int>l;
priority_queue<int,vector<int>,greater<int>>r;
signed main(){
	cin>>q;
	rep(_,q){
		int type;
		cin>>type;
		if(type==1){
			int a,b;
			cin>>a>>b;
			sumb+=b;
			if(l.empty())l.push(a);
			else if(l.size()==r.size()){
				if(l.top()<=a&&a<=r.top()){
					l.push(a);
				}
				else if(a<l.top()){
					diff+=l.top()-a;
					l.push(a);
				}
				else{
					diff+=a-l.top();
					r.push(a);
					int memo=r.top();
					diff-=memo-l.top();
					l.push(memo);
					r.pop();
				}
			}
			else{
				if(l.top()<=a){
					r.push(a);
					diff+=a-l.top();
				}
				else{
					int memo=l.top();
					l.pop();
					r.push(memo);
					if(l.empty()){
						l.push(a);
						diff+=memo-a;
					}
					else{
						if(l.top()<a){
							diff+=memo-a;
						}
						else{
							diff+=memo-l.top();
							diff+=l.top()-a;
						}
						l.push(a);
					}
				}
			}
		}
		if(type==2){
			cout<<l.top()<<" "<<diff+sumb<<endl;
		}
	}
    return 0;
}


Measured memory_bytes: 3828
x, y = (int(i) for i in input().split())

if x == 2 or y == 2:
  print('No')
  exit()
if x == 4 or  x == 6 or x == 9 or x == 11:
  if y == 4 or y == 6 or y == 9 or y == 11:
    print('Yes')
  else:
    print('No')
else:
  if y == 4 or y == 6 or y == 9 or y == 11:
    print('No')
  else:
    print('Yes')

Measured memory_bytes: 3060
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <set>
#include <algorithm>
#include <array>
#include <complex>
#include <string>
#include <utility>
#include <map>
#include <queue>
#include <list>
#include <functional>
#include <numeric>
#include <stack>
#include <tuple>

using namespace std;
int dx[4] = { -1,0,1,0 };
int dy[4] = { 0,1,0,-1 };
const int INF = 100000000;
const long long LINF = 1000000000000000000;
const int MOD = (int)1e9 + 7;
const double EPS = 1e-6;
using pii = std::pair<int, int>;
using ll = long long;
using pLL = std::pair<ll, ll>;
#define SORT(v) std::sort(v.begin(), v.end())
int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N, M;
    cin >> N >> M;
    vector<int> a, dp(N + 2, 0);
    vector<bool> cango(N + 1, true);
    for (int i = 0; i < M; ++i) {
        int in;
        cin >> in;
        in;
        a.push_back(in);
    }
    dp[0] = 1;
    for (int i = 0; i < M; ++i) {
        cango[a[i]] = false;
    }
    if (cango[1]) dp[1] = 1;
    for (int i = 2; i <= N; ++i) {
        if (cango[i]) {
            dp[i] = dp[i - 1] + dp[i - 2];
            dp[i] %= MOD;
        }
        
    }
    cout << dp[N] << endl;
    return 0;
}


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

using Table = vector<vector<int>>;
Table doubling(const auto& X, auto L) {
  int N = X.size();
  auto M = 0;
  while((1<<M) <= N) ++M;
  Table T(N, vector<int>(++M));
  for(auto i=0; i<N; ++i) {
    auto j = upper_bound(begin(X), end(X), X[i] + L) - begin(X) - 1;
    T[i][0] = j;
  }
  for(auto j=1; j<M; ++j) for(auto i=0; i<N; ++i) {
    auto k = T[i][j-1];
    T[i][j] = T[k][j-1];
  }
  return T;
}

int cost(const auto& T, auto a, auto b) {
  auto sum = 0;
  while(a < b) {
    auto i = lower_bound(begin(T[a]), end(T[a]), b) - begin(T[a]);
    if(i == 0) return sum + 1;
    --i;
    a = T[a][i];
    sum += 1 << i;
  }
  assert(false);
}

int main() {
  int N;
  cin >> N;
  vector<int> X(N);
  for(auto& i: X) cin >> i, --i;
  int L;
  cin >> L;

  auto T = doubling(X, L);
  for(auto& i: X) i = X.back() - i;
  reverse(begin(X), end(X));
  auto R = doubling(X, L);

  int Q;
  cin >> Q;
  for(auto q=0; q<Q; ++q) {
    int a, b;
    cin >> a >> b;
    if(a < b) cout << cost(T, a-1, b-1) << endl;
    else      cout << cost(R, N-a, N-b) << endl;
  }
}


Measured memory_bytes: 21504
#include <iostream>

using namespace std;

#include <stdio.h>

int main()
{
    int S, h, m, s;

    cin >> S;
    h = S / 3600;
    m = (S % 3600) / 60;
    s = (S % 3600) % 60;
    printf("%d:%d:%d\n", h, m, s);
}


Measured memory_bytes: 3204
#include <iostream>
#include <assert.h>
#include <vector>
#include <algorithm>
#include <utility>
#include <functional>
#include <queue>
#include <climits>
using namespace std;

int main(){
    int32_t H, W, N;
    std::cin >> H >> W >> N;
    int32_t res = 0;
    if (H > W) {
      res = (H + N - 1) / H;
    } else {
      res =(W + N - 1) / W;
    }
    cout << res << endl;
                   
    return 0;
}


Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define zero_pad(num) setfill('0') << std::right << setw(num)
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<int, int>;

int main() {
    int a, b, c;
    cin >> a >> b >> c;
    int k;
    cin >> k;

    int ans = 0;
    int mx = pow(3, k);
    rep(i, mx){
        int ai = a;
        int bi = b;
        int ci = c;
        int ii = i;
        rep(j, k){
            int p = ii % 3;
            if(p == 0) ai *= 2;
            else if(p == 1) bi *= 2;
            else ci *= 2;
            ii /= 3;
        }
        ans = max(ans, ai + bi + ci);
    }
    cout << ans << endl;
}

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

int main()
{
	int n;
	scanf("%d",&n);
	for(int x=0;x<=2*n+10;x++)
	{
		int to=x+(x*8)/100;
		if(to==n)
		{
			printf("%d\n",x);
			break;
		}
		if(to>n)
		{
			puts(":(");
			break;
		}
	}
	return 0;
}

Measured memory_bytes: 256
import java.util.*;

public class Main {
    public static void main(String[] args) throws Exception {
        // Your code here!
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        int b = sc.nextInt();
        System.out.printf("%d %d\n",a*b,2*a+2*b);
    }
}


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

#define ALL(a) begin(a), end(a)
#define TPL template
#define TNM typename

using ll = long long;
using ull = unsigned long long;

TPL<TNM T> using vec = vector<T>;
TPL<TNM T> using vec2 = vec<vec<T>>;
TPL<TNM T> using vec3 = vec<vec2<T>>;
TPL<TNM T> using vec4 = vec<vec3<T>>;
TPL<TNM T> using vec5 = vec<vec4<T>>;

TPL<TNM T> inline istream& operator >> (istream& is, vector<T>& vec) { for (T& x : vec) is >> x; return is; }
TPL<TNM V, TNM H> void resize(vector<V>& _v, const H _h) { _v.resize(_h); }
TPL<TNM V, TNM H, TNM ... T> void resize(vector<V>& _v, const H& _h, const T& ... _t) { _v.resize(_h); for (auto& __v : _v) resize(__v, _t ...); }
TPL<TNM V, TNM T> TNM enable_if<!is_class<V>::value>::type fill(vector<V>& _v, const T& _t) { std::fill(ALL(_v), _t); }
TPL<TNM V, TNM T> TNM enable_if<is_class<V>::value>::type fill(vector<V>& _v, const T& _t) { for (auto& _e : _v) fill(_e, _t); }
TPL<TNM T> inline void UNIQUE(vector<T>& _v) { sort(ALL(_v)); _v.erase(unique(ALL(_v)), _v.end()); }
struct pre_ { pre_() { cin.tie(nullptr); ios::sync_with_stdio(false); cout << fixed << setprecision(6); } } pre__;



int main(void) {
	int N, L;
	cin >> N >> L;
	int sum = 0;
	for (int i = 1; i <= N; ++i) {
		sum += L + i - 1;
	}
	int ans = 0;
	int mn = (1 << 31) - 1;
	for (int i = 1; i <= N; ++i) {
		int sum2 = sum - (L + i - 1);
		if (abs(sum - sum2) < mn) {
			mn = abs(sum - sum2);
			ans = sum2;
		}
	}
	cout << ans << endl;
	return 0;
}

Measured memory_bytes: 256
//#define _GLIBCXX_DEBUG
#include "bits/stdc++.h"

using namespace std;

//------------------------------- Libraries --------------------------------//

//------------------------------- Type Names -------------------------------//

using i64 = int_fast64_t;

using seika = string;
//{akari : 1D, yukari : 2D, maki : 3D} vector
template <class kizuna>
using akari = vector<kizuna>;
template <class yuzuki>
using yukari = akari<akari<yuzuki>>;
template <class tsurumaki>
using maki = akari<yukari<tsurumaki>>;
//{akane : ascending order, aoi : decending order} priority queue
template <class kotonoha>
using akane = priority_queue<kotonoha, akari<kotonoha>, greater<kotonoha>>;
template <class kotonoha>
using aoi = priority_queue<kotonoha>;

//------------------------------- Dubug Functions ---------------------------//
inline void print()
{
    cout << endl;
}
template <typename First, typename... Rest>
void print(const First &first, const Rest &... rest)
{
    cout << first << ' ';
    print(rest...);
}
//------------------------------- Solver ------------------------------------//

void solve()
{
    int n, m;
    seika s;
    cin >> n >> m >> s;
    reverse(s.begin(), s.end());
    akari<int> ans;
    for (int i = 0; i < n;)
    {
        bool ok = 0;
        for (int j = m; j > 0; j--)
        {
            if (i + j <= n && s[i + j] == '0')
            {
                i += j;
                ans.push_back(j);
                ok = 1;
                break;
            }
        }
        if (!ok)
        {
            cout << -1 << endl;
            return;
        }
    }
    reverse(ans.begin(), ans.end());
    for (int i : ans)
    {
        cout << i << ' ';
    }
    cout << endl;
}

int main()
{
    solve();
    return 0;
}


Measured memory_bytes: 1144