akhauriyash/Code-Regression huggingface dataset:
#include<bits/stdc++.h>
using namespace std;

#define int int64_t
#define endl "\n"
#define all(x) x.begin(),x.end()
#define pb push_back
#define ff first 
#define ss second 
#define pii pair<int,int>
#define vi vector<int>
#define vc vector<char>
#define vii vector<pii>
#define vvi vector<vi>
#define fori(i,n) for(int i=1;i<=n;++i)
#define forn(i,n) for(int i=0;i<n;++i)
#define sz(x) int(x.size())
#define error(x) cout<<#x<<" "<<x<<endl
#define IOS  ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)

const int N=100*1000;
const int mod=1e9+7;

int min3(int a,int b,int c){return min(a,min(b,c));}
int max3(int a,int b,int c){return max(a,max(b,c));}
int min4(int a,int b,int c,int d){return min(min(a,b),min(c,d));}
int max4(int a,int b,int c,int d){return max(max(a,b),max(c,d));}

const int M=42;
int cnt0[M];
int cnt1[M];
int k[M];
//int ans[46];
vi ans;
void  solve(int pos,int f1){//f1=0 means this prefix before is tight 
  if(pos==M){
    return;
  }
  int till=-1;
  //cout<<pos<<" pos,k[pos] "<<k[pos]<<endl;
  if(f1==0)till=k[pos];
  else till=1;
  if(cnt0[pos]>cnt1[pos]){
    //it's better if  this bit be 1 
    if(till==1){//this bit can be 1
      //ans+=(1LL<<(M-1-pos));
      ans.pb(1);
     // cout<<pos<<" "; 
     // cout<<" 1 "<<endl;
      solve(pos+1,f1|(1<k[pos]));
    }else{//this bit can't be 1
      ans.pb(0);
     // cout<<pos<<" "; 
     // cout<<" 0 "<<endl;
      solve(pos+1,f1|(0<k[pos]));
    }

  }else{
    //it's better if this bit be 0 
    ans.pb(0);
   // cout<<pos<<" "; 
   // cout<<" 0 "<<endl;
    solve(pos+1,f1|(0<k[pos]));
  }

}
int32_t  main(){
  IOS;
  int n,K;cin>>n>>K;
  vi v;
  // int cnt=0;
  int va;
  fori(i,n){
    cin>>va;
    v.pb(va);
    int j=0;
    vi tmp;
    while(j<M){
      tmp.pb(va%2);
      va>>=1;
      ++j;
    }
    reverse(all(tmp));
    for(int j=0;j<M;++j){
      if(tmp[j]==1)cnt1[j]++;
      else cnt0[j]++;
    }


  }
  //cout<<va<<" va"<<endl;
  //cout<<cnt<<" cnt "<<endl;
  va=K; 
  //  cout<<va<<" va "<<endl;
  int j=0;
  vi tmp;
  while(j<M){
    tmp.pb(va%2);
    //    cout<<va<<" va "<<j<<" j  "<<endl; 
    va/=2;
    ++j;
  }
  //  for(auto it:tmp)cout<<it<<" ";
  //cout<<endl;
  reverse(all(tmp));

  //for(auto it:tmp)cout<<it<<" ";
  //cout<<endl;
  // cout<<tmp.size()<<endl;
  for(int i=0;i<M;++i)k[i]=tmp[i];
  //for each bit find if it's better for it to be 0/1 
  solve(0,0);
  //now h is known 
  //cout<<ans<<" ans"<<endl;
  int64_t aa=0;
  //reverse(all(ans));
  //for(int i=0;i<M;++i)cout<<ans[i]<<" ";
  //cout<<" ans"<<endl;
  for(int i=0;i<M;++i){
    //   cout<<M-1-i<<" m-1-i"<<endl;
    if(ans[i]==1){
      aa+=((int64_t)1<<(M-1-i));
   //   cout<<((int64_t)1<<(M-1-i))<<" 2power"<<endl;
    }
    //    cout<<((int64_t)1<<(M-1-i))<<" 2^M-1-i"<<endl;
  } 
 // cout<<aa<<" aa"<<endl;
  int hh=0;
  for(int i=0;i<n;++i){
    hh+=aa^v[i];
//    cout<<aa<<" "<<v[i]<<" "<<endl;
    //cout<<ans^v[i]
  }
  cout<<hh<<endl;
  return 0;
}



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

using namespace std;

string s;
int maks,temp,ls;
int main()
{
    cin>>s;

    ls = s.length();

    for(int i = 0; i<=ls; i++){
        if(s[i] == 'R' && i<ls){
            temp++;
            continue;
        } else if(s[i] == 'S' && i<ls){
            maks = max(maks,temp);
            temp = 0;
        } else if(i == ls){
            maks = max(maks,temp);
            temp = 0;
        }
    }

    cout<<maks<<endl;
    return 0;
}


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

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

    int left = 0;
    int cnt = 0;
    rep (i,s.length()) {
        if (s[i] == '(') cnt++;//')'を何個追加するか
        else {
            if(cnt == 0) left++;//'('を何個追加するか...i文字目まで見たときそこまでの括弧がすべてペアになっているのに')'が来たとき
            else cnt--;//'('に対応する')'が見つかったので一つ減らす.
        } 
    }
    int right = cnt;
    string res = "";
    rep (i,left) res += '(';
    res += s;
    rep (i,right) res += ')';
    cout << res << endl;
    return 0;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int A,B,C,D,E,F;
  cin >> A >> B;
  C=A*12.5+0.5;
  D=(A+1)*12.5-0.00001;
  E=B*10;
  F=(B+1)*10-0.00001;
 //cout << C << D << E << F << endl;
 
 if (D<E || F<C) {cout << -1 << endl;}
 else {
   cout << max(C,E) << endl;
 }
}

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

int main() {
    int n, W;
    cin >> n >> W;
    vector<int> dp(W+1);
    for (int i = 0; i < n; ++i) {
        int v, w, m;
        cin >> v >> w >> m;
        for (int k = 1; m > 0; k <<= 1) {
            int mul = min(m, k);
            for (int j = W; j - mul * w >= 0; --j) {
                dp[j] = max(dp[j], dp[j - mul * w] + mul * v);
            }
            m -= mul;
        }
    }
    cout << dp[W] << endl;
}



Measured memory_bytes: 3148
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define pii pair<int,int>
#define pb push_back
#define fi first
#define se second
#define UP(a,b,c) for(ll (a)=(b);(a)<(c);(a)++)
#define UU(a,b,c) for(ll (a)=(b);(a)<=(c);(a)++)
#define DN(a,b,c) for(ll (a)=(b);(a)>(c);(a)--)
#define DU(a,b,c) for(ll (a)=(b);(a)>=(c);(a)--)

pair<long double, long double>pos[200005];
int n;

void reset()
{
}

void input()
{
	int cnt = 0;
	long double d;
	cin>>n>>d;
	UU(i,1,n)
	{
		cin>>pos[i].fi>>pos[i].se;
		if(pos[i].fi * pos[i].fi + pos[i].se * pos[i].se <= d*d)
		{
			cnt++;
		}
	}
	cout<<cnt<<endl;
}

void solve()
{
}

void LetsRock()
{
	solve();	
}

int main()
{
	ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

	input();
	reset();
	LetsRock();
	
	return 0;
}


Measured memory_bytes: 10052
#include <bits/stdc++.h>
#define FOR(I,X,Y) for(long int I=X;I<Y;I++)
#define REP(I,X) for(long int I=X;I>=0;I--)
#define INF 1e9+7
using namespace std;

int main(){
  bool flag = 0;
  string S,T;
  char q;
  cin >> S >> T;
  FOR(i,0,2*S.size()){
    if(S == T)flag = 1;
    q = S[S.size()-1];
    S.erase(S.end()-1);
    S = q + S;
  }
  cout << (flag ? "Yes" : "No") << endl;
}


Measured memory_bytes: 256
# edpc c

import itertools
from math import factorial
import sys
import heapq
from collections import Counter
from collections import deque
from fractions import gcd
from functools import reduce

sys.setrecursionlimit(4100000)
INF = 1 << 60
MOD = 10 ** 9 + 7

# ここから書き始める
n = int(input())
x = [[] for i in range(n)]
for i in range(n):
    x[i] = list(map(int, input().split()))
# print(x)
dp = [[-INF for j in range(3)] for i in range(n)]
dp[0][0] = x[0][0]
dp[0][1] = x[0][1]
dp[0][2] = x[0][2]
for i in range(1, n):
    a = x[i][0]
    b = x[i][1]
    c = x[i][2]
    dp[i][0] = max(dp[i][0], dp[i - 1][1] + a, dp[i - 1][2] + a)
    dp[i][1] = max(dp[i][1], dp[i - 1][0] + b, dp[i - 1][2] + b)
    dp[i][2] = max(dp[i][2], dp[i - 1][0] + c, dp[i - 1][1] + c)
print(max(dp[-1][0], dp[-1][1], dp[-1][2]))


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

;; BEGIN_INSERTED_CONTENTS
(defmacro define-int-types (&rest bits)
  `(progn
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "UINT~A" b)) () '(unsigned-byte ,b))) bits)
     ,@(mapcar (lambda (b) `(deftype ,(intern (format nil "INT~A" b)) () '(signed-byte ,b))) bits)))
(define-int-types 2 4 7 8 15 16 31 32 62 63 64)

(defmacro println (obj &optional (stream '*standard-output*))
  `(let ((*read-default-float-format* 'double-float))
     (prog1 (princ ,obj ,stream) (terpri ,stream))))

(defconstant +mod+ 1000000007)

;; Hauptteil

(defun calc0 (a)
  (declare #.OPT
           (uint62 a))
  (let* ((len (integer-length a))
         (res (make-array len :element-type 'bit :initial-element 0)))
    (dotimes (k len)
      (if (zerop k)
          (let ((rem (mod a 4)))
            (if (or (= rem 0) (= rem 3))
                (setf (aref res 0) 0)
                (setf (aref res 0) 1)))
          (let ((rem (mod a (expt 2 (+ k 1)))))
            (cond ((< rem (expt 2 k))
                   (setf (aref res k) 0))
                  ((evenp rem)
                   (setf (aref res k) 1))
                  (t
                   (setf (aref res k) 0))))))
    (loop for b across res
          for base of-type uint62 = 1 then (ash base 1)
          sum (* b base) of-type uint62)))

(defun main ()
  (let* ((a (read))
         (b (read)))
    (declare (uint62 a b))
    (println
     (if (zerop a)
         (calc0 b)
         (logxor (calc0 b) (calc0 (- a 1)))))))

#-swank(main)


Measured memory_bytes: 20704
#include "bits/stdc++.h"
using ll = long long;
using namespace std;
int main(){
ll n;
cin>>n;
ll ans=0;
vector<ll> p(n);

ll tmp;
for(int i=0;i<n;i++){
cin>>p[i];
}

for(int i=1;i<n-1;i++){
if(p[i-1]<p[i]&&p[i]<p[i+1]||p[i+1]<p[i]&&p[i]<p[i-1])
ans++;
}
cout<<ans<<endl;
}


Measured memory_bytes: 256
import sys
import re

oomoji = re.compile(r"[A-Z]")
S = list(raw_input())
if S[0] != 'A':
  print 'WA'
  sys.exit(0)
C = 0
for i in range(2,len(S)-1):
  if S[i] == 'C':
    C += 1
  elif oomoji.match(S[i]):
    print 'WA'
    sys.exit(0)
if C != 1 or oomoji.match(S[len(S)-1]) or oomoji.match(S[1]):
  print 'WA'
else :
  print 'AC'



Measured memory_bytes: 2568
#include <bits/stdc++.h>
using namespace std;
int main() {
       	int n, k, num;
       	cin >> n >> k;
       	vector<int> d(10, 0);
       	for(int i = 0; i < k; i++) {
       		cin >> num;
       		d[num] = 1;
       	}

       	int ans = n, flag = 0;
       	while(1) {
       		n = ans;
       		while(n > 0) {
       			num = n % 10;
       			if(d[num] == 1) break;
       			n /= 10;
       			if(n == 0) {
       				cout << ans << endl;
       				flag = 1;
       				break;
       			}
       		}
       		ans++;
       		if(flag) break;
       	}

       	return 0;
}

Measured memory_bytes: 256
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
signed main() { 
  ios::sync_with_stdio(false); cin.tie(0);
  //d
  int n;
  cin >> n;
  string s;
  cin >> s;
  int d1[10] = {}, d2[100] = {}, d3[1000] = {};
  for (int i = 0; i < n; i++) {
    int x = s[i] - '0';
    for (int j = 0; j < 100; j++) {
      if (d2[j]) d3[j * 10 + x] = 1;
    }
    for (int j = 0; j < 10; j++) {
      if (d1[j]) d2[j * 10 + x] = 1;
    }
    for (int j = 0; j < 10; j++) {
      d1[x] = 1;
    }
  }
  cout << accumulate(d3, d3 + 1000, 0) << '\n';
  return 0;
}

Measured memory_bytes: 384
n = int(input())
sl = []
tl = []
for _ in range(n):
    s, t = input().split()
    sl.append(s)
    tl.append(int(t))
x = input()

ans = 0
flag = False
for i in range(n):
    if flag:
        ans += tl[i]
    if sl[i] == x:
        flag = True
print(ans)


Measured memory_bytes: 3060
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);i++)
#define per(i,a,b) for(int i=(a);i>=(b);i--)
#define REP(i,n) for(int i=(0);i<(n);i++)
#define fi first
#define se seoncd
#define pb push_back
#define mp make_pair
using namespace std;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef long long ll;
 
template<class T> inline void read(T &x){
	int f=0;x=0;char ch=getchar();
	for(;!isdigit(ch);ch=getchar())f|=(ch=='-');
	for(;isdigit(ch);ch=getchar())x=x*10+ch-'0';
	if(f)x=-x;
}

const int N=1000005;
int a[N],b[N],A,B,m,x,y,z,ans=1e9;

int main(){
	read(A),read(B),read(m);
	rep(i,1,A) read(a[i]);
	rep(i,1,B) read(b[i]);
	ans=*min_element(a+1,a+A+1)+*min_element(b+1,b+B+1);
	rep(i,1,m){
		read(x),read(y),read(z);
		ans=min(ans,a[x]+b[y]-z);
	}
	cout<<ans<<endl;
	return 0;
}

Measured memory_bytes: 4736
import java.util.*;
import java.io.*;

public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        char c = sc.next().charAt(0);
        char[] vowels = new char[]{'a','i','u','e','o'};
        for(char v:vowels) if(c==v){
        	System.out.println("vowel");
        	return;
        }
        System.out.println("consonant");
        
    }
}


Measured memory_bytes: 22740
#include<iostream>
#include<vector>
using namespace std;
#define MAX 200000

int main() {
    int n;
    vector<int> a(MAX+10), reach(MAX+10, -1);
    long long k;

    scanf("%d", &n);
    scanf("%ld", &k);
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
     
    long long cnt = 0;
    int pos = 1;
    while (true) {
        if (reach[pos] !=-1) break;
        if (k == cnt) {
            printf("%d\n", pos);
            return 0;
        }
        reach[pos]=cnt;
        pos=a[pos];
        cnt++;
    }

    k -= reach[pos];
    cnt -= reach[pos];
    k %= cnt;
    for (int i = 0; i < k; i++) pos=a[pos];

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

Measured memory_bytes: 4660
#include <bits/stdc++.h>
#define re register int
using namespace std;

int n,tmp,cnt;
bool a[100001];

int main()
{
	std::cin>>n;
	
	for(re i=1;i<=n;i++)
	{
		std::cin>>tmp;
		if(!a[tmp])
			a[tmp]=1;
		else
			cnt++;
	}
	
	if(cnt%2==1)
		cnt++;
	cnt=n-cnt;

	std::cout<<cnt;
	return 0;
}


Measured memory_bytes: 384
#include <iostream>
#include <string>
#include <queue>
#include <tuple>
#include <algorithm>
using namespace std;

int H, W, N, dist[52][52][2][1 << 10]; string S[52], T[10][52], C[1 << 10][52];
queue<tuple<int, int, int, int>>Q;

void refresh(int a1, int a2, int a3, int a4, int a5) {
	if (dist[a1][a2][a3][a4] > a5) {
		dist[a1][a2][a3][a4] = a5;
		Q.push(make_tuple(a1, a2, a3, a4));
	}
}
int floors(char c) {
	if (c >= 'a' && c <= 'z') return 0;
	if (c >= 'A' && c <= 'Z') return 1;
	if (c == '_') return 0;
	if (c == '^') return 1;
	return -1;
}

int main() {
	cin >> W >> H;
	for (int i = 0; i < H; i++) cin >> S[i];
	int sx = 0, sy = 0, gx = 0, gy = 0;
	for (int i = 0; i < H; i++) {
		for (int j = 0; j < W; j++) {
			if (S[i][j] == '%') { sx = i; sy = j; S[i][j] = '_'; }
			if (S[i][j] == '&') { gx = i; gy = j; S[i][j] = '_'; }
		}
	}
	cin >> N;
	for (int i = 0; i < N; i++) {
		for (int j = 0; j < H; j++) cin >> T[i][j];
	}
	for (int i = 0; i < (1 << N); i++) {
		string V[52]; for (int j = 0; j < H; j++) V[j] = S[j];
		for (int j = 0; j < N; j++) {
			if ((i / (1 << j)) % 2 == 0) continue;
			for (int k = 0; k < H; k++) {
				for (int l = 0; l < W; l++) {
					if (T[j][k][l] == '*') {
						if (V[k][l] == '_') V[k][l] = '^';
						else if (V[k][l] == '^') V[k][l] = '_';
						else if (V[k][l] >= 'a' && V[k][l] <= 'z') V[k][l] -= 32;
						else if (V[k][l] >= 'A' && V[k][l] <= 'Z') V[k][l] += 32;
					}
				}
			}
		}
		for (int j = 0; j < H; j++) C[i][j] = V[j];
	}
	for (int i = 0; i < (1 << N); i++) { for (int j = 0; j < H; j++) { for (int k = 0; k < W; k++) { dist[j][k][0][i] = (1 << 30); dist[j][k][1][i] = (1 << 30); } } }
	dist[sx][sy][0][0] = 0; Q.push(make_tuple(sx, sy, 0, 0));
	while (!Q.empty()) {
		int cx = get<0>(Q.front()), cy = get<1>(Q.front()), fl = get<2>(Q.front()), mask = get<3>(Q.front()); Q.pop();
		int dx[4] = { -1,0,1,0 }, dy[4] = { 0,1,0,-1 };
		if (C[mask][cx][cy] == '|') {
			refresh(cx, cy, fl ^ 1, mask, dist[cx][cy][fl][mask] + 1);
		}
		if (C[mask][cx][cy] >= 'a' && C[mask][cx][cy] <= 'z') {
			char c = C[mask][cx][cy];
			int id = (mask ^ (1 << (c - 'a')));
			refresh(cx, cy, floors(C[id][cx][cy]), id, dist[cx][cy][fl][mask] + 1);
		}
		if (C[mask][cx][cy] >= 'A' && C[mask][cx][cy] <= 'Z') {
			char c = C[mask][cx][cy];
			int id = (mask ^ (1 << (c - 'A')));
			refresh(cx, cy, floors(C[id][cx][cy]), id, dist[cx][cy][fl][mask] + 1);
		}
		for (int i = 0; i < 4; i++) {
			int fx = cx + dx[i], fy = cy + dy[i];
			if (C[mask][fx][fy] == '#') continue;
			if (fl == 0 && floors(C[mask][fx][fy]) == 1) continue;
			if (fl == 1 && floors(C[mask][fx][fy]) == 0) continue;
			refresh(fx, fy, fl, mask, dist[cx][cy][fl][mask] + 1);
		}
	}
	int minx = (1 << 30);
	for (int i = 0; i < (1 << N); i++) { minx = min(minx, dist[gx][gy][0][i]); minx = min(minx, dist[gx][gy][1][i]); }
	if (minx == (1 << 30))minx = -1;
	cout << minx << endl;
	return 0;
}


Measured memory_bytes: 28920
var input = require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n");
var obj = {
  "list" : input, "index" : 0, "max" : input.length,
  "hasNext" : function(){return (this.index < this.max);},
  "next" : function(){
    if(!this.hasNext()){throw "NoSuchElementException:次に要素は無いよ";}
    var returnObj = this.list[this.index];
    this.index++;
    return returnObj;
  }
}
Main();
function next(){return obj.next();}
function nextInt(){return myconv(next(),1);}
function nextStrArray(){return myconv(next(),2);}//半角スペース分割
function nextIntArray(){return myconv(next(),4);}//半角スペース + 数値化
function nextCharArray(){return myconv(next(),6);}//1文字分割
function hasNext(){return obj.hasNext();}
function myout(t){console.log(t);}//標準出力
function myerr(t){console.error(t);}//標準エラー出力
//[no]要素の扱い。数値型
//不明値、異常時:引数そのまま返す　1:数値へ変換
//2:半角SPで分割 4:半角SPで分割し、数値配列へ
//6:1文字で分割  7:1文字で分割し、数値配列へ
//8:半角SPで結合 9:改行で結合 0:文字なしで結合
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(" ");case 4:return i.split(" ").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));case 8:return i.join(" ");case 9:return i.join("\n");case 0:return i.join("");default:return i;}}catch(e){return i;}}
function Main(){
  var one = nextIntArray();
  var N = one[0];
  var K = one[1];
  if(K == 1){
     myout(0);
    return;
  }
  var min = (K - 1);
  var max = N - min;
  myout(max - 1);
}

Measured memory_bytes: 7372
#include <algorithm>
#include <iostream>
#include <numeric>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>

int main() {
  std::string s;
  int k;
  std::cin >> s >> k;
  for (auto &c : s) {
    if (k >= ('z' + 1 - c) and c != 'a') {
      k -= 'z' + 1 - c;
      c = 'a';
    }
  }
  k %= 26;
  if (s.back() > 'z' - k) {
    s.back() += k - 26;
  } else {
    s.back() += k;
  }
  std::cout << s << std::endl;
  return 0;
}

Measured memory_bytes: 640
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
//#pragma GCC optimize ("-O3")
using namespace std;

int main() {
  
  int a,b,c,d,x;
  string s,ss,sss;
  
  int ans = 0;
  string anss = "";
  
  cin >> x >> a;
  
  int ab [] = {0 , 1 , 3 , 1 , 2 , 1 , 2 , 1 , 1 , 2 , 1 , 2 , 1};
  int result3 = std::max({a, b, c});
//--------------------------------------------------------------------------------

  if(x-a < 0) ans = 0;
  else ans = x-a;
  
  cout << ans << endl;

}

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

int main(){
    int W,H,x,y,r;

    cin >> W >> H >> x >> y >> r;

    if( 0 <= x-r && 0 <= y - r && W >= x + r && H >= y + r ) cout << "Yes" << endl;
    else cout << "No" << endl;
}


Measured memory_bytes: 3032
import sys
from functools import reduce
import copy
import math
from pprint import pprint
import collections
import bisect
import itertools


sys.setrecursionlimit(4100000)


def inputs(num_of_input):
    ins = [input() for i in range(num_of_input)]
    return ins


def int_inputs(num_of_input):
    ins = [int(input()) for i in range(num_of_input)]
    return ins


def solve(inputs):
    S = list(inputs[0])
    prev = None
    count = 0
    for c in S:
        if prev is not None and prev != c:
            count += 1
        prev = c
    return count


def string_to_int(string):
    return list(map(lambda x: int(x), string.split()))


if __name__ == "__main__":
    ret = solve(inputs(1))
    print(ret)


Measured memory_bytes: 49520
#include <iostream>

int main(void){
	//output result
	for(size_t i = 1; i < 10; i++){
		for(size_t j = 1; j < 10; j++){
			std::cout << i << "x" << j << "=" << i*j << std::endl;
		}
	}
	return 0;
}

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

int main()
{
    int n, k;
    while (scanf("%d%d", &n, &k) != EOF)
    {
        int remind = (n + 1) / 2;
        puts(k <= remind ? "YES" : "NO");
    }
    return 0;
}

Measured memory_bytes: 256
#[allow(unused_imports)]
use itertools::Itertools;
#[allow(unused_imports)]
use num::*;
use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::collections::*;

fn solve() {
    input! {
        s: Chars,
        t: Chars,
    };

    let res = s
        .into_iter()
        .zip(t.into_iter())
        .filter(|(a, b)| a == b)
        .count();
    println!("{}", res);
}

fn main() {
    std::thread::Builder::new()
        .name("big stack size".into())
        .stack_size(256 * 1024 * 1024)
        .spawn(|| {
            solve();
        })
        .unwrap()
        .join()
        .unwrap();
}


Measured memory_bytes: 2264
#include <bits/stdc++.h>
using ll = long long;
using namespace std;
#define rep(i,n) for(int i=0, i##_len=(int)(n); i<i##_len; i++)
#define reps(i,n) for(int i=1 , i##_len=(int)(n);i<=i##_len;i++)
#define rrep(i,n) for(int i=((int)(n)-1);i>=0;i--)
#define rreps(i,n) for(int i=((int)(n));i>0;i--)
#define repi(i,x) for(auto i=(x).begin(),i##_fin=(x).end();i!=i##_fin;i++)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define mp make_pair
#define pb push_back
#define solve(a) ((a)?"Yes":"No")
typedef vector<int> Vi;
typedef vector<Vi> VVi;
typedef pair<int , int> Pi;
typedef vector<Pi> VPi;
typedef vector<long long> V;
typedef vector<V> VV;
typedef pair<long long , long long> P;
typedef vector<P> VP;
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;}
const long long INFLL = 1LL<<60;
const int INF = 1<<30;
const double PI=acos(-1);
int main(){
	int n,m,x;
	int ans=INF;
	cin >>n>>m>>x;
	VVi data(n,Vi(m+1));
	int flag = 0;
	int a;
	int cnt = 0;
	Vi terget(m, 0);
	rep(i, n) {
		flag = 0;
		cin >> data[i][0];
		rep(j, m) { cin >> data[i][j+1];
		
		}

	}
	rep(bit, (1 << n)) {
		flag = 1;
		cnt  = 0;
		rep(I, m) { terget[I] = 0; }
		rep(i, n) {
			
			if (1&(bit >> i)) {
				cnt += data[i][0];
				rep(I, m) { terget[I] += data[i][I + 1]; }
			}
		}
		rep(I, m) {
			if (terget[I] < x) {
				flag = 0;
			}
		}
		if (flag) {
			chmin(ans, cnt);
		}
	}
	if (ans == INF) {
		cout << -1 << endl;
	} else {
		cout << ans << endl;
	}
}

Measured memory_bytes: 3580
N = int(input())
a = tuple(map(int, input().split()))

def main():
    l = [[0] * N for _ in range(N)]
    for i in range(N):
        for j in range(N):
            if i + j >= N:
                continue
            s = j
            e = j + i
            if len(a) % 2 != i % 2:
                if i == 0:
                    l[s][e] = a[s]
                elif i == 1:
                    l[s][e] = max(a[s:e+1]) - min(a[s:e+1])
                else:
                    l[s][e] = max(a[s] + l[s+1][e], a[e] + l[s][e-1])
            else:
                if i == 0:
                    l[s][e] -= a[s]
                elif i == 1:
                    l[s][e] = min(a[s:e+1]) - max(a[s:e+1])
                else:
                    l[s][e] = min(l[s+1][e] - a[s], l[s][e-1] - a[e])


    return l[0][-1]
print(main())


Measured memory_bytes: 114140
#include <iostream>
#include <cstdio>
#include <cstdlib>

using namespace std;

struct Node {
    int id;
    Node *parent;
    int child_num;
    Node **childlen;
};

int n;
Node **nodes;

int main(void) {

    scanf("%d", &n);
    nodes = new Node*[n];
    for (int i = 0; i < n; ++i) {
        nodes[i] = NULL;
    }

    for (int i = 0, id, n2; i < n; ++i) {
        scanf("%d", &id);
        scanf("%d", &n2);

        Node *pnode = nodes[id];
        if (pnode == NULL) {
            pnode = nodes[id] = new Node;
            pnode->parent = NULL;
        }
        pnode->id = id;
        pnode->child_num = n2;
        pnode->childlen = new Node*[n2];
        for (int j = 0, id2; j < n2; ++j) {
            scanf("%d", &id2);
            Node *cnode = nodes[id2];
            if (cnode == NULL) {
                cnode = nodes[id2] = new Node;
            }
            pnode->childlen[j] = cnode;
            cnode->id = id2;
            cnode->parent = pnode;
        }
    }

    for (int i = 0; i < n; ++i) {

        int depth = -1;
        Node *node = nodes[i];
        while (node) {
            node = node->parent;
            ++depth;
        }

        const char *type = "internal node";
        if (nodes[i]->parent == NULL) {
            type = "root";
        }
        else if (nodes[i]->child_num == 0) {
            type = "leaf";
        }

        printf("node %d: parent = %d, depth = %d, %s, [",
                nodes[i]->id, (nodes[i]->parent ? nodes[i]->parent->id:-1),
                depth, type);
        for (int j = 0, f = 0; j < nodes[i]->child_num; ++j) {
            if (f) {
                printf(", %d", nodes[i]->childlen[j]->id);
            }
            else {
                f = 1;
                printf("%d", nodes[i]->childlen[j]->id);
            }
        }
        printf("]\n");
    }

    for (int i = 0; i < n; ++i) {
        if (nodes[i]->child_num) {
            delete[] nodes[i]->childlen;
        }
    }
    delete[] nodes;

    return 0;
}

Measured memory_bytes: 10500
#include <bits/stdc++.h> 
#include <cstring>
using namespace std;
//typedef
typedef long long ll;
typedef vector<int> vi;
typedef vector<string> vs;
//define
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)

int main(){
    int a,b,ans;
    cin >> a >> b;
   if(a >= b && b != 1){
       cout << 1 << endl;
   }else if(b == 1){
       cout << 0 << endl;
       }
       else{
       ans = (b-a)/(a-1);
       if((b-a)%(a-1) > 0) ans++;
       cout << ans+1 << endl;

   }
 return 0;
}

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

#define all(x) (x).begin(),(x).end()
#define MOD 1000000007
using namespace std;

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

	if( n % 1000 )	cout << (1000 - n % 1000) << endl;
	else	cout << 0 << endl;

	return 0;
}


Measured memory_bytes: 3648
#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
#define mem(a,b) memset((a),(b),sizeof(a))
#define MP make_pair
#define pb push_back
#define fi first
#define se second
#define sz(x) x.size()
#define all(x) x.begin(),x.end()
using namespace std;
#define _GLIBCXX_PERMIT_BACKWARD_HASH
#include <ext/hash_map>
using namespace __gnu_cxx;
struct str_hash{size_t operator()(const string& str)const{return __stl_hash_string(str.c_str());}};
typedef long long ll;
typedef unsigned long long ull;
#define PII pair<int,int>
#define PLL pair<ll,ll>
#define PDD pair<double,double>
const int INF=0x3f3f3f3f;
const ll LLINF=0x3f3f3f3f3f3f3f3f;
const double PI=acos(-1.0);
const double eps=1e-6;
const int MAX=1e5+10;
const ll mod=1e9+7;
int main()
{
	int a,b,c;
	while(~scanf("%d%d%d",&a,&b,&c))
	{
		printf("%d\n",min(a*b,c));
	}
	return 0;
}

Measured memory_bytes: 256
n = gets.chomp.to_i
c = Array.new
s = Array.new
f = Array.new
(n-1).times do
    tmp = gets.chomp.split(" ").map(&:to_i)
    c.push(tmp[0])
    s.push(tmp[1])
    f.push(tmp[2])
end

for i in 0..(n-2) do
    ans = s[i]+c[i]
    for j in (i+1)..(n-2) do
        if ans - s[j] >= 0 then
            mod = (ans - s[j]) % f[j]
            if mod != 0 
                ans = s[j] + f[j] * ((ans - s[j]) / f[j] + 1)
            end
            ans += c[j]
        else
            ans = s[j] + c[j]
        end
    end
    puts ans
end
puts 0


Measured memory_bytes: 1788
#include <bits/stdc++.h>
using namespace std;
    int main(){
        // Your code here!
        int N;
        int F = 0;
        cin >> N;
            for(int i = 1; i <= 9; i++){
                for(int j = 1; j <= 9; j++){
                    if(N == i*j){
                        F = 1;
                    }else{}
                }
            }
        if(F == 1){
            cout << "Yes";
        }else{
            cout << "No";
        }
    }


Measured memory_bytes: 256
#include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <vector>
using namespace std;

constexpr double EPS = 1e-4;
typedef vector<double> vec;
typedef vector<vec> mat;

vec gauss_jordan(mat A) {
	const int n = static_cast<int>(A.size());
	for(int i = 0; i < n; ++i) {
		int pivot = i;
		for(int j = i; j < n; ++j) {
			if(abs(A[j][i]) > abs(A[pivot][i])) pivot = j;
		}
		A[i].swap(A[pivot]);

		if(abs(A[i][i]) < EPS) return vec();

		for(int j = i + 1; j <= n; ++j)
			A[i][j] /= A[i][i];

		for(int j = 0; j < n; ++j) {
			if(i != j) {
				for(int k = i + 1; k <= n; ++k)
					A[j][k] -= A[j][i] * A[i][k];
			}
		}
	}

	vec x(n);
	for(int i = 0; i < n; ++i)
		x[i] = A[i][n];

	return x;
}

struct compare {
	bool operator() (const vec& a, const vec& b) {
		if(a.size() != b.size()) return a.size() < b.size();
		const int n = static_cast<int>(a.size());
		for(int i = 0; i < n; ++i) {
			if(abs(a[i] - b[i]) > EPS) return a[i] + EPS < b[i];
		}
		return false;
	}
};

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

	for(int d; cin >> d, d;) {
		const int n = d + 3;
		vector<vec> expressions(n);
		for(int i = 0; i < n; ++i) {
			expressions[i].reserve(d + 2);
			for(int j = d; j >= 0; --j) {
				expressions[i].push_back(pow(i, j));
			}

			double value;
			cin >> value;
			expressions[i].push_back(value);
		}

		map<vec, int, compare> pattern;
		for(int i = 0; i < n; ++i) {
			for(int j = 0; j < n; ++j) {
				if(i == j) continue;

				mat A;
				A.reserve(n - 2);
				for(int k = 0; k < n; ++k) {
					if(i != k && j != k) A.push_back(expressions[k]);
				}

				vec ans = gauss_jordan(A);
				int& t = pattern[ans];
				for(int k = 0; k < n; ++k) {
					if(i != k && j != k) t |= (1 << k);
				}
			}
		}

		int correct = -1;
		for(const auto& e : pattern) {
			if(__builtin_popcount(e.second) == n - 1) {
				correct = e.second;
				break;
			}
		}

		for(int i = 0; i < n; ++i) {
			if(!(correct & (1 << i))) {
				cout << i << endl;
				break;
			}
		}
	}

	return EXIT_SUCCESS;
}

Measured memory_bytes: 1336
#include<stdio.h>
 
int main(void){
     
    int data,a,b,c,i;
     
    scanf("%d",&data);
     
    for(i=0;i<data;i++){
        scanf("%d %d %d",&a,&b,&c);
        if((c*c)==((a*a)+(b*b)) || (a*a)==((b*b)+(c*c)) || (b*b)==((a*a)+(c*c)))
            printf("YES\n");
        else
            printf("NO\n");
    }
     
    return 0;
 
}

Measured memory_bytes: 576
// </> : towhid1zaman

#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair< int, int > pii;
typedef pair< pii, int > ppi;
#define fill(a,b) memset(a,b,sizeof(a))
#define all(v) (v).begin(),(v).end()
#define sp(k) cout<<setprecision(k)<<fixed;
#define rep(i,a) for(int i=0;i<a;i++)
#define rep1(i,a,b) for(int i=(a);i<=(b);++i)
#define irep(i,b,a) for(int i=(b);i>=(a);--i)
#define minv(v) *min_element(all(v))
#define maxv(v) *max_element(all(v))
#define unq(v) sort(all(v)),(v).erase(unique(all(v)),(v).end())
#define _ ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define sqr(a) ((a)*(a))
#define sz(a) int(a.size())
#define ff first
#define ss second
#define pb push_back

const double pi = acos(-1.0);
const int mod = 1000000007; // (int)1e9+7
const int inf = 0x3f3f3f3f;
const int maxn = 2000100;



int main(){
        _
        int n; cin >> n;
        int price = ceil(n/(1.08));
        if((int)(price*(1.08))>n){
            cout<<":("<<endl;
        }
        else cout<<price<<endl;


return 0;
}




Measured memory_bytes: 256
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
    vector<int> X, Y;
    int x[30]={0, }, y[30]={0, }, cnt=1;
    string N, M;
    cin >> N >> M;
    for (int i=0;i<N.size();i++){
        x[N[i]-97]++;
        y[M[i]-97]++;
    }
    for (int i=0;i<30;i++){
        if (x[i])
        X.push_back(x[i]);
        if (y[i])
        Y.push_back(y[i]);
    }
    sort(X.begin(),X.end());
    sort(Y.begin(),Y.end());
    if (X.size()==Y.size()){
        for (int i=0;i<X.size();i++){
            if (X[i]!=Y[i]){
                cnt=0;
                break;
            }
        }
    }
    else
        cnt=0;
    cnt ? cout << "Yes" : cout << "No";
    return 0;
}

Measured memory_bytes: 776
// #include <boost/multiprecision/cpp_int.hpp>
// using namespace boost::multiprecision;

// #include <bits/extc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp> // tree
// #include <ext/pb_ds/hash_policy.hpp> // hash
// #include <ext/pb_ds/trie_policy.hpp> // trie
// #include <ext/pb_ds/priority_queue.hpp> // priority_queue
// using namespace __gnu_pbds;

#include <bits/stdc++.h>
using namespace std;

#define IOS() ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define X first
#define Y second
#define ALL(x) x.begin(), x.end()
#define RALL(x) x.rbegin(), x.rend()
#define Push push_back

using lli = long long;
using pii = pair<int, int>;
using pll = pair<lli, lli>;
using Double = long double;
template<typename T>
using Vector = vector<vector<T>>;
template<typename T>
using Prior = priority_queue<T>;
template<typename T>
using prior = priority_queue<T, vector<T>, greater<T>>;

const lli mod = 1E9 + 7;
const Double PI = 3.1415926535846;
const Double eps = 1e-8;

lli fastPow(lli base, lli exp, lli module = mod) {
	lli ans = 1;
	base %= module;
	while (exp) {
		if (exp & 1) ans = ans * base % module;
		base = base * base % module;
		exp >>= 1;
	}
	return ans;
}

bool millerRabin(lli n, lli a) {
	/*
	 * n < 4,759,123,141		3 : {2, 7, 61}
	 * n < 1,122,004,669,633	4 : {2, 13, 23, 1662803}
	 * n < 3,474,749,660,383	6 : {p in [2, 13]}
	 * n < 2^64					7 : 
	 * {2, 325, 9375, 28178, 450775, 9780504, 1795265022}
	 *
	 * else, random everytime gives a 75% of correction
	 */
	
	if (n < 2) return 0;
	if ((a = a%n) == 0) return 1;
	if (n & 1 ^ 1) return n == 2;
	
	lli lowb = (n - 1) & -(n - 1);
	lli tmp = (n - 1) / lowb; // lowbit of (n-1)
	lli t = __lg(lowb);
	lli x = 1;
	
	for (; tmp; tmp /= 2, a = a*a%n) {
		if (tmp & 1) x = x * a % n;
	}
	
	if (x == 1 or x == n - 1) return 1;
	
	while (--t) {
		if ((x = x*x%n) == n - 1) return 1;
	}
	
	return 0;
}

bool MR_PrimeFilter(lli n) {
	vector<lli> v[4];
	v[0] = {2, 7, 61};
	v[1] = {2, 13, 23, 1662803};
	v[2] = {2, 3, 5, 7, 11, 13};
	v[3] = {2, 325, 9375, 28178, 450775, 9780504, 1795265022};
	
	if (n < 4759123141LL) {
		for (lli x : v[0]) {
			if (!millerRabin(n, x)) return false;
		}
		return true;
	}
	if (n < 1122004669633LL) {
		for (lli x : v[1]) {
			if (!millerRabin(n, x)) return false;
		}
		return true;
	}
	if (n < 3474749660383LL) {
		for (lli x : v[2]) {
			if (!millerRabin(n, x)) return false;
		}
		return true;
	}
	for (lli x : v[3]) {
		if (!millerRabin(n, x)) return false;
	}
	return true;
}

void solve() {
	int n;
	cin >> n;
	
	lli tmpX, tmpY, digitCount = 0, sumCount = 0;
	while (n--) {
		cin >> tmpX >> tmpY;
		digitCount += tmpY;
		sumCount += tmpX * tmpY;
	}
	
	lli ans = (digitCount - 1) + (sumCount - 1) / 9;
	cout << ans << "\n";
}

int main() {
	int t = 1;
	// cin >> t;
	while (t--) {
		solve();
	}
	return 0;
}

Measured memory_bytes: 256
N,M=map(int,input().split())


A=[int(i) for i in (input().split(" "))]

A.sort()

BC = [list(map(int,input().split())) for _ in range(M)]

BC.sort(key=lambda x:x[1],reverse=True)

for b,c in BC:
    A.extend([c]*b)
    if len(A)>2*N:
        break

A.sort(reverse=True)
suma=0
#for i in A:
#    suma+=i

print(sum(A[:N]))

Measured memory_bytes: 35192
#ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif

#include <bits/stdc++.h>

using namespace std;

typedef long double ld;
typedef long long ll;

#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif

#define pb push_back
#define mp make_pair
#define sz(x) ((int) (x).size())
#define TASK "text"

const int inf = (int) 1.01e9;
const ld eps = 1e-9;
const ld pi = acos((ld) -1);

mt19937 mrand(random_device{} ()); 

int rnd(int x) {
  return mrand() % x;
}

void precalc() {
}

const int maxn = (int) 1e5 + 5;
int n;
int a[maxn];

int read() {
  if (scanf("%d", &n) < 1) {
    return false;
  }
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  return true;
}

const int logx = 30;
int have[logx];

void solve() {
  int x = 0;
  for (int i = 0; i < logx; i++) {
    have[i] = 0;
  }
  for (int i = 0; i < n; i++) {
    x ^= a[i];
    int bit = 0;
    while (!(a[i] & (1 << bit))) {
      bit++;
    }
    have[bit] = 1;
  }
  int cur = 0;
  int res = 0;
  for (int i = logx - 1; i >= 0; i--) {
    if (((x >> i) & 1) != cur) {
      if (!have[i]) {
        printf("-1\n");
        return;
      }
      res++;
      cur ^= 1;
    }
  }
  printf("%d\n", res);
}

int main() {
  precalc();
#ifdef LOCAL
  assert(freopen(TASK ".in", "r", stdin));
  assert(freopen(TASK ".out", "w", stdout));
#endif
  while (true) {
    if (!read()) {
      break;
    }
    solve();
#ifdef DEBUG
    eprintf("Time %.2f\n", (double) clock() / CLOCKS_PER_SEC);
#endif
  }
  return 0;
}


Measured memory_bytes: 640
#include <cstdio>
#include <cstring>

bool appear[26];

int main()
{
  char s[27];
  scanf("%s", s);
  for (char *p = s; *p; ++p)
  {
    appear[*p - 'a'] = true;
  }
  bool all = true;
  char firstnot;
  for (int i = 0; i < 26; ++i)
  {
    all &= appear[i];
    if (!all)
    {
      firstnot = i + 'a';
      break;
    }
  }
  if (!all)
  {
    printf("%s%c\n", s, firstnot);
  }
  else
  {
    if (strcmp(s, "zyxwvutsrqponmlkjihgfedcba") == 0)
    {
      puts("-1");
    }
    else
    {
      int i = 25;
      while (true)
      {
        char c = s[i];
        while (appear[s[i] - 'a'] && s[i] <= 'z')
        {
          ++s[i];
        }
        if (s[i] <= 'z')
        {
          break;
        }
        else
        {
          appear[c - 'a'] = false;
          s[i] = 0;
          --i;        
        }
      }
      puts(s);
    }
  }
  return 0;
}

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

int main() {
  int N, K;
  cin >> N >> K;
  vector<int> D(K);
  for (int i = 0; i < K; i++) {
    cin >> D[i];
  }
  while (true) {
    int n = N;
    while (n > 0) {
      int digit = n % 10;
      for (auto d : D) {
        if (digit == d) {
          goto next;
        }
      }
      n /= 10;
    }
    cout << N << endl;
    return 0;
  next:
    N++;
  }
  return 1;
}


Measured memory_bytes: 256
n=int(input())
h=list(map(int,input().split()))
dp=[0]*n

def cost(i,j):
    return abs(h[i]-h[j])

dp[1]=cost(1,0)

for i in range(2,n):
    dp[i]=min((dp[i-1]+cost(i,i-1),(dp[i-2]+cost(i,i-2))))

print(dp[n-1])

Measured memory_bytes: 13980
#include <bits/stdc++.h>
#define REP(i, n) for (int i = 0; i < (int)(n); i++)
#define FOR(i, a, b) for(int i = a; i < (int)b; i++)
#define ALL(v) (v).begin(),(v).end()
#define MOD 1000000007

using namespace std ;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

int main()
{
  int n, m, c ;
  cin >> n >> m >> c ;
  vector<int> b(m) ;
  vector<vector<int>> a(n,vector<int>(m)) ;
  int sum = 0 ;
  int count = 0 ;
  
  REP(i,m){
    cin >> b.at(i) ;
  }
  REP(i,n){
    REP(j,m){
      cin >> a.at(i).at(j) ;
    }
  }
  REP(i,n){
    REP(j,m){
      sum += a.at(i).at(j)*b.at(j) ;
    }
 //   cout << sum <<endl ;
    if(sum+c>0){
      count++ ;
    }
    sum = 0 ;
  }
      
  cout << count <<endl ;  

  return 0 ;
}




Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <algorithm>
#include <string>
#include <sstream>
#include <complex>
#include <vector>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <map>
#include <set>
#include <fstream>

using namespace std;
#define TOSTRING(x) #x
#define SZ(x) (int)(x).size()
#define REP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REPR(i,n) for(int i=(n)-1;i>=0;i--)
#define ALL(s) (s).begin(), (s).end()
#define so(V) sort(ALL(V))
#define rev(V) reverse(ALL(V))
#define uni(v) v.erase( unique(ALL(v)) , v.end());
#define PAU system("pause")

typedef long long unsigned int llu;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<bool> vb;
typedef vector<vi> vvi;
typedef vector<vll> vvll;
typedef vector<vb> vvb;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;
const int INF = (1 << 28);
const double PI = acos(-1);

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	vi V;
	FOR(i, 1, 10) {
		V.push_back(111 * i);
	}
	int N;
	cin >> N;
	cout << *lower_bound(ALL(V),N) << endl;
	PAU;
	return 0;
}


Measured memory_bytes: 504
#include <float.h>
#include <inttypes.h>
#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <math.h>
#ifdef __cplusplus
#include <bits/stdc++.h>
#endif

uint32_t nextpint(void){ char c=getchar_unlocked(); while(c<'0'||'9'<c) c=getchar_unlocked(); uint32_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return x; }
uint64_t nextplong(void){ char c=getchar_unlocked(); while(c<'0'||'9'<c) c=getchar_unlocked(); uint64_t x=0; while('0'<=c && c<='9'){ x=x*10+c-'0'; c=getchar_unlocked(); } return x; }

uint32_t a[200001];
uint32_t s[200001];
int main(void){
	uint32_t n=nextpint();
	uint64_t k=nextplong();
	for(uint32_t i=1; i<=n; i++){
		a[i]=nextpint();
	}
	uint32_t now=1;
	for(; k>0; k--){
		now = a[now];
		if(s[now]==0){
			s[now]=k;
		}else{
			uint32_t m=s[now]-k;
			k=(k-1)%m;
			break;
		}
	}
	for(; k>0; k--){
		now = a[now];
	}
	printf("%"PRIu32"\n", now);
}


Measured memory_bytes: 3164
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;

typedef long long ll;
const ll INF = 1001001001001001;

int main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    ll n, s;
    cin >> n >> s;
    if(n == s){
        cout << n + 1 << "\n";
        return 0;
    }
    
    for(ll i = 2; i * i <= n; ++i){
        ll temp = n;
        ll res = 0;
        
        while(temp > 0){
            res += temp % i;
            temp /= i;
        }
        
        if(res == s){
            cout << i << "\n";
            return 0;
        }
    }

    ll ans = INF;
    for(ll i = 1; i * i < n; ++i){
        if((n - s) % i != 0)    continue;
        
        ll b = (n - s) / i + 1;
        if(b < 2)      continue;
        
        ll temp = n;
        ll res = 0;
            
        while(temp > 0){
            res += temp % b;
            temp /= b;
        }
            
        if(res == s){
            ans = min(ans, b);
        }
    }
    
    if(ans == INF)      ans = -1;
    cout << ans << "\n";
}

Measured memory_bytes: 384
#include <cstdio>
#include <cstring>
#include <algorithm>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
#define rep(i,a) for(int i=lst[a];i;i=nxt[i])
#define mp(a,b) make_pair(a,b)
using namespace std;

typedef pair<int,int> pii;
#define fi first 
#define se second 

int read() {
	char ch;
	for(ch=getchar();ch<'0'||ch>'9';ch=getchar());
	int x=ch-'0';
	for(ch=getchar();ch>='0'&&ch<='9';ch=getchar()) x=x*10+ch-'0';
	return x;
}

const int N=2e3+5;

int t[N<<1],nxt[N<<1],lst[N],l;
void add(int x,int y) {t[++l]=y;nxt[l]=lst[x];lst[x]=l;}

int n,m,deg[N],fa[N][11],dep[N],c[N],u[N],v[N],p[N];
bool col[N],ban[N];
pii now[N];

void dfs(int x,int y) {
	dep[x]=dep[y]+1;fa[x][0]=y;
	rep(i,x) if (t[i]!=y) dfs(t[i],x);
}

int lca(int x,int y) {
	if (dep[x]<dep[y]) swap(x,y);
	fd(j,10,0) if (dep[fa[x][j]]>dep[y]) x=fa[x][j];
	x=dep[x]==dep[y]?x:fa[x][0];
	fd(j,10,0) if (fa[x][j]!=fa[y][j]) x=fa[x][j],y=fa[y][j];
	return x==y?x:fa[x][0];
}

void calc(int x,int y) {rep(i,x) if (t[i]!=y) calc(t[i],x),c[x]+=c[t[i]];}

int main() {
	n=read();m=read();
	fo(i,1,n-1) {
		int x=read(),y=read();
		add(x,y);add(y,x);
		deg[x]++;deg[y]++;
	}
	dfs(1,0);
	fo(j,1,10) fo(i,1,n) fa[i][j]=fa[fa[i][j-1]][j-1];
	fo(i,1,m) {
		u[i]=read(),v[i]=read();
		int z=lca(u[i],v[i]);
		c[u[i]]++;c[v[i]]++;c[z]-=2;
	}
	calc(1,0);
	fo(i,1,m) now[i]=mp(u[i],v[i]);
	int ans=0;
	fo(i,1,n) ans+=min(c[i],2);
	printf("%d\n",ans);
	fo(tim,1,n-1) {
		int x,y;
		fo(i,2,n) if (!ban[i]&&deg[i]==1) {x=i;break;}
		rep(j,x) if (!ban[t[j]]) y=t[j];
		ban[x]=1;deg[y]--;
		int p1=0,p2=0;
		fo(i,1,m)
			if ((now[i].fi==x)^(now[i].se==x)) {
				if (!p1) p1=i;
				else if (!p2) p2=i;
			}
		if (!p1) continue;
		if (!p2) {
			if (now[p1].fi==x) now[p1].fi=y;
			else now[p1].se=y;
			continue;
		}
		if (now[p1].fi==x) {
			if (now[p2].fi==x) {
				now[p1].fi=now[p2].se;
				col[p2]^=1;
			} else now[p1].fi=now[p2].fi;
		} else {
			if (now[p2].se==x) {
				now[p1].se=now[p2].fi;
				col[p2]^=1;
			} else now[p1].se=now[p2].se;
		}

		p[p2]=p1;now[p2].fi=now[p2].se;
		fo(i,1,m) {
			if (now[i].fi==x) now[i].fi=y;
			if (now[i].se==x) now[i].se=y;
		}
	}
	fo(i,1,m) if (p[i]) col[i]^=col[p[i]];
	fo(i,1,m) {
		if (col[i]) swap(u[i],v[i]);
		printf("%d %d\n",u[i],v[i]);
	}
	return 0;
}

Measured memory_bytes: 384
from sys import setrecursionlimit, exit
setrecursionlimit(1000000000)

def main():
    a, b, c, d = map(int ,input().split())
    while a > 0 and c > 0:
        c -= b
        if c <= 0:
            print('Yes')
            break
        a -= d
        if a <= 0:
            print('No')

main()

Measured memory_bytes: 9164
#include<bits/stdc++.h>
using namespace std;
#define int long long
set<int> G[114514];
signed main(){
  int n;
  cin>>n;
  int a[n],b[n];
  for(int i=0;i<n-1;i++){
    cin>>a[i]>>b[i];
    a[i]--;b[i]--;
    G[a[i]].insert(b[i]);
    G[b[i]].insert(a[i]);
  }
  bool f=0;
  queue<int> q;
  for(int i=0;i<n;i++){
    int tmp=0;
    int k;
    for(int u:G[i]){
      if(G[u].size()==1){
	tmp++;
	k=u;
      }
    }
    f|=(tmp>=2);
    if(f){
      cout<<"First"<<endl;
      return 0;
    }
    if(G[i].size()==2&&tmp==1){
      G[i].erase(k);
      G[k].erase(i);
      int u=*G[i].begin();
      G[i].erase(u);
      G[u].erase(i);
      q.push(u);
      for(int v:G[u]) if(G[v].size()>1) q.push(v);
    }
  }
  while(!q.empty()){
    int i=q.front();q.pop();
    int tmp=0;
    int k;
    for(int u:G[i]){
      if(G[u].size()==1){
	tmp++;
	k=u;
      }
    }
    f|=(tmp>=2);
    if(f){
      cout<<"First"<<endl;
      return 0;
    }
    if(G[i].size()==2&&tmp==1){
      G[i].erase(k);
      G[k].erase(i);
      int u=*G[i].begin();
      G[i].erase(u);
      G[u].erase(i);
      q.push(u);
      for(int v:G[u]) if(G[v].size()>1) q.push(v);
    }
  }
  cout<<(f?"First":"Second")<<endl;
  return 0;
}


Measured memory_bytes: 17152
#include<iostream>
#include<cstdio>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<set>
#include<list>
#include<queue>
#include<deque>
#include<unordered_map>
#include<map>
#include<string>
#include<cstring>
#include<stack>
#include<cmath>

#define vint vector<int>
#define vstr vector<string>
#define vll vector<long long>
#define ll long long
#define pf printf
#define sf scanf
#define sfd(n) scanf("%d", &n)
#define sflf(n) scanf("%lf", &n)
#define sfll(n) scanf("%lld", &n)
#define pfd(n) printf("%d", n)
#define pflf(n) printf("%lf", n)
#define pfll(n) printf("%lld", n)
#define pft	printf("\t")
#define pfn printf("\n")
#define pfk printf(" ")
#define PI 3.1415926
#define MAX 100000
#define M 100003

using namespace std;

int main() {
//	int n;
//	sfd(n);
// 	double* value = new double[n];
//	for( int i=0; i<n; i++ ) {
//		sflf(value[i]);
//	}
	int k, x;
	sfd(k);
	sfd(x);
	for( int i=(x-k+1>=-1000000?x-k+1:-1000000); i<=x+k-1&&i<=1000000; i++ ) {
		pfd(i);
		pfk;
	}
	

	
	return 0;
}

Measured memory_bytes: 256
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <queue>

#define ll long long

using namespace std;

const int N = 60;
const int mod = 1e9 + 7;

inline int read() {
	int jg = 0, jk = getchar() - '0', f = 1;
	while(jk < 0 || jk > 9) {
	    if(jk == '-' - '0')  f = -1;
		jk = getchar() - '0';
	}
	while(jk >= 0 && jk <= 9)
		jg *= 10, jg += jk, jk = getchar() - '0';
	return jg * f;
}

int n, mx, sum;
 
int main() {
	//freopen("a.txt", "r", stdin);
    n = read();
	for(int i = 1, l; i <= n; ++i) {
		l = read();
		sum += l;
		mx = max(mx, l);
	}
	if(sum > 2 * mx)  printf("Yes");
	else  printf("No");
    return 0;
}

Measured memory_bytes: 3744
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const int INF = pow(10, 7);
int main(){
  int n, d;cin>>n>>d;
  d = 2*d+1;
  cout<<n/d+int(n%d!=0)<<endl;
}

Measured memory_bytes: 256