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 |
|---|---|---|---|---|---|---|
adfced47-5cb0-45b8-82ca-bbd8b093c55f | Avdhesh-Varshney/CPMasterLog | CodeChef/Practice-Problem/BUDGET_.cpp | // Monthly Budget
// Problem Code - BUDGET_
// https://www.codechef.com/problems/BUDGET_
// Solution:
#include <iostream>
using namespace std;
int main() {
// your code goes here
int t;
cin >> t;
for(int i = 0; i < t; i++) {
int x, y;
cin >> x >> y;
if(x >= (30*y))
cout << "yes\n";
el... | ALGO | 0.999895 | 4.432734 |
5a54cade-64fd-4479-96a0-a44db8826bef | smostafa2001/DataStructure-AlgorithmSources | C++/SortingAlgos/SortingAlgos.CountingSortAlgo/SortingAlgos.CountingSortAlgo.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
void countingSort(vector<int>& inputArray)
{
int maxElement = *max_element(inputArray.begin(), inputArray.end());
int minElement = *min_element(inputArray.begin(), inputArray.end());
int range = maxElement - minElement + 1;
vector<int... | ALGO | 0.999431 | 4.559327 |
671cae58-34b4-4dac-90b1-96b5b83e4b6b | PozzettiAndrea/Linear-Solver-Library | Matrix.cpp | #include <iostream>
#include <math.h>
#include "Matrix.h"
#include <float.h> //For DBL_MAX
#include <numeric>
#include <vector>
using namespace std;
// Constructor - using an initialisation list here
template <class T>
Matrix<T>::Matrix(int rows, int cols, bool preallocate) : rows(rows), cols(cols), size_of_values(ro... | ALGO | 0.999868 | 5.142705 |
c2bf976d-9ff6-416a-a5ad-757160039c82 | VijayNegi/LeetHub | 1161-maximum-level-sum-of-a-binary-tree/1161-maximum-level-sum-of-a-binary-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.99999 | 6.573569 |
a1ec68db-a55d-40a2-ae25-c6e69fe453cb | ishandutta2007/codeforces | ztxz16/normal/596/B.cpp | #include <map>
#include <set>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int n;
int main() {
//freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
scanf("%d", &n);
int last = 0;
long long ans = 0;
for ... | ALGO | 0.999874 | 3.636315 |
0c052e89-7cdd-4fbb-8a34-a11b1a3e7b05 | GauravJha-Git/CPP | gfg/Tree/87.cpp | /***************************************************************
🧾 Problem: Maximum Path Sum from Any Node in a Binary Tree
Given a binary tree, find the maximum path sum.
The path can start and end at any node. Each node can be used at most once.
🔹 Constraints:
- 1 ≤ number of nodes ≤ 10^3
- -10^4 ≤ node->data ≤ ... | ALGO | 0.999992 | 6.650992 |
06b64b47-a3d4-4c7d-aa1a-15221cfa06dd | atlarge-research/graphalytics-platforms-graphmat | src/main/c/conn.cpp | #include "GraphMatRuntime.h"
#include "common.hpp"
#include <limits>
#include <omp.h>
#include <stdint.h>
#include <algorithm>
#include <iostream>
#include <chrono>
#ifdef GRANULA
#include "granula.hpp"
#endif
using namespace std;
typedef int32_t component_type;
typedef component_type msg_type;
typedef component_ty... | ALGO | 0.99422 | 5.270971 |
9063b4cf-df1c-4fa7-9453-1fd43c23dc1d | gitlarky/PoreDy | include/Eigen/bench/perf_monitoring/gemm/gemm.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <Eigen/Core>
#include "../../BenchTimer.h"
using namespace Eigen;
#ifndef SCALAR
#error SCALAR must be defined
#endif
typedef SCALAR Scalar;
typedef Matrix<Scalar,Dynamic,Dynamic> Mat;
EIGEN_DONT_INLINE
void gemm(const Mat &A, const Mat &B, Mat &C)
{... | TEST | 0.985885 | 5.689105 |
1c062d58-53d0-4b56-84e1-ee06ee4968be | jero1112/Belajar-C-plus-plus | C++/array01.cpp | #include <iostream>
using namespace std;
main() {
float nilai[3], total;
//input nilai
for (int i=0; i < 3; i++) {
cout << "Nilai ke " << i+1;
cout<<" = ";
cin >> nilai[i];
}
//jumLahkan: nilai
for (int i=0; i < 3; i++) {
total += nilai[i];
}
cout << "Nilai Akhir " << total / 3;
}
| ALGO | 0.972093 | 3.231592 |
ddffb16f-23f7-4c57-a492-91845bf28364 | GGLL2019/Data-Structures-and-Algorithms | NiuKe/位运算/8_4_compare.cpp | /**
* @brief 位运算,比较
* @email <EMAIL>
* @date 2019.10.09
*/
/*
* 题目:
* 对于两个32位整数a和b,请设计一个算法返回a和b中较大的。但是不能用任何比较判断。
* 若两数相同,返回任意一个。给定两个整数a和b,请返回较大的数。
* */
#include <iostream>
#include <algorithm>
using namespace std;
int32_t flip(int32_t n)
{
return n^1;
}
int32_t sign(int32_t n)
{
return flip((n... | ALGO | 0.999824 | 4.826648 |
de548649-9b52-4f5b-98a3-234effad257c | lechenyu/Arbalest-Vec | bolt/lib/Passes/ReorderAlgorithm.cpp | #include "bolt/Passes/ReorderAlgorithm.h"
#include "bolt/Core/BinaryBasicBlock.h"
#include "bolt/Core/BinaryFunction.h"
#include "llvm/Support/CommandLine.h"
#include <queue>
#include <random>
#include <stack>
#undef DEBUG_TYPE
#define DEBUG_TYPE "bolt"
using namespace llvm;
using namespace bolt;
namespace opts {
... | ALGO | 0.999514 | 6.643925 |
c76d319b-fc7d-40c0-b4c6-4a15d016c3b3 | coelien/codeforces | lanqiao/tree_array.cpp | //
// Created by sixwa on 2023/2/14.
//
#include<iostream>
#include<algorithm>
using namespace std;
const int N = 10010;
const int M = 1000010;
int stars[N], tri[M];
int lowbit(int x) {
return x & (-x);
}
void add_v(int x, int v) {
for (int i = x; i <= M; i += lowbit(i)) tri[i] += v;
}
int sum_x(int x) {
... | ALGO | 0.999871 | 3.85019 |
a39b5ce4-0be6-4cb5-a71f-0a445637838b | Calix-Kim/Black-Scholes-Formula | BlackScholes/bs_analytic.cpp | #include "bs_analytic.h"
#include "normal.h"
#include <cmath>
#include <iostream>
double bsprice(double s, double k, double r, double q, double t, double sigma, OptionType type) { //call:type = +1 or put:type = -1
double d1 = (std::log(s / k) + (r - q + 0.5 * sigma * sigma) * t) / (sigma * std::sqrt(t));
double d2... | ALGO | 0.999977 | 6.329932 |
3078d707-00ad-4091-86ad-b528b3c5c7bc | AkashMarkad/Hacktoberfest-2022 | inorder.cpp | // C++ program for different tree traversals
#include <bits/stdc++.h>
using namespace std;
/* A binary tree node has data, pointer to left child
and a pointer to right child */
struct Node {
int data;
struct Node *left, *right;
};
// Utility function to create a new tree node
Node* newNode(int data)
{
Node* temp =... | ALGO | 0.999985 | 6.679837 |
5ce660eb-9c0f-465f-ace3-8a952ec75606 | Ynjxsjmh/PracticeMakesPerfect | LeetCode/p0050/I/50-powx-n.cpp | double myPow(double x, int n) {
if (n == 0) {
return 1;
}
if (n == 1) {
return x;
}
if (n == -1) {
return 1/x;
}
return myPow(x*x, n/2) * (n%2==0?1:n>0?x:1/x);
} | ALGO | 0.999815 | 5.863174 |
fd13919a-9441-4f18-8efa-f21fde633aff | Nanored4498/Code-Forces | GYM/446582F.cpp | #include <iostream>
#include <vector>
#include <numeric>
using namespace std;
using vi = vector<int>;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t; cin >> t;
while(t--) {
int n, k; cin >> n >> k;
int g = 0;
vi c(n);
for(int &x : c) {
cin >> x;
g = gcd(g, x);
}
if(n == 1 || ... | ALGO | 0.999984 | 3.593064 |
8f45264b-ae91-4702-b91c-dac42c027290 | alexandraback/datacollection | solutions_5669245564223488_0/C++/aditsu/B_train_cars.cpp | #include <iostream>
#include <algorithm>
using namespace std;
bool isValid(string s) {
bool f[26];
for (int i = 0; i < 26; ++i) {
f[i] = false;
}
for (int i = 0; i < s.length(); ++i) {
char c = s[i];
if (f[c - 'a'] && c != s[i - 1]) {
return false;
}
f[c - 'a'] = true;
}
return true;
}
int main() ... | ALGO | 0.999897 | 4.331729 |
82d819f7-e54b-49fc-87c7-600434f09792 | khushbujain41709/CPP-DSA | Coding/stack/balancedBracket.cpp | // Leetcode - 20
// )( is a unbalanced bracket sequence.
// If we concatenate 2 strings which are balanced then results will be balanced.
// If we wrap a balanced string with a pair of brackets then results is also balanced.
// Time Complexity(Worst) - O(n)
// Space Complexity(Worst) - O(n)
#include<iostream>
#include<... | ALGO | 0.998757 | 6.031352 |
253f84d3-f805-4d6d-a244-824b124da92b | HONG-LOU/training | Daily_Training/23-12/10/c.cpp | /**
* author: HONG-LOU
* created: 2023-12-10 14:00:36
**/
#include <bits/stdc++.h>
auto main () -> int {
std::cin.tie(nullptr) -> std::ios::sync_with_stdio(false);
int tt;
std::cin >> tt;
while (tt--) {
int n;
std::cin >> n;
std::string s;
std::cin >> s;
std::vector<int> c(26, 0);... | ALGO | 0.999919 | 5.435226 |
77d702b9-353e-49d3-a993-97e12f03ef89 | adorableChowhound/translation_app | nmt/tools/mosesdecoder/moses/ChartCell.cpp | // $Id$
// vim:tabstop=2
#include <algorithm>
#include "ChartCell.h"
#include "ChartCellCollection.h"
#include "HypergraphOutput.h"
#include "RuleCubeQueue.h"
#include "RuleCube.h"
#include "Range.h"
#include "Util.h"
#include "ChartTranslationOptions.h"
#include "ChartTranslationOptionList.h"
#include "ChartManager.h... | ALGO | 0.921065 | 6.262963 |
4eb941f7-2a43-4d07-9a37-dc75aea20f21 | A032003/Problem_of_the_Day_Solution | Sum of All Subset XOR Totals-20_May_2024.cpp | class Solution {
public:
void solve(vector<int> nums, vector<int> output, vector<vector<int>>& ans,
int index) {
if (index >= nums.size()) {
ans.push_back(output);
return;
}
solve(nums, output, ans, index + 1); // exclude
// include
in... | ALGO | 0.999995 | 5.901875 |
2c77bba0-1226-4057-909a-1ef41953df99 | xiongyongfeng/datastructure | cpp_binary_tree/main.cpp | #include "BinaryTree.h"
#include "BalanceTree.h"
#include <iostream>
void print_val(int x)
{
std::cout << x << " ";
}
int main()
{
BinaryTree tree;
tree.Insert(15);
tree.Insert(48);
tree.Insert(25);
tree.Insert(37);
tree.Insert(23);
tree.Insert(45);
tree.Insert(47);
tree.Insert(67);
tree.MidOrdT... | ALGO | 0.983491 | 4.646199 |
86a0ea64-d676-466a-94e4-f622117265a3 | Ibn-Omar-Romel/Competitive_Programming_Codeforces | B_Swap_and_Delete.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define yes cout << "YES\n"
#define no cout << "NO\n"
#define ain cin >> arra[i]
#define aout cout << arra[i]
#define vin cin >> vec[i]
#define vout cout << vec[i]
#define ccount cout << count << '\n'
#define cp count++
#define vsort sort( vec.beg... | ALGO | 0.999808 | 4.70571 |
c8ac500c-9306-4058-8d33-63ee40fc6df3 | rubywai/Flutter-Weather-with-Provider- | 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.998693 | 6.797273 |
acc93613-0f2c-410c-bdb3-a6337b2c9ad9 | KomalDhanwani-ai/problem-solving-with-cpp | 258-add-digits/add-digits.cpp | class Solution {
public:
int addDigits(int num) {
while(num>=10)
{
int sum = 0;
while(num>0)
{
sum = sum +num%10;
num = num / 10;
}
num = sum;
}
return num;
}
}; | ALGO | 0.999854 | 6.247716 |
b537551a-2848-4179-9ab1-f1f05e3d7665 | BlitzMaxModules/bah.mod | tesseract.mod/src/ccstruct/normalis.cpp | #include "mfcpch.h" // Precompiled header include must be first.
#include "normalis.h"
#include <stdlib.h>
#include "allheaders.h"
#include "blobs.h"
#include "ocrblock.h"
#include "werd.h"
DENORM::DENORM() {
Init();
}
// TODO(rays) Abolish all non-default constructors.
DENORM::DENORM(float x, float scaling, RO... | TOOL | 0.852287 | 5.432755 |
02baf992-4ddc-48f1-9543-5e7a9ebc4b28 | dhankb/practice | cpp/0114_Flatten_Binary_Tree_to_Linked_List.cpp | #include <iostream>
#include <string>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <stack>
#include <deque>
#include <list>
#include <map>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(nullptr), right(nul... | ALGO | 0.999988 | 5.911489 |
53edb2b8-79cf-4f23-ad20-31596ad88501 | fevilla/implementation-of-the-data-structure | ICPC/DinamycPrograming/1D_RSQ.cpp/uva-11456.CPP | #include<bits/stdc++.h>
using namespace std;
int A[2000+5];
int main()
{
int kases;
scanf("%d" , &kases);
for(int i = 0 ; i < kases ; i++)
{
int nodes;
scanf("%d" , &nodes);
int LIS[nodes+5];
LIS[0] = 1;
int LDS[nodes+5];
LDS[0] = 1;
int ans = ... | ALGO | 0.999917 | 3.387203 |
f3001ca1-7b74-474e-adc6-6fdadcbb7872 | ThePeeps191/ccc25senior | S4.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, pii> state;
const ll INF = LLONG_MAX;
const int N_MAX = 2e5 + 5;
int n, m;
ll ans = INF;
vector<pii> adj[N_MAX];
priority_queue<state, vector<state>, greater<state>> pq;
map<pii, ll> dist;
int main() {
... | ALGO | 0.999895 | 4.544638 |
5d105f6a-caeb-457b-9a8d-4790aaa0b83a | vlsi-test-lab/OpenEDA | packages/eigen-eigen-323c052e1731/bench/perf_monitoring/gemm/gemm.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <Eigen/Core>
#include "../../BenchTimer.h"
using namespace Eigen;
#ifndef SCALAR
#error SCALAR must be defined
#endif
typedef SCALAR Scalar;
typedef Matrix<Scalar,Dynamic,Dynamic> Mat;
EIGEN_DONT_INLINE
void gemm(const Mat &A, const Mat &B, Mat &C)
{... | TEST | 0.980145 | 5.689105 |
fbc82bc1-8811-4ecf-bad4-cb094f0a70d2 | ishandutta2007/codeforces | tabr/normal/1733/E.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int tt;
cin >> tt;
while (tt--) {
long long t;
int x, y;
cin >> t >> x >> y;
if (t < x + y) {
... | ALGO | 0.999693 | 4.206184 |
15820be8-5a8d-4a08-9e27-b39897077808 | naqeeb9a/V-store | 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.998693 | 6.797273 |
db457e27-3ddc-44be-bfd2-bcbf56f17558 | ibrahimmar2/08---Algorithms-Problem-Solving-Level-4 | 0x03_Line_Code_Leap_Year.cpp | #include <iostream>
using namespace std;
int ReadYear()
{
int Year;
cout << "Please enter to year?" << endl;
cin >> Year;
return Year;
}
/*
*
bool IsLeapYear(int Year)
{
if (Year % 400 == 0)
return true;
else if (Year % 100 == 0)
return false;
else if (Year % 4 == 0)
return true;
else
return false;
}... | ALGO | 0.999723 | 3.261834 |
aace9f04-7b9e-4b2d-bc43-f0adcf3c8d7b | dl8sd11/online-judge | 0contest/ABC_151/pA.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<int, ll> pil;
typedef pair<ll, int> pli;
typedef pair<double,double> pdd;
#define SQ(i) ((i)*(i))
#define MEM(a, b) memset(a, (b), sizeof(a))
#define SZ(i) int(i.size())
#define FOR(i, ... | ALGO | 0.982175 | 3.165961 |
118ef1f3-04de-461a-bd49-78957550b327 | PradanyaBoro/Programming_Languages_and_Data_Strucutres_CPP | Codes/NumberOfDivisors.cpp | /*---num of divisors of n----*/
#include<iostream>
using namespace std;
int numFact(int n)
{
int count = 0;
for(int i = 1; i <= n; i++)
{
if(n % i == 0)
count += 1;
}
return count;
}
int main()
{
int n;
cout << "Enter your number:\n";
cin >> n;
int nums = numFact(n);
cout << "Number of divisors of ... | ALGO | 0.998468 | 5.461899 |
30b4d84c-0483-47f7-9b69-0548e740ed8c | roles/algorithms | leetcode/uniquePath.cpp | #include <iostream>
/*
* 递推
*/
using namespace std;
class Solution {
public:
int uniquePaths(int m, int n) {
int* d = new int[n];
for(int i = 0; i < n; i++)
d[i] = 1;
for(int i = 1; i < m; i++){
for(int j = 1; j < n; j++){
... | ALGO | 0.999918 | 5.491406 |
bc0329b9-20d7-4bcc-90e8-7fcaad83b70d | pxn1310572236/BVCoin | src/key.cpp | #include <map>
#include <openssl/ecdsa.h>
#include <openssl/obj_mac.h>
#include "key.h"
// Generate a private key from just the secret parameter
int EC_KEY_regenerate_key(EC_KEY *eckey, BIGNUM *priv_key)
{
int ok = 0;
BN_CTX *ctx = NULL;
EC_POINT *pub_key = NULL;
if (!eckey) return 0;
const EC_... | TOOL | 0.959335 | 7.315616 |
b5b1e56e-9dc5-4359-9123-e50170930213 | AffaganoIsTheWay/Matrix_Multiplication | MPI/block_level.cpp | #include <iostream>
#include <mpi.h>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <algorithm>
using namespace std;
void MatrixMultiplication(int* A, int* B, int* C, int n, int m, int p) {
// Multiply matrices
for (int i = 0; i < n; ++i) {
for (int j = 0; j < p; ++j) {
for ... | ALGO | 0.999948 | 4.629794 |
5e42da48-eeb7-4e35-94da-b14736224571 | keshavsingla015/LeetCode-Solutions | Median in a row-wise sorted Matrix - GFG/median-in-a-rowwise-sorted-matrix.cpp | //{ Driver Code Starts
//Initial template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
int median(vector<vector<int>> &matrix, int R, int C){
// code here
vector<int> v ;
for(int i... | ALGO | 0.999968 | 5.718686 |
295ed8ad-47a4-44bd-b9e7-b67341b828cf | vmos-dev/open-vmos-aosp_5.1 | bionic/libc/bionic/tdestroy.cpp | #define _SEARCH_PRIVATE
#include <search.h>
#include <stdlib.h>
void tdestroy(void* root, void (*destroy_func)(void*)) {
node_t* root_node = (node_t*) root;
if (root_node == NULL) {
return;
}
if (root_node->llink) {
tdestroy(root_node->llink, destroy_func);
}
if (root_node->rlink) {
tdestroy(ro... | TOOL | 0.991789 | 4.761308 |
25076982-c8ff-45dd-a0fe-75a96e4c143a | bokusunny/atcoder-archive | atcoder.jp/abc007/abc007_4/Main.cpp | #include <bits/stdc++.h>
using namespace std;
long long f(long long x) {
string S = to_string(x);
vector<vector<vector<long long>>> dp((int)S.size() + 1, vector<vector<long long>>(2, vector<long long>(2)));
dp[0][0][0] = 1;
for (int i = 0; i < (int)S.size(); i++) {
for (int is_less = 0; is_less < 2; is_l... | ALGO | 0.999879 | 5.387307 |
29e492c8-6c85-40aa-bccc-b59c781b32ca | NilayBadjatya/Interview_DS_Algo | Dijkstra Algorithm/Minimum Path Sum.cpp | typedef pair<int, pair<int, int>> P;
class Solution {
public:
bool isValid(int i, int j, int m, int n){
return i >= 0 && i < m && j >= 0 && j < n;
}
int minPathSum(vector<vector<int>>& grid) {
int m = grid.size();
int n = grid[0].size();
vector<vector<int>> dir = {{0, 1}, {... | ALGO | 0.999994 | 6.160979 |
01d6a77c-9163-40bb-b3c6-1fbaf97daf54 | Pkataki/Problem_Solving | uva/10496.cpp | #include <bits/stdc++.h>
using namespace std;
int x[15];
int y[15];
int dp[15][(1 << 13) + 10];
int n;
int dist[15][15];
int solve(int pos, int mask)
{
if(__builtin_popcount(mask) == n+1)
return dist[pos][0];
if(dp[pos][mask] != -1)
return dp[pos][mask];
int ans = (1 << 30);
dp[pos][mask] = 0;
for(int ... | ALGO | 0.999904 | 4.00191 |
1015ca86-e783-4254-ba6f-ca9eeab772ce | Kawser-nerd/CLCDSA | Source Codes/CodeJamData/13/53/6.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <iostream>
#include <sstream>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <utility>
#include <numeric>
#include <algorithm>
#include <bitset>
#include <complex>
using namespace std;
typed... | ALGO | 0.999923 | 3.879092 |
340bf867-2528-4d06-8eb3-d03404d9b8d3 | work-fw/personal_projects | School/Hardware Systems Design(Verilog)/180425_FPGA.cpp | #include "fpga_api.h"
#include <cstring>
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#define DATA_SIZE SIZE*(SIZE+1)*sizeof(float) // fpga bram data size
#define min(x,y) (((x)<(y))?(x):(y))
FPGA::FPGA(off_t data_addr, off_t api_addr)
{
fd_ = open("/dev/mem", O_RDWR);
data_ = static_cast<fl... | ALGO | 0.875556 | 4.793859 |
d53b6633-394d-485a-9cf6-08d8d540265d | scslab/cowl | gfx/skia/trunk/src/pathops/SkPathOpsLine.cpp | #include "SkPathOpsLine.h"
SkDLine SkDLine::subDivide(double t1, double t2) const {
SkDVector delta = tangent();
SkDLine dst = {{{
fPts[0].fX - t1 * delta.fX, fPts[0].fY - t1 * delta.fY}, {
fPts[0].fX - t2 * delta.fX, fPts[0].fY - t2 * delta.fY}}};
return dst;
}
// may have this be... | ALGO | 0.984723 | 4.921399 |
61883cda-e330-462b-9d58-1f6c72e978a2 | Is-Daouda/is-Engine-Example-Pack | is-Engine-Box2D/app/src/main/cpp/isEngine/ext_lib/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.cpp | #include "b2EdgeAndPolygonContact.h"
#include "../../Common/b2BlockAllocator.h"
#include "../b2Fixture.h"
#include <new>
b2Contact* b2EdgeAndPolygonContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator)
{
void* mem = allocator->Allocate(sizeof(b2EdgeAndPolygonContact));
... | ALGO | 0.97007 | 6.895742 |
cdfed489-ce72-4ad3-b369-72c9c6b684f2 | pedroafmonteiro/prog-leic | P2 Revisions (P06 - P12)/Exercise 05/sparse-matrix-add.cpp | #include <map>
#include "smatrix.h"
using namespace std;
void sum(const smatrix& a, const smatrix& b, smatrix& r) {
if (int(a.size()) == 0) {
r = b;
} else if (int(b.size()) == 0) {
r = a;
} else {
map<pair<size_t, size_t>, int> common;
for (size_t i = 0; i < a.size(); i++)... | ALGO | 0.994118 | 3.768633 |
655bcada-5d2c-4a77-94bd-ec58289f50e6 | mstrechen/competitive-programming | hsin.hr_coci/2016-2017/#7/Pareto.cpp | #include<iostream>
#include<algorithm>
#include<functional>
#include<vector>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<int> accounts(n);
double allsum = 0;
for(auto & i : accounts)
{
cin >> i;
allsum += i... | ALGO | 0.999875 | 4.25695 |
65939fe2-a4d4-4df6-9e1f-bb1fba09e3de | aboeuf/AdventOfCode | 2021/puzzle_2021_07.cpp | #include <2021/puzzle_2021_07.h>
#include <common.h>
class CostsComputer {
public:
CostsComputer() { m_costs.push_back(0u); }
uint getCost(uint translation) {
const auto n = static_cast<uint>(m_costs.size());
if (translation + 1 > n) {
m_costs.resize(translation + 1);
for (auto i = n; i <= tra... | ALGO | 0.997605 | 6.21186 |
bfb03d76-f96a-41eb-a14e-7325d0f17327 | lakshaykapoor7198/Interview | dynamic_programming/buy_sell_k_transaction.cpp | #include <bits/stdc++.h>
using namespace std;
void solve(int arr[], int n, int m){
int dp[n+1][m+1];
for (int i=0;i<=n;i++){
int maxDiff = -arr[0];
for (int j=0;j<=m;j++){
if (i==0 || j==0) dp[i][j]=0;
else{
dp[i][j] = max(dp[i][j-1], arr[j-1]+maxDiff);
maxDiff = max(maxDiff, dp[i-1][j]-arr[j-1]);
... | ALGO | 0.999967 | 3.935182 |
3c35ef21-3524-4201-8c2d-179a2531c6dc | Tomlord1122/llvm-project | libc/src/math/generic/fmaximum_mag_num.cpp | #include "src/math/fmaximum_mag_num.h"
#include "src/__support/FPUtil/BasicOperations.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(double, fmaximum_mag_num, (double x, double y)) {
return fputil::fmaximum_mag_num(x, y);
}
} // name... | TOOL | 0.989982 | 6.226599 |
457d3ec5-2ba1-4ecf-9810-dae57484b453 | anastasiaibaeva/leetcode | 1342-number-of-steps-to-reduce-a-number-to-zero/1342-number-of-steps-to-reduce-a-number-to-zero.cpp | class Solution {
public:
int numberOfSteps(int num) {
int count = 0;
while (num > 0) {
!(num % 2) ? (num /= 2) : (num -= 1);
++count;
}
return count;
}
}; | ALGO | 0.999946 | 6.143857 |
e396d92b-a687-4f5d-832d-42c243d64216 | Matesxs/AOC_2024 | AOC_Day_2/AOC_Day_2/AOC_Day_2.cpp | #include <cstdio>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
template<typename T>
bool isSorted(const std::vector<T>& arr)
{
if (arr.size() < 2) return false;
bool ascending = true;
bool descending = true;
for (size_t i = 1; i < arr.size(); i++)
{
if (arr[i]... | ALGO | 0.998876 | 5.191672 |
80051ef4-f286-42c5-9f28-864607b7ecae | europaplus/CPP_modules | CppModule08/ex01/span.cpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* span.cpp :+: :+: :+: ... | ALGO | 0.988246 | 4.943262 |
f1ed5836-c4bf-4b11-8fc8-5e2adb3afc4d | raincross7/code-similarity | codes/train_code/problem234/problem234_304.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pll;
#define FOR(i, n, m) for(ll (i)=(m);(i)<(n);++(i))
#define REP(i, n) FOR(i,n,0)
#define OF64 std::setprecision(10)
const ll MOD = 1000000007;
const ll INF = (ll) 1e15;
pll A[100005];
int main() {
cin.tie(0);
... | ALGO | 0.999956 | 4.024105 |
0fd9e789-4ce7-49fe-baa0-6f14d3c9e5fc | zixfy/cpp-leetcode | [2544]交替数字和.cpp | // 给你一个正整数 n 。n 中的每一位数字都会按下述规则分配一个符号:
//
//
// 最高有效位 上的数字分配到 正 号。
// 剩余每位上数字的符号都与其相邻数字相反。
//
//
// 返回所有数字及其对应符号的和。
//
//
//
// 示例 1:
//
//
// 输入:n = 521
// 输出:4
// 解释:(+5) + (-2) + (+1) = 4
//
// 示例 2:
//
//
// 输入:n = 111
// 输出:1
// 解释:(+1) + (-1) + (+1) = 1
//
//
// 示例 3:
//
//
// 输入:n = 886996
// 输出:0
// 解释:(+8... | ALGO | 0.999999 | 5.757615 |
7269feee-e64e-4a35-8c6c-f6c9504f9142 | BaoEngg/NMLT | level3/21110865_Level_03_01.cpp | #include <iostream>
using namespace std;
int main()
{
long long n;
cin >> n;
long long tong =0;
for (long long i = 1; i <= n; i++)
{
tong = tong + i;
}
cout << tong << endl;
return 0;
} | ALGO | 0.999469 | 4.000218 |
ce51fe6d-2b0a-4e71-832d-3488881688dc | InvictrixRom/system_nfc | halimpl/pn54x/utils/phNxpConfig.cpp | #include <stdio.h>
#include <sys/stat.h>
#include <list>
#include <string>
#include <vector>
#include <phNxpConfig.h>
#include <phNxpLog.h>
#include "sparse_crc32.h"
#if GENERIC_TARGET
const char alternative_config_path[] = "/data/vendor/nfc/";
#else
const char alternative_config_path[] = "";
#endif
#if 1
const char... | CONFIG | 0.962409 | 5.821064 |
608a623b-6c42-4a5d-b279-996fe586f028 | Anubhavpandey27/Code_Forces | 906 div2/E1.cpp | #include <iostream>
using namespace std;
#include <vector>
#include <string>
#include <algorithm>
#include <math.h>
long long helper(vector<pair<long long ,long long>> vec,long long n,int a,int b){
vector<pair<long long,long long>> ans;
ans.push_back(vec[0]);
for(int i=1;i<vec.size();i++){
if(i!=a && i!=b){... | ALGO | 0.99967 | 4.001277 |
d4cf4a25-fd93-4c9e-83da-bac4d1e6f098 | RiyaRoy06/Phitron-XPSC | Week 5/Day 7/Array cancellation.cpp | #include <bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int t;
cin>>t;
while(t--)
{
ll n,c=0,p=0;
cin>>n;
vector<ll>a(n);
for(ll i=0;i<n;i++)
{
cin>>a[i];
}
for(ll i=0;i<n;i++)
{
... | ALGO | 0.999916 | 3.866217 |
a0f1072c-be47-44a0-b9d8-02f30ad2d594 | DanceManiac/Gamma-Ray-Engine | 3rd party/ode/ode/src/collision_util.cpp | /*
some useful collision utility stuff. this includes some API utility
functions that are defined in the public header files.
*/
#include <ode/common.h>
#include <ode/collision.h>
#include <ode/odemath.h>
#include "collision_util.h"
//****************************************************************************
int... | ALGO | 0.999569 | 3.894806 |
4706c732-2095-4229-bbf3-aa949316230a | SolveGuys/AlgorithmStudy | Problems_Archives/12week/JohnNaksaing/boj11444.cpp | #include <iostream>
//ref1 https://arxiv.org/pdf/1012.0284.pdf
//ref2 https://stackoverflow.com/questions/32272794/finding-the-nth-fib-number-in-ologn
long long int fib(long long int n) {
long long int a, b, p, q;
a = q = 1;
b = p = 0;
while (n > 0) {
if (n % 2 == 0) {
long long int... | ALGO | 0.999961 | 4.95729 |
c88ceb35-28b9-44a0-a854-f21bafa450e6 | thegamer1907/Code_Analysis | contest/1542591604.cpp | #include <iostream>
#include <map>
#include <vector>
using namespace std;
int main(){
map<string,int>mp;
string tar ;cin>>tar;
int n;cin>>n;
vector<string> v(n);
for(auto &x:v)cin>>x;
for(int i=0;i<n;i++){
mp[v[i]]=1;
// cerr<<v[i]<<"******"<<endl;
for(int j=0;j<n;j++){
// cerr<<v[j]<<"-"<<endl;
mp[v[... | ALGO | 0.999988 | 4.063531 |
b7e0a496-2458-46d8-b638-bf55c98108fc | tic40/atcoder | abc/abc371/e/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
#define endl '\n'
using ll = long long;
int main() {
int n; cin >> n;
vector positions(n,vector<int>());
REP(i,n) {
int a; cin >> a; a--;
positions[a].push_back(i);
}
// 番兵追加
for(auto& v: positions) v.push_back(n);... | ALGO | 0.999572 | 3.890427 |
5319c9d1-45b5-4989-b656-dba7660b5d58 | nileshsah/Algorithms | HREC05.cpp | #include <bits/stdc++.h>
#define ll long long
#define get(a) scanf("%ld", &a);
#define repVector(v) for( auto it = v.begin(); it != v.end(); it++ )
#define all(c) c.begin(), c.end()
#define pb push_back
#define FOR(i,a,b) for( ll i = a; i <= b; i++ )
#define ROF(i,a,b) for( ll i = a; i >= b; i-- )
#define debug(x) cou... | ALGO | 0.999881 | 4.162694 |
7c13895b-f22e-4686-b6a6-4ba57ace94b7 | ilrexho2011/Project-EULER-Possible-Solutions-Problems-401_to_500 | Exercise 441/Exercise 441.cpp | #include <cstdio>
const int N = 10000000;
double H[N+1];
int minp[N+1];
void primes(int n,int& k,int* pr)
{
k=0;
while(n>1)
{
int p = minp[n];
pr[k++] = p;
while(n%p==0) n/=p;
}
}
// Sum[1/x : 1<=x<=n, x comprime with all elements of pr]
// k is length of pr
double invsum(int k,int* pr, int n) {
... | ALGO | 0.99914 | 3.657887 |
e5bb5b19-fd98-4dc9-9aa2-8401a6204a9a | Shahid-Fahad/Online-Judge-Solution | Codeforces+Others/Assiust University Newcomer Sheet/Newcomer Sheet/bygtest.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int x,i;
vector<int>v,p;
double avg;
while(cin>>x)
{
v.push_back(x);
if(cin.get()=='\n')
break;
}
x = v.size();
if(x%2==1)
v.erase(v.end()-1,v.end());
p = v;
x = x/2;
sort(p.begin(),p... | ALGO | 0.999733 | 3.082481 |
e23f052d-6d57-4269-ac0d-af4862b436a2 | hzfsls/leetcode-supercrawl | data/1859.sorting-the-sentence/code_snippets/sol.cpp | class Solution {
public:
string sortSentence(string s) {
}
}; | ALGO | 0.999928 | 6.231822 |
c8b9a22f-8d69-4808-a20e-46846a2f9dc8 | funaLee/NMLT_UIT_wecode | Assignment 9/9_6.cpp | #include <bits/stdc++.h>
#define ll long long
#define LIM 105
#define X first
#define Y second
#define EL cout<<"\n"
using namespace std;
void ins (char *s, int n) {
for (int i = strlen(s) + 1; i > n; i--) {
s[i] = s[i - 1];
}
}
int main() {
char s[LIM];
fgets(s, LIM, stdin);
s[strlen(s) - 1] = '\0';
cha... | ALGO | 0.999753 | 3.149608 |
0e45fc43-de79-4d72-8275-6c99b42a23e6 | emddl457/knu_cpp | Chap3_3-6/3-6.cpp | #include <iostream>
#include <cstdlib> // rand(), srand(), RAND_MAX
#include <ctime> // time()
using namespace std;
class EvenRandom // ¦ ȯϴ Ŭ
{
public: // : seed ( 5 Random Ŭ ϴ)
EvenRandom()
{
srand((unsigned)time(0)); // ð õ , 0 1970 1 1 0 0 0ʺ ʸ ȯѴ.
}
// Random Ŭ ٸ next(): 0 ~ RAND_M... | TOOL | 0.879266 | 4.443727 |
8696bc6f-2c7c-4d8f-98e0-674ea8bdc6e8 | UtileBread32046/Personal-Practice-Projects | VSCode/Luogu/B2006.cpp | #include <iostream>
using namespace std;
int main()
{
double x, a, y, b = 0.0;
double z = 0.0;
cin >> x >> a >> y >> b;
z = (b*y-a*x)/(b-a);
cout.precision(2);
cout << fixed;
cout << z;
return 0;
} | ALGO | 0.996232 | 3.283346 |
05bf4ce3-4e94-41af-adef-0131a17a12aa | FranticLOL/ITMO_Parallel_Algorithms | MPI11/src/main.cpp | #include <iostream>
#include "mpi.h"
using namespace std;
int main(int argc, char **argv)
{
int rank, size, prev, next;
int buf[2];
MPI_Init(&argc, &argv);
MPI_Request reqs[4];
MPI_Status stats[4];
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
prev = rank - 1;
next = rank + 1;
if... | ALGO | 0.999257 | 3.946642 |
4e4a9108-839b-4ba2-9ae9-023ef7a1cc94 | White-Wolf99/Leetcode-solutions | 11849-239-230-kth-smallest-element-in-a-bst/11849-239-230-kth-smallest-element-in-a-bst.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999983 | 5.937356 |
2a6b1678-58c7-4e5b-8025-edd44c255498 | ejkim0217/CS225-sp18 | lab_avl/avltree.cpp | /**
* @file avltree.cpp
* Definitions of the binary tree functions you'll be writing for this lab.
* You'll need to modify this file.
*/
#include <algorithm>
#include <iostream>
using namespace std;
template <class K, class V>
V AVLTree<K, V>::find(const K& key) const
{
return find(root, key);
}
template <... | ALGO | 0.999369 | 6.095163 |
baaf25c8-7dca-4e7a-92bc-0ce882eb8b2e | yuqicxy/LeetCode | cpp/179.largest-number.cpp | /*
* @lc app=leetcode id=179 lang=cpp
*
* [179] Largest Number
*/
#include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#include <numeric>
using namespace std;
// @lc code=start
class Solution {
public:
string largestNumber(vector<int>& nums) {
if(all_of(nums.begin(), nums.end()... | ALGO | 0.999916 | 6.602319 |
4f7cc54f-ea9c-4ca6-a3d5-0c91d69c7a3f | Rayleigh0328/OJ | leetcode/1278.cpp | class Solution {
static const int max_size = 105;
static const int inf = (1<<20);
int f[max_size][max_size];
string s;
int n;
int solve(int left, int right){
string tmp = s.substr(left, right-left);
int ans = 0;
for (int i=0;i<(tmp.size()+1)/2;++i)
i... | ALGO | 0.999983 | 5.734431 |
ead13848-8302-45ad-bc11-4704767ca14c | Jeho/TrinityCore | src/server/scripts/Northrend/dalaran.cpp | /* Script Data Start
SDName: Dalaran
SDAuthor: WarHead, MaXiMiUS
SD%Complete: 99%
SDComment: For what is 63990+63991? Same function but don't work correct...
SDCategory: Dalaran
Script Data End */
#include "ScriptPCH.h"
/*******************************************************
* npc_mageguard_dalaran
***************... | TOOL | 0.859449 | 6.859606 |
01b43e7d-c2ab-4e34-b1b3-df56848f6606 | armanhossen-dev/Algorithms-Tracker-Spring-2025-section-N | J_Flip_Sort.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int size;
while (cin>>size)
{
vector<int> arr(size);
for (int i = 0; i < size; i++)
{
cin >> arr[i];
}
int swapT = 0;
for (int k1 = 0; k1 < size-1; k1++)
{
... | ALGO | 0.999769 | 4.17523 |
c85a2337-5fec-4b55-9a99-3622aa9bfd88 | tejaram15/submitted-solutions | grid-challange.cpp | #include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
int main()
{
int n,t,cnt1=0,cnt2=0;
cin>>t;
while(t--)
{
cnt1=0;
cnt2=0;
cin>>n;
string s[n+1];
for(int j=0;j<n;j++)
{
cin>>s[j];
sort(s[j].begin(),s[j].end());
}
for(int i=0;i<n;i++)
{
for(int j=0;j<n-1;j++)
... | ALGO | 0.999984 | 3.867475 |
e049f354-65b8-425a-9602-caa2e812198b | SJMA11723/Problem-solving | codechef/START112B/LOGICIAN.cpp | /**
* Author: Jorge Raul Tzab Lopez
* Github: https://github.com/SJMA11723
*/
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t; cin >> t;
while(t--){
int n; cin >> n;
string str; cin >> str;
int cnt = 0;... | ALGO | 0.99985 | 4.619174 |
5b7290fb-1c24-4117-bb7b-c8377871c7a3 | sgc109/problem_solving | LeetCode/Dynamic_Programming/Decode_Ways.cpp | class Solution {
public:
int N;
vector<int> dp;
int str2int(string s){
int ret = 0;
for(int i = 0; i < s.size(); i++){
ret = ret * 10 + s[i] - '0';
}
return ret;
}
int numDecodings(string s) {
N = s.size();
dp = vector<int>(N + 1, 0);
... | ALGO | 0.999953 | 6.415781 |
508427bc-4df8-4072-9aa0-23fc437d3aca | CHROQUIHAMZA/ParcoursEnLargeur | Graphe.cpp | #include "Graphe.h"
#include <queue>
using namespace std;
Graphe::Graphe() {
nbrElem = 0;
elemts = vector<int>(10, -1);
G = vector<Liste*>(10, nullptr);
}
Graphe::~Graphe() {
for (auto liste : G) {
delete liste;
}
}
void Graphe::inserer(Liste* L, int index) {
for (LST* courant = L->L... | ALGO | 0.993234 | 4.272945 |
a1351f7c-ed51-43b2-979c-d47420d9235d | OanaGaskey/Highway-Driving | src/Eigen-3.3/doc/examples/TutorialLinAlgSVDSolve.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXf A = MatrixXf::Random(3, 2);
cout << "Here is the matrix A:\n" << A << endl;
VectorXf b = VectorXf::Random(3);
cout << "Here is the right hand side b:\n" << b << endl;
cout << "The least-squares ... | ALGO | 0.999661 | 3.919376 |
1f44b51a-85c6-4af9-9d67-86ff2d3fd8ab | yeeunni/DATASTRUCTURE02 | 2021202045_DS_project3/MatrixGraph.cpp | #include "MatrixGraph.h"
MatrixGraph::MatrixGraph(bool type, int size) : Graph(type, size) //constructor of MatrixGraph
{
m_Mat = new int* [size]; //m_Mat is int array of 2 degree
for (int i = 0; i < size; i++)
{
m_Mat[i] = new int[size];
memset(m_Mat[i], 0, sizeof(int) * size); //initialize all componenet ->... | ALGO | 0.89085 | 4.013011 |
2708a523-4748-4b69-b360-c4e5ae2f9640 | champgourav007/Starters | palindrome.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int num;
cout<<"enter the number: ";
cin>>num;
int temp=num;
int rem=0,pal=0;
while (num>0)
{
rem=num%10;
pal=pal*10+rem;
num/=10;
}
if(pal==temp)
cout<<"yes! it is a pallindrome";
else
cou... | ALGO | 0.999948 | 4.357892 |
06a861ee-575c-4f08-aedb-b595fb6512e4 | ffallrain/lammps_waterbox | src/USER-OMP/npair_half_nsq_newtoff_omp.cpp | #include "npair_half_nsq_newtoff_omp.h"
#include "npair_omp.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "atom.h"
#include "atom_vec.h"
#include "group.h"
#include "molecule.h"
#include "domain.h"
#include "my_page.h"
#include "error.h"
using namespace LAMMPS_NS;
/* --------------------------------------... | ALGO | 0.999897 | 5.926687 |
c8a9e82c-ce12-40b5-a8c7-d30ce9d8d765 | iamsank7/Codeforces-solutions | 483A.cpp | #include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
ll l,r,a,b,c;
cin>>l>>r;
if(!(l&1))
{
if(r-l>=2)
cout<<l<<" "<<l+1<<" "<<l+2;
else
cout<<"-1";
}
else
{
if(r-l>=3)
cout<<l+1<<" "<<l+2<<" "<<l+3;
else
cout<<"-1";
}
}
| ALGO | 0.999991 | 3.307996 |
697f457a-78a3-4892-9d51-61c84e648ef2 | abhishek7998/algorithm | transitiveclosure.cpp | #include <bits/stdc++.h>
using namespace std;
bool previous[100][100];
int vertex,edge,x,y;
int main(){
//cout<< "Enter the number of vertices and number of edges\n";
cin>>vertex>>edge;
//cout<< "Enter those edges\n";
for(int i=0;i<edge;i++){
cin>>x>>y;
previous[x][y]=1;
}
for(in... | ALGO | 0.999957 | 3.954759 |
d1fbc394-72e5-4ca5-8138-b73dc5402990 | HKPolyU-UAV/COVIS | src/frontend/f2f_tracking.cpp | #include "include/f2f_tracking.h"
void F2FTracking::init(const DepthCamera dc_in,
const SE3 T_i_c0_in,
const Vec6 feature_para,
const Vec6 vi_para,
const Vec3 dc_para,
const Vec3 kf_para,
... | ALGO | 0.933096 | 5.185234 |
073d91ca-c2dc-4f1c-94d2-c26b460bae43 | NNakreSS/Youtube | ar_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.998478 | 6.76775 |
cd303bc4-320e-4d35-904d-6883e003839e | StudyingFather/my-code | loj/6342.cpp | /*
Name: loj 6342
Author: StudyingFather
Date: 2019/10/29 16:54
Website: https://studyingfather.com
*/
#include <iostream>
#define MOD 1000000007
using namespace std;
int inv[10000005];
int main()
{
int n;
cin>>n;
inv[1]=1;
for(int i=2;i<=n;i++)
inv[i]=1ll*(MOD-MOD/i)*inv[MOD%i]%MOD;
long long sum=0,f=0;
fo... | ALGO | 0.999984 | 4.365065 |
fbe2aaa5-11cc-48ea-bbb3-a4c97d561555 | abhi061201/GFG-LEETCODE-CODINGNINJA-SOLUTION | Day 39/FrogJump cN.cpp | TC= O(N)
SC= O(N)+O(N)
#include<bits/stdc++.h>
int go(int i,vector<int>&arr,vector<int>&dp){
if(i==0)return 0;
if(dp[i]!=-1)return dp[i];
int right= INT_MAX;
int left= go(i-1,arr,dp)+abs(arr[i]-arr[i-1]);
if(i>1)
right= go(i-2,arr,dp)+abs(arr[i]-arr[i-2]);
return dp[i]= min(left,ri... | ALGO | 0.999997 | 5.401371 |
9944e37e-e298-44fc-9176-567ad7e766e0 | xkuang/stuff | BioinformaticsContest/lastcombined/main.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int findEquality(string leftAT, string ATright)
{
while(!equal(leftAT.begin(), leftAT.end()-1, ATright.begin()))
leftAT.erase(0, 1);
return leftAT.length();
}
string gl... | ALGO | 0.999927 | 4.086147 |
6659d7c5-9ec3-4acc-895a-30621dc72392 | Ruhulcse/UVA-solve | Banglawash.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int test;
cin>>test;
int C=1;
while(test--)
{
int match;
cin>>match;
char b;
int A=0,B=0,T=0,W=0;
for(int i=0;i<match;i++)
{
cin>>b;
if(b=='A')
A++;
else if(b=='B')
B++;
... | ALGO | 0.999271 | 4.03373 |
015b7f6c-9a3c-4074-b5bc-657700b40853 | OpenSXCE-org/FireFox-43-port-for-all-OpenSolaris-distros | firefox-beta/dom/xslt/xpath/txLocationStep.cpp | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
Implementation of an XPath LocationStep
*/
#include "txExpr.h"
#include "txIXPathContext.h"
#include "txNodeSet.h"
#include "txXPathTreeWalker.h"
//-----------------------------/
//- Virtual methods from Expr -/
//---------------... | TOOL | 0.944334 | 7.247436 |
47fbdd17-2397-4b95-a6cf-19c12eef7b09 | marat-rkh/MergeHull | src/merge_hull.cpp | #include "merge_hull.h"
#include "utils.h"
#include "merge.h"
#include <cmath>
#include <iostream>
#include <algorithm>
using geom::structures::point_type;
/*
* Rotates triangle counterclockwise
*/
void rotate_triangle_ccw(vector<point_type> & conv_hull) {
point_type buf(conv_hull[1]);
conv_hull[1] = conv_... | ALGO | 0.999946 | 6.543852 |
f30d703e-7504-4d8a-855e-a60b60da5393 | sinha-sahil/ProblemSolving | C++/Concepts/OperatorOverloading.cpp | #include<iostream>
#include<string>
using namespace std;
class Box{
private:
int l, b, h;
public:
Box(): l(0), b(0), h(0){}
Box(int a, int x, int c): l(a), b(x), h(c){}
Box(const Box &B){
l= B.l;
b= B.b;
h= B.h;
}
int getLength... | ALGO | 0.998768 | 3.548434 |
cf37b5c0-dc49-4583-9293-dd0a2186ebe3 | suraj101998/LeetCodeSolutions | 1800-1899/1878.Get Biggest Three Rhombus Sums in a Grid/Solution.cpp | class Solution {
public:
vector<int> getBiggestThree(vector<vector<int>>& grid) {
int m = grid.size(), n = grid[0].size();
vector<vector<int>> s1(m + 1, vector<int>(n + 2));
vector<vector<int>> s2(m + 1, vector<int>(n + 2));
for (int i = 1; i <= m; ++i) {
for (int j = 1; ... | ALGO | 0.999992 | 5.27493 |
9511ad9a-3109-4096-b834-c8796aa60c86 | ankagndz/OGdiyabet | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.