uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
20db3b2d-95bc-45d6-814e-9874a8e3faf4 | alexandraback/datacollection | solutions_5709773144064000_0/C++/Lamak/B.cpp | #include <iostream>
#include <fstream>
#include <iomanip>
using namespace std;
int main () {
ifstream in ("B-small-attempt0.in");
ofstream cout("small.out");
cout.setf( std::ios::fixed, std:: ios::floatfield );
cout.precision(7);
int T;
in>>T;
for (int t=0; t<T; t++) {
const double rate=2.0d;
int farms... | ALGO | 0.99958 | 3.694192 |
89e73de1-9bcb-4d5c-8c52-6ce744dcd1c8 | Corycle/OI-Codes | Bashu OnlineJudge/3756.cpp | /*====Corycle====*/
#include<algorithm>
#include<iostream>
#include<iomanip>
#include<cstring>
#include<cstdlib>
#include<complex>
#include<cstdio>
#include<vector>
#include<cmath>
#include<ctime>
#include<stack>
#include<queue>
#include<map>
#define ll long long
using namespace std;
const int inf=0x3f3f3f3f;
const int... | ALGO | 0.999924 | 4.176849 |
f32deca1-2904-4dd0-b0c1-fd90e7bca2b7 | ailaa-jadoo/Leetcode-questions-LeetHub | 2462-total-cost-to-hire-k-workers/2462-total-cost-to-hire-k-workers.cpp | class Solution {
public:
long long totalCost(vector<int>& costs, int k, int candidates) {
priority_queue<int, vector<int>, greater<int>> pq1, pq2;
long long res = 0;
int count = 0;
int i=0, j=costs.size()-1;
while(count<k){
while(pq1.size()<candidates and i<=j)
... | ALGO | 0.9999 | 5.520158 |
a3246bd2-7c85-483c-bad0-e69f986d82a4 | moowlf/advent-of-code | 2020/01/main.cpp |
// Cpp Includes
#include <fstream>
#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>
std::vector<int> getInputs(std::string_view inputFile) {
std::ifstream input(inputFile.data());
std::vector<int> content;
if (!input.is_open()) throw std::runtime_error("File opening failed.");
... | ALGO | 0.983845 | 5.316182 |
599a3a6c-108a-49e6-8a52-706d1f78aabb | YooJaeJun/PS-Algorithm- | 프로그래머스/lv3/43163. 단어 변환/단어 변환.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
const int inf = 9999999;
vector<vector<bool>> nodes;
vector<bool> visited;
bool possible;
int answer;
bool isSimilar(string s1, string s2) {
int sameNum = 0;
for (int i = 0; i != s1.size(); i++) {
if (s1[i] == s2[i]) {
... | ALGO | 0.99994 | 5.182687 |
5c7cd72b-fa32-4599-9684-dc14c32967a2 | Ruchanov/Algorithms-and-Data-Structures | midterm_upsolving/K.cpp | #include<iostream>
using namespace std;
struct Node{
int val;
Node* next;
Node(int val){
this->val = val;
next = nullptr;
}
};
struct LinkedList{
Node* head = nullptr;
Node* tail = nullptr;
void push_back(int x){
Node* cur = head;
Node* newNode = new Node(x)... | ALGO | 0.99983 | 4.157338 |
de076bf7-e197-42da-a8a0-a612fec2e5c6 | ganesh1151/DSA-using-C- | Hashing/count_distinct_elements_in_every_window_efficient.cpp | //time complexity o(n) and auxiliary space o(k)
#include<iostream>
#include<map>
using namespace std;
void printDistinct(int arr[], int n, int k)
{
map<int, int> m;
for(int i=0;i<k;i++)
m[arr[i]]+=1;
cout<<m.size()<<" ";
for(int i=k;i<n;i++){
m[arr[i-k]]-=1;
if(m[arr[i-k]... | ALGO | 0.999943 | 4.322779 |
02fc8c04-0cba-4cbb-8804-50088afd0156 | Resha-Munikar/C-Programming | Array/7.cpp | //Program to take 10 numbers from user, arrange them in ascending order and count total odd numbers
#include<stdio.h>
int main()
{
int a[10],i=0,j=0,temp=0,odd=0;
for(i=0;i<10;i++)
{
printf("\nEnter element %d: ",i+1);
scanf("%d",&a[i]);
if(a[i]%2==1)
{
odd++;
}
}
printf("\nThe ascending order is:");
... | ALGO | 0.999507 | 3.255503 |
3979fb9c-844b-4484-9505-e524f1d59772 | ishandutta2007/codeforces | tsukiko_tsutsukakushi/normal/1701/B.cpp | /**
* author: otera
**/
#include<bits/stdc++.h>
using namespace std;
#define int long long
using ll = long long;
using ld = long double;
using ull = unsigned long long;
using int128_t = __int128_t;
#define repa(i, n) for(int i = 0; i < n; ++ i)
#define repb(i, a, b) for(int i = a; i < b; ++ i)
#define repc(i, a,... | ALGO | 0.999818 | 4.147428 |
b87f1333-4b73-4804-b041-d778e3be4927 | randbatch-md/lammps-rbe | lib/kokkos/example/tutorial/Advanced_Views/04_dualviews/dual_view.cpp | #include <Kokkos_Core.hpp>
#include <Kokkos_DualView.hpp>
#include <Kokkos_Timer.hpp>
#include <cstdio>
#include <cstdlib>
// DualView helps you manage data and computations that take place on
// two different memory spaces. Examples include CUDA device memory
// and (CPU) host memory (currently implemented), or Inte... | TOOL | 0.950566 | 6.496617 |
bf7163ec-451a-4551-a690-5171717115a3 | ishandutta2007/codeforces | sirrembocodina/normal/1284/C.cpp | #include <iostream>
#include <map>
#include <vector>
#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define fs first
#define sc second
#define pb push_back
int n;
int f[300100];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
c... | ALGO | 0.999991 | 5.175344 |
a66d24dd-70bf-4eae-8933-109386f25bac | cloudv2077/At_Offer | 027.cpp | #include <iostream>
#include <string>
#include <vector>
#include <set>
using namespace std;
class Solution {
public:
vector<string> Permutation(string str) {
vector<string> rs;
set<string> sets;
if(!str.length()){ return rs; }
if(str.length() == 1){
rs.push_back(str);
... | ALGO | 0.999887 | 5.176305 |
8e954825-c3f5-4c59-801d-e72ff43b318f | NMRanaHamid/Problem_Solving | Personal/Same_Component.cpp | #include<bits/stdc++.h>
#define pii pair<int,int>
using namespace std ;
const int N = 1e3+5;
bool visited[N][N];
char adj[N][N];
int n,m;
vector<pii> path = {{-1,0},{1,0},{0,1},{0,-1}};
bool valid(int ci, int cj)
{
return (ci>=0 and ci<n and cj>=0 and cj<m and adj[ci][cj]=='.');
}
void dfs(int si, int sj)
{
vis... | ALGO | 0.99994 | 4.007944 |
87153a3b-716e-44d2-99d8-a42bfc92216f | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-coop-gpt4/Codenet/p00624/733888721/improved.cpp | #include <algorithm>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <functional>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
using names... | ALGO | 0.999818 | 3.875982 |
89063984-907b-46e0-b2f3-a390bac9f46f | ashutosh017/cp_journey | 319_kth_not_div_by_k.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define forn(i, a, b) for(int i=a;i<=b;i++)
#define ford(i,a,b) for(int i=a;i>=b;i--)
#define rep(i, n) forn(i, 0, n-1)
#define fi first
#define se second
#define vi vector<int>
#define vll vector<ll>
#define vb vector<bool>
#define vvi vector<vector<in... | ALGO | 0.999873 | 3.540297 |
e252c973-ad12-42db-8b4b-963a301efb80 | gorden5566/code-for-gorden | others/kmp.cpp | /*
* =====================================================================================
*
* Filename: kmp.cpp
*
* Description:
*
* Version: 1.0
* Created: 2014年10月11日 20时33分20秒
* Revision: none
* Compiler: gcc
*
* Author: gorden5566 (), <EMAIL>
* Orga... | ALGO | 0.999617 | 4.773826 |
4aa88fd1-951a-4721-8a51-793d8bee3abc | TVMD-UAV/TVMD-PX4 | src/modules/mc_hover_thrust_estimator/zero_order_hover_thrust_ekf.cpp | /**
* @file zero_order_thrust_ekf.cpp
*
* @author Mathieu Bresciani <<EMAIL>>
*/
#include "zero_order_hover_thrust_ekf.hpp"
using matrix::sign;
void ZeroOrderHoverThrustEkf::predict(const float dt)
{
// State is constant
// Predict state covariance only
_state_var += _process_var * dt * dt;
_dt = dt;
}
voi... | ALGO | 0.970105 | 6.212011 |
b06ce8e2-936c-4508-874c-8c337f639198 | manikanta2901/ubuntu | .history/practice/cpp/codeforces/GCDSum_20210406141448.cpp | #include <bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#include<queue>
using namespace std;
#define trav(dataType,DataStruct,name) for(dataType<DataStruct>::itt ip = name.bb(); ip != name.ee(); ip++)
//Pre processors & typedefs
... | ALGO | 0.999669 | 4.349319 |
aee618ee-78da-44e3-8c98-922a1fe50740 | shumbul/DSA-Sheet | Day 31/90. Stone Game.cpp | class Solution {
int sumA = 0;
int sumB = 0;
int count = 1; //Odd = A’s turn, Even = B’s turn
int idxf = 0;
int idxl = 0;
public:
bool stoneGame(vector<int>& piles) {
idxl = piles.size() - 1;
if (count % 2 != 0) { //if alice's turn
//pick larger value
if (pile... | ALGO | 0.99998 | 5.348652 |
c43a7b59-91d6-47ef-8dec-76af28170b8e | Unusuario2/mini-sdk-compiletools | src/utils/vvis/flow.cpp | int g_TraceClusterStart = -1;
int g_TraceClusterStop = -1;
/*
each portal will have a list of all possible to see from first portal
if (!thread->portalmightsee[portalnum])
portal mightsee
for p2 = all other portals in leaf
get sperating planes
for all portals that might be seen by p2
mark as unseen if n... | ALGO | 0.99955 | 4.327747 |
a2791a29-623f-4ee4-8f64-654aa18a085a | raincross7/code-similarity | codes/train_code/problem007/problem007_86.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int max_n=200005;
int n,a[max_n];
int main(){
scanf("%d",&n);
ll sum=0;
for(int i=1;i<=n;i++){
scanf("%d",a+i);
sum+=a[i];
}
ll x=0;
ll ans=1e18;
for(int i=1;i<n;i++){
x+=a[i];
ans=min(an... | ALGO | 0.999835 | 3.655186 |
648107ba-0875-440f-bf1f-06a10e1a7066 | helloworldgnu/Algorithm | sort/sort.cpp | #include <iostream>
#include "../util/util.h"
#include "../util/random_generator.h"
#include "../util/timer.h"
#include "./insertion/InsertionSort.h"
#include "./shell/ShellSort.h"
#include "./merge/MergeSort.h"
#include "./quick/QuickSort.h"
#include "./heap/HeapSort.h"
int main(int argc, char *argv[])
{
std::... | ALGO | 0.954828 | 5.230606 |
dd437cd3-7248-4472-9431-92e0cb88df87 | core-marine-dev/elmerfem | ElmerGUI/netgen/libsrc/csg/bspline2d.cpp | #include <mystdlib.h>
#include <csg.hpp>
namespace netgen
{
BSplineCurve2d :: BSplineCurve2d ()
{
redlevel = 0;
}
void BSplineCurve2d :: AddPoint (const Point<2> & apoint)
{
points.Append (apoint);
intervallused.Append (0);
}
bool BSplineCurve2d :: Inside (const Point<2> & p, double & dist) const
{
Point<2... | ALGO | 0.999525 | 6.363446 |
3ad8a104-64d2-440c-8d17-382878a9a14c | ChoonHean/Kattis | src/canofworms.cpp | #include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<double> vd;
typedef long long ll;
typedef vector<ll> vl;
typedef pair<int, int> pii;
template<typename T>
void print(T it) {
for (auto i = it.begin(); i != it.end(); i++) {
cout << *i << " ";
}
cout << endl;
}
cl... | ALGO | 0.999827 | 4.492003 |
9810a716-fe5e-4a21-afdb-8285ac723bce | Haraden994/Retrowave-Audio-Reactive-Runner | include/bullet/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp | #include "btMinkowskiSumShape.h"
btMinkowskiSumShape::btMinkowskiSumShape(const btConvexShape* shapeA,const btConvexShape* shapeB)
: btConvexInternalShape (),
m_shapeA(shapeA),
m_shapeB(shapeB)
{
m_shapeType = MINKOWSKI_DIFFERENCE_SHAPE_PROXYTYPE;
m_transA.setIdentity();
m_transB.setIdentity();
}
btVector3 btMinko... | ALGO | 0.972926 | 6.204347 |
71f13f56-477c-4d6f-b421-43d349d9b21e | nitro44x/concurrencyBookclub | problem1_locking.cpp | #include <atomic>
#include <chrono>
#include <condition_variable>
#include <iostream>
#include <mutex>
#include <string>
#include <thread>
using namespace std::chrono_literals;
void print(const std::string &value) { std::cout << value; }
std::mutex g_mux;
std::condition_variable g_cv;
int g_counter = 0;
void printF... | TOOL | 0.930436 | 4.655412 |
b73df862-f1fe-4591-b80b-be222b27156b | omprakash524/DSA-CPP-CODE | 4. Arrays/code/maxConsecutiveOnes.cpp | #include<iostream>
using namespace std;
int maxConsecutiveOnes(bool arr[], int n){
int res = 0;
for(int i=0;i<n;i++){
int curr=0;
for(int j=i; j<n; j++){
if(arr[j]==1){
curr++;
}else{
break;
}
res = max(res,curr);
}
return res;
} //... | ALGO | 0.999906 | 5.755518 |
a7c9f847-6c8b-44cf-9ae9-103bb36a1655 | wangtss/leetcodePractice | source/168.cpp | string convertToTitle(int n) {
string result, sub;
while (n) {
result = (char)((n - 1) % 26 + 'A') + result;
n = (n - 1) / 26;
}
return result;
} | ALGO | 0.999318 | 5.648327 |
a9aa04ba-ba46-4ebb-9501-91852d165fb7 | tamojit-123/c_practice2 | cubelistcpp/main.cpp | #include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int numb;
for (numb=1; numb<=10; numb++)
{
cout << setw(4) << numb;
int cube = numb*numb*numb;
cout << setw(6) << cube << endl;
}
return 0;
}
| ALGO | 0.974125 | 3.736003 |
ebb761fa-1619-40b7-b582-4a7b94747c1d | mozilla/integration-mozilla-inbound | netwerk/base/src/nsURLParsers.cpp | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include <string.h>
#include "mozilla/RangedPtr.h"
#include "nsURLParsers.h"
#include "nsURLHelper.h"
#include "nsIURI.h"
#include "prtypes.h"
#include "nsString.h"
#include "nsCRT.h"
#include "netCore.h"
using namespace mozilla;
//---... | TOOL | 0.913224 | 7.377842 |
f0ba2086-07b4-40f5-a2f8-e5f90721fa1e | parteek10/LeetCodeContest | Weekly314/A.cpp | //https://leetcode.com/contest/weekly-contest-314/problems/the-employee-that-worked-on-the-longest-task/
int hardestWorker(int n, vector<vector<int>>& logs) {
int maxi=logs[0][1];
int res=logs[0][0];
int prev_time=logs[0][1];
for(int i=1;i<logs.size();i++){
if(maxi<(lo... | ALGO | 0.999841 | 6.32809 |
746f0d94-d756-4b6c-b69c-da9273f0f457 | ishandutta2007/codeforces | ashishgup/normal/1101/G.cpp | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl "\n"
#define int long long
const int N=1e5+5;
const int MOD=1e9+7;
struct Gauss
{
static const int bits = 32;
int table[bits];
Gauss()
{
for(int i = 0; i < bits; i++)
table[i] = 0;
... | ALGO | 0.999918 | 4.249201 |
8f3c334c-0d13-4fe1-bf45-15c5c07077d0 | TheReeplex/PrisonStation | tools/Runtime Condenser/Main.cpp | /* Runtime Condenser by Nodrak
* This will sum up identical runtimes into one, giving a total of how many times it occured. The first occurance
* of the runtime will log the proc, source, usr and src, the rest will just add to the total. Infinite loops will
* also be caught and displayed (if any) above the list of r... | TOOL | 0.876769 | 3.819539 |
dcc8398c-79c3-4a31-aa5e-f08f8fbb0f81 | plasma712/Jushin_Academy | 02.국기반/1개월차/190531/190531/메모리관련.cpp | #include<iostream>
using namespace std;
// ǥ Լ.
void main()
{
// ##1. memcpy Լ.
// Լ.
// ߿ ӽ ۸ ġ ʴ´.
// int iArr_1[5] = {};
// int iArr_2[5] = { 10,20,30,40,50 };
// memcpy(dst, src, size)
// srcκ sizeŭ dst Ѵ.
// memcpy(iArr_1, iArr_2, 16);
// for (int i = 0; i < 5; i++)
// {
// cout << ... | TOOL | 0.88952 | 3.497181 |
ff298940-abc9-4fe3-af2a-bc1c613b8e71 | Shahdev32/Cpp_Programming | inverse...cpp | #include<iostream>
using namespace std;
int main ()
{
int a;
cout<<"Enter array size:";
cin>>a;
int arr[a];
cout<<"enter the array element :";
for(int i=0;i<a;i++){
cin>>arr[i];
}
cout<<"the array element are :";
for(int i=0;i<a;i++){
cout<<arr[i]<<endl;
}
cout<<"Reverse oder of array are:";
for(int i=0;i<=a;a--){... | ALGO | 0.971009 | 3.048605 |
af5c09c3-aa2f-47ba-bf04-e6a816d68261 | PragmaticWays/cplusplus3 | recursive-power-function/Main.cpp | /********************************
Program Exponent Function - This program demonstrates recursion by creating a
function that accepts any type of number and an int, and raises the first number by an exponent of the
second number. It then utilizes the function several times in main() to demonstrate it works properly
... | ALGO | 0.857843 | 5.487534 |
ca7c9059-a341-4f9d-9913-dace2a43260f | NocNoc-Official/NocNoc | src/rpcblockchain.cpp | #include "base58.h"
#include "checkpoints.h"
#include "clientversion.h"
#include "main.h"
#include "rpcserver.h"
#include "sync.h"
#include "txdb.h"
#include "util.h"
#include "utilmoneystr.h"
#include <stdint.h>
#include <univalue.h>
using namespace std;
extern void TxToJSON(const CTransaction& tx, const uint256 ha... | WEB | 0.884075 | 6.010506 |
786141db-6b83-4762-b08d-e038a6a01797 | yash-gargji/codeforces-solution | D_Sum_of_LDS.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int prev = -1;
long long sum = 0;
long long ans = 0;
for(int i = 0;i<n;i++){
int num;
cin>>num;
if(num > prev)
... | ALGO | 0.999641 | 4.634726 |
77d0c281-308a-4c96-bcdf-4651bcf05f93 | SubashChandra/geeksCoding | 3_Hashing/2_theParagraph.cpp | //given a file with multiple paragraph each seperated by a new line nd each paragraph with different words (may repeat)
//check if there exists a paragraph which contains all the words in the file
//use map to keep track of unique elements in the file, word for key nd para no for value nd track maxdistinct elements so... | ALGO | 0.999423 | 4.280506 |
a8bace8b-23b1-4815-b557-01001653b556 | smurry/XCSoar | src/Engine/Trace/Trace.cpp | #include "Trace.hpp"
#include "Navigation/Aircraft.hpp"
#include <algorithm>
Trace::Trace(const unsigned _no_thin_time, const unsigned max_time,
const unsigned max_points)
:chronological_list(ListHead::empty()),
cached_size(0),
m_max_time(max_time),
no_thin_time(_no_thin_time),
m_max_points(... | ALGO | 0.938335 | 6.818422 |
5955c109-377f-41f8-a576-461d747833c9 | ishandutta2007/codeforces | wzyyn/normal/1581/F.cpp | #include<bits/stdc++.h>
using namespace std;
const int N=4005;
int n,m,a[N];
long long f[N][N],tmp[N];
int build(int l,int r){
if (l>r) return 0;
int k=l;
for (int i=l;i<=r;i++)
if (a[i]<a[k]) k=i;
int ls=build(l,k-1);
int rs=build(k+1,r);
if (ls){
for (int i=0;i<=k-l;i++)
f[ls][i]+=1ll*(a[ls]-a[k])*i*(... | ALGO | 0.999972 | 3.414697 |
e6ce7950-5fc5-46e2-bedf-d03b947bba58 | ShuYuMo2003/Generative-Articulated-Object-s- | third_party/ManifoldPlus/3rd_party/libigl/include/igl/heat_geodesics.cpp | #include "heat_geodesics.h"
#include "grad.h"
#include "doublearea.h"
#include "cotmatrix.h"
#include "intrinsic_delaunay_cotmatrix.h"
#include "massmatrix.h"
#include "massmatrix_intrinsic.h"
#include "grad_intrinsic.h"
#include "boundary_facets.h"
#include "unique.h"
#include "slice.h"
#include "avg_edge_length.h"
t... | ALGO | 0.999862 | 6.976087 |
24507fcf-e718-46b0-9fee-563f6b086373 | andi34/SlimRoms_frameworks_native | opengl/libagl/vertex.cpp | #include <stdio.h>
#include <stdlib.h>
#include "context.h"
#include "fp.h"
#include "vertex.h"
#include "state.h"
#include "matrix.h"
namespace android {
// ----------------------------------------------------------------------------
void ogles_init_vertex(ogles_context_t* c)
{
c->cull.enable = GL_FALSE;
c-... | TOOL | 0.855865 | 6.104946 |
8b03cb86-6163-4d37-984f-dae5a1ded35e | Pratik-Ninawe/LeetCode-DSA | 0416-partition-equal-subset-sum/0416-partition-equal-subset-sum.cpp | class Solution {
public:
bool canPartition(vector<int>& nums) {
int sum = 0, n = nums.size();
for (int i = 0; i < n; i++) {
sum += nums[i];
}
if (sum % 2 != 0)
return false;
bitset<10001> bit(1);
for (auto i : nums) {
bit |= bit <... | ALGO | 0.999797 | 5.836529 |
ef1b6ade-009d-4588-8182-9a02c5fe7e73 | nxmai/dsa-practice | leetcode/0283.cpp | #include <bits/stdc++.h>
using namespace std;
void moveZeroes(vector<int>& nums) {
int i = 0, j = 0;
int n = nums.size() - 1;
while(i < n && j < n){
while(i < n && nums[i] != 0){
i++;
}
while(j < n && !(nums[j] != 0 && j > i)){
j++;
}
swap(num... | ALGO | 0.999992 | 5.921685 |
f60e1ad7-3a59-47c8-8649-6e7a3cb24595 | ItsLucas/acm | 41010_3.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
unordered_map<long long, int> three;
unordered_map<long long, int> he;
ll qm(ll a, ll b, ll c) {
long long ans = 0, res = a;
while (b) {
if (b & 1)
ans = (ans + res) % c;
res = (res + res) % c;
b >>= 1;
}... | ALGO | 0.999825 | 4.190522 |
790db875-5b9b-44ad-a7c3-39173885aff1 | BBBBBbruce/PhysicsSimPro | external_lib/PhysX/physx/source/geomutils/src/pcm/GuPCMContactConvexConvex.cpp | #include "geomutils/GuContactBuffer.h"
#include "GuGJKPenetration.h"
#include "GuEPA.h"
#include "GuVecConvexHull.h"
#include "GuVecConvexHullNoScale.h"
#include "GuGeometryUnion.h"
#include "GuContactMethodImpl.h"
#include "GuPCMShapeConvex.h"
#include "GuPCMContactGen.h"
namespace physx
{
using namespace Ps::ao... | ALGO | 0.990944 | 6.535595 |
2965c4b1-0ee4-4f9b-a796-b0562a59ec2d | yoavweiss/RespImg-WebKit | Tools/DumpRenderTree/cf/WebArchiveDumpSupport.cpp | #include "config.h"
#include "WebArchiveDumpSupport.h"
#include <CoreFoundation/CoreFoundation.h>
#include <CFNetwork/CFNetwork.h>
#include <wtf/RetainPtr.h>
extern "C" {
CFURLRef CFURLResponseGetURL(CFURLResponseRef response);
CFStringRef CFURLResponseGetMIMEType(CFURLResponseRef response);
CFStringRef CFURLRespons... | TOOL | 0.914668 | 5.876329 |
550a2e35-2bcc-4447-aa45-b5519b201b9b | matsumoto2004/competitive_programming | template_file/hacker_cup.cpp | #include<bits/stdc++.h>
#include<cassert>
//#include<ext/pb_ds/assoc_container.hpp>
//#include<ext/pb_ds/tree_policy.hpp>
//#include<ext/pb_ds/tag_and_trait.hpp>
#define overload4(_1, _2, _3, _4, name, ...) name
#define rep1(i, n) for (ll i = 0; i < ll(n); ++i)
#define rep2(i, s, n) for (ll i = ll(s); i < ll(n); ++i)
#... | ALGO | 0.999346 | 4.666485 |
a6916e37-0687-441b-985b-59583664d01d | reddevilmidzy/LeetCode | 0387-first-unique-character-in-a-string/0387-first-unique-character-in-a-string.cpp | class Solution {
public:
int firstUniqChar(string s) {
int cnt[26] = {};
for (int i = 0; i < s.length(); i++) {
cnt[s[i] - 'a']++;
}
for (int i = 0; i < s.length(); i++) {
if (cnt[s[i] - 'a'] == 1) {
return i;
}
}
... | ALGO | 0.999914 | 6.079694 |
a9640810-e492-464c-9149-7c638e4416ce | ashuilubajaj01/aps2 | Code library/blessing_of_lord_shiva.cpp | #include<bits/stdc++.h>
#include<cstring>
#include<string>
#include<algorithm>
#include<iostream>
using namespace std;
long long int find(char *str,long long int n)
{
long long int res=0;
for(int i=0;i<n;i++)
{
if(i%2==0 && str[i]=='b')
{
res++;
}
if(i%2==1 &&... | ALGO | 0.999695 | 4.028118 |
64b5ec1a-8831-4c81-9c91-1e2674f70f2c | Hcm455429728/Trans_PingStitching | Trans_PingStitching/Trans_PingStitching/eigen3/lapack/eigenvalues.cpp | #include "lapack_common.h"
#include <Eigen/Eigenvalues>
// computes eigen values and vectors of a general N-by-N matrix A
EIGEN_LAPACK_FUNC(syev,(char *jobz, char *uplo, int* n, Scalar* a, int *lda, Scalar* w, Scalar* /*work*/, int* lwork, int *info))
{
// TODO exploit the work buffer
bool query_size = *lwork==-1;... | ALGO | 0.998506 | 4.671507 |
57052185-142b-42c9-b0ed-78f2095f98d9 | vertoreum/vertoreum | src/wallet/crypter.cpp | #include "crypter.h"
#include "crypto/aes.h"
#include "crypto/sha512.h"
#include "script/script.h"
#include "script/standard.h"
#include "util.h"
#include <string>
#include <vector>
#include <boost/foreach.hpp>
int CCrypter::BytesToKeySHA512AES(const std::vector<unsigned char>& chSalt, const SecureString& strKeyData... | TOOL | 0.913094 | 7.578944 |
f5e52d71-1e95-4f9e-af1d-1bc034512577 | ankursinghkuntal/DSA | GRAPH/Questions/City With the Smallest Number of Neighbors at a Threshold Distance.cpp | // There are n cities labeled from 0 to n-1 with m edges connecting them. Given the array edges where edges[i] = [fromi , toi ,weighti]
// represents a bidirectional and weighted edge between cities fromi and toi, and given the integer distanceThreshold. You need to find
// out a city with the smallest number of ci... | ALGO | 0.999999 | 6.750479 |
7d8bd74a-3919-4aa2-a2fd-5e59f7d313ee | sabbirahmedfahim/ProblemSolving | Codeforces/B_Tenzing_and_Books.cpp | #include <bits/stdc++.h>
#define nl '\n'
#define ll long long
#define all(c) c.begin(),c.end()
#define print(c) for(auto e : c) cout << e << " "; cout << nl
using namespace std;
void solve()
{
int n, x; cin >> n >> x;
vector<int> a(n), b(n), c(n);
for(auto &e : a) cin >> e;
for(auto &e : b) cin >> e;
... | ALGO | 0.999771 | 4.474153 |
b70d5199-cae3-43ba-ba3e-3ed5d81f6656 | spaceskynet/Model | Datastructure/kthNumber-2.cpp | //spaceskynet 2017-08-07 ZX-segtree kth-big
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=1e5+10;
struct node
{
int s;//
node *ls,*rs;
}t[maxn*18],*root[maxn];
int n,m,tot=0,sz,a[maxn],b[maxn];
void init();
bool cmp(const int&,const int&);
void build(node*&,node*,int,int,... | ALGO | 0.999971 | 4.227112 |
6797d9b9-8b06-4f3b-a046-34e61bd58e0f | paridhigulati/LeetCode | 2202-maximize-the-topmost-element-after-k-moves/2202-maximize-the-topmost-element-after-k-moves.cpp | class Solution {
public:
int maximumTop(vector<int>& nums, int k) {
if (nums.size() == 1 && k%2 == 1) return -1;
priority_queue<int>pq;
for (int i=0;i<nums.size() && i<k-1; ++i) {
pq.push(nums[i]);
}
int m{};
if (!pq.empty()) {
m = pq.top(... | ALGO | 0.999895 | 5.507622 |
b8842b4a-e5d6-4d04-9d30-bd71718882c6 | mcrl/SnuRHAC | mapa/tools/clang/lib/Basic/FileManager.cpp | #include "clang/Basic/FileManager.h"
#include "clang/Basic/FileSystemStatCache.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/Path... | TOOL | 0.88043 | 7.762894 |
be66b0c3-24b9-4956-a290-1b5cf1dcfc85 | CrypticSai-08/LeetCode | 2181-merge-nodes-in-between-zeros/2181-merge-nodes-in-between-zeros.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
// ListNode* mergeNod... | ALGO | 0.999941 | 5.576772 |
c0c586aa-0e80-4b09-85ae-e3d1c5b5db15 | jaredramey/AutomationTest_Playground | Engine/Plugins/Experimental/PlanarCutPlugin/Source/PlanarCut/Private/FractureAutoUV.cpp | #include "Distance/DistLine3Segment3.h"
#include "GeometryMeshConversion.h"
#include "Distance/DistLine3Triangle3.h"
#include "GeometryCollection/GeometryCollectionAlgo.h"
#include "Distance/DistSegment3Triangle3.h"
#include "DynamicMesh/MeshNormals.h"
#include "Generators/MeshShapeGenerator.h"
#include "Parameteriza... | TOOL | 0.977144 | 3.761565 |
59ec4bb6-e02a-4b24-8b4b-40c603e6a754 | Anhdozxc/-Ho-ng-Anh__thcs2PTIT | Bài tập 2.cpp | #include <stdio.h>
#include <string.h>
typedef struct {
int id;
char name[101];
char dob[11];
float score1, score2, score3, totalScore;
} Candidate;
int main() {
int n, i, maxIndex = 0;
printf("Nhap so luong thi sinh: ");
scanf("%d", &n);
Candidate candidates[n];
for (i = 0; i < n... | TOOL | 0.993227 | 4.118468 |
087d313a-2c54-4bef-bdb5-1766f0576545 | pratikanand13/Qbasedlearning | venv/lib/python3.11/site-packages/numpy/_core/tests/data/generate_umath_validation_data.cpp | #include <algorithm>
#include <fstream>
#include <iostream>
#include <math.h>
#include <random>
#include <cstdio>
#include <ctime>
#include <vector>
struct ufunc {
std::string name;
double (*f32func)(double);
long double (*f64func)(long double);
float f32ulp;
float f64ulp;
};
template <typename T>... | DATA | 0.855153 | 5.941265 |
ea6a70ba-ce4a-440a-9fa0-c6d48beab754 | squaresLab/BatFix | results/transcoder/python/references/N_TH_TERM_SERIES_2_12_36_80_150.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <numeric>
#include <algorithm>
using namespace std;
int f_gold ( int n ) {
return ( n * n ) + ( n ... | TEST | 0.977579 | 5.190946 |
dd79bc30-18cc-4681-9041-ad3ca5dd0aaf | GALAMAD-AEROSPACE/ADCS-code-for-stm32 | eigen-3.4.0/failtest/qr_int.cpp | #include "../Eigen/QR"
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
#define SCALAR int
#else
#define SCALAR float
#endif
using namespace Eigen;
int main()
{
HouseholderQR<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));
}
| TEST | 0.871474 | 3.071037 |
037bb8a7-7081-4dfe-b0fe-d765eadb0926 | ifding/learning-notes | data-structure/spatial_hashing/main.cpp | #include <string>
#include <fstream>
#include <iostream>
#include "stringset.h"
using namespace std;
void compute(void)
{
Stringset S;
string x, y;
ifstream wordfile("points.txt");
while (wordfile >> x >> y)
S.insert(x, y);
wordfile.close();
//S.print();
double smallest = S.compute();
cout << ... | ALGO | 0.971639 | 4.682645 |
3593c8c5-736e-40bc-ae96-67a173caa7e4 | raincross7/code-similarity | codes/train_code/problem217/problem217_237.cpp | #include <bits/stdc++.h>
#define rep(i,x,n) for(int i=x; i<(int)(n); i++)
using namespace std;
bool hantei(vector<string>& W) {
int l = W.size();
rep(i, 0, l-1) {
if ( W[i].back() != W[i+1].front() ) return false;
}
rep(i, 0, l) {
rep(j, i+1, l) {
if ( W[i] == W[j] ) return false;
}
}
... | ALGO | 0.999947 | 4.660767 |
94c90e53-dee6-4fbe-8e2b-e70159b35c11 | phanan04/Code-PTIT | SPOJ PTIT/CB02.cpp | // https://luyencode.net/problem/CB02
// CB02 - Tính tổng 2 số nguyên
#include <iostream>
using namespace std;
int main()
{
int a, b;
cin >> a >> b;
cout << a + b;
return 0;
} | ALGO | 0.995844 | 4.646976 |
8f295688-16c6-48b6-abbc-5ae240eee81e | R-Hys/compro | test/b.cpp | #include <iostream>
#include <set>
using namespace std;
string s;
void input()
{
cin >> s;
}
void solve()
{
set<char> st;
for (int i = 0; i < s.size(); ++i){
st.insert(s[i]);
}
cout << st.size() << endl;
}
int main()
{
cin.tie();
ios::sync_with_stdio(false);
// int ti = clock(... | ALGO | 0.999442 | 4.592896 |
e10de2eb-09b4-4841-9bc3-c85e0b32156f | ducviet00/AMDGPU-excercises | 04_kmeans_toy/kmeans_gpu.cpp | #include <float.h>
#include <hip/hip_runtime.h>
#include <stdlib.h>
#include "kmeans.h"
#define WARP_SIZE 64
#define BLOCKSIZE 256
#define BLOCKSIZE_XL 1024
#define DIVUP(x, y) ((x + y - 1) / y)
#define HIPCHECK(err) __checkHipErrors(err, __FILE__, __LINE__)
inline void __checkHipErrors(hipError_t err, const char *... | ALGO | 0.999803 | 6.063806 |
94630728-190a-48ad-bed9-193268e1ba02 | johnglover/modal | modal/detectionfunctions/detectionfunctions.cpp | #include "detectionfunctions.h"
#include "mq.h"
using namespace modal;
// ----------------------------------------------------------------------------
// Windowing
void hann_window(int window_size, sample* window) {
int i;
for(i = 0; i < window_size; i++) {
window[i] *= 0.5 * (1.0 - cos(2.0*M_PI*i/(window_size-1... | ALGO | 0.99909 | 6.678402 |
1b39560e-d726-4752-8c65-ee685be3715c | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_3470_311.cpp | #include <bits/stdc++.h>
using namespace std;
template <class T>
string toStr(const T &x) {
stringstream s;
s << x;
return s.str();
}
template <class T>
int toInt(const T &x) {
stringstream s;
s << x;
int r;
s >> r;
return r;
}
int main() {
int n;
cin >> n;
if (n == 1)
cout << 2;
else if (n ... | ALGO | 0.999906 | 3.299597 |
b900f526-22ef-446c-adf3-734e037852b4 | Kalpesh910/Problem-Solving | GFG k largest elements.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
vector<int> kLargest(int arr[], int n, int k) {
// code here
priority_queue<int>qu;
for(int i=0; i<k; i++){
qu.push((-1)*arr[i]);
}
fo... | ALGO | 0.999978 | 5.616782 |
9cd407a0-10a1-4f8a-88e8-8a09a3d1f5bc | 12345231534/Code-C | sangsonguyento.cpp | #include <stdio.h>
int prime[1000001];
int nt(){
for (int i=0;i<1000000;i++ ){
prime[i]= 1;
}
prime[0] = prime[1] = 0;
for (int i=0;i<=1000;i++){
if(prime[i]){
for (int j=i*i; j<=1000000;j+=i)
prime[j] = 0;
}
}
}
int main(){
nt();
int n;
scanf ("%d", &n);
for (int i=0; i<=n;i++){
if (prime[i]) pr... | ALGO | 0.998295 | 3.832477 |
5f82e89d-a723-452e-907f-4c31e54e9803 | dorameme/steady_algorithm_learner | 프로그래머스/점프와 순간 이동(lv2).cpp | /*
start:12:10
end:13:00
시간복잡도:O(lgn)
공간복잡도:O(1)
풀이:밑의 풀이는 쉬운문젠데 내가 너무 어렵게 푼듯하다. 거꾸로생각해보자..
어차피 최소로 갈려면 순간이동을 최대한 많이해야함
0에서 부터 출발한다고 생각하면 고민해야할 것이 굉장히 많지만, 반대로 생각해서 도착지점에서 거꾸로 되감기 해본다고 생각하면 문제를 좀 더 쉽게 해결할 수 있다는 것이 핵심이다.
그러니 함수 따로 뺼 필요없이 그냥 나누기랑 빼기로 풀면 됨~!
*/
#include <iostream>
using namespace std;
int answer;
void sol... | ALGO | 0.999943 | 4.107032 |
0ee6a4c7-74cc-46d6-b1a0-af64db0cbb18 | cod1r/aoc | 2024/day25.cpp | #include "../aoc_utils.h"
struct Schematic {
std::string type;
std::vector<int> heights;
};
int main(void) {
std::string contents = readFile("day25.input");
std::vector<std::string> lines = split(contents, "\n");
std::vector<Schematic> schematics;
std::vector<std::vector<std::string>> splitChunks;
std::... | ALGO | 0.993499 | 5.76625 |
936eeae4-2204-4bf3-93c9-7397aa927ecc | millaker/MiGPU-llvm-project | llvm/lib/CodeGen/LoopTraversal.cpp | #include "llvm/CodeGen/LoopTraversal.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/CodeGen/MachineFunction.h"
using namespace llvm;
bool LoopTraversal::isBlockDone(MachineBasicBlock *MBB) {
unsigned MBBNumber = MBB->getNumber();
assert(MBBNumber < MBBInfos.size() && "Unexpected basic block number.");
... | ALGO | 0.999378 | 7.62674 |
70de40af-e682-48fe-a646-d6e29856ea42 | lethanhdat04/Coding_challenges | TelcoDataCheckQuery.cpp | #include<iostream>
#include<map>
using namespace std;
bool checkPhone(string s) {
if (s.length() != 10) return false;
else {
for (int i = 0; i < s.length(); i++) {
if ((s[i] < '0') || (s[i] > '9')) return false;
}
}
return true;
}
int countTime(string ftime, string etime) ... | ALGO | 0.992194 | 3.715021 |
92fbe251-e03c-43f5-b3cc-5387b4f46285 | eloqdata/eloqdoc | src/mongo/db/geo/shapes.cpp | #include "mongo/db/geo/shapes.h"
#include "mongo/db/jsobj.h"
#include "mongo/util/mongoutils/str.h"
using std::abs;
// So we can get at the str namespace.
using namespace mongoutils;
namespace mongo {
////////////// Point
Point::Point() : x(0), y(0) {}
Point::Point(double x, double y) : x(x), y(y) {}
Point::Poin... | TOOL | 0.951276 | 6.123432 |
7e766671-4ff3-4f6d-8f3d-053878dbaff8 | pratham0203/450_DSA | Row_with_max_1.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int arr[4][4]={{0,0},{1,1}};
int n = 2;
int m = 2;
int right = m-1;
int top = 0;
int index=0;
if(arr==NULL || n==0){
cout<<-1;
}
while(right>=0 && top<n){
if(arr[top][right]==1){
index=top;
... | ALGO | 0.999793 | 3.492865 |
38dd45b1-e941-4c16-93d2-cd02c0e2603d | AustinBoyuJiang/Competitive-Programming | Competitions/HDU/2023/3rd round/第三场资料/std/1012.cpp | #include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
typedef long long ll;
typedef pair<ll,ll>P;
typedef vector<ll>V;
const int N=50005;
int Case,n,q,i,x,cnt,ce,ans[N];ll A,B;
struct E{V s;int t;}e[N*3];
inline int compare(const V&a,const V&b){
int n=a.size(),m=b.size(),i;
if(a[0]!=b[0])retu... | ALGO | 0.99987 | 3.512924 |
7c72f6bb-06a5-424d-bc92-887b49eb628d | psajd/AlgorithmsRealization | lab5/2.cpp | #include <bits/stdc++.h>
using namespace std;
const int mod = 1000029;
struct myMap {
vector<vector<pair<string, string>>> map;
myMap() {
map.resize(mod);
}
int hash(string x) {
int hash = 0;
for (int i = 0; i < x.size(); i++) {
hash *= 47;
hash += x[... | ALGO | 0.999796 | 4.534258 |
01ff4f0d-0ce4-4286-8b21-a792be031778 | chiru0631/DSA | graph/DFS_BFS/number_of_provinces.cpp | //547. Number of Provinces
/*
Problem Statment:
There are n cities. Some of them are connected, while some are not.
If city a is connected directly with city b, and city b is connected directly with city c,
then city a is connected indirectly with city c.
A province is a group of directly or indirectly... | ALGO | 0.999995 | 7.038098 |
a6a78b9e-aa57-4bd1-ade6-df1cfade0cff | martishin/tinyml-digits-recognition | src/edge-impulse-sdk/tensorflow/lite/micro/kernels/select.cpp | #ifndef TF_LITE_STATIC_MEMORY
#include "edge-impulse-sdk/tensorflow/lite/kernels/internal/reference/select.h"
#include <stddef.h>
#include <stdint.h>
#include "edge-impulse-sdk/tensorflow/lite/c/common.h"
#include "edge-impulse-sdk/tensorflow/lite/kernels/internal/tensor_ctypes.h"
#include "edge-impulse-sdk/tensorflo... | TOOL | 0.869466 | 7.764993 |
cdb7f62f-027d-44bd-a284-da36ed3f377d | Inexpediency/cpp-practice | lab1/flip_byte/flip_byte/flip_byte_utils.cpp | #include "stdafx.h"
#include "flip_byte_utils.h"
using namespace std;
bool CheckIsByteNumber(const string str)
{
size_t stringLen = str.length();
int number = 0;
for (size_t i = 0; i < stringLen; ++i)
{
number = (number * 10 + (str[i] - '0'));
if (('0' > str[i]) || (str[i] > '9') || (number > 255) || (number ... | TOOL | 0.875379 | 5.423572 |
b121de31-2372-417e-9dc3-39593afbfe52 | tf83f/Improving-classification | BOOT_P_1.CPP | /******************************************************************************/
/* */
/* BOOT_P_1 - Bootstrap estimate of bias and variance when s != t */
/* ... | ALGO | 0.997459 | 6.279715 |
e153ba7a-7bcc-48a7-a330-ca0f23eb2dd8 | PriDhingra/Tree | insertionInBST.cpp | #include<iostream>
#include<queue>
using namespace std;
class Node {
public:
int data;
Node* left;
Node* right;
Node(int data) {
this -> data = data;
this -> left = NULL;
this -> right = NULL;
}
};
void levelOrderTraversal(Node* root) {
queue<Node*> q;... | ALGO | 0.999905 | 5.035344 |
dc9f8b0c-9f48-446f-ace1-b4ea35339da5 | GROUP-F01/Proyek-Akhir-Semester-F01 | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
31ba6a4e-779c-40e3-b66f-d9c5d967bfce | Ashsifat1511/CP-Solves | B_Paranoid_String.cpp | #include<bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define forn for(int i = 0; i < n; i++)
const int N = 1e6+7;
typedef long long int ll;
#define pb push_back
#define cs cout<<"Case "<<tc<<": "
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int t=1;
cin>>t;
for(i... | ALGO | 0.999395 | 3.707994 |
16f76cb0-7c50-4d7f-a3db-9ff850eecf4e | karthikvg/Fibonacci-game | Project5/gameBoardUtil.cpp | #include<stdio.h>
#include<stdlib.h>
#include "making.h"
#pragma warning(disable:4996)
game* create(int n)
{
/*creates a new game with default values*/
game* newGame = (game*)malloc(sizeof(game));
for (int i = 0; i<4; i++)
for (int j = 0; j<4; j++)
newGame->a[i][j] = 0;
newGame->counter = 0;
newGame->n = n;
... | ALGO | 0.99871 | 3.349269 |
a6c19fc7-958d-4237-b714-b1326e1ed2a6 | built-with-aman/Competitve-CPP-Coding | Algorithms/wave_form.cpp | // wave form in matrix
#include<iostream>
#include <vector>
using namespace std;
int main(){
//pointer approach
// int rows, cols;
// cin >> rows >> cols;
// int** arr = new int*[rows];
// for(int i=0; i<rows; i++){
// arr[i] = new int[cols];
// for(int j=0; j<cols; j++){
// ... | ALGO | 0.999956 | 4.039422 |
21da2126-ac95-4e0f-a140-f0752dca3c73 | FreCap/telnet-boost | ext/boost_1_59_0/libs/numeric/ublas/doc/samples/triangular_adaptor.cpp | #include <boost/numeric/ublas/triangular.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
triangular_adaptor<matrix<double>, lower> tal (m);
for (unsigned i = 0; i < tal.size1 (); ++ i)
for (unsigned j = 0; j <= i; ++ j)
... | ALGO | 0.988277 | 3.658856 |
2212b981-291a-47aa-8ee7-3e7f9c18e543 | ee08b397/Lintcode-7 | Cpp/Subarray-Sum-II.cpp | class Solution {
public:
/**
* @param A an integer array
* @param start an integer
* @param end an integer
* @return the number of possible answer
*/
int subarraySumII(vector<int>& A, int start, int end) {
// sum_from_start[i] denotes sum for 0 ~ i - 1.
vector<int> sum_f... | ALGO | 0.999847 | 6.1085 |
a1965731-a704-40e5-a291-79c8219d638b | sakshieng/DSA-Sheet | DP/KnapsackDP/maxProfitOfSalesman.cpp | #include<bits/stdc++.h>
//sakshi codes here
using namespace std;
// https://leetcode.com/problems/maximize-the-profit-as-the-salesman/description/
// knapsack dp + binary search
class Solution {
public:
//1 state 1-d dp
int solve(vector<vector<int>>& offers,int i,vector<int>& dp){
if(i == offers.size())
... | ALGO | 0.999762 | 5.347424 |
3bbe8c27-f0e4-43ad-ac3b-a71eaa281d9c | Bharatbardiya/my-leetcode-solutions | 0347-top-k-frequent-elements/0347-top-k-frequent-elements.cpp | class Solution {
public:
vector<int> topKFrequent(vector<int>& nums, int k) {
unordered_map<int,int>mp;
// length = n
for(auto x : nums){
mp[x]++;
} // O(n)
priority_queue<pair<int,int>, vector<pair<int,int>>, greater<pair<int,int>> >pq;
// log(size)
... | ALGO | 0.999985 | 6.070012 |
246bc63e-a5cb-41c8-af2c-42cee641168d | wzhugit/CPP-Primer-Plus | chapter17/chapter17ex5.cpp | //C++ Primer Plus chapter17ex5.cpp
#include <fstream>
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
int main()
{
using namespace std;
vector<string> MatFriendvec;
vector<string> PatFriendvec;
vector<string> CommonFriendvec;
vector<string> UnionFriendvec;
vector<string> DiffFriend... | ALGO | 0.988803 | 3.931219 |
fbd2a352-360f-49b0-b3ec-7579ab274660 | irfanrangga/strukturData | TP10_STD/main.cpp | #include "flight.h"
int main(){
ListJadwal L;
infotype x;
adr_jadwalP P;
int n;
int i = 1;
createListJadwal_103022300100(L);
cout << "Masukkan jumlah jadwal penerbangan yang ingin diinput: ";
cin >> n;
while(i <= n){
cout << "\nMasukkan Data ke - " << i << endl;
cout ... | ALGO | 0.928669 | 3.341403 |
a544b9bb-9fc2-4c27-bda2-e76b49f58fa9 | waqasaslam718/DSA | DSA-PracticQuestions/Searching&SortingPracticQuestions/4sum.cpp | #include <iostream>
#include <unordered_map>
#include <vector>
using namespace std;
// Function to find a combination of four elements whose sum equals X
bool findFourElements(int arr[], int n, int X) {
// Create an unordered_map to store the sum of two elements and their indices
unordered_map<int, pair<int, i... | ALGO | 0.999972 | 5.69731 |
0375606d-98a4-415f-8bc9-dff3ef4fcb5d | Gowtham011224/Practice_Programming | C++/heap tree.cpp | #include<iostream>
using namespace std;
#include<cmath>
#include<vector>
vector<int> heap;
template<typename T>
void heapify(T p,T lc,T rc)
{
if(heap[p]<heap[lc] && heap[p]<heap[rc])
return;
if(heap[lc] <= heap[rc] && heap[lc]<heap[p])
{
T t=heap[lc];
heap[lc]=heap[p];
heap[... | ALGO | 0.997997 | 3.882583 |
d421462f-aad9-4a75-babf-0acfb84b1e5e | AndreaEnricoFranzoni/PPCforAutoregressiveOperator | src/mlpack/src/mlpack/methods/adaboost/adaboost_main.cpp | /**
* @file methods/adaboost/adaboost_main.cpp
* @author Udit Saxena
*
* Implementation of the AdaBoost main program.
*
* @code
* @article{Schapire:1999:IBA:337859.337870,
* author = {Schapire, Robert E. and Singer, Yoram},
* title = {Improved Boosting Algorithms Using Confidence-rated Predictions},
* j... | DATA | 0.950065 | 7.644462 |
5bc98745-4483-4530-a059-512e686c9ccb | wallaceketler/cplusplus | Estudo/teste2.cpp | #include <iostream>
using namespace std;
//passagem por valor: não altera valor fora do escopo da função
void dobro(int x){
x *= 2;
cout<<x<<endl;
}
//passagem por referência: altera valor fora do escopo
void troca(int *a, int *b){
int aux = *a;
*a = *b;
*b = aux;
}
//passagem por endereço: alter... | ALGO | 0.991349 | 5.261832 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.