uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
498a09e0-dd2e-4ef2-9ce3-b8a38d58ffb6 | rohitamrutkar8907/DSA-With-C- | zOhther/x.cpp | #include <bits/stdc++.h>
using namespace std;
vector<vector<int>> findTriplets(vector<int> a, int n, int x)
{
// Write your code here.
sort(a.begin(), a.end());
vector<int> f;
for (int i = 0; i < n - 2; i++) {
int j = i + 1, k = n - 1;
while (j < k) {
int sum = a[i] + a[j] + a[k... | ALGO | 0.999985 | 4.553348 |
544992fc-5683-4ca4-bc4e-25d4d1c1a8a2 | Joseph-MingEn/Cpp_MingEn | zerogudje/e971j未完.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int m, n;
cin >> m >> n;
int block[m][n];
for(int i = 0; i < m; i++) {
for(int j = 0; j < n; j++) {
cin >> block[i][j];
}
}
for(int j = 1; j < n-1; j++) {
for(int i = 1; i < m-1; i++) {
... | ALGO | 0.999959 | 3.354152 |
bbddf159-4da7-4fbf-8231-cde98b1ac27e | rocmnavi/boost | libs/compute/perf/perf_is_sorted.cpp | #include <algorithm>
#include <iostream>
#include <vector>
#include <boost/compute/system.hpp>
#include <boost/compute/algorithm/is_sorted.hpp>
#include <boost/compute/algorithm/reverse.hpp>
#include <boost/compute/algorithm/sort.hpp>
#include <boost/compute/container/vector.hpp>
#include "perf.hpp"
int main(int arg... | ALGO | 0.997362 | 6.354411 |
31f4b0fe-d6cd-4c09-abe0-935abee19533 | leechangyeol/BaekJoon | 15650.cpp | #include <iostream>
using namespace std;
int n, m;
const int MAX = 8;
int map[MAX];
void dfs(int cnt, int idx) {
if (cnt == m) {
for (int i = 0; i < m; i++)
cout << map[i] << " ";
cout << "\n";
}
else {
for (int i = idx; i < n; i++) {
map[cnt] = i + 1;
dfs(cnt + 1, i + 1);
}
}
}
int main(void) {
c... | ALGO | 0.999962 | 3.719774 |
b925e672-8d79-4dfa-a287-3257ccdaaccb | Aaanchalsingh/Leetcode | 141-linked-list-cycle/linked-list-cycle.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
bool hasCycle(ListNode *head) {
ListNode *slow=head;
ListNode *fast=head;
while(fast){
slow=slow... | ALGO | 0.999707 | 5.363185 |
8a811155-a2d0-49f1-afc5-57ec0c8691f1 | TooYoungTooSimp/my_solutions | OnlineJudges/poj/3180.cpp | #include <cstdio>
inline int min(int a, int b) { return a < b ? a : b; }
const int maxn = 100010;
int head[maxn], next[maxn << 1], to[maxn << 1], ecnt, n, m;
int dfn[maxn], scc[maxn], cnt[maxn], scccnt, stk[maxn], low[maxn], idx, top;
inline void addEdge(int f, int t)
{
ecnt++;
next[ecnt] = head[f];
head[f]... | ALGO | 0.999786 | 4.633381 |
c1ad01af-c9b4-4c72-9555-d8469c05b754 | maciejewskimichal/Udacity-P11-CarND-Path-Planning-Project | src/Eigen-3.3/bench/benchVecAdd.cpp |
#include <iostream>
#include <Eigen/Core>
#include <bench/BenchTimer.h>
using namespace Eigen;
#ifndef SIZE
#define SIZE 50
#endif
#ifndef REPEAT
#define REPEAT 10000
#endif
typedef float Scalar;
__attribute__ ((noinline)) void benchVec(Scalar* a, Scalar* b, Scalar* c, int size);
__attribute__ ((noinline)) void be... | TOOL | 0.859898 | 5.142219 |
2ac76198-12c1-40b4-b980-b92bf0e59721 | GarvThanvi/DSA | Week8/dnc1.cpp | #include <iostream>
#include <vector>
using namespace std;
void mergeSortedArrays(int arr[], int sizeArr, int brr[], int sizeBrr, vector<int> &ans)
{
int i = 0, j = 0;
while (i < sizeArr && j < sizeBrr)
{
if (arr[i] < brr[j])
{
ans.push_back(arr[i]);
i++;
}
... | ALGO | 0.999985 | 5.080307 |
d2803787-9dbd-42e5-9567-d4a993cd7286 | Paridhi0309/Character_Arrays_and_2d_arrays | reverse_each_word.cpp | #include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
void reverseeachword(char input[]){
int previous=-1;
int len=strlen(input);
for(int i=0;i<=len;i++){
if(input[i]==' ' || input[i]=='\0'){
reverse(input+1+previous,input+i);
previous=i;
}
... | ALGO | 0.999833 | 3.893616 |
892b2458-61ea-4f48-9a65-6c481eb7adce | MicroPrism/Code-study-note | C++_study/Grammer/pratice/unit5/2.cpp | #include<iostream>
#include<array>
int main(void)
{
using namespace std;
array<long double,101> fi;
fi[0]=1,fi[1]=1;
for(int i = 2;i < 101;i++)
fi[i]=i*fi[i-1];
cout<<fi[3]<<endl;
return 0;
}
| ALGO | 0.999756 | 3.39887 |
5d512f8d-7f24-42d7-8c46-df8e5439ece5 | 1chooo/code | zerojudge/d065-三人行必有我師-1-行版/solution.cpp | /*
* Author: 1chooo<<EMAIL>>
* Problem link: https://zerojudge.tw/ShowProblem?problemid=d065
* Status: AC
*/
#include <cstdlib>
#include <iostream>
using namespace std;
int main(void) {
long int a = 0;
long int b = 0;
long int c = 0;
cin >> a >> b >> c;
if (a > b && a > c) {
cout <<... | ALGO | 0.999818 | 4.11663 |
60f4d798-e5c1-41a5-b76b-d44ab913862d | mitsuyuki/beecrowd | 1001.cpp | #include<iostream>
using namespace std;
int main()
{
int A, B, X;
while(cin>>A>>B)
{
X=A+B;
printf("X = %i\n",X);
}
return 0;
} | ALGO | 0.947437 | 3.888103 |
6ccd1b55-dca4-462d-98e4-4cbbe0765f6d | rainbow-auto/rainbow-codes | Comp/24-08-13 ABC300-vp/G.cpp | #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <bitset>
#include <stack>
#include <unordered_map>
#include <unordered_set>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <queue>
#pragma GCC Optimize(2)
using i64 = long long;
#define fastread std::ios::sync_with_... | ALGO | 0.999889 | 3.861985 |
a22d86d0-826a-40ea-a4b3-67c9afaa2cbe | Narasingdharani/DAY-4-CLASS-WORK | day 4 class 4.15.cpp | #include <stdio.h>
int main() {
int i, j;
for (i = 1; i <= 4; i++) {
for (j = 1; j <= i; j++) {
printf("%d", i);
}
printf("\n");
}
for (i = 3; i >= 1; i--) {
for (j = 1; j <= i; j++) {
printf("%d", i);
}
printf("\n");
}
return 0;
}
| ALGO | 0.999639 | 3.777802 |
0c59a4c5-46b0-45a3-a454-761643c0c4a7 | theoden42/code-store | atcoder/KEYENCE Programming Contest 2024(AtCoder Beginner Contest 374)/C.cpp |
/* author: (g)theoden42 */
#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 all(a) a.begin(), a.end()
#ifdef ON_PC
#include <debug.h>
#else
#define debug(x...)
#endif
template<typename T>
using o... | ALGO | 0.999989 | 4.573603 |
cfb131e0-eb91-4344-b3e3-98c941182efd | tsw303005/LeetCode | 173. Binary Search Tree Iterator/function.cpp | #include <iostream>
using namespace std;
/**
* 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, T... | ALGO | 0.999884 | 6.492817 |
37da5c81-145a-4cbf-be0f-2eb6bb8bc890 | kei1107/algorithm | problems/Atcoder/ARC013_C.cpp | #include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
const int INF = 1e9;
const ll LINF = 1e18;
inline ll gcd(ll a, ll b) { return b ? gcd(b, a%b) : a; }
inline ll lcm(ll a, ll b) { return a / gcd(a, b)*b; }
template<class S,class T> ostream& operator... | ALGO | 0.997954 | 3.676369 |
97864595-8584-4630-a73e-2a4b75c06b58 | Adityakumar012/CSES | Graph Algorithms/Round_Trip.cpp | #include <bits/stdc++.h>
using namespace std;
void solve(int node,int parent,int &no,vector<bool>&vist,vector<vector<int>>&adj){
if(vist[node]){
no=node;
return ;
}
vist[node]=true;
for(auto it:adj[node]){
if(it!=parent){
solve(it,node,no,vist,adj);
}
}
}
... | ALGO | 0.999971 | 4.51419 |
e564f90b-1b2f-4ae2-82cc-052f0114447f | jopemachine/Leetcode-Solve | 91.decode-ways.cpp | /*
* @lc app=leetcode id=91 lang=cpp
*
* [91] Decode Ways
*/
// @lc code=start
#include <algorithm>
#include <iostream>
#include <memory.h>
#include <stack>
#include <unordered_map>
#include <utility>
#include <vector>
using namespace std;
class Solution {
public:
int dfs(int index, string str, unordered_m... | ALGO | 0.999762 | 6.741412 |
78e66ed2-109b-4c0a-816e-84309361ac85 | Justinshao33/competitive_programming | done/CSES/Distinct_Values_Subarrays.cpp | #ifdef LOCAL
#define _GLIBCXX_DEBUG 1
#endif
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,popcnt,sse4,abm")
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define re... | ALGO | 0.999932 | 5.128228 |
e13f175d-9f67-4de0-b772-cce8459047ed | jatingandhi32/Analysis-and-Design-of-Algorithms | ADA/longestCommonSubsequence.cpp | #include<bits/stdc++.h>
using namespace std;
int max(int a, int b)
{
return (a > b)? a : b;
}
int lcs( char *X, char *Y, int m, int n )
{
int L[m + 1][n + 1];
int i, j;
for (i = 0; i <= m; i++)
{
for (j = 0; j <= n; j++)
{
if (i == 0 || j == ... | ALGO | 0.999691 | 4.278816 |
8d7f9066-cd6d-4d91-aac7-08a9f04e5921 | wortelworm/informatica_eindproject | snake.cpp | /**
* this is code to simulate the game of snake
*/
#include "snake.h"
#include "utils.h"
#define snakePixel(x, y) Utils::DrawPixel(x + 2, y + 2, RED);
#define foodPixel(x, y) Utils::DrawPixel(x + 2, y + 2, GREEN);
namespace Snake {
bool gameOver;
int8_t directionX;
int8_t directionY;
int8_t nextDirecti... | TOOL | 0.933045 | 5.586825 |
2709d70b-4e33-445c-a909-c99770eab048 | DhruvSharma845/codeforces | cpp/dima_and_continuous_line_358_A.cpp | #include <iostream>
#include <vector>
#include <algorithm>
auto hasIntersections(std::vector<int> points) -> bool {
if(points.size() <= 2) {
return false;
}
for (size_t i = 0; i < points.size() - 1; i++) {
for (size_t j = i + 1; j < points.size() - 1; j++) {
int minI = std:... | ALGO | 0.999994 | 5.615774 |
2dd66e9a-de80-4865-9b1e-681ace5a4f8b | ishandutta2007/codeforces | choutii/normal/866/D.cpp | #include <bits/stdc++.h>
#define fir first
#define sec second
using namespace std;
typedef long long LL;
typedef unsigned long long u64;
template <typename T> inline bool cmin(T & a, const T & b) { return a > b ? a = b, 1 : 0;}
template <typename T> inline bool cmax(T & a, const T & b) { return a < b ? a = b, 1 : 0;}... | ALGO | 0.999897 | 3.319426 |
e170900a-4fe4-444a-8998-abd454c435b1 | navarroruben/RotateMatrix-cpp | main.cpp | // Ruben Navarro
// 12/18/2019
// main.cpp
// CTCI - Rotate Matrix 90
// Rotates a Matrix 90 Degrees in place
#include <iostream>
#include <vector>
#include "prototypes.h"
int main() {
std::vector<std::vector<char>> matr {{'A','B','C'}, {'D', 'E', 'F'}, {'G', 'H', 'I'}};
// check matrix is empty
if (matr... | ALGO | 0.996867 | 6.485468 |
b3bdef02-b5c9-41a1-b25b-7d5f48b97b8b | iains/LLVM-7-branch | llvm/lib/Transforms/Scalar/SimplifyCFGPass.cpp | #include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AssumptionCache.h"
#include "llvm/Analysis/CFG.h"
#include "llvm/Analysis/GlobalsModRef.h"
#include "llvm/Analysis/TargetTransformInfo.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/IR... | TOOL | 0.977629 | 7.8887 |
06db1c8f-3b3c-4efa-9efa-d99133fb1cc5 | WilliamX1/leetcode | Solutions/Count-Odd-Numbers-in-an-Interval-Range.cpp | class Solution
{
public:
int countOdds(int low, int high)
{
return (high + 1) / 2 - low / 2;
}
}; | ALGO | 0.998151 | 5.33225 |
19e8c33d-f18a-42a3-bf73-911dafc28fc4 | shivamsharmxa/GeeksforGeeks-DSA | Difficulty: Easy/First and last occurrences of x/first-and-last-occurrences-of-x.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
vector<int> firstAndLast(int x, vector<int> &arr) {
// Code here
int start = 0, end = arr.size() - 1;
int first = -1, last = -1, mid;
// Find the first occurrence of x... | ALGO | 0.999845 | 5.8357 |
45ad7fc0-6c64-4626-9149-7708b5c2ee72 | chucknology/boost-155 | boost_1_55_0/libs/geometry/index/example/benchmark3.cpp | // Boost.Geometry Index
// Additional tests
#include <iostream>
#include <boost/geometry/index/rtree.hpp>
#include <boost/chrono.hpp>
#include <boost/foreach.hpp>
#include <boost/random.hpp>
#include <set>
int main()
{
namespace bg = boost::geometry;
namespace bgi = bg::index;
typedef boost::chrono::thr... | TEST | 0.915069 | 5.961876 |
8fc2e526-b9c9-4309-81e4-41be5754f640 | AidySun/Data-Structure-and-Algorithm | src/sorting.cpp | #include <iostream>
#include <string>
#include "printA.h"
namespace Sorting {
using namespace std;
void bubble_sort(int *a, int n) {
for (int i = 0; i < n-1; i++) {
for (int j = i+1; j < n; j++) {
if (a[i] > a[j]) {
int t = a[j];
a[j]... | ALGO | 0.999511 | 4.9974 |
e1f789f9-ce64-4c7b-8ff0-d5fdd0883909 | rajeev2010/cpp_tutorial | examples/cx_boost_ublas_vector_expressions_scalar_multi.cpp | /* program to illustrate the use of boost::numeric::ublas
*
* example taken from boost document
*
* Rajeev Singh
* 2013-04-14
*
*/
#include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
vector<double> v (3);
for (unsigned... | ALGO | 0.871782 | 3.440329 |
984e6f61-1aa0-4d71-9c45-0a06418973ee | ArjunMurlidhar/NeutronStarEoS | alf1/MassRadius.cpp | #include<C:\Users\windows7\projects\NS_Integrator\nr3.h>
#include<C:\Users\windows7\projects\NS_Integrator\OdeInt.h>
#include<C:\Users\windows7\projects\NS_Integrator\stepper.h>
#include<C:\Users\windows7\projects\NS_Integrator\stepperdopr5.h>
#include <C:\Users\windows7\projects\NS_Integrator\interp_1D.h>
#include<C:\... | ALGO | 0.999548 | 3.775552 |
5fff4d82-1110-4bde-85cd-7a5aa1d75822 | huang870207/la90506 | C_MM16.cpp | #include<stdio.h>
#include<stdlib.h>
#include <string>
#include <iostream>
#include <vector>
#include<iomanip>
using namespace std;
int main(){ //P_yЬO_b餺
int x,y;
while(cin>>x>>y)
{
if(x*x+y*y<=10000)
cout<<"inside"<<endl;
else
cout<<"outside"<<endl;
}
}
| ALGO | 0.998547 | 3.105386 |
9715ddeb-25c9-43f2-a16b-30603d559b9c | iamomstealer/dsa-in-c-plus-plus | bitwise operators/forFib.cpp | #include<iostream>
using namespace std;
int main() {
int n = 10;
int a = 0;
int b = 1;
cout<<a <<" " <<b<<" ";
for(int i = 1; i<=n; i++ ) {
int nextNumber = a+b;
cout<<nextNumber<<" ";
a = b;
b = nextNumber;
}
return 0;
} | ALGO | 0.999862 | 3.521848 |
9b6b1320-d0b4-4140-9490-f0f34375d597 | heissanjay/Leetcode | 0128-longest-consecutive-sequence/0128-longest-consecutive-sequence.cpp | class Solution {
public:
int longestConsecutive(vector<int>& nums) {
int n = nums.size();
if (n == 0) return 0;
unordered_set<int> s(nums.begin(), nums.end());
int res = 1;
for (const auto& num : s) {
if (s.find(num - 1) == s.end()) {
int count... | ALGO | 0.999947 | 5.989106 |
1207c2ff-bcd7-44ab-ab3f-74cb86018c6e | vpk-11/IPMP | DSA Prep/Round 1/Arrays/Arr_21.cpp | #include <iostream>
using namespace std;
int main()
{
int mat[4][4] = {{10, 20, 30, 40},
{15, 25, 35, 45},
{27, 29, 37, 48},
{32, 33, 39, 50}};
int x;
cout << "Number to be searched: ";
cin >> x;
int i = 0, j = 0; bool flag = true;
... | ALGO | 0.996095 | 4.032489 |
104c2f74-1379-4455-bc3c-cc53277f84a0 | fafa1899/BuildCppDependency | Source/boost-1.86.0/libs/geometry/test/algorithms/overlay/sort_by_side.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// Unit Test
#include <geometry_test_common.hpp>
#include <boost/geometry/algorithms/correct.hpp>
#include <boost/geometry/algorithms/detail/overlay/debug_turn_info.hpp>
#include <boost/geometry/algorithms/detail/overlay/overlay.hpp>
#include <boost/geometry/geome... | TEST | 0.903147 | 7.267414 |
fcd083ca-03ba-4679-b369-f8550ba7bde6 | eddelbuettel/stackoverflow | 76319284/answer.cpp |
#include <Rcpp/Rcpp>
#include <mlpack.h>
// Adjusted for mlpack 4.0.1
#include <mlpack/core.hpp>
#include <mlpack/methods/kmeans.hpp>
#include <mlpack/methods/kmeans/random_partition.hpp>
#include <mlpack/methods/neighbor_search/neighbor_search.hpp>
// [[Rcpp::depends(RcppArmadillo)]]
// [[Rcpp::depends(RcppEnsmalle... | ALGO | 0.995417 | 6.511921 |
33873b7d-f77b-47ab-b4f7-7d366a21242f | RychardRS/LIP | UNIDADE 02/Valores da matriz/main.cpp | #include <iostream>
#include <iomanip>
#define MAX_L 30
#define MAX_C 30
using namespace std;
int main()
{
/*Valores da MatrizFaça um programa que, dados os números n, m (n,m <=30),
lê do usuário os valores de uma matriz A de inteiros de dimensão n x m.
Depois, o programa deve imprimir o menor elemento, o ... | ALGO | 0.997254 | 3.77152 |
3a807f48-9b56-4682-b2d0-baa7632e662e | bioinf/Sibelia | src/lagan/src/utils/Glue.cpp | #include "MultiSequence.h"
#include "SafeVector.h"
#include "Output.h"
#include <math.h>
#include <string.h>
#include <assert.h>
#include <fstream>
#include <iostream>
#include <algorithm>
#define NUCLEOTIDE_MATRIX_FILE "nucmatrix.txt"
#define MAX_LINE_LENGTH 1024
#define CONS_RATE 70
#define INF 2000000000
#define CN... | ALGO | 0.994872 | 4.203048 |
33f85973-9d6a-429f-a839-04876eb5aee7 | sadimndr/projects | sum.cpp | #include<iostream>
using namespace std;
void my_function(int a, int b) {
int sum=a+b;
cout << "sum: " << sum << endl;
}
void reference(int &a, int &b)
{
int sum=a+b;
cout << "sum: " << sum << endl;
}
int main() {
int x = 10, y=20;
my_function(x , y);
reference(x ,y);
} | ALGO | 0.895757 | 4.406104 |
05f6ae28-639c-4445-be6b-a2675bfb4861 | ThihaThantSin777/login-form | 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 |
5e96b088-0b78-44a5-9918-e27953f41454 | alexandraback/datacollection | solutions_2700486_0/C++/dragon007/B.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <string>
using namespace std;
typedef long long LL;
typedef vector<int> VI;
typedef vector<double> VD;
typedef pa... | ALGO | 0.999329 | 3.565902 |
45c8693f-1b00-4d9f-80a8-301478605f89 | DavidLCPyML/Algorithms | codeforces/contests/UTPC/Sep08-23/f.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
#include <string>
#include <cmath>
#include <map>
#include <unordered_map>
using namespace std;
#define FOR(i, st, n) for (int i = st; i < n; i++)
#define vi vector<int>
#define vll vector<ll>
#define pii pair<int, int>
#define pll pair<ll,... | ALGO | 0.999897 | 4.172689 |
aa6f7c3a-fd37-41c2-ae23-c87321b6042a | luv2027/cp_problems | cp33.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >>n;
int ans = 0;
for(int i=1; i<(1<<10); i++){
string s(10, '0');
for(int digit = 0; digit<10; digit++){
if(i & (1 << digit)){
s[digit] = '1';
}
}
if(stoll(s) <= n){
... | ALGO | 0.999748 | 4.282017 |
69a2f907-edc8-4af9-a94d-1800009a856c | RajAditya01/STRIVER_SDE_SHEET | 13-Stack&Queues/_4_Queue_using_stack.cpp | // Implement Queue using Stack
// Problem Statement: Given a Stack having some elements stored in it. Can you implement a
// Queue using the given Stack?
// Queue: A Queue is a linear data structure that works on the basis of FIFO(First in First out). This means the element added at first will be removed first from the... | ALGO | 0.997652 | 5.895355 |
f6bb424b-0abc-4d14-88bb-a22045948bd0 | Terpodia/Competitive-Programming | Problems Solved/Codeforces/Math/Two Divisors.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set =
tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
// ordered_set<int> x; x.find_by_order(y); ... | ALGO | 0.999944 | 5.613902 |
7c071971-3980-4b3a-b587-03ffaef929fe | CodeWithIsmail/Competitive-Programming | Codeforces/C_Theofanis_Nightmare.cpp | /// *** --- || In the name of ALLAH ||| --- *** ///
/// *** --- || Author: Code_with_Ismail ||| --- *** ///
#include <bits/stdc++.h>
using namespace std;
// Data Type:
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vvi;
typede... | ALGO | 0.999969 | 4.619108 |
db665238-623d-48d5-8dd7-80106c7dc059 | SeungBeomLim/24-1_PPS-Camp | A189_임승범_20240726.cpp | // A189. 알람 시계 - Baekjoon
#include <iostream>
using namespace std;
int main() {
int H, M;
cin >> H >> M;
if (M >= 45) {
M -= 45;
} else {
M += 15;
if (--H < 0) {
H = 23;
}
}
cout << H << " " << M << endl;
return 0;
} | ALGO | 0.999874 | 5.47907 |
c74b11a5-5f68-4421-8f37-89af4d86f45d | beingzeroin/cps-8 | Karthik/Wordament/wordament.cpp | #include <stdio.h>
#include <string.h>
#include <stdbool.h>
#define N 4
char board[N][N];
bool visited[N][N];
char word[N*N +1];
int idx;
int wordCount[N*N +1];
bool isValid(int i,int j)
{
if(i<0 || i>=N)
return false;
if(j<0 || j>=N)
return false;
return true;
}
void printWordsStartingAt(in... | ALGO | 0.999655 | 3.486746 |
27ec3aee-403c-489d-a418-4b12c8a4c9ee | DASHxc/Practice-Code | Graphs/Satisfiability of Equality equations.cpp | #include<vector>
#include<unordered_map>
#include<set>
#include<queue>
#include<string>
using namespace std;
//very bad solution beats only 5% on leetcode.
// class Solution {
// public:
// bool equationsPossible(vector<string>& equations) {
// int n = equations.size();
// vector<int> graph[26];
//... | ALGO | 0.999939 | 5.271993 |
4e2bda22-cab0-4d6d-a6c8-ec84ea3feaa5 | 113bommy/PathRepair | variable_trace/cpp/cpp_code/cpp_correct/cpp_correct_test_63_7.cpp | #include <bits/stdc++.h>
using namespace std;
const int mx = 4e5 + 10;
int main() {
int n;
cin >> n;
vector<string> a(n);
for (string& x : a) cin >> x;
vector<int> bal(n), mn(n);
vector<vector<int>> occ(n), nocc(n);
for (int i = 0; i < n; i++) {
int b = 0, mn0 = 1e9;
occ[i].resize(mx * 2);
noc... | ALGO | 0.999828 | 3.897628 |
66a35f28-c277-4532-a7c4-7904b764d3d0 | RathodFahim/Apna-college-cpp-Data-structure-and-algorithm | c++_lec-14/2d_dy_arr.cpp | #include <iostream>
using namespace std;
int main(){
int rows,cols;
cout << "Enter the number of rows \n";
cin >> rows;
cout << "Enter the number of cols \n";
cin >> cols;
int **matrix = new int*[rows];
for(int i=0; i<rows; i++) {
matrix[i] = new int[cols];
}
for(int i=0; i<rows; i++) {
... | TOOL | 0.89244 | 3.159479 |
3c503466-f6e2-41c7-b08c-540651507496 | PatricLeal/Mod-EasyThreed_X1-Marlin-2.1.2 | Marlin/src/gcode/bedlevel/G35.cpp | #include "../../inc/MarlinConfig.h"
#if ENABLED(ASSISTED_TRAMMING)
#include "../gcode.h"
#include "../../module/planner.h"
#include "../../module/probe.h"
#include "../../feature/bedlevel/bedlevel.h"
#if HAS_MULTI_HOTEND
#include "../../module/tool_change.h"
#endif
#if ENABLED(BLTOUCH)
#include "../../feature/b... | TOOL | 0.975789 | 6.076293 |
1a355553-91df-45eb-a67f-b117d3f08dfc | RSathvika20/leetcode- | 990-verifying-an-alien-dictionary/verifying-an-alien-dictionary.cpp | class Solution {
public:
bool isAlienSorted(vector<string>& words, string order) {
unordered_map<char, int> rank;
for (int i = 0; i < order.size(); ++i) {
rank[order[i]] = i;
}
for (int i = 0; i < words.size() - 1; ++i) {
if (!inCorrectOrder(words[i], words[i... | ALGO | 0.99998 | 6.214765 |
0497a184-3cff-4cd5-9289-c25116d1809d | bmatejek/gsvgaps | apps/cmppfms/cmppfms.cpp | ////////////////////////////////////////////////////////////////////////
// Include files
////////////////////////////////////////////////////////////////////////
#include <string>
#include <fstream>
#include <algorithm>
#include <vector>
#include <gaps.h>
#include <GSV/GSV.h>
using namespace std;
//////////////////... | TEST | 0.943225 | 6.167161 |
a8a69a03-703c-41ea-8154-b9c067c52d0c | hosseldin/HackerRank | HackerRank_CPP_ExceptionalServer/HackerRank_CPP_ExceptionalServer.cpp | #include <iostream>
#include <exception>
#include <string>
#include <stdexcept>
#include <vector>
#include <cmath>
using namespace std;
class Server {
private:
static int load;
public:
static int compute(long long A, long long B) {
load += 1;
if (A < 0) {
throw invalid_argument("A is negative");
}
... | ALGO | 0.957017 | 4.408179 |
e079bbe2-8cf5-4c86-906d-feb42f9a08d0 | toufique-imam/SOLVED-PROBLEMS | LightOJ/LOJ 1164.cpp | /*
ID: sabertooth
LANG: C++11
TASK:
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define eps 1e-9
#define inf 0x3f3f3f3f
#define INF 2e18
#define PI acos(-1.0)
#define ff first
#define ss second
#define all(v) v... | ALGO | 0.999551 | 4.053627 |
44d600b0-d157-4ac3-ba90-f3215a2788d4 | mahfuzalhasan/WaveFormer | monai/csrc/filtering/permutohedral/permutohedral_cpu.cpp | #include <math.h>
#include <string.h>
#include <torch/extension.h>
using namespace std;
/***************************************************************/
/* Hash table implementation for permutohedral lattice
*
* The lattice points are stored sparsely using a hash table.
* The key for each point is its spatial lo... | ALGO | 0.999574 | 5.456323 |
ab160ef4-9a84-4dc3-9c32-2bb0aad24092 | raincross7/code-similarity | codes/train_code/problem154/problem154_371.cpp | #include <iostream>
using namespace std;
int main()
{
int a, b, c;
cin >> a >> b >> c;
int cnt = 0;
while (a <= b){
if (!(c % a)) cnt++;
a++;
}
cout << cnt << endl;
} | ALGO | 0.999908 | 4.0409 |
8ee67060-8fef-4afc-b0ea-8876923f3109 | FrenchCORE/Server | dep/g3dlite/source/AABox.cpp | /**
@file AABox.cpp
@maintainer Morgan McGuire, http://graphics.cs.williams.edu
@created 2004-01-10
@edited 2006-01-11
*/
#include "G3D/platform.h"
#include "G3D/AABox.h"
#include "G3D/Box.h"
#include "G3D/Plane.h"
#include "G3D/Sphere.h"
#include "G3D/BinaryInput.h"
#include "G3D/BinaryOutput.h"
namespace... | TOOL | 0.948804 | 7.86145 |
ac3d507a-2294-46f7-be5d-ad25f3783ba3 | AvijitChowdhury/C-Cplusplus-DSA | 5_Algorithm/Algorithms-II/Module 18/Building_Roads.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 5;
int parent[N];
int parentLevel[N];
void dsu_set(int n)
{
for (int i = 1; i <= n; i++)
{
parent[i] = -1;
parentLevel[i] = 0;
}
}
int dsu_find(int node)
{
while (parent[node] != -1)
{
node = parent[node];
... | ALGO | 0.999988 | 3.934209 |
e5cef182-c99f-40cd-8535-9fa40ae19c35 | hiranoo/atcoder | contests/OTHER_CONTESTS/S8PC/s8pc-4/b.cpp | #include <bits/stdc++.h>
#include <atcoder/segtree>
#include <time.h>
#define rep(i, s, t) for(int i = (s); i <= (t); i++)
#define repd(i, s, t) for(int i = (s); i >= (t); i--)
#define all(v) v.begin(), v.end()
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
typedef pair<int, int> pii;
typede... | ALGO | 0.999991 | 3.972708 |
b4168c27-aba7-4efa-9795-33542da6bef6 | Resha-Munikar/C-Programming | Recursion/3.cpp | //Program to find power of a given number
#include<stdio.h>
int power(int,int);
int main()
{
int base=0,x=0,result=0;
printf("\nEnter base and power: ");
scanf("%d%d",&base,&x);
result=power(base,x);
printf("\nThe answer is %d.",result);
return 0;
}
int power(int m,int n)
{
if(n==0)
{
return 1;
}
else
{
... | ALGO | 0.999618 | 4.976935 |
d87800c7-5114-4425-b691-bdd405252860 | shariar-opu/CFsolve | A_From_Zero_To_Y.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define time cerr << "time = " << clock() << " ms" << '\n'
#define optimize() \
ios_base ::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define pb push_back
#define pp pop_back
#define... | ALGO | 0.999828 | 4.464667 |
07b4ddee-3668-4e44-8986-3a1507260e98 | DutchKevv/GameEngine2 | lib/boost_1_76_0/libs/msm/example/mpl_graph/depth_first_search.cpp | #include <boost/msm/mpl_graph/depth_first_search.hpp>
#include <boost/msm/mpl_graph/adjacency_list_graph.hpp>
#include <boost/msm/mpl_graph/incidence_list_graph.hpp>
#include <iostream>
namespace mpl_graph = boost::msm::mpl_graph;
namespace mpl = boost::mpl;
// vertices
struct A{}; struct B{}; struct C{}; struct D{}... | ALGO | 0.986823 | 6.189459 |
bfc7ac42-06da-4221-a9bc-82759a6eac25 | Imraan002/My-c-programs | perfect_subarray.cpp | #include <bits/stdc++.h>
using namespace std;
bool isperfect(int num)
{
int sum=0;
for(int i=1;i<num;i++)
{
if(num%i==0)
{
sum=sum+i;
}
}
if(sum==num)
return true;
else
return false;
}
int solve(int arr[],int n,int k)
{
int sum=0;
int ans=INT_MIN;
int i=0;
for(int i=0;i<n;i++)
{
if(isperfect(a... | ALGO | 0.999955 | 4.596683 |
caca5689-c5cd-4f79-b219-4791429ae5c3 | yyeureka/Leetcode | C++/796_rotate_string.cpp | #include <string>
using namespace std;
/*
We are given two strings, A and B.
A shift on A consists of taking string A and moving the leftmost character to the rightmost position. For example, if A = 'abcde', then it will be 'bcdea' after one shift on A. Return True if and only if A can become B after some number of sh... | ALGO | 0.999919 | 5.564952 |
4823a05f-b355-4d0a-8e3b-fac8407045e4 | BeyondSword/JPAT | Src/1141.cpp | #include<iostream>
#include<algorithm>
#include<vector>
#include<map>
using namespace std;
const int MAXN=100001;
void str_cov(string &s){
for(int i=0; i<s.size(); i++){
if(s[i]>='A'&&s[i]<='Z'){
s[i] = s[i] - 'A' + 'a';
}
}
}
struct School{
int rank;
string name;
doub... | ALGO | 0.999204 | 4.157781 |
aa6cc7bd-1dfb-4740-aa28-c428decdf6b0 | GustavoPolicarpo/maratona | URI/AD-HOC/1104 - Exchanging Cards.cpp | // Author: Gustavo Policarpo
// Name: Exchanging Cards
// Level: 4
// Category: AD-HOC
// URL: https://www.beecrowd.com.br/judge/en/problems/view/1104
#include<bits/stdc++.h>
//LIFE IS NOT A PROBLEM TO BE SOLVED
using namespace std;
int main()
{
int A, B;
long int C[100000];
while(cin >> A >> B)
{
if(A==0&&B=... | ALGO | 0.999533 | 3.535565 |
91b48e68-9afb-45b8-9c1c-a5d4ed2b2f10 | A-BCDe/BOJ-Solutions | Problems/17244.cpp | #include <stdio.h>
#include <map>
#include <queue>
#include <vector>
using namespace std;
struct pos {
int x, y;
bool operator()(pos const& a, pos const& b) const {
return a.x < b.x || (a.x == b.x && a.y < b.y);
}
};
struct elem { pos p; int obj, cnt; };
int main() {
int n, m;
scanf("%d%d", &m, &n);
auto a = ne... | ALGO | 0.999618 | 3.185896 |
0e0be42c-9fd5-4576-a6b3-dfd78350a9ea | ichenyy/luogu | P5705.cpp | #include <iostream>
using namespace std;
int main()
{
char input[5];
cin >> input;
for (int i = 5; i >= 0; i--)
{
cout << input[i];
}
cout << endl;
return 0;
}
| ALGO | 0.990197 | 3.307356 |
521e9350-55af-44cd-b9a9-5267c4affc2e | TDexterMorse/AnadrosPilotMD | Gromacs_Head/Gromacs_Base/gromacs-2024.1/src/gromacs/gmxpreprocess/gen_maxwell_velocities.cpp | #include "gmxpre.h"
#include "gen_maxwell_velocities.h"
#include <cmath>
#include "gromacs/math/units.h"
#include "gromacs/math/vec.h"
#include "gromacs/math/vectypes.h"
#include "gromacs/random/tabulatednormaldistribution.h"
#include "gromacs/random/threefry.h"
#include "gromacs/topology/mtop_atomloops.h"
#include ... | ALGO | 0.997926 | 5.524472 |
5bd41593-9020-4b9e-934b-c61c32d35bd0 | nikhilmehlan/Dsa | 0023-merge-k-sorted-lists/0023-merge-k-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* mergeKLists... | ALGO | 0.999929 | 5.957179 |
919ed1bc-641c-4401-a2be-30a3317f7b50 | mdehtesham77/cplusplus | ARRAY QUESTIONS/q4.cpp | // Write a program to print the position of the largest number from n numbers of arrays.
#include<iostream>
using namespace std;
largest_num(int arr[],int n)
{
int large=arr[0];
for(int i=1; i<n;i++)
{
if(arr[i]>large)
{
large = arr[i];
}
}
// for second lar... | ALGO | 0.999975 | 4.260975 |
7b1b75cf-a3f2-42b5-b299-443b2f906420 | ravireddy07/cpp-book | src/Code-Chef/PPNUM.cpp | #include <cstdio>
#include <iostream>
int main(){
const long long MOD = 1000000007;
const int N = 10;
int t; scanf("%d\n", &t);
while(t--){
long long a, b; scanf("%lld %lld\n", &a, &b);
long long pow(1);
int numDigits(1);
long long total(0);
for(int p = 1; p < N... | ALGO | 0.999061 | 4.499743 |
b93b5fb4-7521-4bea-9adc-d72b7e5d390e | Jayasurya2005gh/Leetcode | 17-letter-combinations-of-a-phone-number/letter-combinations-of-a-phone-number.cpp | class Solution {
public:
void solve(vector<string> &ans,int index,string &output,string &digits,vector<string> &mapping)
{
if(index >= digits.length())
{
ans.push_back(output);
return;
}
int digit = digits[index] - '0';
string val = mapping[digit];
for(int i = 0; i<val.length()... | ALGO | 0.999972 | 6.7847 |
5a22e145-6127-4c03-b2ab-3b0caa466a0e | chezming/opengauss_openGauss-graph | src/gausskernel/storage/access/ubtree/ubtpage.cpp | #include "postgres.h"
#include "knl/knl_variable.h"
#include "access/hio.h"
#include "access/nbtree.h"
#include "access/ubtree.h"
#include "access/transam.h"
#include "access/xlog.h"
#include "access/xloginsert.h"
#include "miscadmin.h"
#include "storage/freespace.h"
#include "storage/indexfsm.h"
#include "storage/lmg... | TOOL | 0.976302 | 7.188289 |
3baa210a-3e7c-4192-843b-14a22a7d6945 | MissAashnaa1/DSA-Questions | 0050-powx-n/0050-powx-n.cpp | class Solution {
double m(double x, int n) {
// Your code goes here
if(n==0)return 1;
if(n<0){
n=abs(n);
x=1/x;
}
if(n%2)
return m(x,n-1)*x;
else return m(x*x,n/2);
}
public:
double myPow(double x, int n) {
// Your code goes here
... | ALGO | 0.999928 | 5.742325 |
37de1420-47f8-4843-a2d2-95b757256503 | gargpb31/LeetCode | 1319-number-of-operations-to-make-network-connected/1319-number-of-operations-to-make-network-connected.cpp | class DSU{
public : vector<int> parent,rank;
DSU(int size)
{
parent.resize(size);
rank.resize(size,1);
for(int i=0; i<size; i++)
{
parent[i]=i;
}
}
int findpar(int node)
{
if(parent[node]==node) return node;
return parent[no... | ALGO | 0.999873 | 5.391039 |
25eaff19-bb7b-4b8f-924c-33eb0141aa3f | amironi/Interviews | stockBuySell.cpp | // This function finds the buy sell schedule for maximum profit
void stockBuySell(int price[], int n)
{
// Prices must be given for at least two days
if (n == 1)
return;
int count = 0; // count of solution pairs
// solution vector
Interval sol[n/2 + 1];
// Traverse through given pr... | ALGO | 0.999908 | 5.32122 |
c1f453a5-ae94-4fcd-9009-e915262ce2ff | gengtsh/darts-heterogeneous | omp2cd-master3/darts-x86/example/Lulesh/Lulesh_v1T/tmp/6/CalcTimeConstraintsForElemsTP.cpp | #include "CalcTimeConstraintsForElemsTP.h"
#include "CalcCourantConstraintForElemsTP.h"
#include "CalcHydroConstraintForElemsTP.h"
void CalcTimeConstraintsForElemsCD::fire(void)
{
LOAD_FRAME(CalcTimeConstraintsForElemsTP);
Domain *domain=FRAME(domain);
Index_t *courant_elem_per_thread =FRAME(courant_elem_per_threa... | ALGO | 0.982725 | 5.07674 |
8aaad471-bbb8-4628-aff1-b6017375af74 | ishandutta2007/codeforces | retro3014/normal/987/D.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <deque>
using namespace std;
#define MAX_N 100000
#define MAX_K 100
int N, M, K, S;
vector<int> gp[MAX_N+1];
int arr[MAX_N+1];
int t;
bool visited[MAX_N+1];
vector<int> type[MAX_K+1];
vector<int> ans[MAX_N+1];
deque<int> dq;
int main()
{
cin>>N>... | ALGO | 0.999959 | 3.538882 |
6f60c3b2-8318-4675-ac1e-91d1557c9440 | dokkev/Whisker-Based-Tactile-Sensing-and-Shape-Classification | code/bulletlib/src/BulletCollision/Gimpact/gim_box_set.cpp | #include "gim_box_set.h"
GUINT GIM_BOX_TREE::_calc_splitting_axis(
gim_array<GIM_AABB_DATA> & primitive_boxes, GUINT startIndex, GUINT endIndex)
{
GUINT i;
btVector3 means(btScalar(0.),btScalar(0.),btScalar(0.));
btVector3 variance(btScalar(0.),btScalar(0.),btScalar(0.));
GUINT numIndices = endIndex-startIndex;... | ALGO | 0.999924 | 6.127942 |
5fb53d8f-abbd-45ea-965c-0094ed475a26 | Shubham56-droid/CodeChef | triangleAng.cpp | #include<iostream>
using namespace std;
int main()
{
float a,b,c;
cin>>a>>b>>c;
if( ((a+b+c) == 180) && (a!=0) && (b!=0) && (c!=0))
{
cout<<"YES\n";
}
else
{
cout<<"NO\n";
}
return 0;
} | ALGO | 0.99983 | 3.730679 |
14fb5fab-4e2e-44b4-8e2c-fdbf93a26d34 | darrylys/spoj | MATHII.cpp | #include<stdio.h>
#define ll long long
int main() {
ll N;
ll sum;
int c = 1;
while (scanf("%lld", &N) != -1) {
sum = 0;
for (int a=1; (ll)a*a*a<=N; ++a) {
// b==a
sum += 1;
sum += 3LL*(N/((ll)a*a)-a);
... | ALGO | 0.999673 | 3.475335 |
d90499e9-4b5c-44af-ba35-9a8006162c1d | Gamer64ytb/Yuzu-Backup | yuzu-master/src/common/zstd_compression.cpp | #include <algorithm>
#include <zstd.h>
#include "common/zstd_compression.h"
namespace Common::Compression {
std::vector<u8> CompressDataZSTD(const u8* source, std::size_t source_size, s32 compression_level) {
compression_level = std::clamp(compression_level, 1, ZSTD_maxCLevel());
const std::size_t max_compr... | TOOL | 0.866472 | 7.41339 |
d057062d-1e64-4f8c-abfb-0f65358c283d | Snigdha-Gayathri/C-Programs | GFG160/Day31.cpp | class Solution {
public:
int peakElement(vector<int> &arr) {
// Your code here
int n=arr.size();
int low=0;
int high=n-1;
while(low<=high)
{
int mid=low + (high-low)/2;
bool leftOk= (mid==0) || (arr[mid]>arr[mid-1]);
... | ALGO | 0.999905 | 5.356688 |
9996b44c-a203-4244-8dd2-a18f15eead5a | kaziabdullahfuad/Codeforces-Grind | upsolving/maximumsum.cpp | #include<iostream>
#include<cmath>
#include<algorithm>
#include<string>
#include<vector>
#include<set>
#include<unordered_set>
#include<unordered_map>
#include<map>
using namespace std;
#define ll long long
#define endl "\n"
#define debug(x) cout<<#x<<":"<<x<<endl;
#define all(x) (x).begin(),(x).end()
template<typename... | ALGO | 0.999872 | 4.344318 |
df96e498-d531-4c67-b120-c336e53da923 | alishaac/.cpp | 32_exercise_inheritance.cpp | #include <iostream>
using namespace std;
class simpleCalculator
{
protected:
float sum;
float difference;
float product;
float division;
float a, b;
public:
void set_sum(float x, float y)
{
a = x;
b = y;
sum = x + y;
}
void set_difference(float x, float y)
... | TOOL | 0.973068 | 5.235879 |
fed06b03-1bab-4f39-8df6-cf4eeb795d29 | wazidu/solved-problems | code force compote.cpp | #include<bits/stdc++.h>
#include<math.h>
using namespace std;
int main()
{
int m,n,k,l;
cin>>m>>n>>k;
l= 7*min(m,min(n/2,k/4));
cout<<l<<endl;
return 0;
}
| ALGO | 0.999862 | 3.103873 |
96360367-e404-43fa-b901-18b2c025fa34 | riu-shimizu/ising_tsp | src/cost_function.cpp | #include "mylib.h"
#include "cost_function.h"
#include <cassert>
#include <vector>
using namespace std;
Graph reverse(const Graph& G) {
const int n = G.size();
Graph revG(n);
rep(i, n) for (auto&& e : G[i]) {
revG[e.to].emplace_back(i, e.weight);
}
return revG;
}
CostFunction::CostFunction(const Graph&... | ALGO | 0.999729 | 4.210706 |
5f66de98-9ce3-405d-ae8e-2d10fa5e0b14 | SnehaBakshi14/LeetCode | 2163-kth-distinct-string-in-an-array/kth-distinct-string-in-an-array.cpp | class Solution {
public:
string kthDistinct(vector<string>& arr, int k)
{
unordered_map<string, int> mp;
for(string &s : arr) {
mp[s]++;
}
int count = 0;
for(string &s : arr) {
if(mp[s] == 1) {
count++;
if(count ... | ALGO | 0.999903 | 5.923772 |
0db01470-2bb6-4a52-a2f1-c20639438f2e | yujincheng08/ZJU-UGCourse | ADS/P7/main.cpp | #include <iostream>
#include <algorithm>
template<typename T, class U>
class AVLTree;
template<typename T, class U = std::less<T>>
class AVL
{
friend class AVLTree<T, U>;
public:
T &getElement() const;
private:
AVL(const T &element, U &compare);
AVL<T,U> *insert(const T &element);
static ssize_t ... | ALGO | 0.999861 | 4.262555 |
bdc3a733-fed7-4862-a071-aee7e73173de | prakhartp/codingNinjasProj | Lib/CountingSort.cpp | //Implementing Counting sort( little broken code)(but does sort all except for highest value)
#include<iostream>
using namespace std;
int main(){
int max;
int size = 10;
int* arr = new int[size];
cout<<"Enter your max range value of the numbers to be entered -> ";
cin>>max;
for(int i = 0 ; i < size ; i++){
... | ALGO | 0.999846 | 4.153049 |
d2c1fe03-2b5d-45ed-9801-018841603d57 | Chandan157/CPP | 2-Searching & Sorting/Sorting/comparator_sort.cpp | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
bool comp(int a, int b) {
return a < b;
}
int main()
{
vector<int> arr = {5,3,6,4,9};
// sort(arr.begin(), arr.end());
//comparator sort
sort(arr.begin(), arr.end(), comp);
for(auto it: arr) {
cout << it <<... | ALGO | 0.999902 | 5.14097 |
c3ea23d2-baff-42a5-94fc-1e13da4d76ec | andreiarnautu/Algorithmic-Problems | ecu.cpp | /**
* Worg
*/
#include <cstdio>
#define lsb(i) (i & (-i))
using namespace std;
FILE *fin = freopen("ecu.in", "r", stdin);
FILE *fout = freopen("ecu.out", "w", stdout);
const int MAX_LOG = 1 + 30;
const int MAX_N = 1 + 20;
/*-------- Input data --------*/
int N, M;
long double x[MAX_N], p[MAX_N], y[MAX_N];
/*--... | ALGO | 0.999967 | 3.399957 |
35bf10cf-641e-48d3-b757-bfdeb3fce2ca | khanhduyvt0101/BlasterMaster | Game/Centipede.cpp | #include "Centipede.h"
#include "Brick.h"
Centipede::Centipede(float x, float y, LPGAMEENTITY t)
{
SetState(CENTIPEDE_STATE_WALKING);
enemyType= CENTIPEDE;
this->x = x;
this->y = y;
nx = -1;
isFollow = 0;
this->target = t;
health = CENTIPEDE_MAXHEALTH;
isActive = false;
alpha = 255;
}
void Centipede::GetBoun... | TOOL | 0.97591 | 4.393388 |
2e9d8016-3a7a-43a5-9efe-873ee7b56b04 | MochammadBismaPrasetya/Dasar-pemrograman | STR04.cpp |
#include <iostream>
#include <conio.h>
#include <string.h>
using namespace std;
int main()
{
char Str1[100]="AAAAA";
char Str2[100]="AAAAA";
cout<<strcmp(Str1,Str2)<<endl;
strcpy(Str1,"ADBBB");
strcpy(Str2,"ABDDD");
cout<<strcmp(Str1,Str2)<<endl;
strcpy(Str1,"ABBBB");
strcpy(Str2,"ADDDD");
... | ALGO | 0.998431 | 3.276844 |
cc638aec-e858-4f3c-8f28-aeb631a178c4 | bony2023/Competitive-Programming | Graph Algorithms/DFS/Articulation Points and Bridges/002 UVA - 315 Network.cpp | // Author : Bony Roopchandani
// 315 - Network
// Articulation Points on Graph
#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<map>
#include<list>
#include<set>
#include<vector>
#include<queue>
#include<stack>
#include<string>
#include<algorithm>
using namespace std;
#d... | ALGO | 0.9993 | 3.988247 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.