uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
c7842f33-86ff-4230-bb7b-4aac4941defa | marminthibaut/acc-tp | Developpement/src/graph/flow/src/flow.cpp |
#include <sstream>
#include <iostream>
#include <stdlib.h>
#include <vector>
#include <stdio.h>
#include "../../AdjacencyListGraph.h"
#include "../../LevelGraph.h"
#include "../flow.h"
#include "../../../includes/utils.h"
/**
* Generate a flow network with the vertex 0 as source and the vertex which has
* the max... | ALGO | 0.985937 | 3.943175 |
35c1efd1-7c3e-4cc3-a799-6ebd3f84003f | plusplus7/solutions | codeforces/2019/round#No750/B.cpp | #include <iostream>
#include <algorithm>
#include <cmath>
#include <cstring>
using namespace std;
int main() {
int n, t;
string s;
cin >> n;
int d = 0;
bool flag = false;
while (n--) {
cin >> t >> s;
if (d == 0 && s[0] != 'S') {
flag = true;
}
if (... | ALGO | 0.999697 | 3.242169 |
e55ee1f6-f1cb-42b4-be7b-4b080eda0f85 | indratrisnar/free_source_bootcamp_d_flutter | starter_bootcamp/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.998862 | 6.785645 |
7003d315-a12c-471c-af15-565ebdc0f77f | mandarinka9/3coderev | 3/3.3DeepSeek.cpp | /*
Юный путешественник решил изучить схему авиационного сообщения Схема авиационного сообщения
задана в текстовом файле с именем FileName. в виде матрицы смежности. Первая строка файла
содержит количество городов (n) n<=25, связанных авиационным сообщением, а следующие n строк
хранят матрицу (m), m[i][j]=0, если не и... | ALGO | 0.999384 | 5.827447 |
d630a2b8-f66d-4d10-81cb-3933163aa37c | SilverPlate3/RansomNote_MemoryScanner | File_Operations.cpp | #include <stdio.h>
#include <Windows.h>
#include <Wincrypt.h>
#include <string.h>
#include "File_Operations.h"
//Defines
#define SHA256LEN 32
// Printing System error's
void Error(const char* msg)
{
printf("\n### ERROR ### %s (%d)", msg, ::GetLastError());
exit(EXIT_FAILURE);
}
// Find_file_hash() - Calcu... | TOOL | 0.982041 | 3.309258 |
1a1a0382-6fc3-4ac5-ad5c-f6e3a98140a8 | BinitDOX/Company-OAs | Navi/WarLane/WarLane.cpp | #include<bits/stdc++.h>
using namespace std;
int solve(int arr[], int n, int l){
int minr = 1;
sort(arr, arr+n);
for(int i=1; i<n; i++)
minr = max((int)ceil((arr[i]-arr[i-1])/2.0), minr);
minr = max(minr, abs(0-arr[0]));
minr = max(minr, abs(l-arr[n-1]));
return minr;
}
int main(... | ALGO | 0.999974 | 3.655279 |
f055a526-7c86-4a70-a01f-b010a074e7de | Runarok/GeeksForGeeks-solutions | Difficulty: Basic/Check for subsequence/check-for-subsequence.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
bool isSubSequence(string A, string B) {
int i = 0, j = 0;
int n = A.length(), m = B.length();
// Traverse through both strings
while (i < n && j < m) {
... | ALGO | 0.99988 | 5.962275 |
02697b2e-6c11-4c4b-a79e-77493beeaeb6 | VishalBhat07/striver-dsa-course | Linked list/Singly Linked List/12_intersection_of_LL.cpp | #include <iostream>
#include <map>
using namespace std;
struct Node
{
int data;
Node *next;
Node(int val)
{
data = val;
next = nullptr;
}
Node(int val, Node *ptr)
{
data = val;
next = ptr;
}
};
Node *getIntersectionNode(Node *headA, Node *headB)
{
/... | ALGO | 0.999799 | 4.874926 |
0bc69d13-b327-42a3-9f9f-ff7c600b71d0 | banikroymandal/DS-Algo | Hash_map/intersection_array.cpp | #include<iostream>
using namespace std;
#include<unordered_set>
class solution{
public:
int intersection_2array(int a[],int b[],int m,int n){
int res=0;
unordered_set<int>s;
for(int i=0;i<m;i++){
s.insert(a[i]);
}
for(int j=0;j<n;j++){
if(s.find(b[j])!=s.end()){
res++;
... | ALGO | 0.999057 | 4.856429 |
138de4d3-86ad-4f98-832c-e15879fecb74 | KeerthanaPravallika/DSA | 50Questions/LinkedList/ReorderList.cpp | /*
Link: https://leetcode.com/problems/reorder-list/description/
You are given the head of a singly linked-list. The list can be represented as:
L0 → L1 → … → Ln - 1 → Ln
Reorder the list to be on the following form:
L0 → Ln → L1 → Ln - 1 → L2 → Ln - 2 → …
You may not modify the values in the list's nodes. Only nod... | ALGO | 0.999972 | 6.327036 |
56e6786a-65bc-427e-99ab-1e8db13f0a0a | istvanzk/tflm-arduino | src/tensorflow/lite/kernels/internal/common.cpp | #include "tensorflow/lite/kernels/internal/common.h"
namespace tflite {
// Single-rounding MultiplyByQuantizedMultiplier
#if TFLITE_SINGLE_ROUNDING
int32_t MultiplyByQuantizedMultiplier(int32_t x, int32_t quantized_multiplier,
int shift) {
TFLITE_DCHECK(quantized_multiplier >= ... | ALGO | 0.98068 | 7.358146 |
ac524ee0-8991-431c-804d-392dcf61e62a | Dzeko-firdaus/tugas-praktikum-c | Praktikum 8/tugas-mandiri-1d.cpp | #include <stdio.h>
int main() {
int A[11];
int i = 0;
int input;
printf("Masukkan data ke dalam array (999 untuk mengakhiri):\n");
do {
printf("Data ke-%d: ", i + 1);
scanf("%d", &input);
if (input != 999) {
// Menyimpan nilai ganjil
if (input % 2 ... | ALGO | 0.99949 | 4.622815 |
2f7cfca2-3878-4c9e-99de-577517fb5037 | mikaozora/Programming-C | Data Structures/Task/ti15.cpp | #include <stdio.h>
#include <string.h>
#include <stdlib.h>
struct Node{
char name[100];
char type[100];
Node *next;
} *head = NULL, *tail = NULL;
Node *createNode(const char *name, const char *type){
Node *temp = (Node *) malloc(sizeof(Node));
strcpy(temp->name, name);
strcpy(temp->type, type);
temp->next = NU... | ALGO | 0.852183 | 3.851816 |
f74ea331-94be-4408-9977-4d2d911aaab9 | drowe67/cml | source/CreateSRandomInterleaver.cpp | #include <math.h>
#include <mex.h>
#include <Matrix.h>
#include <stdlib.h>
/* library of functions */
#include "./include/srandom.h"
/* Input Arguments */
#define LENGTH prhs[0]
#define SVAL prhs[1]
/* Output Arguments */
#define OUTPUT plhs[0]
/* main function that interfaces with MATLAB */
void mexFunct... | TOOL | 0.96865 | 3.722795 |
5d9dc2ac-adf1-439e-b1f7-363769ad89e4 | connieya/cpp_algorithm | solved/silver1/10844.cpp | #include "bits/stdc++.h"
#define MOD 1000000000
using namespace std;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
long long dp[101][10] = {0,};
for (int i = 1; i <= 9; ++i) {
dp[1][i] = 1;
}
for (int i = 2; i <= n; ++i) {
for (int j... | ALGO | 0.999784 | 5.18329 |
a02d19da-2970-4437-993b-568d23767aaa | eduardabarros/Cpp_Responde_Ai | exemplos_e_exercicios/memoria_modificadores_8.cpp |
#include<iostream>
using namespace std;
int main()
{
short int dia;
short int mes;
short int ano;
dia = 30;
mes = 05;
ano = 2022;
cout << "\nHoje é o dia " << dia << " do mes " << mes << " do ano de " << ano << " \n" << endl;
cout << "A variavel dia possui " << sizeof (dia) << "byte(s)\n"
<< ... | TOOL | 0.879093 | 3.366303 |
a7d950aa-666d-4f25-bca6-2b2cfe895ccd | LOGANBLUE1/Supreme-CPP | week 4/1 binarysearch/binaryOccurance.cpp | #include<iostream>
using namespace std;
int firstocc(int arr[],int n,int key){
int s=0,e=n-1;
int mid = s+(e-s)/2;
int ans = -1;
while(s<=e){
// if(arr[mid]==key){
// ans =mid;//this is different step from binary search
// e=mid-1;
// }
if(arr[mid]>=key){... | ALGO | 0.999925 | 5.004677 |
b8c33f09-7da3-4435-992b-b53461d8bcc4 | awesson/mass-spring | RodConstraint.cpp | #include "RodConstraint.h"
#include <GLUT/glut.h>
RodConstraint::RodConstraint(Particle* i_p1, Particle* i_p2, double i_dist) :
p1(i_p1), p2(i_p2), dist(i_dist) {}
void RodConstraint::draw()
{
glBegin( GL_LINES );
glColor3f(0.8, 0.7, 0.6);
glVertex2f( p1->Position[0], p1->Position[1] );
glColor3f(0.8, 0.7, ... | ALGO | 0.944934 | 5.592719 |
f1e20aea-2cf2-469e-9bea-a4a4143d724f | ishandutta2007/codeforces | wsyhb/normal/1450/C2.cpp | #include<bits/stdc++.h>
using namespace std;
namespace IO
{
const int buffer_size=1e5+5;
char buf[buffer_size],*S,*T;
bool flag_EOF;
inline char read_char()
{
if(S==T)
T=(S=buf)+fread(buf,1,buffer_size,stdin);
return S!=T?*(S++):EOF;
}
inline int read_int()
{
int flag=1;
char c=read_char(... | ALGO | 0.999838 | 4.322979 |
bfb10835-560b-46c4-bc8b-ccf5eed62190 | pranavjawale01/cp.exe | CodeForces/1883-B-Chemistry/1883-B-Chemistry.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define ull unsigned long long
#define vi vector<int>
#define vll vector<long long>
#define pii pair<int, int>
#define pll pair<long long, long long>
#define all(x) x.begin(), x.end()
#define pb push_back
#define ff first
#define ... | ALGO | 0.999991 | 5.528185 |
0b91d31f-0ffd-4bad-a819-cd3b8cf6b92c | DH777/Text_Sentiment_Analysis | boost_1_60_0/libs/ptr_container/test/view_example.cpp | //
// This example is intended to show you how to
// use the 'view_clone_manager'. The idea
// is that we have a container of non-polymorphic
// objects and want to keep then sorted by different
// criteria at the same time.
//
//
// We'll go for 'ptr_vector' here. Using a node-based
// container would be a waste of... | TOOL | 0.871368 | 6.077491 |
56c88640-38cf-4582-ab86-7af5982c147c | longwatermelon/cg | raytracing/geometry.cpp | #include "geometry.h"
#include "optimization.h"
#include "util.h"
#include <algorithm>
#include <cstdio>
#include <fstream>
#include <sstream>
#include <glm/gtx/string_cast.hpp>
#define NO_INTERSECTION Intersection{ .intersects = false, .ray = r, .t = INFINITY }
const float EPSILON = 1e-2f;
namespace rt
{
Inters... | ALGO | 0.996505 | 3.661225 |
98c3c0ad-c785-4fa0-85c3-8dc86b2e8175 | heltonricardo/beecrowd-uri | 1-iniciante/1173.cpp | #include <iostream>
using namespace std;
int main(void) {
int i, n;
cin >> n;
for (i = 0; i < 10; ++i) {
cout << "N[" << i << "] = " << n << endl;
n *= 2;
}
return 0;
}
| ALGO | 0.999199 | 3.851717 |
b584f614-406c-4934-a234-62f73308109f | jacksonchen1998/LeetCode | 69. Sqrt(x)/binarySearch.cpp | class Solution {
public:
int mySqrt(int x) {
int low = 0, high = x, res = 0;
while (low <= high) {
long long mid = low + (high - low) / 2;
if (mid * mid <= x) {
res = mid;
low = mid + 1;
} else {
high = mid - 1;
... | ALGO | 0.999917 | 5.50102 |
dff6adad-64b2-4809-b32d-e39d539411a6 | Vivek3500/365-Days-of-GFG | Difficulty: Medium/Duplicate Subtrees/duplicate-subtrees.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
struct Node {
int data;
struct Node* left;
struct Node* right;
Node(int val) {
data = val;
left = right = NULL;
}
};
// Function to Build Tree
Node* buildTree(string str) {
// Corner Case
if (str.length()... | ALGO | 0.999806 | 6.988358 |
1e478476-ff1e-4a42-a498-2414831e070e | ipdor/Leetcode | 93. Restore IP Addresses.cpp | //https://leetcode.com/problems/restore-ip-addresses/
class Solution {
public:
inline bool IsValidSubNet(string &s)
{
if(s.size()==0 || s.size()>3 || (s.size()>1 && s[0]=='0'))
return false;
int subnet = stoi(s);
return subnet>=0 && subnet<=255;
}
void solve(string& s... | ALGO | 0.999341 | 5.667003 |
2b89ec65-d4e6-4e78-b9f6-a45b4a5cf0bc | rafid211/online-judge-solution | codechef/Minimize Digitsum.cpp | #include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9+7;
const double EPS = 1e-11;
const double PI = 2 * acos(0.0);
const int INF = 0x7f7f7f7f;
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vec... | ALGO | 0.999798 | 3.892655 |
d90c21ac-be5a-4ccd-8edf-14dc82e84bdd | md-rafiul-islam/Problem-Solving-Repo | project_euler_34_digit_factorials.cpp | #include<iostream>
using namespace std;
int fact(int n){
int x=1;
for(int i=1; i<=n; i++){
x*=i;
}
return x;
}
bool is_curious(int n){
int sum=0;
int x=n;
while(n){
sum+=fact(n%10);
n/=10;
}
return sum%x==0;
}
int main(){
long long sum=0;
int... | ALGO | 0.999962 | 5.55544 |
da8fefd6-3278-456b-b226-429810f5fb3f | bachupradeep99/csa693-daa | perfect number.cpp | #include <stdio.h>
int main() {
int num, sum = 0;
printf("Enter a number: ");
scanf("%d", &num);
for (int i = 1; i <= num / 2; i++)
if (num % i == 0)
sum += i;
if (sum == num)
printf("%d is a perfect number.\n", num);
else
printf("%d is not a perfect number... | ALGO | 0.999655 | 4.200593 |
6cf0904c-ebac-4847-882b-0e8acd234e21 | ronnie9901/examdart | 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 |
d53fbcca-3460-47fa-847e-7e2e67c84468 | Mauricio134/Build_Octree | VTK-9.3.0.rc1/ThirdParty/libproj/vtklibproj/src/projections/rpoly.cpp | #define PJ_LIB__
#include <errno.h>
#include <math.h>
#include "proj.h"
#include "proj_internal.h"
namespace { // anonymous namespace
struct pj_opaque {
double phi1;
double fxa;
double fxb;
int mode;
};
} // anonymous namespace
PROJ_HEAD(rpoly, "Rectangular Polyconic")
"\n\tConic, Sph, no... | TOOL | 0.989683 | 6.110203 |
df4932ca-e916-4fea-8b63-58189a99b1d7 | rhoot/c8e | 3rdparty/SFML-2.5.0/src/SFML/Network/Ftp.cpp | ////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <SFML/Network/Ftp.hpp>
#include <SFML/Network/IpAddress.hpp>
#include <SFML/System/Err.hpp>
#include <algorithm>
#include <cctype>
#include <fstream>
#include <iterator>
#include... | TOOL | 0.860546 | 5.865932 |
1b5ca45a-e904-44b7-b411-8ec265b0b396 | helloMickey/Algorithm | lc-cn/剑指offer/数组中的逆序对.cpp | // https://leetcode-cn.com/problems/shu-zu-zhong-de-ni-xu-dui-lcof/
class Solution {
/*
借助归并排序过程统计逆序对的个数;
*/
public:
int mergeSort(vector<int>& nums, vector<int>& tmp, int l, int r) {
if (l >= r) {
return 0;
}
int mid = (l + r) / 2;
int inv_count = mergeSort... | ALGO | 0.999987 | 5.503 |
c6a7de50-f692-4963-a211-52274db9e9e7 | cr7as7/Leetcode_solutions | 284-peeking-iterator/peeking-iterator.cpp | /*
* Below is the interface for Iterator, which is already defined for you.
* **DO NOT** modify the interface for Iterator.
*
* class Iterator {
* struct Data;
* Data* data;
* public:
* Iterator(const vector<int>& nums);
* Iterator(const Iterator& iter);
*
* // Returns the next element in the itera... | ALGO | 0.99125 | 6.016865 |
77750659-3ea2-4119-a0dc-8b970a627f20 | G33k1973/CodingGames | NumberOfIslands(InterviewBit).cpp | int X[8] = { 1,1,1,0,0,-1,-1,-1 };
int Y[8] = { -1,0,+1,-1,+1,-1,0,+1 };
bool isvalid(int i, int j, int n, int m) {
return (i >= 0 && j >= 0 && i < n&&j < m);
}
void dfs(const vector<vector<int> > &A, int i, int j, int n, int m, vector<vector<bool>>& visited) {
visited[i][j] = true;
for (int u = 0; u < 8; ++u) {
i... | ALGO | 0.999729 | 5.720407 |
c58117db-1cca-4155-91bd-9e5e76957b0a | duran-duran/birch | src/cftree.cpp | #include "cftree.h"
#include "metrics.h"
CF_Node::CF_Node(data_t threshold, size_t branching, size_t *entriesCount) :
threshold(threshold),
bFactor(branching),
counter(entriesCount),
leaf(true),
root(true),
prevLeaf(nullptr),
nextLeaf(nullptr)
{
}
CF_Node::CF_Node(data_t threshold, size_t ... | ALGO | 0.994085 | 5.406397 |
fd5eda23-07cc-4ac6-a1c0-2d602952cc8c | Aniket23160/Competitive_Coding | Dynamic_Programming/main.cpp | //#include <iostream>
//#include <string.h>
//
//using namespace std;
//
// int t[1000][1000];
//int longest_common_subsequence(string x,string y){
// int m=x.size();
// int n=y.size();
//
// for (int i=0;i<m+1;i++){
// for (int j=0;j<n+1;j++){
// if(i==0||j==0){
// t[i][j]=... | ALGO | 0.999923 | 3.74083 |
e47c147a-faac-4deb-9f00-373a89a84a30 | nikhiljain-413/Data_Structures_Problems_solution | code/pairs.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
pair<int , string> p;
p = make_pair(1 , "nikhil");
cout<<p.first<<" "<<p.second<<endl;
pair<int ,string> p1;
p1 = {2, "jain"};
cout<<p1.first<<" "<<p1.second<<endl;
pair<int , string> p3[3];
p3[0] = {1,"mom"};
p3[1] = {2, "dad"};
p3[2] = {3, "sister"}... | TOOL | 0.945574 | 3.552727 |
0e9be6f7-7378-4e2d-be51-c79981472b74 | coding-ninja-dsa-competitive-package/codig-ninja-dsa-learning | 03-competitive-programming/modules/011-Modulo-Arithmetic/code/001-Number-Of-Balanced-Trees.cpp | #include<bits/stdc++.h>
using namespace std;
/**
* Number Of Balanced BTs
* - Given an integer h, find the possible number of balanced binary trees of
* height h. You just need to return the count of possible binary trees which
* are balanced.
* - This number can be huge, so, return output ... | ALGO | 0.999991 | 5.444427 |
daccf491-e535-4907-b644-117ad12d891f | Juko626/Learning-cpp-Course | SWEA/#5658_[모의 SW 역량 테스트] 보물상자 비밀번호.cpp | #include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <cmath>
using namespace std;
/* Ǯ
*/
string sep_word[28][4];
int arr[28][4];
int N;
vector<int> alist;
int string_to_hex(string s)
{
int sum_num = 0;
for (int i =0; i<N/4; i++)
{
if (s[s.size()-1-i] == '1')
... | ALGO | 0.999589 | 4.271361 |
208e64e2-413c-459b-9e1f-e0091244211b | Sanyam-2026/ADA_Assignment | insertionsort.cpp | //This program contains qno 10:-
#include <iostream>
using namespace std;
class Array
{
int arr[100];
int size;
public:
Array(int siz)
{
size = siz;
cin >> size;
cout << "enter the elements of an array :" << endl;
for (int i = 0; i < size; i++)
{
cin... | ALGO | 0.999098 | 3.934733 |
7b8513ff-745a-4542-a45b-8e46777734e1 | bilyanhadzhi/intro-to-programming-labs | 01_data_types_variables_arithmetic_operators/06/06.cpp | #include <iostream>
int main(void)
{
int num1;
int num2;
std::cin >> num1 >> num2;
double avg = (num1 + num2) / 2.0; // for the result of a division to be a floating-point number,
// at least one of the operands needs to be a floating-point number
std::cout ... | ALGO | 0.979565 | 4.551578 |
29a0b964-7f42-4bbe-a44a-16a848a14a66 | Const5215/Leetcode | 20180803/839.cpp | class Solution {
public:
int find(vector<int>& uset, int now) {
return now == uset[now] ? now: uset[now] = find(uset, uset[now]);
}
void union_set(vector<int>& uset, int a, int b) {
uset[find(uset, a)] = uset[find(uset, b)];
}
int numSimilarGroups(vector<string>& A) {
vector<... | ALGO | 0.999964 | 5.544578 |
07d37a4f-a69c-46a7-afb8-7f6e71eb81fc | shikhagoel003/Caffe-on-PYNQ | caffe-ssd/src/caffe/layers/softmax_layer.cpp | #include <algorithm>
#include <vector>
#include "caffe/layers/softmax_layer.hpp"
#include "caffe/util/math_functions.hpp"
namespace caffe {
template <typename Dtype>
void SoftmaxLayer<Dtype>::Reshape(const vector<Blob<Dtype>*>& bottom,
const vector<Blob<Dtype>*>& top) {
softmax_axis_ =
bottom[0]->Canon... | DATA | 0.909155 | 7.647714 |
18dc1afc-76ba-446c-8454-588083d3020a | ishandutta2007/codeforces | savinov/normal/690/D2.cpp | #include <bits/stdc++.h>
#define clr(x) memset((x), 0, sizeof(x))
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define mp make_pair
#define in(x) int (x); input((x));
#define x first
#define y second
#define forn(i, n) for(int i = 0; i < (int)(n); ++i)
#define ford(i, n) for(int i = (int)(n) - 1; i >= 0;... | ALGO | 0.99998 | 3.572496 |
c3b3199a-bbc8-40df-8863-82890cc8d790 | kartikeya532001/C-programs | TABLE.CPP | #include<stdio.h>
#include<conio.h>
main()
{
clrscr();
int i,no,ans;
for(i=1;i<11;i++)
{
scanf("%d",&no);
ans=no*i;
printf("\n %d*%d",no*i);
printf("=%d",ans);
}
} | ALGO | 0.999252 | 3.082869 |
727e41df-bace-473b-8591-372ae2004657 | MuhammadSaad000/DSA | Stack/EvalPrefix.cpp | #include<iostream>
#include<stack>
using namespace std;
//File Completed on November 15,2022.
//Problem Solved : https://www.geeksforgeeks.org/evaluation-prefix-expressions/
//Evaluate Prefix Expression
int EvalPrefix(string &s);
bool isNumeral(char& ch);
bool isOperator(char& ch);
int PerformOperation(int&, int&, ch... | ALGO | 0.999869 | 4.558113 |
5ef35d1d-4856-4786-bf29-169d3f24b21f | ruiwng/program | PAT/data_structure_2015/08-8.cpp | #include <stdio.h>
#include <set>
#include <vector>
#include <algorithm>
#include <unordered_set>
using namespace std;
struct successor
{
int index;
int last_time;
successor(int i=0,int l=0):index(i),last_time(l){}
};
struct node
{
int complete_time;
bool flag;
unordered_set<int> predecessor;
vector<int> ... | ALGO | 0.999961 | 3.971511 |
c9da6aca-40ab-4b44-b34a-334c0f367502 | yogibala/leetcode | solutions/3292. Minimum Number of Valid Strings to Form Target II/3292.cpp | class Solution {
public:
// 3291. Minimum Number of Valid Strings to Form Target I
int minValidStrings(vector<string>& words, string target) {
int ans = 0;
int unmatchedPrefix = target.length();
vector<vector<int>> lpsList;
for (const string& word : words)
lpsList.push_back(getLPS(word + '#'... | ALGO | 0.999824 | 6.317019 |
9e4149f2-600f-45ea-9a11-ab657c939d93 | artvandelaysb/ocv2 | modules/stitching/src/stitcher.cpp | #include "precomp.hpp"
namespace cv {
#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1900/*MSVS 2015*/)
// Stitcher::ORIG_RESOL is initialized in stitching.hpp.
#else
const double Stitcher::ORIG_RESOL = -1.0;
#endif
Ptr<Stitcher> Stitcher::create(Mode mode)
{
Ptr<Stitcher> stitcher = makePtr<Sti... | TOOL | 0.885997 | 6.273931 |
7bc81f9e-43c2-4c61-afee-1fdaa2f1e561 | elpimous/Legged_Control | legged_interface/src/constraint/NormalVelocityConstraintCppAd.cpp | #include "legged_interface/constraint/NormalVelocityConstraintCppAd.h"
#include "legged_interface/LeggedRobotPreComputation.h"
namespace ocs2 {
namespace legged_robot {
/******************************************************************************************************/
/*******************************************... | TOOL | 0.960485 | 5.958939 |
1467ee2f-f811-4eea-9be1-f863dbef03b7 | CoderDream/java-architect-util | hello-algo/hello-algo-main/codes/cpp/chapter_tree/array_binary_tree.cpp | /**
* File: array_binary_tree.cpp
* Created Time: 2023-07-19
* Author: krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 数组表示下的二叉树类 */
class ArrayBinaryTree {
public:
/* 构造方法 */
ArrayBinaryTree(vector<int> arr) {
tree = arr;
}
/* 列表容量 */
int size() {
return tree.size();... | ALGO | 0.999644 | 5.477825 |
c3e9d13e-8dc8-4ffc-9aee-2597bf2b39c8 | tiwariankit1234/coding-2 | 3611-construct-the-minimum-bitwise-array-ii/3611-construct-the-minimum-bitwise-array-ii.cpp | class Solution {
public:
int f(int num){
int k=-1;
for(int i=0;i<31;i++){
//check if the i-th bit is set
if((num&(1<<i))==0) {
k=i;
break;
}
}
if(k!=-1 and (k-1)<31){
num=num^(1<<(k-1));
... | ALGO | 0.99957 | 5.822229 |
08a760a7-34c9-4094-ac4a-df1c84ad350b | gomind-ritesh/labsheets | labsheets_y1/Lab5/qu5.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
float numinput,average,input,counter;
cout << "input number of inputs" << endl;
cin >> numinput;
average=0;
for(counter=1;counter <= numinput;counter++)
{
cout << "input number " << endl;
cin >> input;
averag... | ALGO | 0.855516 | 3.144981 |
ce7a4ac6-27e5-4121-a01e-8afe89d21777 | AakashN2k03/DSA | Coding/LEETCODE_GRAPH/CriticalConnectionsInANetwork(LC).cpp | // LEETCODE: 1192. Critical Connections in a Network (BRIGE PROBLEM) (TARJANS'S ALGORITHM)
//NOTE:
// tin[node] → Time when the node was first visited.
// low[node] → min lowest time insertion of all adjacent nodes apart from parent node
// DRY RUN THIS CODE
class Solution {
public:
int timer=1;
void dfs(int node,... | ALGO | 0.999974 | 6.283098 |
79f3ce36-d6d2-4796-b1bc-fe066190b8d2 | kunyavskiy/competitive-programming-archive | codeforces.com/round/207/B.cpp | //#include <iostream>
#include <fstream>
#include <vector>
#include <set>
#include <map>
#include <cstring>
#include <string>
#include <cmath>
#include <cassert>
#include <ctime>
#include <algorithm>
#include <sstream>
#include <list>
#include <queue>
#include <deque>
#include <stack>
#include <cstdlib>
#include <cstdi... | ALGO | 0.999976 | 3.493605 |
6da9a102-af6c-4674-b229-847719de8763 | plweegie/CPP_RoutePlanning | src/route_model.cpp | #include "route_model.h"
#include <iostream>
RouteModel::RouteModel(const std::vector<std::byte> &xml) : Model(xml) {
// Create RouteModel nodes.
int counter = 0;
for (Model::Node node : this->Nodes()) {
m_Nodes.emplace_back(Node(counter, this, node));
counter++;
}
CreateNodeToRoadH... | ALGO | 0.865134 | 5.340662 |
eb0aa39d-d4c1-4145-b561-b4013a7a77ac | TatilsonGhost/TatilsonGhost | Lista3/Exercicio5.cpp | #include <stdio.h>
#include <stdlib.h>
int main() {
int array[20], i, menor, maior;
// Ler os valores do array
printf("Digite os 20 valores do array:\n");
for (i = 0; i < 20; i++) {
scanf("%d", &array[i]);
}
// Inicializar as variveis menor e maior com o primeiro valor do array
men... | ALGO | 0.999375 | 4.390994 |
d9424d30-0614-4054-9106-418c24e5f8e4 | ishandutta2007/codeforces | bigbag/normal/1693/C.cpp | /**
* created: 16/06/2022, 18:11:55
**/
#include <bits/stdc++.h>
using namespace std;
const int max_n = 200222, inf = 1000111222;
int n, m, dp[max_n], mx[max_n], bad[max_n];
vector<int> rg[max_n];
int main() {
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
ios_base::sync_wi... | ALGO | 0.999639 | 4.500041 |
85531e9c-6ff8-4ca8-ad9f-c8b844273f8a | 646divi/LeetCodeDSA | Medium/Longest Common Subsequence/longest-common-subsequence.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
const int mod=1e9+7;
using namespace std;
// } Driver Code Ends
// function to find longest common subsequence
class Solution
{
public:
int LCS(string s1,string s2,int n1,int n2,vector<vector<int>>&dp){
if(n1<0 || n2<0)return 0;
if(dp[n1][n2]!=-1)... | ALGO | 0.999981 | 6.206314 |
53c9da8f-7f75-45bb-8ba4-517c36082444 | Stefanstud/leetcode-env | data/leetcode_solutions/solutions/1832. Check if the Sentence Is Pangram/1832-2.cpp | class Solution {
public:
bool checkIfPangram(string sentence) {
int seen = 0;
for (const char c : sentence)
seen |= 1 << c - 'a';
return seen == (1 << 26) - 1;
}
};
| ALGO | 0.990121 | 6.453348 |
44fd0313-58c0-4b01-bbe3-5a39e4ba7d5e | ManduTheCat/Algorithm_training | Code_plus/foundaional_algorithm2/tree/tree_diameter_2_1967/diameter.cpp | #include <iostream>
#include <cstring>
#include <vector>
using namespace std;
typedef struct _node{
int node;
int cost;
}node;
vector <node> adj_list[20002];
bool check[10002];
int node_count;
int max_node;
int max_cost;
void dfs(int node, int cost){
check[node] = true;
if(max_cost < cost){
max_cost = cost;
... | ALGO | 0.998422 | 4.143942 |
77e65091-3291-4bfc-9c56-b483c67fd9ca | C-2024-4-6/8209240526Zhoushengrong | 第三四次实验/4-1-2.cpp | #include<iostream>
using namespace std;
void sort(double a[])
{
bool change;
double t;
do
{
change = false;
for (int j = 0; j < 9; j++)
{
if (a[j] > a[j + 1])
{
t = a[j];
a[j] = a[j + 1];
a[j + 1] = t;
change = true;
}
}
} while (change);
}
int main()
{
double arr[10];
for (int ... | ALGO | 0.999802 | 3.46914 |
deb0b9ce-b16f-4227-9195-bca6ccc015c2 | ishandutta2007/codeforces | strawberryc/normal/914/D.cpp | #include <cmath>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define For(i, a, b) for (i = a; i <= b; i++)
#define p2 p << 1
#define p3 p << 1 | 1
using namespace std;
inline int read() {
int res = 0; bool bo = 0; char c;
while (((c = getchar()) < '0' || c > '9') && c != '-');
if (c... | ALGO | 0.999922 | 4.418491 |
55672995-2af2-431e-bb2b-782f72c009c9 | nixann/fmi-intro-to-programming-practicum-g5-2023-2024 | week 06 - Bitwise operations/solutions/task2.cpp | #include <iostream>
int main() {
unsigned n, k;
std::cin >> n >> k;
// Тук задачата е сходна като миналата, но няма да правим AND с 1, тъй като не искаме само последния бит
// Трябва 1 да е отместено с k позиции наляво
// Това можем да го направим с операцията <<, като я приложим k на брой пъти
// Пример: (n =... | ALGO | 0.9999 | 5.514282 |
d219c880-2a2f-4117-8616-bb0db0099108 | Dup4/Leetcode | leetcode/weekly-contest/201/b/solution.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
#define mkp make_pair
#define all(x) (x).begin(), (x).end()
using db = double;
using ll = long long;
using ull = unsigned long long;
using pII = pair<int, int>;
using pLL = pair<ll, ll>;
co... | ALGO | 0.99999 | 4.786726 |
40a9fe03-2305-4fd6-a2d5-403135821e26 | Apurba94/10-Years-of_Competitive-Programming-Resources-Collection | SPOJ/Classical/7100 - Back To The Polygon.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
struct point{
int x,y;
point(){}
point(int _x, int _y){
x = _x; y = _y;
}
};
int signed_area(const point &p1, const point &p2, const point &p3){
return (p1.x*p2.y+p2.x... | ALGO | 0.998351 | 3.577621 |
8ee1a5f0-997e-4671-b0c6-bb6b2ddcefae | dreamtomb/Introduction_to_Alogorithm_Competition | ch03/UVa1585.cpp | #include <cstdio>
#include <cstring>
#define maxn 85
char s[maxn];
int answer[85];
int main()
{
int kase;
memset(answer, 0, sizeof(answer));
scanf("%d", &kase);
for (int i = 0; i < kase; i++)
{
scanf("%s", s);
int flag = 0, ans = 0;
for (int i = 0; i < strlen(s); i++)
... | ALGO | 0.999574 | 3.543728 |
c7def879-98a6-4f44-9300-6a0a496c3dad | johnchen902/codebook | codes/zvalue_palindrome.cpp | void Zpal(const char *s, int len, int *z) {
// Only odd palindrome len is considered
// z[i] means that the longest odd palindrom centered at
// i is [i-z[i] .. i+z[i]]
z[0] = 0;
for (int b=0, i=1; i<len; i++) {
if (z[b] + b >= i) z[i] = min(z[2*b-i], b+z[b]-i);
else z[i] = 0;
while (i+z[i]+1 < len and i-z[i... | ALGO | 0.997777 | 3.377196 |
2ab97392-49f7-4b1a-8b41-2b12e015ad8a | manishgupta72/Data-Structure-And-Algorithm-Programs | Pattern/HalfPyramid using number.cpp | #include<iostream>
using namespace std;
int main()
{
int row,col;
cin>>row>>col;
for(int i=1;i<=row;i++)
{
for(int j=1;j<=col;j++)
{
if(i==1||i==row || j==1||j==col){
cout<<"*";
}else
{
cout<<" ";
}
}
... | ALGO | 0.999761 | 3.803043 |
3a666ffc-4cdc-4a99-8adf-c8ce51ea169a | harshnadar/Leetcode-Problems | count-all-possible-routes/count-all-possible-routes.cpp | class Solution {
public:
long long int dp[101][201];
int finish;
int n;
int mod =1e9+7;
vector<int> locations;
int solve(int i, int fuel){
// if(fuel<0) return 0;
if(dp[i][fuel]!=-1) return dp[i][fuel];
dp[i][fuel]=(i==finish);
... | ALGO | 0.999921 | 5.558083 |
2a1303b6-cb9f-4fb3-9321-01ac34546796 | Mulab11/cntt2016-hw1 | TC-SRM-556-div1-500/qj.cpp | #include <bits/stdc++.h>
using namespace std;
typedef std::pair<std::string, std::string> Info;
const int N = 50 + 10;
const Info INF(std::string(N, '9'), std::string(N, '9'));
class LeftRightDigitsGame2 {
int n;
Info f[N][N][2][2];
std::string s, t;
template <typename T> inline void check(T &lhs, const T &... | ALGO | 0.999991 | 4.133703 |
a38ada28-b8f7-49e1-831f-4ec011de1b7d | misiek1984/NBC | NBCLib/NBC.cpp | /********************************************************************
* Micha Komorowski
* 2010-05-16
* Implementation of a Neighborhood-Based Clustering Algorithm
********************************************************************/
#include "NBC.h"
namespace NBC
{
//************************************************... | ALGO | 0.999425 | 6.127186 |
984d0106-23c8-42bd-95a2-ab1d4c1d80e5 | Vassu05/CSES | sum_of_three_values.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n, x; cin >> n >> x;
vector<int> a(n);
for(int &i : a) cin >> i;
vector<int> ord(n);
iota(ord.begin(), ord.end(), 0);
sort(ord.begin(), ord.end(), [&](int xx, int yy) { return a[xx] < a[yy]; });
for(int i = 0; i < n; i++) {
... | ALGO | 0.99997 | 4.466582 |
691b12a8-e8fd-451e-9356-3a09fda32df0 | VanshikaAsthana/Practice_c_plus_plus | floatdivision.cpp | #include<iostream>
#include<iomanip>
using namespace std;
int main()
{
float a,b,c;
cout<<"Provide the values"<<endl;
cin>>a>>b;
c=a/b;
cout<<fixed<<setprecision(2);
cout<<"The result is:"<<c;
return 0;
} | ALGO | 0.978671 | 3.834848 |
f38e78ce-290e-4ec6-b32a-37dd0db913e1 | eujuu/Algorithm | baekjoon/백준 11052 카드 구매하기.cpp | #include <iostream>
#include<vector>
#include <algorithm>
using namespace std;
int arr[1001];
int cnt[1001];
int main() {
int n, tmp, tc;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> arr[i];
}
cnt[1] = arr[1];
for (int i = 2; i <= n; i++) {
cnt[i] = arr[i];
for (int j = i / 2; j < i; j++) {
... | ALGO | 0.999978 | 3.791116 |
251abdcc-5275-47de-9f2b-a7a294558fd1 | falabretti/algorithms | simulation/hanoi_tower.cpp | #include <bits/stdc++.h>
using namespace std;
int moves = 0;
void hanoi_tower(int n, char begin, char end, char aux) {
if (n == 1) {
printf("%c -> %c\n", begin, end);
moves++;
} else {
hanoi_tower(n - 1, begin, aux, end);
hanoi_tower(1, begin, end, aux);
hanoi_tower(n -... | ALGO | 0.999668 | 5.323979 |
c3b9c289-4cdd-4d1e-92fe-1863163c532b | suryakantkasare/CSES | Introduction/Gray_Code.cpp | #include <iostream>
#include <vector>
using namespace std;
void generate_gray_code(int n) {
vector<string> gray_codes;
gray_codes.push_back("0");
gray_codes.push_back("1");
for (int i = 2; i <= n; i++) {
int size = gray_codes.size();
for (int j = size - 1; j >= 0; j--) {
gr... | ALGO | 0.999988 | 5.561613 |
bc164839-a906-4be0-be21-f6f28d3519ae | swlpark/ece1387 | vtr/vtr_flow/benchmarks/arithmetic/multless_consts/verilog/synth/testacm.cpp | #include <vector>
#include "acm.h"
reg_t tmpreg() { static int c=100; return c++; }
int main(int argc, char **argv) {
acm_init();
vector<coeff_t> targets;
vector<reg_t> dests;
targets.resize(2); dests.resize(2);
targets[0] = 4; dests[0] = 0;
targets[1] = 5; dests[1] = 2;
oplist_t op... | ALGO | 0.974282 | 3.942826 |
1b611156-a439-490e-81c9-3f6bb419d8da | URSec/Kage-FreeRTOS | freertos_mpu_coremark/lib/third_party/mcu_vendor/nxp/LPC54018/mcuxpresso/startup_lpc54018.cpp | #if defined (DEBUG)
#pragma GCC push_options
#pragma GCC optimize ("Og")
#endif // (DEBUG)
#if defined (__cplusplus)
#ifdef __REDLIB__
#error Redlib does not support C++
#else
//*****************************************************************************
//
// The entry point for the C++ library startup
//
//********... | CONFIG | 0.936482 | 7.188688 |
7532015c-b21d-44cc-97b3-2a21b3b1c474 | minseojo/problem-solving | 프로그래머스/lv2/12939. 최댓값과 최솟값/최댓값과 최솟값.cpp | #include <string>
#include <vector>
#include <iostream>
#include <math.h>
using namespace std;
int ans[2] = {1000000000, -1000000000};
string solution(string s) {
string str = "";
for (int i = 0; i < s.size(); i++) {
if (s[i] == ' ') {
int number = stoi(str);
ans[0] = min(a... | ALGO | 0.999968 | 4.584219 |
c040667e-d2f8-4253-9bb1-47f0c0b0ed76 | Shimmen/ProxyGen | code/deps/eigen-3.3.7/bench/vdw_new.cpp | #include <iostream>
#include <Eigen/Core>
using namespace Eigen;
#ifndef SCALAR
#define SCALAR float
#endif
#ifndef SIZE
#define SIZE 10000
#endif
#ifndef REPEAT
#define REPEAT 10000
#endif
typedef Matrix<SCALAR, Eigen::Dynamic, 1> Vec;
using namespace std;
SCALAR E_VDW(const Vec &interactions1, const Vec &inter... | ALGO | 0.999827 | 3.519938 |
d44b6a3e-2414-47cc-b5a6-c5d5c35b2daa | HajimeHitoshiHideo/CompProgCodes | etc/Segment-Tree.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int n;
vector<ll> sg;
void bsg(int pos, int l, int r)
{
if(l == r)
{
cin >> sg[pos];
return;
}
int m = l + ((r-l)/2);
int p = (pos<<1);
bsg(p, l, m);
bsg(p + 1, m+1, r);
sg[pos] = sg[p] + ... | ALGO | 0.999756 | 4.503115 |
90687b16-9663-484c-942d-dc2b8d501068 | Kavin1421/Leetcode-Solution | 0500-0599/0556.Next Greater Element III/Solution.cpp | class Solution {
public:
int nextGreaterElement(int n) {
string s = to_string(n);
n = s.size();
int i = n - 2, j = n - 1;
for (; i >= 0 && s[i] >= s[i + 1]; --i)
;
if (i < 0) return -1;
for (; s[i] >= s[j]; --j)
;
swap(s[i], s[j]);
... | ALGO | 0.999944 | 5.497602 |
2c0c9780-12a0-4293-b3d2-3ac7ef1ab59d | raman7073/AllAboutCPP | Level4/graph/12.Articulation Point and Bridges/isBridge.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
int time = 0;
int bridgeUtil(int v, vector<bool> &visited, vector<int> &disc, vector<int> &low, vector<int> &parent, vector<int> adj[], int c, int d)
{
// Mark the current node as vi... | ALGO | 0.999729 | 6.39033 |
5fa53226-0cb3-4825-8791-3bc9f1c498ee | raincross7/code-similarity | codes/train_code/problem367/problem367_174.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vint;
typedef vector<double> vdbl;
typedef vector<ll> vll;
typedef vector<string> vstr;
typedef vector<vector<int> > vvint;
typedef vector<pair<int, int> > vpii;
typedef vector<... | ALGO | 0.999831 | 4.408658 |
50b3ed46-2751-43f4-ad0e-2f32fb9b0fa7 | Liul-Sintayehu/online_shopping | 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.998809 | 6.763549 |
19b05a48-9ffa-48a7-aa09-8ce85ad96e88 | darabmalik/DSA | Week-3/Ex_3.1.cpp | #include <iostream>
using namespace std;
int pwr(int X, int N)
{
if (N == 0)
return 1;
else
return pwr(X, N - 1) * X;
}
int main() {
int const base = 2;
for (int i = 0; i <= 20; i++) {
cout << i << "\t" << pwr(base, i) << endl;
}
} | ALGO | 0.992262 | 4.771085 |
5ca8e6b8-5d93-4acd-b2e1-95454814e21d | Ayushd70/LeetCodeSolutions | CPP/VerticalOrderTraversal.cpp | class Solution {
public:
map<int,set<pair<int,int>>> ans;
void pre( TreeNode *root, int horizontal_Level, int vertical_Level ){
if(!root)
return ;
ans[horizontal_Level].insert({vertical_Level,root->val});
pre(root->left,horizontal_Level-1,vertical_Level+1);
pre(root->... | ALGO | 0.999986 | 5.787128 |
5cf0f572-ec5b-4a9a-a546-94560f75a7ac | linouk23/leetcode | 557.cpp | // 557. Reverse Words in a String III - https://leetcode.com/problems/reverse-words-in-a-string-iii
#include "bits/stdc++.h"
using namespace std;
class Solution {
public:
string reverseWords(string s) {
for (int L = 0; L < s.length(); ++L) {
if (s[L] == ' ') { continue; }
int R = ... | ALGO | 0.999918 | 6.081904 |
119412bb-c43c-48b4-ad75-7f29e49179a8 | sarvex/leetcode-algol | solution/0000-0099/0063.Unique Paths II/Solution.cpp | class Solution {
public:
int uniquePathsWithObstacles(vector<vector<int>>& obstacleGrid) {
int m = obstacleGrid.size(), n = obstacleGrid[0].size();
vector<vector<int>> dp(m, vector<int>(n));
for (int i = 0; i < m && obstacleGrid[i][0] == 0; ++i) {
dp[i][0] = 1;
}
... | ALGO | 0.999789 | 6.297352 |
ee9ac933-7c58-488e-a65a-783d4e465ad8 | sebmorris/mcml | src/simulation/simulation.cpp | #include "simulation.hpp"
using std::cout;
using std::ostream;
using std::vector;
// Probably want another one with double width, double height, size_type bins
Simulation::Simulation(Material material, vector<double> trackedDistances, double trackingInterval, Random random) :
material_(material), trackingInterval_(t... | ALGO | 0.993175 | 6.143344 |
16b76d83-0086-45c4-b0f2-6306b52e0d23 | evanbanks/LeetCode | 367 Valid Perfect Square/answer.cpp | class Solution {
public:
bool isPerfectSquare(int num) {
int left = 1, right = num/2;
while (left < right){
int mid = (left + right + 1) / 2;
if (num / mid < mid) right = mid - 1;
else left = mid;
}
return left * left == num;
}
};
| ALGO | 0.999744 | 5.92557 |
5edac3e2-1518-4b50-a8eb-812774962a0a | RiyaJain12/DSA-with-Cpp | heap/MergeTwoBinaryMaxHeap.cpp | #include<bits/stdc++.h>
using namespace std;
void heapify(vector<int> &arr, int n, int i)
{
int largest = i;
int left = 2 * i +1;
int right = 2 * i + 2;
if (left < n && arr[largest] < arr[left])
{
largest = left;
}
if (right < n && arr[largest] < arr[right])
{
largest = ... | ALGO | 0.999986 | 4.26522 |
83fa1340-6739-4244-b85f-18c5fc5f5b51 | HemanthK-12/Self-Balancing-Bot | libraries/PID/PID_v1.cpp | #if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include <PID_v1.h>
/*Constructor (...)*********************************************************
* The parameters specified here are those for for which we can't set up
* reliable defaults, so we need to have the user set them.
**... | ALGO | 0.965991 | 6.349391 |
35e64de3-1f8b-41c4-93c0-b1a452aa2971 | sanketa124/Leetcode-all | C++/count-number-of-maximum-bitwise-or-subsets.cpp | // Time: O(min(2^n, m * n)), m is the 'bitwise or' of nums
// Space: O(min(2^n, m))
class Solution {
public:
int countMaxOrSubsets(vector<int>& nums) {
unordered_map<int, int> dp = {{0, 1}};
int total = 0;
for (const auto& x : nums) {
unordered_map<int, int> new_dp = dp;
... | ALGO | 0.999991 | 6.278815 |
a726db52-ebaa-4da0-a92d-ef35ab2826f8 | A-CS120-Group/project2 | part5/utils.cpp | #include "utils.h"
unsigned int crc32(const char *src, size_t srcSize) {
boost::crc_32_type crc;
crc.process_bytes(src, srcSize);
return crc.checksum();
}
int judgeBit(float signal1, float signal2) {
if (signal1 - signal2 > PREAMBLE_THRESHOLD)
return 1;
else if (signal2 - signal1 > PREAMBL... | TOOL | 0.998751 | 5.071432 |
639678c6-3b55-4d5d-bb8f-83ba91cf7087 | Rishabh7798/GFG-POTD-2025 | 10-03-2025.cpp | Edit Distance
class Solution {
public:
// Function to compute the edit distance between two strings
int editDistance(string& s1, string& s2) {
// code here
int m = s1.length(), n = s2.length();
vector<vector<int>> dp(m + 1, vector<int>(n + 1, 0));
// Base cases
... | ALGO | 0.999765 | 6.160347 |
762be2b8-2bf5-4fdf-a3f6-59f41658803f | ashrafulislampro/Basic_Data_Structure_with_phitron | Module_6.5/practice_3.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node *Next;
Node(int n)
{
this->val = n;
this->Next = NULL;
}
};
void insert_at_tail(Node *&head, Node *&tail, int val)
{
Node *newnode = new Node(val);
if (head == NULL)
{
head = newno... | ALGO | 0.999866 | 4.766901 |
6c781dd2-a2e9-483c-aafb-2dedae7275f5 | alexprut/HackerRank | Algorithms/Implementation/The Time in Words/Solution.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
string timeToString(int n) {
string hour;
switch (n) {
case 0:
hour = "zero";
case 1:
hour = "one";
break;
case 2:
hour = ... | ALGO | 0.999224 | 6.384772 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.