uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
e109ccae-681e-4310-bd85-3f1111a891b4 | Soquer070/LiftingLoops | llvm/lib/CodeGen/VLIWMachineScheduler.cpp | #include "llvm/CodeGen/VLIWMachineScheduler.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/DFAPacketizer.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/RegisterC... | ALGO | 0.892584 | 5.090586 |
1347ed8a-59a5-4271-a3a8-f4c1c322ab96 | matpx/blendini | src/extern/libigl/include/igl/cr_vector_curvature_correction.cpp | #include "cr_vector_curvature_correction.h"
#include "orient_halfedges.h"
#include "gaussian_curvature.h"
#include "squared_edge_lengths.h"
#include "doublearea.h"
#include "boundary_loop.h"
#include "internal_angles_intrinsic.h"
#include "PI.h"
template <typename DerivedV, typename DerivedF, typename DerivedE,
typ... | ALGO | 0.982005 | 6.610745 |
96b1fc81-835a-415a-8415-5fd8f0712382 | Rasec09/COJ-Solutions | 1545 - Equidivisions.cpp | #include <stdio.h>
#include <string.h>
#include <utility>
#include <stack>
using namespace std;
#define MAX 101
typedef pair <int, int> Coord;
int square[MAX][MAX];
bool visitado[MAX][MAX];
void dfs(Coord s, int n)
{
stack <Coord> pila;
pila.push(s);
visitado[s.first][s.second] = true;
while(!pila.empty())
{
... | ALGO | 0.998756 | 3.658737 |
419f9a93-dec8-4fbf-ab2c-a0888af110d1 | abhijeetaman007/Code-Practice-Backup | program_atom/cpp_program/BattleofWinterfell1.cpp | #include<bits/stdc++.h>
#include<iostream>
using namespace std;
int main(){
queue<queue<int> > q(4);
char s,s1='D',s2='E';
int t;
cin>>t;
while(t--){
cin>>s;
if(s==s2)
{
int m,n;
cin>>m>>n;
// q[m-1].push(n);
}
// enqueue();
//if(s==s1)
// {
//}
//dequeue()... | ALGO | 0.997874 | 3.052172 |
2a37b294-ee1f-45ba-aea8-8f6845bb4317 | qk12/Contest | Multi-University Training Contest/1/6582-Path.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll; //long long类型的无穷大为1e18
const int max_v = 1e4 + 5;
struct Edge
{
int from, to;
ll dist;
Edge() {}
Edge(int u, int v, ll d) : from(u), to(v), dist(d) {}
};
struct HeapNode
{
ll dist;
int u;
bool operator<(const HeapNode &rhs... | ALGO | 0.999874 | 5.289162 |
afedf78d-c274-4dac-bdcd-bd457e61f86c | Bero000/CPP-MODULE-08 | cpp08/ex01/Span.cpp | #include "Span.hpp"
Span::Span(): N(0)
{}
Span::~Span()
{}
Span::Span(int n): N(n)
{}
Span::Span(const Span& cpy)
{
*this = cpy;
}
Span& Span::operator= (const Span& value)
{
if (this != &value)
this->N = value.N;
return *this;
}
void Span::addNumber(int nNumb)
{
if (vec.size() < static_cast<u... | ALGO | 0.997074 | 4.66905 |
5d11a798-4710-4a6b-b712-68233c4ff5b3 | Reddimus/USACO_notes | Graphs/Silver/P2_2021-Connecting_Two_Barns/P2_2021-Connecting_Two_Barns.cpp | #include <bits/stdc++.h>
#define T_MAX 21
#define N_MAX 100001
using namespace std;
vector<int> paths[N_MAX];
int fieldComponents[N_MAX];
vector<int> componentFields[N_MAX];
int main() {
// Read first line: t = sub test cases
// freopen("test.in", "r", stdin);
int t;
cin >> t;
long long subTestAnswers[T_MAX] = ... | ALGO | 0.999758 | 4.83599 |
e3bbff16-114e-41bb-8484-499e8f613d66 | dmironenko/leetcode | 289. Game of Life/main.cpp | #include <algorithm>
#include <vector>
class Solution {
public:
void gameOfLife(std::vector<std::vector<int>>& board) {
int rows = board.size();
int cols = rows ? board[0].size() : 0;
for (int i = 0; i < rows; ++i) {
for (int j = 0; j < cols; ++j) {
int alive_c... | ALGO | 0.999235 | 6.970617 |
f6f37fc0-fd41-46b6-adb8-30107720bbad | careylu/Algorithm_Note | 字符串/memcpy实现/main.cpp | using namespace std;
// memcpy中dst和src中的区域不能重叠,否则会出现未知结果。
// 函数没做任何内存的处理,内存是否重叠由程序员自己控制。
// 实现memcpy库函数
void* memcpy(void *dst, const void *src, size_t count)
{
// 容错处理
if (dst == NULL || src == NULL)
return NULL;
unsigned char *pdst = (unsigned char *)dst;
const unsigned char *psrc = (const u... | ALGO | 0.993991 | 3.284501 |
dc965f94-4ff1-4ed9-b967-5517109c043d | SilenceX12138/ROS-Intelligent-Service-Robot | robot/src/drivers/wpb_home_apps/src/who_is_who.cpp | /* @author Zhang Wanjie */
#include <ros/ros.h>
#include <std_msgs/String.h>
#include <sound_play/SoundRequest.h>
#include <vector>
#include <move_base_msgs/MoveBaseAction.h>
#include <actionlib/client/simple_action_client.h>
#include "xfyun_waterplus/IATSwitch.h"
#include <w... | TOOL | 0.867005 | 3.807057 |
1b54372b-0480-44e5-9f6f-b2c2e4b085c9 | Fructose-fr/leetcode-DSA | 0283-move-zeroes/0283-move-zeroes.cpp | class Solution {
public:
void moveZeroes(vector<int>& nums) {
int nz=0;
for(int i=0; i<nums.size(); i++){
if(nums[i] != 0){
std::swap(nums[nz] , nums[i]);
nz++ ; }
}
}
}; | ALGO | 0.999914 | 6.016982 |
2210436e-574c-4987-9554-07d7c4f84782 | AllanNozomu/CompetitiveProgramming | UVa/00573.cpp | bool debug = false;
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<bitset>
#include<set>
#include<string>
#include<iostream>
#include<algorithm>
#include<map>
#include<unordered_map>
#include<stdlib.h>
#include<string.h>
#include<stdio.h>
#include<math.h>
#include<time.h>
using namespace st... | ALGO | 0.999094 | 3.263467 |
eaf75b87-b21f-4af5-b9c6-da36c2f52808 | HusainCyclewala/DSA | SORTING/4-bubbleSort.cpp | // Implement bubble sort
#include <stdio.h>
#include <conio.h>
// MINE PERSONAL
int main()
{
int i, j, n, arr[100], temp;
printf("Enter the no of elements: ");
scanf("%d", &n);
for (i = 0; i < n; i++)
{
printf("\nenter element: ");
scanf("%d", &arr[i]);
}
for (i = 0; i < n... | ALGO | 0.999814 | 4.564735 |
6cef7eb5-b538-4f45-b4dc-9c653c5caeb6 | Sean0628/competitive_programming | atcoder/tessoku-book/3/a19.cpp | #include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define out(arg) cout << (arg) << endl
using ll = long long;
using P = pair<int, int>;
using mint = modint1000000007;
void chmax(ll& a, ll b) { a = max(a, b); }
void chmax(int& a... | ALGO | 0.99994 | 4.564916 |
f4242e7f-511b-469c-ad26-583c4496d0e7 | thegamer1907/Code_Analysis | CodesNew/3386.cpp | // TEMPLATE START
#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<LL> VLL;
typedef vector<ULL> VULL;
typedef vector<bool> VB;
typedef vector<double> VD;
typedef pair<int,int> PII;
typedef vector<VI> VVI;
typedef vector<PII> VPI... | ALGO | 0.999993 | 4.169416 |
57de6e24-405d-46d5-87a7-bb1736a754f9 | Msohelrana/Competetive-Programming | Leetcode/92. Reverse Linked List II.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* reverseBetw... | ALGO | 0.999998 | 5.737546 |
d132d3ba-8215-4282-a5fc-32241c5ec2c5 | cactusHats/cppLesson | practice_11-2.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cassert>
using namespace std;
template <typename T>
size_t binarySearch(T key, const vector<T>& v){
if(!is_sorted(v.cbegin(), v.cend())){
throw runtime_error("例外:ソートされていない");
}
int n = v.size();
int low = 0;
int high = n-1... | ALGO | 0.998624 | 4.164686 |
fed869f0-590e-4a54-83f1-6d56d581851a | ibqn/cses | 1194-monsters/escape-slow.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
void bfs(int &start, const vector<vector<int>> &adj, vector<bool> &visited, vector<int> &dist, vector<int> &parent)
{
queue<int> queue;
queue.push(start);
dist[start] = 0;
visited[start] = true;
while (!queue.empty())
... | ALGO | 0.99999 | 4.882889 |
b8a37f26-ba78-412a-a04e-6e192bffa287 | Naveen-siva-kumar/Leetcode-Problems | 116-populating-next-right-pointers-in-each-node/116-populating-next-right-pointers-in-each-node.cpp | /*
// Definition for a Node.
class Node {
public:
int val;
Node* left;
Node* right;
Node* next;
Node() : val(0), left(NULL), right(NULL), next(NULL) {}
Node(int _val) : val(_val), left(NULL), right(NULL), next(NULL) {}
Node(int _val, Node* _left, Node* _right, Node* _next)
: val(_... | ALGO | 0.999915 | 5.528334 |
7773698a-c048-421b-95ba-59642f540cd6 | asSqr/AtCoder | ARC106 A.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
#include <algorithm>
#include <functional>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <tuple>
#include <vector>
#define repi(i,a,b) for(ll i=... | ALGO | 0.99994 | 3.67137 |
18fec0df-49e9-46c4-9ad5-86f0ddc4de4f | kekenew/firmware-mod-kit | src/others/squashfs-3.0-e2100/lzma/C/Common/CRC.cpp | // Common/CRC.cpp
#include "StdAfx.h"
#include "CRC.h"
static const UInt32 kCRCPoly = 0xEDB88320;
UInt32 CCRC::Table[256];
void CCRC::InitTable()
{
for (UInt32 i = 0; i < 256; i++)
{
UInt32 r = i;
for (int j = 0; j < 8; j++)
if (r & 1)
r = (r >> 1) ^ kCRCPoly;
else
r >... | ALGO | 0.938444 | 6.39949 |
7b337461-020c-4101-9920-a4c12df87bc5 | MahmoudSamy1452/Problem-Solving-Solutions | Codeforces/CUFE-CPC-2/B/main.cpp | #include <bits/stdc++.h>
#include<cstring>
#include<cmath>
#define cas "Case "
#define gi(x) while(cin>>x)
#define gi2(x,y) while(cin>>x>>y)
#define gi3(x,y,z) while(cin>>x>>y>>z)
#define ll long long
#define ull ... | ALGO | 0.998945 | 3.344958 |
a15948d9-fe76-49e9-90ec-58d6f05358d4 | noornabi-noor/Codeforces | C_Heavy_Intervals.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define ld long double
#define lld long long double
#define ull unsigned long long
#define pll pair<int, int>
#define mod 1000000007
const int N = (int)1e6;
#define BISMILLAH ios_base::sync_with_stdio(0);cin.tie(0);
#define ALHAMDULILLAH return 0;
#d... | ALGO | 0.999942 | 4.18465 |
df3d532b-295d-4411-b589-ba8c697af28d | xingkongtianyu/MyFiles | 数据结构与算法/数据结构代码(高一凡)含源码/数据结构代码(高一凡)/BC/CH2/Algo2-3.cpp | // algo2-3.cpp ʵ㷨2.7ij
#include"c1.h"
typedef int ElemType;
#include"c2-1.h"
#include"bo2-1.cpp"
#include"func2-3.cpp" // equal()comp()print()print2()print1()
void MergeList(SqList La,SqList Lb,SqList &Lc) // 㷨2.7
{ // ֪˳ԱLaLbԪذֵǵݼС
// 鲢LaLbõµ˳ԱLc,LcԪҲֵǵݼ
ElemType *pa,*pa_last,*pb,*pb_last,*pc;
pa=La.e... | ALGO | 0.999876 | 3.574433 |
96225afb-0c1b-4a93-bba5-35984b8f597a | K123Ritesh/Notes_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.998859 | 6.785645 |
65286a72-b13a-47c7-8246-fdeb7cea7a09 | Pulkit95700/Data-Structures-and-Algorithms-using-C- | LinkedList/CircularLinkedList.cpp | #include<iostream>
using namespace std;
class Node{
public:
int data;
Node* next;
Node(){
data = 0;
next = NULL;
}
Node(int val){
data = val;
next = NULL;
}
};
class CircularLinkedList{
public:
Node* head = NULL;
CircularLinkedList(){
... | ALGO | 0.999644 | 4.382062 |
51a198cc-23e1-4533-8dcf-5f7a1579e40d | namhyo01/ForStudy | study/study/6010.cpp | //#include <bits/stdc++.h>
//
//using namespace std;
//#define endl "\n"
//int main() {
// ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//
// int n, q;
// cin >> n >> q;
// int sum = 0;
// vector<int> v;
// for (int i = 0; i < n; i++) {
// int temp;
// cin >> temp;
// sum += temp;
// v.push_back(sum-1);
// }
/... | ALGO | 0.999934 | 4.036108 |
2f0692ac-2df3-42ae-acdf-e0c6e2f252c4 | KTS-o7/Leetcode_Journey | LeetcodeSolutions/Prob0100_SameTree.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.999995 | 6.881064 |
f2d032ef-437c-4404-bf1c-b4bc006a656e | Mahabub618/ACM-Code-Library | Merge_Sort_Tree.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 1e5+5;
vector<int> tr[4*N];
int a[N];
void build(int u, int b, int e)
{
if(b == e)
{
tr[u].push_back(a[b]);
return;
}
int mid = (b+e)>>1;
build(2*u, b, mid);
build(2*u+1, mid+1, e);
merge(tr[2*u].begin(), tr[2*u].en... | ALGO | 0.999861 | 4.581473 |
cf39aea4-dbe1-4430-9132-5a849fc45771 | kamyu104/GoogleCodeJam-2019 | World Finals/go-to-considered-helpful.cpp | /*
* Google Code Jam 2019 World Finals - Problem F. Go To Considered Helpful
* https://codingcompetitions.withgoogle.com/codejam/round/0000000000051708/000000000016c934
*
* Time: O(N^4), N is max(R, C)
* Space: O(N^2)
*
*/
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <funct... | ALGO | 0.999817 | 6.304849 |
f8ca0a3e-58fb-4d40-8db8-ac9bdb4f9f16 | ck89119/Algorithm | LeetCode/862.cpp | #include <bits/stdc++.h>
using namespace std;
#define dump(x) cout << __LINE__ << " : "<< #x << " = " << (x) << endl
#define clr(a, x) memset(a, x, sizeof(a)) //0:0, -1:-1, INF:0x3f, -INF:0xc0
#define mp(a, b) make_pair(a, b)
#define pb(a) push_back(a)
#define lowbit(x) x & (-x)
typedef long long ll;
typedef pair<i... | ALGO | 0.999972 | 5.346971 |
41ab2e0d-afe1-4bc0-858e-35f63c891a7d | meduardafb/Aula-LLPR-dia-11-10 | aula dia 11 10.cpp | #include <stdio.h>
#include <locale.h>
int main(){
setlocale(LC_ALL,"Portuguese_Brazil");
int a, multiplicacao;
printf("Programa Para Transformar Minutos Em Segundos \n\n");
printf("Digite os Minutos: ");
scanf("%d", &a);
multiplicacao = a*60;
printf("Resultado em Segundos: %d", multiplicacao);
retu... | ALGO | 0.906997 | 3.454817 |
5d2badbc-34ae-47a0-af35-08632ea696ee | Parkseojin2001/CPlus_practice | CH04.complex_type/CH04.complex_data_type_Quiz/CH04.complex_data_type_Quiz/소스.cpp | #pragma warning(disable:4996)
#include <iostream>
#include<array>
//Quiz 10
int main() {
using namespace std;
array<double, 3> record;
cout << "#1 : ";
cin >> record[0];
cout << "#2 : ";
cin >> record[1];
cout << "#3 : ";
cin >> record[2];
cout << "Avg: " << (record[0] + record[1] + record[2]) / 3 << endl;
re... | TOOL | 0.93863 | 3.611702 |
e0accf8a-752f-43d0-8960-e248b45ef36d | nguyencongvan10022002/CTDL_GTH | codeptit/tong_long_nhat_cua_day_con_khong_ke_nhau.cpp | #include<bits/stdc++.h>
using namespace std;
main(){
int t; cin >> t;
while(t--){
int n; cin >> n;
int a[n + 5];
int dp[n + 5];
for(int i = 1; i <= n; i++) cin >> a[i];
dp[1] = a[1];
dp[2] = max(a[1], a[2]);
for(int i = 3; i <= n; i++){
dp[i] ... | ALGO | 0.999866 | 4.286308 |
a8d20885-2f52-4eeb-9edf-6275695c58de | mdmehedi121888/Tree | 24.maximum width of binary tree.cpp |
int widthOfBinaryTree(TreeNode* root) {
queue<pair<TreeNode*,int>>q;
q.push({root,0});
long ans=0;
while(!q.empty()){
int n = q.size();
long first = q.front().second;
long last = q.back().second;
ans = max(ans,last-first+1);
fo... | ALGO | 0.9999 | 5.686315 |
67d1ddb3-7abb-4dea-81dd-6a5c7b80ae38 | KauanIzidoro/Codeforces-Problems | 1A.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ll n, m, a;
ll ans[2];
cin >> n >> m >> a;
ans[0] = (n+a-1)/a;
ans[1] = (m+a-1)/a;
cout << ans[0] * ans[1] << endl;
return 0;
} | ALGO | 0.999818 | 3.511526 |
e8d3ff60-9178-4708-83a6-4669d087e975 | xtf0214/CPP | Contest/Codeforces/1823/B.cpp | /**
* @file : B
* @author : Tanphoon
* @date : 2023/07/20 00:09
* @version : 2023/07/20 00:09
* @link : https://codeforces.com/contest/1823/problem/B
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void solve() {
int n, k;
cin >> n >> k;
int cnt = 0;
f... | ALGO | 0.999401 | 4.76098 |
ab885e4e-21ad-403c-8557-81cef365962f | amarlearning/CompetitiveQuestion | codechef/Jan17/Reservior.cpp | /*
Author : Amar Prakash Pandey
contact : http://amarpandey.me
*/
#include <string.h>
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
... | ALGO | 0.999937 | 4.335744 |
3fddee1a-4f2b-4169-8a58-daa847d7c107 | KitchenGun/SGA_Study | DataStructureSelfStudy/Stack/Stack/Stack.cpp | #include <iostream>
#include <stack>
using namespace std;
int main()
{
stack<int> s;
s.push(10);
s.push(20);
s.push(30);
while (s.empty() == false)
{
int top = s.top();
printf("Top : %d\n", top);
s.pop();
}
} | ALGO | 0.934032 | 3.93674 |
e7a528f2-e9d6-4a49-8ed6-b2e4feaa2efa | Algo-Goer/LeetCodeSolutions | 2022/0320_49.字母异位词分组group-anagrams_hash与sort.cpp | /*
* @lc app=leetcode.cn id=49 lang=cpp
*
* [49] 字母异位词分组
*/
// @lc code=start
/*
互为字母异位词的两个字符串包含的字母相同,因此对两个字符串分别排序后得到的字符串一定相同
故可以将排序之后的字符串作为哈希表的key
*/
class Solution
{
public:
vector<vector<string>> groupAnagrams(vector<string> &strs)
{
unordered_map<string, vector<string>> m;
for (auto &st... | ALGO | 0.999995 | 6.610261 |
5a1f5814-e400-499e-a271-10d40d7cb162 | shubham7668/Leetcode | 1790-check-if-one-string-swap-can-make-strings-equal/1790-check-if-one-string-swap-can-make-strings-equal.cpp | class Solution {
public:
bool areAlmostEqual(string s1, string s2) {
if(s1==s2) return 1;
for(int i=0;i<s2.size()-1;i++){
for(int j=i+1;j<s2.size();j++){
swap(s2[i],s2[j]);
if(s1==s2) return 1;
swap(s2[i],s2[j]);
}
... | ALGO | 0.999984 | 5.854296 |
876ad739-1a2f-49cd-80ab-06127bd1aa37 | GaganKumar-26/DSA-Practice | Day-7 Function/OddEven.cpp | #include<iostream>
using namespace std;
bool isEven(int a){
//odd
if(a & 1){
return 0;
}
//even
return 1;
}
int main(){
int number;
cin >> number;
if (isEven(number)){
cout<<"Number is Even"<<endl;
}
else {
cout<<"Number is odd"<<endl;
}
return 0... | ALGO | 0.999374 | 3.979843 |
bb44ed21-d172-4f60-9581-38ff25021313 | glerium/acm-life | codeforces/2008-div-3/C.cpp | #include <bits/stdc++.h>
#define endl '\n'
#define rep(i,x,y) for(int i=x;i<=y;i++)
using namespace std;
typedef long long ll;
constexpr int maxn = 2e5+10;
constexpr ll mod = 998244353;
ll getans(ll x) {
ll l = 0, r = x, mid, ans;
while(l <= r) {
mid = (l + r) >> 1;
if(mid * (mid + 1) / 2 <= x) ... | ALGO | 0.999791 | 5.036726 |
22cdc0ba-965a-4701-ae55-b84e0714fa1d | ChouE/LeetCode-Cpp | TwoPointer/75.颜色分类.cpp | /*
* @lc app=leetcode.cn id=75 lang=cpp
*
* [75] 颜色分类
*/
// @lc code=start
class Solution {
public:
void sortColors(vector<int>& nums) {
int n = nums.size();
int p0 = 0, p2 = n - 1;
for (int i = 0; i <= p2; i++) {
while (i <= p2 && nums[i] == 2)
{
... | ALGO | 0.999739 | 6.330805 |
263342e7-11d6-49b6-80ba-3095e0533707 | chrispiech/cs106b-fall-2016-website | lectures/8-Fractals/code/circles/lib/StanfordCPPLib/dawglexicon.cpp | /*
* File: dawglexicon.cpp
* ---------------------
* A lexicon is a word list. This lexicon is backed by two separate data
* structures for storing the words in the list:
*
* 1) a DAWG (directed acyclic word graph)
* 2) a Set<string> of other words.
*
* Typically the DAWG is used for a large list read from a f... | ALGO | 0.982191 | 7.286204 |
b9353da8-4369-4f45-bae7-1ea89d63e603 | ZulfahmiCP/Competitive-Programming-Recources | CodeForces/Div_3/Set_900/Round_903/E_Block_Sequence.cpp | #include <iostream>
#include <functional>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
#include <iomanip>
#include <cstring>
#include <numeric>
#include <vector>
#include <string>
#include <array>
#include <cmath>
#include <queue>
#include <stack>
#include <tuple>
#include <deque>
#include <se... | ALGO | 0.999675 | 4.747388 |
e5096ffe-c97e-4252-8a93-d16242ff025e | wenyuema-cs/fairness | .history/read_20220307162839.cpp | #include <iostream>
#include <iomanip>
#include <fstream>
#include <vector>
#include <typeinfo>
#include <string>
#include <string>
#include <sstream>
#include <iterator>
#include <vector>
#include <algorithm>
using namespace std;
//======================================================================
class Graph
{
... | ALGO | 0.999609 | 4.061097 |
f2f5a287-c17f-4d35-b8ff-365a613806fe | tanvitiwari17/DSA_cpp | DS codes/binary_trees/right_view_of_BT/main.cpp | vector<int> rightView(Node *root)
{
// Your Code here
vector <int> v;
queue <Node* > q;
if(root==NULL)
return v;
q.push(root);
while(!q.empty()){
// v.push_back(q.front()->data);
int l=q.size();
while(l)
{
Node*temp=q.front();
q.pop();
... | ALGO | 0.999655 | 5.395966 |
44759f4c-3038-4917-b3a8-14d65566fb0b | ayush8303/Siddhaganga-Institute-Adv.-DSA-Training-program | Day 26 - Graph/valid bfs.cpp | #include <bits/stdc++.h>
using namespace std;
vector<vector<int>> adj;
vector<int> ind;
bool cmp(int x, int y)
{
return ind[x] < ind[y];
}
vector<int> bfs(int n)
{
vector<int> ordering; // bfs traversal
vector<bool> visited(n + 1, false);
queue<int> q;
q.push(1);
visited[1] = 1;
while (!q.empty())
{
... | ALGO | 0.999982 | 4.27539 |
8a9a8f23-e5a5-45a8-b834-c17aab4d9f07 | MarcioMicro/beecrowd-cpp | Iniciante/Bee1050.cpp | #include <iostream>
using namespace std;
int main() {
int i;
string ddd[100];
ddd[61] = "Brasilia";
ddd[71] = "Salvador";
ddd[11] = "Sao Paulo";
ddd[21] = "Rio de Janeiro";
ddd[32] = "Juiz de Fora";
ddd[19] = "Campinas";
ddd[27] = "Vitoria";
ddd[31] = "Belo Horizonte";
ci... | ALGO | 0.996304 | 4.928327 |
8ac3591c-517e-4d17-8d84-3b092598cb2c | VenkataAnilKumar/LeetCode | C++/reorder-list.cpp | // Time: O(n)
// Space: O(1)
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
void reorderList(ListNode *head) {
if (!head) {
return;
}
... | ALGO | 0.999984 | 6.087995 |
b2f60c35-b78b-4c48-b100-1b9b2d62099a | codingaquarium/ProgrammingCollection | PE-codes/PE08.cpp | /*
http://codingaquarium.wordpress.com/
Shaikh shiam Rahman
Khunla University of Engineering and Technology(KUET)
*/
#include <bits/stdc++.h>
using namespace std;
/*** typedef ***/
#define MEMSET_INF 127
#define MEMSET_HALF_INF 63
#define stream istringstream
#define rep(i,n) for(__typeof(n) i=0; i<(n); i++)
#defin... | ALGO | 0.999468 | 3.60801 |
338db097-576e-4426-ba7a-8583ac315e3d | AbhiHooda/LeetCodeSolutions | 1929. Concatenation of Array.cpp | /*
Given an integer array nums of length n, you want to create an array ans of length 2n where ans[i] == nums[i] and ans[i + n] == nums[i] for 0 <= i < n (0-indexed).
Specifically, ans is the concatenation of two nums arrays.
Return the array ans.
*/
class Solution {
public:
vector<int> getConcatenation(vector<i... | ALGO | 0.999388 | 5.557017 |
e7489c0a-52c1-41c4-ab2f-6a0d5280b0df | hjenryin/gem5 | src/systemc/tests/systemc/misc/unit/data/datawidth_bool_to_unsigned/promote_truncation/datawidth.cpp | /*****************************************************************************
datawidth.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/**************************************************************************... | ALGO | 0.960632 | 5.742909 |
39be0948-1ef3-40fa-bf65-4d8e6d60e5d7 | vaezyq/openMpStudy | paiValueEstimation.cpp | //
// Created by 22126 on 2021/10/15.
//
#include <iostream>
#include <omp.h>
#include <ctime>
#define main04 main04
using namespace std;
int main04() {
double factor = 1.0, sum = 0.0;
#pragma omp parallel for num_threads(10) default(none) shared(factor) reduction(+:sum)
for (int i = 0; i < 10000; ++i) {
... | ALGO | 0.999603 | 3.977986 |
2c4758fc-d44b-45d6-8d6b-5bbc0b6cc6dd | PRBonn/semantic-spatio-temporal-mapping | cpp/st_mapping/core/Registration.cpp | #include <tbb/blocked_range.h>
#include <tbb/global_control.h>
#include <tbb/info.h>
#include <tbb/parallel_reduce.h>
#include <Eigen/Core>
#include <algorithm>
#include <numeric>
#include <sophus/se3.hpp>
#include <sophus/so3.hpp>
#include <tuple>
#include "LocalMap.hpp"
#include "Mapping.hpp"
namespace Eigen {
usi... | ALGO | 0.997525 | 7.272447 |
b5af99ba-1efa-40f7-9ea0-df4a6b3bd94b | KhokharHuzaifa/Sorting-Algorithms-DSA | mergeSortAlgorithm.cpp | // Merge sort in C++
#include <iostream>
using namespace std;
void merge(int arr[], int p, int q, int r) {
int n1 = q - p + 1;
int n2 = r - q;
int L[n1], M[n2];
for (int i = 0; i < n1; i++)
L[i] = arr[p + i];
for (int j = 0; j < n2; j++)
M[j] = arr[q + 1 + j];
int i, j, k;
i = 0;
j = 0;
k = ... | ALGO | 0.999969 | 5.638526 |
1ae0af83-2125-4a7f-9cf3-5f946d9c1d94 | JunBinLiang/Road-To-1900 | Leetcode/LinkedList/141-Linked List Cycle(E).cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
bool hasCycle(ListNode *head) {
ListNode* slow = head;
ListNode* fast = head;
while(fast != NULL) {
... | ALGO | 0.999243 | 5.285724 |
a2380b19-c296-44f3-861c-bfd31005c3ea | purple-jwl/atcoder | src/ABC/221/D.cpp | #include <bits/stdc++.h>
#define REP(i, x, n) for (int i = x; i < (int)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define uniq(x) x.erase(unique(x.begin(), x.end()), x.end())
using namespace std;
typedef long long ll;
typedef pair<int, int... | ALGO | 0.999908 | 3.775638 |
1a8d5531-fcef-4e70-a555-a5a0e368f93e | yash2411-cmd/placement_prep | arrays/questions/findunique.cpp | //codestudio question
#include<iostream>
using namespace std;
int main(){
int n;cin>>n;
int arr[n];
int ans=0;
for(int i=0;i<n;i++){
cin>>arr[i];
}
for(int i=0;i<n;i++){
ans= ans^arr[i]; // we are using property of XOR to cancel out the same element like 1^1=0 so the element whi... | ALGO | 0.999969 | 4.623533 |
dccd6655-40ce-4f5c-8bc6-26c8f6f70b95 | Chudi-Dhruv/DSA_CPP | printFirstNegativeInteger.cpp | #include <queue>
vector<long long> printFirstNegativeInteger(long long int A[],
long long int N, long long int K) {
vector<long long> ans;
queue<long long> neg_num_arr;
long long int i=0,j=0;
while(j<N){
if (A[j]<0){
... | ALGO | 0.999981 | 4.342541 |
4b34b4bc-6085-4edd-b49f-a6cb8d188cab | jyotirmoy1997/Data-Structures-Files | Array/SubarrayProductLessThanK.cpp | /*
Very Important : The difference between right and left pointers + 1 = The number of subarrays
between right and left pointers
*/
#include<bits/stdc++.h>
using namespace std;
int numSubarrayProductLessThanK(vector<int>& nums, int k) {
int left = 0, right = 0, product = 1, count = 0, n = nums.size();
... | ALGO | 0.999833 | 4.707049 |
a11dd091-fc42-4008-b711-c4c6517df28e | samuelrivas/monorepo | src/c++/algos-n-fun/src/src/last_nth_linked_list.cpp | #include <forward_list>
#include <cassert>
#include <iostream>
#include <vector>
#include <utility>
using std::forward_list;
using std::pair;
using std::vector;
using std::cout;
using std::endl;
template <typename T>
bool nth_last(const forward_list<T> &l, int n, T* out) {
assert(n > 0);
auto head = l.cbegin();
... | TEST | 0.959437 | 5.815192 |
72c05e2e-5708-47ee-87d2-5a9aa1eeb563 | charlie-zhang-code/practice-language | leetcode-practice/cpp/code/[344]反转字符串.cpp |
//leetcode submit region begin(Prohibit modification and deletion)
class Solution {
public:
void reverseString(vector<char>& s) {
int left = 0, right = s.size() - 1;
while (left < s.size() / 2) { // 也可以用 left < right
swap(s[left], s[right]);
left++;
right--;
... | ALGO | 0.999846 | 6.152901 |
794caa14-1d05-4a1d-8e11-58570158a347 | JackJu-HIT/Selfdriving-MPC | global_kinematic_model/src/Eigen-3.3/unsupported/doc/examples/BVH_Example.cpp | #include <Eigen/StdVector>
#include <unsupported/Eigen/BVH>
#include <iostream>
using namespace Eigen;
typedef AlignedBox<double, 2> Box2d;
namespace Eigen {
Box2d bounding_box(const Vector2d &v) { return Box2d(v, v); } //compute the bounding box of a single point
}
struct PointPointMinimizer //how to compute squa... | ALGO | 0.999726 | 6.502348 |
79fa7b87-e7a6-4185-9b78-d348fdc8056e | PhDP/alchemy2 | src/infer/createhypercubedt.cpp | #include <ext/hash_set>
#include <ext/hash_map>
#include "hashint.h"
#include "inferutil.h"
#include "hypercube.h"
#include "hypercuberefinement.h"
using namespace std;
using namespace __gnu_cxx;
//extern function
//merge the input hypercubes into larger hypercubes
//(make as large as possible)
void mergeHyperCubes... | ALGO | 0.999369 | 3.869621 |
9bec502f-bda0-4ce3-9f8c-043d3e69bb9e | JANN4TUL-FERDOUS/Codeforces-Solutions | jannatul.cse7.bu/contest/1539B.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n,q,i;
cin>>n>>q;
string a;
cin>>a;
int b[n+1];
b[0]=0;
for(i=0;i<n;i++) b[i+1]=a[i]-96+b[i];
while(q--){
int l,r;
cin>>l>>r;
cout<<b[r]-b[l-1]<<endl;
}
return 0;
} | ALGO | 0.99961 | 4.108722 |
9672a670-3498-48bb-9075-4418fed709a4 | asad-shuvo/ACM | Online Judge/Leetcode/342. Power of Four.cpp | class Solution {
public:
bool isPowerOfFour(int num) {
if(num==0)return 0;
while(num!=1){
if(num%4!=0){
return 0;
}
else{
num/=4;
}
}
return 1;
}
};
| ALGO | 0.999878 | 5.458893 |
557a037a-1998-47f2-a1df-50d6588dbf0a | hugopoggetti/LeetCode | src/Min_Stack.cpp | class MinStack {
private:
vector<vector<int>> st;
public:
MinStack() {
}
void push(int val) {
int min_val = getMin();
if (st.empty() || min_val > val) {
min_val = val;
}
st.push_back({val, min_val});
}
void pop() {
st.pop_back();
}
... | ALGO | 0.999808 | 6.374381 |
15307a20-d7a6-4575-8f82-91f11ae18053 | AshminJayson/Competitive_Coding | Problems/Code Actually/Contest 1/Code_Actually_Day_16.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define start() int x; cin >> x; while(x--)
#define IO ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
vector <string> lx;
void permute(string s, string sub)
{
if(s.length() == 0)
{
lx.push_back(sub);
r... | ALGO | 0.999957 | 4.924065 |
6073eb71-59c1-4173-9dc2-ca4974e61003 | hynseok/codetree-TILs | 241012/루돌프의 반란/rudolph-rebellion.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int n, m, p, c, d;
int ry, rx;
int map[51][51] = {0,};
int dy[8] = {-1, 0, 1, 0, 1, 1, -1, -1};
int dx[8] = {0, 1, 0, -1, 1, -1, 1, -1};
struct santa {
int id;
int y;
int x;
int score;
int is_stun;
bool is_out;
};
santa sant... | ALGO | 0.999911 | 4.045231 |
ae780fe8-6232-46fa-89d1-de268281a21b | FreCap/telnet-boost | ext/boost_1_59_0/libs/coroutine/example/cpp03/asymmetric/fibonacci.cpp | #include <cstdlib>
#include <iostream>
#include <boost/range.hpp>
#include <boost/coroutine/all.hpp>
void fibonacci( boost::coroutines::asymmetric_coroutine< int >::push_type & sink)
{
int first = 1, second = 1;
sink( first);
sink( second);
while ( true)
{
int third = first + sec... | ALGO | 0.859225 | 5.98719 |
2305d01a-d6bd-47f3-90dd-06a0dd4659f1 | ViktorMilanov05/FMI_Data_Structures_and_Algorithms | Sortings/mergeSort.cpp | #include <iostream>
template <class T>
void merge(T* arr1, size_t len1, T* arr2, size_t len2, T* res) {
unsigned firstInd = 0;
unsigned secondInd = 0;
unsigned resInd = 0;
while (firstInd < len1 && secondInd < len2) {
res[resInd++] = (arr1[firstInd] < arr2[secondInd] ? arr1[firstInd++] : arr2[secondInd++]);
}
... | ALGO | 0.999881 | 4.873325 |
1cf035f6-97bc-4a24-93f4-42a78e4ee2c7 | TranBaLoi/DSA_PTIT | TinhGiaTriBieuThucTienTo.cpp | #include<bits/stdc++.h>
using namespace std;
bool isOperator(char c)
{
return c == '+' || c == '-' || c == '*' || c == '/' || c == '^';
}
int main()
{
int t; cin >> t;
while(t--)
{
string s; cin >> s;
stack<int> st;
reverse(s.begin(), s.end());
for(auto c : s)
... | ALGO | 0.999943 | 4.466727 |
d2a0e8c8-0eaf-48b7-b0ce-4fbdd18b1590 | ntsd/my-solutions | Codingame/Bot-Programming/othello.cpp | #include <chrono>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <vector>
using namespace std;
const int MAX_TIME_MS = 50; // 150
class State {
public:
State(int board_size, int player_id, const vector<string> &board)
: board_size(board_size), player_id(player_id), board(bo... | ALGO | 0.999764 | 5.980388 |
369bf67d-fc9c-43be-a806-a3c5b2d01122 | rauschinger/algorithm-engineering | answers/02_exam_assignments/continue_hack.cpp | #include <omp.h>
#include <atomic>
#include <iostream>
using namespace std;
bool is_solution(int number) { // test if number solves the problem
for (volatile int i = 10000000; i--;) {} // mock computation
return number > 133 && number < 140;
}
int main() {
constexpr int biggest_possible_number = 10000;
// ... | ALGO | 0.999982 | 5.996239 |
1f1fda56-9c8b-42e7-a7c4-3bead8612bf1 | ArcticFoox/autocommit | every_sequence.cpp | //10974 backtracking
#include<iostream>
using namespace std;
int n;
int arr[9];
bool visited[9];
void back(int row){
if(row == n){
for(int i = 0; i < n; i++){
cout << arr[i] << ' ';
}
cout << '\n';
return;
}
for(int i = 1; i <= n; i++){
if(visited[i]) ... | ALGO | 0.999932 | 5.09247 |
6481b87b-0dad-4fb3-a1d7-a0e408c141cb | cppietime/GameModMidtermS21 | idlib/math/FFT.cpp |
#include "../precompiled.h"
#pragma hdrstop
typedef struct {
double re;
double im;
} cpxDouble_t;
/*
===================
"A New Principle for Fast Fourier Transformation", Charles M. Rader and N.M. Brenner, I.E.E.E. Transactions on Acoustics
"Programs for Digital Signal Processing", published by I.E.E.E. Pres... | ALGO | 0.999592 | 5.169284 |
6c1676f3-74fb-4c15-99fc-3dfa81697c5f | habib302/LeetCode-Solution | 0167. Two Sum II - Input Array Is Sorted.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
int n=nums.size(),left=0,right,sum=0;
right=n-1;
vector<int> res;
while(left < right){
sum = nums[left]+nums[right];
if(sum==target){
... | ALGO | 0.9999 | 6.324202 |
68be3189-08e5-4fa1-9e83-e1a0f2684f81 | swapnil-32/dsa_practice_problems | Reverse alternate nodes in Link List - GFG/reverse-alternate-nodes-in-link-list.cpp | //{ Driver Code Starts
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
using namespace std;
/* A linked list node */
struct Node
{
int data;
struct Node *next;
Node(int x){
data = x;
next = NULL;
}
};
struct Node *start = NULL;
/* Function to print nodes in a given l... | ALGO | 0.999862 | 6.035688 |
ed6c3e76-67e6-4e42-b25a-05958a7c2c3d | MingyuLau/HUST-C-Programming-Course-Project | DISK_C/BORLANDC/CRTL/CLIB/VDELF.CPP | /*-----------------------------------------------------------------------*
* filename - vdel.cpp
* C++ vector_delete
* Called internally by the compiler to deallocate arrays of classes
* having destructors
*-----------------------------------------------------------------------*/
#include <stdlib.h>
#include <std... | TOOL | 0.95921 | 6.260331 |
9b901545-f08a-4040-956b-665b91183b74 | itohdak/AtCoder | ABC/old/previous/04-/043/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define REP(i,m,n) for(int i=(int)(m); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define RREP(i,m,n) for(int i=(int)(m); i>=(int)(n); i--)
#define rrep(i,n) RREP(i,n-1,0)
#define REPL(i,m,n) for(ll i=(ll)(m); i<(ll)(n); i++)
#define repl(i,n) REPL(i,... | ALGO | 0.99994 | 4.097463 |
a0c8c460-b169-4fb1-83a0-24ce208aa1e7 | wincle626/HLS_Bambu | ext/flopoco/src/IntAddition/BasicCompressor.cpp | #include <iostream>
#include <sstream>
#include <string>
#include "gmp.h"
#include "mpfr.h"
#include <vector>
#include <gmpxx.h>
#include <stdio.h>
#include <stdlib.h>
#include "BasicCompressor.hpp"
using namespace std;
namespace flopoco{
// personalized parameter
//string BasicCompressor::operatorInfo = "UserDefined... | ALGO | 0.995646 | 3.857265 |
62d43caf-f6d7-447f-9ab3-64beea47a159 | alexandraback/datacollection | solutions_5658571765186560_1/C++/Tedxz/d.cpp | #include <cstdio>
#include <iostream>
#include <cstring>
using namespace std;
const int MAX_P = 1007;
int T, ans;
int r, c, x;
bool check(int r, int c, int x) {
if (r < c) {
int t = r;
r = c;
c = t;
}
if (r * c % x != 0)
return true;
if (x > r)
return tr... | ALGO | 0.999864 | 3.827831 |
dc17b012-8e5d-42ae-b86a-f02c9040cee1 | jash-git/CB_CPP_BST | Code/BST.cpp | #include "BST.h"
BSTree::BSTree() :root(NULL) {}; //构造函数
BSTree::~BSTree() //析构函数
{
destroy();
}
void BSTree::insert(int key) //将key节点插入到二叉树中
{
BSTNode *z = new BSTNode(key, NULL, NULL, NULL); //根据插入的key生成新的二叉树节点(z)
if (z == NULL)
{
return; //如果z里面的值为空,则停止函数的执行
}
insert(root, z); //把新生的节点(z)传入树根
}
voi... | ALGO | 0.999543 | 3.179688 |
2f513eb2-6d52-42fe-934d-62e82458c469 | yellowHatpro/Codes-Practice | Leetcode/20_Valid_Parentheses.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
bool isValid(string s) {
stack<char> st;
for (int i = 0; i < s.length(); i++)
{
if(s[i]=='(' || s[i]=='[' || s[i]=='{'){
st.push(s[i]);
}
else{
if (st.empty() or... | ALGO | 0.999263 | 5.744455 |
f95c3f3c-569f-414c-ac07-0b88dfbc170b | eemoreira/biblioteca-de-problemas | icpc/nacional2017/i.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#include "debug.h"
#else
#define dbg(x...)
#endif
typedef long long ll;
#define ll int
typedef tuple<ll,int,int> i3;
typedef pair<int,ll> ii;
/* stop freaking out pls */
const int maxn = 2e5 + 5;
const int L = __lg(maxn) + 2;
int dad[maxn][L];
ll dp[maxn][... | ALGO | 0.999964 | 4.693308 |
12d619e0-2e7b-4ed5-9b1e-ebbe59aa1b07 | nguyendangcuong201004/DSA | SAP XEP - TIM KIEM/Bài 26. Tìm kiếm cặp số có hiệu bằng X.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool check (int *a, int n, int x){
for (int i = 0; i < n; i++){
int tmp = a[i] - x;
auto it = lower_bound (a, a + n, tmp);
if (*it == tmp){
return true;
}
}
return false;
}
int main(){
int ... | ALGO | 0.999931 | 4.628147 |
5e1fcfb2-ba37-4dd8-b9c8-48697120b1a9 | saiful-islam-auny/Phitron | Data Structure/module 8 (assignment)/Reverse_and_Original.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node *next;
Node(int val)
{
this->val = val;
this->next = NULL;
}
};
void tail_insert(Node *&head, Node *&tail, Node *&head_cpy, Node *&tail_cpy, int val)
{
Node *NewNOde = new Node(val);
if (head... | ALGO | 0.999812 | 4.603379 |
c8ef6102-8d79-4b38-a7cd-43dc4612e2d5 | shash04/General_Coding | myCodeSchool/Search_and_Sort/binarySearch.cpp | #include <iostream>
using namespace std;
int binarySearch(int *arr, int x, int size)
{
int start = 0;
int end = size - 1;
while (start <= end)
{
//int mid = end + (end - start) / 2; **More correct. Avoids overflow.
int mid = (start + end) / 2;
if (arr[mid] == x)
re... | ALGO | 0.999761 | 5.624853 |
1d916a1d-a541-4ba9-a799-3c3b7bd4e7dc | grand00father/OpenMP_MPI | OpenMP_7.cpp | #include <iostream>
#include <vector>
#include <omp.h>
#include <chrono>
#include <mutex>
std::mutex mtx;
// A function for summing array elements using atomic operations
double sum_atomic(const std::vector<int>& data) {
double sum = 0;
#pragma omp parallel for
for (size_t i = 0; i < data.size(); ++i) {
... | TOOL | 0.986158 | 6.02523 |
bb3b5209-32fd-445b-a76d-ac76e5b6590f | ithemal/DiffTune | llvm-mca-parametric/llvm/lib/Transforms/Utils/ImportedFunctionsInliningStatistics.cpp | #include "llvm/Transforms/Utils/ImportedFunctionsInliningStatistics.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <iomanip>
#include <sstream>
using namespace llvm;
Importe... | TOOL | 0.85731 | 7.814892 |
9ee6cd38-d2ff-4253-b694-cc2ad33465f2 | yinshi197/Algorithm | 7-二叉树/7-2-二叉树BFS/637.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
};
class Solution {
public:
vector<double> averageOfLevels(TreeNode* root) {
queue<TreeNode*> que;
... | ALGO | 0.999883 | 4.162919 |
3ce04490-02ad-445a-812f-96d109c971e1 | AIvaylov02/Artificial-Intelligence | 03. CSP - N-Queens/src/simpleQueen.cpp | #include "../headers/simpleQueen.h"
SimpleQueen::SimpleQueen(int row, int col)
{
this->row = row;
column = col;
}
int SimpleQueen::compareSimpleQueensByRow(SimpleQueen a, SimpleQueen b)
{
return a.row < b.row;
} | ALGO | 0.939777 | 4.124107 |
c6d98022-9b57-4c4b-bc2f-6a82ab0c5e42 | harshaithireddy/LeetCode-Codes | 50-powx-n/powx-n.cpp | class Solution {
public:
double myPow(double x, long long n) {
if(n == 0) return 1;
if(n < 0) {
x = 1 / x;
n = -n;
}
double sub = myPow(x, n/2);
if(n & 1) return (x * sub * sub);
return sub * sub;
}
}; | ALGO | 0.999358 | 5.821614 |
c85ad388-6fd1-47ca-bfe5-54c209b2662f | champmaniac/SolvingLeetCodeProblems | Day 42/SquaresOfASortedArray.cpp | class Solution {
public:
vector<int> sortedSquares(vector<int>& nums) {
int n=nums.size(),l=0,r=n-1;
vector<int> v(n);
for(int k=n-1;k>=0;k--){
if(abs(nums[r])>abs(nums[l]))
v[k]=nums[r]*nums[r--];
else
v[k]=nums[l]*nums[l++];
}... | ALGO | 0.999988 | 5.928193 |
7d4916e3-a96d-47f6-9f4c-afad654eacbe | bitslab/CompilerInterrupts | benchmarks/accuracy_and_overhead/parsec-benchmark/pkgs/libs/tbblib/src/examples/parallel_for/tachyon/src/bndbox.cpp | /*
* bndbox.c - This file contains the functions for dealing with bounding boxes.
*
* $Id: bndbox.cpp,v <IP_ADDRESS> 2012/03/29 17:22:19 uid42307 Exp $
*/
#include "machine.h"
#include "types.h"
#include "macros.h"
#include "vector.h"
#include "intersect.h"
#include "util.h"
#define BNDBOX_PRIVATE
#include "bn... | ALGO | 0.987507 | 7.580953 |
21a3e23f-a742-42d7-b8b5-c53b932bf779 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_4142_8.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int a, b;
cin >> a, b;
cout << a * b;
}
| ALGO | 0.984256 | 3.600814 |
35ba09d4-94bf-4579-b3b5-d0bd5c853cd0 | AsifWatson/codeforces | B/982B.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
int arr[200010];
char str[400010];
cin>>n;
map<int,int> m;
stack<int> st1;
stack<int> st2;
for(int i=0;i<n;i++)
{
cin>>arr[i];
m[arr[i]]=i+1;
}
sort(arr, arr+n, greater<int>());
for(int i=0;... | ALGO | 0.999997 | 4.174994 |
89915846-eefc-4227-9611-39c0b29d634c | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_10672_13.cpp | #include <bits/stdc++.h>
const int inf = (int)1e9;
using namespace std;
int l[100011], r[100011];
int p;
long double h[100011];
long double f[100011];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n >> p;
for (int i = 1; i <= n; i++) {
cin >> l[i] >> r[i];
h[i] = r[i] / p - (l[i... | ALGO | 0.999497 | 3.942903 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.