uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
09966cd5-ec3c-477e-9c9c-2e05acc1e753 | liuxi93ing/My-Leetcode | 027_Remove element/main.cpp | #include <iostream>
#include <vector>
#include "Solution.h"
using namespace std;
int main()
{
Solution s;
vector<int> nums = {};
int val = 1;
int length = s.removeElement(nums,val);
for(int i=0; i<length;i++)
cout<< nums[i]<<' ';
cout<<'\n';
return 0;
}
| ALGO | 0.999431 | 4.752352 |
aa49157b-c7ed-4cc1-a658-d2a17384db45 | MahendraSH/dsa-cpp | arrayProblems/medium/pro10.cpp | // 10.##Problem Statement : You are given an array of โNโ integers.You need to find the length of the longest sequence which contains the consecutive elements.
#include <bits/stdc++.h>
using namespace std;
int findLarCon(vector<int> &a)
{
sort(a.begin(), a.end());
int n = a.size();
int maxlen = 1;
int... | ALGO | 0.999743 | 4.422977 |
42e11069-af37-45ce-8078-549f32bad0bb | Hazelanai/Fresas-con-chocolate | suma_de_pares.cpp | #include <iostream>
using namespace std;
int main(){
int n;
// calcular la suma de los nรบmeros pares desde 1 hasta n
cout <<"Ingrese el numero" << endl;
cin >> n;
int suma = 0;
for(int i = 1; i <= n; i++){
if(i % 2 == 0){
suma += i;
cout << i << endl;
}... | ALGO | 0.997884 | 4.266484 |
32e0ae2d-56c0-4e9d-b60e-ec8e02fc7bfb | zhou-jk/code | Gym/104012 2022-2023 ICPC NERC (NEERC), North-Western Russia Regional Contest (Northern Subregionals)/M/M.cpp | #include<iostream>
#include<cstdio>
#include<set>
using namespace std;
const int N=200005;
const int M=1000005+N;
int n,m,q;
int c[N];
set<int>s;
set<int>pos[M];
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr),cout.tie(nullptr);
cin>>n;
for(int i=0;i<n;i++)
cin>>c[i];
int premn=c[... | ALGO | 0.99978 | 3.679035 |
484cd1a0-7a7f-4601-a059-24dc3d751522 | namnguyen16082008/LUYENCODE | DK07.cpp | #include <bits/stdc++.h>
#define ll long long int
using namespace std;
double a,b,c,x,y,z=0;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>>a>>b>>c;
if (a==0){
if (b==0 && c==0) cout<<"INF";
else if (b==0 && c!=0) cout<<"NO";
else if (b!=0 && c==0) cout<<fixe... | ALGO | 0.999951 | 3.958369 |
0d0a748e-ffc4-4148-906c-cc055b109fc4 | LORDofDOOM/MMOTBC | src/scripts/EasternKingdoms/MoltenCore/boss_majordomo_executus.cpp | /* ScriptData
SDName: Boss_Majordomo_Executus
SD%Complete: 30
SDComment: Correct spawning and Event NYI
SDCategory: Molten Core
EndScriptData */
#include "ScriptPCH.h"
#define SAY_AGGRO -1409003
#define SAY_SPAWN -1409004
#define SAY_SLAY -1409005
#define SAY_SPECIAL -1409006
#d... | TOOL | 0.905337 | 5.930315 |
857fa571-7503-4440-ac64-18464418a685 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_7417_0.cpp | #include <bits/stdc++.h>
int main() {
int t;
scanf("%d", &t);
while (t--) {
char s[1001];
scanf("%s", s);
if (strlen(s) == 2) {
printf("%s", s);
printf("\n");
} else {
for (int i = 0; i <= strlen(s) - 2; i = i + 2) {
printf("%c", s[i]);
}
printf("%c", s[strlen... | ALGO | 0.998946 | 3.265399 |
2442d7a6-57d6-4893-8d7c-e372f73c1acf | Ehkiden/Matrix-and-BFS-Example | main.cpp | //Project: Matrix and Breadth First Traversal Example
//Date: 04/11/2017
//Purpose: create a graph from given set of vertices and edges
// repeatedly ask the user to choose a source vertex (enter "Q" or "q" to quit)
// and calculate the shortest distance of each vertex to the source
// It is a s... | ALGO | 0.996939 | 4.400465 |
e262c0b5-ec39-4e44-9e88-58a27f14b379 | goddice/utah | proj5/src/render.cpp | #include <iostream>
#include <chrono>
#include "render.h"
float fresnel_reflection(const Ray& ray, const Point3& N, const float& ior, bool front) {
float cos_i = abs((-ray.dir).Dot(N));
float sin_i = sqrt(1 - cos_i * cos_i);
float ior_i = 1.0f;
float ior_t = ior;
if (!front) {
std::swap(ior... | ALGO | 0.995941 | 4.753078 |
5449c5cc-c476-4335-8886-685d81af9b12 | woojin20212321/Flutter_Project | UI_study/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.998261 | 6.76775 |
3d3d07c0-7b48-47fd-a7c6-e1e0be999c3e | Yukun-Huang/Google-KickStart | 2018 Round B/Problem B/cpp/B_small.cpp | #include <iostream>
#include <algorithm>
#include <fstream>
#include <vector>
#include <deque>
#include <assert.h>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <unordered_map>
#include <stdio.h>
#include <string.h>
#include <utility>
#include <math.h>
#include <bitset>
#include <iomanip>
#in... | ALGO | 0.99949 | 3.279172 |
18ebed9f-815a-4782-bdd5-a9c2fec3da15 | vabridgers/llvm-project-dev | libcxx/test/std/containers/associative/multiset/find.pass.cpp | // <set>
// class multiset
// iterator find(const key_type& k);
// const_iterator find(const key_type& k) const;
#include <set>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.h"
int main(int, char**)
{
{
typedef int V;
typedef std::mul... | TEST | 0.943813 | 4.828416 |
c3a5f356-580a-4ee2-bc51-dd0682afff9f | rhs0266/FastCampus | ๊ฐ์ ์๋ฃ/02-์๊ณ ๋ฆฌ์ฆ/14-์ต๋จ๊ฑฐ๋ฆฌ/๋ฌธ์ ๋ณ ์ฝ๋/1916-์ต์๋น์ฉ ๊ตฌํ๊ธฐ/solution.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#pragma warning(disable:4996)
using namespace std;
#define NM 1005
struct Edge {
int to, weight;
Edge() {}
Edge(int to, int weight) : to(to), weight(weight) {}
};
struct Info {
int idx, dist;
Info() {}
Info(int idx, int dist) : idx(idx), dist(dist) {}
b... | ALGO | 0.999933 | 4.768358 |
c594e19d-4ac9-420a-81cd-da89331266f1 | dgboy2000/segmentation-svm | rwsegment/mrf/trw/src/example.cpp | #include <stdio.h>
#include "MRFEnergy.h"
// Example: minimizing an energy function with Potts terms.
// See type*.h files for other types of terms.
void testPotts()
{
MRFEnergy<TypePotts>* mrf;
MRFEnergy<TypePotts>::NodeId* nodes;
MRFEnergy<TypePotts>::Options options;
TypePotts::REAL energy, lowerBound;
const... | ALGO | 0.999822 | 5.402516 |
52e2b8cf-2bd7-40f9-97a7-deb631a82141 | ersascape/rc-genexec | pascals-triangle.cpp | /*
Author: DF
Question: Pascals Triangle
*/
// clang-format off
#include <iostream>
#include <vector>
using namespace std;
#define el '\n'
// clang-format on
void solveMyProblem(long long n) {
vector <vector <int> > arr(n, vector<int> (n, 0));
for (int i = 0; i < n; i++) {
for (int j = 0; j <=... | ALGO | 0.999983 | 4.896931 |
d0fa69fc-d753-40b4-ac7a-c5be5f3ef2ba | yunghoon19/Algorithm | BackJoon/no.11729/no.11729.cpp | /*
๋ฐฑ์ค ์๊ณ ๋ฆฌ์ฆ ๋ฌธ์ 11729๋ฒ ์์ค ์ฝ๋
*/
#include <iostream>
#include <math.h>
using namespace std;
// ๋ธ๋ญ๊ฐ์, ์์๊ธฐ๋ฅ, ๋ชฉํ๊ธฐ๋ฅ, ๊ฒฝ์ ๊ธฐ๋ฅ
void Hanoi(int N, int start, int end, int waypoint)
{
if (N == 1) // ๋จ์ ์ํ 1๊ฐ์ผ ๋ ์ฌ๊ท ํ์ถ
{
printf("%d %d\n", start, end);
return;
}
else
{
Hanoi(N -... | ALGO | 0.999906 | 4.362853 |
355c97db-c377-40a8-8bfd-90c4e0d41e0c | diasgsputra/dumbways | soal3.cpp | #include <iostream>
using namespace std;
int prima(int awal,int x);
int main(){
int input,i,j,bil,angka_terakhir=0,angka;
bool lanjut;
cin>>input;
for(i=0;i<=input+1;i++){
j=0;
while(j<i){
angka = angka_terakhir;
lanjut = true;
while (lanjut) {
if ((angka==2 or angka==3 or angka==5 or angka==... | ALGO | 0.999842 | 3.835076 |
fa9cfcc0-38e0-4625-a966-e89a7563cc19 | yokotech/competitive_programming | AtCoder/abc/abc_130/2_abc130_b.cpp | // 2_abc130_b
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#inclu... | ALGO | 0.999992 | 3.354508 |
74864ea1-b9f7-4fa3-85af-d441f60abe1f | Subzero-10/leetcode | .history/89.gray-code_20200818214950.cpp | /*
* @lc app=leetcode id=89 lang=cpp
*
* [89] Gray Code
*
* https://leetcode.com/problems/gray-code/description/
*
* algorithms
* Medium (47.97%)
* Likes: 664
* Dislikes: 1573
* Total Accepted: 164.7K
* Total Submissions: 334.8K
* Testcase Example: '2'
*
* The gray code is a binary numeral system ... | ALGO | 0.999831 | 6.590916 |
05224465-dfb0-4895-a0ef-7774f86b860a | zhongfei2016/leetcode-cpp | bfs/NoiseCalSln.cpp | //
// leetcode-cpp
// ๅชๅฃฐ็ไผ ๆญ๏ผๅ
ฅๅๆฏnรmๅๆ ็็ฉ้ตๅๅชๅฃฐๆบๅๆ ๅๅชๅฃฐๅผ๏ผๆฏไธชๅชๅฃฐๆบ็ๅชๅฃฐๅผๅๅ
ซไธชๆนๅไผ ๆญ๏ผๆฒก่ตฐไธไธชๅๅฐไธไธชๅผ๏ผๆฑๆดไธช็ฉ้ตๆๆๅชๅฃฐๅผ๏ผๅ ๅ ็ๅฐๆนๅๆ้ซๅผ๏ผ
#include "NoiseCalSln.h"
#include <queue>
struct Noise {
int x;
int y;
int noise;
Noise(int x, int y, int noise) {
this->x = x;
this->y = y;
this->noise = noise;
}
};
vecto... | ALGO | 0.999855 | 6.055119 |
32f4fac2-54e6-4dd4-9daa-13817520f5db | Parth7/Finite_Difference_Method_BSM | payoff.cpp | //
// Created by Parth Parakh on 06/12/20.
//
#include"payoff.h"
#include<cmath>
using namespace std;
PayOff::PayOff() {}
PayOff::~PayOff() noexcept {}
PayOffCall::PayOffCall(const double &K_): K(K_) {}
PayOffCall::~PayOffCall() noexcept {}
double PayOffCall::operator()(const double &S) const
{
return max(S-K,... | ALGO | 0.995927 | 5.191585 |
e501587c-886b-4ea5-be3c-a3857ccd4113 | jperezrua/qtOpencvToolbox | SRC/mySFM/MultiCameraDistance.cpp | #include "MultiCameraDistance.h"
#include "RichFeatureMatcher.h"
#include "OFFeatureMatcher.h"
#include "GPUSURFFeatureMatcher.h"
//c'tor
MultiCameraDistance::MultiCameraDistance(
const std::vector<cv::Mat>& imgs_,
const std::vector<std::string>& imgs_names_,
const std::string& imgs_path_):
imgs_names(imgs_names_... | ALGO | 0.988138 | 6.128178 |
52e0056b-6e66-4577-84fa-97b33ccc0fb9 | spring/spring | rts/lib/assimp/code/SpatialSort.cpp | /** @file Implementation of the helper class to quickly find vertices close to a given position */
#include "SpatialSort.h"
#include <assimp/ai_assert.h>
using namespace Assimp;
// CHAR_BIT seems to be defined under MVSC, but not under GCC. Pray that the correct value is 8.
#ifndef CHAR_BIT
# define CHAR_BIT 8
#en... | ALGO | 0.999589 | 7.50856 |
9effed8c-ce3c-4437-bac1-fff112b099f7 | jam1garner/rust-std-skyline-squashed | src/llvm-project/polly/lib/Transform/DeLICM.cpp | #include "polly/DeLICM.h"
#include "polly/LinkAllPasses.h"
#include "polly/Options.h"
#include "polly/ScopInfo.h"
#include "polly/ScopPass.h"
#include "polly/Support/GICHelper.h"
#include "polly/Support/ISLOStream.h"
#include "polly/Support/ISLTools.h"
#include "polly/ZoneAlgo.h"
#include "llvm/ADT/Statistic.h"
#defin... | ALGO | 0.951537 | 7.433084 |
c8cb0d51-2205-4308-85e6-207e774f55ba | thien5743/phuong-trinh-bac-2 | phuong trinh bac 2/phuong trinh bac 2.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main() {
float a, b, c, x1, x2, delta;
cout << "giai huong trinh bat 2\n";
cout << "nhap a:"; cin >> a;
cout << "nhap b:"; cin >> b;
cout << "nhap c:"; cin >> c;
if (a == 0) {
// bx + c = 0;b=0 b<>0
}
if (b == 0) {
if (c != 0) {
cout << "PT vo... | ALGO | 0.99939 | 3.445966 |
3e77b08b-4384-472f-8fe7-17a5474220e1 | ZERICO2005/ABS-Fractal-Explorer | src/render_CPU/frac_Multi_AVX.cpp | #include "frac_Multi_Internal.h"
#include "frac_Multi_AVX.h"
#ifdef ENABLE_AVX_RENDERING
#ifndef __AVX__
#error "__AVX__ is required to enable AVX rendering"
#endif
#include <immintrin.h>
/*
Directory:
* Debug Tools
* Function Definition AVX FP64
* Function Definition AVX FP32
* Fractal Rendering AVX FP32
*... | ALGO | 0.99006 | 5.202162 |
689b4359-79b6-4565-bf66-1e49fb13031f | Crescendoe/E_Commerce_Flutter_App | 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.998733 | 6.76775 |
1d1cb852-7f02-4113-a1b6-c13d8f9e2cd1 | vaibhavjain2391/Spoj-Practise | edit_distance.cpp | #include<iostream>
#include<string.h>
using namespace std;
int findEditDistance(char *a, char *b, int alen, int blen);
int min(int a, int b, int c)
{
if(a<b)
{
if(a<c)
return a;
else
return c;
}
else
{
if(b<c)
return b;
else
return c;
}
}
int main()
{
int test_cases,alen,blen,result;
char ... | ALGO | 0.999978 | 4.74205 |
17636af4-b204-4ada-abb1-e461b7e9fcae | Bookworm-bit/competitive-programming | USACO/Guide/Silver/Custom Comparators and Coordinate Compression/srq.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int a[(int) 1e9];
memset(a, 0, sizeof(a));
int N, Q;
cin >> N >> Q;
for (int i=0; i<N; i++) {
int l, r;
ll v;
cin >> l >> r >> v;
a[l] += v;
if (r < (int) 1e9) {
a[... | ALGO | 0.999757 | 4.801252 |
a68e745e-b190-4431-8a53-f1f57566f8e2 | Junaid7200/University-Labs | Data Structures/Stacks/.history/LabEvalPractice_20240419053832.cpp | #include <iostream>
#include <cmath>
using namespace std;
class int_Node {
public:
int data;
int_Node* next;
int_Node(int data) {
this -> data = data;
this -> next = NULL;
}
void setData(int data) { this -> data = data; }
void setNext(int_Node* node) { this -> next = node; }
int getDat... | ALGO | 0.999152 | 4.217881 |
72d48ecb-b3e4-4591-b96e-ef63f87935dc | rpeng233/cycleToggling | source/solvers/cgsolver.cpp | #include "../util/io.h"
#include "../util/graph.h"
#include "cg.h"
#include "jacobiprecon.h"
int main(int argc, char *argv[])
{
if (argc!=3) { printf("Usage: ./cgsolver graphFile rhsFile\n"); return 0; }
string graphFile=argv[1];
string rhsFile=argv[2];
GraphSP g=IO::readGraphSP(graphFile);
Mat A=IO::construc... | ALGO | 0.9984 | 3.316648 |
11e86f6f-4158-4ce6-98fb-9a344e5fd323 | yamamoto99/LeetCode | 143.ReorderList.cpp | // Definition for singly-linked list.
struct ListNode {
int val;
ListNode *next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x) : val(x), next(nullptr) {}
ListNode(int x, ListNode *next) : val(x), next(next) {}
};
class Solution {
public:
void reorderList(ListNode* head) {
if (!head || !head->next || !h... | ALGO | 0.99999 | 5.324467 |
c476a3e9-b63c-46e3-90c1-5bf311828e8f | sleeyax/cronet-binaries | src/third_party/libc++/src/benchmarks/algorithms.partition_point.bench.cpp | #include <algorithm>
#include <array>
#include <cassert>
#include <cstdint>
#include <tuple>
#include <vector>
#include "benchmark/benchmark.h"
#include "CartesianBenchmarks.h"
#include "GenerateInput.h"
namespace {
template <typename I, typename N>
std::array<I, 10> every_10th_percentile_N(I first, N n) {
N step... | TEST | 0.866017 | 7.035626 |
298e5bb2-b86f-4cfb-8cd1-27d180d1c2ee | 07Siddhant/amazon_interview_preparation | median_of_a_stream.cpp | #include<bits/stdc++.h>
int signumm(int a,int b){
if(a==b) return 0;
else if(a>b) return 1;
else return -1;
}
void call_median(int ele,priority_queue<int> &maxi, priority_queue<int,vector<int>,greater<int>> &mini,int &median)
{
switch(signumm(maxi.size(),mini.size())){
case 0: if(ele>median){... | ALGO | 0.999999 | 4.816913 |
9792403a-4e94-4931-8035-279855a42890 | bhaktiagrawal088/DSA_Sheet | Basic/evenoddsum.cpp | #include<iostream>
using namespace std;
int main(){
int num;
cin>>num;
int rem=0, sum1=0, sum2=0;
while(num != 0){
rem = num %10;
num = num/10;
// cout<<rem<<endl;
if(rem%2 == 0){
sum1 += rem;
}else{
sum2 += rem;
}
}
cout<<s... | ALGO | 0.999368 | 3.628596 |
e5e12877-fa31-4aa8-a960-7db24c649049 | AdityaAtb09/LeetCode | Compare two Large Numbers - GFG/compare-two-large-numbers.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
int check(string a,string b);
int main(){
int t;
cin>>t;
while(t--)
{
string a, b;
cin >> a >> b;
cout<<check(a,b)<<'\n';
}
return 0;
}
// } Driver Code Ends
int check(string a,string b){
//code
a.size... | ALGO | 0.999857 | 5.722769 |
3555112c-394b-4f42-aea6-a800eb64ea66 | shbej/Learn_cpp | numfirst.cpp | #include <iostream>
int main()
{
unsigned int N = 1;
std::cin >> N;
char array[1000];
char symb {};
int code = symb;
for (int i = 0; i < N; ++i)
{
std::cin >> array[i];
char symb = array[i];
int code = symb;
}
for (int i = 0; i < N; ++i)
{
char symb = array[i];
int code = sym... | ALGO | 0.976224 | 4.530802 |
4610e29f-ce45-4716-a37e-c222b7d060a9 | BO-DA/boda_AI | VanishingPoint/main.cpp | #define _USE_MATH_DEFINES
#include "opencv2/opencv.hpp"
#include <iostream>
#include <filesystem>
#include <cmath>
namespace fs = std::filesystem; // ISO C++17 Standard (/std:c++17)
float REJECT_DEGREE_TH = 4.0;
int ReadImage(std::string InputImagePath, std::vector<cv::Mat>& Images, std::vector<std::string>& Image... | ALGO | 0.993302 | 4.916484 |
d5c462c5-0b8e-4afd-8623-7e6ebd1998cb | ZorzalG/competitive-programming | USACO/circularbarn.cpp | #include <bits/stdc++.h>
using namespace std;
#define dbg(v) cout << "Line(" << __LINE__ << ") -> " << #v << " = " << (v) << endl;
set<int> mods[4];
void sieve(){
bool prime[5000001]={};
for(int i=2;i<=5000000;i++){
if(!prime[i]){
for(int j=2*i;j<=5000000;j+=i){
prime[j]=... | ALGO | 0.999959 | 3.945282 |
c52678aa-35c5-487d-9d26-9b940ad989f6 | kidclone3/CP | OnlineJudge/vnoi/seg_tree/segtree_itmix.cpp | #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;
// Disable this pragma by default because of debugging
// #pragma GCC optimize("O3,unroll-loops")
#define pb push_back
#define vi vector<int>
#define vl vect... | ALGO | 0.999736 | 5.039903 |
1818fd1a-d8f3-4517-919b-658814fef254 | ChrisDavid1999/Frictionless_Collisions | ICT398SoloProject/reactphysics3d-develop/src/collision/narrowphase/SphereVsConvexPolyhedronAlgorithm.cpp | // Libraries
#include <reactphysics3d/collision/narrowphase/SphereVsConvexPolyhedronAlgorithm.h>
#include <reactphysics3d/collision/narrowphase/GJK/GJKAlgorithm.h>
#include <reactphysics3d/collision/narrowphase/SAT/SATAlgorithm.h>
#include <reactphysics3d/collision/narrowphase/NarrowPhaseInfoBatch.h>
// We want to use... | ALGO | 0.999126 | 7.713463 |
159bbf1e-88d6-465d-a6e3-8dedcaa3e8ac | nicomu99/collision_detection | src/model/RectangleRectangleCollision.cpp | //
// Created by nico on 1/19/25.
//
#include "RectangleRectangleCollision.hpp"
#include <limits>
#include "Vector2d.hpp"
#include "Rectangle.hpp"
namespace RectangleRectangleCollision {
void projectRectangleOntoAxis(const Rectangle* rect, const Vector2d& axis, double& min,
doub... | ALGO | 0.99924 | 7.112937 |
70d57546-27e4-4aad-9c1a-12f25bbd31c0 | nettee/leetcode | solutions/0198.house-robber/0198.house-robber.1567586619.cpp | class Solution {
public:
int rob(vector<int>& nums) {
if (nums.empty()) {
return 0;
}
int N = nums.size();
// subproblem:
// rob(e) = rob houses [0..e)
// rob() = rob(N)
//
// rob(0) = 0
// rob(1) = money[0]
// rob(k) = max:... | ALGO | 0.99988 | 6.066488 |
04806e77-50a2-4de6-a520-d1b0af3b400e | riddhiman13/predictive-multi-agent-framework | src/moveit/moveit_planners/trajopt/src/trajopt_planner_manager.cpp | /* Author: Omid Heidari
Desc: TrajOpt planning plugin
*/
#include <moveit/planning_interface/planning_interface.h>
#include "moveit/collision_detection_fcl/collision_detector_allocator_fcl.h"
#include <class_loader/class_loader.hpp>
#include "trajopt_interface/trajopt_planning_context.h"
namespace trajopt_int... | TOOL | 0.894207 | 7.003837 |
52c47d69-e608-4a6d-bd63-c5d1e6a978a9 | naoyat/topcoder | fileedit/2009/SilverDistance1.cpp | #line 2 "SilverDistance.cpp"
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <cctype>
#include <algorithm>
#include <string>
#include <vector>
#include <deque>
#include <stack>
#include <queue>
#include <list>
#include <map>
#include <set>
// BEGIN CUT HERE
#include "cout.h"
// END CU... | ALGO | 0.999971 | 3.753056 |
942ece0f-cbbf-439b-87de-afbe460174dc | derfelterciano/cpp_ds_and_algos | tests/DjikstraTest.cpp | #include <algs/Dijkstra.hpp>
#include <cassert>
#include <ds/Graph.hpp>
#include <iostream>
#include <tuple>
int main() {
using algs::dijkstra;
using ds::Graph;
using Vertex = int;
using Weight = int;
// 1) A small weighted graph:
// 0 โ 1 (5), 0 โ 2 (3), 1 โ 3 (1), 2 โ 3 (7), 0 โ 3 (10)
... | TEST | 0.865457 | 6.949311 |
1d063da3-832e-4779-bc46-f28224278cb5 | MASHiRO1412/coding | Contest/plab041.cpp | #include <bits/stdc++.h>
#define endl "\n"
using namespace std;
template <typename T = int>
T input() { return *istream_iterator<T>(cin); }
int nnode, nedge, start, target;
long long v[10000][10000];
int main()
{
ios::sync_with_stdio(false);
cin >> nnode >> nedge;
cin >> start >> target;
for(int i = 0;... | ALGO | 0.999658 | 3.893255 |
a399eb28-c39c-4c5d-b6fd-ead31b9cae69 | prabhatrmishra/Algorithms | TextEditorProblem.cpp | #include <iostream>
#include<vector>
#include<stdio.h>
using namespace std;
vector<string>txt;
int p,q;
vector<string>buff;
void ddee()
{
cout<<"I am called"<<endl;
if(txt.size()== 0)
{
p=0; q=0;
}
else {
txt.erase(txt.begin()+p);
// for(int i = 0; i < txt.size(); ... | ALGO | 0.975393 | 3.931541 |
01c4cc5a-4c25-4bf9-822f-1fbff7d01142 | trivediadi/Linked-list | Inserting_from_head.cpp |
#include <iostream>
#include <vector>
using namespace std;
class Node{
public:
int data;
Node* next;
Node(int data1,Node* next1){
data=data1;
next=next1;
}
Node(int data1){
data=data1;
next=nullptr;
}
};
Node* convertArrtoLL(vector<int> &arr){
... | ALGO | 0.999888 | 4.70774 |
18d830be-ff73-4881-9f8d-38b2d5892545 | OneBitPython/Codeforces | A_Addition_and_Minimum.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define all(c) c.begin(), c.end()
#define endl "\n"
const double PI=3.141592653589;
void __print(int x) {cerr << x;}
void __print(long x) {cerr << x;}
void __print(unsigned x) {cerr << x;}
void __print(unsigned long x) {cerr << ... | ALGO | 0.999788 | 4.921555 |
c00cd82c-bb4b-4eed-b5d7-cc103f692c0f | ihSomik/problem-solving | timus/1000. A+B Problem.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a >> b;
cout << a + b << endl;
return 0;
} | ALGO | 0.99732 | 3.773329 |
097cf9f8-fe70-4968-a0a2-de8f558db6d3 | yashasvigirdhar/codebase | code/graph/scc_usingdfs.cpp | /*
*/
/* Data Structure Includes */
#include <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <bitset>
#include <stack>
/*other Includes */
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include ... | ALGO | 0.999938 | 4.189836 |
cff33f41-77ef-4b45-b8fd-e8c6739b280d | KevalPadsumbiya/Graph-Algorithms | eventree.cpp | #include<iostream>
#include<vector>
#include<bits/stdc++.h>
#define lli long long int
#define mod 1000000007
#define pb push_back
#define mk make_pair
#define fastio ios_base::sync_with_stdio(false); cout.tie(NULL);
using namespace std;
int vis[1000],mx;
vector<int> ar[1000];
int DFS(int src)
{
vis[src]=1;
int n=0;... | ALGO | 0.999657 | 4.305624 |
0c55f778-0109-4dfe-8b5a-5249c27d941e | cpsa3/backup | OJ/HDU_CODE/1465.cpp | ////////////////////System Comment////////////////////
////Welcome to Hangzhou Dianzi University Online Judge
////http://acm.hdu.edu.cn
//////////////////////////////////////////////////////
////Username: 096040179JY
////Nickname: ___
////Run ID:
////Submit time: 2010-12-27 19:32:13
////Compiler: Visual C++
//////////... | ALGO | 0.999888 | 3.471606 |
6f196546-9e23-4f04-a4b3-391d22fb66be | ArchitKumar1/LeetCode-Submissions | sort-characters-by-frequency/Runtime Error/3-14-2019, 4:02:25 AM/Solution.cpp | // https://leetcode.com/problems/sort-characters-by-frequency
class Solution {
public:
string frequencySort(string s) {
priority_queue<pair<int,char>> s1;
int A[100]={0};
for(auto c: s){
A[c-'a']++;
}
for(int i=0;i<100;i++){
if(A[i]){
... | ALGO | 0.999949 | 5.889488 |
fc9531f6-6565-4a2c-b3fa-edd20d11b870 | sourabh067/practice-problems | pattern/starX.cpp | #include <iostream>
using namespace std;
int main() {
// pattern printing
// star X
// square format
// (i==j || i+j==n+1)
int n=7;
for (int i =1 ;i<=n;i++){ // rows
for (int j = 1;j<=n;j++){ // columns
if (i==j || i+j==n+1) cout << "* ";
else cout << " ";
}
... | ALGO | 0.999847 | 3.639185 |
13443157-1481-4e4c-ac9c-2c3ee9db44d2 | ishandutta2007/codeforces | heno239/normal/939/C.cpp | #include<iostream>
#include<string>
#include<cstdio>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<bitset>
#include<stack>
#include<unordered_map>
#include<utility>
#include<cassert>
#in... | ALGO | 0.999888 | 3.282207 |
d73265cc-2a8f-4175-b88a-26483396da8b | piyush1146115/Competitive-Programming | Codechef/Codechef August Challange 2019/Bruteforce for Zoombie and .cpp | /*
* FILE: Bruteforce for Zoombie and .cpp
*
* @author: Piyush Kanti Das <piyush123kantidas[at]gmail[dot]com>
*
* LINK:
*
* DATE CREATED: 02.08.2019 22:23:10 +06
*
* DESCRIPTION:
*
* DEVELOPMENT HISTORY:
* Date Version Description
* --------------------------------------------------------------... | ALGO | 0.999973 | 3.175334 |
17ea1b1e-3b68-46e2-9838-5b401a6a3167 | ishandutta2007/codeforces | shayan.p/normal/888/D.cpp | #include<bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define ll long long
using namespace std;
ll select(ll n,ll k)
{
ll ans=1;
for(ll i=0;i<k;i++)ans*=n-i;
for(ll i=1;i<=k;i++)ans/=i;
return ans;
}
ll fact(ll num)
{
ll ans=1;
for(ll i=1;i<=num;i++)ans*=i;
return ans... | ALGO | 0.999944 | 3.962775 |
ed1eda89-953f-4176-89d7-fe4e42f33df4 | murli2003/c | sum.cpp | #include<stdio.h>
using namespace std;
main()
{
int int1, int2, sum;
printf("Enter 1st number");
scanf("%d", &int1);
printf("Enter 2nd number");
scanf("%d", &int2);
sum= int1 +int2;
printf("sum is %d\n", sum);
}
| TOOL | 0.986681 | 3.108309 |
66e8b55e-7eda-4c20-b209-d1b7c0cfeeb6 | quandquang1312/red_training_exercise | graph/AllPairShortestPath/UVA-821_FloydMarshall.cpp | // https://vjudge.net/problem/UVA-821
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
#ifdef LOCAL
freopen("../in.txt", "r", stdin);
freopen("../ou.txt", "w", stdout);
#endif
... | ALGO | 0.997923 | 3.993355 |
0ba8096e-d825-4b61-85dc-ebd9b1cf8205 | bhaveshgarg2000/LeetCode-GFG-DailyChallenge | February 2024/DivisibleBy8.cpp | class Solution
{
public:
int DivisibleByEight(string s)
{
// code here
if (s.length() >= 3)
{
int count = 1;
int sum = 0;
for (int i = s.length() - 1; i > s.length() - 4; i--)
{
int temp = abs(s[i] - '0');
t... | ALGO | 0.99952 | 4.857367 |
9a745beb-ea97-49b8-8622-b859017face1 | ngthanhtrung23/ACM_Notebook_new | Graph/tests/aizu_grl_3_a_articulation_points.test.cpp | #define PROBLEM "http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=GRL_3_A"
#include "../../template.h"
#include "../DfsTree/BridgeArticulation.h"
void solve() {
int n, m; cin >> n >> m;
vector<vector<int>> g(n);
REP(i,m) {
int u, v; cin >> u >> v;
g[u].push_back(v);
g[v].pu... | ALGO | 0.999858 | 4.79362 |
8a66e042-7278-49ea-9175-11a8b194df64 | harshada0207/LEETCODE-AND-GFG | 0135-candy/0135-candy.cpp | class Solution {
public:
int candy(vector<int>& ratings) {
int n=ratings.size();
int sum=1;
int i=1;
while(i<n)
{
if(ratings[i]==ratings[i-1])
{
sum+=1;
i++;
continue;
}
int peak=1... | ALGO | 0.999995 | 6.121442 |
316546d0-0c14-416d-bf9f-0894663201dd | lokesh226/cpp--problem-solving | stromers number.cpp | A stromers number is a positive integer number i such that greatest prime factor of the term i*i+1 is grater then or equal to 2*i
#include <bits/stdc++.h>
using namespace std;
int maxPrimeFactors(int n)
{
int maxPrime = -1;
while(n % 2 == 0)
{
maxPrime = 2;
n /= 2;
}
for(int i = 3; i < (int)(sqrt(n)... | ALGO | 0.999838 | 4.12886 |
8dab9056-3e43-416f-896f-6b693c60d6f6 | koraygoktas/SIMPLE-STUDIES | ders 33.cpp | #include <stdlib.h>
#include <stdio.h>
#include <math.h>
int main()
{
double sayi,sayi1,sayi2;
/*
printf("sayi giriniz= ");
scanf("%lf",&sayi);
printf("sayiniz =%.2lf",sayi); */
printf("sayi giriniz= ");
scanf("%lf",&sayi);
sayi1=floor(sayi);
sayi2=ceil(sayi);
printf("sayi1= %lf\n",sayi1);
printf("s... | ALGO | 0.990207 | 3.012554 |
64ccce96-53aa-4a40-8c7c-8764f8e044e5 | ehnryx/acm | google-kickstart/2020/roundA/b.cpp | #include <bits/stdc++.h>
using namespace std;
#define _USE_MATH_DEFINES
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef complex<ld> pt;
typedef vector<pt> pol;
mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count());
const char nl = '\n';
const ll INF = 0x3f3f3f3f... | ALGO | 0.99994 | 3.900244 |
50bfb984-d6de-41d5-88c9-16e187680537 | vsajip/llvm | lib/Transforms/IPO/IPConstantPropagation.cpp | #define DEBUG_TYPE "ipconstprop"
#include "llvm/Transforms/IPO.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Module.h"
#include "llvm/Pass.h"
#include "llvm/Support/CallSite... | TOOL | 0.978308 | 7.800108 |
37c30bf2-0003-4742-9146-a3e200b98fdf | kant9612/library | 301~400/377/A.cpp | #include <iostream>
#include <algorithm>
#include <string>
int main() {
std::string S;
std::cin >> S;
// Sort the string
std::sort(S.begin(), S.end());
// Check if sorted string is "ABC"
if (S == "ABC") {
std::cout << "Yes" << std::endl;
} else {
std::cout << "No" ... | ALGO | 0.999931 | 6.093646 |
8e28ec43-9976-4448-9932-fe0e9ba97a58 | PrashamModi/Leetcode | 1776-minimum-operations-to-reduce-x-to-zero/1776-minimum-operations-to-reduce-x-to-zero.cpp | class Solution {
public:
int minOperations(vector<int>& nums, int x) {
int n = nums.size();
int i = 0, j = 0;
int ans = INT_MIN;
int curr_sum = 0;
int sum = accumulate(nums.begin(), nums.end(), 0);
sum -= x;
while(j < n){
curr_sum += nums[j];
... | ALGO | 0.999971 | 5.736738 |
11a96452-c0ac-49d2-ab66-04d2f1ef0eba | mamta519github/Leetcode | 1580-shuffle-the-array/1580-shuffle-the-array.cpp | class Solution {
public:
vector<int> shuffle(vector<int>& nums, int n) {
vector<int>output;
for(int i=0; i<n; i++)
{
output.push_back(nums[i]);
output.push_back(nums[i+n]);
}
return output;
}
}; | ALGO | 0.999947 | 6.224773 |
90bdc341-0ba6-492d-93ad-5712d3b3f44e | Creammimy/coffee_shop | 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 |
157428fd-f522-476f-b2f1-699bb9290249 | rudraps0x63/cses-solns | increasing-array.cpp | #include <bits/stdc++.h>
using namespace std;
#define vin(v) for (auto& x : v) cin >> x
#define pb(x) push_back(x);
#define mp(x, y) make_pair(x, y);
#define sz(x) (int)x.size()
#define log(x) cout << x << '\n'
#define logs(x) cout << x
typedef unsigned long long ull;
typedef long long ll;
typedef double ... | ALGO | 0.999936 | 3.962939 |
5f322899-2e77-4554-b4c3-e371f819a87e | SadiqVali786/DSA | 13.BackTracking/11.distributeRepeatingInts.cpp | #include<iostream>
#include<vector>
#include<unordered_map>
#include<algorithm>
#include<chrono>
using namespace std;
bool can_we_supply_this_order(vector<int> &order_quantities, vector<int> &food_counts, int customer_id) {
if(customer_id == order_quantities.size()) return true;
for(int i=0; i<order_quantities... | ALGO | 0.999941 | 6.163074 |
99514e91-e912-4e3e-a4f1-ff8144dcf00c | sujitmandava/CP | CP_Practice/B_Interesting_drink.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define float double;
void solve()
{
int n;
cin >> n;
int a[n];
for (int i = 0; i < n; i++)
{
cin >> a[i];
}
sort(a, a + n);
int m;
cin >> m;
for (int i = 0; i < m; i++)
{
int k;
ci... | ALGO | 0.999953 | 4.527661 |
1256ecee-b2e7-4028-b4ef-90b6203aa883 | ArchitKumar1/LeetCode-Submissions | relative-sort-array/Accepted/6-23-2020, 11:25:02 AM/Solution.cpp | // https://leetcode.com/problems/relative-sort-array
class Solution {
public:
vector<int> relativeSortArray(vector<int>& arr1, vector<int>& arr2) {
map<int,int> m1;
int pos = 0;
for(int c : arr2)m1[c] = ++pos;
sort(arr1.begin(),arr1.end(),[&](int a,int b){
if(m1... | ALGO | 0.999992 | 6.116161 |
99081e1d-c9cf-432a-9105-e60dc279e9af | rhtm02/Algorithm | greedy/leetcode_1725.cpp | #include <iostream>
#include <map>
using namespace std;
class Solution {
public:
int countGoodRectangles(vector<vector<int>>& rectangles) {
map<int,int> LenCnt;
int length = 0;
int width = 0;
int maxlen = 0;
int temp = 0;
for(auto it:rectangles)
{
... | ALGO | 0.999237 | 5.769299 |
7c93f5c0-812e-48ae-a6cc-2fdac4993a59 | Ziaeemehr/cpp_workshop | boost/BGL/dijkstra-example.cpp | #include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <boost/property_map/property_map.hpp>
using namespace boost;
int
main(int, char *[])
{
typedef adjacency_list < listS, vecS, directedS,
no_property, property < edge_wei... | ALGO | 0.999903 | 5.440712 |
6f53b15a-041d-4174-b15c-1c0d63b1eae1 | ishandutta2007/codeforces | moonight/normal/1556/F.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define db double
#define X first
#define Y second
#define rep(i,a,b) for(register int i=(a);i<=(b);++i)
#define rep0(i,a,b) for(int i=(a);i<(b);++i)
#define per(i,a,b) for(int i=(a);i>=(b);--i)
#define fore(i,a) for(register int i=0;i<a.size();++i)
inli... | ALGO | 0.999917 | 3.45968 |
85d7a342-3c03-40f0-a76e-3644387aa77d | alexandraback/datacollection | solutions_1484496_1/C++/ggm/c.cpp | #include <cstdio>
#include <cmath>
#include <vector>
#include <cstdlib>
const int LEN = 2000000;
using namespace std;
vector<int> number[LEN+5];
vector<int> input;
void print(int status) {
int l=0;
while(status)
{
if(status % 2 == 1)
{
printf("%d",input[l]);
if(status == 1) printf("\n");
else printf(... | ALGO | 0.999707 | 4.08733 |
da946c8a-c0e1-43e7-b42b-8050535ec2be | openfnord/corectrl | src/core/components/amdutils.cpp | #include "amdutils.h"
#include "common/stringutils.h"
#include "units/units.h"
#include <algorithm>
#include <cstddef>
#include <iterator>
#include <regex>
#include <unordered_map>
#include <utility>
namespace Utils {
namespace AMD {
bool readAMDGPUVRamSize(int deviceFD, units::data::megabyte_t *size)
{
#if defined(... | TOOL | 0.911834 | 7.004842 |
d597a045-692e-4412-8d08-da7cb6c73cdd | AravindaDP/CarND-MPC-Project | src/Eigen-3.3/bench/product_threshold.cpp |
#include <iostream>
#include <Eigen/Core>
#include <bench/BenchTimer.h>
using namespace Eigen;
using namespace std;
#define END 9
template<int S> struct map_size { enum { ret = S }; };
template<> struct map_size<10> { enum { ret = 20 }; };
template<> struct map_size<11> { enum { ret = 50 }; };
template<> struct ... | TOOL | 0.952985 | 5.102006 |
36d21e3b-7f92-49f1-be0f-56366432ff67 | mahim007/Online-Judge | codeforces/C. Bank Hacking.cpp | ///Bismillahir Rahmanir Rahim
#include<cstdio>
#include<iomanip>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<cctype>
#include<algorithm>
#include<string>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<sstream>
#include<stack>
#include<list>
#include<iostream>
#include<assert.h>
... | ALGO | 0.999881 | 3.760677 |
04fdec94-cb77-4c34-9cbc-eb04b2f9dec9 | Manish-kasera/DSACPPLearnin-Coding-Ninja- | function.cpp | #include<bits/stdc++.h>
using namespace std;
int fact(int n)
{
if( n== 1)
return 1;
return n * fact(n-1);
}
int ncr(int n,int r)
{
return (fact(n)/ (fact(n-r) * fact(r)));
}
void func(int a[]) {
cout << sizeof(a) << endl;
}
int main()
{
int n,r;
cin >> n >> r;
// cout << ncr(n,r) << endl;
... | ALGO | 0.991141 | 3.493614 |
8dc686af-0651-4755-a2fd-7ded955671ad | prateeksahu-me/DSA4 | Heap/Kth largest element/KthlargestElement.cpp |
#include <bits/stdc++.h>
using namespace std;
class KthLargestElementInAnArray {
public:
int findKthLargest(vector<int>& arr, int k) {
priority_queue<int> pq;
int n = arr.size();
for (int i = 0; i < n; i++) {
pq.push(arr[i]);
}
while (k-1) {
pq.pop();
k--;
... | ALGO | 0.999989 | 5.315948 |
83499355-57fa-4e0a-838a-4cad8c7ed5b3 | GopalSharma52/DSA-C- | Array/ReverseArrayM2.cpp | #include<iostream>
using namespace std;
void reverse(int arr [],int n){
int start = 0;
int end = n-1;
while (start<=end)
{
swap(arr[start],arr[end]);
start++;
end--;
}
}
void printArray(int arr[],int n){
for(int i = 0 ; i<n; i++){
... | ALGO | 0.998675 | 4.502221 |
4aa2a278-8c20-48f9-9f80-cd849e75a366 | ilovethedogs/solved | book0/ch7-binarySearch/ch7-p2-countingSort.cpp |
#include <iostream>
#include <string>
#include <vector>
#include <sstream>
#include <algorithm>
int main() {
// get input
auto n {int{}};
std::cin >> n;
std::cin >> std::ws;
auto s {std::string{}};
std::getline(std::cin, s);
auto ss {std::stringstream {s}};
auto temp {int{}};
auto ... | ALGO | 0.999835 | 4.914246 |
200d3c3d-429d-4709-8144-d2131db3d7ed | Takeoff0518/cpp-learning-code | abc295_c.cpp | #include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdio>
#include<map>
#define N (1005)
#define M (1005)
#define ll long long
#define INF (0x3f3f3f3f)
#define mod (998244353)
#define PII pair<int,int>
#define ls(xxx) (xxx)<<1
#define rs(xxx) (xxx)<<1|1
using namespace std;
int n,ans;
map<int,int> mp;
i... | ALGO | 0.999927 | 3.7105 |
50177b59-2108-41e7-ab98-ae75e7af9d18 | ishandutta2007/codeforces | jjleo/normal/1362/D.cpp | #include <bits/stdc++.h>
#define maxn 500086
using namespace std;
int n, m;
int a[maxn];
int x, y;
vector<int> v[maxn];
int t[maxn], b[maxn];
inline bool cmp(int x, int y){
return t[x] < t[y];
}
int main(){
scanf("%d%d", &n, &m);
while(m--){
scanf("%d%d", &x, &y);
v[x].push_back(y), v[y].push_back(x);
}
fo... | ALGO | 0.999981 | 3.738787 |
a0d37bae-6c04-46c1-9ed2-77c2dd7d6850 | Sadat-09/Codeforces | make.cpp | #include <iostream>
using namespace std;
int main()
{
long long x,n,sum=0,ne=0,z=0;
cin>>n;
for(int i=0;i<n;i++)
{ cin>>x;
if (x<0)
{ ne++;
sum+=abs(x+1);
}
else if(x==0)
{z++;
sum+=1;
}
else if(x>0)
{
sum+=abs(x-1);
}
}
if(ne%2!=0&&z==0)sum+=2;
cout<<sum<<endl;
}
| ALGO | 0.999968 | 3.842089 |
1b2eb4bd-b8f8-4358-9903-e1447617adf1 | kuhu12/cprograms | fruitSellProblem.cpp | #include<bits/stdc++.h>
using namespace std;
double Distance (pair<int,int> p1,pair<int,int> p2)
{
return sqrt((p1.first-p2.first)*(p1.first-p2.first)+(p1.second-p2.second)*(p1.second-p2.second));
}
int main()
{
int N,i,j;
pair<int,int> start1,end1,current;
cin>>start1.first>>start1.second;
cin>>end... | ALGO | 0.999952 | 3.338278 |
7e2a5183-70d6-4343-b02f-5b3857fadc68 | kloud47/DSA-CPP | Graph_DSA_C++/Graph_5-cycle-detection-directed.cpp | ///// Cycle detection in -> Directed graph /////////////////////////////////////////////////////////////////
#include<iostream>
#include<unordered_map>
#include<queue>
#include<list>
using namespace std;
bool checkDFS (unordered_map<int, list<int>> adjlist, unordered_map<int, bool> &visited,
unordered_map<int, boo... | ALGO | 0.999989 | 5.13569 |
b080f17a-23c1-4d50-aa39-8e3a6bb2a522 | Racon23/leetcode2 | solution/389.ๆพไธๅ_2.cpp | // @before-stub-for-debug-begin
#include <vector>
#include <string>
#include "commoncppproblem389.h"
using namespace std;
// @before-stub-for-debug-end
/*
* @lc app=leetcode.cn id=389 lang=cpp
*
* [389] ๆพไธๅ
*
* https://leetcode-cn.com/problems/find-the-difference/description/
*
* algorithms
* Easy (64.18%)
*... | ALGO | 0.999919 | 6.730476 |
e5938fc6-9acc-4875-946f-de1d2b8ec343 | xdroid-CAF/xd_frameworks_av | media/libstagefright/codecs/amrwb/src/isp_isf.cpp | /*
------------------------------------------------------------------------------
Filename: isp_isf.cpp
Date: 05/08/2004
------------------------------------------------------------------------------
REVISION HISTORY
Description:
-----------------------------------------------------------------------------... | ALGO | 0.999315 | 5.655546 |
b4cd440f-dd00-436b-b6da-70b69af5ffb7 | 4SohyunChoi4/PSAlgorithm | 12954.cpp | #include <string>
#include <vector>
using namespace std;
vector<long long> solution(int x, int n) {//x๊ฐ๊ฒฉ, ์ด n๊ฐ
vector<long long> answer;
int num=x;
for(int i=0 ; i<n ; i++){
answer.push_back(num);
num += x;
}
return answer;
} | ALGO | 0.999852 | 3.485704 |
3c033e87-9a65-40c8-81f2-fb2c3c1b4be4 | upendra-coder/CP | A_Exciting_Bets.cpp | #include <bits/stdc++.h>
using namespace std ;
int main() {
int t ;
cin >> t ;
while(t--) {
long long a,b ;
cin >> a >> b ;
if(a == b)
cout << 0 << " " << 0 << endl ;
else {
long long maxgcd = abs(a-b) ;
cout << maxgcd << " " ;
long long ans1 = a%maxgcd ;
long lo... | ALGO | 0.999912 | 4.819448 |
60d7c3d7-e217-4ced-be7d-5a779254a56b | jianminchen/LeetCode-III | 162. Find Peak Element.cpp | class Solution {
public:
int findPeakElement(vector<int>& nums) {
if (nums.size() == 1 || nums[0] > nums[1])
return 0;
else if (nums[nums.size() - 2] < nums[nums.size() - 1])
return nums.size() - 1;
else
{
for (int i = 1; i < nums.size() - 1; i++)
... | ALGO | 0.999896 | 5.636046 |
a6a739d6-6c28-4fd5-bd4a-f39d0adcb24f | azayrahmad/dsa-teaching-material | 13_Tree/13 - TreeBSTLecture.cpp | #include <iostream>
using namespace std;
struct TreeNode {
char data;
struct TreeNode * kiri;
struct TreeNode * kanan;
};
//Fungsi untuk membuat node baru untuk Tree
TreeNode * tambahNode(char dataBaru){
TreeNode * nodeBaru = new TreeNode;
nodeBaru -> data = dataBaru;
nodeBaru -> kiri = NULL;
nodeBaru -> kanan... | ALGO | 0.999923 | 5.745358 |
69fb5eda-4c32-4220-b346-784e09e7e338 | vamsaty/SPOJ-solutions | NG0FRCTN.cpp | #include<bits/stdc++.h>
#define pi pair<long long,long long>
#define mp make_pair
using namespace std;
pi rec(int n){
if(n == 1)
return mp(1,1);
pi s = rec(n/2);
if(n%2 == 0)
return mp(s.first,s.first+s.second);
return mp(s.first+s.second,s.second);
}
int main(){
int t;
while(1){
cin>>t;
if(!t)break... | ALGO | 0.999556 | 3.958574 |
065fce28-ca05-4604-afee-3d991b4ee6e3 | Calipso341/C-my-begining- | ClassWork/Classwork 2.14.19 Tasks/Classwork 2.14.19 Tasks/Source.cpp | //================================= Task 4 =================================
#include<iostream>
using namespace std;
#include<ctime>
int const Size = 5;
int const Size1 = 10;
void FillArr1(int arr[Size][Size1], const int Size);
void PrintArr1(int arr[Size][Size1], const int Size);
void FillArr2(int arr[Size][Size1... | TOOL | 0.898448 | 3.883133 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.