uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
2976585a-1d75-48d9-84f8-04bef42cd97d | rollends/SE499 | simulator/src/sylvester.cpp | #include "rose499/sylvester.hpp"
using namespace Eigen;
DriveController::ValueType SylvesterController::genTurnControl(DriveController::StateType x, double t )
{
using Matrix3T = Matrix<ValueType, 3, 1>;
using Matrix33T = Matrix<ValueType, 3, 3>;
using Matrix2T = Matrix<ValueType, 2, 1>;
using Matrix2... | ALGO | 0.998104 | 5.699338 |
7c6db34b-ae4a-4619-b118-0dc5a8e0b662 | Rajat775/Leetcode | 0407-trapping-rain-water-ii/0407-trapping-rain-water-ii.cpp |
#define ppi pair<int,pair<int,int>>
class Solution {
public:
int DR[4]={1,0,-1,0};
int DC[4]={0,1,0,-1};
int trapRainWater(vector<vector<int>>& heightMap) {
int n=heightMap.size();
int m=heightMap[0].size();
priority_queue<ppi,vector<ppi>,greater<ppi>> pq;
vector<vector<bool>>vis(n,vector<b... | ALGO | 0.999954 | 6.394786 |
212e04ac-1c18-44f4-9a85-e629b40e8605 | YunGyuLee/AlgorithmStudy | bj15684.cpp | using namespace std;
const int MAX_N = 11;
const int MAX_H = 31;
int N,M,H;
int answer = -1;
struct info{
int y;
int x;
int v;
};
info map[MAX_H][MAX_N];
int find_one(int num,int y){
int now = y;
while(1){
now = now+1;
if(now>H){
now = -1;
break;
... | ALGO | 0.999903 | 3.694343 |
b720d0d8-3b9a-4209-a3e2-c2274b4547b5 | Merculiar/crypto_market | 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 |
b3745cac-40bf-4e77-ba1e-c81084a3a3ca | TD2106/Competitive-Programming | Hacker Earth/I Demand Trial by Combat.cpp | #include <iostream>
#include <bitset>
using namespace std;
int main ()
{
int first=1;
bitset<102> prev;
bitset<102> seat;
bitset<102> res;
int tc,n,m,pren=-1,prem=-1;
cin>>tc;
while(tc--)
{
bool temp;
cin>>n>>m;
seat.reset();
for(int i=1;i<=n;i++)
{
cin>>temp;
seat[i]=temp;
}
seat[0]=seat[n+... | ALGO | 0.999915 | 3.328742 |
e779f40d-36c6-4934-8bdc-6574a7f805df | abhaychandna/Practice | Projects/A.cpp | #include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--)
{
int r, n;
cin >> r >> n;
vector<int> a(r),p(150,0);
for (int i = 0; i < r; i++)
cin >> a[i];
for (int i = 0; i < n; i++)
{
int x;
cin >> x;
x--;
p[x]++;
}
//sort(... | ALGO | 0.999928 | 3.759148 |
a30285f4-f356-41d3-89d5-403ea2cc9414 | Tomas-Parizek/SRCZ | src/ast/normal_forms/name_exprs.cpp | #include "ast/normal_forms/name_exprs.h"
#include "ast/rewriter/rewriter_def.h"
#include "ast/ast_smt2_pp.h"
class name_exprs_core : public name_exprs {
struct cfg : public default_rewriter_cfg {
ast_manager & m;
defined_names & m_defined_names;
expr_predicate & m_p... | TOOL | 0.912337 | 6.157483 |
70583754-a8c7-4b4c-afd8-22007654c2a7 | AaronNGray/GenomeWorkbench | src/algo/phy_tree/fastme/traverse.cpp | #include <ncbi_pch.hpp>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "graph.h"
#include "fastme.h"
BEGIN_NCBI_SCOPE
BEGIN_SCOPE(fastme)
meEdge *findBottomLeft(meEdge *e)
/*findBottomLeft searches by gottom down in the meTree and to the left.*/
{
meEdge *f;
f = e;
while (NULL != f->head... | ALGO | 0.999962 | 5.756788 |
e205ca0f-d6fb-4a8b-996c-5d18012fb910 | sandialabs/SpecUtils | src/Filesystem.cpp | #include "SpecUtils_config.h"
#include <memory>
#include <string>
#include <vector>
#include <random>
#include <fstream>
#include <cstring>
#include <assert.h>
#include <algorithm>
//#include <iostream> //temporary for debug
#if( ANDROID )
#include <android/log.h>
#endif
#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN 1
... | TOOL | 0.910759 | 6.945871 |
f709ed7d-2e92-459d-8410-e20fb32dcb56 | AndreiDaniDev/CompetitiveProgramming2025-26 | Codeforces-2065-D.cpp | #include <iostream>
#define in cin
#define out cout
#include <algorithm>
using namespace std;
const int nmax = 2 * 1e5;
int nrq, n, m, a[nmax + 2], sum[nmax + 2];
int idx, perm[nmax + 2];
int64_t score;
int main(){
in.tie(NULL) -> sync_with_stdio(false);
in>>nrq;
for(int __t = 1; __t <= nrq; __t++){
... | ALGO | 0.999681 | 3.370056 |
8b515e97-a528-4ea2-b0bd-4a3a8ab3f77f | ishandutta2007/codeforces | a-soul_bella/normal/1613/E.cpp | #include <bits/stdc++.h>
using namespace std;
int n,m,vis[1000005],ans[1000005];
queue <int> q;
vector <int> e[1000005];
inline int id(int x,int y)
{
return (x-1)*m+y;
}
string s[1000005];
inline bool check(int x)
{
int qwq=0,qaq=0;
for(auto t:e[x])
qwq+=!ans[t],qaq+=!!ans[t];
return qwq<=1&&qaq>=1;
}
signed main... | ALGO | 0.999731 | 3.836935 |
799ded22-c8d8-4ac8-9b47-413edc0cafaa | ddcc/rstm | mesh/point.cpp | /* point.cpp
*
* Points coordinates are immutable, but their first_edge field can change.
*/
#include <limits.h> // for INT_MIN, INT_MAX
#include <stdlib.h> // for random()
#include <tr1/unordered_set>
using std::tr1::unordered_set;
#include <iostream>
using std::cout;
using std::cerr;
#incl... | ALGO | 0.988818 | 6.454546 |
c6cc80f3-dd06-4ecb-8f7d-74e3aba21564 | praymeta/Code-Up-Algorithm | PRG0_ProductOfTwoNumbers.cpp | #include <string>
#include <vector>
using namespace std;
int solution(int num1, int num2) {
int answer = 0;
answer = num1 * num2;
return answer;
}
| ALGO | 0.998506 | 5.013989 |
47034254-c854-41ff-9b95-71a516331768 | DinhHuyKhanh/Codeforces | 1339A.cpp | #include <bits/stdc++.h>
using namespace std;
int n,t;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin>>t;
while(t--){
cin>>n;
cout<<n<<"\n";
}
return 0;
}
| ALGO | 0.998976 | 3.624366 |
27770182-138a-4876-8a18-dece5d779da5 | i-am-chitti/Coding-Hour | Codeforces/pythagorean_triples.cpp | #include <bits/stdc++.h>
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
using namespace std;
typedef long long ll;
void solve(){
ll N;
cin>>N;
ll b=4,c=5,a;
ll count=0;
while(c<=N) {
a=(c*c)-(b*b);
if(((c*c)-c)==((b*b)+b) && (sqrt(a)*sqrt(a)==... | ALGO | 0.999565 | 4.769799 |
f3cf36cb-4b9a-44b7-accc-8c7eeb0000fe | Tanmay0808/CPP-Programs | Practice Questions/graph/bridgesInGraph.cpp | #include<iostream>
#include<vector>
#define NIL -1
using namespace std;
void addEdge(vector<int> adj[], int u, int v)
{
adj[u].push_back(v);
adj[v].push_back(u);
}
void bridgesUtil(int u, vector<int> adj[], bool visited[], int parent[], int low[], int disc[])
{
static int time = 0;
visited[u] = true;
... | ALGO | 0.999896 | 4.697847 |
8b3a5a74-af8e-4537-9e40-9f581652fa72 | ashmi19/interviewbit | Linked Lists/Merge two sorted linked list/main.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
/// Iterative
ListNode* Solution::mergeTwoLists(ListNode* A, ListNode* B)
{
if(A && !B) return A;
if(!A && B) return B;
if(!A && !B) return NULL;
... | ALGO | 0.999942 | 5.467212 |
9249501b-b618-4af0-9a2a-4f7650dab651 | Alpha4952/Competitive-Programming-Code | Binary Search 3/2. ABCTEL/ABCTEL.cpp | #include<bits/stdc++.h>
using namespace std;
int n, k, x[1000002], s[1000002], res = 0, r;
pair<int, int> b[1000002];
int main() {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
freopen("abctel.inp", "r", stdin);
freopen("abctel.out", "w", stdout);
cin >> n >> k;
for (int i = 1; i <= n; i... | ALGO | 0.999826 | 3.612642 |
13926d90-1c49-4fda-a0da-67a6be80f9b4 | Tejas-raghu/Leetcode_Problems | 2697-lexicographically-smallest-palindrome/2697-lexicographically-smallest-palindrome.cpp | class Solution {
public:
string makeSmallestPalindrome(string s) {
for(int i=0 ; i<s.size()/2 ; i++){
if(s[i] != s[s.size()-i-1]){
(s[i]<s[s.size()-i-1] ? s[s.size()-i-1] = s[i] : s[i]=s[s.size()-i-1]);
}
}
return s;
}
}; | ALGO | 0.999985 | 6.236228 |
36ad2f6c-f927-48d6-a911-63bebae8fbaa | kopsh/JustForFun | LRUCache/LRUCache_O(n).cpp | #include <iostream>
#include <vector>
#include <map>
#include<ext/hash_map>
using namespace __gnu_cxx;
using namespace std;
class LRUCache{
public:
LRUCache(int capacity) {
this->capacity = capacity;
}
int get(int key) {
bool hit = false;
vector<int>::iterator target;
for(v... | ALGO | 0.995948 | 4.531373 |
3e3ca0d1-1a31-4176-9fa9-834b60dcd0eb | SAURABH200301/MyCppCodes | Different Names(map).cpp | #include<bits/stdc++.h>
#include <map>
using namespace std;
int main()
{
string s;int count=0;
getline(cin,s);
string temp="";
map<string,int> m;
for(int i=0;i<s.length();i++)
{
if(s[i]==' ')
{
m[temp]++;
temp="";
}
else
{
temp+=s[i];
}
if(i==s.length()-1)
{
m[temp]++;
}
}
map<... | ALGO | 0.999908 | 3.57904 |
f0611743-2f10-4cef-b1bc-13e31c54ac9f | JIYUNHYEOK/Lecture | C++ Programming/midterm/midterm4.cpp | #include <iostream>
using namespace std;
const int SET_SIZE = 101;
int countElementOfUnion(int setA[], int setB[], int sizeA, int sizeB)
{
int count = sizeB; // 집합 setA, setB의 합집합의 원소의 개수
int ans[SET_SIZE];
for(int i=0; i<sizeB; i++) ans[i] = setB[i];
for (int i=0; i<sizeA; i++) {
for (int j=... | ALGO | 0.999901 | 3.97632 |
b777e1b2-9a8b-4e6f-aa05-124e5ffd3d44 | htfy96/leetcode-solutions | code/Coin Change 2.cpp | class Solution {
public:
int change(int amount, vector<int>& coins) {
vector<int> v((amount + 1) * coins.size());
if (coins.empty()) return amount ? 0 : 1;
#define idx(x, y) ((x) * coins.size() + (y))
for (int j=0; j<coins.size(); ++j)
v[idx(0, j)] = 1;
for (int i... | ALGO | 0.99992 | 5.586487 |
9809ad0e-e3b5-4d85-a941-5edc046ae448 | ishandutta2007/codeforces | saketh/normal/734/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})
#define all(x) (x).begin(), (x).end()
... | ALGO | 0.999984 | 4.120963 |
a50a6bd4-0817-46b6-acf6-4b271b036f2a | DragonKrissash/Competitive-Programming | CPG/Binary Search/step 3/E_Equation.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(x) begin(x), end(x)
#define X first
#define Y second
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
float c;cin>>c;
double low=0,high=INT32_MAX;int t=100;
double ans=0.0;
while(t--){
double mid=(low+high)/2.0;
... | ALGO | 0.999936 | 3.536525 |
a40fbdac-50df-4de9-96e4-42dc012ac59d | titancoinproject/Titan | src/protocol.cpp | #include "protocol.h"
#include "util.h"
#include "utilstrencodings.h"
#ifndef WIN32
# include <arpa/inet.h>
#endif
namespace NetMsgType {
const char *VERSION="version";
const char *VERACK="verack";
const char *ADDR="addr";
const char *INV="inv";
const char *GETDATA="getdata";
const char *MERKLEBLOCK="merkleblock";
c... | TOOL | 0.885682 | 6.14025 |
fa0eabcf-2a6b-4ab5-9709-ebb2edd6568f | alpha-asb/Most_Do_Placements | String/Implement_STRstr.cpp | int strstr(string s, string x)
{
//Your code here
int n = s.size(),m = x.size();
for(int i=0;i<=n-m;i++){
if(s.substr(i,m) == x)return i;
}
return -1;
}
| ALGO | 0.999337 | 5.264438 |
d8ec37e4-93be-47c0-94a2-bf643c38a502 | swapnanilchatterjee/One-Shot-Placement | Find k largest elements in an array.cpp | #include<bits/stdc++.h>
using namespace std;
vector<int>largest(vector<int>&nums,int target){
sort(nums.begin(),nums.end(),greater<int>());
vector<int>res;
for(int i=0;i<target;i++){
res.push_back(nums[i]);
}
return res;
}
int main(){
vector<int>nums={11, 5, 12, 9, 44, 17, 2};
int ta... | ALGO | 0.99983 | 4.237644 |
d7a591f2-d6a7-454e-a235-5cf38d31d9fd | ShafayetAhmad/DSA_Practice | Practitioner/Pappu_Bishwas/image.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
void rotate(std::vector<std::vector<int>>& matrix) {
int n=matrix.size(),i,j,start,end,temp,curr,next;
start=0;
end=n-1;
while (start<end)
{
j=start;
while (j<end)
... | ALGO | 0.999936 | 7.119048 |
58fe0f8e-a0e1-4d32-98a3-7ad260b7a04a | Swadeg/compArchSem6 | bp.cpp | /* 046267 Computer Architecture - Winter 20/21 - HW #1 */
/* This file should hold your implementation of the predictor simulator */
#include "bp_api.h"
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <vector>
#include <iostream>
using namespace std;
class branc... | ALGO | 0.99713 | 5.455562 |
cd2e200d-d136-4946-af34-94da5198476f | JQNguyen15/uva_problems | c++/uva10041.cpp | #include <iostream>
#include <algorithm>
int main(){
int n;
std::cin>>n;
for (int i=0;i<n;i++){
int r,result=0,median;
std::cin>>r;
int street[r];
for (int j=0;j<r;j++)
std::cin>>street[j];
std::sort(street,street+r);
if (r%2!=0)
median=street[r/2];
else
median=(street[r/2]+street[(r/2)-1]... | ALGO | 0.999734 | 3.565922 |
519c2fad-30e9-422f-ae8e-584c1463da84 | dag625/AdventOfCode | 2024/day22.cpp | //
// Created by Dan on 12/22/2024.
//
#include "registration.h"
#include <doctest/doctest.h>
#include <fmt/core.h>
#include <vector>
#include <numeric>
#include <numeric>
#include "utilities.h"
#include "parse.h"
#include "ranges.h"
namespace fs = std::filesystem;
namespace {
using namespace aoc;
/*
... | ALGO | 0.988968 | 6.319272 |
2d360787-3fc0-49a9-9fd9-db22d49aa17b | Jason-Chan88/Process | Lstack.cpp | #ifndef LSTACK_CPP
#define LSTACK_CPP
#include <string>
#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
//Templated node class used in templated linked list
template <class T>
class Node {
public:
Node( const T& data ); //Constructor
T& GetData(); //Gets data from node
void Set... | TOOL | 0.990002 | 5.27457 |
424d6f30-f433-42cf-9cda-efceb532cb35 | abhinav4008/cpp | alphabettriangle.cpp | #include <iostream>
using namespace std;
int main (){
int n;
cout<<"enter n : ";
cin>>n;
for(int i=1;i<=n;i++){
for(int j=1;j<=i;j++){
cout<<(char) (j+64);
}cout<<endl;
}
}
| ALGO | 0.996666 | 3.467748 |
315c612a-c5db-4dd7-9454-46f148d946f8 | Stenardt-9002/LeetCode-Practice | Leetcode_contest/2022/Weekly_Contest_313/4-2430-Max_deletion_string.cpp | // https://leetcode.com/problems/maximum-deletions-on-a-string/
#include <bits/stdc++.h>
#include<ext/pb_ds/tree_policy.hpp>
#include<ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds ;
typedef long long int ll;
#define DEBUG_var 1
#define fastIO ios_base::sync_with_stdio(false);cin.tie(... | ALGO | 0.999903 | 5.491085 |
10a54982-aef6-4dd8-9112-f8f5a128a38e | EliasHridoy/ProblemSolve | AtCoder/AtC155A.cpp |
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ffast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define filoop(n) for(ll i=0;i<(n);i++)
#define fjloop(n) for(ll j=0;j<(n);j++)
int main()
{
ffast;
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
// int t;
... | ALGO | 0.999978 | 3.848444 |
006af395-5629-4540-ac7d-f73069e3bf5e | Paramveer2023/projects | c++/functions_questions.cpp | #include<iostream>
using namespace std;
#include<math.h>
bool primecheck(int a){
for(int i=2;i<a;i++){
if(a%i==0){
return false;}
}
return true;
}
void fib(int a){
int f0 = 0;
int f1 = 1;
int t;
cout<<0<<"\t";
for (int i = 1;i<=a;i++){
t = f0+f1;
... | ALGO | 0.999792 | 3.577938 |
c467243b-524b-4f72-a956-3c90fda5b9a9 | URSec/SVA-Compiler | clang/tools/clang-format/ClangFormat.cpp | #include "clang/Basic/Diagnostic.h"
#include "clang/Basic/DiagnosticOptions.h"
#include "clang/Basic/FileManager.h"
#include "clang/Basic/SourceManager.h"
#include "clang/Basic/Version.h"
#include "clang/Format/Format.h"
#include "clang/Rewrite/Core/Rewriter.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Suppo... | TOOL | 0.877394 | 3.087217 |
b6266d14-9692-4553-8008-8602a2649179 | CoseCoder/MultiImageFrame | MultiImageFrame/PoissonImageEditing.cpp | #include "PoissonImageEditing.h"
PoissonImageEditing::PoissonImageEditing()
{
}
PoissonImageEditing::PoissonImageEditing(const QImage & image1, QImage & image2)
{
QImage2cvMat(image1, img1_);
QImage2cvMat(image2, img2_);
}
PoissonImageEditing::~PoissonImageEditing()
{
}
QImage PoissonImageEditing::poissonBlending... | ALGO | 0.994123 | 4.245231 |
259d38ec-e4ea-4fe9-9693-57a57898c385 | sauravUppoor/cpp_notes | ObjectScope/6_global/main.cpp | // Global constants can be better defined (in pre C++17) using headers for definition
// and .cpp for declarations with extern const type since they will be
// compiled only in this file.
// Best practice - use inline constexpr variables + define it in header file
#include "constant.h"
#include <iostream>
int main()... | CONFIG | 0.910519 | 4.995627 |
1df68cd1-fa2e-4aea-aa79-11bedca96c9f | TKRchamak/Phitron_Course | Algorithom/week_3/Exam/problem_5_detect_cycle_undirected_graph_with_bfs/detect_cycle_undirected_graph_with_bfs.cpp | #include<bits/stdc++.h>
using namespace std;
const int N =1e5;
vector<int> graph[N];
int visited[N];
int level[N];
int parent[N];
int bfs(int node){
queue<int> q;
q.push(node);
parent[node] = -1;
while(!q.empty()){
int curr = q.front();
q.pop();
if(visited[curr] == 1) continue... | ALGO | 0.999985 | 4.547956 |
227f5766-3a38-40cc-b0af-f9bd9e3ea1de | zzctommy/public-source-code | 码库/CF1097D Makoto and a Blackboard.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef double db;
#define x first
#define y second
#define sz(v) (int)v.size()
#define pb(x) push_back(x)
#define mkp(x,y) make_pair(x,y)
inline int read(){
int x=0,f=1;char c=getchar();
while(!isdigit(c)){if(c=='-')f=0;c=getchar();}
while(isdigit(c... | ALGO | 0.999991 | 4.083776 |
01f31d83-bfb4-4e29-9ccb-bb4ef91cb564 | avsh12/Computational-Physics | Differential Equation Solver/Hyperbolic/hyperbolic.cpp | #include<iostream>
#include<math.h>
#include "PDESolver.h"
class BoundaryCondition:public Hyperbolic
{public:
static float xstep, xrange;
static float phi(float x)
{return exp(-(x-xrange/2)*(x-xrange/2));
}
static float u_t0(float x)
{return phi(x);}
... | ALGO | 0.999896 | 3.966324 |
6f6fcb09-d9e8-48e6-b611-5ab729a819ce | wildannazh/Belajar-CPP | latihan.cpp | #include<iostream>
using namespace std;
int main()
{
int number, space1, space2, space3;
int i, j, x, y, z;
cout << "Enter any number: ";
cin >> number;
space1 = (2*number)-1;
space2 = number-1;
space3 = space1*space2;
z = number-1;
for(i = 1; i <= number; i++)
{
for(j = 1; j <= (2*i)-1; j++){
for (x = 1; x <= ... | ALGO | 0.999857 | 3.180741 |
9483ee80-8b38-4fff-91ee-3df83061e91b | gyurim/codingtest | 2022 카카오 인턴십/3_답.cpp | #include <string>
#include <vector>
#include <algorithm>
#include <iostream>
#define LIMIT 151
#define MAX 987654321
using namespace std;
int dp[LIMIT][LIMIT];
int solution(int alp, int cop, vector<vector<int>> problems) {
int answer = MAX;
int max_alp = 0;
int max_cop = 0;
for (int i = 0; i < prob... | ALGO | 0.999328 | 3.995658 |
2ec750fd-ec43-41a1-97d8-0f98a1e7f069 | Vedantjn/Striver-s-SDE-Sheet | Heaps_Min_Heap_Implementation.cpp | #include<iostream>
using namespace std;
// Heap ko visualise tree ki trh krte hain, but implement array se krte hain
class Heap{
public:
int arr[101];
int size;
Heap(){
size = 0;
}
void insert(int value){
// Step 1 : value inseert kro end me
size = size+1;
in... | ALGO | 0.99974 | 4.391449 |
cc73a51f-61ce-40af-a9c7-f3db0a891262 | NikhilSharma-30/Parallel-and-Distributed-Computing-Assignments | Assig 1-3 solutions/Assignment 1-3 sol/Assignment2/MatrixMultiply.cpp | #include <iostream>
#include <mpi.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
#define N 70
void sequential_matrix_multiplication(int A[N][N], int B[N][N], int C[N][N])
{
double start_time, run_time;
start_time = MPI_Wtime(); // Start timer
for (int i = 0; i < N; i++)
... | ALGO | 0.999861 | 4.707011 |
d65c60fd-e26f-4e3e-9bc4-f99ed66948aa | juhik24/DSA-Sheet | 974-subarray-sums-divisible-by-k/974-subarray-sums-divisible-by-k.cpp | class Solution {
public:
int subarraysDivByK(vector<int>& nums, int k) {
int n = nums.size();
unordered_map<int, int>mp;
int sum = 0, cnt = 0;
for(int i = 0; i < n; i++) {
sum += nums[i];
int rem = sum%k;
if(rem == 0) cnt++;
else if(rem... | ALGO | 0.999926 | 5.848231 |
5467587b-a14d-4bcf-b2e9-e4c06703e6a8 | otoyaa/past-contest | C++/明治大学/倍数にかっこをつけて表示.cpp | #include <bits/stdc++.h>
#define read(x) cin>>x
#define vi vector<int>
#define l(i,s,n) for (int i=int(s);i<int(n);i++)
#define pb push_back
#define f first
#define s second
#define no cout<<"NO"<<"\n"
#define yes cout<<"YES"<<"\n"
#define pii pair<int,int>
typedef long long ll;
using namespace std;
int mdc(int a,int ... | ALGO | 0.999384 | 4.346992 |
f78a40b5-384b-47f9-8828-886ee75fe0ac | abtahi2024/Algorithms_2023 | module21/unbound_knapsack.cpp | #include<bits/stdc++.h>
using namespace std;
int dp[1005][1005];
int unbounded_knapsack(int n,int s,int val[],int wet[])
{
if(n==0||s==0)
{
return 0;
}
if(dp[n][s]!= -1)
{
return dp[n][s];
}
if(wet[n-1]<=s)
{
int c1=val[n-1]+unbounded_knapsack(n,s-wet[n-1],val,wet... | ALGO | 0.999997 | 4.037488 |
91723cd6-25df-4075-b895-eb64ec85849b | zwshen/notes-learning | skills/Acm/zwsoj/V500/530.cpp | /* @JUDGE_ID: 13160EW 530 C++ */
// nCr D
// ѩƦriLܤjAҥHϥ vector ʺA}C
// Foز֥[覡AӦѯ֪X
// ]ٰOŶC
//@BEGIN_OF_SOURCE_CODE
#include <iostream>
#include <vector>
using namespace std;
typedef unsigned long ULONG;
ULONG find(ULONG m,ULONG n)
{
ULONG i,j;
vector<ULONG> board;
if( n==0 || n==m ) return 1;
if( n==1 || n==m-... | ALGO | 0.99995 | 5.537619 |
19dc022b-a691-4342-85d0-8c2fe8c2cf18 | NeRrO106/OOP-Cpp | Lab7/main.cpp | #include <iostream>
#include "Produs.h"
#include <cstring>
using namespace std;
int main()
{
int n;
cin>>n;
Produs* p = new Produs[n];
for(int i=0;i<n;i++) cin>>p[i];
for(int i=0;i<n;i++) cout<<p[i]<<" ";
cout<<endl;
for(int i=0;i<n-1;i++){
for(int j=i+1;j<n;j++){
if(p[... | TOOL | 0.967059 | 3.308999 |
385ffb12-823e-4671-b2f2-cc146f1545bf | jdoerfert/cudaomp | libcxx/test/std/containers/sequences/vector/vector.capacity/resize_size_value.pass.cpp | // <vector>
// void resize(size_type sz, const value_type& x);
#include <vector>
#include <cassert>
#include "test_macros.h"
#include "test_allocator.h"
#include "min_allocator.h"
#include "asan_testing.h"
int main(int, char**)
{
{
std::vector<int> v(100);
v.resize(50, 1);
assert(v.size()... | TEST | 0.857106 | 6.38132 |
6efb80df-efda-4777-8735-9c6575f2fcbc | mayankchauhan185/DS | 0104-maximum-depth-of-binary-tree/0104-maximum-depth-of-binary-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.999668 | 6.417715 |
e7b9dc7e-a2bb-4bf6-8322-1a0ea881dbfe | MarceloFontana/Atividades_CG_ | CGCCHibrido-main/dependencies/x64/glm/test/core/core_func_integer_bit_count.cpp | // This has the programs for computing the number of 1-bits
// in a word, or byte, etc.
// Max line length is 57, to fit in hacker.book.
#include <stdio.h>
#include <stdlib.h> //To define "exit", req'd by XLC.
#include <ctime>
unsigned rotatel(unsigned x, int n)
{
if ((unsigned)n > 63) {printf("rotatel, n out of ... | ALGO | 0.99942 | 4.574697 |
f20321d5-a6ae-49af-b142-fd0118da9041 | labulaka6/Leetcode | Array/medium/974.cpp | static const auto _ = [](){
ios::sync_with_stdio(false);
cin.tie(nullptr);
return nullptr;
}();
// 前缀和 + 哈希表
// 子数组的元素之和 => 数组第 i 项到第 j 项的和
// 元素和能被 K 整除的子数组数目 => 有几种 i、j 组合,使得 A[i] 到 A[j] 之和 mod K == 0
// ↓ ↓ ↓ 转化为 ↓ ↓ ↓
// 有几种 i、j 组合,满足 (preSum[j] − preSum[i−1]) mod K == 0
// 有几种 i、j 组合,满足 preSum[j] mod... | ALGO | 0.999907 | 5.675702 |
53b19df1-af1e-4718-84ea-2831f7a41d2b | RoshanSharma20/leetcode_answers | 0419-battleships-in-a-board/0419-battleships-in-a-board.cpp | class Solution {
public:
void solution(vector<vector<char>>& board,vector<vector<bool>>& visited,int row,int col)
{
visited[row][col]=true;
vector<int> delrow = {0,-1,0,1};
vector<int> delcol = {-1,0,1,0};
for(int i=0;i<4;++i)
{
int nrow = row+delrow[... | ALGO | 0.999855 | 6.14069 |
3d194f83-a1a9-407b-983f-da49abc9c64d | khhitish/Leetcode-GFG | Binary Search - GFG/binary-search.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 binarysearch(int arr[], int n, int k) {
int low=0, high=n-1;
while(low<=high)
{
int mid = l... | ALGO | 0.999748 | 6.048801 |
843f1548-c1c2-4331-95b6-795363428960 | qwertyuiop5040/sample_algorithms | boilerplate.cpp | #include <bits/stdc++.h>
using namespace std;
#define forn(i,n) for(int i=0;i<n;i++)
#define forn1(i,n) for(int i=1;i<=n;i++)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
typedef long long ll;
typedef pair<int,int> pii;
int t,n;
int main(){
cin>>t;
cout<<setprecision(16);
forn1(i,t... | ALGO | 0.984457 | 3.2742 |
fa1a2ece-5446-48e3-8321-0c2e0e6d5c40 | rahuljain/playground_CPlusPlus | high_school/ProgramsXI/Term-II/NO-REV.CPP | /* This program prints the reverse of an inputted number and
checks if it's a palindrome or not. */
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
#include<math.h>
void main()
{
clrscr();
int n, numb=0;
cout<<"Enter the number: ";
cin>>n;
int num=n, no=n;
while(n>0)
... | ALGO | 0.997779 | 3.759707 |
9bcfdbef-2f21-48ab-9f51-4fdd654d637a | sakiib/competitive-programming-code-library | DS & Algo Implementation/String Algorithms/Z Algo/password.cpp | #include <bits/stdc++.h>
using namespace std;
struct BINARY_INDEXED_TREE {
static const int MAXN = 1e6 + 5;
int BIT[ MAXN + 5 ];
inline void Initialize( ) {
memset( BIT , 0 , sizeof( BIT ) );
}
inline int RQuery ( int l , int r ) {
return PQuery( ... | ALGO | 0.999986 | 3.875379 |
83631536-750a-4d5a-b3cb-84daabc1510a | Glebuska/spbu-graph-course-21 | dfs.cpp | //
// Created by Gleb Mirzazyanov on 21.03.2021.
//
#include "dfs.h"
GrB_Index build_permute
(
GrB_Vector* e,
const GrB_Index tau,
GrB_Matrix* P // output matrix
)
{
GrB_Index nvals;
GrB_Vector_nvals(&nvals, *e);
GrB_Index size;
GrB_Vecto... | ALGO | 0.999785 | 5.777295 |
c7f82d17-d946-40cc-9f75-8f379272ded3 | Maxeg13/QUADRO_binaries | release/pca.cpp |
#include <iostream>
#include "pca.h"
#include <vector>
#include <Eigen/Dense>
#include "eig.h"
void PCA::algorithm()
{
eig(cor);
eigvals=getEigVals();
eigvecs=getEigVecs();
cout<<endl<<"eigvecs:"<<endl<<eigvecs<<endl;
cout<<endl<<"eigenvals"<<endl<<eigvals<<endl;
}
void PCA::proect(std::vector<fl... | ALGO | 0.999459 | 3.287907 |
31250b1a-03a5-4bbb-8fff-a90b21d071e4 | valentinRog/advent-of-code-2018 | day08/part2.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node {
vector< int > m;
vector< Node > c;
};
Node make_tree( deque< int > &q ) {
Node node;
int nc( q[0] ), nm( q[1] );
q.erase( q.begin(), q.begin() + 2 );
for ( int i( 0 ); i < nc; i++ ) { node.c.push_back( make_tree( q ) ); }
for (... | ALGO | 0.999942 | 4.20451 |
0bbddfe1-4fee-4ae6-8ede-c7d275a41211 | yashpatel137/Interview_Prep | LinkedList/Sort_a_k_sorted_doubly_linked_list.cpp | struct compare{
bool compare(struct Node *first, struct Node *second)
{
return first->data > second->data;
}
};
struct Node *sort(Node *head, int k)
{
if(head==NULL)
{
return head;
}
priority_queue<Node*,vector<Node*>,compare> pq;
Node *newhead=NULL,*curr;
for(int i=... | ALGO | 0.999991 | 3.724409 |
e76f87ee-b04a-44d5-ac3b-0fdecb8ce749 | ishandutta2007/codeforces | davidberard/normal/1104/B.cpp | #pragma GCC optimize("O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef long double ld;
int main () {
ios_base::sync_with_stdio(0), cin.tie(0... | ALGO | 0.999996 | 4.689415 |
58134107-7bc6-4339-b3f9-b80030813851 | alwaysanshul/LEETCODE | 1137-n-th-tribonacci-number/1137-n-th-tribonacci-number.cpp | class Solution {
public:
int tribonacci(int n) {
if(n==0 || n==1) return n;
if(n==2) return 1;
vector<int> dp(n+1,0);
dp[1]=1;
dp[2]=1;
for(int i=3;i<=n;i++)
dp[i] = dp[i-1]+dp[i-2]+dp[i-3];
return dp[n];
}
}; | ALGO | 0.999972 | 6.096412 |
a10d1a7d-0c4d-40a7-b2d9-926c70df6f07 | Adarsh-kumar/Competitive_coding_practice | bool_parenth.cpp | #include<iostream>
using namespace std;
int bool_parenth(int* symbol,char* operators,int n,int m)
{
int dp[n]={0};
for(int i=0;i<n;i++)
{
int count1=0;
int count0=0;
for(int j=0;j<m;j++)
{
if(i==0)
{
dp[i]=0;
break;
}
else
{
if(operators[j]=='&')
{
if(symbol[i]==1)
count1++;
}
else if(operators[j]=='|')
{
count1++;
if... | ALGO | 0.999962 | 4.959744 |
9d2a87bc-86ab-4690-8c26-41e5aff81181 | avdhut0923/tcs-A-TO-Z-dsa | tcs_A-to-Z_dsa/01patterns/20p.cpp | #include <bits/stdc++.h>
using namespace std;
void pattern(int n){
int spaces = 2*n - 2;
for(int i=1;i<=2*n-1;i++){
int stars = i;
if(i>n) stars = 2*n-i;
// stars
for(int j=1;j<=stars;j++)
cout<<"*";
// spaces
for(int j=1;j<=spaces;j++){
cout<<" ";
}
... | ALGO | 0.999932 | 4.443626 |
5e0887e4-89c5-48e0-bd16-5fc4377d7d53 | fyrsta7/LLM_on_ASAC | result_api_backup/en_md/gpt-4o-mini/Checkerboard.cpp | #include <iostream>
#include <queue>
#include <vector>
#include <tuple>
#include <cstring>
using namespace std;
const int INF = 1e9;
const int dx[4] = {0, 0, 1, -1};
const int dy[4] = {1, -1, 0, 0};
struct Cell {
int x, y, cost;
};
int main() {
int m, n;
cin >> m >> n;
vector<vector<int>> board... | ALGO | 0.999912 | 5.329939 |
bb6b4917-c548-44c0-b8b3-d1f949194f68 | ammarqaisar11a55/LeetCode-Solutions | 2293. Min Max Game.cpp | class Solution
{
public:
int minMaxGame(vector<int> &nums)
{
if (nums.size() == 1)
return nums[0];
vector<int> newNum(nums.size() / 2);
for (int i = 0; i < nums.size() / 2; i++)
{
if (i & 1)
{
newNum[i] = max(nums[2 * i], num... | ALGO | 0.999992 | 5.458786 |
56c0a695-195a-4a43-8b7f-f6c3e6233389 | taken20090/citra | src/core/hw/aes/key.cpp | #include <algorithm>
#include <exception>
#include <sstream>
#include <boost/optional.hpp>
#include "common/common_paths.h"
#include "common/file_util.h"
#include "common/logging/log.h"
#include "common/string_util.h"
#include "core/hw/aes/arithmetic128.h"
#include "core/hw/aes/key.h"
namespace HW {
namespace AES {
n... | TOOL | 0.853841 | 7.500396 |
8c8ee17e-7298-4804-82c9-b7e616fe33c5 | dan1elsaenz/ie0217 | Sesiones/Sesion6/bubbleSort1.cpp | /**
* Algoritmo Bubble Sort:
* Recorre el arreglo varias veces, de tal forma que, realiza comparaciones
* para intercambiar las posiciones adyacentes en el arreglo si el valor de
* la izquierda es menor que el de la derecha (caso ascendente).
*
* Complejidad temporal O(n^2)
*/
#include <iostream>
using namespa... | ALGO | 0.999988 | 6.065975 |
23b4a326-e21a-49a5-a8f9-2b4e9ea82704 | avikant0-0/striver | 0450-delete-node-in-a-bst/0450-delete-node-in-a-bst.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.489494 |
9b55a68b-98b4-4437-90d6-e96120c0ec7c | GarrettXUPT/leetCode | 剪绳子.cpp | #include<iostream>
#include<vector>
using namespace std;
/*
ֵ ʹö̬滮
ǰ洢ӳi <= 3ʱȣʱDZиģӹm
һforѭϵ㷨֣ȼf(n)֮ǰijȳ˻
ڶforѭӳΪiʱеиһεĿ(иһκõijji - jӣ
ԸmaxDistenceĶӦ˻)˻
*/
int cuttingRope(int n) {
if (n < 2) return 0;
else if (n == 2) return 1;
else if (n == 3) return 2;
vector<int> maxDistences(n + 1);
for (int i = 0... | ALGO | 0.999774 | 4.121516 |
644b8c11-f295-46b8-ac31-b8fd8b317d9c | Realichain/realichain | src/crypto/sha1.cpp | #include "crypto/sha1.h"
#include "crypto/common.h"
#include <string.h>
// Internal implementation code.
namespace
{
/// Internal SHA-1 implementation.
namespace sha1
{
/** One round of SHA-1. */
void inline Round(uint32_t a, uint32_t& b, uint32_t c, uint32_t d, uint32_t& e, uint32_t f, uint32_t k, uint32_t w)
{
... | ALGO | 0.998401 | 7.487545 |
8102caaf-9f80-4a4d-bace-657aa298c424 | Tagore22/algorithmSolve | algorithmSolve/알고스팟/PALINDROMIZE.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> kmpProto(const string& str)
{
int begin = 1;
int matched = 0;
vector<int> proto(str.size(), 0);
while (begin + matched < str.size())
{
if (str[begin + matched] == str[matched])
{
... | ALGO | 0.999897 | 4.768551 |
4aebb88c-213a-4878-a3e9-4cea1b546d7e | SBidaibek/acm | fb2018/qual/a.cpp | #include <bits/stdc++.h>
using namespace std;
#define forn(i, x, n) for (int i = int(x); i <= int(n); ++i)
#define for1(i, n, x) for (int i = int(n); i >= int(x); --i)
#define x first
#define y second
#define pb push_back
typedef long long ll;
typedef pair <int, int> pii;
typedef long double ld;
typedef vector <ll> ... | ALGO | 0.999771 | 3.663653 |
bf073a41-88cc-496f-a213-6acd66115250 | darkenk/soldat_cpp | third_party/src/soloud-RELEASE_20200207/src/audiosource/speech/resonator.cpp | #include <math.h>
#include "resonator.h"
#ifndef PI
#define PI 3.1415926535897932384626433832795f
#endif
/* Convert formant freqencies and bandwidth into resonator difference equation coefficents
*/
void resonator::initResonator(
int aFrequency, /* Frequency of resonator in Hz */
int aBandwi... | ALGO | 0.998319 | 5.071481 |
67e60537-04af-400a-bf82-6946ae3d73d9 | Biomedical-Imaging-Group/mri-reconstruction | code/waveletstuff/UpSampleDim.cpp | // y_hat = UpSampleDim(x_hat, du)
//
// Matlab MEX-file for upsampling by a factor
// of 2 along a specified dimension.
// Implementation is done in the frequency domain.
//
// (c) Cedric Vonesch, 2006.11.14-2006.11.15
// Test data: a = [1 0 0 0; 0 1 0 0; 0 0 0 2; 0 0 2 0]
//#include <stdlib.h>
#include <math.h>
#inc... | ALGO | 0.939121 | 4.732594 |
e7cab27b-eeeb-4a78-aeeb-1a86bc95dfb3 | Atrion/MOSS_CWE | MOULOpenSourceClientPlugin/Plasma20/Sources/Tools/MaxSceneViewer/plKeyRefSort.cpp | #include "plKeyRefSort.h"
#include "../pnKeyedObject/plKeyImp.h"
#include <algorithm>
std::vector<plKey>* plKeyRefSort::fKeys = nil;
std::vector<plKeyRefSort::KeyRefs> plKeyRefSort::fNumRefs;
int plKeyRefSort::CountRefsRecur(plKey key, std::vector<plKey>& traversedKeys)
{
int numRefs = 0;
if (std::find(traversedK... | ALGO | 0.993498 | 4.836973 |
fad5d594-aa0a-48aa-8aab-26b54dec76e5 | saikatcodec/CP | Codeforces/A_Don_t_Try_to_Count.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
// clang-format off
#define nl "\n"
#define ll long long
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#defin... | ALGO | 0.999732 | 5.400965 |
60fb8690-9c6c-4044-bdf6-8c819bb6d72e | santhosh-4000/IPMP1921 | week-2/Arrays/firstMissingPos.cpp | //https://leetcode.com/problems/first-missing-positive/
int segergate(vector<int>& arr){
int j=0,i;
for(i=0;i<arr.size();i++){
if(arr[i]<=0){
swap(arr[i],arr[j]);
j++;
}
}
return j;
}
int firstMissingPositive(v... | ALGO | 0.999906 | 5.098808 |
4eea20c5-fb41-4ec2-a1a0-926498ee3159 | codewaltz1994/Clickhouse_uniqueMergeTree | src/Common/ZooKeeper/TestKeeper.cpp | #include <Common/ZooKeeper/TestKeeper.h>
#include <Common/setThreadName.h>
#include <Common/StringUtils/StringUtils.h>
#include <base/types.h>
#include <sstream>
#include <iomanip>
#include <functional>
namespace Coordination
{
static String parentPath(const String & path)
{
auto rslash_pos = path.rfind('/');
... | TEST | 0.870612 | 6.942984 |
0ddc78af-1b3d-422d-a6e7-a0a618761c80 | kvitajin/PR1 | ppr0/main.cpp | #include <iostream>
#include <cmath>
int main() {
int a=25, b;
b=sqrt(a);
if(b=4){
std::cout << a << " " << b;
} else{
b=b*b;
std::cout << a << " " << b;
}
/*int day=0;
while(++day){
std::cout<< day << std::endl;
day=day%7;
}*/
... | ALGO | 0.949873 | 3.088261 |
38f8ef47-aa38-4ade-a941-4dea852d9e15 | fafa1899/BuildCppDependency | Source/boost-1.86.0/libs/geometry/doc/doxy/doxygen_input/sourcecode/doxygen_2.cpp | OBSOLETE
#include <boost/tuple/tuple.hpp>
#if defined(_MSC_VER)
// We deliberately mix float/double's here so turn off warning
//#pragma warning( disable : 4244 )
#endif // defined(_MSC_VER)
#include <boost/geometry/geometry.hpp>
#include <boost/geometry/algorithms/overlaps.hpp>
#include <boost/geometry/geometries/g... | TOOL | 0.910384 | 6.475918 |
6a1854b0-1507-4edd-8750-e29cbdc3ff58 | wszk1992/LeetCode-Team | Codes/Yangkun Huang/Dynamic Programming/62. Unique Paths.cpp | int uniquePaths(int m, int n) {
if(m==1||n==1) return 1;
int currCeil=0, left=1;
vector<int> upCeil(n,1);
for(int i=1;i<m;i++){
for(int j=1;j<n;j++){
currCeil=left+upCeil[j];
left=currCeil;
upCeil[j]=currCeil;
}
... | ALGO | 0.999945 | 5.556766 |
874b25e9-7fc3-45e8-9b21-438c1b115036 | OneBitPython/Codeforces | C_Interesting_Story.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define all(c) c.begin(), c.end()
#define endl "\n"
int sum() { return 0; }
template<typename... Args>
int sum(int a, Args... args) { return a + sum(args...); }
string bin(long n){
long i;
string val = "0";
for (i = ... | ALGO | 0.99945 | 4.880719 |
ddfb6de3-99d3-44df-a910-bf356ebc8383 | junstat/CppLearning | LeetCode/Q0099/Q0012/Solution.cpp | #include <string>
#include <vector>
using namespace std;
class Solution {
public:
vector<int> val = {1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1};
vector<string> str = {"M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV", "I"};
string intToRoman(int x) {
string ans;
... | ALGO | 0.999644 | 6.277643 |
faeb465d-2f72-4956-9e26-90031f48dd32 | satyam0804/CodeChef | Array/CASH.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ll t;
cin >> t;
while (t--)
{
ll n, k,x;
cin >> n >> k;
ll sum = 0;
for(int i=0;i<=n-1;i++)
{
cin >> x;
sum += x;
}
cout << sum % k<<... | ALGO | 0.999778 | 3.455453 |
29bf05ba-a6a3-41f9-a033-5876bdded1f8 | Lee-W/ACM | POJ/2255/2255.cpp | #include <iostream>
using namespace std;
struct Node {
Node* left;
Node* right;
char content;
Node() {
left = NULL;
right = NULL;
};
};
Node* buildTree(string, string);
void postOrderTraversal(Node*);
void deleteTree(Node*);
main()
{
ios::sync_with_stdio(false);
string pre... | ALGO | 0.999977 | 4.798708 |
dfcde379-7d72-46a4-9d52-941a05defc8b | JaeHee97/GameProgramming | C02 (2주차 실습)/예제5_5_1.cpp | #include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#include <conio.h>
struct linked_list
{
char data;
struct linked_list *link;
};
void add_node(char data);
void print_linked_list(struct linked_list *now);
void print_reverse_linked_list(struct linked_list *now);
struct linked_list *hea... | ALGO | 0.998812 | 3.416087 |
99b9833a-5f3c-4762-9292-4edb1fc9586c | yvn819/Autonomous-Drone | src/semantic_image_proc/src/lantern_detector.cpp | #include <ros/ros.h>
#include <cv_bridge/cv_bridge.h>
#include <sensor_msgs/Image.h>
#include <sensor_msgs/CameraInfo.h>
#include <opencv2/opencv.hpp>
#include <nav_msgs/Odometry.h>
#include <tf/transform_datatypes.h>
#include <tf/transform_listener.h>
#include <tf_conversions/tf_eigen.h>
#include <eigen3/Eigen/Dense>
... | TOOL | 0.887305 | 6.762881 |
e1480dbf-5716-4272-b7a5-d8c29a55bed1 | gmladk04/python_challenge | Bome_s.a/class_3/11727_bm.cpp | #include <iostream>
#define N 1000
#define M 10'007
using namespace std;
long long arr[N+1] = { 0, };
int main() {
ios_base::sync_with_stdio(false);
cout.tie(NULL);
cin.tie(NULL);
arr[1] = 1;
int n;
cin >> n;
int plus = 1;
for (int i = 2; i <= n; i++) {
arr[i] = (arr[i - 1] * 2 + plus) % M;
plus = -... | ALGO | 0.999989 | 4.300317 |
f68bb7dd-e994-4e40-9174-5d6dea43567f | theascone/stochastic-subset-bvh | src/media/grid.cpp | // media/grid.cpp*
#include "media/grid.h"
#include "paramset.h"
#include "sampler.h"
#include "stats.h"
#include "interaction.h"
namespace pbrt {
STAT_RATIO("Media/Grid steps per Tr() call", nTrSteps, nTrCalls);
// GridDensityMedium Method Definitions
Float GridDensityMedium::Density(const Point3f &p) const {
/... | ALGO | 0.99967 | 7.828019 |
9445c8b2-92c7-4d32-8c8e-d0744108e9cf | chrise-dcq/Algorithms_chrise-go | Search/BinarySearch.cpp | /*
二分查找
说明
如果搜寻的数列已经有排序,应该尽量利用它们已排序的特性,以减少搜寻比对的次数,
这是搜寻的基本原则,二分搜寻法是这个基本原则的代表。
解法
在二分搜寻法中,从数列的中间开始搜寻,如果这个数小于我们所搜寻的数,
由于数列已排序,则该数左边的数一定都小于要搜寻的对象,所以无需浪费时间在左边的数;
如果搜寻的数大于所搜寻的对象,则右边的数无需再搜寻,直接搜寻左边的数。
所以在二分搜寻法中,将数列不断的分为两个部份,每次从分割的部份中取中间数比对,
例如要搜寻92于以下的数列,首先中间数索引为(0+9)/2=4(索引由0开始):
[3 24 57 57 67 68 83 90 92 95]
由于67小于9... | ALGO | 0.999948 | 4.102749 |
fbc7a2a5-1609-4319-9559-3c8ad0b9d9a8 | andrewng0788/MS100 | BPR_ChangeCollet.cpp | #ifdef _DEBUG
#define new DEBUG_NEW
#endif
//================================================================================
// Holder Upload Collet PR
//================================================================================
LONG CBondPr::AGC_SearchUploadColletPR(IPC_CServiceMessage &svMsg)
{
typedef stru... | TOOL | 0.866759 | 5.057928 |
f950ea73-ce1a-473f-a6a6-b2d7ec602d0d | martin0327/LeetCode | 1945-sum-of-digits-of-string-after-convert/1945-sum-of-digits-of-string-after-convert.cpp | class Solution {
public:
int getLucky(string s, int k) {
string t;
for (auto c : s) t += to_string(c-'a'+1);
auto f = [&] (string s) {
int x = 0;
for (auto c : s) x += c - '0';
return to_string(x);
};
while (k--) t = f(t);
return st... | ALGO | 0.999892 | 6.140445 |
2741933b-e61a-43ac-980e-26ebae122273 | Syhawk/LeetCode | palindrome_linked_list.cpp | //uri: https://leetcode.com/problems/palindrome-linked-list/
/*
* 计算出链表的长度,将链表从中间平分为两条新的链表,将第二条链表进行反转,两条链表进行对比。
* 空间复杂度:O(1).
* 时间复杂度:O(n).
* */
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solu... | ALGO | 0.999873 | 5.576937 |
cc996fad-4a93-4a95-831b-f1ccda1564ce | EACUAMBA/ustm | aplicativos_moveis/teste1_edilson_alexandre_cuamba_4l7lds1/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.998952 | 6.763549 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.