uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
54865b7a-7139-4772-bdc5-5cc816ee375d | anshyyy/CPP | Codeforces/1539A.cpp | #include <bits/stdc++.h>
#define IOS ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define loop(i,a,n) for(int i=a;i<n;i++)
#define all(v) (v).begin(),(v).end()
#define all1(v) (v).begin()+1,(v).end()
#define allr(v) (v).rbegin(),(v).rend()
#define allr1(v) (v).rbegin()+1,(v).rend()
typedef long long... | ALGO | 0.999854 | 4.848897 |
ddb67642-9f20-4ed9-8485-839f381d9313 | lepecoder/algorithms | leetcode_cn/59.cpp | class Solution {
public:
vector<vector<int>> generateMatrix(int n) {
vector<vector<int>> res(n, vector<int>(n));
int top = 0;
int left = 0;
int right = n - 1;
int down = n - 1;
int k = 1;
while (top <= down && left <= right) {
// top
... | ALGO | 0.999935 | 5.892711 |
95637752-3c96-416e-8f1c-13b6ed8b7737 | abdulkhaleq24/Basic-Data-Structures | Module 18 Operations on Binary Tree/max_height_nodes.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node *left;
Node *right;
Node(int val)
{
this->val = val;
this->left = NULL;
this->right = NULL;
}
};
Node *input_tree()
{
int val;
cin >> val;
Node *root;
if (val == -1)
{
... | ALGO | 0.999679 | 4.379173 |
e048c7c1-730b-4b6a-a26d-08a3208e69ee | XJTU-IMISS-test1/DP-DICE-test | Sketches/datasets.cpp | #include<iostream>
#include<fstream>
#include<iterator>
#include<string>
#include<vector>
#include<fstream>
#include<iomanip>
#include<math.h>
#include<cstdlib>
#include<thread>
#include<mutex>
#include<time.h>
#include<chrono>
#include"MurmurHash3.h"
using namespace std;
using namespace chrono;
void hash_x64_128()
{... | TOOL | 0.960416 | 4.489869 |
9f7d0bd2-79ae-4e0d-b989-b274998e8249 | cormoran/CompetitiveProgramming | src/contest/codeforces/196div1/B.cpp | #include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<set>
#include<string>
#include<cmath>
#include<cassert>
#include<map>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
typedef ll int__;
#define rep(i,j) for(int__ (i... | ALGO | 0.999774 | 4.370938 |
7d006e96-c413-424c-be73-d6bbf3a9897d | viiccwen/Competitve-programming | LeetCode/Daily/202402/279. Perfect Squares.cpp | class Solution {
public:
bool isPerfectSqueare(int& n, int& target) {
return n*n == target;
}
int numSquares(int n) {
vector<int> dp(n + 1, INT_MAX);
int perfectN = 1;
dp[0] = 0;
while(perfectN * perfectN <= n) {
int ps = perfectN * perfectN;
... | ALGO | 0.999981 | 5.650979 |
f1711937-e1a2-41fa-b435-59fcbc4ac189 | Kyuhyun-Cho/data-structure-lab-hw-kmu | Lab4_extra1.cpp | //조규현 20191669 Lab4-extra1
#include <iostream>
#include <cstring>
#define MAX_SIZE 100
using namespace std;
class Stack {
private:
int *sarray;
int top;
const int size;
public:
Stack(int size);
virtual ~Stack();
bool isFull() const;
bool isEmpty() const;
void push(int value);
char... | ALGO | 0.9995 | 4.037206 |
912a87d8-b59a-459c-8e83-2783c0e1f17f | sanluyene/cs140 | lab08/dl_hash.cpp | // CS140 Spring 2016
// Lab 08: Hash table for Dlists
// Author: Ashley Sattler
// Date: 03/29/2016
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include "dl_hash.h"
// This is our hashing function
unsigned int djb_hash(string &s)
{
int i;
unsigned int h;
h = 5381;
for (i = 0; i < s.size(); i++) {
... | ALGO | 0.993217 | 5.786072 |
530e238b-7934-44f5-a480-3f4ca310f847 | i-X-ce/competitive-programming | ABC/368C.cpp | /*
g++ XXX.cpp
./a.out
*/
#include <bits/stdc++.h>
using namespace std;
int main() {
int n; cin >> n;
vector<int>h(n);
for (int i=0;i<n;i++) cin >> h.at(i);
long long ans = 0;
for (int i=0;i<n;i++){
int hbf = h.at(i);
ans += (hbf / 5) * 3; hbf %= 5;
while(true){
if (hbf > 0){
ans++;... | ALGO | 0.999945 | 3.959562 |
9cc78562-de04-4e8d-a9e0-3f2d3970d7c2 | techwangh/LeetcodeAnswers | 066PlusOne.cpp | class Solution {
public:
vector<int> plusOne(vector<int>& digits) {
int n = digits.size(), carry = 0;
digits[n-1]++;
if(digits[n-1] == 10) {
for(int i = n-1; i >= 0; --i) {
digits[i] += carry;
carry = digits[i] == 10 ? 1 : 0;
if(car... | ALGO | 0.999951 | 6.955774 |
2f17a91b-d0a5-4ee3-aef2-a85a0d2702cb | Muhammad-Al-Halaby/Competitive-Programming-Submissions | codeforces/339/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define OnlineJudge1
#define loop(a,n) for(int i = a;i<n;i++)
#define NumofDigits(n) ((int)log10(n)+1)
#define CountofNumber(array,n,x) (upper_bound(array, array+n, x)-lower_bound(array, array+n, x))
#define readline(s) getline(cin,s)
#define PB push_back
#define MP make... | ALGO | 0.999964 | 4.195064 |
fcd106fe-4228-4102-9103-43d62e56b158 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Mixtral/top0-100/smallest-greater-multiple-made-of-two-digits-Solution.findInteger/177927_nan.cpp | PHP_FUNCTION(openssl_seal)
{
zval *pubkeys, *pubkey, *sealdata, *ekeys, *iv = NULL;
HashTable *pubkeysht;
EVP_PKEY **pkeys;
zend_resource ** key_resources; /* so we know what to cleanup */
int i, len1, len2, *eksl, nkeys, iv_len;
unsigned char iv_buf[EVP_MAX_IV_LENGTH + 1], *buf = NULL, **eks;
char * data;
size... | TOOL | 0.969117 | 6.22962 |
33479cf5-193f-4e0a-b05a-558c5605d3bf | GENFrameWork/GEN | DataIO/Streams/DIOStreamIPLocalEnumDevices.cpp | /**-------------------------------------------------------------------------------------------------------------------
*
* @file DIOStreamIPLocalEnumDevices.cpp
*
* @class DIOSTREAMIPLOCALENUMDEVICES
* @brief Data Input/Output Stream IP Local Enum Devices class
* @ingroup DATAIO
*
* @copyright GE... | TOOL | 0.874629 | 4.070799 |
78a516af-1841-4068-b0fd-ed1d50405d11 | ankur-maheshwari/cpp | STACK & QUEUE/QUEUE/reverseFIrst-k-of-queue.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
vector<long long> printFirstNegativeInteger(long long int arr[],
long long int n, long long int k);
// Driver program to test above functions
int main() {
long long int t, i;
cin >> t;
while ... | ALGO | 0.999787 | 5.716298 |
c95e1246-91da-4956-b15a-31e41b161e57 | aqzsha/ads | acmp/dp/a1.cpp | #include <bits/stdc++.h>
using ll = long long;
#define go ios_base::sync_with_stdio(0);cin.tie(NULL);cout.tie(NULL);
using namespace std;
int dp[1001];
void solve(){
int n;cin>>n;
dp[1] = 2;
dp[0] = 1;
for(int i = 2;i<=n;i++){
dp[i] = dp[i-1]+i;
}
cout<<dp[n];
}
int main(){
go
... | ALGO | 0.999925 | 4.39824 |
024202b4-6055-4bef-9116-fc34204daea8 | raincross7/code-similarity | codes/train_code/problem320/problem320_111.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,l,r) for(int i=(l);i<(r);i++)
#define pb push_back
#define fi first
#define se second
using ll = long long;
using G = vector<vector<int>>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
const ll MOD = 1000000007;
ll GCD(ll x, ll y){
return y ? GCD(y... | ALGO | 0.999963 | 3.896333 |
1a4dae6a-1d8a-403e-9b52-657dda1ee0bf | minseok128/algorithm_study | cpp/20230504/_18870.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<int> arr;
int ord[1000000], res[1000000];
int main()
{
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(0);
int n;
cin >> n;
arr.resize(n);
for (int i = 0; i < n; i++)
{
cin >> arr[i];
ord[i] = i;
}
sort(ord, ord + n, [](int a, int b)
{ r... | ALGO | 0.999973 | 4.281899 |
02060608-0498-4628-a570-4907a55dc634 | jcwalmsley/FCND-Estimation-CPP-master | src/Math/Random.cpp | #include "../Common.h"
#include "Random.h"
#include <math.h>
// from num recipes in c++ chap7
// a uniform random number generator
double ran1(int &idum)
{
const int IA = 16807, IM = 2147483647, IQ = 127773, IR = 2836, NTAB = 32;
const int NDIV = (1+ (IM-1)/NTAB);
const double EPS = 3.0e-16, AM = 1.0/IM, RNMX = (1... | ALGO | 0.958222 | 3.320771 |
ba5b70f9-3c0f-4602-8147-832dcda55908 | antdkfa/LeetCode-Challenge | 2023/September/22-Is Subsequence.cpp | class Solution {
public:
bool isSubsequence(string s, string t) {
int s1=0, s2=0;
while(s1 < s.length() && s2 < t.length()) {
if(s[s1] == t[s2]) s1++,s2++;
else s2++;
}
return s1 == s.length();
}
};
| ALGO | 0.999927 | 6.319408 |
699c3a6d-7969-444c-9f34-897ac45254dd | denis-gubar/Leetcode | Design/0703. Kth Largest Element in a Stream.cpp | class KthLargest {
public:
KthLargest(int k, vector<int> nums) : k(k) {
if (k - 1 == nums.size())
nums.push_back(numeric_limits<int>::lowest());
sort(nums.begin(), nums.end(), comparator);
heap = vector<int>{ nums.begin(), nums.begin() + k };
make_heap(heap.begin(), heap.end(), comparator);
}
int add(int... | ALGO | 0.999984 | 5.80472 |
c3ba2712-61a5-4f67-a6e4-16c2e93cf774 | ishandutta2007/codeforces | _guoyh_/normal/1148/D.cpp | # include <cstdio>
# include <cstring>
# include <algorithm>
# define ll long long
using namespace std;
const int MAXN = 300051;
struct Node{
int a, b;
} arr[MAXN];
int n, sz1, sz2;
int b1[MAXN], b2[MAXN];
bool cmp1(int x, int y){
return arr[x].a > arr[y].a;
}
bool cmp2(int x, int y){
return arr[x].a < arr[y].a;
}
i... | ALGO | 0.99996 | 3.809846 |
b2041e5e-0183-4ee3-a0f8-8904cafca275 | jeffreyqdd/usaco-train | haybales_silver/haybales.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
using namespace std;
int kHaybales, kQueries;
int BinarySearch(int target, vector<int> const &haybale_list)
{
int low = 0, mid = (haybale_list.size() - 1) / 2 , high = haybale_list.size()-1... | ALGO | 0.999975 | 4.438525 |
10ef37b2-75a7-46ba-a3ec-11e78d0e525d | ishandutta2007/codeforces | dengyaotriangle/normal/1175/E.cpp | #include<bits/stdc++.h>
using namespace std;
const int maxn=200005;
const int maxl=24;
const int maxd=500005;
struct seg{
int l,r;
};
int n,m;
seg s[maxn],q[maxn];
int fa[maxd][maxl];
int pw2[maxl ];
int pfm[maxn];
bool cmp(seg a,seg b){
if(a.l==b.l) return a.r<b.r;
return a.l<b.l;
}
int main(){
pw2[... | ALGO | 0.99995 | 3.78153 |
ffbcbc4b-f4bb-43e0-bc51-89b7a41e858b | shaury-singh/Codeforces | PrefixMinSuffixMaxOptimal.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> transform(vector<int>& nums){
vector<int> result(nums.size(),0);
int minPrefix = nums[0];
int maxSuffix = nums[nums.size()-1];
for (int i=0; i<nums.size()-1; i++){
minPrefix = min(minPrefix,nums[i]);
... | ALGO | 0.999746 | 4.066826 |
dd3c9e20-1a88-4806-83aa-0ace38c30cfa | Apress/learn-cocos2d-game-dev-w-ios-5 | CH13_code/PhysicsBox2D04/libs/Box2d/Collision/b2Collision.cpp | #include <Box2D/Collision/b2Collision.h>
#include <Box2D/Collision/b2Distance.h>
void b2WorldManifold::Initialize(const b2Manifold* manifold,
const b2Transform& xfA, float32 radiusA,
const b2Transform& xfB, float32 radiusB)
{
if (manifold->pointCount == 0)
{
return;
}
switch (manifold->type)
{
... | ALGO | 0.999638 | 7.766701 |
27ff9316-d529-4665-b951-24e25b7bcbcc | ishandutta2007/codeforces | lucina/normal/1705/B.cpp | #include<bits/stdc++.h>
using namespace std;
const int nax = 3e5 + 10;
int n;
int a[nax];
int x;
void solve() {
cin >> n;
int64_t ans = 0;
for (int i = 1 ; i <= n ; ++ i) {
cin >> a[i];
ans += a[i];
}
ans -= a[n];
a[n] = 1;
int st = 1;
while (a[st] == 0) st++;
int he... | ALGO | 0.999893 | 4.846083 |
78d6e653-2b82-46a2-a2fb-fbcbbac3aa38 | Walker0710/CPP | Neetcode 150/2_Add_Two_Numbers.cpp | #include <bits/stdc++.h>
using namespace std;
// << ,
class ListNode
{
public:
int val;
ListNode *next;
// constructor
ListNode(int d)
{
this->val = d;
this->next = NULL;
}
};
void insertAtTail(ListNode* &head, ListNode* &tail, int n) {
ListNode* temp = new ListNode(n)... | ALGO | 0.999938 | 5.806245 |
8a1f2323-50a6-49bd-bc5d-83a89eb435a7 | ishandutta2007/codeforces | hydro-bot1/normal/131/B.cpp | // Hydro submission #6253c25b48f7830132791aed@1649656411171
#include<bits/stdc++.h>
using namespace std;
long long s,a,t[55];
int main()
{
int i,n;
cin>>n;
for(i=1;i<=n;i++)
{
cin>>a;
if(a<0)
t[abs(a)+10]++;
else t[a]++;
}
for(i=1;i<=10;i++)
s+=t[i]*t[i+10];
s+=(t[0]-1)*t[0]/2;
cout<<s;
return 0;
} | ALGO | 0.999581 | 3.921282 |
94493de3-c1cb-4aee-8748-bf56aa691aa2 | riteshbirthal/Coding-Problem-Solutions | LeetCode Solutions/Year-2024/August/8-August/solution.cpp | class Solution {
public:
vector<vector<int>> spiralMatrixIII(int rows, int cols, int rStart, int cStart) {
int dir = 1, itr = 1, siz = 0;
vector<vector<int>> ans;
while(siz<rows*cols){
switch(dir){
case 1:
// code for right direction
... | ALGO | 0.999264 | 5.124901 |
6f8a4143-26c6-4b50-9d86-3699f6f0b51e | Bungmint/competitiveprogramming | contest/codeforces/104146/A.cpp | using namespace std;
#pragma region TEMPLATE
using ll = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using vpi = vector<pii>;
using pll = pair<ll, ll>;
using vl = vector<ll>;
using vpl = vector<pll>;
using ld = long double;
template <typename T, size_t SZ>
using ar = array<T, SZ>;
template <typename... | ALGO | 0.999473 | 3.484805 |
4ddcc397-66ec-439b-9981-603307cc0a8f | utrad-ical/uth_cad_challenge_sample | source/MachineLearning/common/io_matrix.cpp | #define _CRT_SECURE_NO_DEPRECATE
#include <cstdio>
#include <vector>
std::vector<std::string>* separate_std_string(std::vector<std::string>* dest, const std::string &src, const std::string &delim);
float** new_matrix(int n_row, int n_col);
float** read_matrix(char* filename, int* n_row, int* n_col)
{
FILE* fpi = fo... | TOOL | 0.912105 | 3.521492 |
790c7965-73e5-45ad-9284-59b0fbb3b2c5 | ElTantawy/mimd_to_simt | SSDE/LLVM/llvm/lib/CodeGen/EarlyIfConversion.cpp | #include "llvm/ADT/BitVector.h"
#include "llvm/ADT/PostOrderIterator.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SparseSet.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/MachineBranchProbabilityInfo.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/Code... | ALGO | 0.98389 | 8.063379 |
1d70764e-ab14-44f1-b566-b30a756cc797 | Abdo-Tageldin2/Algorithm-and-Data-Structures-Projects | Fake-Coin-Detection/main.cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
// Function to randomly assign weights to coins, with one fake coin
void assignRandomWeights(int coins[], int n) {
int fakeIndex = rand() % n;
int fakeWeight = rand() % 2 == 0 ? 9 : 11; // Either lighter (9) or heavier (11)
for... | ALGO | 0.99091 | 4.24273 |
44cb00e6-4526-4438-81c2-7d613b2a984f | ksgeu0905/Practice_Questions | 623-add-one-row-to-tree/623-add-one-row-to-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.999997 | 6.195467 |
93ee9f17-3aaf-4963-9691-523c9edc3a16 | Hydorn/notes | algorithms/prog-c++/test.cpp | #include <iostream>
using namespace std;
int main (){
int a = 23;
int b = 22;
cout << a + b;
return 0;
} | ALGO | 0.927639 | 3.035518 |
a23aea67-ee72-43c3-963f-fd39d630fad6 | LonglongSang/Life_of_XDU | Data Structure/Experiment 5/AVL.cpp | //2、二叉平衡树
#include <stdio.h>
#include <iostream>
#include <stdlib.h>
#include <time.h>
#include <unordered_set>
#include <vector>
using namespace std;
template <class T>
class AVL{
private:
struct node{
T val;
node* left;
node* right;
int height;
... | ALGO | 0.999791 | 4.966437 |
63eefeed-bbb1-4274-91db-073440b91ba8 | sunforest99/Algorithm | Algorithm/2164.cpp | #include <iostream>
#include <queue>
using namespace std;
int main(void)
{
int n = 0;
queue<int> Queue;
cin >> n;
for (int i = 1; i <= n; i++)
{
Queue.push(i);
}
while (Queue.size() != 1)
{
Queue.pop();
int temp = Queue.front();
Queue.pop();
Queue.push(temp);
}
cout << Queue.front() << endl;
re... | ALGO | 0.999957 | 3.500497 |
597104ae-d749-4d98-8c3c-9eacf0385a68 | danielyc0304/Code | LeetCode/61.rotate-list.cpp | /*
* @lc app=leetcode id=61 lang=cpp
*
* [61] Rotate List
*/
#include <iostream>
using namespace std;
struct ListNode {
int val;
ListNode* next;
ListNode() : val(), next(nullptr) {}
ListNode(int x) : val(x), next(nullptr) {}
ListNode(int x, ListNode* next) : val(x), next(next) {}
};
// @lc co... | ALGO | 0.999943 | 6.33111 |
ac6068b5-2dde-4317-a4e1-46d1e7e2d50b | Sarvesh1990/Coding-Practise | C++-Practise/CompressString.cpp | //Inplace compression of string (abbccda -> a1b2c2d1a1)
//Use recursion, starts from 0, keep increasing count, divides count/10 to decide number of digits after alphabet, then call compress again with starting as new character and act pointer set at alphabet+number of digit, put character at act pointer and use n to pu... | ALGO | 0.999984 | 3.754309 |
0a7d790a-c842-41e6-b99c-b1622ac47e01 | gab-borges/OBI-Training | 2021/F1/tempo.cpp | #include <iostream>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
cin.ignore();
char status[101];
int tempo[101];
fill(status, status+101, 'A');
fill(tempo, tempo+101, 0);
char ant = 'A';
for(int i=0; i<n; i++) {
... | ALGO | 0.998757 | 3.64729 |
f9601538-4360-4b18-a4ea-a026603e7bdf | raincross7/code-similarity | codes/train_code/problem269/problem269_330.cpp | #include <algorithm>
#include <iostream>
#include <stack>
#include <queue>
#include <cmath>
#include <string>
#include <iterator>
#include <map>
#include <set>
#include <iomanip>
#include <vector>
#include <cstdint>
using namespace std;
using ll = long long;
using ld = long double;
using P = pair<ll, ll>;
using Graph =... | ALGO | 0.999913 | 4.549185 |
984b19ef-f3d7-4f86-8cb9-1c939b3b09e3 | coderajdeep/SDE-AZ | 13--graph/18--courseScheduleI--207.cpp | // Course schedule I -- leetcode 207
// Using DFS
// Time complexity O(V + E) where V = numCourses and E = prerequisites.size()
// Space complexity O(V + E) + O(2 * V)
bool dfs(int u, vector<bool> &visited, vector<bool> &path, vector<int> *adj) {
visited[u] = true;
path[u] = true;
for(int v : adj[u]) {
... | ALGO | 0.999907 | 6.746924 |
b1264fd0-52b3-4dcc-9a71-5b95ee04c716 | lesubmarin/Sorting_Algorithms_Visualiser | src/bubble/bubble_sort.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <random>
#include <numeric>
#include <ranges>
#include <SDL2/SDL.h>
#include <chrono>
const int WindowWidth = 1280;
const int WindowHeight = 640;
void draw_state(std::vector<int>& v, SDL_Renderer* renderer, unsigned int red, unsigned int blue, int ba... | ALGO | 0.981158 | 5.556417 |
fd8c8453-b73d-4720-a6cc-f974a1a86fab | aroradev314/competitive_programming | practice/breachoffaith.cpp | #include <bits/stdc++.h>
#define sz(a) ((int)((a).size()))
typedef long long ll;
typedef long double ld;
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> b(2 * n);
for (int i = 0; i < 2 * n; i++) cin >> b[i];
ll mx = 0;
for (int i : b) mx = max(mx, (ll) i);
vector<int> s;
for (... | ALGO | 0.999864 | 3.475734 |
5ff78424-1ef5-436e-913b-622d43a2917f | YuiCtwo/JNeuralTO | JNeRF/python/jnerf/ops/op_include/eigen/doc/examples/TutorialLinAlgExSolveColPivHouseholderQR.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix3f A;
Vector3f b;
A << 1,2,3, 4,5,6, 7,8,10;
b << 3, 3, 4;
cout << "Here is the matrix A:\n" << A << endl;
cout << "Here is the vector b:\n" << b << endl;
Vector3f x = A.colPivHouseholderQr... | ALGO | 0.999858 | 3.366961 |
fb426e3a-350a-4a5d-96aa-ab48852aa06e | GbLeem/codetree-TILs | 241213/사각형 채우기 2/rectangle-fill-2.cpp | #include <iostream>
using namespace std;
int dp[1002];
int n;
int main()
{
cin >> n;
dp[1] = 1;
dp[2] = 3;
dp[3] = 5;
for(int i = 4; i <= n; ++i)
{
dp[i] = (dp[i-1] + dp[i-2]*2) %10'007;
}
cout << dp[n];
return 0;
} | ALGO | 0.999987 | 4.413024 |
cbdcaf30-95f8-466a-8d41-7f7a2ce796e5 | ddt3/MarlinRoel | Marlin/src/feature/meatpack.cpp | /**
* MeatPack G-code Compression
*
* Algorithm & Implementation: Scott Mudge - <EMAIL>
* Date: Dec. 2020
*
* Character Frequencies from ~30 MB of comment-stripped gcode:
* '1' -> 4451136 '4' -> 1353273 '\n' -> 1087683 '-' -> 90242
* '0' -> 4253577 '9' -> 1352147 'G' -> 1075806 'Z' -> 341... | TOOL | 0.943462 | 5.83423 |
443a2d7c-ca27-49dd-b281-e53044a66667 | HossamElDeenKamal2003/codeforces-solutions | CodeForces/C++17 (GCC 7-32)/1283A | Minutes Before the New Year/191023275.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <map>
using namespace std;
/*int solve() {
int n, ans = -1;
cin >> n;
map<int, int>mp;
for (int i = 1; i <= n; i++) {
int x;
cin >> x;
mp[x]++;
if (mp[x] >= 3)
ans = x;
}
return ans;
}*/
int main()
{
/*int t;
cin >> t;
while (t--) {... | ALGO | 0.999424 | 3.770341 |
ee0297e9-67bc-4d94-8a1c-e2887441de26 | Anurag-Singhal1/DSA_lovebabbar | graphs/graph_bridge_tarzan.cpp | #include<bits/stdc++.h>
#include<iostream>
// #include<unordered_map>
// #include<list>
// #include<queue>
// #include<stack>
// #include<vector>
// #include<limits.h> // to include INT_MAX and INT_MIN
// #include<algorithm> // to make use of ... | ALGO | 0.999928 | 5.215959 |
95854602-0948-421d-a89c-fcec1d3d5256 | hyunseok94/Slope_generator | src/Eigen/lapack/svd.cpp | #include "lapack_common.h"
#include <Eigen/SVD>
// computes the singular values/vectors a general M-by-N matrix A using divide-and-conquer
EIGEN_LAPACK_FUNC(gesdd,(char *jobz, int *m, int* n, Scalar* a, int *lda, RealScalar *s, Scalar *u, int *ldu, Scalar *vt, int *ldvt, Scalar* /*work*/, int* lwork,
... | ALGO | 0.999126 | 5.526819 |
4e93861e-931a-4220-984b-241e0d21eac5 | shubh1777/LeetCode-100Days | Rahul/day19.cpp | class Solution {
public:
int heightChecker(vector<int>& heights) {
int count = 0;
vector<int> temp(heights.begin(),heights.end());
sort(temp.begin(),temp.end());
for(int i=0;i<heights.size();i++){
if(heights[i] != temp[i]){
count++;
}
}
... | ALGO | 0.999915 | 5.69056 |
8323a7c9-c31b-422f-b02e-97a822c4621c | mu-subhan/code-repo | 1603-running-sum-of-1d-array/running-sum-of-1d-array.cpp | class Solution {
public:
vector<int> runningSum(vector<int>& nums) {
int sum =0;
for(int i=0;i<nums.size();i++){
sum =sum + nums[i];
nums[i]=sum;
}
return nums;
}
}; | ALGO | 0.999793 | 5.537981 |
7f082b37-da74-426c-a54a-87d3a1245131 | KQYaili/test1 | contact/contact/test.cpp | #define _CRT_SECURE_NO_WARNINGS
#include"contact.h"
void menu() {
printf("************************************************************************\n");
printf("************************ 1.add 2.del ***************************\n");
printf("************************ 3.search 2.modify ************************... | TOOL | 0.995718 | 3.246729 |
38f3a02c-c4c5-442f-a03c-52caa1657122 | hsqthu2012/Foot_Placement_Safe_Control | hpp-fcl/src/distance/convex_halfspace.cpp | /** \author Joseph Mirabel */
#include <hpp/fcl/shape/geometric_shapes.h>
#include "../distance_func_matrix.h"
#include "../narrowphase/details.h"
namespace hpp {
namespace fcl {
template <>
FCL_REAL ShapeShapeDistance <ConvexBase, Halfspace>
(const CollisionGeometry* o1, const Transform3f& tf1,
const CollisionGeo... | ALGO | 0.999472 | 7.151376 |
5c6c7e62-6a42-42f3-b2a6-9f2dec0d7a62 | TaszidIzaz/Problem_Solving | Solutions/intToRom.cpp | class Solution {
public:
const int val[13] = {1000,900,500,400,100,90,50,40,10,9,5,4,1};
const string rom[13] = {"M","CM","D","CD","C","XC","L","XL","X","IX","V","IV","I"};
string intToRoman(int N) {
string ans = "";
for (int i = 0; N; i++)
while (N >= val[i]) ans += rom[i], N -... | ALGO | 0.999403 | 6.365565 |
14bad231-c4b0-4180-b789-43266f787cf6 | pieceofpi365/martkist | src/key.cpp | #include "key.h"
#include "arith_uint256.h"
#include "crypto/common.h"
#include "crypto/hmac_sha512.h"
#include "pubkey.h"
#include "random.h"
#include <secp256k1.h>
#include <secp256k1_recovery.h>
static secp256k1_context* secp256k1_context_sign = NULL;
/** These functions are taken from the libsecp256k1 distribut... | TOOL | 0.883294 | 6.477404 |
969ec154-ef68-446c-abd7-43670878df99 | AnanyaSinha2717/CPP-Projects | Patterns/6.cpp | // asterik equilateral triangle
// *
// * *
// * * * (n = 3)
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n;
int i = 1;
cout << "Enter a number: ";
cin >> n;
cout << endl;
while (i <= n)
{
int j = 1;
while (j <= i)
{
cou... | ALGO | 0.999852 | 4.668638 |
32ae9eda-30d4-4d22-9612-94b19296a972 | i-am-chitti/Coding-Hour | CPP Practice/Arrays/right_rotation.cpp | #include<bits/stdc++.h>
using namespace std;
int findGcd(int a, int b) {
if(b == 0) return a;
else return findGcd(b, a%b);
}
//Method 1
void rightRotate1(vector<int> arr, int k) {
int n = arr.size();
if(k>n) k=k%n;
int gcd = findGcd(n, k);
int temp, j, d;
for(int i=n-1; n-i-1<gcd; i--) {... | ALGO | 0.999967 | 4.543834 |
7a0bbd03-9b4e-409e-9fc3-3e6ff185d83e | Tongyuang/EdgeTile | EdgeTileClient/deps/opencv/3rdparty/carotene/src/add_weighted.cpp | #include "common.hpp"
#include "vtransform.hpp"
namespace CAROTENE_NS {
#ifdef CAROTENE_NEON
namespace {
using namespace internal;
template <typename T> struct TypeTraits;
template <> struct TypeTraits< u8> { typedef u16 wide; typedef u8 unsign; typedef uint8x16_t vec128; };
template <> struc... | TOOL | 0.985542 | 6.623674 |
fb82d71a-16b0-4635-bd92-aebece9d6e24 | ritikmittal/NoteBook2 | DP & Convolutions/FFT.cpp | typedef complex<double> C;
typedef vector<double> vd;
void fft(vector<C>& a) {
int n = sz(a), L = 31 - __builtin_clz(n);
static vector<complex<long double>> R(2, 1);
static vector<C> rt(2, 1); // (^ 10% faster if double)
for (static int k = 2; k < n; k *= 2) {
R.resize(n); rt.resize(n);
... | ALGO | 0.99996 | 3.856318 |
61f86e1f-bc7f-4a9b-987e-6d5c3e3e7157 | CodecupHSGS/codecuphsgs | backend/uploads/mock.cpp | #include <iostream>
#include <fstream>
#include <unordered_map>
#include <map>
#include <utility>
#include <tuple>
using namespace std;
map<pair<int, int>, int> board;
int n = 6, m = 7;
void print_board() {
for (int x = 1; x <= n; ++x) {
for (int y = 1; y <= m; ++y) {
cerr << board[{x, y}] <<... | ALGO | 0.999748 | 4.240869 |
0de1702f-aa60-4e84-982a-19269a8ed4ea | junhochoi-dev/algorithm | [PS]BOJ/00000_09999/01000_01999/01100/boj01100.cpp | #include <iostream>
using namespace std;
int main() {
char chess_table[8][8];
int count = 0;
for (int n = 0; n < 8; n++) {
for (int m = 0; m < 8; m++) {
cin >> chess_table[n][m];
}
cin.clear();
}
for (int n = 0; n < 8; n++) {
for (int m = 0; m < 8; m++) {
if ((m + n) % 2 == 0 && chess_table[n][m] == ... | ALGO | 0.999212 | 4.29785 |
5d0b81b6-3ece-49e8-8bb1-1c7ef4c83574 | jarintasnim2n1/Jarin | Day6/max_sum_subarray_of_sizeK.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
long maximumSumSubarray(int K, vector<int> &Arr , int N){
// code here
int l=0,r=0;
long long ans=0,sum=0;
while(r<N){
sum+=Arr[r];
if(r-l+... | ALGO | 0.999964 | 6.254384 |
68a33d73-142d-4b2d-8caf-07daa673c3b7 | MrCode4/Encrypt_Decrypt_LIB | Encryptor.cpp | #include "Encryptor.h"
#include <fstream>
#include <sstream>
#include <vector>
#include <string>
#include <filesystem>
#include <chrono>
#include <iostream>
#include <cstdlib> // For std::system and std::remove
// For AES default transform.
#include <openssl/evp.h>
#include <openssl/aes.h>
#include <cstring>
namesp... | TOOL | 0.988001 | 7.078648 |
c460b947-8308-4b27-aba4-79752b817076 | ishandutta2007/codeforces | nehnait/normal/1280/C.cpp | //Author:xht37
#include <bits/stdc++.h>
#define ui unsigned int
#define ll long long
#define ul unsigned ll
#define ld long double
#define pi pair< int, int >
#define fi first
#define se second
#define mp make_pair
#define ls (p << 1)
#define rs (ls | 1)
#define md ((t[p].l + t[p].r) >> 1)
#define pq priority_queue... | ALGO | 0.99947 | 3.952783 |
b560d933-fa4d-4e37-b81b-5d889550d104 | yuzu00117/Box2D_Test | main.cpp | #include"include/box2d/box2d.h"
#include <iostream>
#
int main() {
// Worldの重力を設定(下方向に9.8m/s^2)
b2Vec2 gravity(0.0f, -9.8f);
b2World world(gravity);
// 地面(静的なオブジェクト)を作成
b2BodyDef groundBodyDef;
groundBodyDef.position.Set(0.0f, -10.0f);
b2Body* groundBody = world.CreateBody(&groundBodyDef)... | ALGO | 0.938588 | 4.638735 |
90527ca6-6a55-45d0-bf63-6a6c7260f50e | 183aryan/LeetCode-Solutions | 0894-all-possible-full-binary-trees/0894-all-possible-full-binary-trees.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.999867 | 6.172909 |
1b593184-2977-4d40-bbdb-f00b90a41b13 | aniketbiswas21/Codeforces | team.cpp | #include <iostream>
using namespace std;
//Compiler version g++ 6.3.0
int main()
{
int t;
cin>>t;
int no=0;
while(t--){
int a[10];
int count=0;
for(int i=0;i<3;i++){
cin>>a[i];
if(a[i]==1){
count++;
}
}
if(count>=2){... | ALGO | 0.999295 | 3.822166 |
8878bcef-2888-4072-8890-e6472fae53ea | rankss/UVa | 113.cpp | #include <cstdio>
#include <cmath>
int main()
{
double n, p, a;
while (scanf("%lf\n%lf", &n, &p) != EOF)
{
a = (double)pow(M_E, log(p)/n);
printf("%.0lf\n", a);
}
return 0;
}
// Solver: RankSS
| ALGO | 0.999811 | 3.758355 |
816b0b96-cb1c-43a6-8ac9-1ac52428af93 | BhaskarMalik/learning-coding | mountain peak.cpp | #include <iostream>
#include<vector>
#include<algorithm>
using namespace std;
int mountainPeak(int arr[], int s){
int st=1;
int end=s-2;
while(st<=end){
//int mid=(st+end)/2;//may cause overflow instead using
int mid = st+( (end-st)/2);
if(arr[mid-1]<arr[mid] && arr[mid]>arr[m... | ALGO | 0.99983 | 4.758781 |
46c754cb-5e84-44a4-8de9-e2f8be3a23d6 | SLMT/course-parallel-programming | src/pp/hw3/main_mpi.cpp | // This line must be the front of all other includes
#include <mpi.h>
#include <cstdio>
#include <unistd.h>
#include <omp.h>
#include "mandelbort_set.hpp"
#include "ms_mpi.hpp"
#include "../timer.hpp"
namespace pp {
namespace hw3 {
void MSMain(int num_threads, int num_x_points, int num_y_points, double real_min, do... | ALGO | 0.995411 | 5.820575 |
85a4f8c6-8d56-44c2-8f20-73030b5daed0 | koba-e964/contest | universal-cup/1-4-ukraine/d.cpp | #include <iomanip>
#include <iostream>
#include <string>
#include <vector>
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
using namespace std;
typedef long long int ll;
typedef vector<int> VI;
typedef vector<ll> VL;
typedef pair<int, int> PI;
int main(void) {
ios::sync_with_stdio(false);
cin.tie(0);
int... | ALGO | 0.999573 | 4.069653 |
571f08c5-4d76-400f-b542-b31454251dd6 | shreejitverma/SDE-Interview-Prep | LeetCode/C++/minimum-time-difference.cpp | // Time: O(nlogn)
// Space: O(n)
class Solution {
public:
int findMinDifference(vector<string>& timePoints) {
static const int N = 60 * 24;
vector<int> minutes;
for (const auto& t : timePoints) {
minutes.emplace_back(stoi(t.substr(0, 2)) * 60 + stoi(t.substr(3)));
}
... | ALGO | 0.999689 | 6.398295 |
fbce980f-25ee-45c1-9d2c-ee4899678cc6 | zkFHE/zkOpenFHE | src/binfhe/lib/rgsw-acc.cpp | /*
FHEW scheme (RingGSW accumulator) implementation
The scheme is described in https://eprint.iacr.org/2014/816 and in Daniele Micciancio and Yuriy Polyakov
"Bootstrapping in FHEW-like Cryptosystems", Cryptology ePrint Archive, Report 2020/086,
https://eprint.iacr.org/2020/086.
Full reference to https://epri... | ALGO | 0.998668 | 7.483988 |
82ef3949-c17e-4ef9-b2dd-454f5f8928be | vfolunin/archives-solutions | UVa Online Judge/12826.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
bool between(int a, int b, int c) {
return a <= b && b <= c || a >= b && b >= c;
}
bool solve(int test) {
int y1, x1, y2, x2, y3, x3;
if (!(cin >> y1 >> x1 >> y2 >> x2 >> y3 >> x... | ALGO | 0.999797 | 4.200765 |
24420946-1945-4876-bad2-2e76f16bd578 | sane-aalam/DSA-Sheet-for-Coding-Interviews | 4 Months/23.Binary Search/Number of occurrence.cpp |
#include <bits/stdc++.h>
using namespace std;
class Solution {
int FindfirstPosition(vector<int> & nums,int target){
int start = 0;
int end = nums.size() - 1;
int mid = start + (end-start)/2;
int findFirstIndex = -1;
while(start <= end){
if(nums[mid] == target){
... | ALGO | 0.999973 | 6.051997 |
402afcf9-8c77-4ba9-ab03-4d574838de92 | TotoroCodingDojo/leetcode-cpp | 1641/sol0.cpp | class Solution {
public:
unordered_map<int, unordered_map<char, int>> m;
int count(int n, char last_char){
if(n==1){
switch(last_char){
case 'a': return 5;
case 'e': return 4;
case 'i': return 3;
case 'o': retu... | ALGO | 0.999794 | 6.521187 |
da9a94e4-dcd9-4994-aa6e-b0ae410d9c55 | GremekaFox/skilcheck-cpp | tasks/acmp_282.cpp | #include <iostream>
#include <vector>
#include <fstream>
using namespace std;
int main(){
long long w;
long long h;
ifstream cin ("input.txt");
ofstream cout("output.txt");
cin >> w;
cin >> h;
long long res;
long long w_1;
long long h_1;
for (int i = 1; i <= w; i++) {
... | ALGO | 0.994112 | 3.950699 |
ca7f9cd0-123f-4c44-a711-f8335ce8060f | ishandutta2007/codeforces | duality/normal/1305/E.cpp | #define DEBUG 1
#include <bits/stdc++.h>
using namespace std;
#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printA... | ALGO | 0.999982 | 3.252731 |
fa6d93e1-8a91-40ae-a7d2-fc9df6862612 | brimmann/enhanced-bank-account-management-system-cpp | Bank Account/implementation.cpp | #include "bank_account.h"
///////////////////////
BankAccount::BankAccount(string n , unsigned long aN , string aT, double b)
{
name = n;
accountNumber = aN;
accountType = aT;
balance = b;
}
/////////////////
void BankAccount::Deposit(double amount)
{
balance += amount;
cout << "$" << amount << " deposited!\n"... | TOOL | 0.864884 | 4.080858 |
bd05e95f-e240-4c3c-bba5-40af97fab90e | XtremeXSPC/CP-Problems | CodeForces/Rounds/Round_1046_Div_2/problem_E.cpp | //===----------------------------------------------------------------------===//
/**
* @file: problem_E.cpp
* @brief Codeforces Round 1046 (Div. 2) - Problem E
* @author: Costantino Lombardi
*
* @status: PASSED
*/
//===----------------------------------------------------------------------===//
/* Included library... | ALGO | 0.999675 | 5.505922 |
553a9624-0e4d-471e-b667-0cfe28e573a9 | Abhinav7076/My-Codes | Bit Manipulation/Count number of bits to be flipped to convert A to B.cpp | class Solution{
public:
// Function to find number of bits needed to be flipped to convert A to B
int countBitsFlip(int a, int b){
// Your logic here
return __builtin_popcount(a xor b);
}
}; | ALGO | 0.99986 | 5.699673 |
2dea491b-5d87-4d08-8ba6-3d3746b0b797 | SonuRajput1010/LeetCode | 1356-sort-integers-by-the-number-of-1-bits/1356-sort-integers-by-the-number-of-1-bits.cpp | class Solution {
public:
static int numberof1s(int a){
int count = 0;
while(a){
a = a&(a-1);
count++;
}
return count;
}
static bool comp(int a, int b){
int p = numberof1s(a);
int q = numberof1s(b);
if(p==q){
return (... | ALGO | 0.999994 | 5.684185 |
ac2b2c37-7f96-4ef8-903c-2064ea4a631d | ishandutta2007/codeforces | mr.robot_28/normal/420/E.cpp | #include<bits/stdc++.h>
using namespace std;
#define double long double
const double pi = acos(-1);
pair <double, double> intersect(double x, double y, double r, double x1, double y1, double r1)
{
double dist = sqrt(x * x + y * y);
double fi = acos((r1 * r1 + dist * dist - r * r) / (2 * r1 * dist));
double A1, B1,... | ALGO | 0.999682 | 3.820754 |
634a846c-807e-46ba-be6a-a355f56338f6 | 7wataaa/atcoder | abc275/c/abc276/c/main.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int ans = min({(a + b + c) - a, (a + b + c) - b, (a + b + c) - c});
cout << ans << endl;
}
| ALGO | 0.999943 | 4.144089 |
ea1920da-e8a6-42d8-ab4f-dbf26e93ded8 | KashvirSewpersad/C-Fundamentals | 34.FunctionEvenNumbers.cpp | #include <iostream>
using namespace std;
bool isEven(int a) // Function Decleration. Good notation says that boolean functions must start with "is" prefex.
{
if(a%2==0)
{
return true;
}
else
{
return false;
}
}
int main()
{
int input;
bool result;
while (true)
... | ALGO | 0.942054 | 4.052781 |
50597995-1117-4062-a1aa-2b3900ce8874 | LuckyN510/CODE_PTIT | DSA/Do thi/DSA09007_DUONG DI THEO BFS TREN DO THI VO HUONG.cpp | #include<bits/stdc++.h>
using namespace std;
int n, m, s, t;
vector<int> adj[10005];
int parent[10005];
bool visited[10005];
void nhap(){
cin >> n >> m >> s >> t;
for(int i = 1; i <= n; i++){
adj[i].clear();
visited[i] = false;
parent[i] = -1;
}
for(int i = 0; i < m; i++){
... | ALGO | 0.999903 | 4.452668 |
24ee46b2-3249-4b91-87ca-16bb780f380c | texasflood/misc | professionalCpp/bookCode/thirdEdition/chapter11/c11_code/10_FunctionTemplate/03_FindTemplateOverload.cpp | #include <cstddef>
#include <iostream>
#include <cstring>
using namespace std;
static const size_t NOT_FOUND = (size_t)(-1);
template <typename T>
size_t Find(T& value, T* arr, size_t size)
{
cout << "original" << endl;
for (size_t i = 0; i < size; i++) {
if (arr[i] == value) {
return i; // found it; return t... | TOOL | 0.998676 | 5.205303 |
2dfd5677-7783-47c1-af60-0de60d18bb8d | fate7902/study | Programmers/Lv.1/부족한 금액 계산하기.cpp | using namespace std;
long long solution(int price, int money, int count) {
long long total = price * (((long long)count + 1) * count / 2);
long long answer = total - money <= 0 ? 0 : total - money;
return answer;
} | ALGO | 0.99962 | 4.255358 |
f2bd1e39-0223-49eb-b2fb-72b5f1465564 | skgshivam/Coding_Practice | Arrays/smallest_positive_missig_number.cpp | #include<bits/stdc++.h>
#include<iostream>
using namespace std;
int missingNumber(int arr[], int n) {
// Your code here
int small = 1;
int index = 0;
for(int i=0;i<n;i++){
if(arr[i]>0){
arr[index]=arr[i];
index++;
}
}
cout<<index<<endl;
for(int ... | ALGO | 0.999946 | 3.283094 |
f789dadb-af23-411b-ac3f-7d0468add28c | ValentinaAngulo77/PRACTICA_02 | EJERCICIO_02_08.cpp | // Materia: Programacin I, Paralelo 4
// Autor: Valentina Jazmin Angulo Burgoa
// Fecha creacin: 28/08/2023
// Fecha modificacin: 28/08/2023
// Nmero de ejericio: 8
// Problema planteado: Se tiene el arreglo
// Ventas:
// 0:vene, 1:vfeb, 2:vmar, 10:vnov, 11:vdic
// Donde se almacenan las ventas mensuales de una em... | ALGO | 0.999033 | 6.120838 |
3eabc919-9341-47d0-81b4-6eefd7519200 | yudongyeop/programming | 백준/DFS와 BFS/토마토2.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <utility>
//BFS solution
using namespace std;
typedef pair<int, int> p;
int N,M,H;
int box[10010][102];
bool visit[10010][102];
int day = -1;
int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};
int ud[] = {M,-M};
void bfs(vector<p> have) {
queue<p> q;
for ... | ALGO | 0.999926 | 3.65843 |
e1449572-ca5b-478f-bf83-f452aaaacacb | Nivedagaspar/Programs-on-Design-and-analysis-of-Algorithms | dia progs/kmp.cpp | #include<iostream>
#include<cstring>
using namespace std;
void computelps(char patt[],int m,int *lps);
void kmp(char text[],char patt[])
{
int n=strlen(text);
int m=strlen(patt);
int lps[m];//longest prefix suffix
computelps(patt,m,lps);
cout<<"LPS: ";
for (int i=0;i<m;i++)
{
cout<<lps[i]<<" ";
}
int i=0;
i... | ALGO | 0.999976 | 4.59515 |
54e5ddb7-07e9-4322-950d-540eea6fc24a | sanchayitapurkayastha/6Companies30Days | Milestone 2/12-ColmNamefromGivenColmNo.cpp | //Column name from given column number
class Solution{
public:
string colName (long long int n)
{
string temp = " ";
while (n) {
n --;
char c = 'A' + (n % 26);
temp += c;
n /= 26;
}
reverse (temp.begin(), temp.end());
... | ALGO | 0.998306 | 5.214722 |
e68dcb74-4516-49ee-b5c2-4bc9d26c8787 | BoredAmi/Szkudlarek_Filip_Smigiel_Patrycja | src/world.cpp | #include "world.h"
#include "gathering.h"
#include <random>
std::vector<std::vector<tiles>> generateWorld(int width, int height, SimplexNoise& noise) {
std::vector<std::vector<tiles>> world(width, std::vector<tiles>(height, tiles(tile_types::land)));
std::random_device rd;
std::mt19937 gen(rd());
std::... | TOOL | 0.855518 | 5.480489 |
36b68429-d7aa-4ea8-a5d2-1d9581cfd14c | CodeCrackerSND/BarsWF_v2 | perm.cpp | #include <string.h>
#include "perm.h"
#include <assert.h>
#include <iostream>
#include "global.h"
#include "algo/algo.h"
#include <math.h>
using namespace std;
unsigned char perm::charset[256];
unsigned char perm::SpecialChars[256];
int perm::charset_len;
bool perm::end_of_calc = false;
my_data perm::data;
int perm::... | ALGO | 0.990165 | 3.496762 |
9a85e295-105e-49b8-8676-d499e425abab | Smeany/leetcode | 238. Product of Array Except Self/solution.cpp | class Solution {
public:
vector<int> productExceptSelf(vector<int>& nums) {
vector<int> ret(nums.size());
ret[0] = 1;
for(int i = 1; i < nums.size(); i++){
ret[i] = ret[i-1] * nums[i - 1];
}
int n = 1;
for(int i = nums.size() - 2; i >= 0; i--) {
... | ALGO | 0.999991 | 6.413905 |
69cd6084-ed11-4797-8075-1b1258fb2b68 | sjhan1120/C_CPP_Learning | C++basedOOP/5_4_callByValueReturn.cpp | #include <iostream>
using namespace std;
int sum(int nX, int nY)
{
int nZ = nX + nY;
return nZ;
}
int main()
{
int j = 10, k = 20, nSum;
printf("초기 값 : j = %d, k = %d\n", j, k);
//10, 20을 복사해주고 되돌아온 결과는 nSum에 저장한다.
nSum=sum(j, k);
printf("반환된 값 : %d\n", nSum);
return 0;
} | ALGO | 0.971606 | 4.379795 |
9eba1493-e743-4f28-9488-ff1dbdb5407d | aniketbidgar3/Cpp | Binary_Search.cpp | #include <iostream>
using namespace std;
void binarySearch()
{
int n;
cout << "Enter Size : ";
cin >> n;
int arr[n];
cout << "Enter ELements of Array : ";
for (int i = 0; i < n; i++)
{
cin >> arr[i];
}
int key;
cout << "Search Element : ";
cin >> key;
int st =... | ALGO | 0.999042 | 4.920173 |
156ebb7b-720d-4060-acef-fca297bf63fb | Prateekkumar24/CipherSchools_CP | Sheet_02_code/MergeTwoSortedArrays.cpp | #include<bits/stdc++.h>
using namespace std;
// Function to merge arrays
void mergeSortedArrays(int arr1[], int arr2[], int size1, int size2)
{
// map store key value pair in sorted order according to key
//it uses red black tree internally
map<int, bool> mp;
// Insert value to map
... | ALGO | 0.999983 | 4.323341 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.