uuid stringlengths 36 36 | repo_name stringlengths 5 133 | relative_path stringlengths 3 3.76k | content stringlengths 282 4.03M | category stringclasses 6
values | algo_rel_score float32 0.9 1 | quality_score float32 3 8.13 | source_meta dict |
|---|---|---|---|---|---|---|---|
cdfeab00-348d-46cc-9297-b49c6356a567 | BlackPunk/Tubes_std | TubesCode.cpp | #include "tubes.h"
void createList(multiList &L){
first_Matkul(L) = NIL;
last_Matkul(L) = NIL;
first_Dosen(L) = NIL;
last_Dosen(L) = NIL;
}
address_matKul allocatedMatkul(infotype X){
address_matKul P = new mataKuliah;
infoM(P) = X;
nextM(P) = NIL;
rel(P) = NIL;
return P;
}
address... | TOOL | 0.970189 | 3.181449 | {
"github_metadata": {
"branch": "master",
"commit_count": 55,
"repo_created_at": "2019-04-16T22:42:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "389a30097... |
03a38590-a718-466a-8eff-247a874c5af7 | sarthak815/ProblemSolving-Hackerrank | Algorithm-Problems/Append_and_Delete.cpp | #include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
/*
* Complete the 'appendAndDelete' function below.
*
* The function is expected to return a STRING.
* The function accepts following parameters:
* 1. STRING s
* 2. STRING t
* 3. INTEGER k
*/
string ... | ALGO | 0.999952 | 5.518171 | {
"github_metadata": {
"branch": "master",
"commit_count": 19,
"repo_created_at": "2021-06-17T14:05:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2b3298761... |
251c257e-ffe0-4d9f-9174-6db74f8e89bb | qtumproject/qtum | src/libff/libff/algebra/curves/bn128/bn128_pairing.hpp | /** @file
********************************************************************************
Declares functions for computing Ate pairings over the bn128 curves, split into a
offline and online stages.
********************************************************************************
* @author This file is part of... | TOOL | 0.9505 | 6.732756 | {
"github_metadata": {
"branch": "master",
"commit_count": 46429,
"repo_created_at": "2017-03-03T08:17:11.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1215,
"forks": 404,
"issues": 37,
"pull_requests": 3
},
"file_meta": {
"content_id": "4... |
0875e0cf-d997-4b5c-a8b8-f2b481fd8aa6 | nusdbsystem/pivot | src/client/client.cpp | //
// Created by wuyuncheng on 10/10/19.
//
#include "client.h"
#include <fstream>
#include <sstream>
#include <string>
#include <random>
#include <stack>
#include <infra/ConfigFile.hpp>
#include "libhcs.h"
#include "gmp.h"
#include <comm/Comm.hpp>
#include "../utils/util.h"
#include "../utils/pb_converter.h"
#include... | DATA | 0.985843 | 4.364358 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2021-07-18T11:16:30.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 27,
"forks": 7,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b5930298d7... |
6f08b956-c699-45fe-9d44-09d18d01eb62 | krishnakant2004/DSA | dsa1_1styear/tree/diameter.cpp | #include<iostream>
using namespace std;
typedef struct node{
int val;
struct node* left,*right;
}td;
class Solution {
public:
int longdiameter=0;
int diameterOfBinaryTree(td* root){
diameter(root);
return this->longdiameter;
}
int diameter(td* &root) {
if(root==nullptr){
... | ALGO | 0.9998 | 4.138562 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2025-05-07T09:52:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "80edd12d2946... |
74f89f58-e6d9-45bb-9cf5-c8df2e690b1c | PointCloudLibrary/pcl | surface/include/pcl/surface/on_nurbs/fitting_curve_2d_pdm.h | /*
* Software License Agreement (BSD License)
*
* Copyright (c) 2012-, Open Perception, Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code... | ALGO | 0.999764 | 6.535201 | {
"github_metadata": {
"branch": "master",
"commit_count": 14566,
"repo_created_at": "2013-02-12T16:40:25.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 10495,
"forks": 4656,
"issues": 432,
"pull_requests": 147
},
"file_meta": {
"content_id... |
ba13fcb9-799b-4857-8b13-092349d9b2fa | KoreaFriedChips/Competitive-Programming | COCI/'08 Contest 1/Ptice.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <string>
#include <map>
#include <queue>
using namespace std;
#define ll long long
#define pb push_back
#define ull unsigned long long
#define vi vector<int>
#define pii pair<int, int>
#define mp make_pair
#define endl '\n'
#define MO... | ALGO | 0.999986 | 3.895019 | {
"github_metadata": {
"branch": "master",
"commit_count": 37,
"repo_created_at": "2021-03-15T19:29:03.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "bc1dd80db... |
bf1f279d-1487-4a5e-a36c-d94bb2b6c259 | autolyticus/hpc | LabExercises/2/mult_block.cpp | #include <cstdlib>
#include <iostream>
#include <omp.h>
using namespace std;
int main() {
long double start, end, elapsed = 0.0;
int arr1[100][100];
int arr2[100][100];
int c[100][100];
#pragma omp parallel for
for (int i = 0; i < 100; i++) {
for (int j = 0; j < 100; j++) {
arr1[i][j] = rand() %... | ALGO | 0.999061 | 3.939456 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2018-08-08T17:47:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 8,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7a9602192e... |
4f3c014f-77b1-4160-9488-27fb337b9930 | HaochiBai1998/Leetcode | 387. First Unique Character in a String.cpp | //
// Created by bhc on 2022/2/8.
//
#include<utility>
#include<vector>
#include<iostream>
#include<algorithm>
#include<map>
#include<stack>
#include<set>
#include<queue>
using namespace std;
class Solution {
public:
//queue,当有重复,把队列前面所有重复数字踢掉
int firstUniqChar(string s) {
unordered_map<char, int> p... | ALGO | 0.999889 | 5.173975 | {
"github_metadata": {
"branch": "main",
"commit_count": 17,
"repo_created_at": "2022-01-17T10:33:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e02539524f8... |
101b5ab4-43f4-41c9-80d6-e2ae142f4d49 | orestischar/algorithms | 2nd Assignment/algo2_2.cpp | #include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <stack>
using namespace std;
vector<long int> tail;
vector<long int> bob_increasing(1,1);
vector<long int> bob_decreasing;
vector<long int> v;
int binary1(vector<long int>& v, long int l, long int r, long int key)
{
while (... | ALGO | 0.999969 | 3.928115 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2020-10-06T20:27:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "aa64a642274e... |
9e2c7eed-c79b-4f2f-b9f1-1ca0d5b9eede | famus2310/CP | Hackerrank/string/highestpal.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pair<int, int> > piii;
#define pb push_back
#define NeedForSpeed ios_base::sync_with_stdio(0), cin.tie(0)
#define PI acos(-1)
#define all(c) c.begin(), c.end()
#define SET(x, y) memset((x), y, sizeof(x))
con... | ALGO | 0.99998 | 3.688053 | {
"github_metadata": {
"branch": "master",
"commit_count": 19,
"repo_created_at": "2018-08-12T00:10:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1830fb153... |
494109ea-d423-47a1-b19b-360fb00faf61 | ArguetaE/Calculadora.cpp | Calculadora_con_N_opciones.cpp | #include <iostream>
#include <conio.h>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include<time.h>
#include<windows.h>
using namespace std;
//SUMA
void suma(){
system("cls");
float *p1;
float numero=0;
int conta=0;
float suma=0;
int num_de_usuario=0;
cout<<"Ingrese la cantidad de numeros a sum... | ALGO | 0.974203 | 3.066823 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2022-10-10T05:20:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f9b3a28bef6d... |
99cce93c-7f24-4006-b94d-1e6eda9d322e | alexandraback/datacollection | solutions_1484496_0/C++/cuiwei/main.cpp | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
using namespace std;
int tc, n, arr[21];
struct node {
int id;
long long val;
} f[1 << 21];
bool cmp(const node &a, const node &b) {
return a.val < b.val;
}
int main() {
freopen("D:\\C-small-attempt0.i... | ALGO | 0.999753 | 3.292647 | {
"github_metadata": {
"branch": "master",
"commit_count": 58,
"repo_created_at": "2017-03-08T11:33:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "00198523e... |
ff37d0f2-5b85-427c-bda1-fd90796d1e5a | kamyu104/LeetCode-Solutions | C++/count-substrings-divisible-by-last-digit.cpp | // Time: O(d * n)
// Space: O(d)
// case works, math, freq table
class Solution {
public:
long long countSubstrings(string s) {
int64_t result = 0;
vector<int> cnt;
// digit 1, 2, 5
for (int i = 0; i < size(s); ++i) {
if (s[i] == '1' || s[i] == '2' || s[i] == '5') {
... | ALGO | 0.998726 | 5.67594 | {
"github_metadata": {
"branch": "master",
"commit_count": 19395,
"repo_created_at": "2018-10-11T17:38:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4939,
"forks": 1616,
"issues": 1,
"pull_requests": 55
},
"file_meta": {
"content_id": ... |
caff1ef6-24f8-4759-9d62-f1760a3aebfa | JackLee404/CompetitivePrograming | HBCPC/Contest/f.cpp | #include <iostream>
#include <algorithm>
using namespace std;
typedef long long LL;
const int N = 1e6 + 10;
int main() {
int t;
cin >> t;
while (t --) {
LL n, m, a[N];
cin >> n >> m;
for (int i = 1; i <= n; i ++) {
cin >> a[i];
}
sort(a + 1, a + n + 1, greater<LL>());
LL now = 0, pir = 0;
for (i... | ALGO | 0.999941 | 3.388338 | {
"github_metadata": {
"branch": "main",
"commit_count": 67,
"repo_created_at": "2022-07-10T08:35:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2faa1e7e37d... |
25b4d016-11b0-47fd-8a75-a543cfc20122 | AndyWangSFU/Huffman-Encoding-Decoding | huff/PriorityQueue.h | /*
* PriorityQueue.h
*
* Description: Priority Queue
* Class Invariant: The elements stored in this Priority Queue are always sorted.
*
* Author: Inspired by <NAME> and <NAME> (textbook).
* Modified: February 2019
*
* Class Invariant: FIFO order
*
*
* Spring 2019 / CMPT-225 D200
* Created on: Februar 26 2... | ALGO | 0.997431 | 5.760446 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2019-09-05T21:09:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5123965f2b... |
7d255b41-5dec-464f-bd6f-fe4499af65cd | SystemOutGirlsAlgorithm/algorithm | 10월/2022-10-22/baekjoon_23305_진도.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <string>
#include <functional>
#include <string>
#include <queue>
#include <deque>
#include <stack>
#include <set>
#include <map>
#include <cmath>
#include <cstring>
#include <bitset>
#include <stdio.h>
#include <math.h>
#include <sstream>
#define xx ... | ALGO | 0.99988 | 3.050616 | {
"github_metadata": {
"branch": "main",
"commit_count": 2780,
"repo_created_at": "2022-03-22T10:41:57.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 16,
"forks": 38,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "a8e01904... |
86c14da3-a0ee-4ff4-a8a2-b196082921db | blei139/CarND-MPC-Project | src/MPC.cpp | #include "MPC.h"
#include <cppad/cppad.hpp>
#include <cppad/ipopt/solve.hpp>
#include "Eigen-3.3/Eigen/Core"
using CppAD::AD;
// Set the timestep length and duration
size_t N = 15; //5; //10; //20; //25; //15;
double dt = 0.1; //0.05; //0.1;
// Set cost factors
// Tune cost factors
int cost_cte_factor = 25; //35;... | ALGO | 0.999169 | 4.968615 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2017-06-20T04:33:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c029f4b841... |
17d4fba9-b0e8-4e74-a971-c2a64c965df6 | minakian/CarND-Kidnapped-Vehicle-Project | src/particle_filter.cpp | /*
* particle_filter.cpp
*
* Created on: Dec 12, 2016
* Author: <NAME>
*/
#include <random>
#include <algorithm>
#include <iostream>
#include <numeric>
#include <math.h>
#include <iostream>
#include <sstream>
#include <string>
#include <iterator>
#include "particle_filter.h"
using namespace std;
void Par... | ALGO | 0.976637 | 5.939243 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2017-05-30T03:30:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "564975a7c3... |
9143d011-615a-4582-8dd6-aa9409e2b107 | Tmbao/ImageRetrievalServer | core/query/query.h | #ifndef QUERY_H_INCLUDED
#define QUERY_H_INCLUDED
#include "../configurations.h"
#include "../app/appdata.h"
vector<double> computeAllScores(vector<double> qTfidf) {
AppData *app = AppData::getInstance();
vector<double> scores(app->ivt.nDocs);
for (int i = 0; i < app->ivt.nWords; i++) {
if (abs... | ALGO | 0.993585 | 5.107937 | {
"github_metadata": {
"branch": "master",
"commit_count": 41,
"repo_created_at": "2015-05-31T01:22:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "96c112170... |
7ea9cfa5-c47a-47bb-9381-32f558264d13 | sanjay09112/CODSOFT | TicTacToe.cpp | #include <iostream>
#include <string>
using namespace std;
void printBoard(char gameBoard[3][3]) {
cout << " | | " << endl;
cout << " " << gameBoard[0][0] << " | " << gameBoard[0][1] << " | " << gameBoard[0][2] << endl;
cout << "___|___|___" << endl;
cout << " | | " << endl;
cout << " "... | ALGO | 0.998581 | 7.464801 | {
"github_metadata": {
"branch": "main",
"commit_count": 15,
"repo_created_at": "2024-07-15T14:36:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1fac55808c6... |
dcfd975a-82dd-453e-a3e6-a50b41a67cc7 | ishandutta2007/codeforces-a | aropan/normal/914/C.cpp | #include <iostream>
#include <cstdio>
#include <cassert>
#include <ctime>
#include <cmath>
#include <cstring>
#include <string>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;
#ifdef LOCAL
#define dbg(x) cerr << #x " = " << x << endl;
#includ... | ALGO | 0.999944 | 4.359681 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2024-04-11T00:51:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0e7af2531d15... |
d0db4808-d39c-428d-a6c0-8fe2348b700b | vivekchaurasiya12/Data-Structure-Algo | String/largestOddNumberInString.cpp | #include <bits/stdc++.h>
using namespace std;
string largestOddNumberInString(string &str) {
if (str.empty()) return ""; // Handle empty string case
int index = -1;
// Traverse the string from right to left to find the rightmost odd digit
for (int i = str.size() - 1; i >= 0; i--) {
if ((str[... | ALGO | 0.999551 | 6.246507 | {
"github_metadata": {
"branch": "main",
"commit_count": 136,
"repo_created_at": "2024-10-03T18:46:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7b7d45f4e4... |
25fb6f51-75ef-45f7-9abe-5117e32d4426 | VladyslavStashkevych/lab4.7 | lab4.7/lab4.7/lab4.7.cpp | // lab4.7.cpp
// <<NAME>>
// Лабораторна робота № 4.7
// Обчислення суми ряду Тейлора за допомогою ітераційних циклів та рекурентних співвідношень.
// Варіант 19
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
int main() {
double xFirst, xLast, x, dx, eps, a, R, Sum;
int n = 1;
cout ... | ALGO | 0.999333 | 5.099656 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2021-10-12T21:58:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "059f85ebe802... |
5a731398-6c99-45fe-adf2-b59599f5ab9c | mlblewis/Stuff | DSA/Matrix.cpp | /*
<NAME>
Discrete Structures - Wuthrich
October 25,2016
The purpose of this program is to determine if the first 5 square matricies are
symmetric then with te next 5 pairs of matricies being square zero-one matricies
calculate the join of the pair of matricies.
*/
#include<iostream>
#include<fstream>
using namespace ... | ALGO | 0.997085 | 3.780541 | {
"github_metadata": {
"branch": "master",
"commit_count": 19,
"repo_created_at": "2016-10-25T19:24:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e4527789e... |
ec6e6c06-d330-408e-90ed-27ef20481c91 | Akhan521/Projects-Repository | Checkers/Project_1_Checkers/Checkers_Board_Basics_V2/main.cpp | /*
* File: main.cpp
* Author: <NAME>
* Created: Oct. 11, 2022, 11:00 AM
* Purpose: Version 2 - Creating the checkerboard pattern and
* adding functions.
*/
//System Libraries:
#include <iostream> //I/O Library.
#include <list> //Lists.
#include <ite... | TOOL | 0.906529 | 4.885297 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2022-01-24T02:54:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d7b565b2f7... |
6586479c-0451-4bc9-9a91-dac573623c21 | lleviackermann/CpCodes | codeforces/D_Attribute_Checks.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#define endl "\n"
#define fo(i, n) for (i = 0;... | ALGO | 0.999977 | 3.88401 | {
"github_metadata": {
"branch": "master",
"commit_count": 140,
"repo_created_at": "2023-04-28T10:03:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "337771fc... |
5e203737-db5e-484d-b26f-c8435c34e976 | WZSLYF/oi | usaco/2.1.2/2.1.2.cpp | #include <bits/stdc++.h>
using namespace std;
#define Rep(i, s, e) for(int i = s; i < e; ++i)
const int maxn = 3e4;
struct f {
int x, y;
inline bool operator < (const f& b) const{ return x*b.y < y*b.x; }
}dat[maxn];
int n, ans;
bool isEuq(const f& a, const f& b) {
return a.x * b.y == b.x * a.y;
}
int g... | ALGO | 0.999639 | 3.436497 | {
"github_metadata": {
"branch": "master",
"commit_count": 26,
"repo_created_at": "2019-07-14T16:15:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a79ec6c2a... |
841e640a-d818-4a61-be9d-d2d353d9e757 | AutumnKite/Codes | Codeforces/1423H Virus/std.cpp | #include <bits/stdc++.h>
class DSU {
std::vector<int> fa, sz;
std::vector<int> sta;
public:
DSU(int n) : fa(n), sz(n), sta(0) {
for (int i = 0; i < n; ++i) {
fa[i] = i;
sz[i] = 1;
}
}
int find(int x) {
return fa[x] == x ? x : find(fa[x]);
}
bool merge(int x, int y) {
x = find(x), y = find(y);
... | ALGO | 0.999844 | 4.519806 | {
"github_metadata": {
"branch": "master",
"commit_count": 683,
"repo_created_at": "2019-08-18T00:53:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3e240e40... |
a9f0134b-0439-4680-a665-d4653349bc2d | askbk/kattis | permutedarithmeticsequence/permutedarithmeticsequence.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
int N, M, m, input = 0, d = 0;
cin >> N;
while (N--) {
cin >> M;
m = M;
vector<int> seq;
while (m--) {
cin >> input;
seq.push_back(input);
}
d = seq[1] - seq[0];
for (size_t i = ... | ALGO | 0.998525 | 4.113348 | {
"github_metadata": {
"branch": "master",
"commit_count": 73,
"repo_created_at": "2017-03-22T21:18:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ebc360bfc... |
fe35257f-162d-4b69-a574-7a77babcf147 | biocro/biocro | src/module_library/c4photo.cpp | #include <cmath> // for pow, exp, std::abs
#include "ball_berry_gs.h" // for ball_berry_gs
#include "conductance_limited_assim.h" // for conductance_limited_assim
#include "../framework/constants.h" // for dr_stomata, dr_boundary
#include "../framework/quadratic_root.h" ... | ALGO | 0.999857 | 5.778575 | {
"github_metadata": {
"branch": "main",
"commit_count": 3739,
"repo_created_at": "2015-03-04T02:15:15.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 46,
"forks": 23,
"issues": 26,
"pull_requests": 5
},
"file_meta": {
"content_id": "6c0b701... |
27a7893a-35e4-484d-ab01-b2bdabaeaa60 | Ningsir/cuda-programming | cuda_mpi/parallelMatrixMul/main.cpp | #include <iostream>
#include <cuda.h>
#include <mpi.h>
#include "matrix.cuh"
using namespace std;
int main()
{
MPI_Init(NULL, NULL);
int size;
MPI_Comm_size(MPI_COMM_WORLD, &size);
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
int M = 256, N = 256, K = 256;
float *A, *B, *C;
A = (float *)malloc(sizeof(fl... | ALGO | 0.998009 | 4.321826 | {
"github_metadata": {
"branch": "main",
"commit_count": 22,
"repo_created_at": "2021-10-17T02:58:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e4444ab8953... |
71d7c2e9-893a-48f6-a4bf-fe3bf618dad4 | GitHubSeob/ThreeBeginners_AlgorithmStudy | 2021_08/week_4/KDK_10815.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int N, M;
cin >> N;
vector<int> v(N);
for (int i = 0; i < N; i++)
cin >> v[i];
sort(v.begin(), v.end());
cin >> M;
for (int i = 0; i <... | ALGO | 0.999995 | 4.179358 | {
"github_metadata": {
"branch": "main",
"commit_count": 437,
"repo_created_at": "2021-07-25T08:48:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "35ec982227... |
8cd5a785-ccd1-45ad-9a8b-256cf0ed27c1 | trivedipankaj/Data-Structures-and-Algorithms | ds/linkedlist/doubly_linked_list.cpp | /**
@author <NAME>
@desc Implementation of doubly linked list
@created Tuesday, 31-05-2011, 21:52
*/
#include<iostream>
using namespace std;
struct node{
int data;
node *prev;
node *next;
};
node *newNode(int data){
node *nn = new node;
nn->data = data;
nn->prev = N... | ALGO | 0.999784 | 5.269747 | {
"github_metadata": {
"branch": "master",
"commit_count": 92,
"repo_created_at": "2011-05-30T09:23:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1b17ae84a... |
d5260b19-39a3-44b9-a829-f7dc03c157c0 | cprypt/Baekjoon_Online_Judge | Class_2/11050.cpp | #include <iostream>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
// 동적 프로그래밍
int arr[11][11] = {0};
for (int i = 0; i <= 10; i++)
{
arr[i][0] = 1;
for (int j = 1; j < i; j++)
{
arr[i][j] = arr[i - 1][j -... | ALGO | 0.999951 | 4.735898 | {
"github_metadata": {
"branch": "main",
"commit_count": 34,
"repo_created_at": "2024-07-05T12:10:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "28b475fbd5c... |
d7de8f27-303f-48dc-a42d-1d42661b8388 | VictorSuret1/-EDD-Proyecto_202001767 | Fase2/arbolb.cpp | #include "arbolb.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <QProcess>
ArbolB::ArbolB() : raiz(nullptr) {}
ArbolB::~ArbolB() {
limpiar(raiz);
}
void ArbolB::insertarComentario(const QString& usuario, const QString& texto, const QDateTime& fechaHora) {
Comentario nuevoComentario(usua... | ALGO | 0.949448 | 5.690727 | {
"github_metadata": {
"branch": "main",
"commit_count": 10,
"repo_created_at": "2024-08-19T01:10:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f2f402cd352... |
074c4e9e-6107-415b-a247-004f9be1820f | hasnat0006/CP_SOLUTION | Codeforces/Random Round/Global Round/Global Round 28/D_Kevin_and_Competition_Memories.cpp | #pragma GCC optimize("O3")
#include <bits/stdc++.h>
#ifndef ONLINE_JUDGE
#include "D:\Documents\debug1.cpp"
#else
#define dbg(x...)
#define dbgc(x...)
#endif
using namespace std;
#define ll long long
#define vf(v) (v).begin(), (v).end()
#define vr(v) (v).rbegin(), (v).rend()
const ll mod = 1e9 + 7;
const ll inf = 1e1... | ALGO | 0.999942 | 3.651246 | {
"github_metadata": {
"branch": "main",
"commit_count": 188,
"repo_created_at": "2024-01-15T18:05:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b24bdf4b5b... |
ce7351be-e222-4daa-9670-34a92029aa4c | NelsonGomesNeto/Competitive-Programming | Online Judges/A2OJ/1500-1599 Ladder/369CValeraAndElections.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxN = 1e5; int n;
struct Road
{
int city; bool hasProblem;
bool operator<(const Road &a) const { return(hasProblem < a.hasProblem); }
};
vector<Road> graph[maxN];
/* Explanation:
While on a DFS, mark 1 on memo if the actual vertex (if it's connected to a pr... | ALGO | 0.999987 | 3.953405 | {
"github_metadata": {
"branch": "master",
"commit_count": 333,
"repo_created_at": "2019-08-07T17:50:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 10,
"forks": 5,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1ea0486... |
0adb000e-9421-4630-8aa9-abc1b22f46e9 | ZY-Null/begin_learning_cpp | leetcode/2594_repairCars.cpp | #include <bits/stdc++.h>
using namespace std;
/************************************************************************************************/
/* */
/* sulotions ... | ALGO | 0.999879 | 5.408505 | {
"github_metadata": {
"branch": "main",
"commit_count": 18,
"repo_created_at": "2023-08-27T04:02:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "eaf3cc84237... |
12ae0ba9-faf0-443e-8da7-ae8df078c8e6 | waly1029/Data-Structures-and-Algorithms | LeetCode/二叉树98.验证二叉搜索树.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.999986 | 6.228362 | {
"github_metadata": {
"branch": "master",
"commit_count": 46,
"repo_created_at": "2023-04-02T14:13:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a2516ac31... |
3684ece9-b40e-4683-ad4f-c4a662abfcbb | ordinarydennis/leetcode_dp_solutions | 55_Jump_Game.cpp | class Solution {
int dfs(int index, vector<int>& nums)
{
if (dp.count(index))
{
return dp[index];
}
if (nums.size() - 1 <= index)
{
return 0;
}
if (0 == nums[index])
{
return -1;
}
int min = INT_MAX;
for (int i = 1; i <= nums[index]; i++)
{
int result = dfs(index + i, nums);
... | ALGO | 0.999991 | 5.706655 | {
"github_metadata": {
"branch": "main",
"commit_count": 53,
"repo_created_at": "2024-09-14T06:41:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "97b353acb27... |
64e56c90-d5c2-42b2-88cb-5c4005900842 | dormi1010/private | AtCoder/ABC/ABC154/ABC154D.cpp | #include <bits/stdc++.h>
#define REP(i, n) for (long long i = 0; i < (long long)n; i++)
#define _GLIBCXX_DEBUG
using namespace std;
using ll = long long;
using Pi = pair<int, int>;
using Pl = pair<ll, ll>;
using Vecl = vector<ll>;
using Graph = vector<vector<int>>;
int main() {
cin.tie(0);
ios::sync_with_stdio(fal... | ALGO | 0.999349 | 3.543095 | {
"github_metadata": {
"branch": "master",
"commit_count": 72,
"repo_created_at": "2017-11-14T10:40:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "95c265862... |
4c3cba75-ec75-454a-a45f-044b50e19ac7 | ldcm3/Tech-Interview-Studies | Google/reverseLL.cc | #include <iostream>
using namespace std;
class LinkedListNode
{
public:
int value;
LinkedListNode* next;
LinkedListNode(int val):
value(val),
next(nullptr)
{}
~LinkedListNode()
{
delete next;
}
... | ALGO | 0.999602 | 5.880064 | {
"github_metadata": {
"branch": "master",
"commit_count": 51,
"repo_created_at": "2016-12-22T09:28:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7618b41c0... |
2caa0e53-a185-461b-ab0d-37a2c445e8c6 | singhAman05/blind_75 | Find All People With Secret.cpp | /*
In this solution i tried simple BFS but it gives TLE for large test cases
*/
class Solution {
public:
vector<int> findAllPeople(int n, vector<vector<int>>& meetings, int firstPerson) {
vector<pair<int,int>> adj[n];
for(auto it : meetings){
adj[it[0]].push_back({it[1],it[2]});
... | ALGO | 0.999985 | 5.136854 | {
"github_metadata": {
"branch": "main",
"commit_count": 65,
"repo_created_at": "2024-01-29T09:43:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0022a1e4a1b... |
70ac99ca-ce00-4de1-ad52-826a937c3cdb | Subrojyoti/Data-Structures-and-Algorithms | Sorting Algos/merge_sort.cpp | #include <iostream>
using namespace std;
template<class T>
void merge(T arr[], int, int);
template<class T>
void merge_sort(T arr[], int l, int r){
if(l < r){
int mid = l + (r - l)/2;
merge_sort(arr, l, mid);
merge_sort(arr, mid+1, r);
merge(arr, l, r);
}
}
template<class T>
vo... | ALGO | 0.999927 | 5.293735 | {
"github_metadata": {
"branch": "main",
"commit_count": 14,
"repo_created_at": "2024-03-30T15:26:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a4b14c5e876... |
1657455d-2168-4e4b-b373-ba23173f661a | peng-zhihui/Dummy-Robot | 2.Firmware/Core-STM32F4-fw/Robot/algorithms/kinematic/6dof_kinematic.h | #ifndef DOF6_KINEMATIC_SOLVER_H
#define DOF6_KINEMATIC_SOLVER_H
#include "stm32f405xx.h"
#include "arm_math.h"
#include "memory.h"
class DOF6Kinematic
{
private:
const float RAD_TO_DEG = 57.295777754771045f;
// DH parameters
struct ArmConfig_t
{
float L_BASE;
float D_BASE;
flo... | ALGO | 0.935599 | 6.034463 | {
"github_metadata": {
"branch": "main",
"commit_count": 34,
"repo_created_at": "2021-10-07T11:42:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 13680,
"forks": 2934,
"issues": 116,
"pull_requests": 5
},
"file_meta": {
"content_id": "3d... |
f246d179-7956-4cd7-a25a-45ebaa64f65e | lazydev01/365DayCPChallenge | lazydev01/day_370.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef ONLINE_JUDGE
#define cerr if(0) cerr
#endif
#define int long long int
#define endl "\n"
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
void increasing(){
int t;
cin >> t;
while(t--){
int n;
cin >> n;
vector<int> arr(n);
... | ALGO | 0.999914 | 4.563183 | {
"github_metadata": {
"branch": "main",
"commit_count": 1059,
"repo_created_at": "2022-12-18T09:37:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "21ada41c5... |
86ad17d3-833b-45b5-8815-69c3d330dd8c | 99002519/Notebook | C++/Modern_C++/References/20-Oct/code/banking.h | #ifndef __BANKING_H
#define __BANKING_H
class Banking {
std::list<Account> accounts;
public:
void addAccount(std::string, std::string, double);
void addAccount(const Account& ref);
void removeAccount(int id);
void displayAll();
Account* findById(int id);
double findAverageBalance();
Account* findAcco... | TOOL | 0.942034 | 4.750012 | {
"github_metadata": {
"branch": "main",
"commit_count": 31,
"repo_created_at": "2020-10-24T03:50:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 7,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "08c740265e0... |
f8f27549-6cb9-40de-82a5-3fef65db3c9b | ishandutta2007/codeforces-b | bluediamond/normal/1603/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define int ll
signed main() {
ios::sync_with_stdio(0); cin.tie(0);
// freopen ("input", "r", stdin);
int tt;
cin >> tt;
while (tt--) {
int n;
cin >> n;
bool bad = 0;
for (int i = 1; i <= n; i++) ... | ALGO | 0.99909 | 4.538419 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2024-04-11T01:05:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "87e9c99244e7... |
9fae3cb7-87b7-454a-a91a-c5c7fe9df169 | Aryan-Madaan/Data-Structures-and-Algorithm-Course | Course-1 Algorithmic Toolbox/Week 5/5_2_3_Edit_Distance.cpp | // Created by <NAME>.
//---------------------------------------------------------------------------------------------------
#include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
#define Expresso std::ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
#define ... | ALGO | 0.999984 | 4.168581 | {
"github_metadata": {
"branch": "main",
"commit_count": 97,
"repo_created_at": "2022-10-12T13:00:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "efeeec15947... |
dabd94ef-a662-4066-a3d2-5bde6265b6f6 | jose-dom/bitcoin_forecasting | env/lib/python3.9/site-packages/pystan/stan/lib/stan_math/stan/math/prim/scal/prob/rayleigh_lccdf.hpp | #ifndef STAN_MATH_PRIM_SCAL_PROB_RAYLEIGH_LCCDF_HPP
#define STAN_MATH_PRIM_SCAL_PROB_RAYLEIGH_LCCDF_HPP
#include <stan/math/prim/scal/meta/operands_and_partials.hpp>
#include <stan/math/prim/scal/err/check_consistent_sizes.hpp>
#include <stan/math/prim/scal/err/check_nonnegative.hpp>
#include <stan/math/prim/scal/err/... | ALGO | 0.95178 | 6.239335 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2021-01-04T01:45:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 12,
"forks": 12,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "54b3679a... |
2a90867f-a86d-4ff1-9f5d-b71460ef9a2b | nocodenolife3742/cp_template | math/fft.cpp | // work with M = 1e7, 998244353
using ll = long long;
typedef complex<double> cd;
typedef complex<long double> cld;
void fft(vector<cd> &a) {
int n = a.size(), l = 31 - __builtin_clz(n);
vector<cld> R(2, {1, 0});
vector<cd> rt(2, {1, 0});
for (int k = 2; k < n; k *= 2) {
R.resize(n), rt.resize(... | ALGO | 0.999982 | 5.389082 | {
"github_metadata": {
"branch": "master",
"commit_count": 46,
"repo_created_at": "2023-09-12T18:37:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cd67901e1... |
43473f9d-39ef-4747-8845-5c61208a6105 | qwebnm7788/algorithm | boj/2228.cpp | #include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int MAXN = 101;
const int INF = 2e9;
int memo[MAXN][MAXN];
int cost[MAXN][MAXN];
int number[MAXN];
int foo(int index, int left) {
if (left == 0) return 0;
if (left < 0 || index < 0)
return -INF;
int& ret = memo[index][left];
... | ALGO | 0.999977 | 3.420624 | {
"github_metadata": {
"branch": "master",
"commit_count": 10,
"repo_created_at": "2017-01-04T06:50:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "baf7a1a3d... |
af232fe4-2145-44a6-8441-0e190cfc8ffb | omkargaikwad23/CSE | CP_DSA/Algorithms/Functions/set.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int>vi;
#define test ll t; cin>>t; while(t--)
#define speed ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define loop(i, b) for (ll i = 0; i < b; i++)
#define iterate(x) for(auto i... | ALGO | 0.999523 | 3.597185 | {
"github_metadata": {
"branch": "master",
"commit_count": 10,
"repo_created_at": "2021-12-25T05:49:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f3ef2af91... |
64ba587e-ae3a-4285-b5b5-18f82b3904a8 | nipun0307/DSA-Stuff | bfs.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#define send freopen("in.txt", "r", stdin);
#define help freopen("out.txt","w", stdout);
using namespace std;
int n_=0;
void dfs(int node, vector<vector<int>>&adjList, vector<bool> &visited, stack <int> &stk){
if (vis... | ALGO | 0.999716 | 4.30823 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2021-08-05T13:11:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "95ddf21ed3... |
5e2ea9a5-0201-4050-85a5-778749bc16c7 | amarNetake/Dynamic-Programming-Practice-Work | 31. Minimum Palindromic Cut (Palindrome Partitioning)/code(O(N^3 slow solution).cpp | // Palindrome Partition OR Minimum Palindromic Cut
/*
Minimum cuts required to make all the partitions a palindrome
*/
// THIS IS A O(n^3) SOLUTION
int palindromicPartition(string str)
{
// code here
int n=str.length();
vector<vector<bool>> dp(n,vector<bool>(n,false));
for(int i... | ALGO | 0.999772 | 4.891176 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2021-07-26T11:55:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6d2535a5f6... |
5bcc1fbb-1c7d-4b5a-8653-3a733ee373cf | lichenk/AlgorithmContest | codeforces/201/C/C.cc | #include "bits/stdc++.h"
#include <assert.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define PB push_back
#define MP make_pair
const int MOD=1000000007;
#define endl "\n"
#define fst first
#define snd second
const int UNDEF = -1;
const ll INF=1e18;
template<typename T> inline bool chkmax(T &a... | ALGO | 0.999967 | 3.798297 | {
"github_metadata": {
"branch": "master",
"commit_count": 11,
"repo_created_at": "2018-07-29T03:21:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "33f95beff... |
f53fc751-8f64-4734-9b28-9459f0a274d6 | Sreyash19/DSA | 013_Linked_List/007_Floyds_Cycle_Detection.cpp | #include<iostream>
#include<map>
using namespace std;
class Node{
public:
int data;
Node* next;
Node(int d){
this->data = d;
this->next = NULL;
}
~Node(){
int value = this->data;
if(this->next != NULL){
delete next;
next = NULL;
}
... | ALGO | 0.999855 | 5.071666 | {
"github_metadata": {
"branch": "main",
"commit_count": 20,
"repo_created_at": "2023-07-31T09:08:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "971c71bd03e... |
c0cc118d-4b34-40cf-beb6-20c507bb3b6e | Pavelius/simwar | simwar/computer.cpp | #include "main.h"
const int ideal_safety = 2;
void playeri::computer_move() {
heroi* source[hero_max];
auto hero_count = heroi::select(source, lenghtof(source), this);
for(unsigned i = 0; i < hero_count; i++)
source[i]->make_move();
}
bool heroi::choose_units_computer(const actioni* action, const provincei* pro... | ALGO | 0.995798 | 4.998158 | {
"github_metadata": {
"branch": "master",
"commit_count": 148,
"repo_created_at": "2019-01-01T14:50:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d5889c37... |
a5e8df36-5590-4f24-9c34-aaf2ac2aff22 | LARG/regression-importance-sampling | gridworld/src/MathUtils.cpp | #include <Includes.hpp>
bool isReal(const double & x)
{
return ((!std::isnan(x)) && (!std::isinf(x)));
}
double dist(const double & x1, const double & y1, const double & x2, const double & y2)
{
return sqrt((x2 - x1)*(x2 - x1) + (y2 - y1)*(y2 - y1));
}
double distSquared(const double & x1, const double & y1, const... | ALGO | 0.998977 | 5.712955 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2019-04-29T16:14:22.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 8,
"forks": 5,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "e587dde9ff2... |
5233dd39-85f4-463e-8c47-bdec8076126e | manojloul/Leetcode | 641-design-circular-deque/641-design-circular-deque.cpp | class MyCircularDeque {
public:int size=0;
struct manu{
int val;
manu *next;
manu *prev;
manu():val(0),next(nullptr),prev(nullptr){}
manu(int x):val(x),next(nullptr),prev(nullptr){}
manu(int x,manu *t):val(x),next(t),prev(t){};
};
int len=0;
struct manu* h... | ALGO | 0.999422 | 5.530674 | {
"github_metadata": {
"branch": "main",
"commit_count": 1689,
"repo_created_at": "2022-05-16T13:46:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cd7214518... |
06eb5a0e-3186-43dc-9d58-7422fa87b7b6 | FabianWiebe/competitive-programming | c3/heist_planning/solution.cpp | #include <iostream>
#include <vector>
#include <fstream>
#include <utility>
#include <algorithm>
#include <iomanip>
#include <limits>
#include <cmath>
using namespace std;
struct Item {
int index;
int value;
int weight;
};
int main (void) {
// std::ios::sync_with_stdio(false);
// std::cin.tie(NULL);
/... | ALGO | 0.999931 | 3.490783 | {
"github_metadata": {
"branch": "master",
"commit_count": 31,
"repo_created_at": "2019-02-03T00:32:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0962afc09... |
4eaa6842-0cb1-4cc0-b765-ec3cdfdb74d2 | Vigneswar-A/LabPrograms | string_matching.cpp | #include <iostream>
using namespace std;
void naive_string_matching(string text, string pattern)
{
int n = text.length();
int m = pattern.length();
for (int i = 0; i < n - m + 1; i++)
{
int flag = true;
for (int j = 0; (j < m && flag); j++)
if (text[i + j] != pattern[j])
... | ALGO | 0.999954 | 5.088997 | {
"github_metadata": {
"branch": "master",
"commit_count": 4,
"repo_created_at": "2023-05-05T04:01:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "890b7b95df... |
1483f178-37c1-4057-a627-78a34fd9f782 | gupuerari/Programacao_Orientada_Objeto | Trabalho9_p2/Exercicio_1.cpp | #include <iostream>
#include <cmath>
#include <stdexcept>
using namespace std;
double divide(int num, int den) {
if (den == 0) {
throw invalid_argument("Divisor não pode ser zero.");
}
double quociente = double(num) / den;
if (abs(quociente) > 10000.0) {
throw overflow_error("... | ALGO | 0.988489 | 5.495797 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2025-05-30T00:33:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "192d6bc134b5... |
116b0ee0-4974-4140-911e-54e14d90f614 | BenjaminxBauer/Tetris | game.cc | /**************************************************************************
* game.cc
*
* Author: <NAME>
* Credit: The core of this program and set of files is built off of
* Professor Chelberg's notes lec11a, specifically his animate
* program, object.h object.cc, and square.h square.cc files
... | ALGO | 0.912321 | 3.93758 | {
"github_metadata": {
"branch": "main",
"commit_count": 11,
"repo_created_at": "2021-12-09T00:08:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "491ab7e10a3... |
f8c2deb9-fd85-44d0-800e-e7b00532ff4d | PhuNH/parprog | assignment3/x_conv_seq.h | #ifndef _X_CONV_SEQ
#define _X_CONV_SEQ
#include <iostream>
#include <vector>
#include <assert.h>
#include <cmath>
#include <png++/png.hpp>
using namespace std;
typedef vector<double> Array;
typedef vector<Array> Matrix;
typedef vector<Matrix> Image;
Image x_convolution(Image &image, Matrix &filter, int num_threads)... | ALGO | 0.965527 | 4.60045 | {
"github_metadata": {
"branch": "master",
"commit_count": 27,
"repo_created_at": "2018-10-20T13:01:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "58cbd48de... |
0a4f9a8d-2c3b-48de-87d2-b644ef416910 | ApolloAuto/apollo | modules/planning/planning_open_space/trajectory_smoother/iterative_anchoring_smoother.h | /******************************************************************************
* Copyright 2019 The Apollo Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
... | ALGO | 0.976526 | 4.838886 | {
"github_metadata": {
"branch": "master",
"commit_count": 19341,
"repo_created_at": "2017-07-04T19:03:31.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 25847,
"forks": 9793,
"issues": 895,
"pull_requests": 104
},
"file_meta": {
"content_id... |
26775ff7-6e68-4cb7-acea-15adc39ec4da | michaelyql/cp | cp4/complete-search/g-uva102.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = a; i < b; i++)
#define LSOne(S) ((S) & -(S))
#define all(x) (x).begin(), (x).end()
#define debug
#ifdef debug
#define db(x) cout << #x " = " << x << endl;
#define bp(x) cout << #x << endl;
#else
#define db(x)
#define bp(x)
#endif
us... | ALGO | 0.99989 | 3.850893 | {
"github_metadata": {
"branch": "main",
"commit_count": 120,
"repo_created_at": "2025-03-07T07:20:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "94fa55d06a... |
aca5302a-40b9-4ada-b02a-da62de1595ec | QuBenhao/LeetCode | problems/problems_LCR_007/Solution.cpp | //go:build ignore
#include "cpp/common/Solution.h"
#include <vector>
using namespace std;
using json = nlohmann::json;
class Solution {
public:
vector<vector<int>> threeSum(vector<int>& nums) {
vector<vector<int>> ans;
sort(nums.begin(), nums.end());
int n = static_cast<int>(nums.size());
for (int i = 0;... | ALGO | 0.996706 | 6.326599 | {
"github_metadata": {
"branch": "master",
"commit_count": 3931,
"repo_created_at": "2020-10-26T02:27:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 15,
"forks": 13,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "41960... |
97c49e95-2a12-4112-8a63-aaa24e351f8a | lge88/kb | lc/198-house-robber/house-robber.cc | #include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#include <iterator>
#include <algorithm>
using namespace std;
class Solution {
public:
// F(x) = max(F(x-2) + nums[x], F(x-1))
// Want: F(n... | ALGO | 0.999897 | 5.496502 | {
"github_metadata": {
"branch": "master",
"commit_count": 211,
"repo_created_at": "2016-09-01T06:48:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7eb12494... |
306db69d-16c4-467a-911a-f88e1c81dccc | N2-Sys/OmniWindow | Exp-2/include/sl-mv.h | #ifndef _SL_MV_SKETCH_H
#define _SL_MV_SKETCH_H
#include "MVSketch.h"
template<typename T, uint32_t d, uint32_t w>
class SlidingMV:public SketchBase<T> {
public:
MVSketch<T, d, w> mvNew;
MVSketch<T, d, w> mvOld;
int size = mvNew.width * d;
int head_i = 0, head_j = 0;
double threshold;
SlidingMV(d... | ALGO | 0.989444 | 4.037045 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2023-07-18T02:02:02.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 6,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e49291019e961... |
00f034cd-83aa-4820-82bb-6181e20fc6fb | niteshydv01/Data-Structure-Algorithm | 1605-minimum-number-of-days-to-make-m-bouquets/1605-minimum-number-of-days-to-make-m-bouquets.cpp | class Solution {
public:
bool possible(vector<int>& arr, int day, int m, int k) {
int cnt = 0, noOfB = 0;
for (int i = 0; i < arr.size(); i++) {
if (arr[i] <= day) {
cnt++;
if (cnt == k) {
noOfB++;
cnt = 0;
... | ALGO | 0.999998 | 5.855238 | {
"github_metadata": {
"branch": "main",
"commit_count": 1227,
"repo_created_at": "2024-02-26T20:47:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7c56414bb... |
c79ec359-4bcd-4ec7-96b9-6f6694eabcf7 | packmani/toi-posn-com-guide | toi20/toi20_tour/toi20_tour.cpp | //TOI20-Tour
//sol แบบไม่ควรจะถูกต้อง
#include <bits/stdc++.h>
#define S second
#define F first
typedef long long ll;
using namespace std;
using pll = pair<ll,ll>;
vector<tuple<int,int,int>> g[200000];
int n, m, l, x, u, v, s, w;
vector<pll> Px, P_y;
void dfs(int u, ll ff, ll ss){
if(u == n-1){Px.emplace_back(ff, s... | ALGO | 0.99995 | 4.253576 | {
"github_metadata": {
"branch": "main",
"commit_count": 365,
"repo_created_at": "2024-06-26T10:30:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 11,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ca0f7b303... |
642b663d-7c46-4a15-b9e7-85c0af34282a | 130-SanaAsif/DSA-Practice | TCS-NQT/Interview/3.cpp | #include<iostream>
using namespace std;
void printArray(int arr[], int n){
for(int i=0; i<n; i++){
cout<<arr[i]<<" ";
}
cout<<endl;
}
void Approach1(int arr[], int n){
int cnt=0;
for(int i=0; i<n; i++){
if(arr[i] == 0){
cnt++;
}
}
for(int i=0; i<cnt; i... | ALGO | 0.999962 | 4.408224 | {
"github_metadata": {
"branch": "master",
"commit_count": 464,
"repo_created_at": "2022-10-20T08:39:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ab0bc8aa... |
42bdef57-e54f-442c-8a00-9bab5789b46b | Tianyu-Huang-letsgo/Leecode | Tree/rightSideView.cpp | #include <iostream>
#include <stdio.h>
#include <vector>
#include <queue>
using namespace std;
// 二叉树的右视图
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(nullptr), right(nullptr) {}
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
TreeNode(int x,... | ALGO | 0.999746 | 5.600116 | {
"github_metadata": {
"branch": "main",
"commit_count": 30,
"repo_created_at": "2024-08-05T08:59:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "49218493c4c... |
464b89bc-689e-42bf-a3b3-6262a0d34419 | GreatGameDota/leetcode-challenges | medium/max-area-of-island/solution.cpp | class Solution
{
public:
int maxAreaOfIsland(vector<vector<int>> &grid)
{
int maxNum = 0;
for (int i = 0; i < grid.size(); i++)
for (int j = 0; j < grid[0].size(); j++)
if (grid[i][j] == 1)
maxNum = max(maxNum, dfs(grid, i, j));
return maxN... | ALGO | 0.999911 | 6.013531 | {
"github_metadata": {
"branch": "master",
"commit_count": 410,
"repo_created_at": "2021-08-16T17:38:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "171bcd49... |
3049d172-c72d-4290-a945-f7c1371ba172 | ericdunipace/causalOT | src/optimizer_functions.cpp | #include "causalOT_types.h"
#include "utils.h"
//Entropy Balancing Weights
//[[Rcpp::export]]
double entBW_obj_(const SEXP & vars_,
const SEXP & A_,
double delta) {
// map R types to Eigen types
const vecMap beta_const(Rcpp::as<vecMap>(vars_));
const matMap A(Rcpp::as<ma... | ALGO | 0.996002 | 5.278639 | {
"github_metadata": {
"branch": "master",
"commit_count": 526,
"repo_created_at": "2019-12-29T07:11:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 7,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b14453b1... |
2fd532e4-2bf4-4d2d-b2ea-bc5a6bc73e99 | ankit-singh-dungriyal/Coding | Codeforces/29D_ Ant on the Tree.cpp | // <NAME> the Tree (Codeforces Beta Round #29 (Div. 2, Codeforces format))
// Concept used : dfs
// 'By Anki'
#include<bits/stdc++.h>
// #include<iostream>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
#define pb push_back
#define mp make_pair
#define wr(i) cout<<#i<<" = "<<i<<", ... | ALGO | 0.999931 | 3.749158 | {
"github_metadata": {
"branch": "master",
"commit_count": 593,
"repo_created_at": "2020-05-13T17:12:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "95734654... |
8d867a72-9492-4d5e-b0ac-38d363ff2f98 | bendova/3DMath | Chapter4_Transformations/src/intersection2d/PolygonIntersection.h | #ifndef _MY_CODE_INTERSECTION_2D_POLLIGON_INTERSECTION_H_
#define _MY_CODE_INTERSECTION_2D_POLLIGON_INTERSECTION_H_
#include <vector>
#include <glm/glm.hpp>
#include "vectormath/DataTypes.h"
namespace MyCode
{
namespace Intersection2D
{
namespace PolygonIntersection
{
bool DoPolygonsIntersect2D(const std::ve... | ALGO | 0.984809 | 6.268118 | {
"github_metadata": {
"branch": "master",
"commit_count": 30,
"repo_created_at": "2015-04-12T07:41:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "00eee5fee... |
ecf525a3-127d-4e21-b612-e9c796f43b76 | danillsmagin/SecondLab | main.cpp | #include <cmath>
#include <complex>
#include <conio.h>
#include <iostream>
#include <istream>
#include <windows.h>
using namespace std;
class Complex {
private:
double real, imag;
public:
Complex() {// конструктор по умолчанию
this->real = 0;
this->imag = 0;
}
Complex(double r, doubl... | ALGO | 0.956283 | 3.201562 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2022-11-19T20:11:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0a8d874b9345... |
17ec32f5-dd18-46c9-9e3f-1861e427539f | archishmanghos/DSA-Contests | Interviews/LeetCode/Random-problems/Medium/Cheapest-Flights-Within-K-Stops/787.cpp | int findCheapestPrice(int n, vector<vector<int>>& flights, int src, int dst, int k) {
vector<vector<int>> adj[n];
for (auto edge : flights) {
int u = edge[0], v = edge[1], wt = edge[2];
adj[u].push_back({v, wt});
}
priority_queue<vector<int>, vector<vector<int>>, greater<vector<int>>> p... | ALGO | 0.999721 | 4.979706 | {
"github_metadata": {
"branch": "master",
"commit_count": 2328,
"repo_created_at": "2021-08-03T05:06:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "61b751b... |
5d7c802b-7c66-4605-be2f-d953c30ff088 | ShreyashiBansal/LEETCODE-JULY-2021 | Count Vowels Permutation.cpp | class Solution {
const int MOD = 1e9 + 7;
const unordered_map<char, vector<char>> mappings{ {'s', {'a', 'e', 'i', 'o', 'u'} }, // start
{'a', {'e'} },
{'e', {'a', 'i'} ... | ALGO | 0.999909 | 6.43491 | {
"github_metadata": {
"branch": "main",
"commit_count": 21,
"repo_created_at": "2021-07-03T17:56:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "abf9043e54a... |
dd8f71eb-3c72-4b8b-97d8-97687811e85b | busybus/2017 | evaluation/sub_03/AI_MY.hpp |
// Author: <NAME>
// License: CC BY 4.0
#pragma once
#include <map>
#include <limits>
#include <random>
#include <cstdint>
#include <cassert>
#include <numeric>
#include <algorithm>
#include <functional>
struct AI_MY : public Strategy {
using Plan_t = std::uint8_t;
using Fitness_t = unsigned;
using Indi... | ALGO | 0.999917 | 5.454195 | {
"github_metadata": {
"branch": "master",
"commit_count": 27,
"repo_created_at": "2016-12-04T17:22:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 3,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "254f11888... |
614d50fd-4755-4fcf-899d-5e258ca36597 | ishandutta2007/codeforces-g | gisp_zjz/normal/1662/C.cpp | #include<bits/stdc++.h>
using namespace std;
const int M=998244353;
int n,m,k,d[105],G[105][105],L;
void add(int &x,int y){x+=y;if (x>=M)x-=M;}
void sub(int &x,int y){x-=y;if (x<0) x+=M;}
struct mat{
int a[205][205];
void init(){
for (int i=1;i<=n*2;i++)
for (int j=1;j<=n*2;j++)
... | ALGO | 0.999961 | 4.105524 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T01:55:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ed5d2ee2c195... |
8c6706b3-8f8b-4faa-8554-f199dab965e5 | mrkooshaj/My-Codes | Data_Structures_And_Algorithms/Hash/String_Hash.cpp | #include <iostream>
#define BASE 761
using namespace std;
int hashltr[2000001];
int hashrtl[2000001];
int basepowers[2000001];
int ceil2 (int n)
{
return (n+1) / 2;
}
int floor2 (int n)
{
return n/2;
}
inline int hashleft(int i,int j)
{
int s1 = hashltr[j];
int s2 = hashltr[i];
s2 = s2 * ba... | ALGO | 0.999868 | 3.564618 | {
"github_metadata": {
"branch": "master",
"commit_count": 20,
"repo_created_at": "2018-10-23T18:58:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fc9b50276... |
cefa1814-e9aa-45d0-a95f-5a120d5e72b6 | yingsw79/algorithm | 数据结构/线段树/普通线段树/区间修改/acwing243.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define lowbit(x) (x & (-x))
typedef long long LL;
typedef unsigned long long ULL;
typedef pair<int, int> PII;
const int INF = 0x3f3f3f3f, MOD = 1e9 + 7;
// https://www.acwing.com/problem/content/244/
const int N = 100010;
int a[N], n, m;
struct Node {
... | ALGO | 0.999844 | 5.853575 | {
"github_metadata": {
"branch": "master",
"commit_count": 129,
"repo_created_at": "2024-05-21T08:43:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5b78f6e6... |
da61f7f6-c313-4e1b-8b0e-91ec70f012ac | ShreyasDatta/DSA | Linked List/SinglyLinkedList/loopDetection.cpp | #include<iostream>
using namespace std;
class Node{
public:
int data;
Node* next;
Node(int val){
data = val;
next=NULL;
}
};
void insertEnd(Node** head, int value){
Node* newNode = new Node(value);
Node* temp = *head; ... | ALGO | 0.999815 | 5.045511 | {
"github_metadata": {
"branch": "master",
"commit_count": 88,
"repo_created_at": "2022-10-31T17:58:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0e4ab726a... |
9b0d6faa-91b3-4023-ac37-c89be4d1f9f0 | jschleic/simple-STORM | gui/stormprocessor.h | /*
* Copyright (C) 2011 <NAME> <<EMAIL>>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is... | ALGO | 0.962149 | 5.673097 | {
"github_metadata": {
"branch": "master",
"commit_count": 190,
"repo_created_at": "2011-11-08T12:51:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 8,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ef356405... |
7e1ac780-5b9b-4519-942e-833b1632d778 | SandyLee-00/ProblemSolving_Baekjoon-Programmers | 백준/Gold/13549. 숨바꼭질 3/숨바꼭질 3.cc | // 13549번 숨바꼭질 3
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
/*
bfs로 매 초마다 이동하기
*2 할 때는 시간 추가 안하고 큐에 넣기
큐에 넣을 때 모든 *2에다가 큐 넣기
*/
const int MAX = 100005;
bool vis[MAX];
int main() {
ios_base :: sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
int N; cin >> N;
int K; cin >> K;
deque<p... | ALGO | 0.999947 | 3.834688 | {
"github_metadata": {
"branch": "main",
"commit_count": 342,
"repo_created_at": "2022-09-02T07:32:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5740a1f170... |
a2aaa597-920e-4308-bad6-0522c835e9f9 | ruihangdu/map_gui | Graph.cpp | #include "Graph.h"
void swap(vector<Vertex *> &v, int a, int b) {
Vertex *temp = v[a];
v[a] = v[b];
v[b] = temp;
}
void Graph::parseDataFromFile(string filename) {
ifstream fin(filename, ios::in);
if (!fin) {
cout << "Cannot open file" << endl;
exit(1);
}
string buffer;
int startNode, endNode, ed... | ALGO | 0.972276 | 3.769716 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2017-02-16T14:17:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b3a957e6eb... |
04857df0-5667-445a-b27c-e367976fd45d | Devchawla2608/DP | Q42(printLIS).cpp | // Longest Increasing Subsequence
// Given an integer array nums, return the length of the longest strictly increasing
// subsequence
// Link -> https://leetcode.com/problems/longest-increasing-subsequence/
int lengthOfLIS(vector<int>& nums) {
int n = nums.size();
vector<int> dp(n , 1);
... | ALGO | 0.999973 | 5.5767 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2023-08-24T13:29:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "09b6dc1e58... |
af870cfc-0977-4803-b17c-63a2b79012dd | Nithishkumar654/CrackYourPlacement | Day_1/setMatrixZeroes.cpp | class Solution {
public:
void setZeroes(vector<vector<int>>& matrix) {
int n = matrix.size(), m = matrix[0].size();
int row = 0, col = 0;
for(int i = 0; i < n; i++){
for(int j = 0; j < m; j++){
if(matrix[i][j] == 0){
if(i == 0) row = 1;
... | ALGO | 0.999406 | 6.394111 | {
"github_metadata": {
"branch": "master",
"commit_count": 17,
"repo_created_at": "2024-07-29T16:58:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "32af7eb3d... |
85e24a73-de82-4dd2-8a1d-7b65a880fe9f | ChaissonLab/SegDupAnnotation | CountN.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
int nl=0, nh=0, other=0;
vector<int> low(256,0), high(256,0);
string prevTitle = "";
while (cin) {
string line;
cin >> line;
if (line.size() > 0 and line[0] == '>') {
if (prevTitle != "") {
int s=nl+nh;
if (s ... | ALGO | 0.979488 | 3.06861 | {
"github_metadata": {
"branch": "master",
"commit_count": 230,
"repo_created_at": "2020-01-31T00:23:47.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 9,
"forks": 2,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "6cd2e1a44... |
7de4ca6b-81b6-4116-82c9-90a4827eb192 | vianney6364/Virtual_Ecotroph_Dynamic | FUNCTIONS/dyn_dispatch_prod_rect_morta.cpp | #include <Rcpp.h>
using namespace Rcpp;
// This is a simple example of exporting a C++ function to R. You can
// source this function into an R session using the Rcpp::sourceCpp
// function (or via the Source button on the editor toolbar). Learn
// more about Rcpp at:
//
// http://www.rcpp.org/
// http://adv-r.ha... | DATA | 0.98249 | 5.535481 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2023-08-23T18:16:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5953b9aab914... |
ce4bd8fe-4c66-499e-8359-d28e4bf8cceb | Geant4/geant4 | source/processes/electromagnetic/utils/src/G4EmBiasingManager.cc | //
// ********************************************************************
// * License and Disclaimer *
// * *
// * The Geant4 software is copyright of the Copyright Holders of *
// * the Geant4 Collaboration... | ALGO | 0.945487 | 6.029144 | {
"github_metadata": {
"branch": "master",
"commit_count": 83,
"repo_created_at": "2016-06-21T08:25:54.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 705,
"forks": 340,
"issues": 0,
"pull_requests": 2
},
"file_meta": {
"content_id": "67950f... |
b8118f7b-3835-4b9e-abc9-a051b6e2225c | KarlRixon/nuaa_cg | examples/matrix/src/test_matrix.cpp | #include <cstdlib>
#include <iostream>
#include "Matrices.h"
#include "Timer.h"
using namespace std;
int main(int argc, char *argv[])
{
Matrix4 m1, m2;
m1.set(2,-1,0,0, 1,2,5,0, 1,0,4,0, 3,1,2,1);
m2 = m1;
cout << "ORIGINAL\n";
cout << m1;
cout << "\nDET: " << m1.getDeterminant() << endl;
... | ALGO | 0.953286 | 4.846784 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2018-10-03T15:39:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 14,
"forks": 11,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "86bc84bf... |
ec161f0d-fb3f-482c-98ed-78136d033fa5 | mechiragjain/Data-Structure-Algorithms | Tree/19 - Foldable Binary Tree.CPP | /*Given a binary tree, check if the tree can be folded or not. A tree can be folded if left and right subtrees of the tree are structure wise same. An empty tree is considered as foldable*/
#include <bits/stdc++.h>
using namespace std;
// Tree Node
struct Node {
int data;
Node *left;
Node *right;
No... | ALGO | 0.99994 | 5.921843 | {
"github_metadata": {
"branch": "master",
"commit_count": 44,
"repo_created_at": "2020-04-24T09:14:56.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "65a237568... |
d923ed88-9532-45af-876e-7b3fd7c5b94b | albercol/FAL-Fundamentos_de_algoritmia | Soluciones/Problema39CurvaConcava.cpp | #include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
using namespace std;
/*
T(n) = C1 n == 1, T(n/2)+C1 n>1
C1+ C1+T(n/2^2) ; C1 + C1 + C1 + T(n/2^3)....
K*C1 + T(n/2^k) -----> n/2^k = 1 ; log n = k;
C1*log (n) + T(1) ----> Por lo que pertenece al orden de O(log(n))
*/
// función que resuelv... | ALGO | 0.999951 | 4.906851 | {
"github_metadata": {
"branch": "main",
"commit_count": 110,
"repo_created_at": "2021-11-22T15:37:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5ad07ece6d... |
b171ca35-f7a5-4a1d-8f63-f8eb91a303ee | alexandraback/datacollection | solutions_5744014401732608_0/C++/rofi/B.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <utility>
#include <list>
#include <functional>
#include <cstdlib>
#include <cmath>
#include <map>
#include <set>
#include <sstream>
#include <iterator>
#include <stack>
#include <queue>
#include <numeric>
using namespace std;
#def... | ALGO | 0.999895 | 4.290151 | {
"github_metadata": {
"branch": "master",
"commit_count": 58,
"repo_created_at": "2017-03-08T11:33:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "74ab80a17... |
dc090ab4-be54-41a2-9ad5-fe8162571cfe | Erwin-c/algorithm | LeetCode/StackSolution.cc | /*
* StackSolution.cc
*
* Author: Erwin
*/
#include <LeetCode/StackSolution.h>
#include <cassert>
#include <stack>
bool StackSolution::isValid(std::string s) {
std::stack<char> stack;
for (size_t i = 0; i < s.size(); ++i) {
if (s[i] == '(' || s[i] == '{' || s[i] == '[') {
stack.push(s[i]);
} ... | ALGO | 0.901574 | 6.859215 | {
"github_metadata": {
"branch": "main",
"commit_count": 212,
"repo_created_at": "2021-01-10T10:40:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6fd5db7735... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.