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 |
|---|---|---|---|---|---|---|
41d05057-a57a-4f3f-91d4-1b510309ba39 | yuyangh/LeetCode | 124. Binary Tree Maximum Path Sum.cpp | #include "LeetCodeLib.h"
/*
* @lc app=leetcode id=124 lang=cpp
*
* 124. Binary Tree Maximum Path Sum
*
* https://leetcode.com/problems/binary-tree-maximum-path-sum/description/
*
* algorithms
* Hard (30.11%)
* Testcase Example: '[1,2,3]'
*
* Given a non-empty binary tree, find the maximum path sum.
*
* Fo... | ALGO | 0.999744 | 6.206652 |
f99d0e5d-1d95-4082-a87a-3e8813033600 | Lunaris-AOSP/external_cronet | tot/third_party/libc++/src/test/std/algorithms/alg.nonmodifying/alg.find/ranges.find_if_not.pass.cpp | // <algorithm>
// UNSUPPORTED: c++03, c++11, c++14, c++17
// template<input_iterator I, sentinel_for<I> S, class Proj = identity,
// indirect_unary_predicate<projected<I, Proj>> Pred>
// constexpr I ranges::find_if_not(I first, S last, Pred pred, Proj proj = {});
// template<input_range R, class Proj = ide... | TEST | 0.872536 | 7.374797 |
e7a8f990-a9a7-4e38-a74c-f660a54976d4 | parsa-x86/MySolutions | codeforces/A/Dubstep.cpp | // Problem: A. Dubstep
// Contest: Codeforces - Codeforces Round #130 (Div. 2)
// URL: https://codeforces.com/problemset/problem/208/A
// Memory Limit: 256 MB
// Time Limit: 2000 ms
#include <iostream>
using namespace std;
int main() {
string s;
cin >> s;
bool needsSpace = false;
for (size_t i = 0; i < s.siz... | ALGO | 0.999534 | 4.926219 |
19548118-aa10-40b0-b878-fb61bea24e6f | jtnicholl/GroupBConnectTheNumbers | fileio/Utils.cpp | #include "Utils.h"
#include <fstream>
#include <sstream>
namespace fileio {
inline bool fileExists(const std::string& filename) {
std::ifstream file(filename.c_str());
return file.good();
}
inline void saveText(const std::string& text, const std::string& filename) {
std::ofstream outfile;
outfile.op... | TOOL | 0.979961 | 6.273982 |
8e82aba8-8167-47bd-9cc5-55980b933b88 | vishaltiwari/GSoC-GEOS | geos-svn/src/geomgraph/DirectedEdge.cpp | #include <geos/util/TopologyException.h>
#include <geos/geomgraph/Edge.h>
#include <geos/geomgraph/EdgeRing.h> // for printing
#include <geos/geomgraph/DirectedEdge.h>
#include <geos/geom/Location.h>
#include <geos/geomgraph/Label.h>
#include <geos/geomgraph/Position.h>
#include <geos/inline.h>
#include <cmath>
#incl... | ALGO | 0.987092 | 6.226351 |
76a0cbf9-24d0-4085-bbe1-2ac7b6b95cef | MapleSystem/secure-c | libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp | // UNSUPPORTED: c++98, c++03
// <vector>
// template <class... Args> iterator emplace(const_iterator pos, Args&&... args);
#include <vector>
#include <cassert>
#include "min_allocator.h"
#include "asan_testing.h"
int main(int, char**)
{
{
std::vector<int> v;
v.reserve(3);
assert(is_cont... | TEST | 0.971239 | 5.868145 |
e806b375-325f-4a50-af9e-81054be7826d | BhartiRajesh99/DSA | graphAdjacencyMatrix.cpp | #include<iostream>
using namespace std;
class Graph{
private:
int adj[20][20] = {0};
int vertex,Edges,directed;
public:
// for unweighted graph
void addEdge(int u, int v){
adj[u][v] = 1;
if(this->directed)
adj[v][u] = 1;
}
... | ALGO | 0.999429 | 5.312871 |
91f2a55c-d23e-4540-b4e4-e314ea7fe927 | yeonggwangchoi/Baekjoon_Algorithm | 5176.cpp | #include <iostream>
using namespace std;
int main()
{
cin.tie(nullptr);
cout.tie(nullptr);
ios::sync_with_stdio(false);
while (true)
{
int N;
cin >> N;
int P, M;
cin >> P >> M;
if (P > M)
cout << P - M << "\n";
else{
for (int i = 0; i < P; i++) {
}
}
}
} | ALGO | 0.99925 | 3.306215 |
29fee83a-fbc9-4829-8d3d-6540315df925 | khushisinha20/Data-Structures-and-Algorithms | Trees/Binary Search Trees/serialize_and_deserialize_bst.cpp | //leetcode.com/problems/serialize-and-deserialize-bst/
#include <bits/stdc++.h>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(nullptr), right(nullptr) {}
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
TreeNode(int x, Tree... | ALGO | 0.999921 | 7.267788 |
5d42d65b-d3d2-47f6-86dd-80850700135b | AlexRalston/Exercises | ejercicioExamenBi7.cpp | /*En una estacion meteo se toman meidiciones 7x24 matriz filas son dias y columnas temperaturas*/
#include<iostream>
#include<iomanip>
using namespace std;
int main(){
const int NUM_DIAS=7;
const int NUM_HORAS=24;
//Declaracion del array
int temperaturas[NUM_DIAS][NUM_HORAS];
//El usuario introd... | ALGO | 0.996086 | 3.058233 |
4952ed9b-9a3a-4408-9b95-0902d296f789 | Ghost-W0LF/Ecommorce-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.998809 | 6.763549 |
6f7dd633-c46c-479e-8632-9f8aea50a22c | Daksh-404/Discrete-Structures | question9.cpp | #include<iostream>
using namespace std;
float sqrt(int number)
{
float ans=0;
float inc=1.0;
for(int i=0;i<=3;i++)
{
while(ans*ans<=number)
{
ans=ans+inc;
}
ans=ans-inc;
inc=inc/10;
}
return ans;
}
void expressionRecurrence(int k1,int k2,int k3,int b1,int b2... | ALGO | 0.999067 | 4.022435 |
6175c117-f698-48e4-bc13-ca89257f91b7 | Delthin/leetcode-solution | leetcode/editor/cn/[707]设计链表.cpp | /**
你可以选择使用单链表或者双链表,设计并实现自己的链表。
单链表中的节点应该具备两个属性:val 和 next 。val 是当前节点的值,next 是指向下一个节点的指针/引用。
如果是双向链表,则还需要属性 prev 以指示链表中的上一个节点。假设链表中的所有节点下标从 0 开始。
实现 MyLinkedList 类:
MyLinkedList() 初始化 MyLinkedList 对象。
int get(int index) 获取链表中下标为 index 的节点的值。如果下标无效,则返回 -1 。
void addAtHead(int val) 将一个值为 val 的节点插入到链表中第一个元素... | ALGO | 0.999531 | 5.094675 |
79579647-3343-4021-b19a-a4e224eebb07 | DragonKrissash/Competitive-Programming | Old Data/CP PWIOI Contest 1/carbohydrate_per_day.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
for(int b=1;b<=t;b++){
string word;
cin>>word;
int max=270,sum=0,a=0;
sort(word.begin(),word.end());
for(a=0;a<word.length();a++){
sum=sum+word[a];
if(sum>=max){
... | ALGO | 0.999618 | 3.788518 |
44782b3a-2f26-4a4d-a2b5-dd72e9b43c95 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_13302_7.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
cout<<c<<" "<<a<<" "<<b;
}
| ALGO | 0.999798 | 3.124499 |
b3ffa1e3-98d3-499e-87b7-ba0feb183335 | wickedcoder12/stlcpp | stl13.cpp | // we will talk about maps now
// we will talk about normal maps and unordered maps
// map is data structure that stores which stores data corresponding to a key basically maps it
// int - string map
// 1 abc
// 5 cdc here 5 and 1 is key and maps help in mapping
// normal map stores data in sorted orde... | ALGO | 0.992552 | 4.763843 |
20524674-608e-429b-9954-8a13143ff3fb | cal-cs184-student/p4-clothsim-sp23-linum-usitatissimum | ext/nanogui/ext/eigen/failtest/jacobisvd_int.cpp | #include "../Eigen/SVD"
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
#define SCALAR int
#else
#define SCALAR float
#endif
using namespace Eigen;
int main()
{
JacobiSVD<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));
}
| ALGO | 0.931074 | 3.33146 |
d9c6a173-68c9-4208-be8b-049d64023c0a | cjeongmin/2022-CPP-Snake_Game | Snake.cpp | #include "Snake.h"
Snake::Snake() {
direction = 0;
dx[0] = dy[1] = -1;
dx[2] = dy[3] = 1;
dx[1] = dx[3] = dy[0] = dy[2] = 0;
maximum_length = 3;
cell.push_back(Cell(10, 10, HEAD));
cell.push_back(Cell(10, 11, BODY));
cell.push_back(Cell(10, 12, BODY));
}
Snake::~Snake() {}
void Snake... | TOOL | 0.997434 | 5.233049 |
d1d11c01-b63e-4604-ab5c-ff72392b304a | ajay-1134/Concepts | Graph/number_of_ways_to_arrive_at_destination.cpp | #include<bits/stdc++.h>
using namespace std;
int countPaths(int n, vector<pair<int,int>>g[], int src, int dest) {
vector<pair<int,int>>min_time(n,{INT_MAX,0});
min_time[src] = {0,1};
priority_queue<pair<int,int>,vector<pair<int,int>>,greater<pair<int,int>>>q;
q.push({0,src});
while(!q.empty()){
... | ALGO | 0.999929 | 4.339664 |
de93347a-6c47-4dda-bff5-589989fd00f1 | 1lavrenkova1/profile_1lavrenkova1 | Backtracking/test.cpp | #include <iostream>
#include <vector>
#include <chrono>
class Square{
public:
int x_coord;
int y_coord;
int size;
Square(int x, int y, int size): x_coord{x}, y_coord{y}, size(size){}
};
void print_result(std::vector<Square>& table, int min){
std::cout<<table.size()<<"\n";
... | ALGO | 0.993965 | 3.879562 |
dafafe66-6291-4da9-8032-eec33aa89292 | archeos/micmac-archeos | src/uti_phgrm/TexturePacker/TexturePacker.cpp | #include "TexturePacker.h"
#include <assert.h>
#ifndef __GNUC__
#pragma warning(disable:4100 4244)
#endif
namespace TEXTURE_PACKER
{
class Rect
{
public:
void set(int x1,int y1,int x2,int y2)
{
mX1 = x1;
mY1 = y1;
mX2 = x2;
mY2 = y2;
}
bool intersects(const Rect &r) const
{
bool i... | ALGO | 0.989905 | 5.209051 |
8d713336-8a36-4c5f-a1e8-385f5a0f87f3 | iCore-034/First-semester-college-labs-CPP | lab 4/Labs 4.1.cpp | #include <iostream>
#include <vector>
#include <algorithm> // ( n*log n)
using namespace std;
void main() {
vector<double> nums; //
nums.push_back(1); // , = [1...n], 1
int n = 0;
cout << "Input count numbers.(Beginning is always == 1)" << endl;
cin >> n; // 1
cout << "Input numbers." << e... | ALGO | 0.999415 | 3.423616 |
2187fd2b-8d79-49ec-944e-43d8321a8264 | rifatbroh/LAB_Academic | Ostad_Coding Cracking/Array_assignment/Array_assignment/task1.cpp | #include <bits/stdc++.h>
using namespace std;
/*
Time Complexity: O(n^2)
Space Complexity: O(1)
*/
vector<int> Sum(vector<int>& nums, int target) {
for (int i = 0; i < nums.size(); i++) {
for (int j = i + 1; j < nums.size(); j++) {
if (nums[i] + nums[j] == target) {
ret... | ALGO | 0.999758 | 5.460112 |
1c93c8b9-e8b7-4514-9ded-dff195e021ff | event-driven-robotics/four-dof-affine-tracking | code/analysis.cpp | #include <yarp/os/all.h>
#include <event-driven/algs.h>
#include <event-driven/vis.h>
using namespace yarp::os;
#include "affine.h"
class objectPos: public yarp::os::RFModule
{
private:
cv::Size img_size;
double period{0.01};
double eros_k, eros_d;
double tau_latency{0};
double recording_duratio... | TOOL | 0.853686 | 4.948177 |
1de08c88-4fbf-410b-bdd4-c9e083ea64b4 | ishandutta2007/codeforces | romawhite/normal/773/C.cpp | #define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/stack:16777216")
#include <string>
#include <vector>
#include <map>
#include <list>
#include <iterator>
#include <cassert>
#include <set>
#include <queue>
#include <iostream>
#include <sstream>
#include <stack>
#include <deque>
#include <cmath>
#include <memory.... | ALGO | 0.999872 | 3.360744 |
f5692b9f-cba8-4b52-b531-822cea64de7b | GuilhermeGabriel/competitive-programming | neps/369.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
bool trocado = false;
cin >> n;
int vet[n];
for (int i = 0; i < n; i++) {
cin >> vet[i];
}
for (int i = 0; i < n - 1; i++) {
if (vet[i] % 5 == 0 && vet[i] < vet[n - 1]) {
int aux = vet[n - 1];
vet[n - 1] = vet[i];
vet[i] = aux;
... | ALGO | 0.999937 | 4.038376 |
3fa35169-5468-463a-8ced-365f05b50c07 | coldice/g5e_test1 | work_dir/src/G5E_ver01/G5E/g5e_math.cpp | #include "g5e_math.h"
G5EPoint::G5EPoint()
{
x=0;
y=0;
z=0;
}
G5EPoint::G5EPoint(float x, float y, float z)
{
this->x = x;
this->y = y;
this->z = z;
}
bool G5EPoint::operator ==(G5EPoint point)
{
if(this->x == point.x && this->y == point.y && this->z == point.z) return 1;
else return 0;
}
G5EPoint G5EPoint::ope... | TOOL | 0.966416 | 4.540662 |
131bbc6f-19fb-43ca-8a1b-05c88fabdede | 226YR/Atcoder | 375/c.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main()
{
int n;
cin >> n;
vector<vector<int>> a(n, vector<int>(n));
vector<vector<bool>> b(n, vector<bool>(n, false));
rep(i, n)
{
rep(j, n)
{
cin >> a[i][j];
if (a[i][j] == '.')
... | ALGO | 0.999975 | 3.210599 |
abc11e30-b85e-40c5-9bb5-24d0c94b4f60 | Hedgehoged/Konovalov_Daniil | cubic_spline_interpolation/interpolation_.cpp | #include "interpolation_.h"
#include <cassert>
#include <iostream>
#include <numeric>
#include <stdexcept>
#include <vector>
LinearInterpolation::LinearInterpolation(std::map<Arg, Val> &&data)
{
for (auto it = data.begin(); it != std::prev(data.end()); ++it)
{
auto [x1, f1] = *it;
auto [x2, f2] = *std::ne... | ALGO | 0.999093 | 5.670964 |
1102a949-3fab-48c0-b2fe-ce2a87d6d39f | derand/cpp_tasks | task04/task0417.cpp | #include <iostream>
#include <stdlib.h>
#include <cmath>
using namespace std;
int main(int argc, const char *argv[])
{
const int n = 10;
double arr[n] = { 1.0, 0.0, -3.0, 4.0, -2.5, 0.0, 2.5, 1.7, 0, 2.0};
int i = 0;
double c = 2.3;
// Enter array from keyboard
//for (; i<n; i++) {
// ... | ALGO | 0.999831 | 3.33305 |
88607459-a2af-4ba6-9301-43db5d71c78b | dementrock/acm | poj/Archives/1458/7102860_AC_16MS_4136K.cpp | #include<stdio.h>
#include<string>
#include<iostream>
using namespace std;
string s1,s2;
int f[1001][1001];
inline int max(int a, int b){return a>b?a:b;}
void dp(int x, int y)
{
f[x][y]=0;
if(!x||!y) return;
if(s1[x-1]==s2[y-1])
{
if(f[x-1][y-1]==-1) dp(x-1,y-1);
f[x][y]=max(f[x][y],f[x-1][y-1]+1);
}
if(f[x][... | ALGO | 0.99998 | 3.857591 |
7658f932-5dd8-4a90-8005-681b58bfeb62 | renukagour/Competitive_Coding | Renuka/03-02-2023_Patterns/number_pattern/pattern3.cpp | #include<iostream>
using namespace std;
int main(){
int n,i,j;
cin>>n;
int c=1;
for(i=0;i<n;i++){
for(j=0;j<=i;j++){
cout<<c++<<" ";
}
cout<<endl;
}
c--;
for(i=0;i<n;i++){
for(j=0;j<=n-1-i;j++){
cout<<c--<<" ";
}
cout<<... | ALGO | 0.999986 | 3.293537 |
1c722e06-9ccd-4ee7-826c-56de269c154a | rmbozhko/prat-ltr | ch7/ex/ex06.cpp | #include <iostream>
using std::cout;
using std::endl;
using std::cin;
void ft_show_array(const double *arr, const size_t len)
{
for (size_t i = 0; i < len; i++)
cout << "Element\'s #" << i + 1<< " value: " << arr[i] << endl;
}
void ft_reverse_array(double *arr, const size_t len)
{
double temp;
size_t i;
si... | TOOL | 0.876844 | 3.758868 |
a77c7aa5-d578-43b3-b118-f90b271d2a91 | ivayloknchv/DSA_2024_2025 | Week 10/kClosest.cpp | // https://leetcode.com/problems/k-closest-points-to-origin/description/
struct MyCmp
{
bool operator()(const vector<int>& lhs, const vector<int>& rhs)
{
long long l1 = lhs[0] * lhs[0] + lhs[1] * lhs[1];
long long l2 = rhs[0] * rhs[0] + rhs[1] * rhs[1];
return l1 < l2;
}
};
class S... | ALGO | 0.999995 | 6.073075 |
8624b91d-978d-497d-ae98-5c2600992edc | HritikChandravnshi/VotingApp | calculator.cpp | #include<iostream>
using namespace std;
int main(){
int num1, num2, input;
cout<<"Enter num1: ";
cin>>num1;
cout<<"Enter num2: ";
cin>>num2;
cout<<"Options:\n";
cout<<"1. Addition\n";
cout<<"2. Subtract\n";
cout<<"Input: ";
cin>>input;
// some wrong program
switch(inp... | TOOL | 0.926106 | 3.443123 |
c2c507a6-5a3a-449a-8d85-a0823224422a | avplayer/proxy | third_party/boost/libs/spirit/example/qi/roman.cpp | ///////////////////////////////////////////////////////////////////////////////
//
// A Roman Numerals Parser (demonstrating the symbol table). This is
// discussed in the "Symbols" chapter in the Spirit User's Guide.
//
// [ JDG August 22, 2002 ] spirit1
// [ JDG March 13, 2007 ] spirit2
//
//////////////////////... | TOOL | 0.950561 | 7.725194 |
718bdfe5-22cd-45ce-b29c-4191160a60b1 | Rayleigh0328/OJ | leetcode/36.cpp | class Solution {
public:
bool isValidSudoku(vector<vector<char>>& a) {
bool ans = true;
for (int i=0;i<9;++i)
for (int j=0;j<9;++j)
if (!(a[i][j] == '.' || ('1'<=a[i][j] && a[i][j]<='9'))) return false;
bool *flag = new bool [200];
//chec... | ALGO | 0.998357 | 5.863126 |
609e6a80-82c4-464f-89b5-30b49247993c | XessX/Angry_Bird_Alike | boost/libs/context/example/callcc/fibonacci.cpp | #include <cstdlib>
#include <iostream>
#include <memory>
#include <boost/context/continuation.hpp>
namespace ctx = boost::context;
int main() {
int a;
ctx::continuation c=ctx::callcc(
[&a](ctx::continuation && c){
a=0;
int b=1;
for(;;){
c=c.resume()... | TOOL | 0.913928 | 4.739003 |
d76994f8-56c4-4fc5-9716-32f76f4a2cbc | viniciusvidal2/Ardupilot_GRIn | libraries/AP_Math/matrixN.cpp | /*
* N dimensional matrix operations
*/
#pragma GCC optimize("O3")
#include "matrixN.h"
// multiply two vectors to give a matrix, in-place
template <typename T, uint8_t N>
void MatrixN<T,N>::mult(const VectorN<T,N> &A, const VectorN<T,N> &B)
{
for (uint8_t i = 0; i < N; i++) {
for (uint8_t j = 0; j < ... | ALGO | 0.994595 | 5.782454 |
274eb895-ac51-482a-8aa0-4b847a7f286e | IgorPBorja/competitive-programming | problems/GruPro/2024-05-04/B.cpp | // #define TESTCASES
// #define DEBUG
#include <bits/stdc++.h>
using namespace std;
#define vi vector<int>
#define vb vector<bool>
#define vc vector<char>
#define vvi vector<vector<int>>
#define vvb vector<vector<bool>>
#define vvc vector<vector<char>>
#define vvpi vector<vector<pair<int, int>>>
#define pii pair<int,... | ALGO | 0.99984 | 4.490365 |
950d099a-1596-4db5-9c96-1f18016b3d6a | mdmahamudmredha/Problem_Solving_C_and_Cpp | CodeForces/1923B_Monsters_Attrack.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ull unsigned long long
#define py cout<<"YES\n";
#define pn cout<<"NO\n";
/*----Start Needed Function-----------------------------------------------*/
// Function to calculate the factorial of a number
int... | ALGO | 0.99996 | 3.72576 |
324e5486-e560-4a82-850f-0337690df138 | jstraub/rtmf | src/realtimeMF.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <rtmf/rtmf.hpp>
#include <rtmf/realtimeMF_openni.hpp>
#include <boost/program_options.hpp>
namespace po = boost::program_options;
int main (int argc, char** argv)
{
// Declare the supported options.
po::options_description desc("Allowed options")... | DATA | 0.990303 | 4.552507 |
af94daea-0097-4aeb-8c7e-b2f152345aed | Mihir-Panjikar/CPP | 2-D Array/Program_3.cpp | /*
Write a function in C++ which accepts an integer array and its size as arguments and
replaces elements having even values with its half and elements having odd values with
twice its value.
Example :
if an array of five elements initially contains the elements as 3, 4, 5, 16, 9 then the function
should rearrange the... | ALGO | 0.996412 | 5.265393 |
bbee5eb4-9fc6-4660-af9e-3b6894a36e44 | scarsty/lammps_m | src/fix_dt_reset.cpp | #include "math.h"
#include "stdlib.h"
#include "string.h"
#include "fix_dt_reset.h"
#include "atom.h"
#include "update.h"
#include "integrate.h"
#include "domain.h"
#include "lattice.h"
#include "force.h"
#include "pair.h"
#include "modify.h"
#include "fix.h"
#include "output.h"
#include "dump.h"
#include "comm.h"
#inc... | TOOL | 0.913572 | 6.345935 |
c3edd8c0-3b39-48ef-befe-0ecbd4067c99 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_7463_16.cpp | #include <bits/stdc++.h>
using namespace std;
int pre[200005], a[2 * 200005], b[3 * 200005];
int n, L;
bool ok(int val) {
memset(pre, 0, sizeof(pre));
int bas = n + 1, son = n;
while (bas - 1 >= 1 && a[n + 1] - b[bas - 1] <= val) bas--;
while (son + 1 <= 2 * n && b[son + 1] - a[n + 1] <= val) son++;
for (int ... | ALGO | 0.999979 | 3.24102 |
df702787-d7ce-424e-8882-90a0549147e9 | qingyili/Universal-Puzzle-Solver | Project 1/HeapPriorityQueue.cpp | //HeapPriorityQueue.cpp
#ifndef _HEAPPRIORITYQUEUE_CPP
#define _HEAPPRIORITYQUEUE_CPP
#include "HeapPriorityQueue.hpp"
#include <cassert>
#include <cstdlib>//for NULL
#include <iostream>
HeapPriorityQueue::HeapPriorityQueue() {
// TODO
//?nothing to do not dynamicall allocated
}
HeapPriorityQueue::~HeapPriorit... | ALGO | 0.971704 | 4.566331 |
0f077d9a-1454-415c-a1f6-9c29ea966295 | jorgmo02/Problemas-resueltos-MARP | 07 - Multitarea.cpp | #include <iostream>
#include <queue>
#include <fstream>
struct Tarea {
int inicio = 0;
int fin = 0;
int periodo = -1;
bool operator < (const Tarea& b) const {
return inicio > b.inicio;
}
};
bool resuelveCaso() {
// leer los datos de la entrada
int nTareas = 0, nPeriodicas = 0;
... | ALGO | 0.999908 | 4.252775 |
75bdc905-4b9a-4db7-8929-4969b7224a29 | ishandutta2007/codeforces | sohsoh/normal/540/E.cpp | /*
Soheil Mohammadkhani
I will change this text here when i've got "Candidate Master":)
*/
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define X first
... | ALGO | 0.999984 | 4.493986 |
a3f9f461-a923-4301-8f7f-a0acbcc16edf | shivajaysaxena/LeetCode | 405-convert-a-number-to-hexadecimal/convert-a-number-to-hexadecimal.cpp | class Solution {
public:
string HEX = "0123456789abcdef";
string toHex(int num) {
if (num == 0)
return "0";
string ans;
int count = 0;
while (num && count++ < 8) {
ans = HEX[(num & 0xf)] + ans;
num >>= 4;
}
return ans;
}
}; | ALGO | 0.999783 | 5.93366 |
63b2d16d-7923-4382-baac-2fd02ff1f5b9 | friengineer/rgb-triangle-renderer | pixelwidget.cpp | #include <QtGui>
#include <QApplication>
#include <QMainWindow>
#include <QMessageBox>
#include <QPainter>
#include <QLabel>
#include <QDesktopWidget>
#include <iostream>
#include <fstream>
#include "pixelwidget.hpp"
using namespace std;
void PixelWidget::DefinePixelValues() {
SetPixel(10,30,RGBVal(255,0,0));
Set... | TOOL | 0.956109 | 5.396794 |
7ad13830-88af-4a8a-8b19-d49c6d12eabf | Piyusss/Lc-2024 | 2582-minimum-score-of-a-path-between-two-cities/minimum-score-of-a-path-between-two-cities.cpp | class Solution {
public:
void dfs(int node,vector<pair<int,int>>adj[],vector<int>&vis,int &mini){
vis[node]=1;
for(auto it:adj[node]){
mini=min(mini,it.second);
if(!vis[it.first]){
dfs(it.first,adj,vis,mini);
}
}
}
int minScore(int n, vector<vector<int>>& roads) {
... | ALGO | 0.999965 | 5.703435 |
b5701644-a9d0-4912-a16d-709bcd664fb6 | sarvinshrivastava/Cpp.Leetcode | P-2579.cpp | class Solution {
public:
long long coloredCells(int n) {
long long sum = 1;
while (n > 1) {
n--;
sum += 4 * n;
}
return sum;
}
};
| ALGO | 0.999974 | 5.734648 |
28f3d819-219a-4373-a926-24a1948fe67f | imkshitiz/Leetcode | 1431-kids-with-the-greatest-number-of-candies/1431-kids-with-the-greatest-number-of-candies.cpp | class Solution {
public:
vector<bool> kidsWithCandies(vector<int>& candies, int extraCandies) {
int maxElement = *max_element(candies.begin(),candies.end());
vector<bool> ans;
for(int i =0;i<candies.size();i++){
if( candies[i]+ extraCandies >= maxEl... | ALGO | 0.999962 | 6.01038 |
30d7b9ee-fb0b-420a-a8cc-a185f5dc5278 | Tiphereth-A/CP-lib | test/library-checker-datastructure/unionfind.test.cpp | #define PROBLEM "https://judge.yosupo.jp/problem/unionfind"
#include "../../include/ds/dsu_basic.hpp"
using namespace tifa_libs;
int main() {
std::cin.tie(nullptr)->std::ios::sync_with_stdio(false);
u32 n, q;
std::cin >> n >> q;
ds::dsu_basic dsu(n + 1);
flt_ (u32, i, 1, q + 1) {
u32 t, u, v;
std::c... | ALGO | 0.99885 | 5.282835 |
1a362756-6584-4c92-95f9-a4593bb6cc35 | ishandutta2007/codeforces | rosed/normal/1666/L.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define ls(p) (p<<1)
#define rs(p) (p<<1|1)
#define mid ((l+r)>>1)
#define y1 zmakioi
const int N=5e5+10;
int n,m,s;
vector<int> eg[N];
queue<int> q;
int pre[N];
int qwq[N];
int st[N][2],top[2];
inline void spfa()
{
pre[s]=-1;
for(int t:eg[s])
{
pr... | ALGO | 0.999976 | 3.709704 |
33ae73fc-d5b7-4894-8117-3b1006bf7437 | yuval2017/3DAnimation | ass2/igl/slice_cached.cpp | #include <iostream>
#include <vector>
#include <utility>
#include "slice.h"
template <typename TX, typename TY, typename DerivedI>
IGL_INLINE void igl::slice_cached_precompute(
const Eigen::SparseMatrix<TX>& X,
const Eigen::Matrix<int,Eigen::Dynamic,1> & R,
const Eigen::Matrix<int,Eigen::Dynamic,1> & C,
Eigen:... | ALGO | 0.97114 | 6.503207 |
7f68a5e5-86bb-4d30-abef-962ddb10c266 | maidat1708/PTIT_DSA | KT055 ( bai toan cai tui 0 - 1 ).cpp | #include<bits/stdc++.h>
using namespace std;
int t,n,v,dp[1005][1005]={0},a[1005],c[1005];
int result() {
for (int i = 1;i <= n ;++i) for (int j =1;j <= v ; ++j) {
dp[i][j] = dp[i-1][j];
if (j>=a[i]) dp[i][j] = max ( dp[i][j], dp[i-1][j-a[i]]+c[i]);
}
return dp[n][v];
}
int main(){
cin >> t;
while(t--){
ci... | ALGO | 0.99991 | 3.50397 |
de0ae3f5-3f52-4701-ba87-867538da9353 | anwar-arif/acm-code | lightoj/1162 - Min Max Roads.cpp | #include <cassert>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <queue>
#... | ALGO | 0.999864 | 4.090183 |
cc565639-3ff5-4a54-96bb-f791cf7e3e13 | shivPratap007/daily-dsa | recursion/05-findTheSum.cpp | #include<iostream>
#include<vector>
using namespace std;
int findSum(vector<int> arr,int i){
if(i==arr.size()-1){
return arr[i];
}
int ret=findSum(arr,i+1);
return ret+arr[i];
}
int main(){
int n;
cin >> n;
vector<int> arr(n);
for(int i=0; i<n; i++){
cin >> arr[i] ;
... | ALGO | 0.999945 | 4.30836 |
7215ccb1-70e8-48ae-8ad3-49ec3ab66b33 | ishandutta2007/codeforces | eddy1021/normal/802/I.cpp | // eddy1021
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef double D;
typedef long double LD;
typedef long long LL;
typedef pair<int,int> PII;
typedef pair<LL,LL> PLL;
#define mod9 1000000009LL
#define mod7 1000000007LL
#define INF 1023456789LL
#define INF16 10000000000000000LL
#define... | ALGO | 0.999844 | 3.910223 |
d8413edb-25a5-4ae4-b8c9-c046d3ef6d56 | CodeNameLiquid/c-lab-report | lab/lab3/lab3_2.cpp | #include<iostream>
#include<cmath>
using namespace std;
class cartesian;
class polar
{
float mag,dir;
public:
polar(float m,float d)
{
mag=m;
dir=d;
}
void input()
{
cout<<"Enter the polar coordinates"<<endl;
cin>>mag>>dir;
... | TOOL | 0.917526 | 4.009243 |
5c523b91-d0c9-4c28-b572-c2cea567f51a | Jackarain/avhttp | boost/libs/msm/doc/HTML/examples/BoostCon09Full.cpp | #include <vector>
#include <iostream>
#include <boost/mpl/vector/vector50.hpp>
#include <boost/msm/back/state_machine.hpp>
#include <boost/msm/front/state_machine_def.hpp>
#include <boost/msm/back/tools.hpp>
namespace msm = boost::msm;
namespace mpl = boost::mpl;
namespace // Concrete FSM implementation
{
// eve... | TOOL | 0.935624 | 7.01484 |
af58e3a6-2825-4ccf-b716-a3899881b4d7 | aakashkumarjee/interviewbit-solutions | Arrays/flip.cpp | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
vector<int> solve(string A)
{
int n = A.size();
int l = 0, r = 0, ltemp = 0;
int count = 0;
int fcount = 0;
vector<int> ans;
if (n == 0)
return ans;
for (int i = 0; i < n; i++)
{
if (A[i] == '0')
{... | ALGO | 0.99984 | 4.461277 |
6ae0f767-694c-4aa5-9e42-fda3e8de2ab9 | ishandutta2007/codeforces | trivialman/normal/1552/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for (int i = (a); i <= (b); ++i)
#define rrep(i, a, b) for (int i = (a); i >= (b); --i)
#define PB push_back
#define ar2 array<int, 2>
typedef long long LL;
const LL P = 998244353;
const int INF = (1 << 30) - 1;
const int N = 25;
mt19937 rng(time(0));
... | ALGO | 0.999881 | 4.814352 |
51cd7f18-9653-4d65-8c85-76e4511f3112 | wphu/lizCode | src/Collisions/Collisions2D_Elastic.cpp | #include "Collisions2D_Elastic.h"
#include "SmileiMPI.h"
#include "Field2D.h"
#include <cmath>
#include <iomanip>
#include <algorithm>
#include <ostream>
#include <sstream>
using namespace std;
// Constructor
Collisions2D_Elastic::Collisions2D_Elastic(PicParams& params, vector<Species*>& vecSpecies, SmileiMPI* smpi,... | ALGO | 0.99653 | 4.155691 |
2075d71d-3dba-4741-ba6a-25939a508800 | jiahao2333/AYYWARE1 | AYYWARE CSGO/MathFunctions.cpp | /*
Syn's AyyWare Framework 2015
*/
#include "MathFunctions.h"
#include "CommonIncludes.h"
void AngleVectors(const Vector &angles, Vector *forward)
{
Assert(s_bMathlibInitialized);
Assert(forward);
float sp, sy, cp, cy;
sy = sin(DEG2RAD(angles[1]));
cy = cos(DEG2RAD(angles[1]));
sp = sin(DEG2RAD(angles[0]));
... | ALGO | 0.958656 | 5.52859 |
5e1ec363-b447-4a75-8e88-81684ca83772 | mehuloo3/gfg | Difficulty: Hard/Boolean Parenthesization/boolean-parenthesization.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
public:
bool evaluate(int b1,int b2,char &op)
{
if(op=='&')
return b1&b2;
if(op=='|')
return b1|b2;
if(op=='^')
... | ALGO | 0.999495 | 6.542465 |
83e40c33-fbab-4b5a-8329-00a056430ca9 | Bartek-cloud/cwiczenia | łatwe_easy/DDZ6 - Posortuj Euklidesa.cpp | #include<iostream>
#include<vector>
#include <algorithm>
using namespace std;
int nwd(int a, int b) {
if (b == 0)
return a;
return nwd(b, (a % b));
}
bool cmp(const int a,const int b) {
if (nwd(a,1260) == nwd(b,1260)) {
if (a < b) {
return true;
}
else return false;
}
else if (nwd(a,1260) > nwd(b,1260... | ALGO | 0.999939 | 3.968246 |
57089b68-7380-429c-ac06-6504305193cf | muzee99/BOJ | BOJ4963.cpp | // BOJ4963_섬의 개수
#include <iostream>
#include <queue>
using namespace std;
int w,h;
int count = 0;
int check[501][501];
int map[501][501];
int step[8][2] = {{-1,-1}, {-1,0}, {-1,1}, {0,-1}, {0,1}, {1,-1}, {1,0}, {1,1}};
int isInside(pair<int, int> locate) {
if(locate.first>=0 && locate.first<h && locate.second>=... | ALGO | 0.999855 | 4.846754 |
dfffd2ff-df58-4a7f-8277-d1084dd43d7f | starga2er777/PointCloudCompression | modules/video/src/tracking/detail/tracker_mil_model.cpp | #include "../../precomp.hpp"
#include "tracker_mil_model.hpp"
/**
* TrackerMILModel
*/
namespace cv {
inline namespace tracking {
namespace impl {
TrackerMILModel::TrackerMILModel(const Rect& boundingBox)
{
currentSample.clear();
mode = MODE_POSITIVE;
width = boundingBox.width;
height = boundingBox... | ALGO | 0.99467 | 6.097854 |
3e05d5b8-b818-431a-89be-75c999a935e8 | LeonardoHOjeda/flutter-codes | project_final/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.998634 | 6.783439 |
f08948fe-6d5b-4d79-9dd3-9cfd865458cb | bobur554396/PPI2024 | week15/G1/3.cpp | #include <iostream>
using namespace std;
int main(){
// - [ ] Prefix sum of array elements
/*
In:
5
1 2 3 4 5
Out:
1 3 6 10 15
1 2 3 4 5
1 3
*/
int n;
cin >> n;
int a[n], b[n];
for(int i = 0; i < n; i++)
cin >> a[i];
int sum = 0;
for(in... | ALGO | 0.999358 | 4.171272 |
cdc081b3-897f-4b30-b39c-e1d45ea6b364 | xuy/planning_roamer | src/VAL/typecheck.cpp | #include "typecheck.h"
#include "ptree.h"
#include <functional>
#include "main.h"
#include "Exceptions.h"
#include <algorithm>
namespace VAL {
void TypeHierarchy::addDown(const PTypeRef & t1,const PTypeRef & t2)
{
GIC i = downGraph.find(&t1);
GIC j = downGraph.find(&t2);
if(i == downGraph.end())
{
i = graph.fin... | ALGO | 0.944266 | 4.021828 |
61a3dfeb-647d-4053-a2b2-9b7fb0dc654e | plasmatic1/dmoj-solutions | cpp/dmopc15c1p6.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> p;
const int MAX = 200001;
int m, n, q, bi, bl, br, bx,
arr[MAX], counttree[MAX * 6], totallazyp[MAX * 12]; // Large arbitrary coefficients to account for O(nlogn) size
#define M_ADD(x, y) ((((x) % (m)) + ((y) % (m))) % (m))... | ALGO | 0.9998 | 4.885187 |
0c46d712-8d00-4a3d-86a6-fb451ada82b5 | ykofficial15/Urjotsav | 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.99887 | 6.783439 |
da327375-cb4f-4cf1-a8d8-3d0513dbceb8 | haarit19058/DSAinC | CSES/string_algorithms/word_combinations.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
// TODO: solve "Word Combinations"
return 0;
}
| ALGO | 0.997573 | 3.587215 |
7157c2c8-6011-4a37-ab78-40ca23d819bc | OmkarBhostekar/leetcode | 208-implement-trie-prefix-tree/208-implement-trie-prefix-tree.cpp | class TrieNode{
public:
char val;
bool end;
unordered_map<int,TrieNode*> next;
TrieNode(char x){
this->val = x;
this->end = false;
}
};
class Trie {
public:
unordered_map<char,TrieNode*> m;
Trie() {
}
void insert(string word) {
... | ALGO | 0.999862 | 5.996927 |
3da1d8c7-b9e9-469d-8a53-fa94fd864a84 | Kawser-nerd/CLCDSA | Source Codes/AtCoder/abc037/D/2272178.cpp | #include <iostream>
#include <string>
#include <stdlib.h>
#include <cmath>
#include <vector>
#define rep(i, s, N) for(int i = s; i < N; i++)
#define Yes(result) if (result) std::cout << "Yes" << '\n'
#define No(result) if (!result) std::cout << "No" << '\n'
#define resetarr(val, arr) for(int i = 0; i < sizeof(arr) / 4... | ALGO | 0.999958 | 4.388815 |
5698ebba-9091-475a-a26b-31e047ccee3b | pclubiitk/Spring-Camp-25 | CP/Harshil/assignment7/CSES-Road_reparation.cpp | #include<bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr);
#define int long long
int get_parent(int a,vector<int>& parent)
{
if(parent[a]==a) return a;
return parent[a]=get_parent(parent[a],parent);
}
void check(int a,int b,vector<int>& paren... | ALGO | 0.999827 | 4.647913 |
37e56df6-61bc-4a6b-9b36-426a3328e86d | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-coop-gpt35/Codenet/p02373/163757526/response_3.cpp | #include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
typedef pair<int, int> ii;
typedef vector<int> vi;
const int MAXN = 100005;
const int LOGN = 20;
int idx_in_path[MAXN];
vector<ii> path;
vector<vi> adjList;
int path_size = 0;
void dfs(int u, int depth = 0) {
idx_in_path[u] = path_size;... | ALGO | 0.999873 | 4.685081 |
7dd1611c-cf98-49d6-af6e-dba12e19069e | Moeen35245/dsa | Arrays/kadane's.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
int maxSubArray(vector<int> &nums)
{
int sum = 0, maximum = nums[0];
for (int i = 0; i < nums.size(); i++)
{
sum = sum + nums[i];
maximum = max(maximum, sum);
if (sum < 0)
... | ALGO | 0.999534 | 5.652419 |
f64375a7-2191-4a10-a6d6-b03784645a04 | rain1024/datastructures-algorithms-competitive-programming | problems/codeforces2A/cpp/main/solution.cpp | #include <algorithm>
#include <cmath>
#include <iostream>
#include <map>
#include <string>
#include <unordered_map>
#include <vector>
#include <set>
// #include <fstream>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
// bool is_use_file = false;
// filesystem::path filepath =
... | ALGO | 0.999852 | 5.012781 |
34cef00a-a4c5-4604-8db1-58971770447d | YagoOlive/Fundamentos | matriz/matriz_5.cpp | #include<stdio.h>
main()
{
int i=0, j=0, coluna0=0, coluna1=0, coluna2=0, coluna3=0;
int mtz[4][4], linha0=0, linha1=0, linha2=0, linha3=0;
for(i=0;i<4;i++)
{
for(j=0;j<4;j++)
{
printf("\ninforme um valor para matriz[%d][%d]:", i, j);
scanf("%d", &mtz[i][j]);
}
}
printf("\n\n MATRIZ... | ALGO | 0.999753 | 3.06848 |
68ab8f54-ce8a-4954-9b27-69c35e58f28d | K14KHaNaSa/bojPractice | 10886.cpp | #include <iostream>
using namespace std;
int main(void) {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int n, vote;
cin >> n;
int sum = 0;
for (int i = 0; i < n; i++) {
cin >> vote;
sum += vote;
}
if ((n / 2) < sum) {
cout << "Junhee is cute!";
}
else {
cout << "Junhee is not cute!";
... | ALGO | 0.9997 | 3.94137 |
016e297c-8dd5-4035-823a-0179ece128ba | Ph0ngBui/baitap | bai5/bai5.cpp | #include <iostream>
#include <cmath>
using namespace std;
int kiemtrasonguyento() {
int n;
if (n >= 1) {
return false;
}
for (int i = 1; i * i <= n; i++) {
if (n % i == 0) {
return false;
}
}
return true;
}
int main() {
int n;
cin >> n;
if (kiemtrasonguyento(n)) {
cout << 'YES' << endl;
}
else
{
... | ALGO | 0.999978 | 4.420381 |
dbd53d43-0f90-4309-97d4-67de87e4227d | kritika2611/Algorithms-and-Datastructures | _Arrays/temple_offering.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int t;
while(t--){
int n;
cin>>n;
int arr[100000]={0};
int ans=0;
for(int i=0;i<n;i++){
cin>>arr[i];
}
for(int i=0;i<n;i++){
int left=0,right=0;
int j=i, k=i;
while(j>0){
if(arr[j-1]<=arr[j]){
left+=1;
j--;
}
... | ALGO | 0.999853 | 4.444923 |
11451ffe-da6f-4448-819c-ba612eb695f1 | sambler/myblender | extern/bullet2/src/BulletCollision/CollisionShapes/btConvexInternalShape.cpp | #include "btConvexInternalShape.h"
btConvexInternalShape::btConvexInternalShape()
: m_localScaling(btScalar(1.),btScalar(1.),btScalar(1.)),
m_collisionMargin(CONVEX_DISTANCE_MARGIN)
{
}
void btConvexInternalShape::setLocalScaling(const btVector3& scaling)
{
m_localScaling = scaling.absolute();
}
void btConvexIntern... | ALGO | 0.885633 | 6.834397 |
0a25f834-b75b-4289-a26e-f389ea6384da | rajneeshkumar146/Questions | Question_LeetcodeAndGeeks/Recursion/medium/Q004_Leetcode77_combinations/Q004Leetcode77.cpp | // #include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <string>
#define vi vector<int>
#define vii vector<vi>
using namespace std;
auto speedUp = []() {
std::ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
return nullptr;
}();
vector<vector<int>> res;
vector<int... | ALGO | 0.99997 | 4.531177 |
60b6b788-ef76-42e8-af86-bcb737c07e44 | BUAADreamer/BUAA-CO-2020 | P2/迷宫.cpp | #include<cstdio>
#include<iostream>
using namespace std;
int a[8][8];
int cnt=0;
int n,m;
int to[4][2]={
{0,1},
{1,0},
{0,-1},
{-1,0}
};
void way(int sti,int stj,int edi,int edj){
if(sti==edi&&stj==edj){
cnt++;
return;
}
else {
a[sti][stj]=1;
for(int i=0;i<4;i++){
int nexti=sti+to[i][0];
int nextj=... | ALGO | 0.999765 | 4.07453 |
90c21994-6f01-4b84-9fdb-c9f3a3a22552 | pratt3000/PICT-SE-Labs | DSA/a_7_stack.cpp | #include <bits/stdc++.h>
using namespace std;
class stak{
public:
static int top;
char stk[1000000];
stak()
bool isempty();
char pop();
void push(char a);
bool isfull();
};
char stak :: pop(){
char s = stk[top];
top = top - 1;
return s;
}
void stak :: push(char a){
stk[top] = a;
top = top + 1;
}
bool stak... | ALGO | 0.998978 | 4.297297 |
c3464a5f-32b4-4308-a8d5-4bbecbb9f675 | SuvratZZZ/solved | solved/pr4c.cpp | #include <bits/stdc++.h>
using namespace std;
# define ll long long
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
# define pb push_back
# define fl(i,n) for(ll... | ALGO | 0.999767 | 4.788982 |
6fc3100a-f33a-4972-88a8-636e12958e8a | prakharmishra2002/Leet-Code-POTD-Solutions | April 2025/12.cpp | class Solution {
public:
long long countGoodIntegers(int n, int k) {
unordered_set<string> dict;
int base = pow(10, (n - 1) / 2);
int skip = n & 1;
/* Enumerate the number of palindrome numbers of n digits */
for (int i = base; i < base * 10; i++) {
string s = to_... | ALGO | 0.999734 | 5.864869 |
99d926a2-f3d7-4ddb-b883-fe0d9c114f0d | rajatbansal01/100daysofDSA | C++/dijkstra.cpp | #include <iostream>
using namespace std;
#include <limits.h>
#define V 9
int minDistance(int dist[], bool sptSet[])
{
int min = INT_MAX, min_index;
for (int v = 0; v < V; v++)
if (sptSet[v] == false && dist[v] <= min)
min = dist[v], min_index = v;
return min_index;
}
void printS... | ALGO | 0.999959 | 3.619264 |
2be12048-b743-4151-a458-ac7c458768d1 | sreeram2001/100-Days-DSA | Day72/LCA_bst.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
TreeNode* recursiveCheck(TreeNode* root, TreeNode* p, TreeNode* q)
{
//when root ... | ALGO | 0.999991 | 6.064421 |
b5c47a20-c1fd-4ff4-865b-e44bb945413b | sakured/TP_Cpp | TP4/src/td04_ex03.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
bool is_palindrome(std::string const& str) {
return std::equal(str.begin(), str.end(), str.rbegin());
}
int main()
{
std::string str {};
std::cout << "Entrez un mot :" << std::endl;
std::cin >> str;
if ... | ALGO | 0.875226 | 4.665843 |
5e8f9c83-dd2c-4f86-b358-99993bb53d66 | DeltaZXAdvent/leetcode-like | leetcode/product-of-array-except-self.cpp | /**
* https://leetcode.cn/problems/product-of-array-except-self/?envType=study-plan-v2&envId=top-100-liked
*/
#include <bits/stdc++.h>
#include "print.h"
static_assert(sizeof(int) * CHAR_BIT >= 32);
using namespace std;
#define DUMP(x) (string(#x) + ": " + to_string(x))
class Solution {
public:
vector<int> product... | ALGO | 0.999947 | 5.590881 |
eae4c9fd-0ece-480e-9635-baeefe25b29b | Pricter/ProblemCave | Problem1.cpp | #include <iostream>
int main() {
int limit = 1001;
int ans = 0;
for (int i = 0; i < limit; ++i) {
if (((i % 3) == 0) && ((i % 5) == 0)) {
ans += i;
continue;
}
else if ((i % 3) == 0) {
ans += i;
continue;
}
else if ((i % 5) == 0) {
ans += i;
continue;
}
}
printf("Ans: %d", ans);
} | ALGO | 0.999884 | 4.146163 |
9adc2ac8-54b1-463d-a781-79d48fa5d389 | ashutosh-singh83/DSA | Some other questions/prime.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int i;
for(i=2;i<n;i++){
if(n%i==0){
cout<<"Non Prime"<<endl;
break;
}
}
if(i==n){
cout<<"Prime\n";
}
return 0;
} | ALGO | 0.999849 | 3.865221 |
08b90ca7-a6b7-4de0-a101-1f2e77f829c2 | ishandutta2007/codeforces | huah/normal/1557/A.cpp | #include<bits/stdc++.h>
typedef long long ll;
#define rep(i,l,r) for(int i=l;i<=r;i++)
#define nep(i,r,l) for(int i=r;i>=l;i--)
void sc(int &x){scanf("%d",&x);}
void sc(int &x,int &y){scanf("%d%d",&x,&y);}
void sc(int &x,int &y,int &z){scanf("%d%d%d",&x,&y,&z);}
void sc(ll &x){scanf("%lld",&x);}
void sc(ll &x,ll &y){sc... | ALGO | 0.999011 | 3.696407 |
a6a93c52-2833-4e7c-98a2-8f2e1c678ee0 | SonamShrivastava2002/Cplusplus_Questions | Others/implementPhoneDirectory.cpp | #include <bits/stdc++.h>
using namespace std;
//TC - O(n*(m^2)),SC-O(n*m)
class trieNode{
public:
char data;
trieNode* children[26];
bool isTerminal;
trieNode(char ch){
data = ch;
for(int i=0;i<26;i++){
children[i] = NULL;
}
isTerminal = false;
}
};
cl... | ALGO | 0.999704 | 5.419588 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.