uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
cf42c576-f71e-4707-abb5-a384fced06fe | satyamsingh-stack/GFG | Linkedlist/Circular_Linkedlist_Insertion_at_End_(Efficient).cpp | /*Time Complixity = O(1)*/
#include<bits/stdc++.h>
using namespace std;
struct Node{
int data;
Node *next;
Node(int x){
data=x;
next=NULL;
}
};
Node *insertEnd(Node *head,int x){
Node *temp=new Node(x);
if(head==NULL){
temp->next=temp;
return temp;
}
else{
temp->next=head->next;
head->next=temp;
i... | ALGO | 0.999715 | 4.282009 |
3cc6e4b6-d5fe-4fcc-8ffe-8dc20a5f3921 | Jatin-Shihora/DSA-Essentials_Core-CS | Data_Structures/Priority Queue/9. Course Scheduler 3.cpp | class Solution {
public:
static bool cmp(vector<int>v1,vector<int>v2)
{
return v1[1]<v2[1];
}
int scheduleCourse(vector<vector<int>>& courses) {
sort(courses.begin(),courses.end(),cmp);
priority_queue<int>pq;
int count=0;
for(auto x:courses)
{
... | ALGO | 0.999874 | 6.147332 |
b46368b6-dbf1-4b3b-9fdd-a44d9647f529 | rahenri/blackbit | src/search.cpp | #include "search.h"
#include "board.h"
#include "board_array.h"
#include "hash.h"
/* configurable params */
const int mate_score = 100000;
uint32_t pv_fail = 0, node_count = 0;
const int cap_table[7] = {0, 1, 2, 3, 4, 5, 6};
// const int mob_pref_table[7] = {0, 1, 5, 4, 3, 2, 0};
BoardArray<BoardArray<int>> move_... | ALGO | 0.999889 | 5.849814 |
a4e1d66a-bea5-4f71-9fef-552c9e4844fa | jwu/exlibs-c | ext/physfs-2.0.2/lzma/CPP/7zip/UI/Common/SortUtils.cpp | // SortUtils.cpp
#include "StdAfx.h"
#include "SortUtils.h"
#include "Common/Wildcard.h"
static int CompareStrings(const int *p1, const int *p2, void *param)
{
const UStringVector &strings = *(const UStringVector *)param;
return CompareFileNames(strings[*p1], strings[*p2]);
}
void SortFileNames(const UStringVec... | TOOL | 0.940311 | 6.468472 |
cd117eb8-55db-4888-8354-add0a364a4b1 | yash007i/cpp-basic | 04_conditional/cond3.cpp | #include <iostream>
using namespace std;
int main() {
int cups;
double pricePerCup = 20;
double totalPrice , discount;
cout << "Enter the number of cups: " << endl;
cin >> cups;
if(cups > 20){
discount = 0.20;
}else if(cups >= 10 && cups <= 20){
discount = 0.10;
}els... | TOOL | 0.964674 | 4.202976 |
5bd5b52e-eb35-438c-a8ba-1d15cdd29ac3 | HorizenOfficial/zend_oo | src/crypto/equihash.cpp | // Implementation of the Equihash Proof-of-Work algorithm.
//
// Reference
// =========
// Alex Biryukov and Dmitry Khovratovich
// Equihash: Asymmetric Proof-of-Work Based on the Generalized Birthday Problem
// NDSS ’16, 21-24 February 2016, San Diego, CA, USA
// https://www.internetsociety.org/sites/default/files/blo... | ALGO | 0.999928 | 7.309673 |
6851ff52-d917-4c5b-b238-da1aa660036b | nvbangg/CodePTIT | ToanRoiRac2/CT004_ChuTrinhHamilton01.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
const int N = 105;
int n, u;
vector<vector<int>> mtKe;
vector<vector<int>> res;
vector<int> path;
vector<bool> visited;
void Hamilton(int i)
{
for (int j = 1; j <= n; j++)
{
if (!visited[j] && mtKe[path[i - 1]][j])
{
v... | ALGO | 0.999935 | 4.436095 |
77cb6dd5-aaf2-4539-bce6-932bcb662ca5 | yigiterenalp/Homeworks-for-PD1-Lesson | Homework2_17_c/Homework2_17.cpp | #include <stdio.h>
int main()
{
double sum=0.0;
int n;
printf("Enter number of terms in series: \n");
scanf("%d",&n);
for(int a=1;a<=n;a++)
{
sum+=1.0/a;
printf("1/%d +",a);
}
printf("\n\nSum:%f\n",sum);
}
| ALGO | 0.997324 | 3.272361 |
edf42e39-bafe-4c26-9ed0-b51b5c736775 | hadifauzan/pemrogaman_mobile | uts/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.997975 | 6.76775 |
d5905aa1-5643-47e3-8f50-008274c4e302 | YarKhan02/Data-Structures-And-Algorithms | Tree/LevelOrderTraversal.cpp | #include <iostream>
using namespace std;
class Node {
public:
int data;
Node* left;
Node* right;
Node* next;
Node(int data) {
this->data = data;
this->left = nullptr;
this->right = nullptr;
this->next = nullptr;
}
};
... | ALGO | 0.999919 | 5.15269 |
e2f82266-6d76-43a7-8638-c7f32c9d64aa | openkylin/inkscape | src/3rdparty/2geom/src/2geom/sweep-bounds.cpp | #include <2geom/sweep-bounds.h>
#include <algorithm>
namespace Geom {
struct Event {
double x;
unsigned ix;
bool closing;
Event(double pos, unsigned i, bool c) : x(pos), ix(i), closing(c) {}
// Lexicographic ordering by x then closing
bool operator<(Event const &other) const {
if(x < othe... | ALGO | 0.999503 | 7.597327 |
5b570562-8672-4765-bee7-3fe3f9413ffe | metalFrenzy/Rick-and-Morty | 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.998859 | 6.785645 |
dbb2e384-f514-47a9-8a16-9fc72df6a8f7 | zyayoung/ByteTrackInference | yolox/layers/csrc/cocoeval/cocoeval.cpp | using namespace pybind11::literals;
namespace COCOeval {
// Sort detections from highest score to lowest, such that
// detection_instances[detection_sorted_indices[t]] >=
// detection_instances[detection_sorted_indices[t+1]]. Use stable_sort to match
// original COCO API
void SortInstancesByDetectionScore(
const... | DATA | 0.99707 | 7.840165 |
b1039330-c90a-4216-a328-e110e3aee7f6 | Nafyaz/my-codes | Codeforces/1631A.cpp | #include<bits/stdc++.h>
using namespace std;
int a[102];
int b[102];
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int t, n, i, mxa, mxb;
cin >> t;
while(t--)
{
cin >> n;
for(i = 0; i < n; i++)
{
cin >> a[i];
}
for(i = 0; i < n; ... | ALGO | 0.999976 | 3.236194 |
0567ea75-ee62-4d64-aa9b-ebb623570f06 | CPP-Algorithm-Study/CPP-Algorithm-Study | cherry/0814/둘만의 암호.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
/*
<문제설명>
입력 : 두 문자열 s,skip, 자연수 index
출력 : 알맞게 변경된 암호
내용
1. 문자열 s의 각 알파벳 index 만큼 뒤의 알파벳으로 바꿔줌.
2. index 만큼의 뒤의 알파벳이 z를 넘어갈 경우 다시 a로 돌아감.
3. skip 에 있는 알파벳은 제외하고 건너뜀
*/
string solution(string s, string skip_, int index) {
string answ... | ALGO | 0.999582 | 5.506318 |
c4f3bf9a-af38-491c-bdd8-e3a6890d195e | hellocomrade/happycoding | hackerrank/MaximumElement.cpp | #include <iostream>
#include <stack>
#include <algorithm>
using namespace std;
//https://www.hackerrank.com/challenges/maximum-element/
/*
Maximum Element
You have an empty sequence, and you will be given queries. Each query is one of these three types:
1 x -Push the element x into the stack.
2 -Delete the ele... | ALGO | 0.999434 | 5.306684 |
df719172-076c-4209-82bf-90c07cf2e065 | manojmh/ComputerScience | algorithms/DP/IBit/LongestPalindromicSubsequence.cpp | /**
https://www.interviewbit.com/problems/longest-palindromic-subsequence/
Given a string A, find the common palindromic sequence
(A sequence which does not need to be contiguous and is a pallindrome), which is common in itself.
You need to return the length of longest palindromic subsequence in A.
NOTE:
Your code wil... | ALGO | 0.999972 | 5.916565 |
0792f3b6-5c95-4502-9232-19c5685fce78 | Hee-won/LLVM-JSRfuzz | llvm/lib/Transforms/Utils/LoopUnroll.cpp | #include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Twine.h"
#include "llvm/ADT/ilist_iterator.h"
#include "llvm/ADT/iterator_ran... | ALGO | 0.959108 | 3.155799 |
7d30fa07-ae79-4fb9-906a-57af79f8792d | bmvaysfe/CPP | ht3.cpp | // Hash Table Problems
#include<iostream>
#include<vector>
#include<string>
#include<queue>
#include<cstring>
#include<algorithm>
#include<cmath>
#include<cctype>
#include<cmath>
#include<cassert> // for assert()
#include<set>
#include<map>
#include<cstdio>
#include<unordered_set> // for Hash Table C++ 11 implementa... | ALGO | 0.989261 | 4.276619 |
21ed66ad-6a25-4c0b-bf09-0f47f96ccb28 | lugnitdgp/codecracker_sharif | assignments/assignment_12/p2/meraj/submission_80.cpp | #include <iostream>
#include <cstdio>
#include <math.h>
using namespace std;
int main()
{
long long int ct1, ct2, t, sq, i, n, *arr;
cin>>t;
while (t--)
{
cin>>n;
arr=new long long int[n];
for (i=0; i<n; i++)
{
cin>>arr[i];
}
ct1=ct2=0;
... | ALGO | 0.999805 | 3.520741 |
63cf8c40-73e4-4191-b9d3-fd704ed3117c | nindob/interview-prep | codeforces/800/Way Too Long Words.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
string word;
cin >> word;
if (word.length() > 10) {
cout << word[0] << word.length() - 2 << word[word.length() - 1] << endl;
}
else {... | ALGO | 0.999246 | 5.509427 |
73cce121-895f-4d99-abb0-95389cd4d83f | FilippoScaramuzza/online-chess | back-end/stockfish/sf_14_src/src/material.cpp | #include <cassert>
#include <cstring> // For std::memset
#include "material.h"
#include "thread.h"
using namespace std;
namespace Stockfish {
namespace {
#define S(mg, eg) make_score(mg, eg)
// Polynomial material imbalance parameters
// One Score parameter for each pair (our piece, another of our pieces)... | ALGO | 0.99712 | 6.799293 |
5e8181d6-6210-4cab-8c3f-e53384ec668b | n99joon/AlgorithmProblems | CPPTester/CSCI570Exam2/DP_Question.cpp | //Given an integer array nums and an integer m, find k non-overlapping subarrays of length m with maximum sum and return them.
//Return the result as a list of indices representing the starting position of each interval (0-indexed). If there are multiple answers, return the lexicographically smallest one.
// If tie, re... | ALGO | 0.999966 | 5.530803 |
bc547a67-1668-4511-a081-018a98c09dfc | PriyanshK09/Leetcode-Discord-Bot | solutions/detect-cycles-in-2d-grid.cpp | // Time: O(m * n * α(n)) ~= O(m * n)
// Space: O(m * n)
class Solution {
public:
bool containsCycle(vector<vector<char>>& grid) {
UnionFind union_find(grid.size() * grid[0].size());
for (int i = 0; i < grid.size(); ++i) {
for (int j = 0; j < grid[0].size(); ++j) {
if (i... | ALGO | 0.999945 | 6.928792 |
2929e976-9347-4519-aa24-d2f7ad7d3a09 | rodion-s/msu_cpp_autumn_2019 | 01/calc.cpp | /*
EXPR --> TERM{+TERM | -TERM}
TERM --> FACTOR{*FACTOR | /FACTOR}
FACTOR --> -FACTOR | NUMBER
NUMBER --> 0|1|....|INT_MAX
*/
#include <iostream>
#include <stack>
#include <stdexcept>
#include <string>
using namespace std;
void GET_LEX(const char *input, int &idx) {
while (isspace((unsigned char)in... | ALGO | 0.999286 | 4.936038 |
e5a161a2-7525-43bd-a05e-30973265c8e6 | CodingMadeEasy786/BasicProblemforbeginners | EvenOrOdd.cpp | #include <iostream>
using namespace std;
int main()
{
int Num;
cout<<"enter a number to find even or odd";
cin>>Num;
if(Num/2==0)
{
cout<<"it is an Even Number"<<Num;
}
else
{
cout<<"it is an odd Number"<<Num;
}
} | ALGO | 0.986494 | 3.081241 |
17b607d5-a27b-4a5b-b773-e7198e980380 | shinchan0604/Data_structues_lab | lab10/pqmaxheap.cpp | //program to implement priority queue(max heap)
#include<iostream>
#include<vector>
using namespace std;
class maxheap{
private:
vector<int> heap;
int size;
public:
maxheap()
{size = 0;}
void heapifyup(int index);
void heapifydown(int index);
void insert(i... | ALGO | 0.999899 | 4.737994 |
e70278f0-a1b2-49a9-ba93-65d3ebbeac57 | Mobiussoaring/DMSXL-algorithm-code | 数组/区间和.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int length; // 数组长度
vector<int> sum(length, 0); // 区间和数组
cin >> length >> sum[0];
int tem;
for (int i = 1; i < length; i++)
{
cin >> tem;
sum[i] = sum[i - 1] + tem; // 计算区间和
}
int a, b;
while ... | ALGO | 0.999762 | 3.827314 |
fbd82130-aef2-4fbd-8c75-7bb5d2cd3252 | aroup/UVaOnlineJudge | UVa 1206/a.cpp | //money,fear,hunger
#include <bits/stdc++.h>
using namespace std;
#define _CRT_SECURE_NO_DEPRECATE
typedef long long ll ;
typedef vector <int> vi ;
typedef pair <int, int> ii ;
typedef vector <ii> vii;
typedef set <int> si ;
typedef map <string,int> msi;
#define REP(i,a,b) \
for (... | ALGO | 0.999549 | 3.886912 |
d5c596ed-ba5f-4013-acc2-90dd20fb7196 | masashi545/Cpp | maximum-cup-2018/h/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); ++i)
using ll = long long;
using P = pair<int, int>;
const ll INF = 1e12 + 7;
int N;
const int MAX_N = 310;
vector<vector<ll>> d(MAX_N, vector<ll>(MAX_N, INF)); // 各頂点間の最短距離
void warshall_floyd() {
rep(k, N) {
rep(i, ... | ALGO | 0.999961 | 4.684531 |
3dd979b5-83c3-487c-9758-220da9d4edf0 | Vaibhav-Raktate/Leetcode | 290. Word Pattern.cpp | class Solution {
public:
bool wordPattern(string pattern, string s) {
vector<string>v;
int i=0;
string temp="";
while(i<s.size()){
if(s[i]==' '){
v.push_back(temp);
temp="";
}
... | ALGO | 0.999498 | 6.107577 |
5a84238b-1305-4b65-a128-df6bc7899292 | gracexiao1029/ComputerGraphics | computer-graphics-shader-pipeline/eigen/demos/mandelbrot/mandelbrot.cpp | #include "mandelbrot.h"
#include <iostream>
#include<QtGui/QPainter>
#include<QtGui/QImage>
#include<QtGui/QMouseEvent>
#include<QtCore/QTime>
void MandelbrotWidget::resizeEvent(QResizeEvent *)
{
if(size < width() * height())
{
std::cout << "reallocate buffer" << std::endl;
size = width() * height();
i... | ALGO | 0.875599 | 5.79494 |
1c709a12-d613-42f6-8d7b-f86f45ddb911 | Pedroo123/algoritmos-c | Basics/media.cpp | #include <stdio.h>
#include <stdlib.h>
int main() {
float nota1 = 0, nota2 = 0, nota3 = 0, nota4 = 0, mediaFinal = 0;
printf("----- Media Final ----- \n ");
printf("Digite a primeira nota: ");
scanf("%f", ¬a1);
printf("Digite a segunda nota: ");
scanf("%f", ¬a2);
printf("Digite a terceira nota: ... | ALGO | 0.998527 | 3.569221 |
0d7cc1d1-e80a-4fc7-8c02-46a92ae0760a | calvinckfong/leetcode | 3000/2138.cpp | // 2138. Divide a String Into Groups of Size k
class Solution {
public:
vector<string> divideString(string s, int k, char fill) {
vector<string> result;
for (int i=0; i<s.size(); i+=k) {
string ss = s.substr(i, k);
while (ss.size()<k)
ss.push_back(fill);
... | ALGO | 0.998767 | 5.572763 |
76eb8649-af8b-4b58-9008-fe660bd517ae | cuonggpham/HUST-Applied-Algorithms | Lab/Lab01/01.03.range_minimum_query.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1000000; // Số phần tử tối đa trong mảng
const int LOG = 30; // Số lượng bit để biểu diễn giá trị tối đa của log2(n)
int n;
int A[MAX_N];
int M[LOG][MAX_N]; // Mảng lưu giá trị chỉ số của các phần tử nhỏ nhất trong các đoạn
// Hàm tiền xử lý mảng... | ALGO | 0.999991 | 6.012788 |
f8d44cfc-e4dd-43d7-9720-9169d5b627f7 | supriya759694/Code-CPP | nextpermu.cpp |
//next permutation which directly returns the lexicographically next greater permutation of the input.
#include<bits/stdc++.h>
using namespace std;
int main(){
vector<int>a={2,1,3};
next_permutation(a.begin(),a.end());
int n=a.size();
for(int i=0; i<n; i++)
cout<<a[i]<<" ";
}
| ALGO | 0.999852 | 3.768573 |
c3b6b44e-87bc-4f74-8e56-67d30020069d | stg0123/baekjoonlearn | brute force/baekjoon2577.cpp | #include <iostream>
#include <string>
using namespace std;
int main(){
long long a,b,c,sum,mod=10,tmp=0;
int x[10]={};
std::cin >> a >> b >> c;
sum=a*b*c;
std::string str = std::to_string(sum);
for(int i=0;i<str.length();i++){
x[(sum%mod-tmp)/(mod/10)]++;
tmp=sum%mod;
mo... | ALGO | 0.99983 | 3.808882 |
a0056995-a499-4e0b-87de-fdd5a8da9a40 | hegde95/PPO_TORCS_IMAGE | vtorcs-RL-color/src/modules/simu/simuv2/aero.cpp | #include "sim.h"
void
SimAeroConfig(tCar *car)
{
void *hdle = car->params;
tdble Cx, FrntArea;
Cx = GfParmGetNum(hdle, SECT_AERODYNAMICS, PRM_CX, (char*)NULL, 0.4f);
FrntArea = GfParmGetNum(hdle, SECT_AERODYNAMICS, PRM_FRNTAREA, (char*)NULL, 2.5f);
car->aero.Clift[0] = GfParmGetNum(hdle... | ALGO | 0.984801 | 4.909784 |
ee66e6db-586f-41ff-98ae-297bf9a04a56 | MAYANK20293/Leetcode | 1731-even-odd-tree/1731-even-odd-tree.cpp | class Solution {
public:
bool dfs(TreeNode* root, vector<int>& val, int depth) {
if (!root)
return 1;
if (depth + 1 > val.size()) {
if ((depth & 1) ^ (root->val & 1))
val.push_back(root->val);
else
return 0;
} else {
... | ALGO | 0.999989 | 5.846852 |
76735de0-fc99-4ad9-a07b-f18c0248ec78 | Geeteshsood/leetcode | 1655-distribute-repeating-integers/1655-distribute-repeating-integers.cpp | class Solution {
public:
bool find(int i,vector<int> &freq,vector<int> &quantity){
int n = freq.size() , m = quantity.size();
if(i == m){
return true;
}
for(int j=0;j<n;j++){
if(quantity[i] <= freq[j]){
... | ALGO | 0.999997 | 5.710184 |
5ceca446-f0d8-462e-b5c9-bdcd83bf813b | FranklinMar/Programming-Tasks | C++/Practice-5/Task02.cpp | /*
------------------
Name: Task02.cpp
------------------------------------------------------------
Description: Using the following class declaration, create
an array of 10 elements, initialize the variable "num"
with values from 1 to 10, and the variable "sqr" - with
squared num.
----------------------------... | TOOL | 0.92387 | 3.697236 |
088d689b-081b-4de8-9969-c10e3f50dcb6 | alexriderspy/Competitive-Programming | codeforces/726/p1.cpp | #include<bits/stdc++.h>
using namespace std;
void solve(){
int n;
cin>>n;
vector<int>v(n,0);
for(auto &x:v) cin>>x;
long long int sum=0;
int ans=0;
for(int i=0;i<n;i++) sum+=v[i];
if(sum<n) cout<<1<<'\n';
else{
cout<<sum-n<<'\n';
}
}
int main(){
int t;
cin>>t;
... | ALGO | 0.999789 | 3.692313 |
0b232154-cf3f-4be4-bf22-3a49089115f3 | sdinx/D3D11_ECS | bullet3/src/BulletCollision/CollisionDispatch/btBoxBoxDetector.cpp | ///ODE box-box collision detection is adapted to work with Bullet
#include "btBoxBoxDetector.h"
#include "BulletCollision/CollisionShapes/btBoxShape.h"
#include <float.h>
#include <string.h>
btBoxBoxDetector::btBoxBoxDetector(const btBoxShape* box1,const btBoxShape* box2)
: m_box1(box1),
m_box2(box2)
{
}
// given ... | ALGO | 0.999556 | 6.435564 |
f820eeab-58b6-477b-a807-94f46c5a6564 | KidusB9/Applications-of-Data-strctures-and-Algorthims-In-C- | C++ algorithm that generates all possible permutations of a given set of integers:.cpp | #include <iostream>
#include <vector>
void generate_permutations(std::vector<int>& nums, std::vector<bool>& used, std::vector<int>& current_permutation) {
// If the current permutation is the same size as the input set, print it out and return
if (current_permutation.size() == nums.size()) {
for (int i... | ALGO | 0.999984 | 6.520228 |
d68d765a-78f6-4782-a27e-db67c8ab424c | dsx137/CUITExamClient | CryptoPP/src/integer.cpp | // integer.cpp - originally written and placed in the public domain by Wei Dai
// contains public domain code contributed by Alister Lee and Leonard Janke
// Notes by JW: The Integer class needs to do two things. First, it needs
// to set function pointers on some platforms, like X86 and X64. The
// function pointer... | TOOL | 0.940807 | 7.19199 |
92343eb4-f21d-4bd8-acd3-1c9123944d96 | ShubhamBrody/Data-Structures-And-Algorithms | Arrays/BinarySearch.cpp | #include<iostream>
#include<math.h>
#define ll long long
using namespace std;
int main()
{
int n, k;
cin >> n;
int arr[n];
for(int i = 0; i < n; i++)
{
cin >> arr[i];
}
cin >> k;
bool found = false;
ll l = 0, h = n-1, mid;
while(l <= h)
{
mid = floor((int)(l... | ALGO | 0.999937 | 4.583095 |
e88011a4-7ecb-4f7c-b4ca-287932575b2b | dalmia/Coursera-Specializations | Data Structures and Algorithms/Course 2/Week 2/starter_code/job_queue/job_queue2.cpp | #include <iostream>
#include <cstdio>
#include <vector>
#include <string>
#include <algorithm>
#include <queue>
#include <functional>
#define MAX(x,y) ((x)>(y)?(x):(y))
#define MIN(x,y) ((x)<(y)?(x):(y))
#define pb push_back
#define mp make_pair
#define rep(i,n) for(int i=0;i<n;i++)
#define repr(i,j,n) for(i=j;i<=n;i+... | ALGO | 0.999981 | 3.096806 |
24d35d8b-07f3-4048-b867-0241a47a07e5 | Jonathan2251/lbt | exlbt/clang-tools/vector-dsl.cpp | /*
~/riscv/riscv_newlib/bin/clang++ vector-dsl.cpp -menable-experimental-extensions \
-march=rv64gcv0p10 -O0 -mllvm --riscv-v-vector-bits-min=256 -DUSE_RVV -v
~/riscv/git/qemu/build/qemu-riscv64 -cpu rv64,v=true a.out
~/riscv/riscv_newlib/bin/riscv64-unknown-elf-objdump -d a.out|grep vmul
The following work for #und... | TEST | 0.868946 | 6.338827 |
cd228e62-d4b0-4254-8f56-4b0fcff51d9b | areumh01/LeetCode | 3sum/3sum.cpp | class Solution {
public:
// vector<vector<int>> find_twosum(int index, int target, vector<int>& nums){
// int start = index;
// int end = nums.size()-1;
// vector<int> tmp;
// vector<vector<int>> result;
//
// while(start<end){
// if(nums[start]+nums[end] < targe... | ALGO | 0.999961 | 5.407002 |
4dc099c3-9924-45b3-b5f9-517991036005 | fudoge/Problem_Solving | 1661-minimum-number-of-vertices-to-reach-all-nodes/1661-minimum-number-of-vertices-to-reach-all-nodes.cpp | class Solution {
public:
vector<int> findSmallestSetOfVertices(int n, vector<vector<int>>& edges) {
unordered_set<int> not_roots;
for (const auto& edge : edges) {
not_roots.insert(edge[1]);
}
vector<int> result;
for (int i = 0; i < n; ++i) {
if (not_... | ALGO | 0.999941 | 6.579511 |
ad22a9b1-eae0-4ef6-b79b-4493f458b57a | AngelJC03/Data-Structures | C++/Dynamic Array/dynArrMain.cpp | #include "dynArr.cpp"
int main(int argc, char* argv[]) {
freopen("DynamicArrayOutput.txt", "w", stdout);
DynArr array;
for (int i = 0; i < 10; i++) {
array.push_back(rand() % 100);
}
std::cout << "Starting Array: " << '\n';
array.print();
std::cout << "**array.removeIndex(4)**"... | TOOL | 0.969493 | 4.534082 |
dcf664e7-65d1-4170-8953-a41f27bc60bc | Prashant-flick/codeforces-contest | 972/B_1_The_Strict_Teacher_Easy_Version.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int t=1;
cin >> t;
while (t--)
{
int n,m,q;
cin >> n >> m >> q;
vector<int> arr(m);
for(int i=0; i<m; i++)cin >> arr[i];
sort(begin(arr), end(arr));
while(q--){
... | ALGO | 0.999976 | 3.666242 |
180e0fc3-2c90-4891-8dcf-7904827f9884 | TON618OFF/PW6CPP | practice 6.cpp | #include <iostream>
#include <vector>
#include <string>
using namespace std;
/*
Слава делает класс Студента и класс МПТ
Мотя продумывает всю валидацию, создаёт класс Преподавателя
*/
class Student {
public:
string name;
string group;
vector<string> lessons;
int done_works;
int fail_works;
S... | TOOL | 0.923974 | 3.741439 |
1b61115e-cd18-4174-b5db-b06acb615962 | raincross7/code-similarity | codes/train_code/problem193/problem193_465.cpp | #include <bits/stdc++.h>
using namespace std;
using ll=long long;
using vi = vector<int>;
using vvi = vector<vector<int>>;
using vl = vector<ll>;
using vvl = vector<vector<ll>>;
#define debug(x) cerr<<#x<<": "<<x<<endl;
#define rep(i,n) for(int i=0;i<n;i++)
const int MOD = 1000000007;
int main() {
char S[5];
rep(i... | ALGO | 0.999671 | 3.287889 |
197dfad5-0603-454c-991a-c9e9a3e88ef4 | miemie2013/ncnn_ppyolov2 | src/layer/arm/sigmoid_arm_asimdhp.cpp | #include "sigmoid_arm.h"
#include <math.h>
#if __ARM_NEON
#include <arm_neon.h>
#include "neon_mathfun.h"
#if __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
#include "neon_mathfun_fp16s.h"
#endif
#endif // __ARM_NEON
namespace ncnn {
#if __ARM_FEATURE_FP16_VECTOR_ARITHMETIC
int Sigmoid_arm::forward_inplace_fp16s(Mat& bottom_... | ALGO | 0.996693 | 6.588394 |
65e85bcd-8960-4148-a47c-836fce4fbc49 | hky5820/Registration_Tooth_ICP | Library_Eigen_3.3.7/doc/examples/QuickStart_example2_fixed.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
using namespace std;
int main()
{
Matrix3d m = Matrix3d::Random();
m = (m + Matrix3d::Constant(1.2)) * 50;
cout << "m =" << endl << m << endl;
Vector3d v(1,2,3);
cout << "m * v =" << endl << m * v << endl;
}
| ALGO | 0.997043 | 3.375595 |
cd9c4ab4-a1b3-44b7-b81b-5d012b0acaaf | iamakshatjain/Codings | Hackerrank/Practice/HashMaps/countingTriplets.cpp | //partially correct
#include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
vector<string> split(const string &);
// Complete the countTriplets function below.
long countTriplets(vector<long> arr, long r)
{
long int count = 0; //this is to be returned
int n =... | ALGO | 0.999811 | 4.256771 |
a3f4fa92-e226-4953-8d83-50a775e4bfcc | greenfox-zerda-sparta/wekkew | 02week/2day/10ex/src/10ex.cpp | #include <iostream>
#include <string>
using namespace std;
int doubler(int x) {
return x*2;
}
int main() {
int j = 123;
// create a function that doubles it's input
// double j with it
cout << doubler(j);
return 0;
}
| TOOL | 0.924455 | 5.567367 |
79fe01ea-f29a-4559-8e91-61bed01ad2ed | NishanthSubramanian/Ciphers | Rot13/rot13.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int i = 0, j, k;
string s = "nggnpx";
string result;
while (s[i] != '\0')
{
if(s[i]+13 < 'z')
result[i] = 13 + s[i];
else
result[i] = s[i]-13;
i++;
}
for (i = 0; i < s.length(); i++)
... | ALGO | 0.999273 | 3.289225 |
0fdde992-d050-43f5-a2b8-0c67852f4cb1 | Anupkumar14/hackerRank | InsertNodeInSortedLinkList.cpp | /*
Inserting a Node Into
a Sorted Doubly
Linked List
Given a reference to the head of a doubly-linked list and an integer, , create a new
DoublyLinkedListNode object having data value and insert it into a sorted linked list.
Complete the DoublyLinkedListNode SortedInsert(DoublyLinkedListNode head, int data) method in t... | ALGO | 0.999904 | 5.642893 |
73928574-b5fc-450e-b426-15d4ae4845b3 | sneha390/DSA_Track | POPQuestion/quickSort.cpp | #include <bits/stdc++.h>
using namespace std;
void swap(int arr[] , int pos1, int pos2){
int temp;
temp = arr[pos1];
arr[pos1] = arr[pos2];
arr[pos2] = temp;
}
int partition(int arr[], int low, int high, int pivot){
int i = low;
int j = low;
while( i <= high){
if(arr[i] > pivot){
i++;
}
else{
swap(... | ALGO | 0.999909 | 4.686461 |
7381d1d2-60e6-4d4b-9b57-7f4a9ede6fd0 | SanyaWaffles/DFGZDoom | src/rendering/hwrenderer/scene/hw_bsp.cpp | /*
** gl_bsp.cpp
** Main rendering loop / BSP traversal / visibility clipping
**
**/
#include "p_lnspec.h"
#include "p_local.h"
#include "a_sharedglobal.h"
#include "g_levellocals.h"
#include "p_effect.h"
#include "po_man.h"
#include "m_fixed.h"
#include "ctpl.h"
#include "texturemanager.h"
#include "hwrenderer/scene/... | ALGO | 0.994694 | 4.13699 |
dde53272-4d27-4d7d-88ff-9dabceb68d70 | Mostafa61290/C- | main.cpp | // application file
#include <iostream>
#include <String>
#include "list.h"
#include "stdio.h" // to using NULL
using namespace std ;
// function to check the count of zero in the list
int countZero (list &l1){
l1.toFirst() ; // make the cursor in the first node
int k1 ; // variable int to store in it the va... | ALGO | 0.996499 | 3.121359 |
a1336aff-067c-4cc7-a765-b9ea187f4257 | ayush-yadav-4/leetcode-solutions | 0273-integer-to-english-words/0273-integer-to-english-words.cpp | class Solution {
public:
vector<string> belowTwenty = {"", "One", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten",
"Eleven", "Twelve", "Thirteen", "Fourteen", "Fifteen", "Sixteen", "Seventeen",
"Eighteen", "Nineteen"};
... | ALGO | 0.994054 | 7.136361 |
12f196d3-7257-4ac8-8f81-1681565a38ed | iridium/RISCV-ROCKETCHIP-CNN | Sources_projet_Etudiants/bare_metal/examples/cnn/test/main.cpp | #include "cnn.h"
#include "img.h"
#include "coeffs.h"
#include <iostream>
using namespace std;
int main()
{
int classes[10] = {0};
float probs[10] = {0.};
int max_i = 0;
float max = 0;
cnn(coeffs, classes, img, probs);
for ( int i = 0 ; i < 10 ; i++){
if ( probs[i] > max){
... | DATA | 0.929735 | 3.109751 |
43452c02-be88-44e4-892b-7b9993848a3a | ha981muk-git/lecture_cpp | Prog2_SoS2020_Referenzen3_Operatoren2_const_Methode/Prog2_SoS2020_Referenzen3_Operatoren2/cBruch.cpp | #include "cBruch.h"
int cBruch::ggT(int x, int y) { // Wiederverwendung aus Prog1
if (x == y) {
return x;
}
else {
if (x > y) {
return ggT(x - y, y);
}
else {
return ggT(x, y - x);
}
}
}
void cBruch::kuerzen() {
int ggt = zaehl != 0 ? ggT(zaehl > 0 ? zaehl : zaehl * -1, nenn > 0 ? nenn : nenn ... | ALGO | 0.985298 | 4.869733 |
9daa9ebf-aee3-4c52-8967-73f07b6c4181 | Sania-Singla/DSA | DSA_Array/searchInRotatedSortedArray.cpp | #include <iostream>
#include <vector>
using namespace std;
void print(vector<int> arr)
{
for (int val : arr)
{
cout << val << " ";
}
cout << endl;
}
int getPivot(vector<int> arr)
{
int i = 0;
while (i < arr.size() - 1 && arr[i] <= arr[i + 1])
{
i++;
}
return i + 1... | ALGO | 0.999927 | 5.670034 |
927841ba-43ec-467b-b17f-79ffbcebc635 | jeffreyqdd/usaco-train | mootube/mootube.cpp | #include <fstream>
#include <iostream>
#include <vector>
#include <set>
#include <queue>
using namespace std;
typedef long long intl;
struct Video
{
intl id;
intl rev;
};
int kVideos, kQuestions;
intl Bfs(Video const &video, vector<vector<Video>> const & path)
{
//input tells the video watched and fj's ... | ALGO | 0.999726 | 4.473576 |
bb1bdeef-5110-48e7-a955-de1000b58c65 | IamWilliamWang/Recursion | efficientfibonacci.cpp | #include "efficientfibonacci.h"
#include "fibonacci.h"
EfficientFibonacci::EfficientFibonacci()
{
}
/*获得Fibonacci数*/
long EfficientFibonacci::getFibonacciNumber(long n)
{
//如果this.fibonacciis储存了所要查询的数字,就直接返回表内的数字
if((int)this->fibonaccis.size() > n)
return this->fibonaccis.at(n);
else//没找到的话就向表内追加... | ALGO | 0.999507 | 3.319946 |
9f4294f5-c8f3-48bb-a443-0b89a790d0a9 | Slowqueueue/parallel-programming | pplab3task35mpi/pp35mpi.cpp | #include <mpi.h>
#include <vector>
#include <fstream>
#include <cmath>
#include <iostream>
#include <omp.h>
using namespace std;
struct Location
{
float T = 0;
void SetTemp(float newT, bool* isApproximated, float eps)
{
float LegacyT = T;
T = newT;
*isApproximated = abs(T - LegacyT)... | ALGO | 0.999961 | 5.022911 |
24cb987e-c9b3-49e9-87b7-568f9526c3b7 | sinian666/code_102_5 | cpp_副本27/chapter_array_and_linkedlist/linked_list.cpp | /**
* File: linked_list.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 在链表的节点 n0 之后插入节点 P */
void insert(ListNode *n0, ListNode *P) {
ListNode *n1 = n0->next;
P->next = n1;
n0->next = P;
}
/* 删除链表的节点 n0 之后的首个节点 */
void remove(ListNode *n0) {
if (n0... | ALGO | 0.999778 | 5.583626 |
48f176f8-eab7-4357-ba67-48d5260f817a | xKristee29/1nfo | .history/9_ascdesc_20210307094516.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int h[10][100005];
ifstream f("ascdesc.in");
ofstream g("ascdesc.out");
int n,x,maxa;
int main(){
int i;
f>>n;
for(i=1;i<=n;++i){
f>>h[0][i];
}
return 0;
} | ALGO | 0.994469 | 3.357323 |
51c283e4-3cae-4c06-800f-8bcdf04a186c | ishandutta2007/codeforces | ljc00118/normal/986/B.cpp | #pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
const int N = 1000000 + 10;
int a[N], w[N];
int n;
int main() {
cin >> n;
for(int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
w[a[i]] = i;
}
int ans = 0;
for(int i = 1; i <= n; i++) {
if(a[i] != i) {
ans++;
int tmp = a[i];
swap... | ALGO | 0.999874 | 3.877888 |
dc3fde12-ba19-46a4-9816-7ddc96d9e1ba | sybui2004/DSA---PTIT | DSA - PTIT code by C++/DSA09025 - DUONG DI THEO DFS VOI DO THI CO HUONG.cpp | /*Author: Bùi Thái Sỹ B22DCCN702 from ProPTIT with love
DSA09025 - DUONG DI THEO DFS VOI DO THI CO HUONG
*/
#include <bits/stdc++.h>
using namespace std;
#define fast \
ios_base::sync_with_stdio(false); \
cin.tie(0);
#define pb push_back
#define ll long long
#define FORU(i, a, b) for (i... | ALGO | 0.999836 | 4.785704 |
9965c22b-9b92-421e-b8f9-c083e140e814 | tridhapuku/DSP_MLIR | llvm/lib/Support/xxhash.cpp | // xxhash64 is based on commit d2df04efcbef7d7f6886d345861e5dfda4edacc1. Removed
// everything but a simple interface for computing xxh64.
// xxh3_64bits is based on commit d5891596637d21366b9b1dcf2c0007a3edb26a9e (July
// 2023).
#include "llvm/Support/xxhash.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Suppo... | ALGO | 0.952954 | 4.064114 |
a8520921-0c67-4edf-b1b1-c209de946da1 | valeriisydorov/cpp-primer | 10_37/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
int main() {
std::vector<int> fib{0, 1, 1, 2, 3, 5, 8, 13, 21, 34};
std::vector<int> range;
std::copy(fib.rbegin() + 3, fib.rbegin() + 7, std::back_inserter(range));
std::for_each(range.begin(), range.end(), [] (int i) -> void {
std::c... | ALGO | 0.998428 | 3.903346 |
ffbe7875-cf8a-4c7f-813f-f0a5bbbfae03 | alifseptiandi/leetcode-problems | 125. Valid Palindrome/125. Valid Palindrome.cpp | class Solution {
public:
bool isPalindrome(string s) {
int left = 0, right = s.length() - 1;
while (left < right) {
// Move left pointer to the next alphanumeric character
while (left < right && !isalnum(s[left])) {
left++;
}
... | ALGO | 0.99782 | 6.782128 |
653d9845-0d71-4cb7-ad90-f16e3850853d | mazhar75/online-Judge | Atcoder/C++ (GCC 9.2.1)/abc222_a/26463172.cpp | #include<iostream>
using namespace std;
int main()
{int n,a[4];
cin>>n;
for(int i=3;i>=0;i--)
{a[i]=n%10;
n=n/10;
}
for(int i=0;i<4;i++)
{cout<<a[i];
}
return 0;
}
| ALGO | 0.999682 | 3.365886 |
8bd3260b-27a0-41e6-b29f-87287a02df74 | onlinesmit/DSAinC- | SecondLargeArrElement.cpp | #include<iostream>
using namespace std;
int main(){
// int arr[] = {6,3,7,4,8, 23, 5};
// int n = sizeof(arr)/sizeof(arr[0]);
// // int n, arr[10];
// // cout<<"Enter the no. of element: ";
// // cin>>n;
// // cout<<"Enter the element: ";
// // for (int i = 0; i < n; i++)
// // {
//... | ALGO | 0.989206 | 3.701752 |
3440c877-0509-41f5-a581-5dbf029fedf2 | snichols/boost_1_61_0 | libs/numeric/ublas/doc/samples/vector_binary_redux.cpp | #include <boost/numeric/ublas/vector.hpp>
int main () {
using namespace boost::numeric::ublas;
vector<double> v1 (3), v2 (3);
for (unsigned i = 0; i < (std::min) (v1.size (), v2.size ()); ++ i)
v1 (i) = v2 (i) = i;
std::cout << inner_prod (v1, v2) << std::endl;
}
| ALGO | 0.998459 | 3.969631 |
da1b0e32-1080-4e42-97b5-bd15ba3a0a3a | Niharikamnit/Leetcode | 56-merge-intervals/56-merge-intervals.cpp |
class Solution {
public:
// static bool comparator( vector<int>& a, vector<int>& b )
// {
// return a[0] < b[0];
// }
vector<vector<int>> merge(vector<vector<int>>& intervals) {
// vector<vector<int>> res;
// //Handle Edge cases
// if( intervals.empty() )
// ... | ALGO | 1 | 6.069415 |
d98be3c2-c4fc-4149-ac65-f0ba22613157 | HarshSharma032003/OOPS-LAB-2 | exp2.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct Book {
string title;
string author;
double price;
};
void displayBook(const Book& book) {
cout << "Title: " << book.title << ", Author: " << book.author << ", Price: $" << book.price << endl;
}
bool compareByPrice(... | ALGO | 0.999951 | 6.092843 |
09e1f2ae-a2e8-4dec-828d-a5ddff873537 | TrentonCouture/HelmEffects | JUCE/modules/juce_audio_basics/buffers/juce_FloatVectorOperations.cpp | namespace juce
{
namespace FloatVectorHelpers
{
#define JUCE_INCREMENT_SRC_DEST dest += (16 / sizeof (*dest)); src += (16 / sizeof (*dest));
#define JUCE_INCREMENT_SRC1_SRC2_DEST dest += (16 / sizeof (*dest)); src1 += (16 / sizeof (*dest)); src2 += (16 / sizeof (*dest));
#define JUCE_INCREMENT_DE... | TOOL | 0.868422 | 7.127055 |
44f69e1d-fbd9-4e6a-a3b9-29761b0426a1 | Riyuk-04/Algo1 | algo/ass3/ex.cpp | #include<iostream>
using namespace std;
typedef struct {
int x, y;
} POINT ;
typedef struct POINT_2{
int x, y;
POINT_2 *next;
} POINT_2 ;
typedef struct {
POINT *Arr ;
int queue_size,start_id,end_id;
} QUEUE ;
typedef struct {
POINT_2 *head;
} STACK ;
typedef struct {
int Len;
int Breadth;
int **MAT;
in... | ALGO | 0.999936 | 3.494957 |
dbd12709-8abd-4eda-889a-f369cce55ad6 | felipesdias/Extractor-URI-Online-Judge | URI-EN/BEGINNER/1013 - The Greatest.cpp | // Author: Felipe Souza Dias <<EMAIL>>
// Name: The Greatest
// Level: 1
// Category: BEGINNER
// URL: https://www.urionlinejudge.com.br/judge/en/problems/view/1013
#include <stdio.h>
#include <iostream>
#include <cstring>
#include <cmath>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
cout... | ALGO | 0.999765 | 4.447628 |
f2063812-6757-48d5-b698-532358fbea9f | iMjayant17/PracticeLeet | 1370-count-number-of-nice-subarrays/count-number-of-nice-subarrays.cpp | class Solution {
public:
int numberOfSubarrays(vector<int>& nums, int k) {
for(auto &i:nums){
if(i&1) i = 1;
else i = 0;
}
for(int i = 1;i<nums.size();i++){
nums[i]+=nums[i-1];
}
map<int,int> m;
int ans = 0;
m[0]++;
... | ALGO | 0.999998 | 5.679613 |
7fb78ec7-f659-4a1a-85b5-4e6651215d83 | akshatsingh523/Data-Structures-and-Algorithm | linked-list-cycle-ii/linked-list-cycle-ii.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *detectCycle(ListNode *head) {
if (head == NULL || head->next == NULL) return nullptr;
ListNode* node = hea... | ALGO | 0.999836 | 5.455223 |
6087cd65-86ab-489c-9309-59d6278fe49a | TBradCreech/TJBotSDK | lib/boost_1_60_0/libs/graph/example/prim-telephone.cpp | int
main()
{
using namespace boost;
GraphvizGraph g_dot;
read_graphviz("figs/telephone-network.dot", g_dot);
typedef adjacency_list < vecS, vecS, undirectedS, no_property,
property < edge_weight_t, int > > Graph;
Graph g(num_vertices(g_dot));
property_map < GraphvizGraph, edge_attribute_t >::type
e... | ALGO | 0.995646 | 4.425797 |
f2c6f067-3635-4d2c-9f20-344b7b89e31f | Kaustubh22327/CFsols | A_Soft_Drinking.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,k,l,c,d,p,nl,np;
cin>>n>>k>>l>>c>>d>>p>>nl>>np;
int x=(k*l)/nl;
int y=c*d;
int z=p/np;
int mini=min({x,y,z});
cout<<mini/n<<endl;
} | ALGO | 0.999726 | 3.265418 |
5c11b7ca-70be-4bef-880e-b90b1786f57d | 4256aniket/DSA_Notes_Code | Trees/problems/98. Validate Binary Search Tree.cpp | /*
Given the root of a binary tree, determine if it is a valid binary search tree (BST).
A valid BST is defined as follows:
The left subtree of a node contains only nodes with keys less than the node's key.
The right subtree of a node contains only nodes with keys greater than the node's key.
Both the left and right ... | ALGO | 0.999984 | 6.955491 |
f76dee62-f32b-4218-b215-713443fa8db3 | tareque-bin-habib/cpp-practice-7.5 | problem_3.cpp | #include <bits/stdc++.h>
using namespace std;
int countWordOccurrence(string sentence, string word)
{
int count = 0;
int pos = 0;
while ((pos = sentence.find(word, pos)) != -1)
{
count++;
pos += word.length();
}
return count;
}
int main()
{
string sentence;
getline(cin,... | ALGO | 0.998038 | 5.183265 |
5586acc9-9aed-4407-b41e-9a72de6d1f3f | youmorry/atcoder | abc121/abc121_c/main.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main() {
ll n, m;
cin >> n >> m;
ma... | ALGO | 0.999871 | 4.564454 |
f1a6c4ab-8d61-4579-b861-50a37bff3ac0 | Iambharatkolhe/ADSAL_71_CPP | Assignment_No_VI.cpp | #include<iostream>
using namespace std;
int TotalShop;
int startingtime[20];
int endingtime[20];
int calculatemin[20];
int visitedtime[20];
int visitedstartingtime[20];
int set0(){
for(int i=0;i<TotalShop;i++){
visitedstartingtime[i]=0;
visitedtime[i]=0;
... | ALGO | 0.999896 | 3.521044 |
4b0d46a6-b5f8-4fcf-94cd-45bc60308741 | wocantudou/Opencv4.9.0 | modules/core/src/matrix_decomp.cpp | #include "precomp.hpp"
namespace cv { namespace hal {
/****************************************************************************************\
* LU & Cholesky implementation for small matrices *
\*********************************************************************************... | ALGO | 0.999813 | 4.277206 |
ef3b44d3-7cd0-4209-8775-7952d4334a25 | lynxluna/freeimage | Source/OpenEXR/IlmImf/ImfEnvmap.cpp | //-----------------------------------------------------------------------------
//
// Environment maps
//
//-----------------------------------------------------------------------------
#include <ImfEnvmap.h>
#include "ImathFun.h"
#include <algorithm>
#include <math.h>
using namespace std;
using namespace Imath;
nam... | ALGO | 0.896226 | 6.876375 |
dbf3631e-43b2-44b3-be1d-b7b731a12d08 | Anannaya-Sikder/XPSC-problem-solving | 5 march/cloth.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin >> T;
while (T--) {
int X, Y, Z, A, B, C;
cin >> X >> Y >> Z >> A >> B >> C;
int happy = 0;
int give = min(X, A);
happy += give;... | ALGO | 0.999802 | 4.30014 |
99f3aabe-07e9-4799-b2d9-099d9b805766 | geozy/Multisig | src/univalue/lib/univalue.cpp | #include <stdint.h>
#include <errno.h>
#include <iomanip>
#include <limits>
#include <sstream>
#include <stdexcept>
#include <stdlib.h>
#include <string.h>
#include "univalue.h"
namespace
{
static bool ParsePrechecks(const std::string& str)
{
if (str.empty()) // No empty string allowed
return false;
... | TOOL | 0.870386 | 6.600841 |
3d8a58b2-fb4d-4d29-a54c-f88badacef16 | nschweitz/aoc2020 | 2.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <stdexcept>
int main() {
auto part1 = 0;
auto part2 = 0;
for (std::string line; std::getline(std::cin, line);) {
auto pos = line.find("-");
auto range_min = std::stoi(line.substr(0, pos));
auto last = pos+1;
pos = line.fi... | ALGO | 0.994117 | 4.792667 |
f5cd550a-a2ca-4f86-a3c5-359d3eb40d3c | Esratjahanmare/Code | Codeforces/D. Binary Cut.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
string s;
cin>>s;
int n=s.size();
int cnt=1, tg=0;
for(int i=1; i<n; i++)
{
if(s[i]==s[i-1]) continue;
else cnt++;
if(s[i-1]=='0' && s[i]=='1')
tg=1;
}
int ans=cnt-tg;
cout<<ans<<endl;
}
... | ALGO | 0.999745 | 4.806539 |
48c2078f-5c29-4f07-8f33-15533f6011e2 | ihays/LeetCode | C++/FindAllAnagramsInAString.cpp | //Ian Hays
//07-28-2020
//https://leetcode.com/problems/find-all-anagrams-in-a-string/
//SC: O(N) TC: O(N)
class Solution {
public:
vector<int> findAnagrams(string s, string p) {
vector<int> res,set(26,0), cur(26,0);
for(int i = 0; i < p.length(); i++){
set[p[i]-'a']++;
... | ALGO | 0.999922 | 6.623304 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.