uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
cc1def03-3330-4129-8dfa-76487e6f53cc | GalacticPresidentSuperstarMAV/Ardu-Pilot | ArduPlane/takeoff.cpp | #include "Plane.h"
/* Check for automatic takeoff conditions being met using the following sequence:
* 1) Check for adequate GPS lock - if not return false
* 2) Check the gravity compensated longitudinal acceleration against the threshold and start the timer if true
* 3) Wait until the timer has reached the... | TOOL | 0.949874 | 3.149492 |
3f6a3118-0991-4592-a42f-7af42abfc5d5 | mirzaazwad/Competitive-Programming | SolvedProblems/Codeforces/B_Dictionary.cpp | #include <bits/stdc++.h>
#define fastio \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
#define endl "\n"
using namespace std;
int main()
{
fastio;
int t;
cin >> t;
while(t--)
{
string x;
cin >> x;
int ix=x[0]-'a';
ix*=25;
... | ALGO | 0.999884 | 4.619565 |
b0bd5535-42ac-4e5f-a3c6-35bf71b9f09e | ujjawalgupta29/Coding-Stuff | GFG/longest_alternating_subseq.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
int solve(vector<int> &nums, int n)
{
if(n == 0)
return 0;
vector<int> inc(n,1);
vector<int> dec(n,1);
int max_len = 1;
for(int i=1; i<n; i++)
{
int min_count = 1;
int max_count = 1;
... | ALGO | 0.99975 | 5.131734 |
b5d1b98c-183c-4d1f-a8b7-6cd25a7cc235 | Itsrajsk/DSA-In-Cpp-From-Scratch | Heap/Min-Heap.cpp | // Min Heap Using Priority Queue
#include <iostream>
#include <queue>
using namespace std;
int main()
{
priority_queue<int, vector<int>, greater<int>> minHeap; // Min-heap declaration
minHeap.push(10);
minHeap.push(20);
minHeap.push(30);
minHeap.push(40);
minHeap.push(50);
minHeap.push(60... | ALGO | 0.999439 | 5.280114 |
06863186-833f-496d-8895-ebe58d0b0871 | soon-yau/SDCND_Term2 | CarND-MPC-Project/src/Eigen-3.3/bench/sparse_lu.cpp |
// g++ -I.. sparse_lu.cpp -O3 -g0 -I /usr/include/superlu/ -lsuperlu -lgfortran -DSIZE=1000 -DDENSITY=.05 && ./a.out
#define EIGEN_SUPERLU_SUPPORT
#define EIGEN_UMFPACK_SUPPORT
#include <Eigen/Sparse>
#define NOGMM
#define NOMTL
#ifndef SIZE
#define SIZE 10
#endif
#ifndef DENSITY
#define DENSITY 0.01
#endif
#ifnd... | ALGO | 0.996395 | 4.19082 |
8deb5895-3fdb-4c78-86ce-b215c6d82540 | singlarohan/leetcode_sol | 0373-find-k-pairs-with-smallest-sums/2023-06-28 00.46.34 - Accepted - runtime 1163ms - memory 152.3MB.cpp | class Solution {
public:
vector<vector<int>> kSmallestPairs(vector<int>& num1, vector<int>& num2, int k) {
priority_queue<pair<int, vector<int>>> pq;
for(int i = 0; i < num1.size(); i++){
for(int j = 0; j < num2.size(); j++){
int curr = num1[i] + num2[j];
... | ALGO | 0.999992 | 5.846385 |
ef71dfe0-06c9-456b-a793-bb3c763bd4a8 | VladMaksimum/Laboratory-C- | Семестр 1/lab_8/task_3/main.cpp | #include <iostream>
#include "func.hpp"
#include <string>
int main()
{
const int n_max=2000;
const int p_max=4;
int cnt;
std::string words[n_max];
char popular_letters[p_max];
read(cnt,words);
find_popular_letters(cnt,words,popular_letters);
two_popular_in_row(cnt,words,popular_letter... | ALGO | 0.998213 | 4.129249 |
5c6e095e-9bbf-4987-878b-1d60e8805ab6 | ishandutta2007/codeforces | rg_gr/normal/1523/D.cpp | // Problem: D. Love-Hate
// Contest: Codeforces - Deltix Round, Spring 2021 (open for everyone, rated, Div. 1 + Div. 2)
// URL: https://codeforces.com/contest/1523/problem/D
// Memory Limit: 256 MB
// Time Limit: 3000 ms
//
// Powered by CP Editor (https://cpeditor.org)
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,po... | ALGO | 0.999632 | 3.454009 |
24bc582f-216b-4953-879b-1c3b870aecb6 | Saad-Ali-Khan-007/OOP | lab1/q13.cpp | #include <iostream>
using namespace std;
int startlab1()
{
cout << "Name: Saad Ali Khan(SE-23083)" << endl;
cout << "Lab 01" << endl;
return 0;
}
int l1q13()
{
int amount;
cout << "Enter amount in rupees: ";
cin >> amount;
int thousands = amount / 1000;
amount %= 1000;
int five_hun... | TOOL | 0.975847 | 3.213968 |
ed086996-26f6-4038-b3fc-4890539ae391 | amwatson/CitraVR | src/core/hw/aes/arithmetic128.cpp | #include <algorithm>
#include <functional>
#include "core/hw/aes/arithmetic128.h"
namespace HW::AES {
AESKey Lrot128(const AESKey& in, u32 rot) {
AESKey out;
rot %= 128;
const u32 byte_shift = rot / 8;
const u32 bit_shift = rot % 8;
for (u32 i = 0; i < 16; i++) {
const u32 wrap_index_a = ... | ALGO | 0.999069 | 6.15027 |
74f248d4-7fb7-4b09-b9a0-7dd15b63883d | dwolverine12/.vs | Practice/5.cpp | #include<iostream>
#include<vector>
#include<queue>
#include<climits>
#include<algorithm>
using namespace std;
struct Edge{
int destination, time;
Edge(int dest, int t) : destination(dest), time(t) {}
};
struct Compare{
bool operator()(const pair<int, int>& a, const pair<int, int>& b)
{
retur... | ALGO | 0.997995 | 5.504493 |
7c47fd47-e202-44af-972a-8e589266b438 | falcaoanderson/CompetitiveProgramming | juizes/vjudge-s10-B.cpp | // 01/08/23 //
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <tuple>
#include <cstring>
#include <stack>
using namespace std;
#define ll long long
#define endl "\n"
#define fast_io ios_base::sync_wit... | ALGO | 0.999973 | 4.836518 |
6c7d5a5e-d6f2-4902-8ede-883c01b88b62 | k8440009/Algorithm | BOJ/1068_1.cpp | // 트리
// https://www.acmicpc.net/problem/1068
#include <iostream>
#include <vector>
using namespace std;
const int MAX = 50 + 1;
int N, M;
int parent[MAX];
vector<int> adj[MAX];
vector <int> roots;
int answer;
void dfs(int idx)
{
int cnt = 0;
for (int data : adj[idx])
{
if (data == M)
continue;
cnt++;
if ... | ALGO | 0.999933 | 4.107968 |
0218d32a-182d-4bc0-8de1-d14aa095b184 | Pratheesh-555/DataStructures | RecursiveBinarySearch.cpp | // Algorithm recursiveBinarySearch (list, first, last, target, locn)
// 1. if first > last then
// 1. locn=-1
// 2. return false
// 2. else
// 1. mid = (first + last) / 2
// 2. if target< list[mid]
// 1. return recursiveBinarySearch (list, first, mid-1, target, locn)
// 3. else if target >l... | ALGO | 0.999964 | 5.192793 |
f628f86f-d257-4f80-b4c0-2904a4a520a9 | AndresVelezR/VRP-RESEARCH-PROJECT | src/Program/Params.cpp | #include "Params.h"
Params::Params(
const std::vector<double>& x_coords,
const std::vector<double>& y_coords,
const std::vector<std::vector<double>>& dist_mtx,
const std::vector<double>& service_time,
const std::vector<double>& demands,
double vehicleCapacity,
double durationLimit,
int nbVeh,
bool isDurationC... | TOOL | 0.964241 | 6.538357 |
e233dcdf-70a9-4b7b-b439-1a428a575eb8 | dheeraj-mlv/practice-leetcode | 435-non-overlapping-intervals/435-non-overlapping-intervals.cpp | class Solution {
public:
int eraseOverlapIntervals(vector<vector<int>>& intervals) {
// sort the given interval list
sort(intervals.begin(),intervals.end());
// now take 2 pointers previous and current
// now traverse on the current pointer check if its a overlapping interval or not... | ALGO | 0.999937 | 5.877907 |
a2816c2b-626c-412a-a2f1-8f0da1335e2a | SheaJanke/Competitive-Programming | Contests/Codeforces/Old/Global_Round_15/c.cpp | #include <bits/stdc++.h>
using namespace std;
bool hasIntersection(pair<int, int> &c1, pair<int,int> &c2){
vector<pair<int, int>> vals;
vals.push_back({c1.first, 1});
vals.push_back({c1.second, 1});
vals.push_back({c2.first, 2});
vals.push_back({c2.second, 2});
sort(vals.begin(), vals.end());
... | ALGO | 0.999905 | 3.75537 |
634e1671-3e40-43c3-9c4c-1ea6e10773fd | flintmarko/Python-Compilers- | src/asm.cpp | #include "../include/asm.hpp"
#include <iostream>
using namespace std;
const int stack_offset = 8;
int func_count = 0;
map<string, string> func_name_map;
map<string, string> m;
int cntr_loop = 0;
ASM::ASM(){;}
ASM::ASM(string op, string a1, string a2, string a3, string it) : op(op), arg1(a1), arg2(a2), arg3(a3), in... | TOOL | 0.863993 | 3.05439 |
c4663f7a-4eec-4c3a-a9a3-8ee9712c933b | Aashin20/LeetCode-Solutions | 136-SingleNumber/136-SingleNumber.cpp | // Last updated: 6/14/2025, 10:33:48 PM
class Solution {
public:
int singleNumber(vector<int>& nums) {
int ans=0;
for(int i=0;i<nums.size();i++){
ans=ans^nums[i];
}
return ans;
}
}; | ALGO | 0.999986 | 5.890512 |
bfc57835-b689-439f-a092-5a52917d6a93 | shreyaa2506/DSA_Problems | Graphs/TopologicalSortusingDFS.cpp | #include <bits/stdc++.h>
void topdfs(int node,unordered_map<int,bool>&visited,unordered_map<int,list<int>>&adj
,stack<int>&s ){
visited[node]=1;
for(auto i:adj[node] ){
if(!visited[i]){
topdfs(i,visited,adj,s);
}
}
s.push(node);
}
vector<int> topologicalSort(vec... | ALGO | 0.999993 | 5.04492 |
3564e253-e176-4921-a5a5-fe654e7e9107 | tonogutierrez/Evidencia1 | evidencia2.cpp | /*
Antonio Gutiérrez Mireles A01198527
Alejandro Hernandez A01571408
*/
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>
#include <fstream>
#include <limits>
#include <tuple>
#include <set>
#include <sstream>
using namespace std;
struct Colonia {
string nombre;... | ALGO | 0.999765 | 4.869913 |
12e99678-82b2-4eb8-a02d-156038112ebf | axelu/leetcode | cpp/02500-02999/maximumnumberofintegerstochoosefromarangei.cpp |
// 2554. Maximum Number of Integers to Choose From a Range I
// https://leetcode.com/problems/maximum-number-of-integers-to-choose-from-a-range-i/
class Solution {
public:
int maxCount(vector<int>& banned, int n, int maxSum) {
sort(banned.begin(),banned.end());
// greedily pick every none banned ... | ALGO | 0.99991 | 6.432189 |
91123325-564f-4772-a0ad-42a728e66b70 | yfuka86/pc | atcoder/arcold/arc145/a/arc145_a.cpp | #pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
#define rep_r(i,n) for(ll i=(ll)(n)-1;i>=0;i--)
#define rep2(i,sta,n) for(ll i=sta;i<(ll)(n);i++)
#define rep2_r(i,sta,n) for(ll i=(ll)(n)-1;i>=sta;i--)
#define all(v) (v).begin(),(v).end()
#define rall(v) (v).rbegin(),(v)... | ALGO | 0.999971 | 4.687275 |
62372387-0d49-4db6-b085-2cd95d75f747 | shengdewu/code | 第七章/7.4/WIN_MNN_PC_DEMO_HairColored/MNN/f_LaplaceSharpen.cpp | #include"f_LaplaceSharpen.h"
#include<stdlib.h>
#include<math.h>
#include<string.h>
#include<stdio.h>
#include"Commen.h"
int f_LaplaceSharpen(unsigned char* srcData,int width, int height,int stride,int mode)
{
int ret = 0;
unsigned char* tempData = (unsigned char*)malloc(sizeof(unsigned char) * height * stride);
in... | ALGO | 0.850936 | 3.436985 |
eb78fcc6-6cb6-4f4f-b1de-df5ece395d79 | sulmy03/Trabajos-Sulmy | TAREA JOYANES 88 y 89/5.18.CPP |
#include <iostream>
#include <math.h>
#define veinte 20
using namespace std;
int main(){
float termino, suma = 0;
for (float i = 1; i <= veinte; i++)
{
termino = i * i/ pow(3,i);
suma += termino;
}
cout << " valor de la suma = " << suma << endl;
return 0;
} | ALGO | 0.9998 | 3.02695 |
212018b9-0a89-43ee-861d-9f2ce2930177 | Ankit8607/GeeksForGeeks-must-do-problems | linked list/Merge two sorted linked lists.cpp | // https://practice.geeksforgeeks.org/problems/merge-two-sorted-linked-lists/1
Node* sortedMerge(Node* head1, Node* head2)
{
Node *head=NULL,*prev=NULL;
while(head1 or head2){
// cout<<head1->data<<" "<<head2->data<<endl;
if(head2==NULL || (head1!=NULL && head1->data<head2->data)){
... | ALGO | 0.999901 | 4.689165 |
69c7509c-f650-43b2-a1be-b3e6e53b1fb8 | Kyun2da/Algorithm | cpp/baekjoon/17219 비밀번호 찾기/17219 비밀번호 찾기/소스.cpp | #include <iostream>
#include <map>
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(0);
string s1, s2;
map <string, string> m;
int N, M;
cin >> N >> M;
for (int i = 0; i < N; i++) {
cin >> s1 >> s2;
m.insert(pair<string, string>(s1, s2));
}
for (int i = 0; i < M; i++) {
cin >> s1;
... | ALGO | 0.99986 | 4.021467 |
b9975169-3e84-4c9a-b36f-35da6f205ce0 | thanhthieuBKDN/Learn_GoogleTest | src/math.cpp | #include "math.h"
int32_t myMath::add(int32_t a, int32_t b) {
return a + b;
}
int32_t myMath::add(BasePhanSo& a, BasePhanSo& b) {
int tu1 = a.getTu();
int mau1 = a.getMau();
int tu2 = b.getTu();
int mau2 = b.getMau();
int tuResult = (tu1 * mau2) + (tu2 * mau1);
int mauResult = mau1 * mau2;... | TOOL | 0.892894 | 5.532531 |
691af0d5-9cd7-463e-9b49-459ba9c3ae00 | mailtokartik1/InterviewBit-Solutions | Cpp/Strings/palindrome-string.cpp | int Solution::isPalindrome(string A) {
string B, C;
// Loop through the string and convert the string to lowercase
// Push the alphanumeric characters into a new string
// Reverse the new string for comparison
for (int i = 0; i < A.size(); i ++) {
int temp = A[i];
if ((temp >= 48 &... | ALGO | 0.999942 | 5.535434 |
ee44bf82-e3c2-4f3d-9a3f-320fdfcc44d9 | ishandutta2007/codeforces | dragonslayerintraining/normal/459/A.cpp | #include <cstdio>
#include <algorithm>
int main(){
int X1,Y1,X2,Y2;
scanf("%d %d %d %d",&X1,&Y1,&X2,&Y2);
if(std::abs(X1-X2)==std::abs(Y1-Y2)){
printf("%d %d ",X1,Y2);
printf("%d %d\n",X2,Y1);
}else if(X1==X2){
int side=Y1-Y2;
printf("%d %d ",X1+side,Y1);
printf("%d %d\n",X1+side,Y2);
}el... | ALGO | 0.999831 | 3.421961 |
328cb209-f541-42ab-bd10-38a160075dc4 | yeasinshamimdev/operation-on-binary-tree- | input_binary_tree.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node *left;
Node *right;
Node(int val)
{
this->val = val;
this->left = NULL;
this->right = NULL;
}
};
Node *input_tree()
{
int val;
cin >> val;
Node *root;
if (val == -1)
root = NULL;
else
root = new... | ALGO | 0.999573 | 4.66638 |
53b45edd-1127-43fa-9d08-0275170a5002 | SemaMolchanov/cpp-basics | labs/lab10/o.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void to_bin(int n){
string s = "";
if(n == 0){
s = "0";
}
while(n != 0){
s += char(n%2 + 48);
n /= 2;
}
for(int i = 0; i < s.size()/2; i++){
swap(s[i], s[s.size()-1-i]);
}
co... | ALGO | 0.99994 | 5.067751 |
c157e240-8eb2-4875-9410-10051f25a715 | Savithakumaresan/codekata | natural.cpp | #include <iostream>
using namespace std;
class Sum
{
private :
int i,n,sum=0;
public :
void display()
{
cout<<"enter your number"<<endl;
cin>>n;
for(i=1;i<=n;i++)
{
sum=sum+i;
}
cout<<sum<<endl;
}
};
int main()
{
Sum s;
s.display();
... | ALGO | 0.897382 | 3.516733 |
9fe1a1af-cd01-4b6c-9f6d-083737752358 | np4800/cpp | arrays/8-second-largest-elememnt.cpp | #include <iostream>
#include <vector>
using namespace std;
int secondLargest(vector<int> arr, int n) {
for(int i=0; i<n; i++) {
int temp=0;
if (i == n-1) {
return arr[n-2];
}
if (arr[i] > arr[i+1]) {
temp = arr[i];
arr[i] = arr[i+1];
arr[i+1] = temp;
}
// cout << arr[i... | ALGO | 0.999619 | 4.044332 |
aea30a9b-d10c-4ce2-bd61-c2b2b577dd78 | wwwllm/C-- | codeforces/div.2(1033)2025.6.21/A.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
int l1, b1, l2, b2, l3, b3;
cin >> l1 >> b1 >> l2 >> b2 >> l3 >> b3;
auto check = [&]() -> bool
{
bool ok = 0;
if (l1 == l2 && l2 == l3 && b1 + b2 + b3 == l1)
ok = 1;
else if (l2 + l3 == l1 && b2 == b3 && b... | ALGO | 0.999814 | 4.624433 |
56c2295c-c5e0-48c6-bc49-20b9eb111e92 | bdcbqa314159/cppJoshi | cpp/src/payoff.cpp | #include "../include/cppJoshi_bits/payoff.hpp"
#include <algorithm>
Payoff1::Payoff1(double strike, optionType theOptionType) : strike(strike), strikeDD(0.), theOptionType(theOptionType)
{
}
Payoff1::Payoff1(double strike, double strikeDD, optionType theOptionType) : strike(strike), strikeDD(strikeDD), theOptionType(... | ALGO | 0.985374 | 5.664509 |
16a2e1a5-d889-4b15-9579-844455cbd0ad | michaelzhiluo/UVA-Online-Judge | Competitive Programming 3/Chapter 2/1DArray/UVA665.cpp | #include <iostream>
#include <bits/stdc++.h>
// Heads up, troll question, you cannot determine UNIQUE counterfeit coint with >, < so only focus on =
using namespace std;
int main(){
int TC, n, k, p;
char comparator;
scanf("%d", &TC);
while(TC--){
scanf("%d %d", &n, &k);
bool notcounterfeit[n+1];
for(int i=0;... | ALGO | 0.999666 | 3.392321 |
15bc1ffd-6c3d-4491-85dc-45dcf8b2455b | thailin1/Programming-Cpp | KOLOKWIUM/exam6/zad3.cpp | #include <iostream>
#include <cmath>
int main() {
int n;
// Wczytanie liczby
std::cout << "Podaj liczbe calkowita: ";
std::cin >> n;
// Obliczenie i wypisanie wyniku
int wynik = static_cast<int>(std::sqrt(n));
std::cout << "[sqrt(n)] = " << wynik << std::endl;
return 0;
}
// W tym p... | ALGO | 0.999251 | 5.637111 |
25deb09b-26ee-4fa5-b4cd-854c31a87b6a | Mondonno/algorithms | src/math/euklides_rozszerzony.cpp | // todo: dodanie euklidesa rozszerzonego iteracyjnie
/*
Euklides rozszerzony zaimplementowany rekurencjynie
*/
int yp;
int x = 1;
int y = 0;
void euklidesRozszerzony(int a, int b) {
if(b == 0) return;
euklidesRozszerzony(b, a % b);
yp = y;
y = x - ((a/b) * yp);
x = yp;
} | ALGO | 0.996461 | 3.817078 |
baf5f883-3a41-4968-a433-d265aaef717f | Mr-Python-in-China/LuoguProblem | Luogu_P_1352.cpp | #include <bits/extc++.h>
using namespace std;
namespace pbds = __gnu_pbds;
using ui = unsigned int;
using tree = vector<vector<size_t>>;
void dfs(vector<int> const& r, tree const& t, vector<pair<int, int>>& f,
size_t const& p) {
f[p].first = r[p], f[p].second = 0;
for (size_t const& i : t[p]) {
dfs(r, ... | ALGO | 0.999833 | 3.999512 |
bce227fa-3aaa-4c73-bf5f-583563ab23a4 | CMU-CBML/RDCNN | FEM_Data_Generation/eigen3/doc/examples/QuickStart_example2_dynamic.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXd m = MatrixXd::Random(3,3);
m = (m + MatrixXd::Constant(3,3,1.2)) * 50;
cout << "m =" << endl << m << endl;
VectorXd v(3);
v << 1, 2, 3;
cout << "m * v =" << endl << m * v << endl;
}
| ALGO | 0.999179 | 3.515557 |
d4613e09-47d6-4fbb-b0d5-b02e934cbe65 | archie-95/HackerRank | Junping On the Clouds.cpp | #include<iostream>
using namespace std;
int main()
{
int n,ar[100],i,count=0;
cin>>n;
for(i=0;i<n;i++)
{
cin>>ar[i];
}
for(i=0;i<n;i++,count++)
{
if(i<n-2 && ar[i+2]==0)
i++;
}
cout<<--count;
}
| ALGO | 0.99995 | 3.409764 |
d51530e7-d9d8-4bbf-b712-000735210da4 | ayush0x00/data_structures | friend_function.cpp | //This code demonstrates how to use friend function to multiply a matrix and vector
#include<iostream>
#include<vector>
class create_matrix;
class create_vector{
public:
create_vector(std::vector<int> v):_vector(v){
std::cout << "Vector created with elements as follows " << '\n';
for(auto it=_vector.begin();... | ALGO | 0.965443 | 5.128956 |
7d05d2a1-97a2-4a4b-8151-ffb2f57aeba4 | coding-pandaa/Data-Structure-Algorithm | Arrays/MEDIUM/1.TwoSum.cpp | #include<bits/stdc++.h>
using namespace std;
vector<int> twoSum(vector<int> &v,int n,int k)
{
unordered_map<int,int> mp;
vector<int> res;
for(int i=0;i<n;i++)
{
if(mp.find(k-v[i])!=mp.end())
{
res.push_back(i);
res.push_back(mp[k-v[i]]);
}
mp[v[i]]... | ALGO | 0.999975 | 4.866149 |
b35aa362-2e4a-4230-99c2-8b58acf27c02 | yosef8234/test | hackerrank/c++/introduction/arrays-introduction.cpp | // An array is a series of elements of the same type placed in contiguous memory locations that can be individually referenced by adding an index to a unique identifier.
// Declaration:
// int arr[10]; //Declares an array named arr of size 10, i.e; you can store 10 integers.
// Accessing elements of an array:
// Ind... | ALGO | 0.99994 | 5.234724 |
204af722-4549-4738-9df0-52a6c35e5d07 | CakeForest/noip | 2016上课/7.15/012 最优布线问题 Kruskal.cpp | #include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int MAX=10000;
int map[MAX][MAX],arcnum=1,sum,father[MAX];
struct arc{
int a,b,l;
}Arc[MAX];
bool cmp(arc a,arc b){
return a.l<b.l;
}
void addarc(int a,int b,int l){
Arc[arcnum].a=a;
Arc[arcnum].b=b;
Arc[arcnum].l=l;
arcnum++;
}
in... | ALGO | 0.999859 | 3.318374 |
005294b3-4716-418b-b66a-58b116dff9fd | WizardPenguin/competative-programming | ubuntu/C_Longest_Regular_Bracket_Sequence.cpp | #pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef pair<double,double> p... | ALGO | 0.999324 | 4.568284 |
db8ba67d-028c-469d-ad02-c9718942dc68 | BALLISTICrobin/c-plus-plus-and-dsa | toMyCritics.cpp | #include<iostream>
using namespace std;
int main(int argc, char const *argv[])
{
int test;
cin>>test;
while(test--){
int a,b,c;
cin>>a>>b>>c;
if(a+b>=10){
cout<<"YES"<<endl;
}
else if(b+c>=10){
cout<<"YES"<<endl;
}
else if(c+a>... | ALGO | 0.998708 | 4.11426 |
996d137e-0d61-498b-ba1c-c7203fefe31c | Allenkar63/Arrays-Strings | palindrome.cpp | #include <iostream>
#include <string>
using namespace std;
int main(){
string a,revstr;
int length,i;
cout<<"Enter a string: ";
cin>>a;
length=a.length();
for(i=length-1;i>=0;i--)
{
revstr+=a[i];
}
if(a==revstr)
{
cout<<"It is a palindrome.";
}
else
... | ALGO | 0.999525 | 4.137683 |
5e77cf6c-476c-4886-a143-d5cf58dea6c6 | Mohit21/Questions-Mohit | COdeforces/CodeforcesGoodContest.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
long long n;
cin>>n;
int flag=0;
for(int i=0;i<n;i++){
string str;
int bef,aft;
cin>>str;
cin>>bef>>aft;
if(bef>=2400 && aft>bef){
flag=1;
}
}
if(flag==1){
cout<<"YES";
... | ALGO | 0.999653 | 3.515396 |
3688dbab-8a67-4cbe-85eb-a269f42462e3 | Ashish-Chokhani/Competitive_Programming | Codeforces/1667A.cpp | #include <bits/stdc++.h>
using namespace std;
long long int findOperations(long long int ai, long long int k)
{
double x=(double)k/ai;
return ceil(x);
}
void solve()
{
long long int n;
cin >> n;
vector<long long int> arr(n);
for (long long int i = 0; i < n; i++)
{
cin >> arr[i];
... | ALGO | 0.999982 | 3.915895 |
89027212-fda8-4445-bab1-53cc60b3aae6 | saumyaagarg/100-Days-of-DSA | Day 02/5-elements-more-than-once.cpp | // Solve the "find all elements that appear more than once in an array" problem.
#include <iostream>
using namespace std;
// Function to find and print elements with duplicates in the array
void findDuplicateElements(int arr[], int n) {
bool *visited = new bool[n](); // Create a visited array to mark processed el... | ALGO | 0.99985 | 6.351228 |
10fd521b-48f3-4a31-839e-c0ea79615c4b | keeganryan/flatter | src/problems/relative_size_reduction/orthogonal.cpp | #include "orthogonal.h"
#include <cassert>
#include "workspace_buffer.h"
#include "math/mpfr_lapack.h"
namespace flatter {
namespace RelativeSizeReductionImpl {
const std::string Orthogonal::impl_name() {return "Orthogonal";}
Orthogonal::Orthogonal(const RelativeSizeReductionParams& params, const ComputationContex... | ALGO | 0.959379 | 6.380939 |
fd46c6f7-6578-4c6b-a41a-da48ade0ad67 | ishandutta2007/codeforces | tatyam/normal/1463/A.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using uint = unsigned;
using pcc = pair<char, char>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
using pdd = pair<ld, ld>;
using tuplis = array<ll, 3>;
template<class T> using pq = prior... | ALGO | 0.999829 | 4.43671 |
4e32e6c7-4046-4feb-ac9f-e47624a7a900 | kimsg125/Baekjoon | 프린터_큐.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair<int,int> pii;
void solve() {
int N, M, n, cnt=0;
cin >> N >> M;
queue<pii> A;
vector<int> B;
for (int i = 0; i < N; i++)
{
cin >> n;
A.emplace(n,i);
B.push_back(n);
}
sort(B.begin()... | ALGO | 0.999861 | 5.379076 |
4a18f041-431c-4f21-bccf-7ce88e5f50da | 404Naoki/Atcoder | abc171/f.cpp | #include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
const int INF = 1e9 + 7;
int main(void){
int k;
string s;
cin >> k >> s;
return 0;
} | ALGO | 0.99981 | 3.279525 |
aa8d3e54-4ae8-4b80-9a53-e4cf3c212040 | rafaelGuasselli/exercicios | judges/vjudge/topicos_2/treino_maratona/j3.cpp | #include <iostream>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
const string CARD_ORDER = "A23456789DQJK";
const char WILDCARD = '*';
struct Player {
map<char, int> card_count; // Keeps track of the number of each card
vector<char> cards; // Keeps track of the actual cards
... | ALGO | 0.99993 | 6.204695 |
c18e232e-6e22-46d8-b194-3844418595cd | princekumar1291/The-Complete-FAANG-Preparation-DSA- | _14_DP/_03_2D/_03_UniquePathsII.cpp | //Problem Link: https://leetcode.com/problems/unique-paths-ii/description/
class Solution {
public:
int helper(int i,int j,vector<vector<int>>& obst,vector<vector<int>>& dp){
if(i>=0 && j>=0 && obst[i][j]==1) return 0;
if(i==0 && j==0) return 1;
else if(i<0 || j<0) return 0;
if(dp[i... | ALGO | 0.999607 | 6.173623 |
77f2e8b7-a4a0-408f-9d7f-2f0288a0b7a2 | martonistvan/CarND-Path-Planning-Project-master | src/Eigen-3.3/bench/geometry.cpp |
#include <iostream>
#include <Eigen/Geometry>
#include <bench/BenchTimer.h>
using namespace std;
using namespace Eigen;
#ifndef SCALAR
#define SCALAR float
#endif
#ifndef SIZE
#define SIZE 8
#endif
typedef SCALAR Scalar;
typedef NumTraits<Scalar>::Real RealScalar;
typedef Matrix<RealScalar,Dynamic,Dynamic> A;
type... | ALGO | 0.941071 | 5.941502 |
064c9b00-4d50-4308-a141-2b2b67c8d001 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/MixtralExpert/top0-100/word-pattern-Solution.wordPattern/177768_DoS.cpp | sparse_dump_region (struct tar_sparse_file *file, size_t i)
{
union block *blk;
off_t bytes_left = file->stat_info->sparse_map[i].numbytes;
if (!lseek_or_error (file, file->stat_info->sparse_map[i].offset))
return false;
while (bytes_left > 0)
{
size_t bufsize = (bytes_left > BLOCKSIZE) ? BLOCKS... | TOOL | 0.960589 | 6.748899 |
f73958bc-0585-4150-b20a-4eb8b8a5c774 | torizon/mesa-deb | src/compiler/glsl/opt_flip_matrices.cpp | /**
* \file opt_flip_matrices.cpp
*
* Convert (matrix * vector) operations to (vector * matrixTranspose),
* which can be done using dot products rather than multiplies and adds.
* On some hardware, this is more efficient.
*
* This currently only does the conversion for built-in matrices which
* already have tra... | ALGO | 0.976789 | 7.516939 |
0e27fed8-e227-4f72-9fbc-8f47d8ed7282 | sm3304love/nonlinear_mpc | src/nonlinear_mpc.cpp | #include <nonlinear_mpc/nonlinear_mpc.hpp>
#include <pluginlib/class_list_macros.h>
PLUGINLIB_EXPORT_CLASS(nonlinear_mpc::NonlinearMPC, nonlinear_mpc::NonlinearMPCInterface)
namespace nonlinear_mpc
{
NonlinearMPC::NonlinearMPC()
{
Q_trans.diagonal() << 800, 800, 800;
Q_ori.diagonal() << 300, 300, 300;
Q_v... | TOOL | 0.996082 | 5.951381 |
1f8bc81f-9f9c-42f9-9ad2-ce159ce95196 | webaverse-studios/webaverse | packages/engine-wasm/PhysX/physx/samples/samplenorthpole/SampleNorthPoleBuilder.cpp | #include "PxPhysicsAPI.h"
#include "PxTkStream.h"
#include "SampleNorthPole.h"
using namespace PxToolkit;
#define USE_MESH_LANDSCAPE // PT: define this to use a triangle mesh for the landscape, instead of a heightfield
static PxReal randomScaled(PxReal value)
{
PxReal val = value*(getSampleRandom().randomFloat());
... | ALGO | 0.866112 | 5.02704 |
2c3c6019-0b59-4a24-8d03-558e48ca090e | circt/llvm | libcxx/test/libcxx/fuzzing/partition_copy.pass.cpp | // UNSUPPORTED: c++03, c++11
#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <vector>
#include "fuzz.h"
extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) {
auto is_even = [](auto t) {
return t % 2 == 0;
};
std::vector<std::u... | TEST | 0.980011 | 5.89314 |
9dce5bc0-fb64-4aaf-aad6-253a71b72b28 | GreyMerlin/Factplusplus | Kernel/Input.cpp | #include "dlTBox.h"
//-----------------------------------------------------------------------------
//-- Subsumption axioms and support
//-----------------------------------------------------------------------------
// return true if undefined concept found
void TBox :: addSubsumeAxiom ( DLTree* sub, DLTree* sup )
{... | ALGO | 0.965117 | 4.465846 |
407a8066-5c18-4033-9e11-a78e9f95c5b1 | 1838641320/newbee_code_store | 20.6/Atlantis HDU - 1542 扫描线.cpp | #include"s.h"
#include<bits/stdc++.h>
#define rep(i,a,b) for(int i=a;i<b;i++)
using namespace std;
const int maxn=209;
struct Li{ double x1,x2,h,d; }rect[maxn];
int n;
char num[maxn];
double x[maxn];
void add(int l,int r,char d){
for(char *i=num+l,*ed=num+r;i!=ed;i++)
(*i)+=d;
}
double cnt(int tot){
double res=0;
... | ALGO | 0.993547 | 3.239018 |
3ffd3993-9a89-491f-b238-b41300b15e76 | ypizarroza90/ACM-ICPC | UVA/991.cpp | #include <iostream>
#include<stdio.h>
using namespace std;
long long int Catalan(int n)
{
if(n<=0)
{
return 1;
}
else
{
return (2*(2*n-1)*Catalan(n-1))/(n+1);
}
}
int main()
{
int n,ok=0;
while(cin>> n){
if(ok)puts("");
cout<< Catalan(n)<<endl;
ok=1... | ALGO | 0.999919 | 4.181602 |
1a6677fd-42bb-4a2e-81dd-2ea78361582b | Rajat-Goyal/all-over-again | cf/499B.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
string st1,st2;
int n,m;
map<string,string>mp;
cin>>n>>m;
for(int i=0;i<m;i++){
cin>>st1>>st2;
if(st2.length()<st1.length())mp[st1]=st2;
else mp[st1]=st1;
}
... | ALGO | 0.999974 | 4.086932 |
ed755f0b-c5a2-49f4-9d27-520ea32c8e4c | shiridikumar/cp | 901a.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
int test;
cin>>test;
for(int tes=0;tes<test;tes++){
int n;
cin>>n;
int a[n];
int eff=0;
for(int i=0;i<n-1;i++){
cin>>a[i];
eff+=a[i];
}
cout<<-1*eff<<en... | ALGO | 0.998576 | 3.496567 |
a00ad4db-e051-46a6-bd7a-a4113bde4fdb | RiddhikaBansal/c-plus-plus-array | search.cpp | #include<iostream>
using namespace std;
int main()
{
int A[]={2,43,7,-8,5,9,-7,3};
int key;
cout<<"enter key here "<<endl;
cin>>key;
for(int i=0;i<10;i++)
{
if(key==A[i])
{
cout<<"key found at "<<i<<endl;
return 0;//we have to close loop after checking th... | ALGO | 0.999701 | 3.603761 |
2f975559-f331-4e65-87cf-8cb498521cb6 | WIndki/Personal | BaseLesson/printNMatrix.cpp | #include <iostream>
#include <iomanip>
using namespace std;
void printMatrix(int n) {
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= n; j++) {
cout.width(3);
cout << to_string(min(i, j));
}
cout << endl;
}
}
int main() {
int n;
while (cin >... | ALGO | 0.999568 | 4.943184 |
c483ccbd-0da4-4a38-b874-53b15c7dc285 | Kazi-Namira/C_Plus_Plus_practice | Codeforces/Sheet#1-Data_Type/O.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
char s;
cin>>a>>s>>b;
if(s=='+')
{
cout<<a+b<<endl;
}
else if(s=='-')
{
cout<<a-b<<endl;
}
else if(s=='*')
{
cout<<a*b<<endl;
}
else
{
cout<<a/b<<endl;
}
return 0;
}
| ALGO | 0.9994 | 3.711796 |
138ed8ee-d301-4037-84de-aafb394f0356 | lovely2001/DSA_Practice | Arrays/1.cpp | //Given an integer array(arr) and its size(n), print the count of odd and even integers present in the array.
#include<iostream>
using namespace std;
int main(){
int arr[]={1,2,3,4,5};
int size=5;
int count_evennumber=0;
int count_oddnumber=0;
for(int i=0;i<size;i++){
if(arr[i]%2==0){
... | ALGO | 0.998078 | 5.486624 |
0b575269-5e69-493c-b743-766f0d87ae32 | NavesEdu/exercicio_mock_lab | exercicio_mock/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.998095 | 6.785645 |
0a43e95a-f417-4988-bda6-72f194e90533 | IT-Nick/RepeatLection | main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <iterator>
using namespace std;
/Степа Плеханов, [22.02.2022 02:40]
Напишите функцию, разбивающую строку на слова по пробелам.
vector<string> SplitIntoWords(const string& s);
(ищи пробел с помощью find, создавай слово с помощью констрк... | ALGO | 0.982715 | 3.901426 |
5ec4ae44-f3f9-47ea-a60a-e4708c6cf045 | VishalSaha001/DSA_practice | dijkstra.cpp | #include <queue>
#include <iostream>
#define pii std::pair<int, int>
std::vector<std::vector<pii>> adj;
std::vector<int> dijkstra(int src)
{
int n = adj.size();
std::vector<int> dist(n, __INT_MAX__);
std::priority_queue<pii, std::vector<pii>, std::greater<pii>> pq;
dist[src] = 0;
pq.push({dist[src]... | ALGO | 0.999973 | 4.94019 |
db190d2d-0369-45c5-b52f-c2db4e629540 | UndeShravani/cppAssisment | Totalcost.cpp | #include <iostream>
using namespace std;
int main()
{
//needs 15 notebooks and 20 pens
int book=15;
int pen=20;
double notebookprice=2.25;
double penprice=0.75;
//The total cost
double totalbookcost=book*notebookprice;
double totalpencost=pen*penprice;
//result
cout<<"Total book cost:Rs."<<totalboo... | TOOL | 0.907621 | 4.191 |
63d212f8-9a76-4786-b2be-17bbc9ae2fca | tkddn204/coding-test-training-cpp | done/lecture/2164.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl "\n"
void solve() {
queue<int> q;
int n;
cin >> n;
for (int i = 1; i <= n; i++) q.push(i);
while (q.size() > 1) {
q.pop();
q.push(q.front());
q.pop();
}
cout << q.front();
}
int main() {
ios_base::sync_with_stdio(false);
cin.t... | ALGO | 0.999957 | 4.118879 |
291c4e35-3748-4f85-9659-fa7bbfbe10a4 | MahajanYashasvi156/LeetCoding | 214-shortest-palindrome/214-shortest-palindrome.cpp | class Solution
{
public:
string shortestPalindrome(string s)
{
string text = s;
string temp = s;
reverse(temp.begin(),temp.end());
text = text + "$" + temp;
int i = 1;
int j = 0;
vector<int> lps(text.size(),0);
while(i<text.size())
{
... | ALGO | 0.999963 | 5.555279 |
f2ea8fa7-8a93-4313-91d5-ea4f1da6d408 | bhartik021/Data-Structure-Algorithm | Array/2009. Minimum Number of Operations to Make Array Continuous.cpp | class Solution {
public:
int minOperations(vector<int>& nums) {
int n = nums.size();
std::sort(nums.begin(), nums.end());
std::vector<int> uniqueNums(nums.begin(), std::unique(nums.begin(), nums.end()));
int ans = std::numeric_limits<int>::max();
for (int i = 0; i < uniqueNums.s... | ALGO | 0.999876 | 5.75969 |
9f8abac5-67c2-496c-a3fd-b4e3f9757c88 | starHo4/AtCoder_PastProblems | ABC/A/ABC072A/main.cpp | #include <iostream>
using namespace std;
int main(){
int X, t;
cin >> X >> t;
if(X > t){
cout << X - t << endl;
} else {
cout << 0 << endl;
}
} | ALGO | 0.999679 | 3.527069 |
2c90b3d8-7533-43cc-8d84-f9ef99b28067 | karouzakisp/llvm-dev | llvm/lib/CodeGen/ShrinkWrap.cpp | #include "llvm/ADT/BitVector.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/CFG.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineBlockFrequencyInfo.h"
#include "llvm/CodeGen/... | ALGO | 0.998917 | 5.970235 |
dc2b5957-9fe0-4f83-b72d-4e5d34cc13e3 | Nafyaz/my-codes | Codechef/FLIPFAIL.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define show(x) cout << #x << ": " << x << "; "
#define pll pair<ll, ll>
#define pii pair<int, int>
#define ff first
#define ss second
#define MOD 1000000007
#define MAXN 2000006
void solve(int caseno)
{
int i, ones, zeros, cost, ans;
string s;
... | ALGO | 0.999983 | 4.669207 |
ffae2d76-3a74-45fe-9b0c-0009067ae0ca | redotter84/algo | sqrt.cpp | // 85 d
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize ("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#include <unordered_set>
#include <unordered_map>
#include <rando... | ALGO | 0.999598 | 4.677928 |
98d117fd-c8d1-4494-ad3b-609f6c26a608 | bdwgarrison/MiniMath | functions.cpp |
#include "functions.h"
#include "algorithms.h"
#include <cmath>
#include <stdexcept>
#include <fstream>
#include <sstream>
/********************************** ntuple DEFINITIONS **************************/
namespace functions_and_mathematical_objects_for_numerical_analysis{
ntuple::tupiter ntuple::begin()
{ return ... | TOOL | 0.973771 | 4.920354 |
1ce91e6c-5040-4e56-8151-902d431b231e | ZXYUSTC/Coding | MergeSort_Link.cpp | #include<iostream>
using namespace std;
typedef struct Node{
int val;
struct Node* next;
Node(int x){
val=x;
next=NULL;
}
}Node;
void Merge(Node *p, Node *q, Node *r){
Node *s1=p, *s2=p->next;
Node *head=new Node(0);
Node *s=head; }
while(s1!=q&&s2!=r){
if(s1->val<=s2->val){
s->next=s1;
s1=s1->next... | ALGO | 0.999985 | 4.429787 |
e391ca53-dd63-4dec-bc96-9b069976b07b | Sanchit-100/CodeForces_Contests | CP-1-1/q4.cpp | #include<iostream>
#include<vector>
#include<unordered_map>
#include<string>
#include<algorithm>
using namespace std;
using ll=long long;
int main(){
ll n,m;
cin>>n>>m;
vector<ll> arr;
for(int i=0;i<n;i++){
ll temp;
cin>>temp;
arr.push_back(temp);
}
ll ans=0;
... | ALGO | 0.999887 | 3.710979 |
9545af44-f8f4-4439-8941-cb30d785716b | ZuoYaoyao/algorithm | bfs.cpp | //一定要形成习惯,抽象的好处,不要因为一时的方便,而违反规定。
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<queue>
using namespace std;
struct node{
int adjvex;
struct node* next;
};
struct list{
struct node* head;
};
struct graph{
int vertex;
struct list* array;
};
int visited[8];
queue<int> q;
struct... | ALGO | 0.999866 | 3.828629 |
bc0f0d1d-6c2b-448e-b82b-83de1697b6b3 | sarvex/leetcode-factor | solution/0900-0999/0944.Delete Columns to Make Sorted/Solution.cpp | class Solution {
public:
int minDeletionSize(vector<string>& strs) {
int n = strs.size();
int m = strs[0].size();
int res = 0;
for (int i = 0; i < m; ++i) {
for (int j = 0; j < n - 1; ++j) {
if (strs[j][i] > strs[j + 1][i]) {
res++;
... | ALGO | 0.99999 | 6.246359 |
b536ddad-5cdc-42cd-ad41-5b3c1d436e6f | ar-harsha/PPT | assign18/q1.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
vector<vector<int>> intervals(vector<vector<int>> &arr){
vector<vector<int>> ans;
sort(arr.begin(),arr.end());
for(int i=0;i<arr.size();i++){
if(ans.empty() || ans.back()[1]<arr[i][0]){
ans.push_back(arr[i]);
}
... | ALGO | 0.999761 | 4.593065 |
19529398-4e9e-43e1-a48d-dbdb4a17e057 | keijak/comp-pub | atcoder/abc014/D/lca3.cpp | #include <bits/stdc++.h>
using i64 = long long;
using u64 = unsigned long long;
#define REP(i, n) for (int i = 0, REP_N_ = (n); i < REP_N_; ++i)
#define ALL(x) std::begin(x), std::end(x)
template <class T>
inline int ssize(const T &a) {
return (int)std::size(a);
}
template <class T>
inline bool chmax(T &a, T b) {
... | ALGO | 0.999758 | 4.629922 |
ce617544-e809-412e-a95a-ec0282895500 | cjm571/Mu-Man | lib/boost_1_55_0/libs/local_function/example/gcc_cxx11_lambda.cpp | #include <boost/config.hpp>
#ifdef BOOST_NO_CXX11_LAMBDAS
# error "lambda functions required"
#else
#include <boost/detail/lightweight_test.hpp>
#include <algorithm>
int main(void) {
//[gcc_cxx11_lambda
int val = 2;
int nums[] = {1, 2, 3};
int* end = nums + 3;
int* iter = std::find_if(nums, end... | TEST | 0.939863 | 6.216812 |
4a5394ab-af26-4055-a3b5-691f0437ec2d | aaditibisht805/leetcode-gfg | 0141-linked-list-cycle/0141-linked-list-cycle.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
bool hasCycle(ListNode *head) {
ListNode * temp, * r;
temp = head;
r= head;
if(head==0)
... | ALGO | 0.999813 | 4.77713 |
0af4bde5-dadb-4d21-9f5e-36c5c8e15774 | ICPCCualquiera/notebook | stl/set/array_enlazado.cpp | #pragma region // ArrayEnlazado
struct ArrayEnlazado {
// ocurrencias[x] := { i | arr[i] = x }
// prevA[i] := max j tq. j < i && arr[j] = arr[i] (def. -1)
// nextA[i] := min j tq. i < j && arr[i] = arr[j] (def. sz(arr))
map<int, set<int>> ocurrencias;
vector<int> arr;
vector<int> prevA;
v... | ALGO | 0.999922 | 5.155302 |
2d99a0af-cd2f-412b-b606-5525b6805b4a | codecommander03/Problemset | E_Permutation_of_Rows_and_Columns.cpp | #include <bits/stdc++.h>
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
// सुखदुःखे समे कृत्वा लाभालाभौ जयाजयौ॥
// ततो युद्धाय युज्यस्व नैवं पापमवाप्स्यसि॥
template <typename T, class C = std::less<T>>
using ordered_set = tree<T,... | ALGO | 0.999862 | 3.738772 |
ee7bc6bc-ba7d-445f-8294-3aaae97a708c | hma40/Cpp-Competitive-Programming | USACO/2019_20_USACO/Gold/FavoriteColors.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n,m;
vector<set<int>> adj, radj;
vector<int> ans;
vector<int> parents;
void debug() {
for(int i = 0; i < n; i++) {
cout << "[";
for(int j: adj[i]) cout << j << ", ";
cout << "],";
}
cout << endl;
for(int i = ... | ALGO | 0.999995 | 4.414929 |
182a2bbb-f570-4e5c-9f8c-f2ac3d56b686 | roy-subhojeet/leetcode | 0011-container-with-most-water/0011-container-with-most-water.cpp | class Solution {
public:
int maxArea(vector<int>& height) {
int head = 0;
int tail = height.size()-1;
int maxArea = 0;
while(head < tail)
{
int h = min(height[head], height[tail]);
maxArea = max(maxArea, h * (tail - head));
if(height[head] ... | ALGO | 0.999976 | 6.695138 |
0cc1ee72-d23e-4255-97b4-8e4c25663491 | Vmessaggi/Estrutura-de-dados | GRAFOS/EXPLGRAFOS-2.cpp | #include <iostream>
#include <string>
#include <locale>
using namespace std;
class GrafoNode{
public:
GrafoNode(){
prox = nullptr;
}
GrafoNode(string follower, GrafoNode *ptr = nullptr){
nome = follower; prox = ptr;
}
string nome;
GrafoNode *... | TOOL | 0.901523 | 3.728372 |
61ea2677-57ac-4223-93bf-97017cc2a810 | GregorRoncin/p23-ap-cplusplus | Sujet Matrice/question1_2.cpp | #include <iostream>
#include <vector>
//Question 1
class Vertex;
class Edge {
public:
Vertex* start; // Sommet de départ de l'arête
Vertex* end; // Sommet de fin de l'arête
int weight; // Poids associé à l'arête
Edge(Vertex* s, Vertex* e, int w) : start(s), end(e), weight(w) {} // Constructeur... | ALGO | 0.994208 | 4.203759 |
ff1f082b-ab9f-4726-b778-74c9cd783194 | Kiddinglife/Seriousness | server/thirdparty/folly/experimental/NestedCommandLineApp.cpp | #include <folly/experimental/NestedCommandLineApp.h>
#include <iostream>
#include <folly/FileUtil.h>
#include <folly/Format.h>
#include <folly/experimental/io/FsUtil.h>
namespace po = ::boost::program_options;
namespace folly {
namespace {
// Guess the program name as basename(executable)
std::string guessProgramN... | TOOL | 0.878046 | 7.541818 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.