uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
874f9c6e-8885-473c-8126-f13464a0deea | KansaiUser/practicecode | Apath.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <set>
#include <tuple>
#include <algorithm>
using namespace std;
struct Node {
int f; // total cost = g + h
int g; // cost so far
int x, y;
vector<pair<int,int>> path;
// For priority queue: smallest f on top
bool operator<... | ALGO | 0.999956 | 6.044246 |
622c01e5-c6b4-4346-a6d9-13590fb9a5c7 | dubshfjh/LeetCode | 209.cpp | 将数组左右边界left和right初始化为0,循环执行直到right==size(为保证最后一个元素被分析,必须使用do-while循环):
1.不管right是否<size,先右移一次,再循环右移right直到 right==size 或者 [left...right-1]的sum>=s
2.left左移直到 [left+1...right-1]的sum<s,更新minlen = (right-1)-left+1 = right-left,回到步骤1
class Solution {
public:
int res = INT_MAX;
int minSubArrayLen(int s, vector<int>& ... | ALGO | 0.999994 | 3.858968 |
54e8805a-5d2c-4950-8023-ae024dba5c10 | ishubhranshu/code_soln | 0040-combination-sum-ii/0040-combination-sum-ii.cpp | class Solution {
public:
vector<vector<int>> ans;
void solve(int ind, int trgt, vector<int>& candidates, vector<int> &cans)
{
if(trgt==0)
{
ans.push_back(cans);
return;
}
if(ind==candidates.size() || trgt<0)
return;
for(int i=ind; ... | ALGO | 0.999994 | 6.272865 |
120f76d9-4b4a-4462-9619-59c638c55659 | ampfibi1/Collision | Main.cpp | #include<iostream>
#include <cmath>
#include "Math.h"
#include"player.h"
#include"FPS.h"
int main() {
sf::ContextSettings settings;
settings.antialiasingLevel = 10;
sf::RenderWindow window(sf::VideoMode(1080, 740), "Collision",sf::Style::Default,settings);
window.setFramerateLimit(120);
bool checkCollision =... | TOOL | 0.863094 | 3.97108 |
5e13710e-50a7-43e5-b874-92c989fec675 | Smolka99/Inkscape-W2P | src/3rdparty/2geom/tests/line-test.cpp | /** @file
* @brief Unit tests for Line and related functions
* Uses the Google Testing Framework
*/
#include "testing.h"
#include <iostream>
#include <glib.h>
#include <2geom/line.h>
#include <2geom/affine.h>
using namespace Geom;
TEST(LineTest, VectorAndVersor) {
Line a(Point(10, 10), Point(-10, 20));
L... | TEST | 0.92179 | 6.437119 |
1bf51502-4393-469a-bebb-26452ba152bd | Trunggenk/LTNC_24 | ch2/Divisible Sum Pairs.cpp | //
// Created by Trung on 2/27/2024.
//
#include <bits/stdc++.h>
using namespace std;
int divisibleSumPairs(int n, int k, vector<int> ar) {
int count=0;
for(int i =0 ; i< n ; i++)
for(int j = i+1; j<n ; j++)
{
if ((ar[i]+ar[j])%k==0) {count++;}
}
return count++;
}
int ma... | ALGO | 0.999212 | 4.905468 |
ebaa390e-de95-4efa-8075-fa60ecfb48f9 | ji5485/Problem-Solving | Deprecated_C++/Baekjoon/Recursive/9527.cpp | #include <iostream>
#include <cmath>
using namespace std;
int getPosition(long long int number);
long long int getResult(int index, long long int number);
long long int INITIAL = (long long int) 1;
int main() {
long long int a, b;
scanf("%lld %lld", &a, &b);
long long int result = getResult(getPosition(b)... | ALGO | 0.999857 | 3.900738 |
39624d75-ebe9-478a-8464-806c743c847c | rahenry/3body | src/old/radial_subsystem.cpp | #include "radial_subsystem.h"
#include "angular_subsystem.h"
#include "states.h"
#include "three_body_system.h"
radial_subsystem::radial_subsystem(three_body_system *tbs_, angular_subsystem *ang_, double m1_, double m2_, double omega1_, double omega2_, double r0_like_, double r0_unlike_) : tbs(tbs_), ang(ang_), m1(m1_... | ALGO | 0.928887 | 3.062707 |
90813064-b972-41bc-8d7f-108d2eaf48a9 | batzor/AlgorithmsForEverything | leetcode.com/0048.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
void rotate(vector<vector<int>>& matrix) {
int N = matrix.size();
for(int i = 0; i < N / 2; i++) {
for(int j = i; j < N - i - 1;j++) {
int tmp = matrix[i][j];
matrix[i][j] = matrix[N - 1 - j][i];
... | ALGO | 0.999946 | 5.14419 |
aa48be01-aee4-43be-a884-79ecc8d1ae46 | git-afuentes/practice_c_cpp | ch2_1b.cpp | /*Write code to remove duplicates from an unsorted linked list. FOLLOW UP. How would you solve this problem if temporary buffer is not allowed*/
#include <stdio.h>
#include <cstddef> //For NULL
#include <iostream>
#include <map>
using namespace std;
struct Node{
int x;
Node *next;
};
class List{
Node* head;
pu... | ALGO | 0.998616 | 4.410975 |
1b002570-e278-4c87-8e02-1ff2c32c18fb | Stars-22/luogu | Part 7 数据结构/Part 7.2 栈/P1175 表达式的转换.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int a[1000], pb = 0, pd = 0;
char b[1000], d[1000];
string c;
cin >> c;
for(int i=0; i<c.size(); i++){
if(c[i] >= '0' && c[i] <= '9'){
b[pb] = 'n';
a[pb++] = c[i] - '0';
}
if(c[i] == '^') d[pd++] = c[i];
if(c[i] == '*' || c[i] == '/'){
whil... | ALGO | 0.999976 | 3.498765 |
5e55f84c-cb6e-465f-831d-1ff564b00497 | trivedikrunal/Apna-College-DSA-Series | Lecture 6/01decimalToBinaryConversion.cpp | #include<iostream>
using namespace std;
int decimalTOBinary(int decNum){
int ans = 0;
int pow = 1;
while(decNum > 0){
int rem = decNum % 2;
decNum = decNum / 2;
ans += rem * pow;
pow *=10;
}
return ans;
}
int main(){
for(int i=1;i<=10;i++){
cout << ... | ALGO | 0.998998 | 5.667838 |
608a36a0-96b1-479b-8585-2c293fab44ee | renatostanz/gemp | classes/04-Vectors/examples/variable_vectors-HackerRank/en/shallow_copy.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int number_of_vectors;
int number_of_querries;
cin >> number_of_vectors >> number_of_querries;
vector<vector<int>> vector_of_vectors(number_of_vectors);
for (int... | ALGO | 0.999935 | 4.277478 |
088c7fbd-544f-40df-a1c2-b7d4aa800da7 | HawDinh/CodePTIT | Code_DSA/DSA06001.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int patition(int a[], int l, int r){
int x=a[r];
int i=l-1;
for (int j=l;j<r;j++){
if (a[j]<x) {
++i;
swap(a[j],a[i]);
}
}
swap(a[i+1],a[r]);
return i+1;
}
void quickSort(int a[],int l, i... | ALGO | 0.999738 | 4.084198 |
8f4b3f9f-ac33-450e-b694-2b406522a54f | LSun233/realtime-rendering | 3PartyLib/eigen-3.4.0/eigen-3.4.0/doc/examples/Tutorial_PartialLU_solve.cpp | #include <Eigen/Core>
#include <Eigen/LU>
#include <iostream>
using namespace std;
using namespace Eigen;
int main()
{
Matrix3f A;
Vector3f b;
A << 1,2,3, 4,5,6, 7,8,10;
b << 3, 3, 4;
cout << "Here is the matrix A:" << endl << A << endl;
cout << "Here is the vector b:" << endl << b << endl;
Vec... | ALGO | 0.99969 | 3.150347 |
48c9940e-2103-45ca-8443-65180528c756 | kashmawy/model_predictive_controller | src/Eigen-3.3/doc/examples/QuickStart_example2_dynamic.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXd m = MatrixXd::Random(3,3);
m = (m + MatrixXd::Constant(3,3,1.2)) * 50;
cout << "m =" << endl << m << endl;
VectorXd v(3);
v << 1, 2, 3;
cout << "m * v =" << endl << m * v << endl;
}
| ALGO | 0.998295 | 3.497551 |
359a0d41-a3ed-4918-a082-efffda121ef9 | papillonztf/cpp11grammar | cpp语言/函数调用栈及反汇编/函数调用栈及反汇编/main.cpp |
#include<stdio.h>
#include<stdlib.h>
int sum(int a, int b)
{
int tmp = 0;
tmp = a + b;
return tmp;
}
int main()
{
int a = 10;
int b = 20;
int ret = 0;
ret = sum(a, b);
printf("ret=%d\n", ret);
system("pause");
return 0;
}
| TOOL | 0.884593 | 3.249312 |
3b675f9d-46da-414e-bd28-543775dfb845 | kritirikhi/DataStructuresAndAlgorithms | PalindromeLinkList.cpp | // check if a linked list is a palindrome or not
#include <iostream>
using namespace std;
// creation of a class containing data and the next pointer
class node{
public:
int data;
node* next;
node(int d){
data=d;
next=NULL;
}
};
// function which adds node to the tail of the linked li... | ALGO | 0.99999 | 5.148891 |
5e5b5dc8-6f7d-4856-884d-c5ecbecc83a5 | BodhiDog/OJCode | Luogu/P3901.cpp | #include <bits/stdc++.h>
using namespace std;
const int R = 1e5 + 10;
int a[R], belong[R], cnt[R], res;
bool ans[R];
struct Qry
{
int id, l, r;
bool operator<(const Qry &oth) const
{
if (belong[l] == belong[oth.l])
{
return (belong[l] & 1) ? r > oth.r : r < oth.r;
}
else
{
return belong[l] < b... | ALGO | 0.999984 | 4.107122 |
3b8e7663-ba03-4d31-ba3a-fee8b4e3fb8a | ajayjose123/ajay-files | b12.cpp | #include<iostream>
#include<cmath>
using namespace std;
int main()
{
int n, digits = 0, cpy, rev = 0, r;
cin >> n;
cpy = n;
while(cpy!=0)
{
cpy/=10;
digits++;
}
cpy = n;
for(int i = 1; i<=digits; i++)
{
r=cpy%10;
rev += r*pow(10, (digits - i));
cpy/=10;
}
if(n!=rev... | ALGO | 0.999955 | 4.162948 |
598aff52-3baa-4038-aac6-d90fbea933a2 | FeiZhan/Algo-Collection | answers/leetcode/Regular Expression Matching/Regular Expression Matching.cpp | //@result 445 / 445 test cases passed. Status: Accepted Runtime: 16 ms Submitted: 0 minutes ago You are here! Your runtime beats 55.16% of cpp submissions.
class Solution {
public:
bool isMatch(string s, string p) {
vector<vector<bool> > dp(s.length() + 1, vector<bool> (p.length() + 1, false));
dp[... | ALGO | 0.999739 | 5.342692 |
37943e6f-0da1-4b32-9262-ad31288b6a04 | d4niells/dumbprojects | learning/random_event_generator.cpp | #include <iostream>
#include <ctime>
int main() {
srand(time(0));
int randNum = rand() % 5 + 1;
switch (randNum) {
case 1:
std::cout << "You win a bumper sticker!\n";
break;
case 2:
std::cout << "You win a t-shirt!\n";
break;
case 3:
... | TOOL | 0.8944 | 4.386131 |
ab3e303e-ebf6-42cd-a29b-7713fe2def45 | sunil-kumarr/Coding-Hub | Tree/BFS of BinaryTree.cpp | #include<iostream>
#include<vector>
#include<queue>
using namespace std;
struct TreeNode{
int data;
TreeNode* left,*right;
};
TreeNode* newNode(int data)
{
TreeNode* temp = new TreeNode();
temp->data=data;
temp->left=temp->right=NULL;
return temp;
}
TreeNode* buildTree(TreeNode* root,int node)
{
if... | ALGO | 0.999988 | 4.813863 |
01113e18-75f7-40a4-8510-5a18fcb5e08d | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_10526_18.cpp | #include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const long long MOD = 1e9 + 9;
vector<bool> used;
int main() {
long long n;
cin >> n;
long long l = 0, r = 1e9 + 1;
cout << 0 << " " << 0 << endl;
string second;
cin >> second;
string a;
for (int i = 1; i < n; i++) {
long long... | ALGO | 0.999842 | 3.298841 |
7291a5c5-4ef0-4679-920a-d28b899129cf | neha2k4/LEETCODE | 2573-find-the-string-with-lcp/2573-find-the-string-with-lcp.cpp | class Solution {
public:
string findTheString(vector<vector<int>>& lcp) {
int n = lcp.size();
// Check matrix structure
// lcp[i][j] = lcp[j][i]
// lcp[i][i] = n - i
// lcp[i][j] > 0: lcp[i+1][j+1] = lcp[i][j] - 1
// lcp[i][j] < n - i, lcp[i][j] < n - j
for (... | ALGO | 0.999994 | 5.941719 |
d5e091f4-6fc0-447d-92f6-6eb91c71112d | MuhammadZackySaputra/Mobile_lanjut_2201082014 | theme2014/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.998528 | 6.76073 |
07eaae9b-2a61-4ac7-917b-59b5d2efff29 | Saurabh995/spoj | HAMSTER1.cpp | // @author- razor123
#include<iostream>
#include<string>
#include <cstring>
#include<queue>
#include<vector>
#include<climits>
#include <algorithm>
#include <map>
#include <stack>
#include <cmath>
using namespace std;
typedef long long ULL;
typedef pair<int,int> PI;
typedef pair<int,PI> PPI ;
#define mem(a,n) memse... | ALGO | 0.999446 | 3.38674 |
21bbe2ba-1911-4652-9561-2b106483c03c | eyadhr/C- | Lesson 06/for_as_while.cpp | #include <stdio.h>
int main()
{
int num,sum=0;
scanf("%d", &num);
for ( ; num !=0 ; )
{
sum+= num;
scanf("%d", &num);
}
printf("%d",sum);
} | ALGO | 0.99978 | 3.069457 |
8dc4f65f-ffa4-4508-a322-00642bec8ca1 | TitikshaBansal/LeetCode | Medium/shortestPathInBinaryMatrix.cpp | class Solution {
public:
int shortestPathBinaryMatrix(vector<vector<int>>& grid) {
int n = grid.size();
if(grid[0][0] != 0 || grid[n-1][n-1] != 0) return -1;
vector<vector<int>> dirs = {
{-1, -1}, {-1, 0}, {-1, 1},
{0, -1}, {0, 1},
{1, -1}, {1, 0... | ALGO | 0.999995 | 6.819117 |
ecec69da-0b97-41af-9a3e-c40be4d28b39 | SWATISONAWANE63/leetcodeSolution | 3491-find-the-maximum-length-of-valid-subsequence-ii/find-the-maximum-length-of-valid-subsequence-ii.cpp | class Solution {
public:
int maximumLength(vector<int>& nums, int k) {
vector<vector<int>>dp(k,vector<int>(k,0));
int maxlen=0;
for(int i=0; i<nums.size(); i++){
int currMod=nums[i]%k;
for(int preMod=0;preMod<k; preMod++){
dp[preMod][currMod]=dp[currMod][p... | ALGO | 0.999884 | 5.649641 |
33d480c8-d2db-4a84-b2d1-696cb60e920c | JollyBolt/leetcode | 202-happy-number/happy-number.cpp | class Solution {
public:
int sqSum(int n){
int ans = 0;
while(n){
int r = n%10;
ans += r*r;
n/=10;
}
return ans;
}
bool isHappy(int n) {
unordered_map<int,int> m;
while(m.count(n)==0){
m[n]=1;
n = sq... | ALGO | 0.999984 | 5.984281 |
9fac52c3-df9e-4bdb-8e0c-c4f1d061d35f | EricGolovin/Univerisy-Projects | integerMethods-subject/lab01/main.cpp | #include <iostream>
#include <sstream>
#include <cmath>
using namespace std;
double getX_argument() {
string buffer;
double result;
stringstream strInputStream;
cout << "Enter START value for X: ";
cin >> buffer;
strInputStream << buffer;
strInputStream >> result;
return result;
}
do... | ALGO | 0.991388 | 3.822271 |
2c67df81-157e-4c36-afab-f6419b16e127 | Reshief/ipcr | src/other/main_OO.cpp | #include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/registration/icp.h>
#include <pcl/registration/correspondence_estimation.h>
#include <fstream>
#include "cv.h"
#include "highgui.h"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "cmaes.h"
#include "paramet... | ALGO | 0.991333 | 3.421704 |
b4f8b7aa-117c-4d7b-8548-b686cdd1b55e | sumayyaDev/cpp | Bootcamp_S13/Bootcamp_LightOJ/AJ_IP_Checking.cpp | #include<bits/stdc++.h>
using namespace std;
int Binary_to_Decimal(int b)
{
int temp = b;
int deci = 0;
int base = 1; //2^0=1
while(temp){
int last_digit = temp%10; // 1 or 0
temp = temp/10;
deci += last_digit * base;
base = base * 2; //2^1=1*2=2, 2^2=2*2=4, 2^3=4*2
... | ALGO | 0.999145 | 3.979321 |
f4bfff2a-969c-46a3-b8ed-15f799cf079f | tkrotoff/WengoPhone | archaeology/200901-source-without-versioning/wengophone-1.0/wifo/trunk/eXosip/phapi/aec2.cpp | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "aec2.h"
#define UNROLLPTR
#define LOOPSTEP 4
#if 0
#define LOOPSTEP 2
#endif
#ifdef UNROLLPTR
REAL dotp(REAL a[], REAL b[])
{
REAL sum0 = 0.0, sum1 = 0.0;
#if LOOPSTEP == 4
REAL sum2 = 0.0, sum3 = 0.0;
#endif
REAL *enda = a ... | ALGO | 0.998654 | 3.023434 |
7fed2e16-334d-41fa-9b41-60e6a491f34b | nguyengiabk/programming_contest | codeforces/796/796A.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main() {
int n, m, k;
cin >> n >> m >> k;
m--;
int a[n];
for (int i=0; i < n; i++) {
cin >> a[i];
}
int l = 1;
int r = 1;
while(m-l >= 0 && (a[m-l] == 0 || a[m-l] > k)) l++;
while(m+r < n && (a[m+r] == 0 || a[m+r] > k)) r++;
l = m... | ALGO | 0.99978 | 3.500057 |
09a4a471-dace-4694-bf8f-586a640c769b | PChaparro/coding-practices | leetcode/1466-reorder-routes-to-make-all-paths-lead-to-the-city-zero/solution.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
int minReorder(int n, vector<vector<int>> &connections)
{
unordered_map<int, vector<int>> outgoing, incoming;
for (auto connection : connections)
{
int a = connection[0],
b = connection[1];
outgoing[a].push_b... | ALGO | 0.999855 | 5.528368 |
587b425b-a3f6-411f-b464-73b824001f78 | xinfeng1i/AlgorithmSolution | codeforces/2/204/A.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int n = 0;
cin >> n;
int cnt_0 = 0;
int cnt_5 = 0;
int tmp = 0;
for (int i = 0; i < n; ++i)
{
cin >> tmp;
if (tmp == 0)
{
cnt_0++;
}
... | ALGO | 0.999669 | 4.388623 |
00128bd0-3e90-43bf-8fe7-fbc04ec6ef12 | franv314/competitive | olinfo/OIS/xmastree/xmastree.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int N; cin >> N;
vector<int> A(N);
vector<vector<int>> adj(N);
for (int i = 0; i < N - 1; i++) {
int u, v; cin >> u >> v;
adj[u].push_back(v);
adj[v].push_back(u);
}
for (auto &a: A) cin >> a;
function<pai... | ALGO | 0.999884 | 4.550682 |
13732319-cd73-44ba-98dc-32318f4c4c50 | tr1ten/DNA | 1493D.cpp | #include <cstdio>
#include <bits/stdc++.h>
using namespace std;
#include "ext/pb_ds/assoc_container.hpp"
#include "ext/pb_ds/tree_policy.hpp"
using namespace __gnu_pbds;
template<class T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update> ;
template<typename T>
using order... | ALGO | 0.999898 | 3.941152 |
225e8830-283c-43fe-bc48-f59841991512 | D4nielS4ntos/javascript-typescript-html-css | cpp/exercicios/verifica.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
vector<string> vetor = {"caixa", "baixa", "carga", "larga", "deixa"};
string palavra;
bool estar = false;
cout << "Digite uma palavra para descobrir se está na lista: " << endl;
cin >> palavra;
for (auto ... | ALGO | 0.992083 | 4.90122 |
2fcae2bf-86da-4cb8-bfcc-174bddb91221 | miraclekowk/RTKpp | rtk_request.cpp | //
// Created by nins on 2022/3/9.
//
#include "rtk_request.h"
std::unordered_map<std::string,std::string> rtk_mime_type = {
{".html", "text/html"},
{".xml", "text/xml"},
{".xhtml", "application/xhtml+xml"},
{".txt", "text/plain"},
{".rtf", "application/rtf"},
{".pdf", ... | WEB | 0.94 | 3.292037 |
511df3ab-8b79-45fa-9867-ab9af1318a92 | liac1983/Prog | node.cpp | #include <iostream>
using namespace std;
//! Doubly-linked node containing an int value.
struct node {
int value; // Value.
node* prev; // Previous node.
node* next; // Next node.
};
//! Builds a new node containing value v followed by next.
node* build(int v, node* next=nullptr) {
node* n = new node { ... | ALGO | 0.964848 | 4.962613 |
1f372110-f1a4-41f7-a0d0-934edd221c63 | SkydevilK/SWEA | D3/6692.cpp | #include<iostream>
using std::cin;
using std::cout;
int main()
{
std::ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int T = 0;
int N = 0;
double p = 0;
int money = 0;
double total = 0;
cin >> T;
for (int test = 1; test <= T; ++test)
{
total=0;
cin >> N;
for (int i = 0; i < N; ++i)
{
... | ALGO | 0.99084 | 4.290448 |
a7ef238d-4e51-45c3-a958-5764121b1717 | thaind/Android | Demos/Andengine/GLES2 Demos/AndEnginePhysicsBox2DExtension/jni/Box2D/Collision/Shapes/b2EdgeShape.cpp | #include "Box2D/Collision/Shapes/b2EdgeShape.h"
#include <new>
using namespace std;
void b2EdgeShape::Set(const b2Vec2& v1, const b2Vec2& v2)
{
m_vertex1 = v1;
m_vertex2 = v2;
m_hasVertex0 = false;
m_hasVertex3 = false;
}
b2Shape* b2EdgeShape::Clone(b2BlockAllocator* allocator) const
{
void* mem = allocator->All... | ALGO | 0.923559 | 7.628422 |
e21bf662-bc73-4100-a502-77655a4a6929 | firdauslubis88/NISwGSP | NISwGSP/eigen3/bench/benchCholesky.cpp |
// g++ -DNDEBUG -O3 -I.. benchLLT.cpp -o benchLLT && ./benchLLT
// options:
// -DBENCH_GSL -lgsl /usr/lib/libcblas.so.3
// -DEIGEN_DONT_VECTORIZE
// -msse2
// -DREPEAT=100
// -DTRIES=10
// -DSCALAR=double
#include <iostream>
#include <Eigen/Core>
#include <Eigen/Cholesky>
#include <bench/BenchUtil.h>
using na... | TEST | 0.993536 | 5.938015 |
9e374f98-dbcf-452f-80c2-29d2b1ef8d73 | youbeen2798/Baekjoon-Problems | 1316_그룹 단어 체커.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n;
int ans = 0;
string st;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
for (int i = 0; i < n; i++) {
vector <int> v1;
vector <int> v2;
cin >> st;
int cnt = 1;
for (int j = 0; j < ... | ALGO | 0.999969 | 4.304718 |
8f9eb9d5-7b47-47c7-b867-d016f0bd33b9 | AkshatAwadhiya/Leetcode-Solutions | 75-sort-colors/sort-colors.cpp | class Solution {
public:
void sortColors(vector<int>& nums) {
int low = 0;
int mid = 0;
int high = nums.size() - 1;
while (mid <= high) {
if (nums[mid] == 0) {
swap(nums[low], nums[mid]);
low++;
mid++;
}... | ALGO | 0.999949 | 6.144154 |
f8379f1c-0856-457b-bf77-0aa0315c9fe4 | xuwithbean/XU_DOG | eigen-3.4.0/doc/snippets/Triangular_solve.cpp | Matrix3d m = Matrix3d::Zero();
m.triangularView<Eigen::Upper>().setOnes();
cout << "Here is the matrix m:\n" << m << endl;
Matrix3d n = Matrix3d::Ones();
n.triangularView<Eigen::Lower>() *= 2;
cout << "Here is the matrix n:\n" << n << endl;
cout << "And now here is m.inverse()*n, taking advantage of the fact that"
... | ALGO | 0.998909 | 3.70449 |
716b08eb-b848-4d89-8a16-ab54ec3c39d0 | Abhishek222747/dsa | Recursion and Backtracking/Problem Equal Subset Sum.cpp | Given an array arr[], determine if it can be partitioned into two subsets such that
the sum of elements in both parts is the same.
Note: Each element must be in exactly one subset.
Examples:
Input: arr = [1, 5, 11, 5]
Output: true
Explanation: The two parts are [1, 5, 5] and [11].
Input: arr = [1, 3, 5]
Output: fal... | ALGO | 0.995741 | 6.161779 |
c9fd910f-12e9-47bd-8116-28f6b209b321 | ishandutta2007/codeforces | icecuber/normal/1196/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
ios::sync_with_stdio(0); cin.tie(0);
int t;
cin >> t;
while (t--) {
ll a, b, c;
cin >> a >> b >> c;
cout << (a+b+c>>1) << endl;
}
} | ALGO | 0.999721 | 4.671541 |
09813305-e55a-4f45-9f43-a8d7dd45e17b | Rohit1173/GRAPHS | Topological_sort_dfs.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define mod 1000000007
#define endl '\n'
#define setbits __builtin_popcountll
#define msort(v) sort((v).begin(),(v).end())
#define all(c) (c).begin(), (c).end()
#define fill(container, value) memset((container), (value), si... | ALGO | 0.999966 | 4.596222 |
9f58137f-032b-4579-a366-5e3660c665d6 | euma/programming | AlgorithmCompetitionClassicalIntroductionTheSecondEdition/入门经典/part2/chapter7/7.1/拓展/IOI2000回文词/poj1159.cpp | //Memory: 49864K Time: 1391MS
//短小精悍的代码(max(int, int, int))不一定快捷..
//果然还是要注意细节、静态查错。。一开始写成了a[i]==b[i],这种小而致命的错误不仔细看是很难找到的。。
#include<cstdio>
char a[5050],b[5050];
int n;
short f[5050][5050];
inline int max(int a, int b, int c){return (a>b)?(a>c?a:c):(b>c?b:c);}
int main(){
scanf("%d",&n); getchar();
for(int i=1; i... | ALGO | 0.999918 | 3.286036 |
a2ef2b7b-629a-43b5-9363-867bfad8df33 | RikinR/contact_book | 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.998809 | 6.763549 |
9bcfec36-72aa-4034-b345-1af13e3ec9fa | QuyDatSadBoy/CPP_PTIT | CPP0724.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define foru(i, a, b) for (int i = a; i <= b; ++i)
#define ford(i, b, a) for (int i = b; i >= a; --i)
#define fill(a, b) memset(a, b, sizeof(a))
#define all(v) v.begin(), v.end()
#define ii pair<int, int>
const int mod = 1e9 + 7;
int main()
{
ios_... | ALGO | 0.999975 | 3.961739 |
a702a580-6bd2-4b68-89ce-67b4e3cdc874 | Vestigor/Programming_Paradigms | 2024_9_23/problem_2.cpp | /***********************************************************
* File: problem_2.cpp
* Author: Xiaolong Ma(С)
* E-mail: <EMAIL>
* Compiler: Visual Studio 2022
* Function: solve the problem which is called "the code of the code box the chocolate locked in"
* Date: 2024.9.24
* Update: 2024.9.24
**************... | ALGO | 0.997 | 5.638195 |
563b19f4-ce6f-43db-9e6a-e5b525112008 | bcmi/Object-Placement-Assessment-Dataset-OPA | faster-rcnn/lib/model/csrc/cpu/ROIAlign_cpu.cpp | // implementation taken from Caffe2
template <typename T>
struct PreCalc {
int pos1;
int pos2;
int pos3;
int pos4;
T w1;
T w2;
T w3;
T w4;
};
template <typename T>
void pre_calc_for_bilinear_interpolate(
const int height,
const int width,
const int pooled_height,
const int pooled_width,... | DATA | 0.960428 | 6.539428 |
4cd6272d-ff6a-4c17-a086-d8ab6ea118bd | Nikhil-Singla/the-daily-grind | leetcode/cpp/01_easy/2357_MinOperationsZero.cpp | class Solution {
public:
int minimumOperations(vector<int>& nums)
{
sort(nums.begin(), nums.end());
int curr = 0;
int operations = 0;
for(auto c : nums)
{
if(c != curr)
{
curr = c;
c = 0;
operations+... | ALGO | 0.999899 | 6.103931 |
48882eef-42cd-4f16-bbb5-f1530c80ff32 | JiangWenqi/Algorithm-Questions | Leetcode-Solutions/222.count-complete-tree-nodes.cpp | /*
* @lc app=leetcode id=222 lang=cpp
*
* [222] Count Complete Tree Nodes
*
* https://leetcode.com/problems/count-complete-tree-nodes/description/
*
* algorithms
* Medium (57.56%)
* Likes: 6322
* Dislikes: 357
* Total Accepted: 483.4K
* Total Submissions: 824.6K
* Testcase Example: '[1,2,3,4,5,6]'
... | ALGO | 0.999859 | 7.004783 |
3872f6f4-1654-4480-83d6-675cd8706105 | kyomin/algorithm | Baekjoon/32215.cpp | #include <iostream>
using namespace std;
int main() {
int n, m, k;
cin >> n >> m >> k;
int ans = (m * k) + m;
cout << ans << endl;
return 0;
} | ALGO | 0.999869 | 3.315917 |
2f9349b6-43f4-459c-9f5a-28ff067a36be | HongSon28/Training | Contest training/VOI24 Training/orange02e.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=2e5;
int n,m,res,cur;
int t[N+5];
vector<int>k[N+5];
bool check(int tm) {
int cnt=0;
for (int i=1;i<=n;i++) {
for (auto j:k[i]) cnt+=(j<=tm);
}
return cnt>=m;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
c... | ALGO | 0.999972 | 3.250169 |
11191c91-9821-494d-a3a2-151bd8a6c81b | ndthangit/exercises | IT3150/week5/DFS.cpp | /*
Given a undirected graph =(V,E) in which V = {1,2,..,n} is the set of nodes.
Write a program that visit nodes of G by a DFS (consider a lexicorgraphic order of nodes).
Input
Line 1: contains 2 integers n and m (1 <= n,m <= 100000)
Line i+1: contains u and v which are two end-points of the ith edge
Output
Sequence o... | ALGO | 0.99999 | 4.79913 |
55b955cf-f922-4b30-895c-cb49aaa5d5b8 | mechusatveer/Data-Structure-Algorithm | Array/MergeKsorted.cpp | Hi
you are given n sorted array each of size m
you need to generated a new array of size mn which is sorted
Anyhow we need to allocate mn space so do not count that is space complexity
1) 4 8 9 10 14 16
3 6 7 11 17 18
1 2 5 6 12 13
Here m = 6
n = 3
1) brute force will be
space co... | ALGO | 0.999898 | 4.672015 |
b6629711-0fca-4173-af3e-316ada66877b | SanchitPandey26/CPP | STL/queue.cpp |
#include <bits/stdc++.h>
using namespace std;
int main(){
// Queue follows FIFO property, i.e, First in First Out. That means we access only the
// element first inserted into the queue.
queue<int> q; // Decalration of stack
q.push(1); // {1}
q.push(2); // {1, 2}
q.emplace(4); // {1,2,4}
... | ALGO | 0.964026 | 5.353198 |
56b928ff-951e-4c70-bf70-99ae046e9935 | mattix7771/NQueen-Problem-CaPS-cw2- | nqueens.cpp | // Headers
#include <cassert>
#include <iostream>
#include <vector>
#include <fstream>
#include <string>
#include <chrono>
#include <iomanip>
#include <omp.h>
#include <thread>
#include <algorithm>
#define ITER_NUM 13
using namespace std;
using namespace std::chrono;
// check if the chessboard is valid so far, for r... | ALGO | 0.999733 | 4.064341 |
7cf92596-1188-4cb6-90e9-955130db7aa2 | MrAshwin2142/LeetCode-Solutions | 2470-removing-stars-from-a-string/2470-removing-stars-from-a-string.cpp | class Solution {
public:
string removeStars(string s) {
stack<char> st;
for(char c:s){
if(c!='*') st.push(c);
else st.pop();
}
string ans="";
while(!st.empty()){
ans+=st.top();
st.pop();
}
reverse(ans.begin(),ans... | ALGO | 0.999968 | 6.193223 |
21d798d2-f578-4f4a-95fa-6b9811f613bc | Arnick-s/Leetcode-problems | 1827-minimum-operations-to-make-the-array-increasing/1827-minimum-operations-to-make-the-array-increasing.cpp | class Solution {
public:
int minOperations(vector<int>& nums) {
int n = nums.size();
int prev = nums[0];
int op = 0;//cnt
for(int i = 1;i<n;i++){
int tempcnt = max(0,prev - nums[i] + 1);
op += tempcnt;
prev = nums[i] + tempcnt;
}
re... | ALGO | 0.999976 | 5.930048 |
3ac9cb23-9bcf-4505-b5ff-9d31c12dada2 | anup00900/LEETCODE_QUEstION | Leetcode1342.cpp | class Solution {
public:
int numberOfSteps(int num) {
if(num<=0)
{
return 0;
}
if(num%2==0)
{
return(1+numberOfSteps(num/2));
}
return(1+numberOfSteps(num-1));
}
}; | ALGO | 0.999945 | 5.810779 |
3285a939-67da-4f8e-a895-83575a3cc5d6 | khushbujain41709/CPP-DSA | Coding/Trees/pathSumII.cpp | // Leetcode 113
#include<iostream>
#include<vector>
#include<stack>
#include<algorithm>
using namespace std;
class TreeNode{
public :
int val;
TreeNode* left;
TreeNode* right;
TreeNode(int val){
this->val = val;
this->left = NULL;
this->right = NULL;
}
};
void helper(Tree... | ALGO | 0.999955 | 5.840415 |
20edab60-9acd-404c-b6af-aed74ec9140e | cepxuozab/YandexTrainingAlgorithms | Training4/Lesson4/D_TravelingSalesman/main1.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
constexpr int INF = 1e9;
auto ReadGraph(int n) -> std::vector<std::vector<int>> {
std::vector<std::vector<int>> graph(n, std::vector<int>(n));
for (auto &arr: graph) {
for (int &a: arr) {
std::cin >> a;
}... | ALGO | 0.999538 | 5.204449 |
c0443406-8a65-4649-8e52-097129bade49 | RafaelChavesPB/CompetitiveProgramming | codeforces_Alice_bob_and_candies.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
deque<int> fd;
int t,n,a,b,sum_a,sum,round;
cin>>t;
while(t--){
cin>>n;
while(n--){
cin>>a;
fd.push_back(a);
}
round=1;
sum_a=sum=a=b=0;
while(!fd.empty()){
... | ALGO | 0.999312 | 3.070393 |
41857dc6-78be-4c57-bdc0-86aaa0b58dac | stellakang/modoo_algorithm | week9/findTheTownJudge.cpp | class Solution {
public:
//time complexity : O(N+E)
//space complexity : O(N)
int findJudge(int N, vector<vector<int>>& trust) {
vector<bool>hasOutdegree;
vector<int>indegree;
hasOutdegree.resize(N+1,false);
indegree.resize(N+1,0);
for(vector<int> ad... | ALGO | 0.999903 | 5.513773 |
aa44e54a-48c2-486b-8e9e-5f0cfd467ee5 | puneetvernekar/CP | 0div-idbig-omega-company-tagsdiv-idbig-omega-topbardiv-classcompanytagscontainer-styleoverflow-x-scroll-flex-wrap-nowrap-div-classcompanytagscontainer-tagno-companies-found-for-this-problem-div-divdiv-classcompanytagscontainer-chevrondivsvg-version11-idicon-xmlnshttp-wwww3org-2000-svg-xmlns-xlinkhttp-wwww3org-1999-xlin... | class Solution {
public:
int appendCharacters(string s, string t) {
int j=0;
for(int i=0;i<s.size();i++)
{
if(s[i]==t[j])
{
j++;
}
}
return t.size()-j;
}
}; | ALGO | 0.999958 | 6.000453 |
46b3d73d-40f1-4d4d-a001-34afd6ef5734 | evelyn-plee/leetcode | trappingRainWater/trappingRainWater-1.cpp | class Solution {
public:
int trap(vector<int>& height) {
int res = 0, mx = 0, n = height.size();
vector<int> dp(n, 0);
for (int i = 0; i < n; ++i) {
dp[i] = mx;
mx = max(mx, height[i]);
}
mx = 0;
for (int i = n - 1; i >= 0; --i) {
d... | ALGO | 0.999889 | 6.928144 |
1917bc43-dccc-4f1d-b963-38980765db00 | moxenseya/leetcode30days | intersection_of_linked_lists.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {
ListNode* a = headA;
ListNode* b = headB;
... | ALGO | 0.999935 | 5.545123 |
d3fede22-5c26-4815-9c9b-183fa5042a75 | victorliking/Dream | DFS/Sum Root to Leaf Numbers.cpp | /*
Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.
An example is the root-to-leaf path 1->2->3 which represents the number 123.
Find the total sum of all root-to-leaf numbers.
For example,
1
/ \
2 3
The root-to-leaf path 1->2 represents the number 12.... | ALGO | 0.999978 | 6.571089 |
38a082df-322c-44de-a9d3-a6e2b629f875 | eiofmv/data_structures_and_algorithms | 5. Advanced/week2/ad_allocation/ad_allocation.cpp | #include <algorithm>
#include <iostream>
#include <vector>
#include <cstdio>
using namespace std;
typedef vector<vector<double>> matrix;
pair<int, vector<double>> allocate_ads(
int n,
int m,
matrix A,
vector<double> b,
vector<double> c) {
// Write your code here
return {0, vector<double>... | ALGO | 0.999906 | 3.342331 |
d511a52f-3240-47e4-9442-b47630d42dcd | YoussefHassanDEV/Problem-Solving | A_1_Gardener_and_the_Capybaras_easy_version.cpp | #include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
string s, z, k, l;
cin >> s, z;
int i, j;
z = s[0];
k = s.substr(1, s.size() - 2);
l = s[s.size() - 1];
i = z.compare(k);
... | ALGO | 0.999662 | 3.650647 |
c2105bb9-c1c1-4b78-8b32-ef8c830db8bb | ishandutta2007/codeforces | ftiasch/normal/687/D.cpp | #include <algorithm>
#include <cstdlib>
#include <cctype>
#include <cstdio>
#include <cstring>
#include <numeric>
const int N = 1000;
const int M = N * (N - 1) / 2;
int n, m, q, a[M], b[M], c[M], aa[M], bb[M], cc[M], order[M], parent[N << 1];
int find(int u)
{
int r = u;
while (parent[r] != r) {
r = ... | ALGO | 0.999996 | 4.584898 |
5f8c3b50-9f2e-40a2-8708-b069f558a421 | dannyyu92/cs320 | proj2/Project2.cpp | #include "Project2.h"
#include <fstream>
#include <iostream>
#include <sstream>
#include <math.h>
#include <cmath>
#include <cstdlib>
using namespace std;
Project2::Project2() {
inputFileName = "";
outputFileName = "";
}
Project2::Project2(string inputFile, string outputFile) {
inputFileName = inputFile;
outp... | TOOL | 0.903638 | 3.425685 |
b87ed136-c3be-441b-9a78-3ce778d3ced5 | ishandutta2007/codeforces | al13n/normal/804/E.cpp | #define _CRT_SECURE_NO_DEPRECATE
#define _USE_MATH_DEFINES
#include <array>
#include <iostream>
#include <fstream>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <climits>
#include <ctime>
#include <numeric>
#include <vector>
#include <algorithm>
#include <bitset>
#include <cmath>
#include <cstring>
#... | ALGO | 0.999929 | 3.09875 |
c43973c1-0b40-453b-b2f2-a84b77d36327 | tarowatanabe/cicada | cicada/operation/output.cpp | #define BOOST_SPIRIT_THREADSAFE
#define PHOENIX_THREADSAFE
#include <unistd.h>
#include <boost/fusion/include/std_pair.hpp>
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/karma.hpp>
#include <boost/functional/hash/hash.hpp>
#include <iostream>
#include <iterator>
#include <cicada/operation.h... | ALGO | 0.991228 | 7.18627 |
e2a0d09d-51cc-408b-b94f-565bbd862d03 | evialbert/LeetCode | 2940-find-building-where-alice-and-bob-can-meet/2940-find-building-where-alice-and-bob-can-meet.cpp | class Solution {
public:
vector<int> leftmostBuildingQueries(vector<int>& heights, vector<vector<int>>& queries) {
int n = heights.size(), m = queries.size();
vector<int> ans(m);
vector<int> nge(n);
stack<int> stk;
for(int i = n-1; i>=0; i--){
while(!stk.... | ALGO | 0.999946 | 6.105628 |
d4832916-bcb5-48e2-abfb-cbb9aba7a011 | ishandutta2007/codeforces | zld3794955/normal/401/D.cpp | #include<iostream>
#include<cstdio>
#include<algorithm>
#include<set>
#include<map>
#include<cmath>
#include<cstdlib>
#include<ctime>
#include<cctype>
#include<cstring>
#include<vector>
#include<list>
#include<deque>
#include<queue>
#include<stack>
#include<string>
#include<utility>
using namespace std;
const int power... | ALGO | 0.99996 | 3.286169 |
dfe9309c-ffc4-4fc0-a9ab-95048eab7b50 | XyeHyin/vscode | tree_value_sum.cpp | // name: tree_value_sum.cpp
// date 2025-06-01
// author: XyeHyin
#include <bits/stdc++.h>
// #pragma GCC optimize("O3,Ofast,unroll-loops")
// #include "atcoder/convolution"
// #include "atcoder/dsu"
// #include "atcoder/fenwicktree"
// #include "atcoder/lazysegtree"
// #include "atcoder/math"
// #include "atcoder/ma... | ALGO | 0.999695 | 5.212959 |
3bb64f79-d57a-4f53-9510-2168ac9da005 | AdhamHammoda/Competitive-Programming | Kattis/harshadnumbers.cpp | #include <bits/stdc++.h>
#define FIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long int
using namespace std;
void test_case()
{
ll n;
cin>>n;
for(ll i=n;i<=1e10;i++)
{
ll m=i;
ll sum=0;
while(m>0)
{
sum+=m%10;
m/=10;
... | ALGO | 0.99992 | 4.915809 |
ce1bf5bb-ecd9-421a-b1b5-19996103f5b0 | GustavoHCavalcanti/Trabalho2MP | conta_palavras.cpp | #include "conta_palavras.hpp"
#include <sstream>
#include <cctype>
#include <algorithm>
#include <map>
#include <string>
#include <locale>
#include <codecvt>
#include <iterator>
/**
* @brief Remove acentos de uma string, substituindo caracteres acentuados por seus equivalentes sem acento.
*
* @param palavra A pala... | ALGO | 0.990962 | 5.666958 |
f03f89d5-fe88-479e-a95e-d4c8d7fca0bc | Safwan-Ibrahim/CPP | Phase 01 P2/Class 6/Problem of class 6/B.Worms.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
int32_t main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n; cin >> n;
int arr[n+1];
arr[1] = 1;
int x = 0;
for (int i = 1; i < n; i++) {
int a; cin >> a;
x += a;
arr[i+1] ... | ALGO | 0.999736 | 3.844468 |
570a20ba-61ff-4e9a-a407-a39befc6215c | ArefinAlter/ProblemSolving | codeforces/500/A.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,t,i,j=0,cell=1,a[30010];
cin>>n>>t;
for(i=1;i<n;i++){
cin>>a[i];
if(cell==i) cell+=a[i];
if(cell==t) j=1;
}
j==1?cout<<"YES"<<endl:cout<<"NO"<<endl;
return 0;
}
| ALGO | 0.999991 | 3.451447 |
fffc8fe4-07ce-481c-b4f6-162faf14f68a | Vzenun/Codeforces-Problems-Solutions | Middle_of_the_Contest.cpp | // Vidur Goel
//Codeforcees Handle: Vidurcodviz
#include<iostream>
#include<string>
#include<cmath>
#include<climits>
#include<algorithm>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<stack>
#include<chrono>
#include<random>
#include<cassert>
#include<array>
#include<bitset>
#include<... | ALGO | 0.99972 | 5.587424 |
959dd8c1-1181-4899-8410-8e5f43745889 | bytedance/terark-zip | 3rdparty/boost-include/libs/compute/perf/perf_reverse_copy.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <boost/compute/system.hpp>
#include <boost/compute/algorithm/reverse_copy.hpp>
#include <boost/compute/container/vector.hpp>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
... | ALGO | 0.988459 | 5.545968 |
c4c33dc6-478d-4018-9e53-8d3b0a299fa8 | raolokesh126/hacktoberfest | Binary Tree/Find LCA in BT.cpp | /*
link: https://practice.geeksforgeeks.org/problems/lowest-common-ancestor-in-a-binary-tree/1
*/
// ----------------------------------------------------------------------------------------------------------------------- //
/*
storing and comparing path of n1 and n2
TC: O(N)
SC: O(N)
*/
// C++ Program ... | ALGO | 0.99999 | 6.696994 |
4761e4bf-0e5b-494d-9007-7a1da4fe71d8 | burugaria7/AtCoder | ABC184/B.cpp | #include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using ll = long long... | ALGO | 0.999887 | 4.322752 |
7e15a324-04a1-4adb-ad44-86c2ca957292 | AMlhdSan/code | Luogu_P_2858.cpp | #include <bits/stdc++.h>
#define N 2001
using namespace std;
int v[N];
int n;
int dp[N][N];
int main() {
cin >> n;
for(int i = 1; i <= n; ++i) {
cin >> v[i];
dp[i][i] = v[i] * n;
}
for(int l = 1; l <= n; ++l) {
for(int i = 1; i + l - 1 <= n; ++i) {
int j = ... | ALGO | 0.999892 | 3.723327 |
afdb691d-8a42-42be-a2cb-b2b68ddf7cbe | rituraj0/Old-Codes | pj.cpp | #include<iostream>
#include<cstdio>
#include<cmath>
int main()
{
float r,u,an,rd,pi,g=9.806;
int test,i;
scanf("%d",&test);
for(i=1;i<=test;i++)
{
scanf("%f%f",&r,&u);
if( r > ((u/g)*u) )
{ printf("Scenario #%d: -1\n",i);
continue;
}
rd=(asin( (g/u)*(r/u) ) )/2;
pi=2*acos(0.00);
an=(rd/pi)... | ALGO | 0.993118 | 3.524417 |
2dc9dba6-afe6-4165-a073-a1f10c32f62f | rayvantsahni/The-HackerRank-Vault | 30 Days of Code/Day 02: Operators.cpp | #include <bits/stdc++.h>
#include<cmath>
using namespace std;
// Complete the solve function below.
void solve(double meal_cost, int tip_percent, int tax_percent)
{
cout << round(meal_cost + (tip_percent*meal_cost/100) + (tax_percent*meal_cost/100));
}
int main()
{
double meal_cost;
cin >> meal_cost;
... | ALGO | 0.998718 | 4.121734 |
0d505a41-59b1-4873-a0a9-0c04360e5a1f | raincross7/code-similarity | codes/train_code/problem025/problem025_27.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef complex<double> P;
typedef pair<int,int> pii;
#define REP(i,n) for(ll i=0;i<n;++i)
#define REPR(i,n) for(ll i=1;i<n;++i)
#define FOR(i,a,b) for(ll i=a;i<b;++i)
#define DEBUG(x) cout<<#x<<": "... | ALGO | 0.999361 | 3.534994 |
7dca3a8a-dd81-40b6-a0a2-92a3368b02d6 | xconfigurator/test_20200428_c_cpp | 02_C++/04_tju_144_061-080/062.cpp | /**
* @file 062.cpp
* @author your name (<EMAIL>)
* @brief
* @version 0.1
* @date 2022-06-25
*
* @copyright Copyright (c) 2022
*
*/
#include <iostream>
using namespace std;
class per {
protected:
char *name;
int age;
public:
virtual void message() {cout << "person message.\n";}
};
class teache... | TOOL | 0.880326 | 4.798368 |
a83bf713-e859-4bf7-b9c9-bde4f276fe56 | rajveer-09/HustlerWorkspaceLeetcode | 81-search-in-rotated-sorted-array-ii/search-in-rotated-sorted-array-ii.cpp | class Solution {
public:
bool search(vector<int>& nums, int target) {
int n = nums.size();
int left = 0, right = n - 1;
while(left <= right){
while(left + 1 < n && nums[left] == nums[left + 1]) left++;
while(right - 1 >= 0 && nums[right] == nums[right - 1]) right--;... | ALGO | 0.999986 | 6.0489 |
c346d320-aa28-4ab0-afb5-51d7f35262c2 | alive-xd/CipherSchool | Lectures/Lecture13.cpp | In this lecture : Introduction of functions and what is meant by functions and how to use in c++.
Actually Functions : Functions are used to perform certain actions, and they are important for reusing code .Define the code once, and use it many times.
Functions in c++ = create a function
C++ provides some pre-defined ... | TOOL | 0.98738 | 4.981379 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.