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 |
|---|---|---|---|---|---|---|
6be73293-56c6-4d29-9156-fede8b50b769 | CrazyMrAll/codefiled_cpp | 程序设计方法与实践2022/20. 军训日记:查寝.cpp | #include <iostream>
using namespace std;
const int MAXN = 100005;
struct Node
{
int num;
Node* next = NULL;
Node(int t) {
num = t;
}
};
Node *p[MAXN];
int main()
{
int n, m, x, y;
int itemnum[MAXN];
scanf("%d %d", &n, &m);
for (int i = 1; i <= n; i++) {
p[i] = new Node(i... | ALGO | 0.999986 | 3.920442 |
cf84f21a-878a-4ced-b8e2-f0778e853049 | hookflash/obsolete.opbb10 | hookflash-libs/boost/libs/math/example/binomial_sample_sizes.cpp | #ifdef _MSC_VER
# pragma warning(disable: 4512) // assignment operator could not be generated.
# pragma warning(disable: 4510) // default constructor could not be generated.
# pragma warning(disable: 4610) // can never be instantiated - user defined constructor required.
#endif
#include <iostream>
using std::cout; ... | ALGO | 0.980967 | 7.057256 |
a489f2d7-e071-4aa7-82d3-c28451e42987 | 0xallam/Search-Engine | main.cpp |
#define _HAS_STD_BYTE 0
#include <iostream>
#include <string>
#include <fstream>
#include <unordered_map>
#include <vector>
#include <sstream>
#include "Engine.h"
#include "ConsoleMode.h"
#include "BrowserMode.h"
using namespace std;
unordered_map<string, vector<string>> *graph;
unordered_map<string, vector<string... | TOOL | 0.885887 | 3.89675 |
35369de9-8c86-44ab-92cd-17c5a0fedd56 | AthosMatos/TrabsFaculdade | IA/IA/main.cpp | #include <iostream>
#include "grafo.hpp"
using namespace std;
int main()
{
Grafo grafo;
grafo.add(8);
grafo.connect("A", "B", 10);
grafo.connect("A", "G", 5);
grafo.connect("B", "C", 4);
grafo.connect("B", "H", 8);
grafo.connect("H", "D", 20);
grafo.connect("D", "E", 10);
grafo.connect("E", "F", 6);
grafo... | ALGO | 0.998581 | 4.274834 |
ce01c4ef-e65e-44d0-8351-aec2471c800f | venelin9/DSP | hash/source.cpp | #include <iostream>
using std::cout;
#include "hash.h"
#include <string>
using std::string;
unsigned fun( const string &s ){
unsigned p(0);
for (unsigned i(0); i<s.length(); i++){
p+=s[i];
}
return p%256;
}
int main(){
hash table(255, fun);
table["John"]=15;
cout<<table["John"]<<'\n';
cout<<table[... | ALGO | 0.989952 | 5.060925 |
e66710e5-7cfb-46ea-a99b-4570baffee5b | John-Atha/search-sort-ds | quickSort.cpp | // { Driver Code Starts
#include <stdio.h>
#include <bits/stdc++.h>
using namespace std;
void swap(int arr[], int i, int j) {
int temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
/* Function to print an array */
void printArray(int arr[], int size) {
int i;
for (i=0; i < size; i++)
pri... | ALGO | 0.999956 | 4.948541 |
c946d30d-a218-4379-a6f0-4420169162ad | anoopshetty03/SDE-Sheet | Trees/Binary Trees/PreorderTraversal.cpp | // https://leetcode.com/problems/binary-tree-preorder-traversal/
class Solution {
public:
void helper(TreeNode* root, vector<int>& ans){
if(root != NULL){
ans.push_back(root->val);
helper(root->left,ans);
helper(root->right,ans);
}
}
vector<int> preorder... | ALGO | 0.999996 | 6.455528 |
955d065e-e3a3-4baf-b26c-a4096c77d7e0 | lclpsoz/competitive-programming | ATC/atc-dp/Q.cpp | #include "bits/stdc++.h"
#include "ext/pb_ds/tree_policy.hpp"
#include "ext/pb_ds/assoc_container.hpp"
using namespace std;
////////////// Prewritten code follows. Look down for solution. ////////////////
#define x first
#define y second
#define LEN(x) ((int)(x).size())
#define ALL(x) x.begin(), x.end()
using ll = long... | ALGO | 0.999988 | 4.157203 |
8be38cec-b110-483e-a97c-eb53742444df | Grudgeguy/codes | Algebra/Fundamentals/Euclidean_gcd.cpp | #include<bits/stdc++.h>
#define ll long long
using namespace std;
ll gcd(ll a, ll b){
if(b==0) return a;
return gcd(b,a%b);
}
ll lcm(ll a, ll b){
return a*b/gcd(max(a,b),min(a,b));
}
ll gcd2(ll a,ll b){
if(!a&1 && !b&1) return
}
int main(){
ll a,b;
cin>>a>>b;
cout<<gcd(max(a,b),min(a,b))<<... | ALGO | 0.999959 | 3.799162 |
ca8fe094-07a8-4335-8542-cef3ada3967f | sidharthsharma96/CODING | SPOJ/Problems/WILLITST.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
#ifndef ONLINE_JUDGE
//freopen("input.txt","r",stdin);
//freopen("output.txt","w",stdout);
#endif
ios_base::sync_with_stdio(0);
ll n;
cin>>n;
if((n<=1) || (n&(n-1)))
cout<<"NIE\n";
else
cout<<"TAK\n";
return 0;
} | ALGO | 0.99942 | 4.885417 |
5fb418ba-c738-4fd9-9846-15030edf8ca1 | chinnonae/ADT-Lab | Grader1/IceCreamQueue4.cpp | #include <iostream>
using namespace std;
template <typename T>
class Heap
{
private:
T* data;
int count;
public:
Heap(int max_size);
~Heap();
int size() { return count; }
void insert(T x);
T get_min();
T extract_min();
private:
void percolate_up(int i);
void percolate_down(int i);
int parent_id... | ALGO | 0.999544 | 3.751312 |
34b54f3c-1313-44bc-859a-cd42a95061a0 | torizon/mesa-deb | src/compiler/glsl/opt_tree_grafting.cpp | /**
* \file opt_tree_grafting.cpp
*
* Takes assignments to variables that are dereferenced only once and
* pastes the RHS expression into where the variable is dereferenced.
*
* In the process of various operations like function inlining and
* tertiary op handling, we'll end up with our expression trees having
... | ALGO | 0.993317 | 7.663228 |
0ab662a6-abbb-4654-841b-cab92a365ec6 | rajat03github/DSAnew | BEFORE 37/D13BQ.cpp | #include <iostream>
using namespace std;
int firstOcc(int arr[], int n, int key)
{
int s = 0;
int e = n - 1;
int mid = s + (e - s) / 2;
int ans = -1;
while (s <= e)
{
if (arr[mid] == key)
{
ans = mid;
e = mid - 1;
}
else if (key > arr[m... | ALGO | 0.999929 | 5.348869 |
e94b5fca-3182-42f0-a721-f90e3d545a41 | Saiprathap3/Cryptography---192210657 | Exp-29.cpp | #include <stdio.h>
#include <stdint.h>
#include <string.h>
#define BLOCK_SIZE 136
#define STATE_SIZE 25
#define HASH_SIZE 32
#define ROTL64(x, n) (((x) << (n)) | ((x) >> (64 - (n))))
const uint64_t RC[24] = {
0x0000000000000001ULL, 0x0000000000008082ULL, 0x800000000000808aULL,
0x8000000080008000ULL, 0x... | ALGO | 0.999419 | 6.868512 |
0bc486ab-8cfa-4051-8afc-15147838599b | ishandutta2007/codeforces | maximumshot/normal/558/E.cpp | #include <iostream>
#include <math.h>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <fstream>
#include <string>
#include <algorithm>
#include <stack>
#include <queue>
#include <list>
#define ALL(x) (x).begin(), (x).end()
#define mp make_pair
#define vec vector
#define deb(x) cerr << #x << "... | ALGO | 0.999988 | 3.850831 |
99db9e26-b63b-4d3b-afcf-057fe0120415 | matumoto1234/cp-crawler | AtCoder/abc186/abc186_a/18859646.cpp | // detail: https://atcoder.jp/contests/abc186/submissions/18859646
#include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
using ll = long long;
int main() {
ll n,w;
cin >> n>>w;
cout<<n/w<<endl;
return 0;
} | ALGO | 0.999812 | 4.452303 |
ffc57201-4349-4390-b900-a0c5166135c2 | yuifan/pexus4_frameworks_av | media/libstagefright/codecs/avc/common/src/mb_access.cpp | #include <string.h>
#include "avclib_common.h"
OSCL_EXPORT_REF void InitNeighborAvailability(AVCCommonObj *video, int mbNum)
{
int PicWidthInMbs = video->PicWidthInMbs;
// do frame-only and postpone intraAvail calculattion
video->mbAddrA = mbNum - 1;
video->mbAddrB = mbNum - PicWidthInMbs;
video-... | ALGO | 0.982914 | 5.763853 |
06a24769-dac8-4adb-b096-bb687ffa8b69 | aayush751/Geeksforgeeks | Easy/Remove all duplicates from a given string/remove-all-duplicates-from-a-given-string.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
string removeDuplicates(string str) {
// code here
string ans;
for(int i = 0; i < str.size(); i++ )
{
if( count( ans.begin(), ans.end(... | ALGO | 0.999801 | 6.431401 |
24dd720c-a738-4e76-96dd-d72178db7f15 | Namek025/Cataclysm | dep/g3dlite/source/uint128.cpp | /**
@file uint128.cpp
@maintainer Morgan McGuire, http://graphics.cs.williams.edu
@author Kyle Whitson
@created 2008-07-17
@edited 2008-07-17
*/
#include "G3D/uint128.h"
namespace G3D {
/** Adds two 64-bit integers, placing the result and the overflow into 64-bit integers.*/
static void addAndCarry(const ... | ALGO | 0.971727 | 7.42392 |
95483b00-7701-48cd-8e93-49008916d362 | GOKU-Sudo/DSA | DSA/questions/diameterOfTree.cpp | #include<bits/stdc++.h> // Include all standard libraries
using namespace std; // Use the standard namespace
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) ... | ALGO | 0.999956 | 6.728721 |
93d7986b-e70b-4ade-86b9-bbeb800b5ea4 | Dzhevizov/CplusplusFundamentals | StringsAndStreamsEx/Ex7/Ex7.cpp | #include <iostream>
#include <string>
#include <sstream>
using namespace std;
int main()
{
string strInput;
getline(cin, strInput);
istringstream oStream(strInput);
string strCurrentWord;
string strMaxLengthNoise = "";
while (oStream >> strCurrentWord)
{
stringstream oCurrNoise;
string strCurrNoise;
fo... | ALGO | 0.994525 | 4.314236 |
41f94e42-cf43-4306-b014-dd463fc8100d | Imp0scar/CSE100 | Labs/Lab11/obenitez3.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void DFS(vector<int>* G, bool* seen, vector<int>& f, int v, int& t){
seen[v] = true;
for(int i = 0; i < G[v].size(); i++){
int u = G[v][i];
if(!seen[u]){
DFS(G, seen, f, u, t);
}
}
f[v] =... | ALGO | 0.999998 | 5.154805 |
f9c31955-61f8-413c-9c84-3754920fbaff | atulbunkar/leetcode | 89-gray-code/89-gray-code.cpp | class Solution {
public:
vector<int> grayCode(int n) {
int p = 1<<n;
vector<string> ans;
ans.push_back("0");
ans.push_back("1");
n--;
vector<string> temp;
while(n--){
int s = ans.size();
for(int i= s-1 ; i >= 0 ; i--){ //creati... | ALGO | 0.999993 | 5.847891 |
ba068781-f43d-4675-8544-af60989bb422 | ckdgus0505/DataStructure | 201511061_graph/201511061_graph/201511061_graph.cpp | #define _CRT_SECURE_NO_WARNINGS
#define MAX_VERTEX 100
#include "graph.h"
graph g1;
int dfn[MAX_VERTEX];
int low[MAX_VERTEX];
int num = 1;
int main()
{
FILE* fp = fopen("graph02.txt", "r+t");
g1.load_graph(fp);
fclose(fp);
g1.print_graph();
memset(dfn, -1, sizeof(dfn));
memset(low, -1, sizeof(low));
g1.dfs(1,... | ALGO | 0.998652 | 4.021375 |
e99d268a-313b-44ff-b00d-a05bd79b3a6d | seraph27/competitve-programming | atcoder/abc411/e.cpp | // Problem: E - E [max]
// Contest: UNIQUE VISION Programming Contest 2025 Summer (AtCoder Beginner Contest 411)
// URL: https://atcoder.jp/contests/abc411/tasks/abc411_e
// Time Limit: 3000
// Start: Thu Jun 26 18:22:36 2025
// mintemplate
#ifdef MISAKA
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
#include <... | ALGO | 0.999828 | 5.445025 |
7b775f57-5605-4b11-ac90-cf734aebe377 | TgX-2/Template | Data Structures/Tree/HLD.cpp | struct HeavyLightDecomposition {
int child[maxn], par[maxn];
int hld[maxn], hldd[maxn], dep[maxn], id[maxn], fin[maxn], sta[maxn];
int inn[maxn], out[maxn];
int cnt = 1, cntt = 0, n;
void dfs(int u, int pre) {
child[u] = 1;
par[u] = pre;
for(int v : g[u]) if (v != pre) {... | ALGO | 0.999883 | 4.099883 |
a4bd073a-7905-437e-86ec-34f2d5267f5a | M45UDrana/DS-Algo-Problem-Solving | codeforces/445B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<string, int> psi;
#define ff first
#define ss second
#define pb(a) push_back(a)
#define mp(a,b) make_pair(a,b)
#define input freopen("input.txt","r",stdin)
#define output freopen("output.txt","w",stdout)
#def... | ALGO | 0.99997 | 4.340976 |
f5561501-4e3d-443a-a8aa-78a0276ddb28 | homologus/Pandoras-Toolbox-for-Bioinformatics | src/SPAdes/src/debruijn/kmer_coverage_model.cpp | #include "kmer_coverage_model.hpp"
#include "xmath.h"
#include "logger/logger.hpp"
#include "smooth.hpp"
#include "verify.hpp"
#include <boost/math/special_functions/zeta.hpp>
#include <boost/math/distributions/normal.hpp>
#include <boost/math/distributions/skew_normal.hpp>
#include <boost/math/distributions/geometri... | ALGO | 0.997166 | 6.550179 |
612188f2-c7b5-492a-a9b2-040a33456c69 | przemyslaw-szymanski/vke | src/ThirdParty/glslang/hlsl/hlslParseables.cpp | //
// Create strings that declare built-in definitions, add built-ins programmatically
// that cannot be expressed in the strings, and establish mappings between
// built-in functions and operators.
//
// Where to put a built-in:
// TBuiltInParseablesHlsl::initialize(version,profile) context-independent textual built... | TOOL | 0.953159 | 5.5541 |
42e8f357-1775-402c-849b-14c1516f3670 | InitialDLab/SEAL-ORAM | src/SRORAM.cpp | //
// Created by Dong Xie on 7/10/2016.
//
#include "SRORAM.h"
using namespace CryptoPP;
void SRORAM::initialize() {
AutoSeededRandomPool prng;
const uint32_t tmp_len = B - AES::BLOCKSIZE - 3 * sizeof(uint32_t);
for(uint32_t k = 0; k < N; k ++) {
byte tmp_buffer[tmp_len];
prng.GenerateBl... | ALGO | 0.995396 | 4.863767 |
65b9b14c-23fc-4543-9449-82c1cf65cc41 | rema888/Remenny_Laby_PMI_IIAD | Remenny_Laby/Laba_7/func/func.cpp | #include <func.hpp>
#include <iostream>
namespace laba_7
{
bool isPrime(int x)
{
if(x < 2)
return false;
for (int d = 2; d <= sqrt(x); d++)
if(x % d == 0)
return false;
return true;
}
void Read(int matrix[N_Max][M_Max], int& n, int& m)
{
std::cout << "Введите количест... | ALGO | 0.999681 | 3.466868 |
b2f00668-29a0-44ea-9bb9-2ec52c7b9472 | mwdev22/cpp_uczelnia | semestr2/zaj8/vec.cpp | #include <iostream>
class Vector {
private:
double x;
double y;
public:
Vector(double x1,double y1) : x(x1), y(y1) {};
friend std::ostream& operator<<(std::ostream&, const Vector &v);
friend Vector operator+(const Vector &v1, const Vector &v2);
Vector operator-... | ALGO | 0.901098 | 4.859738 |
9603f1a8-4277-4dfb-b900-643471322e36 | YenVu02/CTDL-GT | Tong_day_con_lon_nhat.cpp | #include<bits/stdc++.h>
using namespace std;
void init(int a[], int n){
for(int i = 0; i < n; i++){
cin >> a[i];
}
}
int max(int a, int b){
return (a > b) ? a : b;
}
int max(int a, int b, int c){
return max(max(a, b), c);
}
int maxCrossingSum(int a[], int l, int m, int h){
int sum = 0;
int left_sum = INT_MIN... | ALGO | 0.999552 | 4.809848 |
aa59d214-d60d-4a53-ad3a-58d71f6702f7 | hazzlerr/GRIND | Before June 7/cf1792E.cpp | // We can find all divisors of m1 * m2 by 1) Separately factorizing m1 and m2 2) Getting all divisors using recursion
// Then, for d we need to find maximum mx such that d % mx == 0, and then the answer will be d / mx
// We can do it using dp
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using nam... | ALGO | 0.999893 | 4.88871 |
f3537dc5-a977-412d-8a63-25a0d69986e0 | jyc/gecko | modules/fdlibm/src/s_ceilf.cpp | /* s_ceilf.c -- float version of s_ceil.c.
* Conversion to float by Ian Lance Taylor, Cygnus Support, <EMAIL>.
*/
#include "math_private.h"
static const float huge = 1.0e30;
float
ceilf(float x)
{
int32_t i0,j0;
u_int32_t i;
GET_FLOAT_WORD(i0,x);
j0 = ((i0>>23)&0xff)-0x7f;
if(j0<23) {
if(j0<0) { /* rai... | ALGO | 0.985446 | 4.773717 |
784ece17-85e7-432c-9014-af67afd78315 | teddy-teem/Competitive-Programming | String/Palindrom/MaxLengthPalindromSub.cpp | #include <bits/stdc++.h>
#define F_READ freopen("input.txt", "r", stdin);
#define F_WRITE freopen("output.txt", "w", stdout);
#define IOS \
ios_base::sync_with_stdio(false); \
cin.tie(NULL)
#define PB push_back
#define F first
#define S second
#define REP(i, a, b) for (int i = a; i <= ... | ALGO | 0.999855 | 3.817482 |
e85c1720-44dd-4753-9316-0167e98d3635 | krnbatra/SPOJ-Solutions | ADDREV.cpp | /*My First Template :D*/
#include <bits/stdc++.h>
using namespace std;
#define MOD (int)1e9+7
#define ll long long
#define pb push_back
template <typename T> T mod(T a, T b){return (a%b>0)?(a%b):mod((a+b),b);}
template <typename T> T gcd(T a, T b){return (b==0)?a:gcd(b,a%b);}
template <typename T> T lcm(T a, T b){ret... | ALGO | 0.999807 | 5.226322 |
2818a076-40a4-4fc8-abf3-72e441e355a4 | mntxca/CS-32-Projects | HW3Submission1/linear.cpp | //#include "Header.h" include only when testing
// Return true if the somePredicate function returns true for at
// least one of the array elements, false otherwise.
bool anyTrue(const double a[], int n)
{
if (n <= 0)
return false;
if (somePredicate(*a))
return true;
else
return (anyTrue(a + 1, n - 1));
}
... | ALGO | 0.933761 | 5.338531 |
09c7dfb1-674f-43e0-a2e1-d4a37038d69e | DcmTruman/my_acm_training | HDU/2217/10126170_AC_31ms_1964kB.cpp | #include<iostream>
#include<stdio.h>
#include<algorithm>
using namespace std;
int NDD[2200] = { 0, };
int N, ans = 0;
long long T;
int main()
{
while (scanf("%d %d", &N, &T) != EOF)
{
NDD[0] = 0;
ans = 0;
int p = 0;
for (int i = 1; i <= N; i++) {
int a;
cin >> a;
NDD[i] = a;
}
sort(NDD, NDD + N +... | ALGO | 0.999966 | 3.528414 |
849a33cd-b88e-40b3-852f-853a4c8b12ae | trcp/erasers_kachaka | erasers_kachaka/erasers_kachaka_navigation/src/pot_fields_node.cpp | #include <rclcpp/rclcpp.hpp>
#include <sensor_msgs/msg/laser_scan.hpp>
#include <std_msgs/msg/float32.hpp>
#include <visualization_msgs/msg/marker.hpp>
#include <cmath>
#include <algorithm>
class PotFieldsNode : public rclcpp::Node {
public:
PotFieldsNode() : Node("pot_fields_node") {
// パラメータの宣言と取得
... | TOOL | 0.964636 | 6.706879 |
c775df4a-76f2-4a36-8e24-1062d1685d01 | OTTFFYZY/StandardCodeLibrary | DynamicProgramming/NumberBitDP/NumbersAtMostNGivenDigitSet_0.cpp | class Solution {
public:
vector<int> d,w;
vector<vector<int> > dp;
int md;
int dfs(int dep,int lim)
{
if(dp[lim][dep]!=-1) return dp[lim][dep];
if(dep==0)
{
if(lim)
{
dp[lim][dep]=0;
for(int i:d)
if(i... | ALGO | 0.999927 | 5.949025 |
baa9c1a9-5265-4e38-b971-115bf59c0b76 | MateoHoyos/Lab1 | Ejercicio7/main.cpp | #include <iostream>
using namespace std;
int main()
{
int N,suma=0;
cout<<"Ingrese un numero N: ";
cin>>N;
for(int i=1;i<=N;i++){
suma+=i;
}
cout<<"La sumatoria desde 0 hasta "<<N<<" es: "<<suma<<endl;
return 0;
}
| ALGO | 0.962129 | 3.633241 |
721b3e9a-8c32-4a45-a423-802c020b6276 | Legion-zialot/s-xray16 | src/xrGame/min_obb.cpp | #include "StdAfx.h"
#include "magic_box3.h"
#include "magic_minimize_nd.h"
class PointArray
{
public:
PointArray(int iQuantity, const Fvector* akPoint) : m_akPoint(akPoint) { m_iQuantity = iQuantity; }
int m_iQuantity;
const Fvector* m_akPoint;
};
static void FromAxisAngle(Fmatrix& self, const Fvector& rk... | ALGO | 0.998877 | 6.883069 |
da4df208-3e74-442e-b52d-29f3d8d6a630 | aaisha7ac/DSA | Geeks_For_Geeks/Array/perfect_array.cpp | class Solution{
public:
bool IsPerfect(int a[],int n)
{
// Complete the function
int j = n-1;
int i = 0;
while(i<=j){
if(a[i]!=a[j]){
return false;
}
i++;
... | ALGO | 0.998991 | 4.938178 |
045a0182-ccc3-4ad9-a142-697132ca4fcc | Samuvin/Data_Structures_And_Algorithms | Trees/Binary Search Trees/Maximum_And_Minimum_In_A_Tree.cpp | class Solution
{
public:
int findMax(Node *root)
{
if(root==NULL)
return INT_MIN;
int left=findMax(root->left);
int right=findMax(root->right);
return max({root->data,left,right});
}
int findMin(Node *root)
{
if(root==NULL)
return INT_M... | ALGO | 0.999963 | 5.470462 |
ad4d427e-f7ea-425b-9a53-c29cfb8d2904 | jk-jung/problem-solving | codeforces/Codeforces Round 83x/R832_div2_C.cpp | #include <cstring>
#include <cstdio>
#include <cmath>
#include <cassert>
#include <set>
#include <map>
#include <array>
#include <stack>
#include <queue>
#include <vector>
#include <numeric>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<i... | ALGO | 0.999911 | 4.543926 |
7a5f29be-2065-4021-8055-5eb2e50a92a0 | MeiYing-cell/C-_code | Acwing/算法基础课/第六讲 贪心/125耍杂技的牛.cpp | #include<iostream>
#include<algorithm>
using namespace std;
typedef pair<int, int> PII;
const int N = 5e4 + 10;
PII cow[N];
int n;
int main(){
cin >> n;
for(int i = 0; i < n; i ++){
int w, s;
cin >> w >> s;
cow[i] = {w + s, w};
}
sort(cow, cow + n);
int res = -2e9, sum = 0;
... | ALGO | 0.999941 | 3.503989 |
3922334c-b645-4b63-942b-fa850b12ad47 | Anubhav12345678/competitive-programming | cycleinanarr.cpp | // C++ program to check if a given array is cyclic or not
#include<bits/stdc++.h>
using namespace std;
// A simple Graph DFS based recursive function to check if
// there is cycle in graph with vertex v as root of DFS.
// Refer below article for details.
// https://www.geeksforgeeks.org/detect-cycle-in-a-graph/ ... | ALGO | 0.999988 | 4.812101 |
3e484030-3a72-4f29-8b92-9bfb297eef91 | IshanC05/LeetCode-Questions | Count triplets with sum smaller than X - GFG/count-triplets-with-sum-smaller-than-x.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
long long countTriplets(long long arr[], int n, long long sum)
{
// Your code goes here
long long ans = 0;
sort(arr, arr + n);
for(int i = 0; i < n - 2; i++){
... | ALGO | 0.999732 | 6.080438 |
379f130a-2911-4b6f-9541-5f2a543d436a | DivyaPrakashJha/Tree | T-03.cpp | // Inorder Traversal
// Order of Traversal -> Left Node Right
#include<bits/stdc++.h>
using namespace std;
class Node{
public:
int val;
Node* left;
Node* right;
Node(int data){
val = data;
left = nullptr;
right = nullptr;
}
};
// Recursive Inorder Traversal
void inO... | ALGO | 0.999981 | 5.945921 |
d05dd595-7d76-4b41-9c26-c97cd5d46bb2 | A31Nesta/Penumbra | src/utils/config.cpp | #include "config.hpp"
namespace pen {
// Creates an unsigned 32 bit integer with all flags from command line arguments
uint32_t getFlagsFromArguments(int argc, char** argv) {
uint32_t flags = 0;
// Check if flag is valid and put its value in the flags variable
for (int i = 0; i < argc;... | TOOL | 0.933086 | 5.134833 |
4bfd0ffc-e63f-4507-87b1-caf1a129152c | Madhur-A/Competitive-DSA | Leetcode/Misc/C1312.cpp |
#include <bits/stdc++.h>
using std::string;
class Solution {
public:
int dp[501][501];
public:
int rx(std::string const &s, int const &left, int const &right) {
if(left < right) {
if(dp[left][right] != -1) { return dp[left][right]; }
int res = 0;
if(s[left] == s[r... | ALGO | 0.999845 | 5.408303 |
e8a3699e-3386-4078-b792-c738afb5629d | chuncheyang1130/Leetcode_Practice | 2737-find-the-closest-marked-node/2737-find-the-closest-marked-node.cpp | class Solution {
public:
int minimumDistance(int n, vector<vector<int>>& edges, int s, vector<int>& marked) {
vector<int> dist(n, 1e9);
vector<vector<pair<int,int>>> edge_matrix(n, vector<pair<int,int>>());
unordered_map<int, int> hash_table;
for (int i = 0; i < marked.size(... | ALGO | 0.999892 | 5.395721 |
0cf73e91-f977-4578-a00e-0220eb5be767 | slientreed/Point2OfferCode | 52_First_Common_ListNode.cpp | /*
说明:
1. 问题:51. 两个链表的第一个公共节点
2. 思路:1. 暴力搜索,每次搜索一个节点,同时搜索一遍第二个。 time:O(n^2)
2. 借助栈: 从后向前找,找到第一个不相同的后一个节点即是。所以把链表节点都入栈,然后挨个出栈对比,找到第一个不相同的下个节点; O(m+n)
3. 为了解决两个链表不齐的问题,可以先遍历两个链表长度,找出长度差n,然后长的链表先走n步,短的再跟上对比; time: O(m+n)
4. 使用3的方法,可以 list1: list1 + list2 ; list2: list2 + list1。这样两个链表一样长... | ALGO | 0.999983 | 4.504942 |
7d31dad8-4f9e-4f4e-b30b-1712330f35bc | nguyenvangiang1988/Intern-Batch33 | Codility/ex1.cpp | #include "header.h"
using namespace std;
string to_binary(int N){
string ret;
while (N > 0){
ret = to_string(N % 2) + ret;
N /= 2;
}
return ret;
}
int longest_binary_gap(int N){
string bN = to_binary(N);
int max = 0, count = 0;
bool check = false;
for (int i = 0; i < bN... | ALGO | 0.997364 | 5.062284 |
2f52275d-3494-4476-bfd7-aee67ec1b3d3 | DarkKnight6499/pa_mido | gps/core/ContextBase.cpp | #define LOG_NDEBUG 0
#define LOG_TAG "LocSvc_CtxBase"
#include <dlfcn.h>
#include <cutils/sched_policy.h>
#include <unistd.h>
#include <ContextBase.h>
#include <msg_q.h>
#include <loc_target.h>
#include <platform_lib_includes.h>
#include <loc_log.h>
namespace loc_core {
loc_gps_cfg_s_type ContextBase::mGps_conf {};
... | CONFIG | 0.852234 | 6.22083 |
24867e24-11f4-4223-a773-ecffe01792a7 | TINABJan254/CPP-PTIT | CPP0412_SapXep012.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
while (t--){
int n;
cin >> n;
int a[n+5];
for (int i = 0; i < n; i++)
cin >> a[i];
sort(a, a+n);
for (int i = 0; i < n; i++)
cout << a[i] << " ";
cout << endl;
}
}
| ALGO | 0.999708 | 3.667036 |
b7257a31-4695-4260-8c74-0916a00a305d | aredjil/euler_project | problem_930/.history/src/main_20250209193105.cpp | #include "gather.hpp"
std::random_device dv;
std::mt19937 gen(dv());
void step(std::vector<int> &balls, std::vector<int> &bowls)
{
int m = balls.size();
int n = bowls.size();
int rd_ball;
int rd_dir;
// Choosing a random ball
std::uniform_int_distribution<int> choose_ball(0, m - 1);
// P... | ALGO | 0.999856 | 5.154084 |
cf661d00-4300-4ac4-b300-28059dd262e3 | amoghkrishna55/CPP | rev_array.cpp | #include<iostream>
using namespace std;
void rev(int arr[],int size){
int start = 0;
int end = size-1;
while(start<end){
swap(arr[start],arr[end]);
start++;
end--;
}
}
int main(){
int a;
cin >> a;
int* arr = new int[a];
for(int i=0;i<a;i++){
cin >> arr[i... | ALGO | 0.999625 | 4.359591 |
060db72a-c10d-4b23-a22d-fb7d5bcfc578 | MikhailVilkin/Labs | binary.cpp | #include <iostream>
int binary_search(int *array, unsigned int length, int number) {
int middle = length / 2;
return number == array[middle] ?
middle :
number < array[middle] ?
binary_search(array, middle, number) :
middle + binary_search(&array[middle], middle + (length % 2), number);
}
int m... | ALGO | 0.998905 | 5.192823 |
d95b3069-22f5-4564-86d1-eb7db7599767 | JimmyCode2009/leetcode-desktop | Evaluate Reverse Polish Notation/main.cpp | #include <iostream>
#include <vector>
#include <stack>
using namespace std;
class Solution {
public:
int evalRPN(vector<string> &tokens) {
int a,b;//
stack <int> s;
for(vector<string>::const_iterator it=tokens.begin();it<tokens.end();++it)
{
if(( (*it)[0] == '+' || (*it)[0] == '-' ||(*it)[0] == '*... | ALGO | 0.999807 | 5.194659 |
5c797498-00e0-4df1-9956-6e1744ab0111 | supudo/contests | atcoder/abc129/a_airplane.cpp | // @supudo
// clang++ -O2 -Wall -std=c++14 atcoder_abc129_airplace.cpp -o ../build/atcoder_abc129_airplace -DLOCAL
#include <iostream>
#include <vector>
#include <string>
#include <sstream>
#define loop(var, from, to) for (int var=from; var<to; ++var)
using namespace std;
int main() {
vector<int> times;
#ifdef LO... | ALGO | 0.998544 | 4.349809 |
c6f90062-8390-427f-9a1c-bcafeb003c2b | prathameshatkare/Investo | Desktop/DSA/DAY 1 to 4/pattern 13.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
int count=0;
int i=0;
char value='A';
while(i<n){
int j=0;
while(j<n){
cout<<char(value+i+j);
j++;
count++;
}
cout<<endl;
i++;
}
}
#include<iostream>
using namespace ... | ALGO | 0.998073 | 3.820325 |
523519d6-4910-4205-81dd-6446ab5ac0a9 | ChristianFrisson/NMPT | lib/GentleBoostCascadedClassifier.cpp | #include "GentleBoostCascadedClassifier.h"
#include <list>
#include "BlockTimer.h"
#include "DebugGlobals.h"
#include <limits.h>
#include "HaarFeature.h"
#include "NMPTUtils.h"
#include <opencv2/highgui/highgui_c.h>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
//#include <omp.h>
using namesp... | ALGO | 0.962568 | 4.046693 |
5372004d-ce3f-4b82-8871-96c526a8ae4b | Veljko28/cpp-data-algrtms | codeforces/114/SquareString.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iterator>
#include <numeric>
#include <string>
#include <cstring>
#include <ctime>
#include <set>
#include <list>
#include <sstream>
#include <iomanip>
#include <map>
#include <stack>
#include <unordered_map>
#include <queue>
#include... | ALGO | 0.998553 | 4.950041 |
ef8b214c-02d5-4912-9f6a-528bf922b36b | jldinh/vplants | tree_matching/src/cpp/Unordered/matching_ulcs_minco.cpp | #include "matching_ulcs_minco.h"
// -------------
// Constructeur
// -------------
Matching_U_LargestCommonSubTree_Using_MinimumComponents::Matching_U_LargestCommonSubTree_Using_MinimumComponents(TreeGraph& input,TreeGraph& reference,NodeCost& nodeDistance)
{
Matching_U_MinCo( *T1,*T2,*ND);
_nbInputConnected... | ALGO | 0.999376 | 4.582017 |
a176aeaa-0d87-476a-8476-8ccf4e100c6f | pnkjshahare/DSA | Array/ArrayRemoveDuplicateNo.cpp | #include <bits/stdc++.h>
using namespace std;
// Brute force approch
// return the array.
int RemoveElementSTl(vector<int> arr)
{
set<int> st;
for (int i = 0; i < arr.size(); i++)
{
st.insert(arr[i]);
}
for (auto i : st)
{
cout << i << " ";
}
}
// Return the size of array.
in... | ALGO | 0.999779 | 5.000516 |
c7068196-0482-464c-8174-73b34a263656 | ch1ch/Happy-Zoo | Happy Zoo/libs/Box2D/Collision/b2BroadPhase.cpp | #include <Box2D/Collision/b2BroadPhase.h>
#include <cstring>
using namespace std;
b2BroadPhase::b2BroadPhase()
{
m_proxyCount = 0;
m_pairCapacity = 16;
m_pairCount = 0;
m_pairBuffer = (b2Pair*)b2Alloc(m_pairCapacity * sizeof(b2Pair));
m_moveCapacity = 16;
m_moveCount = 0;
m_moveBuffer = (int32*)b2Alloc(m_move... | ALGO | 0.917351 | 6.650233 |
b3c03bc0-afc4-41b1-adeb-7549b644e472 | prasannakumar-23/TIME-COMPLEXITY | recursion.cpp | #include<iostream>
using namespace std;
int fact(int n)
{
if(n==0)
return 1;
else
return fact(n-1) * n;
}
void print_fun(char ch)
{
int i=0,j;
if(i==1)
cout<<ch<<endl;
else
if(true)
{
for(j=1; j<=5+3;j+=1)
cout<<fact(j)<<endl;
}
else
cout<<"Hi";
}
int main()... | ALGO | 0.99878 | 3.027444 |
fed871bf-86bf-4708-ac32-db2fa0c37782 | kcalbCube/PVC-16 | include/boost_1_78_0/libs/math/example/laplace_example.cpp | // laplace_example.cpp
// Example of using laplace (& comparing with normal) distribution.
// Note that this file contains Quickbook mark-up as well as code
// and comments, don't change any of the special comment mark-ups!
//[laplace_example1
/*`
First we need some includes to access the laplace & normal distributi... | TOOL | 0.978463 | 4.096901 |
8ebdb289-d052-49a8-bb81-e4b5712df227 | SumitRaikwar18/Hacktoberfest | c++ problems asked in interview/Check set bits(GFG).cpp | Example 1:
Input:
N = 7
Output:
1
Explanation:
Binary for 7 is 111 all the
bits are set so output is 1
Example 2:
Input:
N = 8
Output:
0
Explanation:
Binary for 8 is 1000 all the
bits are not set so output is 0.
Your Task:
You don't need to read input or print anything. Your task is to complete the function isBitSet... | ALGO | 0.999976 | 6.138225 |
5b85916f-b9ca-456d-a97c-bc8a4b67321e | ajayAlways/Leetcode-solved-problems | 1707-maximum-xor-with-an-element-from-array/1707-maximum-xor-with-an-element-from-array.cpp | class Trie{
private:
Trie *links[2]={};
public:
Trie(){}
bool isContainsKey(int bit){
return this->links[bit]!=NULL;
}
Trie* get(int bit){
return this->links[bit];
}
void put(int bit, Trie *trie){
... | ALGO | 0.999938 | 5.556877 |
0fe1947a-ed06-4ace-9aa7-dc60cac540cb | Son-OfAnton/Competitive-Programming | CodeForces/theatreSquare.cpp | // Theatre Square - 1A
#include <bits/stdc++.h>
using namespace std;
int main()
{
double n, m, a;
cin >> n >> m >> a;
cout << (long long)ceil(n / a) * (long long)ceil(m / a) << endl;
}
| ALGO | 0.999508 | 3.612015 |
99819988-4927-43c8-a57b-4d9a3e78a53d | VerdanShandilya/CP_101 | Binary_Search/brightness_begins.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <climits>
#include <cmath>
// #include <bits/stdc++.h>
using namespace std;
using ll = long long;
void helper(){
ll k;
cin>>k;
ll l=k;
ll r=2e18;
ll ans=0;
while(l<=r){
ll mid=l+(r-l)/2;
ll b... | ALGO | 0.99987 | 4.483891 |
93d19d09-91a7-4b9f-b414-b30148f28d1d | kajo-kurisu/D_VINS | vins_estimator/src/initial/initial_aligment.cpp | #include "initial_alignment.h"
void solveGyroscopeBias(map<double, ImageFrame> &all_image_frame, Vector3d* Bgs)
{
Matrix3d A;
Vector3d b;
Vector3d delta_bg;
A.setZero();
b.setZero();
map<double, ImageFrame>::iterator frame_i;
map<double, ImageFrame>::iterator frame_j;
for (frame_i = all... | ALGO | 0.937617 | 3.17132 |
83a4ae9f-b7e6-4f29-b6d6-d91eeb8a3095 | fishy15/competitive_programming | oi/usaco/train/ch3/3.2_knapsack/ratios.cpp | /*
ID: aaryan.1
TASK: ratios
LANG: C++11
*/
#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
bool equal(int a, int b) {
if (a == 0) return b == 0;
return a == b;
}
int find_ratio(int* a, int* b) {
if (a[0] % b[0] != 0) {
return -1;
}
if (a[0] > 0) {
... | ALGO | 0.999813 | 4.122581 |
cca19be5-9b86-4031-abcc-605713c7ca2f | kumarshivam27december/data_structure_and_algorithm_in_c- | lec059_miscellenous_problem/string_compress.cpp | /*
test case 1:-
/lmn/abcd/..//b/./cd/ab//.//
/lmn/b/cd/ab
test case2:-
/../
/
test case 3:-
/./././.././././../
/
*/
#include <bits/stdc++.h>
#include <cstring>
using namespace std;
string compress(string str)
{
stack<char> s;
for (int i = 0; i < str.size(); i++)
{
if (str[i] == '/')
... | ALGO | 0.999521 | 4.069679 |
469059f6-7d00-4ba7-9c13-0220b29baacd | KunjShah95/CPP-COMPLETE-COURSE-WITH-DSA | chapter 4/FIBONACCISERIES.CPP | #include <iostream>
using namespace std;
void printFibonacci(int n)
{
int t1 = 0, t2 = 1, nextTerm = 0;
cout << "Fibonacci Series: " << t1 << ", " << t2 << ", ";
for (int i = 1; i <= n - 2; ++i)
{
nextTerm = t1 + t2;
t1 = t2;
t2 = nextTerm;
cout << nextTerm << ", ";
... | ALGO | 0.999433 | 5.533291 |
a3056c8a-0811-4a25-9151-5f5a12a17503 | revyos-rocm/rocm-llvm | libcxx/test/std/algorithms/alg.sorting/alg.merge/inplace_merge.pass.cpp | // <algorithm>
// template<BidirectionalIterator Iter>
// requires ShuffleIterator<Iter>
// && LessThanComparable<Iter::value_type>
// void
// inplace_merge(Iter first, Iter middle, Iter last);
#include <algorithm>
#include <cassert>
#include <random>
#include <vector>
#include "count_new.h"
#include "... | TEST | 0.99803 | 6.573207 |
8d918dc8-3e4c-4b9c-bee9-919601ddf42f | dslsn01/Programmiamo | IT/1/Ciao, Mondo!/Esercizi/C++/esercizio23.cpp | /* file esercizio23.cpp */
#include <iostream>
using std::cout;
using std::endl;
int main()
{
// stampa il risultato della moltiplicazione 2*3
cout << "2 * 3 = " << 2 * 3 << endl;
}
| TOOL | 0.970226 | 3.090406 |
cc34ae2a-6d27-45ff-b392-0ef8a9209bad | TheKingAAV7/leetcode | 101-symmetric-tree/symmetric-tree.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.999971 | 6.597535 |
50f09080-7246-4710-a5a1-0f06fa040841 | Tanya347/LeetCode_Solutions | 977-squares-of-a-sorted-array/977-squares-of-a-sorted-array.cpp | class Solution {
public:
#include<cmath>
vector<int> sortedSquares(vector<int>& nums) {
int n = nums.size();
vector<int> res(n);
//i stores the place where positive integers begin, j stores where negative integers end
//and r stores current index in resultant ar... | ALGO | 0.999982 | 5.715411 |
33633e5d-2bb0-4055-a850-68bb5a6fd6af | prajwalbayari/C_plus_plus | Apna college/Number Theory/extEuclid.cpp | // Extended euclid algorithm to solve non-linear equations
//ax+by=gcd(a,b)
#include<iostream>
#include<stdlib.h>
#include<algorithm>
#include<vector>
using namespace std;
struct triplet
{
int x,y,gcd;
};
triplet extended(int a,int b)
{
if(b==0)
{
triplet ans;
ans.x=1;
ans.y=0;
... | ALGO | 0.999603 | 4.191138 |
8c03b2dc-8e0b-4ec7-82dd-f5eb6007865b | ArbitCode/Leetcode-Practice | powx-n/powx-n.cpp | class Solution {
public:
double fastPow(double x, long long n){
if(n == 0) return 1.0;
double half = fastPow(x, n/2);
if(n%2 == 0) return half * half;
else return half * half * x;
}
double myPow(double x, int n) {
long long N = n;
if(N < 0){
x... | ALGO | 0.999501 | 5.417409 |
360c9338-71d5-490c-b1f8-b623f1d15b5b | Rajdip789/Striver-SDE-Sheet-Challenge | Day10/Longest Subarray Zero Sum .cpp | #include <bits/stdc++.h>
int LongestSubsetWithZeroSum(vector<int> &A) {
// Write your code here
int n = A.size();
int longest = 0, sum = 0;;
unordered_map<int, int> mpp;
for(int i = 0; i < n; i++) {
sum += A[i];
if(sum == 0) {
longest = i + 1;
}
else {... | ALGO | 0.99971 | 5.746492 |
17367db4-d456-4c04-95b2-b088ab1fe4fa | hjiang13/LLMs-in-IR | processed_data/Decompiled_Humaneval_x_cpp_164_Result_O3/GPT35_human_x_164_decompiled/CPP_14.cpp | ```cpp
#include <vector>
#include <string>
void all_prefixes(std::vector<std::string>& result, const std::string& input) {
result.clear();
std::string temp;
for (size_t i = 0; i < input.size(); ++i) {
temp = "";
for (size_t j = i; j < input.size(); ++j) {
temp += input[j];
... | ALGO | 0.985062 | 6.264632 |
8987faa6-94bc-4b01-a281-ab0e7df419db | umsuchi/beecrowd-solution | 1173.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
int n ;
cin >> n;
vector<int> fill;
for(int i = 0; i < 10; i++){
fill.push_back(n);
n += n;
}
for(int i = 0 ; i < 10 ; i++)
cout << "N[" << i << "] = " << fill.at(i) << endl;
return 0;
} | ALGO | 0.998621 | 3.481747 |
8063f45e-1e95-4e32-9433-76ad87e21d3e | yuv-raj-25/cpp-dsa | .history/knapsack_20230925133421.cpp | // A dynamic programming based
// solution for 0-1 Knapsack problem
#include <iostream>
using namespace std;
int knapSack(int W, int wt[], int val[], int n)
{
int i, w;
vector<vector<int> > K(n + 1, vector<int>(W + 1));
// Build table K[][] in bottom up manner
for (i = 0; i <= n; i++) {
for (w = 0; w <= W; w++)... | ALGO | 0.999998 | 5.904766 |
7bb03e0e-eedb-4268-a24f-e7edcc1424e0 | SegFault03/LeetCode | Sliding Window/2090_KRadiusSubarrayAverages.cpp | /*
Can be solved using a sliding window technique.
We have a fixed window pane size that we 'slide' across the entire array,
adding the new element that came under the window's right edge, and
discarding the element that the window's left edge just left.
E.g:
a = [1, 2, 3, 4]
Window size = 2
[1,2,3,4]
---
initially, ... | ALGO | 0.999921 | 5.875288 |
2e915542-d821-4eb5-b25d-0ea14418d470 | ankush-1208/Competitve-Programming | Codeforces/Contests/1520/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ip cin>>
#define op cout<<
#define endl "\n"
#define int long long
signed main(){
fast
int t, n;
cin>>t;
while(t--){
ip n;
if(n == 1) {
op 1 << e... | ALGO | 0.999925 | 4.315276 |
67233906-fc54-48d5-bd17-4697bf566956 | donbasta/leetcode-submissions | Medium/57.cpp | class Solution {
public:
vector<vector<int>> insert(vector<vector<int>>& intervals, vector<int>& newInterval) {
vector<vector<int>> ret;
int start = newInterval[0], end = newInterval[1];
bool found = false;
for (int i = 0; i < intervals.size(); i++) {
if ((intervals[i][1]... | ALGO | 0.999969 | 6.211605 |
a343c547-4984-442b-beea-9d6ebbf0a982 | ROCm/firdev-llvm-project | llvm/lib/CodeGen/GlobalMerge.cpp | #include "llvm/ADT/BitVector.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/Triple.h"
#include "llvm/ADT/Twine.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/IR/BasicBlock.h"
#in... | TOOL | 0.986528 | 7.751817 |
26b795a3-71fd-40f2-b132-576fd04c0308 | ShwetaCodeCraft/DSA-C- | p26.cpp | // sorting-4
//short the given array using merge sort
#include<bits/stdc++.h>
using namespace std;
void merge(int arr[], int low, int mid, int high){
vector<int> temp;
int left= low;
int right= mid+1;
while(left<=mid && right<=high){
if(arr[left]<=arr[right]){
temp.push_back(arr[le... | ALGO | 0.999997 | 5.043077 |
9d428152-aed5-4df8-9a5f-33a4c158e969 | MiyamuP/AtCoder | ABC204/q_b.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cin>>n;
int a[n];
int sum=0;
for (int i=0; i<n; i++) {
cin>>a[i];
if(a[i]>10) {
sum+=a[i]-10;
}
}
cout<<sum<<endl;
return 0;
} | ALGO | 0.998435 | 3.331319 |
c4acc7f7-7267-4773-86aa-1b3a3f74edcf | frankie-yanfeng/CPP-program-design | C++/Lesson9/setPractice/main.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <set>
#include <algorithm>
#include <string>
using namespace std;
int main() {
int iCount;
set<int> ss;
cin >> iCount;
for (int i=0; i<iCount; ++i){
int type, query;
cin >> type >> query;
switch (type){
case 1:
... | ALGO | 0.999541 | 4.247706 |
5ddc998e-b142-4fa3-924a-7f0f92103e63 | adilahmad17/Obfuscuro | llvm/llvm-4.0.0.src/tools/clang/tools/libclang/CXSourceLocation.cpp | #include "clang/Frontend/ASTUnit.h"
#include "CIndexer.h"
#include "CLog.h"
#include "CXLoadedDiagnostic.h"
#include "CXSourceLocation.h"
#include "CXString.h"
#include "CXTranslationUnit.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Format.h"
using namespace clang;
using namespace clang::cxindex;
//==... | TOOL | 0.909765 | 4.327072 |
feffbe22-ba3e-4248-853a-1e6ad52b4a47 | Young-Song/percolation | testpercolation.cpp |
#include <iostream>
#include "dsets.h"
#include "percolation.h"
#include "easypng.h"
int main()
{
//get input size and probability from user
int size;
double probability;
cout<<"Please enter an integer as size:\n";
cin>>size;
cout<<"Please enter a decimal number between 0 and 1 as percolation pro... | ALGO | 0.980327 | 4.677173 |
30cb025f-7d70-4177-bff9-e1e20bc3d717 | sanyagargg/LeetcodeSolutions | Graphs/MinSpanningTree or DisjointSet/Most-Stones-Removed-with-Same-Row-or-Column.cpp | class Solution {
public:
int find(int u, unordered_map<int, int>& parent) {
if (parent[u] != u)
parent[u] = find(parent[u], parent);
return parent[u];
}
void unite(int u, int v, unordered_map<int, int>& parent) {
int pu = find(u, parent);
int pv = find(v, parent)... | ALGO | 0.999533 | 6.212873 |
d95a1b7d-71a2-4adb-9938-e007c868cadf | Pritam723/ProblemSolving | 2640-maximum-number-of-integers-to-choose-from-a-range-i/2640-maximum-number-of-integers-to-choose-from-a-range-i.cpp | class Solution {
public:
int maxCount(vector<int>& banned, int n, int maxSum) {
// sort(banned.begin(), banned.end());
// int m = banned.size();
int i = 1;
unordered_map<int, bool> mp;
for(int b: banned) mp[b] = true;
// cout << endl;
int summ = 0;
i... | ALGO | 0.999948 | 5.76053 |
20fa7d8d-a276-4ab0-8dfe-28740ff72951 | rares-gh-pisoi/pbinfo | Clasa9/meditatie info/teme/13.2.2024/Interval3/Interval3/main.cpp | #include <iostream>
using namespace std;
int v[1000];
int main()
{
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>v[i];
}
int pr=v[0];
int u=v[n-1];
int aux;
aux=pr;
pr=u;
u=aux;
int interval=1;
for(int i=1;i<n-1;i++){
if(v[i]<pr || v[i]>u){
interv... | ALGO | 0.999865 | 3.9841 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.