uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
97deaad5-b65d-44a7-8602-9d82224e507e | uvvo/C-PLUS-PLUS-ACTIVITIES | find the largest and smallest element of an array..cpp | //Write a C++ program to find the largest and smallest element of an array.
#include<iostream>
using namespace std;
int main ()
{
int arr[10], n, i, max, min; //declare variable
cout << "Enter the size of the array : "; //aks to user Enter the size of the array
cin >> n;
cout << "Enter the elements of t... | ALGO | 0.999786 | 3.777551 |
1f91eebc-a09d-4e9b-b238-d26e7ab2b5d4 | ishandutta2007/codeforces | emiso/normal/980/D.cpp | #include <bits/stdc++.h>
#define MN 10010
#pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
using namespace std;
vector<bool> isp(MN, 1);
vector<int> primos;
void crivo() {
for(int i = 2; i < MN; i++) {
if(isp[i]) {
primos.push_back(i);
for(int j = 2 * i; j < MN; j += i)
... | ALGO | 0.999975 | 3.526175 |
e37e47cd-d4f3-4c2a-925a-c4ae921b0df0 | prathameshhire/LeetCode | 1991-find-the-middle-index-in-array/1991-find-the-middle-index-in-array.cpp | class Solution {
public:
int findMiddleIndex(vector<int>& nums) {
int rsum =0;
for(int i= 0; i < nums.size(); i++){
rsum += nums[i];
}
int lsum =0;
for(int i= 0; i < nums.size(); i++){
rsum = rsum - nums[i];
if(lsum == rsum)
... | ALGO | 0.999973 | 6.069108 |
b5c6e30d-4080-4bbb-949e-c20191aa0c1e | CSReading/comp_arch | chapter03/3_11.cpp | #include <iostream>
#include <ctype.h>
using namespace std;
int main() {
int N;
cin >> N;
byte byteArray[N];
for (int i = 0; i < N; i++){
int x;
cin >> x;
byteArray[i] = (byte)x;
}
for (int i = 0; i < N; i++) {
printf("%02x", byteArray[i]);
if (i % 4 ==... | ALGO | 0.888488 | 3.814743 |
6a23b373-76bf-49e6-8b37-6a033b13f815 | cozy-hn/flutter_clone_coding | furniture_app_ui/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.99872 | 6.76073 |
43d1b0df-1e10-41a1-a79d-9db9710bff9c | takkrish/datastructures-and-algorithms-cpp | String Easy/Length of Last Word.cpp | // Given a string s consisting of words and spaces, return the length of the last word in the string.
// A word is a maximal
// substring
// consisting of non-space characters only.
// Example 1:
// Input: s = "Hello World"
// Output: 5
// Explanation: The last word is "World" with length 5.
// Example 2:
// Inpu... | ALGO | 0.998867 | 6.033743 |
ccd5ea71-5a4d-4084-83ad-fe8f0c6402a5 | A-lex-Ra/pinktrombone-cpp | pinktrombone.cpp | #include <iostream>
#include <numbers>
#include <thread>
#include <vector>
#include <random>
#include <chrono>
#include "AL/al.h"
#include "AL/alc.h"
#include "simplex_noise.h"
class Glottis {
public:
Glottis(int sample_rate)
: sample_rate(sample_rate), time(0.0), phase(0.0), frequency(140.0), smooth_frequ... | TOOL | 0.988942 | 6.974288 |
456b23f9-ce9c-494e-a3cb-954f1debe9ba | NavonilDas/Algos | Hackerearth/Algorithm/IntelligentGirl.cpp | // Har Har Mahadev
// By Navonil Das
#include <bits/stdc++.h>
#define FASTIO \
ios::sync_with_stdio(false); \
cin.tie(0); \
cout.tie(0)
#define endl '\n'
#define ll long long
#define ull long long
#define vi vector<int>
// change ull to ll for negative
// ull gcd(ull a,ull... | ALGO | 0.999987 | 3.306031 |
70d49ef4-418a-4d76-9aec-1427eec541d3 | akshaykoni174285/Data-Structures-and-Algorithms- | LeetCode/1.Arrays/moore's_votingalog.cpp | #include <iostream>
#include <vector>
using namespace std;
int main(int argc, char const *argv[])
{
vector<int> nums = {1,1,2,2,2,1,1};
int count = 0;
int element;
for(int i = 0; i < nums.size();i++){
if(count == 0){
count = 1;
element = nums[i];
}
else if (element == nums[... | ALGO | 0.999821 | 3.967951 |
9a59ba53-54ab-44bd-902a-58f2910b70b7 | firewood/topcoder | atcoder/abc_293/e.cpp | #include <algorithm>
#include <cctype>
#include <cmath>
#include <cstring>
#include <iostream>
#include <sstream>
#include <numeric>
#include <map>
#include <set>
#include <queue>
#include <vector>
using namespace std;
int64_t solve(int64_t A, int64_t X, int64_t M) {
if (M <= 1) {
return 0;
}
int64_t ans = 0, lo... | ALGO | 0.999988 | 4.279782 |
f2d23d8d-cd3d-42c5-80cf-798087b6a8bf | AnujWebDev/Learning-DSA | Recursion/MergeSortForDescendingOrder.cpp | #include <iostream>
#include <vector>
using namespace std;
void Merge(int arr[],int start,int end,int mid){
vector<int>temp(end-start+1);
int left = start, right = mid+1,index =0;
while(left <= mid && right <= end){
if(arr[left] >= arr[right]){
temp[index] = arr[left];
index... | ALGO | 0.999984 | 4.819899 |
d34ac469-bcfe-476d-8e5e-a01244eb8950 | xuzhezhaozhao/fastText_dnn | deps/lshbox/include/eigen/doc/tutorial.cpp | #include <Eigen/Array>
int main(int argc, char *argv[])
{
std::cout.precision(2);
// demo static functions
Eigen::Matrix3f m3 = Eigen::Matrix3f::Random();
Eigen::Matrix4f m4 = Eigen::Matrix4f::Identity();
std::cout << "*** Step 1 ***\nm3:\n" << m3 << "\nm4:\n" << m4 << std::endl;
// demo non-static set.... | TOOL | 0.885203 | 4.17468 |
efa247f3-6bc9-44e9-8ea0-7ea8d66357b7 | DelaraJ/Codes_Coursera | Data Structures/2_hash_chains/hash_chains.cpp | #include <bits/stdc++.h>
using namespace std;
struct Query {
string type, s;
size_t ind;
};
class QueryProcessor {
int bucket_count;
// store all strings in one vector
map<int, list<string>> elems;
size_t hash_func(const string& s) const {
static const size_t multiplier = 263;
... | ALGO | 0.992774 | 5.171021 |
fc5ef0cf-f737-44d9-99da-880f0544de11 | ishandutta2007/codeforces | marcina007/normal/258/B.cpp | #include<algorithm>
#include<cassert>
#include<complex>
#include<map>
#include<iomanip>
#include<sstream>
#include<queue>
#include<set>
#include<string>
#include<vector>
#include<iostream>
#include<cstring>
#define FOR(i, a, b) for(int i =(a); i <=(b); ++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)
#define ... | ALGO | 0.999884 | 4.01276 |
b47fc600-430a-48d7-83e9-aabefb1d00b7 | raincross7/code-similarity | codes/train_code/problem331/problem331_96.cpp | #include <bits/stdc++.h>
using namespace std;
#define _GLIBCXX_DEBUG
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define ll long long
#define P pair<ll,ll>
#define all(v) (v).begin(),(v).end()
const ll mod = 1e9+7;
const ll INF = 1e18;
const double pi = acos(-1.0);
int main(void)
{
ll n,m,x; cin>>n>>m>>x;
v... | ALGO | 0.999963 | 4.128829 |
a95eab9b-44be-48a0-b6a3-2d7de71cdccb | halfopen/.leetcode | 92.反转链表-ii.cpp | /*
* @lc app=leetcode.cn id=92 lang=cpp
*
* [92] 反转链表 II
*/
// @lc code=start
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution
{
public:
ListNode *reverseBetween(ListNode *head, int m, i... | ALGO | 0.999924 | 6.462179 |
1a9492cb-1b8d-447f-b308-1addcd8b6c94 | adamrehn/encrypted-file-container | source/compression/ZlibCompression.cpp | #include "ZlibCompression.h"
string ZlibCompression::TransformInput(char* input, size_t length, bool isFinalInput)
{
//Accept the input
strm.next_in = (Bytef*)input;
strm.avail_in = length;
//Use no flush mode, until we reach the last of the input
int flush = (isFinalInput) ? Z_FINISH : Z_NO_FLUSH;
//Create... | TOOL | 0.899778 | 5.402935 |
f50f9ddc-bed2-464f-ab76-5d08324665fd | yashpatel137/Interview_Prep | Searching & Sorting/Bishu_and_soldiers.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int size;
cin>>size;
int arr[size];
vector<pair<int,int>> ans;
for(int i=0;i<size;i++)
{
int x;
cin>>x;
arr[i]=x;
}
int rnd;
cin>>rnd;
for(int i=0;i<rnd;i++)
{
int pwr;
cin>>pwr... | ALGO | 0.999462 | 3.458369 |
ccd80c04-1169-48ce-b6af-63544fb99ec9 | mariah-zm/fyp-artefact-and-results | case-study/fuzzylite/src/norm/s/EinsteinSum.cpp | #include "fl/norm/s/EinsteinSum.h"
namespace fl {
std::string EinsteinSum::className() const {
return "EinsteinSum";
}
Complexity EinsteinSum::complexity() const {
return Complexity().arithmetic(4);
}
scalar EinsteinSum::compute(scalar a, scalar b) const {
return (a + b) ... | TOOL | 0.914291 | 5.886467 |
e128e282-bfaf-4137-8ce2-14e947199c0d | harshleet/leetsolution | 53-maximum-subarray/maximum-subarray.cpp | class Solution {
public:
int maxSubArray(vector<int>& nums) {
int st=0 ,en=0,maxi=INT_MIN,sum=0,n=nums.size();
for(int i=0;i<n;i++){
sum+=nums[i];
if(sum>=maxi){
maxi=sum;
en=i;
}
if(sum<0){
st=i+1;
... | ALGO | 0.99997 | 5.262776 |
52ceec11-030c-433f-85e1-b381f9c58f96 | reo91004/ds-notes | 2. Queue/#02-2 원형 큐.cpp | #include <iostream>
using namespace std;
#define MAX 5
typedef int element;
typedef struct {
int front;
int rear;
element data[MAX];
} QueueType;
void error(char *message) {
fprintf(stderr, "%s\n", message);
exit(1);
}
void init_queue(QueueType *q) {
q->front = q->rear = 0;
}
// 나머지 연산 이용해... | ALGO | 0.961211 | 4.918747 |
9bbdb147-f5d9-4ffa-bf81-01e0abb40846 | nb10008/smzc | F3DMaxExp/Quadric.cpp | //----------------------------------------------------------------------------//
// Includes //
//----------------------------------------------------------------------------//
#include "StdAfx.h"
#include <math.h>
#include "Quadric.h"
//--------------... | TOOL | 0.925129 | 5.828124 |
90b3b768-946e-4710-aed2-efd4a82b8b47 | sarvex/leetcode-checked-c | solution/1600-1699/1656.Design an Ordered Stream/Solution.cpp | class OrderedStream {
public:
vector<string> data;
int ptr = 0;
OrderedStream(int n) {
data.resize(n, "");
}
vector<string> insert(int idKey, string value) {
data[idKey - 1] = value;
vector<string> ans;
while (ptr < data.size() && data[ptr] != "") ans.push_back(data... | ALGO | 0.996942 | 6.109315 |
6ab95546-33d4-4f39-8718-5b97dab0af17 | dunan/MultiVariatePointProcess | 3rd-party/igl/snap_to_fixed_up.cpp | template <typename Qtype>
IGL_INLINE void igl::snap_to_fixed_up(
const Eigen::Quaternion<Qtype> & q,
Eigen::Quaternion<Qtype> & s)
{
using namespace Eigen;
typedef Eigen::Matrix<Qtype,3,1> Vector3Q;
const Vector3Q up = q.matrix() * Vector3Q(0,1,0);
Vector3Q proj_up(0,up(1),up(2));
if(proj_up.norm() == 0)
... | ALGO | 0.943866 | 4.797478 |
2de4db9a-acc3-4813-8a3c-e2743f77ffd8 | virtyaluk/leetcode | problems/318/solution.cpp | class Solution {
public:
int maxProduct(vector<string>& words) {
int ans = 0;
unordered_map<string, int> um;
for (const string& word: words) {
um[word] = token(word);
}
for (const string& word1: words) {
for (const string& word2: word... | ALGO | 0.999876 | 6.090463 |
b184b636-ed84-46ef-b57c-bb45032b4204 | alexandraback/datacollection | solutions_2645486_0/C++/Lunarmony/B.cpp | #include <algorithm>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <queue>
#include <vector>
#include <set>
using namespace std;
const int kMaxN = 10001;
long long E, R, N;
long long v[kMaxN];
long long kG[kMaxN];
long long solve() {
long long ans = 0;
kG[... | ALGO | 0.999985 | 4.358605 |
da52489e-c957-43b6-a2ce-c647a6b17260 | EhetisumSharif/Programing | C++ programing/factorial.cpp | #include <iostream>
using namespace std;
class factorial
{
public:
int fact(int n);
};
int factorial::fact (int n)
{
if (n == 0)
{
return 1;
}
return n*fact(n - 1);
}
int main()
{
factorial a;
cout << "Factorial : " <<a.fact(5) << endl;
return 0;
} | ALGO | 0.998477 | 4.279416 |
2a769ecb-8778-424e-a0a9-a11f074ce5db | JaeHyoNi/BackJoon | for_class_3/1931.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int N; cin>>N;
vector<pair<int,int>> arr(N);
for(int i=0;i<N;i++) cin>>arr[i].second>>arr[i].first;
sort(arr.begin(),arr.end());
int time = arr[0].first;
int count = 1;
for (int i=1;i<N;i++) {
if (time <= arr[i].second ){
count++;
tim... | ALGO | 0.999944 | 4.498288 |
fc4d820d-d12a-4f96-b6f9-91baf0f16092 | Awaisgardezi0457/Beginner-To-Advanced-C-plus-plus-Course | C++ practice programs/array programs/14.cpp | //Find the mode of the array [i.e., find the element that appears most frequently in the array]
#include <iostream>
using namespace std;
int main()
{
int arr[7]={3,4,2,4,5,6,9};
int mode=arr[0];
int maxcount=0;
for(int i=0;i<7;i++){
int count=0;
for(int j=0;j<7;j++){
if(arr[j]==arr[i]){
... | ALGO | 0.999758 | 3.600582 |
698418f8-4a7b-44cf-967e-b2975c1b742e | ishandutta2007/codeforces | robezh/normal/526/E.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = (int)1e6 + 50, INF = (int)1e9 + 50;
int n, q;
int num[3 * N], rem[3 * N], cnt[3 * N];
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
cin >> n >> q;
for(int i = 0; i < n; i++) {
cin >> num[i];
... | ALGO | 0.999459 | 3.717868 |
d78e94e2-acc2-4e1b-addd-78fbca6ffaad | rwf93/Starbound | source/windowing/StarWidgetParsing.cpp | #include "StarWidgetParsing.hpp"
#include "StarRoot.hpp"
#include "StarJsonExtra.hpp"
#include "StarImageMetadataDatabase.hpp"
#include "StarPane.hpp"
#include "StarButtonGroup.hpp"
#include "StarButtonWidget.hpp"
#include "StarCanvasWidget.hpp"
#include "StarImageWidget.hpp"
#include "StarImageStretchWidget.hpp"
#incl... | TOOL | 0.852537 | 6.402999 |
c5604fd3-e8bd-45be-89bf-72977c1df819 | eerrieda/c- | while_6.cpp | #include <stdio.h>
main()
{
int n, sum = 0;
printf("*** 2 ***\n");
while( n <10)
{
printf("2 * %d = %d\n", n, n*2);
n++;
}
}
| ALGO | 0.902643 | 3.390063 |
a39901f2-d2f3-41b0-adf7-8d17d85da602 | gitXFhub/PAT | 041.cpp | #include<iostream>
using namespace std;
int main()
{
int n,num2,m;
cin >> n;
string arr[1001][2];
for (int i = 0; i < n; i++)
{
string num1, num3;
cin >> num1 >> num2 >> num3;
arr[num2][0] = num1;
arr[num2][1] = num3;
}
cin >> m;
for (int i = 0; i < m; i++)
{
cin >> num2;
cout << arr[num2][0] <<... | ALGO | 0.999629 | 3.541341 |
63ada73a-cdb9-4f8a-b594-bb06654dad28 | bqmnhat/CompetitiveProgramming | BtTuyen/DrawingACircle/main.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
int d,t,n,a,b;
void Solve() {
for (int i=1; i<=n; i++) {
cin >> a >> b;
int tmp = min(a,b);
if (d <= tmp)
cout << "YES";
else
cout << "NO";
cout << '\n';
}
}
int main()
{
ios_b... | ALGO | 0.999651 | 3.593226 |
73ac7318-36ce-4ac5-941c-c2b7aa8c480c | ohtuna/Algorithm | Codeforces/1186A.cpp | #include<iostream>
using namespace std;
int main()
{
int n, m, k;
cin >> n >> m >> k;
if(m-n >=0 && k-n >=0)
{
cout << "YES";
}
else
{
cout << "NO";
}
}
| ALGO | 0.999941 | 3.549141 |
c8641b7a-7238-4495-a267-59434edf6816 | firewood/topcoder | srm_7xx/srm_769/BallsOnAMeadow.cpp | // BEGIN CUT HERE
/*
SRM 769 Div2 Easy (250)
PROBLEM STATEMENT
There once was a meadow:
................
Then, somebody dropped some balls onto the meadow:
.()...()().().()
Finally, some grass grew on the meadow, obscuring some of the balls:
.(|||.()(||||||)
You are given the string meadow with the final state ... | ALGO | 0.999688 | 4.461102 |
fec5448e-bb75-45ac-8840-707233567c6d | manikantaoruganti/leetcode-s | 1993-sum-of-all-subset-xor-totals/2025-06-02 19.04.45 - Accepted - runtime 0ms - memory 9MB.cpp | class Solution {
int dfs(int i, int xorSum, vector<int>& nums) {
if (i == nums.size()) return xorSum;
return dfs(i + 1, xorSum, nums) + dfs(i + 1, xorSum ^ nums[i], nums);
}
public:
int subsetXORSum(vector<int>& nums) {
return dfs(0, 0, nums);
}
}; | ALGO | 0.999999 | 5.991553 |
afb139f9-324d-4bad-906f-2709cbc7e10c | Shivansh-Gautam/Data-Structures-And-Algorithms | Medium/Minimum cost to fill given weight in a bag/minimum-cost-to-fill-given-weight-in-a-bag.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
class Array {
public:
template <class T>
static void input(vector<T> &A, int n) {
for (int i = 0; i < n; i++) {
scanf("%d ", &A[i]);
}
}
template <class T>
static void print(vector<T> &A) {
f... | ALGO | 0.999989 | 5.70286 |
ce262460-dd28-4afd-83e2-cbfd66dac04a | mcoder2014/FaceReconstruction | libs/eigen-eigen-5a0156e40feb/unsupported/doc/examples/MatrixLogarithm.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
using std::sqrt;
MatrixXd A(3,3);
A << 0.5*sqrt(2), -0.5*sqrt(2), 0,
0.5*sqrt(2), 0.5*sqrt(2), 0,
0, 0, 1;
std::cout << "The matrix A is:\n" << A << "\n\n";
std::cout << "... | ALGO | 0.998895 | 3.621207 |
27b96440-c6f4-4fd7-a3d0-7dc7733b95a9 | Shambhogit/Data-Structure | linklist/doubleLLdeletion.cpp | #include<iostream>
#define n NULL
using namespace std;
struct node{
int data;
node *next;
node *prev;
};
class DLL{
int size;
node *head,*tail;
public:
DLL(){
head = n;
tail = n;
size = 0;
}
void add_node(int a){
node *new_node = new node;
... | ALGO | 0.999921 | 4.377833 |
a09d7b7a-b8bf-4381-bdca-f31f16289c6b | CodeShark/BitcoinScriptExperiments | src/createmofntx.cpp | #include <CoinCore/hash.h>
#include <CoinCore/numericdata.h>
#include <CoinCore/secp256k1_openssl.h>
#include <CoinQ/CoinQ_script.h>
#include <algorithm>
#include <iostream>
#include <stdexcept>
const unsigned char ADDRESS_VERSIONS[] = {30, 50};
using namespace Coin;
using namespace CoinCrypto;
using namespace Coin... | ALGO | 0.946451 | 5.607268 |
541a19b9-2b18-4386-81f3-bb03a4ad114d | henryoier/leetcode | 005_LongestPalindromicSubstring/005_LongestPalindromicSubstring.cpp | /*************************************************************************
> File Name: 005_LongestPalindromicSubstring.cpp
> Author: Sheng Qin
> Mail: <EMAIL>
> Created Time: Tue Jul 26 17:00:21 2016
************************************************************************/
#include<iostream>
#include<string>
usi... | ALGO | 0.999728 | 5.046584 |
35dc50eb-7882-4211-a763-29d5b197ea1f | KashishJuneja101003/GFG-Problems | Infix to Postfix.cpp | class Solution {
public:
int getPriority(char op){
if(op == '+' || op == '-') return 1;
if(op == '*' || op == '/') return 2;
if(op == '^') return 3;
return 0;
}
string infixToPostfix(string& s) {
stack<char> stk;
string postfix = "";
... | ALGO | 0.999854 | 5.455465 |
e4ca966f-782f-4b92-8549-cbc3115bbf5f | ishandutta2007/codeforces | tsukiko_tsutsukakushi/normal/1340/C.cpp | /**
* author: otera
**/
#include<iostream>
#include<string>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<deque>
#include<ciso646>
#include<random>
#include<map>
#include<set>
#include<complex>
#include<bi... | ALGO | 0.999964 | 3.277359 |
04e89f97-fa38-4c48-a803-2d53d26d376c | Elsyrian/acmudec | livearchive/4210.cpp | /*************************************************************************************************************************
* 4210 - Almost Shortest Path
* http://livearchive.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=25&page=show_problem&problem=2211
*
* Classification: Graph
*
* Author:
... | ALGO | 0.999654 | 4.085656 |
64925357-d594-4773-8558-e1f287cccd2b | sstuqtd/vocal | thridparty/boost/libs/geometry/index/example/benchmark.cpp | // Boost.Geometry Index
// Additional tests
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/index/rtree.hpp>
#include <boost/chrono.hpp>
#include <boost/foreach.hpp>
#include <boost/random.hpp>
int main()
{
namespace bg = boost::geometry;
namespace bgi = bg::index;
typedef boo... | TEST | 0.99332 | 6.784066 |
5f2b3ddd-9807-464c-98f2-b94fc447a347 | Mir00r/Algorithm | Searching_Algorithm/Binary_Search_Algorithm/Binary_Search.cpp | #include <bits/stdc++.h>
using namespace std;
#define LI long int
#define LLI long long int
#define LL __int64
#define ULL unsigned long long
#define LLU long long unsigned
#define row 105
#define col 105
#define MAX 100000 + 5
#define jora pair <int, int>
#define memo(array, value) memset(array, value, sizeof(array)... | ALGO | 0.999982 | 4.030723 |
82c93949-e78c-47d1-930c-13ec0de6066f | jakubcovam/JKMNet | include/eigen-3.4/failtest/qr_int.cpp | #include "../Eigen/QR"
#ifdef EIGEN_SHOULD_FAIL_TO_BUILD
#define SCALAR int
#else
#define SCALAR float
#endif
using namespace Eigen;
int main()
{
HouseholderQR<Matrix<SCALAR,Dynamic,Dynamic> > qr(Matrix<SCALAR,Dynamic,Dynamic>::Random(10,10));
}
| TEST | 0.958769 | 3.076401 |
5983cd02-458b-48b6-a150-449963a765be | Damir660/4-lab | lab4_/lab4_.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <locale.h>
#include <malloc.h>
#include <stdlib.h>
struct Node {
int data;
struct Node* left;
struct Node* right;
};
struct Node* root;
int nodeCount = 0;
void invertTree(struct Node* r) {
if (r == NULL) {
return;
}
struct N... | ALGO | 0.999885 | 3.922092 |
e922702f-db96-449c-a9b1-d5293fc9b374 | HONG-LOU/training | Daily_Training/12/13/d.cpp | /**
* author: HONG-LOU
* created: 2022-12-13 14:38:26
**/
#include <bits/stdc++.h>
auto main() -> int {
std::cin.tie(nullptr) -> std::ios::sync_with_stdio(false);
std::vector<double> x(28), y(28);
for (int i = 0; i < 28; i++) {
std::cin >> x[i] >> y[i];
}
double sum = 0;
for (int i = 0; i < 2... | ALGO | 0.999145 | 3.893562 |
1d0a016d-6c6d-4e47-838c-513a8687ad16 | ustcyyw/algorithm | luogu/imitate/ CF1840E.cpp | /**
* @Time : 2024/3/9-3:28 PM
* @Author : yyw@ustc
* @E-mail : <EMAIL>
* @Github : https://github.com/ustcyyw
* @desc :
*/
/*
* 用cnt记录有多少个位置相等
* 限制、交换时都查看原先该位置是否相等,以及操作后是否相等 来更新cnt
* cnt + 限制的数量 = 字符串长度 说明相等
*/
#include<bits/stdc++.h>
typedef long long ll;
using namespace std;
const int MOD = 1e9 + 7,... | ALGO | 0.999981 | 4.626355 |
26db84dd-58b9-4dca-b4fe-dbf20aec8796 | yangh9596/Algo-Leetcode | Leetcode/169_Majority Element.cpp | #include <iostream>
#include <map>
#include <vector>
using namespace std;
class Solution {
public:
int majorityElement(vector<int>& nums) {
int majority=0;
map<int,int> container;
for(auto k:nums) {
container[k]++;
}
for(map<int,int>::iterator it=contain... | ALGO | 0.999781 | 5.546444 |
31386b27-b63f-47f9-a42c-b14e0aeb35db | izazprogram/simple_moviea | 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 |
7c4f71e5-2770-47fb-a45e-a5038729d962 | ishandutta2007/codeforces | krijgertje/normal/1609/B.cpp | #include <algorithm>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cmath>
#include <cstring>
#include <list>
#include <cassert>
#include <climits>
#inclu... | ALGO | 0.999904 | 3.923098 |
7e735c33-62a9-45cb-8a39-4072f8202a9f | maru2213/Competitive-programming | AtCoder/ABC/192/A_20210220.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define rep2(i, s, n) for (int i = (s); i < (int)(n); i++)
using ll = long long;
using P = pair<int,int>;
int main() {
int x;
cin >> x;
cout << (x/100 + 1)*100 - x << endl;
return 0;
}
| ALGO | 0.996033 | 3.446944 |
a56a247f-f6a5-4b71-87b0-70fff8864426 | thilio/Competitive-Programming | OJ/Codeforces/1096B - Substring Removal.cpp | #include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define fr(i,n) for(int i=0;i<n;i++)
#define frr(i,n) for(int i=1;i<=n;i++)
#define ms(x,i) memset(x,i,sizeof(x))
#define dbg(x) cout << #x << " = " << x << endl
#define all(x) x.begin(),x.en... | ALGO | 0.999972 | 4.351064 |
9d11983e-6496-4243-9df0-0dc37fd938f4 | samuelhafsteins/Competetive-Programming | kattis/iceland/fibCopy2.cpp | #include <bits/stdc++.h>
using namespace std;
//template <class T> int size(const T &x) { return x.size(); }
#define rep(i,a,b) for (auto i=(a); i<(b); ++i)
#define iter(it,c) for (auto it = (c).begin(); it != (c).end(); ++it)
typedef pair<int, int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi>... | ALGO | 0.999849 | 4.748432 |
1c700f65-a1c5-42f5-be6f-9dfa016da60d | remotemcu/adin-llvm | lib/CodeGen/MachineLICM.cpp | #include "llvm/ADT/BitVector.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineDominators.h"... | ALGO | 0.996399 | 3.188484 |
2019cb93-300e-4e08-ac46-56aa75b2bc2c | abdmert97/Ceng477-HW3 | glm/test/core/core_func_integer_find_lsb.cpp | // This has the programs for computing the number of trailing zeros
// in a word.
// Max line length is 57, to fit in hacker.book.
#include <cstdio>
#include <cstdlib> //To define "exit", req'd by XLC.
#include <ctime>
int nlz(unsigned x) {
int pop(unsigned x);
x = x | (x >> 1);
x = x | (x >> 2);
x = ... | ALGO | 0.998761 | 5.181464 |
b1685eff-68a9-435c-bfb4-5751bb44540c | hemanth171/CPP_Programs | magiccode.cpp | #include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define vl vector<long long>
#define pi pair<int,int>
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define REP(i,a,b) for (int i = a; i <= b; i++)
#define deb(x) cout << #x << "=" << x << endl
#define deb2(x, y) cout << #... | ALGO | 0.996957 | 3.205458 |
f8d4e7e1-dc49-4209-ac2a-240979fc2c5f | thrent88/CppCMakeQtTemp | src/main/src/utils/StringUtils.cpp | //
// Created by Thrent on 2025/5/25.
//
#include "utils/StringUtils.h"
#include <algorithm>
#if defined(_WIN32) || defined(_MSC_VER) || defined(WIN64)
#include <Windows.h>
#elif defined(__linux__) || defined(__GNUC__)
#include <iconv.h>
#endif
namespace utils {
std::string StringUtils::trim(std::string s) {
... | TOOL | 0.894063 | 6.499667 |
3ed43b1e-d052-4528-8204-b4e4963cf08f | crocs-muni/CryptoStreams_CAESAR | aead/cba/cba7/cba7_encrypt.cpp | #include <string.h>
#include <openssl/aes.h>
#include "cba7_api.h"
#include "cba7_encrypt.h"
#define NONCEBYTES CRYPTO_NPUBBYTES
// CHANGE namespace moved due to includes
namespace Cba7_raw {
int numRounds = -1;
// CBA parameters
//================
#define tau_par (const int)96
#define b_par (const int)32
#define K... | ALGO | 0.9804 | 4.877633 |
bc0145cb-f02d-423a-8e0e-d7277d42c486 | t2469/competitive-programming-cpp | src/atcoder/abc408/d.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
constexpr int m = 3;
constexpr int INF = 2e9;
int main() {
int T;
cin >> T;
while (T--) {
int N;
string S;
cin >> N >> S;
vector<vector<int>> dp(N + 1, vector<int>(m, INF));
dp[0][0] = 0;
f... | ALGO | 0.999971 | 5.15727 |
1abf5077-3a7b-43b0-be07-abb7a214dc05 | wuzhiyi/leetcode | cpp/BalanceBinaryTree/BalanceBinaryTreeSub1.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
int treeDepth(TreeNode* root){
if (root==NULL) return 0;
int left = 1, right = ... | ALGO | 0.999849 | 6.458924 |
d6ba909a-a74a-4af5-a808-147639367a73 | miras999/ADS-2022-Fall | G2/L17 TOPSORT, CYCLES, COLORS/bipartite_dfs.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<vector<int> > g;
vector<int> colors;
void dfs(int v) {
for (int i = 0; i < g[v].size(); i++) {
int u = g[v][i];
if (colors[u] == 0) {
colors[u] = 1 + colors[v] % 2;
dfs(u);
}
}
}
bool dfs2(int v) {
for (int i = 0; i... | ALGO | 0.999897 | 5.077291 |
175a75f8-a78b-41e4-baf1-56ef10972e3a | hit7sh/CodeForces | Round 740/A.cpp | void solve() {
int n;
cin >> n;
vi A(n);
cin >> A;
int ans = 0;
f0(j, 10000) {
if (is_sorted(all(A))) break;
ans++;
for (int i = (j & 1); i + 1 < sz(A); i += 2) {
if (A[i] > A[i + 1])
swap(A[i], A[i + 1]);
}
}
print(ans);
}
| ALGO | 0.999976 | 3.968361 |
bf3b5b48-ff01-44a7-a1ab-3cb53c90109d | okhat/LazyBM | src/main.cpp | #include <omp.h>
#include <algorithm>
#include <fstream>
#include <iostream>
#include <string>
#include <vector>
// NOTE: Use those normally...
#define CachePrefix "/datasets2/IRg/CatB/1.pisa_CRAWL_filtered_fixed/"
#define COMPRESS_UPPER_BOUNDS true
#define FILTER_TERMS true
#define CACHE_REUSE true
// NOTE: Effectiv... | ALGO | 0.98563 | 3.609466 |
b65ca810-6e88-4379-9f57-df04cec88966 | Saad-ur-Rehman/Single_Queuing_System | Simulation Project/SourceCode.cpp | #include "stdio.h"
#include "stdlib.h"
#include "math.h"
#define Q_LIMIT 100
#define BUSY 1
#define IDLE 0
int next_event_type, num_custs_delayed, num_delays_required, num_events, num_in_q, server_status;
float area_num_in_q, area_server_status, mean_interarrival, mean_service, time, time_arrival[Q_LIMIT + 1],... | ALGO | 0.996335 | 4.336201 |
e79b3ac1-f2db-40ef-b07a-32d5d7a8c7bf | yearling/SolidAngleThirdPart | PhysX/APEX_1.4/shared/general/HACD/src/dgConvexHull3d.cpp | #include "dgStack.h"
#include "dgTree.h"
#include "dgGoogol.h"
#include "dgConvexHull3d.h"
#include "dgSmallDeterminant.h"
#define DG_VERTEX_CLUMP_SIZE_3D 8
class dgAABBPointTree3d
{
public:
#ifdef _DEBUG
dgAABBPointTree3d()
{
static int32_t id = 0;
m_id = id;
id ++;
}
int32_t m_id;
#endif
dgBigVector ... | ALGO | 0.999356 | 3.047006 |
62bc0573-6d47-43f1-86d4-b5f1dad83f40 | eftrahman/Bin | sortnames.cpp | #include <bits/stdc++.h>
using namespace std;
void print(vector<string> names){
for(int i=0;i<names.size();i++)
cout<<names[i]<<endl;
}
bool mycomp(string a, string b){
return a<b;
}
vector<string> alphabaticallySort(vector<string> a){
int n=a.size();
sort(a.begin(),a.end(),mycomp);
return a;
}
int main(){
int ... | ALGO | 0.999114 | 3.974506 |
b5f43367-9f39-4120-acdc-4cca3fb89608 | DCSLgatech/LES | src/trustregion_visualize_6d.cpp | #include <ros/ros.h>
#include <ros/package.h>
#include<iostream>
#include<vector>
#include <fstream>
#include <ompl/base/samplers/InformedStateSampler.h>
#include <ompl/base/SpaceInformation.h>
#include <ompl/base/objectives/PathLengthOptimizationObjective.h>
#include <ompl/base/objectives/StateCostIntegralObjective.h... | ALGO | 0.992033 | 4.759789 |
33497488-e997-4c79-8af4-a24d120e70ad | CORTEXIES/AgroPulse | server/start/scripts/model_photo/llama.cpp/examples/speculative-simple/speculative-simple.cpp | #include "arg.h"
#include "common.h"
#include "sampling.h"
#include "speculative.h"
#include "log.h"
#include "llama.h"
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
int main(int argc, char ** argv) {
common_params params;
if (!common_params_parse(argc, argv, params, LLAMA_EXAMPLE_... | TOOL | 0.874699 | 7.271963 |
f93b6cb6-139a-4391-9d13-2e8dc1f8ad71 | GRAYCN/souffleCompilerMode | src/ast/utility/Utils.cpp | /************************************************************************
*
* @file Utils.cpp
*
* A collection of utilities operating on AST constructs.
*
***********************************************************************/
#include "ast/utility/Utils.h"
#include "ast/Aggregator.h"
#include "ast/Argument.h"
... | TOOL | 0.944812 | 7.347992 |
9e386e6d-5acd-4380-ad02-335479f3fe1c | gy20073/aws | mkz-mpc-control/src/path_follower/src/MPC/QPsolver/src/SolutionAnalysis.cpp | /**
* \file src/SolutionAnalysis.cpp
* \author Hans Joachim Ferreau (thanks to Boris Houska)
* \version 3.2
* \date 2008-2017
*
* Implementation of the SolutionAnalysis class designed to perform
* additional analysis after solving a QP with qpOASES.
*
*/
#include <qpOASES/extras/SolutionAnalysis.hpp>
BEGIN_N... | ALGO | 0.99894 | 5.03233 |
37813a00-0cbe-42f9-8e16-6012a9d66d30 | checkoutb/LeetCodeCCpp | ge1100/LT1195_2024-04-24_Fizz_Buzz_Multithreaded.cpp |
#include "../header/myheader.h"
class LT1195
{
public:
};
// Runtime
// 0ms
// Beats100.00%of users with C++
// Memory
// 8.27MB
// Beats93.46%of users with C++
class FizzBuzz {
private:
int n;
std::mutex mtx;
int idx = 1;
std::condition_variable cv;
public:
FizzBuzz(int n) {
this->n = n... | ALGO | 0.999727 | 6.139576 |
616b3233-06f3-4c74-bb43-b56d8a65a08e | BioDataAnalysis/blaze | blazemark/src/blitz/TDVecDMatMult.cpp | //=================================================================================================
//=================================================================================================
//*************************************************************************************************
// Includes
//****... | ALGO | 0.998871 | 5.978899 |
028b3245-e516-497e-9984-7b5931b746aa | ruben3d/luna-raytracer | src/scene/SphereAreaLight.cpp | //
// SphereAreaLight.cpp - Created on 2009.01.15
//
#include <cmath>
#include <string>
#include <boost/lexical_cast.hpp>
#include "SphereAreaLight.h"
#include "Object.h"
#include "Polar3.h"
#include "Random.h"
#include "Ray.h"
#include "Sphere.h"
#include "Material.h"
unsigned int SphereAreaLight::GlobalCounter = 0;... | ALGO | 0.887736 | 6.24728 |
2adcc4bd-a45a-4ec9-b0a7-5250c6e97ecd | wipeswill77/cpp-primer-answer-and-practices | Chapter9/9_20/main.cpp | //sun xinyu
//2023年9月6日11:18:15
//Exercise 9.20: Write a program to copy elements from a list<int> into
//two deques. The even-valued elements should go into one deque and the
//odd ones into the other.
#include <iostream>
#include <vector>
#include "list"
#include "deque"
using namespace std;
int main() {
int in... | ALGO | 0.997642 | 4.905328 |
8a83c0a4-bb07-411c-b316-044c5fd9da10 | eshan1809/LeetCode-Daily-Challenge | September 2022/September_13.cpp | class Solution {
public:
bool validUtf8(vector<int>& data) {
int rem = 0;
for (auto &val : data) {
if ((val >> 7) == 0b0) {
if (rem > 0)
return false;
} else if ((val >> 5) == 0b110) {
if (rem > 0)
return... | ALGO | 0.996247 | 6.217122 |
8eb6292f-4033-43d0-8395-7561a6c15348 | RDLLab/SKD_DEVEL | opptv5/src/solvers/ABT/solver/abstract-problem/heuristics/RolloutHeuristic.cpp | /** @file RolloutHeuristic.cpp
*
* Contains the implementation of the RolloutHeuristic class.
*/
#include "RolloutHeuristic.hpp"
#include <memory>
#include "solvers/ABT/solver/HistoryEntry.hpp"
#include "solvers/ABT/solver/abstract-problem/HistoricalData.hpp"
#include "solvers/ABT/solver/abstract-problem/Model.hp... | ALGO | 0.992015 | 6.76323 |
8f545cb2-794b-4fe8-9278-97101601c435 | wenqf11/LeetCode | C++/89. Gray Code/main.cpp | #include <iostream>
#include "solution.h"
int main()
{
Solution s;
vector<int> res = s.grayCode(5);
system("pause");
return 0;
} | ALGO | 0.998953 | 4.545658 |
103e8c36-4483-438e-9bf1-871fc07a15b5 | plskz/competitive-programming | Codeforces/Codeforces Round #651 (Div. 2)/C.cpp | #include <bits/stdc++.h>
#define ll long long
#define all(x) (x).begin(), (x).end()
#define allr(x) (x).rbegin(), (x).rend()
using namespace std;
bool win(int n) {
if (n == 1) return 0;
if (n == 2) return 1;
if ((n & (n - 1)) == 0) return 0;
if (n % 4 == 2) {
n /= 2;
for (int i = 3; i ... | ALGO | 0.999888 | 4.785019 |
30f466a8-07a6-4a69-bcf6-ff9aa0b450c7 | Munawertaj/Codeforces | A_Polycarp_and_the_Day_of_Pi.cpp | /*
Date: 27 January 2023
Problem Link: https://codeforces.com/contest/1790/problem/A
Author: Tareq Munawer Taj
CSE, Rajshahi University
*/
#include <bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define ld long double
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define... | ALGO | 0.999546 | 5.178458 |
ed2f54ad-16c8-4820-9f83-feab976553fe | PNU-Algorithm-Study/Algorithm-study | 0x0E/10814/kch_10814.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
vector<pair<int, string>> v;
bool cmp(pair<int, string> p1, pair<int, string> p2)
{
return p1.first < p2.first;
}
int main(void)
{
int num;
cin >> num;
for(int i = 0; i < num; i++)
{
int age;
string nam... | ALGO | 0.999464 | 4.444671 |
8ca14023-5f09-4e03-9aca-3bae3eeb2b1e | tracyqwerty/multithreading_knowledge_sharing | trapool/main.cpp | #include "gptpool.h"
#include <bits/stdc++.h>
int main() {
GPTPool pool(4);
std::vector<std::future<int> > results;
for (int i = 0; i < 8; ++i) {
results.emplace_back(pool.enqueue([i] {
//std::cout << "hello " << i << std::endl;
//std::this_thread::sleep_for(std::chrono::seconds(1));
//std:... | TOOL | 0.86199 | 4.055948 |
9992f343-61ac-4018-9393-24c1b03195f4 | krishna-gavas/Competitive-Coding | GeeksForGeeks/DynamicProgramming/9.MinimumNumberOfJumps.cpp | // Minimum number of jumps
// Question:
// Given an array of integers where each element represents the max number of steps that can be made forward from
// that element. The task is to find the minimum number of jumps to reach the end of the array (starting from the
// first element). If an element is 0, then canno... | ALGO | 0.99997 | 5.559384 |
c9219b54-5434-4346-b45b-0d028d5599ff | jonathanirvings/toki-open-2017 | toki-open-2017-magic/solution-3-magician.cpp | #include "magician.h"
#include <map>
#include <set>
#include <vector>
namespace magician {
std::vector<int> leftNodes, rightNodes;
std::map<int, int> leftNodesIndex, rightNodesIndex;
std::vector<int> matchedWith;
std::set<std::pair<int, int>> visited;
int N, K;
bool dfs(int now, int mask) {
if (now ... | ALGO | 0.999967 | 4.723462 |
dbc3dcba-53bf-4a2c-a342-f0372555fcf6 | marcel-licence/ML_SynthTools | src/ml_filter.cpp | /**
* @file ml_filter.cpp
* @author Marcel Licence
* @date 16.01.2022
*
* @brief This file contains the implementation of a filter processing.
* At the moment it can only calculate a low pass filter and apply it to an audio signal.
*
* @see First time used here: https://youtu.be/WJGOIgaY-1s
*/
#ifdef __CDT_PA... | ALGO | 0.995858 | 4.699446 |
38826689-55fd-4354-9d54-e1ce022340e0 | Decatf/platform_frameworks_av | media/libstagefright/codecs/mp3dec/src/pvmp3_mdct_6.cpp | /*
------------------------------------------------------------------------------
PacketVideo Corp.
MP3 Decoder Library
Filename: mdct_18.cpp
Date: 09/21/2007
------------------------------------------------------------------------------
REVISION HISTORY
Description:
-------------------------------... | ALGO | 0.999193 | 6.146664 |
e31fd1e0-3414-460c-9c08-ed2bb5b76263 | Jingzhidehui/C_CODE | 三子棋/三子棋/test.c.cpp | #define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<stdlib.h>
#include<ctime>
#include <conio.h>
#include"game.h"
#include"game.c.cpp"
//Ϸ
//Ϸʵ
void game()
{
char ret = 0;
//
char board[ROW][COL] = { 0 };
//ʼ
InitBoard(board,ROW,COL);
//ӡ
DisplayBoard(board,ROW,COL);
//
while (1)
{
//
PlayerMove... | TOOL | 0.954913 | 3.348841 |
85ca3d84-5502-43be-8839-14a6d22ed401 | cpt1020/Hidden-Markov-Model | src/main.cpp | #include <iostream>
#include <string.h>
#include <cstdlib>
#include "forward_algo.h"
#include "forward_backward_algo.h"
#include "baum_welch_algo.h"
#include "scaling.h"
#include "viterbi_algo.h"
#include "utils.h"
using namespace std;
int main(int argc, char* argv[]){
int observed_seq[7] = {0, 0, 1, 1, 1, 1, 0};... | ALGO | 0.99983 | 6.081601 |
cd8ccce1-8602-4e4a-b11b-fadd5557e2f6 | Tanveer2719/Compilers-CSE-310- | Offline 1/1905025_Assignment_1.cpp | #include<iostream>
#include<fstream>
#include<string>
#include<sstream>
using namespace std;
ofstream write("output.txt");
//hash function
unsigned long long sdbm_hash(string str)
{
unsigned long long hash = 0;
int c, i = 0;
while (str[i] != '\0'){
c = int(str[i++]);
hash = c + (hash << ... | ALGO | 0.956755 | 4.088418 |
bdb0d07b-7441-4cee-9d72-8619c700b817 | CodeRitik189/LeetCodeRepo | 413-arithmetic-slices/413-arithmetic-slices.cpp | class Solution {
public:
// first approach was a o(N) space approach but new one is better
/*vector<unordered_map<int,int>>dp(nums.size());
for(int i=1;i<nums.size();i++){
dp[i][nums[i]-nums[i-1]] = dp[i-1][nums[i]-nums[i-1]]+1;
dp[i-1][nums[i]-nums[i-1]] = 0;
}
... | ALGO | 0.999918 | 5.917244 |
ba5b6155-c7bc-4e93-b838-c95d6a0284f6 | llvm/clangir | lld/ELF/CallGraphSort.cpp | #include "CallGraphSort.h"
#include "InputFiles.h"
#include "InputSection.h"
#include "Symbols.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Transforms/Utils/CodeLayout.h"
#include <numeric>
using namespace llvm;
using namespace lld;
using namespace lld::elf;
namespace {
struct Edge {
int from;
uint64_t... | ALGO | 0.99884 | 6.810103 |
56100bfd-3021-4692-99a8-e817ca139447 | ishandutta2007/codeforces | deep_learning/normal/429/E.cpp | #include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
using namespace std;
int lst[200005], from[400005], to[400005], pre[400005], idx[400005], deg[200005], tot;
int ans[100005], l[100005], r[100005], app[200005], seq[200005], sz;
bool del[400005], vis[200005];
inline void add_edge(int u, in... | ALGO | 0.999987 | 3.653085 |
e4735960-511e-4b0e-9cd2-9cabce874f37 | Nightmayor15/Homework | sem6/Shapes.cpp | #include <iostream>
#include "Shapes.h"
/// @brief Вычисление площади треугольника
/// @return Площадь треугольника (действительное число)
double Triangle::area()
{ return sqrt(((a + b + c) / 2. - a) * ((a + b + c) / 2. - b) * ((a + b + c) / 2. - c) * (a + b + c) / 2.); }
/// @brief Вычисление площади прямоугольника
... | TOOL | 0.931836 | 3.536747 |
f383e3c8-5f7f-4c9d-9c66-257c875a60ba | shufolislam1/Basic_DS | assignment_1/Sorted.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
// Write your code here
int t;
cin >> t;
while (t--)
{
int n;
bool some = false;
cin >> n;
int arr[n];
for (int i = 0; i < n; i++)
{
cin >> arr[i];
}
for (int i = ... | ALGO | 0.999933 | 4.639718 |
e36fdcdb-0b7d-40ea-8645-6f583f46e59a | ieAditya/cpp_Codes | 450series/matrix/03_median.cpp | #include <bits/stdc++.h>
using namespace std;
bool isPossible(vector<vector<int>> &matrix, int R, int C, int mid)
{
int count = 0;
int half = (R * C + 1) / 2;
for (int r = 0; r < R; r++)
{
for (int c = 0; c < C; c++)
{
if (matrix[r][c] <= mid)
count++;
... | ALGO | 0.999908 | 5.378085 |
b4ba7e60-c4d0-482f-bf14-6ca8e1f7ef80 | chengchengwoo/leetcode | 235.lowest-common-ancestor-of-a-binary-search-tree.cpp | /*
* @lc app=leetcode id=235 lang=cpp
*
* [235] Lowest Common Ancestor of a Binary Search Tree
*
* https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-search-tree/description/
*
* algorithms
* Easy (43.36%)
* Total Accepted: 260.7K
* Total Submissions: 598K
* Testcase Example: '[6,2,8,0,4,7,... | ALGO | 0.999999 | 6.876292 |
47a66788-5cdf-4b93-a7ff-3aa4656bd8d2 | kul-arun/Codeforces | src/IWannaBeTheGuy.cpp | // 469A. I Wanna Be the Guy
#include <iostream>
#include <unordered_set>
int main() {
short n;
std::cin >> n;
std::unordered_set<int> set;
short p;
std::cin >> p;
while (p-- > 0) {
short tmp;
std::cin >> tmp;
set.insert(tmp);
}
short q;
std::cin >> q;
wh... | ALGO | 0.999726 | 3.917286 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.