uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
0ee8fe97-bc92-4556-916e-b059a3094ae5 | alexandraback/datacollection | solutions_5639104758808576_0/C++/Rongqi/prob_a.cpp | #include <iostream>
#include <string>
using namespace std;
int testcases;
int n;
int main() {
cin >> testcases;
for (int testcase = 0; testcase < testcases; testcase ++) {
char ch;
string ss;
cin >> n >> ss;
int s = 0;
int o = 0;
for (int i = 0; i <= n; i ++) {
ch = ss[i];
int num = (int) (ch - '0... | ALGO | 0.999074 | 3.982129 |
630f3c22-32a8-4a72-9ac1-7c08ee8fc810 | ishandutta2007/codeforces | crtsir/normal/1215/A.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int a1,a2,b1,b2,n;
cin>>a1>>a2>>b1>>b2>>n;
if(b1>b2)swap(a1,a2),swap(b1,b2);
n=min(n,a1*b1+a2*b2);
cout<<max(0,(n-a1*(b1-1)-a2*(b2-1)))<<' ';
if(a1*b1>=n)
cout<<n/b1;
else
cout<<a1+(n-a1*b1)/b2;
} | ALGO | 0.999809 | 3.459778 |
f56795ea-9a04-43c3-98e0-5aabec05f444 | nmamro/SPBU_Homework_Sem1 | Lab10/Homework/Homework/Graph.cpp | #include "Graph.hpp"
#include "ReadFromFile.hpp"
using namespace std;
struct Node
{
int city;
vector<Node*> neighbours;
bool isVisited = false;
};
Node *createNode(int city)
{
return new Node{city};
}
void refreshIsVisited(Node *node)
{
node->isVisited = false;
for (unsigned int i = 0; i < node->neighbours.s... | ALGO | 0.99973 | 5.324564 |
64335079-48a5-484f-a935-8b4084c169e2 | csl-iisc/SUV-MICRO24 | llvm/libcxx/test/libcxx/fuzzing/stable_sort.pass.cpp | // UNSUPPORTED: c++03, c++11
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <vector>
#include "fuzz.h"
extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) {
std::vector<ByteWithPayload> input;
for (std::size_t i = 0; i < size; ++i)
input.push_back(By... | TEST | 0.989335 | 5.98301 |
6e486516-369d-46ff-9a8e-94238d428364 | pmkenned/early_coding | C++_2006/Prime/Prime.cpp | #include <iostream.h>
#include <math.h>
unsigned long int x = 1;
int main()
{
for(unsigned long int i = 0; x < pow(2, (sizeof(long int)*8)); i++)
{
x+=2;
for (unsigned long int j = 2; j <= (float) x/2; j++)
{
if (!(x%j))
{
x+=2;
continue;
}
}
cout << x << endl;
}
return 0;
} | ALGO | 0.996935 | 3.493168 |
44d56dc8-8bb7-45e0-894f-63036b1c621a | ShiveshNandan/dda | DAA_practicals/Topologycal_Sort_by_list.cpp | #include<bits/stdc++.h>
#include "graph.cpp"
using namespace std;
void toposort( G<int> graph , vector<int>& arr , int N ){
vector<vector<int>> adj_list(N);
// creating the adgcentcy list
for(int i =0;i<graph.adj.size() ; i++){
list < G<int> ::node* > :: iterator it = graph.adj[i].begin();
... | ALGO | 0.999982 | 4.776445 |
6434f2be-c78b-4aea-89ca-c4e3ebe564ed | sajidifti/CSE207_Data_Structure | Binary_Search_Tree/longPath.cpp | #include <stdio.h>
#include <stdlib.h>
int h = 0;
int last = -1;
struct node
{
int data;
struct node *left;
struct node *right;
};
struct node *Insert(struct node *root, int data)
{
if (root == NULL)
{
struct node *temp = (struct node *)malloc(sizeof(struct node));
temp->data = d... | ALGO | 0.999917 | 3.704365 |
3ac4f417-7f3d-4fa9-a034-91aef7547172 | ksmail13/Algorithm | sort_compare.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <time.h>
#define RIGHT_LIMIT(right) (((right)>=LIMIT) ? LIMIT : (right))
#define LIMIT 200
using namespace std;
void quicksort(int *arr, int left, int right);
void mergesort(int *arr, int length);
void printarr(int *arr, int len);
... | ALGO | 0.99966 | 4.547064 |
904afe85-d96e-4236-9de0-b2439af8bf7b | codewithparvesh/Python-Master-Code | cpp_code/Pattern's/4th 1st way.cpp | #include <iostream>
using namespace std;
int main()
{
int n = 5;
// loogic for pattern
for (int row = 1; row <= n; row++)
{
// for each row
for (int col = 1; col <= n; col++)
{
// space
if (col < row)
{
cout << " ";
... | ALGO | 0.999397 | 4.552391 |
19d4f404-e55a-45d0-be6c-3812917ba7b3 | vortex1409/TC435-CPP-REPOSITORY | Loops/do_while.cpp | do
{
statement(s);
}while( condition );
#include <iostream>
using namespace std;
int main ()
{
// Local variable declaration:
int a = 10;
// do loop execution
do
{
cout << "value of a: " << a << endl;
a = a + 1;
}while( a < 20 );
return 0;
}
| ALGO | 0.947468 | 3.289369 |
c144d5be-b921-4aff-aa50-002be79c71d3 | uthantvicentin/Competitive-Programming | Code_Monk/Basics_IO/ladderophilia.cpp | #include <bits/stdc++.h>
#define endl '\n'
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL);
using namespace std;
int main(){
//IOS;
int n;
cin >> n;
if(n > 0){
printf("* *\n");
printf("* *\n");
}
for(int i = 0 ; i < n ; ++i){
printf("*****\n");
printf("* *\n");
printf("* *\n");
}
... | ALGO | 0.999984 | 3.212377 |
a218ab8c-c287-4163-a970-eb92e0a4c665 | samuelbachmann/Coderclass | CPP/quadratic.cpp | #include <iostream>
#include <sstream>
#include <cmath>
float first_solution, second_solution;
float discriminant(float aCal, float bCal, float cCal){
float dCal = (bCal * bCal) - 4 * aCal * cCal;
return dCal;
}
float calculateSolution(float a_cal, float b_cal, float d_cal){
first_solution = (-b_cal + sq... | ALGO | 0.999034 | 4.540884 |
2e758470-e9e8-439d-b23a-b277e46cb5fc | MaksS7/Qt_bis | Qt_bis/horizshift.cpp | /*Версия от 25.05.2020*/
#include "horizshift.h"
#include <QDebug>
#include <QWidget>
horizshift::horizshift()
{
}
horizshift::~horizshift()
{
}
QString horizshift::bubSort(QString str)
{
for(int i(0); i < str.length(); i++) {
for(int j(0); j < str.length(); j++) {
if(str[j] > str[i]) {
... | ALGO | 0.999864 | 3.453393 |
058763e2-c935-460a-9f92-db0090410c55 | riz1-ali/Codeforces_Solutions | 995B.cpp | #include<bits/stdc++.h>
using namespace std;
#define lp(i,n) for(i=0;i<n;i++)
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(NULL);
cout.tie(NULL);
int n,i,j,ans=0,temp;
cin>>n;
int arr[2*n];
lp(i,2*n)
cin>>arr[i];
i=0;
j=0;
while(i<2*n)
{
if(arr[i]==arr[i+1])
i+=2;
else
{
j=i+1;
while(j... | ALGO | 0.999657 | 3.425673 |
6c2b9018-2433-4a5b-82a5-d39466db0e2a | ritz2405/c-and-cpp-codes | subperm.cpp | #include<bits/stdc++.h>
using namespace std;
void solve()
{
int n,k;
cin>>n>>k;
if(n>1 && k==1)
{
cout<<-1<<"\n";
continue;
}
vector<int> v(n);
iota(v.begin(), v.end(), 1);
reverse(v.end() - (n-k+1), v.end());
for(int x:v)
{
cout<< x <<' ';
}
cout<<"\n";
}
int main()
{
int t;
cin>>t;
while(t--)
{
... | ALGO | 0.999729 | 4.057964 |
cd008ac0-7106-470f-a53b-fddcaf1d0aea | yuhuoji/CPP | src/leetcode/editor/cn/Leetcode_39_combination-sum.cpp | #include "../../../../dependencies/include/bits/stdc++.h"
using namespace std;
namespace solution39 {
// leetcode submit region begin(Prohibit modification and deletion)
class Solution {
public:
// 时间, 所有可行解的长度之和, n 个位置每次考虑选或者不选, O(n*2^n)
// 空间O(target)
// 可以排序+剪枝
vector<vector<int>> combinationSum(ve... | ALGO | 0.999991 | 6.222986 |
9ecea931-254e-49a9-8822-07a7a31b23ea | NikHillAgar/Codeforces | FriendsandGifts.cpp | #include <bits/stdc++.h>
using namespace std;
int main(int argc, char const *argv[])
{
int n;
cin>>n;
int a[n];
int b[n] = {0};
//cout<<b[3];
for (int i = 0; i < n; ++i)
{
cin>>a[i];
if(a[i]>0){
b[a[i]-1] = i+1;
}
}
for (int i = 0; i < n; ++i)
{
if(a[i]==0 && b[i]==0){
for (int j = 0; j < n;... | ALGO | 0.999962 | 3.483653 |
18990c97-da20-4d7d-83ed-70e7bc4ae0d7 | 0xessam/MY-Codeforces-problems-solutions | codeforces/1867/C.cpp | #include <bits/stdc++.h>
using namespace std ;
#define lp(i,n) for(int i = 0; i < (n); ++i)
template<typename T>istream& operator>>(istream&i,vector<T>&v){lp(j,v.size())i>>v[j];return i;}
#define tenll(x) ((ll)1e##x)
#define ll long long
#define el '\n'
#define int ll
#define ull unsigned long long
#define cm return vo... | ALGO | 0.999931 | 4.036043 |
ba54c9f4-1fca-41db-9d4a-6e5e7e494d94 | AliAkberAakash/_CONTESTS_ | DCC practice contest 14/A.cpp | #include<cstdio>
#include<iostream>
#include<cmath>
#define SIZE 1000005
bool prime[SIZE];
int lessPrimes[SIZE];
void sieve()
{
int i,j;
prime[0]=1; //initializing 0 is not prime
prime[1]=1; //initializing 1 is not prime
for(i=4; i<SIZE; i+=2) prime[i]=1; //all the even numbers except 2 are not prim... | ALGO | 0.999374 | 3.636042 |
dfcd6231-c588-4d4f-80c4-d010869c1c3a | sirAdarsh/CP-files | CodeForces/219-A(test).cpp | #include<iostream>
using namespace std;
int main(){
int k;
cin>>k;
string s;
cin>>s;
int arr[26]={};
int sum=0;
for(int i=0;i<s.size();i++){
arr[s[i]-97]++;
}
bool end=false;
for(int i=0;i<26;i++){
if(arr[i]%k!=0){
cout<<"-1"<<endl;
end=true;
break;
}
}
if(!end){
string str="";
for(int ... | ALGO | 0.999961 | 3.818145 |
c70f3919-66ee-4f27-b725-f64f7729c271 | IPA3211/StudyCpp_Algorithm | inflearn/Lesson1/37. LRU/main.cpp | #include <iostream>
const int SIZE_OF_DATA = 10;
int main(void) {
int loop = 0, cacheSize = 0, input = 0, temp = 0;
int cache[SIZE_OF_DATA];
for (int i = 0; i < SIZE_OF_DATA; i++)
cache[i] = 0;
std::cin >> cacheSize;
std::cin >> loop;
for (int i = 0; i < loop; i++) {
std::cin >> input;
for (int j = 0;... | ALGO | 0.999849 | 3.473978 |
efe6358d-a9d4-4627-acd6-0c9dff8e2bb3 | osirisQdt2810/algorithms | src/leetcode/cheatsheet/solution/1400-1499/1451.Rearrange Words in a Sentence/Solution.cpp | class Solution {
public:
string arrangeWords(string text) {
vector<string> words;
stringstream ss(text);
string t;
while (ss >> t) {
words.push_back(t);
}
words[0][0] = tolower(words[0][0]);
stable_sort(words.begin(), words.end(), [](const string& ... | ALGO | 0.999958 | 6.069077 |
468f325a-4dbc-4d42-bd45-a6c16b21ed41 | BioDataAnalysis/blaze | blazemark/src/blaze/Complex4.cpp | //=================================================================================================
//=================================================================================================
//*************************************************************************************************
// Includes
//****... | ALGO | 0.973211 | 3.284899 |
aa10b85b-6765-4192-a708-f7ac91d41b1e | ehnryx/acm | bad_code_from_long_ago/lucca2018/d.cpp | #include <bits/stdc++.h>
using namespace std;
#define _USE_MATH_DEFINES
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef complex<ld> pt;
typedef vector<pt> pol;
#define nl '\n'
inline void srand() { srand(clock() + time(nullptr)); }
template <class T, class U>
ostream& operator << (os... | ALGO | 0.999913 | 4.564568 |
3180c68e-3dc1-43a1-a422-ded5009da0a7 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_12648_13.cpp | #include <bits/stdc++.h>
using namespace std;
const int Maxx = 100005;
inline int read() {
int res = 0, bj = 0;
char ch = getchar();
while (ch < '0' || ch > '9') bj |= (ch == '-'), ch = getchar();
while (ch >= '0' && ch <= '9')
res = (res << 3) + (res << 1) + (ch ^ 48), ch = getchar();
return bj ? -res : ... | ALGO | 0.999844 | 3.798148 |
d616b94e-9429-48c6-9d00-514b189b7a51 | raincross7/code-similarity | codes/train_code/problem317/problem317_417.cpp | #include <iostream>
#include <cstdio>
#include <string>
int main() {
int H, W;
std::cin >> H >> W;
for (int y = 0; y < H; ++y)
for (int x = 0; x < W; ++x) {
std::string cell;
std::cin >> cell;
if ("snuke" == cell) {
std::printf("%c%d\n", 'A'+x, 1+y);
}
}
... | ALGO | 0.998437 | 3.317909 |
5c7a17c2-e58a-4264-8ab8-d0c3a39341a3 | Samim-Arefin/Codeforce-Problem-Solution | B. Bogosort.cpp | #include<bits/stdc++.h>
int main()
{
int test;
std::cin>>test;
while(test--)
{
std::vector<int>v1;
int size;
std::cin>>size;
while(size--)
{
int temp;
std::cin>>temp;
v1.push_back(temp);
}
sort(v1.begin(),v1.end(... | ALGO | 0.999931 | 4.944827 |
21288298-f60f-476f-a9f4-a61d8ca863e0 | oxygen-hunter/Flashboom | data/leetcode_cpp/solve-the-equation.cpp | // Time: O(n)
// Space: O(n)
class Solution {
public:
string solveEquation(string equation) {
auto a = 0, b = 0;
auto side = 1;
int submatches[] = { 1, 2, 3, 4 };
auto e = regex("(=)|([-+]?)(\\d*)(x?)");
for (regex_token_iterator<string::iterator> it(equation.begin(), equat... | ALGO | 0.999979 | 5.21666 |
977b4ea1-00e0-427d-a8fb-c88c333f7599 | Spetsnaz-Dev/CPP | DP/maximize_the_cut_segments.cpp | int maximizeTheCuts(int n, int x, int y, int z)
{
vector<int> dp(n+1);
vector<int> v;
v = {x, y, z};
sort(v.begin(), v.end());
for(int i=1; i<=n; i++)
{
for(int j=0; j<3; j++)
{
if(i == v[j])
dp[i] = max(1, dp[i]);
else if(i > v[j... | ALGO | 0.99994 | 4.183225 |
28c1cb49-f5f5-489a-821e-7db5c6fba468 | thegamer1907/Code_Analysis | CodesNew/4194.cpp | #include <bits/stdc++.h>
#define ll long long
#define F firsq
#define S second
#define SI size()
#define pb push_back
using namespace std;
ll i,m,n,sum,a[200007],t;
int main(){
cin>>n>>t>>a[0];
for (i=1;i<n;i++){cin>>a[i];a[i]+=a[i-1];}
while (t--)
{
ll x;
cin>>... | ALGO | 0.999836 | 3.036328 |
9bfa282c-2e2b-4c51-b9a2-eb0211dcf22a | THTBSE/Manufacture | SelectionTool/circleSelection.cpp | #include "circleSelection.h"
#include <numeric>
void circleSelection::toScreen(TriMesh* mesh, vector<int>& vIndex, vector<vec2>& sp
,COpenGLDC* PGLRC)
{
if (!mesh || vIndex.empty())
return;
for_each(vIndex.begin(),vIndex.end(),[&](int id)
{
vec2 p;
COpenglSelection::PointToScreen(PGLRC,mesh->vertices[id],p)... | TOOL | 0.95022 | 4.207959 |
8a1bc9ce-7c4f-4896-af4a-13e00664e831 | abhaybd/gramps_kd | src/kd_server.cpp | #include "gramps_kd/kd_server.h"
// clang-format off
// pinocchio includes have to go before urdf for some reason
#include "pinocchio/algorithm/aba.hpp"
#include <pinocchio/algorithm/frames.hpp>
#include <pinocchio/algorithm/joint-configuration.hpp>
#include <pinocchio/algorithm/kinematics.hpp>
#include "pinocchio/alg... | WEB | 0.880954 | 6.954595 |
84aec07e-d00d-420b-b88a-7d07bc1ffc5a | AkashKumar7902/algorithm | Recursion/SudokuSolver.cpp | vector<vector<string>> ans;
bool issafe(int board[][10], int i, int j, int n) {
for (int row = 0; row < i; ++row) {
if (board[row][j] == 1) {
return false;
}
}
int x = i;
int y = j;
while (x >= 0 && y >= 0) {
if (board[x][y]) {
return false;
}
x--;
y--;
}
x = i;
y = j;
while (x >= 0 && y... | ALGO | 0.999882 | 5.60075 |
3ebbda0a-b803-45de-909e-844a3d3d5a68 | pazhanivel07/frameworks_av-10-r33_CVE-2020-0242 | media/libstagefright/MediaCodecList.cpp | //#define LOG_NDEBUG 0
#define LOG_TAG "MediaCodecList"
#include <utils/Log.h>
#include "MediaCodecListOverrides.h"
#include "StagefrightPluginLoader.h"
#include <binder/IServiceManager.h>
#include <media/IMediaCodecList.h>
#include <media/IMediaPlayerService.h>
#include <media/MediaCodecInfo.h>
#include <media/sta... | TOOL | 0.879354 | 7.295308 |
9021712b-cb9a-4b31-b7f0-0dbca232b3dd | usherfu/competitiveprogram | codeforces_problemset/344A_Magnets.cpp | #include <bits/stdc++.h>
#include <array>
using namespace std;
#define ll long long
#define ar array
typedef vector<int> vi;
typedef pair<int,int> pi;
int main(){
ios::sync_with_stdio(0); //make io more efficient
cin.tie(0);
ll n, g=1;
string cur, pre;
cin >> n;
cin >> pre;
for (size_t ... | ALGO | 0.999912 | 3.812642 |
629699d4-ee59-4778-84ce-4eee7894c5cc | kushal-a/propeller_balancer | src/full_test/propeller_balancer.cpp | #include "propeller_balancer.h"
#include "imu.h"
#include "motor.h"
#include <math.h>
int pid_P;
int pid_I;
int pid_D;
int pid_last_e;
int pid_dt;
int pidVal = 0;
int um,alpha1,I;
void init_consts(){
um = KAPPA * MASS * GRAVITY;
alpha1 = 2*H_COM/(KAPPA*L_PP);
I = INERTIA + MASS*H_COM*H_COM;
}
void init_... | ALGO | 0.992332 | 3.968755 |
68b814dc-ecc8-4851-a5f3-ee0b2b891b16 | turneja123/competitive-programming-library | Problem/Tree/All-Star.cpp | //https://algotester.com/en/ArchiveProblem/DisplayWithFile/71129#mySolutions
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
#define endl "\n"
#define ll long long
#define IOS ios_base::sync_with_stdio(false); cin.tie(nullptr);
const int N = 1e5 + 5;... | ALGO | 0.999833 | 4.72334 |
6533cf07-6fd6-4ef6-b702-92199cf45305 | lerrorgk/LeetCode | 122. 买卖股票的最佳时机 II/main.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
stack<int> st;
int ans = 0;
for(int p : prices){
if(st.empty() || st.top() < p){
st.push(p);
} else if(st.top() >= p){
int b = st.top();
int a = 0;
... | ALGO | 0.999763 | 6.197221 |
72fc9436-0682-4e1b-928c-f296900d9d82 | Beisenbek/FallPP12021 | midterm-upsolving-solutions/186852.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin >> n;
int temp = n;
int b = 0;
while (temp != 0)
{
b = b * 10 + temp % 10;
temp /= 10;
}
if (n == b)
cout << "YES";
else
cout << "NO";
return 0;
} | ALGO | 0.999977 | 4.904709 |
194fa90b-d9df-4c99-b2cd-3715130deff4 | Si-nhan/Cpp-programs | STRING/ADN.cpp | #include <iostream>
using namespace std;
main() {
string fir_half_ADN;
cout << "Enter the first half of ADN: ";
getline(cin, fir_half_ADN);
int len = fir_half_ADN.length();
char sec_half_ADN[len];
// Match 2 halves of the ADN
for (int i = 0; i < len; i++)
switch (fir_half_ADN[i]) {
case 'A... | ALGO | 0.993806 | 3.732275 |
09e3855a-733d-46b6-9224-3f9d6cfc0c14 | Masters-Akt/CS_codes | leetcode_sol/263-Ugly_Number.cpp | class Solution {
public:
bool isUgly(int n) {
if(n<=0) return false;
while(n%5==0) n/=5;
while(n%3==0) n/=3;
while(n%2==0) n/=2;
if(n==1) return true;
return false;
}
}; | ALGO | 0.999868 | 5.889493 |
ec684e01-2e54-436f-a430-6e67e35a2552 | nirbar/boost | libs/math/src/tr1/assoc_legendref.cpp | extern "C" float BOOST_MATH_TR1_DECL boost_assoc_legendref BOOST_PREVENT_MACRO_SUBSTITUTION(unsigned l, unsigned m, float x) BOOST_MATH_C99_THROW_SPEC
{
return (m&1 ? -1 : 1) * c_policies::legendre_p BOOST_PREVENT_MACRO_SUBSTITUTION(l, m, x);
}
| TOOL | 0.952202 | 4.12418 |
63c8b534-b54d-476e-ad9e-4f50b9afe962 | russaltang88/leetcode-solutions | cpp/0062-unique-paths.cpp | /*
Given grid, return # of unique paths from top-left to bottom-right
Ex. m = 3, n = 2 -> 3 unique paths (R->D->D, D->D->R, D->R->D)
DP: edges have 1 unique path, inner cells consider where it comes from
Recurrence relation: grid[i][j] = grid[i-1][j] + grid[i][j-1]
Time: O(m x n)
Space: O(m x ... | ALGO | 0.999861 | 7.122243 |
7ecf0bb1-685a-4538-ab47-e1e7a7ba8eb8 | itssmfaisal/Portfolio | Non_Primes_101.cpp | #include <bits/stdc++.h>
#define IO \
ios_base::sync_with_stdio(false); \
cin.tie(NULL); \
cout.tie(NULL)
#define int long long
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define w(t) \
int t; \
cin >> t; \
whil... | ALGO | 0.999531 | 4.130742 |
b3b97b2e-0da9-444e-aac8-e2cdeb189ac3 | PacktPublishing/OpenCV-4-Computer-Vision-Application-Programming-Cookbook-Fourth-Edition | Chapter09/patches.cpp | #include <iostream>
#include <vector>
#include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/features2d.hpp>
#include <opencv2/objdetect.hpp>
int main()
{
// image matching
// 1. Read input images
cv::Mat image1= cv::imread("church01.jpg", cv::IMREAD_GRAYSCALE);... | ALGO | 0.994807 | 5.322635 |
2fdc6a23-0568-4118-b3f2-a6e3cd449167 | Alan-Tony/CompilerDesignLab | Lab2/Q3_and_Q4/Ans4_PARSING.cpp | #include <bits/stdc++.h>
using namespace std;
vector<char> *first;
vector<char> *follow;
vector<char> non_term;
vector<char> term;
int num_non_term, num_term;
//Index
int non_term_index[256];
int term_index[256];
vector<string> productions;
int num_prod;
int **parse_table;
void acceptProductions(){
vector<boo... | ALGO | 0.999537 | 4.783458 |
e1cebe4c-263d-411c-aadc-f464dd4fb3dc | shariar-opu/CFsolve | B_Mike_s_Sequence.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define time cerr << "time = " << clock() << " ms" << '\n'
#define optimize() \
ios_base ::sync_with_stdio(0); \
cin.tie(0); \
cout.tie(0);
#define pb push_back
#define pp pop_back
#define... | ALGO | 0.99995 | 3.693791 |
b0153ce4-b718-474f-a275-090821d5067d | travp624/packages_apps_Camera | jni/feature_stab/db_vlvm/db_feature_detection.cpp | /*$Id: db_feature_detection.cpp,v 1.4 2011/06/17 14:03:30 mbansal Exp $*/
/*****************************************************************
* Lean and mean begins here *
*****************************************************************/
#include "db_utilities.h"
#include "db_feat... | ALGO | 0.97609 | 4.379949 |
20b32819-bb09-4784-b445-2ec3595e1f6a | jurgen-kluft/csort | source/main/cpp/c_blit_sort.cpp | // blitsort <IP_ADDRESS> - Igor van den Hoven <EMAIL>
// Blitsort is an in-place rotate quick/merge sort based on the stable out-of-place
// merge sort quadsort, stable out-of-place quicksort fluxsort, and unstable in-place crumsort.
#include "csort/c_blit_sort.h"
#include "csort/c_quad_sort.h"
#include "csort/priva... | ALGO | 0.999967 | 7.118812 |
8d5008c0-22f2-40bc-ab10-9895a131a87d | StepMan91/MsCV-UE4-Robotics_Project | Packages folder/pcl/tools/grid_min.cpp | #include <pcl/point_types.h>
#include <pcl/io/pcd_io.h>
#include <pcl/console/print.h>
#include <pcl/console/parse.h>
#include <pcl/console/time.h>
#include <pcl/filters/grid_minimum.h>
using namespace std;
using namespace pcl;
using namespace pcl::io;
using namespace pcl::console;
typedef PointXYZ PointType;
typedef... | DATA | 0.954726 | 6.996823 |
f41c3854-0790-4fbf-ba77-7982bba0f06b | Vedantjn/persistent-assignment | 5.cpp | class Solution {
public:
ListNode* deleteDuplicates(ListNode* head) {
if(head==NULL)return head;
ListNode* node=head;
while(node && node->next){
if(node->next->val==node->val){
node->next = node->next->next;
}
... | ALGO | 0.999927 | 5.623228 |
5dd361c6-42c1-40b6-b5b9-ca864c563a53 | manishgoyal30/Data_Structure | GFG/Arrays/valueequALTOindex.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,count=1,res=1;
cin>>n;
int arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
for(int i=1;i<n;i++)
{
if((arr[i]%2==0 && arr[i-1]%2!=0) ||arr[i]%2!=0 && arr[i-1]%2==0 ){
count++;
res = max(count,... | ALGO | 0.999914 | 4.186226 |
65f0dfb7-cf5b-428f-9ea9-8b56ee21747b | nabeelwasi/C-language | nabeel.cpp | #include<stdio.h>
#include<conio.h>
void printNo(int no);
int main(){
printNo(1);
getch();
return 0;
}
void printNo(int a){
if(a<=10){
printf("%d\n",a);
a++;
printNo (a);
}
}
| ALGO | 0.999547 | 3.36567 |
33a4e840-1efe-4a98-97ab-968ccf872f93 | cstechfoodie/COMP371-Computer-Graphic-Scene-of-End-of-the-World | ThirdParty/FreeImage-3170/Source/OpenEXR/IlmImf/ImfRgbaYca.cpp | //-----------------------------------------------------------------------------
//
// Conversion between RGBA and YCA data.
//
//-----------------------------------------------------------------------------
#include <ImfRgbaYca.h>
#include <assert.h>
#include <algorithm>
using namespace IMATH_NAMESPACE;
using namespa... | ALGO | 0.981619 | 7.347564 |
efd77a4e-ab7f-4e5c-b5d7-bfe9d75419ca | raju1107/uibk_ps_parsys | exercise08/solution/montecarlo_mpi/Main.cpp | // mpic++ Main.cpp Montecarlo.h Montecarlo.cpp -fopenmp -Wall -O3 -std=c++11 -o montecarlo
// mpirun -np 4 ./montecarlo 100000000 par
#include "Montecarlo.h"
#include <mpi.h>
int main(int argc, char** argv) {
long s = 10000;
char *temp;
if (argc >= 2) {
s = strtoul(argv[1],&temp,0);
}
int rank, size... | ALGO | 0.999577 | 4.151046 |
5d9d862f-ab2b-4048-8471-eb6d87a7fcb9 | Omkar-M/CPractice | day 1/8.cpp | //Write a Program to Multiply two decimal Numbers entered by User.
#include <iostream>
using namespace std;
int main() {
int num1, num2, mul;
cout << "Enter two numbers: ";
cin >> num1 >> num2;
mul = num1 * num2;
cout << "Product = " << mul;
return 0;
} | ALGO | 0.999136 | 4.12187 |
e8605850-1f70-4a7c-838b-e623b758e464 | StijnOnline/Learning_Cpp_with_AoC | AdventOfCode2022_Cpp/Day7/Day7.cpp | #include <fstream>
#include <string>
#include <iostream>
#include <sstream>
#include <array>
#include <vector>
#include "Day7.h"
class dir;
class file {
public:
std::string name;
int size;
dir* parentDir;
file(std::string name, int size) {
this->name = name;
this->size = size;
}
};
class dir {
public:
std::... | TOOL | 0.989131 | 4.099143 |
ea39a399-0fd2-4ced-b68a-8f17c908e31b | vochi/core-intern-test | effect_sandbox/3rd/opencv_contrib/modules/ximgproc/src/bilateral_texture_filter.cpp | #include "precomp.hpp"
#include <opencv2/ximgproc.hpp>
#include <vector>
namespace cv
{
namespace ximgproc
{
void compute_mRTV(const Mat& L, Mat& mRTV, int fr);
void compute_G(const Mat& B, const Mat& mRTV, Mat& G, Mat& alpha, int fr);
void joint_bilateral_filter(const Mat& img, const Mat& G, Mat& r_img, int fr2... | ALGO | 0.999286 | 5.811806 |
54a60a50-2c22-4fcb-8f57-9511a2fd6b60 | Muktadirul675/toph_problems | ascii_progress_bar/main.cpp | #include<iostream>
using namespace std;
int main(){
int n; cin >> n;
int progress = n / 10;
string bar = "[";
for(int i=0;i<10;i++) {
if(i<progress) bar += "+";
else bar+=".";
}
bar += "]";
cout << bar << " " << n << "%";
return 0;
}
| ALGO | 0.984086 | 3.335556 |
65343220-85bc-4fef-82a1-dd4cb02aa59e | SonarSystems/Cocos2d-x-Multi-Device-2.0 | Full Scene Examples/MultiResJS/frameworks/cocos2d-x/extensions/Particle3D/PU/CCPUSimpleSpline.cpp | #include "CCPUSimpleSpline.h"
#include "base/ccMacros.h"
NS_CC_BEGIN
//---------------------------------------------------------------------
PUSimpleSpline::PUSimpleSpline()
{
// Set up matrix
// Hermite polynomial
_coeffs.m[0] = 2;
_coeffs.m[1] = -2;
_coeffs.m[2] = 1;
_coeffs.m[3] = 1;
_co... | ALGO | 0.994027 | 6.902122 |
cc9d8444-7614-4721-a541-0069e8351397 | lbv/pc-code | solved/f-h/hexagonal-bamboo-fort/fort.cpp | #include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;
#define MAXN 100
#define MAXS 100000
#define Zero(v) memset((v), 0, sizeof(v))
#define GetFS(b) ((b) & -(b))
struct Bit {
int f[MAXS + 1]; int n;
void init(int N) { n=N; Zero(f); }
void add(int i, int v) { while (i <= n) { f[i... | ALGO | 0.99992 | 4.719469 |
ad3ec6df-03ae-4a4a-9b49-7b46310de0e4 | EmmanuelMartinezSalcedo/codes | Clients.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <limits>
// Estructura para representar un cliente
struct Cliente {
std::vector<double> caracteristicas;
};
// Funcin para calcular la distancia entre dos clientes
double calcularDistancia(const Cliente& c1, const Cliente& c2) {
double distancia ... | ALGO | 0.999929 | 6.348125 |
1df3c45b-70c2-41e0-84f6-9f83b79bbd38 | silver-birch-wawa/PAT | 算法学习/字符串专题/字符串hash.cpp | #include <bits/stdc++.h>
using namespace std;
#define N 10000
int H[N]={0};
int index(char c){
int hash=c-'A';
return hash;
}
int su=10000019;
int main(){
int i,j;
char input[N];
scanf("%d",&input);
int length=strlen(input);
H[0]=index(input[0]);
for(i=1;i<length;i++){
// 每个输入字符依赖于上一个字符
H[i]=H[i... | ALGO | 0.999968 | 4.142965 |
d6dcf86b-c31b-4c13-a7dc-49fc5d7ce5c5 | mutablealligator/scalable-ndn-forwarding | boost_1_60_0/libs/geometry/index/example/benchmark3.cpp | // Boost.Geometry Index
// Additional tests
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/index/rtree.hpp>
#include <boost/chrono.hpp>
#include <boost/foreach.hpp>
#include <boost/random.hpp>
#include <set>
int main()
{
namespace bg = boost::geometry;
namespace bgi = bg::index;
... | TEST | 0.872505 | 6.063844 |
c1bc54a7-3628-477e-b170-caf920a495c6 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_6281_7.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10, lg = 30;
long long n, u, v, w, q, par[N][lg + 10], h[N], cnt[N][lg + 10], ans, l;
long long ST[N], ip[N], t;
char c;
vector<pair<long long, long long> > G[N];
set<long long> st;
set<long long>::iterator it, it1, it2;
void dfs(long long x, long long p... | ALGO | 0.999988 | 4.025651 |
81125076-a398-4b62-a080-a2aeb5e0b481 | 113bommy/LogicalErrorFixCodeT5 | LogicalErrorFix_metric/ParseError_CodeT5_LineNumber_cpp_gold/Problem_15_gold_59.cpp | #include <bits/stdc++.h>
using namespace std;
long long max(long long a, long long b) {
if (a >= b) {
return a;
}
return b;
}
long long min(long long a, long long b) {
if (a <= b) {
return a;
}
return b;
}
long long modpower(long long a, long long n, long long d = 1000000007) {
long long res = 1;
while (n) {
if (n % 2)... | ALGO | 0.999945 | 4.559542 |
a3a20aed-4bbf-4ca1-8da8-d44fe3c2b54b | wujunhui99/cpp | archive/408/408_exam/os/2-chapter/2-2-18.cpp | semaphore odd = 0, even = 0, empty = N, mutex = 1;
cobegin{
Process P1(){
while(true){
int x = produce();
P(empty);
P(mutex);
Put();
V(mutex);
if(x % 2)
V(odd);
else
V(even);
}
}
Process P2(){
while(true){
P(odd);
P(mutex);
getodd();
V(mutex);
V(empty);
countodd()... | ALGO | 0.999497 | 3.739497 |
0951e249-e4e0-40db-be26-dafb554dd1c3 | K1XE/LeetCode | 周赛/157/no1.cpp | #include "tools.h"
class Solution
{
public:
bool isPrime(long long n)
{
if (n <= 1)
return false;
if (n <= 3)
return true;
if (n % 2 == 0 || n % 3 == 0)
return false;
for (long long i = 5; i * i <= n; i += 6)
{
if (n % i ==... | ALGO | 0.99991 | 4.827771 |
9437f172-a0fc-49c8-93cc-f7d0275bc79e | Syncpine/LeetCodeSolutions | Array/136. Single Number.cpp | class Solution {
public:
int singleNumber(const std::vector<int>& nums)
{
int ans = 0;
for(auto ii : nums)
{
ans ^= ii;
}
return ans;
}
}; | ALGO | 0.999858 | 5.825382 |
350364b7-7a6b-4ce3-aadc-a69545d397f0 | Andrzej-Swietek/Algorytmy | 7_dluga_tasma.cpp | #include <iostream>
#include <vector>
#include <iomanip>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
double n;
cin >> n;
//v.push_back(0);
double k = 0;
cout << fixed;
for(int i=0;i<n;i++)
{
double tmp;
cin>> tmp;
if(i==0)
... | ALGO | 0.999881 | 4.023165 |
729d8f8d-0b09-4f84-9474-a5f3dd798e34 | huangkonglan/suanfawork | 递归二分查找.cpp | //ݹֲ㷨
#include <stdio.h>
int BinSearch(int a[],int low,int high,int k) //ֲ㷨
{ int mid;
if (low<=high) //ǰԪʱ
{ mid=(low+high)/2; //мλ
if (a[mid]==k) //ҵ±mid
return mid;
if (a[mid]>k) //a[mid]>kʱ,a[low..mid-1]еݹ
return BinSearch(a,low,mid-1,k);
else //a[mid]<kʱ,a[mid+1..high]еݹ
return BinSe... | ALGO | 0.999792 | 3.423506 |
6c4ef0d5-209f-42e0-b3b8-93eab56f0481 | KiwiFlow/Algorithms | Building designing.cpp | #include<cstdlib>
#include<ctime>
#include<cmath>
#include<stdio.h>
#include<queue>
#include<climits>
#include<vector>
#include<algorithm>
using namespace std;
int main() {
//freopen("d:\\in.txt", "r", stdin);
//freopen("d:\\out.txt", "w", stdout);
int t; scanf("%d", &t);
for (int i = 0; i < t; i++) {
int n; sca... | ALGO | 0.999775 | 3.856648 |
f235dea6-8868-4275-927d-8c022fd17bc7 | rajibdpi/leetcode-sol-mkdocs | main/solutions/0350. Intersection of Two Arrays II/0350-3.cpp | class Solution {
public:
vector<int> intersect(vector<int>& nums1, vector<int>& nums2) {
if (nums1.size() > nums2.size())
return intersect(nums2, nums1);
vector<int> ans;
int lowerBound = 0; // Lower bound for the binary search
sort(begin(nums1), end(nums1));
sort(begin(nums2), end(nums2... | ALGO | 0.99998 | 6.419623 |
23f1c2f7-b331-4dc3-b349-0bd667cc6df3 | yunyu-Mr/myLeetcode | cpp/populating_next_right_pointer_to_each_node_2.cpp | #include <iostream>
#include <queue>
using namespace std;
//Definition for binary tree with next pointer.
struct TreeLinkNode {
int val;
TreeLinkNode *left, *right, *next;
TreeLinkNode(int x) : val(x), left(NULL), right(NULL), next(NULL) {}
};
class Solution {
public:
void connect(TreeLinkNode *root) {
if... | ALGO | 0.999773 | 4.832353 |
5be9ef5b-d7f8-4192-8716-af7af10a8f23 | ashanka234/DS_and_algo | Heap/heap_sort.cpp | #include<iostream>
#include<queue>
using namespace std;
void heapSort_pq(int *arr, int n)
{
priority_queue<int, vector<int>, greater<int> > minHeap;
for(int i=0; i<n; i++)
minHeap.push(arr[i]);
while(!minHeap.empty())
{
cout << minHeap.top() << " ";
minHeap.pop();
}
}
voi... | ALGO | 0.999965 | 4.675143 |
759b3a73-5b2c-4082-8f72-d32fa69d7427 | PriyanshuDas/college-work | Archieved Programs/codechef/march_17/SUMDIS.cpp | #include <bits/stdc++.h>
#define sf scanf
#define pf printf
#define mp make_pair
#define pb push_back
#define ins insert
#define ll long long int
#define ull unsigned long long int
#define fi first
#define se second
#define n_max 100001
using namespace std;
int T, N;
ll inf = 900000000000001;
vector <ll> a[3];
ll t... | ALGO | 0.999908 | 3.50072 |
b2944d3d-fecb-4051-9ad3-51e827685e47 | zcbauer/Assorted-C-Cpp-projs | C++/NameEveryNumber.cpp | #include <iostream>
#include<fstream>
#include<vector>
using namespace std;
void allNumbers(vector<int> &numbers, int &limit){
for(int i=0; i<=limit; ++i){
numbers.push_back(i);
}
}
int main(){
vector <int> numberList;
int limit;
cout<<"What is the max that you want? "<<endl;
cin>> limit;
allNumbers(n... | ALGO | 0.985411 | 3.686656 |
3dd6ba12-6919-4b8a-984e-5d7e82446398 | ShelpAm/competitive_programming | competitest/Codeforces/Educational Codeforces Round 176 (Rated for Div. 2)/B. Array Recoloring/main.cpp | #pragma once
// Problem: B. Array Recoloring
// Contest: Educational Codeforces Round 176 (Rated for Div. 2)
// Judge: Codeforces
// URL: https://codeforces.com/contest/2075/problem/B
// Start: Thu 20 Mar 2025 12:40:19 PM CST
// Author: ShelpAm
// #include <bits/stdc++.h>
#include <algorithm>
#include <bit>
#include ... | ALGO | 0.999944 | 5.78118 |
60f94281-5e06-40a8-b1e8-7f6e60b7973d | MereyPolatkhan/competitive_programming_and_algorithms | _codeforces/_archive_cf/1607B.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> pii;
void solve() {
ll d, n;
cin >> d >> n;
ll x = 0;
if (n % 4 == 1) {
... | ALGO | 0.999943 | 4.162754 |
371fc34a-a372-4643-8836-b06ddcbacc1c | TDLoi123/code-basic | DSA06040.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
while (t--){
int n, m, k;
cin >> n >> m >> k;
long long a[n], b[m], c[k];
for (int i=0; i<n; i++){
cin >> a[i];
}
for (int i=0; i<m; i++){
cin >> b[i];
}
for (int i=0; i<k; i++){
cin >> c[i];
}
multiset <long long... | ALGO | 0.999826 | 3.710181 |
6e8348ec-6acc-4626-8428-86062f16c4b4 | turcotte/xdynalign | irvine/xdynalign.cpp | #include "stdafx.h"
#include "algorithm.cpp"
#include "xdynalign.h"
#include <math.h>
#include <string.h>
// #include <assert.h>
// #include <iostream.h>
// #define NDEBUG
#define maxloop 20 //maximum size of unpaired nucs on each side of an internal loop
// This function takes 3 sequences and creates an alignment. ... | ALGO | 0.996782 | 3.565245 |
c837343d-21d1-4595-9449-d6050141d82e | gan-ta/Algorithm | BackJoonOnline/2217로프.cpp | #include<iostream>
#include<algorithm>
#include<functional>
#include <numeric>
using namespace std;
int N;
int rope[100001] = { 0, };
int main()
{
int i;
int total = 0;
int cnt = 0;
int res = 0;
cin >> N;
for (i = 1; i <= N; i++)
{
cin >> rope[i];
}
sort(rope + 1, rope + N + 1, greater<int>());
for (i... | ALGO | 0.99995 | 3.676111 |
a13804d2-d3d6-499b-8557-b87f43390f80 | SETURAJ/LeetCode-Solutions | minimum-difference-between-highest-and-lowest-of-k-scores/Accepted/10-8-2022, 5_47_09 AM/Solution.cpp | // https://leetcode.com/problems/minimum-difference-between-highest-and-lowest-of-k-scores
class Solution {
public:
int minimumDifference(vector<int>& nums, int k) {
sort(nums.begin(),nums.end(),greater<int>());
int res=INT_MAX;
for(int i=0;i<=nums.size()-k;i++)
{
res=mi... | ALGO | 0.999956 | 5.434517 |
1637ae91-8003-4ad3-9f85-bae9d721de72 | sudhanshu1402/Data-Structure-And-Algorithms | Strings/Word Occurrences.cpp | /* TODO:
Count the number of word occurrences in a string
loop through your string until you find a character that matches the first character in your word;
create a substring using the current index and the length of the word you are looking for;
increment your counter if the 2 strings are identical.
Here we will nee... | ALGO | 0.999783 | 5.751701 |
f26958b4-317e-4f33-a96e-398dd3acc764 | itsMuhammadtalha/OOP-in-C- | Assignments/1D ARRAY/1d array q3 .cpp | // 1d array q3
#include <iostream>
using namespace std;
int main()
{
int sz;
cout<<"Enter the size of array::";
cin>>sz;
int randArray1[sz];
int randArray2[sz];
int sum[sz];
//cout<<"1st array is" <<endl ;
for(int i=0;i<sz;i++)
randArray1[i]=rand()%100; //Generate number between 0 to 99
... | ALGO | 0.992192 | 3.291928 |
add69b30-e00e-4284-b5c7-f7852e37b286 | VFR-maniac/opencore-amr | opencore/codecs_v2/audio/gsm_amr/amr_nb/enc/src/g_pitch.cpp | /*
------------------------------------------------------------------------------
Filename: g_pitch.cpp
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------... | ALGO | 0.999253 | 5.259645 |
7d56fb8a-4b66-4256-9f47-e8577ea076ec | bsun1220/ICPC-Prep | c1_prep/tanya.cpp | #include <set>
#include <iostream>
#include <vector>
#include <map>
#include <deque>
#include <stack>
#include <string>
#include <algorithm>
#include <queue>
#define ll long int
using namespace std;
map<string, ll> find_count(string s){
map<string, ll> m;
for(ll i = 0; i < s.size(); i++){
... | ALGO | 0.999992 | 4.656938 |
190cf1d0-f455-4c3d-9e44-b132a39d253f | yffi4/ADS-2024 | lab5/B.cpp | #include <iostream>
using namespace std;
class MaxHeap
{
private:
int* heapArray;
int capacity;
int heapSize;
public:
MaxHeap(int capacity){
this->capacity = capacity;
heapArray = 0;
heapSize = 0;
}
int parent(int i) {return (i - 1) / 2;}
int left(int i) {return i * ... | ALGO | 0.999996 | 4.316743 |
8ac03057-4812-480b-b258-ef15dd9edd6a | Prakash251299/Leetcode | Problems/64MinimumPathSum.cpp | class Solution {
public:
int minPathSum(vector<vector<int>>& grid) {
for(int i=grid.size()-1;i>=0;i--){
for(int j=grid[0].size()-1;j>=0;j--){
// cout<<grid[i][j]<<" ";
int a=50000,b=50000;
if(i+1<grid.size()){
a = grid[i+1][j];
... | ALGO | 0.999906 | 5.652028 |
8783e7db-2980-4400-b19b-cbe4e41796aa | ubc-aamodt-group/ray-intersection-predictor | rtao-benchmark/src/GPUBVHConverter.cpp | #undef NDEBUG
#include <cassert>
#include <random>
#include <float.h>
#include <unordered_map>
#include "helper_math.h"
#include "WoopTriangleHelper.h"
#include "GPUBVHConverter.h"
#include "Logger.h"
void print_node(const CWBVHNode node) {
printf("P: %f, %f, %f\n", node.pOrigin.x, node.pOrigin.y, node.pOrigin.z);
p... | ALGO | 0.995653 | 5.44517 |
dda1fd8a-c90c-4519-9198-483c4dc017ca | rajeevroy21/gfg160 | Day8.cpp | int maximumProfit(vector<int> &prices) {
int sum=prices[0],max=0;
int n=prices.size();
for(int i=1;i<n;i++)
{
if(sum>prices[i])
sum=prices[i];
else if(prices[i]-sum>max)
max=prices[i]-sum;
}
return max;
}
| ALGO | 0.999617 | 5.545704 |
b5cdc82e-7717-4964-b8bf-445fcd7be014 | DRL-CASIA/Autonomous-Driving | decision-making-CarND/CarND-test/src/Eigen-3.3/doc/examples/DenseBase_middleCols_int.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
int main(void)
{
int const N = 5;
MatrixXi A(N,N);
A.setRandom();
cout << "A =\n" << A << '\n' << endl;
cout << "A(1..3,:) =\n" << A.middleCols(1,3) << endl;
return 0;
}
| ALGO | 0.928402 | 3.133398 |
a49b176a-43d7-4300-bff6-a850e4666f22 | Saptarshidas131/CPP | gfg/C++ stl/binary_to_decimal.cpp | #include <iostream>
using namespace std;
int main()
{
int n, val = 0, base = 1;
cin >> n;
while(n > 0)
{
int last_digit = n%10;
val += (last_digit*base);
n /= 10;
base *= 2;
}
cout << val;
return 0;
}
| ALGO | 0.999916 | 4.263831 |
97afd596-e9bd-4fc3-94d7-86421e3f415f | Sonu08-Sto/Data-Structure-Algorithms | Merge_k_sorted_array_heap.cpp | #include<bits/stdc++.h>
using namespace std;
struct Triplet{
int val,apos,vpos;
Triplet(int v,int ap,int vp){
val=v;
apos=ap;
vpos=vp;
}
};
struct MyCmp{
bool operator()(Triplet &t1,Triplet &t2){
return t1.val>t2.val;
}
};
vector<int> MergeKth(vector<vector<int>> &... | ALGO | 0.999967 | 4.098901 |
e512b3a7-7f00-48ef-bdc3-b11afc39bd8e | ishandutta2007/codeforces | c_sunshine/normal/500/A.cpp | #include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;
const int maxn=30005;
int n,t;
int a[maxn],b[maxn];
void init()
{
scanf("%d%d",&n,&t);
for(int i=1;i<n;i++)
scanf("%d",a+i);
}
void work()
{
b[1]=1;
for(int i=1;i<n;i++)
if(b[i])b[i+a[i]]=1;
if(b[t])puts("Y... | ALGO | 0.999962 | 3.890555 |
b76cd169-3857-4d01-9b78-498b5183e77a | clay-arras/cp-practice | codeforces/solved/madokaandformalstatement.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#define open(x) freopen(x, "r", stdin);
#else
#define debug(...)
#define open(x)
#endif
void solve(){
int n; cin >> n;
vector<int> a, b;
for (int i=0; i<n; i++){
int t; cin >> t;
a.push_back(t);
}
for (i... | ALGO | 0.999912 | 3.994521 |
2ada619e-1f16-41ef-a59e-2aa3313f4731 | Mr-Phoebe/ACM-ICPC | OJ/Leetcode/Algorithm/911. Online Election.cpp | class TopVotedCandidate {
public:
TopVotedCandidate(vector<int>& persons, vector<int>& times) {
_times = times;
vector<int> number(persons.size(), 0);
timeToPeople.resize(persons.size());
int max = -1, peo;
for(int i = 0; i < persons.size(); i++) {
if(++number[per... | ALGO | 0.999991 | 6.217584 |
e500b5a0-4ed6-400a-ba80-790c0e19470d | fyquah/hardcaml_zprize | zprize/ntt/host/bench_throughput.cpp | #include <assert.h>
#include <algorithm>
#include <random>
#include <stdint.h>
#include <vector>
#include "driver.h"
#include "reference.h"
enum class WhatToMeasure {
MEMCPY_AND_EVALUATE_AND_CHECK,
EVALUATE_ONLY
};
struct host_args_t {
std::string binaryFile;
NttFpgaDriverArg driver_arg;
uint64_t num_evalu... | TEST | 0.941784 | 6.44199 |
429f52a9-1e07-4393-85c6-d09a3ce54623 | Nexisato/LeetCodeDiary | LeetCode/0485-Max-Consecutive-Ones/485-Max-Consecutive-Ones.cpp | /*
LeetCode 485: Max Consecutive Ones
@Description:
Given a binary array, find the maximum number of consecutive 1s in this array.
Note:
The input array will only contain 0 and 1.
The length of input array is a positive integer and will not exceed 10,000
*/
#include <bits/stdc++.h>
using namespace std;
/*
思路:
*/
clas... | ALGO | 0.999978 | 6.432197 |
05c00b0e-df5b-4960-90e5-7bc85d119e43 | ob22a/Leetcode | 16-3sum-closest/3sum-closest.cpp | class Solution {
public:
int threeSumClosest(vector<int>& nums, int target) {
sort(nums.begin(),nums.end());
int ans=nums[0]+nums[1]+nums[2];
for(int i=0;i<nums.size()-2;++i){
int left=i+1,right=nums.size()-1;
while(left<right){
int sum = nums[i]+nums[... | ALGO | 0.999994 | 6.258379 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.