Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
int binarySearch(int arr[], int l, int r, int x){ if (r < l) return -1; int mid = l + (r - l) / 2; if (arr[mid] == x) return mid; if (arr[mid] > x) return binarySearch(arr, l, mid - 1, x); return binarySearch(arr, mid + 1, r, x); } int count(int arr[], int n, int x){ int ind = binarySearch(arr, 0, n - 1, x); if (ind == -1) return 0; int count = 1; int left = ind - 1; while (left >= 0 && arr[left] == x) count++, left--; int right = ind + 1; while (right < n && arr[right] == x) count++, right++; return count; } int main(){ int size, queries, temp; scanf("%d %d", &size, &queries); int data[size]; for(int i=0;i
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)