uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
25b309ea-d359-4e49-a3bd-4fc79e33f633 | mcmilk/cppcrypto | cppcrypto/poly1305.cpp | /*
This code is written by kerukuro for cppcrypto library (http://cppcrypto.sourceforge.net/)
and released into public domain.
*/
#include "poly1305.h"
#include <memory.h>
#include <stdexcept>
#include "portability.h"
#include "cpuinfo.h"
#include <iostream>
//#define NO_OPTIMIZED_VERSIONS
namespace cppcrypto
{
pol... | ALGO | 0.927802 | 7.070243 |
23bc281e-413b-4d76-9de1-2fb2028b1e93 | ishandutta2007/codeforces | bohdanpastuschak/normal/958/C2.cpp | #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
typedef long double LD;
typedef long long LL;
typedef pair<int, int> PII;
typedef pair<LD, LD> PDD;
typedef pair<LL, LL> PLL;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<LD> VLD;
typedef vector<string... | ALGO | 0.999952 | 3.679762 |
73fb3a1e-e418-482c-9c10-9d43eb19ed6b | eduard-bystrov/acm-icpc | EZMASK.cpp | #include <iostream>
#include <cmath>
#include <algorithm>
#include <utility>
#include <string>
#include <vector>
#include <set>
#include <math.h>
#include <map>
#include <iomanip>
#include <functional>
#include <list>
#include <random>
using namespace std;
typedef long long int64;
typedef vector<int64> VI;
typedef pai... | ALGO | 0.999951 | 4.19938 |
e88b515e-46ad-4ecb-aeab-08884808c6f8 | juliaavilelaa/Competitive-Programming | UVA/The_dominoes_solitaire/the_dominoes_solitaire.cpp | #include <bits/stdc++.h>
using namespace std;
#define _ ios_base::sync_with_stdio(0); cin.tie(0);
#define endl '\n'
#define pb push_back
typedef long long ll;
int n, m;
pair<int, int> primeira, ultima;
bool solve(int cont, map<pair<int, int>, int> &peca, int lado) {
if (cont == 0 && (lado == ultima.first || lad... | ALGO | 0.999971 | 3.594295 |
f7e382a0-6fa0-427c-8cb3-9a4c0959fd5e | thermotools/lammps_mie_fh | lib/atc/Quadrature.cpp | #include "Quadrature.h"
#include <cmath>
#include "ATC_Error.h"
using namespace std;
namespace ATC {
Quadrature * Quadrature::myInstance_ = nullptr;
// -----------------------------------------------------------------
// instance()
// -----------------------------------------------------------------
Quadrature * Qu... | ALGO | 0.943749 | 5.046584 |
8c65b7bc-1a46-44b0-b44f-a036dac95bee | abhishek110803/Leetcode-Problems | ValidPerfectSquare.cpp | class Solution {
public:
bool isPerfectSquare(int num) {
if (num==1||num==4||num==9||num==16){return true;}
for(double i=0;i<=num/4;i++){
if (num==i*i){return true;}
}
return false;}
}; | ALGO | 0.999134 | 5.59048 |
f20d8c10-4885-4213-b323-44c4ca4026cf | sinian666/codes_102_1 | cpp_副本27/chapter_sorting/bucket_sort.cpp | /**
* File: bucket_sort.cpp
* Created Time: 2023-03-30
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 桶排序 */
void bucketSort(vector<float> &nums) {
// 初始化 k = n/2 个桶,预期向每个桶分配 2 个元素
int k = nums.size() / 2;
vector<vector<float>> buckets(k);
// 1. 将数组元素分配到各个桶中
for (float num : ... | ALGO | 0.999915 | 5.549027 |
adeb5f86-2045-4b0a-a34c-bb187f5c8435 | sarvex/leetcode-jai | solution/1500-1599/1594.Maximum Non Negative Product in a Matrix/Solution.cpp | using ll = long long;
const int mod = 1e9 + 7;
class Solution {
public:
int maxProductPath(vector<vector<int>>& grid) {
int m = grid.size();
int n = grid[0].size();
vector<vector<vector<ll>>> dp(m, vector<vector<ll>>(n, vector<ll>(2, grid[0][0])));
for (int i = 1; i < m; ++i) {
... | ALGO | 0.999987 | 5.124146 |
d430612f-fb98-490d-b129-f00389888725 | sharma0vashu/DSA | 812-rotate-string/rotate-string.cpp | class Solution {
public:
bool rotateString(string s, string goal) {
int n1=s.length();
int n2=goal.length();
if(s==goal) return true;
if(n1!=n2) return false;
string res=s+s;
if(res.find(goal)!= string::npos) {
return true;
}
else{
... | ALGO | 0.999989 | 5.646394 |
489520eb-b598-4229-8a6b-2070e5cdb8e5 | aviaryan/competitive | leetcode/medium/merge-intervals.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
vector<vector<int>> merge(vector<vector<int>>& intervals) {
int arrLen = 10000 + 2;
int arr[10000 + 2] = { -1 };
memset(arr, -1, arrLen * sizeof(int)); // init with -1 properly
int maxVal = -1;
for (int i = 0; i < intervals.si... | ALGO | 0.999986 | 4.990238 |
60c1c729-c596-49bd-bf5a-3472cc143b6e | Slava/competitiveProgramming | codeforces/cdf_135A_938216.cpp | #include <cstdio>
#include <cstdlib>
#include <map>
#include <set>
#include <cmath>
#include <vector>
#include <string>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
int n;
int a[100100];
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", a + i);
}
sort(a... | ALGO | 0.999924 | 3.435631 |
f71a5654-7fcc-428f-83a2-2c776f5fdc21 | ritikajagtap/ATOZ | linkedList/detectCycle2.cpp | #include <bits/stdc++.h>
#include <conio.h>
using namespace std;
class ListNode
{
public:
int val;
ListNode *next;
};
void inputlist(ListNode *&head, int x);
void printlist(ListNode *head);
void createCycle(ListNode *&head, int a, int b);
bool hasCycle(ListNode *head);
ListNode *detectCycle(ListNode *head);
in... | ALGO | 0.999949 | 3.721702 |
56c563ef-a5ab-4d57-ab52-0564beec4f47 | LyaminVS/facultativ | facultative_cpp/facultative_cpp_1_week/10ex/10ex/main.cpp | #include <iostream>
#include <string>
#include <vector>
int main(int argc, const char * argv[]) {
unsigned int n;
n = atoi(argv[1]);
std::vector<double> ans(600);
for (double i = 1; i <= n; i++) {
ans[i - 1] = 1 / i;
}
for (int j = 0; j < n; j++) {
std::cout << std::scienti... | ALGO | 0.986762 | 3.270842 |
a80e68cb-86c2-4d89-acca-0802d4669082 | Harsh836-ui/DSA-Problems | buildArraYpermutation.cpp | #include<bits/stdc++.h>
using namespace std;
#define nline "\n"
int main()
{
int n; cin >> n;
int nums[n];
for (int i = 0; i < n; ++i)
{
cin >> nums[i];
}
int ans[n];
for (int i = 0; i < n; ++i)
{
ans[i] = nums[nums[i]];
}
for (auto it : ans) {
cout << it ;
}
} | ALGO | 0.999987 | 3.648497 |
1f0d15a3-cc10-4d90-ba50-5c2b5a2c3c0e | deepin-community/chromium | third_party/skia/tools/skdiff/skdiff.cpp | #include "include/core/SkBitmap.h"
#include "include/core/SkColor.h"
#include "include/core/SkColorPriv.h"
#include "include/core/SkTypes.h"
#include "tools/skdiff/skdiff.h"
/*static*/ char const * const DiffRecord::ResultNames[DiffRecord::kResultCount] = {
"EqualBits",
"EqualPixels",
"DifferentPixels",
... | TOOL | 0.890332 | 7.16831 |
d5b676df-a33f-4962-a31b-28bc4f78a9ad | avplayer/proxy | third_party/boost/libs/compute/perf/perf_stl_is_permutation.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
int main(int argc, char *argv[])
{
perf_parse_args(argc, argv);
std::cout << "size: " << PERF_N << std::endl;
// create ve... | TEST | 0.951057 | 5.791606 |
eb21d0ea-5bca-4908-be74-ce39356da519 | bawejagb/LeetCode_Solutions | 0407-trapping-rain-water-ii/0407-trapping-rain-water-ii.cpp | class Solution {
public:
int trapRainWater(vector<vector<int>>& heightMap) {
int R = heightMap.size();
int C = heightMap[0].size();
int volume=0;
vector<vector<bool>> visit(R,vector<bool>(C,false));
priority_queue<pair<int,pair<int,int>>,vector<pair<int,pair<int,int>>>,great... | ALGO | 0.999942 | 6.396648 |
26169bbd-523b-4c01-aa99-8948a96a7a6c | Mahfuzpust/UVa-Problem-solutions | UVa Problem Solving-2021/UVa-12555.cpp | #include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
using namespace std;
int main() {
string s;
int tc, a, b, count = 1;
cin >> tc;
while (tc--) {
cin >> a >> s;
b = s.length() > 3 ? (int) s[3] - '0' : 0;
cout << "Case " << count++ << ": " << a * 0.5 + b * 0.05 << endl;
}
return 0;... | ALGO | 0.988025 | 3.970741 |
1aa68562-bc6c-45c4-a87b-85f9187cf329 | mehraabsingh/LeetCode-CodeVault | Daily Challenge/(18-08-24)0264-UglyNumberII.cpp | class Solution {
public:
int nthUglyNumber(int n) {
priority_queue<long, vector<long>, greater<long>> q;
q.push(1l);
unordered_set<long> vis{{1l}};
long ans = 1;
vector<int> f = {2, 3, 5};
while (n--) {
ans = q.top();
q.pop();
for (... | ALGO | 0.999996 | 5.958736 |
38be4cce-3425-429e-a089-369953cb7308 | raincross7/code-similarity | codes/train_code/problem129/problem129_229.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
int main() {
int x, y; cin >> x >> y;
int i=1;
if (x == y) {
cout << "-1" << endl;
return 0;
}
while (i * x<= 1e9) {
if (i * x % y == 0) {
i++... | ALGO | 0.999959 | 3.441903 |
3a9a34bf-2dbd-42cd-b326-6e43561ebc31 | Reshma-akter970/Problem_Solving | bfs_path_printing.cpp | #include<bits/stdc++.h>
using namespace std;
vector<int> v[1005];
bool vis[1005 ];
int level[1005];
int parent[1005];
void bfs(int src)
{
queue<int> q;
q.push(src);
vis[src]=true;
level[src]=0;
while(!q.empty())
{
int par=q.front();
q.pop();
for(int child:v[par])
... | ALGO | 0.999993 | 4.011777 |
958afbf9-4d0e-4757-a51f-d5665df17531 | darshakkanani/Cplusplus | Binary Search /peakElementOfAnArray.cpp | #include <iostream>
using namespace std;
int peakElement(int arr[], int size)
{
int start = 0;
int end = size - 1;
int mid = start + (end - start) / 2;
while (start < end)
{
if (arr[mid] < arr[mid + 1])
{
start = mid + 1;
}
else
{
end... | ALGO | 0.999661 | 4.391111 |
9a5d133c-950f-4f99-8555-e871b3a5aaa9 | Intruderp/LeetCode | 1024-video-stitching/1024-video-stitching.cpp | class Solution {
public:
int videoStitching(vector<vector<int>>& clips, int time)
{
int i=0,cur=0,n=clips.size(),res=0;
sort(clips.begin(),clips.end());
while(cur<time)
{
int maxi=cur;
while(i<n and clips[i][0]<=cur)
{
maxi=max... | ALGO | 0.999992 | 6.147924 |
fa9d4555-5583-412f-a068-2c64292b68f0 | Haroliao/prac6 | BitFlip.cpp | #include <iostream>
#include "Mutator.h"
#include "Individual.h"
#include "BitFlip.h"
#include <string>
#include <stdlib.h>
Individual BitFlip::mutate(Individual A, int K){
K=K%A.getLength();
K-=1;
A.flipBit(K);
return A;
}
| ALGO | 0.985619 | 4.384422 |
be9e0329-1638-4677-adbf-a339207fd365 | splodginald/MPI-PACC-OpenBeagle | OpenBEAGLE-4.0.0-alpha2-Source/src/beagle/AlgoNSGA2.cpp | /*!
* \file beagle/src/AlgoNSGA2.cpp
* \brief Source code of class AlgoNSGA2.
* \author Christian Gagne
* $Revision: 1.4 $
* $Date: 2007/08/17 18:09:13 $
*/
#include "beagle/Beagle.hpp"
using namespace Beagle;
/*!
* \brief Construct generational evolutionary algorithm.
*/
AlgoNSGA2::AlgoNSGA2(void) ... | ALGO | 0.996727 | 6.878683 |
8e2c5e3e-9e3a-48c7-bb03-201e1911f0dd | Scyther2/leetcode | #34.cpp | class Solution {
public:
vector<int> searchRange(vector<int>& nums, int target) {
int n=nums.size();
int a=lower_bound(nums.begin(),nums.end(),target)-nums.begin();
int b=upper_bound(nums.begin(),nums.end(),target)-nums.begin();
if(a==b)
{
return... | ALGO | 0.999959 | 6.632979 |
53d2f8ef-8e65-4649-8c19-febd60590bc7 | Arannamoy-Mondal/CP | Problems/Ehab_Is_an_Odd_Person.cpp | #include<bits/stdc++.h>
#define int long long
#define nl "\n"
#define blk " "
#define rep(i,in,n) for(int i=in;i<n;i++)
#define pb push_back
#ifndef ONLINE_JUDGE
#define debug(a) cout<<#a<<blk<<a<<nl;
#define sep(a) cout<<#a<<#a<<#a<<#a<<#a<<#a<<#a<<endl;
#else
#define debug(a)
#define sep(a)
#endif
const int N=1e5+5;
... | ALGO | 0.999944 | 3.657716 |
5249042b-565f-4125-8235-00e6da54c100 | mugglecloud/pdfium | core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp | #include "../../../include/fpdfapi/fpdf_parser.h"
#include "../../../include/fpdfapi/fpdf_module.h"
#include "../../../include/fxcodec/fx_codec.h"
#include <limits.h>
#define _STREAM_MAX_SIZE_ 20 * 1024 * 1024
FX_DWORD _A85Decode(const FX_BYTE* src_buf, FX_DWORD src_size, FX_LPBYTE& dest_buf, FX_DWORD& dest_size)
{
... | TOOL | 0.983593 | 3.568514 |
563e56b5-3270-44cc-a004-e8e0f4673936 | Venkat-Gowtham/Leet_Code_Problems | 2502-sort-the-people/sort-the-people.cpp | class Solution {
public:
bool static cp(pair<string,int>&a,pair<string,int>&b){
if(a.second==b.second)return a.first<b.first;
return a.second>b.second;
}
vector<string> sortPeople(vector<string>& names, vector<int>& heights) {
vector<pair<string,int>>nh;
for(int i = 0;i<names... | ALGO | 0.999991 | 6.141517 |
84dc38d0-eb85-4eb4-a22d-4947d9bce2ba | bose-sayan/CP | Graph/kosaraju.cpp | #include <bits/stdc++.h>
using namespace std;
// Global
const int MXN = 1e5 + 10;
vector<int> G[MXN], GT[MXN];
int out[MXN] = {}, col[MXN] = {};
int n, m, curTime = 1;
// first dfs on original graph to find the out times
void findOutTimeDfs(int src) {
if (out[src])
return;
out[src] = 1; // mark visi... | ALGO | 0.999933 | 4.94946 |
191ee52b-c6ad-41be-806e-5d73c05d163a | kento-yoshidu/cpp_algorithm | atcoder/other_contest/joi2024yo1b/d_repetition.cpp | // https://atcoder.jp/contests/joi2024yo1b/tasks/joi2024_yo1b_d
#include <iostream>
using namespace std;
int func(int x, int n) {
int ans = 0;
while (x < n) {
int r = x % 3;
ans++;
if (r == 0) {
x++;
} else if (r == 1) {
x *= 2;
} else {
... | ALGO | 0.999817 | 4.757882 |
458e5874-f36f-4c69-9030-0cd4f76307fd | Murtadha9/Task-Grid-flutter | 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.998784 | 6.761023 |
9449638b-14bb-4959-b514-2afd97b0aa88 | tte0/CP | U_Bewitching_Stargazer.cpp | // Author: Teoman Ata Korkmaz
#include <bits/stdc++.h>
#define int int_fast64_t
using namespace std;
///////////////////////////////////////////////////////////
int n,k;
inline tuple<int,int> f(int n){//ans,cnt
if(n<k)return {0,0};
if(n==1)return {1,1};
auto [ans,cnt]=f(n/2);
ans*=2;
ans+=((n+1)/2... | ALGO | 0.999843 | 4.324189 |
ab6c0a56-908a-44e9-ab17-fdee723ac0ef | amsraman/Competitive_Programming | 15-295/F21/Contest 09/C.cpp | #include <bits/stdc++.h>
using namespace std;
template <typename T>
struct FlowNetwork {
size_t n;
T INF = 0x3f3f3f3f;
vector<size_t> level, ptr;
vector<vector<size_t>> graph;
vector<map<size_t, T>> init_capacity, edge_capacity;
FlowNetwork(size_t n): n(n), level(n), ptr(n), graph(n), init_ca... | ALGO | 0.999938 | 4.100631 |
35a367b6-4bb2-4a22-a28a-c7dcf0f21180 | ASAG-ISCAS/BdryReach | capd/capdDynSys4/examples/poincare/IPoincareMapExample.cpp | #include <iostream>
#include "capd/capdlib.h"
using namespace std;
using namespace capd;
using capd::autodiff::Node;
/*
* This is vector field of the PCR3BP
* @param in is an array of independent variables
* @param out is an array of dependent variables, i.e. out = f(in)
* @param params - parameters of the map. Here w... | ALGO | 0.999931 | 5.273283 |
59b0041c-1d6e-405f-b05a-e34121b7fed2 | ramonbordelies/CPS356 | ramon_bordelies_project04/philo.cpp | #include <array>
#include <chrono>
#include <iostream>
#include <mutex>
#include <random>
#include <thread>
#include <condition_variable>
constexpr int no_of_philosophers = 5;
enum class State {
THINKING = 0,
HUNGRY = 1,
EATING = 2,
};
inline size_t left(size_t i) {
return (i + no_of_philosophers - 1... | ALGO | 0.988527 | 4.527933 |
22d0f328-9926-4876-a357-f0a3c0209f50 | Gemasyaputra/gemasyaputra_flutter_mi2b_uas | 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 |
8d8045d8-3a71-46bd-97c4-a4dec1d952fe | Snehil-Mittal/CrackYourPlacement | Dynamic_programming/Climbing_Stairs.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
static vector<int>dp;
int climbStairs(int n) {
dp[0]=1;
dp[1]=1;
for(int i=2;i<=n;i++){
dp[i]=dp[i-2]+dp[i-1];
}
return dp[n];
}
};
vector<int> Solution::dp(4... | ALGO | 0.999991 | 4.992929 |
3b274b82-7ed2-41b3-a519-02bc0534f8ee | ashita-agarwal/DSA-Practice-Cpp | IMP QUES/diagonal print of square matrix.cpp | #include <iostream>
using namespace std;
int main() {
int arr[100][100];
int n;
cin>>n;
int rows,cols;
rows=cols=n;
//input the 2D array
for(int i=0;i<rows;++i){
for(int j=0;j<cols;j++){
cin>>arr[i][j];
}
}
cout<<"Principal diagonal "<<endl;
for... | ALGO | 0.999428 | 3.1913 |
f77bf7c9-b130-407f-a1fe-6e1407bee18e | GG38040/C-Projects | gfg257_hw5_q1.cpp | // ConsoleApplication35.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int fibO(int inputNum);
//computes the fibonacci for given input number
//user enters integer output is its fibonacci
int main()
{
int outputFibo;
int inputNum;
cout... | ALGO | 0.999711 | 4.060001 |
3708098f-0dbe-4e84-b592-3672b24bc70e | tx995976/codes_daily | class_code/code/10/5-1.cpp | #include<iostream>
#include<stack>
using namespace std;
const int MaxSize = 100; // 栈中能保存的最多元素个
template<class t>
class Istack{
public:
Istack(); // 栈的构造函数
~Istack(){} // 栈的析构函数
void Push(const t &n); // 往栈顶增加元素
void Pop(); //... | ALGO | 0.984676 | 3.966706 |
20a5e914-116e-4932-b456-982edfd85d76 | ishandutta2007/codeforces | quang/normal/453/A.cpp | #include <bits/stdc++.h>
#define fi freopen("inp.txt", "r", stdin)
#define fo freopen("out.txt", "w", stdout)
using namespace std;
int m, n;
int main() {
ios_base::sync_with_stdio(0);
// fi, fo;
cin >> m >> n;
double res = 0.0;
for(int i = 1; i <= m; i++)
res += 1.0 * i * (pow(1.0 * i / m,... | ALGO | 0.999273 | 3.809109 |
5c1492c3-bf8e-42f7-9c9c-16906828090b | justin0u0/LeetCode | problems/1964-find-the-longest-valid-obstacle-course-at-each-position/solution.cpp | /**
* Author: justin0u0<<EMAIL>>
* Problem: https://leetcode.com/problems/find-the-longest-valid-obstacle-course-at-each-position/
* Runtime: 230ms (99.31%)
*/
const static auto _ = []() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
return nullptr;
}();
class Solution {
private:
vector<int> lcs;
vect... | ALGO | 0.999805 | 6.009582 |
a1bd2fde-d171-420a-9500-0d5f1c9699bc | perente/LeetCode | 1039-find-the-town-judge/find-the-town-judge.cpp | //Rampia Perente
class Solution {
public:
int findJudge(int n, vector<vector<int>>& trust) {
vector<int> trust_balance(n + 1, 0);
if(n == 1)
return 1;
int size = trust.size();
for(int i = 0; i < size; i++)
{
int a = trust[i][0];
int b = trus... | ALGO | 0.999964 | 5.121552 |
2248f8dd-b17b-40a9-8ac0-11025dad95b9 | rkv225/Algorithms-Practise | 02_hash_tables/02_chained_hash_table.cpp | #include<iostream>
#include<vector>
using namespace std;
class hash_table
{
public:
hash_table(int n)
{
size = n;
hash_set.assign(n, vector<int>());
}
void insert(int k)
{
int p = hash_function(k);
hash_set[p].push_back(k);
}
bool search(int k)
{
int p = hash_function(k);
if (!hash_set[p].empty... | ALGO | 0.999399 | 5.22378 |
b5804057-5ab4-480e-97d6-e684a4672661 | adityasharmawork/CPP_Programs | Day5/src/withdraw.cpp | #include <iostream>
using namespace std;
class Balance{
private:
int b;
public:
// Constructor
Balance(int val = 0) : b(val) {
// b = val;
}
// Display
void display() const {
cout<<"The balance is : "<<b<<endl;
}... | ALGO | 0.90774 | 4.526054 |
d413e28b-9c47-4f34-9531-d5014218ab68 | Khushboo1457/DS-file | lab/BST_exp11/main.cpp | #include <iostream>
using namespace std;
struct BST
{
int info;
BST *left;
BST *right;
};
BST *root;
class binary
{
BST *check,*ptr;
int num;
public:
binary()
{
root = NULL;
}
void add()
{
cout<<"\nEnter the number until -1 is entered\n";
cin>>num;
... | ALGO | 0.999834 | 3.703001 |
dadaccf1-e970-4b46-b764-398fa2532d3f | jiho5993/solving_algorithm | BOJ/13305_25_07_16.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL_TEST
constexpr bool isLOCAL = true;
#else
constexpr bool isLOCAL = false;
#endif
#define debug if constexpr (isLOCAL) cerr
#define ll long long
ll arr[100001], arr2[100001];
void solve() {
int N; cin >> N;
for (int i=0; i<N-1; i++) cin >> arr[i];
... | ALGO | 0.999965 | 3.79009 |
1d1e3a4f-5a9b-47b2-a7ca-9dc9c0cf761b | BruceleeThanh/Backup_CppBasicTLU | Kiem tra so dep - ham bool/Source.cpp | #include <iostream>
#include <math.h>
using namespace std;
bool kiemtraNguyento(long long);
bool soDep(long long);
bool kiemtraNguyento(long long b)
{
int i = 2;
if ((b == 2) || (b == 3))
return 1;
while (i <= (int)sqrt((double)b))
{
if (b%i == 0)
{
return 0;
break;
}
else
{
i++;
if (i > (... | ALGO | 0.999742 | 3.939553 |
a140f84e-60f6-48c1-971c-a5a1d51d9ece | eric-heiden/tds-merge | third_party/CppAD/speed/src/link_sparse_jacobian.cpp | # include <cppad/utility/near_equal.hpp>
# include <cppad/speed/sparse_jac_fun.hpp>
# include <cppad/speed/uniform_01.hpp>
# include <cppad/utility/index_sort.hpp>
# include "link_sparse_jacobian.hpp"
/*
------------------------------------------------------------------------------
$begin choose_row_col_sparse_jacob... | ALGO | 0.991672 | 7.492353 |
fef25a5f-bedd-463d-a888-a548312358aa | fawkesrobotics/fawkes | src/libs/utils/search/astar.cpp | #include <utils/search/astar.h>
namespace fawkes {
/** @class AStar <utils/search/astar.h>
* This is an implementation of the A* search algorithm.
*
* @author Stefan Jacobs, Martin Liebenberg
*/
/** @var AStar::closed_list
* This is AStars closed_list.
*/
/** @var AStar::solution
* This is the final solutio... | ALGO | 0.999966 | 5.753669 |
2b70963f-0d5a-4126-bbee-34e80e68ab18 | rd-dpo-office/important-dsa-problems | sort.cpp | #include<iostream>
#include<string.h>
#define FRAM_TXT_SIZ 3
#define MAX_NOF_FRAM 127
using namespace std;
char str[FRAM_TXT_SIZ*MAX_NOF_FRAM];
struct frame
{
char text[FRAM TXT SIZ];
int seq_no;
}
fr[MAX NOF FRAM], shuf ary[MAX NOF FRAM];
int assign_seq_no()
{ int k=0,i,j;
for(i=0; i< tr1en(str); k++)... | ALGO | 0.986458 | 3.6239 |
b1870a5d-7253-4019-bd73-41f9ef745699 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_5078_28.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
long double a, b;
cin >> a >> b;
long int c = floor(a * b);
cout << c << endl;
}
| ALGO | 0.999308 | 3.740657 |
365ae797-b350-47ef-a094-e4533c4165ee | GuacheSuede/MSSubmission1234567890 | submission/rsi/boost_1_69_0/libs/math/example/binomial_quiz_example.cpp | // binomial_examples_quiz.cpp
// Simple example of computing probabilities and quantiles for a binomial random variable
// representing the correct guesses on a multiple-choice test.
// source http://www.stat.wvu.edu/SRS/Modules/Binomial/test.html
//[binomial_quiz_example1
/*`
A multiple choice test has four possibl... | ALGO | 0.992329 | 5.955971 |
195d2778-d87f-4b02-80b9-02461687e3d9 | judy5050/algorithmStudy | 17626.cpp | ////
//// 17626.cpp
//// algo
////
//// Created by 박효정 on 2021/08/25.
////
//
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
const int INF = 987654321;
int main(){
int n;
int dp[50001];
cin >> n;
fill(dp, dp+n+1, INF);
int i = 1;
while(true) {
if (i*... | ALGO | 0.999931 | 4.298912 |
13ba6bfc-3411-4916-8687-7df29790e972 | DexterSamir/CodeVentures | URI/divisor 1.cpp | #include <bits/stdc++.h>
using namespace std;
//Author: Ezio Sam
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin>>n;
for(int i=1;i<=n;i++) {
if(n%i==0) cout<<i<<endl ;
}
} | ALGO | 0.99982 | 3.880417 |
b914ba07-f403-45eb-99cc-e9dd855037a5 | rickyggg/leetcode_and_swordoffer | src/swordoffer/34_二叉树中和为某一值的路径.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 {
private:
vector<vector<int> > res;
vector<int> temp;
public:
vector<vector<int>> pathSum(TreeNo... | ALGO | 0.999977 | 5.875078 |
85f9f169-7495-4557-a8c9-f9519a84ad96 | yukarinoki/programing_contests | abc088/abc088c.cpp | #include <cstdio>
#include <iostream>
#include <bitset>
using namespace std;
typedef long long ll;
bool check(int a,int b,int c){
// If a==b==c return false, else return true;
if(a==b&&b==c) return false;
else return true;
}
int main(){
int c[3][3],oc[3][3]; //c[i][j] = c_(i,j)
for(int i=0;i<3;i++... | ALGO | 0.999992 | 3.887767 |
f2b92c85-931b-4a0f-913b-06b73e0a298a | Madhumidha-S/DSA | Strivers/Array/rearrange.cpp | /*
Rearrange Array Elements by Sign
You are given a 0-indexed integer array nums of even length consisting of an equal number of positive and negative integers.
You should return the array of nums such that the the array follows the given conditions:
Every consecutive pair of integers have opposite signs.
For all integ... | ALGO | 0.999984 | 5.728105 |
593af584-24f1-405a-897d-12d10ea78581 | abhiram138b/LEETCODE | number-of-islands/number-of-islands.cpp | #define pii pair<int,int>
class Solution {
public:
bool isSafe(int i,int j,vector<vector<char>>& grid,int n,int m){
return i>=0 && i<n && j>=0 && j<m && grid[i][j] == '1';
}
int numIslands(vector<vector<char>>& grid) {
queue<pii> q;
int n = grid.size();
int m = grid[... | ALGO | 0.999991 | 6.352485 |
34162742-14a8-44b4-b095-89b2503ee8c9 | sureyeaah/Competitive | 559C.cpp | // Gear4
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
using namespace std;
#define DEBUG(x) cout << '>' << #x << ':' << x << endl;
#define FOR0(i,n) for(int i=0, _##i=(n); i<_##i; ++i)
#define FOR(i,l,r) for(int i=(l), _##i=(r); i<_##i; ++i)
#define FORD(i,l,r) for(int i=(r), _##i=(l); --i>=_##i; )
... | ALGO | 0.999954 | 4.244452 |
8bf7ed4a-98a1-47f6-b1ac-4ed9d4615279 | broseraf228/cyber_biology | src/neuron_network/simple_perceptron.cpp | #include "simple_perceptron.hpp"
#include <math.h>
NNSimplePerceptron::NNSimplePerceptron(const std::vector<uMtrxF>& weights) : NeuronNetworkI() {
for (int i = 0; i < weights.size() - 1; i++)
if (weights[i].gsy() + 1 != weights[i + 1].gsx())
throw("try to create neuron networc with mistmatches size of weights"... | ALGO | 0.962814 | 4.936113 |
ce4ea095-839e-4711-9b71-da57fd35b119 | Sarveshsingh2007/coding | sarvesh50.cpp | #include<iostream>
using namespace std;
int main() {
int n;
cout<<"enter the value of n"<<endl;
cin>>n;
int i=1;
while(i<=n) {
int j=1;
while(j<=i) {
cout<<"*";
j=j+1;
}
cout<<endl;
i=i+1;
}
}
| ALGO | 0.999857 | 3.777242 |
0d132e93-ad2b-4d44-b5f7-d53be4dc056d | Deepusain/leetcode | 3110-score-of-a-string/3110-score-of-a-string.cpp | class Solution {
public:
int scoreOfString(string s) {
int total = 0;
for(int i = 0; i < s.size() - 1; i++) {
total += abs(s[i] - s[i + 1]);
}
return total;
}
}; | ALGO | 0.999924 | 5.688196 |
c037c0c6-86c0-4c0a-90b4-4bdb3f5e22c9 | CodingGoku/DSA | BS/BS23_rowWithMaxNoOfOnes.cpp | #include <bits/stdc++.h>
using namespace std;
// n log2 m
int maxOnes(vector<vector<int>> arr)
{
int n = arr.size(); //rows
int m = arr[0].size(); // columns
int cnt_max = 0, index = -1;
for(int i=0; i<n; i++)
{
int cnt = 0;
int first_occurence_of_1 = lower_bound(begin(arr[i]),end(... | ALGO | 0.999443 | 5.341301 |
e73ec2b4-539f-440f-b0a9-1581e6b4fdb6 | changchujing/exc | exp4-2.cpp | #include <iostream>
#include <stdio.h>
using namespace
int main(){
int x,y;
int bool_value;
printf("please input x:\n ");
scanf("%d",&x);
printf("please input y;\n ");
scanf("%d",&y);
if(x > y ){
printf(" x > y ==> %d \n",x > y);
}else if( x < y){
printf(" x < y... | ALGO | 0.997765 | 3.097299 |
84e6efdd-3c21-48c9-92df-435362ed9e8a | mashiro222/Graphics-Assignment-Llg | Homeworks/4_MinSurfMeshPara/code/code/70_李喆昊/src/Engine/Filter/FilterMitchell.cpp | #include <Engine/Filter/FilterMitchell.h>
using namespace Ubpa;
float FilterMitchell::Mitchell1D(float x) const {
x = std::abs(2 * x);
if (x > 1)
return ((-B - 6 * C) * x * x * x
+ (6 * B + 30 * C) * x * x
+ (-12 * B - 48 * C) * x
+ (8 * B + 24 * C)) * (1.f / 6.f);
else
return ((12 - 9 * B - 6 * C) * ... | ALGO | 0.985428 | 4.84688 |
7fa05546-2f18-4fc7-9b21-65f546525a26 | aniketraj1615/CPP_Codes | horner_method_taylor_series.cpp | #include<bits/stdc++.h>
using namespace std;
double e(int x,int n){
double static s=1;
if(n==0){
return s;
}
s=1+(x*s)/n;
return e(x,n-1);
}
int main(){
int x,n;
cin>>x>>n;
cout<<e(x,n);
return 0;
} | ALGO | 0.999947 | 3.360999 |
56db7904-cc58-43ac-9699-a47dabcb9c17 | anuragsinghrajput123456789/DSA-Problems-Cpp | Patterns/pattern6.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n=5;
for(int i=1; i<=n; i++){
for(int j=1; j<=n; j++){
char ch = 'A' + i - 1;
cout << ch;
}
cout << endl;
}
return 0;
}
| ALGO | 0.999523 | 3.6301 |
21271577-11b4-4cce-abb1-2567a48c8784 | kightbal/C-Study | Section12/ChallengeSolution/main.cpp | // Section 12
// Challenge - Solution
/* Write a C++ function named apply_all that expects two arrays of integers and their sizes and
dynamically allocates a new array of integers whose size is the product of the 2 array sizes
The function should loop through the second array and multiplies each element across ... | ALGO | 0.995476 | 5.490077 |
4082a0b1-b01f-4942-91b8-1983da683685 | ALEXMORF/the-dark-dungeon | code/game_random.cpp | #include "game_random.h"
void seed_rand(int32 seed)
{
random_index = seed % array_count(random_table);
}
int quick_rand()
{
if (random_index == array_count(random_table)-1)
{
random_index = 0;
}
return random_table[random_index++];
}
int ranged_rand(int32 lo, int32 hi)
{
int32 result ... | TOOL | 0.978318 | 4.820765 |
07c9a5ca-e3ac-4206-8912-f1adc624d680 | mfkiwl/Speculator | Analyzer/Vocoders/World_Harvest/src/common.cpp | #include "common.h"
#include <math.h>
#define STB_FFT_IMPLEMENTAION
#include "stb_fft.h"
#include "matlabfunctions.h"
//-----------------------------------------------------------------------------
int GetSuitableFFTSize(int sample)
{
return static_cast<int>(powf(2.0f,
static_cast<int>(logf(static_cast... | ALGO | 0.996416 | 5.517173 |
1482c344-a94d-4147-abcf-3260c59e41fb | hmmmq/PaperAlgorithm | test/miracl/ecsgen2.cpp | /*
* Proposed Digital Signature Standard
*
* Elliptic Curve Variation GF(2^m) - See Dr. Dobbs Journal April 1997
*
* This program generates one set of public and private keys in files
* public.ecs and private.ecs respectively. Notice that the public key
* can be much shorter in this scheme, for the s... | ALGO | 0.996365 | 5.082809 |
ca90a802-8269-4adc-988c-dde8a87db91d | msalahuddin267/XPSC | Week 04/Day 11/Black and White Stripe.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while(t--)
{
int n, k;
cin >> n >> k;
string s;
cin >> s;
int i = 0, j = 0, cnt = 0, ans = 0;
wh... | ALGO | 0.999909 | 4.065235 |
d81e9bcb-9c12-4781-9804-10cdf4e012ef | tarunsamanta2k22/Data-Structure---Algorithm | LINKED LIST/detect & remove loop.cpp | //Function to remove a loop in the linked list.
bool removeLoop(Node* head)
{
// code here
// just remove the loop without losing any nodes
Node *slow=head, *fast=head;
while(fast && fast->next)
{
slow=slow->next;
fast=fast->next->next;
... | ALGO | 0.999704 | 3.056026 |
58f2b7ca-c4e4-4688-9bca-9aab168ea2e6 | garvmalik11/cppCodes | 4.1 2D Arrays/TransposeMatrix.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int r,c;
cin >> r >> c;
int arr[r][c];
for(int i=0; i<r; i++){
for(int j=0; j<c; j++){
cin >> arr[i][j];
}
}
for(int i=0; i<r; i++){
for(int j=i; j<c; j++){
int temp = arr[i][j];
... | ALGO | 0.999983 | 3.038082 |
412b24b5-7015-4e43-87be-8f3da6d7440f | Yash-Singh1/competitive-programming | alphastar/cc41a/mst/spandfs/main.cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int n, m;
cin >> n >> m;
vector<vector<int>> g(n);
int x, y;
for (int i{0}; i < m; ++i) {
cin >> x >> y;
--x; --y;
g[x].push_back(y);
g[y].push_bac... | ALGO | 0.999939 | 4.331357 |
61552902-00cf-4f82-b23a-37cacceedb04 | amanbhala/Leetcode | algos/besttimetobuyandsellstock.cpp | class Solution {
public:
int maxProfit(vector<int>& prices) {
int result=0;
int min=prices[0];
for(int i=1;i<prices.size();i++){
if(prices[i]-min>result)
result=prices[i]-min;
if(prices[i]<min)
min=prices[i];
}
return re... | ALGO | 0.999639 | 6.004015 |
da73404d-6d14-4861-aba8-9758396128b3 | Lan-Jing/Leetcode-Submissions | 55.cpp | #include <iostream>
using namespace std;
#include <string>
#include <cstring>
#include <vector>
/*
O(n) greedy solution is quite perfect.
It may not be possible to use less time for feasibility validation.
*/
class Solution {
public:
int canJump(vector<int> &nums) {
vector<int> newNums,valid, dp;
... | ALGO | 0.999992 | 4.939724 |
aacbf7ca-6083-4e9e-887b-73e95f19260b | H-M-Nizum/My_Algo | Basic_Graph/BFS_DFS/DFS.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 1e3+5;
vector<int> adj[N];
bool visited[N];
void dfs(int u){
visited[u] = true;
cout<<u<<" ";
for(int v:adj[u]){
if(visited[v]) continue;
dfs(v);
}
}
int main(){
int n, m;
cin>>n>>m;
for(int i=0; i<m; i++){
... | ALGO | 0.999921 | 4.84069 |
06c5f387-a3dc-4dc1-9455-89f816811978 | liu-shichao/test_skia | thirdparty/include/src/utils/SkMatrix22.cpp | #include "src/utils/SkMatrix22.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPoint.h"
#include "include/core/SkScalar.h"
void SkComputeGivensRotation(const SkVector& h, SkMatrix* G) {
const SkScalar& a = h.fX;
const SkScalar& b = h.fY;
SkScalar c, s;
if (0 == b) {
c = SkScalar... | ALGO | 0.991721 | 6.175712 |
61befb6b-2243-4008-9f65-0057881c17d5 | Ayushkumarmaury/DSA | DSA/searches/recursion2.cpp | //sum of given number
#include<iostream>
using namespace std;
int sum(int n){
if(n==0){
return n;}
return n + sum(n-1);
}
int main(){
int n;
cout<<"Enter your number : ";
cin>>n;
cout<<sum(n);
return 0;
} | ALGO | 0.999197 | 3.877055 |
d360d5a1-d27f-4d39-9c35-4aa6ba496310 | Hijiongfeng/Likou | daily/821.cpp | #include<bits/stdc++.h>
using namespace std;
/*
给你一个字符串 s 和一个字符 c ,且 c 是 s 中出现过的字符。
返回一个整数数组 answer ,其中 answer.length == s.length 且 answer[i] 是 s 中从下标 i 到离它 最近 的字符 c 的 距离 。
两个下标 i 和 j 之间的 距离 为 abs(i - j) ,其中 abs 是绝对值函数。
示例 1:
输入:s = "loveleetcode", c = "e"
输出:[3,2,1,0,1,0,0,1,2,2,1,0]
解释:字符 'e' 出现在下标 3、5、6 和 11 处... | ALGO | 0.999985 | 5.431477 |
2f1c3ac6-9902-4d5f-9214-318102d470b5 | Mridul004/GFG | Difficulty: Medium/Longest Palindrome in a String/longest-palindrome-in-a-string.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
bool recur(int i,int j,string &s){
if(i>=j) return 1;
if(s[i]==s[j]) recur(i+1,j-1,s);
else return 0;
}
string longestPalindrome(string &s) {
int n=s.length();
... | ALGO | 0.999763 | 6.383584 |
1b84dbe1-f37f-4926-80d3-db66ac02059f | AArgharupa/Cpp_programming | Quiz1DistanceBetweenTwoPoints.cpp | #include <iostream>
#include <math.h>
using namespace std;
//this is the class
class Points
{
int x, y; // The coordinates
public:
Points(int, int); //Paarametarized costructor
friend void distanceBetweenTwoPoints(Points, Points);
//constructor overloading
Points(void)
{ //default constructor... | ALGO | 0.946675 | 3.931615 |
d2619d38-1ab4-4cec-b285-a824d369a5a7 | kniefliu/skia | src/core/SkAnalyticEdge.cpp | #include "SkAnalyticEdge.h"
#include "SkFDot6.h"
#include "SkMathPriv.h"
// This will become a bottleneck for small ovals rendering if we call SkFixedDiv twice here.
// Therefore, we'll let the outter function compute the slope once and send in the value.
// Moreover, we'll compute fDY by quickly lookup the inverse ta... | ALGO | 0.999352 | 6.635564 |
17fd887e-7db1-4980-a8c1-2f75c2c123a3 | samadakbarzai1/Mandelbrot | ComplexPlane.cpp | // ComplexPlane.cpp
// created by samad and maryam
#include "ComplexPlane.h"
#include <cmath>
#include <thread>
ComplexPlane::ComplexPlane(int pixelWidth, int pixelHeight)
: m_pixel_size(pixelWidth, pixelHeight), m_vArray(sf::Points, pixelWidth * pixelHeight), m_zoomCount(0), m_state(State::CALCULATING) {
m_a... | TOOL | 0.899137 | 5.811009 |
d004dedd-ee7e-498e-a3cf-cf9743a2554d | 1092772959/My-ACM-code | 2018夏/7.11/e.cpp | #include<iostream>
#include<algorithm>
#include<stdio.h>
#include<cstring>
#include<cmath>
using namespace std;
typedef long long ll;
const int INF = 2e9 + 10;
ll gcd(ll a,ll b) //gcd
{
if(b==0) return a;
return gcd(b,a%b);
}
ll qpow(ll a,ll b, ll mod)
{
ll res=1;
if(!a) return 0;
while(b)
... | ALGO | 0.999979 | 4.260073 |
55985660-1ddf-4925-81f4-a1b17da76113 | hotuanan/codeforces | Diverse Team/main.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
int n, k;
cin >> n >> k;
unordered_set<int> have;
unordered_set<int> idxs;
for(int i = 0; i < n; i++) {
int tmp;
cin >> tmp;
if(k == 0) continue;
if(have.find(tmp) == have.end()) {
have.insert(... | ALGO | 0.999989 | 3.6574 |
bba81429-f5c4-4e46-9d7c-800ed9138f78 | SKEIN-FION/SkeinCoin | src/chainparams.cpp | #include "chainparams.h"
#include "consensus/merkle.h"
#include "tinyformat.h"
#include "util.h"
#include "utilstrencodings.h"
#include <assert.h>
#include <boost/assign/list_of.hpp>
#include "chainparamsseeds.h"
static CBlock CreateGenesisBlock(const char* pszTimestamp, const CScript& genesisOutputScript, uint32_... | CONFIG | 0.919454 | 6.380564 |
5fec39c3-3d8f-4214-950e-be1c54bdb92c | sunbaoshi1975/EricCCC | Kattis/Detailed Differences.cpp | #include <bits/stdc++.h>
using namespace std;
#define LOCAL
int main() {
#ifdef LOCAL
const string strPath = ".\\testcase\\";
const string strFile = "Detailed Differences.01";
string strInFile = strPath + strFile + ".in";
string strOutFile = strPath + strFile + ".my.out";
freopen(strInFile.c_str... | ALGO | 0.999802 | 3.227952 |
68d704ca-5638-4915-96b2-2d85e1ec529f | Zee-Palm-LLC/jewelery-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.998762 | 6.786404 |
2e517a99-24c9-4c35-b9ea-c4c5c2c99e8a | Kartik9077/DSA | 160-intersection-of-two-linked-lists/intersection-of-two-linked-lists.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *getIntersectionNode(ListNode *headA, ListNode *headB) {
ListNode *temp;
while(headA != NULL){
temp = headB;
... | ALGO | 0.999688 | 5.106657 |
6a51c148-a892-4df6-a2a1-e40f6d996961 | sonianurag02/Leetcode | 69. Sqrt(x).cpp | // -------------------- Approach - 1 ----------------------
// Brute Force
class Solution {
public:
int mySqrt(int x) {
if(x == 0){
return 0;
}
int ans = 1;
for(long long i = 1; i <= x; i++){
if(i * i <= x){
ans = i;
} else {
... | ALGO | 0.999952 | 5.707416 |
00b7a60e-9264-47a0-8406-b12b0ee05ad8 | didierganthier/dummy_comp_impl | 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.998799 | 6.776823 |
7c9e7fbb-a15e-42bf-9970-c35b09ad463d | AnujaGD/Snippets | Cpp/MergeSort.cpp |
#include <stdio.h>
#include <stdlib.h>
// Merges two subarrays of arr[].
// First subarray is arr[l..m]
// Second subarray is arr[m+1..r]
void merge(int arr[], int l, int m, int r)
{
int i, j, k;
int n1 = m - l + 1;
int n2 = r - m;
/* create temp arrays */
int L[n1], R[n2];
... | ALGO | 0.999998 | 5.555892 |
d2b8e40f-53a1-42d3-9155-470f87803b3f | ChangJun1/LuoGuCPP | P1320.cpp | //// https://www.luogu.com.cn/problem/P1320
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int main() {
string s;
vector<int> res;
int count = 0, finishCount = 0;
char flag = '0';
bool first = true, finished = false;
while (!finished) {
cin >> s;
i... | ALGO | 0.999941 | 4.05467 |
7f7bc317-9016-4b34-bc83-d449e6857db1 | twyblade64/AdventOfCode2021 | 11_1/main.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <stack>
int main() {
std::ifstream data("input_11_1.txt");
if (!data.is_open()) return -1;
int width, height = 0;
std::vector<int> map;
std::string input;
while (data >> input) {
width = input.size();
for (int i = 0; i < width; ++i)
map.p... | ALGO | 0.995945 | 6.502814 |
5ef67e98-a677-4df9-b86d-9547f88234cb | spcl/cppless-clang | llvm/lib/Analysis/MemorySSAUpdater.cpp | #define DEBUG_TYPE "memoryssa"
using namespace llvm;
// This is the marker algorithm from "Simple and Efficient Construction of
// Static Single Assignment Form"
// The simple, non-marker algorithm places phi nodes at any join
// Here, we place markers, and only place phi nodes if they end up necessary.
// They are on... | ALGO | 0.998925 | 7.353478 |
b85a8788-dd44-4c51-80fc-1384fdf6b33a | Sanyam15/leetcode-solutions | LongestSubstringWithout RepeatingCharacters/longest_substring_without_repeating_char.cpp | class Solution {
public:
int lengthOfLongestSubstring(string s) {
int n = s.length();
int res = 0,cnt=0,k=0;
map <char,int> mp;
//for(int i=0;i<26;i++)
// a[i]=0;
for(int i=0;i<n;i++)
{
if(mp[s[i]]==0)
{
cnt++;
... | ALGO | 0.999953 | 5.543375 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.