uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
28395237-98dc-4794-ae2a-a4a3d96d1f32 | tanishq252/myLeetcodeSolutions | arrays/replaceElementsWithGreatestOnRightSide.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
vector<int> arr = {17,3,4,9,2,3,8};
int pervMax = arr[0];
if(arr.size() == 1){
// return;
arr[0] = -1;
}
for(int i=0;i<arr.size();i++){
pervMax = arr[i+1];
for(int j=i+1;j<arr.size();j++){
pervMax ... | ALGO | 0.999956 | 4.190715 |
edbd47be-f65a-483c-a056-b65bb1d18541 | Mushiurmukul/DSA_CODE | circular_linkedlist.cpp | //single
#include<bits/stdc++.h>
using namespace std;
class Node{
public:
int data;
Node* next;
Node(int data)
{
this -> data = data;
this -> next = NULL;
}
~Node()
{
int value =this->data;
if(this->next !=NULL)
{
delete next;
this->... | ALGO | 0.999858 | 4.021267 |
ac811b44-f4d2-41d2-a505-0ca95ddd3241 | sharma-dikshant/cp | divide and conquer algorithms/quicksort/quicksort.cpp | #include <bits/stdc++.h>
using namespace std;
int partition(vector<int> &arr, int s, int e)
{
int pi = s;
int pivot = arr[e];
for (int i = s; i < e; i++)
{
if (arr[i] <= pivot)
{
swap(arr[i], arr[pi]);
pi++;
}
}
// final swap for pivot element
... | ALGO | 0.999855 | 5.403786 |
74b871ee-269f-41f5-a80e-4efac586ad86 | quicky2000/sheep | src/sheep_situation.cpp | #include "sheep_situation.h"
#include <iostream>
#include <sstream>
using namespace std;
namespace sheep
{
//-----------------------------------------------------------------------------
bool sheep_situation::is_final(void)const
{
return m_sheeps == m_final_sheeps;
}
//---------------------------------... | ALGO | 0.989257 | 3.449728 |
f883fb5f-544f-409f-9da9-1053ef804cf3 | zpoint/Reading-Exercises-Notes | C++ Primer/16_Templates_And_Generic_Programming/16_47.cpp | #include <iostream>
#include <utility>
template <typename F, typename T1, typename T2>
void flip(F f, T1 &&t1, T2 &&t2)
{
f(std::forward<T2>(t2), std::forward<T1>(t1));
}
void g(int &&i, int& j)
{
std::cout << i << " " << j << std::endl;
}
int main()
{
int i = 3;
flip(g, i, 42);
return 0;
}
| TOOL | 0.901708 | 5.717767 |
dcaf90c1-f3e8-4ebc-a5e0-3587d54f4649 | codeSpicer/LeetCode-solutions | 0039-combination-sum/0039-combination-sum.cpp | class Solution {
public:
vector<vector<int>> combinationSum(vector<int>& candidates, int target) {
vector<vector<int>> combinations;
vector<int> combination;
sort(candidates.begin(), candidates.end());
dfs(combinations, combination, candidates, 0, target);
return combinations... | ALGO | 0.999973 | 6.809786 |
348fdff7-0c42-47e2-ab8f-91325a69dc36 | vestigegroup/LEETCODE_solution-CPP- | 0205-isomorphic-strings/0205-isomorphic-strings.cpp | class Solution {
public:
bool isIsomorphic(string s, string t) {
// Check if lengths of strings are different, return false if so
if (s.length() != t.length())
return false;
// Create two maps to store the mappings of characters
std::unordered_map<char, char> s_... | ALGO | 0.999921 | 6.820791 |
bbad1815-7433-4c83-b716-c0781cc5dcb7 | saquibali7/LeetCode-Question | 1753-maximum-score-from-removing-stones/1753-maximum-score-from-removing-stones.cpp | class Solution {
public:
int maximumScore(int a, int b, int c) {
priority_queue<int> pq;
pq.push(a);
pq.push(b);
pq.push(c);
int res=0;
while(pq.size() > 1){
int temp1=pq.top();
pq.pop();
int temp2=pq.top();
pq.pop();
... | ALGO | 0.999992 | 5.752323 |
ed9740e4-8cc8-46cd-b39e-54399dde684c | foltri/advent-of-code-2022 | days/aoc12.cpp | //
// Created by Balint Zsiga on 2022. 12. 15..
//
#include "aoc12.h"
namespace aoc12
{
class AdjList
{
private:
std::vector<std::vector<size_t>>nodes{};
public:
explicit AdjList(size_t size) : nodes{ std::vector<std::vector<size_t>>(size) }
{
}
... | ALGO | 0.999881 | 5.769713 |
4060d7b3-cb20-46d3-990b-a2e41370b369 | NavinShrinivas/AlgorithmicProblems | learning/coin_DP_problem.cpp | //learning dynamic programming iwth help of the ever infamous
//coin problem
#include<bits/stdc++.h>
#include<math.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
using namespace std;
int main()
{
//optional for codeforces and harckerrank
// int t;
// int tc=0;
/... | ALGO | 0.999979 | 4.004671 |
e98b4bde-df51-4c22-a149-c97d6ed08426 | qhb1001/For-that-dream | Online Contest/Nowcoder/qhb/C.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
const int MAX = 105;
int fa[MAX], cnt[MAX];
int find(int x) {
return fa[x] == x? x : fa[x] = find(fa[x]);
}
void unit(int u, int v) {
u = find(u);
v = find(v);
if(u == v) return ;
if (cnt[u] < cnt[v]) swap(u, v);
cnt[u] += cnt[v];
fa[v... | ALGO | 0.99953 | 4.135056 |
dbdb19fe-0ce9-4634-b621-29b93b3424a3 | MikamiTetsuro365/Atcoder | ABC144/E.cpp | #define _USE_MATH_DEFINES
#include "bits/stdc++.h"
using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;
typedef pair<pair<ll, ll >, ll > pii;
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
bool check(ll N, ll K, vector<ll > A, vector<ll > F, ll mid){
//mid(最小のコスト)にたどり着くまで... | ALGO | 0.999933 | 3.864473 |
796bf5dd-e066-4c3a-aba9-1318dd8b9a20 | arijitroy003/An-Algorithm-A-Day | Dijkstra's Algorithm - STL (Object Oriented).cpp | /*input
*/
/*~ @author = dwij28 (Abhinav Jha) ~*/
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
using namespace std;
class Graph {
int n;
std::vector< pair<int, int> > *adj;
public:
Graph(int n);
void add(int u, int v, int w);
void dijkstra(int src);
};
Graph::Graph(in... | ALGO | 0.999974 | 3.884781 |
6916cf62-71e7-4bcb-a525-f31c84f3dba7 | RuiqiW/geometry-processing-monte-carlo | libigl/include/igl/ismember.cpp | template <
typename DerivedA,
typename DerivedB,
typename DerivedIA,
typename DerivedLOCB>
IGL_INLINE void igl::ismember(
const Eigen::MatrixBase<DerivedA> & A,
const Eigen::MatrixBase<DerivedB> & B,
Eigen::PlainObjectBase<DerivedIA> & IA,
Eigen::PlainObjectBase<DerivedLOCB> & LOCB)
{
using namespace ... | ALGO | 0.997431 | 6.500557 |
1401adbb-3d28-46cb-a632-91f42bd6a0a3 | Olivyezhyk/Lab_12 | Lab_12_06/Lab_12_06.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <queue>
#include <string>
using namespace std;
using WordQueue = queue<string>;
void createQueueFromLine(const string& line, WordQueue& q) {
istringstream iss(line);
string word;
while (iss >> word) {
q.push(word);
}
}
void p... | ALGO | 0.99274 | 5.387856 |
8146da9c-e649-4e2e-9385-9682bc835ec7 | denis-gubar/Leetcode | Array/0274. H-Index.cpp | class Solution {
public:
int hIndex( vector<int>& citations ) {
sort(citations.begin(), citations.end());
int N = citations.size();
if (!N || citations[0] >= N) return N;
int a = 0, b = N;
while (a + 1 < b)
{
int m = (a + b) / 2;
if (citations[N - m] >= m)
a = m;
else
b = m;
}
re... | ALGO | 0.999869 | 6.339114 |
61233a79-e473-4b46-a49c-85a5509d7755 | kim0chan/PS | Codes/BOJ/1000-1999/1200-1299/1240.cpp | #include <bits/stdc++.h>
#define NODE first
#define DIST second
using namespace std;
int N, M, A, B, D;
vector<pair<int, int>> adj[1001];
int main() {
cin.tie(0);
cin.sync_with_stdio(0);
cin >> N >> M;
for(int i = 0; i < N - 1; i++) {
cin >> A >> B >> D;
adj[A].push_back({ B, D });
adj[B].push_back({ A, D ... | ALGO | 0.999959 | 4.938705 |
9e12b2d2-6aee-4ede-9a40-b47e0ae00efd | kknaks/study | 코딩테스트/2st_week/2_e_1992_reculsive.cpp | #include <bits/stdc++.h>
using namespace std;
string s;
char a[104][104];
int n;
string quard(int y, int x, int size){
if (size == 1) return string(1,a[y][x]);
char b = a[y][x];
string ret = "";
for (int i = y; i < n; i++){
for (int j = x; j < n; j++){
if (b != a[i][j]) {
... | ALGO | 0.999569 | 4.598545 |
9a7e7fea-43e2-4b6f-b9f0-78b5c2ecc8a3 | CSPercival/CP-Problemset | Training/Milocin2025/Day2/L.cpp | #include <bits/stdc++.h>
#define st first
#define nd second
// #define int long long
typedef long long ll;
using namespace std;
void solve() {
ll n; cin >> n;
if (n == 1) {
cout << "1\n";
return;
}
ll ans = n-2;
if (((n%4) == 1) || (((n%4)==2) && (n >= 6))) ans++;
if (((n%4) ==... | ALGO | 0.999774 | 4.430345 |
b97a26ea-5ad3-4b22-91c2-1193dcf105aa | ekanshka/neetcode-problems | arrays-and-hashing/easy/two-sum/map-n/two-sum.cpp | /**
* O(n), O(n)
*
* Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.
*
* link: https://leetcode.com/problems/two-sum/
*/
/**
* @brief we cannot use two pointer solution here because:
* - they are not sorted
* - we need to return th... | ALGO | 0.999698 | 6.477662 |
6cfa896e-d0ac-4204-a063-2bb3620da61f | facebookarchive/BOLT | clang/test/SemaTemplate/instantiate-declref-ice.cpp | // RUN: %clang_cc1 -fsyntax-only -verify %s
// expected-no-diagnostics
template<int i> struct x {
static const int j = i;
x<j>* y;
};
template<int i>
const int x<i>::j;
int array0[x<2>::j];
template<typename T>
struct X0 {
static const unsigned value = sizeof(T);
};
template<typename T>
const unsigned X0<T>::... | ALGO | 0.902547 | 5.590412 |
cad5be8b-3e89-41af-a834-454f6dd1275d | hx062312/FSE-24-UniTrans | cleaned_data/transcoder_evaluation_gfg/cpp/FAST_MULTIPLICATION_METHOD_WITHOUT_USING_MULTIPLICATION_OPERATOR_RUSSIAN_PEASANTS_ALGORITHM.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
// #include <bits/stdc++.h>
#include <algorithm>
using namespace std;
unsigned int f_gold ( unsigned int a, unsigned int b ) {
int res = 0;
while ( b > 0 ) {
if ( b & 1 ) res = res + a;
a = a << ... | ALGO | 0.999899 | 5.584494 |
4763a4fa-7563-4260-841f-6137a6d00d14 | kapoorz/cpptopics | interviewbit/Bitmask/counttotalsetbits.cpp | #include <bits/stdc++.h>
using namespace std;
int solve(int A)
{
if (A <= 2)
return A;
if (A == 3)
return 4;
int mod = 1e9 + 7;
long long curcount = 4;
long long sum = 4;
long long temp = 4; // temp store no of 1 in msb
while ((temp << 1) - 1 <= A)
{
curcount = ... | ALGO | 0.999973 | 5.014135 |
b79d3a13-1b27-4455-9feb-4bfe57df1f0b | ngongochan/oop-workspace | practical-exams/practical-exam-1/main-1-2.cpp | #include <iostream>
extern void modifyArray(double [], int, double);
int main() {
double array[] = {1, 2, 3, 4};
modifyArray(array, 4, 10);
} | ALGO | 0.989109 | 3.815459 |
b8d90987-7663-427a-8009-a1dfe9936d13 | keijak/comp-pub | cf/contest/1487/A/main.cpp | #include <bits/stdc++.h>
#define REP_(i, a_, b_, a, b, ...) \
for (int i = (a), _Z_##i = (b); i < _Z_##i; ++i)
#define REP(i, ...) REP_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
#define ALL(x) std::begin(x), std::end(x)
using i64 = long long;
using u64 = unsigned long long;
template <typename T, typename U>
inlin... | ALGO | 0.999325 | 5.178354 |
8d1f5e7d-7e95-41f4-9294-97646738e42d | qixuanxuan/leetcode | 13. 罗马数字转整数.cpp | class Solution {
public:
int romanToInt(string s) {
unordered_map<char,int> p;
p['I'] = 1;
p['V'] = 5;
p['X'] = 10;
p['L'] = 50;
p['C'] = 100;
p['D'] = 500;
p['M'] = 1000;
int len = s.size();
int result = 0;
int i=0;
while(i<len-1){
if(s[i]=='I'){
if(s[i+1]=='V'){
i++;
resul... | ALGO | 0.999697 | 6.159077 |
298cfc5b-92cf-45d5-ae47-741781559254 | ishandutta2007/codeforces | aaaaajack/normal/429/C.cpp | #include<cstdio>
#include<algorithm>
#include<functional>
using namespace std;
int a[30],b[30],lf=0,in=0;
bool check(int now){
if(now==in){
int cnt=0;
for(int i=0;i<in;i++) cnt+=b[i];
if(cnt==lf) return true;
return false;
}
for(int i=0;i<now;i++){
if(a[now]<a[i]-1&&a[now]<=b[i]){
b[i]-=a[now];
if(ch... | ALGO | 0.999994 | 3.443104 |
c117d8d8-80e0-4c42-90ff-d4ec2e99f5b2 | pazhanivel07/frameworks_av-r33_CVE-2022-20413 | media/libstagefright/codecs/amrnb/common/src/q_plsf.cpp | /*
********************************************************************************
*
* GSM AMR-NB speech codec R98 Version 7.5.0 March 2, 2001
* R99 Version 3.2.0
* REL-4 Version 4.0.0
*
*********************************************************... | ALGO | 0.927666 | 5.540532 |
700ec726-a12d-4d84-9fcc-e9dab2ccb2cb | raincross7/code-similarity | codes/train_code/problem131/problem131_348.cpp | #include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL_DEBUG
#include "LOCAL_DEBUG.hpp"
#endif
#define int long long
const int MOD = 1e9 + 7;
signed main(){
int n, m, d; cin >> n >> m >> d;
if(d == 0){
printf("%.7f\n", 1.0 * (m - 1) / n);
}else{
printf("%.7f\n", 1.0 * (m - 1) * 2 * (n - d) / (n * n... | ALGO | 0.999414 | 3.883209 |
a4f952ad-81af-4bbb-999a-e01b9afa6ba8 | lionkingchuja/leet_code | 1431-all-ancestors-of-a-node-in-a-directed-acyclic-graph/1431-all-ancestors-of-a-node-in-a-directed-acyclic-graph.cpp | class Solution {
public:
vector<vector<int>> getAncestors(int n, vector<vector<int>>& edges) {
vector<int>adj[n];
for(int i=0;i< edges.size();i++){
adj[edges[i][0]].push_back(edges[i][1]);
}
vector<vector<int>>ans(n);
vector<bool>vis(n,false);
for(int i=0... | ALGO | 0.999983 | 5.794625 |
b30db023-8a37-4237-a254-cc5087ac551c | deepakbind/codeforces | .history/StonesontheTable_20230421141901.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int arr[n];
int cnt=0;
for(int i=0;i<n-1;i++){
for(int j=0;j<n-1;j++){
if(arr[i]==arr[j])
cnt++;
else{
cnt--;
}
}
cout<<cnt<<endl;
}
retirn 0;
} | ALGO | 0.999796 | 3.364571 |
f6e51495-1de9-4e41-9869-9b3fa498fc41 | jawaadaadam/HuffmanCodeGenerator | HuffmanTree.cpp | #include "HuffmanTree.hpp"
//This function helps traverse the tree in preorder
void HuffmanTree::preSearchTree(HuffmanNode * node, std::map<char, std::string>& h_codes, char key, std::string code) const{
if(node == nullptr) //base case
return;
if((node->isLeaf()) && (node->getCharacter() == key)) //i... | ALGO | 0.999897 | 5.299577 |
8b90f6f2-2eea-4a52-8edc-07b31db4d265 | sinian666/code_102_8 | cpp_副本8/chapter_sorting/quick_sort.cpp | /**
* File: quick_sort.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 快速排序类 */
class QuickSort {
private:
/* 元素交换 */
static void swap(vector<int> &nums, int i, int j) {
int tmp = nums[i];
nums[i] = nums[j];
nums[j] = tmp;
}
... | ALGO | 0.999967 | 5.600534 |
a0f06909-1386-4237-ab1a-81eff9c3e61c | FortimusPrime/Ray-Tracer | Ray Tracer/Source_Code/main.cpp | // To Run: clang++ -Xpreprocessor -fopenmp -lomp -I/opt/homebrew/Cellar/libomp/19.1.3/include -L/opt/homebrew/Cellar/libomp/19.1.3/lib simple_parallel.cpp -o parallel_example && ./parallel_example
// clang++ -Xpreprocessor -fopenmp -lomp -I/opt/homebrew/Cellar/libomp/19.1.3/include -L/opt/homebrew/Cellar/libomp/19.1.3... | ALGO | 0.939599 | 4.86177 |
cbea61a5-0dde-44a1-93a3-c91fe6c20364 | BC46/kattis-solutions | src/thanos.cpp | #include <iostream>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
double p, r, f;
int t;
cin >> t;
while (t--) {
int years = 0;
cin >> p >> r >> f;
while (f >= p) {
p *= r;
++years;
}
... | ALGO | 0.999506 | 4.181894 |
dff7ce52-fd72-4c1d-84fc-05a5fc01b24a | blindaks/LeetCode-Daily-Challenge | Find the Town Judge.cpp | class Solution {
public:
int findJudge(int n, vector<vector<int>>& trust) {
map<int,int>mp;
for(auto v:trust)
{
mp[v[0]]++;
}
int x=0;
for(int i=1;i<=n;i++)
{
if(mp[i]==0)
{
x=i;
break;
... | ALGO | 0.999932 | 5.192004 |
cec70262-0025-4d6b-9f15-573957e47427 | Keehl-Mihael/TransROWL-HRS | Models/kmeans.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <fstream>
#include <sstream>
#include <algorithm>
using namespace std;
class Point{
private:
int pointId, clusterId;
int dimensions;
vector<double> values;
public:
Point(int id, string line){
dimensions = 0;
pointId = id... | ALGO | 0.994591 | 5.59404 |
5b060ab5-134d-4576-aba5-998f701f37dd | waleedtariq109/grasp-cpp | 11.pointers/dangling-pointer.cpp | #include <iostream>
int main() {
// Dangling pointer
/**
*
* Case #1: Uninitialized pointer
*
* In this case we have a pointer which we decalre but not initialized
* so this pointer is point to some garbage value or invalid memory
* address. If we don't initialize our pointer there are chances t... | TOOL | 0.91895 | 3.74035 |
7383072e-c283-48fe-bcf2-9e52889e331c | rkokan/HackerRank | Sorting/Quicksort 1 - Partition/main.cpp | #include <stdio.h>
#include <stdlib.h>
int main()
{
int n, *ar, i, pos, j, temp, k;
scanf("%d",&n);
ar = (int*)malloc(n*sizeof(int));
for (i = 0 ; i < n ; i++){
scanf("%d",&ar[i]);
}
pos = 0;
for (i = 1 ; i < n ; i++){
if (ar[pos] > ar[i]){
temp = ar[i];
... | ALGO | 0.99999 | 3.260867 |
0d4f0831-5955-42c8-9722-77d53eb132e2 | cou929/topcoder | LotteryCheating.cpp | // BEGIN CUT HERE
// END CUT HERE
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <utility>
#include <set>
#include <cctype>
#include <queue>
#include <stack>
// BEGIN CUT HERE
#include "cout.hp... | TEST | 0.999614 | 4.786971 |
f476da9e-a803-479d-87a8-101edc3e2282 | stamcenter/llvm-zeno | llvm/lib/Transforms/Scalar/PlaceSafepoints.cpp | #include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/CFG.h"
#include "llvm/Analysis/ScalarEvolution.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/IR/Dominators.h"
#incl... | ALGO | 0.913058 | 7.887833 |
cfbbf98a-0880-49ef-a806-152c6d517d3d | karenhogue/ne697-geant4 | assignment2/assignment2.cpp | #include <iostream>
#include <tgmath.h>
#include <sstream>
using namespace std;
int main(int argc, char *argv[])
{
double two_to_n = 0;
// int n = 3;
string str = argv[1];
int n = stoi(str);
two_to_n = pow(2.0, (1.0 * n));
std::cout << two_to_n << std::endl;
} | ALGO | 0.986906 | 4.377817 |
87e8a118-8c82-4e50-9ee1-21414007de80 | SinaC/OldRaytrace | src/renderers/quincunx.cpp | #include <stdio.h>
#include <string.h>
#include "../world.h"
#include "../color.h"
#include "../ray.h"
#include "../cameras/camera.h"
#include "../math/math.h"
#include "quincunx.h"
// Quincunx
// X---X corner weight: 0.125
// | | center weight: 0.5
// | X |
// | |
// X---X
bool RendererQuincunx::render( cons... | ALGO | 0.993396 | 5.665018 |
4e75dfb9-5697-499c-9e60-2235c02af676 | lilithCode/Data-Structures-and-Algorithms | AVLtree.cpp | #include <iostream>
#include <queue>
using namespace std;
class Node
{
private:
int data;
Node *left;
Node *right;
public:
Node(int value = 0, Node *l = nullptr, Node *r = nullptr)
: data{value}, left{l}, right{r} {}
int getData() { return data; }
Node *getLeft() { return left; }
N... | ALGO | 0.999986 | 6.597553 |
89935b43-06c1-488d-a78b-c13f913c5963 | sayIshuu/Algorithm-Study-Cplus | 2023스터디/0주차/BJ2751 수 정렬하기2/BJ2751.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void)
{
vector<int> v;
int n; cin >> n;
for (int i = 0; i < n; i++)
{
int a; cin >> a;
v.push_back(a);
}
sort(v.begin(), v.end());
for (int i = 0; i < n; i++)
{
cout... | ALGO | 0.999813 | 4.413145 |
942a2c96-5028-4298-9f22-1e0dfafbb44e | openkylin/kylin-kmre-emugl | android-emu/android/emulation/ConfigDirs.cpp | #include "android/emulation/ConfigDirs.h"
#include <assert.h> // for assert
#include <errno.h> // for errno
#include <string.h> // for strerror
#include <vector> // for vector
#include "android/base/Log.h" // for LogStream, LOG, LogMessage
#include "android/base/Optional.h" // for Optional
... | TOOL | 0.9139 | 7.708458 |
30b7fd8f-c482-41c8-bc5b-d0233a299d30 | Rashed112/LeetCode-Solutions | solutions/112_path_sum.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.999964 | 6.271107 |
3e4b17c1-b0cf-4e00-8b96-0dd013aeec01 | sumitanand027/Leetcode-Problem-solved | 875-koko-eating-bananas/875-koko-eating-bananas.cpp | class Solution {
public:
int check( vector<int> &piles, int k ) {
int ans = 0;
for( auto &p : piles ){
ans += ( p + k - 1 ) / k ;
}
return ans;
}
int minEatingSpeed(vector<int>& piles, int h) {
int l = 1, high = 0;
... | ALGO | 0.999891 | 5.573473 |
44fb4866-0734-46c2-b194-542afec3656f | totorolivesalone/Computer_Graphics | midpointcircle.cpp | #include<iostream>
#include<iomanip>
#include<graphics.h>
#include<stdio.h>
using namespace std;
void drawcircle(int x0,int y0,int r)
{
int x=0;
int y=r;
int d=1-r;
while(y>=x){
putpixel(x0+x,y0+y,WHITE);
putpixel(x0+y,y0+x,WHITE);
putpixel(x0-y,y0+x,WHITE);
putpixel(x0-x,y0+y,WHITE);
putpixel(x0-x,y0-y,W... | ALGO | 0.998903 | 3.856438 |
55bf11b4-a835-48c5-8fe3-8778878f9915 | ITESA-DYPCOE/Coffee-and-code | Hackerrank/Other_Concepts/AttendingWorkshops.cpp | #include<bits/stdc++.h>
using namespace std;
struct Workshops {
int start_time;
int duration;
int end_time;
};
struct Available_Workshops {
int n;
vector <Workshops> w;
};
Available_Workshops *initialize(int *start_time, int *duration, int n) {
Available_Workshops *tmp = new(Available_Worksh... | ALGO | 0.999974 | 4.660182 |
915b55e3-a22c-4feb-9b26-2fc0eafe5de2 | ishandutta2007/codeforces | eddy1021/normal/558/C.cpp | // eddy1021
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long long ll;
typedef pair<int,int> PII;
#define mod9 1000000009ll
#define mod7 1000000007ll
#define INF 1023456789ll
#define INF16 10000000000000000ll
#define FI first
#define SE second
#define PB push_back
#define MP make_pair
#defi... | ALGO | 0.999945 | 4.174218 |
136cd786-93bb-49d2-9cba-516af8093537 | jieqian2/Financial-Computing-in-Cpp | Code Used In Class/down_and_out_adjusted_dynamic_prog.cpp | // Down-and-out European Barrier Option Pricing Code written by Prof. Sreenivas
// The terminal payoff vector that corresponds to indices of the underlying
// stock prices that are in the black vis-a-vis the barrier have been discounted
// appropriately using the approach in Baron-Adesi, Fusari and Theal's paper.
/... | ALGO | 0.999781 | 6.187146 |
cf4dd947-4215-4b48-8044-044bc9464de8 | EVARATE/MandelbulbUI | utilityFunctions.cpp | #include "boolcloud.h"
#include <string>
#include <cmath>
//inline reason: Compiler puts these functions into several files and
//then complains that there are multiple definitions of it. Inline fixes that.
inline std::string getFileExt(std::string& filePath, std::string defaultExtension){
std::string revExt;
... | TOOL | 0.898058 | 4.244684 |
744ea8b3-2f3e-45e2-9d3a-e5026a8d7a36 | atlas25git/codeforces | 121div2/B.cpp | /***************************************
*****Solution authored by Atlas25.******
*****************************************/
#include<bits/stdc++.h>
using namespace std;
using namespace chrono;
#define int long long int
#define ld long double
#define F first
#define S second
#define P pair<int,int>
#define pb push_back... | ALGO | 0.99995 | 6.203319 |
e1b08f20-5122-48d6-b5ae-75791b5cc6ce | athulSat/CP | 214A.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
signed main()
{
ios::sync_with_stdio(false), cout.tie(0);
int n,m,count(0);
cin>>n>>m;
for(int a=0; a*a <=n; a++)
{
for( int b=0; b*b <=m; b++)
{
if((((a*a)+b)==n) && ((a+ (b*b))==m)) count++;
}
}
cout<<count << ... | ALGO | 0.999526 | 4.395833 |
6b7a7864-bff9-425b-ac8d-f3a9f2fa6a2a | a0x8o/caffe2 | third_party/eigen/doc/examples/TutorialLinAlgSetThreshold.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix2d A;
A << 2, 1,
2, 0.9999999999;
FullPivLU<Matrix2d> lu(A);
cout << "By default, the rank of A is found to be " << lu.rank() << endl;
lu.setThreshold(1e-5);
cout << "With threshold 1e-5... | ALGO | 0.999799 | 4.090376 |
83bd76a0-fc1b-4c22-a5b5-9d89cc95203f | AFTI-TOP-TEAM/symb-lib | src/symblib/processor/SumProcessor.cpp | #include "SumProcessor.h"
#include "../classlib/memory.h"
#include "../node/Sum.h"
#include "../node/Var.h"
#include "ExpressionProcessor.h"
namespace symb
{
REGISTER_PROCESSOR("+", SumProcessor);
//------------------------------------------------------------------------------
Real SumProcessor::ComputeImpl(Express... | ALGO | 0.995954 | 5.812123 |
ed667c6b-330f-4f17-aa34-8d7e0219811d | leftrk/tools | archives/aoapc-bac2nd-master/ch10/UVa580.cpp | // UVa580 Critical Mass
// Rujia Liu
#include<iostream>
using namespace std;
int f[31], g[31];
int main() {
f[0] = f[1] = f[2] = 0;
g[0] = 1; g[1] = 2; g[2] = 4;
for(int n = 3; n <= 30; n++) {
f[n] = 1 << (n-3);
for(int i = 2; i <= n-2; i++)
f[n] += g[i-2] * (1 << (n-i-2));
g[n] = (1<<n) - f[n... | ALGO | 0.999752 | 3.903025 |
c7a5790c-5ef5-4d36-8c71-ca5367c7608c | dylanneve1/PixelPlus-Magisk | zygisk/module/jni/libcxx/test/std/containers/associative/multiset/equal_range_transparent.pass.cpp | // UNSUPPORTED: c++98, c++03, c++11
// <set>
// class multiset
// template<typename K>
// pair<iterator,iterator> equal_range(const K& x); //
// C++14
// template<typename K>
// pair<const_iterator,const_iterator> equal_range(const K& x) const; //
// C++14
#include <cassert>
#inc... | TEST | 0.939985 | 5.303455 |
55cadb26-0e05-4dd9-a19f-73cc925c8f30 | ImtiazAhmedAkash/Problem-Solving | codeforces/200/B.cpp | // Drinks
#include <bits/stdc++.h>
using namespace std;
/*
* The answer is the average of the given values.
*
*/
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int t, val;
double sum = 0;
cin >> t;
for (int i = 0; i < t; i++)
{
cin >> val;
sum += val;
... | ALGO | 0.995674 | 4.963577 |
5a4f2575-6118-4dd8-8898-70cea4ca118b | FVR-355R/355R-2019-2020 | PreBatavia1/RedLeft/src/main.cpp | /*----------------------------------------------------------------------------*/
/* */
/* Module: main.cpp */
/* Author: VEX ... | TOOL | 0.94894 | 5.658377 |
4142c1d2-726d-44f3-8fb8-b4bfee770e74 | Arin016/DSA | bit manipulation/contributiontechniqueinbits.cpp | /*
Given An infinite string: S = "011011100101110111100010011010..."
this is the binary rep of numbers 0,1,2,3,4.... concatenated in a string
q queries: of the form ?k => you have to find the index of the k-th 1 in this string
*/
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define F first
#defi... | ALGO | 0.999877 | 5.250066 |
22dc9e9e-21fe-405d-9e75-37e0bd65bc47 | brunorhafael/Codes | C and C++/Decimal para binário.cpp | #include <stdio.h>
#include <conio.h>
int main(void){
int resto, binario=0, poten10=1, n;
printf("Digite o numero em Decimal: ");
scanf("%d", &n);
while(n >=1){
resto = n % 2;
binario = binario + resto * poten10;
n /=2;
... | ALGO | 0.994609 | 4.210749 |
5ddc63e2-e78c-4fb4-8882-f7698284fbb8 | Coder-pipo/C---learning-codes | perfectpermutation.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
cin>>n;
int arr[n]={0};
arr[0]=n;
int x=1;
for(int i=1;i<n;i++)
{
arr[i]=x;
x++;
}
... | ALGO | 0.999688 | 4.103879 |
00e31f7d-65c9-4832-9ce0-0a9dc2806a22 | wanyding/leetcode_practicing | tree/tree114.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
void flatten(TreeNode* root) {
if(root==NULL)return;
stack<TreeNode*> s;
... | ALGO | 0.999977 | 5.638162 |
1e1fb8f9-db01-49e1-8823-5ae6060a1a3f | chandru007raju/CodingNinjas | DSA using C++/Lecture-3 Recursion1/Code/print.cpp | #include<iostream>
using namespace std;
void print(int n){
if(n==0){
return;
}
print(n-1);
cout<<n<<" ";
}
int main(){
int n;
cin>>n;
print (n);
}
| ALGO | 0.99963 | 4.868814 |
4d31c417-d147-4eee-9304-b797a146288d | Vanshita0771/Programming-in-Java- | Hashing/Majority Element.cpp | //{ Driver Code Starts
//Initial Template for Java
import java.util.*;
import java.io.*;
import java.lang.*;
class Geeks
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int t = sc.nextInt();
while(t-- > 0)
{
int n =sc.nextInt... | ALGO | 0.999208 | 4.049648 |
08102be5-a26e-4a4b-8070-d9f189c46e1a | akib-pixel/Alogorithm-Cpp- | Count_Me.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
cin.ignore();
while (t--)
{
string sen;
getline(cin,sen);
map<string, int> wc;
stringstream ss(sen);
string word;
string mw;
int maxC = 0;
while (ss >... | ALGO | 0.999816 | 4.486722 |
ff76bc9c-f865-4ec5-b6f3-97009d27a9ad | RosaCaridad/ardurep | APMrover2/Steering.cpp | #include "Rover.h"
/*
work out if we are going to use pivot steering
*/
bool Rover::use_pivot_steering(float yaw_error_cd)
{
// check cases where we clearly cannot use pivot steering
if (control_mode->is_autopilot_mode() || !g2.motors.have_skid_steering() || g.pivot_turn_angle <= 0) {
pivot_steerin... | TOOL | 0.857838 | 5.625246 |
a2c0148e-4ff7-4509-9035-9d0c27e4b09b | rohan920git/DSA-C- | extracharsINstring.cpp | class Solution {
public:
int minExtraChar(string s, vector<string>& dictionary) {
int n = s.length();
int dp[n + 1]; // dp[i] represents the minimum number of extra characters up to index i
unordered_set<string> dict;
for (auto word : dictionary) {
dict.insert(word)... | ALGO | 0.999734 | 6.447276 |
671584d5-51ad-47d0-b66b-cc4e580d66f9 | ishandutta2007/codeforces | aidos/normal/159/C.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <queue>
#include <ctime>
#include <ext/pb_ds/detail/standard_policies.hpp>
#include <ext/pb_ds/assoc_container.hpp> // .
#include <ext/pb_ds/tree_po... | ALGO | 0.999971 | 3.147961 |
fac09e8b-27e0-47c7-88c8-b7622e0f628c | GabrielH9981/Economizas | Library/PackageCache/com.unity.ide.visualstudio@2.0.14/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.h>
#include "BStrHolder.h"
#include "ComPtr.h"
#include "dte80a.tlh"
constexpr int RETRY_INTERVAL_MS = 150;
constexpr int TIMEOUT_MS = 10000;
// Often a DTE call made to Visual Studio can fail after ... | TOOL | 0.949674 | 6.969462 |
e249c2f9-baf2-41f1-bd9a-4fc68c6fadb7 | imtiaz1710/competitive-programming | hacker earth/code monk/prefix evolution.cpp |
#include <iostream>
using namespace std;
int top=-1;
void push(int x,int stk[])
{
stk[++top]=x;
}
void pop()
{
top--;
}
int main()
{
int tmp;
string s;
getline(cin,s);
int stk[3];
for(int i=s.size()-1;i>=0;i--)
{
if(s[i]==' '||s[i]==',')
continue;
else if(s[i]... | ALGO | 0.999952 | 3.63045 |
3916365b-d5cc-4ab7-a018-79ab34c687f3 | eraserhd/ehk | topcoder/archive/TheNumberGameDivOne.cpp | #include <algorithm>
#include <cmath>
#include <functional>
#include <string>
#include <vector>
#include <iostream>
#include <sstream>
using namespace std;
struct TheNumberGameDivOne {
string find(long long n) {
std::vector<int> factors;
while (n > 1 && n%2 == 0)
factors.push_back(2), n... | ALGO | 0.999755 | 4.548691 |
f05503fe-1116-4588-8988-9c0f465d712d | anetreba/HalfMarathonCpp | Sprint02/t03/src/tesLibrary.cpp | #include "header.h"
void valid_file(std::ifstream& file) {
while (file.peek() == ' ')
file.ignore(1);
if (!file || file.peek() == EOF) {
std::cerr << "error" << std::endl;
exit(1);
}
}
void print(std::multimap<std::string,std::string>& multimap) {
int count;
std::vector<std... | TOOL | 0.882288 | 4.138029 |
e4b668db-3919-45c8-b9c0-bb560ae75888 | Domain-Cmap/assignments-day-1-to-day-9-Surbhisharma10 | Day 5/Medium/3.cpp | #include <vector>
using namespace std;
int findMin(vector<int>& nums) {
int left = 0, right = nums.size() - 1;
while (left < right) {
int mid = left + (right - left) / 2;
if (nums[mid] > nums[right]) {
left = mid + 1; // Minimum must be in the right half
} else {
... | ALGO | 0.999941 | 6.31214 |
3f34fac0-b629-461f-b4b5-9a219800d6bc | JobHaver/leetCode | append-characters-to-string-to-make-subsequence.cpp | class Solution {
public:
int appendCharacters(string s, string t) {
int j = 0;
for(int i = 0; i < s.size() && j < t.size(); i++)
if(s[i] == t[j])
j++;
return t.size() - j;
}
}; | ALGO | 0.999926 | 6.009885 |
61ea569c-3cdb-491b-8b69-05ff918e8056 | nyumaeric/passing_data | 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 |
01bdb726-7f5c-4074-b75b-ef34c53d11f1 | mertpasacukur/riscv_llvm | llvm/lib/Transforms/Utils/BreakCriticalEdges.cpp | #include "llvm/Transforms/Utils/BreakCriticalEdges.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/BlockFrequencyInfo.h"
#include "llvm/Analysis/BranchProbabilityInfo.h"
#include "llvm/Analysis/CFG.h"
#include "llvm/Analysis/LoopInfo.h"
#inclu... | TOOL | 0.999411 | 7.670366 |
96ea9904-efbb-4707-a063-c4c9312cb341 | Bertik23/calvodax | src/numbers/integer.cpp | #include "integer.h"
std::ostream &operator<<(std::ostream &os, const Integer &n) {
n.print(os);
return os;
}
Integer::Integer(const std::string &str)
: number(find_representation(Digits::from_str(str))) {}
Integer::Integer(i32 i) : number(find_representation(Digits(i))) {}
Integer::Integer(Digits i) : ... | TOOL | 0.8811 | 5.957066 |
a3357b11-9bc7-4bb3-a5ac-db886cc1d6ef | yashagg16/LeetCode-Problems | largest-number/largest-number.cpp | class Solution {
public:
static bool cmp(string& a, string& b){
return (a+b) > (b+a);
}
string largestNumber(vector<int>& nums) {
vector<string> str;
for(int i=0; i<nums.size(); i++){
str.push_back(to_string(nums[i]));
}
sort(str.begin(),... | ALGO | 0.999997 | 6.187728 |
1d6175f8-1428-40e7-9ed5-ead3fe34fbfd | ishandutta2007/codeforces | farhod_farmon/normal/955/E.cpp | #include <bits/stdc++.h>
#define fi first
#define se second
#define fin(s) freopen( s, "r", stdin );
#define fout(s) freopen( s, "w", stdout );
const long long N = 100100;
const long long Q = 10100;
const long long mod = 1e9 + 7;
const long long block = sqrt(N);
using namespace std;
int n;
int a[N];
int t[4 * N];
i... | ALGO | 0.99993 | 3.787053 |
8b0f4823-d0a9-4697-8347-67d728525a83 | lucasj26/hw3 | hw3_tests/testing_utils/misc_utils.cpp | #include "misc_utils.h"
#include <sys/resource.h>
#include <iostream>
#include <sstream>
#include <cstring>
std::string stackLimToString(rlim_t stackLimit)
{
std::stringstream result;
if(stackLimit == RLIM_INFINITY)
{
result << "infinity";
}
else
{
result << "0x" << std::hex << stackLimit;
}
return res... | TOOL | 0.983393 | 5.524111 |
6a31cb47-b0c4-40c5-8d40-dec5431e6b0e | Ahsanprantik/My_codes | Contest_programs/CF_485/a.cpp | #include <bits/stdc++.h>
#define INi(x) scanf("%d", &x)
#define INii(x, y) scanf("%d %d", &x, &y)
#define Oi(x) printf("%d\n", x)
#define Oii(x, y) printf("%d %d\n", x, y)
#define OCSi(c, x) printf("Case %d: %d\n", c, x)
#define Os(s) printf("%s\n", s)
#define OCSs(c, s) printf("Case %d: %s\n", c, s)
#define INs(s) sc... | ALGO | 0.995761 | 3.390555 |
11c6fa97-b5f4-411b-8994-91f37d01f2f8 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_10973_11.cpp | #include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
void add(int &x, int y) {
x += y;
if (x >= mod) x -= mod;
}
int get(char x) { return 'z' - x; }
int rget(char x) { return x - 'a'; }
int main() {
ios_base::sync_with_stdio(0), cin.tie(0);
int n, k;
cin >> n >> k;
string s;
cin >> s;
... | ALGO | 0.999989 | 4.511153 |
e87eb278-498a-45df-b4c8-a026ef45b4e1 | ashrafulislampro/XPSC_Problems_Solution | Week_04_Topicwise/C_Ski_Resort.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
int n, k, l = 0, r = 0, q, cnt = 0, mx_cnt = 0;
cin >> n >> k >> q;
vector<int> v(n);
for (auto &x : v)
{
cin >> x;
if (x <= q)
{
cnt++;
}
else
{
cnt = 0;
}
... | ALGO | 0.999758 | 4.039795 |
bdc549c0-8f61-40a7-83e7-b29cb3f28294 | AniKouDev/CodeChef | 0-1000 Beginner Level/Chef_and_Candies.cpp | #include <iostream>
using namespace std;
#define breakline cout<<endl
int main(){
int t;
cin >> t;
while(t--){
int n, x;
cin >> n >> x;
if(n>x)
{n = n-x;
if(n%4 == 0)
cout << n/4;
else
cout << n/4 + 1;}
else
cout <... | ALGO | 0.999707 | 3.700827 |
95c043c7-633f-46a5-bb89-2fa27f2455b1 | Hyunsuke/R-Type_ | server/src/systems/UpdatePositionSystem.cpp | #include "GameLoop.hpp"
#include "Server.hpp"
void UpdatePositionSystem::updateWithoutWalls(EntityManager& entityManager, ComponentManager& componentManager, float deltaTime) {
for (Entity entity : entityManager.getEntities()) {
auto position = componentManager.getComponent<Position>(entity);
auto ... | ALGO | 0.956726 | 3.677815 |
4c593f09-50f3-46e5-a93a-4885a90150dd | ishandutta2007/codeforces | leapfrog/normal/1367/F1.cpp | //
#include<bits/stdc++.h>
using namespace std;
template<typename T>inline void read(T &x)
{
x=0;char c=getchar(),f=0;
for(;c<'0'||c>'9';c=getchar()) if(!(c^45)) f=1;
for(;c>='0'&&c<='9';c=getchar()) x=(x<<1)+(x<<3)+(c^48);
if(f) x=-x;
}
int T,n,a[200005],b[200005],le[200005],ri[200005],pos[200005],dp[200005][3],nu... | ALGO | 0.999831 | 4.482965 |
63dc6762-db6f-4661-9d96-b76b3422c954 | ur0/webkit-source | ThirdParty/ANGLE/samples/shader_translator/shader_translator.cpp | #include "GLSLANG/ShaderLang.h"
#include <assert.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sstream>
#include <vector>
#include "angle_gl.h"
//
// Return codes from main.
//
enum TFailCode
{
ESuccess = 0,
EFailUsage,
EFailCompile,
EFailCompilerCreate,
};
... | TOOL | 0.85011 | 3.338638 |
a85eeea9-582c-4391-96c3-e506dc7a7693 | ishandutta2007/codeforces | vladgavrila/normal/626/E.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
#define maxn 200010
int n, m;
long long sum[maxn];
int v[maxn];
long long getSum(int a, int b)
{
return sum[b]-sum[a-1];
}
double getAverage(int mpos, int lg)
{
long long sum = getSum(mpos-lg, mpos) + getSum(n-lg+1, n);
return double(sum) / (2... | ALGO | 0.999996 | 3.200752 |
895f949b-c5a2-472a-875e-2dfcf26f075b | Kaminyou/MyLeetcode | cpp_solutions/762.cpp | class Solution {
public:
bool isPrime(int num) {
if (num == 2 || num == 3 || num == 5 || num == 7 || num == 11 || num == 13 || num == 17 || num == 19 || num == 23) return true;
return false;
}
int countPrimeSetBits(int left, int right) {
int res = 0;
for (int i = left; i <= r... | ALGO | 0.999908 | 5.78371 |
c9c2c2b1-8e24-4aa9-b377-5206a1fb4ade | BlackFrogKok/test | src/libigl/igl/find_cross_field_singularities.cpp | #include "find_cross_field_singularities.h"
#include <vector>
#include <igl/cross_field_missmatch.h>
#include <igl/is_border_vertex.h>
#include <igl/vertex_triangle_adjacency.h>
#include <igl/is_border_vertex.h>
#include <igl/cross_field_missmatch.h>
template <typename DerivedV, typename DerivedF, typename DerivedM, ... | ALGO | 0.970061 | 5.684624 |
ce81dbe2-4320-4997-b699-6f363b9a5aba | TheFenrisLycaon/DSA-C-- | cp/CodeForces/0700-0799/787A.cpp | #include <cstdio>
long gcd(long a, long b){return (b == 0) ? a : gcd(b, a % b);}
int main(){
long a, b, c, d; scanf("%ld %ld %ld %ld", &a, &b, &c, &d);
long gcdac = gcd(a, c);
long target = d - b;
if((target % gcdac) != 0){puts("-1"); return 0;}
long x(0), y(0);
while((a * x - c * y) != targ... | ALGO | 0.999898 | 3.443701 |
ebd6939f-b9e8-4d23-b710-2b25271cc2a5 | wch982167/Leetcode | Two Sum II - Input Array Is Sorted.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& numbers, int target) {
// vector<int> ans;
// map<int, int> mp;
// int var;
// for(int i=0;i<numbers.size();i++){
// var = target-numbers[i];
// if(mp.find(numbers[i])!=mp.end()){
// ans.... | ALGO | 0.999929 | 6.409242 |
cdbffede-4f8d-42f8-a472-24f5b788f793 | mhp38/LeetCode | 238. Product of Array Except Self .cpp | class Solution {
public:
vector<int> productExceptSelf(vector<int>& nums) {
int n = nums.size();
vector<int> result(n, 1);
// First pass: calculate prefix products (product of all elements to the left)
int prefix = 1; // Start with 1 because there are no elements to the left of in... | ALGO | 0.999972 | 7.25284 |
e45218c5-5a2e-450a-9b6f-a43c697131f9 | Joy773/CodeChef | Final population.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
int total, left, added;
cin >> total >> left >> added;
cout << (total - left) + added << endl;
}
return 0;
}
| ALGO | 0.996055 | 3.239327 |
e76c17a4-1dea-4825-bad4-ebebcf6b8e39 | DevWahabBaloch/imagepicker | 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 |
877de60f-c3e6-404b-91e7-2f66bf2dc891 | Archit669/data-structures-and-algorithms | dsa/8_recursion/4_sorting_algorithms/3_insertion_sort.cpp | // { Driver Code Starts
// C program for insertion sort
#include <stdio.h>
#include <math.h>
/* Function to print an array */
void printArray(int arr[], int size)
{
int i;
for (i=0; i < size; i++)
printf("%d ", arr[i]);
printf("\n");
}
// } Driver Code Ends
class Solution
{
// function to swa... | ALGO | 0.999944 | 6.071229 |
007462e6-e19c-4a1f-9e0c-e08d4c391ee9 | hyuckbin/DATASTRUCTURE | sorting/sorting.cpp | #include "sorting.h"
#include <iostream>
#define DEBUG
using namespace std;
void sorting::swap(int& a , int& b){
int temp = a;
a = b;
b = temp;
}
void sorting::printAll(int* arr , int n){
for(int i=0; i<n; i++){
cout << "[" <<arr[i]<<"] ";
}
cout << endl... | ALGO | 0.999923 | 4.648993 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.