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


// TODO: Implement a helper named check_permissions that matches the prototype below.
// int check_permissions(char *, char *);

int check_permissions(char *a, char *b) {
    for (int i = 0; i < 9; i++) {
        if (b[i] == '-') {
            ;
        } else if (b[i] != a[i]) {
            return 1;
        }
    }
    return 0;
}

int main(int argc, char** argv) {
    if (!(argc == 2 || argc == 3)) {
        fprintf(stderr, "USAGE: count_large size [permissions]\n");
        return 1;
    }

    // TODO: Process command line arguments.
    // char input[50];
    int count = 0;
    int val = 0;
    char permissions[10];
    int file_size;
    scanf("%*s, %*d");
    while (val != -1) {
        val = scanf("%s %*d %*s %*s %d %*s %*d %*s %*s", permissions, &file_size);
        if (val == -1) {
            break;
        }
        // printf("%s ", permissions);
        // printf("%d\n", file_size);
        int size = strtol(argv[1], NULL, 10);
        if (file_size >= size) {
            if (argc == 3) {
                if (check_permissions(permissions, argv[2]) == 0) {
                    count += 1;
                }
            } else {
                count += 1;
            }
        }
    }
    printf("%d \n", count );
    
print out permissions match and file size is larger or equal