Datasets:
Tasks:
Text Generation
Modalities:
Text
Formats:
json
Languages:
English
Size:
< 1K
ArXiv:
Tags:
competitive-programming
code-generation
specification-generation
proof-generation
verification
rust
License:
Download codeforces/cf1840C/code.rs from Gax-c/VeriContest_Lite: direct link, hf CLI and curl.
- Browser
- Download file 625 Bytes
-
https://huggingface.co/datasets/Gax-c/VeriContest_Lite/resolve/main/codeforces/cf1840C/code.rs
- Command line
-
hf download hf://datasets/Gax-c/VeriContest_Lite/codeforces/cf1840C/code.rs
-
curl -L -o code.rs https://huggingface.co/datasets/Gax-c/VeriContest_Lite/resolve/main/codeforces/cf1840C/code.rs
625 Bytes
| impl Solution { | |
| pub fn count_vacations(n: usize, k: usize, q: i64, a: Vec<i64>) -> i64 { | |
| let mut pos: usize = 0; | |
| let mut total: i64 = 0; | |
| while pos < n { | |
| if a[pos] > q { | |
| pos += 1; | |
| } else { | |
| let start = pos; | |
| while pos < n && a[pos] <= q { | |
| pos += 1; | |
| } | |
| let seg_len = pos - start; | |
| if seg_len >= k { | |
| let x = (seg_len - k) as i64 + 1; | |
| total += x * (x + 1) / 2; | |
| } | |
| } | |
| } | |
| total | |
| } | |
| } | |