uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
d26c9015-62ec-4e54-ac5b-c7e31946097d | smartbch/cpu-roaster | src/1900_KruskalMST.cpp | // C++ program for Kruskal's algorithm to find Minimum Spanning Tree
// of a given connected, undirected and weighted graph
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "include/util.h"
#include "include/tracer.h"
#define V_COUNT (100*1024)
#define ITER_COUNT 50
// a structure to represent a w... | ALGO | 0.999938 | 5.049032 |
d0779978-0940-49e6-9f56-b13bb7e96a92 | yangyuyueYY/data_structure | 101、求两个数的最大公约数和最小公倍数,要求用递归算法实现.cpp | /*
* ԼСҪõݹ㷨ʵ
*/
#include <stdio.h>
/*
* ݹԼ
* @param int m
* @param int n
* @return int Լ
*/
int maxyue(int m,int n)
{
int x;
if(m % n == 0){
return n;
}else{
x = m%n;
m = n;
n = x;
return(maxyue(m,n));
}
}
int main()
{
int m,n,t;
printf(":");
scanf("%d%d",&m,&n);
if(m<n){
t = m;
m = n;
... | ALGO | 0.999777 | 3.086039 |
60a40e3e-1e9c-4a75-b46c-8ba9b9dbbdc7 | SerbanL/BORIS | Boris/Atom_DiffEqCubic_Evals_RKF.cpp | #include "stdafx.h"
#include "Atom_DiffEqCubic.h"
#ifdef MESH_COMPILATION_ATOM_CUBIC
#ifdef ODE_EVAL_COMPILATION_RKF45
#include "Atom_Mesh_Cubic.h"
#include "SuperMesh.h"
#include "Atom_MeshParamsControl.h"
//--------------------------------------------- RUNGE KUTTA FEHLBERG (4th order solution, 5th order error)
vo... | ALGO | 0.999965 | 5.439213 |
0f07a9b3-706c-43e6-9e90-7b030bd97025 | BEaANIKET/365-Days-of-code-challenge | 1.leedcode/easy/1528. Shuffle String.cpp | class Solution {
public:
string restoreString(string s, vector<int>& indices) {
string str(s.length(),'X');
for(int i=0;i<indices.size();i++){
str[indices[i]]=s[i];
}
return str;
}
}; | ALGO | 0.99922 | 5.696871 |
eaf06397-d039-4cd9-8cf9-11f9622181ea | DHRUVSHARM/CPP_codes | connected_horses.cpp | /*
Connected Horses
Send Feedback
You all must be familiar with the chess-board having 8 x 8 squares of alternate black and white cells. Well, here we have for you a similar N x M size board with similar arrangement of black and white cells.
A few of these cells have Horses placed over them. Each horse is unique. Now t... | ALGO | 0.999685 | 4.855392 |
39de8f9e-57a8-429f-8b9e-b72621110449 | renosang/build | tools/ziptime/ZipFile.cpp | //
// Access to Zip archives.
//
#include "ZipFile.h"
#include <memory.h>
#include <sys/stat.h>
#include <errno.h>
#include <assert.h>
#include <inttypes.h>
using namespace android;
#define LOG(...) fprintf(stderr, __VA_ARGS__)
/*
* Open a file and rewrite the headers
*/
status_t ZipFile::rewrite(const char* zip... | TOOL | 0.872461 | 6.234113 |
b588ca95-1d72-4eb3-a9e1-fd66bada3672 | raincross7/code-similarity | codes/train_code/problem340/problem340_368.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
#define REP(i, a, b) for(int i = a, i##_len = (b); i < i##_len; ++i)
int main()
{
int N,A,B;
scanf("%d %d %d", &N, &A, &B);
int num[3] = {0,0,0};
for(int i = 0; i < N; ++i) {
int p;
scanf("%d", &p);
if(p <= A) ++... | ALGO | 0.999863 | 3.63617 |
9f18d964-1745-4bf2-bcca-80a684b73b94 | matthewloden/practiceInterviewQuestions | medianOfTwoSortedArrays.cpp | #include <iostream>
using namespace std;
int findMedian(int nums1[],int nums2[],int length1, int length2){
int mergedArray[length1 + length2];
int i = 0, j = 0, k = 0;
while( i < length1 && j < length2){
if(nums1[i] < nums2[j]){
mergedArray[k] = nums1[i];
k++;
... | ALGO | 0.99999 | 5.148866 |
3e2c0b3f-d0f2-4bed-87ac-7479326139cb | AppLoidx/vtalgo_2020 | base_leetcode/905.cpp | class Solution {
public:
vector<int> sortArrayByParity(vector<int>& A) {
int leftIndex = 0;
int rightIndex = A.size() - 1;
while (leftIndex < rightIndex) {
if (A[leftIndex] % 2 != 0) {
swap(A[leftIndex], A[rightIndex]);
--rightIndex;
} ... | ALGO | 0.999992 | 5.703387 |
5fe790f8-477e-467d-af1d-2cc736cf8339 | ishandutta2007/codeforces | rush_d_cat/normal/549/A.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <set>
using namespace std;
typedef long long LL;
int n, m;
char s[52][52];
set<int> st;
int chk(int x, int y)
{
set<int> tmp;
tmp.insert(s[x][y]); tmp.insert(s[x][y+1]); tmp.insert(s[x+1][y]); tmp.insert(s[x+1][y+1]);
if (t... | ALGO | 0.99966 | 3.800318 |
53da6607-4900-402f-bb69-a79994e9e449 | bschulz81/robustregression | library/src/linearregression.cpp | #include <vector>
#include <valarray>
#include <omp.h>
#include <algorithm>
#include "lossfunctions.h"
#include "linearregression.h"
#include "statisticfunctions.h"
using namespace std;
ROBUSTREGRESSION_API bool Linear_Regression::linear_regression(const valarray<double>& x, const valarray<double>&y, Linear_Regressi... | ALGO | 0.999045 | 5.540154 |
7f222434-fdb3-4611-9687-3ae9e9549b8b | ilot12/algorithm-practice | programmers-algokit/05. bruteForce/problems/problem6/problem6.cpp | #include <string>
#include <vector>
#include <queue>
#include <iostream>
using namespace std;
class Graph {
private:
int vertex;
vector<vector<int>> adjList;
vector<bool> visited;
vector<vector<int>> wiresVec;
void makeAdjList(vector<vector<int>> wires) {
for (vector<int> wire : wires... | ALGO | 0.999629 | 5.289871 |
cd210784-7564-4f51-ae57-bb495c66b2fb | Ramangupta6117/leetcode | 0229-majority-element-ii/0229-majority-element-ii.cpp | class Solution {
public:
vector<int> majorityElement(vector<int>& nums) {
int n = nums.size();
int ele1 = -1;
int ele2 = -1;
int count1 = 0;
int count2 = 0;
for(int ele : nums){
if(ele1 == ele){
count1++;
}
else if... | ALGO | 0.999978 | 5.558746 |
5f5de3f3-0961-46e1-afa4-2b9d7640202b | zxyDEDIRE/ACM_CODE | CodeForces/Codeforces Round 792 (Div. 1 + Div. 2)/c.cpp | #include<bits/stdc++.h>
using namespace std;
using ll=long long;
using pii=pair<int,int>;
const int maxn=1e6;
vector<pii>v[maxn];
int q[maxn];
int n,m;
bool cmp(vector<pii>a,vector<pii>b)
{
for(int i=0;i<n;i++)
{
if(a[i].first==b[i].first)continue;
else return a[i].first<b[i].first;
}
return 0;
}
void solve()
{... | ALGO | 0.99988 | 3.403913 |
8ed04ad3-649e-47c6-9d37-25aa6accf67b | ishandutta2007/codeforces | wxhtzdy/normal/1594/A.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
... | ALGO | 0.999549 | 4.17037 |
455a3295-fbdb-4019-89ba-1da90aa54fbf | chandrasainadhreddy/CSA5175-CRYPTOGRAPHY | 31.subkey generation in CMAC, it states that the block cipher is applied to the block that consists entirely of 0 bits.cpp | #include <stdio.h>
#include <stdint.h>
#define BLOCK_SIZE_128 16 // 128-bit block size
#define BLOCK_SIZE_64 8 // 64-bit block size
// Constants for 128-bit and 64-bit block sizes
#define CONSTANT_128 0x87 // 0x87 for 128-bit block size
#define CONSTANT_64 0x1b // 0x1b for 64-bit block size
// Function to per... | ALGO | 0.99762 | 6.494573 |
0fa5dfcb-9c42-41a2-91bc-9cd8d977039c | ishandutta2007/codeforces | vkgainz/normal/1207/A.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define s second
#define f first
#define vi vector<int>
#define vvi vector<vector<int>>
#define pb push_back
#define mp make_pair
const int MX = 1e5+5;
int dp[101][101][101];
int main() {
int t; cin >> t;
while(t--) {
int b, p, f; cin >> b >> p >... | ALGO | 0.999556 | 3.449066 |
e0d4cfef-9f2c-4a56-9c24-2f0d009d7b3a | Manoj-T-V/DSA | merge-sorted-array/merge-sorted-array.cpp | class Solution {
public:
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
vector<int> ans;
for(int k=0;k<m;k++)
{
ans.push_back(nums1[k]);
}
nums1.clear();
int i =0, j=0;
while(i<m && j< n)
{
if(ans[i]<nums2[j])
... | ALGO | 0.999941 | 5.1497 |
7aca216d-c384-40c0-8907-a33e6adf6721 | Drehrumbum/viterbi.dll | dllmain.cpp | #include "viterbi.h"
extern LONG WINAPI VecExceptionHandler(PEXCEPTION_POINTERS);
extern void SetupDLL();
// LUT pointer for Reed-Solomon
RS_LookUp* rsLUT;
// Experimental export. Powering up the 256-bit SIMD stages in advance.
// Can be called by QIRX right before 256-bit code should be executed.
// The procedure d... | ALGO | 0.968112 | 4.753205 |
56efd8bc-c54a-495b-a45a-d6ebf0cb552f | Leo-Development/world_talk | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
a61822db-90b9-454d-a624-cf2bc15015f2 | Ramkumar6103/dsa | scoreOfString.cpp | #include <iostream>
#include <string>
#include <cmath>
using namespace std;
class Solution {
public:
int scoreOfString(string s) {
short result = 0;
for (int i = 1; i < s.size(); i++) {
result += abs(s[i] - s[i - 1]);
}
return result;
}
};
int main() {
string in... | ALGO | 0.999825 | 5.337406 |
8d2d7c23-a3be-4cc3-baa6-811173a2d0cd | abhidahiya23/CompetitiveProgramming | Algo++/Redundant Parentheses.cpp | // Redundant Parentheses
#include <iostream>
#include <stack>
using namespace std;
bool checkDuplicate(string str){
stack<int> s;
for(int i=0;i<str.length();i++){
char ch = str[i];
if(ch!=')'){
s.push(ch);
}else{
if(s.top()=='(')
return true;
while(s.top()!='(')
s.pop();
s.pop();
}... | ALGO | 0.996831 | 4.348633 |
3f325e88-b866-4044-87bd-44e7e3767fe8 | palmerchaun/cplusplus | tests/Compt Test 1/functions.cpp | #include "functions.h"
#include "constants.h"
#include "planets.h"
using namespace Gravity;
double currentCal = 0;
double getGravity(Planet planet)
{
switch(planet){
case sun : return Sun;
case jupiter : return Jupiter;
case neptune : return Neptune;
case saturn : return Saturn;
case earth : return Eart... | ALGO | 0.984151 | 3.919493 |
a40953df-1748-4b8b-9f2c-2368f4ef487d | raincross7/code-similarity | codes/train_code/problem296/problem296_10.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
int main(){
int n;
cin >> n;
vector<int> a(n);
for (int i=0; i<n; i++){
cin >> a.at(i);
}
int count = 0;
map<int, int> b;
for (int x: a){
b[x] += 1;
if (x < b[x]){
count++;
}
}
for (int x: a){
if ( x > b[x])... | ALGO | 0.999949 | 3.661568 |
1028f177-379a-4c45-8fb8-0dc25e1a2024 | ImMasterSam/SCIST-Solutions | 三章:資料結構與演算法/第五節:動態規劃/經典問題(二)/String Computer/String Computer.cpp | #include <bits/stdc++.h>
#define BOOST ios_base::sync_with_stdio(false);cin.tie(0);
using namespace std;
vector<vector<int>> dp; //紀錄操作變化量
vector<vector<int>> pre;
string a, b;
void print(int i, int j){
if(i==0 && j == 0) return;
switch(pre[i][j]){
case 1:
print(i-1, j-1);
break;
case 2:
print(... | ALGO | 0.999976 | 3.585088 |
cd286f69-1887-4c32-be3b-1bb1be038f15 | to-ywz/PAT- | P1019/P1019.cpp | #include <stdio.h>
#include <algorithm>
using namespace std;
bool cmp(int a, int b);
void to_array(int a, char b[]);
int main()
{
char num[5];
int n;
scanf("%d", &n);
do
{
to_array(n, num);
int max, min;
sort(num, num + 4);
sscanf(num, "%d", &min);
sort(num... | ALGO | 0.998805 | 3.206142 |
9edb7f91-0be2-4b30-ac77-b2a76c8b6508 | Himanshutomar31/c-topython | externals/Eigen3/demos/mandelbrot/mandelbrot.cpp | #include "mandelbrot.h"
#include <iostream>
#include<QtGui/QPainter>
#include<QtGui/QImage>
#include<QtGui/QMouseEvent>
#include<QtCore/QTime>
void MandelbrotWidget::resizeEvent(QResizeEvent *)
{
if(size < width() * height())
{
std::cout << "reallocate buffer" << std::endl;
size = width() * height();
i... | ALGO | 0.926639 | 5.79494 |
63e09771-fae2-46da-b9df-b6870be755b1 | gabrielpessoa1/Competitive-Programming | NEERC 2013/K.cpp | #include <bits/stdc++.h>
using namespace std;
const int ms = 1e6+5;
int arr[ms];
int qnt[ms];
int bu[ms];
vector<int> ans;
void printe() {
cout << ans.size() << '\n';
for(int i = 0; i < ans.size(); i++) {
cout << ans[i];
if(i != ans.size() - 1) cout << ' ';
}
cout << '\n';
exit(0);
}
main() {
... | ALGO | 0.999928 | 3.252468 |
3f262ebf-7120-4f0b-9fff-33940949c557 | zt8989/IronMule | srchybrid/MD5Sum.cpp | #include "stdafx.h"
#include "MD5Sum.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
typedef unsigned char *POINTER;
typedef unsigned short int UINT2;
typedef unsigned long int UINT4;
typedef struct {
UINT4 state[4];
UINT4 count[2];
unsigned char buffer[64];
}... | ALGO | 0.981713 | 5.699367 |
23f34a37-9154-45ac-b2b9-e31225e18697 | contengee/MyAtCoderSolve | abc247d.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int Q;
cin >> Q;
deque<pair<long long, long long>> tube; // 筒を表現するデック
while(Q--) {
int type;
cin >> type;
if(type == 1) { // クエリタイプ1の場合
long long x, c;
cin >> x >> c;
... | ALGO | 0.999153 | 5.080018 |
3335dd4c-6763-433e-b503-4714d4923690 | benjack795/solomon-reimp | ode-0.16/GIMPACT/src/gim_tri_tri_overlap.cpp | #include "GIMPACT/gim_trimesh.h"
#define FABS(x) (float(fabs(x))) /* implement as is fastest on your machine */
/* some macros */
#define CLASSIFY_TRIPOINTS_BY_FACE(v1,v2,v3,faceplane,out_of_face)\
{ \
_distances[0] = DISTANCE_PLANE_POINT(faceplane,v1);\
_distances[1] = _distances[0] * DISTANCE_PLA... | ALGO | 0.999591 | 6.464332 |
65f57bb6-79fa-4e0d-bebd-5c83efc3a49b | pedrosoutinho/cp-dump | E162/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
using db = long double;
using pi = pair<int, int>;
using pd = pair<db, db>;
#define mp make_pair
#define f first
#define s second
#define tcT template <class T
#define tcTU tcT, class U
tcT > using V = vector<T>;
tcT, size_t SZ > u... | ALGO | 0.999776 | 4.14764 |
b7e5ccc5-bd24-46a9-b0d1-30937e058008 | rammiah/OnlineJudge | HDU/HDU1014.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <cstdio>
#include <set>
using namespace std;
int main() {
int mod, seed, step;
while (scanf("%d %d", &step, &mod) != EOF) {
set<int> nums;
seed = 0;
while (nums.count(seed) == 0) {
nums.insert(seed);
seed = (seed + step) ... | ALGO | 0.995088 | 3.790056 |
779fc133-7104-4ff3-b82c-77e3fb993d0c | Evolving-AI-Lab/innovation-engine | sferes/examples/ex_ea.cpp | #include <iostream>
#include <sferes/phen/parameters.hpp>
#include <sferes/gen/evo_float.hpp>
#include <sferes/ea/rank_simple.hpp>
#include <sferes/eval/eval.hpp>
#include <sferes/stat/best_fit.hpp>
#include <sferes/stat/mean_fit.hpp>
#include <sferes/modif/dummy.hpp>
#include <sferes/run.hpp>
using namespace sferes;
... | ALGO | 0.999911 | 6.68069 |
eaec7d07-165c-48eb-88bd-e50ca2633053 | peterpaul2512/bai_tap_nmlt | bai_tap/bai_tap_mang_2_chieu/ma_tran_thuong/ky_thuat_dat_co_hieu_348_365/bai_362.cpp | // Bài 362: Liệt kê các dòng giảm dần trong ma trận
#include <iostream>
using namespace std;
void inputMatrix(int matrix[100][100], int &rows, int &cols);
void printMatrix(int matrix[100][100], int rows, int cols);
void listDecreasingRows(int matrix[100][100], int rows, int cols);
int main() {
int matrix[100][1... | ALGO | 0.999894 | 4.065103 |
e959430d-6a2e-4ece-b2cd-3bd77b1357d1 | RichaoWang/RobotSimulation | 3rdparty/eigen-3.4.0/doc/examples/make_circulant2.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
// [circulant_func]
template<class ArgType>
class circulant_functor {
const ArgType &m_vec;
public:
circulant_functor(const ArgType& arg) : m_vec(arg) {}
const typename ArgType::Scalar& operator() (Index row, Index col) const {
Index index = ... | ALGO | 0.99949 | 5.538595 |
66dba764-46e5-4c62-ad8d-c5760834677c | CascadingRadium/Leetcode1000ProblemChallenge | 412-fizz-buzz/412-fizz-buzz.cpp | class Solution {
public:
vector<string> fizzBuzz(int n)
{
vector<string> ans(n);
for(int i=1;i<=n;i++)
{
if(i%3==0 && i%5==0)
ans[i-1]="FizzBuzz";
else if(i%3==0)
ans[i-1]="Fizz";
else if(i%5==0)
ans[i-1... | ALGO | 0.999869 | 6.58604 |
a251e306-0507-48d3-9a92-88121ba8360e | garvitkataria/Compitative-Programming | Number Theory 1/Assignment/CardGame3.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int L;
typedef int l;
typedef vector<L> V;
typedef vector<l> v;
typedef vector< pair<L,L> > Y;
#define limit 32000
#define MAX 10000001
#define MOD 1000000007
#define pb push_back
#define mp make_pair
V *F;
void PrintVector(V arr1)
{
for (int i = 0; i ... | ALGO | 0.999909 | 3.453076 |
625d288d-740e-41cb-addf-07da7cebffd1 | webbedpiyush/DSA-practise | 2225-find-players-with-zero-or-one-losses/2225-find-players-with-zero-or-one-losses.cpp | class Solution {
public:
vector<vector<int>> findWinners(vector<vector<int>>& matches) {
unordered_map<int,int> count;
vector<vector<int>> ans(2);
for(int i = 0;i<matches.size();i++) {
int c = matches[i][1];
if(!count.count(matches[i][0])) {
... | ALGO | 0.9999 | 5.803125 |
046ed852-0298-46ce-a9b7-0c8a0a621428 | ou3slati/competitive-programming | Implementations/Other/Singapore/City Mapping.cpp | //Never stop trying
#include "citymapping.h"
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
template <typename T>
using ordered_set=tree<T, null_type, less<T>, rb_tree_tag, tree_order_stati... | ALGO | 0.999003 | 3.717577 |
eee97fba-2d8b-423b-b49f-4a4d0b5afeca | tlarbals824/PS | 프로그래머스/3/258705. 산 모양 타일링/산 모양 타일링.cpp | #include <string>
#include <vector>
#include<iostream>
using namespace std;
long long check[200200][2]={0};
int solution(int n, vector<int> tops) {
check[0][0]=1;
check[0][1]=0;
for(int i=1;i<2*n+1;i++){
check[i][0]=(check[i-1][0]+check[i-1][1])%10007;
if(i%2==1 && tops[(i-1)/2]=... | ALGO | 0.999911 | 4.150004 |
b21e3d00-ec7c-4d0d-90de-4ce9309d803c | Robbbert/hbmame | 3rdparty/bgfx/examples/45-bokeh/bokeh.cpp | /*
* Implement bokeh depth of field as described in the blog post here:
* https://web.archive.org/web/20201215123940/https://blog.tuxedolabs.com/2018/05/04/bokeh-depth-of-field-in-single-pass.html
*
* Additionally, implement the optimizations discussed in the closing paragraph.
* Apply the effect in multiple passes. Ca... | TOOL | 0.987794 | 6.907762 |
42de5760-20b5-4f63-be0d-59c2d983e49f | SGGODE/lettcode-solved | 994-rotting-oranges/994-rotting-oranges.cpp | class Solution {
public:
int orangesRotting(vector<vector<int>>& grid) {
int n=grid.size(),cnt=0;
int m=grid[0].size();
queue<pair<pair<int,int>,int>> q;
vector<vector<int>> vis(n,vector<int>(m,0));
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(grid[i][j]==2){
... | ALGO | 0.999971 | 6.096804 |
87ad1714-fd35-4041-9f0a-1dd311160554 | Andrew741/SIE_552 | AttitudeControlSystem.cpp | #include "AttitudeControlSystem.hpp"
#include <iostream>
#include <math.h>
AttitudeControlSystem::AttitudeControlSystem()
{
}
AttitudeControlSystem::~AttitudeControlSystem()
{
}
float AttitudeControlSystem::computeRotationalTime(float degrees)
{
float time = -1.0;
float momInertia = 1.0;
float len... | ALGO | 0.999663 | 4.83268 |
7d75a84c-1682-439b-a24a-7dacea26b50a | bagasrna/Dasar-CPP | 37_Latihan Rekursif Fibonacci/Fibonacci.cpp | #include <iostream>
using namespace std;
int fibonacci(int n);
int main(){
int angka, hasil;
cout << "menghitung fibonacci dari : ";
cin >> angka;
hasil = fibonacci(angka);
cout << "nilainya adalah : ";
cout << hasil << endl;
cin.get();
return 0;
}
int fibonacci(int n){
if((n == 0)||(n == ... | ALGO | 0.999678 | 4.448233 |
df7c4cea-6e09-4512-8014-6c5bc211c929 | chichchic/algorithmPrac | BaekJoon/2020/200329_1007.cpp | #include <iostream>
#include <cmath>
using namespace std;
long long sx, sy;
int memo[20][2], n;
long long my_min(long long a, long long b)
{
return (a == 9223372036854775807) ? b : (a > b) ? b : a;
}
long long func(int left, int index, long long x, long long y)
{
if (left == 0)
return (sx - x - x) * (sx - x... | ALGO | 0.99976 | 4.043693 |
a2d353bd-def7-496b-997f-d47355d91313 | yzzupgo/MFTCG | Data/abc170_b/noobcoder002/wa/14321929.cpp | #include <bits/stdc++.h>
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vvi vector < vi >
#define pii pair<int,int>
#define pll pair<long long, long long>
#define mod 1000000007
#define inf 1000000000000000001;
#define all(c) c.begin(),c.end()
#define mp(x,y) make_pair... | ALGO | 0.999903 | 3.311896 |
bd6935c3-8e5d-4933-81a8-39503fb8fd78 | chengluyu/old-drafts | USACO/MAR08/src/cheng/baler.cpp | #include <cmath>
#include <climits>
#include <fstream>
using namespace std;
const int N = 1050 + 1;
const double INIT_SPEED = 10000;
#define PID "baler"
ifstream cin(PID ".in");
ofstream cout(PID ".out");
struct gear {
int x, y, r;
double s;
} gears[N];
bool visited[N] = { 0 };
int n, start = -1, xt, yt, ans = ... | ALGO | 0.999804 | 3.88184 |
e690638a-c66e-493e-b8d2-2393f1184128 | ishandutta2007/codeforces | dormi/normal/1335/E1.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef pair<int,int> pii;
typedef pair<lli,lli> pll;
template<typename T>
int sz(const T &a){return (int)a.size();}
const int MAXN=2e5+1;
const int MAXC=201;
int am[MAXN][MAXC];
vector<int> locs[MAXC];
int main(){
cin.tie(NULL);
ios_base:... | ALGO | 0.999739 | 4.070124 |
e0a9d970-ca10-4502-8f37-b854317a7b53 | NekoDesu-cyte/STD_Haikal_Fadhilah_Mufid_2311104027 | 01_Pengenalan_CPP_Bagian_1/Unguided/Soal_no_2.cpp | #include <iostream>
#include <string>
using namespace std;
string angkakehuruf(int angka){
if (angka < 0 || angka > 100) return "Angka Melebihi Kapasitas";
string satuan[] = {"null", "satu", "dua", "tiga", "empat", "lima", "enam", "tujuh", "delapan", "sembilan"};
string belasan[] = {"sepuluh","sebelas", ... | TOOL | 0.978838 | 5.559913 |
70b63a1c-75d1-47ae-b231-286f51fb2bbe | wendycat12/CompilerDesign | Homework 1/LexicalAnalysis.cpp | // Wendy Catalan
// Compiler Design Homework 1
#include <iostream>
#include <fstream>
using namespace std;
// Function to process the file and display words and punctuation marks
void processFile(const string& filename)
{
ifstream file(filename);
if (!file.is_open()) {
cerr << "Error opening file:... | TOOL | 0.91036 | 5.270054 |
52cee3d3-365c-4a3d-b4d9-d08ee73b0dd4 | HimanshuJo/Important-Programming-Concepts-With-Implementations-CPP-Java-Python-JS-SQL | Tar/C++/AlgosImpl/SweepLine/SweepLine1.cpp | #include <bits/stdc++.h>
using namespace std;
// A point in 2D plane
struct Point
{
int x, y;
};
// A line segment with left as Point
// with smaller x value and right with
// larger x value.
struct Segment
{
Point left, right;
};
// An event for sweep line algorithm
// An event has a point, the position
// ... | ALGO | 0.99981 | 4.443231 |
d6a1c646-16be-42c5-941a-8f6a5df98f03 | AjayPoonia112/DSA_Concepts | String/validate_string.cpp | // Validate a string fo name
#include<bits/stdc++.h>
using namespace std;
bool validate(string s){
for(int i=0;i<s.length();i++){
if(!(s[i]>=65 && s[i]<=90) && !(s[i]>=91 && s[i]<=122) && !(s[i]>=48 && s[i]<=57)){
return false;
}
}
return true;
}
int main(){
string s;
getline(cin,s);
bool re... | ALGO | 0.977592 | 4.388958 |
4dd3e496-d57e-4104-96f3-f20c5781a023 | FreeCAD/FreeCAD | src/Mod/Mesh/App/WildMagic4/Wm4DistLine3Triangle3.cpp | #include "Wm4FoundationPCH.h"
#include "Wm4DistLine3Triangle3.h"
#include "Wm4DistLine3Segment3.h"
namespace Wm4
{
//----------------------------------------------------------------------------
template <class Real>
DistLine3Triangle3<Real>::DistLine3Triangle3 (const Line3<Real>& rkLine,
const Triangle3<Real>& rkT... | ALGO | 0.998016 | 6.574279 |
badf0d9c-310f-402f-b026-2490b6e4816f | cran/gbm3 | src/bernoulli.cpp | //-----------------------------------
//
// File: bernoulli.cpp
//
// Description: bernoulli distribution.
//
//-----------------------------------
//-----------------------------------
// Includes
//-----------------------------------
#include "bernoulli.h"
#include <memory>
//--------------------------------------... | ALGO | 0.999646 | 6.836191 |
aab9f010-a088-4aa1-a10a-48c56452362b | NguyenLabJHU/Tahoe-FEM | tahoe-dev/src/elements/contact/PenaltyContactElement2DT.cpp | /* $Id: PenaltyContactElement2DT.cpp,v 1.55 2011-12-01 20:38:01 beichuan Exp $ */
#include "PenaltyContactElement2DT.h"
#include <cmath>
#include <iostream>
#include <iomanip>
#include "ofstreamT.h"
#include "ifstreamT.h"
#include "ContactNodeT.h"
#include "ParabolaT.h"
#include "ModSmithFerrante.h"
#include "Greenwo... | ALGO | 0.996116 | 5.084664 |
4f4d265d-6305-48ff-89e7-27c32955f52a | samssjubair/xpsc | week-7/day-5/A_Cricket_Tournament.cpp | #include <iostream>
#include <string>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <ctime>
#include <climits>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <deque>
#include <set>
#include <unordered_set>
#include <iomanip>
#include <cstdlib>
#include <cstdio>
#include <... | ALGO | 0.999904 | 4.580953 |
1dca677a-14b3-4aa9-b2de-f6d417ab9282 | kidonm/advent-of-code | 2021/6/b.cpp | #include <algorithm>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
typedef long long ll;
int main() {
int cycle = 9;
vector<ll> sim(cycle, 0);
string s;
cin >> s;... | ALGO | 0.999563 | 3.256312 |
0b466374-2297-4cbe-bb34-08644e1ab0cc | DISASTER-RUMBLING/CODE | 算法/Leetcode/Leetcode 3128. 直角三角形.cpp | #define _CRT_SECURE_NO_WARNINGS
#include<vector>
using namespace std;
class Solution {
public:
long long numberOfRightTriangles(vector<vector<int>>& grid) {
long long res = 0, rw = grid.size(), cl = grid[0].size();
vector<int> row(rw, 0), col(cl, 0);
for (int i = 0; i < rw; i++) {
... | ALGO | 0.99967 | 5.255837 |
0a269748-c87c-4336-b10c-c01da143980a | nqdat2002/Data-Structures-and-Algorithms | SamSung courses/tinh gia tri bieu thuc hau to.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll L(ll a, ll b, char c){
if(c == '+') return a + b;
if(c == '-') return a - b;
if(c == '*') return a * b;
if(c == '/') return a / b;
}
ll Solve(string str){
int n = str.length();
stack<ll> stk;
for(int i = 0; i < n; i ++){
if(isdigit(str[i]... | ALGO | 0.999832 | 5.06958 |
33f96468-464a-4d20-842f-51e3fe53b430 | raincross7/code-similarity | codes/train_code/problem255/problem255_208.cpp | #include <bits/stdc++.h>
#define REP(i,n) for (int i = 0; i < n; i++)
using namespace std;
int main() {
string s;
cin >> s;
bool ans = false;
if (s[0] != s[1] && s[1] != s[2] && s[2] != s[0])
ans = true;
cout << ((ans) ? "Yes" : "No") << endl;
} | ALGO | 0.999994 | 3.373117 |
7061987a-964a-441b-a86a-1b38b1dd16f1 | shivsingh98/180-HARD | Day 5/08Factorial.cpp | #include<iostream>
using namespace std;
int main(){
int i,n, fact=1;
cout<<"enter number:\n";
cin>>n;
for(i=1; i<=n; i++){
fact *= i;
}
cout<<fact;
} | ALGO | 0.999913 | 4.692883 |
5d366a1a-c8be-42b2-8ac2-ce882046cebd | greenfox-zerda-sparta/kblanka | week-06/day-4/C++ Vectors/W6_Day5_Ex10.cpp | #include <iostream>
#include <string>
#include <vector>
#include <stdlib.h> /* srand, rand */
#include <time.h>
using namespace std;
int a;
template <class T>
T divisor(T x) {
int divisorsum = 0;
for (int i = 1; i <= x; i++) {
if (x % i == 0)
divisorsum++;
}
return divisorsum;
}
template <clas... | ALGO | 0.958375 | 3.400764 |
d8f1fdee-d416-4b5a-b73b-ed787be06139 | shamikh1014/code8 | dp2a5.cpp | // Matrix Chain Multiplication
// Problem statement
/*
Given a chain of matrices A1, A2, A3,.....An, you have to figure out the most efficient way to multiply these matrices. In other words, determine where to place parentheses to minimize the number of multiplications.
You will be given an array p[] of size n + 1.... | ALGO | 0.999979 | 4.672512 |
ec3f23be-e116-4081-9adb-018565927b32 | tanishq252/myLeetcodeSolutions | 856-score-of-parentheses/856-score-of-parentheses.cpp | class Solution {
public:
int scoreOfParentheses(string s) {
stack<int> st;
st.push(0);
for(int i=0;i<s.length();i++){
if(s[i]=='('){
st.push(0);
}
else{
int currScore = st.top();
st.pop();
int... | ALGO | 0.999774 | 5.509238 |
22031dd4-1fd0-46d9-b9d5-068444a1874e | rmohan-ucf/COP4520-Assignment-2 | cupcake.cpp | #include <iostream>
#include <mutex>
#include <thread>
using namespace std;
const int nGuests = 20;
int counter = 0;
int currentThread;
bool cupcakeStatus = true;
vector<bool> guestStatus(nGuests, false);
mutex mazeMutex;
/**
* Gets number of milliseconds since epoch time
*/
long long getTime() {
auto tmp = chr... | ALGO | 0.990308 | 6.138829 |
2fba311e-e9fd-4b0e-965c-5a8009040a9f | Pdpandya/SE-Fundamentals-of-Programming | 5.string/11.replace in lowercase.cpp | #include <stdio.h>
int main() {
char sentence[100];
// Input the sentence from the user
printf("Enter a sentence: ");
fgets(sentence, sizeof(sentence), stdin);
// Iterate through each character of the sentence
for (int i = 0; sentence[i] != '\0'; i++) {
// Check if the character is lo... | ALGO | 0.908862 | 5.503618 |
6fd9b7f0-9de8-4a6e-8863-8a0fd139d31a | yogurt-shadow/z3_comp | z3_origin/src/smt/theory_bv.cpp | #include "smt/smt_context.h"
#include "smt/theory_bv.h"
#include "ast/ast_ll_pp.h"
#include "ast/ast_pp.h"
#include "ast/bv_decl_plugin.h"
#include "smt/smt_model_generator.h"
#include "util/stats.h"
namespace smt {
theory_var theory_bv::mk_var(enode * n) {
theory_var r = theory::mk_var(n);
m_fin... | ALGO | 0.986951 | 6.298326 |
03dd11d6-e23b-4192-81cb-48b655433ae7 | joonyi/Coding-Challenge-in-CPP | RoundRobin.cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
#include <cmath>
#include <queue>
#include <algorithm>
#include <iomanip>
using namespace std;
int totalQuantum = 0;
class Job{
public:
float arrival_time;
float service_time;
char name;
int priority;
Job(float myArrival_time, float myService_time, char myN... | ALGO | 0.999543 | 3.941204 |
fa2b08cf-3b88-419b-aaba-534676691171 | kapilll/DSA | CPP/Stacks/histogramBest.cpp | #include <bits/stdc++.h>
using namespace std;
int getMaxArea(int arr[],int n){
stack <int> s;
int res=0;
int tp;
int curr;
for(int i=0;i<n;i++){
while(s.empty()==false && arr[s.top()]>=arr[i]){
tp=s.top();s.pop();
curr=arr[tp]* (s.empty() ? i : i - s.top() - 1);... | ALGO | 0.999712 | 5.928946 |
e2fe4b8d-709a-4929-9a8a-47b5d9ad36f9 | liukanshan1/C-Code | C++ 项目/C++ Project/双向链表.cpp | #include <iostream>
#include <string>
using namespace std;
struct Num
{
string data;
struct Num* next;
struct Num* previous;
};
Num* CreateList(int n)
{
Num* head = new Num; //head
head->previous = NULL; //headpreviousÿ
Num* pre = head;
for (int i = 0; i < n; i++)
{
Num* p = new Num;
p->data = "data here"... | ALGO | 0.992462 | 3.407015 |
b6794e82-52eb-4c0b-a2af-df5edcfdad26 | extter/PF2021 | Algorithms/Modifying/transform.cpp | #include <algorithm>
#include <iomanip>
#include <iostream>
#include <string>
#include <vector>
void print_ordinals(std::vector<std::size_t> const &ordinals) {
std::cout << "ordinals: ";
for (std::size_t ord : ordinals)
std::cout << std::setw(3) << ord << ' ';
std::cout << '\n';
}
int main() {
std::string... | TOOL | 0.984591 | 6.166979 |
74dafa29-dfa1-4120-b76e-e4d09934f0d8 | HHSOLL/CPP-Datastructure | ex0504_EvaluatingExpressions/EvaluatingExpressions.cpp | #include <iostream>
#include "../shared/Queue.h"
#include "../shared/Stack.h"
int Prec(char c);
void InfixToPostfix(Queue<char>& q, Queue<char>& output);
int EvalPostfix(Queue<char>& postfix);
int main() {
const char infix[] = "1+(1*2+3)*4";
const int size = sizeof(infix) / sizeof(char) - 1;
Queue<char> q;
... | ALGO | 0.999459 | 4.795854 |
5177a76b-1c89-4540-a5af-7872278c6710 | tanus786/CP-Codes-HackOctober-Fest-2023 | C++ STL/Heap.cpp | #include<iostream>
#include<queue>
using namespace std;
class Heap{
public:
int arr[100];
int size;
Heap(){
arr[0]=-1;
size=0;
}
void insert(int val){
size=size+1;
int index=size;
arr[index]=val;
while(index>1){
int parent=i... | ALGO | 0.999947 | 3.997196 |
4fad5ff0-a90a-4256-b1ea-1843a28ee727 | ishandutta2007/codeforces | djq_cpp/normal/1261/E.cpp | #include <bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)(n); i ++)
#define rep1(i, n) for(int i = 1; i <= (int)(n); i ++)
#define MP make_pair
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
const int MOD = 998244353;
int n, a[1005];
int grp[1005];
int ans[1005][1005];
int sz[1005], ... | ALGO | 0.999979 | 3.346349 |
225cd127-4a4c-4979-91ec-ebf00cf3c2f8 | MahinAshraful/CodeWatch_Data | sample-data/p00005/s594338825.cpp | #include <stdio.h>
long gcd_euclid(long m, long n) {
long temp;
while (n) {
temp = m % n;
m = n;
n = temp;
}
return m;
}
int main(){
long a, b;
long temp;
long gcd, lcm;
while(scanf("%ld %ld", &a, &b) != EOF){
gcd = gcd_euclid(a, b);
temp = a / gcd;
lcm = temp * b;
printf("%ld %ld\n", gcd, lcm);
}
return 0;
} | ALGO | 0.999799 | 4.123015 |
ec394078-8461-47bb-8d8a-aaddd9504290 | Byeongzi2/TIL | Backtracking/Baekjoon_#9663.cpp | #include<bits/stdc++.h>
using namespace std;
#define MAXN 15
int N,ans;
int Col[MAXN];
bool check(int c) {
for(int i=0;i<c;i++) {
if(Col[i]==Col[c] || abs(Col[c] - Col[i]) == c-i) return false;
}
return true;
}
void backtrack(int c) {
if(c==N) {
ans++;
return;
}
for(int i=0;i<N;i++) {
Col[c] = i;
... | ALGO | 0.999962 | 4.844519 |
680dfa58-980a-4b9f-a319-2764db4d41b3 | Mr-Phoebe/ACM-ICPC | 专题训练/模拟与暴力/大模拟/编程之美1.cpp | // whn6325689
// Mr.Phoebe
// http://blog.csdn.net/u013007900
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstring>
#include <climits>
#include <complex>
#include <fstream>
#include <cassert>
#include <cstdio>
#include <bitset>
#include <vector>
#include <deque>
#include <queue>
#include... | ALGO | 0.99973 | 4.007974 |
d5238e4f-24e4-42d8-8144-75ea2d3eb35a | Lucerna00/BOJ | dynamic programming 2/11066.cpp | #include<iostream>
#include<algorithm>
#include<climits>
using namespace std;
int file[501], sum[501], dp[501][501];
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int T = 0, K = 0;
cin >> T;
while (T--) {
cin >> K;
for (int i = 1;i <= K;i++) {
cin >> file[i];
sum[i] = su... | ALGO | 0.999874 | 3.555744 |
fb5152f9-03f7-4f6d-9952-98638b88acf3 | Kawser-nerd/CLCDSA | Source Codes/CodeJamData/14/44/10.cpp | #include <algorithm>
#include <iostream>
#include <iomanip>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <string>
#include <vector>
#include <cstdio>
#include <cmath>
//#include <ctime>
#include <map>
using namespace std;
map < string, int > toID;
int n, m, z;
int getID(string s)
{
if(toID.count... | ALGO | 0.999977 | 4.232789 |
36eff68a-33b5-4f40-a446-569996bed225 | ayukumi-cmd/Leetcode_solutions | 1916-find-center-of-star-graph/1916-find-center-of-star-graph.cpp | class Solution {
public:
int findCenter(vector<vector<int>>& edges) {
if(edges[0][0]==edges[1][0]||edges[0][0]==edges[1][1]){
return edges[0][0];
}
if(edges[0][1]==edges[1][0]||edges[0][1]==edges[1][1]){
return edges[0][1];
}
return 0;
}
}; | ALGO | 0.99995 | 5.72521 |
cdb49f59-a557-49c5-bf09-e1b350c2e1f8 | senapk/arcade | arcade/05_laco_math/questoes/3_inversao_numeros.a.cpp | /////////////////////////////////////////////
// Fundamentos de Programação - UFC Quixada
// Baixe o motor.h ou comente o include
// motor.h: https://github.com/senapk/arcade
/////////////////////////////////////////////
#include <motor.h>
#include <iostream>
using namespace std;
//@begin
//@completado e convertido p... | ALGO | 0.997955 | 4.03982 |
b55e1113-3f38-4953-bf5a-8aa817f20836 | JasonMullen/Programming-1-3 | chapter5PracticeWork(caloriesBurned)/chapter5PracticeWork(caloriesBurned).cpp | /*
Name:Jason Mullen
Date:8-3-2020
Assignment:Calories Burned
Running on a particular treadmill you burn 3.6 calories per minute.
Write a program that uses a loop to display the number of calories burned after 5, 10, 15, 20, 25, and 30 minutes.
*/
#include <iostream>
using namespace std;
int main()... | ALGO | 0.976291 | 3.916584 |
524043cf-d498-457b-9f67-e4f19b90c77c | legendzhouqiang/BRPC | src/brpc/restful.cpp | // Authors: Ge,Jun (<EMAIL>)
#include <google/protobuf/descriptor.h>
#include "brpc/log.h"
#include "brpc/restful.h"
#include "brpc/details/method_status.h"
namespace brpc {
// Define in http_parser.cpp
extern bool is_url_char(char c);
inline butil::StringPiece remove_last_char(butil::StringPiece s) {
if (!s.em... | TOOL | 0.969872 | 6.375702 |
ea674265-9e61-4fd6-b8df-5615113dc7b1 | NissZZ/laboratory-work-4 | 8.cpp | #include <iostream>
#include <vector>
using namespace std;
string join(const vector<string>& str, const string& sep)
{
string result;
for (int i = 0; i < str.size(); i++)
{
result += str[i] + sep;
}
return result;
}
| TOOL | 0.971095 | 4.966762 |
bc02344a-ac2b-4991-a21e-d34a05b0ba55 | rohitjuyal21/DSA | 23_Linked_List/Doubly Linked List/tempCodeRunnerFile.cpp | #include <iostream>
using namespace std;
class Node
{
public:
int data;
Node *prev;
Node *next;
// constructor
Node(int d)
{
this->data = d;
this->prev = NULL;
this->next = NULL;
}
// destructor;
~Node() {
int value = this->data;
if(next != ... | ALGO | 0.999288 | 4.99676 |
95947302-5a3a-4a22-9e1c-5ea219f8e144 | purseclab/M2MON | microkernel/librepilot/ground/gcs/src/libs/eigen/bench/benchFFT.cpp | #include <iostream>
#include <bench/BenchUtil.h>
#include <complex>
#include <vector>
#include <Eigen/Core>
#include <unsupported/Eigen/FFT>
using namespace Eigen;
using namespace std;
template <typename T>
string nameof();
template <> string nameof<float>() {return "float";}
template <> string nameof<double>() {r... | TEST | 0.852847 | 6.391927 |
c0a49c83-243c-4f65-871c-1dc3d558a1d6 | aoscarsj/competitive | neps/primo.cpp | #include <iostream>
using namespace std;
bool eh_primo(int x){
int divisores = 0;
for(int i = 1; i<= x ; i++){
if(x%i == 0 )
divisores++;
}
if(divisores == 2)
return true;
else
return false;
}
int main(){
int x;
cin>>x;
if(eh_primo(x)){
cout << "S" << "\n";
}else{
cout << "N" << "\n";
}
}
| ALGO | 0.999903 | 3.982495 |
8247b683-126a-4412-b61c-e28682d5ac80 | Razeen-Shaikh/hackerrank | cpp/introduction/input-and-output.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
int a, b, c;
cin >> a >> b >> c;
cout << a + b + c;
return 0;
}
| ALGO | 0.9996 | 3.989417 |
dd0d182f-5c23-4ee0-8a4e-7cf0c84c291d | clausenar/C-primer-5ed-solutions | chapter_03/e03_10.cpp | #include<iostream>
using std::cin;
using std::cout;
using std::endl;
using std::string;
int main()
{
string line;
string new_line;
cin >> line;
for (auto c : line)
if (!ispunct(c))
new_line=new_line+c;
cout << new_line << endl;
return 0;
}
| ALGO | 0.991573 | 3.387233 |
c961f7a2-ff9a-4068-8c77-1e3499ad5c4d | jma02/cpp-compprog | dp/to_become_max.cpp | #include <bits/stdc++.h>
using namespace std;
// Binary Search
// is the previous index able to get to m-1 ?
//
// 1
// 2 17
// 3 5
void solve(){
long long n, k; cin >> n >> k;
vector<long long> arr(n, 0);
for(auto &i : arr) cin >> i;
std::reverse(arr.begin(), arr.end());
long long INF = 2e8;
... | ALGO | 0.999974 | 4.66502 |
227bfc32-bd26-4d44-871d-3acb0505cd6f | Amol0501/DSA_CPP | DSA/Tree/BST/1_create_BST.cpp | #include<bits/stdc++.h>
using namespace std;
class Node{
public:
Node *lchild;
int data;
Node *rchild;
};
class BST{
public:
Node *root = NULL;
void insert(int key);
Node *Rinsert(Node *p, int key);
void inorder(Node *p);
Node *search(int key);... | ALGO | 0.999919 | 4.571159 |
6a29eeb1-a2e1-4be6-8d95-d2b58232c9f9 | occidere/leetcode | Algorithms/841_Keys_and_Rooms/Solution.cpp | #include <cstdio>
#include <vector>
using namespace std;
class Solution {
public:
bool canVisitAllRooms(vector<vector<int>>& rooms) {
for (int i = 0; i < rooms.size(); i++) {
visit.push_back(0);
}
dfs(rooms, 0);
for (int v : visit) {
if (!v) {
... | ALGO | 0.999927 | 6.155012 |
9930510d-c4fe-412b-8750-e1fe2c359e8a | jiacongfang/Frontiers_of_Geometric_Computation_25Spring_PKU | Final_Project/preprocess/isosurface/tbb/tbb-2018_U6/src/perf/time_cpq_throughput_test.cpp | #define HARNESS_CUSTOM_MAIN 1
#define HARNESS_NO_PARSE_COMMAND_LINE 1
#include <cstdlib>
#include <cmath>
#include <queue>
#include "tbb/tbb_stddef.h"
#include "tbb/spin_mutex.h"
#include "tbb/task_scheduler_init.h"
#include "tbb/tick_count.h"
#include "tbb/cache_aligned_allocator.h"
#include "tbb/concurrent_priority_... | TEST | 0.968765 | 6.439278 |
93cbfa8e-0568-4aba-b229-f18f43834327 | devartstar/Algorithms | contest/virtualContest/contest23/e.cpp | /*
-------------------------------------
| |
| Author - Devjit Choudhury |
| Date - ___________________ |
| |
-------------------------------------
Link -
*/
#include <bits/stdc++.h>
using namespace std;
#define ar array
#define ll long long
#define ull unsigned l... | ALGO | 0.999885 | 5.308649 |
ff92e73f-9301-4ad4-97e5-f0683507c0f0 | ishandutta2007/codeforces | wasa855/normal/1217/C.cpp | #include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define Fast_IO ios::sync_with_stdio(false);
inline int read()
{
char ch=getchar(); int nega=1; while(!isdigit(ch)) {if(ch=='-') nega=-1; ch=getchar();}
int ans=0; while(isdigit(ch)) {ans=ans*10+ch-48;ch=getchar();}
if(nega==-1) r... | ALGO | 0.998949 | 3.801146 |
1e8f81b4-b8be-44aa-9b71-3ae081e2c7ae | SantiagoVeraEspinoza/Logic-Projects | CGE/Fractal Tree/Main.cpp | #include <iostream>
#include <math.h>
#include "olcConsoleGameEngineSDL.h"
using namespace std;
//Function that rotates angle by certain degree, takes the degree and the angle as parameters
float Rotate(float degree, float angle){
float n_angle=0.0f;
//If the degree is in between 360 or -360 it considers to ro... | ALGO | 0.960647 | 4.906286 |
dcb6d76d-a4a3-4ed3-9ec0-fe0d54d02bfd | SoulWizard7/cppWithSamuel | Algorithms/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
using namespace std;
// FOR EACH LOOPS from lecture
int square(int& num) {
return num *= num;
}
class Accumulator {
int sum{ 0 };
public:
int operator() (int value = 0) {
return sum += value;
}
void reset() {
sum = 0;
}
};
in... | ALGO | 0.993967 | 4.483157 |
8ded7852-9165-4229-99dd-f5a6492beb2a | folgerwang/UnrealEngine | Engine/Source/ThirdParty/nvTextureTools/nvTextureTools-2.0.6/src/src/nvmath/Basis.cpp | // This code is in the public domain -- <EMAIL>
#include <nvmath/Basis.h>
using namespace nv;
/// Normalize basis vectors.
void Basis::normalize(float epsilon /*= NV_EPSILON*/)
{
normal = ::normalize(normal, epsilon);
tangent = ::normalize(tangent, epsilon);
bitangent = ::normalize(bitangent, epsilon);
}
/// Gra... | ALGO | 0.986997 | 6.970404 |
64dc7c5a-3eb2-4ec1-93bb-e2c71c8448d1 | BlackJulySnow/acm | vj/3.12/B.cpp | #include "bits/stdc++.h"
#define fore(i, l, r) for(int i = l;i <= r;i++)
using namespace std;
int main() {
int t,n,a[200];
cin >> t;
while(t--){
int ans = 0;
cin >> n;
fore(i,1,n)
cin >> a[i];
for(int i = 1;i <= n;i++){
for(int j = 1;j <= i;j++){
... | ALGO | 0.99922 | 3.974373 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.