uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
2a26d8fa-95be-44f3-ac7a-ef518d8d8f0f | Kisioj/Symulator-System-w-Kolejkowych | Projekt/Symulator Kolejki/ttmath/samples/uint.cpp | #include <ttmath/ttmath.h>
#include <iostream>
void SimpleCalculating(const ttmath::UInt<2> & a, const ttmath::UInt<2> & b)
{
std::cout << "Simple calculating" << std::endl;
std::cout << "a = " << a << std::endl;
std::cout << "b = " << b << std::endl;
std::cout << "a + b = " << a+b << std::endl;
std::cout << "a -... | ALGO | 0.94942 | 5.812026 |
b09e0b32-fd44-4d46-be2f-d7ada8c29d28 | kabsmeiou/cp-solutions | Educational Codeforces/Round 164/A.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int T;
cin >> T;
while (T--) {
int n, m, k;
cin >> n >> m >> k;
map<int, int> a;
for (int i = 1; i <= n; i += 1) {
a[i % m] += 1;... | ALGO | 0.999779 | 4.48772 |
37174ca6-cb77-46f8-917e-89034f8a30cb | harrySentinel/DSA | String/rotation.cpp | #include <iostream>
using namespace std;
// Function to check if str2 is a rotation of str1
bool isRotation(string str1, string str2) {
if (str1.length() != str2.length()) return false;
string concatenated = str1 + str1;
return (concatenated.find(str2) != string::npos);
}
int main() {
string str1 = "... | ALGO | 0.999017 | 6.03962 |
bc582a56-35ad-4257-9e04-f10375d9aadc | alian010/problem_solving- | policRecurits.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,psum=0,posum=0,co=0;
cin>>n;
while(n--)
{
int x;
cin>>x;
if (x>-1)
{
psum+=x;
}
else if (psum>0)
{
psum=psum-abs(x);
}
else
{
... | ALGO | 0.999942 | 3.690028 |
37f5b72e-aa98-4bae-895e-7d31d7da95ed | ChrisrunnerR/Instagram | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
51ac5c38-b2f9-4284-8b20-676c1d8b8595 | ishandutta2007/codeforces | rama_pang/normal/1268/B.cpp | #include <bits/stdc++.h>
using namespace std;
using lint = long long;
lint N;
lint A[300005];
int main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
cin >> N;
lint black = 0, white = 0;
for (int i = 0; i < N; i++) {
cin >> A[i];
if (i % 2 == 0) {
black += A[i] ... | ALGO | 0.999957 | 4.212014 |
ffd9011b-033c-4e50-9152-fa785a037f46 | janani271/CP-solutions-6 | chpintu.cpp | #include<bits/stdc++.h>
using namespace std;
#define fastread ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define pb push_back
#define pairs pair<ll,ll>
#define MAX 100003
ll MOD=1e9+7;
ll t , n , m , cost[60] , cnt[60], i , a[60] , p , ans;
int main()
{
#ifndef ONLINE_JUDGE
... | ALGO | 0.999883 | 3.468024 |
ed0c4846-eb13-43e6-8f51-623392b2d4db | hyturing/Competitive-Programming | Codechef/Starter45/adjacent_sum_parity.cpp | /**
* Author: hyturing
* Created:
**/
#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9+7;
const int MM = 998244353;
const int N = 1e5+5;
const long long INF = 1e18;
void solve() {
// code here
int n; cin >> n;
int arr[n];
for (auto &x: arr) cin >> x;
int b[n];
if (arr[0] == 1) {
b[... | ALGO | 0.999994 | 4.576842 |
734b82c9-fb34-4e33-aee2-d89ac3502270 | cadenroberts/collegeCEprojects | University of California, Santa Cruz/Upper Division Coding/CSE101/CSE101_LAB1/CSE101_LAB1_CODING/shakespeareQuery.cpp | #include <iostream>
#include <fstream>
#include <string>
using namespace std;
struct Node {
string word;
int freq;
Node * next;
};
class LinkedList {
public:
LinkedList() : head(nullptr) {}
void add(const string& word) {
Node * current = head;
Node * prev = nullptr;
while ((current != nullptr)... | ALGO | 0.996422 | 4.288206 |
080a569f-c96b-4fb4-99b7-b58dc708868e | citrus610/aoc-2024 | day 7/main.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <unordered_set>
#include <cstdint>
void read_input(std::vector<std::pair<uint64_t, std::vector<uint64_t>>>& list)
{
std::ifstream is("input.txt");
std::string line;
while (std::... | ALGO | 0.998259 | 4.480582 |
2b0cc56f-bb76-45f3-a3df-0fa34d4d6934 | kmjp/procon | leetcode/biweekly/001-040/017/1315.cpp | typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) me... | ALGO | 0.999875 | 4.733013 |
c2b69cf7-40cd-49b7-b2ec-06ecdaffd5ae | nodedevelopertr/myrepver4 | depends/libff/libff/algebra/curves/mnt753/mnt4753/mnt4753_init.cpp | /** @file
*****************************************************************************
Implementation of interfaces for initializing MNT4.
See mnt4753_init.hpp .
*****************************************************************************
* @author This file is part of libff, developed by SCIPR Lab
* ... | TOOL | 0.866412 | 6.499245 |
2aa0142d-0155-47b8-b051-2d325c53570b | NoneMSG/HackerRank | Time in words_HR/Time in words/main.cpp | #include <cmath>
#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int main() {
map<int, string> timelist;
int hour, minute;
cin>>hour;
cin>>minute;
string half="half past ";
string underHalf=" minutes past ";
string aboveHalf=" minutes ... | ALGO | 0.997151 | 5.710376 |
9b084b61-496d-4263-87f1-f7dc9edda0d4 | Santhosh-004/c-programming | string operation/main.cpp | #include <iostream>
int main() {
std::string name = "clkafasdf a";
std::cout << name.find_last_of(" ") << std::endl;
name.erase(name.find_last_of(" "));
std::cout << name << std::endl;
std::cout << name.find_last_of("f") << std::endl;
std::cout << name.find_last_not_of("f") << std::endl;... | TOOL | 0.882573 | 4.966459 |
864fb88d-5746-469d-85bc-fd605eec27f9 | snehaagrawal14/GFG_Solutions | Difficulty: Medium/Ancestors in Binary Tree/ancestors-in-binary-tree.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// Tree Node
struct Node {
int data;
Node* left;
Node* right;
};
// Utility function to create a new Tree Node
Node* newNode(int val) {
Node* temp = new Node;
temp->data = val;
temp->left = NULL;
temp->right = NULL;
... | ALGO | 0.999889 | 6.321499 |
c0f3cae4-9c2b-42b9-9302-e3cef56a5b88 | Leonab/CompetitiveP | dp/modified_fibonacci.cpp | #include<bits/stdc++.h>
using namespace std;
#define rep(i,N) for(int (i)=0;(i)<(N);(i)++)
#define repi(i,j,N) for(int (i)=(j);(i)<(N);(i)++)
#define sz(a) int((a).size())
#define pb push_back
#define mp make_pair
#define ll long long
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
int main... | ALGO | 0.999967 | 3.339939 |
9b6879fd-0283-46d7-b5ca-0324e1af7fbd | jyqiu1216/Rino | sdk/boost_1_62_0/libs/sort/example/wstringsample.cpp | // See http://www.boost.org/libs/sort for library home page.
#include <boost/sort/spreadsort/string_sort.hpp>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <vector>
#include <iostream>
#include <fstream>
#include <string>
using std::wstring;
using namespace boost::sort::spread... | ALGO | 0.998056 | 4.643817 |
94530586-d801-4263-923f-c7f32904ffba | hannasalam/CP-DSA | DSA/Binary Search/Median of two sorted arrrays.cpp | class Solution {
public:
int find(vector<int>& nums1, vector<int>& nums2, int mid){
int count = 0;
int i=0,j=0;
while(i<nums1.size() and j<nums2.size()){
if(nums1[i]<=mid) i++;
else if(nums2[j]<=mid)j++;
else break;
count++;
}
w... | ALGO | 0.999994 | 5.976756 |
0d40b7d9-b850-4236-b636-ba551d6698ad | lucic71/llvm-ub-free | polly/lib/Support/ISLTools.cpp | #include "polly/Support/ISLTools.h"
#include "polly/Support/GICHelper.h"
#include "llvm/Support/raw_ostream.h"
#include <cassert>
#include <vector>
using namespace polly;
namespace {
/// Create a map that shifts one dimension by an offset.
///
/// Example:
/// makeShiftDimAff({ [i0, i1] -> [o0, o1] }, 1, -2)
/// = ... | TOOL | 0.945319 | 6.271008 |
ba8dae29-4ca9-468b-8b66-8c6e6b6a0bd0 | heyooJatinHere/800-1299 | Solutions/queue-at-the-school.cpp | #include <iostream>
using namespace std;
int main()
{
int n, t;
cin >> n >> t;
string s;
cin >> s;
while (t--)
{
for (int i = s.size() - 1; i > 0; i--)
{
if (s[i] == 'G' && s[i - 1] == 'B')
{
s[i - 1] = 'G';
s[i] = 'B';
... | ALGO | 0.999753 | 4.209638 |
4a6eecd2-b6d0-47d2-bef6-7a9b77c14702 | Srujana226/PPS-PROGRAMMES | gcd.cpp | #include <stdio.h>
int main()
{
int n1, n2, i, gcd;
printf("Enter two integers: ");
scanf("%d %d", &n1, &n2);
for(i=1; i <= n1 && i <= n2; ++i)
{
if(n1%i==0 && n2%i==0)
gcd = i;
}
printf("G.C.D of %d and %d is %d", n1, n2, gcd);
return 0;
}
| ALGO | 0.991165 | 3.985534 |
ed633772-efcd-44ab-b181-37e55415c735 | Beman/boost-trunk-git-svn | libs/graph/example/filtered_graph_edge_range.cpp | /*
Sample output:
filtered edge set: (A,B) (C,D) (D,B)
filtered out-edges:
A --> B
B -->
C --> D
D --> B
E -->
*/
#include <boost/config.hpp>
#include <iostream>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/filtered_graph.hpp>
#include <boost/graph/graph_utility.hpp>... | ALGO | 0.999314 | 6.295903 |
ef060220-24ca-4a96-ad0d-f5c45915f2d5 | LubanCat/mpp | mpp/base/mpp_cluster.cpp | #define MODULE_TAG "mpp_cluster"
#include <string.h>
#include "mpp_mem.h"
#include "mpp_env.h"
#include "mpp_lock.h"
#include "mpp_time.h"
#include "mpp_debug.h"
#include "mpp_common.h"
#include "mpp_cluster.h"
#include "mpp_dev_defs.h"
#define MPP_CLUSTER_DBG_FLOW (0x00000001)
#define MPP_CLUSTER_DBG_L... | TOOL | 0.887672 | 3.692064 |
e29b6166-0bd3-4d46-a6c7-013a42c3a3c6 | Dyyt587/OCS2_ROS2 | ocs2_core/src/loopshaping/augmented_lagrangian/LoopshapingStateInputAugmentedLagrangian.cpp | #include <ocs2_core/loopshaping/LoopshapingPreComputation.h>
#include <ocs2_core/loopshaping/augmented_lagrangian/LoopshapingStateInputAugmentedLagrangian.h>
namespace ocs2 {
std::vector<LagrangianMetrics> LoopshapingStateInputAugmentedLagrangian::getValue(scalar_t t, const vector_t& x, const vector_t& u,
... | ALGO | 0.955684 | 6.839313 |
ba705e5d-96c6-4f0e-87ba-2e5c3eb4550e | VisaHuy/Visa | test.cpp | // C++ program for implementation of Insertion Sort
#include <iostream>
using namespace std;
/* Function to sort array using insertion sort */
void insertionSort(int arr[], int n)
{
for (int i = 1; i < n; ++i) {
int key = arr[i];
int j = i - 1;
/* Move elements of arr[0..i-1], that are
... | ALGO | 0.999991 | 6.089071 |
57323e8a-e789-4653-9702-1214440b80c0 | lamknh/Problem_Solving | BOJ/C++/1021.cpp | #include <iostream>
#include <deque>
using namespace std;
int N, M, cnt = 0, x;
deque<int> dq;
int main(int argc, char** argv){
scanf("%d %d", &N, &M);
for(int i = 1; i <= N; i++){
dq.push_back(i); // 큐 초기화
}
int A[M];
for(int i = 0; i < M; i++){
scanf("%d", &A[i]);
}
for(int i = 0; i < M; i... | ALGO | 0.999921 | 3.612478 |
a7188415-1123-4837-a5fa-504ddb503982 | toufiq-dev/leetcode-practices | 0939-minimum-area-rectangle/0939-minimum-area-rectangle.cpp | class Solution {
public:
int minAreaRect(vector<vector<int>>& points) {
unordered_set<int> pointSet; // To store unique points in a set for efficient lookup
int result = INT_MAX;
// Add all points to the set for constant time lookup
for (const auto& point : points) {
po... | ALGO | 0.999946 | 7.192262 |
c84e150d-6b2f-40dd-b618-4f2cd066bae6 | yagyeshvishnoi/DSA | 0300-longest-increasing-subsequence/0300-longest-increasing-subsequence.cpp | class Solution {
public:
int lengthOfLIS(vector<int>& nums) {
//..hello
int n = nums.size();
vector<vector<int>> dp(n+1,vector<int>(n+1,0));
for(int i = 0;i<n+1;i++)dp[i][i] = 1;
for(int i = 0; i<n ;i++){
int curr = dp[i][i];
for(int j = i+1;j<n;j++){
... | ALGO | 0.999985 | 5.736819 |
969e1c78-9571-427b-bcda-a8ec09b3acc5 | bhavya26050/DSA | Merge2BST.cpp | #include<iostream>
#include<vector>
#include<queue>
using namespace std;
class Node
{
public:
int data;
Node* left;
Node* right;
Node(int d)
{
this -> data = d;
this -> left = NULL;
this -> right = NULL;
}
};
Node* insertIntoBST(Node* root, int d) {
if (root ==... | ALGO | 0.999985 | 4.802239 |
64069e44-d6a0-4fcc-99d5-ca992a808954 | andr729/jnp_dx_z2 | project_2/Project2/Project2/utils.cpp | #include "utils.h"
#include <cmath>
FLOAT vecLen(D2D1_POINT_2F p) {
FLOAT len2 = p.x * p.x + p.y * p.y;
FLOAT len = std::sqrtf(len2 + 1e-10);
return len;
}
D2D1_POINT_2F normalize(D2D1_POINT_2F p) {
auto len = vecLen(p);
return { p.x / len, p.y / len };
}
namespace detail{
void auxMakeRadBrush(ID2D1RadialGradi... | TOOL | 0.896487 | 6.407237 |
ec12d394-825e-44d0-b7c7-04ce4887e0af | HussnulMaab192/Charity-Sharing-App | charity_app/windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998947 | 6.785645 |
5180b0c5-bc26-4c3d-aa6c-16ea2de715ca | zippond/leetcode | src/backtrack/51_n_queens.cpp | class Solution {
public:
vector<vector<string>> solveNQueens(int n) {
vector<vector<string>> result;
vector<vector<int>> tmp(n, vector<int>(n, 0));
int cur = 0;
find(result, tmp, n, cur);
return result;
}
vector<string> format(vector<vector<int>>& p)
{
vec... | ALGO | 0.999597 | 5.708679 |
f99407e9-81f8-4b79-9884-18981b69d05b | RhonalG24/TecSuperior-Sistemas-UTN | TecSuperior Sistemas/1er Cuatrimestre/Programacion/Trabajo Práctico/MI_Proyecto/main_Etapa_3ERROR.cpp | /*
Etapa 3
En la etapa final, nuestro amigo ciclista desea volver a modificar la aplicación una vez más. En
este caso, quiere poder registrar los entrenamientos realizados en todo 1 mes y obtener datos
de todo el mes de entrenamiento.
El ciclista desea que luego de cargar los datos de todo el mes de entrenamiento, la a... | ALGO | 0.894546 | 4.788707 |
357533c1-07c6-4374-ac70-3cc0aebfcad9 | jaishreedhage/Competitive-coding | Interview Bit/number_of_1_bits.cpp | int Solution::numSetBits(unsigned int A) {
// Do not write main() function.
// Do not read input, instead use the arguments to the function.
// Do not print the output, instead return values as specified
// Still have a doubt. Checkout www.interviewbit.com/pages/sample_codes/ for more details
// int... | ALGO | 0.99986 | 5.5421 |
49b88b00-e166-4735-9e34-b2456f07dbe2 | topacoder/c-_Codes | c++_assignments/Day-4/maxMin.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int min(int arr[], int n){
int min = INT_MAX;
for(int i=0; i<n; i++){
if(arr[i] < min) min = arr[i];
}
return min;
}
int max(int arr[], int n){
int max = INT_MIN;
for(int i=0; i<n; i++){
if(arr[i] > max) max = arr[i];
}
return max;
... | ALGO | 0.999596 | 3.534135 |
1b975008-7580-4246-984e-ab4f5b21b6b5 | MijaTola/Codeforce | 268A.cpp | #include <iostream>
using namespace std;
int main(){
int h[31],g[31];
int n;
cin >> n;;
for (int i = 0; i < n; ++i)
cin >> h[i] >> g[i];
int ans = 0;
for (int i = 0; i < n; ++i)
for (int j = 0; j < n; ++j)
if(i != j and h[i] == g[j])
ans++;
cout << ans << endl;
return 0;
} | ALGO | 0.99983 | 3.217741 |
35ec9c64-9e1d-4542-a4f8-7525b8ef9212 | luoan/Accelerated-cpp | 8-old/8-2/accmumulate.cpp | #include<iostream>
#include<vector>
using std::cin; using std::cout;
using std::endl; using std::vector;
template <class In, class X>
X accumulate(In beg, In end, X x)
{
while (beg != end) {
x += *beg++;
}
return x;
}
int main()
{
double x;
vector<double> ret;
while (cin >> x)
... | ALGO | 0.999122 | 4.317437 |
f9da7101-47ec-4e83-9c61-c88356f72c43 | MadhavGupta2004/codeforces | gamewithintegers.cpp | #include<iostream>
#include<vector>
#include<limits.h>
#include<unordered_map>
#include<algorithm>
using namespace std;
int main(){
int t,n;
cin>>t;
while(t--){
cin>>n;
if(n%3==0){
cout<<"Second"<<endl;
}
else{
cout<<"First"<<endl;
}
}
} | ALGO | 0.999832 | 3.811053 |
65911a20-a124-4c7e-8775-57739672e1fe | 108-19/problem-solving-training | leetcode/array-2/Array-I/07.cpp | class Solution {
public:
vector<vector<int>> largeGroupPositions(string s) {
vector<vector<int>> result;
int n = s.size();
int start = 0;
char prevChar = s[0];
int consecutiveCount = 1;
for (int i = 1; i < n; ++i) {
if (s[i] == prevChar) ... | ALGO | 0.999434 | 6.735997 |
7b913afb-a840-4c0c-9586-b93d701b53a6 | Noodle-Dev/Java_HandLight_Control | libs/opencv/sources/samples/cpp/grabcut.cpp | #include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/imgproc.hpp"
#include <iostream>
using namespace std;
using namespace cv;
static void help(char** argv)
{
cout << "\nThis program demonstrates GrabCut segmentation -- select an object in a region\n"
"and then grabcut wi... | ALGO | 0.860987 | 5.414489 |
be8f55aa-7dd5-4065-ba96-26a1e590880d | takashigoto1207/atcoder | abc3xx/abc379/abc379_b.cpp | #include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i, n) for (int i = 0; i < n; i++)
using namespace std;
using namespace atcoder;
using ll = long long;
int main() {
int N, K, cnt = 0, ans = 0;
string S;
cin >> N >> K >> S;
rep(i, N) {
if (S[i] == 'O')
cnt++;
else if (S[i] == 'X')
... | ALGO | 0.999811 | 4.506749 |
dda995c4-2597-4c65-9789-ca595e0a871d | jamiedonnelly-px/py-manifold | 3rd_party/libigl/include/igl/copyleft/progressive_hulls_cost_and_placement.cpp | IGL_INLINE void igl::copyleft::progressive_hulls_cost_and_placement(
const int e,
const Eigen::MatrixXd & V,
const Eigen::MatrixXi & F,
const Eigen::MatrixXi & E,
const Eigen::VectorXi & EMAP,
const Eigen::MatrixXi & EF,
const Eigen::MatrixXi & EI,
double & cost,
Eigen::RowVectorXd & p)
{
using name... | ALGO | 0.999579 | 4.860816 |
5653b1d1-ab53-409f-9977-ffc1d54abb72 | bolleyboll/LeetCode-Journey | CodingNinjas/1 to N Without Loop.cpp | // CN: https://www.codingninjas.com/studio/problems/print-1-to-n_628290
#include <bits/stdc++.h>
using namespace std;
vector<int> printNos(int x) {
vector<int> res;
if(x<=1)
return {x};
else{
res = printNos(x-1);
res.push_back(x);
return res;
}
} | ALGO | 0.997416 | 5.058 |
2c44c93a-f4ee-42d8-9b44-463f28903428 | GCW-kuku/bustub | src/optimizer/nlj_as_index_join.cpp | #include <algorithm>
#include <memory>
#include <optional>
#include <tuple>
#include "catalog/column.h"
#include "catalog/schema.h"
#include "common/exception.h"
#include "common/macros.h"
#include "execution/expressions/column_value_expression.h"
#include "execution/expressions/comparison_expression.h"
#include "execu... | ALGO | 0.986548 | 7.270188 |
55eeb26b-b12f-4997-82c8-13119c2243bf | maparham/flow_update | boost_1_65_1/libs/graph/example/closeness_centrality.cpp | //[closeness_centrality_example
#include <iostream>
#include <iomanip>
#include <boost/graph/undirected_graph.hpp>
#include <boost/graph/exterior_property.hpp>
#include <boost/graph/floyd_warshall_shortest.hpp>
#include <boost/graph/closeness_centrality.hpp>
#include <boost/graph/property_maps/constant_property_map.hp... | ALGO | 0.999881 | 6.528184 |
f53490e1-5cfb-48fa-a562-c56ce0268889 | leftrk/tools | archives/cpp-primer-5th/VisualStudio2012/10/accum4.cpp | \r/\r/g
#include <numeric>
using std::accumulate;
#include <iterator>
using std::istream_iterator;
#include <iostream>
using std::cin; using std::cout; using std::endl;
int main()
{
istream_iterator<int> in(cin), eof;
cout << accumulate(in, eof, 0) << endl;
return 0;
}
| ALGO | 0.979498 | 3.762441 |
d3e5d607-d2fc-4fb3-93ea-9534561e8272 | Ricardo2001ZG/RicsCodePractice | oi/luogu.com.cn/P1420-1428/P1420.cpp |
#include <iostream>
/*! @fn int main();
* @brief P1420 最长连号
* @param[in] readN 输入整数个数 N
* @param[in] readB 输入整数 b
* @param[out] answer 输出答案
* @return 算法题函数 return 0
*/
int main()
{
int readN = 0, answer = 1;
int continuousCount = 1;
long long readNum = 0, lastNum = 0;
std::cin >> readN;
... | ALGO | 0.99992 | 3.586009 |
069a2fcd-0a37-429d-9468-7298784b72d6 | kmjp/procon | yuki/1001-2000/1701-1800/1748.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define ... | ALGO | 0.999415 | 3.374514 |
265a0045-937f-44c9-87c5-de80a11f9f56 | ishandutta2007/codeforces | antoine/normal/1068/B.cpp | #undef NDEBUG
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void getDivisorsHelper(int i, ll curr, const vector<pair<ll, int>> &v, vector<ll> &res) {
if (i == v.size())
res.push_back(curr);
else {
for (int j = 0; j <= v[i].second; ++j) {
getDivisorsHelper(i + 1, curr, v, res);
curr *=... | ALGO | 0.999922 | 5.069577 |
6d9b4172-8eda-4d71-8c0b-73aaf2ec6d61 | crdroidandroid/android_frameworks_av | media/module/codecs/mp3dec/src/pvmp3_polyphase_filter_window.cpp | /*
------------------------------------------------------------------------------
PacketVideo Corp.
MP3 Decoder Library
Filename: pvmp3_polyphase_filter_window.cpp
Date: 09/21/2007
------------------------------------------------------------------------------
REVISION HISTORY
Description:
--------... | ALGO | 0.983753 | 4.600871 |
7c637340-74bf-4b2f-8275-13cb09797df0 | karygauss03/Leetcode-Solutions | 1160-letter-tile-possibilities/1160-letter-tile-possibilities.cpp | class Solution {
public:
string path = "";
set<string> ans;
bool vis[8];
void solve(string& tiles) {
if (path.size() > tiles.size()){
return;
}
ans.insert(path);
for (int i = 0 ; i < tiles.size(); ++i) {
if (vis[i]) {
continue;
... | ALGO | 0.999943 | 6.624649 |
551471e7-cac0-474c-a0a6-1737ecea4879 | libretro/libretro-uae | sources/src/pcem/sound_sb_dsp.cpp | /*Jazz sample rates :
386-33 - 12kHz
486-33 - 20kHz
486-50 - 32kHz
Pentium - 45kHz*/
#include <stdint.h>
#include <stdio.h>
#include <math.h>
#ifndef M_PI
#define M_PI 3.14159265358979323846264338327950288
#endif
#include "ibm.h"
#include "device.h"
#include "dma.h"
#include "filters.h"
#include "io.h"
#inc... | TOOL | 0.902293 | 5.324305 |
4009c73f-8f65-40a3-a34b-08a105238f89 | XuyuanGuo/bupt_Compiler-Principle | 语法分析/LR分析法/main.cpp | #include<iostream>
#include<fstream>
#include<string>
#include<vector>
#include<stack>
#include<queue>
#include<unordered_map>
#include<algorithm>
// 定义了一些常量,如终结符和非终结符的数量
#define NUM_OF_TERMINATE 9
#define NUM_OF_NONTERMINATE 4
#define NUM_OF_PRODUCTION 8
#define NUM_OF_STATE 16
#define BUFFER_SIZE 100
using namespac... | ALGO | 0.985778 | 3.46298 |
90544b32-cba4-4a41-b676-21c53d30b50e | feliposz/leetcode-solutions | C++/merge-two-sorted-lists.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* mergeTwoLis... | ALGO | 0.999907 | 5.727608 |
dfe7ee9b-771c-4bc4-b6fc-998182bb01c5 | freedom0116/data-structure-and-programming | hw6/src/util/util.cpp | #include <sys/types.h>
#include <dirent.h>
#include <errno.h>
#include <vector>
#include <string>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include "rnGen.h"
#include "myUsage.h"
using namespace std;
//----------------------------------------------------------------------
// G... | TOOL | 0.891116 | 5.463684 |
bda2859c-c751-4ddb-a277-c2bbec0beb28 | by-student-2017/lammps-14May16 | src/MC/fix_bond_create.cpp | #include <math.h>
#include <mpi.h>
#include <string.h>
#include <stdlib.h>
#include "fix_bond_create.h"
#include "update.h"
#include "respa.h"
#include "atom.h"
#include "atom_vec.h"
#include "force.h"
#include "pair.h"
#include "comm.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include ... | ALGO | 0.98487 | 6.483508 |
1c0195f4-c1fa-4264-b7f6-ccb33d5fd3c9 | TakdanaiPKJ/2110104-CEDT-Computer-Programming | Mock-Exam/03_vending_machine/vending.cpp | #include "bits/stdc++.h"
using namespace std;
int main(){
unsigned long long n;
string a;
cin >> n;
getline(cin>>ws,a);
string tmp = "";
unsigned long long sum = 0;
for(auto x: a){
if(isdigit(x)){
tmp += x;
}
else {
if(tmp == "") continue;
int sumst = stoull(tmp);
sum... | ALGO | 0.995493 | 4.090098 |
f908fafc-f107-4dab-8a3e-504932fe9b3b | jcheng1103/USACO-practice | convention/convention/main.cpp | #include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
int main() {
ifstream fin("convention.in");
ofstream fout("convention.out");
int n, m, c, a[100000];
fin >> n >> m >> c;
for (int i = 0; i < n; i++){
fin >> a[i];
}
sort(a, a + n);
int l = 0, r... | ALGO | 0.99999 | 3.917215 |
6084df03-5e3d-4871-a9af-1d208c81ac3c | DVLPR-AMDIN/shivom-dsa-files | Sorting/Recursion.cpp | #include <bits/stdc++.h>
using namespace std;
void inc(int x)
{
if (x == 0)
{
return;
}
inc(x - 1);
cout << x << " ";
}
int main()
{
int x = 5;
inc(5);
} | ALGO | 0.999785 | 3.892131 |
8799aeed-caf3-4ec4-aa95-a75e0b23ae2e | corner0530/atcoder | ABC/249/a.cpp | #include <bits/stdc++.h>
using namespace std;
#define PI 3.14159265358979323846
#define MOD 1000000007
#define mod 998244353
using ll = long long;
using vll = vector<ll>;
using vvll = vector<vll>; // vvll 変数名(要素数1, vll(要素数2, 初期値))
void YESNO(bool ans) {
if (ans) {
cout << "YES" << endl;
} else {
cout <<... | ALGO | 0.999889 | 4.961595 |
1f4c2799-d837-444b-8086-b2bd48bbe9e9 | dfeng/abtree | src/api.cpp | #include <Rcpp.h>
#include "node.h"
#include "abtree.h"
using namespace Rcpp;
void DeleteTree(Node *node) {
if (node->left) {
DeleteTree(node->left);
DeleteTree(node->right);
}
delete node;
}
// ======================== Tree -> DF ======================== //
void ExportTree(Node *node, DoubleMat ... | ALGO | 0.979445 | 4.289059 |
12932d80-8482-485e-ac64-02bcab17bc66 | cjs937/AI_Final | GameAI/Pathfinding/Game/DijkstraPathfinder.cpp | #include "DijkstraPathfinder.h"
#include <queue>
#include <vector>
#include "Node.h"
#include "GridGraph.h"
#include "Connection.h"
#include "PerformanceTracker.h"
#include "GameApp.h"
DijkstraPathfinder::DijkstraPathfinder(GridGraph* pGraph):GridPathfinder(pGraph, Color(RED))
{}
DijkstraPathfinder::~DijkstraPathfind... | ALGO | 0.999085 | 3.883789 |
4696ab93-cd44-42a2-88bb-82774004fd65 | siddtheshah/COMS4735_Assignment3 | src/shape_descriptors.cpp | #include "shape_descriptors.h"
#include <cmath>
using namespace cv;
using namespace std;
void add_size_description(map<int, BuildingInfo>& buildingMap) {
for (auto& building : buildingMap) {
if (building.second.pixel_area > 2000) {
building.second.shape_descriptions.emplace_back("large");
}
else if (buildin... | TOOL | 0.863385 | 5.745635 |
e345f91d-e00e-4805-b815-8b1678610834 | ishandutta2007/codeforces | he_ren/normal/1290/C.cpp | #include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
const int MAXN = 3e5 + 5;
const int MAXM = 3e5 + 5;
const int MAXP = MAXM*2;
int n,m;
int fa[MAXP],size[MAXP],must[MAXP];
int find(int u){ return fa[u]==u? u: fa[u]=find(fa[u]);}
inline void connect(int u,int v)
{
int fu=find(u), fv=find(v);
... | ALGO | 0.999931 | 3.792763 |
79adf0bf-4dc5-4fb7-aa9d-399e4460bccb | liuq901/code | ZOJ/z_1450.cpp | #include <cstdio>
#include <cstdlib>
#include <cmath>
const double pi=3.1415926535897;
struct point
{
double x,y;
double mod()
{
return(sqrt(x*x+y*y));
}
};
bool operator ==(point a,point b)
{
if (fabs(a.x-b.x)<1e-8 && fabs(a.y-b.y)<1e-8)
return(true);
else
return(false);
}
bool oper... | ALGO | 0.999869 | 3.871507 |
fb7e1eca-6261-4003-9667-27c5790f92d2 | sumitkr2000/Striver-SDE-Sheet-Challenge | Day 13/Stack using queue.cpp | class MyStack {
public:
queue<int> q;
MyStack() {
}
void push(int x) {
q.push(x);
int size = q.size() - 1;
while(size--) {
q.push(q.front());
q.pop();
}
}
int pop() {
int ele = q.front();
q.pop();
... | ALGO | 0.998356 | 5.39601 |
1e4548bf-a687-45b9-b2b5-15d74bc31de7 | Biank23/Competitive-Programming | OI/OIA/2011/Certamen de Selección/Día 2/aventureros.cpp | #include <bits/stdc++.h>
using namespace std;
const int SZ = 1<<19;
int st[2 * SZ];
void init(int n) {
for (int i = 0; i < n; i++) {
st[i + SZ] = 1;
}
for (int i = SZ - 1; i > 0; i--) {
st[i] = st[2 * i] + st[2 * i + 1];
}
}
int find(int sum) {
int u = 1;
while (u < SZ)... | ALGO | 0.999997 | 3.901315 |
21fc6642-c725-4384-8d9f-6ad03a915075 | Farhad559/Codeforces | 320A Magic Numbers.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define nl '\n'
#define yes cout << "YES" << endl
#define no cout << "NO" << endl
int main() {
optimize();
string s;cin>>s;
ll i=0;
bool cbd=true;
while(i<s.size()) {
if(i+2<s... | ALGO | 0.99963 | 3.718892 |
b0e79934-de65-4815-bb79-f95fde35c731 | moto6/Coding_TEST | BEAK_gicho/14501.cpp | /////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////
#include<iostream>
using namespace std;
int map[501][501];
const int DEBUG = 1;
const int FILEIO = 1;//1:use, 0:Not use
//int dx[]... | ALGO | 0.999793 | 3.136377 |
b8b67720-a896-454c-b7ab-0fa24d549d75 | karleone-don/ads | lab2/f.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
int a, b, c;
cin >> a;
vector<int> n;
for(int i = 0; i < a; i++){
cin >> b;
n.push_back(b);
}
cin >> b >> c;
auto it = n.begin() + c;
n.insert(it, b);
for(int i = 0; i < a+1; i++){
cou... | ALGO | 0.999892 | 3.131109 |
9f2ebc5d-a39e-4ee3-b5b1-949720040ae6 | BartVandewoestyne/Cpp | C++98/examples/iterator/reverse_iterator.cpp | /*
* Key ideas:
*
* - To iterate backwards through a list or vector, you can use a
* reverse_iterator. A reverse iterator is made from a bidirectional, or
* random access iterator which it keeps as a member which can be accessed
* through base(). To iterate backwards use rbegin() and rend() as the... | ALGO | 0.998057 | 5.648057 |
13c973b0-eb4a-47f6-b343-c7fc2d66006a | loomplyty/RobotIX | Kinect2/Vision_Gait0.cpp | #include "Vision_Gait0.h"
int RobotVisionWalk(Robots::RobotBase &robot, const VISION_WALK_PARAM ¶m)
{
Robots::WalkParam wk_param;
switch(param.movetype)
{
case turn:
{
wk_param.alpha = 0;
wk_param.beta = param.turndata*M_PI/180;
wk_param.d = 0;
wk_param.h = 0.05... | ALGO | 0.947308 | 3.205526 |
c8ba5cb3-6660-4367-a348-0fa4cdd84460 | DrNightmare/codemonk-practice | stl2.cpp | #include "iostream"
#include "string"
#include "set"
#define REP(i, n) for(int i = 0; i < n; i++)
using namespace std;
int main()
{
int n, t;
cin >> t;
while(t--){
set<string> namelist;
set<string>::iterator it;
string name;
cin >> n;
REP(i, n) {
cin >> name;
namelist.insert(name);
}
for (it ... | ALGO | 0.998852 | 4.373544 |
df918dce-67b0-47c6-874c-ac78da213357 | ed-he/MA1 | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
ab10fc9d-3c60-48be-9324-bd2460d09225 | yohanse/flutter_exercise_and_project | weather/windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998662 | 6.76073 |
c109f1aa-ab68-4c1a-b2df-44551ed03841 | HarenKei/BOJ_Solved | DP/1904.cpp | #include <bits/stdc++.h>
#define MAX 1000001
using namespace std;
int n;
long dp[MAX];
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> n;
dp[0] = 0;
dp[1] = 1;
dp[2] = 2;
for(int i = 3; i <= n; i++){
dp[i] = (dp[i - 1] + dp[i - 2]) % 15746;
... | ALGO | 0.999973 | 4.273135 |
208e552c-3a6a-4a69-8e0a-1e41e34caa54 | benenzhu/nowcoder-linux | nowcoder-1/s28_dir_traverse/readFileNum.cpp | /*
// 打开一个目录
#include <dirent.h>
#include <sys/types.h>
DIR *opendir(const char *name);
name 名称
return
DIR 的结构体 / 目录流信息
错误返回 NULL
// 读取目录中的数据
#include <dirent.h>
struct dirent *readdir(DIR *dirp);
name
return
#include <dire... | TOOL | 0.873656 | 4.378806 |
b7ae0caf-6d45-4f51-b296-d0a86bcd39ee | Coder02Aniket/C-Plus-Plus-Codes | love babbar dsa series/Code/others/lec5fibonacci.cpp | #include<iostream>
using namespace std;
int fibonacci(int n){
if(n<2)
return n;
return fibonacci(n-1) + fibonacci(n-2);
}
int main(){
cout<<"enter number to calculate the series till postion ";
int num;
cout<<"calculating till position "<<num<<endl;
cin >> num;
fo... | ALGO | 0.99921 | 3.958106 |
de99d5a9-3bd1-49a2-aba3-0cfcb46da7d5 | siiyayu/Algorithms-specialization | course1/week5_dynamic_programming1/1_money_change_again/change_dp.cpp | #include <iostream>
#include <vector>
using namespace std;
int get_change(int money, const vector<int>& coins) {
vector<int> min_num_coins(money + 1);
min_num_coins[0] = 0;
for (int m = 1; m <= money; m++) {
min_num_coins[m] = 1e6;
for (int coin : coins) {
if (m >= coin) {
... | ALGO | 0.999935 | 5.554112 |
72e4eac7-0a3f-47bb-b173-6831374cff5d | Hiyabye/Baekjoon | 21xxx/21569.cpp | #include <algorithm>
#include <iostream>
using namespace std;
void solve(void) {
int a, b; cin >> a >> b;
cout << min((max(a, b)+1)/2, min(a, b)) << " " << max((max(a, b)+1)/2, min(a, b));
}
int main(void) {
ios::sync_with_stdio(false);
cin.tie(nullptr);
solve();
return 0;
} | ALGO | 0.999962 | 4.678199 |
9ba0cee2-4f5e-44ab-909f-6d7535fed219 | gururajks/sortingalgorithm_cpp | DataStructures/Graph/AStar.cpp | #include<queue>
#include<vector>
#include <map>
using namespace std;
/*
class Point
{
public:
Point(int x, int y) : distance(0) {}
Point(int x, int y, int distance) : x(x), y(y), distance(distance) {}
int x;
int y;
int distance;
};
int h(Point current, Point target)
{
return (abs(current.x - target.x) + abs(cur... | ALGO | 0.999969 | 3.810349 |
866ef60c-f48b-4f23-9611-42651f26bd9e | threewhite3/CPP_Improve_Programming | STL_Function_Object.cpp | #include<iostream>
#include<string>
#include<vector>
#include<deque>
#include<algorithm>
#include<functional>
#include<stack>
#include<queue>
#include<list>
#include<map>
#include<set>
using namespace std;
//1、函数对象在使用时,可以像普通函数那样调用, 可以有参数,可以有返回值
class MyAdd
{
public:
int operator()(int v1, int v2)
{
return v1 + v2... | TOOL | 0.971806 | 4.522663 |
9f7f60f2-0098-49a5-a478-15403da90cd1 | harshitasaini16/Leetcode-Practise | 965-univalued-binary-tree/965-univalued-binary-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999628 | 6.505512 |
dc89a731-a2a3-4127-81b4-749dd6c9535d | Orang123/ACMAlgorithmExercises | 字符串/尺取/计算满足条件的子串的个数/HDU 5806 NanoApe Loves Sequence Ⅱ.cpp | /*
:ժ
nmkҸnУжٸkСm
2<=n<=200000,1<=m<=10^9,1<=k<=100000.
:http://acm.hdu.edu.cn/showproblem.php?pid=5806
˼·:ȡ.ֻҪ֤ӴвСmĸΪk,ܱ֤
kСm.
*/
//ac 546ms
//ʱ ճleetcodeʱ ֮ǰд ...
//csdnҵ
#include <iostream>
#include <cstdio>
#include<vector>
#include <cstring>
#include <algorithm>
using namespace std;
typedef long long LL;
const in... | ALGO | 0.999897 | 4.009153 |
3db96243-4ede-470f-af5d-36862dbd1144 | lealdavi/Maratona-UFSCar-So-2024 | semana04/maximise_the_score.cpp | #include <bits/stdc++.h>
using namespace std;
void insertion_sort(long int arr[], int n);
long int min(long int a, long int b);
int main()
{
int t, n;
long int a[101], score;
cin >> t;
for (int i = 0; i < t; i++)
{
score = 0;
cin >> n;
n *= 2;
for (int j = 0; j < n... | ALGO | 0.999586 | 4.242181 |
0dc6b8f8-c78f-4340-80d0-70b230e5c56d | aacienfuegos/covIRIN | experiments/testevoexp.cpp |
/******************* INCLUDES ******************/
/***********************************************/
/******************** General ******************/
#include <gsl/gsl_rng.h>
#include <gsl/gsl_randist.h>
#include <sys/time.h>
/******************** Simulator ****************/
#include <vector>
#include "simmath.h"
#... | ALGO | 0.873877 | 3.869923 |
fb85306d-82a0-49af-bb86-23488ca03f71 | iam-dha/DSA | Algorithm/Sorting&Searching/1621.cses.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
set<int> se;
int ans = 0;
for(int i = 0; i < n; i++){
int x; cin >> x;
if(se.find(x) == se.end()){
ans++;
se.insert(x);
}
}
cout << ans;
}
| ALGO | 0.999896 | 4.085962 |
dc95a493-6c93-4a5a-a2ff-6ffe92f81286 | akadjoker/gmogre3d | OgreMain/src/OgreOptimisedUtil.cpp | #include "OgreStableHeaders.h"
#include "OgreOptimisedUtil.h"
#include "OgrePlatformInformation.h"
//#define __DO_PROFILE__
#ifdef __DO_PROFILE__
#include "OgreRoot.h"
#endif
namespace Ogre {
//---------------------------------------------------------------------
// External functions
extern OptimisedU... | TOOL | 0.948987 | 6.072002 |
024a659a-dd7c-4352-882b-c40beee42279 | dhruviladani/leetcode | Binary Search/binary_search.cpp | class Solution {
public:
int search(vector<int>& nums, int target) {
int l = 0;
int h = nums.size()-1;
while(l <= h){
int mid = (l + h)/2;
if(nums[mid] == target){
return mid;
}
else if(target > nums[mid]){
l = m... | ALGO | 0.999867 | 6.236067 |
f5eeb599-4e36-4fb3-9c9b-50da692acd5f | thegamer1907/Code_Analysis | CodesNew/3706.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define lp(var,start,end) for (ll var = start; var <end ; ++var)
#define rlp(var,start,end) for(ll var = start; var>=end ; var--)
#define pb push_back
#define mp make_pair
#define pf push_front
#define F first
#define S seco... | ALGO | 0.999987 | 3.547246 |
7e84fb5e-9377-480a-8370-a84851e9b13a | iwei20/advent2021 | 9/1/main.cpp | #include <bits/stdc++.h>
#include "../../advent_utils.hpp"
using namespace std;
using ll = long long;
using vi = vector<int>;
vector<int> dx = {-1, 0, 1, 0};
vector<int> dy = {0, 1, 0, -1};
int basin_size(vector<vector<int>>& hmap, vector<vector<bool>>& visited, int i, int j) {
if(hmap[i][j] == INT_MAX || visited... | ALGO | 0.999683 | 6.341967 |
38da3366-cca0-47fa-8ec6-a1a517f81729 | farhannirzhor/Codeforces_Problem-s_Solutions | 282A Bit++.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
int c=0;
cin>>n;
for(int i=0;i<n;i++)
{
string s;
cin>>s;
if(s[1]=='+')
{
c++;
}
else if(s[1]=='-')
{
c--;
}
}
cout<<c<<endl;
}
| ALGO | 0.999933 | 4.115839 |
1337ec28-0990-4194-9b3a-2b3210c1f80e | Abhinav7076/My-Codes | LeetCode-Solutions-master/C++/find-the-index-of-the-large-integer.cpp | // Time: O(logn)
// Space: O(1)
class Solution {
public:
int getIndex(ArrayReader &reader) {
int left = 0, right = reader.length() - 1;
while (left < right) {
const auto& mid = left + (right - left) / 2;
if (reader.compareSub(left, mid, (right - left + 1) % 2 ? mid : mid + ... | ALGO | 0.999556 | 5.958586 |
96f55c2c-88d2-4d5f-8f07-cf643bbec19f | NorwegianIcecube/advent_of_code2024 | day_7/d7p2.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
long concat_cumbers(long a, long b){
string a_str = to_string(a);
string b_str = to_string(b);
string ab_str = a_str + b_str;
return stol(ab_str);
}
int main(){
ifstream infile("pu... | ALGO | 0.999971 | 4.906177 |
1e5d1afa-1110-47dc-9944-eb2849f5f3d2 | trannguyen997/Tile | Assets/tiled-master/src/libtiled/wangset.cpp | #include "tilelayer.h"
#include "wangset.h"
#include <QDebug>
#include <QStack>
#include <QtMath>
namespace Tiled {
/**
* These return the color of the edge of the WangId.
* 0 being the top edge:
*
* |0|
* 3|.|1
* |2|
*/
int WangId::edgeColor(int index) const
{
Q_ASSERT(index >= 0 && inde... | TOOL | 0.958761 | 6.505241 |
d862e253-d353-4b37-9ed8-87b00938efb5 | offamitkumar/UVA--Online-Judge | Solution/Problem_011614/11614 Etruscan Warriors Never Play Chess.cpp | #include <bits/stdc++.h>
using namespace std;
#define int int64_t
signed main(void){
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
#ifdef HELL_JUDGE
freopen("input","r",stdin);
freopen("output","w",stdout);
#endif
int t; cin >> t;
while(t--){
long double n; cin ... | ALGO | 0.999793 | 3.934649 |
cb260b3b-56b8-49f9-8dcd-bc4d61c3ac65 | ParasAnxi/LeetCode-CPP | Q0901-1000/983.Minimum_Cost_For_Tickets.cpp | class Solution {
private:
int solve(int n,vector<int>& days, vector<int>& cost,int index,vector<int>& dp){
if(index >= n)
return 0;
if(dp[index]!=-1)
return dp[index];
int option1 = cost[0]+solve(n,days,cost,index+1,dp);
int i;
for(i=index;i<n&&days[i]<days[index]+7;i++... | ALGO | 0.999675 | 5.598987 |
6eb649c8-34a2-4915-bcee-fd2b6dcc1150 | logarathansv/LeetCodez | 0940-fruit-into-baskets/0940-fruit-into-baskets.cpp | class Solution {
public:
int totalFruit(vector<int>& fruits) {
unordered_set<int> st;
unordered_map<int, int> mp;
int l = 0, r = 0;
int maxlen = 0, len = 0;
for (r = 0; r < fruits.size(); r++) {
st.insert(fruits[r]);
mp[fruits[r]]++;
// for... | ALGO | 0.999961 | 6.260395 |
860551b2-091d-4ec5-8b5d-f99428d27c60 | Shamikh05/Leetcode-Daily-Challenge | November-2022/Day-23/Valid_Sudoku.cpp | class Solution {
/* Block Index can be given as:
(i / 3) is getting the row number
((i / 3) * 3) is giving the number of blocks before that block
((i / 3) * 3) + (j / 3) is giving the exact index of that block
0 0 0 | 1 1 1 | 2 2 2
0 0 0 | 1 1 1 | 2 2 2
0 0 0 | 1 1 1 | 2 2 2
--------------... | ALGO | 0.999273 | 6.874053 |
a9c53ac4-d7a6-49d3-9bd8-32c4859deeb6 | saptarshi-mondal-12/DSA-Revision | 7. Matrix/30_Search_in_2D_matrix_II.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
/* Search in 2D matrix II
Write an efficient algorithm that searches for a value target in an m x n integer matrix matrix. This matrix has the following properties:
1. Integers in each row are sorted in ascending from left to right.
2. Integers in each c... | ALGO | 0.99997 | 6.166767 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.