uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
907a404f-a24d-477c-a8f9-44077fb85702 | arnab-zero/CSE301_Combinatorial_Optimization | DP/Subset_for_sum.cpp | #include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define pb push_back
#define pob pop_back
#define spc " "
bool existSubset(int a[], int n, int sum){
if(sum == 0)
return true;
if(n == 0)
return false;
if(a[n-1] > sum)
return existSubset(a, n-1, sum);
... | ALGO | 0.999964 | 4.144236 |
61225ab6-7421-40db-87df-894380272c34 | lscheiderer/ifsc-1310 | Programming II/assignment2.cpp |
#include<iostream>
#include<vector>
#include<map>
#include<random>
#include<algorithm>
struct Room
{
enum class Name { cell, gate, armory, jailers, exit };
enum class Direction { N, S, E, W, none };
std::string message;// the message displayed when in the room.
std::map<Direction, Name> doorways;
//NOTE:: these... | TOOL | 0.870332 | 3.733518 |
1e43499c-ea5d-4036-9413-4b5528afa993 | ujjwalkasera01/Questions | 882-peak-index-in-a-mountain-array/peak-index-in-a-mountain-array.cpp | class Solution {
public:
int peakIndexInMountainArray(vector<int>& arr) {
int beg=0;
int end=arr.size()-1;
int mid;
while(beg<end){
mid=beg+(end-beg)/2;
if(arr[mid]<arr[mid+1])
beg=mid+1;
else
end=mid;
}
... | ALGO | 0.999975 | 5.707598 |
0c339a4d-9aae-4e30-b34f-9c8dd3aeb41c | grx62203/leetcode | 1、acwing/算法基础课/算基-1-高精度计算-acwing791大整数相加压9位.cpp | /*
给定两个正整数(不含前导 0),计算它们的和。
输入格式
共两行,每行包含一个整数。
输出格式
共一行,包含所求的和。
数据范围
1≤整数长度≤100000
*/
/*
大整数相加压9位
每一位表示9个数字
加减乘除的统一写法 就是将所有的ABC数组都是低位在前、高位在后
*/
#include <iostream>
#include <vector>
using namespace std;
const int base = 1000000000;
vector<int> add(vector<int> &A, vector<int> &B)
{
if (A.size() < B.size()) ret... | ALGO | 0.999879 | 4.940794 |
a53477c5-59ac-4671-806b-2232642a041b | iilloo/leetcode | 101.对称二叉树.cpp | #include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <list>
#include <string>
#include <stack>
using namespace std;
/*
* @lc app=leetcode.cn id=101 lang=cpp
*
* [101] 对称二叉树
*/
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right... | ALGO | 0.999955 | 6.432563 |
3577632b-dbc5-4c17-a471-f7b31dd88695 | mokhdzanifaeq/Competitive-Programming-Solutions | PROMED@CS 2012/e.cpp | #include <iostream>
#include <cstring>
#include <cstdlib>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0); // tq asdacap :)
int n;
char input[1000];
cin >> n;
cin.ignore();
for(int i = 1; i <= n; i++)
{
int len, num_array[100], nArray = 0, cond = 1;
ci... | ALGO | 0.999146 | 3.790956 |
ef7030b2-2727-4fe3-ac7c-d812ee9d4576 | LINGCHEN1043/my-C-homework | 17.99乘法表.cpp | #include<stdio.h>
int main()
{int a,i;
for(i=1;i<=9;i++)
{for(a=1;a<=i;a++)
printf("%dx%d=%-3d",i,a,i*a);
printf("\n");}
return 0;}
| ALGO | 0.999008 | 3.184821 |
0ed0dfa6-efb2-444e-a4a2-c378bd7ef20a | ishandutta2007/codeforces | abc864197532/normal/1537/E2.cpp | /*
* ## ##### #### #### # # ####
* # # # # # # # # # # # #
* # # ##### # # # # # # #
* ###### # # # # # # ## # # #
* # # # # # # # # ## ## # #
* # # ##### #### #### # # ####
*/
#include <bits/stdc++.h>
us... | ALGO | 0.999996 | 3.887949 |
b65663d9-a10d-45c4-8998-2d8a58517f09 | oneNutW0nder/butler | src/lib/util.cpp | #include "util.hpp"
void gotError(const std::string& msg, const int& err) {
std::cerr << msg << std::endl;
exit(err);
}
// trim from end of string (right)
std::string& rtrim(std::string& s, const std::string& t) {
s.erase(s.rfind(t), t.length());
return s;
}
// trim from beginning of string (left)
std::strin... | TOOL | 0.854688 | 5.331365 |
d8f3b764-9a04-4762-bef8-ca960a5a373a | ayushvadodariya/tic_tac_toe_game | 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 |
b3c2f460-c60c-4e2a-9c12-deddfc71d97b | ritikgarg655/CodeForce | element.cpp | #ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#includ... | ALGO | 0.999144 | 4.508636 |
6192023b-d93b-4db6-a5c1-6620e32a484c | vynride/codeforces | A_Game_With_Sticks.cpp | #include <bits/stdc++.h>
using namespace std;
int main(void)
{
int n, m;
cin >> n >> m;
int lesser = (n > m) ? m:n;
(lesser % 2 == 0) ? (cout << "Malvika" << endl)
: (cout << "Akshat" << endl);
} | ALGO | 0.999918 | 3.309477 |
f98779b0-1286-4d96-9795-2c194eca5a9e | ishandutta2007/codeforces | ztxz16/normal/372/B.cpp | #include <stdio.h>
#include <stdlib.h>
int n, m, q, i, x1, y1, x2, y2;
char str[105][105];
int f[41][41][41][41], up[105][105], now, ans;
int main()
{
scanf("%d %d %d", &n, &m, &q);
gets(str[0] + 1);
for (i = 1; i <= n; i++)
gets(str[i] + 1);
for (x1 = 1; x1 <= n; x1++)
for (y1 = 1; y1 <= m; y1++)
{
for ... | ALGO | 0.99965 | 3.688065 |
a405ee80-c650-41ae-8d9e-a50d7b42d7fd | srvsingh1962/DSA-Udemy | FREQUENCYCOUNT.cpp | #include<bits/stdc++.h>
using namespace std;
int lower_bound(vector<int> &arr, int start, int end, int key){
int min_pos = INT_MAX;
while(start <= end){
int mid = (start+end)/2;
if(arr[mid] == key){
min_pos = min(min_pos, mid);
end = mid - 1;
continue;
... | ALGO | 0.999994 | 5.030437 |
03653e3c-bb7b-4b28-bfc1-6b6ef99390db | yuqj1991/realtimefaceRecognition | include/eigen/doc/examples/class_VectorBlock.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
template<typename Derived>
Eigen::VectorBlock<Derived>
segmentFromRange(MatrixBase<Derived>& v, int start, int end)
{
return Eigen::VectorBlock<Derived>(v.derived(), start, end-start);
}
template<typename Derived>
const Eigen::Vec... | TOOL | 0.989236 | 4.383477 |
f98beb1b-100f-4555-81ed-20711c7ef8a7 | Deepak20y/automatic-memory | E_Tufurama.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 200 * 1000 + 9;
int n;
int a[N];
int f[N];
vector <int> v[N];
void upd(int pos, int d){
for(; pos < N; pos |= pos + 1)
f[pos] += d;
}
int get(int pos){
int res = 0;
for(; pos >= 0; pos = (pos & (pos + 1)) - 1)
res += f[pos];
return res;
}
int mai... | ALGO | 0.999919 | 3.758419 |
edf28601-6943-4b1f-9772-f97f9647fcf3 | HarshaVardhan31012007/Leetcode-and-Gfg-Codes | 0410-split-array-largest-sum/0410-split-array-largest-sum.cpp | class Solution {
public:
bool possible(vector<int>&nums,int mid,int k){
int c=1;int sum=0;
for(int i=0;i<nums.size();i++){
if(sum+nums[i]<=mid)
sum+=nums[i];
else{
c++;
if(c>k) return false;
sum=nums[i];
}
}
... | ALGO | 0.999984 | 5.689066 |
5a941e48-0f9f-4b92-af53-80896b7c963b | Strawberry9583/LeetCode | Challenge/October_LeetCoding_Challenge/Day30_number_of_longest_increasing/Day30_number_of_longest_increasing/Day30_number_of_longest_increasing.cpp | #include<iostream>
#include<vector>
#include<string>
#include<algorithm>
using namespace std;
// method1: dp
// dp[i] indicates max_length when the sequncen ends up with nums[i];
// max_length_num[i] indicates the max_length number of the longest increasing subsequence when
// end up with nums[i];
// time complexity:... | ALGO | 0.999997 | 5.800792 |
abaa4f6f-bbb7-4611-9f3b-989c7095a140 | Devaanshraheja/DSA_Cpp | lecture_10/04_binary_search.cpp | #include<iostream>
using namespace std;
int binary_search(int*a, int s, int e, int key){
// base case
if(s>e) return -1;
int mid=(s+e)/2;
if(a[mid]==key) return mid;
else if(key>a[mid]){
int indx=binary_search(a,mid+1, e,key);
return indx;
}
else{
return binary_search(a,s,mid-1,key);
}
}
... | ALGO | 0.999948 | 5.039564 |
3f7f868d-6958-4af0-a5c0-451b52a45ac1 | HamzaAliDev/DSA-Uni-Practice | bubble-sort.cpp | #include <iostream>
using namespace std;
int main(){
int n;
cout<<"Enter length of array: ";
cin>>n;
int arr[n];
cout<<"Enter values in Array: ";
for(int i=0; i<n; i++){
cin>>arr[i];
}
// bubble sort
int count = 1;
int temp;
while(count < n){
for(int i=0; i< n-count; i++){
if(arr[i] > arr[i + 1])
... | ALGO | 0.999683 | 4.496351 |
88fde27c-598d-4c55-8254-6e3b2da26cd8 | iains/LLVM-7-branch | llvm/lib/CodeGen/DFAPacketizer.cpp | #include "llvm/CodeGen/DFAPacketizer.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBundle.h"
#include "llvm/CodeGen/ScheduleDAG.h"
#include "llvm/CodeGen/ScheduleDAGInstrs.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetS... | TOOL | 0.995366 | 7.660175 |
71c6c596-e1b2-448d-add0-90b5052c3f14 | yzzupgo/MFTCG | Data/abc206_a/Conanvs/ac/23636317.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, a;
cin >> n;
a = 108 * n / 100;
if(a < 206) {
cout << "Yay!" << endl;
} else if(a == 206) {
cout << "so-so" << endl;
} else if(a > 206) {
cout << ":(" << endl;
}
}
| ALGO | 0.999007 | 3.44731 |
ca17aecd-b3eb-4ba9-b40b-47db625e5e7e | lilmuggle/leetcode | regExpMatch.cpp | class Solution {
public:
bool isMatch(string s, string p) {
vector<vector<bool>> dp(s.size() + 1, vector<bool>(p.size() + 1, false));
dp[0][0] = true;
for(int j = 1; j <= p.size(); j++)
if(p[j - 1] == '*')
dp[0][j] = dp[0][j - 2];
for(int i = 1; i <= s.siz... | ALGO | 0.999891 | 5.955273 |
86070469-2235-4333-9b3a-b0402255f25e | Hoorabfatima/PD6 | task1cp.cpp | #include<iostream>
using namespace std;
string decideActivity(string, string);
main()
{
string temperature, humidity, recommendedActivity;
cout<<"Enter temperature (warm or cold): ";
cin>>temperature;
cout<<"Enter humidity (dry or humid): ";
cin>>humidity;
recommendedActivity=decideActivity(temperature, hum... | TOOL | 0.856522 | 5.116342 |
556411c5-8d03-481c-9b06-5be1e0f8241d | MrAlexandrov/competitive-programming | contests/Yandex/Fundamentals of algorithms/3. Algorithm Design Techniques/6. Randomized algorithms/B/main.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int lomutoPartition(vector<int> &arr, int low, int high) {
int pivot = arr[(low + high) / 2]; // ( )
int i = low;
for (int j = low + 1; j < high; j++) {
if (arr[j] < pivot) {
i++;
swap(arr[i], arr[j]);... | ALGO | 0.999977 | 4.988513 |
d6508a91-392d-4b4a-8ad4-27e5b4c796fd | Nerer/Mjolnir | 2016.08.02-ICPC-2012-Asia-Regional-Chengdu/D.cpp | #include <bits/stdc++.h>
const int N = 1e5 + 100;
const int MAGIC = 300;
int n, m;
std::vector<std::pair<int, long long> > edge[N];
long long sumWeight;
bool color[N];
long long sum[N][2];
long long answer[2];
void init() {
for (int i = 1; i <= n; i ++) {
int t;
scanf("%d", &t);
color[i] = t;
}
std::fill(ed... | ALGO | 0.999671 | 4.556348 |
5a2e8903-6177-4868-8e66-457c1930fae3 | HolyDragonProject/android_external_skia | tests/PathOpsCubicLineIntersectionIdeas.cpp | #include "PathOpsTestCommon.h"
#include "SkIntersections.h"
#include "SkPathOpsCubic.h"
#include "SkPathOpsLine.h"
#include "SkPathOpsQuad.h"
#include "SkRandom.h"
#include "SkReduceOrder.h"
#include "Test.h"
static bool gPathOpsCubicLineIntersectionIdeasVerbose = false;
static struct CubicLineFailures {
CubicPts... | TEST | 0.911643 | 5.116207 |
e0fe54ab-b6ef-4fd3-9c49-29a5c505c9e7 | Alishakc02/DISCRETE-STRUCTURE | practice12.cpp | #include<iostream>
#include<string>
#include<stdbool.h>
using namespace std;
void findDifference(int set1[],int size1, int set2[], int size2)
{
int i,j;
cout<<"Difference between the sets is:"<<endl;
for( i=0;i<size1;i++){
bool found =false;
}
for( j=0;j<size2;j++){
if (set1... | ALGO | 0.996477 | 3.481816 |
06d68de7-569a-40e0-b9ae-32ad12ccf498 | sushil2817/DSA-in-CPP | DSA2025/2DArray/rowSum.cpp | #include<iostream>
using namespace std;
void rowSum(int arr[][4], int row, int col){
for(int i=0;i<row;i++){
int sum = 0;
for(int j=0;j<col;j++){
sum = sum+arr[i][j];
}
cout<<"Printing sum "<<sum<<endl;
}
}
// col sum
void colSum(int arr[][4], i... | ALGO | 0.999624 | 3.776407 |
dff5f15d-9749-471f-84da-91aafae48410 | 1010varun/Leetcode-Problems | 0410-split-array-largest-sum/0410-split-array-largest-sum.cpp | class Solution {
public:
bool isPossible(vector<int>& nums, int mid, int k) {
int count = 1;
int sum = 0;
for(int i = 0; i < nums.size(); i++) {
if(sum + nums[i] <= mid) {
sum += nums[i];
}
else {
... | ALGO | 0.999979 | 5.863545 |
5863464c-7067-4c2e-9b14-c34ca636177f | adriraj2000/CP_Problems | KMP.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> prefix_function(string s)
{
int n = s.length();
vector<int> pre(n, 0);
for (int i = 1; i < n; i++)
{
int j = pre[i - 1]; //Last subsequent matched prefix length
//If it does not matches
while (j > 0 && s[i] != s[j])
... | ALGO | 0.999931 | 5.187979 |
bea024c6-b9cf-41d5-b7bf-7c57027124bb | FS-NulL/Q3Radiant | Q3Radiant/VERTSEL.CPP |
#include "stdafx.h"
#include "qe3.h"
#include "winding.h"
int FindPoint (vec3_t point)
{
int i, j;
for (i=0 ; i<g_qeglobals.d_numpoints ; i++)
{
for (j=0 ; j<3 ; j++)
if (fabs(point[j] - g_qeglobals.d_points[i][j]) > 0.1)
break;
if (j == 3)
return i;
}
VectorCopy (point, g_qeglobals.d_points[g_q... | ALGO | 0.993464 | 3.168242 |
b1a61913-b77c-4882-91e7-d42f9cef42a2 | BingLingYun/AC_Code | 2024ICPC Chengdu/G.cpp | #include<bits/stdc++.h>
#define i64 long long
#define pii pair<int,int>
#define pll pair<i64,i64>
#define int128 __int128_t
#define ull unsigned long long
#define all(x) x.begin(),x.end()
using namespace std;
constexpr i64 mod=998244353;
int main()
{
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
cout... | ALGO | 0.999768 | 4.412772 |
687c843c-e368-4f86-b6f8-b2465d441b2a | evaluation-alex/389-ldap-directory-server | lib/libaccess/lasgroup.cpp | #ifdef HAVE_CONFIG_H
# include <config.h>
#endif
/* #define DBG_PRINT */
/* lasgroup.c
* This file contains the Group LAS code.
*/
#include <stdio.h>
#include <string.h>
#include <netsite.h>
#include "aclpriv.h"
#include <libaccess/usrcache.h>
#include <libaccess/las.h>
#include <libaccess/dbtlibaccess.h>
#include... | TOOL | 0.90967 | 4.585728 |
e7d6a912-c229-4840-9cf5-3d5e62cb0550 | AAIR-lab/QACE | dependencies/prp/src/VAL/PinguPlanGenerator.cpp | #include "PinguPlanGenerator.h"
#include <fstream>
#include <algorithm>
using namespace std;
namespace VAL {
PinguPlanGen::PinguPlanGen(char * name) : VisitController(), lastAt("theStart"), count(0), pingu(0), lastMoved(0), mustDelay(true)
{
ifstream mapper(name);
string s;
float x,y;
while(true)
{
... | ALGO | 0.971924 | 3.360384 |
c26d9173-56f2-4adb-b895-c5b049b2d408 | szefany/acm-icpc | ural/p1961.cpp | #include <cstdio>
#include <iostream>
long long n, m, N;
int main() {
std::cin >> n >> m >> N;
long long l = m, r = N - n + m;
while (l < r) {
long long x = l + r + 1 >> 1;
long long a = (x + 1) * (N - x - n + m);
long long b = (x + 1 - m) * (N - x);
if (a >= b) {
... | ALGO | 0.999993 | 3.949083 |
fd3b46bf-06bb-49ed-9711-38aad2d466d1 | maityamit/Cpp-DSA-Notes-and-Programs | 004 - Recursion/002 Recursion 1b/004 String to Number Convert.cpp | #include <iostream>
#include<string.h>
using namespace std;
int helper(char input[],int end){
if(end==0){
return (int)input[0]-48;
}
int ans = (int)input[end]-48;
int res = helper(input,end-1);
return (res*10)+ans;
}
int stringToNumber(char input[]) {
// Write your code here
re... | ALGO | 0.999792 | 4.388165 |
67b2820e-d32e-43fc-81c0-39c72950f830 | sakthii21/Leetcode- | Next permutation.cpp | class Solution {
public:
void nextPermutation(vector<int>& nums) {
int n = nums.size();
int ind=-1;
for(int i=n-2;i>=0;i--){
if(nums[i]<nums[i+1]){
ind=i;
break;
}
}
if(ind==-1){
reverse(nums.begin(),nums.end());
return;
... | ALGO | 0.999996 | 5.819683 |
46f7fcf8-5a6d-4c68-b51e-a5189e6b6fd2 | zhanghx0905/undergraduate-archive | 01.FOP/Mock exam/分书问题.cpp | /*
题目描述
现在有N本书,准备分给N个人。每个人的阅读兴趣,用一个二维数组like[i][j]加以描述。
若 like[i][j] = 1 ,则表示第i个人喜欢第j本书;反之,若 like[i][j] = 0 ,则表示第i个人不喜欢第j本书。
现在已知like数组,请写一个程序,输出所有的分书方案,让人人皆大欢喜。
输入描述
第一行有一个整数N。(N <= 10)
之后有N行,每i行有N个数a_ij,取值为0或1,表示like数组,即第i个人是否喜欢第j本书。0表示不喜欢,1表示喜欢。
输出描述
输出多行。
每行输出一种分书方案,按顺序输出1~N每个书分给对应的人的编号。
所有分书方案,按字典序从小到大的顺序输出。*/
#in... | ALGO | 0.999961 | 3.846316 |
3a6fd46e-4807-432a-a2c2-a95dad4d5da4 | vitorguidi/Competitive-Programming | Treinos equipe/xv de piracikobus/2019/03-01 2018 IME Tryouts/f.cpp | #include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define fr(i,n) for(int i=0;i<n;i++)
#define frr(i,n) for(int i=1;i<=n;i++)
#define ms(x,i) memset(x,i,sizeof(x))
#define dbg(x) cout << #x << " = " << x << endl
#define all(x) x.begin(),x.en... | ALGO | 0.999983 | 3.877813 |
0b8b2e00-6a09-49fc-bbdf-eebe539b4e4d | NicholasOsterfelt/ucd-csci2312-pa2 | Cluster.cpp | //
// Created by Nick on 9/20/2015.
//
#include <cmath>
#include "assert.h"
#include <sstream>
#include <cstdlib>
#include <forward_list>
#include "Cluster.h"
#include "Point.h"
using namespace std;
namespace Clustering {
unsigned int Cluster:: _generateId = 0;
Cluster::Cluster(unsigned int d) {
dims ... | ALGO | 0.971982 | 5.6518 |
69c546cc-a2f5-47cd-89f6-b38502912155 | nikitapastuhov16/Polyakov_Labs | Source codes/8F.cpp | #include <iostream>
using namespace std;
void sort(int *mass, int size)
{
int min = 0;
int max = size - 1;
while (min < max)
{
for(int i = min; i < max; i++) if(mass[i] > mass[i+1]) swap(mass[i], mass[i+1]);
max--;
for(int i = max; i > min; i--) if(mass[i] < mass[i-1]) swap(mass... | ALGO | 0.999892 | 3.355847 |
62f3c6ce-d293-479f-b2e8-ce12794ee7f4 | AmrTAzzam/smartKG-creator | hdt-cpp-molecules/libhdt/src/libdcs/fmindex/SuffixArray.cpp | #include "SuffixArray.h"
namespace csd{
SuffixArray::SuffixArray(){
}
long* SuffixArray::sort(unsigned char *text, unsigned long length){
long c, *x, *p;
long k, l, nn;
#if COMPACT==2
unsigned char q[UCHAR_MAX+1];
#endif
p=(long *)malloc((length+1)*sizeof(long));
x=(long *)malloc((length+1)*siz... | ALGO | 0.998683 | 3.176515 |
4ecc13dd-0f04-4d7a-8cc5-a5c8757b8cfd | nataliekemper/CG-proj-cs184 | Cloth-sim/ext/nanogui/ext/eigen/doc/examples/tut_arithmetic_dot_cross.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
using namespace std;
int main()
{
Vector3d v(1,2,3);
Vector3d w(0,1,2);
cout << "Dot product: " << v.dot(w) << endl;
double dp = v.adjoint()*w; // automatic conversion of the inner product to a scalar
cout << "Dot product via a matrix product... | ALGO | 0.999127 | 4.042919 |
7f872503-902b-4151-b985-a89fab8ebc48 | akhiranandan/30-Days-Challenge | Microsoft/10.cpp | class Solution {
public:
bool static cmp(const pair<int,int> p1 ,const pair<int,int> p2)
{
if(p1.first != p2.first)
{
return (p1.first < p2.first);
}
else return (p1.second > p2.second);
}
void dijkstras(int src, int n, vector<pair<int, int>> adj[], vec... | ALGO | 0.999978 | 5.952316 |
a8058ef6-aa74-45d7-9f48-f2a06bedfd84 | dark-bytes/Competitive-Programming | ALGORITHM/maxlength.cpp | #include<iostream>
using namespace std;
int main()
{
int a[7];
for(int i = 0;i<7;i++)
{
cin>>a[i];
}
int ls[7] = {0};
for(int i = 0;i<7;i++)
{
ls[i] = 1;
for(int j = 0;j < i;j++)
{
if(a[i] > a[j] && ls[i] <= ls[j])
{
ls[i] = ls[j] + 1;
}
}
}
int largest = 0;
for(int i = 0;i <... | ALGO | 0.999953 | 3.378818 |
599f2402-53e0-4b05-8f3a-a3c3b5f82dd9 | yashi2407/Leetcode-Submissions | 0945-snakes-and-ladders/0945-snakes-and-ladders.cpp | class Solution {
public:
pair<int, int> getPosition(int num, int n) {
int rowFromBottom = (num - 1) / n;
int row = n - 1 - rowFromBottom; // Convert to top-down row index
int colInRow = (num - 1) % n;
int col;
if (rowFromBottom % 2 == 0) {
col = colInRow; // Left... | ALGO | 0.999937 | 6.79169 |
d8147b1a-39e7-4c47-880b-71bc88345ef6 | MrPablozOne/Bakalarka_Kaira | libs/casimrun/state.cpp |
#include "state.h"
#include "context.h"
namespace ca {
extern int process_count;
extern size_t tracelog_size;
}
casr::State::State(RunConfiguration &run_configuration, ca::NetDef *net_def)
: thread_info(ca::process_count),
run_configuration(run_configuration) {
global_time = 0;
for (int p = 0; p < ca::process... | TOOL | 0.896207 | 4.631512 |
7c1e1212-9667-4092-b55f-4535759565aa | xiaojiang2001/study2 | offer100/树/demo55二叉树的深度.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) {}
};
int TreeDepth(TreeNode* pRoot) {
queue<TreeNode*> que;
if(pRoot == nu... | ALGO | 0.999285 | 4.892223 |
4de5f15c-d018-44ee-b63b-da8e042d250b | Institute-of-Surface-Science/mshr | 3rdparty/CGAL/examples/Nef_2/nef_2_polylines.cpp | #include <CGAL/Exact_rational.h>
#include <CGAL/Lazy_exact_nt.h>
#include <CGAL/Simple_cartesian.h>
#include <CGAL/Bounded_kernel.h>
#include <CGAL/Nef_polyhedron_2.h>
typedef CGAL::Lazy_exact_nt<CGAL::Exact_rational> FT;
typedef CGAL::Simple_cartesian<FT> Kernel;
typedef CGAL::Bounded_kernel<Kernel> Extended_kernel;
... | ALGO | 0.994142 | 4.604901 |
94745f5b-0c39-439e-a5cd-e8e2c7d8bd41 | oxygen-hunter/Flashboom | data/leetcode_cpp/greatest-common-divisor-of-strings.cpp | // Time: O(m + n)
// Space: O(1)
class Solution {
public:
string gcdOfStrings(string str1, string str2) {
if (str1.empty() || str2.empty()) {
return "";
}
int c = gcd(str1.length(), str2.length());
const auto& result = str1.substr(0, c);
return check(str1, resul... | ALGO | 0.999907 | 6.614663 |
00f0dab2-ca99-497a-aa47-2a7e73fb48a9 | aditi-n-kumar/Heaps-DSA | main.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "util.h"
#include "heap.h"
#include "main.h"
#include <iomanip>
#include <iostream>
#include <fstream>
#include <limits>
void initializeHeap(HEAP* pHeap, ELEMENT** V, int capacity) {
pHeap->capacity = capacity;
pHeap->H = new int[capacity... | ALGO | 0.995642 | 4.228204 |
0f72852d-3cae-4f06-b06f-1a001278b68a | abdelrhmunhussien/lane-detection | video.cpp | /// Use this file with videos ///
#include "lane-detection.h"
int main(int argc, char* argv[])
{
// Load source video
if (argc != 2) {
std::cout << "Usage: ./exe path-to-video" << std::endl;
return -1;
}
// Initialize video capture for reading a videofile
VideoCapture cap(argv[... | TOOL | 0.933095 | 5.465243 |
342f8944-7e5a-4d64-a77d-75f6a6bc238d | Pradeep17Jadhav/LeetCode-Questions | 740-delete-and-earn/740-delete-and-earn.cpp | class Solution {
public:
//Same as house robbing problem
int deleteAndEarn(vector<int>& nums) {
return deleteAndEarn_1(nums);
// return deleteAndEarn_2(nums);
}
//TC: O(N)
//SC: O(1) //constant sized array is used
int deleteAndEarn_1(vector<int>& nums) {
int n = ... | ALGO | 0.99947 | 5.888979 |
ca17eecb-4c17-44e6-8d85-403dcd3e5f7f | vfolunin/archives-solutions | EOlymp/8846.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
int main() {
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
int n;
cin >> n;
cout << n / 100 * 100 + n % 10 * 10 + n / 10 % 10;
} | ALGO | 0.9965 | 3.885755 |
91677a13-1824-4d5f-85b5-d846e7551b04 | improdead/vector_engine | thirdparty/icu4c/common/bytestriebuilder.cpp | #include "unicode/utypes.h"
#include "unicode/bytestrie.h"
#include "unicode/bytestriebuilder.h"
#include "unicode/stringpiece.h"
#include "charstr.h"
#include "cmemory.h"
#include "uhash.h"
#include "uarrsort.h"
#include "uassert.h"
#include "ustr_imp.h"
U_NAMESPACE_BEGIN
/*
* Note: This builder implementation stor... | TOOL | 0.958516 | 7.603553 |
df116d5e-fb65-406a-a36e-e0e81963b95e | rahulsidar/RahulSidar-OATCP | 15-Brief_words/BriefWord.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define IMAX INT32_MAX
#define IMIN INT32_MIN
#define endl '\n'
#define all(v) v.begin(), v.end()
#define loop(n) for (int i = 0; i < n; i++)
#define vll vector<ll>
#define pr pair<ll, ll>
#define vpr vector<par<int, int>>
void cases();
int32_t main... | ALGO | 0.999527 | 3.525777 |
34cb32c0-67c2-4d93-8c4d-9a3b75dee8dc | harshitsyal/gsoc | shogun/src/shogun/classifier/svm/LaRank.cpp | /***********************************************************************
* $Id: kcache.c,v 1.9 2007/01/25 22:42:09 leonb Exp $
**********************************************************************/
#include <vector>
#include <algorithm>
#include <shogun/io/SGIO.h>
#include <shogun/lib/Signal.h>
#include <shogun/li... | ALGO | 0.990176 | 4.784303 |
1826d7a4-f6dc-41cb-a098-5f5fa29e09b0 | coderss07/competitive-programming | Rotten_oranges.cpp | // Author : Sarthak Sharma
#include<bits/stdc++.h>
// <------------------------------------- Directives ------------------------------------->
#define ll long long int
#define vi vector<int>
#define vl vector<ll>
#define vll vector<vector<ll>>
#define pii pair<int, int>
#define ff first
#define N 1e5
#define mod 100000... | ALGO | 0.999962 | 5.021242 |
41a6a5f8-f4d2-44ce-b561-807e93466f41 | SamTang2004/ProjectRepo | python 练习册/C++练习册/TestProject/main.cpp | #include <iostream>
#include <string>
#include <cstring>
using namespace std;
// declarations
int main();
double ceil(double x, double top);
// actual code
int main()
{
cout<<ceil(-20,15);
return 0;
}
double ceil(double x, double top){
return abs(x)>=top ? (x > top ? top : -top) : x;
}
| ALGO | 0.998326 | 3.472915 |
e0670279-6c80-4fcd-af75-0f0a27b212d3 | manish-kumar1/LeetCode-Problems | Array/Container_with_Most_Water.cpp | /*
Q. Container With Most Water
You are given an integer array height of length n.
There are n vertical lines drawn such that the two endpoints of the ith line are (i, 0) and (i, height[i]).
Find two lines that together with the x-axis form a container, such that the container contains the most water.
Return the max... | ALGO | 0.999959 | 6.612893 |
3201ea5b-3a2c-4d5b-ade3-b3b86898cead | porag525/XPSC | Week 8/Day 5/B_Longest_Divisors_Interval.cpp | /*
__________________________
| Author:Md.Moniruzzaman |
--------------------------
*/
#include <bits/stdc++.h>
#define ll long long int
#define all(v) v.begin(), v.end()
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define f front
using namespace std;
void solve()
{
ll n,ans=0;
... | ALGO | 0.999674 | 4.612983 |
c5a2ec6f-89fd-4527-a071-8561c1e3f83b | ishandutta2007/codeforces | endagorion/normal/446/D.cpp | #include <bits/stdc++.h>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define... | ALGO | 0.999962 | 4.056027 |
a0319d7d-7bee-4f99-b7c9-74890ac7d869 | Pooja-so/DSA | Step1_Basics/Recursion/numbers.cpp | #include<iostream>
using namespace std;
// without backtracking
void numN_To_1(int n){
if(n == 0 )
return;
cout<< n << endl;
numN_To_1(n-1);
}
// with backtracking
void numN_To_1(int n){
if(n == 5 )
return;
numN_To_1(n-1);
cout<< n << endl;
}
// Backt... | ALGO | 0.999888 | 4.111446 |
e2c8babe-80db-4665-b838-caaabd116c5d | harleyham/H1 | tools/crop_to_hull.cpp | #include <pcl/filters/crop_hull.h>
#include <pcl/io/pcd_io.h>
#include <pcl/console/print.h>
#include <pcl/console/parse.h>
#include <pcl/console/time.h>
#include <pcl/surface/concave_hull.h>
using namespace pcl;
using namespace pcl::io;
using namespace pcl::console;
typedef PointXYZ PointT;
typedef PointCloud<PointT... | TOOL | 0.989629 | 6.848223 |
4a9eabf7-7359-42f9-8ee1-d95a95bf7520 | shamikh1014/CL | Arrays/arrayProblem27.cpp | // 32. Find whether an array is a subset of another array.
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int m, n;
cin>>m>>n;
int a[m], b[n];
for(int i=0;i<m;i++){
cin>>a[i];
}
for(int i=0;i<n;i++){
... | ALGO | 0.999981 | 4.273959 |
94efadc4-f431-439c-8c29-64dad82f83af | xmfbit/Algorithm-Design-And-Analysis | Part-I/Week5/dijkstra.cpp | #include <iostream>
#include <queue>
#include <string>
#include <vector>
#include <utility>
#include <list>
#include <fstream>
#include <sstream>
using namespace std;
typedef pair<int, size_t> Edge;
typedef pair<int, size_t> dis_pair;
#define MAX_LENGTH 1000000
struct CompDispair {
bool operator()(const dis_pair& lh... | ALGO | 0.998369 | 3.903224 |
831bdec4-4926-451f-a2ae-3c1ab90e74a6 | ishandutta2007/codeforces | rivalq/normal/835/A.cpp | //https://codeforces.com/contest/835/problem/A
#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
#define rep(i,a,n) for(int i=a;i<n;i++)
#define rep3(n) for(int i=0;i<n;i++)
#define inarr(arr,n) rep(i,a,n)cin>>arr[i]
#define ll long long int
#define pb push_back
#define all(v) ... | ALGO | 0.999788 | 3.691023 |
ba2d2364-9d19-4222-802d-b0572d88e683 | raincross7/code-similarity | codes/train_code/problem318/problem318_229.cpp | //#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define INF 0x6fffffff
#define INFL 0x6fffffffffffffffLL
int main() {
ll a,b,c,h,i,j,k,l,m,n,x,y;
ll ans = 0;
string s;
cin >> a >> b >> c;
ans = a + b + c - max(a , max(b,c));
cout << ans << endl;
return 0;
}
| ALGO | 0.999705 | 3.661715 |
1615ae56-50ac-4991-8e52-964e31e3865c | jaiskid/Career_bootcamp | career_bootcamp/divisblesub.cpp | //good subarrays
#include<iostream>
#include<cstring>
#define ll long long
using namespace std;
int freq[1000005],arr[1000005];
int main() {
int t;
cin>>t;
while(t--){
memset(freq,0,sizeof(freq));
int n;
cin>>n;
freq[0]=1;
int sum=0;
for(int i=0;i<n;i++){
cin>>arr[i];
sum+=arr[i];
sum%=n;
... | ALGO | 0.999819 | 3.974087 |
509a6066-874e-45f5-83b5-91ac558b1af5 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Phi/top0-100/best-time-to-buy-and-sell-stock-iv-Solution.maxProfit/177781_DoS_Exec_Code_Overflow.cpp | void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
int i, j;
Guchar *inp, *tmp_line;
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
tmp_line = (Guchar *) gmalloc (length * nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
... | ALGO | 0.997173 | 4.472883 |
0dab2adf-bf8b-4ede-9f4f-db25ebaa0277 | finger-bone/sgo-lang | src/slr_parser_core.cpp | #include "../include/nlohmann/json.hpp"
#include "../include/slr_parser.hpp"
namespace slr {
// 构建解析表,指定开始符号
bool SLR1Parser::build_parse_table(const std::string &start_symbol) {
this->start_symbol = start_symbol;
this->augmented_start_symbol = start_symbol + "'";
// 增广文法
initialize_augment_grammar();
// ... | ALGO | 0.981791 | 4.862656 |
9aa11a7d-0722-4494-9614-742e24d64873 | alemutn/CUVL_LABORATORIO_I | Guia/Ejercicio_MI34/main.cpp | #include <iostream>
using namespace std;
int factorial(int valor) {
int resultado = 1;
for (int i = valor; i > 0; i--)
{
resultado = resultado * i;
}
return resultado;
}
int main () {
int numero = 0;
cout << "Ingrese un número: ";
cin >> numero;
cout << endl;
cout... | ALGO | 0.997814 | 4.700765 |
b0714b4d-4de8-407e-b3ee-445894afd10f | Shivank-thapa/CS-513 | A1/204101053.cpp | /* Compilation and execution environment: Linux G++
To compile and get executable file use command:
`g++ 204101053.cpp -o execution_file_name`
or
`g++ -std=c++11 204101053.cpp -o execution_file_name`
*/
/**
* Filename: 204101053.cpp
* Author Name: Shivank Thapa
* Course: CS-513
* Subject... | TOOL | 0.980439 | 4.815241 |
f5e6b0f1-c8a8-4cb5-b98c-7c640e9a7271 | RocaIgnacio1/Programacion-Competitiva | notebook/secciones/geometria/polarsort.cpp | #include "pto.cpp"
/*
funcionamiento:
vector<pto> puntos = {pto(1, 2), pto(2, 1), pto(-1, -1), pto(0, 2)};
pto referencia(1, 1); // punto de referencia
sort(puntos.begin(), puntos.end(), Cmp(referencia));
*/
struct Cmp{//orden total de puntos alrededor de un punto r
pto r;
Cmp(pto r):r(r) {}
int cuad(c... | ALGO | 0.999767 | 4.556684 |
8f8f95ea-e6e0-4aa5-8a6e-da5d5bac2a84 | lenefi/TMA4280 | poisson/test_trans/main.cpp |
#include "mpi.h"
#include <cstdio>
#include <cstring>
#include <iomanip>
#include <sstream>
typedef double real;
int main(int argc, char **argv)
{
MPI_Init(&argc, &argv);
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
int size;
MPI_Comm_size(MPI_COMM_WORLD, &size);
int m = 2*size;
int n = m / size;
... | ALGO | 0.995041 | 3.17351 |
ca39e811-2854-4a09-a49a-c49e87724f1c | linneszyx/CP-Problems | Hard/Better String/better-string.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
public:
long long fun(string &s){
vector<int>vis(26,-1);
int n=s.size();
vector<long long>dp(n+1,1);
for(int i... | ALGO | 0.999996 | 6.230635 |
baba026c-24f0-4aaa-b46b-3494249d315b | RahmanMoshiur00/Problem-Solving | Contests/ICPC 4B.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define all(a) a.begin(), a.end()
#define ZERO(a) memset(a, 0, sizeof(a))
#define MINUS(a) memset(a, 0xff, sizeof(a))
#define debug if( 0 )
const int mxn = 100010;
void solve(int test_cas... | ALGO | 0.999939 | 3.833745 |
58bc9172-da7b-4374-95f3-655be0dae38c | thuthu-c/competitive-programming | code/aulas-UFMG/guloso/corredor.cpp | #include <bits/stdc++.h>
using namespace std;
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define f first
#define s second
#define pb push_back
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
int mai... | ALGO | 0.999901 | 4.12044 |
d6cda226-db3f-4b97-a407-fa82f799ab12 | Astitva0809/Leetcode | 1335-maximum-candies-allocated-to-k-children/1335-maximum-candies-allocated-to-k-children.cpp | class Solution {
public:
int mini(vector<int>& candies){
int m=INT_MIN;
int n =candies.size();
for(int i=0;i<n;i++){
m=max(m,candies[i]);
}
return m;
}
long long ischeck(int val, vector<int>& candies){
int n=candies.size();
long long res=... | ALGO | 0.999982 | 5.756517 |
a206316b-152f-47b6-ba7f-5a6b8b396cfc | occilation/uva | 624-CD/main.cpp | #include <iostream>
#include <utility>
using namespace std;
typedef pair<int, int> p2i;
int N, n, tracks[20];
// version with void and global variables
int best_sum, best_tracks;
void count_void(int i, int sum, int cur_tracks) {
if (sum > N) return;
if (sum > best_sum) {
best_sum = sum;
best... | ALGO | 0.999705 | 3.927386 |
f12692f0-e807-463f-9e3d-c24cdb49b080 | liam-m-bell/graphics | code/raytracer_start/Materials/global_material.cpp | #include "global_material.h"
#include <math.h>
GlobalMaterial::GlobalMaterial(Environment* p_env, Colour p_reflect_weight, Colour p_refract_weight, float p_ior)
{
}
// reflection and recursion computation
Colour GlobalMaterial::compute_once(Ray& viewer, Hit& hit, int recurse)
{
Colour result;
return result;
}
C... | ALGO | 0.95903 | 4.690897 |
3ad92f50-0662-4507-83a1-13453fa7af4e | CGAL/cgal | Lab/demo/Lab/Plugins/Point_set/Point_set_to_mesh_distance_plugin.cpp | #include <CGAL/Three/CGAL_Lab_plugin_interface.h>
#include <CGAL/Three/CGAL_Lab_plugin_helper.h>
#include <CGAL/Three/Three.h>
#include <QApplication>
#include <QDockWidget>
#include <QObject>
#include <QAction>
#include <QMainWindow>
#include <Scene_surface_mesh_item.h>
#include <Scene_points_with_normal_item.h>
#incl... | TOOL | 0.904112 | 6.730126 |
93f7bf20-e23f-4cea-8b5c-5c0d074f4e25 | chaerrad/baekjoon_algorithm | BF/16922(BF).cpp | #include <iostream>
using namespace std;
bool check[50 * 20 + 1];
int main() {
int n;
cin >> n;
for (int i = 0; i <= n; i++)
{
for (int j = 0; j <= n - i; j++)
{
for (int k = 0; k <= n - i - j; k++)
{
int l = n - i - j - k;
int sum = i + 5 * j + 10 * k + 50 * l;
check[sum] = true;
}
}
}
... | ALGO | 0.999785 | 3.236959 |
8ac44299-e371-49ac-b7d7-43d82e5e91e0 | gyubeomim/pgo_toy_example | src/pgo_toy_example_node.cpp | #include "pgo_toy_example.h"
#include <ros/ros.h>
#include <geometry_msgs/Point.h>
#include <visualization_msgs/Marker.h>
#include <visualization_msgs/MarkerArray.h>
#include <Eigen/Dense>
#include <g2o/core/sparse_optimizer.h>
#include <g2o/core/optimizable_graph.h>
#include <g2o/core/block_solver.h>
#include <g2o... | ALGO | 0.957721 | 4.854567 |
3fad8da1-3b85-45c7-8f3d-3ac78ea3ed2b | ishandutta2007/codeforces | ooops_no/normal/1155/C.cpp | #include<iostream>
#include<vector>
#include<algorithm>
#include<string>
#include<set>
#include<iterator>
#include<map>
#include<deque>
#include<math.h>
using namespace std;
#define int long long
#define pb push_back
#define ld long double
#define mp make_pair
int gcd(int a, int b) {
if (b == 0) {
return a;
}
e... | ALGO | 0.999987 | 3.397955 |
df512e76-401b-4e3d-9568-83c1c886b1e1 | Matthew-Holmes/MultiTaskBayesian | src/optimisers/cuda/RandomSampleWrapper.cpp | #include <vector>
#include <string>
#include <iostream>
#include <fstream>
#include <Eigen/Dense>
#include <cuda_runtime.h>
#include "RandomInitialise.h"
#include "SurrogateKernel.h"
#include "RandomSampleWrapper.hpp"
template <typename T>
void writeDeviceArrayToTxt(
const T* d_array, size_t size, size_t stride, ... | ALGO | 0.997644 | 6.490858 |
094635c2-e9a0-41f0-a43e-b96bde2b553e | kahvmoh/Code-Solutions | 215-kth-largest-element-in-an-array/215-kth-largest-element-in-an-array.cpp | class Solution {
public:
int findKthLargest(vector<int>& nums, int k) {
int len = nums.size();
sort(nums.begin(), nums.end());
return nums[len - k];
}
}; | ALGO | 0.999897 | 5.435929 |
08968b79-a59a-46d1-86fb-f0a462e30bb6 | dame-time/UserAssistedSphereMeshEditor | include/igl/quad_grid.cpp | template<
typename DerivedV,
typename DerivedQ,
typename DerivedE>
IGL_INLINE void igl::quad_grid(
const int nx,
const int ny,
Eigen::PlainObjectBase<DerivedV> & V,
Eigen::PlainObjectBase<DerivedQ> & Q,
Eigen::PlainObjectBase<DerivedE> & E)
{
grid(Eigen::Vector2i(nx,ny),V);
return igl::quad_grid(nx,... | ALGO | 0.988088 | 5.63276 |
02737ca2-06ae-446b-8f5e-b9a5496dbbf7 | Alok-2004/problemSolving | KthSymbol_779.cpp | #include <iostream>
#include <cmath>
using namespace std;
int kthGrammar(int n, int k) {
// Base case: when n is 1, return 0 as the first row is always 0
if (n == 1) return 0;
// If k is even, the value is flipped compared to the previous row's k/2 position
if (k % 2 == 0) {
int preAns = kthG... | ALGO | 0.999975 | 7.064824 |
effaa396-06b4-4146-a94f-4c2fd038fc10 | SakibHasanMD/Data_Structure_Lab_P_Fall_22-23 | task2.cpp | #include <iostream>
using namespace std;
int main()
{
//Array A and B must be of same size
int A[6]={1,4,6,9,5,12};
int B[6]={5,3,7,2,1,6};
int length_of_A=sizeof(A)/4;
int length_of_B=sizeof(B)/4;
int CommonArray[20]={};
int i,j,l=0;
//loop for matching all elements of A to all elements of B... | ALGO | 0.991896 | 3.720635 |
4d1a3d08-e4b7-4190-b655-1701772fddfe | kartikdev1211/DSA | Heap/code.cpp | #include<bits/stdc++.h>
using namespace std;
class heap{
public:
int arr[100];
int size=0;
heap(){
arr[0]=-1;
size=0;
}
void insert(int val){
size=size+1;
int index=size;
arr[index]=val;
while(index>1){
int parent=index/2;
i... | ALGO | 0.999925 | 3.87254 |
5089d269-d3c5-43ac-89b8-161a4d10717a | Shunaze-Sherwin/All-code | 122.cpp | #include <bits/stdc++.h>
using namespace std;
#define inf 1e18
#define ll long long
#define ld long double
#define ull unsigned ll
#define pa pair<int, int>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define endl "\n"
#define gcd __gcd
#define log __lg
#define upper upper_bound
#defi... | ALGO | 0.999903 | 3.902627 |
645c6113-d6fe-4773-9437-d2b216d92140 | matty9090/Facebook-message-analyser | FB.cpp | #include <fstream>
#include <string>
#include <iostream>
#include <map>
#include "picojson.h"
struct Message
{
std::string Person;
std::string Msg;
double Reactions;
double NumLaughing;
int Messages;
int Corn;
};
int main(int argc, char* argv[])
{
std::vector<std::string> rawfiles;
f... | DATA | 0.926352 | 5.243251 |
81278207-1edb-44b2-8106-483e13c0cf0d | gnahtcouq/cpp | Thuc Hanh Nhap Mon Cau Truc Du Lieu/ON THI CUOI KY/Stack/stack.cpp | #include<iostream>
using namespace std;
#define MAXSTACK 100
const int stop = -99;
struct Node {
int data;
Node* link;
};
typedef Node* Nodeptr;
struct Stack {
Nodeptr top;
};
void init_Stack(Stack& s);
int isEmpty(Stack s);
Nodeptr tao_Node(int x);
void push(Stack& s, int a);
int pop(Stack& s);
int top(Stack& ... | ALGO | 0.999688 | 3.868824 |
fd82ab7b-56e7-4cd9-818f-9cc746cc4cae | Dadagum/software_opt_tech | ex_1_6/timer.cpp | #include<sys/time.h>
#include<iostream>
#include"ex_1_6.h"
void print_insert_n_time(void (*func)(person*, int), int N, person *p) {
struct timeval start;
struct timeval end;
unsigned long diff;
// timer start
gettimeofday(&start, NULL);
// start inserting
func(p, N);
// timer end
ge... | ALGO | 0.958179 | 4.004011 |
e342f4c3-8e90-4fbd-88c7-ec8d11f13f59 | reverg/PS | boj/15829.cpp | #include <iostream>
#include <string>
#define r 31
#define M 1234567891
int main()
{
std::string input = "";
int dummy = 0;
std::cin >> dummy >> input;
unsigned long H = 0;
for (int i = 0; i < input.length(); i++)
{
unsigned long r_sq = 1;
for (int j = 0; j < i; j++)
... | ALGO | 0.999829 | 4.98842 |
3ca974b4-8f25-48a8-a792-1b66b8274805 | aaron-enright/programming-tests | LinkedLists/C-plus-plus/LinkedLists/LinkedList-ABC/LinkedList-ABC.cpp | #include <iostream>
#include "LinkedList-ABC.h"
class ReversedLinkedList : public AbstractLinkedList
{
public:
virtual void Insert(int value)
{
Node* newList = new Node(value);
newList->next = this->head;
head = newList;
}
virtual void Insert(int* value, int nvalues)
{
AbstractLinkedList::Insert(value, ... | ALGO | 0.959714 | 4.826399 |
79b89a66-34d1-43eb-9a95-8895bf3d588e | VladimirBalditsyn/PhoneBook | Trie_with_A-K.cpp | #include <vector>
#include <string>
#include <queue>
#include <memory>
#include <array>
constexpr char first_letter = '0';
constexpr size_t alphabet_size = 10;
class Aho_Korasick;
class Trie {
public:
Trie(const std::vector<std::pair<std::string_view, size_t>>& subpatterns);
std::vector<uint32_t> Aho_Korasick(co... | ALGO | 0.999744 | 5.658472 |
dc8b7a1b-cbde-485d-b52a-1de936af355d | ishandutta2007/codeforces | fataleagle/normal/459/D.cpp | #include <bits/stdc++.h>
using namespace std;
int N;
int A[1000000];
int B[1000000];
int L[1000000];
int R[1000000];
int seg[4000000];
void update(int idx, int begin, int end, int x, int v)
{
if(x<begin || end<x)
return;
if(begin==end)
seg[idx]+=v;
else
{
int mid=(begin+end)/2... | ALGO | 0.99997 | 4.15518 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.