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 |
|---|---|---|---|---|---|---|
576fddb3-bf54-4456-8198-5755d65ad90c | Omkar-Najan/Cpp-Codes | Stacks/postfixEvalution.cpp | #include<iostream>
#include <stack>
#include<math.h>
using namespace std;
int postfixEvalution(string s){
stack<int> st;
for(int i=0;i<s.length();i++){
if(s[i]>='0' && s[i]<='9'){
st.push(s[i]-'0');
}else{
int op2 = st.top();
st.pop();
int op1 = ... | ALGO | 0.999648 | 4.589008 |
80c12c4b-eece-4396-ad10-919a52bcfd4e | PlasmaControl/FreeMHD | OpenFOAM-v2206/ThirdParty/sources/boost/boost_1_74_0/libs/compute/perf/perf_stl_count.cpp | #include <algorithm>
#include <iostream>
#include <vector>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
int main(int argc, char *argv[])
{
perf_parse_args(argc, argv);
std::cout << "size: " << PERF_N << std::endl;
// create vector of random numb... | ALGO | 0.939529 | 5.452251 |
f9b9b44c-1a23-4857-b7df-b14d8e2ba715 | giongto35/CompetitveProgramming | D343.cpp | #include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <sstream>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <que... | ALGO | 0.999499 | 3.84778 |
ce692198-a50e-4a9b-856d-ff4093eafbd9 | J0131/C_Programming | HeapPrioQ_Event/main.cpp | /****************************************
* ϸ : ø Priority ť ̺Ʈó α
* ۼ : ֹ
* final update : 2020.10.29
*****************************************/
#include <iostream>
#include <fstream>
#include "Event.h"
#include "HeapPrioQ.h"
#include <string>
#include <stdlib.h>
#include <Windows.h>
using namespace std;
#define I... | ALGO | 0.943809 | 3.992975 |
1c9502d3-b3b9-46c7-a657-b94b7207c373 | KarlPham/A1PSD | 1b.cpp | #include<iostream>
#include<fstream>
#include<vector>
using namespace std;
int main()
{
int Sum = 0; // Variable to store the final calculated sum
int a, b; // Temporary variables to store pairs from the file
vector<int> arrLeft; // Vector to store first values from each pair
vector<int> arrRight; //... | ALGO | 0.999806 | 5.245656 |
90620889-5471-4fdd-a9a4-d1126e6479f7 | ishandutta2007/codeforces | pechalka/normal/1200/C.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <iomanip>
using namespace std;
long long gcd(long long a, long long b){
if (b == 0)
return a;
return gcd(b, a % b);
}
int main(){
long long A[2];
cin >> A[0] >> A[1];
long long B[2];
B[0] = A[0] / gcd(A[0], A[1]);
B[1] = A[1] / gcd... | ALGO | 0.999211 | 3.630079 |
ea7b6834-9e8c-4a70-b2d2-512ecefe7703 | AndreiTod1/myssh-C | exec.cpp | #include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <fcntl.h>
using namespace std;
struct Command {
vector<string> args;
string input_redirection;
string output_redirection;
string error_redirection;
s... | TOOL | 0.972585 | 4.042123 |
e17e269f-4cfc-41e3-85cc-371b1e281b03 | bak3839/baekjoon_cpp | 프로그래머스/1/42840. 모의고사/모의고사.cpp | #include <string>
#include <vector>
using namespace std;
vector<int> solution(vector<int> answers) {
vector<int> ans;
int p1[5] = {1, 2, 3, 4, 5};
int p2[8] = {2, 1, 2, 3, 2, 4, 2, 5};
int p3[10] = {3, 3, 1, 1, 2, 2, 4, 4, 5, 5};
int n1 = 0, n2 = 0, n3 = 0;
for(int i = 0; i < answers... | ALGO | 0.999928 | 5.398542 |
6721507c-a12c-4c14-89bd-bfe7d384d7dc | AI1379/OILearning | Practices/Training/2021AutumnTraining/1003/D2.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int n;
vector<int> tree[100010]; // 邻接表
struct node {
int lev, t, pos;
node(int a, int b, int c) : lev(a), t(b), pos(c) {}
};
ll blood[100010], attack[100010], def[100010], lev[100010], t[100010];
bool vis[100010];
int rt[100010]; // 父节点
int fa... | ALGO | 0.999868 | 3.483788 |
b98000ed-ee62-478d-a663-d3527cfa5100 | Kumarshivam99557/LeetcodeProblems | 1262-online-majority-element-in-subarray/online-majority-element-in-subarray.cpp | class MajorityChecker {
unordered_map<int,vector<int>> mp ;
vector<int> v ;
int trial = 30 ;
public:
MajorityChecker(vector<int>& arr) {
srand(time(NULL));
trial = 20 ;
int n = arr.size() ;
v.clear();
mp.clear() ;
for(int i = 0 ; i< n ; ++i ){
... | ALGO | 0.999939 | 5.419925 |
1afc30c8-2ed8-4958-945b-e748dfc7203c | aryadamargalih/pertemuan9 | 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.998757 | 6.771107 |
e444fa0a-c171-4220-ae92-f79c0a45c464 | ishandutta2007/codeforces | duality/normal/1672/H.cpp | #define DEBUG 0
#include <bits/stdc++.h>
using namespace std;
#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printA... | ALGO | 0.999965 | 4.044416 |
51356a90-8fa8-45e2-b1fa-9f01355f92d0 | geekzzz/IntroToAlgorithm_CPP | LeetCodePractice/1-300/108. Convert Sorted Array to Binary Search Tree/108. Convert Sorted Array to 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* sortedArrayToBST(vector<int>& nums) {
int n = nums.size();
if (!n)
return NULL;
return ... | ALGO | 0.999999 | 6.656144 |
c79e905c-7809-429b-a8f3-314ddb1f99dc | fatehmuhammad22/C-Language-Codes | Program to check if a matrics is symetric or not.cpp | #include<stdio.h>
int main(){
int arr[4][4]={2,0,1,1,0,-1,-2,3,1,-2,0,4,1,3,4,2};
int tran[4][4];
int symetric=0;
for(int i=0;i<=3;i++){
for(int j=0;j<=3;j++){
tran[j][i]=arr[i][j];
}
}
printf("Transpose of the Matrix is:\n");
for(int k=0;k<=3;k++){
for(int p=0;p<=3;p++){
printf("%d\t", tran[k][p]);
... | ALGO | 0.999977 | 3.283263 |
ad2151bc-d985-4143-a9b6-a84af5bcfb99 | ArchitKumar1/LeetCode-Submissions | ipo/Wrong Answer/2-13-2021, 11:42:39 PM/Solution.cpp | // https://leetcode.com/problems/ipo
class Solution {
public:
int findMaximizedCapital(int k, int W, vector<int>& p, vector<int>& c) {
int n = p.size();
vector<pair<int,int>> v;
for(int i = 0;i<n;i++){
v.push_back({c[i],p[i]});
}
sort(v.begin(),... | ALGO | 0.999991 | 4.9442 |
54a0fa98-b1b1-4fed-9da8-806ea7ed03ad | Ranvijaykumar9708/call_log | 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.998799 | 6.776823 |
bd93f184-4c75-41dd-8b74-c6e763dd2281 | GauravJha-Git/CPP | gfg/String/17.cpp | // Non Repeating Character
// Given a string s consisting of lowercase English Letters. Return the first non-repeating character in s.
// If there is no non-repeating character, return '$'.
// Note: When you return '$' driver code will output -1.
// Examples:
// Input: s = "geeksforgeeks"
// Output: 'f'
// Explanatio... | ALGO | 0.999141 | 5.368836 |
61f08524-dd55-46b9-80e5-514188a211a3 | Blacksmith1111/Yandex_algs | FIb.cpp | #include <iostream>
int Fib(int n){
int fib1 = 0, fib2 = 1;
if(n == 1){
return fib1;
}
if(n == 2){
return fib2;
}
return Fib(n-2) + Fib(n-1);
}
int main(){
std::cout << Fib(7) << "\n";
return 0;
} | ALGO | 0.999482 | 4.927548 |
60ecb6da-42ad-4f7e-a7d9-3d1ac45df140 | TigerBi/DMOJ-Solutions | snowflakes.cpp | // fast enough to pass
#include <bits/stdc++.h>
using namespace std;
set<vector<int>> snowflakes;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int n, ns, i, tmp;
cin >> ns;
n = ns;
while (ns--)
{
vector<int> snowflake;
for (int i = 0; i < 6; i++)
{
... | ALGO | 0.999698 | 3.974597 |
f68742f4-45bd-475d-9576-2b0f19d533d4 | Aethereux/Hikari-LLVM19 | libc/src/math/nvptx/copysign.cpp | #include "src/math/copysign.h"
#include "src/__support/common.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(double, copysign, (double x, double y)) {
return __builtin_copysign(x, y);
}
} // namespace LIBC_NAMESPACE_DECL
| TOOL | 0.971452 | 5.748122 |
18e02975-21f3-4c81-b414-67d395e60be8 | amrharb/leetcode | 53-maximum-subarray/53-maximum-subarray.cpp | class Solution {
public:
int maxSubArray(vector<int>& v) {
int sum=0,mx=-1e9,n=v.size();
for(int i=0;i<n;i++){
sum+=v[i];
mx=max(mx,sum);
if(sum<0)sum=0;
}
return mx;
}
}; | ALGO | 0.999975 | 5.957682 |
af79d8b4-f576-47d2-be70-752d420fe58c | nafis195/LeetCode | Linked List Cycle/Source.cpp | // Bismillahir Rahmanir Rahim
// Nafis Chowdhury
// Leetcode - Linked List Cycle
// Problem Statement - https://leetcode.com/problems/linked-list-cycle/
// Main.cpp
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };... | ALGO | 0.999919 | 5.775538 |
f36f95ab-5a02-4113-9045-0bb28d24f36e | poglodjan/C_experience | C++ object oriented/class_Matrix/Matrix.cpp | #include <iostream>
using namespace std;
class Matrix {
int** coef;
int size;
public:
Matrix();
Matrix(int _size);
Matrix(int** m, int _size);
~Matrix();
Matrix(const Matrix& m);
Matrix& operator=(const Matrix& m);
friend ostream& operator<<(ostream& out, const Matrix& m);
};
Matrix::Matrix() :coef(nullptr... | ALGO | 0.990008 | 3.22289 |
cd9e42d7-078b-4d0c-abff-755dbbd07b5c | ljx791863565/MyLeetcode | boost_1_67_0/libs/graph/test/metis_test.cpp | #include <boost/graph/breadth_first_search.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/metis.hpp>
#include <fstream>
#ifdef BOOST_NO_EXCEPTIONS
void
boost::throw_exception(std::exception const& ex)
{
std::cout << ex.what() << std::endl;
abort();
}
#endif
using namespace boost;
/* An ... | ALGO | 0.998625 | 5.502904 |
2ec4e910-bceb-429b-87cb-f34e8ee81ca0 | dspangpang/pb_nbv | src/pb_core/src/pbnbv.cpp | #include "../include/pb_core/pbnbv.h"
pbnbv::pbnbv():is(),ns(),vs()
{
currnet_cloud.reset(new pcl::PointCloud<pcl::PointXYZ>);
current_camera_pose = Eigen::Matrix4d::Identity();
// 从环境变量中提取 work_dir
std::string work_dir = std::getenv("WORK_DIR");
if (work_dir.empty())
{
LOG(ERROR) << "... | ALGO | 0.996765 | 4.490217 |
7447d14f-8a34-4be3-8238-72287ad77932 | roshanrk44/Leetcode_Solutions | 0029-divide-two-integers/0029-divide-two-integers.cpp |
class Solution {
public:
int divide(int dividend, int divisor) {
if(dividend==INT_MIN && divisor==(-1))
return INT_MAX;
int ans = dividend/divisor;
return ans;
}
}; | ALGO | 0.994428 | 5.752072 |
ffa6f9e2-8069-44c8-a92a-18ec4c0497ed | Villager14/Employment_Work | Library/Mesh/MeshCommonProcessing.cpp | /*
* @file MeshCommonProcessing.cpp
* @brief bV̋ʏ
* @author Morita
* @date 2024/07/30
*/
#include "pch.h"
#include"MeshCommonProcessing.h"
MeshCommonProcessing::MeshCommonProcessing()
{
}
MeshCommonProcessing::~MeshCommonProcessing()
{
}
bool MeshCommonProcessing::CircleHitDetermination(const std::vector<DirectX... | ALGO | 0.969823 | 4.279699 |
a7c0b518-6be3-4452-989e-b3e1dba3ec57 | kamaboko123/aoj | cpp/ITP1/ITP1_4_B.cpp | #include <cstdio>
#include <iostream>
#include <string>
#include <cmath>
using namespace std;
int main(void){
string input;
while(getline(cin, input), !cin.eof()){
double r;
sscanf(input.c_str(), "%lf\n", &r);
printf("%lf %lf\n", (r * r * M_PI), (r * 2 * M_PI));
... | ALGO | 0.984763 | 3.694586 |
aa9f4213-6f2e-430c-a6a9-c9723e160aa5 | kumaranubhav1654/DSA | 547-number-of-provinces/number-of-provinces.cpp | class Solution {
public:
vector<int>parent;
vector<int>size;
vector<int>rank;
void unionBySize(int u, int v){
int up = findUParent(u);
int vp = findUParent(v);
if(up==vp) return;
if(size[up]< size[vp]){
parent[up] = vp;
size[vp]+=size[up];
}
e... | ALGO | 0.999995 | 5.993526 |
b7592e0e-a78d-4ca5-9ec2-8361f2a4f078 | DuyMinh0102/My_Work | 25 - 9/sumborder/sumborder.cpp | #include <iostream>
using namespace std;
const int maxn = 1e4;
int m, n, sum = 0;
int a[maxn + 5][maxn + 5];
void Init(){
freopen("sumborder.inp", "r", stdin);
freopen("sumborder.out", "w", stdout);
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
void Solve(){
cin >> m >> n;
for ... | ALGO | 0.999883 | 3.576514 |
9474c56c-0f72-4133-9e57-cae09deeb5e8 | wtrebella/AdventOfCode2020 | day2.cpp | #include "day2.h"
using namespace std;
void runDay2()
{
// puzzle 1
vector <PasswordEntry> passwordEntries = parsePasswordEntries(DAY2_PATH);
vector <PasswordEntry> puz1validEntries = passwordEntries;
removeInvalidEntries(puz1validEntries, isValidForPuz1);
cout << "Day 2" << endl;
cout << "=... | TOOL | 0.92565 | 4.469351 |
a446c5a1-fd7e-43e2-953d-58874e08194b | seongwn/OpenSWProject | HW03_Restor_Segm/SobelGraySkeleton.cpp | #include <iostream>
#include <opencv2/opencv.hpp>
#include <math.h> /* exp */
#define IM_TYPE CV_8UC3
using namespace std;
using namespace cv;
// Image Type
// "G" for GrayScale Image, "C" for Color Image
#if (IM_TYPE == CV_8UC3)
typedef uchar G;
typedef cv::Vec3b C;
#elif (IM_TYPE == CV_16SC3)
typedef short G;... | ALGO | 0.997512 | 5.129569 |
fbddfe45-bace-433e-8af7-2997e13d89b8 | Dup4/competitive-programming | codeforces/contest/1207/d.cpp | #include <bits/stdc++.h>
using namespace std;
#define debug(...) \
{ \
printf("# "); \
printf(__VA_ARGS__); \
puts(""); \
}
#define ll long long
#define pii pair<int, int>
#define fi first
#define se second
const int N = 3e5 + 10;
const ... | ALGO | 0.999879 | 4.134675 |
9492f170-eba2-4d45-ab68-74e2b377e51b | Aratrika-2003/CrackYourPlacement | Dynamic Programming/job-sequencing/sol.cpp | #include<bits/stdc++.h>
using namespace std;
struct Job
{
int id; // Job Id
int dead; // Deadline of job
int profit; // Profit if job is over before or on deadline
};
class Solution
{
public:
bool static comp(Job a, Job b){
return a.profit>b.profit;
}
vector<int> Jo... | ALGO | 0.999961 | 5.485304 |
06b44b7b-367a-4e24-a211-f9587819fbe1 | wewe5215/NTHU_AIAS_2024 | lab08/emulator/translate.cpp | #include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include "translate.h"
char* concat(const char *s1, const char *s2){
const size_t len1 = strlen(s1);
const size_t len2 = strlen(s2);
char *result = (char*)malloc(len1 + len2 + 1); // +1 for ... | TOOL | 0.925441 | 3.319463 |
5c239b5c-48fb-4796-8fce-4d94763c7d16 | Superconductor-Electronics/JoSIM | src/j_misc.cpp | std::string
Misc::file_from_path(std::string path)
{
auto posLastSlash = path.find_last_of("/\\");
if (posLastSlash == std::string::npos) {
posLastSlash = 0;
return path.substr(posLastSlash);
}
else
return path.substr(posLastSlash + 1);
}
bool
Misc::has_suffix(const std::string& str, const std::string& suffi... | TOOL | 0.955445 | 4.727243 |
96d2fd7e-ef2a-4f4c-baac-3bbe84c8c3c5 | viter-oliver/HSG | boost_1_79_0/libs/spirit/example/qi/compiler_tutorial/calc2.cpp | ///////////////////////////////////////////////////////////////////////////////
//
// A Calculator example demonstrating the grammar and semantic actions
// using plain functions. The parser prints code suitable for a stack
// based virtual machine.
//
// [ JDG May 10, 2002 ] spirit1
// [ JDG March 4, 2007 ... | TOOL | 0.961589 | 7.574358 |
a6319c8d-3cfb-4ab6-b16d-2e2e7cfb214c | r-o-b-o-t-o/generic-genetics | examples/mystery-sentence/src/main.cpp | #include "crossover.hpp"
#include "evaluator.hpp"
#include "generator.hpp"
#include "mutation.hpp"
#include "../../../include/criterion.hpp"
#include "../../../include/generate.hpp"
#include "../../../include/geneticAlgorithm.hpp"
#include "../../../include/selectors.hpp"
int main() {
// ---------------------usin... | ALGO | 0.999576 | 5.980457 |
61fb0f07-89b4-48ae-97c5-8cae07d33665 | Golovanov399/adventofcode | 2022/12_b.cpp | #include <bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define itn int
#define make_unique(x) sort((x).begin(), (x).end()); (x).erase(unique((x).begin(), (x).end()), (x).end())
using namespace std;
inline int nxt() {
int x;
cin >> x;
return x;
}
int main() {
vector<string> a;
{
string s;
while (cin... | ALGO | 0.999836 | 3.755844 |
6f506396-48e1-41b2-b440-451594d5fc43 | ishandutta2007/codeforces | fastmath/normal/1333/C.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define ii pair <int, int>
#define app push_back
#define all(a) a.begin(), a.end()
#define bp __builtin_popcount
#define ll long long
#define mp make_pair
#define f first
#define s second
#define Time (double)clock()/CLOCKS_PER_SEC
const int N = 2e5 + ... | ALGO | 0.999894 | 3.470665 |
f45cfbbf-5f37-4b0a-a976-ee6dc27959a3 | ItsUtkarshhh/Arsh-Goyal-45-Days-DSA-Challenge | Day35/MaximumOfMinimumForEveryone.cpp | // GFG Question :
#include <iostream>
#include <vector>
#include <stack>
#include <algorithm>
using namespace std;
vector<int> maxOfMin(int arr[], int n) {
vector<int> left(n), right(n);
stack<int> s;
// Fill elements of left[]
for (int i = 0; i < n; i++) {
while (!s.empty() && arr[s.top()] >... | ALGO | 0.999995 | 5.434583 |
57bd16d0-9c90-4708-ad78-7a92274a4a82 | nguyenvu9405/online-judge | html/submissions/47/submission.cpp | #include<cstdio>
#include<cstring>
#include<cmath>
int p[101], f[21], a[21], n;
long cnt=0;
void sieve(int nmax)
{
memset(p, 1, sizeof(p));
p[1]=p[0]=0;
int i, j, lim=sqrt(nmax);
for (i=2; i<=lim; ++i)
if (p[i]) for (j=2; j<=nmax/i; ++j) p[i*j]=0;
}
void print()
{
//for (int i=1; i<=2*n;... | ALGO | 0.999528 | 3.454175 |
5523b8ee-1ac7-431d-967e-79d9e9336319 | khalwsh/Competitive-Programming | Math/Number Theory 2/Sum of Arithmetic Progression Modular and Divided.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 3e5 + 9;
/*
Sums of arithmetic progressions.
mod_sum(n, a, d, m) = \sum_{i = 0}^{n - 1}{(a + d * i) % m}.
floor_sum(n, a, d, m) = \sum_{i = 0}^{n - 1}{(a + d * i) / m}.
log(m), with a large constant.
*/
long long sumsq(long long n) {
return n / 2 * ((n - 1... | ALGO | 0.999802 | 4.026427 |
869242b9-34b9-4e0e-b812-147bc607a296 | coryellj53/CS-142 | 2 - Variables and assignments/2.11 - String basics/2.11.1.cpp | #include <iostream>
#include <string>
using namespace std;
/*
A user types a word and a number on a single line. Read them into the provided variables. Then print: word_number. End with newline. Example output if user entered: Amy 5
Amy_5
*/
int main() {
string userWord;
int userNum = 0;
/* Your solutio... | TOOL | 0.873283 | 5.022754 |
d9386f79-ac55-44d3-9624-95c581b46f28 | qetupjuan/GAME3001-M2020-Lab9-Starter | include/GLM/test/gtx/gtx_simd_mat4.cpp | ///////////////////////////////////////////////////////////////////////////////////
/// OpenGL Mathematics (glm.g-truc.net)
///
/// Copyright (c) 2005 - 2012 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... | TEST | 0.993223 | 6.517536 |
db258ffc-5545-4a55-8f86-2c50e74d7e2d | barkhaaroraa/cpp-codes | binarysearch.cpp | #include<iostream>
#include<vector>
#include <bits/stdc++.h>
using namespace std;
int binary(vector<int>arr)
{
int s;
int c=arr.size();
cout<<"enter number to searched"<<endl;
cin>>s;
int beginn=0,endd=c,t=1;
while(beginn<=endd)
{
c=(beginn+endd)/2;
if(arr[c]==s)
... | ALGO | 0.999556 | 4.52066 |
9986faa3-0612-4536-be43-caa949b20d1f | cy0713/SMeta | boost/libs/compute/perf/perf_stl_unique_copy.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
int main(int argc, char *argv[])
{
perf_parse_args(argc, argv);
std::cout << "size: " << PERF_N << std::endl;
// create ve... | ALGO | 0.968296 | 5.605659 |
5be0141d-1281-4193-bda1-9ffacd530614 | Kristpher/NITCbase | mynitcbase/BlockAccess/BlockAccess.cpp | #include "BlockAccess.h"
#include<cstdlib>
#include <cstring>
RecId BlockAccess::linearSearch(int relId, char attrName[ATTR_SIZE], union Attribute attrVal, int op) {
// get the previous search index of the relation relId from the relation cache
// (use RelCacheTable::getSearchIndex() function)
RecId prevR... | TOOL | 0.962329 | 4.598353 |
162c5884-099c-4c64-8a2c-82259431c09f | dskhairnar/Leetcode | 0219-contains-duplicate-ii/0219-contains-duplicate-ii.cpp | class Solution {
public:
bool containsNearbyDuplicate(vector<int>& nums, int k) {
unordered_map<int, int> mp; // Stores the last index of each number
for (int i = 0; i < nums.size(); i++) {
if (mp.find(nums[i]) != mp.end() && i - mp[nums[i]] <= k) {
return true; ... | ALGO | 0.999844 | 7.007251 |
5e6422bf-c415-42f5-8672-c1d152c77656 | nc-77/algorithms | ACM/专题训练8 树状数组/1.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
const int maxn=50000+10;
int bit[maxn],n;
int sum(int i)
{
int s=0;
while(i>0)
{
s+=bit[i];
i-=i&-i;
}
return s;
}
void add(int i,int x)
{
while(i<=n)
{
bit[i]+=x;
i+=i&(-i);
}
}
int main()
{ ios::sync_with_stdio(false);
int t;
cin>>t;
... | ALGO | 0.998572 | 4.0529 |
7df270e9-b623-42cf-8020-7231325f0d31 | aastha-ML/placement-classes | pair.cpp | class Solution {
public:
int numIdenticalPairs(vector<int>& nums) {
unordered_map<int, int> keyMap;
int count=0;
for(int i=0; i<nums.size(); i++){
count+=keyMap[nums[i]];
keyMap[nums[i]]++;
}
return count;
}
}; | ALGO | 0.999926 | 6.018845 |
9d5b76e7-2e56-460e-869c-588901b1dd75 | compilerai/counter | llvm-project/clang/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp | #include "clang/Basic/JsonSupport.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/APSIntType.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/ProgramStateTrait.h"
#include "clang/StaticAnalyzer/Core/PathSensitive/RangedConstraintManager.h"
#incl... | TOOL | 0.871174 | 7.554851 |
98e4c71e-82e9-4cd0-a46c-fe9be4eed91c | Kumar-akki/SU2 | SU2_CFD/src/numerics/flow/convection/roe.cpp | #include "../../../../include/numerics/flow/convection/roe.hpp"
#include "../../../../../Common/include/toolboxes/geometry_toolbox.hpp"
CUpwRoeBase_Flow::CUpwRoeBase_Flow(unsigned short val_nDim, unsigned short val_nVar, const CConfig* config,
bool val_low_dissipation) : CNumerics(va... | ALGO | 0.999455 | 5.473425 |
8a2a6dd9-f063-4e7e-ae9f-5238cd1f5969 | msdeep14/codeforces | 276B.cpp | //mandeep singh @msdeep14
//
#include<bits/stdc++.h>
#define ll long long int
#define fe first
#define se second
#define pb push_back
#define mp make_pair
#define inf INT_MAX
#define vi vector<int>
#define vl vector<ll>
#define si set<int>
#define msi multiset<int>
#define fr0(i,a,b) for(int i=a;i<b;i++)
#define fr1(i,... | ALGO | 0.999976 | 3.734654 |
52a4f7a1-36be-490c-8a65-fc26b153e5b4 | heavenMOJANG/ICPC | .history/Codeforces/CF1995/B2_20240724002511.cpp | #pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define int long long
#define pii pair<int, int>
using namespace std;
constexpr int inf = 0x7fffffff;
struct Node {int a,c;};
void solve() {
int n, m; cin >> n >> m;
vector<Node> f(n);
for (int i... | ALGO | 0.999986 | 4.137911 |
0e49edc7-9e3c-48e2-98f1-de72980d253a | LiuYangG/CodeByMyself | 八皇后.cpp | #include<iostream>
using namespace std;
const int N = 15;
int count = 1;
int col[N],ug[N+N],uug[N+N];
int Map[N][N];
void dfs(int u){
if(u==8){
//找满了8行
cout<<"No. "<<count++<<endl;
for(int i=0;i<8;i++){
for(int j=0;j<8;j++){
cout<<Map[i][j]<<" ";
}
... | ALGO | 0.998738 | 3.340939 |
6280a54f-0a18-4e3f-afe1-55f0b9f7b594 | inzamamtoha/Data_Structure_Lab | Graph/Dijkstra.cpp | #include<bits/stdc++.h>
using namespace std;
#define N 10000
#define INF INT_MAX
int v,e;
vector<int>edge[N];
vector<int>cost[N];
int parent[1000];
struct graph
{
int node;
int cost;
bool operator <(const graph & p)const
{
return cost<p.cost;
}
}ed;
void print_path(int source,int destination... | ALGO | 0.999994 | 3.618291 |
5ef8161e-45a2-483f-b603-1861db1a987d | PranjalShinde16/Codeforces | Ladder A/24.AntonAndLetters.cpp | #include<bits/stdc++.h>
#include<string.h>
using namespace std;
int main()
{
string s;
int count=0,n;
getline(cin,s);
n=s.length();
for(int i=0;i<n;i++){
if(s[i]>='a'&&s[i]<='z'){count = count + 1;}}
for(int i=0;i<n;i++)
{
if(s[i]>='a'&&s[i]<='z')
{
for(int j=... | ALGO | 0.999467 | 3.54558 |
f5f859b7-4c9e-410f-90b2-add0fbbb48f9 | Seungwuk98/Algorithm-Solving-C- | rotate.cpp | #include <bits/stdc++.h>
#define PI 3.14159265358979323846264338327950288419716939937510L
using namespace std;
using ld = long double;
struct vec3
{
ld x, y, z;
vec3(){x=y=z=0;}
vec3(ld x, ld y, ld z) : x(x), y(y), z(z) {}
vec3 operator-(const vec3 &o) const {
return vec3(x - o.x, y - o.y, z -... | ALGO | 0.999905 | 3.760825 |
f5159abb-900c-4f80-b5bf-b4f32912733a | algorithm-random-defense/algorithm_study | src/AS_23_12_week1/1245.cpp | // 농장 관ㅣ
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
int dx[8] = {-1, 0, 1, 0, -1, -1, 1, 1};
int dy[8] = {0, -1, 0, 1, -1, 1, -1, 1};
using namespace std;
vector<vector<int> > board;
int col, row, mountain_top;
vector<vector<bool> > vis;
int getMaxHeight() {
int res = 0;
for (int ... | ALGO | 0.999415 | 4.182862 |
abcf1599-aaf7-4131-8697-bf08f0ad7605 | JessicaSt0ne/bserv-main | dependencies/boost/libs/math/tools/hypergeometric_1F1_map_neg_b_fwd_recurrence.cpp | #define BOOST_ENABLE_ASSERT_HANDLER
#define BOOST_MATH_MAX_SERIES_ITERATION_POLICY INT_MAX
// for consistent behaviour across compilers/platforms:
#define BOOST_MATH_PROMOTE_DOUBLE_POLICY false
// overflow to infinity is OK, we treat these as zero error as long as the sign is correct!
#define BOOST_MATH_OVERFLOW_ERROR_... | ALGO | 0.997895 | 5.382825 |
e8eb22c7-6cf8-4479-aee7-d2876bd33f86 | furkankurtoglu/whole-well | Transfer_Region_Fine/sample_projects/biorobots/main-biorobots.cpp | /*
*/
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <ctime>
#include <cmath>
#include <omp.h>
#include <fstream>
#include "./core/PhysiCell.h"
#include "./modules/PhysiCell_standard_modules.h"
// custom user modules
#include "./custom_modules/biorobots.h"
using namespace BioFVM;
using names... | ALGO | 0.871652 | 3.844644 |
59e74d21-7996-4548-806d-63dd1d43d4e0 | joker-eph/llvm-project-with-mlir | llvm/utils/FileCheck/FileCheck.cpp | #include "llvm/Support/CommandLine.h"
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/WithColor.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/FileCheck.h"
#include <cmath>
using namespace llvm;
static cl::extrahelp FileCheckOptsEnv(
"\nOptions are parse... | TOOL | 0.901207 | 7.457392 |
a0a10655-d28c-4162-a879-165823ce57d7 | Deformable-Toolkit/dtk | src/dtkPhysMassPoint.cpp | #include "dtkPhysMassPoint.h"
#include "dtkTx.h"
namespace dtk
{
dtkPhysMassPoint::dtkPhysMassPoint(dtkID id, dtkPoints::Ptr pts, const double &mass, const dtkT3<double> &vel, double pointDamp, double pointResistence, dtkDouble3 gravityAccel)
{
mID = id;
mPts = pts;
mMass = mass;
mVel = vel;
mPosBuffers.... | ALGO | 0.888955 | 5.353333 |
505e1265-7633-49eb-a2d1-f522e9d8ac86 | dharmu8948/DSandAlgo | Binary Search/SqrtUsingBS.cpp | // WAP to find the Square root of a given number
#include <bits/stdc++.h>
using namespace std;
int findSqrt(int n) {
int start =0, end =n;
int ans;
while(start<=end) {
int mid = start + (end - start)/2;
int sqRoot = mid*mid;
if(n == sqRoot) {
return mid;
}else if(... | ALGO | 0.999912 | 3.927364 |
49888acd-b042-4b00-a814-a529309b2851 | 3000IQPlay/AntiRAT-21 | src/hotspot/share/services/mallocLimit.cpp | #include "precompiled.hpp"
#include "memory/allocation.hpp"
#include "runtime/java.hpp"
#include "runtime/globals.hpp"
#include "services/mallocLimit.hpp"
#include "services/nmtCommon.hpp"
#include "utilities/globalDefinitions.hpp"
#include "utilities/parseInteger.hpp"
#include "utilities/ostream.hpp"
MallocLimitSet ... | TOOL | 0.890337 | 7.178829 |
92e831d5-9f38-477c-a30c-d204e480f1c4 | protik0939/XPSC_Codes | Week 7/Day 1/And_Then_There_Were_K.cpp | #include <bits/stdc++.h>
#define somoy \
ios_base::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0);
typedef long long int ll;
using namespace std;
int main()
{
somoy;
ll t;
cin >> t;
while (t--)
{
ll n;
cin >> n;
... | ALGO | 0.999985 | 4.974564 |
71d626a2-90b4-4ec1-93aa-5bab546d0fbb | minblock/motherofweeddaycoin | src/versionbits.cpp | #include <versionbits.h>
#include <consensus/params.h>
ThresholdState AbstractThresholdConditionChecker::GetStateFor(const CBlockIndex* pindexPrev, const Consensus::Params& params, ThresholdConditionCache& cache) const
{
int nPeriod = Period(params);
int nThreshold = Threshold(params);
int64_t nTimeStart =... | ALGO | 0.99797 | 7.509752 |
594292d8-09be-43b6-a555-14072ddd9ef9 | stefdasca/CompetitiveProgramming | Codeforces/Codeforces Round #237/CF404-D2-C.cpp | #include<bits/stdc++.h>
#define god dimasi5eks
#pragma GCC optimize("O3")
#define fi first
#define se second
#define pb push_back
#define pf push_front
#define mod 1000000007
#define eps 1e-9
using namespace std;
typedef long long ll;
int add(int a, int b)
{
ll x = a+b;
if(x >= mod)
x -= mod;
if(... | ALGO | 0.99994 | 3.588382 |
06503b31-c4c8-418b-b6f2-7ceaf78c6ca0 | 0XSNCRYPTO/ton | dht/dht-bucket.cpp | #include "td/utils/tl_storers.h"
#include "td/utils/crypto.h"
#include "td/utils/tl_parsers.h"
#include "td/utils/Random.h"
#include "td/utils/format.h"
#include "keys/encryptor.h"
#include "auto/tl/ton_api.hpp"
#include "dht-remote-node.hpp"
#include "dht-bucket.hpp"
#include "dht.hpp"
//#include <algorithm>
nam... | TOOL | 0.91295 | 6.435854 |
11f3f497-0dca-4ea8-aa23-eb22d61e1e5d | mattya-lab/Aizu_Online_Judge | Volume1/0103.cpp | #include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
using p = pair<int, int>;
int main(void)
{
int n = 0; cin >> n;
rep(i, n) {
int b1 = 0, b2 = 0, b3 = 0;
int out = 0;
int ans = 0;
while(out < 3) {
char s[10]; cin >> s;
if (strcmp(s, "HIT") == 0) {
if (b1 == ... | ALGO | 0.998887 | 3.969098 |
ab244f90-806b-482b-94d0-5d78bc1cde78 | sourabh59-coder/LeetCode | 0026-remove-duplicates-from-sorted-array/0026-remove-duplicates-from-sorted-array.cpp | class Solution {
public:
int removeDuplicates(vector<int>& v) {
int n = v.size();
int i = 0, j = 1;
while(j!=n)
{
if(v[i]!=v[j])
{
v[i+1] = v[j];
i++;
}
j++;
}
return (i+1);
}
}; | ALGO | 0.999827 | 5.990024 |
09cccd31-77e3-44b6-a05a-77b9a7425639 | Phenom-OS/frameworks_av | media/libstagefright/codecs/amrnb/common/src/gc_pred.cpp | /*
Pathname: ./audio/gsm-amr/c/src/gc_pred.c
Functions:
gc_pred_reset
gc_pred
gc_pred_update
gc_pred_average_limited
------------------------------------------------------------------------------
MODULE DESCRIPTION
This file contains the functions that perform code... | ALGO | 0.999639 | 6.133978 |
1c699504-25ce-4cd9-bdc3-839ecd91fc21 | alessandrobason/Pocket | third_party/assimp/code/PostProcessing/TextureTransform.cpp | /** @file A helper class that processes texture transformations */
#include <assimp/Importer.hpp>
#include <assimp/postprocess.h>
#include <assimp/DefaultLogger.hpp>
#include <assimp/scene.h>
#include "TextureTransform.h"
#include <assimp/StringUtils.h>
using namespace Assimp;
// -----------------------------------... | TOOL | 0.925144 | 7.706746 |
30e1c8e2-8cd6-4ddb-b571-1b6208597006 | sids278/Leetcode-Codes | 0054-spiral-matrix/0054-spiral-matrix.cpp | class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& matrix) {
vector<int>result;
int m=matrix.size();
int n=matrix[0].size();
int top=0;
int down=m-1;
int left=0;
int right=n-1;
int direction=0;
while(top<=down && left<=right){
... | ALGO | 0.999998 | 6.345106 |
2ff745a1-5152-46ad-9fb4-f138bd0d57c0 | saketh1999/DSA_MASTERY | 1263-number-of-dice-rolls-with-target-sum/number-of-dice-rolls-with-target-sum.cpp | class Solution {
public:
int mod = (int)pow(10, 9) + 7;
int solver(int dies,int k, int target, vector<vector<int>>&dp)
{
if(dies ==0 && target==0) return 1;
if(dies==0 || target<=0)return 0;
if(dp[dies][target]!=-1)
return dp[dies][target]%mod;
int ways=0;
for(int i=1;i<=k;i++)
... | ALGO | 0.999997 | 5.828285 |
4395b817-c883-4b22-a06b-f633bba03178 | Superm4n97/competetive-programming | Codeforces vol 04/1455B.cpp | #include<bits/stdc++.h>
#define ll long long int
#define show(x) cout << #x << " : " << x << endl
using namespace std;
ll perfect(ll n)
{
ll b = 1, e = 1000006 , ans = 1000006 ;
while(b<=e){
ll mi = (b+e)/2;
if (mi*(mi+1)/2>=n){
ans = min(ans,mi);
... | ALGO | 0.99961 | 4.496493 |
9449ddb2-bc9d-496c-ab3c-b10d2f9ebad3 | Kinjalrk2k/leetcode-sync | 560-subarray-sum-equals-k/subarray-sum-equals-k.cpp | class Solution {
public:
int subarraySum(vector<int>& nums, int k) {
int n = nums.size();
vector<int> pre(n+1, 0); // extra 'cause prefix
pre[0] = 0; // first is zero
int c = 0;
for(int i=1; i<pre.size(); i++) {
pre[i] = pre[i-1] + nums[i-1];
}
... | ALGO | 0.999907 | 5.920107 |
a05cdf42-4056-418f-8ebe-84a0e29b0b77 | Haiyang-W/RBGNet | pcdet/ops/pointnet2/pointnet2_stack/src/vector_pool.cpp | #include <torch/serialize/tensor.h>
#include <vector>
#include <THC/THC.h>
#include <cuda.h>
#include <cuda_runtime_api.h>
#include "vector_pool_gpu.h"
extern THCState *state;
#define CHECK_CUDA(x) do { \
if (!x.type().is_cuda()) { \
fprintf(stderr, "%s must be CUDA tensor at %s:%d\n", #x, __FILE__, __LINE__); ... | ALGO | 0.925851 | 6.066283 |
dda8b867-98d0-4bb8-b6d5-4675b4f3e9f8 | harsha123io/CSA0259-C-programming-for-game-developers | Maximum and Minimum value in a given array of numbers.cpp | #include <stdio.h>
int main() {
int arr[] = { 5, 8, 3, 1, 9, 2 };
int n = sizeof(arr) / sizeof(arr[0]);
int max = arr[0];
int min = arr[0];
// iterate through the array to find the max and min
for (int i = 1; i < n; i++) {
if (arr[i] > max) {
max = arr[i];
... | ALGO | 0.999852 | 4.545273 |
688b57da-284d-4d49-b76e-3649cfda02aa | DVC-COMSC/CS1A66-59e177 | main.cpp | #include "A66.hpp"
int main()
{
int num1, num2, num3;
int max, min;
getinput(num1, num2, num3);
cout << " Your input " << setw(5) << num1 << setw(5) << num2 << setw(5) << num3 << endl;
maxmin(num1, num2, num3, max, min);
cout << " Max, Min and Max-Min" << setw(5) << max << setw(5) << min << setw(5) << max - min ... | ALGO | 0.946742 | 4.21923 |
7fa0f899-3e9f-43b7-8dff-1e40fe52e11e | woohyman/tv_sink | 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 |
26cf41cb-b6ee-4922-9930-2a978a51b1b4 | zhang35/PAT-Advanced-Level | 1090.cpp | #include <iostream>
#include <vector>
#include <cmath>
using namespace std;
int maxDepth = 0;
int num = 0;
void dfs(vector<vector<int> > &e, int cur, int depth){
if (e[cur].size()==0){
if (depth > maxDepth){
maxDepth = depth;
num = 1;
}
else if (depth == maxDept... | ALGO | 0.999894 | 3.721918 |
2f295207-0fd3-4477-ad21-1b8a6f7eb2d3 | kumasento/VELVET-PROGRAMMING | WikiOI/Old/wiki_1098_Card.cpp | #include <iostream>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cmath>
using namespace std;
int main(){
freopen("1098.in", "r", stdin);
int N; cin>>N;
int Cards[N]; memset(Cards, 0, sizeof(Cards));
int sum = 0;
for(int i = 0; i < N; i++){
cin>>Cards[i];
sum += Cards[i];
}
int Average ... | ALGO | 0.999923 | 3.564578 |
7924b16a-ee24-4b86-8bee-853ef919676a | nayemuddinn/Competitive-programming | Codeforces/Binary Cafe.cpp | /**
.
author-> NATE
.
**/
#include<bits/stdc++.h>
using namespace std;
#define first_in_out ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define For(i,n) for(int i=0;i<n;i++)
#define For2(i,n) for(int i=1;i<=n;i++)
#define For3(i, j, n) for (int i = j; i <= n; i++)
#... | ALGO | 0.999678 | 3.955783 |
3e912298-b9e4-4800-8202-719ae9d23861 | SCOREC/nektar | solvers/IncNavierStokesSolver/Utilities/CFLStep.cpp | #include <cstdio>
#include <cstdlib>
#include <SolverUtils/Driver.h>
#include <LibUtilities/BasicUtils/SessionReader.h>
#include <IncNavierStokesSolver/EquationSystems/IncNavierStokes.h>
using namespace Nektar;
using namespace Nektar::SolverUtils;
int main(int argc, char *argv[])
{
if(argc != 2)
{
f... | ALGO | 0.909777 | 3.18564 |
d50fe98c-1835-405b-a166-31a7ba535ae3 | cleaton/platform_frameworks_av | media/libstagefright/codecs/amrwb/src/highpass_50hz_at_12k8.cpp | /*
------------------------------------------------------------------------------
Filename: highpass_50Hz_at_12k8.cpp
Date: 05/08/2004
------------------------------------------------------------------------------
REVISION HISTORY
Description:
---------------------------------------------------------------... | ALGO | 0.999952 | 5.747053 |
86c9d396-4533-4d91-9bea-d8570027abf7 | llukito/leetCode | 1828-queries-on-number-of-points-inside-a-circle/1828-queries-on-number-of-points-inside-a-circle.cpp | class Solution {
public:
vector<int> countPoints(vector<vector<int>>& points, vector<vector<int>>& queries) {
vector<int> ans;
for(int i=0; i<queries.size(); i++){
int num = 0;
int x = queries[i][0]; int y = queries[i][1]; int r = queries[i][2];
for(vector<int> ve... | ALGO | 0.999831 | 5.640299 |
a3cabf1d-c49a-417b-b524-a91e4914ff3b | xdai02/C_Plus_Plus | code/Chapter5/5-1/distance.cpp | #include <iostream>
#include <cmath>
using namespace std;
double square(double x) {
return x * x;
}
double distance(double x1, double y1, double x2, double y2) {
return sqrt(square(x1 - x2) + square(y1 - y2));
}
int main() {
double x1, y1, x2, y2;
cout << "Enter (x1, y1): ";
cin >> x1 >> y1;
... | ALGO | 0.999316 | 4.934846 |
bda57415-45f4-4d0e-b5a8-a9d83fdf1b27 | ShelpAm/competitive_programming | luogu/problem/P1551/main.cpp | #include <algorithm>
#include <array>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstddef>
#include <deque>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <string_view>
#include <uno... | ALGO | 0.999979 | 5.461796 |
25929ec4-c9e4-4bd9-9928-7eed920ddad0 | Al-amen/leetcode | 2163-minimum-difference-in-sums-after-removal-of-elements/2163-minimum-difference-in-sums-after-removal-of-elements.cpp | class Solution {
public:
long long minimumDifference(vector<int>& nums) {
int n3 = nums.size(), n = n3 / 3;
vector<long long> part1(n + 1);
long long sum = 0;
// max heap
priority_queue<int> ql;
for (int i = 0; i < n; ++i) {
sum += nums[i];
ql.... | ALGO | 0.999888 | 5.702765 |
76db165d-ce57-4edf-9964-76070410e25a | acorerhardell/ejemplos-cpp | Fracciones.cpp | #include<iostream>
class Fraccion
{
private:
int numerador;
int denominador;
public:
Fraccion(int numerador=1, int denominador=1);
Fraccion operator+(Fraccion otra);
Fraccion operator-(Fraccion otra);
Fraccion operator*(Fraccion otra);
Fraccion operator/(... | TOOL | 0.927975 | 4.723758 |
1bcbcac2-8d4c-4610-a4de-22d90191dacb | m4oughi/100DaysofCode | pureCPP/0037. Day 37/Standard Template Library Basics/023. Container Adapters - Queue/006. Reversing a Queue Using a Stack/main.cpp | #include <iostream>
#include <queue>
#include <stack>
void reverseQueue(std::queue<int>& q) {
std::stack<int> s;
// Move elements from queue to stack
while (!q.empty()) {
s.push(q.front());
q.pop();
}
// Move elements back to queue from stack
while (!s.empty()) {
q.pus... | ALGO | 0.999685 | 5.917799 |
922af78b-0097-4d59-987b-e411a217428f | CODEWARLORDx/WARLORD-S-REPO | pascal_triangle.cpp | #include <stdio.h>
int main() {
int rows, coef = 1;
printf("Enter the number of rows: ");
scanf("%d", &rows);
for(int i = 0; i < rows; i++) {
for(int space = 1; space <= rows - i; space++) {
printf(" ");
}
for(int j = 0; j <= i; j++) {
if(j == 0 || i == 0... | ALGO | 0.999493 | 3.990574 |
1ae45737-0ddc-4627-a921-f7d13d157d2a | Abdelaziz2811/DSA_LV1 | Arrays/BubbleSort.cpp | #include <iostream>
#include <vector>
using namespace std;
void Swap(vector<int>& nums, int i, int j) {
int temp = nums[i];
nums[i] = nums[j];
nums[j] = temp;
}
vector<int> SortArray(vector<int>& nums) {
for (short i = 0; i < nums.size(); i++) {
for (short j = 0; j < nums.size() - ... | ALGO | 0.999584 | 4.905664 |
bc88ba2f-0bbe-446d-ab63-498ae8736930 | pranjal021/LeetCode_Solutions | Easy/925-Long Pressed Name.cpp | class Solution {
public:
bool isLongPressedName(string name, string typed) {
int j=0;
for(int i=0;i<typed.length();i++){
if(name[j] == typed[i])
j++;
else if((i==0 && name[j]!=typed[i]) || (j > 0 && name[j-1] != typed[i]))
return false;
... | ALGO | 0.99979 | 5.783661 |
6002160a-2a8f-4034-9255-b2f5d266dfe7 | wgsylcl/OI-Template | docs/DS/code/P5631.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
typedef long long ll;
#define mid ((l + r) >> 1)
#define ls ((x) << 1)
#define rs ((x) << 1 | 1)
const int MAXN = 1e6 + 10, MAXM = 2e6 + 10, MAXV = MAXM << 2, MAXW = 1e5 + 1;
inline ll enc(int u, int v)
{
if (u > v) swap(u, v);
return 1ll * u * MAX... | ALGO | 0.999987 | 4.107479 |
66a5bdf3-93fe-4043-bad5-92576cba31dd | Varunkumar2516/DATASTRUCTURES | 1.ARRAY/DELETEELEMENT.cpp | #include <iostream>
using namespace std;
int main()
{
int a[20], n, pos, i, length;
cout << "Enter the number of Elements:: ";
cin >> n;
cout << "\nEnter the Elements of an Array:: ";
for (i = 0; i < n; i++)
{
cin >> a[i];
}
cout << "your array:: ";
for (i = 0; i < n; i++)
... | ALGO | 0.997075 | 3.211543 |
8c4ef538-0968-4ceb-8674-14a356885b64 | Nafyaz/my-codes | Codeforces/0977A.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n, k;
cin >> n >> k;
while(k--)
{
if(n%10 == 0)
n /= 10;
else
n--;
}
cout << n;
}
| ALGO | 0.999743 | 3.640429 |
99340679-e3fc-40f6-a776-76a7b6dcec68 | yogendrarp/leetcode | algorithms/450/stacks_queues/nearestgreatertoleft.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
vector<long> getNearestGreaterToLeft(vector<long> input)
{
vector<long> ngL;
stack<long> auxStack;
for (int i = 0; i < input.size(); i++)
{
if (auxStack.size() == 0)
{
... | ALGO | 0.999991 | 4.751574 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.