uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
6999cd03-fdd8-46a5-9926-3417841419b7 | HarshKatore/C-C-_ALL_CODES | C++ Language/daistanceBetnTwopoints.cpp | #include<iostream>
#include<cmath>
using namespace std;
class point{
int x, y;
friend int dist(point,point);
public:
point(int a, int b){
x = a;
y = b;
}
void displayPoint(){
cout<<"The point is ("<<x<<", "<<y<<")"<<endl;
}
};
int dis... | ALGO | 0.988778 | 4.108483 |
7aecaad3-d96a-4604-bcb9-06bfff8dea6f | Amanzhol-1/ADS_KBTU | LAB 9/Esol.cpp |
#include <iostream>
#include <string>
#include <vector>
using namespace std;
vector<int> prefix(string p){
int m = p.size();
vector<int> pref(m);
int j = 0; // j - и длинна подстроки и индекс до длинны префикса
int i = 1;
while(i < m){
while(j > 0 && p[i] != p[j]){
j = pref[j ... | ALGO | 0.999873 | 4.516172 |
5c4f1a99-0392-4418-9c46-bdc6ed1a35f9 | Kamleshwar3010/CPP-Practise-Code | hcf.cpp | #include <iostream>
using namespace std;
int main()
{
int a, b, hcf;
cout<<"Enter first number"<<endl;
cin>>a;
cout<<"Enter second number"<<endl;
cin>>b;
for(int i=1; i <= a && i <= b; i++)
{
// Checks if i is factor of both integers
if(a%i==0 && b%i==0)
hcf = i... | ALGO | 0.998671 | 4.09819 |
e0302cd9-63c9-4916-a7a2-055862c30964 | ishandutta2007/codeforces | y25t/normal/1616/D.cpp | #include<bits/stdc++.h>
#define ll long long
#define N 50005
int T;
int n,a[N],x;
int main(){
scanf("%d",&T);
while(T--){
scanf("%d",&n);
for(int i=1;i<=n;i++)
scanf("%d",&a[i]);
scanf("%d",&x);
int f=0;
ll g=0;
bool h=0;
for(int i=1;i<=n;i++){
a[i]-=x;
if(!h||g+a[i]>=0)
f++,g=std::min(g... | ALGO | 0.999918 | 3.970722 |
beca9010-a1fb-4afa-95e7-a0098cf04411 | Rutvi-Malaviya/LeetCode | 250. Count Univalue Subtrees/code.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.999881 | 6.536713 |
00f1762c-ccc0-49d6-93fd-63cc7bdf902d | KaranGaur2112/dsa-cpp | maths/maths-compute-power-recursive.cpp | /*
given two numbers, x and n, find x raised to the power n: pow(x, n)
*/
/*
LOGIC:
power(x,n) = if(n%2 == 0){
power(x, n/2) * power(x, n/2)
}
else{
power(x, n - 1) * x
}
*/
#include <bits/stdc++.h>
using namespace std;
long int power(int x, int n){
if(n... | ALGO | 0.99989 | 5.457297 |
398d7011-7efa-4f59-9492-12c140dbc20a | hsr205/nyu-tandon-bridge-spring-2023 | All_Weeks/Week_7/C++_Programs/hr2600_hw7_q2.cpp | #include <iostream>
#include <vector>
#include <numeric>
using namespace std;
vector<int> analyzeDividors(int num, int &outCountDivs, int &outSumDivs)
{
vector<int> result;
for (int i = 1; i < num; i++)
{
if (num % i == 0)
{
result.push_back(i);
}
}
return re... | ALGO | 0.999518 | 5.419878 |
6ae57ac2-7168-4f29-88b8-64c0baaff556 | AdamSturge/quaternion-mesh-construction | shared/libigl/python/py_igl/embree/py_reorient_facets_raycast.cpp |
m.def("reorient_facets_raycast", []
(
const Eigen::MatrixXd& V,
const Eigen::MatrixXi& F,
int rays_total,
int rays_minimum,
bool facet_wise,
bool use_parity,
bool is_verbose,
Eigen::MatrixXi& I,
Eigen::MatrixXi& C
)
{
Eigen::VectorXi Iv;
Eigen::VectorXi Cv;
igl::embree::reorient_facets_raycast... | ALGO | 0.984886 | 6.8774 |
f61216bb-5a04-46c3-a684-e2cabea286f6 | fzlinshu/DPSolver | src/dpsolver/search/pbs.cpp | /* -*- mode: C++; c-basic-offset: 2; indent-tabs-mode: nil -*- */
#include <gecode/search/seq/pbs.hh>
namespace Gecode { namespace Search { namespace Seq {
Stop*
pbsstop(Stop* so) {
return new PortfolioStop(so);
}
Engine*
pbsengine(Engine** slaves, Stop** stops, unsigned int n_slaves,
cons... | TOOL | 0.985162 | 6.098817 |
bcede0cf-494a-49dc-b5c0-0bd51a7cfdf3 | AlexGliesch/competitive-programming | competitions/Regional 2007/J - Olimpiadas (WA).cpp | #include <queue>
#include <vector>
#include <ciso646>
#include <algorithm>
#include <iostream>
#include <limits>
using namespace std;
/*
* the idea: run edmonds-karp max flow, and store the size and max flow of
* all augmenting paths found. then simulate the persons arriving at Beijing
* at every iteration since... | ALGO | 0.99981 | 4.087492 |
672961e3-a375-4e09-9e7f-94354c2d0146 | behargintza/opencv | modules/dnn/src/layers/concat_layer.cpp | #include "../precomp.hpp"
#include "layers_common.hpp"
#include "../op_cuda.hpp"
#include "../op_halide.hpp"
#include "../op_inf_engine.hpp"
#include "../ie_ngraph.hpp"
#include "../op_vkcom.hpp"
#ifdef HAVE_OPENCL
#include "opencl_kernels_dnn.hpp"
#endif
#ifdef HAVE_CUDA
#include "../cuda4dnn/primitives/concat.hpp"
... | ALGO | 0.918029 | 7.129812 |
93238bc5-e2b6-4ca3-a8af-bff9c0007c43 | trams/ACM | 105_good.cpp | #include <iostream>
#include <vector>
#include <limits>
#include <stdio.h>
using namespace std;
typedef double number_type;
void build(const vector<number_type>& arr, vector<number_type>& segment_tree,
int vertex, int first, int last) {
if (first == last) {
segment_tree[vertex] = arr[first];
} else {
c... | ALGO | 0.99998 | 4.713859 |
f9adfe42-fc98-4452-b0f3-5011d8501d7b | huylaclac/latNguyenGiaHuy_K24B_D24TXCN01-N | ss16 bt9.cpp | #include<stdio.h>
void thempt(int *arr, int *n, int pos, int values){
for(int i=*n;i>pos;i--){
arr[i]=arr[i-1];
}
arr[pos]=values;
(*n)++;
}
void inmang(int *arr, int n){
for(int i=0;i<n;i++){
printf("%d ", arr[i]);
}
printf("\n");
}
int main() {
int arr[100]={1,6,3,9,2,3,7,4,5,6,};
int n=10;
int p... | ALGO | 0.999932 | 3.473324 |
4c68288d-0bc8-47d5-9c5a-a966c345e4fc | PriyanshuA1507/Leetcode-Solutions | 538-convert-bst-to-greater-tree/convert-bst-to-greater-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.999962 | 5.935965 |
32d3dff9-3a22-4321-a18d-9c85272aed3c | bvrstich/Hessian-v2DM-2D-Hub | Hessian.cpp | #include <iostream>
#include <cmath>
#include <fstream>
#include <vector>
using std::ostream;
using std::ofstream;
using std::ifstream;
using std::vector;
using std::cout;
using std::endl;
using std::ios;
#include "include.h"
/**
* standard constructor:
*/
Hessian::Hessian() : Matrix(TPTPM::gn() + 1) { }
/**
* c... | ALGO | 0.987328 | 4.058798 |
c11b553b-712d-43d4-9125-c49caeddefb3 | Yukishita26/kyopro_lib | cpp/lib.cpp |
#include <iostream>
#include <cassert>
using namespace std;
class UnionFindTree{
private:
int tree[10007];
int rank[10007];
public:
UnionFindTree(int N){
for(int i=0; i<=N; i++){
tree[i] = i;
rank[i] = 1;
}
}
int root(int a){
if (tree[a] == a)... | ALGO | 0.998223 | 4.297721 |
a4da06b0-4625-4c3c-9d21-a53669be6ea0 | nobinov/image_resizer_server | include/boost_1_75_0/libs/stl_interfaces/example/interoperability.cpp | #include <algorithm>
#include <array>
#include <numeric>
#include <cassert>
// This is a random access iterator templated on a value type. The ValueType
// template parameter allows us easily to define const and non-const iterators
// from the same template.
template<typename ValueType>
struct random_access_iterator... | TEST | 0.984185 | 6.977918 |
1fbe6367-7927-4724-90ff-447e2d0e9494 | LZUCSWang/opengauss-server | src/gausskernel/dbmind/db4ai/executor/gd/shuffle_cache.cpp | #include "db4ai/gd.h"
/*
* Shuffle using a limited cache is performed by caching and training batches
* in random order. During the first iteration the batches are processed
* sequentially in the same order as provided by the source relation or query.
* The cache tries to keep a snapshot of the whole data as long ... | ALGO | 0.938195 | 6.624455 |
27d10238-f008-4240-a84e-092f8c020b7a | daily-boj/arkc1009 | C++/p2028.cpp | #include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int main() {
int T, N;
cin >> T;
while(T--) {
cin >> N;
int powCnt=log10(N)+1;
if((N*N)%(int)(pow(10, powCnt))==N) cout << "YES";
else cout << "NO";
cout << "\n";
}
return 0;
}
| ALGO | 0.999096 | 5.092572 |
58407e63-ac20-4c2b-b614-8081952042b8 | Alaxe/noi2-ranking | 2018/solutions/E/NVM-Varna/beautiful.cpp | #include <iostream>
using namespace std;
int length(int num) {if (num <= 9) {return 1;} else if(num <= 99){return 2;} else if(num <= 999) {return 3;} else if(num <= 9999) {return 4;} else if(num <= 99999) {return 5;} else if(num <= 999999) {return 6;} else if(num <= 9999999) {return 7;} else if(num <= 99999999) {retu... | ALGO | 0.999896 | 3.792283 |
20d7aa59-4a31-4ff2-a1ab-70763a255c18 | smadhav2024/Data-Structures-lab | dsa repository/Lab 10/polycarp.cpp | #include <stdio.h>
#include <unordered_set>
using namespace std;
int min_removals(int n, int a[]) {
unordered_set<int> s;
int c = 0;
for (int i = n - 1; i >= 0; i--) {
if (s.count(a[i])) break;
s.insert(a[i]);
c++;
}
return n - c;
}
int main() {
int t, n;
scanf("%d", &... | ALGO | 0.999486 | 4.466717 |
ddf13dfb-71f0-4311-be7f-dc72bc4188bd | rajeevrj256/-CrackYourInternship | 424-longest-repeating-character-replacement/longest-repeating-character-replacement.cpp | class Solution {
public:
int characterReplacement(string s, int k) {
int i=0;
int j=0;
int maxcount=0;
int maxlen=0;
unordered_map<char,int>hash;
while(j<s.size()){;
hash[s[j]]++;
maxcount=max(maxcount,hash[s[j]]);
if((j-i+1)-maxcount>k){
... | ALGO | 0.999972 | 6.2812 |
cf459c37-31e7-4ead-90c6-05ca577af640 | LieGeee/task | niuke/课程/优先队列,并查集/合并果子.cpp | #include <bits/stdc++.h>
using namespace std;
priority_queue<int>a;
int x,ans;
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>x;
a.push(-x);
}
for(int i=0;i<n-1;i++){
int t1=a.top();
// cout<<t1<<' ';
a.pop();
int t2=a.top();
a.pop(... | ALGO | 0.999961 | 3.772155 |
e937484b-972e-47e5-bb23-6dd69b3dc6f2 | zhangchunbao515/leetcode | leetcode-04/solutions/cpp/0238.cpp | class Solution {
public:
vector<int> productExceptSelf(vector<int>& nums) {
const int n = nums.size();
vector<int> ans(n);
ans[0] = 1;
int r = 1;
for (int i = 1; i < n; i++) ans[i] = nums[i - 1] * ans[i - 1];
for (int i = n - 1; i >= 0; i--) {
ans[i] *= r;
r *= nums[i];
}
... | ALGO | 0.999982 | 6.901818 |
c5d3306d-70a2-4919-95b9-996a7b12ea3a | bm3719/practice | cpp/1_pell_seq.cpp | // -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// Populate a vector with Pell Series integers and print them out.
#include <vector>
#include <iostream>
#define TEST 0
using namespace std;
int main(int argc, char ** argv) {
int seq_size = 18;
vector<int> pell_seq(seq_size);
... | ALGO | 0.990347 | 4.793941 |
7061a927-cd1d-4775-bbe7-458374af8699 | itsminal/Strivers-A2Z-DSA | Check Armstrong.cpp | bool checkArmstrong(int n){
//Write your code here
if(n==1){
return true;
}
int temp,digits=0,temp2,sum=0;
temp=n;
temp2=n;
while(temp>0){
temp=temp/10;
digits++;
}
// digits=log10(n)+1;
while(temp2>0){
sum=pow((temp2%10),digits)+sum;
temp2=temp2/10;
}
if(sum==n){
return true;
}else{
return... | ALGO | 0.999961 | 5.38789 |
33c6715a-4ef1-4457-aea8-a4c986c695ef | rubberduckk/algorithm | 2023/20230310/20230310/boj_4673.cpp | //
// boj_4673.cpp
// 20230310
//
// Created by 김예은 on 2023/03/10.
//
#include <iostream>
#include <vector>
#include <string> // to_string
#include <algorithm> // find(int)
#define END 10000
using namespace std;
int getSelfNumber(int n)
{
int res = n;
string itoa = to_string(n);
// for s... | ALGO | 0.998539 | 5.314434 |
61355d91-f29f-453a-ad8e-753a474bf357 | LaxmanSingh07/DSA | DS/programming/c++_apna_college/Array/recurstion/first.cpp | #include<iostream>
#include<string>
using namespace std;
void reverse(string s ){
if(s.length()==0){
return ;
}
string ros = s.substr(1);
reverse(ros);
cout<<s[0];
}
int main(){
reverse("laxman");
return 0;
} | ALGO | 0.999762 | 3.049139 |
e2dc2636-9843-4f50-b161-37de55806a85 | BeretBenjamin/Parallel-Programming | Lab6-PDP/Lab6-PDP/HamiltonianCycle.cpp | #include "HamiltonianCycle.h"
#include <algorithm>
const int MAX_DEPTH = 5;
HamiltonianCycle::HamiltonianCycle(const std::vector<std::vector<int>>& graph, int startingNode,
std::atomic<bool>& foundHamiltonianCycle, std::vector<int>& output)
: graph(graph), startingNode(startingNode), foundHamiltonianCycle(foun... | ALGO | 0.99989 | 5.530022 |
4909134a-136c-457b-abae-46479dc6c2ca | ishandutta2007/codeforces | bigbag/normal/1305/D.cpp | #include <bits/stdc++.h>
using namespace std;
const int max_n = 1111, inf = 1000111222;
int n, used[max_n], sz[max_n];
vector<int> g[max_n];
int root;
int query(int a, int b) {
cout << "? " << a << " " << b << endl;
int res;
cin >> res;
return res;
}
void answer(int x) {
cout << "! " << x << en... | ALGO | 0.999918 | 4.134275 |
0cd378d7-f720-45a6-b675-687329583ffb | msssggg3-14/chess_AI | stockfish/src/nnue/nnue_misc.cpp | // Code for calculating NNUE evaluation function
#include "nnue_misc.h"
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <iomanip>
#include <iosfwd>
#include <iostream>
#include <sstream>
#include <string_view>
#include <tuple>
#include "../position.h"
#include "../types.h"
#include "../uci.h"
#includ... | ALGO | 0.996343 | 7.510572 |
40509dbb-b585-42bd-8bf9-11063c9f2c2a | morrischen890717/Leetcode | C++/139_sol1.cpp | class Solution {
public:
class Trie {
public:
bool isWord;
vector<Trie*> child;
Trie(){
isWord = false;
child = vector<Trie*> (26, NULL);
}
};
int solve(string& s, int id, vector<int>& dp, Trie *root){
if(id == s.length())
retur... | ALGO | 0.999778 | 5.914269 |
5f91cd4c-ab43-4d55-a84d-a5a46bba4707 | yoshiaki-ando/IGRF13_cpp | geomag70.cpp | /****************************************************************************/
/* */
/* NGDC's Geomagnetic Field Modeling software for the IGRF and WMM */
/* */
/***... | TOOL | 0.881394 | 6.570463 |
de361006-771a-4e18-8e98-393c89835958 | ishandutta2007/codeforces | redstar_13/normal/484/D.cpp | #include<bits/stdc++.h>
#define NN 1000001
using namespace std;
int a[NN];
long long dp[NN], ans;
inline bool linear(int u) {
if(a[u-1]>=a[u] && a[u]>=a[u+1]) return true;
return a[u-1]<=a[u] && a[u]<=a[u+1];
}
main() {
int n; scanf("%d", &n);
for(int i=1; i<=n; i++) scanf("%d", a+i);
for(int i=2; i<=n; i++)... | ALGO | 0.999804 | 3.744786 |
0dd924a9-06cc-4854-9b20-9419b123ee27 | ishandutta2007/codeforces | potassium/normal/1208/B.cpp | #pragma GCC optimize ("Ofast")
//#pragma comment(linker, "/stack:200000000")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
#define INF 2147483647
#define LLINF LLONG_MAX
#define PI ... | ALGO | 0.999984 | 4.355654 |
045f63d0-0ecc-4466-b809-4308f58b93c6 | omarosamahu/CPP | problem_solving/sum_remainder.cpp | #include <iostream>
#include <vector>
using vect = std::vector<int>;
vect getSumforTwoVectors(vect a,vect b){
vect c;
for (size_t i = 0; i < a.size(); i++)
{
if(a[i] + b[i] > 10){
c.push_back((a[i] + b[i]) / 10);
a[i+1] = a[i+1] + ((a[i] + b[i]) % 10);
}
... | ALGO | 0.999502 | 5.251908 |
a63b853a-6ba8-4a93-925a-0fe0c7222893 | mmozeiko/Squares3D-iPad | newton/physics/dgCollisionCylinder.cpp | #include "dgPhysicsStdafx.h"
#include "dgBody.h"
#include "dgContact.h"
#include "dgCollisionCylinder.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
dgInt32 dgCollisionCylinder::m_shapeRefCoun... | ALGO | 0.876206 | 6.658077 |
354f7bdc-b778-4c1a-b932-ae72aa04aac7 | FisherKKK/DSANN | apps/utils/compute_groundtruth.cpp | #include <string>
#include <iostream>
#include <fstream>
#include <cassert>
#include <vector>
#include <algorithm>
#include <cassert>
#include <cstddef>
#include <random>
#include <limits>
#include <cstring>
#include <queue>
#include <omp.h>
#include <mkl.h>
#include <boost/program_options.hpp>
#include <unordered_map... | DATA | 0.975651 | 3.608674 |
75595606-b7b1-46c5-8935-211a41537555 | zeromem88/data-structures | Solutions-Week4/PhoneBook/phone_book.cpp | #include <iostream>
#include <vector>
#include <string>
using std::string;
using std::vector;
using std::cin;
struct Query {
string type, name;
int number;
};
vector<Query> read_queries() {
int n;
cin >> n;
vector<Query> queries(n);
for (int i = 0; i < n; ++i) {
cin >> queries[i].type... | ALGO | 0.998878 | 5.195509 |
a30d70aa-f2a7-415b-9972-607b58734977 | SudhanshuYadav-Dev/Day1--Array-Questions | 29. Rotate The Array.cpp | #include<iostream>
#include<vector>
using namespace std;
void RotateArray(vector<int>arr,int k){
vector<int>temp(arr.size());
for(int i=0; i<arr.size(); i++){
temp[(i+k)%arr.size()]=arr[i];
}
//Copy temp array in original Array
for(int i=0; i<arr.size(); i++){
cout<<arr[i]<<" ";
}cout<<endl;
}
int main(){
... | ALGO | 0.999799 | 4.566912 |
4ea7bd95-3cc3-47ef-9924-708cf65cd4c3 | hajeongyeon/Algorithm | DFS&BFS/boj16236.cpp | // ǥ Ÿ
// Ÿ ª
// Ÿ y
// y ٸ x
#include <iostream>
#include <queue>
#include <cstring>
using namespace std;
// ü
struct shark {
int x, y; // ǥ
int dist; // Ÿ
bool operator < (const shark &s) const
{
if (dist == s.dist)
{
if (y == s.y)
{
return x > s.x;
}
else
{
return y > s.y... | ALGO | 0.999974 | 3.480366 |
d094afb5-2178-4939-b761-d39f6d55e737 | Uthmman/gymsystem | 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.998784 | 6.761023 |
d2781011-091e-486f-a512-77075a98c153 | arjav1528/CP | LeetCode/237.delete-node-in-a-linked-list.cpp | /*
* @lc app=leetcode id=237 lang=cpp
*
* [237] Delete Node in a Linked List
*
* https://leetcode.com/problems/delete-node-in-a-linked-list/description/
*
* algorithms
* Medium (81.09%)
* Likes: 5317
* Dislikes: 1625
* Total Accepted: 1.6M
* Total Submissions: 1.9M
* Testcase Example: '[4,5,1,9]\n5'... | ALGO | 0.999925 | 6.881997 |
0dd6ab33-f343-468b-bb53-a8f839420277 | Kishore7298/CodeFights | Arrays/4.sudoku/sudoku2.cpp | /*
*Sudoku is a number-placement puzzle. The objective is to fill a 9 × 9 grid with numbers in such a way that each column, each row, and each of the nine 3 × 3 sub-grids that compose the grid all contain all of the numbers from 1 to 9 one time.
*Implement an algorithm that will check whether the given grid of numbers ... | ALGO | 0.999073 | 6.551475 |
733858d0-93be-47ba-af92-6fb4c6455c16 | Jyf624761709/Luogu | AC/P1454.cpp | #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;
#define in(t) freopen("t.in","r",stdin)
#define out(t) freopen("t.out","w",stdout)
#define m(a) memset(a,0,sizeof(a))
typedef long long ll;
char a[105][105];
int n,m,ans=0;
void dfs(int... | ALGO | 0.999874 | 3.747591 |
a6a356c6-eaae-4a70-8976-bf5c8f9c8bd2 | architjindalcs/Leetcode-Solutions | Circular tour - GFG/circular-tour.cpp | // { Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
struct petrolPump
{
int petrol;
int distance;
};
// } Driver Code Ends
/*
The structure of petrolPump is
struct petrolPump
{
int petrol;
int distance;
};*/
/*You are required to complete this method*/
class Solution{
public:
... | ALGO | 0.999728 | 5.434423 |
4e6bca48-5380-4c71-817f-8a8492a515e4 | Dimamaman/Flutter-Max-Way | 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.998784 | 6.761023 |
b13028ce-4f36-4c35-ae9f-859c838180fb | ArjobanSingh/usaco-guide | bronze/simulation/mixing_milk.cpp | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
#define dbg(v) \
cout << "Line(" << __LINE__ << ") -> " << #v << " = " << (v) << endl;
const int N = 3; // The number of buckets (which is 3)
const int TURN_NUM = 100;
int main(... | ALGO | 0.999969 | 3.623487 |
614cbe2d-b864-4853-8874-6d9d65853337 | lee-honey/CodingTest-Study | 06주차/예산/hyunhee.cpp | #include <iostream>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int solution(vector<int> d, int budget) {
int answer = 0;
int hap = 0;
sort(d.begin(), d.end());
for (int i = 0; i < d.size(); i++)
{
hap += d[i];
if(hap > budget)
... | ALGO | 0.999855 | 4.883047 |
0fe392f1-cae6-48ef-ad6c-8f22c7eedcf1 | liuxuanhai/Window_entry_to_the_master | 第8章(密码学算法)/大整数库Miracl/source/ECSGEN2.CPP | #include <iostream>
#include <fstream>
#include <ec2.h>
using namespace std;
Miracl precision=20;
int main()
{
ifstream common("common2.ecs"); /* construct file I/O streams */
ofstream public_key("public.ecs");
ofstream private_key("private.ecs");
int ep,m,a,b,c;
EC2 G,W;
Big a2,a6,q,x,y,d... | ALGO | 0.995862 | 3.010599 |
342d77c9-c6b7-4653-9875-e8c3a79ee75e | SYSU-HILAB/Mobile-Robot-Planning-Assignment-and-control | src/quadrotor_simulator/so3_quadrotor_simulator/include/ode/libs/numeric/odeint/examples/harmonic_oscillator.cpp | #include <iostream>
#include <vector>
#include <boost/numeric/odeint.hpp>
//[ rhs_function
/* The type of container used to hold the state vector */
typedef std::vector< double > state_type;
const double gam = 0.15;
/* The rhs of x' = f(x) */
void harmonic_oscillator( const state_type &x , state_type &dxdt , const ... | ALGO | 0.999402 | 7.292909 |
70d73996-fbd4-43d8-b5b4-c1343dd856df | skygragon/Q.solution | leetcode/066.plus-one.cpp | /*
* [66] Plus One
*
* https://leetcode.com/problems/plus-one
*
* Easy (37.40%)
* Total Accepted: 152920
* Total Submissions: 408892
* Testcase Example: '[0]'
*
* Given a non-negative integer represented as a non-empty array of digits,
* plus one to the integer.
*
* You may assume the integer do not c... | ALGO | 0.999892 | 6.834008 |
a6ed52dd-753b-4a55-be4b-285416722d0d | NaimSS/ICPC-Summer-2025 | mictorio/naim.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll modpow(ll x,ll e,ll m){
ll ans = 1;
for(; e ; e >>= 1, x = (x * x) % m){
if(e & 1) ans = (ans * x) % m;
}
return ans;
}
const int N = 100100;
const int M = 1e9 + 7;
ll fat[N], inv[N];
void init(){
fat[0] = 1;
for(i... | ALGO | 0.999965 | 4.931267 |
bd8c0799-8f39-4144-a274-23c08a802660 | cowkjw/Algorithm | 프로그래머스/unrated/181829. 이차원 배열 대각선 순회하기/이차원 배열 대각선 순회하기.cpp | #include <string>
#include <vector>
using namespace std;
int solution(vector<vector<int>> board, int k) {
int answer = 0;
for(int i = 0;i<board.size();i++)
{
for(int j = 0;j<board[0].size();j++)
{
if(i+j<=k)
{
answer+=board[i][j];
}... | ALGO | 0.999616 | 5.337212 |
d3cccd4d-4129-4ec9-9a89-f678bbd53220 | neote250/GAT350 | RayTracer/Source/Material.cpp | #include "Material.h"
#include "Random.h"
bool Lambertian::Scatter(const ray_t& ray, const raycastHit_t& raycastHit, color3_t& attenuation, ray_t& scatter) const
{
scatter.origin = raycastHit.point;
scatter.direction = raycastHit.normal + randomOnUnitSphere();
attenuation = m_albedo;
return true;
}
... | ALGO | 0.876411 | 4.875171 |
380a06f0-5aed-41a1-85a3-16a0b451eef1 | krgss/Online_Review_Rating_Analysis | LDAs/MedLDA/MEDsLDA/main.cpp | // This file is part of MedLDA for regression.
#include "stdafx.h"
#include "windows.h"
#include "io.h"
#include <time.h>
#include "MedLDAReg.h"
#include <vector>
#include <string>
using namespace std;
int main(int argc, char* argv[])
{
//long t1;
//(void) time(&t1);
seedMT( time(NULL) );
// seedMT(4357U);
if ... | DATA | 0.974684 | 3.371145 |
10962651-b184-4d4a-ab6a-78340573f0e7 | lukasp-dev/DSA | LeetCode/0202-happy-number/0202-happy-number.cpp | class Solution {
public:
bool isHappy(int n) {
unordered_set<int> set;
bool flag = true;
int global_num = n;
while(flag){
string number = to_string(global_num);
int sum = 0;
for(int i=0; i<number.size(); i++){
int operand = number[... | ALGO | 0.999978 | 6.37495 |
7fca4a39-1942-483d-a6a9-13825ba1b3f0 | SantiagoRoa/Ciencias-Computacion-1 | Colas/main.cpp | #include <cstdlib>
#include <iostream>
#include <ctype.h>
#include <iomanip>
#include "pila.h"
#include "cola.h"
#include <locale.h>
using namespace std;
int main(int argc, char *argv[])
{
setlocale(LC_CTYPE, "Spanish");
cola Cola;
pila Pila[3];
int i, j, tam, grupo = 0, orden[3];
char x;
do {
cout << "Escri... | ALGO | 0.995938 | 3.452506 |
565e6d4e-a763-4c1f-81f7-8c5636b987ad | minhnhatnoe/Public-Templates | src/Matrix-Multiplication.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/// @brief Mutiplies two matrices
/// @param a First factor
/// @param b Second factor
/// @return The product of two matrices
vector<vector<ll>> operator*(const vector<vector<ll>> &a, const vector<vector<ll>> &b){
vector<vector<ll>> x(a.size(), v... | ALGO | 0.999053 | 4.655968 |
1de8fe7f-31d7-4521-a80f-91bec559964f | smsh0722/PS | problems/11437_2.cpp | /* NOTE: RMQ-based LCA
Level + SegTree
*/
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
const int INT_INF = ~(1<<31);
struct SegTree{
size_t N;
struct Node{
int level;
int nodeNum;
};
vector<Node> arr;
};
// num of nodes
int N;
// num of queries
int M;
... | ALGO | 0.999979 | 5.086491 |
e6cbbeb9-daa7-4402-8228-ab3898aebc0c | abdimk/C-Cpp-Java-ASM | Cpp Examples/pass_by_reference.cpp | #include <iostream>
using namespace std;
void swap(int &a, int &b);
int main(){
int a {12};
int b {24};
cout << a << " "<< b <<endl;
swap(a,b);
cout << a <<" "<< b <<endl;
}
void swap(int &a, int &b){
int temp {};
temp = a;
a = b;
b = temp;
}
| ALGO | 0.989954 | 4.165503 |
7373e8e1-5962-4b3d-944d-acfb875b76b4 | Haar-you/kyopro-lib | Mylib/Algorithm/golden_section_search_upwards.cpp | #pragma once
#include <cmath>
#include <functional>
namespace haar_lib {
template <typename T = double, typename Func = std::function<T(T)>>
T golden_section_search_upwards(T lb, T ub, const Func &f, int LOOP_COUNT = 100) {
static const T phi = (1.0 + std::sqrt(5)) / 2;
T t1 = 0, t2 = 0;
while (LOOP_... | ALGO | 0.999992 | 5.849038 |
c92e692c-66c8-47cd-b586-e2a9b6965430 | niveditabiswas112006/C-Programming | Assignment-18.cpp | // 18. W.A.P a program to calculate to check if a number is positive, negative and zero.
#include <iostream>
using namespace std;
int main(){
int a;
cout<<"Enter the number to check: ";
cin>>a;
if (a > 0){
cout<<"The number you've entered is positive ";
}
else if (a < 0){
cout<<"... | ALGO | 0.989717 | 3.013641 |
fe4a89ab-94d7-43f4-a56d-7cb085055f8d | valbuenaster/hackerEarthCodes | SevenSegmentDisplay.cpp | #include <iostream>
#include <math.h>
#include <vector>
#define NLIM 10000
#define BLANKCHAR '@'
int N_matches[] = {6,2,5,5,4,5,6,3,7,6};
using namespace std;
void printString(char * p)
{
for(int ii = 0; ii<NLIM; ii++)
{
//if(p[ii]!=BLANKCHAR)
cout << p[ii];
}
cout <<endl;
}
void c... | ALGO | 0.999372 | 3.987165 |
bd1e5bfc-ea70-4bb4-89dd-cbfe394d39b9 | SaharRostaei/TwoViewReconstruction | src/TwoViewReconstruction.cpp | /*///////////////////////////////////////////////////////////////////////////////////////
//
// This is the implementation for TwoViewReconstruction class
// author: Sahar Rostaei, <EMAIL>
// TwoViewReconstruction.cpp
// Jan 2024
//
/*/////////////////////////////////////////////////////////////////////////////////... | ALGO | 0.991933 | 6.130694 |
e4e4f89d-eb8b-419b-a350-e9cc9cedecd3 | svetlanasieber/Programming-Basics-with-Cpp | 03_time_plus_15_minutes.cpp | #include <iostream>
#include <math.h>
using namespace std;
int main() {
int hours, minutes;
cin >> hours >> minutes;
int total_minutes = hours * 60 + minutes + 15;
int final_hours = total_minutes / 60;
int final_minutes = total_minutes % 60;
if (final_hours == 24) {
final_hours = 0;
}
if (fina... | ALGO | 0.991873 | 6.14001 |
bdb15473-2342-4c07-9c98-b12a23d09b40 | ishandutta2007/codeforces | burnedchicken/normal/1071/B.cpp | #include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("unroll-loops")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,avx,avx2,tune=native")
//#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(... | ALGO | 0.999989 | 3.624431 |
714c5a02-fd24-4573-8e7c-04e196370800 | ishandutta2007/codeforces | karry5307/normal/1304/E.cpp | // This code is written by Karry5307
#include<bits/stdc++.h>
// Definition
#define For(i,x,y) for(register int i=(x);i<(y);i++)
#define Forr(i,x,y) for(register int i=(x);i<=(y);i++)
#define Rep(i,x,y) for(register int i=(x);i>(y);i--)
#define Repp(i,x,y) for(register int i=(x);i>=(y);i--)
#define ve vector
#define ite... | ALGO | 0.999987 | 4.249427 |
a09c6695-c6cd-41ff-b421-ae0ec3f7c240 | EmptyDust/Algorithm-Codes-and-writeups | codes/-0x30_competition/-0x36_nowcoder/2025summercamp_2/L.cpp | #include <bits/stdc++.h>
#define ranges std::ranges
#define views std::views
using u32 = unsigned;
using i64 = long long;
using u64 = unsigned long long;
using u128 = unsigned __int128;
using a2 = std::array<int, 2>;
using a3 = std::array<i64, 3>;
using a4 = std::array<int, 4>;
const int N = 1e6;
const int MAXN = 1... | ALGO | 0.999518 | 5.382607 |
32f27410-4668-4545-85cc-3ee7a693a240 | Souravirus/codeforces | r424/probb.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
string A, B, C;
int arr[26];
cin>>A>>B>>C;
string :: iterator its1;
string :: iterator its2;
for(its1=A.begin(), its2=B.begin(); its1!=A.end() ; its1++, its2++)
{
int num=*its1;
//cout<<*its1<<" "<<num<<endl;
int num2=*its2;
num=num-97;
arr[num]... | ALGO | 0.999991 | 4.005479 |
8cee7ecb-3937-4d22-bfbb-e5e682c94c0b | RakibLiar/LeetCode | 1155-number-of-dice-rolls-with-target-sum/1155-number-of-dice-rolls-with-target-sum.cpp | class Solution {
public:
int MOD = 1000000007;
int calculate(vector<vector<int>> &dp, int k, int tar, int n, int ind, int sum) {
if(ind == n && sum == tar) return 1;
if(ind >= n || sum >= tar) return 0;
if(dp[ind][sum] != -1) return dp[ind][sum];
int a = 0;
for(int i... | ALGO | 0.999996 | 5.858816 |
8b8cbd03-b850-4983-9cfb-6596e81ebec3 | Vedant285/LeetCode | 1112-find-words-that-can-be-formed-by-characters/find-words-that-can-be-formed-by-characters.cpp | class Solution {
public:
int countCharacters(vector<string>& words, string chars) {
int ans=0;
vector<int>c(26,0);
for(auto it:chars){
c[it-'a']++;
}
for(auto it:words){
vector<int>v(26,0);
for(auto s:it){
v[s-'a']++;
... | ALGO | 0.999939 | 6.030128 |
a21661dc-8087-4b91-ae9e-a8323f422f33 | Akalich/test-pro34- | TaskOne.cpp | #include <iostream>
using namespace std;
int main()
{
for (int i = 1; i <= 100; ++i)
{
if (i % 3 == 0 && i % 5 == 0)
{
cout << "FizzBuzz" << endl;
}
else if (i % 3 == 0)
{
cout << "Fizz" << endl;
}
else if (i % 5 == 0)
{
... | ALGO | 0.999688 | 5.220699 |
283d21b9-3153-4e79-8b78-d92e523a1a57 | kkorona/BOJ_Rche | 1937/main.cpp | #include <iostream>
#include <vector>
using namespace std;
vector < vector < int > > T;
vector < vector < int > > Map;
int N;
const int dy[4] = {-1,1,0,0}, dx[4] = {0,0,-1,1};
bool bchk(int lo,int tar,int hi) {
return lo <= tar && tar < hi;
}
int dfs(int y,int x) {
int &ret = T[y][x];
if(ret == 0) {
... | ALGO | 0.999753 | 4.472783 |
2a5260d6-bde5-4e3c-bbfd-a1cdb776c277 | kmjp/procon | codeforce/701-750/703/e2.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define ... | ALGO | 0.999616 | 3.572397 |
cf240855-05e3-4d79-9deb-2168829cbb8b | mohsinenur/URIOnlineJudge | Even_Square.cpp | #include<iostream>
using namespace std;
main()
{
int N, i;
cin >> N;
for (i = 1; i <= N; i++)
{
if ((i%2) == 0)
{
cout << i << "^" << 2 << " = " << i*i << endl;
}
}
return 0;
}
| ALGO | 0.998558 | 3.765648 |
37c08b0d-30e1-43c3-907b-31031c2dd3e0 | TaRun1369/RandomDSA | 908-middle-of-the-linked-list/middle-of-the-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* middleNode(... | ALGO | 0.9999 | 5.772513 |
6e97da81-576b-48b5-8d74-444283dc1afd | jacob-moore22/CI-PIVOT | examples/MPI/Example2/solutions/SendRecv3.cpp | #include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
MPI_Init(&argc, &argv);
int count = 10;
double xsend[count], xrecv[count];
for (int i=0; i<count; i++){
xsend[i] = (double)i;
}
// Get the rank and number of processes
int rank, nprocs;
M... | ALGO | 0.999262 | 5.396195 |
889378d3-52b8-4d24-a255-b11764eb1885 | andriyukr/ros_optitrack | aruco_ros/aruco/src/aruco/cameraparameters.cpp | #include <aruco/cameraparameters.h>
#include <fstream>
#include <iostream>
#include <opencv/cv.h>
using namespace std;
namespace aruco
{
CameraParameters::CameraParameters() {
CameraMatrix=cv::Mat();
Distorsion=cv::Mat();
CamSize=cv::Size(-1,-1);
}
/**Creates the object from the info passed
* @param camer... | TOOL | 0.852861 | 5.758962 |
8970990a-7cb8-410f-a261-5368f3fe4e66 | MLops34/DSA-Preparation | Revision/LinkedList/DetectLoop.cpp | #include <iostream>
#include <algorithm>
using namespace std;
class Node{
public:
int data;
Node * next;
Node(int data1){
int data=data1;
Node * next=nullptr;
}
Node (int data1 , Node *link){
int data=data1;
next=link;
}
};
class solution{
public:
bo... | ALGO | 0.999831 | 3.697737 |
c107e2db-7b53-4f38-9d6a-9bc50dec528d | EliyaKaheni/FamilyTree | family_ds.cpp | #include <bits/stdc++.h>
// Library effective with Windows
// #include <windows.h>
// Library effective with Linux
#include <unistd.h>
using namespace std;
// Functions & Structures
struct Person;
void print(Person &p);
int family_size(vector<Person> family);
void died(vector<Person> &family, string p);
int find(v... | TOOL | 0.862095 | 3.302998 |
bba45fd2-813b-4557-bdf7-a4b18c468b96 | stalin670/CSES-PROBLEM-SET | DP-Section/1-Dice_Combinations.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
void solve() {
ll n;
cin >> n;
ll mod = 1e9 + 7;
vector<ll> dp(n + 1, 0);
dp[0] = 1;
for(ll i = 1; i <= n; i++) {
for(ll j = 1; j <= 6; j++) {
if(i - j >= 0) {
dp[i] = dp[i] + dp[i - j];
dp[i] = dp[i] % mod;
}
}
}
cout << ... | ALGO | 0.999983 | 5.012792 |
8a1fa443-c8c8-411e-a49f-d6db60712c37 | foriequal0/homework-18-automata | hw1/dfa.cpp | #include <algorithm>
#include "dfa.hpp"
DFA::DFA(state_type initial, std::vector<alphabet_type> alphabets)
: alphabets(alphabets),
initial_state(initial)
{ }
/* Write DFA into stream */
void DFA::write(std::ostream & os) const {
os << states.size() << std::endl;
for(auto state: states) {
os << state;
... | ALGO | 0.973003 | 5.845145 |
dcbf4769-205f-4ceb-bd56-f99fd4f165c5 | Puellaquae/Algorithms | Search/BinarySearch/hdu3400.cpp | //Line belt
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <iostream>
using namespace std;
const double EPS = 1e-7;
struct Point {
double x, y;
Point(){};
Point(double a, double b) { x = a, y = b; }
};
Point A, B, C, D;
double P, Q, R;
double Distance(Point a, Point b) {
return sqrt((a... | ALGO | 0.999867 | 4.209661 |
8414cb64-c626-411e-af65-92583918118d | korli/haiku-jarek | src/tests/add-ons/kernel/file_systems/consistency_check/generate_hashs.cpp | #include <algorithm>
#include <string>
#include <vector>
#include <dirent.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <OS.h>
#include <Path.h>
#include <SHA256.h>
#include "AdaptiveBuffering.h"
//#define TRACE(x...) printf(x)
#define TRACE(x...) ;
... | TOOL | 0.87442 | 5.740262 |
7a835068-da5a-4fab-a221-53a8d21a47fa | AdsonFS/beecrowd-codes | codes/1926.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(S) (S).begin(), (S).end()
#define INF 0x3f3f3f3f
#define pb push_back
#define mk make_pair
#define MAX 1000005
#define S second
#define F first
typedef long long ll;
typedef pair<int, int> ii;
typedef pair<int, ii> pii;
map<int, int> mapa;
bool primo[MAX];
in... | ALGO | 0.999903 | 3.920796 |
2695d379-34f6-47d3-b9af-f91c20f0f378 | Mohamed-Amiir/Leet-code | 2021-remove-all-occurrences-of-a-substring/2021-remove-all-occurrences-of-a-substring.cpp | class Solution {
public:
string removeOccurrences(string s, string part) {
size_t pos = s.find(part); // Find the first occurrence
while (pos != string::npos) {
s.erase(pos, part.size()); // Remove the substring
pos = s.find(part); // Search again
}
return s;
}
}; | ALGO | 0.997825 | 6.252739 |
f8e54132-58b3-434a-a505-7efa1fa9c40d | WTlumos/PAT-A | 1044/1044.9.5.cpp | #include<cstdio>
#include<vector>
using namespace std;
vector<int> ans;
int num[1010]={};
int n,m;
void getsum(int i,int &sum,int &j){
int left=i;
int right=n;
while(left<right){
int mid=(left+right)/2;
if (num[mid]-num[i-1]>=m)
{
right=mid;
}else{
left=mid+1;
}
}
sum=num[right]-num[i-1];
j=right;... | ALGO | 0.999987 | 3.374579 |
441aca64-66d0-450d-bfbe-d4fea712bdab | pavankumar4404/Competitive_Programming | D_Come_a_Little_Closer.cpp | #include <bits/stdc++.h>
using namespace std;
// Speed
#define fastio() ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
// Macros
typedef long long ll;
#define for0(i,n) for(int i=0;i<n;i++)
#define for1(i,n) for(int i=1;i<=n;i++)
#define rfor(i,j) for(int i=j-1;i>=0;i--)
#define all(x) x.begin... | ALGO | 0.999953 | 5.447714 |
c1945d58-51c6-474c-be5b-f30835afabb0 | rdavis023/StackPop | main.cpp | #include <iostream>
#include <climits>
using namespace std;
class Node {
public:
int value;
Node* next;
Node(int value) {
this->value = value;
next = nullptr;
}
};
class Stack {
private:
Node* top;
int height;
public:
Stac... | ALGO | 0.986651 | 5.205803 |
7a618e0c-f912-4f9b-bfee-dd3778af87fd | rohanjass/DSA_LeetCode | 1250-longest-common-subsequence/longest-common-subsequence.cpp | class Solution {
public:
int longestCommonSubsequence(string text1, string text2) {
int m=text1.size();
int n=text2.size();
vector<vector<int>>dp(m+1,vector<int>(n+1,0));
for(int i=1;i<=m;i++){
for(int j=1;j<=n;j++){
if(text1[i-1]==text2[j-1]) dp[i][j]=1+d... | ALGO | 0.999936 | 6.469171 |
e6ee65f4-7f36-459d-b55c-ffeaa24d4923 | badochov-studies/computer-science-studies | BSc/2/algorithms-and-data-structures/lex/main.cpp | #include <bits/stdc++.h>
#define FOR_HELPER(start, end, var_name) for(auto var_name = start; var_name < end; var_name++)
#define FOR_HELPER_1(start, end) FOR_HELPER(start, end, i)
#define FOR_CHOOSER(x, start, end, increment, FOR_MACRO, ...) FOR_MACRO
#define FOR(...) FOR_CHOOSER(,##__VA_ARGS__, FOR_HELPER(__VA_ARGS_... | ALGO | 0.999998 | 5.221406 |
c2b69203-4816-4ee8-b2d9-5cc76723e973 | shikhar-dev/CodeX | LeetCode/minimum-path-sum.cpp | // Problem URL: https://leetcode.com/problems/minimum-path-sum/
class Solution {
public:
int minPathSum(vector<vector<int>>& grid) {
int n = grid.size(), m = grid[0].size(),i,j;
for (i=0; i < n; i++)
for (j = 0;j < m;j++)
if (!(i == 0 and j == 0)) {
in... | ALGO | 0.999951 | 5.907974 |
9e00417c-5083-4d42-839b-cb594d3ff4b3 | khan3575/Practice-Codes | LightOJ/problemba.cpp | #include<bits/stdc++.h>
using namespace std;
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define ll long long
const int mod = 1e9+7;
int main()
{
fastIO;
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int arr[n];
int mx=0;
int mxLoc=-1;
for(int i=0; i<n;i++)
{
cin>>arr[i];
if(... | ALGO | 0.9999 | 4.65258 |
1cbc761e-1647-4385-af9d-e5e86914d046 | eziokittu/KIIT_Laptop_C_Cpp_Codings | TrialAndPractice/Practice/DynamicProgramming/MinCoins_OptimalSolution.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
// Problem statement -
// We have a set of coins of values say - 5,4,1
// Now we have to find the minimum no. of coins to achieve a target value, say 13
// The greedy approach will have the solution as --> 5+5+1+1+1 --> 5 coins
// Bu... | ALGO | 0.999991 | 6.344333 |
e6bb831d-27ae-4567-9fab-38a0fb9015f3 | lakshmanaram/Competitive-programming | hackercup/2018/qualification round/interception.cpp | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define mp make_pair
#define vll vector<long long>
#define all(S) S.begin(), S.end()
#define S(a) scanf("%lld", &a)
using namespace std;
int main(){
ifstream infile;
ofstream outfile;
infile.open("interception.txt");
outfile.open("output.t... | ALGO | 0.995204 | 3.01282 |
3293b78a-bad2-4db4-bbfc-fb7de01a2948 | ishandutta2007/codeforces | fuyuki/normal/1257/E.cpp | #include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;
#define rnt re int
#define re register
#define I inline int
#define V inline void
#define isnum(ch) ('0'<=ch&&ch<='9')
#define FOR(i,a,b) for(rnt i=a;i<=b;i++)
#define ROF(i,a,b) for(rnt i=a;i>=b;i--)
#define gc (_op==_ed&&(_ed=(_op=_buf)+frea... | ALGO | 0.999983 | 3.377486 |
7244498a-f77b-4dc8-b049-0c7f0581ab3d | Shivam256/leetcode | easy/validPalindrome.cpp | // #include <bits/stdc++.h>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
#include <queue>
#include <deque>
#include <bitset>
#include <iterator>
#include <list>
#include <stack>
#include <map>
#include <set>
#include <functional>
#include <numeric>
#include <utility>
#... | ALGO | 0.999888 | 3.894104 |
18560062-31f7-4727-a2e3-cbf7a91b980f | SergeiSMV/compass_bms | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
fca3c9d4-0f7a-43f4-a1c6-48b65d1259f3 | javics2002/MotorEngine | Dependencies/Bullet/Src/Extras/ConvexDecomposition/ConvexBuilder.cpp | #include "float_math.h"
#include "ConvexBuilder.h"
#include "meshvolume.h"
#include "bestfit.h"
#include <assert.h>
#include "cd_hull.h"
#include "fitsphere.h"
#include "bestfitobb.h"
unsigned int MAXDEPTH = 8;
float CONCAVE_PERCENT = 1.0f;
float MERGE_PERCENT = 2.0f;
CHull::CHull(const ConvexDecomposition::ConvexRe... | ALGO | 0.994971 | 6.406917 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.