uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
533ebd23-a358-48df-bbd8-2acbc035dca7 | Ashutoshvashisht007/LeetCode | 1511-count-number-of-teams/count-number-of-teams.cpp | class Solution {
public:
int recur1(int idx,vector<int> &rating,int count,int prev,vector<vector<vector<int>>> &dp){
// base
if(count == 3){
return 1;
}
if(idx == rating.size()){
return 0;
}
if(dp[idx][count][prev+1] != -1){
retur... | ALGO | 0.999996 | 5.417155 |
833f6637-ff7f-4d38-be99-c58916836c97 | kiwiwin/topcoder | srm_380_div1_250.cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <c... | ALGO | 0.998641 | 4.77172 |
e0474f8d-e3c2-4138-b383-6d824a97e5c6 | chintuparmar03/array-and-string-questions | dyn_str_reverse.cpp | #include<iostream>
using namespace std;
int main()
{
string str= "CHINTU";
int size = str.size();
int j=size-1,i=0;
char temp=0;
while (i!=j&&i<j){
temp=str[j];
str[j]=str[i];
str[i]=temp;
i++;
j--;
}
cout<<str;
... | ALGO | 0.999733 | 3.370984 |
56c2e8b7-2a2d-49d6-85c4-4e777df11ee5 | YeongjuJeong/BOJ | 10000-15000/10707.cpp | #include <iostream>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int a, b, c, d, p, x, y;
cin >> a >> b >> c >> d >> p;
x = a * p;
if (p < c) y = b;
else y = b + (p - c) * d;
cout << min(x, y) << '\n';
return 0;
} | ALGO | 0.99982 | 3.647941 |
1ba9a78e-59f0-431c-94d5-2a0b655123aa | natan-telles/Projetos-Academicos | MergeSort.cpp | #include<stdio.h>
#define MAX 100100
int tam, vetor[MAX],vetorOrdenado[MAX];
void merge(int v[], int inicio, int meio, int fim, int aux[]){
// conquista
int i = inicio, j = meio+1, k = inicio;
while (i <= meio && j <= fim) {
if (v[i] <= v[j]) {
aux[k] = v[i];
i++;
... | ALGO | 0.999976 | 4.099697 |
768e6c23-fd20-4341-a6fe-a4fef0093436 | ishandutta2007/codeforces | ainta/normal/960/C.cpp | #include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
int X, d;
vector<long long>V;
int main() {
int i;
long long pv = 1;
scanf("%d%d", &X, &d);
while (X) {
int t = 0, c = 0;
while (t * 2 + 1 <= X)t = t * 2 + 1, c++;
X -= t;
for (i = 0; i < c; i++)V.push_back(pv);
pv += d + 1;
}
pri... | ALGO | 0.999802 | 3.102931 |
dac0aef8-f29c-442b-b13e-7b3efbb12686 | isanchez-aguilar/CodeForces | 460B - Little Dima and Equation.cpp | /*
* User: Isanchez_Aguilar
* Problem: CodeForces 460B - Little Dima and Equation
*/
#include <iostream>
#include <string>
#include <cstring>
#include <vector>
#include <algorithm>
using namespace std;
using Long = long long;
Long fastPow(Long a, Long p)
{
Long ans = 1;
while (p > 0)
{
if ((p & 1ll) == 1ll)
... | ALGO | 0.99966 | 3.614247 |
30aa0448-8546-491f-a519-a9de2a62a8ea | mhwen/competitive-programming | CodeForces/CodeForces951/E.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <map>
#include <set>
#include <stack>
#include <functional>
#include <cmath>
#include <numeric>
#include <iomanip>
using namespace std;
typedef long long ll;
#define sz(x) (int)(x).size()
int main() {
ios::sync_with_stdio(false);
c... | ALGO | 0.99996 | 4.346297 |
0a9ed9db-38fc-4867-9cd6-4e2fa75b7014 | VishwajeetVaibhav/DSA_CPP | PatternPractice/pattern13.cpp | #include<iostream>
using namespace std;
int main()
{
int i=1,j=1,n;
char ch='A';
cout<<"Enter desired number : ";
cin>>n;
while(i<=n){
j=1;
while(j<=i)
{
cout<<ch<<" ";
j++;
}
ch=ch+1;
cout<<endl;
i++;
}
return 0... | ALGO | 0.999644 | 3.665636 |
46ceb3ac-9b26-4bf0-89da-f33e003f757a | Joker-Magician/C- | code3/code3/链表的基本使用.cpp | #define _CRT_SECURE_NO_WARNINGS
//#include<stdio.h>
//#include<stdlib.h>
//
//typedef struct _node {
// int value;
// struct _node* next;
//}Node;
//
//int main()
//{
// Node* head = NULL;
// int number;
// do {
// scanf("%d", &number);
// if (number != -1) {
// //add to linked-list
// Node* p = (Node*)malloc(siz... | ALGO | 0.999669 | 3.920924 |
e0ff34b1-1b52-48d1-a3d9-a9cce8caabc9 | ibrahim1118/LeetCode-Solutions | 2684-maximum-number-of-moves-in-a-grid/2684-maximum-number-of-moves-in-a-grid.cpp | class Solution {
public:
int dp[1001][1001];
int solve(vector<vector<int>>& grid, int r, int c){
int n = grid.size();
int m = grid[0].size();
if(c == m){
return 0;
}
if(dp[r][c]!=-1) return dp[r][c];
int mx = 0;
for(int i=-1; i<=1; i++){
... | ALGO | 0.999997 | 6.031785 |
6c639711-1839-43aa-afc7-c3d2910d2489 | Jai-Marothiya/Complete-DSA | Lec-20-5.cpp | // STL container : Queue. follow FIFO mechanism (i.e. first in first out)
#include <iostream>
#include <queue>
using namespace std;
void printQueue(queue<string> gq)
{
queue<string> g = gq;
while (!g.empty())
{
cout << g.front() << " ";
g.pop();
}
cout << '\n';
}
int main()
{
q... | TOOL | 0.960709 | 4.388943 |
115a166f-19b9-46dd-8b68-db747a277836 | robot-perception-group/robust_deep_residual_blimp | airship_simulation/LibrePilot/ground/gcs/src/libs/eigen/bench/eig33.cpp | #include <iostream>
#include <Eigen/Core>
#include <Eigen/Eigenvalues>
#include <Eigen/Geometry>
#include <bench/BenchTimer.h>
using namespace Eigen;
using namespace std;
template<typename Matrix, typename Roots>
inline void computeRoots(const Matrix& m, Roots& roots)
{
typedef typename Matrix::Scalar Scalar;
con... | ALGO | 0.999656 | 5.613888 |
853db58f-264c-4ccd-8d18-3e967b5d0ad8 | qkrtjdrbs/algorithm | 1065.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
int main(){
cin.tie(NULL); cout.tie(NULL); ios::sync_with_stdio(0);
cin >> n;
int ans = 0;
for(int i=-9;i<10;i++){
for(int j=100;j<=n;j++){
string tmp = to_string(j);
bool flag = true;
for(int k=0;k<tmp.si... | ALGO | 0.999216 | 4.074355 |
b7838af8-2e4d-49c6-9632-26b960426ce9 | rilianx/ibex_revmono | src/symbolic/ibex_ExprCopy.cpp | #include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <cassert>
#include <sstream>
#include "ibex_ExprCopy.h"
#include "ibex_Function.h"
#include "ibex_Domain.h"
using namespace std;
namespace ibex {
void varcopy(const Array<const ExprSymbol>& src, Array<const ExprSymbol>& dest) {
assert(src.size()<=... | ALGO | 0.937317 | 6.055084 |
4318424b-da7c-4755-8895-65394efeb200 | Dharnesh67/decode-cpp | assignments/2darray1/p1.cpp | #include <iostream>
using namespace std;
int main()
{ // here it is necesarry to give the size of matrix
int a[3][3] = {
{1, 2, 3},
{4, 5, 6},
{7, 8, 9}};
int b[3][3] = {
{4, 5, 8},
{0, 0, 8},
{1, 2, 0},
};
for (int i = 0; i < 3; i++) /// i is for rows
... | ALGO | 0.998458 | 3.184671 |
8dbda789-8628-4828-aea2-c2816403cfe9 | Yvonne-Young/leetcode | cpp_solutions/173.binary-search-tree-iterator.cpp | /*
* @lc app=leetcode id=173 lang=cpp
*
* [173] Binary Search Tree Iterator
*/
// @lc code=start
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x)... | ALGO | 0.99997 | 6.860108 |
2ce54f60-05fc-4bef-9d87-b99d49b76174 | ishandutta2007/codeforces | kostka/normal/990/B.cpp | //Bartek Kostka
// You are not prepared!
#include "bits/stdc++.h"
using namespace std;
#define x first
#define y second
#define SZ(x) int(x.size())
#define ll long long
#define pii pair <int, int>
#define vi vector <int>
int main()
{
ios_base::sync_with_stdio(0);
int n, k;
cin >> n >> k;
multiset <int> M;
... | ALGO | 0.999963 | 3.584805 |
8d66512e-6f61-4828-a79c-21877fe42129 | braincorp/panda_bullet_dependencies | opende/ode/demo/demo_crash.cpp | // This is a demo of the QuickStep and StepFast methods,
// originally by David Whittaker.
#include <ode/ode.h>
#include <drawstuff/drawstuff.h>
#include "texturepath.h"
#ifdef _MSC_VER
#pragma warning(disable:4244 4305) // for VC++, no precision loss complaints
#endif
// select correct drawing functions
#ifdef dD... | ALGO | 0.989807 | 3.92232 |
c27a6ee8-3d71-487e-b715-ed319fe232eb | shruti1421/Data-Structures-and-Algorithms | Heap/Algorithms/max_HeapSort.cpp | #include<bits/stdc++.h>
using namespace std;
void maxHeapify(vector<int> &heap, int n, int i) {
int largest = i;
int l = 2 * i + 1;
int r = 2 * i + 2;
if (l < n && heap[l] > heap[i])
largest = l;
if (r < n && heap[r] > heap[largest])
largest = r... | ALGO | 0.999985 | 5.000252 |
4b5271f3-634c-4e3d-9a7a-1f640c192b45 | yongma16/intern_project | C++_project/Study_day01/Study_day01/Study_day01.cpp | // Study_day01.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include <iostream>
#include<string>
#include<vector>
#include<stdlib.h>
#include<initializer_list>//可变参数模板
//#incldue<Sales_data.h>//头文件方式
#include"Sales_data.h"//""是从文件中找,<>从系统里面找
Sales_data demo_data;
using std::cout;
using std::cin;
using std::endl;
using std::... | TOOL | 0.863411 | 3.659793 |
54655ba5-c73e-465d-af1a-6e27f8fec0a3 | Amit7055/Assignments | Conditional Statement/Conditonal8.cpp | /* 8. Write a C program to find the largest of three numbers.
Test Data: 12 25 52
Expected Output:
1st Number = 12, 2nd Number = 25, 3rd Number = 52
The 3rd Number is the greatest among three.
*/
#include<stdio.h>
int main()
{
int a,b,c;
printf("Enter 3 Number: ");
scanf("%d%d%d",&a,&b,&c);
if(a>b && a>c)
... | ALGO | 0.999904 | 3.555755 |
31d4cd4d-db3d-44fc-8da9-50ee888012fd | nahid515023/problams-solve-online-platform | Playlist.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
int n;
cin >> n;
vector<int> v(n);
for (auto &x : v)
cin >> x;
int l = 0, r = 0;
set<int> st;
int cnt = 0;
int ans = 0;
while (l < n && r < n)
{
if (st.count(v[r]) == 1)
... | ALGO | 0.999946 | 4.904825 |
6bf839b1-a1e3-4753-ad6c-71ba05e41707 | talentlei/leetcode | Cpp/51-60/Insert Interval.cpp | /**
* Definition for an interval.
* struct Interval {
* int start;
* int end;
* Interval() : start(0), end(0) {}
* Interval(int s, int e) : start(s), end(e) {}
* };
*/
class Solution {
public:
void merge(vector<Interval>& intervals,vector<Interval>& res) {
if(intervals.size()==0) retur... | ALGO | 0.999981 | 5.851117 |
c53f8f98-6aeb-4a6f-9863-3273dcb0177a | Aapef/hae_Jean_gp2 | mt_case ai - pathfinding/Box2D/Box2D/Collision/b2CollideCircle.cpp | #include "Box2D/Collision/b2Collision.h"
#include "Box2D/Collision/Shapes/b2CircleShape.h"
#include "Box2D/Collision/Shapes/b2PolygonShape.h"
void b2CollideCircles(
b2Manifold* manifold,
const b2CircleShape* circleA, const b2Transform& xfA,
const b2CircleShape* circleB, const b2Transform& xfB)
{
manifold->pointCou... | ALGO | 0.999196 | 7.761623 |
1073f882-2526-4ad1-b891-e458c5abcd87 | dberlin/llvm-gvn-rewrite | lib/Analysis/DominanceFrontier.cpp | #include "llvm/Analysis/DominanceFrontier.h"
#include "llvm/Analysis/DominanceFrontierImpl.h"
#include "llvm/IR/PassManager.h"
using namespace llvm;
namespace llvm {
template class DominanceFrontierBase<BasicBlock>;
template class ForwardDominanceFrontierBase<BasicBlock>;
}
char DominanceFrontierWrapperPass::ID = 0;... | TOOL | 0.980933 | 7.72312 |
618f2561-e06a-40e1-a880-e8341d9724a1 | nosianuri/Introduction-to-Algorithms | Module 19/count_of_subset_sum.cpp | #include <bits/stdc++.h>
using namespace std;
int dp[1005][1005];
int subset_sum(int n, int a[], int s)
{
if(n==0)
{
if(s==0)
return 1;
else
return 0;
}
if(dp[n][s] != -1) return dp[n][s];
if(a[n-1] <= s)
{
int op1 = subset_sum(n - 1, a,s-a[n-1]);
int op2 = subset_sum(n-1,a,s);
... | ALGO | 0.999959 | 3.425525 |
4a42da3a-1af6-49d1-9ff8-91a3d016a58d | raincross7/code-similarity | codes/train_code/problem251/problem251_79.cpp | #include<bits/stdc++.h>
#define rep(i, n) for(int i = 0; i < (int)n; i++)
#define repa(i, s, n) for(int i = s; i < (int)n; i++)
using namespace std;
using ll = long long;
typedef vector<int> vi;
int main(){
ll n;
cin >> n;
vector<ll> h(n);
rep(i, n) cin >> h[i];
int ans = 0;
int tmp = 0;
f... | ALGO | 0.999776 | 4.293349 |
45125d21-7788-425b-8d58-27f9ae992c63 | rodrig92/Pi2Deep | source/src/lib/math/matrix_gemm.cpp | #include "matrix_ops.h"
#include <stdio.h>
#include <assert.h>
#include <stdint.h>
#include <stdlib.h>
#ifdef USE_ACCELERATE_GEMM
#include <Accelerate/Accelerate.h>
#endif
#ifdef USE_EIGEN_GEMM
#include <Eigen/Dense>
#endif // USE_EIGEN_GEMM
#ifdef USE_OPENGL
#include "glgemm.h"
#endif // USE_OPENGL
#ifdef USE_NEO... | ALGO | 0.995096 | 7.046117 |
239fc044-d521-471a-aaa8-53b0dedb73f5 | taiheioki/procon2014_ut | solver/exe/kurage_chuning.cpp | #include <algorithm>
#include <atomic>
#include <cstdlib>
#include <iostream>
#include <string>
#include <stdexcept>
#include <thread>
#include <unordered_set>
#include <vector>
#include <boost/program_options.hpp>
#include <boost/format.hpp>
#include <tbb/parallel_for.h>
#include "slide/KurageBoard.hpp"
#include "s... | ALGO | 0.997767 | 5.521017 |
96b31c0e-093c-402c-9121-4ff5b427a68c | Alpha1zln/C_CPP_Projects | LabCollege/FriendGrpSite/FrndlyPlnt.cpp | //vr 8 ........... FriendlyPlanet ***************
#include <iostream>
#include <string>
#include <vector>
#include <unordered_map>
using namespace std;
// ******************************************************
class FriendlyPlanet {
private:
unordered_map<string, vector<string>> friendsList;
unordered_map<s... | TOOL | 0.909773 | 5.216726 |
e432d506-ac2b-4301-a05e-05cacca46d21 | IgorSutyagin/Can2 | Sph.cpp | #include "Sph.h"
/////////////////////////////////////////////////////////////
// Spherical Harmonics implementation
namespace can2
{
SphericalHarmonics gl_sph(-90);
}
using namespace can2;
double SphericalHarmonics::factorial(int n)
{
static double dres[14] =
{
1.0, // 0
1.0, // 1
2.0, // 2
6.0, // 3
... | ALGO | 0.923236 | 4.828587 |
b795293f-5afb-4c58-9ba3-04b8a8b7a500 | Vinimancabbr/codeMarathon-APedra | CodeTitans-Beecrowd/hammingDistance.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int hammingDistance(unsigned long long int a, unsigned long long int b) {
unsigned long long int fval = a ^ b;
return __builtin_popcountll(fval);
}
int main() {
unsigned long long int a;
unsigned long long int b;
cin >> a... | ALGO | 0.999618 | 3.498818 |
ac460cbd-6dfa-49af-b7b1-ba6f9e8a0bb0 | biswajitmaharana2016/CppCode | Rainer_Grimm/source/array.cpp | // array.cpp
#include <algorithm>
#include <array>
#include <iostream>
int main(){
std::cout << std::endl;
// output the array
std::array <int,8> array1{1,2,3,4,5,6,7,8};
std::for_each( array1.begin(),array1.end(),[](int v){std::cout << v << " ";});
std::cout << std::endl;
// calculate the sum of the ... | TOOL | 0.981499 | 5.515437 |
f5f5d9a2-623a-41e3-b2dd-3ef03044fcbb | SCgeeker/lsj-book-zh_tw | renv/library/R-4.2/x86_64-w64-mingw32/RcppEigen/tinytest/cpp/solution.cpp |
#include <RcppEigen.h>
// [[Rcpp::depends(RcppEigen)]]
typedef Eigen::ArrayXd Ar1;
typedef Eigen::Map<Ar1> MAr1;
typedef Eigen::ArrayXXd Ar2;
typedef Eigen::Map<Ar2> MAr2;
typedef Eigen::MatrixXd Mat;
typedef Eigen::Map<Mat> ... | ALGO | 0.997338 | 4.331167 |
b118693a-c53f-4830-81ef-a7ca2c050997 | ming-000/flutter-test | 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 |
37a043c7-c958-4d1d-8814-f9521885625f | yashbhanu/Data-Structure-and-Algorithms | Problem Solving/Binary Search Tree/bst_kthSmallestElem_2.cpp | #include <iostream>
using namespace std;
class BinaryTreeNode
{
public :
int data;
BinaryTreeNode *left;
BinaryTreeNode *right;
BinaryTreeNode(int data) {
this -> data = data;
this -> left = NULL;
this -> right = NULL;
}
};
... | ALGO | 0.999985 | 5.803652 |
b631ef4d-7831-4bbe-a933-9de1ca8f3043 | nekida/skillbox_cpp | 27/task1.cpp | #include <iostream>
#include <string>
#include <random>
#include <assert.h>
#include <vector>
static constexpr int numOfTree = 1;
int getRandomInRange (const int min, const int max)
{
return min + (rand() % (max - min + 1));
}
class Branch {
std::string nameElf = "";
int numBigBranch = 0;
int numM... | TOOL | 0.969925 | 4.314308 |
098598f0-ebd7-456f-a5af-8317bf3093fd | adarshgiri125/practiceQuestion_CPP | Basic/Prime Number/prime-number.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
int isPrime(int N){
int ans = 1;
if(N <= 1){
return 0;
}
for(int i = 2; i<= sqrt(N); i++){
if (N%i == 0){
ans = 0;... | ALGO | 0.998669 | 5.540417 |
6a0b0f37-1795-498d-8d6e-62faeef1fd57 | slingjuns/LCNotes | Tags/Simulation/1823 Find the Winner of the Circular Game/1823 Find the Winner of the Circular Game.cpp | // Date: October 1, 2023
class Solution {
public:
int findTheWinner(int n, int k) {
// simulation
list<int> ss;
for(int i = 0; i < n; ++i) ss.push_back(i+1);
decltype(ss)::iterator it = ss.begin();
while(n > 1) {
for(int j = 0; j < k-1; ++j) {
... | ALGO | 0.999992 | 6.027995 |
f5610db0-6ae9-4f57-b2f6-e7c7aab413bf | Bol-C14/Matrix_Solver_Benchmarking_Suite | lib/klu_new/src/SuiteSparse-dev/Mongoose/MATLAB/edgecut.cpp | //------------------------------------------------------------------------------
// Mongoose/MATLAB/edgecut.cpp
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
#include "mongoose_mex.hpp"
using namespace... | ALGO | 0.993509 | 6.446542 |
633899ce-67d4-4823-ac56-9f38f65bd267 | Fernandozs10/Competitiva-Soluciones | rare order.cpp | #include <iostream>
#include <vector>
#include <cstring>
#include <bitset>
using namespace std;
typedef vector<int> vi;
vector<vi> AdjList;
bitset<30> visited, appeared;
vi finishOrder;
void dfs(int u) {
visited.set(u);
for (int i = 0; i < (int) AdjList[u].size(); i++) {
int v = AdjList[u][i];
... | ALGO | 0.999951 | 4.021085 |
521dfd2e-234c-49ca-a5aa-1830a1b5ce8e | pcacjr/qt-creator | src/libs/3rdparty/botan/src/pubkey/eckaeg/eckaeg_op.cpp | #include <botan/eckaeg_op.h>
#include <botan/numthry.h>
namespace Botan {
Default_ECKAEG_Op::Default_ECKAEG_Op(const EC_Domain_Params& dom_pars,
const BigInt& priv_key,
const PointGFp& pub_key)
: m_dom_pars(dom_pars),
m_pub_key(pub_key)... | ALGO | 0.985326 | 6.082993 |
5ed43bc5-b9c8-4e39-a057-8e14ca006e31 | gupta-parth/competitive-programming | solutions/codeforces/1519/a.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--) {
long long r, b, d;
cin >> r >> b >> d;
if (r * (d + 1) < b || b * (d + 1) < r) {
cout << "NO\n";
} else {
cout << "YES\n";
}
}
}
| ALGO | 0.9993 | 4.324684 |
2aac0f5d-37c2-4959-a845-24676741cf24 | Mansiikumarii/LeetCode-GfG | Difficulty: Medium/Topological sort/topological-sort.cpp | class Solution {
public:
void dfs(unordered_map<int, vector<int>>& adj, vector<int>& vis, stack<int>& st, int u) {
vis[u] = 1;
for (auto padosi : adj[u]) {
if (!vis[padosi])
dfs(adj, vis, st, padosi);
}
st.push(u);
}
vector<int> topoSort(int V, vector<vector<int>>& edges) {
... | ALGO | 0.999994 | 5.785769 |
e933cdd1-0d82-4005-bc81-06bc41ff3c99 | ThanakritW/ocom2021 | HELPTEMP/Inserton.cpp | #include <bits/stdc++.h>
using namespace std;
int n,i,a[100010];
string s1,s2,s3;
void bsort(int a[])
{
int c = 1;
if(s1 == "greater")
while(c > 0)
{
c=0;
for(int i=0;i<n-1;i++)
if(a[i] > a[i+1])
{
swap(a[i],a[i+1]);
c++;
... | ALGO | 0.999915 | 4.220873 |
b5c91b6f-8205-4d42-b071-2415a23ccde4 | bartsidee/boxee | xbmc/BrowseWindowFilter.cpp |
#include "BrowseWindowFilter.h"
#include "VideoInfoTag.h"
#include "MusicInfoTag.h"
#include "utils/log.h"
#include "boxee.h"
#include "Util.h"
#define WINDOWS_FOLDER_SEPARATOR '\\'
#define LINUX_FOLDER_SEPARATOR '/'
CBrowseWindowFilter::CBrowseWindowFilter(int id, const CStdString& strName)
{
m_iId = id;
m_strNam... | TOOL | 0.879722 | 5.582296 |
870a2a6f-be26-4fdc-8dc8-f20aee233020 | Poojya-D/100daystocode | SubarrySum.cpp | /******************************************************************************
find subarray with given sum
*******************************************************************************/
#include <iostream>
using namespace std;
int main()
{
int arr[] = {1,8,12,13,9};
int su... | ALGO | 0.999951 | 4.824005 |
dd68ee94-5eb0-4e87-8a34-8089e96bd9d6 | totymedli/coding-contest-solutions | projecteuler/002.cpp | //Solution: 4613732
#include <iostream>
using namespace std;
int main()
{
int ossz = 2;
int pre = 1;
int pre2 = 2;
for (int i = 3; i <= 4000000; i = pre + pre2)
{
pre = pre2;
pre2 = i;
if (i % 2 == 0)
ossz += i;
}
cout << ossz;
return 0;
}
| ALGO | 0.999763 | 4.281292 |
c23f9487-89a9-4358-bd1e-059c3a2a80de | codeuser-crypto/DSA-C-- | 11-array/MaxSubarraySum.cpp | /*1. Brute Force:
Idea: For each subarray arr[i..j], calculate its sum.
Time Complexity: O(N3)
Space Complexity: O(1)*/
#include <iostream>
#include<climits>
using namespace std;
int main(){
int n;
cin >> n;
int arr[n];
for(int i = 0; i < n; i++){
cin >> arr[i];
}
int maxSum = INT_MIN;
... | ALGO | 0.999967 | 5.314214 |
b3581a6c-2eca-4f65-873b-e0d8b6b10fe4 | tejus0/TLE-Eliminators | R-800/TwoPermutations.cpp | /*
written by Pankaj Kumar.
country:-INDIA
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
/* ascii value
A=65,Z=90,a=97,z=122
*/
// Techniques :
// divide into cases, brute force, pattern finding
// sort, greedy, binary search, two pointer
// transform into graph
int solve(){
int ... | ALGO | 0.999923 | 4.102202 |
68a40348-46e9-4a83-ae39-9c56cebdf382 | PetrZaicev/Stepik_Introduction_to_Programm_Cpp | 1.6 Действительные числа/Task8.cpp | /* Дан многочлен P(x)=anxn + an−1xn−1+ … + a1x + a0 и число x. Вычислите значение этого многочлена, воспользовавшись схемой Горнера:
P(x)=(…(((anx + an−1)x + an−2)x + an−3) … )x+ a0
Формат входных данных
Сначала программе подается на вход целое неотрицательное число n ≤ 20, затем действительное число x,
затем следу... | ALGO | 0.999677 | 4.337955 |
9635cdba-ac9c-4c14-92bd-0a2057065366 | Maserhe/LeetCode | 559.n叉树的最大深度.cpp | /*
* @lc app=leetcode.cn id=559 lang=cpp
*
* [559] N叉树的最大深度
*/
// @lc code=start
/*
// Definition for a Node.
class Node {
public:
int val;
vector<Node*> children;
Node() {}
Node(int _val) {
val = _val;
}
Node(int _val, vector<Node*> _children) {
val = _val;
child... | ALGO | 0.999949 | 7.021738 |
a5a9572a-795f-4d71-9ff4-fba538609939 | Ishu-sri-001/DSA | Tree/LevelOrderTraversal.cpp | // https://leetcode.com/problems/binary-tree-level-order-traversal/
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {... | ALGO | 0.999868 | 6.508717 |
93169027-fcb3-4cfd-8b41-e417def929db | nobe9216/MyCampSites | 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 |
f7428009-c8ef-40aa-9a3a-c194d0b39b9b | Lophophora24/Quench_2.0 | thirdparty/boost_1_82_0/libs/gil/doc/html/_downloads/mandelbrot.cpp | #include <boost/gil/image.hpp>
#include <boost/gil/typedefs.hpp>
#include <boost/gil/extension/io/jpeg.hpp>
// Creates a synthetic image defining the Mandelbrot set.
// The example relies on a virtual_2d_locator to iterate over the pixels in the destination view.
// The pixels (of type rgb8_pixel_t) are generated prog... | ALGO | 0.912065 | 6.417197 |
d454d58f-4387-4c12-a3da-1e0d833d3838 | BlueberryPie-kyle/Algorithm-Exercise | LuoGu/P4994.cpp | #include <bits/stdc++.h>
#define endl "\n"
using namespace std;
void solve() {
int a = 0, b = 1, c, n = 1, m;
cin >> m;
while (true) {
c = (a + b) % m;
a = b;
b = c;
if (a == 0 && b == 1) {
cout << n;
break;
}
n++;
}
}
int main() ... | ALGO | 0.999979 | 4.27465 |
6b99a03e-d843-4d78-a3d2-37273c756dda | zfa07/Killyouss | Engine/Source/ThirdParty/CryptoPP/5.6.2/include/gf2_32.cpp | // gf2_32.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "misc.h"
#include "gf2_32.h"
NAMESPACE_BEGIN(CryptoPP)
GF2_32::Element GF2_32::Multiply(Element a, Element b) const
{
word32 table[4];
table[0] = 0;
table[1] = m_modulus;
if (a & 0x80000000)
{
table[2] = m_modulus ^ (... | ALGO | 0.999746 | 5.535272 |
8d3cdba0-f1b4-44ce-a392-5c1ac1f45435 | tmdgh1592/PROBLEM_SOLVE | BAEKJOON/PS/BOJ_1939.cpp | #include <bits/stdc++.h>
#define endl "\n"
#define FAST ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define rep(i, a, b) for(auto i = a; i < b; ++i)
#define REP(i, a, b) for(auto i = a; i <= b; ++i)
#define pii pair<int, int>
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define INF num... | ALGO | 0.999912 | 4.770612 |
df6984f9-451a-4e34-8c5c-caaf7365ff9d | beneychen/PRACTISE | 图论/最短路/sightsee.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <cstring>
using namespace std;
const int N = 1e3 + 5, M = 1e4 + 5, Inf = 0x3f3f3f3f;
struct Edge{
int to, w; int next;
}e[M];
int head[N], cnte;
int t, n, m, u, v, w, st, en;
int dis[N][2], vis[N][2], cnt[N][2];
struct Node{
int inde... | ALGO | 0.999959 | 4.363714 |
83ba95c5-8dae-4c62-b6ba-23b53b0abea4 | xavimarin35/TonicEngine | TonicEngine/Source Code/Libraries/MathGeoLib/include/Math/float4.cpp | /** @file float4.cpp
@author Jukka Jylnki
@brief */
#include "float4.h"
#ifdef MATH_ENABLE_STL_SUPPORT
#include "myassert.h"
#include <utility>
#include <iostream>
#endif
#include <stdlib.h>
#include "float2.h"
#include "float3.h"
#include "../Geometry/Sphere.h"
#include "../Algorithm/Random/LCG.h"
#include "float4... | TOOL | 0.941425 | 3.776405 |
80806fba-3374-4e1d-81e9-293d2fc7da28 | Riczzoe/CS106B | Section/section_3/ChangeWeCanBelieveIn.cpp | #include "ChangeWeCanBelieveIn.h"
#include "error.h"
using namespace std;
int fewestCoinsFor(int cents, const Set<int>& coins) {
(void) cents;
(void) coins;
return -1;
}
/* * * * * Test Cases Below This Point * * * * */
#include "GUI/SimpleTest.h"
PROVIDED_TEST("Works for US currency.") {
Set<int> us... | TEST | 0.957362 | 6.785889 |
cca98924-2311-41fc-a354-7b6ddcb32e17 | jeonghnpark/DERIV_SHB3 | SingleOption/AsianOption.cpp | #include "AsianOption.h"
#include <vector>
#include <random>
using namespace std;
double AsianOption::Calc(MarketParam & para, long numMc)
{
//old interface don't use
double s0 = para.get_spot();
Rate R = para.get_rfrate();
Rate Q = para.get_q();
signed int vd = para.get_vdate();
signed int expiryd = GetExpiryd(... | ALGO | 0.999017 | 6.236455 |
1653c9db-4d43-4205-9394-0ac0f2c4833c | IsNotMyIP/Ejercicos-Algoritmos-y-estructuras-de-datos | 2 -Analisis de Algoritmos Recursivos/Ej2-1/Ej2-1/Ej2-1/main.cpp | #include <iostream>
using namespace std;
#include <math.h>
unsigned int recursivoMCD(int mayor, int menor){
if (mayor != 0){
return recursivoMCD(menor, mayor%menor);
}
else{
return mayor;
}
}
int recursivoPotencia(int base, unsigned int exponente){
if (exponente != 0){
return base * recursivoPotencia(base... | ALGO | 0.999681 | 3.779014 |
a021b2a8-e2f1-4506-b672-ba6e6259e800 | UET-2425HK2-INT2210-01/23021458-CTDL-GT | 23021458_NguyenThanhVinh_Tuan2/Lect2_Assignment4.cpp | #include <iostream>
#include <string>
using namespace std;
struct node {
int data;
node* next;
};
node* makeNode(int x)
{
node* newNode = new node();
newNode->data = x;
newNode->next = NULL;
return newNode;
}
void push(node*& queue, int x)
{
node* newNode = makeNode(x);
if (queue == NULL)
{
queue = newNod... | ALGO | 0.999368 | 4.641429 |
ef35cb41-9f1a-41dd-a8ac-12d53fdcf5d0 | Pragnesh2208/LeetCode-Solution | Backtracking/#77 Combination.cpp | /********************************Optimal approach to Print all Permutation*********/
/********************************Time Complexity = O ( C(N*K)* K )************************/
/********************************Here K to putting temp in ans and N * K for total permutations************/
/*****************************... | ALGO | 0.999971 | 5.957173 |
ae482b9e-d6bf-4aaf-a0be-d9bfc695b338 | Shubham-9798/competitive-programming | code block/binarySearch.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int binarySearch (vector<int>,int num);
int main(){
int myints[] = {32,71,12,45,26,80,53,122};
std::vector<int> myvector (myints, myints+8);
int num=1522;
//sort
std::sort (myvector.begin(), myvector.begin()+myvector.size()-1);
... | ALGO | 0.999655 | 4.801319 |
06ecf09a-5736-4f1f-9f69-860aab80d95e | Umars007/Flutter-Projects | meal_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.998824 | 6.76073 |
5e315459-4406-47cc-9282-717d079b11c2 | PAUL-NYA/Aquino | 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 |
ca23551d-4775-48e2-b401-35c28dfd37b1 | shivam-72/DSACodes | 2280-count-good-triplets-in-an-array/2280-count-good-triplets-in-an-array.cpp | class Solution {
public:
void updateSeg(int i, int l, int r, int idx, vector<long long>& seg) {
if (l == r) {
seg[i] = 1;
return;
}
int mid = l + (r - l) / 2;
if (idx <= mid) {
updateSeg(2 * i + 1, l, mid, idx, seg);
} else {
... | ALGO | 0.999962 | 5.134156 |
09804d8d-5c2e-4034-89ff-f084c205a6b9 | monowarulIslamShraban/cf_solves | 1647A.cpp | /*
Problem Link: https://codeforces.com/problemset/problem/1647/A
Solve Link: https://codeforces.com/contest/1647/submission/149803261
*/
#include<bits/stdc++.h>
#define intld long double
#define intll long long
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define endl "\n"
using nam... | ALGO | 0.99979 | 4.182715 |
26af051a-fb2f-4f56-a9bf-8e0bb7b080ae | Dtcreation/Firmware-Molise-Artillery | Marlin/src/lcd/fontutils.cpp | /**
* @file fontutils.cpp
* @brief help functions for font and char
* @author Yunhui Fu (<EMAIL>)
* @version 1.0
* @date 2016-08-19
* @copyright GPL/BSD
*/
#include "../inc/MarlinConfig.h"
#if HAS_WIRED_LCD
#include "marlinui.h"
#include "../MarlinCore.h"
#endif
#include "fontutils.h"
uint8_t re... | TOOL | 0.902232 | 5.716172 |
ec512ba7-a437-4720-beb0-7466eca333f9 | niteshim0/DSA | 07_Bit_Manipulation/13_Power_Set.cpp | class Solution {
public:
vector<vector<int>> subsets(vector<int>& nums) {
int n = nums.size();
int no_of_subsets = 1<<n;
vector<vector<int>> ans;
for(int num = 0;num<no_of_subsets;num++){
vector<int> vec;
for(int i = 0;i<n;i++){
... | ALGO | 0.999923 | 6.536224 |
11408c36-4115-463c-9d4c-20a1de33e8dd | alexsaen/fog | Fog/Src/Fog/Core/Math/Integrate.cpp | // [Precompiled Headers]
#if defined(FOG_PRECOMP)
#include FOG_PRECOMP
#endif // FOG_PRECOMP
// [Dependencies]
#include <Fog/Core/Global/Global.h>
#include <Fog/Core/Global/Init_p.h>
#include <Fog/Core/Global/Private.h>
#include <Fog/Core/Math/Function.h>
#include <Fog/Core/Math/Fuzzy.h>
#include <Fog/Core/Math/Interv... | ALGO | 0.999886 | 6.967373 |
8390d204-5dcb-41a7-b9ec-1b1370bc8920 | Sudhir769/Sudhirleet769 | Burning Tree - GFG/burning-tree.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
struct Node {
int data;
Node *left;
Node *right;
Node(int val) {
data = val;
left = right = NULL;
}
};
Node *buildTree(string str) {
// Corner Case
if (str.length() == 0 || str... | ALGO | 0.999381 | 6.513347 |
781ff361-e886-4b08-8893-b91a48acc8c4 | MelihEkinci/Optical-Flow-Horn-Schunck | eigen-3.4.0/doc/examples/tut_arithmetic_redux_basic.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::Matrix2d mat;
mat << 1, 2,
3, 4;
cout << "Here is mat.sum(): " << mat.sum() << endl;
cout << "Here is mat.prod(): " << mat.prod() << endl;
cout << "Here is mat.mean(): " << mat.mean() ... | ALGO | 0.998908 | 3.872858 |
49daa4a2-894b-4ddd-b892-01f21cc23818 | Gaurav-08-dev/Pepcoding | Level -2/3) Tree/46) convert bst to linked list.cpp | /* BST TO LINKED LIST* /
/* APPROACH 1 - recursive */
class Solution {
public:
TreeNode* prev=NULL;
void flatten(TreeNode* root) {
if(!root) return ;
flatten(root->right);
flatten(root->left);
root->right=prev;
root->left=... | ALGO | 0.999994 | 5.800367 |
e788413c-e279-4ec1-9920-80bf62afebdd | DiegoLarrieta/MasterDS-A | Excercises/LinkedList/mergetwosortedLL.cpp | /*
🔗 Problema: Merge Two Sorted Linked Lists
📘 (LeetCode 21: Merge Two Sorted Lists)
🎯 Enunciado:
Te dan dos listas enlazadas ordenadas de forma ascendente.
Tu tarea es combinarlas en una sola lista también ordenada y devolver su head.
Input:
List1: 1 → 2 → 4
List2: 1 → 3 → 5
Output:
Merged: 1 → 1 → 2 → 3 → 4 →... | ALGO | 0.999969 | 6.153512 |
7e944a0d-b59a-4d3c-a178-3c0561ad2301 | Jay7221/competitve-programming | other_contests/code_spark_expert_dkte/clowns_closet.cpp | #include <bits/stdc++.h>
using namespace std;
//#pragma GCC optimize("Ofast,unroll-loops")
//#pragma GCC target("avx,avx2,avx512,fma")
template<typename A, typename B> ostream& operator<<(ostream &os, const pair<A, B> &p) { return os << '(' << p.first << ", " << p.second << ')'; }
template<typename T_container,... | ALGO | 0.999843 | 4.676175 |
68435206-baef-490a-9e6c-17c3598c8045 | DV1537/assignment-a1-dxsh | main.cpp | #include <iostream>
#include <fstream>
/**
* The program reads numbers from a file and prints the sum of them
* Example: main.exe ./tests/input.in
* @param argc [description]
* @param argv [description]
* @return [description]
*/
int main(int argc, const char* argv[]) {
int a = 0;
int sum = 0;
int a... | TOOL | 0.899931 | 4.680922 |
109ac7a5-624e-4862-b486-18088fbaf820 | HectorPascual/openthread | src/core/thread/lowpan.cpp | /**
* @file
* This file implements 6LoWPAN header compression.
*/
#include "lowpan.hpp"
#include "common/code_utils.hpp"
#include "common/debug.hpp"
#include "common/encoding.hpp"
#include "common/instance.hpp"
#include "common/locator-getters.hpp"
#include "net/ip6.hpp"
#include "net/udp6.hpp"
#include "thread/... | TOOL | 0.881155 | 5.718594 |
d70c234a-85a4-4df4-aa44-8feb9818b292 | kalex1994/UVA | 860.cpp | #include<iostream>
#include<cstdio>
#include<cmath>
#include<cstdlib>
#include<cstring>
#include<string>
#include<bitset>
#include<map>
#include<set>
#include<limits>
#include<sstream>
#include<stack>
#include<vector>
#include<algorithm>
#include<list>
#include<iomanip>
#include<queue>
using namespace std;
#define Em... | DATA | 0.990424 | 3.53354 |
3326478e-0156-4cd6-a8f4-2a423108134a | saching1307/C- | sqrt.cpp | #include<iostream>
#include<cmath>
using namespace std;
#define ERROR_MARGIN 0.00001
float mySqrt(float i)
{
if(i == 1)
return 1;
else if(i < 0)
return INT_MIN;
else if(i > 1)
{
float low = 0;
float mid;
float high = i;
while(1)
{
mid = (low + high)/2.0;
float diff = abs((mid * mid) - (float... | ALGO | 0.999784 | 3.117631 |
3cf7d20b-c3a0-41a0-a470-53aece0487cf | GonGarciaFontenla/AyED | Guia-4/13.cpp | #include <iostream>
using namespace std;
void mostrar(double matriz[5][4], int filas, int columnas){
for (int i = 0; i < filas; i++)
{
for (int j = 0; j < columnas; j++)
{
cout<< matriz[i][j]<< " ";
}
cout<< endl;
}
}
void insertar_array_matriz(const double*... | ALGO | 0.999325 | 3.393913 |
9ed89e46-e6fe-49b9-a843-8d703a5382ee | Rakeshgsekhar/code_practice_c_plus_plus | codes/shortestPalindrom.cpp | #include <iostream>
#include<vector>
#include<set>
#include <algorithm>
#include<string>
#include <cstring>
#include<conio.h>
using namespace std;
class Solution {
public:
string shortestPalindrome(string s) {
int endIndex = 0 ;
if(s.size() == 0){
return "";
}
if(s.s... | ALGO | 0.999957 | 5.639689 |
2d75d6c6-9836-4d0c-bb98-df7b615c1186 | mohadmed-adel/iam_facetime | 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.998693 | 6.797273 |
021cb3dd-968a-46f7-86cf-f04199ebdcc7 | qiaozishun4/CSP2024_BJ | BJ-Senior/answers/BJ-S00471/color/color.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
int t, n;
int a[20];
int ans;
int last0 = 1, last1 = 0;
void dfs(int step, int tot) {
if (step > n) {
ans = max(ans, tot);
return;
}
int tmp = last0;
last0 = step;
dfs(step + 1, tot + (a[tmp] == a[step]) * a[step]);
l... | ALGO | 0.999721 | 4.397734 |
cfab9ece-ac92-4640-83e5-e9c50231d241 | lvf411/EdgeDeviceManage_Master | src/taskSchedule/globalVar.cpp | #include<iostream>
#include<vector>
using namespace std;
int tasknum_TEST;
int cpunum_TEST;
vector<vector<double>> DAG_TEST;
vector<vector<double>> NxPw_TEST;
vector<double> taskWeight_TEST;
vector<double> cpuSpeed_TEST;
| ALGO | 0.997213 | 3.408145 |
dbf54212-2fb2-4fde-b72b-7e15b17a3873 | abytm10/My-Leetocde-solutions | two_sum.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
for (int i = 0; i < nums.size(); i++) {
int complement = target - nums[i];
cout << "com" << complement << endl;
auto k = std::find(nums.begin(), nums.end(), complement);
if( k != num... | ALGO | 0.999347 | 5.906546 |
6c999258-261d-4832-b34b-fb7a09304941 | ishandutta2007/codeforces | kaitokid/normal/610/A.cpp | #include <iostream>
using namespace std;
int main()
{
int a;
cin>>a;
if(a%2!=0){cout<<"0";return 0;}
cout<<((a/2)-1)/2;
return 0;
} | ALGO | 0.999578 | 3.211991 |
3134f89d-d6ee-4d46-ae8f-5b6d3a1a7b1a | hthuwal/competitive-programming | leetcode/cpp/longest-consecutive-sequence.cpp | /* -------------------------------------------------------------------------- */
/* https://leetcode.com/problems/longest-consecutive-sequence/ */
/* -------------------------------------------------------------------------- */
#include <stack>
#include <unordered_map>
#include <unordered_set>
using na... | ALGO | 0.999846 | 6.113245 |
d3a8e22c-5256-48da-8036-908466dc69bb | vinodpkd/leetcode | 3168.cpp | //3168. Minimum Number of Chairs in a Waiting Room
/*
You are given a string s. Simulate events at each second i:
If s[i] == 'E', a person enters the waiting room and takes one of the chairs in it.
If s[i] == 'L', a person leaves the waiting room, freeing up a chair.
Return the minimum number of chairs needed s... | ALGO | 0.999493 | 4.64015 |
420f3f7d-9a39-45bb-9e3d-1d247ae1a047 | BSDRock/Ravesli | 41r.cpp | #include <iostream>
int comma(int x, int y, int y)
{
}
int main()
{
int a=78;
int b=87;
int c=90;
double t = 7.0;
std::cout << sizeof(t); // выводим размер переменной t в байтах
comma(a, b, c);
return 0;
}
| ALGO | 0.893131 | 3.080876 |
5dd74ad2-5336-4456-8b85-d6471e1f4ee4 | talha-khondoker/Week4 | Day-7/B_Roof_Construction.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
ll tc;
cin>>tc;
while (tc--)
{
ll n;
cin>>n;
ll x=log2(n-1);
ll y=1<<x;
for(int i=n-1; i>=y; i--)
{
cout<<i<<" ... | ALGO | 0.999731 | 4.706851 |
5fc6af46-c9dd-4137-963d-dfc86ccc9c4f | snandasena/cf-contests | hacker_rank/repeat_letters.cpp | #include <bits/stdc++.h>
using namespace std;
// Complete the repeatedString function below.
long repeatedString(string s, long n) {
long ans = 0;
long len = s.length();
for (int i = 0; i < min(len, n); ++i) {
if (s[i] == 'a') ans++;
}
if (n <= len) {
return ans;
} else {
... | ALGO | 0.999662 | 4.363598 |
43ff9214-8512-4028-9c26-e4e0c6f0067b | dotexe3301/codeforces_solutions | 808D_array_division.cpp | #include<iostream>
#include<map>
using namespace std;
int main()
{
int n;
cin>>n;
int arr[n+5];
long long sum=0;
for(int i = 0 ; i <n ; i++)
{
cin>>arr[i];
sum+=arr[i];
}
if(sum & 1)
{
cout<<"NO";
return 0;
}
map<long long,int>first,... | ALGO | 0.99999 | 3.860747 |
96c00db9-820c-445c-b4fb-24aa3797ba63 | vvickia/Conservative-Lax-scheme | lax.cpp | #include <cmath>
#include <iostream>
#include "headers/lax.h"
#include "headers/iof.h"
#include "headers/de_allocate.h"
#include "headers/init_functions.h"
using namespace std;
// The function of saving the program result to a file
// x, t are arrays of coordinates (N size) and time (M_size), respectively
// func is... | ALGO | 0.999628 | 4.31684 |
63f032ad-fd3c-4e6c-a993-16986bff103f | goelayush7/LEETCODE | 39-combination-sum/combination-sum.cpp | class Solution {
public:
void helper(vector<int>&cand,int target,int index,vector<int>&temp,vector<vector<int>>&out){
if(target==0){
out.push_back(temp);
return;
}
if(index==cand.size()){
if(target==0){
out.push_back(temp);
}
... | ALGO | 0.999991 | 6.40929 |
7a97103b-320c-442b-9915-3859f6a093b2 | rockychowdhury/Problem_Solving | W6/Day_03/Oneful_Pairs.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define ll long long
#define In_range(i, s, n) for (int i = s; i < n; i++)
typedef pair<int, int> pii;
const int INF = 1e9 + 7;
const int N = 1e5 + 5;
const int M = 1e3 + 5;
int i, j;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.... | ALGO | 0.999958 | 3.390738 |
1a89014b-0ea0-480d-9bae-2083104a61ee | MateyApostolov/Olimpiici_D | fivediv v2.cpp | #include <bits/stdc++.h>
using namespace std;
bool is_prime(long long num) {
for(long long i = 2; i * i <= num; i++) {
if(num % i == 0) return false;
}
return true;
}
int main () {
long long n, sum = 0;
cin >> n;
for(long long i = 2; i * i * i * i <= n; i++) {
if(is_prime(i)) s... | ALGO | 0.99993 | 4.326723 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.