uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
ac0a4814-ddca-436c-bab2-7af6d3d4ba5d | oldlick/CompetitiveProgramming | atcoder/3 ABC/168/E.cpp | #include <cstdio>
#include <cmath>
#include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <queue>
#include <tuple>
using namespace std;
#define FOR(i,a,b) for(ll i=a;i<b;i++)
#define REP(i,n) for(ll i=0;i<n;i++)
#define REPR(i,n) for(ll i=n-1;i>=0;i--)
typedef long lon... | ALGO | 0.999835 | 4.014966 |
8b57fbfb-7bcc-4790-849a-cbd8cd9a13d5 | reallymanya/DSA | pattern problems/ques21.cpp | /* 1
2 2
*/
#include <iostream>
using namespace std;
int main(){
int n;
cin >> n;
int row = 1;
int num = 1;
while(row<=n){
//space print
int space = n - row;
while(space) {
cout<<" ";
space = space - 1;
}
//num
int... | ALGO | 0.999972 | 3.710526 |
a8daca6d-1a11-4485-816a-73bb7697a53f | senior-kapitoshka/Solutions | cpp/rot13.cpp | #include <string>
#include <unordered_map>
#include <algorithm>
std::string rot13(const std::string& str) {
using namespace std::literals;
std::string s ="ABCDEFGHIJKLMabcdefghijklm"s;
std::string c = "NOPQRSTUVWXYZnopqrstuvwxyz"s;
std::unordered_map<char,char> mp;
int i=0;
std::for_each(s.begin(... | ALGO | 0.999796 | 6.92478 |
511386e7-c633-40bc-941c-c82f8cb7562a | vfolunin/archives-solutions | Kattis/nonnegpartsums.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <string>
using namespace std;
bool solve() {
int n;
cin >> n;
if (!n)
return 0;
vector<int> prefixSum(n);
for (int &x : prefixSum)
cin >> x;
prefixSum.insert(pre... | ALGO | 0.999866 | 3.958753 |
92c2a684-af53-4d27-8fdf-6596e1a028b2 | Surenthirakumar/DS-Prgms | 01)reverse a 32 bit signed integers.cpp | #include <stdio.h>
#include <limits.h>
int reverseInt(int num) {
int reversed = 0;
while (num != 0) {
if (reversed > INT_MAX / 10 || reversed < INT_MIN / 10) {
return 0;
}
int digit = num % 10;
reversed = reversed * 10 + digit;
num /= 10;
}
... | ALGO | 0.999232 | 5.440082 |
5b7b083d-0c9a-4791-b928-fbdfb0c1193c | 24Pranav/Leetcode_practice | leetcode-main/leetcode-main/0236-lowest-common-ancestor-of-a-binary-tree/0236-lowest-common-ancestor-of-a-binary-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* fun(TreeNode* root, TreeNode* p, TreeNode* q)
{
//dfs
//Base Cas... | ALGO | 0.999976 | 5.908617 |
52b655ec-9df4-4521-94a6-7b51ffc3fea3 | helloobaby/llvm_msvc | mlir/lib/Dialect/Vector/Transforms/VectorTransferSplitRewritePatterns.cpp | #include <optional>
#include <type_traits>
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/Dialect/Utils/StructuredOpsUtils.h"
#include "mlir... | TOOL | 0.901437 | 7.470244 |
c4be9d03-59b8-4e0b-91e7-0cf287f9d0a1 | marekpetrik/craam2 | include/eigen3/doc/examples/class_Block.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
template<typename Derived>
Eigen::Block<Derived>
topLeftCorner(MatrixBase<Derived>& m, int rows, int cols)
{
return Eigen::Block<Derived>(m.derived(), 0, 0, rows, cols);
}
template<typename Derived>
const Eigen::Block<const Derive... | TOOL | 0.979352 | 5.865374 |
a859ccc5-0373-478f-891e-fa668d3e692a | akankshaaa08/Algorithms-in-CPP | Matrix/matrixMedian.cpp | /*
Assumption: The matrix is row wise sorted
T.C ==> O(r * log(max-min) * log c)
*/
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int median(vector<int> ar[], int row, int col)
{
int min = ar[0][0]; //the smallest element will be in first col
int max = ar[0][col-... | ALGO | 0.999989 | 4.734215 |
2e880df3-1333-48a9-aed2-0f2b15edb6b5 | lenaonisch/OBJ_DETECTOR | HierarhicalThreshold.cpp | #include "stdafx.h"
#include "HierarhicalThreshold.h"
void HierarhicalThreshold::Histogram(int L)
{
int histSize = L;
float range[] = { 0, 256 } ; //the upper boundary is exclusive
const float* histRange = { range };
bool uniform = true; bool accumulate = false;
cv::calcHist( &src, 1, 0, cv::Mat(), histogram, 1, ... | ALGO | 0.998754 | 5.131852 |
8fcacae4-0660-41b5-a5ab-cf6f439a5a11 | 4meM/pc_begining | winnerOfDados.cpp | #include <iostream>
using namespace std;
int main() {
int totalCase, cantWinM = 0, cantWinC = 0;
cin >> totalCase;
for(int i = 0; i < totalCase; i++ ){
int dado1, dado2;
cin >> dado1 >> dado2;
if (dado1 > dado2){
cantWinM ++;
}
else if (dado1 < dado2) {
... | ALGO | 0.999911 | 3.963837 |
f1e63116-8e8c-412e-8455-edb6ae6cf0d5 | izlyforever/cf | contest/1589/e/e.cpp | #include <bits/stdc++.h>
#define cerr(x) std::cerr << (#x) << " is " << (x) << '\n'
using LL = long long;
void solve() {
int n;
std::cin >> n;
std::vector<int> a(n);
for (auto &x : a) std::cin >> x;
std::vector<LL> s(n + 1);
for (int i = 0; i < n; ++i) {
s[i + 1] = s[i] + (i % 2 == 0 ? a[i] : -a[i]);
... | ALGO | 0.999761 | 4.619555 |
7e76635a-8035-4221-9e15-f98e7f5f25eb | kotabrog/mycode_competition | AtCoder_Problems/ABC/A/157_Duplex_Printing/main.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
cout << (n - 1) / 2 + 1 << endl;
} | ALGO | 0.997352 | 3.553182 |
78cef24e-d03b-4a6d-9367-2c2b441d5101 | rabelhmd/LeetCode | Missing number in array - GFG/missing-number-in-array.cpp | // { Driver Code Starts
// Initial template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function template for C++
class Solution{
public:
int MissingNumber(vector<int>& array, int n) {
sort(array.begin(), array.end());
for(int i = 0; i < n; i++)... | ALGO | 0.99982 | 5.355067 |
547bce91-d72f-4c57-b6c9-2fe0b33e999d | adarshjha01/Leetcode-questions | 0026-remove-duplicates-from-sorted-array/0026-remove-duplicates-from-sorted-array.cpp | class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int i=0; // for two pointer approach
for ( int j=1;j<nums.size();j++){
if(nums[i]!=nums[j]){
i++;
nums[i]=nums[j];
}
}
return i+1;
}
}; | ALGO | 0.999858 | 6.163408 |
add8188a-1b36-4f6d-bc7b-08cb4c792107 | yusifaliyevpro/Competitive-Programming | LeetCode/Medium/849. Maximize Distance to Closest Person.cpp | // 849. Maximize Distance to Closest Person
// https://leetcode.com/problems/maximize-distance-to-closest-person/
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
int maxDistToClosest(vector<int>& seats) {
}
}; | ALGO | 0.999707 | 5.553974 |
f66d22a1-7860-4082-bbcf-f4f038f6f3ab | madeihaarshad/Lab-04 | 02.cpp | #include <iostream>
#include <list>
using namespace std;
void printList(const list<int>& lst) {
for (const auto& element : lst) {
cout << element << " ";
}
cout << endl;
}
void customSort(list<int>& lst) {
lst.sort();
}
list<int> mergeLists(const list<int>& list1, const list<int>& list2) {
... | ALGO | 0.999916 | 5.348793 |
0cbb86d7-dd5e-47b7-bc73-aa7580460323 | raincross7/code-similarity | codes/train_code/problem163/problem163_336.cpp | #include <stdio.h>
#include<stdlib.h>
#define MAX 2000000
#define VMAX 10000
using namespace std;
int main()
{
unsigned short *A, *B;
int C[VMAX + 1];
int n, i, j;
scanf("%d", &n);
A = (unsigned short *)malloc(sizeof(unsigned short) * n + 1);
B = (unsigned short *)malloc(sizeof(unsigned shor... | ALGO | 0.999993 | 3.512091 |
99a19b6a-39f8-4406-8905-c9a8b75efcda | dhruvjoshi137/Data_Structures_Algorithms | Lecture8/CountSetBits.cpp | #include<iostream>
#include<cmath>
using namespace std;
int main(){
int n=15;
int cnt=0;
// for(int k=0;k<=31;k++){
// int mask = 1<<k;
// if((n & mask)>0){
// cnt++;
// }
// }
for(int k=0;k<=ceil(log2(n+1));k++){
int mask = 1<<k;
// if((n & mask... | ALGO | 0.999209 | 4.161157 |
44e285a5-05c6-499b-83fb-ce976bd11590 | opieproject/opie | core/multimedia/opieplayer/modplug/fastmix.cpp | #include "stdafx.h"
#include "sndfile.h"
#include <math.h>
#ifdef WIN32
#pragma bss_seg(".modplug")
#endif
// Front Mix Buffer (Also room for interleaved rear mix)
int MixSoundBuffer[MIXBUFFERSIZE*4];
// Reverb Mix Buffer
#ifndef NO_REVERB
int MixReverbBuffer[MIXBUFFERSIZE*2];
extern UINT gnReverbSend;
#endif
#ifnd... | ALGO | 0.957213 | 4.316276 |
442f7394-eb3e-4593-ad85-1f2e239d11ae | Nur-Jahan-Smrity/Problem_Solving | codeforces-contest/A. Juicer_(709).cpp | #include<iostream>
#include<bits/stdc++.h>
#include<vector>
#include<math.h>
using namespace std;
int main()
{
int x,y,z;
cin>>x>>y>>z;
int a[x+10],i,j,sum=0,count=0;
for(i=0;i<x;i++)
{
cin>>a[i];
if(a[i]>y)
continue;
sum+=a[i];
if(sum>z)
{
count... | ALGO | 0.999923 | 3.560073 |
b66eaae4-5e55-49e0-abcc-e0618ab702ec | nvs-abhilash/HackerEarth | Phase1/1_CubeChange/SIDDHARTH/my_code_1.cpp | #include<iostream>
using namespace std;
int main()
{
int T;
long long N;
cin >> T;
while(T!=0)
{
cin >> N;
if(N==1)
{cout<<1<<endl;}
else
{cout <<N*N*N-(N-2)*(N-2)*(N-2)<<endl;}
T--;
}
return 0;
}
| ALGO | 0.999874 | 3.521381 |
db4c7c94-af02-4d0e-9300-cebf8d383482 | Sanchronyx/Zero-Judge | d190_Age_Sort.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void){
int num{0};
while (cin >> num){
if (num == 0)break;
vector <int> arr(num, 0);
int n{0};
for (int i = 0; i < num; i++){
cin >> n;
arr[i] = n;
}
... | ALGO | 0.999946 | 4.641058 |
d2889979-bb2f-4ce8-ad08-688c94cc3c5f | muyuuuu/OnlineJudgeSolutions | leetcode/Tree/0105.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999991 | 6.771832 |
b3e28d2e-0cdf-4c73-b51b-91551126eb97 | SagarNarsingani/SDESheetChallenge | Day 4 - Arrays/SubarrayXOR.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;
// Time Complexity: O(N)
// Space Complexity: O(N).
int subarrayXOR(vector<int> arr, int x){
unordered_map<int, int> map;
int n = arr.size(), cnt=0;
int prefix = 0;
for(int i=0; i<n; i++){
// prefix of xor.
... | ALGO | 0.999909 | 5.907274 |
089299cc-06dd-4ff2-814b-e4091188887c | mn619/cf-practise | #628/e.cpp | #include<bits/stdc++.h>
#define FLASH cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(false);
#define F first
#define S second
#define pb push_back
#define int long long
#define maxn 200000
#define mod 1000000007
#define inf 1000000000000000000
#define fr(i,a,b) for(int i=a;i<b;i++)
#define FILEIO freopen("/home/a... | ALGO | 0.999243 | 3.324877 |
b550c19d-cbac-426b-b2ed-d6559160fda6 | adityadeshmukh10/Leetcode | 0120-triangle/0120-triangle.cpp | class Solution {
public:
int minimumTotal(vector<vector<int>>& triangle) {
int height = triangle.size();
// Using a vector of vectors for dynamic sizing
vector<vector<int>> dp(height, vector<int>(height, 0));
// Initialize the last row of dp
for (int i = 0; ... | ALGO | 0.999981 | 7.31228 |
85d75e63-136a-4795-b6cb-ca4c42f0be92 | JJungs-lee/problem-solving | LeetCode/217. Contains Duplicate.cpp | class Solution {
public:
bool containsDuplicate(vector<int>& nums) {
unordered_set<int> hash_table;
for (int n : nums) {
if (hash_table.find(n) != hash_table.end())
return true;
else
hash_table.insert(n);
}
return false;
}
}; | ALGO | 0.999652 | 6.117493 |
ea284452-7bb1-4f98-a99f-4df2db8a778f | fractal-platform/fractal-cdt | tools/llvm/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp | #include "llvm/ADT/APInt.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/ISDOpcodes.h"
#include "llvm/CodeGen/MachineMemOperand.h"
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/CodeGen/SelectionDAGNodes.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/CodeGen... | ALGO | 0.980313 | 5.640704 |
b576861e-5e79-43c9-a28c-f1061890e39d | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_2039_0.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 1010;
struct Two_Set {
int n;
vector<int> G[maxn << 1];
bool mark[maxn << 1];
int s[maxn], c;
void init(int n) {
this->n = n;
for (int i = 0; i < (n << 1); i++) G[i].clear();
memset(mark, 0, sizeof(mark));
}
void add(int x, int v1,... | ALGO | 0.999991 | 3.580506 |
0b0c91ec-4071-4f7e-871d-10954e208300 | umakanwar/cpp_batch_s | 8 august assignment/Q18.cpp | //Write a C++ function that takes a four-digit number as input and uses nested if-else
//statements to determine if it is a palindrome and if its digits form an arithmetic progression.
#include <bits/stdc++.h>
using namespace std;
void checkNumber(int num) {
if (num < 1000 || num > 9999) {
cout << "The nu... | ALGO | 0.999096 | 5.73232 |
bf2ebda8-e4ac-400f-ba2b-159ace809338 | erickborquez/competitive-programming | code-forces/630 div 2/A.cpp | #include <bits/stdc++.h>
#define ENDL '\n'
#define pb push_back
#define F first
#define S second
#define deb(u) cout << #u ": " << (u) << endl;
#define lli long long
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t, a, b, c, d;
cin >> t;
while (t--)
{
... | ALGO | 0.998052 | 3.396589 |
96e20752-0a5b-4b4c-84a8-cd82a624ca95 | tejaspatil1936/cpp-codes | DSA/Recursion/Nto1_RecursionBacktracking.cpp | #include <bits/stdc++.h>
using namespace std;
void printNum(int Num, int MyCount)
{
if (Num < MyCount)
{
return;
}
printNum(Num, ++MyCount);
cout << --MyCount << endl;
}
int main()
{
int Num, MyCount = 1;
cout << "Enter the number : ";
cin >> Num;
printNum(Num, MyCount);
... | ALGO | 0.999887 | 3.610268 |
585fdfb0-7f98-422c-aecb-4facf7c534a8 | pcw109550/problem-solving | LeetCode/daily-temperatures.cpp | // 739. Daily Temperatures
#include <iostream>
#include <vector>
#include <stack>
using namespace std;
class Solution {
public:
vector<int> dailyTemperatures(vector<int>& temperatures) {
// O(N)
int N = temperatures.size();
vector<int> result (N, 0);
stack<int> S;
for (int i... | ALGO | 0.999916 | 6.395971 |
0260d576-baa6-4166-82b6-30e16ad0dd2a | deepfabric/vectodb | faiss/IndexBinaryHNSW.cpp | // -*- c++ -*-
#include <faiss/IndexBinaryHNSW.h>
#include <memory>
#include <cstdlib>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <omp.h>
#include <unordered_set>
#include <queue>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdint.h>
#include <f... | ALGO | 0.999427 | 7.192654 |
f6473d73-3e34-4208-b75f-f6fc56c87c52 | hhh07/multi_nat | ctcdecode/third_party/boost_1_67_0/libs/graph/example/edge_property.cpp | #include <boost/config.hpp>
#include <iostream>
#include <boost/utility.hpp>
#include <boost/property_map/property_map.hpp>
#include <boost/graph/adjacency_list.hpp>
using namespace boost;
using namespace std;
enum edge_myflow_t { edge_myflow };
enum edge_mycapacity_t { edge_mycapacity };
namespace boost {
BOOST_... | ALGO | 0.994718 | 5.39224 |
17908cea-413e-4d0c-9a36-f52fac51b37a | debarshi-statsforever/Semi-Supervised-Clustering | calc_parallel.cpp | #include <RcppArmadillo.h>
#include <iostream>
#define USING_OPENMP 1
#define USING_W_MINIMAL 1
#if USING_OPENMP
// [[Rcpp::plugins(openmp)]]
#pragma omp declare reduction(+ : arma::mat : omp_out += omp_in) \
initializer(omp_priv = omp_orig)
#endif
double logdens_g_minimal(const arma::vec& hx, const arma::vec& mu_... | ALGO | 0.999991 | 5.668751 |
4fd8184a-fe98-4fda-9ffe-3e55799a76e7 | NadeemGulam/Cpp_ | Append_last_k_nodes_in_linkedlist.cpp | #include <bits/stdc++.h>
using namespace std;
class node
{
public:
int data;
node *next;
node(int val)
{
data = val;
next = NULL;
}
};
void insertAtTail(node *&head, int val)
{
node *n = new node(val);
if (head == NULL)
{
head = n;
return;
}
node... | ALGO | 0.999799 | 3.936794 |
bb16ac22-4562-4d5d-92ca-d7f204821bd8 | kassane/zig-mos-bootstrap | llvm/utils/FileCheck/FileCheck.cpp | #include "llvm/FileCheck/FileCheck.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/InitLLVM.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Process.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/Support/WithColor.h"
#include "llvm/Support/raw_ostream.h"
#include <cmath>
#include ... | TOOL | 0.87262 | 7.088843 |
2989a96c-fd3c-4526-8322-a04431aa80d8 | kovidgoyal/calibre | src/calibre/utils/imageops/ordered_dither.cpp | #include "imageops.h"
// Just in case, as I don't want to deal with MSVC madness...
#if defined _MSC_VER && _MSC_VER < 1700
typedef unsigned __int8 uint8_t;
#define UINT8_MAX _UI8_MAX
typedef unsigned __int32 uint32_t;
#else
#include <stdint.h>
// on older compilers this definition is missing
#ifndef UINT8_MAX
#define... | ALGO | 0.914656 | 6.725745 |
4e75a418-05ac-438a-9773-2009c0bf29d8 | sreakdgeek/Model-Predictive-Control | src/Eigen-3.3/doc/examples/Tutorial_ArrayClass_accessors.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
ArrayXXf m(2,2);
// assign some values coefficient by coefficient
m(0,0) = 1.0; m(0,1) = 2.0;
m(1,0) = 3.0; m(1,1) = m(0,1) + m(1,0);
// print values to standard output
cout << m << endl << endl;
... | ALGO | 0.937598 | 3.536336 |
27832657-b778-4ce1-a3c9-e19067916be3 | suyogschavan/p | daa/cpp/mergesort.cpp | #include <iostream>
#include <vector>
#include <thread>
#include <chrono>
#include <algorithm>
using namespace std;
using namespace chrono;
// Merge function for merge sort
void merge(vector<int>& arr, int left, int mid, int right) {
int n1 = mid - left + 1;
int n2 = right - mid;
vector<int> L(n1), R(n2);... | ALGO | 0.999636 | 6.713738 |
bdc3b364-e70e-4c59-8f25-77e96029ddca | odon8411/iOSDev | arm/opencore-amr-0.1.3/opencore/codecs_v2/audio/gsm_amr/amr_nb/common/src/pow2.cpp | /*
Filename: pow2.cpp
------------------------------------------------------------------------------
*/
/*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "pow2.h"
#include "basic_op.... | ALGO | 0.998314 | 6.258036 |
cf05a14f-a7e6-475a-89c6-601d127b3e51 | akashghadge/competitive-programming | CodeForces/810/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define en "\n"
#define ll long long
#define v vector
#define vi vector<int>
#define vll vector<ll>
#define vii vector<vector<int>>
#define pii pair<int, int>
#define vpi vector<pair<int, int>>
#define FAST \
ios_base::sync_with_stdio(false); \
... | ALGO | 0.999251 | 4.911129 |
1aee024d-b813-42a3-aaba-94c4f389095d | aadityesh/neetcode-150 | 268-missing-number/missing-number.cpp | class Solution {
public:
int missingNumber(vector<int>& nums) {
int missing = 0;
int present = 0;
int n = nums.size();
for (int i = 0; i <= n; i++) {
missing ^= i;
if (i < n)
present ^= nums[i];
}
return present ^ missing;
... | ALGO | 0.999964 | 5.772128 |
077c0187-5733-476c-bca8-b5e4d6f7be31 | Ayushluthra2001/DataStructurewithAyushluthra | Operations on Queue.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution{
public:
//Function to push an element in queue.
void enqueue(queue<int> &q,int x)
{
//Your code here
q.push(x);
... | ALGO | 0.998814 | 4.812244 |
da64e0a6-1ffe-458c-bba8-8b4458b86a7a | anonymous-1066593/project_appendix | subtyping_implementation/src/type_generator.cpp | #include <random>
#include <vector>
#include <set>
#include <algorithm>
#include "assert.h"
#include "graph.hpp"
#include "type.hpp"
#include "sort.hpp"
Sort random_sort(std::mt19937 &rng) {
switch(rng() % 3) {
case 0:
return Sort::Bool;
case 1:
return Sort::Int;
ca... | TOOL | 0.895231 | 5.864628 |
4a6d94ef-7141-4684-88ea-e21eb242973b | shreyanshanchlia/Compiler-Design | ignore spaces/ignore spaces_0.cpp | //Design a lexical analyzer for given language and the lexical analyzer should ignore redundant spaces, tabs and new lines.
//It should also ignore comments. Although the syntax specification states that identifiers can be arbitrarily long,
//you may restrict the length to some reasonable value.
#include<bits/stdc++... | ALGO | 0.986791 | 4.054974 |
a5b703af-5a2d-4507-a653-eda8517af31e | Anatoliiiii/Graphs | Sourse.cpp | #include<iostream>
#include <vector>
#include "Graph.h"
using namespace std;
int main()
{
CGraph<int> * graph = new CGraph<int>(1);
graph->AddVertex(1);
graph->AddVertex(2);
graph->AddVertex(3);
graph->AddVertex(4);
graph->AddVertex(5);
graph->AddVertex(6);
Iterator<int, CGraph<int>> *it = graph->Creat... | ALGO | 0.971183 | 3.85495 |
0ddce6e6-b289-495b-923e-7e83ac62cda4 | hdanao86/MKPITS_Harshal_Danao_Java_Mar_2021 | C_Programs/primenumberrange.cpp | /* Write a program in C to find the prime numbers within a range of numbers.
Input starting number of range: 1
Input ending number of range : 50
Expected Output :
The prime number between 1 and 50 are :
2 3 5 7 11 13 17 19 23 29 31 37 41 43 47 */
#include<stdio.h>
int main()
{
int num,rem,sno,eno,cnt;
printf("\n ent... | ALGO | 0.999551 | 3.748355 |
7230e10a-cc08-48b8-a3e3-b8b898a3d9c6 | Krozark/Harpe | Harpe/harpe/execution/local.cpp | #include "../parser_mgf/parser.hpp"
#include "../analyseur/analyseur_peptide.hpp"
#include "../score_evo/Engine/src/random.hpp"
#include "../sql/config.hpp"
#include "local.hpp"
#ifdef APPRENTISSAGE
#include "../score_evo/IndividuTree.hpp"
#include "../score_evo/Engine/src/GeneticEngine.hpp"
#endif
using namespace st... | TOOL | 0.870719 | 3.150151 |
e36654b1-5d35-490e-be2c-c3010e84e542 | yzcmf/Interview | LeetCode-Solutions/C++/longest-line-of-consecutive-one-in-matrix.cpp | // Time: O(m * n)
// Space: O(n)
class Solution {
public:
int longestLine(vector<vector<int>>& M) {
if (M.empty()) {
return 0;
}
int result = 0;
vector<vector<vector<int>>> dp(2, vector<vector<int>>(M[0].size(), vector<int>(4)));
for (int i = 0; i < M.size(); ++... | ALGO | 0.999959 | 5.989347 |
3f25bf93-2378-40e1-9492-d000f524e837 | itsoulos/GrammarNN | INTERVAL/intervalpso.cpp | #include "intervalpso.h"
# include <stdlib.h>
IntervalPso::IntervalPso(IntervalProblem *p)
{
problem = p;
plist.addParam(Parameter("pso_particles",500,10,1000,"Number of particles"));
plist.addParam(Parameter("pso_iterations",200,10,2000,"Number of iterations"));
plist.addParam(Parameter("pso_c1",0.1,0.... | ALGO | 0.999863 | 5.661309 |
59813471-1cda-4179-b1f1-9ef01a1ee330 | Saifur-Rahman03/Codes | Codes/2-2/CSE 2202/Lab Final Preparation/Comparing merge and quick.cpp | #include <bits/stdc++.h>
#include <iostream>
#include <fstream>
#include <random>
#define MAXINT 65535
using namespace std;
long long int n = 10;
long long int c = 0;
long long int partitionFunction(int *a, int l, int h);
void quickSortFunction(long long int *a, long long int l, long long int h);
void mergeFunction(lo... | ALGO | 0.999644 | 3.886381 |
90f0bbb3-dd5b-4fa3-ae49-eb524aa628b0 | guohaomeng/mycode-c- | OJ/2049.cpp | #include <iostream>
#include <iomanip>
using namespace std;
double jiecheng(double n)
{
double sum = 1;
for (double i = 1; i < n; i++)
{
sum = sum/i;
}
return sum;
}
int main()
{
double e = 0;
for (double i = 1;; i++)
{
double m = jiecheng(i);
if (m < 0.000001)
... | ALGO | 0.999939 | 3.613965 |
6d8f7f12-87cd-4273-810e-8f6e69450cb5 | sarvex/leetcode-typescript | solution/0400-0499/0458.Poor Pigs/Solution.cpp | class Solution {
public:
int poorPigs(int buckets, int minutesToDie, int minutesToTest) {
int base = minutesToTest / minutesToDie + 1;
int res = 0;
for (int p = 1; p < buckets; p *= base) ++res;
return res;
}
}; | ALGO | 0.997285 | 6.0089 |
87462d7b-b2b9-4ecd-a900-0b7467c04a8b | SJRLL/jianzhi-offer | 剑指offer--数值的整数次方/Test.cpp |
//Ŀһdouble͵ĸbaseint͵exponentbaseexponentη ֤baseexponentͬʱΪ0
//˼·٣ѧʽƵһnηnΪżʱΪaĶ֮1ηnΪżʱΪaĶ֮1һ1ηȻݹ⡣
class Solution {
public:
double Power(double base, int exponent) {
if (base == 1)
{
return base;
}
if (exponent == 0)
{
return 1;
}
double result = Power(base, exponent >> 1);
result *= result;
i... | ALGO | 0.999876 | 5.349141 |
bcd5e844-53f6-4025-ac2a-a9c8de29fb48 | Livinfly/AlgorithmPromble_Code | Codeforces/2023/1807/e.cpp | // #pragma GCC optimize(2)
#include <bits/stdc++.h>
#define fi first
#define se second
#define mkp(x, y) make_pair((x), (y))
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long LL;
typedef double db;
typedef pair<int, int> PII;
void solve() {
int n; cin >> n;
vector<int> a(n+1), s(... | ALGO | 0.999649 | 3.494909 |
4066900d-321d-460b-9ba6-0afc32dab415 | Farhana-Najnin/Algorithm | conceptual session/exam_special_session_week-1/binary_sesarch(leetcode).cpp | Class solution{
public:
int search(vector<int>&&nums,int target){
int low=0,high=nums.size()-1;
int mid;
while(low<=high){
mid=(low+high)/2;
if(nums[mid]==target){
return mid;
}
else if(nums[mid]<target){
low=mid+1;
}
else{
... | ALGO | 0.999905 | 6.002751 |
a48c76b0-2f1b-4c91-9a9f-9e5cad88b807 | soybean33/BAEKJOON | 2174 로봇 시뮬레이션.cpp | #include <iostream>
#include <vector>
// 방향벡터 -> 우 하 좌 상
constexpr int dirY[4] = { 0, 1, 0, -1 };
constexpr int dirX[4] = { 1, 0, -1, 0 };
struct Coordinate { // Coordinate: 좌표
int y, x;
};
struct Robot { // Robot: 로봇의 정보
Coordinate coordi; // coordi: 좌표
int dir; // dir: 방향
};
struct Order { // Order: 명령
int nu... | ALGO | 0.999948 | 5.820876 |
fb538b72-fb8a-4285-8aae-5bf9241734f9 | x007dwd/dso-stn | src/stn/ransac.cpp | // #include "base-precomp.h" // Precompiled headers
//
#include "stn/ransac.h"
#include "stn/randomGenerator.h"
// #include <mrpt/math/ops_vectors.h>
// #include <mrpt/math/CMatrix.h>
// #include <mrpt/math/CMatrixD.h>
// #include <mrpt/math/ops_matrices.h>
// #include <mrpt/random.h>
//
// using namespace mrpt;
// us... | ALGO | 0.999016 | 7.318585 |
6d66365d-5cc5-471e-8209-f1f4c85d607a | exitinfo/Algorithm | 15814.cpp | #include<bits/stdc++.h>
using namespace std;
char A[100];
char tmp;
int main(){
int t,a,b;
scanf("%s", A);
scanf("%d", &t);
for(int i=0; i<t; i++)
{
scanf("%d %d", &a, &b);
tmp = A[a];
A[a] = A[b];
A[b] = tmp;
}
printf("%s\n", A);
return 0;
}
| ALGO | 0.999952 | 3.576537 |
7d9bad02-c386-4998-87cb-896412808592 | djl70/cs5346-project2-checkers | cs5346-project2-checkers/heuristic_DK.cpp | #include "checkerboard.h"
#include "heuristic_DK.h"
std::vector<DKHeuristic::PieceInfo> DKHeuristic::getPiecesInfo(const checkerboard::Checkerboard& board) const {
std::vector<DKHeuristic::PieceInfo> info;
for (int r = 0; r < 8; ++r)
{
for (int c = 0; c < 8; ++c)
{
if ((r + c) % 2 == 1)
{
const Check... | ALGO | 0.996907 | 5.512876 |
7bddedf5-172c-44dc-b5f3-fdd1a4e6ff83 | raincross7/code-similarity | codes/train_code/problem237/problem237_317.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using P = pair<int,int>;
#define rep(i,n) for(ll i = 0;i < (ll)n;i++)
#define ALL(x) (x).begin(),(x).end()
#define MOD 1000000007
int main(){
int n,m;
cin >> n >> m;
vector<vector<ll>> v(n,vector<ll>(3));
rep... | ALGO | 0.999977 | 3.956371 |
981e1d03-f83b-4d27-a786-fbd18db0778c | kanishkachaudhary-03/flight-management-system- | boost_1_88_0/libs/math/test/git_issue_959.cpp | #include <iostream>
#include <array>
#include <vector>
#include <boost/math/interpolators/bezier_polynomial.hpp>
using tControlPoints = std::vector<std::array<double, 3>>;
void interpolateWithPoints(tControlPoints cp)
{
const auto cpSize = cp.size();
auto bp = boost::math::interpolators::bezier_polynomial(std... | ALGO | 0.962649 | 5.225416 |
fd9d7cfd-c0e1-4320-8479-f85d0322237c | ishandutta2007/codeforces | hank55663/normal/1624/F.cpp | #include<bits/stdc++.h>
#define pb push_back
#define x first
#define y second
#define pdd pair<double,double>
#define pii pair<int,int>
#define pll pair<LL,LL>
#define mp make_pair
#define LL long long
#define ULL unsigned long long
#define sqr(x) ((x)*(x))
#define pi acos(-1)
#define MEM(x) memset(x,0,sizeof(x))
#defi... | ALGO | 0.999319 | 3.329752 |
05aea9c5-45f0-45bb-92ae-adb62636fc14 | ktekchan/Summer | DataStructures/queues/queueStack.cpp | /*
* Author: Khushboo Tekchandani
* Implement a stack using two queues
* Idea: Have two queues. To push: Enqueue in q2, dequeue everything from q1
* and enqueue to q2. Swap the names of q1 and q2
*/
#include <iostream>
#include <queue>
using namespace std;
class queueStack{
private:
queue<int> q1... | ALGO | 0.999205 | 5.337104 |
f6123eae-fafb-4bff-9527-92957a3c5e6a | bonizario/cp | problems/hackerrank/one-week-preparation-kit/day-5-balanced-brackets.cpp | #include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
string isBalanced(string s) {
stack<char> stk;
bool valid = true;
for (auto c : s) {
if (c == '(' || c == '[' || c == '{') {
stk.push(c);
} else {
if (stk.empt... | ALGO | 0.999114 | 6.404691 |
56e6d715-856f-40f7-b1ba-6974c654f3d6 | ishandutta2007/codeforces | timmyfeng/normal/1404/C.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 1;
int ans[N];
int a[N];
struct node {
int mn, ndx, lazy;
void apply(int a, bool b) {
if (b) {
mn += a;
lazy += a;
} else {
mn = a;
lazy = 0;
}
}
node combine(const node& oth) {
if (mn < oth.mn) {
... | ALGO | 0.99999 | 4.100172 |
118a3b1c-bf6c-4c49-8b3f-5f9d02d109d7 | ishandutta2007/codeforces | mhq/normal/1537/E2.cpp | #ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
//#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
typedef long long ll;
vector<int> z_function (string s) {
int n = (int) s.length();
vector<int> z (n);
for (int i=1, l=0, r=0; i<n; ++i) {
if (i <= r)
... | ALGO | 0.999996 | 4.100258 |
f47e8a2f-edce-4b64-8794-0426fc47a0fa | aniketraz/leetcodec- | 0207-course-schedule/0207-course-schedule.cpp | enum class State { kInit, kVisiting, kVisited };
class Solution {
public:
bool canFinish(int numCourses, vector<vector<int>>& prerequisites) {
vector<vector<int>> graph(numCourses);
vector<State> states(numCourses);
for (const vector<int>& prerequisite : prerequisites) {
const int u = prerequisit... | ALGO | 0.999819 | 6.721262 |
654a147b-7c67-4df1-b31c-2a1fe54f0a42 | Simranjakhodia/DSA | Arrays/SortArrayByRecursion.cpp | #include<bits/stdc++.h>
using namespace std;
void insert(vector<int>& v, int x) {
if(v.size() == 0 || v[v.size()-1] <= x) {
v.push_back(x);
return;
}
int temp = v[v.size()-1];
v.pop_back();
insert(v, x);
v.push_back(temp);
}
void sort(vector<int>& v) {
if(v.size() == 1)
... | ALGO | 0.999945 | 5.548207 |
419f034a-8897-4567-bfd4-03c546f5f082 | thiago-sydow/AndroidRobotCamera | jni/cv/src/cvundistort.cpp | #include "_cv.h"
static CvStatus
icvUnDistort_8u_CnR( const uchar* src, int srcstep,
uchar* dst, int dststep, CvSize size,
const float* intrinsic_matrix,
const float* dist_coeffs, int cn )
{
int u, v, i;
float u0 = intrinsic_matrix[2], v0 = intrins... | ALGO | 0.98912 | 5.836969 |
e7912261-3454-4ea1-ac7c-71489fed08db | Fadilurehman/Flutter-UI | 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.998859 | 6.785645 |
e6792396-a303-4f35-82da-244d8b4ff219 | Ali-Noghabi/QR-Factorization | eigen-3.4.0/doc/examples/class_CwiseUnaryOp_ptrfun.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
// define function to be applied coefficient-wise
double ramp(double x)
{
if (x > 0)
return x;
else
return 0;
}
int main(int, char**)
{
Matrix4d m1 = Matrix4d::Random();
cout << m1 << endl << "becomes: " << endl << ... | ALGO | 0.972092 | 4.120226 |
f77850e8-3230-43d4-bb0e-c99d224bda58 | Tahsin005/Problem-Solving | Week 25+/Spell_Splice.cpp | /*
Author: tahsin_ferdous
Email: <EMAIL>
Qué mirás, bobo? Qué mirás, bobo?…
*/
#include<bits/stdc++.h>
#define OJ
using namespace std;
#define ll long long
#define cyes cout << "YES" << '\n'
#define yes cout << "Yes" << '\n'
#define cno cout << "NO"<< '\n'
#define no cout << "No"<< '\... | ALGO | 0.999908 | 3.974031 |
79e7a100-c0ca-4c60-aaf5-418208cacb2a | oaugusto/heuristic-assignment | src/Graph.cpp | //
// Created by Otavio Augusto de O. Souza on 4/14/2018.
// modified: 08/27/2018
//
#include "../include/Graph.h"
bool Graph::is_edge(v_T source, v_T destination) const {
auto it = find(edges[source].cbegin(), edges[source].cend(), Edge(source, destination));
return it != edges[source].end();
}
Edge Graph:... | ALGO | 0.976627 | 4.65281 |
62437689-51a6-42e8-96c6-be02da41a3dd | ishandutta2007/codeforces | qwqcorz/normal/1036/E.cpp | #include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e3+5;
int read()
{
int s=0;
char c=getchar(),lc='+';
while (c<'0'||'9'<c) lc=c,c=getchar();
while ('0'<=c&&c<='9') s=s*10+c-'0',c=getchar();
return lc=='-'?-s:s;
}
void write(int x)
{
if (x<0)
{
putchar('-');
x=-x;
}
if (x<10)... | ALGO | 0.999498 | 3.745254 |
0d27c21c-dcc4-481b-8521-ff92777a2333 | whwofla/ch02 | ch02/7-2.cpp | #include <stdio.h>
#include <stdlib.h>
#include <memory.h>
typedef struct treeNode {
int size;
struct treeNode* left;
struct treeNode* right;
} treeNode;
int FolderSize = 0;
treeNode* makeRootNode(int size, treeNode* leftNode, treeNode* rightNode) {
treeNode* root = (treeNode*)malloc(sizeof(treeNode));
root->si... | ALGO | 0.854988 | 3.742439 |
d21efe26-5a8f-4a14-b1db-0c197c29d81e | ecoinchain/ecoin | src/timedata.cpp | #if defined(HAVE_CONFIG_H)
#include <config/bitcoin-config.h>
#endif
#include <timedata.h>
#include <netaddress.h>
#include <sync.h>
#include <ui_interface.h>
#include <util.h>
#include <utilstrencodings.h>
#include <warnings.h>
static CCriticalSection cs_nTimeOffset;
static int64_t nTimeOffset = 0;
/**
* "Never g... | TOOL | 0.898675 | 6.585495 |
af3c4c26-8720-42fc-83d5-7e83fda4958c | ilkos/uva | uva10364-Square/src/uva10364-Square.cpp | //============================================================================
// Name : uva10364-Square.cpp
//============================================================================
#include <iostream>
#include <vector>
#include <algorithm>
#include <bitset>
using namespace std;
bool isTargetPossible(con... | ALGO | 0.999684 | 5.340355 |
865a3fc8-0518-4640-80d2-68c551605742 | Ajay35/LeetCode-Practice | 2327-number-of-people-aware-of-a-secret/2327-number-of-people-aware-of-a-secret.cpp | class Solution {
public:
int peopleAwareOfSecret(int n, int delay, int forget) {
map<int, long long> delay_map;
map<int, long long> forget_map;
int mod = 1000000007;
delay_map[1 + delay] = 1;
forget_map[1 + forget] = 1;
long long people_know = 1l, people_sh... | ALGO | 0.99998 | 4.986596 |
d94671b8-095f-4404-82ab-c12e00f0ddfc | g-j-chen/gina | Codeforces/Hulk.cpp | #include <iostream>
#include <string>
int main() {
int n;
std::cin >> n;
std::string s = "I hate";
for(int i = 2; i <= n; i++) {
if(i % 2 == 0) {
s.append(" that I love");
} else {
s.append(" that I hate");
}
}
s.append(" it");
std::cout << s;
return 0;
} | ALGO | 0.999437 | 3.183323 |
d2605997-6bec-4874-9f4c-2a93ef16e6b4 | Eng-Mo/CarND-Extended-Kalman-Filter | src/tools.cpp | #include <iostream>
#include "tools.h"
using Eigen::VectorXd;
using Eigen::MatrixXd;
using std::vector;
Tools::Tools() {}
Tools::~Tools() {}
VectorXd Tools::CalculateRMSE(const vector<VectorXd> &estimations,
const vector<VectorXd> &ground_truth) {
/**
TODO:
* Calculate the RMSE... | ALGO | 0.99112 | 5.649298 |
3c35f0b6-c892-4736-a029-ed6f6dae5d06 | chenjintang-shrimp/tctm | 1/main.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int a[1001];
int main()
{
int n,m;
cin >> n >> m;
for (int i = 1; i <= n; i++)
cin >> a[i];
for (int i = 1; i <= n; i++)
a[i] = a[i - 1] + a[i];
for (int i = 1; i <= m; i++)
{
int l, r;
cin >> l >> r;
cout << a[r] - a[l - 1] << endl;
}
retu... | ALGO | 0.99985 | 3.698156 |
c4f18e63-8793-49d2-855b-372d7fa6616d | 12345231534/DSA_PTIT | 6008.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >>t;
while(t--){
int n, m;
cin >>n>>m;
int a[n], b[m];
for (int i=0;i<n;i++){
cin >>a[i];
}
for (int i=0;i<m;i++){
cin >>b[i];
}
sort(a,a+n);
sort(b,b+m);
int cnt =0;
for (int i=0;i<n;i++){
for(int j= 0;j<m;j++){
... | ALGO | 0.999949 | 3.577394 |
457a1b40-bf4c-4fc0-ac5d-d30f40015ca3 | TanishkaHiray/Flutter | Stateful/QuizApp/flutter_application_/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.997718 | 6.76775 |
6ce89f81-429e-4f45-b87b-eff1ba9b269e | ishandutta2007/codeforces | batrr/normal/142/C.cpp | #include <bits/stdc++.h>
/*
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
*/
#define ll long long
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define IOS ios_base::sync_with_std... | ALGO | 0.999919 | 3.47932 |
a604f58e-baec-4226-9b78-ab9c4d207e70 | luwei0917/GlpG_Nature_Communication | src/USER-DPD/fix_shardlow.cpp | /* ----------------------------------------------------------------------
Contributing authors:
James Larentzos (U.S. Army Research Laboratory)
and Timothy I. Mattox (Engility Corporation)
Martin Lisal (Institute of Chemical Process Fundamentals
of the Czech Academy of Sciences and J. E. Purkinje Univer... | ALGO | 0.998596 | 5.945571 |
4b40b0f6-62c6-4eac-836b-6e13681bd47d | mihawk2010/MyHihocoder | ProgrammingBeauty/P1/main.cpp | #include <iostream>
#include <string>
#include <map>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
map<string, int> Month = {{"January", 1}, {"February",2}, {"March", 3}, {"April", 4},
{"May", 5}, {"June", 6}, {"July", 7}, {"August", 8}, {"September", 9},
{"Octobe... | ALGO | 0.999181 | 4.169842 |
b469b78e-d8e4-46b4-9a7e-bb2de2a088a4 | QTune1603/LCOJ | UOC2.cpp | #include <bits/stdc++.h>
using namespace std;
#define ms(s,n) memset(s,n,sizeof(s))
#define all(a) a.begin(),a.end()
#define sz(a) int((a).size())
#define f0(i,n) for (int i=0; i<n; i++)
#define f1(i,n) for (int i=1; i<=n; i++)
#define FastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#de... | ALGO | 0.99983 | 4.245381 |
1a82e994-d1dc-4364-a929-0b9ad1b7e346 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_4138_12.cpp | #include <bits/stdc++.h>
using namespace std;
inline pair<int, int> merge(pair<int, int> x, pair<int, int> y) {
if (!x.second) return y;
if (!y.second) return x;
if (x.first == y.first) return pair<int, int>(x.first, x.second + y.second);
return (x.first < y.first) ? x : y;
}
namespace SGT {
long long sumv[5000... | ALGO | 0.999984 | 4.216442 |
d109c77f-bec7-44a5-b128-43976cff0f90 | karibshams/hackerrankcode | (HACKERRANK) Is This a Binary Search Tree.cpp | /* Hidden stub code will pass a root argument to the function below. Complete the function to solve the challenge. Hint: you may want to write one or more helper functions.
The Node struct is defined as follows:
struct Node {
int data;
Node* left;
Node* right;
}
*/
bool checkBST(Node* root) {
static Node ... | ALGO | 0.999699 | 4.216774 |
3921e83f-3eb4-4312-9afc-85570aefe840 | NearlyTRex/Boost | libs/bimap/example/tutorial_modify_and_replace.cpp | // VC++ 8.0 warns on usage of certain Standard Library and API functions that
// can be cause buffer overruns or other possible security issues if misused.
// See https://web.archive.org/web/20071014014301/http://msdn.microsoft.com/msdnmag/issues/05/05/SafeCandC/default.aspx
// But the wording of the warning is mis... | TEST | 0.853838 | 5.960849 |
eabb2d8d-347d-47e5-a36e-f54e07cca90c | mamun4122/My-Online-Judge-Submission | Codeforces/2014 Syrian Collegiate Programming Contest (SCPC 14) - 100500/100500I-Hall of Fame.cpp | #pragma comment(linker, "/stack:640000000")
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <iterator>
#include <list>
#include <map... | ALGO | 0.999351 | 3.577987 |
a7a4f40a-f888-4acd-a114-7fde2b44fb37 | goyalyash82/GFG | Difficulty: Easy/Divisible by 7/divisible-by-7.cpp | // User function template for C++
class Solution {
public:
int isdivisible7(string num) {
int rem = 0;
for (int i =0; i < num.length(); i++){
int digit = num[i]- '0';
rem = (rem *10 + digit) % 7;
}
if(rem % 7 == 0){
return 1;
}
r... | ALGO | 0.997436 | 5.0273 |
7512dc7b-3d55-4623-a056-69060fc9d758 | kartikeymishra22/C-with-DSA | Code in C 1/2.cpp | #include<iostream>
using namespace std;
int power(int n)
{
if(n == 0)
return 1;
int smallerproblem = power(n - 1);
int biggerproblem = 2 * smallerproblem;
return biggerproblem;
}
int main()
{
int n;
cin>>n;
int ans = power(n);
cout<<ans<<endl;
} | ALGO | 0.999987 | 4.803127 |
cb09830c-e1f2-43ef-828a-5794268f2a8e | ishandutta2007/codeforces | shadowlight/normal/1624/B.cpp | #include <bits/stdc++.h>
#define ll long long
#define db long double
#define ull unsigned long long
#define x first
#define y second
#define mp make_pair
#define pb push_back
#define all(a) a.begin(), a.end()
using namespace std;
#define pper(a) cerr << #a << " = " << a << endl;
void per() { cerr << endl; }
template... | ALGO | 0.999707 | 3.970411 |
8db22c82-a49e-4840-94de-e372e0bb4ef8 | ishandutta2007/codeforces | shubham__36/normal/1503/B.cpp | #pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
// #include <atcoder/all>
// #include <bits/stdc++.h>
#include <complex>
#include <queue>
#include <set>
#include <unordered_set>
#include <list>
#include <chrono>
#include <rand... | ALGO | 0.999781 | 3.999075 |
3f9417b7-4471-40fb-a22b-8162df0a8189 | 192210154/csa5173 | Q15.cpp | #include <stdio.h>
#include <string.h>
#include <ctype.h>
#define ALPHABET_SIZE 26
#define MAX_TEXT 1000
const double englishFreq[ALPHABET_SIZE] = {
8.167, 1.492, 2.782, 4.253, 12.702, 2.228, 2.015, 6.094, 6.966,
0.153, 0.772, 4.025, 2.406, 6.749, 7.507, 1.929, 0.095, 5.987,
6.327, 9.056, 2.758, 0.978, 2.... | ALGO | 0.999989 | 5.219136 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.