uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
63078005-5f4c-48f3-873f-f97fd5bcec98 | syuu1228/bhyve | contrib/llvm/lib/CodeGen/AggressiveAntiDepBreaker.cpp | #define DEBUG_TYPE "post-RA-sched"
#include "AggressiveAntiDepBreaker.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/RegisterClassInfo.h"
#include "llvm/Target/TargetInstrInfo.h"
#include "llvm/Target/TargetMachine.... | ALGO | 0.977757 | 4.617235 |
08f106ae-27f6-4286-b3bc-2177af0d9ef3 | lua9520/source-engine-2018-hl2_src | utils/vrad/disp_vrad.cpp | #include "disp_vrad.h"
#include "utllinkedlist.h"
#include "utlvector.h"
#include "iscratchpad3d.h"
#include "scratchpadutils.h"
//#define USE_SCRATCHPAD
#if defined( USE_SCRATCHPAD )
static IScratchPad3D *g_pPad = 0;
#endif
int FindNeighborCornerVert( CCoreDispInfo *pDisp, const Vector &vTest )
{
CDispUtilsHelper ... | ALGO | 0.972452 | 5.719837 |
7ba7d0d6-bd6c-41ee-bca5-e9d31c9a2d39 | chen82508/Leetcode | Problems/237. Delete Node in a Linked List.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public :
void deleteNode ( ListNode* node ) {
node -> val = node -> next -> val ;
ListNode *lnTmp = node -> next ;
... | ALGO | 0.999499 | 5.054947 |
4a393ce7-890d-4dd1-adf1-00478c66c83d | slicol/Games101-Homework-Win | eigen3/doc/special_examples/Tutorial_sparse_example_details.cpp | #include <Eigen/Sparse>
#include <vector>
#include <QImage>
typedef Eigen::SparseMatrix<double> SpMat; // declares a column-major sparse matrix type of double
typedef Eigen::Triplet<double> T;
void insertCoefficient(int id, int i, int j, double w, std::vector<T>& coeffs,
Eigen::VectorXd& b, con... | ALGO | 0.999073 | 5.388735 |
c9e54a74-eaa6-46c9-82d0-2a2cb1f83f21 | danaiChal/Data-Structures | 2o ervthma project/HEAPSORT.cpp | // C++ program for implementation of Heap Sort
//#ifndef _INPUTFILE_H
#define _INPUTFILE_H
#include<iostream>
#include<fstream>
#define AGN_SIZE 3239
#define AINV_SIZE 3201
#define ALE_SIZE 3201
using namespace std;
struct metoxh
{
long int Date;
float Open;
float High;
float Low;
long int Volume;
float OpenIn... | ALGO | 0.997502 | 4.162861 |
7c8971e9-4125-48ee-a27b-01475670b4af | KRAA5H/codexsolutions | C++/17Voting.cpp | #include <iostream>
int main() {
int age;
bool citzen;
bool registered;
std::cout << "Please enter your age: ";
std::cin >> age;
std::cout << "Are you a citzen? ";
std::cin >> citzen;
std::cout << "Are you registered? ";
std::cin >> registered;
if (age >= 18 && citzen && registered) {
std::... | TOOL | 0.978353 | 4.043908 |
9110a4b5-3bf0-4d30-8fa0-1bc4afbc8e6f | dame-time/UserAssistedSphereMeshEditor | include/igl/vertex_components.cpp | template <typename DerivedA, typename DerivedC, typename Derivedcounts>
IGL_INLINE void igl::vertex_components(
const Eigen::SparseCompressedBase<DerivedA> & A,
Eigen::PlainObjectBase<DerivedC> & C,
Eigen::PlainObjectBase<Derivedcounts> & counts)
{
using namespace Eigen;
using namespace std;
assert(A.rows()... | ALGO | 0.998253 | 6.894763 |
f4e2639e-35e8-47dc-b469-849331525509 | Al-Abir/Competitive-Programming | Rated_1000/Triangle_Rectangle.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define ll long long
void solve() {
ll w, h;
cin >> w >> h;
ll area = 0;
for (int i = 0; i < 4; i++) {
int k;
cin >> k;
ll first = 0, second = 0;
for (int j = 0; j < k; j++) {
l... | ALGO | 0.999846 | 3.905923 |
ad603368-bb3b-4c72-b884-f2eb49f69da7 | ishandutta2007/codeforces | nweeks/normal/1335/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define SZ(x) ((int)(x).size())
typedef long long ll;
void solve(void)
{
int n, a, b;
cin >> n >> a >> b;
string s = "";
for (int c(0); c < b; ++c)
s += (char)(c+'a');
for (int i(0); i < n; ++i)
cout << s[i%b];
cout << '\n';
}
int main(void)
{
ios_base::sync_w... | ALGO | 0.998968 | 3.807645 |
1ad90901-1f72-4522-8a0b-53b543075909 | LauZyHou/Algorithm-To-Practice | AcWing/LeetCode究极班/35.cpp | class Solution {
public:
int searchInsert(vector<int>& nums, int target) {
// 找>=target的最小位置,当所有元素都比target小时,要在最后插入,所以r从len位置而不是len-1位置
int l = 0, r = nums.size();
while (l < r) {
int mid = l + r >> 1;
if (nums[mid] >= target)
r = mid;
else... | ALGO | 0.999944 | 6.204229 |
be0f53fb-3deb-40b7-87ab-30d2e7a0e67f | ccihxn/baekjoon_solved | src/main/Cpp/boj_step4/boj10813.cpp | #include <iostream>
#include <vector>
#include <numeric>
using namespace std;
int main() {
int N, M;
cin >> N >> M;
vector<int> baskets(N);
iota(baskets.begin(), baskets.end(), 1);
for (int index = 0; index < M; index++) {
int i, j;
cin >> i >> j;
int tmp = baskets[i - 1];
... | ALGO | 0.999991 | 4.203204 |
500e999b-853a-4efd-b33d-3b32975f25e7 | 3957ki/Algo_Study_SSAFY12 | phs7646/0903/2_1189.cpp | #include<iostream>
using namespace std;
typedef pair<int,int> pp;
int R,C,K;
bool wall[5][5];
int answer;
pp moves[] = {{1,0},{-1,0},{0,1},{0,-1}};
bool visited[5][5];
void dfs(int y,int x,int count) {
if(count == K) {
if(y == R-1 && x == C-1) answer++;
return;
}
for(pp move : moves) {
... | ALGO | 0.999724 | 4.063274 |
fb3e713f-b5a8-4ed3-8b3c-22d6eb402c14 | TraME-Project/TraME | src/optim/zeros/broyden.cpp | /*
* Broyden's method for solving systems of nonlinear equations
*/
#include "optim.hpp"
bool
optim::broyden_int(arma::vec& init_out_vals, std::function<arma::vec (const arma::vec& vals_inp, void* opt_data)> opt_objfn, void* opt_data, algo_settings_t* settings_inp)
{
// notation: 'p' stands for '+1'.
bool ... | ALGO | 0.999994 | 6.987012 |
6864e377-b2c7-4a87-99d7-365f8d9bf154 | debsaikia03/LeetCode-Solved-Problems | 0014-longest-common-prefix/0014-longest-common-prefix.cpp | class Solution {
public:
string longestCommonPrefix(vector<string>& strs) {
sort(strs.begin(), strs.end());
string first = strs[0];
string last = strs[strs.size() - 1];
int i = 0;
while(i < first.size() && first[i] == last[i]) i++;
return first.su... | ALGO | 0.999839 | 5.805629 |
611446a8-a083-473f-965b-6482462d0a6c | zarvent/1-2025 | 🏫 UCB/[SCZ] [1-I2025] [SIS-111] Introduccion A La Programacion/0. 📚 Bibliografia/3. 💻 Programacion Estrcturada/3. Ejercicios - Vectores 1/ejerciciovectores.cpp | #include <iostream>
#include <vector>
using namespace std;
int globalStart = 0;
void printNumbers(int start, int end);
void printVector(vector<int> vec);
void printVectorString(vector<string> vec);
vector<int> sumVectors(vector<int> vec1, vector<int> vec2);
int main() {
vector<int> nums1 = { 2, 3, 1, 2, 5, 6, 8... | ALGO | 0.997327 | 5.287724 |
ee1d7b69-14bc-4f8e-b32c-93433742433d | Zhenghao-Liu/LeetCode_problem-and-solution | 0084(重要).柱状图中最大的矩形/solution_stack.cpp | /*
* 神奇的栈。。看题解把。想不到
*/
class Solution {
public:
int largestRectangleArea(vector<int>& heights)
{
int heights_size=heights.size();
stack<int> stack_heights;
stack_heights.push(-1);
if (heights_size==0)
return 0;
else
stack_heights.push(0);
int temporary,temporary_top,answer=0;
for (int i=1;i... | ALGO | 0.999983 | 5.960642 |
1ebe6839-511b-4845-ae3b-9b2c423ed4a5 | Saketmishra14/DSA-Supreme-3.0 | 14 Stacks/Stack class-01/creation.cpp | #include<iostream>
#include<stack>
using namespace std;
class Stack{
public:
int* arr;
int size;
int top;
Stack(int capacity){
arr=new int(capacity);
size=capacity;
top=-1;
}
void push(int value){
// check stack overflow
if(top==size-1){
... | ALGO | 0.988725 | 4.584487 |
52a7cce4-4865-4ab2-ad8f-77a8d244724f | sharmaishan2511/DSA-in-cpp | dummy.cpp | #include<bits/stdc++.h>
using namespace std;
const int inf = 1000000000;
int n;
vector<vector<int>> capacity, flow;
vector<int> height, excess, seen;
queue<int> excess_vertices;
void push(int u, int v)
{
int d = min(excess[u], capacity[u][v] - flow[u][v]);
flow[u][v] += d;
flow[v][u] -= d;
excess[u] -... | ALGO | 0.999351 | 4.744126 |
e85855e1-9613-4196-b78b-93868b865ab0 | kanieldim/CU-Boulder---CS | CSCI 2270 - Data Structures/Recitation/rec10/Lab10/driver.cpp | #include "MinHeap.hpp"
using namespace std;
int main()
{
MinHeap heap(10);
heap.insertElement(9);
heap.insertElement(13);
heap.insertElement(10);
heap.insertElement(14);
heap.insertElement(15);
heap.insertElement(12);
heap.insertElement(11);
heap.insertElement(8);
cout<<"***********Elements in the... | ALGO | 0.992679 | 4.240658 |
3f46925c-1739-4270-97c1-241b3e9bdf15 | fsy-juruo/noip-2021-js-answer | t2021/JS-0371/number/number.cpp | #include<bits/stdc++.h>
#define MAXN 200005
using namespace std;
typedef unsigned long long ll;
inline ll read(){
ll x = 0, f = 1;
char ch = getchar();
while (ch < '0' || ch > '9') {if (ch == '-') f = -1; ch = getchar();}
while (ch >= '0' && ch <= '9'){x = (x<<1) + (x<<3) + (ch^48); ch = getchar();}
... | ALGO | 0.999708 | 4.319825 |
c2e5fcf0-88fe-4bf0-85ad-e19a61e1f0ec | ishandutta2007/codeforces | daklqw/normal/978/D.cpp | #include <iostream>
#include <cstdio>
using namespace std;
#define MAXN 100010
inline long long absx(long long a){return a<0?-a:a;}
int n,b[MAXN];
int judge(){
int t=b[2]-b[1],cnt=0;
long long now=b[2]+t;
for(int i=3;i<=n;++i,now+=t)
if(b[i]!=now){
if(absx(b[i]-now)>1)return 0x3f3f3f3f;
++cnt;
}
return cn... | ALGO | 0.999878 | 3.399128 |
96eddbbb-c0c0-436e-b268-b6989042a6e6 | ishandutta2007/codeforces | wangzhikun/normal/1252/C.cpp | from collections import Counter
T = int(input())
for _ in range(T):
N,K,D = map(int,input().split())
A = list(map(int,input().split()))
ctr = Counter(A[:D])
ans = len(ctr)
for i in range(N-D):
ctr[A[D+i]] += 1
ctr[A[i]] -= 1
if not ctr[A[i]]:
del ctr[A[i]]
... | ALGO | 0.999862 | 5.296006 |
f6c5716c-ba7e-4cd9-94e0-646edd565826 | jmrashed/HackerRank | Algorithms/Search/SherlockandArray/Solution.cpp | /*
Problem : https://www.hackerrank.com/challenges/sherlock-and-array
C++ 14
Approach :
This is quite a straight forward problem. All elements of the input array is
set to the sum of all the elements upto that point of the input array, i.e.
arr[i] = Sum(arr[j]) for 0 <= j <=i < n
... | ALGO | 0.999756 | 4.389512 |
e6f1cb7e-02d7-45b5-8574-204bf1ce42cf | dubeyaayushi/Data-Structures-and-Algorithms | Linked_List/Size_linked_list.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node{
int data;
Node* next;
};
void printList(Node* head){
Node* temp = head;
while(temp != NULL){
cout << temp->data << " ";
temp = temp->next;
}
cout << endl;
}
void getSize(Node* head){
Node* temp = head;
int co... | ALGO | 0.998553 | 3.89028 |
4004604c-a2a0-44ca-8453-7d0ec654465f | HannanBhuiyan/Flutter-Resources | sum_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.998526 | 6.76073 |
0b06aa6f-4ebf-4711-85c3-3d83f49e92c9 | stoneheart93/Leetcode | [215]Kth Largest Element in an Array.cpp | //Given an integer array nums and an integer k, return the kth largest element i
//n the array.
//
// Note that it is the kth largest element in the sorted order, not the kth dist
//inct element.
//
//
// Example 1:
// Input: nums = [3,2,1,5,6,4], k = 2
//Output: 5
// Example 2:
// Input: nums = [3,2,3,1,2,4,5,5,6... | ALGO | 0.999863 | 5.365514 |
d543a4f5-e865-434a-90b5-ce53b7d936db | Vivek-Gokhale/-CrackYourInternship | Tree/Maximum_Path_Sum.cpp | #include <bits/stdc++.h>
using namespace std;
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), left(... | ALGO | 0.999902 | 6.10292 |
6cc69180-b60e-4c4b-8367-82fcea6e387b | vijit101/CPPCodesBegineers | C++Projects/reversepyramid.cpp | #include<iostream>
using namespace std;
int main(){
int row,col;
cin>>row>>col;
for (int i = 0; i < row; i++)
{
for (int j = 0; j < row ; j++)
{
if (j < row -i)
{
cout<<" ";
}else{
cout<<'*';
}
}
... | ALGO | 0.999975 | 4.054444 |
729b764d-a36a-4c2d-9cbb-c846276bc673 | mirinta/leet_code | priority_queue/0857_minimum_cost_hire_k_workers.cpp | #include <queue>
#include <vector>
/**
* There are n workers. You are given two integer arrays quality and wage where quality[i] is the
* quality of the ith worker and wage[i] is the minimum wage expectation for the ith worker.
*
* We want to hire exactly k workers to form a paid group. To hire a group of k worker... | ALGO | 0.999851 | 5.504709 |
96ccd504-b323-47b8-92f1-370f11a0571e | HumanHyeon/Algorithm_Book | archive/SongChiHoon/Programmers/Kakao/cache.cpp | #include <string>
#include <vector>
#include <iostream>
#include <algorithm>
#include <unordered_set>
using namespace std;
#define INT_PAIR pair<int, int>
#define STR_INT_PAIR pair<string, int>
const bool compare (const STR_INT_PAIR & left, const STR_INT_PAIR & right) {
return left.second > right.second;
}
int solu... | ALGO | 0.999586 | 5.261261 |
9e02d774-9537-43ce-a473-7f5bd734dd11 | lukegustafson/kaggle_chess | rng.cpp | uint64_t rotl(uint64_t x, int r)
{
return (x << r) | (x >> 64-r);
}
///xoroshiro128++ with David Stafford's finalizer
uint64_t random64()
{
static uint64_t x = 0x4112CF68649A260E, y = 0xD813F2FAB7F5C5CA;
uint64_t result = rotl(x + y, 17) + x;
y ^= x;
x = rotl(x, 49) ^ y ^ (y << 21);
y = rotl(y, 28);
result ... | ALGO | 0.995883 | 5.703989 |
fbde4845-574a-4972-bdc6-3227aad212f8 | memorylorry/c-demo | 2_data_structure/6_sort/MergeSort.cpp | #include <stdio.h>
#include "../common/util.h"
void merge(int *arr,int leftStart,int leftEnd,int rightStart,int rigthEnd){
int ls = leftStart , le = leftEnd, rs = rightStart, re = rigthEnd;
// 申请临时的数组
int len = rigthEnd - leftStart + 1;
int tmp[len];
// 开始归并排序
int k = 0;
while (ls <= le &&... | ALGO | 0.999992 | 4.361098 |
e9569b47-7cd2-4a11-802c-126afecf321d | SalatielSauer/SauerWebUI | src/fpsgame/server.cpp | #include "game.h"
namespace game
{
void parseoptions(vector<const char *> &args)
{
loopv(args)
#ifndef STANDALONE
if(!game::clientoption(args[i]))
#endif
if(!server::serveroption(args[i]))
conoutf(CON_ERROR, "unknown command-line option: %s", args[i]);
}
... | TOOL | 0.956489 | 4.623694 |
88aa9318-dc57-47e9-9320-8dfbde2f4c6b | dereksodo/allcode | book1/Ch5/5.4/337_3.cpp | #include <iostream>
#include <cstring>
#include <cstdlib>
#include <set>
#include <vector>
#include <map>
#include <cstdio>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <stack>
#include <cassert>
#include <climits>
#include <numeric>
#include <sstream>
using namespace std;
typedef ... | ALGO | 0.999736 | 3.344305 |
9758f448-39dc-4652-82a7-497f0a0e8c43 | M45UDrana/DS-Algo-Problem-Solving | codeforces/787B.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int k, m; cin >> k >> m;
bool visit[m];
memset(visit, 0, sizeof(visit));
for(int i = 0; i < m; i++)
{
int n; cin >> n;
map<int,int>mp;
bool ok = true;
for(int j = 0, x; j < n; j++)
{
cin ... | ALGO | 0.999974 | 3.997991 |
be9ae2cc-ed0b-4d87-979c-7388ac37b3c2 | Saleh7127/CPP-solution-by-Fellow_junior | GYM cf/gym101673.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define test int t; cin>>t; for(int cs=1;cs<=t;cs++)
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
ll n,m,i,j,k,l,b=0,c=0;
string a,x;
cin>>a;
k=a.size();
l=k/2;
for(i=0;i<l;i++)
{
a[i]-=65;
... | ALGO | 0.999994 | 4.429304 |
12102622-3b0a-4716-9505-d35235843312 | mahdizynali/MazeNet | src/utils.cpp | #include "include/utils.hpp"
cv::Mat helper::sigmoid (const cv::Mat & X) {
cv::Mat sigmoidResult;
cv::exp(-X, sigmoidResult);
cv::add(cv::Scalar(1.0), sigmoidResult, sigmoidResult);
cv::divide(cv::Scalar(1.0), sigmoidResult, sigmoidResult);
return sigmoidResult;
}
cv::Mat helper :: softmax(const ... | TOOL | 0.98904 | 5.234661 |
22b73edd-f26a-45f5-b725-b358cd62ccc5 | Injarapugc/cpcodes | A_Qingshan_Loves_Strings_2.cpp |
#include <iostream> // For input/output operations
#include <vector> // For vector container
#include <string> // For string operations
#include <algorithm> // For algorithms like sort, binary_search, etc.
#include <cmath> // For mathematical functions
#include <map> ... | ALGO | 0.999791 | 3.770721 |
b2e38679-6137-4f77-890d-f19c2166754d | BarneyStinson73/CSE-410-Computer-Graphics-Sessional | Offline2/stage1_transform.cpp | // Line 1: eyeX eyeY eyeZ
// Line 2: lookX lookY lookZ
// Line 3: upX upY upZ
// Line 4: fovY aspectRatio near far
// this is the file format,line 1,2,3 for glulookat, line 4 for gluPerspective
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <math.h>
#include <sta... | ALGO | 0.861228 | 4.135486 |
ce99422b-19e7-4868-b1aa-2dbf7d1ab345 | snehamaryshaji/CPP_Training_U | assignment/day38/day38/batchwordprocessing.cpp | #include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
char toLowercase(char c)
{
return tolower(c);
}
int main()
{
vector<string> words = { "Apple", "banana", "apple", "Orange", "BANANA", "grape" };
for (string& word : words)
{
transform(word.begin(), word.end(), word.be... | ALGO | 0.999775 | 5.279083 |
4e2e5579-cf89-4cdd-ad81-a22d214a3d74 | MMLoveMeMM/AngryPandaLongLink | mars/boost/libs/exception/src/clone_current_exception_non_intrusive.cpp | //This MSVC-specific cpp file implements non-intrusive cloning of exception objects.
//Based on an exception_ptr implementation by Anthony Williams.
#ifdef BOOST_NO_EXCEPTIONS
//#error This file requires exception handling to be enabled.
#endif
#include <boost/exception/detail/clone_current_exception.hpp>
#if define... | TOOL | 0.923663 | 6.558564 |
bcc6235a-aa15-40e5-b986-dd8dbfe33383 | LionStar303/AdventOfCode | 2023/day_18/src/main.cpp | // main file
#include <iostream>
#include <string>
#include <fstream>
#include <vector>
#include <map>
using namespace std;
vector<string> getInputByLine(string fileName) {
vector<string> returnFile;
ifstream file(fileName);
if (file.fail()) {
cout << "file could not be opened";
}
s... | ALGO | 0.999494 | 4.9077 |
b735229b-bc31-47ee-9a74-3dc0cb9ba860 | yousef3ahmed/Competitive-Programming | two_SAT.cpp |
#include "bits/stdc++.h"
using namespace std;
struct _2SAT {
int n;
vector<vector<int>> adj, adj_t;
vector<bool> used;
vector<int> order, comp;
vector<bool> assignment;
_2SAT(int _n){
n = _n*2;
adj.resize(n);
adj_t.resize(n);
}
void dfs1(int v) {
used[v] = true;
for (int u : adj[v]) {
... | ALGO | 0.999896 | 3.94509 |
499f0b47-3f0c-49fd-a15f-0e6796ed64b2 | Ash-codes18/Lpu-colab-CPP-DSA-Soln | CSE-202 C++/Unit-3/Lecture-19/Hayley_Reverse-txt.cpp | #include <iostream>
using namespace std;
int main(){
int n;
cin>>n;
if(n>100){
cout<<"Exceeding limit!";
}
else{
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
for(int i=n-1;i>=0;i--){
cout<<arr[i];
}
}
return 0... | ALGO | 0.995705 | 3.600822 |
c61a2fa7-b453-4fb7-bac6-62422483e176 | malhardhaygude/CODING-deCODING | LeetCode/Easy/387. First Unique Character in a String.cpp | class Solution {
public:
int firstUniqChar(string s) {
int cnt[26];
memset(cnt,0,sizeof(cnt));
for(auto &i:s) cnt[i-'a']++;
for(int i=0; i<s.size(); i++) {
if(cnt[s[i]-'a']==1) return i;
}
return -1;
}
}; | ALGO | 0.999821 | 5.976397 |
39bcd57e-0b4e-4bba-bc35-f35c2dc9cf9b | icgrp/pld2022 | input_src/rendering_explore/operators/coloringFB_top_m8.cpp | #include "../host/typedefs.h"
// color the frame buffer
void coloringFB_top_m8(
hls::stream<ap_uint<32> > & Input_1,
hls::stream<ap_uint<128> > & Input_2,
hls::stream<ap_uint<512> > & Output_1)
{
#pragma HLS INTERFACE axis register port=Input_1
#pragma HLS INTERFACE axis register port=Input_2
#pragma HLS INTERF... | ALGO | 0.885852 | 3.899622 |
a1024cdf-7387-4e2e-a717-05da08121c8f | ammarGamal123/Codeforces-Solutions | CodeForces/GNU C++20 (64)/1679A | AvtoBus/211874064.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
for (int i = 0; i < t; i++){
long long n;
cin >> n;
if (n % 2 == 1 || n == 2){
cout << -1 << endl;
} else {
cout << (n + 4) / 6 << ' ' << n / 4 << endl;
}
}
} | ALGO | 0.999396 | 3.924606 |
a0097649-6ca4-4c83-8ef6-357df2e90fa7 | afterlife69/OwlCoder3 | Medium/Word Break/word-break.cpp | //{ Driver Code Starts
//Initial template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
// s : given string to search
// dictionary : vector of available strings
class Trie{
public:
Trie * links[26] = {nullptr};
bool end;
Tri... | ALGO | 0.999242 | 5.654846 |
bc256b02-c0e0-4b4d-976d-a3dd7628e60c | sarvex/leetcode-holy-c | solution/1300-1399/1353.Maximum Number of Events That Can Be Attended/Solution.cpp | class Solution {
public:
int maxEvents(vector<vector<int>>& events) {
unordered_map<int, vector<int>> d;
int i = INT_MAX, j = 0;
for (auto& v : events) {
int s = v[0], e = v[1];
d[s].push_back(e);
i = min(i, s);
j = max(j, e);
}
... | ALGO | 0.999902 | 6.060956 |
e41cd652-876a-4413-89d6-7b9588414499 | akshaychouke/LeetCode_Solutions | Medium/Stock span problem/stock-span-problem.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to calculate the span of stock’s price for all n days.
vector <int> calculateSpan(int price[], int n)
{
// Your code here
vector <int> ans;
stack<int> st;
... | ALGO | 0.999765 | 6.478361 |
403c7893-e923-4a76-964d-6ae109e8d075 | AhmedMostafa79/problem-solving | Problem-Solving/CSES/String Algorithms/Finding Periods .cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(v) ((v).begin()),((v).end())
#define rall(v) ((v).rbegin()),((v).rend())
#define Fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define close(n) return cout<<n,0;
const int dx[] = { -1,0,1,0,1,-1,1,-1 };
const int dy[] = { 0,1,... | ALGO | 0.999944 | 3.835849 |
1f644465-d276-4b56-8374-d9b47d3bd17d | lmn0/CPP-Programs | Indian Association for Research in Computing Problems/IARCS8.CPP | #include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<string.h>
#include<process.h>
void main()
{
char a[100],ch;
int m=0,i,n,j,k=0;
gets(a);
n=strlen(a);
for(i=0;i<n;i++)
{
if(a[i]>='A' && a[i]<='M')
m++;
if(a[i]<='Z' && a[i]>'M')
m--;
}
if(m!=0)
{cout<<0;exit(0);}
for(i=0;i<n;i++)
{
if(a[i]>='A' && a[i]... | ALGO | 0.999863 | 3.076625 |
d6cc8e78-7a9b-48b3-8e01-4d27a8787029 | rushyya/DSA | 2. Data Structures/5) Binary_Search_Tree/A1_BinarySearchTree.cpp | // Searching and inserting using iterative method
#include<iostream>
using namespace std;
struct Node {
int data;
Node* left;
Node* right;
};
// M2: Searching in BST using iteration
Node* ISearch(Node* p, int data){
while(p!=NULL){
if(p->data== data){
return p;
}
else if(d... | ALGO | 0.999989 | 3.050786 |
1caab8d1-5757-40e5-a2e3-27a39663249d | manikanta2901/ubuntu | .history/SRM/elab/DAA/SortingTechniques/SmallestFactorialNumber_20210218125234.cpp | #include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main(){
int number;
cin >> number;
int count = 0;
int i = 1,answer;
while(count != number){
if(i % 5 == 0){
count++;
ans
}
}
return 0;
} | ALGO | 0.999777 | 3.179816 |
5a92dda3-59e4-4e81-abdb-61a8d37b28e2 | zhangwj0101/codestudy | algorithm/HDU-ACM/ambition0109/2577.cpp | ////////////////////System Comment////////////////////
////Welcome to Hangzhou Dianzi University Online Judge
////http://acm.hdu.edu.cn
//////////////////////////////////////////////////////
////Username: ambition0109
////Nickname: Ambition
////Run ID:
////Submit time: 2010-07-06 18:40:22
////Compiler: Visual C++
////... | ALGO | 0.999808 | 3.247862 |
14930c14-505f-4914-a17f-af0738f51885 | VineetMalik14/Competitive_Programming | Codeforces/571-d2/f.cpp | #pragma GCC optimize("O3")
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#define mod ll(1000000007)
#define mod1 ll(998244353)
#define mox ll(200005)
#define inf ll(1e18)
#define fol(i,a,b) for(ll i=a; i<b; i++)
#define vll vector<ll>
#define mk make_pair
#define pb pus... | ALGO | 0.999946 | 4.712759 |
fd1b08dc-a47f-4c78-b2fa-1868100b35b7 | snull/CTU-CE-BP | 4/T3.cpp | #include <iostream>
using namespace std;
int main(){
float r,h;
cout<<"r : ";
cin>>r;
cout<<"h : ";
cin>>h;
cout<<"surface of cylinder = "<<(2*3.14*r*h)+(2*3.14*r*r)<<endl<<"volume of cylinder = "<<3.14*r*r*h;
return 0;
}
| ALGO | 0.922195 | 3.241153 |
173698e4-3fbe-415a-a67c-06d5e78c45bb | sarvex/leetcode-tsh | solution/2600-2699/2608.Shortest Cycle in a Graph/Solution.cpp | class Solution {
public:
int findShortestCycle(int n, vector<vector<int>>& edges) {
vector<vector<int>> g(n);
for (auto& e : edges) {
int u = e[0], v = e[1];
g[u].push_back(v);
g[v].push_back(u);
}
const int inf = 1 << 30;
auto bfs = [&](in... | ALGO | 0.999936 | 5.569103 |
ff6cd9f6-a941-4e4f-9c41-6f74183b505a | DysonHoang/Tin-Hoc | ClassTT/Home/Mang1Chieu/DOANCON1.cpp | #include <bits/stdc++.h>
#define Mx 100000000
#define ll long long
using namespace std;
map<int, int> mp;
int a[1000000];
int main()
{
ios_base::sync_with_stdio(NULL);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
for (int i = 1; i <= n; i++)
{
cin >> a[i];
}
int max1 = INT_MIN;
... | ALGO | 0.999969 | 3.962155 |
31635c15-8574-452d-aedf-15c5cc683c6f | leehanjun506/Algorithm | 프로그래머스/lv1/12944. 평균 구하기/평균 구하기.cpp | #include <string>
#include <vector>
#include <iostream>
// #include <algorithm>
using namespace std;
double solution(vector<int> arr) {
int l = arr.size();
double sum = 0;
for (int i =0; i<l; i++){
sum += arr[i];
}
double ans;
ans = sum/l;
return ans;
} | ALGO | 0.998631 | 4.22342 |
fbfc95b2-db66-4ffc-a2c6-5493e2873486 | 66kesara99/Hackerrank-Random | Contests/Code Sprint 9/WeightedUniformStrings.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
string s;
cin >> s;
int n;
cin >> n;
vector <int> subs;
int t = s[0]-'a'+1;
for (unsigned int i = 0; i<s.length(); i++){
subs.push_back(t);
//cout << s[i] << " " << t << endl;
if (s[i] == s[i... | ALGO | 0.999984 | 4.260022 |
824e090e-d3dd-4ff8-bafc-d7703c444eae | TianxiaoYe-Shawn/ACADOS_NMPC_ROS | src/Eigen-3.3/doc/examples/Tutorial_ArrayClass_addition.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXXf a(3,3);
ArrayXXf b(3,3);
a << 1,2,3,
4,5,6,
7,8,9;
b << 1,2,3,
1,2,3,
1,2,3;
// Adding two arrays
cout << "a + b = " << endl << a + b << endl << endl;
// Subt... | ALGO | 0.921426 | 3.642258 |
fee6e530-ecff-4fd7-8846-715b8d327165 | PerfectLifeG/Algorithm-Competition | Codeforeces/Div3.962/d.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(),x.end()
#define no cout<<"No"<<endl
#define yes cout<<"Yes"<<endl
#define endl '\n'
// #define x first
// #define y second
typedef pair<int,int> PII;
const int N=200010;
const int mod=998244353;
const int INF=0x3f3f3f3f3f3f3f3f;... | ALGO | 0.999811 | 5.279778 |
f3c28b67-2248-4712-a617-b4961158d406 | toshihoge/ACM-ICPC-Practice | ICPC/World-Final/2012/f/f.cpp | #include<algorithm>
#include<iostream>
using namespace std;
bool acceptable(int midDiff, int n, int k, const int* p) {
int index = 1;
int pair = 0;
while (index < 2*n*k) {
if (p[index] - p[index-1] <= midDiff) {
if (index > 2*k*pair+1) {
return false;
}
pair++;
if (pair >= n)... | ALGO | 0.999878 | 4.227593 |
77ebe9c1-b64c-4641-83d6-bebccd4502d7 | LegendaryArk/CompProg | DMOJ/mccc1j4.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<double> vd;
typedef vector<bool> vb;
typedef vector<pii> vp;
#define f first
#define s second
const ll MOD = 1e9 + 7;
const ll INF = 0x3f;
const double PI = acos((double) -1);
#def... | ALGO | 0.999984 | 4.382538 |
66d1770d-aa95-4a20-8ed9-577ba030884f | magyarakoos/contest-prog | atcoder/abc351/D/main.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define sz(v) (int)v.size()
#define all(v) v.begin(), v.end()
#define smin(x, y) x = min(x, y)
#define smax(x, y) x = max(x, y)
vector<vector<int>> grid, vis;
constexpr int dx[] = {1, -1, 0, 0}, dy[] = {0, 0, 1, -1};
int cnt, H, W, run, INF = 1e9;
v... | ALGO | 0.999482 | 5.17236 |
0d0588c5-43ee-4f27-9a6c-d0133c60dc57 | anwar907/Restaurant | 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 |
e7a2d2d4-5f28-4ef2-a364-0a5cb1ed2b9e | ravimenariya/LEETCODE_GFG_POTD | GFG_POTD/Jan 2025/26-01-2025.cpp |
// problem -> https://www.geeksforgeeks.org/problems/remove-loop-in-linked-list/1
class Solution {
public:
// Function to remove a loop in the linked list.
void removeLoop(Node* head) {
// code here
Node* fast = head;
Node* slow=head;
int f=1;
while(fast && fast->next... | ALGO | 0.999847 | 5.475082 |
970265c3-51d9-46e9-b184-e38b1980c4a0 | amrharb/leetcode | 732-my-calendar-iii/732-my-calendar-iii.cpp | class MyCalendarThree {
public:
map<int,int>mp;
MyCalendarThree() {
mp.clear();
}
int book(int start, int end) {
int cur=0,res=0;
mp[start]++;
mp[end]--;
for(auto&it:mp){
cur+=it.second;
res=max(res,cur);
}
return res;
... | ALGO | 0.999962 | 6.22961 |
52f3adc6-353b-4c5b-afdc-4359b8417842 | Divyansh-Chaubey/learning-C- | ap.cpp | # include<iostream>
using namespace std;
int main()
{
int n=1,term,d=2 ,sum;
cout<<"enter the number of terms you want to print";
cin>> term;
for(int i=0;i<term;++i)
{
sum=n+(i*d);
cout<<sum<<endl;
}
return 0;
} | ALGO | 0.999426 | 3.269409 |
fe8cde21-3d70-4ec7-a477-4c013400ba26 | sofdev-ms/Project-Euler | highly-divisible-triangular-number.cpp | // https://www.hackerrank.com/contests/projecteuler/challenges/euler012/problem
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
ll a[1001] = {0};
a[0] = 1;
ll i = 1;
ll n = 2;
while( i < 1001)
{
ll x = n * (n + 1) / 2;
ll x1 = x;
ll p... | ALGO | 0.999967 | 4.661999 |
f375c09b-2d2e-4317-a694-a07de4ed7089 | Prateek61/RayTracer | Deps/imgui/misc/fonts/binary_to_compressed_c.cpp | // dear imgui
// (binary_to_compressed_c.cpp)
// Helper tool to turn a file into a C array, if you want to embed font data in your source code.
// The data is first compressed with stb_compress() to reduce source code size,
// then encoded in Base85 to fit in a string so we can fit roughly 4 bytes of compressed data i... | TOOL | 0.914974 | 6.751062 |
3c73de19-c18e-4b90-ba0b-3c97452d6da3 | Chenpi-Sakura/algorithm_practice | cpp/AC/Others/SCUPC2025/UESTC/G.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
signed main()
{
int t; cin >> t;
while (t--)
{
int a, p, l, r; cin >> a >> p >> l >> r;
int ans = l + (a - l % p);
if (ans >= l && ans <= r) cout << "Yes" << ' ' << ans << endl;
else cout << "No" << endl;
... | ALGO | 0.999599 | 3.02232 |
3fab85ac-0807-42e0-bab6-da330ffc41a8 | irods/irods_client_http_api | plugins/user_mapping/src/local_file.cpp | #include "irods/http_api/plugins/user_mapping/interface.h"
#include <cstdlib>
#include <cstring>
#include <exception>
#include <filesystem>
#include <fstream>
#include <mutex>
#include <optional>
#include <shared_mutex>
#include <string>
#include <vector>
#include <nlohmann/json.hpp>
#include <spdlog/spdlog.h>
names... | TOOL | 0.864547 | 7.112124 |
49961b67-24c8-4bda-8ea2-49281b7c5154 | Shahanewaz007/Problem-Solving | Codeforces Problem Code/C++/Teleporters (Easy Version).cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while(t--)
{
int n, c;
cin >> n >> c;
list<long> q;
for(int i=1; i<=n; i++)
{
int in;
cin >> in;
q.push_back(i + in);
}
q.sort()... | ALGO | 0.999956 | 3.495166 |
412cadf7-2d78-420b-9e11-c49a905da252 | NureSketsa/praktree | FP/tempCodeRunnerFile.cpp | #include <vector>
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <map>
#include <string>
#include <queue>
#include <algorithm>
using namespace std;
struct CustomCompare
{
bool operator()(const pair<int, int> &lhs, const pair<int, int> &rhs)
{
if (lhs.first == rhs.first)
{
... | ALGO | 0.999849 | 4.120067 |
154e993a-b30f-4f35-9b24-45ae8a98a06f | dueip/Codeforces | voevodin_e_o/hw-05-01.cpp | //#include <iostream>
//#include <cmath>
//
//size_t fact(size_t a) {
// size_t res = 1;
// while (a) {
// res *= a;
// --a;
// }
// return res;
//}
//
//int main()
//{
// double delta = 0.1;
// double a = -1;
// double b = 1;
// double eps = 0.001;
// double sum = 0;
// for (size_t i = 0;; ++i) {
// int what_to_mul... | ALGO | 0.999508 | 3.981713 |
de574554-b1a6-4ba0-a2dc-57b08d33027d | Andrew-J-Li/UTPC-practice | Daily/vile.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int p, y; cin >> p >> y;
bool very_good = false;
for (int i = y; i >= max (p + 1, y - 400); --i) {
bool good = true;
for (int j = 2; j * j <= i; ++j) {
if (i % j == 0 && j <= p) {
good = false;
... | ALGO | 0.999973 | 4.364736 |
ff349b44-eaea-4cb3-8b2c-fd33112d3162 | gaurav1620/Competitive-Coding | Codechef/BINOFEV.cpp | /*
© GAURAV KHAIRNAR 2019
@ Website : gaurav1620.rf.gd
@ Github : gaurav1620
@ Insta : may_be_gaurav
@ Gmail : <EMAIL>
@ CodeForces : gaurav1620
# Dont compare yourself with anyone in this world.If you do so, you are insulting youreself .
*/
#include<bits/stdc++.h>
//Faster loops
#define fo(i,n) ... | ALGO | 0.999969 | 4.216316 |
a04fbf81-ca7f-4a47-a5fe-67c0da8b93cb | ssevR/cses | Introductory_Problems/Permutations/main.cpp | #pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define IOS ios::sync_with_stdio(false); cin.tie(0)
#define ll long long
#define ld long double
#define rep(i,a,n) for (int i=(int)(a);... | ALGO | 0.999964 | 4.362643 |
e52d6a78-b11e-4337-8b38-07476dcb1fa8 | llynv/CP-files | codeforce/ct2024_laga.cpp | /*
Code by: linvg
*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair<int, int>
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) ((int)(x).size())
#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define per(i, a, b) f... | ALGO | 0.999653 | 4.592525 |
0914e475-8e4e-485b-a554-cccd44053794 | alextsao1999/geditor | example/test.cpp | #include <stdio.h>
#include <exception>
#include <lalr/Parser.hpp>
#include <lalr/GrammarCompiler.hpp>
#include <lalr/RegexCompiler.hpp>
#include <iostream>
#include <string>
#include <array>
#include <map>
#include <set>
#include <list>
#include <functional>
#include <Windows.h>
#include <fileapi.h>
#include <memoryap... | TEST | 0.934462 | 6.005316 |
8803a85e-3173-4f1c-9e32-fb98719f620a | mushanshanshan/LeetCode | 2290. Minimum Obstacle Removal to Reach Corner.cpp | class Solution {
private:
vector<pair<int, int>> dirction = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
public:
int minimumObstacles(vector<vector<int>>& grid) {
int N = grid.size(), M = grid[0].size();
int step = 0;
vector<vector<int>> visited(N, vector<int>(M, 0));
deque<vector<int>>... | ALGO | 0.999975 | 6.2372 |
4c8d540c-7617-467e-8dae-1a6192918c3b | bitcointrustbct/bitcointrust_old | src/netbase.cpp | #include "netbase.h"
#include "util.h"
#include "sync.h"
#include "hash.h"
#ifndef WIN32
#include <sys/fcntl.h>
#endif
#include <boost/algorithm/string/case_conv.hpp> // for to_lower()
#include <boost/algorithm/string/predicate.hpp> // for startswith() and endswith()
using namespace std;
// Settings
static proxyTyp... | TOOL | 0.984382 | 4.974189 |
050a5dd5-4c46-4493-8cfc-974099f4112b | Istikhayah/UTS_MobileProgramming | 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 |
cab51bcd-5581-4fe9-85f9-3998131d6088 | iyaacs/algospot | SORTGAME.cpp | #define _CRT_SECURE_NO_WARNINGS
#include<cstring>
#include<iostream>
#include<algorithm>
#include<sstream>
#include<string>
#include<vector>
#include<cmath>
#include<cstdio>
#include<cstdlib>
#include<fstream>
#include<cassert>
#include<numeric>
#include<set>
#include<map>
#include<queue>
#include<list>
#include<deque>... | ALGO | 0.999853 | 3.924496 |
8c4a66c0-74f5-45cb-9323-cb8f3face47a | waqqas/simple-cpp-starter | exercise_7/for_loop.cpp | #include <iostream>
#include <array>
#define ARRAY_SIZE 5
int main()
{
int numbers[ARRAY_SIZE] = {1, 2, 3, 4, 5};
std::cout << "Array elements:\n";
for (int num : numbers)
{
std::cout << num << " ";
}
std::cout << "\n";
return 0;
}
| TOOL | 0.92554 | 4.302013 |
6ca40e16-7297-4991-b802-cd7c9d9149eb | wkhattak/Path-Planning | src/Eigen-3.3/doc/examples/function_taking_ref.cpp | #include <iostream>
#include <Eigen/SVD>
using namespace Eigen;
using namespace std;
float inv_cond(const Ref<const MatrixXf>& a)
{
const VectorXf sing_vals = a.jacobiSvd().singularValues();
return sing_vals(sing_vals.size()-1) / sing_vals(0);
}
int main()
{
Matrix4f m = Matrix4f::Random();
cout << "matrix m:... | ALGO | 0.9997 | 5.283265 |
44ecde93-2bdb-424a-b1ca-e4d56aaf79cc | liuq901/code | AOJ/a_0119.cpp | #include <cstdio>
int q[30],b[30],d[30],a[110][2];
int main()
{
int n,m;
scanf("%d%d",&n,&m);
for (int i=1;i<=m;i++)
{
int x,y;
scanf("%d%d",&x,&y);
a[i][0]=y,a[i][1]=b[x],b[x]=i;
d[y]++;
}
int l=1,r=0;
for (int i=1;i<=n;i++)
if (d[i]==0)
q... | ALGO | 0.999994 | 3.335011 |
96862665-7a6b-4cfe-ba1d-b66a001e9499 | ishandutta2007/codeforces | zoli9/normal/1097/B.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
int a[20];
int M=360;
bool answer=false;
int sz;
void proba(int x)
{
if(x==n)
{
if(sz==0) answer=true;
return;
}
sz+=a[x];
sz%=M;
proba(x+1);
sz-=a[x];
sz+=M;
sz-=a[x];
sz+=M;
sz%=M;
proba(x+1);
sz+=a[... | ALGO | 0.999991 | 3.615814 |
b3c2a773-5019-41e7-b2f0-f16f3e78e8ae | kumar09sahil/DSA_-c- | Stack/QuestionsOnStack/StockSpan.cpp | #include<bits/stdc++.h>
using namespace std;
//* time complexity = O(n);
//* space complexity = O(n);
vector<int> StockSpan(vector<int> v)
{
//* Intuition: claculate previous greatest element;
//* store : (idx)-(prev_greatest_element_idx) as the answer
vector<int>ans(v.size(),1);
reverse(v... | ALGO | 0.999911 | 5.226491 |
728d4e84-1cb7-4e53-bb56-976ba1ca26f8 | sarvex/leetcode-clisp | solution/2500-2599/2546.Apply Bitwise Operations to Make Strings Equal/Solution.cpp | class Solution {
public:
bool makeStringsEqual(string s, string target) {
auto a = count(s.begin(), s.end(), '1') > 0;
auto b = count(target.begin(), target.end(), '1') > 0;
return a == b;
}
}; | ALGO | 0.999922 | 5.969481 |
fee36181-3aeb-43a7-8c90-49f896fecc22 | abhaysp95/language_files | ncpp/practice/coursera_OODS/week4/cube2/game.cpp | #include "game.hpp"
#include "stack.hpp"
#include "uiuc/cube.hpp"
#include "uiuc/HSLAPixel.hpp"
void Game::solve() {
move_(0, stacks_[0].size() - 1, stacks_[0], stacks_[2], stacks_[1], 0);
}
Game::Game() {
// create three empty stacks
for (int i = 0; i < 3; ++i) {
Stack stackOfCubes;
stacks_.push_back(stackOfC... | ALGO | 0.999714 | 3.765763 |
7ab84809-0114-46b9-97c1-1ac33b4ad93d | Arijul420/Algorithms-Lab-main | 7. Dijkstras.cpp | #include<bits/stdc++.h>
using namespace std;
#define INF 0x3f3f3f3f
typedef pair<int, int> iPair;
int V=5;
int isVisited[5];
vector<pair<int, int>>dist(V,make_pair(INF,-1));
void addEdge(vector<pair<int,int>>adj[],int u, int v,int wt)
{
adj[u].push_back(make_pair(v,wt));
}
void printPath(int V,int j)
{
if(... | ALGO | 0.999965 | 4.129112 |
331db229-2c30-4662-a09b-3521e40b62e3 | liwei2088/oi | leetcode/01数据结构/03栈/496.cpp | /*
496. 下一个更大元素 I
给定两个没有重复元素的数组 nums1
和 nums2 ,其中nums1 是 nums2 的子集。找到 nums1 中每个元素在 nums2 中的下一个比其大的值。
nums1 中数字 x 的下一个更大元素是指 x 在 nums2 中对应位置的右边的第一个比 x 大的元素。如果不存在,对应位置输出-1。
*/
#include <iostream>
#include <map>
#include <stack>
#include <vector>
using namespace std;
//该题同样使用单调栈,先处理nums2将所有值之后的较大值位置保存到哈希表(... | ALGO | 0.99999 | 4.964352 |
c9f0def6-5855-43f6-b570-1ab8763d056a | Soooohyun/Soooohyun.github.io | algorithm/10773.cpp | #include <iostream>
#include <stack>
using namespace std;
int main() {
int K;
int num, sum = 0;
stack<int> S;
scanf("%d", &K);
getchar();
for (int i = 0; i < K; i++) {
scanf("%d", &num);
getchar();
if (num) {
S.push(num);
}
else {
S.pop();
}
}
while (!S.empty()) {
sum += S.top();
S.p... | ALGO | 0.999913 | 3.845182 |
0ca86b2b-7088-4bb9-9dd8-e02e57df4a96 | jackliu2013/recipes | cpp/cpp_primer_6/Chapter16/vectlist.cpp | #include <iostream>
#include <vector>
#include <list>
#include <cmath>
#include <ctime>
#include <cstdlib>
#include <algorithm>
int main()
{
using namespace std;
int n_elem;
cout << "Enter number of elements: ";
cin >> n_elem;
vector<int> vi0(n_elem);
for (auto pv = vi0.begin(); pv != vi0.end(); pv++)
*pv = ... | ALGO | 0.98811 | 3.680159 |
71f8706e-0acb-4e15-8b3f-ff950a1a1a80 | demo-jun-4/openvino | src/frontends/tensorflow_common/src/op/ctc_greedy_decoder.cpp | #include "common_op_table.hpp"
#include "openvino/op/concat.hpp"
#include "openvino/op/constant.hpp"
#include "openvino/op/ctc_greedy_decoder_seq_len.hpp"
#include "openvino/op/gather_nd.hpp"
#include "openvino/op/negative.hpp"
#include "openvino/op/non_zero.hpp"
#include "openvino/op/not_equal.hpp"
#include "openvino/... | ALGO | 0.963106 | 4.223762 |
abf8cda9-6be4-420c-a8ff-de8d514fcb12 | xcurvnubaim/Data-Structure | seslab/praktikum/modul-4/dba.cpp | #include <bits/stdc++.h>
using namespace std;
char board[5][5], temp[5][5];
bool isfound=false;
void reset_board(vector<vector<bool>> &visited){
for(int i=0; i<5; i++)
for(int j=0; j<5; j++){
// board[i][j] = temp[i][j];
visited[i][j] = false;
}
}
void solve(deque<char> q,... | ALGO | 0.999891 | 3.853046 |
b2332c05-5cd8-4338-a4b7-a76d88fde651 | Ritax2003/Coding-Ninjas-Questions-TA | course/Recursion/sumofarrayelemnt.cpp | #include<iostream>
using namespace std;
int sum(int input[], int n) {
if(n!=0) return input[0]+sum(input+1,n-1);
else return 0;
}
int main(){
int n;
cin >> n;
int *input = new int[n];
for(int i = 0; i < n; i++) {
cin >> input[i];
}
cout << sum(input, n) << endl;
}
| ALGO | 0.999799 | 4.448419 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.