uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
bbbcf1bb-eb8e-4f9f-b982-68c9fc186eed | qunghiem/Code-PTIT | DSA/DSA09005 - BFS TRÊN ĐỒ THỊ VÔ HƯỚNG.cpp | // https://code.ptit.edu.vn/student/question/DSA09005
// BFS TRÊN ĐỒ THỊ VÔ HƯỚNG
#include <bits/stdc++.h>
using namespace std;
int V, E, u, v, x, y;
vector<vector<int>> G;
vector<bool> vs;
void bfs(int u) {
queue<int> q;
q.push(u);
while (!q.empty()) {
int u = q.front(); q.pop();
if (vs... | ALGO | 0.999933 | 5.76058 |
65b0bfef-202c-4cdf-8e86-1c7ab68a07c6 | doichev-kostia/kpi | programming-basics/C-plus-plus/bachelor/year-1/semester-2/lab-1/Utils.cpp | //
// Created by Kostia on 09.02.2022.
//
#include "Utils.h"
string getInput(const char &terminatingKey) {
string input;
getline(cin, input, terminatingKey);
return input;
}
string getInput(int terminatingKey) {
string input;
getline(cin, input, char(terminatingKey));
return input;
}
void f... | TOOL | 0.94339 | 5.554079 |
54d79034-dcc3-45fb-a0f9-08c17a470439 | nejradilovic/Tehnike-programiranja | Zadaće/Z2/Z4.cpp | //TP 2021/2022: Zadaa 2, Zadatak 4
#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <iomanip>
template <typename NekiTip>
bool Kriterij(std::vector<NekiTip> vektor, std::vector<NekiTip> vektorcic){
auto suma_vektor=NekiTip();
auto suma_vektorcic=NekiTip();
for(int i=0;i<v... | ALGO | 0.999591 | 4.687881 |
78e157d3-b62b-4ddb-ac2e-bcf8aeced2b5 | rp-code9/programming | sites/leetcode/CombinationSum.cpp | // Combination sum
// https://leetcode.com/problems/combination-sum/
// https://leetcode.com/problems/combination-sum-ii/
#include <iostream>
#include <vector>
#include <unordered_set>
#include <algorithm>
void backtrack(std::vector<std::vector<int>>& result, const std::vector<int>& nums,
std::vector<int>& curren... | ALGO | 0.999944 | 6.659095 |
438abe9b-d352-4ca3-9ee2-2f177cc4762d | itisameerkhan/Leetcode | 0987. Vertical Order Traversal of a Binary Tree/solution1.cpp | #include<bits/stdc++.h>
using namespace std;
typedef struct treenode
{
int data;
struct treenode* left;
struct treenode* right;
}TreeNode;
TreeNode* root = NULL;
TreeNode* createNode(int data)
{
TreeNode* newNode = (TreeNode*)malloc(sizeof(TreeNode));
newNode->data = data;
newNode->left = NULL... | ALGO | 0.999992 | 5.323492 |
9c68602b-56f5-4015-a431-4cacf15fdadc | souravbiswassanto/Codeforces | 1593B.cpp |
// Problem: B. Make it Divisible by 25
// Contest: Codeforces - Codeforces Round #748 (Div. 3)
// URL: https://codeforces.com/contest/1593/problem/B
// Memory Limit: 256 MB
// Time Limit: 1000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#pragma GCC diagnostic ignored "-Wunused-variable"
#pragma ... | ALGO | 0.999456 | 4.791768 |
f1572f01-9df0-4dcf-9956-14783fe9c7b9 | CMU-BeanBurrito/comp-prog | CF/CF2092/C.cpp | /*
Author: BeanBurrito
*/
#include <iostream>
#include <cstdio>
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
using ll = long long;
#define MOD 1'000'000'007
#define divceil(n, m) (n+m-1)/m
int gcdExt(int a... | ALGO | 0.999954 | 4.581634 |
477f09eb-10d3-4afa-b984-264517200ebd | Enemy89/14.4 | untitled14/main.cpp | #include <iostream>
int main() {
float matrix [4][4];
float vector [4];
float newVector [4];
float temp=0;
float semiTemp=0;
int count=0;
for (int i=0; i<4; ++i) {
for (int j=0; j<4; ++j) {
std::cout<<"Enter the value of the matrix: "<<std::endl;
std::cin>>ma... | ALGO | 0.999756 | 3.297916 |
c7705295-500f-47de-9341-eb4f81ca7a5f | anjalim28/Leet-Code | October 2023/oct14.cpp | class Solution
{
public:
int solve(vector<int> &cost, vector<int> &time, int i, int bank, vector<vector<int>> &dp)
{
if (bank <= 0)
{
return 0;
}
if (i >= cost.size())
{
return 1e9;
}
if (dp[i][bank] != -1)
{
ret... | ALGO | 0.999221 | 5.263141 |
a2b7d6a4-1bba-4c1d-b8d2-430419632ce8 | Saurabhn16/CP-dsa | DAA LAB/lab3/q1-c-21bcs138lab3-que1.cpp | // QUICK SORT
#include <bits/stdc++.h>
using namespace std;
void swap(int *a, int *b)
{
int t = *a;
*a = *b;
*b = t;
}
int partition(int arr[], int low, int high)
{
int pivot = arr[high]; // pivot
int i = (low - 1);
for (int j = low; j <= high - 1; j++)
{
if (arr[j] < pivot)
... | ALGO | 0.999852 | 5.632118 |
5e8f9b44-7cbd-44c8-971c-3aa539657e2a | leecr97/mpm | include/eigen/doc/examples/Tutorial_simple_example_fixed_size.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
int main()
{
Matrix3f m3;
m3 << 1, 2, 3, 4, 5, 6, 7, 8, 9;
Matrix4f m4 = Matrix4f::Identity();
Vector4i v4(1, 2, 3, 4);
std::cout << "m3\n" << m3 << "\nm4:\n"
<< m4 << "\nv4:\n" << v4 << std::endl;
}
| ALGO | 0.987115 | 3.129515 |
c54fdff4-6ce1-424a-a38c-3b06dbf66fe5 | Katty020/-CrackYourInternship | sort inrotated.cpp | class Solution {
public:
int search(vector<int>& nums, int target) {
int s=0;
int e=nums.size()-1;
while(s<e){
int m=(s+e)/2;
if(nums[m]==target) return m;
if(nums[0]<=target && nums[0]>nums[m]) e=m-1;
else if(nums[0] > target && nums[m]>= nums... | ALGO | 0.999863 | 6.192296 |
fcddb7c0-d3a4-4a12-968c-6f615993e2ab | Anmolkumar2002/DSA | cube_sum_recursion.cpp | #include <iostream>
using namespace std;
int sumofSeries(int N)
{
if(N <= 1)
{
return N;
}
return (N * N * N) + sumofSeries(N - 1);
}
int main()
{
int n;
cout << "Enter the number : ";
cin >> n;
int sum = sumofSeries(n);
cout << "Sum : " << sum;
return 0;
} | ALGO | 0.999949 | 4.301954 |
96d44381-0f8e-40aa-81d1-86eb0408ee32 | LANSGANBS/MyCppCode_Vscode | Codeforces/Codeforces Round 997 (Div. 2)/A_Shape_Perimeter.cpp | #include <bits/stdc++.h>
// #include <bits/extc++.h>
using namespace std;
// using namespace __gnu_pbds;
#define endl '\n'
#define ture true
#define flase false
#define pow power
#define all(x) begin(x), end(x)
#define mem(a, x) memset(a, x, sizeof(a))
#define gcd(a, b) gcdint(a, b)
#define lcm(a, b) (a / gcd(a, b) * b... | ALGO | 0.999913 | 4.990139 |
b0be564d-c482-4b45-902e-31cf785bf1e6 | xiaok365/poj | 1201/main.cpp | #include <iostream>
using namespace std;
#define MAX_N 50010
#define INF 0x7fffffff
struct Edge {
int to, value, next;
Edge() {}
Edge(int t, int v, int n) : to(t), value(v), next(n) {}
};
template<typename T>
struct Queue {
static const int MAX_QUEUE_LEN = 50010;
int head, tail;
T data[MAX... | ALGO | 0.999514 | 3.951799 |
62709041-1dac-489d-a988-7c4e8134e42a | tr0j4n034/All-about-trees | Segment tree/Solutions/SPOJ:SANTA1.cpp | /*
O(N * log(N) + Q * log^2(N)) solution with segment trees.
Values are compressed to eliminate extra log() factor.
*/
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <functional>
#include <vector>
#include <queue>
#inclu... | ALGO | 0.99249 | 3.894637 |
4045051d-e81c-4000-a87a-2f990a61d379 | Damcy/LeetCode | Kth_Largest_Element_in_an_Array.cpp | // author: Ian
// create on: 2017-08-17
// email: <EMAIL>
// description: Kth Largest Element in an Array
class Solution {
public:
int findKthLargest(vector<int>& nums, int k) {
int left = 0;
int right = nums.size() - 1;
if (k > nums.size() || k <= 0) {
return INT_MAX;
}... | ALGO | 0.999986 | 5.20552 |
76e8b5bb-45a0-49c7-8db2-13de4892c486 | bhushangawde/Leetcode-Solutions | 124_binary_tree_max_path_sum.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.999992 | 6.499435 |
ab4e17e9-6ef9-4040-aec7-758ec0e509c1 | projectchrono/chrono | src/chrono/multicore_math/vec3.cpp | #include "chrono/multicore_math/simd.h"
#include "chrono/multicore_math/types.h"
#if defined(USE_SSE)
#include "chrono/multicore_math/simd_sse.h"
#elif defined(USE_AVX)
#include "chrono/multicore_math/simd_avx.h"
#else
#include "chrono/multicore_math/simd_non.h"
#endif
namespace chrono {
vec3 operator-(c... | TOOL | 0.885039 | 6.768085 |
e21893f6-d069-4e89-ae65-5521ed73f7ca | abhinalla003/DSA_Programs | bst.cpp | //Implement Binary Search Tree. Define functions like traversal, searching.
//Created on: 14-03-2023
//Created by 22CP319
#include<iostream>
using namespace std;
class bst {
int info;
bst *right;
bst *left;
public:
bst() {}
bst(int val) {
info=val;
right=left=NULL;
}
void ins... | ALGO | 0.999967 | 5.020849 |
de12ea28-f292-4237-b408-30b10bd65ef6 | zsimpson/sdkpub | opencv/tests/cv/src/aemd.cpp | #include "cvtest.h"
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <float.h>
static char* funcs[] =
{
"cvCalcEMD",
};
static char *test_desc = "Test for EMD on concrete example";
/*////////////////////// emd_test /////////////////////////*/
typedef struct matr_info
{
float* x_origin;... | ALGO | 0.996449 | 4.857077 |
d68b6e8a-1fdc-46cc-8eaa-e311ae33d22a | millaker/MiGPU-llvm-project | llvm/lib/CodeGen/MachineLoopInfo.cpp | #include "llvm/CodeGen/MachineLoopInfo.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/Config/llvm-config.h"
#include "llvm/InitializePasses.h"
#include "llvm/Pass.h"
#incl... | TOOL | 0.955213 | 7.830752 |
af2796e7-756e-4cef-b7c2-90273012c804 | xdccash/xdcash-core | src/miner.cpp | #include "miner.h"
#include "amount.h"
#include "hash.h"
#include "main.h"
#include "masternode-sync.h"
#include "net.h"
#include "pow.h"
#include "primitives/block.h"
#include "primitives/transaction.h"
#include "timedata.h"
#include "util.h"
#include "utilmoneystr.h"
#ifdef ENABLE_WALLET
#include "wallet.h"
#endif
#... | ALGO | 0.998789 | 4.87094 |
1b39120d-d26a-4fa6-ad53-f719d151001b | ZaField/Object_Oriented_Program | Assigment1_Abstraction/FP/rectangle.cpp | #include <iostream>
using namespace std;
struct Rectangle {
double length;
double width;
};
double area(const Rectangle &r) {
return r.length * r.width;
}
int main() {
Rectangle rect = {4, 5};
cout << "Rectangle Area: " << area(rect) << endl;
return 0;
}
| TOOL | 0.949242 | 4.975192 |
4f186a3d-4512-4168-a38e-928120b1ad4b | yungchii/llvm-project | clang-tools-extra/include-cleaner/tool/IncludeCleaner.cpp | #include "AnalysisInternal.h"
#include "clang-include-cleaner/Analysis.h"
#include "clang-include-cleaner/Record.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Frontend/FrontendAction.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Tooling/CommonOptionsParser.h"
#include "clang/Tooling/Tooling.h... | TOOL | 0.914993 | 7.525415 |
5c16aaec-6361-4e6b-b236-9a47e909fc9a | st107034/programming-c-2022-autumn | Kontrolnaya_2-2022.12.12/newProject2/Source.cpp | #include <iostream>
void h(int n, int a, int b)
{
if (n > 0)
{
int c = 6 - a - b;
if (((a == 1) && (b == 2)) || ((a == 2) && (b == 3)) || ((a == 3) && (b == 1)))
{
h(n - 1, a, c);
std::cout << n << " " << a << " " << b << std::endl;
h(n - 1, c, b);
}
else
{
h(n - 1, a, b);
std::cout << n ... | ALGO | 0.999928 | 4.005675 |
4b7ae7f7-f9a4-4ec4-8c07-747fd6a29b91 | jnegrite/Competitive-Programming | Chapter 2/2.2/kattis/mali.cpp | #include<cstdio>
#include<cmath>
using namespace std;
long numRounds{};
int a, b;
long countsA[101] {};
long countsB[101] {};
int main(){
scanf("%ld\n",&numRounds);
for(long i=0;i<numRounds;i++){
scanf("%d %d\n",&a,&b);
countsA[a]++;
countsB[b]++;
long countsA2[101] {};
... | ALGO | 0.999919 | 3.587652 |
9f834524-0bad-40c6-ae67-00d35c3155d1 | paul2705/OI | noip/mb/has.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<map>
#include<string>
using namespace std;
const int MAXN=1e4+5;
map<string,bool> mp;
string s;
int n;
int main(){
scanf("%d",&n);
int ans=n;
for (int i=1;i<=n;i++){
cin>>s;
if (mp[s]) ans--;
mp[s]=1;
}
printf("%d\n",ans);
re... | ALGO | 0.999835 | 3.527536 |
c7bfd9b5-0242-4a82-ad7b-fadf9247c7f7 | GoatGirl98/Walkthrough-of-ACCoding-in-BUAA | 2018级-软件学院-算法分析与设计/E0-算法第0次练习赛-数据结构复习/BUAAOJ2369 优先队列.cpp | #include<cstdio>
#include<cstdlib>
#include<queue>
#include<algorithm>
#define maxn 100010
#define debug 0
using namespace std;
struct movie {
int time;
int happy;
}movies[maxn];
bool compare(movie a, movie b) {
if (a.happy != b.happy)return a.happy > b.happy;
else return a.time > b.time;
}
unsigned i... | ALGO | 0.999268 | 3.746313 |
f970c56c-0773-42b8-a9f8-65ae4785e007 | etnk125/POSN-second-camp | Day15/t4.cpp | #include<iostream>
using namespace std;
main()
{
int i, key, j , n, count=0;
cin>>n;
int arr[n];
for(i=0;i<n;i++)
cin>>arr[i];
for (i = 1; i < n; i++)
{
key = arr[i];
j = i-1;
if(arr[j]<=key)count++;
else
{
while (j >= 0 && arr[j] > key)
{
count+... | ALGO | 0.999949 | 3.698158 |
9e3d0e87-f15e-4556-a90d-ec4deca87967 | Johannyjm/c-pro | AtCoder/othercontests/old/bitterAlchemy2.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int N;
float X;
cin >> N >> X;
vector<int> m(110);
for(int i = 0; i < N; ++i) {
cin >> m[i];
}
X -= accumulate(m.begin(), m.end());
int res = N;
res += X / min(m.begin(), m.end())
cout << res << endl;
} | ALGO | 0.99962 | 3.625323 |
6afe53a0-09b8-48f8-b2d4-b7643f128d39 | chirag74/leetcode | 378-kth-smallest-element-in-a-sorted-matrix/378-kth-smallest-element-in-a-sorted-matrix.cpp | class Solution {
public:
int kthSmallest(vector<vector<int>>& matrix, int k) {
vector<int> z;
for(int i=0;i<matrix.size();i++){
for(int j=0;j<matrix[i].size();j++){
z.push_back(matrix[i][j]);
}
}
sort(z.begin(),z.end());
return z[k-1];
... | ALGO | 0.999989 | 5.633219 |
eac8fe2e-2eec-4c0c-b2ea-46900f8487ce | mistershashanksingh/Basic-Practice-Project | CPP/basic prog/basics/array.cpp | #include<iostream>
using namespace std;
int main(int argc, char const *argv[])
{
/*code of an array*/
// array is data structure type in cpp
int array[11];
// This is how we can create an array in cpp
cout<<"\nEnter 10 digit phone no. to get into an array:";
for (int i = 0; i... | ALGO | 0.951674 | 3.407781 |
005df01d-bd03-4323-9ddf-e0447409959b | ananthkumarmv/Coding-problems | codeforces/Watermelon.cpp | #include<iostream>
using namespace std;
int main() {
int s;
cin >> s;
if(s % 2 == 0 && s > 2) cout << "YES" << endl;
else cout << "NO" << endl;
return 0;
}
| ALGO | 0.99953 | 3.571003 |
998b276a-46cd-48a9-bba6-da4b9b7fc59c | SinceTodayL/CodingPractice | cf_round994/C.cpp | #include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ll;
ll a[210][420];
ll dp[210][210][210];
ll ans[210][210];
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
ll t;
cin >> t;
ll n, m, k;
while(t--){
cin >> n >> m >> k;
for(int i = 0; i < n; ++i){
for(int j = 0; j < m; ++j){
... | ALGO | 0.999932 | 3.444984 |
30700705-c675-43ad-a9ea-61d75db4268d | pokerjest/TINA | rujia/习题/ch5/la2531.cpp | // LA2531/UVa1306 The K-League
// Rujia Liu
#include<cstdio>
#include<cstring>
#include<queue>
#include<vector>
#include<algorithm>
using namespace std;
const int maxn = 700;
const int INF = 1000000000;
struct Edge {
int from, to, cap, flow;
};
bool operator < (const Edge& a, const Edge& b) {
return a.from < b.f... | ALGO | 0.999941 | 3.544042 |
9cbb9029-48eb-4a98-8b83-b73af2f11ac0 | styro2000/RasPreenFM2 | midipal/note_stack.cpp | // 2014 : Modified by Xavier Hosxe for PreenFM2
#include "midipal/note_stack.h"
static const uint8_t kFreeSlot = 0xff;
void NoteStack::NoteOn(uint8_t note, uint8_t velocity) {
// Remove the note from the list first (in case it is already here).
NoteOff(note);
// In case of saturation, remove the least recently pl... | ALGO | 0.979059 | 6.108967 |
e746dc9a-d371-4bc1-a3ba-713cc89d8845 | ljshou/workspace | topcoder/src/651-2/FoxAndSouvenirTheNext.cpp | #include <cstdlib>
#include <cctype>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <fstream>
#include <numeric>
#include <iomanip>
#include <bi... | ALGO | 0.994971 | 4.205379 |
fb970b72-4ade-4b29-b871-0245b28c8366 | kizkdaisuki/template_cpp | string/kizk_hash.cpp | struct kizk_hash{
int n;
string str;
vector<int> p, h;
vector<int> p1, h1;
int Mod = 1e9 + 7;
int P = 13331;
int P1 = 1333331;
int Mod1 = 998244353;
kizk_hash(int _n, string _str) : n(_n), str(' ' + _str){ init();}
kizk_hash(string _str) : n(_str.size()), str(' ' + _str) {init()... | ALGO | 0.99996 | 4.963573 |
94fafd93-33d4-4afb-8d5f-256cc8969822 | Haribala-09/hyprdots | User/History/21944713/7QXC.cpp | #include <bits/stdc++.h>
using namespace std;
#define rev(ans) reverse(ans.begin(), ans.end())
#define mems(a, n) memset(a, n, sizeof(a))
#define pb push_back
#define fst first
#define scd second
#define int long long
using pii = pair<int, int>;
using pci = pair<char, int>;
void dbg_out() { cerr << endl; }
template ... | ALGO | 0.99948 | 5.107049 |
22283456-aec3-40b0-9b8d-a14690d1ab0b | namngduc/algonote | leetcode/26.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
vector<int> removeDuplicates(vector<int>& nums) {
int l = 0, r = 0;
cout << "Size: " << nums.size() - 1 << endl;
int res = 1;
while (r < nums.size()-1) {
while (r < nums.size()-1 && nums[r] == nums[r+... | ALGO | 0.999949 | 5.497834 |
8112a969-cd5f-487e-a5cb-8379447482b0 | yash304109/binarysearch | java/c/c++ stl/vector3.cpp | #include<bits/stdc++.h>
using namespace std;
void print(vector<int> &v){
cout<<"size"<<" "<<v.size()<<endl;
for (int i = 0; i < v.size(); i++)
{
cout<<v[i]<<" ";
/* code */
}
v.push_back(2);
cout<<endl;
}
int main()
{
vector<int> v(10,3);//v(10)
v.push_back(5);
... | ALGO | 0.854704 | 3.593675 |
1f329c54-c6dc-4daa-bed9-a8cd4df1d6b3 | irmikrys/cpp-exam | code/ListyBezSTL/Lista_Macierzy_Ewa_Stachów.cpp | #include <iostream>
#include <cstdlib>
#include <stdio.h>
using namespace std;
class Macierz
{
private:
int rozmiar;
int **ptr;
public:
Macierz();
Macierz(int);
Macierz(const Macierz & m);
~Macierz();
Macierz & operator=(const Macierz & m);
Macie... | ALGO | 0.95068 | 3.549642 |
0467a7d9-6c8f-4813-9048-c41e70a7d8e5 | VectorsMaster/cp_templates | data structures/segment trees/sum_kth.cpp | #include<bits/stdc++.h>
#define LL long long
using namespace std;
struct SegTreeSum {
vector<LL> seg;
int MAX;
SegTreeSum(const int mx) {
MAX=mx;
seg.assign(4*MAX+10,0);
}
void add_val(int pos,int add,int cur,int st,int en) {
if(st==en) {
seg[cur]+=add;
... | ALGO | 0.99846 | 4.046363 |
8fefa4fe-e29d-4508-be25-d2de3f908f50 | AkifAzwad/cp_repo | academy/E - Ada and Spring Cleaning.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 1e6 + 9;
const int p1 = 137, mod1 = 1e9 + 7, p2 = 277, mod2 = 1e9 + 9;
int n, m;
int power(long long n, long long k, int mod) {
int ans = 1 % mod; n %= mod; if (n < 0) n += mod;
while (k) {
if (k & 1) ans = (long long) ans * n % mod;
n = (long long) n *... | ALGO | 0.999814 | 5.075145 |
e30f92c2-636a-4232-8478-32f1ae062081 | COMP215/_jondunnett | EXAM01/mushroom_analyzer.cpp | #include "mushroom_analyzer.h"
#include <stdio.h>
#include <iostream>
#include <math.h>
bag::bag(float capacity)
{
capacity_ = capacity;
capacity_left_ = capacity;
current_load_ = 0;
total_value_ = 0;
hmrMushrooms = 0;
}
bool bag::add_mushroom(mushroom y)
{
if (!fabs(capacity_left_ - 0) < 0.001)
{
mushroom t... | ALGO | 0.955193 | 4.531411 |
80f3372e-0a76-4631-8079-85fcf8d547ac | u-wyh/luogu-code | P6902.cpp | #include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e6+5;
const int LIMIT = 21;
int power;
int ans;
int stjump[MAXN << 1][LIMIT];
int n, m;
struct flag{
int num,s,e;//ʾ ʼ λ
}line[MAXN<<1];
inline int read(){
int x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-')
... | ALGO | 0.999985 | 3.592328 |
dbfe06d0-be90-4ade-9f02-d650adc04f87 | mohosy/CS8_Data_Structures | PCC Class Assignments/cs8_lab15_problem1/problem1.cpp | #include <iostream>
#include <algorithm>
using namespace std;
void heapify(int arr[], int i){
int parent = (i - 1) / 2;
if (parent >= 0 && arr[i] > arr[parent]) {
swap(arr[i], arr[parent]);
heapify(arr, parent);
}
}
void printArray(int arr[], int size){
for (int i = 0; i < size; i++) ... | ALGO | 0.999875 | 4.875571 |
77e93812-659e-451d-8a86-6e615973a181 | zhengzhu14/FAL | juez/59_examen/main59.cpp | #include <iostream>
#include <vector>
using namespace std;
using tMatriz = std::vector<std::vector<int>>;
using tPareja = pair <bool, int>;
tPareja equilibrado(int iniC, int finC,int iniF, int finF,tMatriz const& m) {
if (iniC >= finC && iniF >= finF) {
if (m[iniF][iniC] == 1) return { true, 1 };
else return { t... | ALGO | 0.999949 | 5.330426 |
672f8449-e4b8-492e-9798-63770ff55369 | ABHISHEKBANKAWAT/Prarambh | LinkedList/addtwoNumbers.cpp | ListNode *reverse(ListNode *head)
{
ListNode *current = head, *prev = NULL, *next = NULL;
while (curr != NULL)
{
next = curr->next;
current->next = prev;
prev = curr;
current = nextt;
}
head = prev;
return head;
}
ListNode * addtwo(ListNode * first,ListNode *second)
{
if(length(first)<len... | ALGO | 0.999518 | 4.428557 |
dec5c882-c79a-42f7-abcc-a9944d9f88f1 | PerfectLifeG/Algorithm-Competition | PracticeMakesPerfect/2023Winter/1.20/t4.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
double xa,xb,ya,yb;
cin>>xa>>ya>>xb>>yb;
if(yb<ya){
swap(ya,yb);
swap(xa,xb);
}
double x=1.0*(xa+xb)/2;
double y=1.0*(ya+yb)/2;
if(xa==xb){
double ansx=xa+fabs(ya-yb)/2;
if(y-(int)y>0||ansx-(int)ansx>0){... | ALGO | 0.999983 | 4.213034 |
7f8d23cb-8eda-4d6a-9914-b56f06950079 | Ixox/preenfm3 | firmware/Src/hardware/TftAlgo.cpp | #include "stm32h7xx_hal.h"
#include "TftAlgo.h"
#include "Common.h"
#define RGB565_WHITE 0xffff
#define RGB565_RED 0x00f8
#define RGB565_BLUE 0x1f00
#define RGB565_GREEN 0xe007
#define RGB565_ORANGE 0x00fc
#define RGB565_YELLOW 0xe0ff
#define RGB565_CYAN 0xff07
#define RGB565_PURPLE 0xBFE0
const uint8_t digitBits[] =... | ALGO | 0.997152 | 4.211696 |
b0fcb233-11f8-4780-ad91-7ef2a78925cf | e2crawfo/seq_lda | seq_lda/_seq_lda/markov_lda.cpp | #include "markov_lda.hpp"
void MarkovLDA::allocate_storage(const Corpus& corpus){
LDA::allocate_storage(corpus);
n_symbols = corpus.n_symbols;
opt_words = OptWords(corpus.dictionary);
log_init.resize(n_topics, vector<double>(n_symbols, 0.0));
log_halt.resize(n_topics, vector<double>(n_symbols, 0... | ALGO | 0.995396 | 6.518291 |
0eb214a4-6d49-461e-ade1-107a82dee8c0 | tous33f/LeetCode | 189-rotate-array/rotate-array.cpp | class Solution {
public:
void rotate(vector<int>& nums, int k) {
k=k%nums.size();
int t;
for(int i=0,j=nums.size()-1;i<(nums.size())/2;i++,j--){
t=nums[i];
nums[i]=nums[j];
nums[j]=t;
}
for(int i=0,j=k-1;i<k/2;i++,j--){
t=nums[i... | ALGO | 0.999995 | 5.777377 |
20104682-b9d7-43f2-b73c-ca3684a166d3 | rhzx3519/leetcode | c++/389. Find the Difference.cpp | class Solution {
public:
char findTheDifference(string s, string t) {
int dp[26] = {0};
for (auto c : s)
dp[c - 'a']++;
for (auto c: t)
dp[c - 'a']--;
for (int i = 0; i < 26; i++) {
if (dp[i] == -1)
return ('a' + i);
... | ALGO | 0.999915 | 6.176543 |
ee8d1ad8-bf70-47d2-be89-31d868ca1be0 | NilFoundation/zkllvm-circifier | libcxx/test/std/algorithms/alg.modifying.operations/alg.copy/ranges.copy.pass.cpp | // <algorithm>
// UNSUPPORTED: c++03, c++11, c++14, c++17
// template<input_iterator I, sentinel_for<I> S, weakly_incrementable O>
// requires indirectly_copyable<I, O>
// constexpr ranges::copy_result<I, O> ranges::copy(I first, S last, O result);
// template<input_range R, weakly_incrementable O>
// requires ... | TEST | 0.966249 | 7.598444 |
a48843a3-a611-4349-ad3a-b62e02b29552 | X-czh/Algorithms-LeetCode | 000-099/057-Insert-Interval.cpp | // Greedy
// Time complexity: O(n).
// Space complexity: O(n) to keep the output.
class Solution {
public:
vector<vector<int>> insert(vector<vector<int>>& intervals, vector<int>& newInterval) {
vector<vector<int>> res;
int lo = newInterval[0];
int hi = newInterval[1];
// sp... | ALGO | 0.999989 | 6.430363 |
e9591292-cf65-47a1-a81f-f6fd67aa1e08 | lavinia0724/Algorithm-Codes | UVA-OneStar-Collection-Codes/Content/UVA00439_Knight_Moves.cpp | #include<bits/stdc++.h>
using namespace std;
// 2021.09.14
char letter1, letter2;
int letter_start, digit_start, letter_end, digit_end;
int letter_now, digit_now, letter_next, digit_next;
int chess[10000+5][2], step[10][10];
bool visited[8][8];
int row[8] = { 1, 2, 2, 1, -1, -2, -2, -1 };
int column[8] = { 2, 1, -1,... | ALGO | 0.999772 | 4.755091 |
de1ea99d-ec29-4fae-af0f-a0b45e2f691f | avniamitkumar/CODING-PLATFORM-PRACTICE | unique_binary_search_trees2.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.999899 | 6.00459 |
27e25b40-1da9-4562-a686-e3a30a3cf0ea | muhammad-sayem/Codeforces | A_Rating_Increase.cpp | #include<bits/stdc++.h>
#define nl '\n'
#define yes (cout << "YES\n")
#define no (cout << "NO\n")
#define yy (cout << "Yes\n")
#define nn (cout << "No\n")
#define ll long long
#define pb push_bac... | ALGO | 0.999866 | 4.308229 |
7ec9c2fb-66de-405c-9eb7-5e207fa13136 | hakulamtta/HIT-C-language-review | exp5_4银行利率.cpp | #include <iostream>
#include <stdio.h>
#include <string.h>
#include <math.h>
using namespace std;
#define EPS = 1e-1
//ϰ5.4
//Ϣ뱾
int main(){
float base;//
int n;//
float res;
cout << "뱾" <<endl;
cin >> base >> n;
if (n <= 1)
res = pow(1+0.0225,n) * base;
else if (n <= 2)
... | ALGO | 0.998976 | 3.565348 |
2187acdd-2144-40a9-b5bd-d242a76b7db5 | yipu3/algorithm-practice | CDOJ/SA/张奕普2012060010005/C/C_iiip.cpp | #include<algorithm>
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<climits>
#include<sstream>
#include<vector>
#include<cstdio>
#include<string>
#include<stack>
#include<queue>
#include<cmath>
#include<map>
#include<set>
#define MAXN 17
typedef long long ll;
using namespace std;
int n,m;
char maze[MA... | ALGO | 0.999889 | 3.259175 |
6c923624-7194-4fcd-8593-1d0b60ade7b6 | qhb1001/For-that-dream | Online Contest/Nowcoder/qhb/F.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <vector>
using namespace std;
const int MAX = 1e5 + 5;
typedef long long ll;
ll a[MAX], ans, pre[MAX];
int main() {
pre[1] = 1;
for(int i = 2; i < MAX; ++i) pre[i] = pre[i - 1] + i;
// freopen("input", "r", stdin);
// freopen("output.... | ALGO | 0.999953 | 3.252023 |
2db89bba-cfdd-4232-a554-8f7e84918de1 | ldct/cp | codeforces/615/B/B.cpp | #include <iostream>
#include <vector>
#include <map>
using namespace std;
int N, M;
map<int, vector<int> > neighbours;
map<int, int> size;
map<int, long long> memoMaxDecreasing;
long long maxDecreasing(int n) {
// maximum length of decreasing sequence starting at n
if (memoMaxDecreasing.find(n) != memoMaxDecreas... | ALGO | 0.99978 | 4.133581 |
580d12a3-def3-4f8b-ba2f-c2b822025374 | johnmastroberti/project-euler-cpp | src/p14.cpp | #include "common.hpp"
u64 collatz_step(u64 n) {
if (n % 2)
return 3 * n + 1;
else
return n / 2;
}
void p14() {
// setup
u64 bound = 1'000'000ull;
std::vector<u64> collatz_lengths;
collatz_lengths.reserve(bound + 1);
collatz_lengths.push_back(0); // n=0
collatz_lengths.push_back(0); // n=1
... | ALGO | 0.999358 | 5.964229 |
a9cf5910-4671-4b02-b539-36b6f001506b | Alejandrehl/wouf-test-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.998733 | 6.76775 |
a7e03313-619a-48a4-91b0-bf2f69027e27 | kowusek/PSZT-P | src/gen_algorithm.cpp | #include "gen_algorithm.hpp"
gen_algorithm::gen_algorithm() = default;
gen_algorithm::~gen_algorithm() = default;
gen_algorithm::gen_algorithm(unsigned p_size, float m_probability, float c_probability, unsigned t, unsigned length_of_vector, unsigned iter_count)
{
population_size = p_size;
mutation_probabili... | ALGO | 0.999964 | 5.467717 |
f708170b-62bf-4a22-88ed-0144a291afbf | gianlucaromeo/flutter-pro | flutter_pro/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.998758 | 6.776823 |
ae795d35-d7a2-4819-9d20-7750903ca7fd | BayRanger/sensor_fusion | 08-graph-optimization/src/lidar_localization/src/models/graph_optimizer/g2o/g2o_graph_optimizer.cpp | /*
* @Description:
* @Author: Ren Qian
* @Date: 2020-03-01 18:07:42
*/
#include "lidar_localization/models/graph_optimizer/g2o/g2o_graph_optimizer.hpp"
#include "glog/logging.h"
#include "lidar_localization/tools/tic_toc.hpp"
#include <ostream>
namespace lidar_localization {
G2oGraphOptimizer::G2oGraphOptimizer... | ALGO | 0.996845 | 5.472569 |
c501c196-69ea-4060-95be-12f79ae84b87 | CarolinaMoura/oi | CEOI/2020/spring.cpp | /*
CEOI 2020 - Spring Cleaning
*/
/* Virtual tree solution to Spring Cleaning
* Let's root the tree at 1
* Each edge has a color, which is 1, if the subtree of the lower vertex is even, and 0, if it's odd
* The answer should be sum_of_colors + N-1
* I must know for each vertex the sum_of_colors in its path to the r... | ALGO | 0.999704 | 4.639511 |
e612cad6-48dc-4e69-b315-26d2c94e5813 | YousefSameh25/LeetCode | 2095-delete-the-middle-node-of-a-linked-list/2095-delete-the-middle-node-of-a-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* deleteMiddl... | ALGO | 0.999846 | 5.79939 |
52a1457a-b8ae-4242-ab7f-72e041713f6e | dhkim0821/DynaCoRE | ExternalSource/Optimizer/snopt/examples/cppexamples/catmixa.cpp | #include <stdio.h>
#include <string.h>
#include <iostream>
#include <math.h>
#include "snoptProblem.hpp"
using namespace std;
void usrFG(int *Status, int *n, double x[],
int *needF, int *lenF, double F[],
int *needG, int *lenG, double G[],
char *cu, int *lencu,
int iu[], i... | ALGO | 0.999983 | 5.40489 |
5d06d8e3-6c1f-48cb-a4ac-d5e98125a622 | Fobertree/CSES_Practice | Archived/Introductory Problems/Two_Sets.cpp | #include <iostream>
#include <vector>
using namespace std;
#define PRINT(x) (cout << x << endl)
typedef long long ll;
int main() {
ll n;
cin >> n;
// (n+1)n / 2 -> MOD 4
if (((n+1) * n) % 4 != 0) {
PRINT("NO");
return 0;
}
PRINT("YES");
vector<int> a,b; a.reserve(n); b... | ALGO | 0.999922 | 3.860071 |
654da376-c70a-4d41-9e08-a248734cbcb6 | Pioooooo/aoc | 2023/20-2.cpp | #include <bits/stdc++.h>
using namespace std;
struct mod {
char type;
int reg = 0;
map<string, int> input;
vector<string> output;
};
int main() {
ifstream fin("in");
int sum = 0;
string line;
map<string, mod> config;
string aggre;
while (getline(fin, line)) {
stringstre... | ALGO | 0.999584 | 3.964868 |
a8757d1c-5690-4eac-8e08-edd960086cc9 | TheWildWestBoy03/Elemente-de-grafica-pe-calculator | Tema2/Building.cpp | #pragma once
#include <iostream>
#include <vector>
#include <utility>
#include <cstdlib>
#include "lab_m1/Tema2/Building.h"
#include <random>
void Building::InitBuilding() {
this->heightModulus = 10;
this->widthModulus = 5;
this->lengthModulus = 2;
this->length = 2 + rand() % this->lengthModulus;
this->width =... | TOOL | 0.872731 | 4.037227 |
317bcb38-fe43-4b6c-b1d4-f8330491e92a | Ahmad10Raza/DSA-Practices | Array/CPP/RearrangeAlternativePosNeg.cpp |
#include <bits/stdc++.h>
using namespace std;
void rearrange(int arr[], int n)
{
int i = -1, j = n;
while (i < j)
{
while(i <= n - 1 and arr[i] > 0)
i += 1;
while (j >= 0 and arr[j] < 0)
j -= 1;
if (i < j)
swap(arr[i], arr[j]);
}
if (i == 0 || i == n)
return;
int k = 0;
while (k < n && i < ... | ALGO | 0.999972 | 4.978423 |
aaf70c63-8ec7-460f-901b-9613bc2783f6 | Rahul-Kumar-Parida/400-DSA_Practice_ACCENTURE | TechieCodeBuddy50/Q36.cpp | #include <iostream>
#include <climits>
using namespace std;
int main()
{
int n, totalsum;
cin >> n >> totalsum;
int arr[n];
for (int i = 0; i < n; i++)
{
cin >> arr[i];
}
if (n < 2)
{
cout << -1 << endl;
return 0;
}
int first = INT_MAX;
int second = IN... | ALGO | 0.999945 | 4.208216 |
a270b758-2ce3-4d30-960e-95dfb6989f3f | Bagr1d/Some-Random-Cpp-Algorithms | 2021.cpp | #include <iostream>
#include <fstream>
using namespace std;
fstream plik;
struct g{
string kraj = "";
string miasto = "";
int x[70]={0};
int y[70]={0};
};
g galerie[50];
void otworzPlik(){
plik.open("galerie.txt", ios::in);
for(int i=0;i<50;i++) {
plik>>galerie[i].kraj;
plik>>galerie[i].miasto;
for(int j=... | TOOL | 0.896348 | 3.178999 |
b7511777-02f4-472b-95b1-6153e5461fed | williamjchen/terminalchess | stockfish/stockfish-normal/src/pawns.cpp | #include <algorithm>
#include <cassert>
#include "bitboard.h"
#include "pawns.h"
#include "position.h"
#include "thread.h"
namespace Stockfish {
namespace {
#define V Value
#define S(mg, eg) make_score(mg, eg)
// Pawn penalties
constexpr Score Backward = S( 6, 19);
constexpr Score Doubled = S(... | ALGO | 0.99977 | 7.52159 |
711ead85-cb48-4970-af9e-152453c8a637 | ChayanMallick13/DSA-LOVE-BABBAR | LECTURE - 97/kruskals_Algo.cpp | /*
https://www.naukri.com/code360/problems/minimum-spanning-tree_631769?topList=love-babbar-dsa-sheet-problems&leftPanelTab=0&leftPanelTabValue=PROBLEM
*/
#include <algorithm>
// hamara khud ka likha huya comparator (Our custom comparator)
bool cmp(vector<int> &a, vector<int> &b) {
return (a[2] < b[2]);
}
... | ALGO | 0.999792 | 5.565033 |
be8f8f5b-d9c4-43af-a018-709790e9e2a4 | ishandutta2007/codeforces | doped.silicon/normal/1290/B.cpp | // clang-format off
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#ifndef bhartiya
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
// #pragma GCC target ("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,... | ALGO | 0.999952 | 4.807583 |
80af0227-d733-41de-88d4-6173b621680a | tommympg00/obligatorio-a2 | ejercicio8.cpp | #include <cstdlib>
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
// Pablo Tomás Martínez 241532, Amar Premchand 247766
struct NodoLista
{
int dato;
NodoLista *sig;
NodoLista() : dato(0), sig(NULL) {}
NodoLista(int d) : dato(d), sig(NULL) {}
};
struct _cabezalGrafo
{
... | ALGO | 0.99987 | 3.966449 |
fc2fb2e2-f114-4caf-8f80-83a23b9c8a31 | Haroonhaji/DSA-Implementation | Graphs/Minimum Spanning Tree/Prims Algorithm.cpp | #include <bits/stdc++.h>
using namespace std;
//Function to find sum of weights of edges of the Minimum Spanning Tree.
int spanningTree(int V, vector<vector<int>> adj[])
{
priority_queue<pair<int, int>,
vector<pair<int, int> >, greater<pair<int, int>>> pq;
vector<int> vis(V, 0);
// {wt, node}
pq.push({0, 0});
... | ALGO | 0.99996 | 4.898617 |
ef2fd47b-45ce-41f6-95af-a131bb5b2b91 | harsh-govind/codes-leetcode | 0733-flood-fill/0733-flood-fill.cpp | class Solution {
public:
void solve(vector<vector<int>> &image, int row, int col, int newColor, int originalColor)
{
image[row][col]=newColor;
int m=image.size(), n=image[0].size();
int r[]={-1, 0, +1, 0}, c[]={0, +1, 0, -1};
for(int i=0; i<4; i++)
{
... | ALGO | 0.998067 | 6.483975 |
47a998a7-71f5-453b-86f1-21227f8217f0 | Kira-1937/repo-for-codeforces-contests | 1747B.cpp | #pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
typedef pair<double,double> pd... | ALGO | 0.99984 | 3.838257 |
0b64f449-e3b9-488f-b677-453da35c1662 | Aleena-Mishra-10/Data-Structure | String/Wildcard string matching.cpp | #include <bits/stdc++.h>
using namespace std;
bool match(char *first, char *second)
{
// If we reach at the end of both strings, we are done
if (*first == '\0' && *second == '\0')
return true;
// Make sure that the characters after '*' are present
// in second string. This function ass... | ALGO | 0.999905 | 3.763136 |
1b38480c-6434-434e-bab6-ae6aa87f4425 | fishpj/leetcode | RotateList.cpp | /*
* Filename: RotateList.cpp
* Author: fishpj
* Date: 09/05/2014
*/
#include "leetCode.h"
class Solution
{
public:
ListNode *rotateRight(ListNode *head, int k)
{
//对head为空或者只有一个节点时的处理
if (nullptr == head || nullptr == head->next)
return head;
//由于该题存在k大于链表长度时由取模处理
ListNode *p1 = head, *p2... | ALGO | 0.999951 | 5.190394 |
6a7799e0-3daa-4ceb-826c-5d12c0c07bbb | Boberty2033/BigDecimal | big_decimal.cpp | #include "big_decimal.h"
#include <sstream>
#include <algorithm>
int LongNumber::precision = 8; // Значение по умолчанию
LongNumber::LongNumber() : value("0") {}
LongNumber::LongNumber(const std::string& binary) : value(binary) {}
LongNumber::LongNumber(const LongNumber& other) : value(other.value) {}
LongNumber::... | TOOL | 0.996405 | 4.802881 |
6ab2bbf2-7959-4d40-bd7c-3dc3053d1bde | pinshuai/pflotran-bitbucket | src/mdt/MAD.cpp | #include "MAD.h"
#ifndef MAX
#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
#endif
#ifndef MIN
#define MIN(X,Y) ((X) < (Y) ? (X) : (Y))
#endif
MAD::MAD(Grid **grid_) {
ifc_polygon = NULL;
river_polygon = NULL;
ascii_grids = NULL;
spp_polygon = NULL;
PetscReal mx = 1.;
PetscReal my = 1.;
PetscReal mz = 1.;
... | ALGO | 0.984193 | 5.190412 |
d1459763-7070-436d-895d-0792ab0b2cc4 | PerfectPan/LeetCode | solution/144/sol1.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.999981 | 6.526608 |
f91be047-6b37-4328-9d3c-b03e4bad3f43 | GreFort/LR3 | Задание 5-1/Задание 5-1.cpp | #include <iostream>
#include <math.h>
using namespace std;
int findFirstNegativeElement(double eps)
{
int i;
double count = 0;
for (i = 0; ; i++)
{
count = pow(-1, i) * (1 - (pow(i + 1, 2) / pow(i + 2, 2)));
if (abs(count) < eps && count < 0)
{
return i + 1;
}
}
}
void main()
{
double eps;
cout << "E... | ALGO | 0.999896 | 3.239813 |
a12cfb11-21c0-44f5-9ed2-c73ab8b3dd61 | deepakkk05/DSA | Reversearray.cpp | #include<bits/stdc++.h>
using namespace std;
void revArr(int a[],int n)
{
if(n==0)
{
return;
}
cout<<a[n-1]<<endl;
revArr(a,(n-1));
}
int main(){
int a[] = {1,2,3,34,5,8,3,6};
int n = sizeof(a)/sizeof(a[0]);
revArr(a,n);
} | ALGO | 0.998691 | 4.070624 |
49a3de8c-7807-4390-8592-4f895e0f287f | Rexx0801/codeptit_c_cpp | uocsochiahetcho2.cpp | #include<iostream>
#include<math.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int n;
cin>>n;
int dem=0;
for(int i=1;i<sqrt(n);i++){
if(n%i==0){
if(i%2==0){
dem++;
}
if((n/i)%2==0 && i!=(n/i)){
dem++;
}
}
}
cout<<dem<<endl;
}... | ALGO | 0.999217 | 5.112802 |
d22fd6bd-27ec-4a81-b853-53934601e2f6 | NMRanaHamid/Problem_Solving | Personal/A_Twins.cpp | #include<bits/stdc++.h>
#define fori(i,s,n) for(i=s; i<n; i++)
using namespace std ;
int main()
{
int n,i,a=0,b=0,ans=0,sum=0;
cin>>n;
int ar[n];
fori(i,0,n) { cin>>ar[i]; sum+=ar[i];}
sort(ar,ar+n);
// cout<<sum<<endl;
for(int i=n-1; i>=0; i--)
{
a+=ar[i];
sum-=ar[i];
... | ALGO | 0.999953 | 3.606309 |
da0f332b-5b19-403a-838c-02bf6eaf6d5d | stytim/AzureKinect-ToolTracker | extern/eigen/src/doc/examples/Tutorial_ArrayClass_interop_matrix.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXf m(2,2);
MatrixXf n(2,2);
MatrixXf result(2,2);
m << 1,2,
3,4;
n << 5,6,
7,8;
result = m * n;
cout << "-- Matrix m*n: --" << endl << result << endl << endl;
result = m.array() * ... | ALGO | 0.996925 | 4.317396 |
482df0c9-ca57-4c45-9b1c-a1adadc6fbc2 | Vamshi-29/LeetcodeAdventure | 0053-maximum-subarray/0053-maximum-subarray.cpp | class Solution {
public:
int maxSubArray(vector<int>& nums) {
int sum=0;
int maxsum=0;
for(int i=0;i<nums.size();i++)
{
sum=sum+nums[i];
maxsum=max(maxsum,sum);
if(sum<0)
sum=0;
}
return maxsum;
}
}; | ALGO | 0.999966 | 6.014096 |
8cda404a-2cf2-4438-8cfd-764124e75931 | Ansh718/LeetCode | 2024/July 24/07-07-24.cpp | class Solution
{
public:
int numWaterBottles(int numBottles, int numExchange)
{
int answer = 0;
answer = numBottles;
while (numBottles >= numExchange)
{
int temp = numBottles / numExchange;
answer += temp;
numBottles = numBottles % numExchange ... | ALGO | 0.999788 | 5.338657 |
422602e1-fc49-4e26-87c6-278d62937e09 | makslevental/llvm-unison | lib/CodeGen/LiveRangeEdit.cpp | #include "llvm/CodeGen/LiveRangeEdit.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/CodeGen/CalcSpillWeights.h"
#include "llvm/CodeGen/LiveIntervals.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/VirtRegMap.h"
#include "llvm/Support/Debug.h"
#include... | TOOL | 0.925883 | 7.850304 |
84e24b0a-6b06-4e6b-b1a5-254c043df218 | ishandutta2007/codeforces | qiuzx/normal/1333/B.cpp | #include <bits/stdc++.h>
#define INF 1000000000
#define LINF 1000000000000000000
#define MOD 1000000007
#define mod 1000007
#define INF63 1061109567
#define INF127 9187201950435737471
#define UINF 18446744073709551615
#define F first
#define S second
#define ll long long
#define N 100010
using namespace std;
ll n,a[N],... | ALGO | 0.999958 | 3.25229 |
c173dc86-63fa-42af-b369-23777a952098 | FritzAsephRuaro/PLD007Cpe11S1 | Hands-on 4.2 Array_Activity 1.cpp | #include <iostream>
using namespace std;
int main() {
int arr[] = {19, 3, 15, 7, 11, 9, 13, 5, 17, 1};
int size = sizeof(arr) / sizeof(arr[0]);
cout << "Element\tValue\tHistogram" << endl;
for (int i = 0; i < size; i++) {
cout << i << "\t" << arr[i] << "\t";
for (int j = 0; j < arr[i]... | ALGO | 0.997936 | 3.91572 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.