uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
3b7e8dba-945a-44df-8731-2d19cf4bd4b7 | kitsuy3d/BGE-KIT | extern/bullet2/src/BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp | #include "btHeightfieldTerrainShape.h"
#include "LinearMath/btTransformUtil.h"
btHeightfieldTerrainShape::btHeightfieldTerrainShape
(
int heightStickWidth, int heightStickLength, const void* heightfieldData,
btScalar heightScale, btScalar minHeight, btScalar maxHeight,int upAxis,
PHY_ScalarType hdt, bool flipQuadEdge... | TOOL | 0.935348 | 7.232734 |
0a3684c8-d13f-43ca-a5c6-31a7a2b91b85 | ishandutta2007/codeforces | chen_zexing/normal/1736/A.cpp | #pragma GCC optimize("Ofast,unroll-loops")
#include <bits/stdc++.h>
using namespace std;
int a[105],b[105];
int main(){
int T = 1, kase = 0;
cin >> T;
while (T--){
int n,cnt=0,dif=0;
scanf("%d",&n);
for(int i=1;i<=n;i++) scanf("%d",&a[i]),cnt+=a[i];
for(int i=1;i<=n;i++) scan... | ALGO | 0.999948 | 4.018977 |
cbfe8578-0f6a-4afb-b353-7d99209a32e8 | skyisgreen/Data-structure-exercise | Arithmetic/一元多项式.cpp | #include <iostream>
#include<stdlib.h>
typedef struct node *ptrNode;
typedef ptrNode LinkList; //ͷ
typedef ptrNode Position;//мڵ
typedef int ElementType;
struct node{
ElementType Coefficient;
ElementType Exponent;
Position next;
};
int IsEmpty(LinkList L)
{
return L->next == NULL;
}
LinkList creatLi... | ALGO | 0.99855 | 3.12794 |
f7fa0ee0-67d0-4a74-819f-2f191dc74387 | Jainil102/LeetCode | 0138-copy-list-with-random-pointer/0138-copy-list-with-random-pointer.cpp | /*
// Definition for a Node.
class Node {
public:
int val;
Node* next;
Node* random;
Node(int _val) {
val = _val;
next = NULL;
random = NULL;
}
};
*/
class Solution {
public:
Node* copyRandomList(Node* head) {
unordered_map<Node*, Node*> umap;
Node*... | ALGO | 0.998911 | 5.529826 |
36e7bb28-b6ed-48bf-a2e4-fa893b23ef73 | GladiousZhang/C_Progarmming_Assistance_in_Xidian | 日期计算.cpp | #include <stdio.h>
int main(){
int year,month,day;
int before;
scanf("%d %d %d",&year,&month,&day);
switch (month){
case 1:
before=0;
break;
case 2:
before=31;
break;
case 3:
if(year%4==0&&year%100!=0||year/400==0){
before=60;
}else{
before=59;
}
break;
case 4:
if(year%4==... | ALGO | 0.999967 | 3.700659 |
62d08804-6b9b-4fef-8f09-9cc3a9274df9 | haram1117/AlgorithmStudy | Bronze/17863.cpp | //
// Created by haram on 2023-09-09
//
// Problem-Solving #17863
#include <iostream>
using namespace std;
string s;
int main(){
cin >> s;
if(s[0] == '5' && s[1] == '5' && s[2] == '5')
cout << "YES";
else
cout << "NO";
return 0;
} | ALGO | 0.999817 | 4.274275 |
7bb4ea12-913a-4338-924b-e11010cc4974 | rajibdpi/leetcode-sol-mkdocs | main/solutions/0003. Longest Substring Without Repeating Characters/0003-2.cpp | class Solution {
public:
int lengthOfLongestSubstring(string s) {
int ans = 0;
int j = -1; // s[j + 1..i] has no repeating chars.
vector<int> lastSeen(128, -1); // lastSeen[c] := index of last c presented.
for (int i = 0; i < s.length(); ++i) {
// Update j to lastSeen[c], ... | ALGO | 0.999913 | 6.448877 |
9f26ddfd-b77b-4331-b0cf-7a85b52e3c30 | zarboz/XBMC-PVR-mac | lib/libsquish/clusterfit.cpp | #include "clusterfit.h"
#include "colourset.h"
#include "colourblock.h"
#include <cfloat>
namespace squish {
ClusterFit::ClusterFit( ColourSet const* colours, int flags, float* metric )
: ColourFit( colours, flags )
{
// set the iteration count
m_iterationCount = ( m_flags & kColourIterativeClusterFit ) ? kMaxIt... | ALGO | 0.954424 | 6.829147 |
63a46d3a-3808-4272-b9f9-3a6ea675a09a | Surajgupta001/PROBLEM-PRACTICE | 645_misMatch.cpp | /*
Set Mismatch - [Leetcode - 645(Easy)]
=====================================
You have a set of integers s, which originally contains all the numbers from 1 to n. Unfortunately, due to some error, one of the numbers in s got duplicated to another number in the set, which results in repetition of one number and loss of... | ALGO | 0.999788 | 5.883037 |
b9a421a9-9525-4dad-814b-a1f3b5cfa4e7 | HaochiBai1998/Leetcode | 416. Partition Equal Subset Sum. Partition Equal Subset Sum.cpp | #include<iostream>
#include<vector>
#include<
using namespace std;
class Solution {
public:
bool canPartition(vector<int>& nums) {
sort
int head=0;
int tail=nums.size()-1;
int first_sum=0;
int last_sum=0;
while(tail>head){
if(first_sum<)
}
}
}; | ALGO | 0.999944 | 4.81078 |
0819bbe7-6b77-486f-866b-a844a4e9899f | Sanskar6000/DSA | Interview Questions/Trees/lowest_common_ancestor_bt.cpp | //Brute: Find Path of both nodes from tree-> traverse each path
//Approach: Use Preorder Traversal
//if we find NULL, first Node or Second Node return it
//If left and right both are not NULL. Then the corresponding root will be our answer
//Brute
bool pathArr(TreeNode* root, TreeNode* node, vector<TreeNode*> &arr) ... | ALGO | 0.999981 | 6.041046 |
4b5a4f72-7fb9-4ef0-ad25-cba0e3ec65ba | karantrap/DSA-Problems | BASICS/pattern/solidrect.cpp | #include<iostream>
using namespace std;
int main(){
int n,m;
cout<<"enter rows:";
cin>>n;
cout<<"enter columns:";
cin>>m;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cout<<"*";
}
cout<<endl;
}
} | ALGO | 0.99465 | 3.340352 |
5cb0632f-6ec6-4fc8-a6ad-84109eeca3d0 | Stiner/opennask | objconv/omfhash.cpp | #include "stdafx.h"
void COMFHashTable::Init(SOMFHashBlock * blocks, uint32 NumBlocks) {
// Initialize
this->blocks = blocks; // Pointer to blocks
this->NumBlocks = NumBlocks; // Number of blocks
String = 0;
StringLength = 0;
}
// Rotate right 16-bit word
uint16 ... | ALGO | 0.994577 | 4.224108 |
bc6d341a-0d23-4142-a553-dce1a3d8ecbf | DariaWelt/Numerical-Methods | Polynomial Interpolation/Polinom-Interpolation library/Interpolation.cpp | #include "Interpolation.h"
#include "Polynom.h"
#include "Table_Function.h"
#include <iostream>
void PrintHermitPolynom(FILE* stream, Table_Func_t* trash) {
((Table_Function*)trash->obj)->PrintHermit(stream);
}
double* Hermit(double* valid, int size_v, Table_Func_t* trash) {
vector<double> x(size_v, 0);
for (int ... | ALGO | 0.995032 | 3.799491 |
f4ff6834-f0da-40a2-b388-5272f766a2b1 | adityanjr/code-DS-ALGO | CodeForces/Complete/700-799/714B-FilyaAndHomework.cpp | #include <cstdio>
#include <set>
int main(){
long n; scanf("%ld\n", &n);
std::set<long> s;
while(n--){long a; scanf("%ld", &a); s.insert(a);}
if(s.size() <= 2){puts("YES"); return 0;}
if(s.size() >= 4){puts("NO"); return 0;}
long a = *s.begin();
long b = *(++s.begin());
long c = *(++... | ALGO | 0.999886 | 3.857279 |
5461ef98-0789-4653-9f65-4e77b0aa3e39 | lsiddiqsunny/programming-contest | Lightoj/1035.cpp | #include<bits/stdc++.h>
using namespace std;
int ans[101][101];
int main()
{
int k;
for(int i=2; i<=100; i++)
{
k=i;
for(int j=2; j<=100; j++)
{
if(k==0) break;
while(k%j==0)
{
ans[i][j]++;
k/=j;
}
... | ALGO | 0.999447 | 3.897858 |
b37ecef3-882c-4560-a98b-85c37446eff4 | cepxuozab/YandexTrainingAlgorithms | Training3/DivisionB/Task32_DSU.cpp | #include <iostream>
#include <memory>
#include <numeric>
#include <ranges>
#include <set>
#include <unordered_map>
#include <vector>
class DSU {
std::vector<int> rank;
std::vector<int> parent;
public:
DSU(int n);
auto findParent(int node) -> int;
void Union(int x, int y);
};
auto main() -> int
... | ALGO | 0.999936 | 5.481914 |
270be08b-aca2-4160-8f00-f759acf1737b | Abhyudaymishra97/React | 20005_Abhyuday_Mishra_C++/C++ Assignment/D/D3.cpp | /*
D3. Implement linked list working like Queue.
*/
#include <iostream>
using namespace std;
struct node {
int data;
struct node *next;
};
struct node* front = NULL;
struct node* rear = NULL;
struct node* temp;
/* The function Insert() inserts an element into the queue.
If rear is NULL,then the queu... | ALGO | 0.998605 | 5.042037 |
158612d4-3221-4906-be48-bbee7f742086 | Nateiru/CS149 | asst1/prog1_mandelbrot_threads/mandelbrotThread.cpp | #include <stdio.h>
#include <thread>
#include "CycleTimer.h"
typedef struct {
float x0, x1;
float y0, y1;
unsigned int width;
unsigned int height;
int maxIterations;
int* output;
int threadId;
int numThreads;
} WorkerArgs;
extern void mandelbrotSerial(
float x0, float y0, float x1... | ALGO | 0.930873 | 4.636922 |
8eff3439-d694-4bcc-86e1-e6059a4dbc68 | mridul-mc/all_c_part1 | armstorn no btwn 100-999.cpp | #include<stdio.h>
#include<conio.h>
#include<math.h>
int main()
{
int n,num,d,sum;
printf("Armstorn number between 100 <--> 999:");
for(n=100;n<=999;n++)
{
num=n;
sum=0;
while(num>0)
{
d=num%10;
sum=sum+pow(d,3);
num=num/10;
}
if(n==sum)
printf("%4d",n);
}
return(0);
}
| ALGO | 0.999721 | 3.076688 |
3276b58b-08ab-44db-b4fc-202407fe767a | vladiant/ProjectiveDeblurring | refactored_code/src/MotionBlurImageGenerator.cpp | #include "MotionBlurImageGenerator.hpp"
#include <cmath>
#include <cstring>
#include "warping.h"
MotionBlurImageGenerator::MotionBlurImageGenerator() {
for (int i = 0; i < NumSamples; i++) {
Hmatrix[i].Hmatrix[0][0] = 1;
Hmatrix[i].Hmatrix[0][1] = 0;
Hmatrix[i].Hmatrix[0][2] = 0;
Hmatrix[i].Hmatrix... | ALGO | 0.952766 | 5.219653 |
2dafd1e2-d8a8-483f-ad74-446809bf3ba1 | neeraj-kumar7/Codeforces | 822/b.cpp | #include <bits/stdc++.h>
using namespace std;
void solve(int n){
vector<vector<int>> ans;
for(int i = 1; i <= n; i++){
vector<int> floor;
for(int j = 1; j <= i; j++){
if(j == 1)
floor.push_back(1);
else if(j == i)
floor.push_back(1);
... | ALGO | 0.999918 | 4.240076 |
caf23f44-f133-4108-b622-e8091b7999c4 | ZiajaNieLubieCie2/2E_Programowanie_Obiektowe | 05.10.2023/zadanie 3.cpp | #include <iostream>
using namespace std;
int main()
{
int x;
cout << "podaj liczbe " << endl;
cin >>x;
if (x>=100 && x<150)
cout << "liczba miesci sie w przedziale " << endl;
else
cout <<"liczba nie miesci sie w przedziale "<< endl;
}
| TOOL | 0.968117 | 3.110308 |
1dbbd3b0-99cc-4d0e-ac64-e976c2c0b0ef | qrbs/pytorch_source | pytorch/third_party/eigen/bench/sparse_setter.cpp |
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.05 -DSIZE=2000 && ./a.out
// -DNOGMM -DNOMTL -DCSPARSE
// -I /home/gael/Coding/LinearAlgebr... | ALGO | 0.985751 | 4.133557 |
cb360c3d-1125-47d0-8d64-9db650db1a91 | lazy-chess-player/competion | 第六届传智杯省赛/A/A.cpp | #define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <unordered_map>
#include <string>
#include <queue>
#include <stack>
#include <map>
#include <list>
#define fi first
#define se second
#define endl '\n'
using namespace std;
typedef long long ll;
typ... | ALGO | 0.999589 | 4.455082 |
ede3b08d-85e5-4376-be04-8769d8fbd385 | kang2015/online-test-exam | 百度-字典序位置.cpp | //my ans
//abcdefghijkl的字典序,其中某个串的位置
/**
* 输入:
* 2
* abcdefghijkl
* hgebkflacdji
* 输出:
* 1
* 302715242
* */
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<iostream>
#include<algorithm>
#include<memory>
#include<map>
#include<queue>
#include <sstream>
#include <set>
#include <list>
... | ALGO | 0.999938 | 3.886719 |
78ef374b-56c9-4d6a-9283-39bce8bca60c | yongduek/jungol | 1078_저글링_방사능_오염_upgrade.cpp | #include <stdio.h>
#include <queue>
#include <iostream>
#include <sstream>
using namespace std;
int board[100][100];
int W, H;
const int dx[] = { 0, 0, +1, -1 };
const int dy[] = { +1, -1, 0, 0 };
void pr(int ktime) {
printf ("--- ktime: %d ---\n", ktime);
for (int i = 0; i < H; i++) {
for (int ... | ALGO | 0.999791 | 3.800526 |
5c3d27b4-9800-48c8-9668-40c67fd1124b | rayxo/rayxo_MS | 2.cpp | #include<iostream>
#include<cstdlib>
#include<vector>
#include<cassert>
using namespace std;
template<typename T>
class Minstack
{
public:
vector<T> datas;
vector<T> Mindatas;
void push(T val);
void pop();
T min();
void display();
};
template<typename T>
void Minstack<T>::push(T val)
{
datas.push_back(val);
if... | ALGO | 0.999765 | 4.48482 |
1897fa47-6abb-4c3a-b63c-602877e82ec0 | sir-rasel/Online_Judge_Problem_Solve | Spoj/spoj_NHAY.cpp | #include<bits/stdc++.h>
using namespace std;
const int maxx = 1000005;
int failureTable[maxx];
bool flag = true;
void failureTableGenerate(string pattern){
int len = pattern.length();
failureTable[0]=failureTable[1]=0;
int i=1,j=0;
while(i<len){
if(pattern[i]==pattern[j])
failureT... | ALGO | 0.999602 | 4.289263 |
0b61f174-c413-4305-8891-1a20e8d2030e | arpiku/codeSnippets | leetcode/76_MinimumWindowSubstring.cpp | std::string minWindow(std::string s, std::string t) {
if (s.empty() || t.empty()) {
return "";
}
std::unordered_map<char, int> tFrequency, window;
for (char c : t) {
tFrequency[c]++;
}
int required = tFrequency.size();
int formed = 0;
int left = 0, right = 0;
int mi... | ALGO | 0.99989 | 7.251563 |
2f80c826-e312-404f-91ec-1379fe9eaf47 | ishandutta2007/codeforces | anandoza/normal/939/D.cpp | #include <bits/stdc++.h>
using namespace std;
// clang-format off
// template {{{
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define f first
#define s second
#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define trav(a, x) for (auto... | ALGO | 0.99998 | 5.055526 |
bc7fe81d-4200-469b-bc83-424b913251b3 | A924404/cfd-bench | src/axhelm-sycl/axhelmReference.cpp | #define cubNq3 (cubNq*cubNq*cubNq)
#define Nq3 (Nq*Nq*Nq)
static int meshIJN(const int i, const int j, const int N){
return i + j*N;
}
static int meshIJKN(const int i, const int j, const int k, const int N){
return i + j*N + k*N*N;
}
/* comment the unused function
static int meshIJKLN(const int i, const int ... | ALGO | 0.999745 | 3.885831 |
05733be2-e436-485a-9e01-127e4a453bfe | feilinlp/competitive-programming | CodeBreaker/Lis.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
int n;
scanf("%d", &n);
vector <int> num(n+1);
vector <int> list(n+1, 1e9);
list[0]=0;
int pos=1;
for (int i=1; i<=n; i++)
{
scanf("%d", &num[i]);
if (num[i]>list[pos-1])
... | ALGO | 0.99993 | 3.734849 |
5d148b48-93cf-4cad-aedd-76b13e1b39f6 | Shakun03/codeChallenge | 6_RotateArrayLeftOrRight/prog.cpp | #include <iostream>
using namespace std;
/*
Rotate an array by k steps. if k> 0, rotate right else if k<0, rotate left.
rotating an array k times left === rotating array n-k times right
so essentially you need to code for rotating right.
step 1: if k is huge, reduce it to k%need
step 2: reverse array separa... | ALGO | 0.999899 | 4.656632 |
09cbbe16-7c84-4940-92df-e3a61416dd73 | xizhonghua/zoj | vol_29/3809.cpp | // 3829418 2014-11-27 02:13:26 Accepted 3809 C++ 0 272 xxfflower
#include <iostream>
#include <vector>
using namespace std;
int main() {
int t;
cin>>t;
while(t--) {
int n;
cin>>n;
vector<int> h(n);
for(int i=0;i<n;i++)
cin>>h[i];
int c=0;
... | ALGO | 0.99977 | 3.993693 |
adddf1b9-10a7-4672-b018-50a58ab63154 | dixita7733/DSA | c++tests/looping/3.cpp | // For N=5, what is the diamond pattern output?
// Input: Enter number of rows: 5
// Output:
// *
// ***
// *****
// *******
#include <iostream>
using namespace std;
int main() {
int userno;
cout << "Enter number of rows: ";
cin >> userno;
for (int row = 0; row < userno; row++) {
// Pr... | ALGO | 0.962393 | 6.799795 |
54e9595e-1e5e-4d72-b0f4-b8e9fe0e508f | Kawser-nerd/CLCDSA | Source Codes/AtCoder/abc110/B/4085053.cpp | #include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <sstream>
#include <queue>
#include <map>
#include <vector>
#include <set>
#include <cstdlib>
#include <stack>
#include <climits>
#include <ctime>
#include <iomanip>
using namespace std;
typedef long long LL;
typ... | ALGO | 0.999997 | 3.089027 |
b1dd4263-6818-4dfc-9c44-53cc9ae08c4c | pf3rd1na/flutter_udemy | first_app/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.998423 | 6.762122 |
68dc808c-4f12-4fcf-8754-fa2f82479fcc | Rabiul35790/DimikOJ-52-Problem-Solutions | Problem - 26 (Alien Gupi).cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int T,i,count=0;
double X;
cin>>T;
for(i=0;i<T;i++)
{
cin>>X;
while(X>1)
{
X/=2;
count++;
}
cout<<count<<" days"<<endl;
count=0;
}
} | ALGO | 0.999894 | 3.613059 |
f77cd367-83c7-4cb0-b47e-473a2fdf26ca | DianaMarciniak/Repository_1 | Hmwk/Assignment_1/Gaddis_9thEd_Chap2_Prob7_OceanLevels/main.cpp | /*
* File: main.cpp
* Author: dianamarciniak
* Created on January 3, 2024, 2:08 PM
* Purpose: Template used to start all projects
*/
//System Libraries
#include <iostream> //Input-Output Library
using namespace std;
//User Libraries
//Global Constants - Math Physics, Chemistry, Conversions
//Function Pro... | ALGO | 0.963964 | 3.683602 |
019fbe3b-ae95-4b02-8363-9c7b4723e81a | kazuuuuuuuuuuuu/leetcode_solution | 155.cpp | //every element in a stack can record not only its value
//but also the state of the whole stack up to that point
//
class MinStack {
stack<pair<int, int>> stack;
public:
MinStack() {
}
void push(int val) {
if(stack.empty())
push({val, val});
else
{
... | ALGO | 0.999956 | 6.207682 |
05e6d096-0e9c-4300-ba05-7550560dfcc8 | joshua-ndereba/sub | 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.998733 | 6.76775 |
98cd8917-3212-4bac-bc46-df77f3ab205f | andrewqt/Competitive-Programming | CodeForces/_0567_E_PresidentAndRoads/_0567_E_PresidentAndRoads.cpp | #include <bits/stdc++.h>
using namespace std;
int N, M, S, T;
vector<pair<int, int>> graph[2][100005];
long long dist[2][100005];
priority_queue<pair<long long, int>, vector<pair<long long, int>>, greater<pair<long long, int>>> pq;
bool def[100005];
pair<pair<int, int>, int> edge[100005];
void dijkstra(int s, int t)... | ALGO | 0.999918 | 4.120307 |
53c01fbe-51b6-486e-a1f0-e2271d25c71e | DysonHoang/Tin-Hoc | IT at school/Mang/ktra so chan/main.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{ float s=0;
int n,a[100];
//cout<<"nhap so pt cua mang:";
cin>>n;
for(int i=0; i<n; i++)
{
// cout<<"a["<<i<<"]";
cin>>a[i];
}
for(int i=0; i<n; i++){
if(a[i]%2==0)
cout<<a[i]<<endl;
}
}
| ALGO | 0.9972 | 3.281593 |
dc93df10-a488-4da9-82c9-e2ef888cf6ae | abhishek0777/CPCodes | Heap/8-k-sorted array.cpp | /*
Algo
1. Make min heap of first k+1 elements
2. Now pick top element one by one and also add new el in pq(min heap)
*/
#include<bits/stdc++.h>
#define ll long long int
using namespace std;
int main()
{
ll n,k;cin>>n>>k;
ll a[n];
for(ll i=0;i<n;i++)cin>>a[i];
priority_queue<ll,vector<ll>,greater<ll>> p... | ALGO | 0.999992 | 3.118284 |
ae19bf08-4e8b-46f4-9c36-95c6fbc02e02 | AKA2501/traffic | src/algorithms/munkres.cpp | #include <algorithm>
#include <cassert>
#include <limits>
#include <set>
#include "algorithms/munkres.h"
namespace vroom::utils {
template <class T>
std::unordered_map<Index, Index>
minimum_weight_perfect_matching(const Matrix<T>& m) {
// Trivial initial labeling.
std::vector<T> labeling_x(m.size(), 0);
std::... | ALGO | 0.999849 | 6.538509 |
2e656e2c-c005-4503-8987-e3b53a4debcd | its-Saurabh23/DSA | Repeat/sumTree.cpp |
/*
class Solution
{
private:
//step 1
pair<bool,int> isSumfast(Node* root){
//base case
if(root == NULL){
pair<bool,int>p = make_pair(true,0);
return p;
}
//base case for leaf
if(root->left == NULL && root->right == NULL){
pair<bool,int> p = make_pair(tru... | ALGO | 0.99998 | 5.314777 |
df41fff4-368c-42af-9104-3de111a74cf7 | QbitQuantum/Basics | Исходники/compile_Tridiagonalization_Tridiagonalization_MatrixType.cpp | int main(int, char**)
{
cout.precision(3);
MatrixXd X = MatrixXd::Random(5,5);
MatrixXd A = X + X.transpose();
cout << "Here is a random symmetric 5x5 matrix:" << endl << A << endl << endl;
Tridiagonalization<MatrixXd> triOfA(A);
MatrixXd Q = triOfA.matrixQ();
cout << "The orthogonal matrix Q is:" << endl << Q << e... | ALGO | 0.998083 | 3.532952 |
885dbf58-7068-4bcf-bd9d-5838e4c68a63 | tomn2804/Kanalysis | External Dependencies/boost_1_74_0/libs/numeric/ublas/doc/samples/matrix_row.cpp | #include <boost/numeric/ublas/matrix.hpp>
#include <boost/numeric/ublas/matrix_proxy.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
matrix<double> m (3, 3);
for (unsigned i = 0; i < m.size1 (); ++ i) {
matrix_row<matrix<double> > mr (m, i);
f... | ALGO | 0.957852 | 3.311203 |
4a9dbd3b-1f76-4360-a404-fb8e8b09a091 | wyrover/book-code | 3rdparty/cryptopp565/rc5.cpp | // rc5.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "rc5.h"
#include "misc.h"
#include "secblock.h"
NAMESPACE_BEGIN(CryptoPP)
void RC5::Base::UncheckedSetKey(const byte *k, unsigned int keylen, const NameValuePairs ¶ms)
{
AssertValidKeyLength(keylen);
r = GetRoundsAndThro... | ALGO | 0.9992 | 7.508304 |
b9208f96-c58a-468f-a57d-0b2ca90fe6ea | ladrians/CarND-MPC-P10 | src/Eigen-3.3/lapack/lu.cpp | #include "common.h"
#include <Eigen/LU>
// computes an LU factorization of a general M-by-N matrix A using partial pivoting with row interchanges
EIGEN_LAPACK_FUNC(getrf,(int *m, int *n, RealScalar *pa, int *lda, int *ipiv, int *info))
{
*info = 0;
if(*m<0) *info = -1;
else if(*n<0) ... | ALGO | 0.998061 | 5.816968 |
5859d231-378d-40cc-8b19-3a838678aaf9 | simonlynen/android_libs | eigen/jni/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXf mat(2,4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
MatrixXf::Index maxIndex;
float maxNorm = mat.colwise().sum().maxCoeff(&maxIndex);
std::cout << "Maximum sum at position " << maxIndex << std:... | ALGO | 0.99984 | 4.220459 |
e86eb160-59f6-4a42-ab72-a457b860a2c9 | ungtb10d/su2 | Common/src/toolboxes/MMS/CMMSNSTwoHalfCirclesSolution.cpp | #include "../../../include/toolboxes/MMS/CMMSNSTwoHalfCirclesSolution.hpp"
CMMSNSTwoHalfCirclesSolution::CMMSNSTwoHalfCirclesSolution(void) : CVerificationSolution() { }
CMMSNSTwoHalfCirclesSolution::CMMSNSTwoHalfCirclesSolution(unsigned short val_nDim,
unsig... | ALGO | 0.996212 | 4.562266 |
f5f0408f-27ee-4e1e-8387-cc3e09955c35 | GeisslerGroup/lammps-2Apr13-replica | src/USER-REAXC/reaxc_hydrogen_bonds.cpp | #include "pair_reax_c.h"
#if defined(PURE_REAX)
#include "hydrogen_bonds.h"
#include "bond_orders.h"
#include "list.h"
#include "valence_angles.h"
#include "vector.h"
#elif defined(LAMMPS_REAX)
#include "reaxc_hydrogen_bonds.h"
#include "reaxc_bond_orders.h"
#include "reaxc_list.h"
#include "reaxc_valence_angles.h"
#in... | ALGO | 0.996729 | 4.209658 |
7c8cf660-8e7c-498c-b5bf-e48e5e265398 | satyajit-patel/algoCamp | array/subarray/practice/2962. Count Subarrays Where Max Element Appears at Least K Times.cpp | /*
Input: nums = [1,3,2,3,3], k = 2
Output: 6
Explanation:
The subarrays that contain the element 3 at least 2 times are:
[1,3,2,3], [1,3,2,3,3], [3,2,3], [3,2,3,3], [2,3,3] and [3,3].
Constraints:
1 <= nums.length <= 10^5
1 <= nums[i] <= 10^6
1... | ALGO | 0.999983 | 6.620862 |
e8bbfe69-e01d-4cc6-aef3-3f5a8ac25093 | VelsonWang/AppDemo | src/libs/utils/buildablehelperlibrary.cpp | #include "buildablehelperlibrary.h"
#include "hostosinfo.h"
#include "synchronousprocess.h"
#include <QDir>
#include <QDateTime>
#include <QDebug>
#include <QRegExp>
namespace Utils {
bool BuildableHelperLibrary::isQtChooser(const QFileInfo &info)
{
return info.isSymLink() && info.symLinkTarget().endsWith(QLatin... | TOOL | 0.928385 | 6.142834 |
974de4dc-4168-4e46-b036-9393507c6cb3 | tukaramkangude13/dsa-Problem-and-Many-More | short.cpp | #include<iostream>
#include<vector>
using namespace std;
int main()
{
vector<int>arr{0,1,1,1,1,1,1,1,0,1,0} ;
int start=0;
int end=arr.size()- 1;
int i=0;
while (i!=end)
{
if (arr[i]==0)
{
swap(arr[start],arr[i]);
start++;
i++;
}
... | ALGO | 0.999988 | 3.235761 |
52333770-16cc-4acd-878e-68bfa44960b0 | 304314/Code-Size-Global-Optimization | bolt/lib/Core/ParallelUtilities.cpp | #include "bolt/Core/ParallelUtilities.h"
#include "bolt/Core/BinaryContext.h"
#include "bolt/Core/BinaryFunction.h"
#include "llvm/Support/RWMutex.h"
#include "llvm/Support/ThreadPool.h"
#include "llvm/Support/Timer.h"
#include <mutex>
#define DEBUG_TYPE "par-utils"
namespace opts {
extern cl::OptionCategory BoltCate... | TOOL | 0.91066 | 7.880348 |
7c4d04e5-9f1c-4bf3-b559-dbcb6b8b97dd | Bhavanianbazhagan/c-pratical-lab-experiments | dat0_exp3_floyd's triangle pattern.cpp | #include<iostream>
using namespace std;
int main()
{
int i,j,n;
int a=1;
cout<<"enter number of rows in floyds triangle to print:";
cin>>n;
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
cout<<a;
a++;
cout<<" ";
}
cout<<endl;
cout<<"-";
}
return 0;
}
| ALGO | 0.999586 | 3.343712 |
6da1902c-4671-44a3-8328-da8211baa1b9 | ithemal/DiffTune | llvm-mca-parametric/llvm/lib/Transforms/IPO/CalledValuePropagation.cpp | #include "llvm/Transforms/IPO/CalledValuePropagation.h"
#include "llvm/Analysis/SparsePropagation.h"
#include "llvm/Analysis/ValueLatticeUtils.h"
#include "llvm/IR/InstVisitor.h"
#include "llvm/IR/MDBuilder.h"
#include "llvm/Transforms/IPO.h"
using namespace llvm;
#define DEBUG_TYPE "called-value-propagation"
/// The... | TOOL | 0.994923 | 7.899927 |
6e0e4520-5ca7-47ce-a7b5-2e0eb39bcd1b | ishandutta2007/codeforces | scott_wu/normal/538/C.cpp | #include <iostream>
#include <fstream>
#include <cstdio>
#include <algorithm>
#include <map>
#include <vector>
#include <string>
#include <queue>
using namespace std;
typedef long long ll;
const int MAXM = 100100;
int N, M;
int d[MAXM], h[MAXM];
int main()
{
ios_base::sync_with_stdio(0);
cin >> N >> M;
f... | ALGO | 0.999913 | 3.676741 |
f4851777-2c81-4967-8b62-2d848415afea | Raul-Goncalves/School | 2022-2023/UFCD 0809/F6/FICHA6_PSD_EX11_2.cpp | #include<stdio.h>
main(){
int mes;
printf("Insira o ms de 1 12");
scanf("%d", &mes);
if(mes==1 || mes==3 || mes==5 || mes==7 || mes==8 || mes==10 || mes==12)
printf("O ms tem 31 dias");
else if(mes == 2)
printf("O ms tem 28 dias");
else if(mes == 4||mes == 6||mes == 9||mes == 11)
printf("O ms tem 30 dias... | ALGO | 0.987556 | 3.178627 |
ad42f013-708e-4a55-852a-94bc2232f5b7 | whquddn55/Algorithm_BojSolves | 10000/10814.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
int n;
vector<string> arr[201];
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
cin >> n;
for (int i = 0; i < n; i++) {
int a;
string b;
cin >> a >> b;
arr[a].emplace_back(b);
}
for (int i... | ALGO | 0.999424 | 4.029916 |
13dfd2c9-0550-4941-b6ea-d30faa84a767 | maxgallup/llvm-blade | llvm-project-16.0.1.src/llvm/tools/llvm-xray/xray-color-helper.cpp | #include "xray-color-helper.h"
#include "llvm/Support/FormatVariadic.h"
#include "llvm/Support/raw_ostream.h"
#include <cmath>
using namespace llvm;
using namespace xray;
// Sequential ColorMaps, which are used to represent information
// from some minimum to some maximum.
const std::tuple<uint8_t, uint8_t, uint8_... | TOOL | 0.930676 | 6.877213 |
5e5af7ca-2a35-41b2-9ab2-2cc4fce327e2 | FreeTymeKiyan/LeetCode-Sol-Res | src/main/cpp/143_Reorder_List.cpp | // 143_Reorder_List.cpp : Defines the entry point for the console application.
/**
* Given a singly linked list L: L0->L1->->Ln-1->Ln,
* reorder it to: L0->Ln->L1->Ln-1->L2->Ln-2->
*
* You must do this in-place without altering the nodes' values.
*
* For example,
* Given {1,2,3,4}, reorder it to {1,4,2,3}.
*
*... | ALGO | 0.999982 | 5.776189 |
c05a98de-ec14-4c33-9726-cb7d300e3d4d | prachipatil13/leetcode | 0231-power-of-two/0231-power-of-two.cpp | class Solution {
public:
bool isPowerOfTwo(int n) {
if(n<=0)return false;
if((n& (n-1))==0)return true;
return false;
}
}; | ALGO | 0.99758 | 6.147631 |
5050628e-4aa8-43e2-ac49-1af1c3f9130e | lonyliu/tfhe-10ms | src/libtfhe/tlwe-fft-operations.cpp | #ifndef TFHE_TEST_ENVIRONMENT
/* ***************************************************
TLWE fft operations
*************************************************** */
#include <random>
#include <cassert>
#include "tfhe_core.h"
#include "numeric_functions.h"
#include "lweparams.h"
#include "lwekey.h"
#include "lwesamples.... | ALGO | 0.854054 | 5.892358 |
94221d1e-7154-48f0-bab8-dd4520ece81a | AgustinMDominguez/TrainingCamp_2020 | Competencias/dia-7-Jul22/K_Sereja_and_Dima.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
int cards[n];
for(int i=0; i<n; i++) cin >> cards[i];
int sereja=0, dima=0, aux1=0, aux2 = n-1;
for(int i=1;i<=n;i++){
if(i&1) {
if (cards[aux1] > cards[aux2]) sereja... | ALGO | 0.999986 | 3.644665 |
52e885b1-f9ab-495c-8d0d-6a587cf9a9ea | samoliverdev/OneDudeEngine | Engine/ThirdParty/taskflow/3rd-party/tbb/examples/graph/cholesky/init.cpp | #include <cstdio>
#include <cassert>
#include <cstring>
#include <cstdlib>
#include <mkl_cblas.h>
static void posdef_gen( double * A, int n )
{
/* Allocate memory for the matrix and its transpose */
double *L = (double *)calloc( sizeof( double ), n*n );
assert( L );
double *LT = (double *)calloc( size... | ALGO | 0.999338 | 4.929345 |
e3df7af0-3056-4c82-b309-18577e71231d | Micuks/code | aoapc/chapter6/heapsort.cpp | #include<iostream>
using namespace std;
void swap(int& a, int& b) {
int tmp = a;
a = b;
b = tmp;
}
long long binpow(int bas, int pow) {
long long ans = 1;
while(pow) {
if(pow&1)
ans *= bas;
bas *= bas;
pow >>= 1;
}
return ans;
}
int caldep(int a) {
... | ALGO | 0.999971 | 4.546808 |
de40c279-cec2-4bd0-8aa0-d5dd3ed35318 | mmoeller86/owelbcl | bld/plustest/positive/source/opt23.cpp | #include "fail.h"
struct S {
S *next;
S *prev;
unsigned v;
};
struct I {
I *n;
S *c;
};
struct C {
S *list;
unsigned count;
};
void I_ctor( I *t, S *c ) {
t->c = c;
}
inline I *prev( I *t ) {
t->c = t->c->prev;
return t;
}
void erase( I i ) {
S *p = i.c;
S *e = p->n... | TEST | 0.989675 | 4.10692 |
d8749675-717b-42d3-bfcd-8d7a75d32091 | Sa2003hil/DSA | Introdunction to CPP/stack/Balanced Paranthesis0022/tempCodeRunnerFile.cpp | #include <bits/stdc++.h>
using namespace std;
#define MAX 10
char stack[MAX];
int top = -1;
void push(char data)
{
if (top < MAX - 1) // Check for stack overflow
{
top++;
stack[top] = data;
}
else
{
cout << "Stack overflow!" << endl;
}
}
char pop()
{
if (top >= 0)
... | ALGO | 0.999534 | 6.387321 |
be29d7a8-5c0b-4516-8176-36d746789b37 | prabhatsuman/cses | C_Yarik_and_Array.cpp | /*
Prabhat_007
*/
#include <bits/stdc++.h>
#define ll long long
#define M 1000000007
#define nline '\n'
using namespace std;
typedef vector<int> vi;
#define all(v) (v).begin(), (v).end()
typedef vector<ll> vl;
#define read(v) \
for (auto &x : v) \
cin >> x;
#define printv(v) \... | ALGO | 0.999612 | 5.478734 |
bf8a6dd7-fd75-432a-9cbd-f9ec75f0a07b | mathidot/leetcode_solution | canFinish.cpp | #include "util.h"
vector<vector<int>> buildGraph(int numCourses, vector<vector<int>> &prerequisites) {
vector<vector<int>> graph = vector<vector<int>>(numCourses, vector<int>());
for (const auto &prerequisity: prerequisites) {
int from = prerequisity.back(), to = prerequisity.front();
graph[fro... | ALGO | 0.999791 | 6.517436 |
7c8ac5dc-ab7b-4ca7-90fe-bc5c76906ac1 | Rajeev0651/Codeforces | Set_1/A. Choose Two Numbers.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int N, M, x;
cin >> N;
vector<int> A, B;
for (int i = 0; i < N; i++)
{
cin >> x;
A.push_back(x);
}
cin >> M;
for (int i = 0; i < M; i++)
{
cin >> x;
B.push_back(x);
}
sort(A.begin(), A.end());
sort(B.begin(), B.end());
... | ALGO | 0.999992 | 3.770263 |
0d1039a1-6bb4-42cc-9b6e-dcd15a1b0d97 | levanliu/leetcode | .leetcode/18.四数之和.cpp | /*
* @lc app=leetcode.cn id=18 lang=cpp
*
* [18] 四数之和
*/
// @lc code=start
#include<iostream>
using namespace std;
class Solution {
public:
vector<vector<int>> fourSum(vector<int>& nums, int target) {
vector<vector<int>> quadruplets;
if (nums.size() < 4) {
return quadruplets;
... | ALGO | 0.999943 | 6.049192 |
3b5496d3-2266-4e58-a563-7c6c5b27d561 | Nouran900/EL2040 | C++/Dervied/Find_element_in_array.cpp | #include<iostream>
int search (int arr[],int size,int number_to_find)
{
int y=false;
for (int i=0;i<size;i++)
{
if(arr[i]==number_to_find)
{
y=i;
}
}
return y;
}
int main()
{
int number;
int arr[10]={1,5,7,9,6,4,44,66,88,90};
std::cout<<"enter... | ALGO | 0.998809 | 4.213338 |
03d9d763-6ece-457a-b47b-d1d493d8e26e | aspensmonster-school/cs3358-data-structures | lab1/ll.cpp | /* Doubly Linked List */
#include "ll.h"
#include <iostream>
#include <string>
#include <cstdlib>
#ifndef NULL
#define NULL 0
#endif
using namespace std;
ll::ll()
{
head = NULL;
// tail = NULL;
}
ll::~ll()
{
cout << "Called ll destructor" << endl;
deleteListContents();
delete head;
// delete tail;
}
vo... | ALGO | 0.997945 | 4.478291 |
5795dc5b-7900-4bee-940c-bc27256a1f40 | leducphuclong/code | Competitive Programming/codeforces/training/D_Cleaning_the_Phone.cpp | /*If you don't think twice, you have to code twice.*/
// Include
#include <bits/stdc++.h> // NOLINT
// #include <conio.h>
// Namespace
using namespace std; // NOLINT
// Define
#define nln '\n'
// Typedef and Struct
typedef int64_t lo;
// Constant
// Declare global variables.
vector<pair<lo, lo>> dir4 = {{0, 1},... | ALGO | 0.999918 | 4.701851 |
2800deab-b735-4ab3-b6ec-fadabb365047 | EHammer98/testRepoSWEN2 | src/main.cpp | #include "cli.h"
#include "bubbleSort.h"
#include "mergeSort.h"
#include "heapSort.h"
#include <iostream>
int main() {
cli print;
bubbleSort sort1;
mergeSort sort2;
heapSort sort3;
int arrayToSort[100];
int arrayToSort2[100];
int arrayToSort3[100];
std::string newString = "hireabvherabilelajlvinreaingpiaregi... | ALGO | 0.991968 | 4.643318 |
4d242242-24bf-4076-ae11-4c977bb0f034 | Lalit-Dumka/Leetcode-DSA | 0061-rotate-list/0061-rotate-list.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* rotateRight... | ALGO | 0.999993 | 5.759019 |
8405e34b-1e7f-4fec-bd73-8ed688636d81 | Mahimatestgithub/GFGPOTD | Largestt number in K swaps.cpp | class Solution {
public:
void findMax(string &str, int k, string &maxStr, int idx) {
if (k == 0) return;
int n = str.size();
char maxChar = str[idx];
for (int i = idx + 1; i < n; i++) {
if (str[i] > maxChar) {
maxChar = str[i];
... | ALGO | 0.999991 | 5.747273 |
7e0d94ba-ceb9-4613-9e06-2b959b65ba47 | Ankita-singh-05/CPP--DSA-6 | Arrays/2DARR_input_ouput.cpp | #include<iostream>
using namespace std;
int main(){
int rows, cols;
cin>>rows>>cols;
//Taking input from users
int a[rows][cols];
for (int i=0; i<rows; i++){
for (int j=0; j<cols; j++){
cin>>a[i][j];
}
}
// Printing arrays elements
cout<<"Matrix is: "<<endl;
... | ALGO | 0.955303 | 3.496352 |
b862fac1-c65a-499b-9192-4835d524482f | DnyaneshwarG/learning | CPP/rev.cpp | #include <iostream>
#include <string.h>
using namespace std;
void str_rev(char *str, int len) {
if (str == nullptr || len < 2) {
return;
}
char *start = str;
char *end = str + len - 1;
while (start < end) {
if (start != nullptr && end != nullptr) {
char temp = * start;
*start = *end;
... | ALGO | 0.999942 | 5.691183 |
760f50e9-61f1-42c6-8f05-85a03d9be108 | vedanty3/dsa-codeground | leetcode-gfg-solutions/leetcode-solutions/Kth Smallest Element in a BST.cpp | // https : // leetcode.com/problems/kth-smallest-element-in-a-bst/
/**
* 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) {}... | ALGO | 0.999995 | 6.379999 |
47c99a72-6a87-4513-ba53-b75fa0829cd9 | Boeing/image_transport_plugins | compressed_depth_image_transport/src/rvl_codec.cpp | #include "compressed_depth_image_transport/rvl_codec.h"
namespace compressed_depth_image_transport
{
RvlCodec::RvlCodec()
{
}
void RvlCodec::EncodeVLE(int value)
{
do
{
int nibble = value & 0x7; // lower 3 bits
if (value >>= 3)
nibble |= 0x8; // more to come
word_ <<= 4;... | ALGO | 0.899287 | 5.63158 |
8b737c0d-1123-4cef-a63f-a082be399299 | saduvenkatesh/DSA-PYTHON | lab/concex_hull_grahams_scan.cpp | #include <iostream>
#include <vector>
#include <stack>
#include <algorithm>
using namespace std;
struct Point {
int x, y;
};
// A global reference point used for sorting
Point p0;
// Function to find the orientation of ordered triplet (p, q, r)
// Returns:
// 0 -> Collinear
// 1 -> Counterclockwise (left turn)... | ALGO | 0.999997 | 6.607097 |
88971266-f127-446e-a566-4dd1f90b001f | LeoJY/Leetcode | 201_Bitwise_AND_of_Numbers_Range.cpp | //201. Bitwise AND of Numbers Range
//Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive.
#include <iostream>
using namespace std;
class Solution {
public:
int rangeBitwiseAnd(int m, int n) {
return n > m ? (rangeBitwiseAnd(m >> 1, n >> 1) << ... | ALGO | 0.999662 | 5.635613 |
45a4ffea-57c2-4fae-8dfd-f37330fb05b9 | AnhTTx13/leetcode-c | cpp/problems/problem#3169.cpp | #include <algorithm>
#include <vector>
using namespace std;
int countDays(int days, vector<vector<int>> &meetings) {
sort(meetings.begin(), meetings.end(), [](vector<int> &a, vector<int> &b) {
if (a[0] == b[0]) {
return a[1] < b[1];
}
return a[0] < b[0];
});
vector<vector<int>> windows;
vect... | ALGO | 0.999932 | 5.17319 |
82e4d1af-5356-4175-87c7-10cccd22d6f0 | normalzero/LegionPlayerBot | dep/g3dlite/source/Random.cpp | #include "G3D/Random.h"
namespace G3D {
Random& Random::common() {
static Random r;
return r;
}
Random::Random(void* x) : state(NULL), m_threadsafe(false) {
(void)x;
}
Random::Random(uint32 seed, bool threadsafe) : m_threadsafe(threadsafe) {
state = new uint32[N];
reset(seed, threadsafe);
}
voi... | TOOL | 0.957667 | 6.373438 |
9c546c40-d454-44a3-b33a-08fae0fd7ac6 | xjs-js/leetcode | 0172.Factorial.Trailing.Zeroes/sol.cpp | #define MOD 10000000
class Solution {
public:
int trailingZeroes(int n) {
int count = 0;
uint64_t relt = 1;
for (uint64_t i = 1; i <= n; ++i) {
relt = (relt % MOD) * i % MOD;
while (relt && relt % 10 == 0) {
relt /= 10;
++coun... | ALGO | 0.999932 | 5.846423 |
253f9514-d734-47a3-a482-4f65f66f6280 | code-shub09/DSA-with-C- | scope of vairables/84.cpp | #include <iostream>
using namespace std;
int main()
{
char n;
cin >> n;
int count = 0;
while (n != '$')
{
count++;
cin >> n;
}
cout << count;
}
| ALGO | 0.960807 | 3.08406 |
06b862c9-c6b2-4f49-b8ad-34f35458ec5d | ishandutta2007/codeforces | zhylj/normal/1190/B.cpp | #include <bits/stdc++.h>
#define gc() getchar()
template <typename T> inline void rd(T& x) {
int si = 1; char c = gc(); x = 0;
while(!isdigit(c)) si = c == '-' ? -1 : si, c = gc();
while(isdigit(c)) x = x * 10 + c - 48, c = gc();
x *= si;
}
template <typename T, typename... Args>
inline void rd(T& x, Args&... args... | ALGO | 0.999916 | 3.295909 |
bc24a8d6-1d99-4d14-898e-ac808a73f7a1 | weiyanwei412/SQLaudit | extra/yassl/taocrypt/src/dh.cpp | /* dh.cpp implements Diffie-Hellman support
*/
#include "runtime.hpp"
#include "dh.hpp"
#include "asn.hpp"
#include <math.h>
namespace TaoCrypt {
namespace { // locals
unsigned int DiscreteLogWorkFactor(unsigned int n)
{
// assuming discrete log takes about the same time as factoring
if (n<5)
retur... | ALGO | 0.99842 | 6.18139 |
f7fd23b0-9839-4ea7-abc3-17f8849991e8 | cxoijve/Programmers | 프로그래머스/0/120808. 분수의 덧셈/분수의 덧셈.cpp | #include <string>
#include <vector>
using namespace std;
int gcd(int a, int b){
if(a%b==0) return b;
return gcd(b, a%b);
}
vector<int> solution(int numer1, int denom1, int numer2, int denom2) {
vector<int> answer;
int a = gcd(denom1, denom2);
int b = (numer1*denom2 + numer2*denom1) / a;
a = (... | ALGO | 0.9996 | 5.685235 |
3c104db4-1772-46c0-9dfc-97b485208e5a | sanikk/SearchAlgosQt | src/searches/fringe_with_dll.cpp | #include "fringe_with_dll.h"
#include <iostream>
RetVal fringe_with_dll(int startx, int starty, int goalx, int goaly, std::vector<std::string> citymap) {
const int map_size = citymap.size();
const int start_index = xy2int(startx, starty, map_size);
// std::cout << "start_index: " << start_index << std::endl;
c... | ALGO | 0.999939 | 4.054528 |
8095c04b-bc6b-4368-a582-fa2d8740c8eb | surajjaiswal-cmd/courses | c++/squarroot.cpp | #include <iostream>
using namespace std;
int main()
{
int x;
cout << "enter number =";
cin >> x;
int ans = 0;
for (int i = 0; i < x; i++)
{
if (i * i <= x)
{
ans = i;
}
else
break;
}
cout << ans;
return 0;
}
| ALGO | 0.999852 | 3.958921 |
3df3fdd1-76f9-4735-a53b-08e6ea959248 | BluePhoenixxx/PTITCODE_CPP | CPP0244.cpp |
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
unsigned short n, temp = 0;
cin >> n;
unsigned short a[n];
for (int i = 0; i <n; i++)
cin >> a[i];
sort(a, a+n);
for (int i = 0; i< n; i++)
{
if (a[i]==temp)
continue;
cout << a[i... | ALGO | 0.999961 | 3.255618 |
b57fc95d-f2a1-41e5-a578-6e323d61c86d | mihkhoi/baitap | Chuong 1 luu do thuat toan/68.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n, x, s = 0;
cin >> x >> n;
for(int i = 1;i <= n;i++)
{
s += pow(-1, i) * pow(x, 2*i);
}
cout << s;
return 0;
}
| ALGO | 0.999822 | 4.00539 |
ec08828a-1db1-4710-a9d6-a1a6cf7d306c | NataRazmochaeva/ADS_7383 | Zuev_Daniil_lr1/main.cpp | #include<iostream>
#include<fstream>
#include<cctype>
using namespace std;
bool Expression(ifstream &stream, char c);
bool Identifier(char c);
bool Operation(char c);
void Error(short k);
int main()
{
char c = '0';
bool b = false;
short tmp = 0;
cout<<"Анализатор понятия простое выражение:"<<endl;
... | ALGO | 0.926712 | 3.442103 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.