uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
35969e5d-51e1-448f-96e2-966aedbbc322 | skygupta07/cpp | 36_BinaryTree1/10_evaluateBooleanBinaryTree.cpp | #include <bits/stdc++.h>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(nullptr), right(nullptr) {}
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), left(... | ALGO | 0.999982 | 5.999393 |
cef251e4-53de-42c5-8e92-eabefea6d742 | Khawoat6/skill-by-cpe22 | 6-2-16/Amazing_Factor.cpp | #include<iostream>
using namespace std ;
int main()
{
int input=1 ;
while(input != 0)
{
int check = 0 , sum= 0;
cin >> input;
for(int i=1 ; i<input ;i++)
{
if(check == 0 )
{
for(int j=2 ; j<input ; j++)
{
if(input%j==0)
{
check = 1;
}
}
}
if( input%i... | ALGO | 0.999973 | 4.665589 |
a9a15bcd-ddfc-44d5-a781-63a211d120bd | sunil8387/Data-Structure-Coding-ninjas | generic_trees/preorder_print.cpp | #include<iostream>
#include<queue>
#include<climits>
using namespace std;
template <typename T>
class treenode
{
public:
T data;
vector<treenode*> children;
treenode(int d){
data=d;
}
};
treenode<int> * takeInputLevelWise(){
int rootdata;
cout<<"enter root data: ";
cin>>rootdata;
treenode<int>* root=new tr... | ALGO | 0.999943 | 4.801991 |
da9adefc-ab51-4e0e-bde7-4d9c9bf7eb1e | ValeriiKoniushenko/VaKon2D | dependencies/boost_1_80_0/libs/math/src/tr1/assoc_legendre.cpp | extern "C" double BOOST_MATH_TR1_DECL boost_assoc_legendre BOOST_PREVENT_MACRO_SUBSTITUTION(unsigned l, unsigned m, double x) BOOST_MATH_C99_THROW_SPEC
{
return (m&1 ? -1 : 1) * c_policies::legendre_p BOOST_PREVENT_MACRO_SUBSTITUTION(l, m, x);
}
| TOOL | 0.902182 | 4.375299 |
da0e2990-a35a-4889-989b-5a19b72da354 | ishandutta2007/codeforces | krk/normal/508/C.cpp | #include <cstdio>
using namespace std;
const int nil = 315;
const int Maxm = 645;
int m, t, r;
int a[Maxm];
bool tk[Maxm];
int ison[Maxm];
int res;
bool Candle(int pos)
{
while (pos >= 0 && tk[pos]) pos--;
if (pos < 0) return false;
tk[pos] = true;
for (int i = pos; i < pos + t && i < Maxm; i++)
ison[i]++;
re... | ALGO | 0.999965 | 3.905685 |
3dd55adb-0caf-40cf-8155-edcc5527e8e7 | HarshitDhingra/Competitive-Programming | Dynamic Programming Foundation/count a+b+c subsequences.cpp | #include <bits/stdc++.h>
using namespace std;
int solve(string s)
{
int n = s.length();
int a = 0;
int ab = 0;
int abc = 0;
for (int i = 0; i < n; i++) {
if (s[i] == 'a') {
a = 2 * a + 1;
}
else if (s[i] == 'b') {
ab = 2 * ab + a;
}
e... | ALGO | 0.999767 | 3.804083 |
fcb4cb9a-3fdd-41e2-bc43-3b0b96c16f63 | Ziad-Fahmy/ICPC-Assiut-Materials | C. Replacement.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)cin>>arr[i];
for(int i=0;i<n;i++)
{
if(arr[i]>0) arr[i]=1;
else if(arr[i]<0) arr[i]=2;
cout<<arr[i]<<" ";
}
}
| ALGO | 0.999881 | 3.695642 |
068a0f02-305d-4de0-8a14-032b25156942 | Hafiz-sustswe/Operating-System-Algorithms-Materials-and--Codes | OS-Algorithm-cpp-Codes/Round-robin(Varying-time-quanta).cpp | //Round Robin scheduling algorithm (with variable time quantum) :
#include <iostream>
#include <vector>
using namespace std;
struct Process {
int process_id;
int arrival_time;
int burst_time;
int remaining_time;
int wait_time;
int turnaround_time;
};
void calculate_round_robin(vector<Process... | ALGO | 0.999989 | 4.3883 |
39198be9-5e45-4f58-aef2-43bf55e95c19 | call-me-bammer/montmartre-hill | baekjoon/14499/main.cpp | #include <iostream>
using namespace std;
int col[4] = {0, 0, 0, 0};
int row[4] = {0, 0};
int d[][2] = { {0, 0}, {0, 1}, {0, -1}, {-1, 0}, {1, 0} };
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int n, m, x, y, k;
cin >> n >> m >> x >> y >> k;
int map[n][m];
for (int i = 0; i < n; ... | ALGO | 0.999974 | 4.343556 |
f2991d0f-883c-4a3b-a1c4-554c3e9beb97 | c0rwil/cse_310 | Project1/src/QS.cpp | // ***************************************
// * Carlos Corral-Williams | 1222280826 *
// ***************************************
#include <iostream>
#include "QS.h"
using namespace std;
// constructor for the quicksort
QuickSort::QuickSort(int *arr, int len, int dispArr, int dispRes, int displayCompCount)
{
this->... | ALGO | 0.999426 | 4.937218 |
30abd98b-c83e-4216-8740-4591c0a2ab0f | Stayaccept/LeetCode | 76. 最小覆盖子串.cpp | class Solution {
public:
map<char,int> mp1,mp2;
map<char,int>::iterator ite;
int judge(){
char u;
for(ite=mp2.begin();ite!=mp2.end();ite++){
u=ite->first;
if(mp1[u]<ite->second)
return 0;
}
return 1;
}
string minWindow(string s, str... | ALGO | 0.999982 | 6.011104 |
5a7707c9-3e15-4a9b-a127-1b8de5d88254 | SCS2017/Leetcode-Solution | 数组/287_寻找重复数.cpp | /*
给定一个包含 n + 1 个整数的数组 nums,其数字都在 1 到 n 之间(包括 1 和 n),可知至少存在一个重复的整数。
假设只有一个重复的整数,找出这个重复的数。
示例 1:
输入: [1,3,4,2,2]
输出: 2
示例 2:
输入: [3,1,3,4,2]
输出: 3
说明:
不能更改原数组(假设数组是只读的)。
只能使用额外的 O(1) 的空间。
时间复杂度小于 O(n2) 。
数组中只有一个重复的数字,但它可能不止重复出现一次。
*/
#include <bits/stdc++.h>
using namespace std;
//更改原数组
class Solution {
public:
... | ALGO | 0.999961 | 5.346809 |
54d56bb2-baf1-4390-950e-a0bc0659eabb | raincross7/code-similarity | codes/train_code/problem426/problem426_19.cpp | #pragma once
#include <stdio.h>
#include <string>
#include <iostream>
#include <queue>
using namespace std;
string S[1001];
long result=0;
int H,W,N;
long minmytime[1000][1000];
queue<int> qx,qy,mytime;
int sx,sy,gx,gy;
int step = 0;
int main(){
scanf("%d%d%d",&H,&W,&N);
for(int i=0;i<H;i++){
cin>>S[i];
for(in... | ALGO | 0.999494 | 3.173919 |
4f74eac3-6161-428f-9d1c-eeff5be05d7f | shishirkj/DSA | strings/checkpalindrome.cpp | /* Problem Statement-
You are given a string 'S'.Your task is to check wheter the string is palindrome or not.For checking palindrome,consider alphabets and numbers only and ignore the symbols and whitesoaces.
Note:
String 'S' is NOT case sensitive
Example :
S = "c1 0$d@eeD 01c"
o/p = 1
PROBLEM LINK --> https://w... | ALGO | 0.999714 | 5.145114 |
2c0d109d-8463-4f1f-9309-8214f14ba249 | vivekmangal204/Best-DSA-Course-By-Coder-Army | DSA - Coder Army/2. 2D ARRAYS (5 Lectures)/3. 2D Array Interview Questions - 2/Homework/homework.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
// Q1. Left Rotate Matrix K times.
vector<vector<int>> rotateMatrix(int N, int M, int K, vector<vector<int>> Mat)
{
// code here
for (int i = 0; i < N; i++)
{
int k = K % M;
// Reverse the first k elements
... | ALGO | 0.999852 | 4.958262 |
34c201b9-9ba3-48f6-8e7a-a9fa30d5f000 | sarvex/leetcode-jai | solution/0700-0799/0789.Escape The Ghosts/Solution.cpp | class Solution {
public:
bool escapeGhosts(vector<vector<int>>& ghosts, vector<int>& target) {
int tx = target[0], ty = target[1];
for (auto& g : ghosts) {
int x = g[0], y = g[1];
if (abs(tx - x) + abs(ty - y) <= abs(tx) + abs(ty)) {
return false;
... | ALGO | 0.999901 | 6.192601 |
ad1a72c8-c542-4cbc-a441-a1689ee1a63d | ardac67/cpp | cppexercises/Chapter 8 Operator Overloading and References/q3.cpp | #include <iostream>
#include <vector>
using namespace std;
class Imaginary{
public:
Imaginary(double real,double imaginary):realP(real),imaginaryP(imaginary){}
Imaginary(double realPart):realP(realPart),imaginaryP(0){}
Imaginary(){realP=0.0;imaginaryP=0.0;}
friend bool operator ==... | ALGO | 0.970841 | 3.848446 |
ca1c0601-4bbc-4380-b0ed-e79cc0647b8a | AbhishekNaik1112/LeetCode | 3312-number-of-changing-keys/3312-number-of-changing-keys.cpp | class Solution {
public:
int countKeyChanges(string s) {
int n = s.size();
int ct = 0;
for (int i = 0; i < n; i++)
s[i] = tolower(s[i]);
for (int i = 1; i < n; i++) {
if (s[i - 1] != s[i])
ct++;
}
return ct;
}
}; | ALGO | 0.99996 | 5.67566 |
c4cf947c-c389-44c5-aa75-30472fb7128e | srijanaryal/insta-UI | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
8139f205-24ec-469d-a5bd-6468ac7770c0 | rajanraj2/DSA | Step 13/Lec_02/11_Right_Left_View_BT.cpp | // Link - https://leetcode.com/problems/binary-tree-right-side-view/
// Binary Tree Right Side View
/**
* 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),... | ALGO | 0.99989 | 6.986138 |
23d69e9f-c5b6-4f17-a42b-b1f9c5d49130 | harshgunwant/NeetCode150 | 637-average-of-levels-in-binary-tree/average-of-levels-in-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.99996 | 6.857942 |
44d12d50-ddca-4952-b359-4515dbc59c1c | alexrqcat/PRO1-FIB | P2 - First Loops/P59539.cpp | #include <iostream>
using namespace std;
int main() {
cout.setf(ios::fixed);
cout.precision(4);
double n;
cin >> n;
double aux = 0;
for (double i = 1 ; i <= n ; ++i){
aux = aux + 1 / i;
}
cout << aux << endl;
}
| ALGO | 0.999501 | 3.903353 |
b8397b5d-15c9-4ba3-bce4-03d00b7fff7e | Yosiky/yandex-belts | yellow/task4.1/stats.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
// enum class Gender {
// FEMALE,
// MALE
// };
// struct Person {
// int age; // возраст
// Gender gender; // пол
// bool is_employed; // имеет ли работу
// };
// // Это пример функции, его не нужно отправлять вместе с фун... | TOOL | 0.995375 | 4.759062 |
59e9b464-ffbc-4ef5-80bf-215d73c9a685 | adu2706/DSA_CODES | sweep line/solve_interval_3.cpp | #include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define int long long
using event = pair<pair<int, int>, pair<int, int>>;
void solve() {
int n;
cin >> n;
vector<event> events;
for (int i = 0; i < n; i++) {
int l, r, x;
cin >> l >> r >> x;
events.... | ALGO | 0.999935 | 4.539075 |
a7f70497-4e8e-4961-bf18-47d2b4bcaf4e | hanaessam/graphics_drawing_algorithms | project_2d_package/clippingalgorithm.cpp | #include "clippingalgorithm.h"
#include "linealgorithm.h"
#include <algorithm>
#include <tchar.h>
#include <windows.h>
#include <iostream>
#include <cmath>
using namespace std;
struct Vertex
{
double x,y;
Vertex(int x1=0,int y1=0)
{
x=x1;
y=y1;
}
};
union OutCode
{
unsigned All:4;
... | ALGO | 0.998994 | 4.260042 |
e5a1dc5d-b6f8-4d5c-8925-299809df54f0 | sanchit-sinha/CP | Contests/Newton-School/Contest1/C/sol.cpp | #include "bits/stdc++.h"
using namespace std;
#define IOS {ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
#define pb push_back
#define ll long long
#define ld long double
#define all(c) (c).begin(),(c).end()
#define sz(c) (int)(c.size())
#define mp make_pair
#define mt make_tuple
#define get(x,c) get<x>(c)
#defin... | ALGO | 0.999951 | 4.544033 |
15135524-97cb-4866-a57f-ad6e184abca8 | Abhaycl/CarND-MPC-2P5 | src/Eigen-3.3/unsupported/doc/examples/MatrixSquareRoot.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
const double pi = std::acos(-1.0);
MatrixXd A(2,2);
A << cos(pi/3), -sin(pi/3),
sin(pi/3), cos(pi/3);
std::cout << "The matrix A is:\n" << A << "\n\n";
std::cout << "The matrix square root of A is:... | ALGO | 0.998938 | 3.930508 |
5a402316-fbda-408f-a513-f409c59ac064 | GXDE-OS/opencv-mobile | opencv-4.5.4/modules/ml/src/em.cpp | #include "precomp.hpp"
namespace cv
{
namespace ml
{
const double minEigenValue = DBL_EPSILON;
class CV_EXPORTS EMImpl CV_FINAL : public EM
{
public:
int nclusters;
int covMatType;
TermCriteria termCrit;
inline TermCriteria getTermCriteria() const CV_OVERRIDE { return termCrit; }
inline void se... | ALGO | 0.995767 | 6.519388 |
8bfe6848-1472-42bd-92c3-83e7514c73d4 | ishandutta2007/codeforces | meijer/normal/1458/C.cpp | #include <bits/stdc++.h>
using namespace std;
// macros
typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ll, ll> lll;
typedef tuple<int, int, int> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<iii> viii;
typedef vector<ll> vll;
typedef vector<lll> vlll;
#defi... | ALGO | 0.999977 | 4.067221 |
df57e38d-76f4-4da2-a9ea-dffc2be4cc53 | ShankinDanila/Table_2keySpaces | laba3/table.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "item.h"
#include "first_keyspace.h"
#include "second_keyspace.h"
#include "input.h"
#include "dialog.h"
#include "table.h"
#include "menu.h"
#include "dialog.h"
struct Table* new_table() {
struct Table* newtab = NULL;
newtab = (struct Table*)callo... | TOOL | 0.954553 | 3.5999 |
c9fbb378-45b3-4fa7-92fe-48ab73ac90bd | ishandutta2007/codeforces | pwild/normal/1408/F.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef pair<ll,ll> pll;
typedef vector<bool> vb;
const ll oo = 0x3f3f3f3f3f3f3f3f;
const double eps = 1e-9;
#define sz(c) ll((c).size())
#define all(c) begin(c), end(c)
#define FOR(i,a,b) for (ll i = (a)... | ALGO | 0.999956 | 3.353103 |
9cbfb0df-cf7f-4d7e-b824-5bea784d8d3d | jyotideepjee1803/CSES-problem-solutions | Dynamic Programming/1140 Projects/DP_only_approach.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define all(a) a.begin(),a.end()
#define revall(a) a.rbegin(), a.rend()
#define srt(a,l,r) sort(a.begin()+l, a.begin()+r)
#define pb push_back
#define ai vector<int>
#define pii pair<int,int>
const int mod = 1e9+7;... | ALGO | 0.999897 | 4.338122 |
db42c78f-6fd6-4cd5-abdc-fa68e233ae69 | shishirRsiam/LeetCode-Solve | 3158. Find the XOR of Numbers Which Appear Twice.cpp | class Solution
{
public:
int duplicateNumbersXOR(vector<int> &nums)
{
vector<int> store, count(100);
for (auto val : nums)
{
count[val]++;
if (count[val] == 2)
store.push_back(val);
}
int ans = 0;
for (auto val : store)
... | ALGO | 0.999985 | 5.310284 |
e2437710-10c6-4b63-be4b-94d7b015a3f9 | geraldstanje/algorithms | tree_algos/check_bst.cpp | #include <iostream>
#include <queue>
#include <stack>
#include <set>
#include <stdlib.h>
#include "4_tree.h"
using namespace std;
class Solution {
public:
int findMin(TreeNode *root) {
if (!root) { return 10000; }
return min(root->val, min(findMin(root->left), findMin(root->right)));
}
int findMax(TreeNode *r... | ALGO | 0.999992 | 6.07606 |
9b40a24a-5a11-4fcc-8fe0-4766b0b2337f | AmeenMuhammad/PF-ITM- | UserInput.cpp | #include <iostream>
using namespace std;
int main(){
int number1 , number2 ;
cout <<"Entewr two number ";
cin >> number1 >> number2;
if (number1 > number2 )
{
cout << "The maximum number is: ";
}else{
cout <<"The maximum number is: ";
}
return 0;
} | ALGO | 0.98355 | 3.210452 |
36ca9c4a-932b-4e3f-9347-ab489f39823f | ntkay/2023aaib3 | week12/week12-6.cpp | #include <iostream>
using namespace std;
int a[10000];
int main(){
int T,N;
cin>>T;
for(int t=1;t<=T;t++){
char c,c1;
cin>>c>>c1>>N;
for(int i=0;i<N*N;i++) cin>>a[i];
int bad=0;
for(int i=0;i<N*N;i++){
if(a[i]<0) bad=1;
if(a[i] != a[N*N-1-i]) bad=1;
}
if(bad==0) cout<<"Test #"<<t<<": Symmetric.\n";
e... | ALGO | 0.98795 | 3.648418 |
fa60c43d-c372-4034-92cb-0eba9657e875 | mtbishmam/Competitive-Programming-Problems | CF 1077E - E. Thematic Contests.cpp | #include <iostream>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <queue>
#include <bitset>
#include <algorithm>
#include <numeric>
#include <math.h>
#include <iomanip>
#include <cstring>
// #include <cassert>
#include <functional>
using namespace std;
#define endl "\n"
#define pb p... | ALGO | 0.999923 | 4.589752 |
d154b67d-d61d-4473-9d71-383d5c977229 | Hima0X2/codeforces | 978B.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int i,n,c=0,d=0,g=0;
string s;
cin>>n;
cin>>s;
for(i=0;i<n;i++){
// if(s[i]=='x')c++;
if(s[i]!='x'){
c=0;
g=d+g;
d=0;
}
if(s[i]=='x'){
... | ALGO | 0.999891 | 3.694344 |
2c2a3370-ee04-4394-a062-e66bdc228daf | ssungk/study | C++/lab04/lab04_06/utilityfunctions.cpp | #include "fraction.h"
CFraction add(const CFraction& fr1,const CFraction& fr2)
{
int n = (fr1.m_nNumerator)*(fr2.m_nDenominator) + (fr1.m_nDenominator)*(fr2.m_nNumerator);
int d = (fr1.m_nDenominator)*(fr2.m_nDenominator);
return CFraction(n,d);
}
CFraction subtract(const CFraction& fr1,const CFraction& fr2 )
{
i... | TOOL | 0.95921 | 4.361609 |
95f1178d-c02f-43d4-a3af-78beda7b5c72 | pranavajith/CP-Practice | CP (Until Creation of Repo)/codeforces/439A.cpp | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define ll long long
void solve(){
ll n,d;
cin>>n>>d;
vector <ll> v;
for (int i=0;i<n;i++){
ll m;
cin>>m;
v.push_back(m);
}
ll s = 0;
for (auto w: v){
s+=w;
}
// cout<<endl<<s+10*v.size... | ALGO | 0.999711 | 3.617241 |
38a99c24-5202-439a-b3ef-c9729910a6c6 | KudusMusah/gp_chat | 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 |
adff1bf6-c41c-469d-a6f5-2cc7587945ac | sublingbling/coding-everyday | 12_07_2016_triangle/qingsi.cpp | class Solution {
vector<int> DP;
public:
int minimumTotal(vector<vector<int>>& triangle) {
int numRows = triangle.size();
if (numRows == 0) {
return 0;
}
DP = triangle.back();
for (int i = numRows-2; i >= 0; i--) {
for (int j = 0; j < i+1; j++) {
... | ALGO | 0.999967 | 6.644444 |
54d7c3be-4313-4089-a1c2-06d9832803e8 | Diogotb/CursoFlutterA | exemplo_persistencia_sp/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.998334 | 6.76073 |
aafdd921-e5c6-4d4e-ab2c-38704415da37 | shubhkamble26/SOS-2021 | Array/max_min_ar.cpp | #include<iostream>
#include<climits>
#include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
int max_elem=INT_MIN;
int min_elem=INT_MAX;
for(auto x:arr){
max_elem=max(max_elem,x);
min_elem=min(min_... | ALGO | 0.999893 | 4.528575 |
1935be3d-87ca-46ab-a5fa-53cb8ac6914a | Ronnie-Git/LeetCode | 0.题库/387_字符串中的第一个唯一字符.cpp | int firstUniqChar(char* s) {
int *num_s = (int *)calloc(sizeof(int), 128);
int *num_t = (int *)calloc(sizeof(int), 128);
for (int i = 0; s[i]; i++) {
num_s[s[i]] += 1;
num_t[s[i]] = i;
}
int flag = -1;
for (int i = 0; s[i]; i++) {
if (num_s[s[i]] == 1) {
flag ... | ALGO | 0.993901 | 3.872751 |
2b8665bf-42c7-47b6-abf9-d6c5b7abebfc | simX/d2x-xl | tags/v1.13.126/effects/perlin.cpp | #include <math.h>
#include <stdlib.h>
#include "perlin.h"
static long randSeed = 0;
//------------------------------------------------------------------------------
double Noise1D (long x)
{
#if 1
srand (randSeed * (x + 2));
x = rand ();
return (double) (x - (((long) RAND_MAX + 1) / 2)) / (double) (((long) RAND... | ALGO | 0.999729 | 6.387634 |
4d3088bb-7679-43c1-85ad-d803d34f76e1 | combofish/leetcode-solutions-cpp | src/HOT-100/hot_253.cpp | /**
-- question: 会议室 II
-- method:
- []
--result:
-- analyse:
Time: O()
Space: O()
*/
#include "../combofish_utils.hpp"
#include <algorithm>
#include <functional>
#include <queue>
class Solution {
// function start.
public:
int minMeetingRooms(vector<vector<int>> &intervals) {
std::sort(intervals... | ALGO | 0.999927 | 5.758001 |
16488522-4363-427a-bf1f-29fe352484d0 | axfunds/AXFunds-old-pow | src/rpcblockchain.cpp | #include "main.h"
#include "bitcoinrpc.h"
#include "auxpow.h"
using namespace json_spirit;
using namespace std;
void ScriptPubKeyToJSON(const CScript& scriptPubKey, Object& out);
// from rpcraw.cpp
void TxToJSON(const CTransaction& tx, const uint256 hashBlock, Object& entry);
// double GetDifficulty(const CBlockInde... | WEB | 0.919067 | 6.421697 |
d07de9b7-9b34-441d-9bbf-57d665326003 | AbhayGoyal/Starters | cpp/ASSIGN.CPP | Q1.
#include<iostream.h>
#include<conio.h>
class ops
{
public:
double num1,num2;
ops(){}
ops(int num1,int num2)
{
num1=num1;
num2=num2;
}
ops operator *(ops b)
{
ops temp;
temp.num1=num1*b.num1;
temp.num2=num2*b.num2;
return... | TOOL | 0.899715 | 3.633396 |
538f03bd-284a-4f8a-adcc-a286e041f9bb | govinddwivedi-git/Codeforces-Solutions | D_2_Encrypting_Messages.cpp | #include <bits/stdc++.h>
using namespace std;
// Macros and constants
#define pb push_back
#define endl ("\n")
#define pi (3.141592653589)
#define int long long
#define float double
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(), c.end()
#define mini(a, b, c) min(... | ALGO | 0.999993 | 3.702764 |
232db0b3-d50c-4744-97fc-5822b0317d69 | imrankhalid001/flutter_get_api | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
36166803-b07d-4bc9-ae32-d5f7e1f5404e | asek-ll/ray-tracer-cpp | src/Sphere.cpp | #include "Sphere.h"
std::optional<float> Sphere::intersect(const Ray &ray)
{
auto l = center - ray.origin;
auto adj = l.dot(ray.direction);
auto d2 = l.dot(l) - (adj * adj);
auto radius2 = radius * radius;
if (d2 > radius2)
{
return {};
}
auto thc = sqrt(radius2 - d2);
auto t0 = adj - thc;
... | TOOL | 0.935498 | 4.950806 |
f4d9e96b-cb0a-497a-b35e-3219faac656e | VishalBhat07/striver-dsa-course | Binary Search/BS on 1D Arrays/04_searchInsertPosition.cpp | #include <iostream>
#include <vector>
using namespace std;
int searchInsert(vector<int> v, int x)
{
int l = 0;
int r = v.size() - 1;
int mid = l - (l - r) / 2;
int ans = v.size();
while (l <= r)
{
if (v[mid] >= x)
{
ans = min(ans, mid);
r = mid - 1;
... | ALGO | 0.999847 | 5.379343 |
527753ad-e59b-40a1-b59c-88b099d4efd5 | eberan/urho3d_old_mirror | Source/ThirdParty/Bullet/src/BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp | //#define DISABLE_BVH
#include "BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h"
#include "BulletCollision/CollisionShapes/btOptimizedBvh.h"
#include "LinearMath/btSerializer.h"
///Bvh Concave triangle mesh is a static-triangle mesh shape with Bounding Volume Hierarchy optimization.
///Uses an interface to a... | ALGO | 0.979507 | 7.193789 |
d784151f-525c-46ae-b1f7-cace92403b93 | spirit-code/spirit | core/src/utility/Cubic_Hermite_Spline.cpp | #include <utility/Cubic_Hermite_Spline.hpp>
#include <cmath>
namespace Utility
{
namespace Cubic_Hermite_Spline
{
// See http://de.wikipedia.org/wiki/Kubisch_Hermitescher_Spline
std::vector<std::vector<scalar>> Interpolate(
const std::vector<scalar> & x, const std::vector<scalar> & p, const std::vector<scalar> &... | ALGO | 0.999605 | 6.71633 |
167a070f-6953-49c8-b14a-ffc189e1a045 | ishandutta2007/codeforces | irkstepanov/normal/12/A.cpp | #include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int main()
{
//ifstream cin("input.txt");
//freopen("input.txt", "r", stdin);
char c[3][3];
... | ALGO | 0.999966 | 3.832084 |
ac893bae-47db-4394-b46d-b992b1b15a22 | 10946009/yuihuang_zj_ans | cpe-level-1/cpp/uva-10268.cpp |
#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
using namespace std;
string s;
int x;
vector <int> v;
int main() {
while (cin >> x){
getline(cin, s);
getline(cin, s);
//cout << "s: " << s << "\n";
stringstream ss(s);
v.clear(... | ALGO | 0.999811 | 3.638858 |
a32fd9a6-74b2-46be-b2b2-73d4f3b9002c | raincross7/code-similarity | codes/train_code/problem254/problem254_201.cpp | #include <iostream>
#include <string>
#include <vector>
#include <bitset>
#include <limits>
using namespace std;
using ll = long long;
#define REP(i,n) for(ll i=0;i<(ll)(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=(ll)(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=(ll)(b);i--)
#def... | ALGO | 0.999906 | 3.992441 |
a7f1ae3c-6ff3-49be-9b78-6b231d5e8164 | weekend27/leetcode | rotateArray/rotateArray_2.cpp | // Source : https://leetcode.com/problems/rotate-array/
// Author : weekend27
// Date : 2015-12-02
/**********************************************************************************
Rotate an array of n elements to the right by k steps.
For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5... | ALGO | 0.999858 | 5.940815 |
a34b5fe9-0a86-4a68-aef0-af0c06451629 | Ivangarciam55/BubbleSort | bubbleSort/main.cpp | #include <iostream>
#include <random>
#include <ctime>
using namespace std;
void bSort();
unsigned t0, t1;
int contador = 1;
int main() {
t0 = clock();
bSort();
t1 = clock();
double time = (static_cast<double>(t1 - t0)/CLOCKS_PER_SEC);
cout << endl << "Tiempo de ejecucion: " << time << endl;
... | ALGO | 0.998559 | 4.069472 |
45cf2401-4076-4843-bf02-a4660cf4747b | mdmohidulislammi/Learning | Algorithm/Modul_1 Graph_practice/parctice_2.1.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, e;
cin >> n >> e;
int matrix[n][n];
memset(matrix,0,sizeof(matrix));
while (e--)
{
int a, b;
cin >> a >> b;
matrix[a][b] = 1;
matrix[b][a] = 1;
}
for (int i = 0; i < n; i++)
{
fo... | ALGO | 0.999972 | 3.602112 |
c6d2b5e8-2940-4c00-866d-25882bd5e092 | ShawnTSH1229/XEngine | ThirdParty/boost_1_78_0/libs/graph/example/prim-telephone.cpp | /*
IMPORTANT!!!
~~~~~~~~~~~~
This example uses interfaces that have been deprecated and removed from
Boost.Grpah. Someone needs to update it, as it does NOT compile.
*/
#include <boost/config.hpp>
#include <iostream>
#include <fstream>
#include <vector>
#include <boost/lexical_cast.hpp>
#include <boost/gra... | ALGO | 0.999151 | 5.157703 |
73831d1b-ea7b-4682-a714-8e2e165582c3 | eggplanty/CPPAlgorithmLearning | linked_list/lined_list_problem.cpp | //
// Created by XBB-PC on 2020/6/17.
//
#include <iostream>
#include <cstring>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
/*
* 160. 相交链表
* 编写一个程序,找到两个单链表相交的起始节点。
* ... | ALGO | 0.999698 | 4.254655 |
0985501c-b9a8-434e-8e0a-2e562c9a4a80 | heman666/DSA-Coding | Recursion/MaxSegments.cpp | #include<iostream>
using namespace std;
int solve(int n, int& x, int& y, int& z){
if(n==0){
return 0;
}
if(n < 0){
return INT_MIN;
}
int ans1 = solve(n-x,x,y,z)+1;
int ans2 = solve(n-y,x,y,z)+1;
int ans3 = solve(n-z,x,y,z)+1;
int maxi = max(ans1,max(ans2,ans3));
... | ALGO | 0.999979 | 4.114727 |
e98e8457-69a7-4c85-9c8d-0af23f14bb6c | leekim611/Baekjoon | 1000~4999/2231.cpp | /*
풀이 날짜: 220716
*/
#include <iostream>
using namespace std;
int sum(int n) {
int sum = 0;
while(n) {
sum += n%10;
n /= 10;
}
return sum;
}
int main() {
int num;
cin >> num;
for (int i = 0; i < num; i++) {
if (num == (i + sum(i))) {
cout << i << ... | ALGO | 0.999926 | 4.154791 |
ae75866c-70ab-443e-89ba-c9caf6444899 | sagpant/algorithms | src/binary_search_tree_demo.cpp | #include <stdio.h>
#include <generic.h>
#include <time.h>
#include "shuffle.h"
#include "binary_search_tree.h"
using namespace alg;
int main()
{
const int MAX_ELEMENTS = 10;
int key[MAX_ELEMENTS];
int value[MAX_ELEMENTS];
BST<int, int> t;
int i = 0;
srand(time(NULL));
// generate random numbers and fill them... | ALGO | 0.991088 | 3.453632 |
15278f30-6d8b-49c4-a7fc-7541754dd93e | Sandipghosh98/My_Programs | CSE 331 Coding pearls/graphs/has cycle.cpp | #include<bits/stdc++.h>
#include<vector>
#include<list>
using namespace std;
void addedge(int u,int v,list<int> *adj){
adj[u].push_back(v);
adj[v].push_back(u);
}
void display(list<int> *adj){
for(int i=0;i<5;i++){
cout<<"vertex: "<<i<<endl;
for(list<int> :: iterator it=adj[i].begin(); it!=adj[i].end(); it++)... | ALGO | 0.999849 | 4.042793 |
408faf58-d6f8-4ff6-bcfc-b008c55b2737 | sacckey/atcoder | abc172/abc172_d.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
vector<long long> divs(10000010);
for (int i = 1; i <= n; i++){
for (int j = i; j <= n; j+=i)
{
divs[j]++;
}
}
long long ans = 0;
for (long long i = 1; i <= n; i++)
{
ans += i*divs[i];
}
cout << ans <... | ALGO | 0.999853 | 4.57673 |
bd52abd1-5ca7-4da3-9aab-4fe61b89d4a5 | chandepire/chandepire | C++/multthread/main7.cpp | #include <iostream>
#include <thread>
#include <fstream>
using namespace std;
void function_al(int N,int &x)
{
int res = 1;
for(int i=N;i>1;i--)
{
res*=i;
}
cout << "Result is:" << res << endl;
x = res;
return
}
int main()
{
int x;
thread t1(function_al,4,std::ref(x));
t1.join();
return 0;
}
| ALGO | 0.998342 | 3.753215 |
1eaa630e-366b-4c67-b0c0-9e82739a13a7 | danielicapui/C- | soma.cpp | #include <iostream>
#include <iomanip>
using namespace std;
int main() {
int a,b,soma;
cin >>a>>b;
soma=a+b;
cout <<"SOMA = "<<soma<<endl;
return 0;
}
| ALGO | 0.984095 | 3.707535 |
7c07b728-7273-4efd-ac35-1e93a5c86325 | ArseniyKholod/stce_ss24_ex12 | thirdParty/eigen-3.4.0/bench/perf_monitoring/lazy_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;
template<typename MatA, typename MatB, typename MatC>
EIGEN_DONT_INLINE
void lazy_gemm(const MatA &A, const Ma... | TOOL | 0.97458 | 6.08404 |
f00b9668-1ed0-4049-906e-c0a0871bbca1 | ProdanRaduMatei/Probleme-Pbinfo | Solutions/FormNr/main.cpp | #include <iostream>
#include <cstring>
using namespace std;
char s[256];
long long suma = 0, termen, i, lung;
int main()
{
cin.getline(s, 256);
lung = strlen(s);
for (int i = 0; i < lung; ++i) {
if (isdigit(s[i])) {
termen = termen * 10 + (s[i] - '0');
}
else {
... | ALGO | 0.999103 | 3.999748 |
59e000b5-d273-4f50-ae1d-da06d58997ed | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_12957_5.cpp | #include <bits/stdc++.h>
using namespace std;
int a[2002];
vector<int> g[2002];
long long mod = 1000000007;
long long dfs(int cur, int par, int root, int d) {
long long ret = 1;
for (int e : g[cur]) {
if (e != par && (a[e] < a[root] || (a[e] == a[root] && e < root)) &&
a[e] >= a[root] - d) {
ret =... | ALGO | 0.999967 | 4.1787 |
6a1d1a8f-9444-45b9-9109-17d62cf97643 | KildoAlias/DD2380-Artificial-Intelligence-Course | A1games/Cpp_skeletons/TTT/gamestate.cpp | #include "constants.hpp"
#include "gamestate.hpp"
#include <cstdlib>
#include <inttypes.h>
namespace TICTACTOE
{
/**
* Initializes the board to the starting position
*/
GameState::GameState()
{
// Initialize the board (empty)
for (int i = 0; i < 16; i++)
{
mCell[i] = CELL_EMPTY;
}
// Initialize move related ... | TOOL | 0.934275 | 5.885999 |
c3568246-5049-4ce1-ad6f-e8c405f21845 | KhanShaheb34/Data-Structures-and-Algorithms-Notebook | Trees/SumTree.cpp | #include<bits/stdc++.h>
using namespace std;
struct node
{
int data;
node* left;
node* right;
};
int isLeaf(node *node)
{
if(node == NULL)
return 0;
if(node->left == NULL && node->right == NULL)
return 1;
return 0;
}
int isSumTree(node* node)
{
if(node == NULL)
return 0;
int ls;
int rs;
ls = isSum... | ALGO | 0.999864 | 4.759424 |
67fea3b0-1a16-4c2d-80b1-d145c013da05 | PrasadKishorDesai/Data-Structure-Programs | C++/14_Queue_using_Singly_Linked_List_Program.cpp | #include <iostream>
using namespace std;
// creating node class
class Node
{
public:
// declaring variables and initializing in constructor
int key;
int data;
Node* next;
Node ()
{
key = 0;
data = 0;
next = NULL;
}
Node (int k, int d)
{
key = k;
data = d;
next = NULL;
}
};
c... | ALGO | 0.996775 | 4.814065 |
f30863ef-412d-4443-8222-594ca0a60471 | hoangpc0112/dsa-ptit | Quay lui - Nhánh cận/DSA02039 - PHÂN TÍCH SỐ 2.cpp | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (auto i = (a); i <= (b); ++i)
#define ROF(i, a, b) for (auto i = (a); i >= (b); --i)
#define sz(x) (int)(x).size()
#define pb push_back
#define ppb pop_back
#define endl '\n'
#define fi first
#define se second
#ifdef Juhan404
#include "debug.h"
#e... | ALGO | 0.998661 | 5.081365 |
54054ee3-81e3-482e-bab8-2e36c4044abe | HectorMF/EnvironmentGenerator | ext/glm-0.9.8.1/glm/test/core/core_func_integer_bit_count.cpp | // This has the programs for computing the number of 1-bits
// in a word, or byte, etc.
// Max line length is 57, to fit in hacker.book.
#include <stdio.h>
#include <stdlib.h> //To define "exit", req'd by XLC.
#include <ctime>
unsigned rotatel(unsigned x, int n)
{
if ((unsigned)n > 63) {printf("rotatel, n out of ... | ALGO | 0.999044 | 4.574697 |
8bb77d5f-73da-416e-8ba9-83a457f18297 | catid/tonk | TonkineseBandwidth.cpp | #include "TonkineseBandwidth.h"
#include <math.h>
namespace tonk {
#ifdef TONK_ENABLE_VERBOSE_BANDWIDTH
static logger::Channel ModuleLogger("BandwidthControl", MinimumLogLevel);
#define TONK_VERBOSE_BANDWIDTH_LOG(...) ModuleLogger.Info(__VA_ARGS__);
#else
static logger::Channel ModuleLogger("BandwidthCon... | TOOL | 0.920962 | 7.675594 |
19225399-6075-4d41-a2cf-92f2c113dd55 | rammendozaa/Programacion | UVA/10696.cpp | #include <iostream>
using namespace std;
long uno(long i)
{
if(i>=101)
i=i-10;
else
i=uno(uno(i+11));
return i;
}
int main()
{
int n;
long resultado;
cin>>n;
while(n != 0)
{
resultado = uno(n);
cout<<"f91("<<n<<") = "<<resultado<<'\n';
cin>>n;
}
return 0;
}
| ALGO | 0.998574 | 3.687045 |
6a8d19a8-0cef-4481-8733-12bf1ac11bf9 | DroidTh3ory-xx/platform_frameworks_av | media/libstagefright/codecs/m4v_h263/dec/src/idct.cpp | /*
------------------------------------------------------------------------------
MODULE DESCRIPTION
This file contains the functions that transform an 8r8 image block from
dequantized DCT coefficients to spatial domain pirel values by calculating
inverse discrete cosine transform (IDCT).
------------------------... | ALGO | 0.999391 | 4.639013 |
b9a87d90-c728-469f-8e62-c573c7b2165d | maxxlef/CPP | Autonomous Car/Car.cpp | #include "Car.h"
Car::Car() : _road(nullptr), _x(0), _v(0) {} // Initialisation par défaut
// Constructeur paramétré
Car::Car(const Road *roadPtr, float initialPosition)
: _road(roadPtr), _x(initialPosition), _v(0.0), _frontCar(nullptr) {
}
// Destructeur
Car::~Car() = default;
// Accesseur pour la position d... | TOOL | 0.923531 | 4.740434 |
bf4f65e3-548d-4ac1-9d19-1ccc85539b9b | dipenluitel/hacktoberfest | hacktoberfest-2023/Hacktoberfest2023-DSA/Reverse of Number/main.cpp | #include <iostream>
using namespace std;
#include <cmath>
int main()
{
// leetcode reverse of an integer
int n = 0,a;
cin >> a;
while (a != 0)
{
if ((a > INT32_MAX / 10 || a < INT32_MIN / 10))
{
return 0;
}
n = (n * 10) + (a % 10);
a = a / 10;
... | ALGO | 0.999647 | 4.666635 |
fe76bb72-949b-4154-b1f4-e4999d257128 | xyzyzl/compprog | probs/cf/round633/a.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while(t--)
{
int n;
cin >> n;
cout << n << endl;
}
}
| ALGO | 0.999228 | 3.949975 |
6e12ecb1-1fbf-4553-8e85-8e24c357eb03 | javesshhh/DSA_codes | Precomputation.cpp | // Given array a of N integers.Given Q queries
// and in each query given L and R print sum of
// array elements from index L to R (L,R included)
// Constraints
// 1<=N<=10^5
// 1<=a[i]<=10^9
// 1<=Q<=10^5
// 1<=L,R<=N
// as L and R are starting from 1, so indexing of array will be 1 based
// #include <bits/stdc++.h>... | ALGO | 0.999532 | 5.665727 |
6f35cd43-d51f-4742-801f-666f4463a991 | alphastar-avi/CPP | sort/912_SortanArray.cpp | class Solution {
public:
void mergesort(vector<int>&nums,int l,int h){
if (l >= h) return;
int m = (l+h)/2;
mergesort(nums,l,m);
mergesort(nums,m+1,h);
merge(nums,l,m,h);
}
void merge(vector<int>&nums,int l,int m,int h){
vector<int> mer;
int i=l,j=m+1;
while(i<=m && j<=h)... | ALGO | 0.999995 | 5.705609 |
97a49ece-97f8-45a9-89fb-ec42b27d72bd | dldkddkd/Competitive-Programming | Junyoung/기본유형/2xn_타일링_2.cpp | // https://www.acmicpc.net/problem/11727
#include <stdio.h>
#include <algorithm>
using namespace std;
const int MAX = 1000 + 2;
int dp[MAX];
int main(){
int N;
scanf("%d", &N);
dp[1] = 1; dp[2] = 3;
for(int i = 3; i <= N; i++){
dp[i] = (dp[i-1] + 2*dp[i-2]) % 10007;
}
printf("%d\n", dp[N]);
return 0;
} | ALGO | 0.999971 | 4.525355 |
3523b37c-d632-4128-9cc6-29ffa60ef1df | ElickC/Older-Projects | C++/covaleA6.cpp | // File Name: Word guessing game
// Written by: Elick Coval
// Description: The program prompts the user to enters, type * to see guessed letters, type ? to guess a word,
// or type # to quit. Once the user guesses the secret word or types #, the program will display
// number of letters guessed, number of words ... | ALGO | 0.963845 | 3.646473 |
6ec8947a-7964-4fd5-b45a-8cdb4b5d4ad1 | EZIEv/TrainingDSA6.0 | 4F_Burocracy/main.cpp | #include <cstdint>
#include <iostream>
#include <vector>
#include <sys/resource.h>
using namespace std;
pair<uint64_t, uint64_t> CountCoins(int employee, vector<vector<int>>& subordinates, vector<pair<uint64_t, uint64_t>>& coins) {
uint64_t total_coins = 0;
uint64_t emp_size = 0;
for (int subordinate : s... | ALGO | 0.999811 | 4.244205 |
b83f3c40-2d71-41f3-b687-95bee975ac2c | Djokovic0311/LeetCode | problems/split_the_array_to_make_coprime_products/solution.cpp | class Solution {
public:
int findValidSplit(vector<int>& nums) {
int cnt = 0;
map<int, int> suf, pref, vis;
for(auto i : nums){
for(int j = 2; j <= sqrt(i); j++){
while(i%j == 0){
suf[j]++;
i/=j;
}
... | ALGO | 0.999955 | 5.374691 |
0e9c29c2-0b36-4592-a369-5e5ce7571c50 | qiaozishun4/CSP2024_BJ | BJ-Junior/answers/BJ-J01403/sticks/sticks.cpp | #include<bits/stdc++.h>
using namespace std;
int T,n;
string s;
int main(){
freopen("sticks.in","r",stdin);
freopen("sticks.out","w",stdout);
cin>>T;
while(T--){
cin>>n;
if(n==1){
puts("-1");
continue;
}
s="";
if(n%7==0){
while(... | ALGO | 0.999498 | 4.365398 |
5014fa9a-8bfc-4422-87c9-1715855768e1 | RXDG14/c-plus-plus | graph_list.cpp | #include<bits/stdc++.h>
using namespace std;
void addEdge(vector<int> arr[], int u, int v)
{
arr[u].push_back(v); //put element in that vertices's list
// adj[v].push_back(u); for undirected but gotta make changes other places too
}
//this doesnt work yet. will look through later. this was implemented to c... | ALGO | 0.996809 | 4.741751 |
c14acbde-a647-4095-a1f6-2447788d3c2d | hgtterry/OgreWin3D_Basic | Common_64/Bullet/Source/BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.cpp | #include "btVoronoiSimplexSolver.h"
#define VERTA 0
#define VERTB 1
#define VERTC 2
#define VERTD 3
#define CATCH_DEGENERATE_TETRAHEDRON 1
void btVoronoiSimplexSolver::removeVertex(int index)
{
btAssert(m_numVertices>0);
m_numVertices--;
m_simplexVectorW[index] = m_simplexVectorW[m_numVertices];
m_simplexPo... | ALGO | 0.999535 | 5.409675 |
50cb3b6c-5f6f-464d-a989-36bd62949121 | hashcashier/solutions | ASC20D.cpp | //ASC20D
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <cstring>
#include <algorithm>
#include <set>
#include <vector>
#include <stack>
#include <climits>
using namespace std;
typedef unsigned long long LL;
bool vf[30][30], vg[30][30][30][30];
LL f[30][30], g[30][30][30][30];
LL... | ALGO | 0.999839 | 3.623763 |
000a79bf-6252-4f93-b241-727af29686f6 | dinesh-2047/GeekForGeeks-POTD-Solutions | March-2025-POTDs/24th march - Matrix Chain Multiplication.cpp | // Matrix Chain Multiplication
// rec + memo
class Solution {
public:
int n ;
int solve(vector<int> &arr, int i , int j, vector<vector<int>> &dp ){
if(i==j) return 0;
int mini = 1e9;
if(dp[i][j] != -1) return dp[i][j];
for(int k = i ; k<j; k++){
... | ALGO | 0.99999 | 4.973307 |
9f3e21ec-c68a-4788-aead-61001b51d380 | riorafifqi/IMU-Unity-Game | MPU-9250/Library/PackageCache/com.unity.ide.visualstudio@2.0.11/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.966125 | 6.947423 |
34f2d0fe-1cfa-4d03-83ad-c5aec732afc4 | rxsh/competitive-programming | dataStructures/priorityQueue.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
/*
A priority queue maintains a set of elements. The supported operations are insertion and, depending on the type of the queue,
retrieval and removal of either the minimun or maximun element.
Insertion and removal take O(log n) time, and retrieval takes ... | ALGO | 0.999218 | 4.560395 |
706e17e5-e4e5-4c14-9ef8-e9d633d92495 | RaissaKestring/C | basico/exercicio 9.cpp | #include <stdio.h>
main ()
{
float basem, baseme, altura, area;
printf("qual a area da base maior: ");
scanf("%f",&basem);
printf("qual a area da base menor: ");
scanf("%f",&baseme);
print("qual a altura do trapezio: ");
scanf("%f",&altura);
area=(basem + baseme)*altura/2;
printf("a area do trapezio e igua... | ALGO | 0.986765 | 3.282907 |
d53ffc79-4006-4af6-aa95-2ed057ffa140 | StudyingFather/my-code | codevs/1197.cpp | #include <stdio.h>
#include <string.h>
char k[105],m[1005];
int i,j,lm,lk;
int main()
{
scanf("%s%s",k,m);
lm=strlen(m);
lk=strlen(k);
for(i=0;i<lk;i++)
if(k[i]>='A'&&k[i]<='Z')k[i]+=32;
for(i=0;i<lm;i++)
{
for(j=0;j<lk;j++,i++)
if(i>=lm)break;
else if(m[i]>='A'&&m[i]<='Z'&&m[i]-k[j]+'a'<'A'||m[i]>='a'&... | ALGO | 0.999992 | 3.502684 |
939ac685-afe6-4aa2-9ef5-f7293c0ff6cc | andrewherren/cpp_distributions | src/gig.cpp | #include <gig.h>
#include <meta.h>
#include <algorithm>
#include <cassert>
#include <cmath>
namespace CustomDists {
double SampleGIG(double p, double a, double b, std::mt19937& rng) {
assert((a > 0) || (b > 0));
assert(!((p == 0) && ((a == 0) || (b == 0))));
if (a == 0) {
return SampleInverseGamma(p, b/2., ... | ALGO | 0.999519 | 5.291432 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.