akhauriyash/Code-Regression huggingface dataset:
/* ex7_3
   YSK722 */

#include <stdio.h>
#include <stdlib.h>

int main(void){
    int height, width;
    char **box1, **box2, **box3;
    scanf("%d %d", &height, &width);
    // 各行の配列へのポインタ分のメモリ領域を確保
    box1 = (char**)calloc(height, sizeof(char*));
    box2 = (char**)calloc(height, sizeof(char*));
    box3 = (char**)calloc(height, sizeof(char*));
    if (box1 == NULL || box2 == NULL || box3 == NULL){
        exit(1);
    }
    // 各行の要素分のメモリ領域を確保
    for (int i = 0; i < height; i++){
        box1[i] = (char*)calloc(width, sizeof(char));
        if (box1[i] == NULL){
            exit(1);
        }
    }
    for (int i = 0; i < height; i++){
        box2[i] = (char*)calloc(width, sizeof(char));
        if (box2[i] == NULL){
            exit(1);
        }
    }
    for (int i = 0; i < height; i++){
        box3[i] = (char*)calloc(width, sizeof(char));
        if (box1[i] == NULL){
            exit(1);
        }
    }
    // 白黒を読み取る
    for (int i = 0; i < height; i++){
        for (int j = 0; j < width; j++){
                scanf(" %c", &box1[i][j]);
            }
        }
    /* i行の要素が全て白のとき、2つめのboxのi行目の
    要素をすべて"n"にし、それ以外の時はすべて"y"にする */
    for (int i = 0; i < height; i++){
        for (int j = 0; j < width; j++){
            if (box1[i][j] == '#'){
                for (int k = 0; k < width; k++){
                    box2[i][k] = 'y';
                }
                break;
            }
            box2[i][j] = 'n';
        }
    }
    /* j列の要素が全て白のとき、3つめのboxのj列目の
    要素をすべて"n"にし、それ以外の時はすべて"y"にする */
    for (int j = 0; j < width; j++){
        for (int i = 0; i < height; i++){
            if (box1[i][j] == '#'){
                for (int k = 0; k < height; k++){
                    box3[k][j] = 'y';
                }
                break;
            }
            box3[i][j] = 'n';
        }
    }
    /* 2つめ、3つめのboxの対応する要素がどちらとも"y"のときだけ
       boxの要素を出力する */
    for (int i = 0; i < height; i++){
        for (int j = 0; j < width; j++){
            if (box2[i][j] == 'y' && box3[i][j] == 'y'){
                printf("%c", box1[i][j]);
            }
        }
        printf("\n");
    }
    for (int i = 0; i < height; i++){
        free(box1[i]);
    }
    free(box1);
    for (int i = 0; i < height; i++){
        free(box2[i]);
    }
    free(box2);
    for (int i = 0; i < height; i++){
        free(box3[i]);
    }
    free(box3);
    return 0;
}

Measured memory_bytes: 1680
#include <bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define mem(a,b) memset(a,b,sizeof(a))
#define eb emplace_back
#define mp make_pair
using namespace std;
ll t1,t2,a1,a2,b1,b2;
int main(){
    cin>>t1>>t2>>a1>>a2>>b1>>b2;
    if(t1*a1+t2*a2==t1*b1+t2*b2){
        cout<<"infinity"<<endl;
    }else{
        ll dis1=t1*a1-t1*b1;
        ll dis2=dis1+t2*a2-t2*b2;
        if(dis1>0&&dis2>0||dis1<0&&dis2<0){
            cout<<0<<endl;
        }else{
            ll dis=t1*(a1-b1)+t2*(a2-b2);
            if(dis1<0){
                swap(a1,b1),swap(a2,b2);
            }
            dis=abs(dis),dis1=abs(dis1);
            cout<<dis1/dis*2+(dis1%dis!=0)<<endl;
        }
    }
    return 0;
}

Measured memory_bytes: 256
import java.util.Scanner;

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

        while(true){
        n = sc.nextInt();
        if(n==0) break;
        double s[] = new double[n];
        double m, sum = 0d, sum2 = 0d;
        double result;

        for(int i=0; i<n; i++){
            s[i] = (double)sc.nextInt();
            sum += s[i]; 
        }
        m = sum / n;

        for(int i=0; i<n; i++){
            sum2 += Math.pow(s[i]-m, 2);
        }
        result = Math.sqrt(sum2/n); 

        System.out.printf("%.8f\n", result);
    }
    }
}


Measured memory_bytes: 31952
#include <iostream>
#include <algorithm>
using namespace std;
int main(void){
    int n,k,kari[110];
    cin>>n>>k;
    
    for(int i=1;i<=n;i++){
        kari[i]=0;
    }
    
    int kasi[110],kosu[110][110];
    
    for(int i=0;i<k;i++){
        cin>>kasi[i];
        
        for(int g=0;g<kasi[i];g++){
            cin>>kosu[i][g];
            kari[kosu[i][g]]=1;
        }
    }
    
    int ans=0;
    
    for(int i=1;i<=n;i++){
        if(kari[i]==0){
            ans++;
        }
    }
    cout<<ans;
}


Measured memory_bytes: 3584
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sc = new Scanner(System.in);

		int k = sc.nextInt();
		int a = sc.nextInt();
		int b = sc.nextInt();

		for(int i = a; i <= b; i++){
			if(i % k == 0){
				System.out.println("OK");
				return;
			}
		}
		System.out.println("NG");
	}

}


Measured memory_bytes: 27068
#include<iostream>
#include<string>
#include<cstdio>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<vector>
#include<utility>
#include<queue>
#include<stack>
#include<set>
#include<map>
#include<unordered_set>
#include<bitset>
using namespace std;
//#define MODE 1
#ifdef MODE
#define DEB(X) cout<< #X <<": "<<X<<" ";
#define ARDEB(i,X) cout<< #X <<"["<<i<<"]: "<<X[i]<<" ";
#define END cout<<endl;
#else
#define DEB(X) {}
#define ARDEB(i,X) {}
#define END {}
#endif
typedef long long int ll;
//typedef pair<int,int> P;
struct edge{int to,cost;};
#define REP(i,n) for(int i=0;i<(n);i++)
const int INF=100000000;

int main(){
	string s;
	cin>>s;
	int count=0,pos=0;
	if(s[0]!='A'){
		cout<<"WA"<<endl;
		return 0;
	}
	for(int i=2;i<=s.size()-2;i++){
		if(s[i]=='C'){
			count++,pos=i;
		}
	}
	if(count!=1){
		cout<<"WA"<<endl;
		return 0;
	}
	count=0;
	for(int i=0;i<s.size();i++){
		if(i!=0&&i!=pos&&'a'<=s[i]&&s[i]<='z'){
			count++;
		}
	}
	if(count+2!=s.size()){
		cout<<"WA"<<endl;
		return 0;
	}
	cout<<"AC"<<endl;
	return 0;
}


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

int main() {
    int n, l;
    cin >> n >> l;
    string ans="";
    vector<string> s(n);
    rep(i,n) cin >> s[i];
    sort(all(s));
    rep(i,n) ans+=s[i];
    cout << ans << endl;
    return 0;
}

Measured memory_bytes: 3652
#include <bits/stdc++.h>
#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define RFOR(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define rep(i,n) FOR(i,0,(n))
#define REPS(i,n) FOR(i,1,(n)+1)
#define RREP(i,n) RFOR(i,0,(n))
#define rng(x) (x).begin(),(x).end()
#define rrng(x) (x).rbegin(),(x).rend()
#define debug(x) cout << #x << " = " << (x) << endl;
#define SORT(x) sort(rng(x))
#define RSORT(x) sort(rrng(x))
#define SUM(x) accumulate(rng(x),0)
#define fi first
#define se second
#define pb push_back
#define eb emplace_back
#define sz(x) (int)(x).size()
#define bn(x) ((1<<x)-1)
#define dup(x,y) (((x)+(y)-1)/(y))
#define uni(x) x.erase(unique(rng(x)),x.end())
#define SP << " " <<
using namespace std;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using pii = pair<int, int>;
using tiii = tuple<int, int, int>;
const int mod = 1000000007;
const double EPS = 1e-9;
const int INF = (1<<30)-1;
const ll INFLL = (1LL<<62)-1;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//cout << fixed << setprecision(10);

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; }

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

//const int mod = 1000000007;
struct mint {
  ll x;
  mint(ll x=0):x(x%mod){}
  mint& operator+=(const mint a) {
    if ((x += a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator-=(const mint a) {
    if ((x += mod-a.x) >= mod) x -= mod;
    return *this;
  }
  mint& operator*=(const mint a) {
    (x *= a.x) %= mod;
    return *this;
  }
  mint operator+(const mint a) const {
    mint res(*this);
    return res+=a;
  }
  mint operator-(const mint a) const {
    mint res(*this);
    return res-=a;
  }
  mint operator*(const mint a) const {
    mint res(*this);
    return res*=a;
  }
  mint pow(ll t) const {
    if (!t) return 1;
    mint a = pow(t>>1);
    a *= a;
    if (t&1) a *= *this;
    return a;
  }

  // for prime mod
  mint inv() const {
    return pow(mod-2);
  }
  mint& operator/=(const mint a) {
    return (*this) *= a.inv();
  }
  mint operator/(const mint a) const {
    mint res(*this);
    return res/=a;
  }
};

struct combination {
  vector<mint> fact, ifact;
  combination(int n):fact(n+1),ifact(n+1) {
    fact[0] = 1;
    for (int i = 1; i <= n; ++i) fact[i] = fact[i-1]*i;
    ifact[n] = fact[n].inv();
    for (int i = n; i >= 1; --i) ifact[i-1] = ifact[i]*i;
  }
  mint operator()(int n, int k) {
    if (k < 0 || k > n) return 0;
    return fact[n]*ifact[k]*ifact[n-k];
  }
} comb(100005);
// comb(n,k)ならcomb(n+k+5)とかにしておく

mint f(int n, int k) {
  if (n < 0) return 0;
  mint res = comb(n,k);
  // nPk = nCk * k!
  //res *= comb.fact[k]; // <- nPk求めたいときは必要
  return res;
}
// f(n,k).x で nCk か nPk が計算される

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

  FOR(i,1,k+1) {
    mint ans = f(n-k+1,i).x * f(k-1,i-1).x;
    printf("%d\n", ans);
  }

  return 0;
}

Measured memory_bytes: 1792
N, M = [int(x) for x in input().split()]
A = [int(input()) for _ in range(M)]

aset = set(A)
MOD = 10 ** 9 + 7

dp = [0] * (N + 1)

if 1 not in aset:
    dp[1] = 1

if 2 not in aset and N >= 2:
    dp[2] += dp[1] + 1

for i in range(3, N + 1):
    if i in aset:
        continue

    dp[i] += dp[i - 1]
    dp[i] += dp[i - 2]

print(dp[N] % MOD)


Measured memory_bytes: 468500
import java.math.*;
import java.util.*;

public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int N = scan.nextInt();
        int num = 0;
        for(int i = 0; i < N; ++i) {
            String s;
            s = scan.next();
            if(new BigInteger(s).isProbablePrime(5)) ++num;
        }
        System.out.println(num);
    }
}

Measured memory_bytes: 0
#include <bits/stdc++.h>
using namespace std;
#define ll long long
char a[100100];
int main()
{
    int i,j,k,m,n,cnt=0;
    cin>>a;
    n=strlen(a);
    char b=a[0];
    for(i=1;i<n;i++)
    {
        if(a[i]!=b)
        {
            cnt++;
            b=a[i];
        }
    }
    cout<<cnt<<endl;
    return 0;
}



Measured memory_bytes: 384
use proconio::input;

fn main() {
    input! {
        n: usize,
        a: [usize; n-1],
    }

    let mut b = Vec::new();
    b.resize(n, 0);
    for x in a {
        b[x - 1] += 1;
    }
    for x in b {
        println!("{}", x);
    }
}


Measured memory_bytes: 5536
a=int(input())
b=int(input())
c=int(input())
d=int(input())
e=int(input())
s=a+b+c+d+e
li=[a,b,c,d,e]
for i in range(5) :
   li[i]=10-(li[i]%10)
while 10 in li :
   li.remove(max(li))
if len(li)>0 :
   li.remove(max(li))
print(s+sum(li))

Measured memory_bytes: 3064
#                          JAI SHREE RAM

import math; from collections import *
import sys; from functools import reduce

def get_ints(): return map(int, input().strip().split())
def get_list(): return list(get_ints())
def getlistofstring(): return list(input().strip().split())
def printxsp(*args): return print(*args, end="")
def printsp(*args): return print(*args, end=" ")

UGLYMOD = int(1e9)+7; SEXYMOD = 998244353; MAXN = int(1e5)

# sys.setrecursionlimit(10**6)
# sys.stdin=open("input.txt","r");sys.stdout=open("output.txt","w")

# for _testcases_ in range(int(input())):
li = getlistofstring()
if li[1] == '+':
    print(int(li[0])+int(li[2]))
else:
    print(int(li[0])-int(li[2]))
'''
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
THE LOGIC AND APPROACH IS MINE @luctivud ( UDIT GUPTA )
Link may be copy-pasted here if it's taken from other source.
DO NOT PLAGIARISE.
>>> COMMENT THE STDIN!! CHANGE ONLINE JUDGE !!
'''

Measured memory_bytes: 67420
#include<bits/stdc++.h>
using namespace std;
 
#define P(p) cout<<(p)<<endl
#define rep(i,m,n) for(int i = (m); i < (int)(n); i++)
#define rrep(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define vsort(v) sort(v.begin(), v.end());
#define rvsort(v) sort(v.begin(), v.end(),greater<int>());
#define YES cout<<"YES"<< endl
#define NO cout<<"NO"<<endl
#define Yes cout<<"Yes"<<endl
#define No cout<<"No"<<endl  
#define yes cout<<"yes"<<endl
#define no cout<<"no"<<endl
#define ret return
#define lb(v,n) lower_bound(v.begin(),v.end(),n)
#define ub(v,n) upper_bound(v.begin(),v.end(),n)
#define mae(v) max_element(v.begin(),v.end())
#define mie(v) min_element(v.begin(),v.end())
#define INF 0x7FFFFFFF
#define mod 1000000007
typedef long long ll;
////////////////////////////////////////////////////////////

int main(){
	int n;
	cin >> n;
	ll a[n];
	rep(i,0,n)
		cin >> a[i];

	ll cnt = 0;
	rep(i,0,n){
		while( a[i] > 0  && a[i] % 2 == 0){
			a[i] /= 2;
			cnt++;
		}
	}

	cout << cnt << endl;
	ret 0;
}

Measured memory_bytes: 384
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <string>
#include <cstring>
#include <map>
using namespace std;

int h, w, group[400][400];
string s[400];

int dr[4] = {1, 0, -1, 0},
    dc[4] = {0, 1, 0, -1};

bool isInside(int r, int c) {
  return 0 <= r and r < h and 0 <= c and c < w;
}

void dfs(int r, int c, int id) {
  group[r][c] = id;

  for (int i = 0; i < 4; i++) {
    int nr = r + dr[i],
        nc = c + dc[i];
    if (isInside(nr, nc) and s[r][c] != s[nr][nc] and group[nr][nc] < 0) {
      dfs(nr, nc, id);
    }
  }
}

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

  cin >> h >> w;

  for (int r = 0; r < h; r++) {
    cin >> s[r];
  }

  memset(group, -1, sizeof(group));

  int id = 0;
  for (int r = 0; r < h; r++) {
    for (int c = 0; c < w; c++) {
      if (group[r][c] < 0) {
        dfs(r, c, id);
        id++;
      }
    }
  }

  vector<int64_t> numBlack(id, 0), numWhite(id, 0);
  for (int r = 0; r < h; r++) {
    for (int c = 0; c < w; c++) {
      if (s[r][c] == '#') numBlack[group[r][c]]++;
      else numWhite[group[r][c]]++;
    }
  }

  int64_t ans = 0;
  for (int i = 0; i < id; i++) {
    ans += numBlack[i] * numWhite[i];
  }
  cout << ans << endl;

  return 0;
}

Measured memory_bytes: 18560
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>

#define rep(i, n) for(int i=0; i<(n); ++i)
#define max  200001

//qsort(str, n, sizeof(int), up_comp);
int up_comp(const void *a, const void *b){return *(int*)a - *(int*)b;}
int down_comp(const void *a, const void *b){return *(int*)b - *(int*)a;}
int int_sort( const void * a , const void * b ) {return strcmp(( char * )a , ( char * )b );}
int count_digit(int a){int i=0;while(a!=0){a=a/10;i++;}return i;}
int euclid( int a, int b ){int temp;if(a<b){temp=a;a=b;b=temp;}if(b<1)return -1;if(a%b==0) return b;return euclid(b,a%b);}

int main(void){
 
    int ans=0, amax=INT_MIN, flag=0;
    char s[11];
    
    scanf("%s", s);
    
    rep(i, strlen(s)){
        if (s[i]=='A'||s[i]=='T'||s[i]=='C'||s[i]=='G') {
            ans++;
        } else {
            if (amax<ans) {
                amax=ans;
            }
            ans=0;
        }
        
    }
    
    printf("%d", (int)fmax(ans, amax));
    
    return 0;
}


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

int n, k;
long long T[MAX+1];

int check(long long P){
	int i = 0;
	for(int j = 0; j < k; j++){
		long long s = 0;
		while(s + T[i] <= P){
			s += T[i];
			i++;
			if(i == n) return n;
		}
	}
	return i;
}

int slove(){
	long long left = 0, right = (long long)100000*(long long)100000, mid;
	while(right - left > 1){
		mid = (left + right) / 2;
		long long v = check(mid);
		if(v >= n) right = mid;
		else left = mid;
	}
	
	return right;
}

int main(){
	cin >> n >> k;
	rep(i, n) cin >> T[i];
	long long ans = slove();
	cout << ans << endl;
	
	return 0;
}


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

int main(){
	
	int n;
	int a, b, c, d;
	int combsum=0;

	while(cin >> n){
		for( a=0;a<=9;a++ )
			for( b=0;b<=9;b++ )
				for( c=0;c<=9;c++ )
					for( d=0;d<=9;d++ )
						if( a+b+c+d == n )
							combsum++;

		cout << combsum << endl;
                combsum = 0;
	}
	return 0;
}

Measured memory_bytes: 1160
#include<bits/stdc++.h>
using namespace std;
int main() {
  int n; cin >> n;
  auto f = [](int x) {
    int cnt = 0;
    for (int i = 1; i <= x; i++) {
      cnt += (x % i == 0);
    }
    return cnt == 8;
  };
  int r = 0;
  for (int i = 1; i <= n; i += 2) {
    r += f(i);
  }
  cout << r << endl;
}

Measured memory_bytes: 256
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0; i<(n); ++i)
using namespace std;
using ll=long long;
int main(){
    string s;
    cin>>s;
    int n=s.length();
    if(n<=25){
        set<char>se;
        rep(i,n){
            se.insert(s[i]);
        }
        for(int i='a'; i<='z'; ++i){
            if(se.find(i)==se.end()){
                s+=i;
                break;
            }
        }
        cout<<s<<endl;
    }
    else{
        if(s=="zyxwvutsrqponmlkjihgfedcba"){
            cout<<-1<<endl;
        }
        else{
            vector<char>x;
            int max1=0;
            while(!s.empty()){
                char c=s.back();
                x.push_back(c);
                s.pop_back();
                sort(x.rbegin(),x.rend());
                if(c!=x[0]){
                    sort(x.begin(),x.end());
                    int cnt;
                    for(int i=0; i<x.size(); ++i){
                        if(x[i]==c)cnt=i+1;
                    }
                    cout<<s<<x[cnt]<<endl;
                    return 0;
                }
            }
        }
    }
}


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

int main()
{
	long long sum=0;
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
		for(int j=1;j<=n;j++)
			for(int k=1;k<=n;k++)
				sum+=__gcd(__gcd(i,j),k);
	cout<<sum;		
	return 0;
}


Measured memory_bytes: 3624
#include <bits/stdc++.h>
 
#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)
 
#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=(int)(a)-1;i>=(int)(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)
 
#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define bit(n) (1LL<<(n))
 
// #define DEBUG
 
#ifdef DEBUG
    #define dump(...) fprintf(stderr, __VA_ARGS__)
#else
    #define dump(...)
#endif
 
template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}
 
using namespace std;
using ll=long long;
using vi=vector<int>;
using vll=vector<ll>;
 
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int inf = INT_MAX;
const ll INF = LLONG_MAX;
const ll MOD = 1000000007LL;
const int dx[4]={1,0,-1,0};
const int dy[4]={0,1,0,-1};
 
ll extgcd(ll a,ll b,ll& x,ll& y){x=1,y=0;ll g=a;if(b!=0) g=extgcd(b,a%b,y,x),y-=a/b*x;return g;}
ll ADD(const ll &a, const ll &b, const ll mod=MOD) { return (a+b)%mod;}
ll SUB(const ll &a, const ll &b, const ll mod=MOD) { return (a-b+mod)%mod;}
ll MUL(const ll &a, const ll &b, const ll mod=MOD) { return (1LL*a*b)%mod;}
ll DIV(const ll &a, const ll &b, const ll mod=MOD) {ll x,y; extgcd(b,mod,x,y);return MUL(a,(x+mod)%mod,mod);}
 
int main(void){
    cin.tie(0);
    ios::sync_with_stdio(false);

    int n, M; cin >> n >> M;

    int res = 1;
    rep(i, 1, (int)sqrt(M) + 1){
        if(M % i == 0){
            int A = i, B = M / i;
            rep(_, 2){
                if(A >= n){
                    chmax(res, B);
                }
                swap(A, B);
            }
        }
    }

    cout << res << endl;

    return 0;
}


Measured memory_bytes: 256
d, n = map(int, input().split())
counter = 0
for i in range(1, 10000000000000000000000):
  warisuu = 0
  j = i
  while j % 100 == 0:
    j //= 100
    warisuu += 1
  if warisuu == d:
    counter += 1
    if counter == n:
      print(i)
      break


Measured memory_bytes: 40556
/**
     **author : _KMS_
     **created : 05-03-2020
**/
#include<bits/stdc++.h>
using namespace std;
const long long M =6e5,MOD=2e9;
typedef long long ll;

int main() {
      
   ios::sync_with_stdio(false);
   cin.tie(0);
    ll h , n;
    cin >> h >> n;
    ll dam[n+1], mana[n+1];
    for(ll i = 0; i < n; i++){
        cin >> dam[i] >> mana[i];
    }
    ll minmana[h+1];
    for(ll i = 0; i <= h; i++){ minmana[i] = INT_MAX;}
    for(ll i = 1; i <= h; i++){
        for(ll j = 0; j < n; j++){
            ll temp;
            if(dam[j] >= i){
                temp = mana[j];
            }
            else{
                temp = mana[j] + minmana[i-dam[j]];
            }
            if(temp < minmana[i]) minmana[i] = temp;
        }
    }
    cout << minmana[h] << endl;
   
   return 0;
}

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

#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define orep(i, n) for(int i = 1; i < (int)(n); ++i)
#define rrep(i, n) for(int i = (n)-1; i >= 0; i--)
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
using namespace std;
typedef long long ll;
typedef pair<int, int> P;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<P> vp;
const ll LINF = 1001002003004005006ll;
const int INF = 1001001001;

int main() {
    ll n;
    cin >> n;
    ll ans = LINF;
    for (ll i = 1; i < (int) sqrt(n) + 1; i++) {
        if (n % i == 0) { //iで割り切れるとき
            ans = min(ans, (i - 1) + (n / i - 1));
        }
    }
    cout << ans << endl;

    return 0;
}



Measured memory_bytes: 384
def make_divisors(n):
	divisors = []
	for i in range(1, int(n**0.5)+1):
		if n % i == 0:
			divisors.append(i)
			if i != n // i:
				divisors.append(n//i)
	divisors.sort()
	return divisors

N = int(input())
D = make_divisors(N)
L = len(D)
I = D[L//2]
J = N//I
C = (I+J)-2
print(C)

Measured memory_bytes: 3268
#include <bits/stdc++.h>
#define rep(i,n) for(int (i)=0;(i)<(n);(i)++)
#define rep2(i,a,n) for(int i=a;i<n;i++)
#define been(ix) (ix).begin(),(ix).end()
using namespace std;
typedef long long ll; 
typedef vector<int> vi;
typedef vector<long long> vl;
const ll INFL = 1e18;
const int INF = 1001001001; 
typedef pair<int,int> P;
#define foreach(ix,i) for(auto& (ix) : (i))
typedef long double ld;
const int mod =1000000007;
int main(){
    int a,b;
    cin>>a>>b;
    if(a<=b)cout<<"unsafe"<<endl;
    else cout<<"safe"<<endl;
}

Measured memory_bytes: 3636
h,w,a,b = map(int,input().split())

s = 1
t = 0

for i in range(h):
    res = []
    if s == 1 and i >= b:
        s,t = t,s
    for j in range(w):
        if j < a:
            res.append(s)
        else:
            res.append(t)
    else:
        print(*res, sep="")

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

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

    int N;
    cin >> N;
    
    int ans;
    while(true)
    {
        int i = 2;
        bool isPrime = true;
        
        while(i*i <= N)
        {
            if(N % i == 0)
            {
                isPrime = false;
                break;
            }
            i++;
        }
        
        if(isPrime)
        {
            ans = N;
            break;
        }
        
        N++;
    }
    
    cout << ans << endl;

    return 0;
}

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

int main()
{
    int n;
    int a;
    set<int> s;

    cin >> n;
    for(int i = 0;i < n;i++){
        cin >> a;
        s.insert(a);
    }
    cout << s.size() << endl;
    return 0;
}

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

using namespace std;

#define int long long 

const int maxn = 1007;

char c[4] = {'L','R','D','U'};
int dx[4] = {-1,1,0,0};
int dy[4] = {0,0,-1,1};
int n;
int x[maxn];
int y[maxn];
vector<int>ans;
signed main(){
	scanf("%lld",&n);
	bool tp = 0;
	for(int i = 1; i <= n; ++i){
		scanf("%lld%lld",&x[i],&y[i]);
		if(i == 1)tp = ((x[i] ^ y[i]) & 1);
		else if(tp != ((x[i] ^ y[i]) & 1)){
			puts("-1");
			exit(0);
		}
	}
	for(int i = 0; i <= 30; ++i)ans.push_back((1LL << i));
	if(tp == 0)ans.push_back(1);
	sort(ans.begin(),ans.end());
	reverse(ans.begin(),ans.end());
	printf("%lld\n",ans.size());
	for(int i = 0; i < ans.size(); ++i)printf("%lld ",ans[i]);puts("");
	for(int i = 1; i <= n; ++i){
		int px = 0,py = 0;
		string Ans;
		for(int j = 0; j < ans.size(); ++j){
			int Min = 5e18,pos = -1;
			for(int d = 0; d < 4; ++d){
				int nx = px + dx[d] * ans[j],ny = py + dy[d] * ans[j];
				int dis = llabs(nx - x[i]) + llabs(ny - y[i]);
				if(dis < Min)Min = dis,pos = d;
			}
			printf("%c",c[pos]);
			px += dx[pos] * ans[j],py += dy[pos] * ans[j];
		}puts("");
	}
	return 0;
}


Measured memory_bytes: 256
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.StringTokenizer;

class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        InputReader in = new InputReader(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        Task solver = new Task();
        solver.solve(in, out);
        out.close();
    }

    static class Task {
        void solve(InputReader in, PrintWriter out) {
            // write your code here
            String s = in.next();
            int minDiff = 753;
            for (int i = 0; i < s.length() - 2; i++) {
                int x = Integer.parseInt(s.substring(i, i + 3));
                minDiff = Math.min(Math.abs(x - 753), minDiff);
            }
            out.println(minDiff);
        }
    }

    static class InputReader {
        BufferedReader reader;
        StringTokenizer tokenizer;

        InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream));
            tokenizer = null;
        }

        String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

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


Measured memory_bytes: 21460
import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt(),m=sc.nextInt();
        double max=0;
        while(n-->0) {
            double x=sc.nextDouble(),h=sc.nextDouble();
            max=Math.max(max,h/x);
        }
        System.out.printf("%.4f",max*m);
    }
}


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

namespace AtCoder
{
    class Program
    {
        static int n;
        static int[] c;
        static int[] s;
        static int[] f;

        static void Main(string[] args)
        {
            //[summary]C - Special Trains
            n = int.Parse(Console.ReadLine());

            c = new int[n - 1]; //次の駅までの所要時間
            s = new int[n - 1]; //最初の電車の発車時刻
            f = new int[n - 1]; //電車が発車する間隔

            GetTimeTable();

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

                for(int j = i; j < n - 1; j++)
                {
                    if (t <= s[j])
                    {
                        t = s[j] + c[j];
                    }
                    else
                    {
                        int startTime = CalcStartTime(t, f[j]);
                        t = startTime + c[j];
                    }
                }

                Console.WriteLine(t);
            }

            Console.WriteLine(0);
        }

        static int CalcStartTime(int t, int f)
        {
            if (t % f == 0)
            {
                return t;
            }
            else
            {
                int quotient = t / f;
                return (quotient + 1) * f;
            }
        }

        static void GetTimeTable()
        {
            for(int i = 0; i < n - 1; i++)
            {
                var line = ReadLine();

                c[i] = line[0];
                s[i] = line[1];
                f[i] = line[2];
            }
        }

        static List<int> ReadLine()
        {
            var line = Console.ReadLine();
            var array = line.Split(' ');

            return array.Select(x => int.Parse(x)).ToList();
        }
    }
}

Measured memory_bytes: 11220
#include<stdio.h>
int main()
{
	int a;
	char s[10];
	scanf("%d",&a);
	scanf("%s",&s);
	if(a>=2800 && a<5000)
	{
		if(a<3200)
		{
			printf("red\n");
		}
	else{
	    printf("%s\n",s);
	}
	}
	return 0;
}

Measured memory_bytes: 128
/*
 Atcoder ACL
*/


#pragma warning(disable:4996)
#pragma comment(linker, "/STACK:336777216")
#pragma GCC optimize("Ofast")

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <functional>

using namespace std;
using namespace __gnu_pbds;

typedef long long ll;
//#define int long long int
typedef complex<long double> cd;
const long double pi=acos(-1);
typedef double db;
typedef long double ldb;
typedef pair <int,int> pii;
typedef pair <db,db> pdd;
typedef vector<int> vi;
typedef vector<vector<int> > matrix;

#define m1 make_pair
#define pb push_back
#define flush fflush(stdout)
#define IOS std::ios::sync_with_stdio(false); cin.tie(NULL);cout.tie(NULL);
#define reset(x,v) memset(x,v,sizeof(x))

#define fi first
#define se second
#define endl "\n"
#define debug(x) (cerr << #x << ": " << x << "\n")
#define setbits(x) __builtin_popcount(x)
#define setbitsll(x) __builtin_popcountll(x)
#define all(x) x.begin(),x.end()
#define pii pair<int,int>

inline int gcd(int a,int b){if(a==0) return b;return gcd(b%a,a);}
inline int power(ll a,ll n,ll m){if(n==0)return 1;ll p=power(a,n/2,m);p=(p%m*p%m)%m;if(n%2) return (p%m*a%m)%m;else return p;}
const double EPS = 1e-9;
const ll MOD =998244353;
const ll hell=1000000007;
const int INF = 1e8;
const ll LL_INF = 0x3f3f3f3f3f3f3f3f;
template<typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update>;

auto seed = chrono::high_resolution_clock::now().time_since_epoch().count();
std::mt19937 rng(seed);

double startTime;
double getCurrentTime() {
    return ((double)clock() - startTime) / CLOCKS_PER_SEC;
}
const int dx[] = { -1, 0, 1, 0 };

const int dy[] = { 0, 1, 0, -1 };

const int N=600005;

int st[4*N];

void update(int i,int l,int r,int in,int x)
{
    if(l>r)
        return;
    if(in>r||in<l)
        return;
    if(l==r)
    {
        st[i]=x;
        return;
    }
    int m=(l+r)/2;
    update(2*i+1,l,m,in,x);
    update(2*i+2,m+1,r,in,x);
    st[i]=max(st[2*i+1],st[2*i+2]);
}
int query(int i,int l,int r,int qs,int qe)

{
    if(qs>r||qe<l)
        return 0;
    else if(qs<=l&&qe>=r)
        return st[i];
    int mid=(l+r)/2;
    return max(query(2*i+1,l,mid,qs,qe),query(2*i+2,mid+1,r,qs,qe));
}


void solve()
{
  
    
    int n,k;
    cin>>n>>k;
    int a[n];
    for(int i=0;i<n;i++)
        cin>>a[i];
    int ans=0;
    for(int i=0;i<n;i++)
    {
        int mx=query(0,0,N,max((int)0,a[i]-k),a[i]+k);
        ans=max(ans,1+mx);
        update(0,0,N,a[i],1+mx);
    }
    cout<<ans<<endl;
    
    
}


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




Measured memory_bytes: 8928
#include <bits/stdc++.h>
#define rep(i,n)    for(long long i = 0; i < (n) ; ++i)
#define orep(i,n)   for(long long i = 1; i <= (n); ++i)   // one rep
#define drep(i,n)   for(long long i = (n)-1; i >= 0; --i) // down rep
#define srep(i,s,t) for(long long i = (s); i < (t); ++i)  // set rep
#define rng(x)  (x).begin(),(x).end()

  // range
#define rrng(a) (a).rbegin(),(a).rend() // reverse range
#define isin(x,l,r) ((l) <= (x) && (x) < (r))
#define ru(x,y) (((x)+(y)-1)/(y)) // round up
#define fi first
#define se second
#define eb emplace_back
#define fcout cout << fixed << setprecision(15)


using namespace std;
using ll  = long long;
using P   = pair<int,int>;
using vi  = vector<int>;
using vvi = vector<vi>;
using vp  = vector<P>;
using vl  = vector<ll>;

template<typename T> void Yes(T flag) {
  cout << (flag ? "Yes" : "No") << endl;
}

template<typename T> void pv(vector<T> vec) {
  cout << "[";
  for(auto& v : vec) { cout << v << ","; }
  cout << "]" << endl;
}

template<>
void pv(vector<P> vec) {
  cout << "[";
  for(auto& v : vec) {
    cout << "<" << v.fi << ","<< v.se << ">" << ",";
  }
  cout << "]" << endl;
}

template<typename T> void pv2(vector<vector<T>> vec) {
  for(auto& v : vec) pv(v);
}

int main() {
  int n,k,s;
  cin >> n >> k >> s;
  if(s!=1e9){
    if(n==k) {
      rep(i,k-1) cout << s << " ";
      cout << s << endl;
    } else{
    rep(i,k) cout << s << " ";
    rep(i,n-k-1) cout << s + 1 << " ";
    cout << s+1 << endl;
  }
  } else {
    if(n==k){
      rep(i,k-1) cout << s << " ";
      cout << s << endl;
    } else {rep(i,k) cout << s << " ";
    rep(i,n-k-1) cout << 1 << " ";
    cout << 1 << endl;}
  }
  return 0;
}


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

int n, a[100001][3], dp[100001][3];

int main(){
	scanf("%d", &n);
	for (int i=1; i<=n; i++){
		scanf("%d %d %d", &a[i][0], &a[i][1], &a[i][2]);
	}
	for (int i=1; i<=n; i++){
		dp[i][0]=a[i][0]+max(dp[i-1][1], dp[i-1][2]);
		dp[i][1]=a[i][1]+max(dp[i-1][0], dp[i-1][2]);
		dp[i][2]=a[i][2]+max(dp[i-1][0], dp[i-1][1]);
	}
	printf("%d\n", max(dp[n][0], max(dp[n][1], dp[n][2])));
}

Measured memory_bytes: 2560
H, W = map(int, input().split())
c = [list(map(int, input().split())) for _ in range(10)]
A = [list(map(int, input().split())) for _ in range(H)]

for k in range(10):
    for i in range(10):
        for j in range(10):
            c[i][j] = min(c[i][j], c[i][k] + c[k][j])

ans = 0
for h in range(H):
    for w in range(W):
        if A[h][w] != -1:
            ans += c[A[h][w]][1]
print(ans)


Measured memory_bytes: 3444
#include<bits/stdc++.h>
#define ll long long
#define ld long double
#define mk make_pair
#define fi first
#define se second
#define vll vector<ll>
#define pii pair<ll,ll>
#define vvll vector< vector<ll> >
#define pb push_back
#define sz(v) (v).size()
#define inf 1e18
#define md 1000000007
#define all(v) (v).begin(),(v).end()
#define rep(i,a,b) for(ll i=a;i<b;++i)
#define tel(a){cout<<a<<"\n";}
#define tell(a,b){cout<<a<<" | "<<b<<"\n";}
#define telll(a,b,c){cout<<a<<" | "<<b<<" | "<<c<<"\n";}
#define teln(v,n){cout<<"v- ";rep(i,0,n)cout<<v[i]<<" ";cout<<"\n";}
#define IOS ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
#define M 1000010
ld f(ld x1,ld y1,ld x2,ld y2){
	ld dis=(x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
	dis=(ld)sqrt(dis);
	return dis;
}
int main(){
	IOS;
	ll n;cin>>n;
	ld x[n],y[n];rep(i,0,n)cin>>x[i]>>y[i];
	ll a[n];rep(i,0,n)a[i]=i;
	ld sum=0;
	do{
		rep(i,0,n-1)sum+=f(x[a[i]],y[a[i]],x[a[i+1]],y[a[i+1]]);	
	}while(next_permutation(a,a+n));
	ld f=n;
	rep(i,1,n)f=f*i;
	cout<<setprecision(10)<<(ld)sum/f;
	return 0;
}



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

int main() {
    int ans = 0;
    int N; cin >> N;
    map<string, int> card_counter;
    for (int i = 0; i < N; i++) {
        string s; cin >> s;
        card_counter[s]++;
    }
    int M; cin >> M;
    for (int i = 0; i < M; i++) {
        string t; cin >> t;
        card_counter[t]--;
    }
    for (auto& x : card_counter) {
        ans = max(ans, x.second);
    }
    cout << ans << endl;
}


Measured memory_bytes: 3656
#include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
#include <bitset>
#include <iomanip>
#include <stack>
#include <list>
#include <map>
#include <unordered_map>
#include <chrono>
#include <numeric>
using namespace std;
using ll = long long;
const ll INF = (ll)1e18+1;
const ll DIV = 1000000007;
//#define TEST

template <typename T>
inline T gcd(T a, T b) {return b ? gcd(b, a%b) : a;}

ll ngcd(vector<ll> a){
    ll res;
    res = a[0];
    for(ll i = 1; i < a.size() && res != 1; i++) {
        res = gcd(a[i], res);
    }
    return res;
}

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
#ifdef TEST
    chrono::system_clock::time_point start, end;
    start = chrono::system_clock::now();
#endif
    long N;
    cin >> N;
    vector<ll> A(N);
    for(size_t i=0;i<N; i++)
    {
        cin >> A[i];
    }
    cout << ngcd(A) << endl;
#ifdef TEST
    end = chrono::system_clock::now();
    cerr << static_cast<double>(chrono::duration_cast<chrono::microseconds>(end - start).count() / 1000.0) << "[ms]" << endl;
#endif
    return 0;
}

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

int main()
{
    int n;
    int max = -1000000000;
    int min;
    int temp;

    cin >> n;
    cin >> min;
    for (int i = 0; i < n - 1; i++)
    {
        cin >> temp;
        if (max < temp - min)
        {
            max = temp - min;
        }
        if (temp < min)
        {
            min = temp;
        }
    }

    cout << max << "\n";

    return 0;
}


Measured memory_bytes: 3124
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define pii pair <ll,ll>
#define vl vector <ll>
#define vp vector <pair<ll,ll>>
#define sort(x) sort(x.begin(), x.end())
#define N 1000000007
using namespace std;

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    ll n,i,ans = 0,c = 1,x;
    cin>>n;
    for(i=0;i<n;i++)
    {
        cin>>x;
        if(x == c)
        {
            ans++;
            c++;
        }
    }
    if(ans != 0)
        cout<<n-ans;
    else
        cout<<-1;
    return 0;
}


Measured memory_bytes: 256
def main():
    N = int(input())
    s = input()

    r_list = [0]*N
    r_sum = 0
    w_list = [0]*N
    w_sum = 0
    for i in range(N):
        if s[i] != "R":
            r_sum += 1
        r_list[i] = r_sum
        if s[-(i+1)] != "W":
            w_sum += 1
        w_list[i] = w_sum
    # 全てWにする
    m = w_list[-1]
    for i in range(N-1):
        r = r_list[i]
        w = w_list[-i-2]
        t = max(r, w)
        if m > t:
            m = t
    # 全てRにする
    t = r_list[-1]
    if m > t:
        m = t

    print(m)

main()


Measured memory_bytes: 18852
#define _USE_MATH_DEFINES
#include <cstdio>
#include <iostream>
#include <sstream>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <complex>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <limits>
#include <climits>
#include <cfloat>
#include <functional>
#include <iterator>
using namespace std;

const int MOD = 1000000007;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<vector<pair<int, int> > > v(n+1);
    for(int i=0; i<m; ++i){
        int l, r, x;
        cin >> l >> r >> x;
        v[r].push_back(make_pair(l, x));
    }

    vector<vector<vector<int> > > dp(n+1, vector<vector<int> >(n+1, vector<int>(n+1, 0)));
    dp[0][0][0] = 1;
    for(int a=0; a<n; ++a){
        for(int b=0; b<=a; ++b){
            for(int c=0; c<=b; ++c){
                for(int j=0; j<3; ++j){
                    vector<int> color = {c, b, a};
                    color.erase(color.begin() + j);
                    dp[a+1][color[1]][color[0]] += dp[a][b][c];
                    dp[a+1][color[1]][color[0]] %= MOD;
                }
            }
        }
        
        for(int b=0; b<=a+1; ++b){
            for(int c=0; c<=b; ++c){
                for(const auto& p : v[a+1]){
                    int cnt = 1;
                    if(p.first <= b)
                        ++ cnt;
                    if(p.first <= c)
                        ++ cnt;
                    if(cnt != p.second)
                        dp[a+1][b][c] = 0;
                }
            }
        }
    }

    int ans = 0;
    for(int a=0; a<=n; ++a){
        for(int b=0; b<=a; ++b){
            ans += dp[n][a][b];
            ans %= MOD;
        }
    }
    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 111616
int main () {
    int w,h;
    int i,j,k;
    for (i=0;i<1000;i++) {
        scanf("%d %d",&w,&h);
        if (w==0 && h==0)
            break;
        for (j=0;j<w;j++) {
            for (k=0;k<h;k++) {
                
                if(j%2==0) {
                    if(k%2==0) printf("#");
                    else printf(".");
                } else {
                    if (k%2==1) printf ("#");
                    else printf(".");
                }    
            }
            printf("\n");
        }
        putchar('\n');
    }
    return 0;
} 



Measured memory_bytes: 2060
n, m, c = map(int, input().split())
b = list(map(int, input().split()))
ans = 0
for i in range(n):
    a = list(map(int, input().split()))
    s = 0
    for j in range(m):
        s += a[j] * b[j]
    if s + c > 0:
        ans += 1
print(ans)


Measured memory_bytes: 9204
#include <bits/stdc++.h>
#define f first
#define s second
#define MOD 1000000007
#define PMOD 998244353
#define pb(x) push_back(x)
using namespace std;

typedef long long int ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> plii;
typedef pair<int, pii> piii;
const int INF = 1e9+10;
const ll LINF = 1LL*INF*INF;
const int MAXN = 2e5+10;
const int MAXM = 5e3+10;

priority_queue<long double> pq;
vector<vector<int> > graph;
queue<int> que;

int A[MAXN];
char S[MAXN];

int main()
{
    int n,m,k,x,y,q;
    int cnt = 0;
    int mx = 0;
    int mn = INF;
    long double cur,a,b;

    cin>>n;

    for(int i=0;i<n;i++){
        cin>>cur;
        pq.push(-cur);
    }

    for(int i=1;i<n;i++){
        a = -pq.top(); pq.pop();
        b = -pq.top(); pq.pop();
        cur = (a+b)/(long double)2.0;
        pq.push(-cur);
    }

    long double res = pq.top();
    res = -res;

    cout<<fixed;
    cout.precision(9);
    cout<<res<<"\n";

    return 0;
}


Measured memory_bytes: 256
/*
*
*	AUTHOR :- @soham01
*		// "WORK HARD AND NEVER GIVE UP" //
*
*/
#include "bits/stdc++.h"

using namespace std;

#include <ext/pb_ds/assoc_container.hpp> 
#include <ext/pb_ds/tree_policy.hpp> 
using namespace __gnu_pbds; 
  
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update> //find_by_order(), order_of_key()
#define pb push_back
#define mp make_pair 
#define vi vector<long long int >
#define vb vector<bool>
#define vs vector<string>
#define vd vector<double>
#define vvi vector<vector<long long int> >
#define vp vector<pair<long long int , long long int > >
#define seti set<long long int >
#define setc set<char>
#define setd set<double>
#define mod 1000000009
#define endl '\n'
typedef long long int lli;

// ITS MY REQUEST TO PLEASE PLEASE DO LOOK AT THE CONSTRAINS GIVEN CAREFULLY
// DO CHECK FOR CORNER CASES

/*-------LET THE GAME BEGIN-----------*/

void solve()
{
	lli n,i,j,a=0,b=0,c=0,d=0;
	cin >> n;
	//cout << n << endl;
	string s;
	for(i=0;i<n;i++)
	{
		//cout << i <<endl;
		cin >> s;
		//cout << s << endl; 
		if(s[0]=='A')
		{
			a++;
		}
		if(s[0]=='W')
		{
			b++;
		}
		if(s[0]=='T')
		{
			c++;
		}
		if(s[0]=='R')
		{
			d++;
		}
	}
	cout << "AC x " << a << endl;
	cout << "WA x " << b << endl;
	cout << "TLE x " << c << endl;
	cout << "RE x " << d << endl;
}
int main()
{
/*	#ifndef ONLINE_JUDGE
	     freopen("input.txt", "r", stdin);
	     freopen("output.txt", "w", stdout);
	#endif*/
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	solve();
	return 0;
}





Measured memory_bytes: 3656
/*
AuThOr Gwj
*/
#include<bits/stdc++.h>
#define rb(a,b,c) for(int a=b;a<=c;++a)
#define rl(a,b,c) for(int a=b;a>=c;--a)
#define LL long long
#define IT iterator
#define PB push_back
#define II(a,b) make_pair(a,b)
#define FIR first
#define SEC second
#define FREO freopen("check.out","w",stdout)
#define rep(a,b) for(int a=0;a<b;++a)
#define KEEP while(1)
#define SRAND mt19937 rng(chrono::steady_clock::now().time_since_epoch().count())
#define random(a) rng()%a
#define ALL(a) a.begin(),a.end()
#define POB pop_back
#define ff fflush(stdout)
#define fastio ios::sync_with_stdio(false)
#define debug_pair(A) cerr<<A.FIR<<" "<<A.SEC<<endl;
#define biggest(A,B) A=max(A,B)
#define smallest(A,B) A=min(A,B)
#define R(a) cin>>a
#define R2(a,b) cin>>a>>b
using namespace std;
const int INF=0x3f3f3f3f;
typedef pair<int,int> mp;
typedef pair<mp,mp> superpair;
int a[200000+20];
int main(){
	fastio;
	int n,k;
	cin>>n>>k;
	rb(i,1,n)
		cin>>a[i];
	rb(i,k+1,n){
		if(a[i]>a[i-k]){
			cout<<"Yes"<<endl;
		}
		else
		cout<<"No"<<endl;
	}
	return 0;
}


Measured memory_bytes: 4416
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> P;
typedef long long ll;
typedef pair<ll,ll> l_l;
const ll INF = 10000000100;
int main(){
    ll N,M;
    cin >> N >> M;
    vector<l_l> G[N+1];
    for(int i=0; i<M; i++){
        int a,b,c; cin >> a >> b >> c;
        G[a].push_back(l_l(b,c));
        G[b].push_back(l_l(a,-c));
    }
    vector<ll> x(N+1,INF);
    for(int i=1; i<=N; i++){
        if(x[i]==INF) x[i]=0;
        queue<l_l> q;
        q.push(l_l(x[i],i));
        while(!q.empty()){
            l_l now=q.front();q.pop();
            ll nowpos=now.second;
            ll nowdist=now.first;
            for(auto Next: G[nowpos]){
                ll newpos=Next.first;
                if(x[newpos]==INF){
                    x[newpos]=nowdist+Next.second;
                    q.push(l_l(x[newpos],newpos));
                }
                else{
                    if(x[newpos]!=nowdist+Next.second){
                        cout << "No" << endl;
                        return 0;
                    }
                }
            }
        }
    }
    cout << "Yes" << endl;
    return 0;
}

Measured memory_bytes: 14448
/*author: hyperion_1724
  date: 
*/

//Optional FAST

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,fma,abm,mmx,avx,avx2,tune=native")

//Required Libraries

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>

//Required namespaces

using namespace std;
using namespace __gnu_pbds;

//Required defines

#define endl '\n'

#define READ(X) cin>>X;
#define READV(X) long long X; cin>>X;
#define READAR(A,N) long long A[N]; for(long long i=0;i<N;i++) {cin>>A[i];}
#define rz(A,N) A.resize(N);
#define sz(X) (long long)(X.size())
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define trav(x,A) for(auto &x:A)
#define FORI(a,b,c) for(long long a=b;a<c;a++)
#define FORD(a,b,c) for(long long a=b;a>c;a--)

//Required typedefs

typedef tree<long long,null_type,less<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
typedef tree<long long,null_type,greater<long long>,rb_tree_tag,tree_order_statistics_node_update> ordered_set1;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<long long,long long> pll;
typedef vector<int> veci;
typedef vector<long long> vecl;

//Required Constants

const long long inf=(long long)1e18;
const long long MOD=(long long)(1e9+7);
const long long INIT=(long long)(1e6+1);

//Required Functions

ll power(ll x,ll y) 
{ 
	if (y == 0) 
		return 1; 
	ll p = power(x, y/2) % MOD; 
	p = (p * p) % MOD; 
  
	return (y%2 == 0)? p : (x * p) % MOD; 
}
ll modInverse(ll a) 
{ 
   return power(a,MOD-2); 
   
}

//Work

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

	READV(A);
	READV(B);
	if(A<10 && B<10)
	{
		cout<<A*B<<endl;
	}
	else
	{
		cout<<-1<<endl;
	}
	

	return 0;
}

Measured memory_bytes: 256