uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
0138d3d7-decc-4822-a766-24fcd8b94f00 | aman086/tree | PreorderTraversal.cpp | /*
Inorder - left/root/right
Preorder - root/left/right
Postorder - left/right/root
*/
#include<bits/stdc++.h>
using namespace std;
struct Node{
struct Node* left;
struct Node* right;
int data;
Node(int vl){
data = vl;
left = NULL;
right = NULL;
}
};
void PreOrder(struct Node* &root){
... | ALGO | 0.999995 | 4.91154 |
359755fb-e494-4170-b7e4-bde36f1c5b16 | goog00/llvm-m88k-cc | libcxx/test/std/algorithms/alg.nonmodifying/alg.find/pstl.find_if.pass.cpp | // UNSUPPORTED: c++03, c++11, c++14
// UNSUPPORTED: libcpp-has-no-incomplete-pstl
// <algorithm>
// template<class ExecutionPolicy, class ForwardIterator, class Predicate>
// ForwardIterator find_if(ExecutionPolicy&& exec, ForwardIterator first, ForwardIterator last,
// Predicate pred);
... | TEST | 0.96105 | 7.234493 |
1b38e84d-0abc-4d81-8635-48186a3e3f62 | RahulAdhi27/DSALab2025 | LAB4/linkedlist (2).cpp | //Menu-driven program for Linked List
#include <iostream>
#include <cstdlib>
using namespace std;
class list {
private:
struct node {
int data;
node *next;
};
node *head;
void displayReverseHelper(node *current) {
if (current == nullptr) return;
displayReverseHelper(cu... | ALGO | 0.999803 | 4.456632 |
12446d63-e151-41d7-89f7-4f1bffc28520 | kaidul/LeetCode_problems_solution | source-code/Wiggle_Sort_II.cpp | class Solution {
public:
void wiggleSort(vector<int>& nums) {
int n = (int)nums.size();
if(n <= 1) return;
vector<int> bucket[n];
int Min = INT_MAX, Max = INT_MIN;
for(int i = 0; i < n; ++i) {
Max = max(Max, nums[i]);
Min = min(Min, nums[i]);
... | ALGO | 0.999994 | 5.355019 |
9e7e7ac1-1eef-42ed-ad3b-4eacb4cbc2ae | s4742332/Monke | MicromouseSim/DFS/Main.cpp | #include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <cmath>
using namespace std;
#include "API.h"
#define MAZE_SIZE 16
class Cell {
public:
int x, y;
bool visited;
bool wallUp, wallRight, wallDown, wallLeft; // Use booleans for walls
// Default constructor
Cell() : x(0... | ALGO | 0.999993 | 6.650909 |
93c23cd0-36a8-4726-91ad-d52295e2163f | ahmadshirwany/programming2 | examples/04/primes/main.cpp | /*
#############################################################################
# COMP.CS.110 Programming 2: Structures #
# Example: Number series #
# File: main.cpp #
# Des... | ALGO | 0.99932 | 5.452348 |
167ab5c6-9a29-4e7a-b796-789f943c044f | SanzidaH/Extended-ComVes | NFD/tests/other/fw/congestion-mark-strategy.cpp | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
#include "congestion-mark-strategy.hpp"
namespace nfd {
namespace fw {
NFD_REGISTER_STRATEGY(CongestionMarkStrategy);
CongestionMarkStrategy::CongestionMarkStrategy(Forwarder& forwarder, const Name& name)
// Specifying BestRouteStrategy's own name ... | TOOL | 0.914655 | 6.947679 |
32a4a16a-a994-4542-acf6-1f2c06f62286 | pawan12kamboj/Data_Structure_lab_exps | infixexp.cpp | #include <iostream>
#define Size 100
int top = -1;
char arr[Size];
using namespace std;
void push(char item)
{
if(top >= Size-1)
{
cout<<"Overflow\n";
}
else
{
top++;
arr[top] = item;
}
}
char pop()
{
char temp1 = arr[top];
top--;
return(temp1);
}
int isop... | ALGO | 0.999963 | 4.290666 |
d979f7a8-7637-48cd-8cb4-ec8d0dd65d18 | rajanraj2/100_Days_of_Code | Day43_Max_Subarray_LC.cpp | // Link to problem :
// https://leetcode.com/problems/maximum-subarray/description/
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int maxSubArray(vector<int>& nums) {
int n = nums.size();
int maxSum = nums[0];
int currentSum = nums[0];
for (int i = 1; i < ... | ALGO | 0.999772 | 5.967732 |
413eca45-72b3-4e4f-8486-d3c270a4467e | heweimin77/shoran_cpp | session4000/problem3300/p3216.getSmallestString.cpp | #include <gtest/gtest.h>
using namespace std;
namespace {
static auto autorun = []() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
return 0;
} ();
class Solution {
public:
string getSmallestString(string s) {
for (int i = 0; i < s.size()-1; ++i) {
int diff... | ALGO | 0.999889 | 6.32863 |
373e9af3-1e84-44c3-9a8b-3f57d0dae7ed | adlin0058/Code-Cpp | LeetCode/258.各位相加.cpp | /*
* @lc app=leetcode.cn id=258 lang=cpp
*
* [258] 各位相加
*/
// @lc code=start
class Solution
{
public:
int addDigits(int num)
{
if (num > 9)
{
num = num % 9;
if (num == 0)
return 9;
}
return num;
}
};
// @lc code=end
| ALGO | 0.999928 | 6.544671 |
b7f04d2a-c83b-40c7-9071-e8a4e11e58fe | kerozou/kyopuro | 競プロ用ライブラリ各種/int128.cpp | // C++ で __int128 を使うために必要なもの。
// __int128 は operater << を使うために以下の記述がいる。
// cin は 適当にLLとかに突っ込んでから変換するか、stringでとってきて parse をかます。
#include <bits/stdc++.h>
using namespace std;
std::ostream &operator<<(std::ostream &dest, __int128_t value) {
std::ostream::sentry s(dest);
if (s) {
__uint128_t tmp = value < 0 ? -v... | ALGO | 0.998384 | 4.810923 |
613b9d62-900f-437e-8145-22f4d4a38e7a | purple-mountain/cses-problem-set | missing-number/missing-number.cpp | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
long totalSum = (long)n * (n + 1) / 2;
long givenSum = 0;
for (int i = 0; i < n - 1; ++i) {
int input;
cin >> input;
givenSum += input;
}
int ans = totalSum - givenSum;
cout << ans << "\n";... | ALGO | 0.999906 | 4.038466 |
2c7b61e1-37b6-4328-a170-56117aa7af8d | Gulshid/C-language | OOP/CLASS AND OBJECT.cpp | #include<iostream>
using namespace std;
class hello
{
private:
int a,b;
public:
int fun()
{
cout<<"Enter the value for a and b:";
cin>>a>>b;
int z=a+b;
cout<<z;
return z;
}
};
main()
{
hello h;
cout<<"the addition of two value is:"<<h.fun();
}
| TOOL | 0.874037 | 4.06073 |
b148dcf6-2969-46a5-81cd-e7f0564cdd8f | aakashbh1/LeetCode-Solutions | LeetCode Daily Challenges/Map & Set/1337. The K Weakest Rows in a Matrix.cpp | class Solution {
public:
vector<int> kWeakestRows(vector<vector<int>> &mat, int k) {
set<pair<int, int>> s;
for (auto row = 0; row < mat.size(); row++) {
auto count = accumulate(mat[row].begin(), mat[row].end(), 0);
s.insert(make_pair(count, row));
}
vector<in... | ALGO | 0.999823 | 5.907582 |
92644213-ca5e-49a1-a5e3-d90587108f90 | lcnzg/lammps-pi | lib/kokkos/example/tutorial/Advanced_Views/02_memory_traits/memory_traits.cpp | #include <Kokkos_Core.hpp>
#include <impl/Kokkos_Timer.hpp>
#include <cstdio>
#include <cstdlib>
using view_type = Kokkos::View<double*>;
// Kokkos::Views have an MemoryTraits template parameter which
// allows users to specify usage scenarios of a View.
// Some of those act simply as hints, which can be used to inser... | ALGO | 0.91309 | 6.263986 |
754e877e-8537-4508-83d9-689b923b4686 | ilksh/Sudoku-Solver-with-Machine-Intelligence | ImageReaderSrc/tesseract-5.3.0.20221222/src/training/common/commontraining.cpp | #define _USE_MATH_DEFINES // for M_PI
#include "commontraining.h"
#ifdef DISABLED_LEGACY_ENGINE
# include "params.h"
# include "tprintf.h"
namespace tesseract {
INT_PARAM_FLAG(debug_level, 0, "Level of Trainer debugging");
INT_PARAM_FLAG(load_images, 0, "Load images with tr files");
STRING_PARAM_FLAG(configfile,... | DATA | 0.872834 | 6.620072 |
c1c5da85-f945-4d60-a224-eac7740cb05a | Revamth/CSES_Solutions | Ferris_Wheel.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define all(v) v.begin(), v.end()
#define fi first
#define se second
#define fastio() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
const int MOD = 1e9 + 7;
const int INF = 1e9;
const ll LINF = 1e18;
ll mod_exp(... | ALGO | 0.999943 | 5.470369 |
dd1bbe89-0157-4464-8da7-f5b5811a4b47 | krydyh/Algorithm | Programmers/Lv.1/[17681][1차]_비밀지도.cpp | #include <string>
#include <vector>
using namespace std;
vector<string> solution(int n, vector<int> arr1, vector<int> arr2) {
vector<string> answer(n);
for(int i = 0; i < n; ++i) {
for(int j = n - 1; j >= 0; --j) {
if((arr1[i] & (1 << j)) || (arr2[i] & (1 << j)))
answe... | ALGO | 0.999761 | 4.797627 |
ac8d2d68-5eb5-4209-9748-aff056261332 | Aasthapaudel/Computer-Network-assignment | Leetcode/city with smalllest number of neighbor/solution-using-bellman-ford.cpp | #include <iostream>
#include <vector>
#include <limits.h>
using namespace std;
class Solution {
public:
vector<int> bellmanFord(int n, int start, vector<vector<int>>& edges, int distanceThreshold) {
vector<int> distances(n, INT_MAX);
distances[start] = 0;
// Relax all edges n-1 times
... | ALGO | 0.999998 | 6.702433 |
fdf52d80-fb23-4788-9a92-1eace5d78325 | nazfisa/Problem-Solving | os final/pureoptimal.cpp | #include <iostream>
using namespace std;
int min(int counter[],int nFrames)
{
int minimum = counter[0];
int pos;
for(int i=0;i<nFrames;i++) { if(minimum > counter[i])
pos = i;
}
return pos;
}
int main()
{
int pageString[50],n,frames[10],counter[10],recent = 0;
int pageFault = 0,nFram... | ALGO | 0.999201 | 4.161192 |
f76cc432-31a6-4f48-9fa2-c2284a95e95c | ryosuzuki/computer-graphics-playground | ffi/include/igl/adjacency_list.cpp | #include "verbose.h"
#include <algorithm>
template <typename Index, typename IndexVector>
IGL_INLINE void igl::adjacency_list(
const Eigen::PlainObjectBase<Index> & F,
std::vector<std::vector<IndexVector> >& A,
bool sorted)
{
A.clear();
A.resize(F.maxCoeff()+1);
// Loop over faces
for(int i = ... | ALGO | 0.963342 | 5.305983 |
34bd77a8-3992-4a79-8d5e-e5a7079b79b9 | versenyi98/programming-contests | UVa Online Judge/00957 - Popes/main.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
std::ios_base::sync_with_stdio(false);
int N, M;
while (scanf("%d %d", &M, &N) == 2) {
int popes[N];
for (int i = 0; i < N; i++) {
scanf("%d", &popes[i]);
}
int L = 0, R = 0, MAX = 0;
... | ALGO | 0.999892 | 3.51711 |
a4875bff-b5bd-4142-a9ef-45f0a122cf6e | Cuonglearning/Chuong-1 | 1.5.cpp | #include <stdio.h>
#include <conio.h>
struct DonThuc{
float a,n;
};
typedef struct DonThuc DT;
void Nhap(DT &t){
printf("Nhap a: \n");
scanf("%f", &t.a);
printf("Nhap n la: \n");
scanf("%f", &t.n);
}
void Xuat(DT t){
printf("P(x)=%.2fx^%.2f", t.a, t.n);
}
int main(){
DT dt;
// printf("Cho don thuc P(x)= ax^n");
... | ALGO | 0.898261 | 3.190055 |
cbbaffdf-89bb-43de-b1ae-aeaae96eb35a | thebird-/ts-stream-server-client | boost_1_61_0/libs/geometry/doc/src/examples/algorithms/relate.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
//[relate
//` Shows how to detect if a point is inside a polygon, or not
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hp... | ALGO | 0.997968 | 6.500084 |
a5ac4a67-0ecf-4a5d-b7d7-2a992a519367 | shreejitverma/SDE-Interview-Prep | LeetCode/C++/convert-sorted-array-to-binary-search-tree.cpp | // Time: O(n)
// Space: O(logn)
/**
* 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* sortedArrayToBST(vector<int>& nums) {
retur... | ALGO | 0.999996 | 7.178501 |
52362050-091f-4c67-8e6b-cd6a8bf13a72 | raincross7/code-similarity | codes/train_code/problem360/problem360_304.cpp | #include "bits/stdc++.h"
using namespace std;
using ll = long long;
#define rep(i, begin, n) for (int i = begin; i < n; i++)
#define repe(i, begin, n) for (int i = begin; i <= n; i++)
#define repr(i, begin, n) for (int i = begin; i > begin - n; i--)
#define repre(i, begin, end) for (int i = begin; i >= end; i--)
templ... | ALGO | 0.99969 | 4.123105 |
659c62f2-8bff-42ad-824f-2da5b02b989e | vridhipuri/LeetCode-Solutions | 0258-add-digits/0258-add-digits.cpp | class Solution {
public:
int addDigits(int num) {
int sum=0;
int x=num;
while(x!=0)
{
int dig=x%10;
sum+=dig;
x=x/10;
}
if(sum<10)
{
return sum;
}
else{
return addDigits(sum);
... | ALGO | 0.999937 | 6.288858 |
bcd0fd6a-0626-4da8-acd1-48643d9118f5 | master-hkshenoycse/CP | OAProblems/Amazon/LC_2281.cpp | #include<bits/stdc++.h>
#define ll long
using namespace std;
#define ll long long
class Solution {
public:
ll mod=1e9+7;
void clear_stack(stack<ll> &st){
while(st.size()>0){
st.pop();
}
}
int totalStrength(vector<int>& strength) {
ll n=strength.size();
vect... | ALGO | 0.999993 | 4.135655 |
eeeb8d3d-4710-4d9e-96b1-f2cc20a60aff | clothbot/Alliance-VLSI-CAD-System | alliance-5.0/ocp/src/placer/PPlacementFinal.cpp | using namespace __gnu_cxx; // GCC 3.1 and later
#endif
#endif
#endif
#include <math.h>
#include <unistd.h>
#include <algorithm>
using namespace std;
#include "mut.h"
#include "mph.h"
#include "mpu.h"
#include "mlo.h"
#include "mlu.h"
#include "PMove.h"
#include "PConstants.h"
#include "PDetPlacement.h"
#include "PP... | ALGO | 0.976513 | 3.9666 |
85d15ee4-dfc0-4e98-87a0-57492dc605e1 | endernewton/subdiscover | maxflow/maxflow-v3.0/maxflow.cpp | /* maxflow.cpp */
#include <stdio.h>
#include "graph.h"
/*
special constants for node->parent
*/
#define TERMINAL ( (arc *) 1 ) /* to terminal */
#define ORPHAN ( (arc *) 2 ) /* orphan */
#define INFINITE_D ((int)(((unsigned)-1)/2)) /* infinite distance to the terminal */
/************************************... | ALGO | 0.999403 | 5.287704 |
ff8a4c2f-dafd-4dc1-bcf3-5923b3ebc866 | Fujitsu-UTokyo-QDD/QDD | src/algorithms/grover.cpp | #include "algorithms/grover.hpp"
#include "dd.h"
#include "table.hpp"
static unsigned long long CalculateIterations(const unsigned short n_qubits) {
constexpr long double PI_4 =
0.785398163397448309615660845819875721049292349843776455243L; // dd::PI_4
... | ALGO | 0.999685 | 4.357687 |
ced5991f-40dc-4228-aae2-b8bcbcb8d869 | yffi4/ADS-2024 | lab2/B.cpp | #include <iostream>
using namespace std;
struct Node
{
string value;
Node *next;
Node(string val) : value(val), next(nullptr){}
};
Node* createList(int n){
string word;
Node* head = nullptr;
Node* tail = nullptr;
for (int i = 0; i < n; i++)
{
cin >> word;
Node* newNode... | ALGO | 0.999944 | 4.013733 |
0b448732-33c0-46f0-903e-662ecc0b791e | lechenyu/TSan-spd3 | 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"
#includ... | ALGO | 0.927448 | 7.196774 |
50c925f8-bb8c-4adb-9626-17b7c87f3640 | upesacm/21DaysOfCode-2023 | C&C++/Rohit Chauhan/roots.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main() {
float a, b, c, r1, r2, d, real, img;
cout << "Enter coefficients a, b and c: ";
cin >> a >> b >> c;
d = b*b - 4*a*c;
if (d > 0) {
r1 = (-b + sqrt(d)) / (2*a);
r2 = (-b - sqrt(d)) / (2*a);
cout << "R... | ALGO | 0.997768 | 4.144598 |
1c0372c5-f889-48c1-a422-5e80926c5766 | lethyciamaia/coding-challenges | leetcode/hard/medianSortedArray.cpp | // 4. Median of Two Sorted Arrays
#include <bits/stdc++.h>
using namespace std;
// O(m+n log m+n)
class Solution1 {
public:
double findMedianSortedArrays(vector<int>& nums1, vector<int>& nums2) {
nums1.insert( nums1.end(), nums2.begin(), nums2.end() ); //O(m+n)
sort(nums1.begin(), nums1.end()); //... | ALGO | 0.999994 | 6.30017 |
7b3f2fac-91b3-4e59-9271-e86578c6cdfc | WuDiDaBinGe/yxbLeetCode-C- | offer/其他/57-2和为s的连续正数序列.cpp | #include<bits/stdc++.h>
using namespace std;
vector<vector<int>> findContinuousSequence(int target) {
vector<vector<int>> result;
// 枚举首项
for(int a = 1; a < target; ++a) {
// 枚举个数
int n = a, sum = a;
vector<int> res;
while(sum <= target) {
res.push_back(n);
... | ALGO | 0.999943 | 4.675103 |
3cbbfdb0-8b4f-4082-a856-32ba2d6d86ec | mayank7jha1/Launcpad_Oct | Lecture 10/Functions3.cpp | #include<iostream>
using namespace std;
// void swap(int x, int y) {
// int temp = y;
// y = x;
// x = temp;
// cout << endl;
// cout << "Value of x Inside Function is " << x << endl;
// cout << "Value of y Inside Function is " << y << endl;
// return;
// }
void swap(int a, int b) {
int temp = b;
b = a;
a ... | ALGO | 0.999575 | 4.979603 |
c2c0e0af-2331-4fa6-a17f-67532fad32a5 | severinocarlos/algorithms | graph/bicolorable.cpp | vector<int> adj(ms);
vector<int> colour(ms, -1);
void dfs(int u) {
for (int v : adj[u]) {
if (colour[v] == -1) {
colour[v] = 1 - colour[u];
dfs(v);
}
}
}
// call paintAll in main
void paintAll(int n){
for (int u = 0; u < n; ++u) {
if (colour[u] == -1) {
... | ALGO | 0.99914 | 5.204566 |
5c02b9df-9e7a-4ad4-886a-ef0bb5bdb163 | LJP-TW/VectorMatrixCalculator | Project1/Project1/Vector.cpp | #include "Vector.h"
#define _USE_MATH_DEFINES
#include <math.h>
#define PI 3.14159265
constexpr auto THRESHOLD = 10E-12;
Vector::Vector()
{
}
Vector::Vector(double d)
{
this->Data.push_back(d);
}
//////SBz0
Vector Vector::operator+(const Vector & v)
{
// P_O_iHۥ[ --> ץۦP
if (this->Data.size() != v.Data.size())
... | ALGO | 0.982276 | 4.777256 |
0b085787-6930-4ed4-b4ba-f2b44dfcde09 | Hybrid-Rom/system_core | libpixelflinger/codeflinger/Arm64Disassembler.cpp | #include <stdio.h>
#include <inttypes.h>
#include <string.h>
struct disasm_table_entry_t
{
uint32_t mask;
uint32_t value;
const char* instr_template;
};
static disasm_table_entry_t disasm_table[] =
{
{0xff000000, 0x91000000, "add <xd|sp>, <xn|sp>, #<imm1>, <shift1>"},
{0xff000000, 0... | TOOL | 0.872755 | 3.76088 |
53de8605-1927-45c8-aecd-120bfd627754 | arthuryangcs/ACM | Code/AC_HDOJ_arthuryang/50721.cpp | ////////////////////System Comment////////////////////
////Welcome to Hangzhou Dianzi University Online Judge
////http://acm.hdu.edu.cn
//////////////////////////////////////////////////////
////Username: arthuryang
////Nickname: ArthurYang
////Run ID:
////Submit time: 2014-10-25 18:58:45
////Compiler: GUN C++
///////... | ALGO | 0.999706 | 3.863566 |
31a2219b-3346-46c5-b042-9402ff3da2b8 | parbati09/Cpp | Integer_Palindrome.cpp | /*
Problem - Given an integer x, return true if x is palindrome integer.
An integer is a palindrome when it reads the same backward as forward.
For example, 121 is a palindrome while 123 is not.
Example 1:
Input: x = 121
Output: true
Explanation: 121 reads as 121 from left to right and from right to left.
Example 2... | ALGO | 0.999956 | 5.943233 |
1b79cfac-4090-466c-a02a-481bde0a728a | wliday/clrs-c-implementation | HashTables/separate_chaining.cpp | /*最好先手动画下图,或者看上边那张图,这样好理解,否则不太好理解二重指针
输出:
————————————————
表的大小是;23
89插入表中
18插入表中
49插入表中
58插入表中
69插入表中
小伙子,69查找成功了
25不存在表中
69删除成功
25不存在, 无法删除
*/
#include<iostream>
#include<cstdio>
#include<cstdlib>
using namespace std;
struct HashTbl;
struct ListNode;
typedef struct HashTbl * HashTable;//不用这几个typedef程序很难看懂
t... | ALGO | 0.999722 | 4.081181 |
cd623cf1-65b7-448e-be96-d8704fe6cb44 | Xu-Jack11/ACM-Learning | Disjoint Set Union(DSU)/827A.cpp | #include <bits/stdc++.h>
using namespace std;
string ans((int)2e6 + 3, 'a');
int fa[(int)2e6 + 3];
int find(int x)
{
return x == fa[x] ? x : fa[x] = find(fa[x]);
}
void solve()
{
iota(begin(fa), end(fa), 0);
int mx = 0;
int n;
cin >> n;
while (n--)
{
int t;
string s;
... | ALGO | 0.999915 | 4.175753 |
cde7fb2a-03c0-469a-ba55-d97bc4bbf71d | LasiduDilshan/Cpp-MCQ-Finance-Solutions | Resources/7_Interview Codes/SecondMax.cpp | #include <iostream>
int findSecondMax(int arr[], int size) {
if (size < 2) return -1; // Not enough elements
int max = arr[0];
int secondMax = -1;
for (int i = 1; i < size; ++i) {
if (arr[i] > max) {
secondMax = max;
max = arr[i];
} else if (arr[i] > secondMax ... | ALGO | 0.999966 | 6.1333 |
e08ae78c-5342-44ea-b3a2-f6a45533f60a | Mulab11/cntt2016-hw1 | TC-SRM-558-div1-1000/grq.cpp | #include<bits/stdc++.h>
#define sqr(x) (x)*(x)
#define ll long long
#define ull unsigned long long
#define ui unsigned int
#define vi vector<int>
#define pb push_back
#define ld long double
#define mp make_pair
#define pii pair<int,int>
#define debuge puts("isok")
#define debug(x) cout<<#x<<"="<<x<<endl
#define SS seco... | ALGO | 0.999699 | 4.12007 |
f5616e95-006f-483d-9ab2-ec76ff79ab72 | wannabetolkien/CP-Codes | Make_K_Most_Frequent.cpp | /* Nabeel Akhter - Bismillah */
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define lint long long int
#define mod 1000000007
void solve() {
lint n, k;
cin >> n >> k;
vector<lint> a(n);
for (lint i = 0; i < n; i++) {
cin >> a[i];
}
lint min_ops = 2;
map<... | ALGO | 0.999945 | 5.289119 |
f8e365df-4576-4a8a-bee7-6a54b3470418 | fsjhhh/acm_title | cpp/模板/最长公共子序列_DP.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#define IOS ios::sync_with_stdio(false); \
cin.tie(0); \
... | ALGO | 0.999631 | 3.627963 |
4f84d2cc-15b6-406b-9c6c-6a7e9aa36fd5 | PriyanshiG7/CPP-DSA_FULL | patterns/31a.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int row=1;
while(row<=n){
int col=1;
while(col<=row){
char ch =('A' + col -1);
cout<<ch;
col=col+1;
}
cout<<endl;
row=row+1;
}}
| ALGO | 0.999862 | 3.759528 |
dd861005-716e-43f3-9e2e-d9f49e2bf431 | jaygala223/DSA-practice | check-if-number-is-a-sum-of-powers-of-three/check-if-number-is-a-sum-of-powers-of-three.cpp | class Solution {
public:
bool checkPowersOfThree(int n) {
if(n==1)
return true;
if(n%3==2)
return false;
return checkPowersOfThree(n/3);
}
}; | ALGO | 0.999754 | 5.571789 |
c4d5fc06-bb99-4b94-b242-6938182880ba | ipogudin/gauge | thrower/deps/src/poco/Foundation/src/MD5Engine.cpp | #include "Poco/MD5Engine.h"
#include <cstring>
namespace Poco {
MD5Engine::MD5Engine()
{
_digest.reserve(16);
reset();
}
MD5Engine::~MD5Engine()
{
reset();
}
void MD5Engine::updateImpl(const void* input_, unsigned inputLen)
{
const unsigned char* input = (const unsigned char*) input_;
unsigned int i, index, pa... | ALGO | 0.939233 | 7.154037 |
8c9ea14a-f083-4238-bd4c-f59e7aa1caa3 | shuimuyangsha/CppAdvancedProgram | c20_code/03_Random/07_normal_distribution.cpp | #include <random>
#include <functional>
#include <map>
#include <fstream>
#include <ctime>
using namespace std;
int main()
{
const unsigned int kStart = 1;
const unsigned int kEnd = 99;
const unsigned int kIterations = 1'000'000;
// Uniform Mersenne Twister
random_device seeder;
const auto seed = seeder.entrop... | ALGO | 0.995184 | 4.8603 |
34bc7194-fe28-43f0-aac1-65e6b2027936 | Cloverlove/Clover | shujvjiegou/erchashu.cpp | #include<iostream>
#include<malloc.h>
using namespace std;
typedef struct lBNode{
char data;
struct lBNode *lchild,*rchild;
}BiNode,*BiTree;
void createBiTree(BiTree &T)
{
T = (BiTree)malloc(sizeof(struct lBNode));
char x;
cin>>x;
if(x == '#')
T = NULL;
else
{
T = new BiNode;
T->data = x;
createBiTree... | ALGO | 0.99997 | 3.62084 |
e1f1ae01-5ae6-42bc-9795-9955e5352010 | javamaks/DOOM | neo/renderer/jpeg-6/jcsample.cpp | #define JPEG_INTERNALS
#include "jinclude.h"
#include "jpeglib.h"
/* Pointer to routine to downsample a single component */
typedef JMETHOD ( void, downsample1_ptr,
( j_compress_ptr cinfo, jpeg_component_info * compptr,
JSAMPARRAY input_data, JSAMPARRAY output_data ) );
/* Private ... | TOOL | 0.938283 | 5.753269 |
aea406a3-46d6-4797-8dce-fbc47aa38936 | ayushdaphal/CPP-DSA | lect_28/refVar.cpp | //reference variable--> Same memory location with two different names
#include<iostream>
using namespace std;
int main(){
int i=5;
//creating a ref variable
int& j=i;
cout<<"i "<<i<<endl;
cout<<"j "<<j<<endl;
i++;
cout<<"i "<<i<<endl;
cout<<"j "<<j<<endl;
j++;
cout<<"i "<<i<<e... | ALGO | 0.987401 | 3.150838 |
47371373-469a-4649-9745-68799d10c705 | syozo12/searching2 | 4.cpp | #include<iostream>
#include<vector>
using namespace std;
bool search(int a[],int n,int x){
int lo=0;
int hi=n-1;
while(lo<=hi){
int mid=(lo+hi)/2;
if(a[mid]==x){
return true;
}
else if(a[mid]==a[lo]&&a[mid]==a[hi]){//compress the array
lo++;
hi... | ALGO | 0.999954 | 4.349372 |
b80d5aed-686c-443a-8ddc-b11cbc1fc8e3 | egekabas/Competitive-Programming-Solutions | oj.uz/BOI18/election.cpp | #include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> pll;
typedef pair<ull, ull> pull;
typedef pair<int, int> pii... | ALGO | 0.999989 | 4.289 |
4c61b714-1bec-46dc-97b6-e0ed305b9d85 | GDV-Proyectos3/Motor-Ola | MotorOla_Solution/Dependencies/PhysX-4.1/Src/physx/source/common/src/CmRadixSort.cpp | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "foundation/PxMemory.h"
#include "foundation/PxAssert.h"
#include "CmRadixSort.h"
using namespace physx;
using... | ALGO | 0.999925 | 5.845264 |
6afe099e-9c3e-490d-8edd-e2a85d74d59c | lakshman2003/coding-questions | C_Gerrymandering.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;
typedef tree<int, null_type, less<int>, rb_tree_tag,
tree_order_statistics_node_update> indexed_set;
#define ll long long
#define ldd long double
#define en '\n'
#de... | ALGO | 0.999744 | 5.007614 |
da254418-669b-4e9a-8d20-5470e3af4f8c | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-gpt4/Codenet/p02269/479872221/response_6.cpp | #include <iostream>
#include <cstring>
#include <unordered_map>
using namespace std;
unordered_map<string, bool> H;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int NumOfCom;
cin >> NumOfCom;
string com, word;
while (NumOfCom--) {
cin >> com >> word;
if (com[... | ALGO | 0.999359 | 4.511604 |
0b0bd472-43b7-4197-a671-a0dfa6db5dc0 | fluttterdevelop/uzb_languages | 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 |
9848cd6c-31c7-4e47-9380-91331e451d6a | ishandutta2007/codeforces | far_from_noob/normal/1329/A.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define dd double
#define endl "\n"
#define pb push_back
#define all(v) v.begin(),v.end()
#define mp make_pair
#define fi first
#define se second
#define fo(i,n) for(int i=0;i<n;i++)
#define fo1(i,n) for(int i=1;i<=n;i++)
ll mod=1000000007;
ll n,k,t,m,q,... | ALGO | 0.999918 | 4.066658 |
6a69d3c7-0f9a-4f0a-aaac-ffeb5d6b8576 | ishandutta2007/codeforces | ashishgup/normal/492/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
const int N=1e5+5;
int n, r, avg, total=0, reqd, ans=0;
pair<int, int> a[N]; //b, a
int32_t main()
{
IOS;
cin>>n>>r>>avg;
reqd=avg*n;
for(int i=1;i<=n;i++)
{
ci... | ALGO | 0.999876 | 3.596736 |
ccc74ccb-dfdd-422a-a617-3b1c1ac5b0a3 | sinian666/code_41_27 | cpp_副本4/chapter_sorting/bubble_sort.cpp | /**
* File: bubble_sort.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 冒泡排序 */
void bubbleSort(vector<int> &nums) {
// 外循环:待排序元素数量为 n-1, n-2, ..., 1
for (int i = nums.size() - 1; i > 0; i--) {
// 内循环:冒泡操作
for (int j = 0; j < i; j++) {
... | ALGO | 0.999921 | 6.035518 |
342ca439-126a-4229-8a50-0fe8ea9a4a66 | qbit-t/qbit | boost/libs/fiber/src/numa/linux/topology.cpp | #include "boost/fiber/numa/topology.hpp"
#include <exception>
#include <map>
#include <regex>
#include <set>
#include <string>
#include <utility>
#include <boost/algorithm/string.hpp>
#include <boost/assert.hpp>
#include <boost/config.hpp>
#include <boost/filesystem.hpp>
#include <boost/filesystem/fstream.hpp>
#inclu... | TOOL | 0.933067 | 6.193396 |
a218fb4b-0b97-4581-8094-e6eaa72efd21 | benboyer/UDock2_win | UDock2_Win/bullet/BulletCollision/CollisionShapes/btMultiSphereShape.cpp | #if defined(_WIN32) || defined(__i386__)
#define BT_USE_SSE_IN_API
#endif
#include "btMultiSphereShape.h"
#include "BulletCollision/CollisionShapes/btCollisionMargin.h"
#include "LinearMath/btQuaternion.h"
#include "LinearMath/btSerializer.h"
btMultiSphereShape::btMultiSphereShape(const btVector3* positions, const bt... | TOOL | 0.869199 | 7.286427 |
004fab7d-ec75-4e67-a40a-0639aaeed148 | Subhash1998/c-experiments | 32.CPP | #include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
int A[10][10],B[10][10],i,j,n;
printf("Enter the no. of rows/columns for square matrix :- ");
scanf("%d",&n);
printf("\nEnter the first array :- \n");
for(i=0;i<n;++i)
{
for(j=0;j<n;++j)
scanf("%d",&A[i][j]);
}
printf("Enter the second array :-... | ALGO | 0.999106 | 3.014402 |
cd55c5ce-84f9-4324-ab9a-b58551d5fa1d | varung28/DS_Codes | S-T-L/SinglyCircular/SinglyCircularClass.cpp | /*
SinglyCircularClass.cpp
*/
#include<iostream>
using namespace std;
template <class T>
struct Node
{
T data;
char key;
struct Node *Next;
};
template <class T>
class tempSinglyC
{
private:
int iSize;
struct Node<T> *Head;
struct Node<T> *Tail;
public:
tempSinglyC();
~tempSinglyC();
bool showList... | ALGO | 0.982594 | 4.415122 |
0b676687-0bdd-4bb0-ab10-a1fb54381ba4 | Inventor77/Leetcode | Challenges/2022/01_Jan_2022/Jan_14_String_to_Integer_(atoi).cpp | class Solution {
public:
int myAtoi(string s) {
int len_ = s.size();
bool isNeg = false;
int i = 0;
while ((i < len_) && (s[i] == ' ')) {
i++;
}
if (i >= len_) {
return 0;
}
if (s[i] == '-') {
isNeg = true;
... | ALGO | 0.999396 | 5.30841 |
71d5e63b-06a8-453a-933b-cf35b5b6bee7 | kbpoz/Rysownik | sortowanie.cpp | /**
* \file sortowanie.cpp
* \brief Plik implementacji modułu sortowanie.
*/
#include <iostream>
#include "struktury.h"
using namespace std;
/** Sortowanie według X.
*
* Sortowanie bąbelkowe - sortujemy tablicę z punktami według współrzędnej X.
* \param Punkt tab[] tablica punktów
* \param int n ilość punktów
... | ALGO | 0.998218 | 4.542107 |
4f044482-f643-44de-81ab-80a68531203f | dogancemd/213-the-2-tester | in/in2.cpp | #include <iostream>
#include "../your_code/ScapegoatTree.cpp"
int main() {
ScapegoatTree<int> *a=new ScapegoatTree<int>;
std::cout << "Line no:" << 5 << " " << (a->insert(115)) << std::endl;
std::cout << "Line no:" << 6 << " " << (a->insert(172)) << std::endl;
a->printPretty();
std::cout << "Line no:" << 8 << " " << (a... | ALGO | 0.977257 | 3.404751 |
250105ef-726c-4cac-842e-8fb6adc0640c | maks-burlakof/university | oop/sem2/lab4.cpp | #include <iostream>
#include <thread>
#include <mutex>
#include <chrono>
using namespace std;
class Parking {
private:
int available_places, max_wait;
mutex parking_mutex;
public:
Parking(int num_places, int max_waiting_time) {
available_places = num_places;
max_wait = max_waiting_time;
... | ALGO | 0.893777 | 5.930226 |
a8b27c1b-204d-4f79-91e0-db085f994c8b | realAYAYA/UnrealEngine-ToonLit | UnrealEngine/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/ImplicitObjectBVH.cpp | namespace Chaos
{
namespace CVars
{
extern FRealSingle ChaosUnionBVHSplitBias;
extern bool bChaosImplicitBVHOptimizedCountLeafObjects;
}
namespace Private
{
static_assert(sizeof(FImplicitBVHObject) == 72, "FImplicitBVHObject was packed to avoid any padding in it");
FImplicitBVHObject::FImplicitBVHObject... | ALGO | 0.95571 | 7.679768 |
078008d3-bbd1-4e2f-9358-0653ee1aa73f | joshsmiththenoob/C-Course | Workspaces/CourseSection12/ReturnPointer/main.cpp | // Section 12
// Return Pointer
// Note: !! Don't return the pointer that point to the function local variable -> because local variable will be disappear after function call
#include <iostream>
#include <iostream>
#include <iostream>
#include <iostream>
#include <iostream>
#include <iostream>
#include <iostream>
#inc... | TOOL | 0.925824 | 4.421087 |
155b8dd9-f778-49bf-8e66-882cc2144737 | ishandutta2007/codeforces | batrr/normal/1338/B.cpp | #include <bits/stdc++.h>
#define f first
#define s second
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
const int N = (int)2e5 + 123, inf = 1e9, mod = 1e9 + 7;
const ll INF = 1e18;
vector< int > g[N];
in... | ALGO | 0.999787 | 4.066095 |
6116d61d-7bbf-4a01-9de8-a50f67aa4920 | AndLvovSky/algorithms-3-term | 40 задач/28/28.cpp | #include <iostream>
#include <thread>
#include <chrono>
#include <vector>
#include <ctime>
#include <ratio>
using namespace std;
using namespace std::chrono;
const int ARR_SIZE = 22500, PARTITIONS = 8,
PARTS[PARTITIONS] = {1, 2, 10, 50, 150, 225, 2250, 22500},
ARR_COUNT = 1;
int arr[ARR_SIZE], arrCopy[ARR_SIZE];
... | ALGO | 0.998732 | 4.813657 |
768c9420-2039-499a-889e-e080f5bbe42b | agieselm/Trinity-University-CS | Algorithms (C++)/pegBoard.cpp | #include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
bool canWin(const vector<vector<bool>> &board) {
for(int x = 0; x <= 30; x++) {
board.push_back(vector<bool>()); //add 30 empty rows
}
for(int y = 0; y <= 30; y++) {
for(int x = 0; x < board.size(); x++) {
board[x].pu... | ALGO | 0.995246 | 3.768385 |
dffcded9-9456-4ed9-a2e7-c040bfc32bff | GrearyGreen/dcl_slam_single | distributed_mapper/src/pairwise_consistency_maximization/graph_utils/graph_utils_functions.cpp | #include "graph_utils/graph_utils_functions.h"
#include <fstream>
#include <iostream>
#include <math.h>
#include <eigen3/Eigen/Geometry>
namespace graph_utils {
void poseCompose(const graph_utils::PoseWithCovariance &a,
const graph_utils::PoseWithCovariance &b,
graph_utils::PoseWith... | ALGO | 0.988427 | 5.416674 |
02336c36-9c9d-4db1-be29-e1de8e3b54a1 | oneul0/AlgorithmLearning | SWEA/D3/1244.cpp | #include<iostream>
#include <algorithm>
#include <string>
using namespace std;
int ans, change;
string s;
void solution(int idx, int cur){
if(cur == change){
ans = max(ans, stoi(s));
return;
}
for(int i = idx; i<s.size(); i++){
for(int j = i+1; j<s.size(); j++){
if(s[i] <=s[j]){
swap(s[i], s[j]);
... | ALGO | 0.999862 | 4.150288 |
a06aa645-911a-47cf-bf61-d930c638c231 | sergiu-avacaritei/cpp-rendering-engine | libs/glm-0.9.7.2/test/core/core_func_integer_bit_count.cpp | ///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net)
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentatio... | ALGO | 0.994661 | 4.925858 |
4f4d650f-ee37-412e-bd61-5bb1dfc0b0ab | Not-Helpful/ctfs | hxp2022/browser_insanity/kolibrios-7fc8595/contrib/sdk/sources/Mesa/mesa-9.2.5/src/glsl/lower_clip_distance.cpp | /**
* \file lower_clip_distance.cpp
*
* This pass accounts for the difference between the way
* gl_ClipDistance is declared in standard GLSL (as an array of
* floats), and the way it is frequently implemented in hardware (as
* a pair of vec4s, with four clip distances packed into each).
*
* The declaration of g... | TOOL | 0.91851 | 7.715098 |
75ce8844-fff5-49a4-b86b-c9724b669b7f | PolishBookworm/scholarly-enigma | olympiad/kucharz.cpp | #include <iostream>
int main() {
std::ios_base::sync_with_stdio(0);
std::cin.tie(0);
std::cout.tie(0);
int n;
std::cin >> n;
int result[n];
int cache[2] = {0};
for (int i = 0; i < n; i ++) {
std::cin >> cache[1];
result[i] = cache[1] - cache[0];
cache[0] = cache[1];
}
for (auto i : result) std::cout <... | ALGO | 0.999919 | 3.624578 |
2050e4b5-461c-44e7-a110-dd6b5af46b2d | MohamedElbashar/ProblemSolving-Archive | Training/PST/Graph/Is It a Snake .cpp | #include <bits/stdc++.h>
using namespace std;
int t, n, cnttt, cnt3, xx, yy;
char arr[501][501];
int di[] = { 1, -1, 0, 0 };
int dj[] = { 0, 0, 1, -1 };
int valid(int i, int j) {
return i >= 0 && i < 2 && j >= 0 && j < n && arr[i][j] == '#';
}
int solve(int x, int y) {
int vis[501][501] = { 0 };
queue<pair<int, int>... | ALGO | 0.999982 | 3.998272 |
9b219648-6197-40e9-ab12-d8d629dcd1b7 | ansh1406/Symboless-Documentation | Examples/watermelon_problem.cpp | #include<iostream>
#include<string>
#include "symls.hpp"
using namespace std;
int main()
{
string input;
cout<<"Enter no of watermelons: ";
cin >> input;
string output = "";
string code =
"let integer w and read w\n"
"if w modulo 2 is equal-to 0 then\n"
"if w is greater-than ... | ALGO | 0.999909 | 4.047507 |
c3b7aeae-126b-4653-a6a5-d1c1ae604468 | Zain4391/DSA | LCA.cpp | #include <iostream>
class TreeNode
{
public:
int data;
TreeNode* left;
TreeNode* right;
TreeNode(int val) : data(val), left(nullptr), right(nullptr) {}
};
TreeNode* lowestCommonAncestor(TreeNode* root, int node1, int node2)
{
if(root == NULL)
{
return NULL;
}
if(root->da... | ALGO | 0.99999 | 7.47001 |
996fe42e-25b1-47c8-a23a-3f6757cd5566 | Aastha23/Algorithmic-Toolbox | week 2/lcm.cpp | #include<iostream>
using namespace std;
int gcd(int a, int b) {
int temp = 1;
while(b!=0)
{ temp=a%b;
a=b;
b=temp;
}
return a;
}
int main()
{
long long a,b,temp;
cin>>a>>b;
if(a>=b)
temp=gcd(a,b);
else
temp=gcd(b,a);
//lcm*gcd = a*b
a=a/temp;
a=a*b;
cout<<... | ALGO | 0.99992 | 3.706494 |
0965872e-17e2-4e5b-819a-2864736d4801 | J-B-Mugundh/LeetCode-Solutions | 0506-relative-ranks/0506-relative-ranks.cpp | class Solution {
public:
vector<string> findRelativeRanks(vector<int>& score) {
int N = score.size();
// Create a max heap of pairs (score, index)
priority_queue<pair<int, int>> heap;
for (int i = 0; i < N; i++) {
heap.push({score[i], i});
}
// Assign ra... | ALGO | 0.999966 | 6.432115 |
d3e1a5a8-f11b-421f-ac41-64e6481b16b1 | birsnot/A2SV_Programming | array_manipulation.cpp | #include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
vector<string> split(const string &);
/*
* Complete the 'arrayManipulation' function below.
*
* The function is expected to return a LONG_INTEGER.
* The function accepts following parameters:
* 1. INTEGER ... | ALGO | 0.999731 | 5.3218 |
5426ff9b-757e-4d86-9b0a-d071694b354d | sonulen/Teaching_sandbox | cpp/Meyers_Effective_C++_35/rule_31.cpp | #include <utility>
#include <iostream>
#include <cassert>
class GameObject {
public:
virtual GameObject* who() = 0;
};
class Earth : public GameObject {
public:
Earth* who() override { return this; };
};
class SpaceShip : public GameObject {
public:
SpaceShip* who() override { return this; };... | TOOL | 0.929488 | 5.57253 |
b46c7449-cca6-4d7d-be90-894924cf03df | Bharatkgupta/leetcode-bkg | 0160-intersection-of-two-linked-lists/0160-intersection-of-two-linked-lists.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {
int na = 0, nb = 0;
ListNode *a = headA;
L... | ALGO | 0.999956 | 5.434835 |
1169f8bc-2453-46c1-b9df-0b59c77bc24d | HieuGM/DSA_PTIT | DSA03023.cpp | #include<bits/stdc++.h>
#define int long long
#define pb push_back
#define fi first
#define se second
#define pii pair<int, int>
#define FULL(a) a.begin(), a.end()
#define FOR(i, a, b) for(int i=a; i<=b; ++i)
#define TIME (1.0 * clock() / CLOCKS_PER_SEC)
#define HieuGM signed main
#pragma GCC optimize("Ofast,03,unroll-... | ALGO | 0.999901 | 4.693777 |
9dbb4d24-e995-4f6c-802b-bdf1bd09b73a | abhishekumar-tyagi/node | deps/icu-small/source/common/ucharstrie.cpp | #include "unicode/utypes.h"
#include "unicode/appendable.h"
#include "unicode/ucharstrie.h"
#include "unicode/uobject.h"
#include "unicode/utf16.h"
#include "cmemory.h"
#include "uassert.h"
U_NAMESPACE_BEGIN
UCharsTrie::~UCharsTrie() {
uprv_free(ownedArray_);
}
UStringTrieResult
UCharsTrie::current() const {
... | ALGO | 0.971278 | 7.411595 |
9f35e861-349a-47b2-acd4-3eac44966a50 | AlphaActual/Cpp-learning-exercises | priprema11.cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
#include <cmath>
using namespace std;
int brojacCase2 = 0;
int odabir(){
int izbor;
cout << "Odaberite jednu od ponudjenih opcija:"<< endl <<
"1. Sortiranje polja postupkom Bubble sort"<< endl <<
"2. Povrsina trokuta"<< endl <<
"3. Eratostenov... | ALGO | 0.984468 | 3.791306 |
4bebb442-16dd-40ea-af06-3c122415a180 | olka2g/Project_SRPP | Komiwojazer/AlgorithmController.cpp | #include "AlgorithmController.h"
#include <math.h>
#include <vector>
#include "FlowerAlgorithm.h"
#include <string>
using namespace std;
#include <iostream>
Solution findPath(CitiesData cities){
printf("0.\tGRASP\n");
printf("1.\tTabu\n");
printf("2.\tGreedy Radial\n");
string userInput;
int chosen = -1;
do{
... | ALGO | 0.999987 | 4.262157 |
0d3a2107-b881-42ba-a9ce-e707fd59e92c | ustcyyw/algorithm | leetcode/medium/other/divisibilityArray.cpp | /**
* @Time : 2023/2/26-9:19 PM
* @Author : yyw@ustc
* @E-mail : <EMAIL>
* @Github : https://github.com/ustcyyw
* @desc :
*/
#include<bits/stdc++.h>
using namespace std;
/*
* 给你一个下标从 0 开始的字符串 word ,长度为 n ,由从 0 到 9 的数字组成。另给你一个正整数 m 。
word 的 可整除数组 div 是一个长度为 n 的整数数组,并满足:
如果 word[0,...,i] 所表示的 数值 能被 m 整除,div[i]... | ALGO | 0.999956 | 5.20948 |
4b30ba3a-c3b6-4f22-ab58-e7e56aa2f3b2 | jeayoungho97/CodeStudy | self_study/solved.ac/class2/1920.cpp | #include <iostream>
#include <vector>
#include <algorithm>
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int n;
std::cin >> n;
std::vector<int> list(n);
for (int i = 0; i < n; ++i) {
std::cin >> list[i];
}
std::sort(list.begin(), list.end());
int m;
std::cin >> m;
... | ALGO | 0.999981 | 4.767749 |
edbe64d6-2bc1-447c-8a04-046906402fb3 | GG-Bruse/superC | C++实验文件/源.cpp | #define _CRT_SECURE_NO_WARNINGS
/*
给你一个整数 x ,如果 x 是一个回文整数,返回 true ;否则,返回 false 。
回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。
例如,121 是回文,而 123 不是。
*/
//初始版本
//#include<iostream>
//#include<string>
//#include<math.h>
//using namespace std;
//class Solution {
//public:
// bool isPalindrome(int x) {
// int i = 0;
// ... | ALGO | 0.9934 | 3.662271 |
02c30f98-71e1-47ac-b20f-fe94bd9edc90 | Dreamy-Z3r0/VGU-WirelessMeteorologyStation | 04 - Assembly/Version 0.5.1 (Beta) - OOP/Main_Code/Wind_Vane.cpp | #include "Wind_Vane.h"
uint16_t ADC_MAX_VALUE = (12 == ADC_resolution ? 4095 : 1023);
float Vcc = 3.3, // Initial value for Vcc
AVref = 3.3; // Initial value for AVref
WindVane_Control::WindVane_Control(uint32_t ADC_input_pin, unsigned int storage_size) {
this->ADC_input_pin = ADC_input_pin;
this->... | ALGO | 0.920923 | 5.308626 |
2b7370f4-f02f-4bde-bf20-16ab942a1e64 | kandika-Rohan/leetcode-practicing | 0235-lowest-common-ancestor-of-a-binary-search-tree/0235-lowest-common-ancestor-of-a-binary-search-tree.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* lowestCommonAncestor(TreeNode* root, TreeNode* p, TreeNode* q){
if(!root){
... | ALGO | 0.999994 | 6.356675 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.