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 |
|---|---|---|---|---|---|---|
eb2e8b80-e49d-47b8-9cba-f265f394859f | anik-ewu/C-O-N-T-E-S-T | 1.Codeforces/Codeforces Round #790 (Div. 4)/FF.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e9;
#define read(x) freopen("in.txt","r",stdin);
#define write(x) freopen("out.txt","w",stdout);
#define what_is(x) cerr<<#x<<" is "<<x<<"\n";
#define Fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0)... | ALGO | 0.999985 | 3.968307 |
6e43f428-78c3-4266-b202-b52891cefb02 | ShubSingh164/codeforces_codes | 1977A.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
int n, m;
cin>>n>>m;
if (n>=m){
int diff = n-m;
if(diff%2 == 0) cout<< "YES"<<endl;
else cout<< "NO"<<endl;
}else{
cout<<"NO"<<endl;
}
}
return 0;
}
| ALGO | 0.999887 | 4.472097 |
b470aad3-5471-40a6-8fdd-16d5124d54b3 | rdstihz/Learning-and-Coding | src/2021多校/HDU/2/1008.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 150000 + 100;
map<string, int> id;
string s;
int main() {
ios::sync_with_stdio(false);
int T;
cin >> T;
while (T--) {
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> s;
id[s] = i;
... | ALGO | 0.998643 | 4.254551 |
bb23b9fe-26a6-46ee-91d8-c3b533b793f6 | LukeMorrissey777/kimera | catkin_ws/src/gtsam/examples/ImuFactorsExample2.cpp | /**
* @file ImuFactorExample2
* @brief Test example for using GTSAM ImuFactor and ImuCombinedFactor with ISAM2.
* @author Robert Truax
*/
#include <gtsam/geometry/PinholeCamera.h>
#include <gtsam/geometry/Cal3_S2.h>
#include <gtsam/inference/Symbol.h>
#include <gtsam/navigation/ImuBias.h>
#include <gtsam/navigatio... | TEST | 0.979011 | 3.330774 |
b6175c2d-5cf4-4fce-ae4a-fcf89b0ab2eb | 2261819266/Code | OI/others/NTSG/study/KMP/KMP.cpp | #include <cstdio>
#include <cstring>
int *getNext(int *next, const char *format, int n) {
next[0] = 0;
for (int i = 1, j = 0; i <= n; i++) {
while (j && format[i] != format[j]) {
j = next[j - 1];
}
if (format[i] == format[j]) {
next[i] = ++j;
}
}
return next;
}
void print(const int *data, int n) {
... | ALGO | 0.999834 | 3.787323 |
0961c077-6fe8-4a1d-9093-6bf0b148ab86 | maxiv05/prueba | zinjal/Fundamentos de programación/Extras/Ejercicios parciales/Parcial 2/Ejercicios resueltos/Final 1- Ejercicio 2.cpp | #include <iostream>
#include <vector>
#include <matrix>
using namespace std;
int main() {
int habitantes;
cin>>habitantes;
vector<string>candidatos(9);
for(size_t i=0;i<candidatos.size();i++) {
cin>>candidatos[i];
}
matrix<int> elecciones(15,9,0);
int total=0;
for(int i=0;i<232;i++) {
int codigo;... | ALGO | 0.999835 | 4.160899 |
12bc4542-ffe0-4ec6-84c5-956a2b1fce27 | makio93/competitive-othersites | LeetCode/Contest/WC/251/Q1/main.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
int calc(int val) {
int res = 0;
while (val > 0) {
res += val % 10;
val /= 10;
}
return res;
}
public:
int getLucky(string s, int k) {
int n = s.length();
int res = 0;
... | ALGO | 0.999766 | 5.253141 |
c8304022-5729-428a-8906-f05d5ad5978c | fengzi2023/leetcode | path_sum_iii.cpp | // https://leetcode.com/problems/path-sum-iii/discuss/
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* struct TreeNode *left;
* struct TreeNode *right;
* };
*/
void path_sum(struct TreeNode* root,int sum,int *count) {
if (root == NULL) {
return;
}
i... | ALGO | 0.999792 | 6.070424 |
efb924a0-074d-4a48-a7d8-44d98cec1021 | ishandutta2007/codeforces | sergeifedorov/normal/161/D.cpp | #include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <ctime>
#include <cstring>
#include <cassert>
#include <sstream>
using namespace std;
#define forn(i, n) for(int i = 0; i < (int)(n); i++)
#define ford(i, n) for(int i... | ALGO | 0.999964 | 4.167334 |
f7fe83a3-14c6-4814-98d8-d0496a6344e1 | sakibul-shovon/CP-Contest- | Contest 3/f.cpp | // File Name: f.cpp
// Date: 2023-07-21
// Time: 00:29:26
#include <bits/stdc++.h>
using namespace std;
int main(){
int t; cin>>t;
int total = 0;
while(t--)
{
string s; cin>>s;
if(s == "donate")
{
int x; cin>>x;
total = total + x;
}
... | ALGO | 0.997256 | 4.872303 |
9846e616-b4cc-4aa7-a570-e90f55870ce9 | sheikhhossainn/Algorithms | Greedy/activitySelection.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
struct Activity
{
int start, end;
};
bool compareActivity(Activity a, Activity b)
{
return a.end < b.end;
}
int activitySelection(vector<Activity> &activities, int n)
{
sort(activities.begin(), activities.end(), compareActivi... | ALGO | 0.999891 | 5.412469 |
aeb7c1a6-056c-4c12-a791-dcf5bca93798 | kiyoony/dovelet | change.cpp | #include <stdio.h>
int main()
{
int n;
scanf("%d", &n);
n = 1000 - n;
printf("%d %d %d", n / 100, (n % 100) / 50, ((n % 100)%50) / 10);
return 0;
} | ALGO | 0.990785 | 3.172701 |
c7490242-8249-4ec5-96a6-4ab15c6b3234 | xodn348/main | c_btop/prog9/prog9.6.cpp | /* Program 9.6 Calculating factorials using recursion */
#include <stdio.h>
unsigned long factorial(unsigned long);
int main(void)
{
unsigned long number = 0L;
printf("\nEnter an integer value: ");
scanf(" %lu", &number);
printf("\nThe factorial of %lu is %lu\n", number, factorial(number));
return... | ALGO | 0.999881 | 6.383745 |
0e6485c5-751b-4f56-bf60-2e96018c1915 | NVlabs/Parsimony-CGO23 | apps/synet-simd/src/Simd/SimdNeonYuvToHue.cpp | #include "Simd/SimdMemory.h"
#include "Simd/SimdStore.h"
#include "Simd/SimdConversion.h"
#include "Simd/SimdLog.h"
namespace Simd
{
#ifdef SIMD_NEON_ENABLE
namespace Neon
{
SIMD_INLINE int32x4_t MulDiv(const int32x4_t & dividend, const int32x4_t & divisor, const float32x4_t & KF_255_DIV_6)
... | ALGO | 0.963508 | 4.954277 |
5ab49421-b0a2-495d-88c2-5b1a3870327b | GeckoProjectMN/GeckoProject | src/rpc/blockchain.cpp | #include "rpc/blockchain.h"
#include "amount.h"
#include "chain.h"
#include "chainparams.h"
#include "checkpoints.h"
#include "coins.h"
#include "core_io.h"
#include "consensus/validation.h"
#include "validation.h"
#include "core_io.h"
// #include "index/txindex.h"
#include "policy/feerate.h"
#include "policy/policy.h... | WEB | 0.882865 | 6.119105 |
ef71a8da-5005-455e-a2f2-068a695a6069 | ishandutta2007/codeforces | emthrm/normal/1682/C.cpp | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr double EPS = 1e-8;
constex... | ALGO | 0.999908 | 5.221284 |
cb675e26-1eb2-410e-94c1-fade04162e08 | moxSedai/comp-sci | 2430/Lectures/Lecture3/main.cpp | #include <iostream>
using namespace std;
\
struct Point{
int x;
int y;
Point *next;
};
class list{
private:
Point *head;
public:
list(){head=0;}
bool isempty(){if (head == 0)
return true;
else return false;}
void add_beg(int,int); //add one point
//v... | ALGO | 0.996543 | 4.30578 |
a094f3e5-8b0f-4cec-b918-ec69f43d4e79 | Anonymous82338590/AdaptiveDynamicArray | src/HeaderFiles/ADAnolimit.cpp | #include "ADAnolimit.h"
NodeForDAnolimit::NodeForDAnolimit(int capacity, int numkeys, NodeForDAnolimit * parent) {
NumOfKeys = numkeys;
Parent = parent;
Pointers = new NodeForDAnolimit *[capacity];
Keys = new int[capacity];
Next = nullptr;
//Previous = nullptr;
IsLeaf = false;
}
DAnolimit ... | ALGO | 0.998662 | 3.804425 |
23374df0-9447-4836-89f7-ae056bb160bf | pshpsh76/GC-for-C | src/gc_impl.cpp | #include "gc_impl.h"
#include "gc.h"
#include "gc_fwd.h"
#include "stealing_queue.h"
#include <algorithm>
#include <cstdint>
#include <cstdlib>
#include <mutex>
#include <thread>
#include <vector>
uintptr_t Aligned(uintptr_t ptr) {
return ptr + (kAlignment - ptr % kAlignment) % kAlignment;
}
static uintptr_t GetM... | TOOL | 0.873341 | 6.879792 |
b4178068-035e-4691-8c91-8b28f78588c7 | Torng030/CPE_49 | 10252 - Common Permutation/10252 - Common Permutation.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
string s1,s2;
while(getline(cin,s1))
{
getline(cin,s2);
int a[130]={},b[130]={};
for(int i=0;i<s1.size();i++)
a[s1[i]]++;
for(int i=0;i<s2.size();i++)
b[s2[i]]++;
... | ALGO | 0.999964 | 3.620245 |
d5b6d9f3-a019-42a3-8c1b-41012d6a0f67 | ANA-CNU/ANA-Daily-Algorithm | 이수민/15681.cpp | #include <bits/stdc++.h>
using namespace std;
int n,r,q,u,v;
vector<int> vec[100001];
int check[100001];
int dp[100001];
int dfs(int index) {
if(dp[index]) return dp[index];
if(check[index]) return 0;
check[index] = 1;
int sum = 0;
for(int i=0; i<vec[index].size(); i++) {
sum += dfs(vec[ind... | ALGO | 0.999862 | 4.187252 |
396e430a-9930-4251-b55f-db8702de030b | loic-issanchou/CarND-Path-Planning-Project | src/Eigen-3.3/doc/special_examples/Tutorial_sparse_example_details.cpp | #include <Eigen/Sparse>
#include <vector>
#include <QImage>
typedef Eigen::SparseMatrix<double> SpMat; // declares a column-major sparse matrix type of double
typedef Eigen::Triplet<double> T;
void insertCoefficient(int id, int i, int j, double w, std::vector<T>& coeffs,
Eigen::VectorXd& b, con... | ALGO | 0.997284 | 5.388735 |
9ca57fbd-e20f-48ea-8546-c5e3fe426f8c | marioyc/Online-Judge-Solutions | UVA/Contest Volumes/11907 - Collision of Bacteria.cpp | #include <cstdio>
#include <cmath>
#include <algorithm>
using namespace std;
int N;
double X[50][2],Y[50][2];
double calc_dist(){
double ret = 20000,x1,y1,x2,y2;
for(int i = 0;i<N;++i) for(int j = i+1;j<N;++j){
x1 = max(X[i][0],X[j][0]); x2 = min(X[i][1],X[j][1]);
y1 = max(Y[i][0],Y[j][0... | ALGO | 0.999631 | 3.741215 |
5e36e1d9-c65a-4e77-8a73-f2ccc550bd4a | ishandutta2007/codeforces | irkstepanov/normal/1657/D.cpp | #include <bits/stdc++.h>
#define all(a) (a).begin(), (a).end()
#define sz(a) (int)(a).size()
#define pb push_back
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<long long, long long> pll;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
/... | ALGO | 0.999948 | 3.548625 |
eb299d83-b9ca-4ad2-b253-2b4a2e793af4 | sarvex/leetcode-tcsh | solution/0900-0999/0950.Reveal Cards In Increasing Order/Solution.cpp | class Solution {
public:
vector<int> deckRevealedIncreasing(vector<int>& deck) {
sort(deck.rbegin(), deck.rend());
deque<int> q;
for (int v : deck) {
if (!q.empty()) {
q.push_front(q.back());
q.pop_back();
}
q.push_front(v);... | ALGO | 0.999995 | 6.284242 |
d4ae0506-75e9-434f-89a2-711f0403ed73 | SilvioGiancola/VisualInertialKinectFusion | pcl/tools/gp3_surface.cpp | #include <pcl/io/pcd_io.h>
#include <pcl/io/vtk_io.h>
#include <pcl/console/print.h>
#include <pcl/console/parse.h>
#include <pcl/console/time.h>
#include <pcl/surface/gp3.h>
using namespace pcl;
using namespace pcl::io;
using namespace pcl::console;
double default_mu = 0.0;
double default_radius = 0.0;
void
printHe... | TOOL | 0.967332 | 7.133985 |
dab57b04-29c1-4dfa-a9d7-b117c30d4c7c | mezbahDev/Codeforces | Codeforces/1520A. Do Not Be Distracted.cpp | #include<iostream>
using namespace std;
bool isSuspicious(const string& s){
for(size_t i = 0; i <s.length(); ++i){
for(size_t j = i+1; j < s.length(); ++j){
if(s[j] == s[i] && s[j-1]!=s[j]){
return true;
}
}
}
return false;
}
int main(){
int t;
... | ALGO | 0.999884 | 4.499675 |
1923af23-26f5-405e-84d4-c4ae12ed149e | Orang123/ACMAlgorithmExercises | 数据结构/并查集/POJ 2236 Wireless Network.cpp | #include<stdio.h>//鼯
struct post
{
int x,y;
};
int a[1002];
bool distance(int x1,int y1,int x2,int y2,int d)//жϾ
{
if((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)<=d*d)
return true;
else return false;
}
//ʹʽϲֻʹ·ѹʱ临ӶO(ElogV) O(mlogn) ҪصѧƵ֤
int set_union(int x)//ͨϵ
{
int anc=x;
while(a[anc]!=anc)//,Ҳɲõݹ,ݹ... | ALGO | 0.999456 | 3.820244 |
39b42927-02d3-480f-828b-c8013d36ed1a | MikamiTetsuro365/Atcoder | ABC059/C.cpp | #include "bits/stdc++.h"
using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;
typedef pair<pair<ll, ll >, ll > pii;
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
int main(){
ll N;
cin >> N;
vector<ll > vec(N, 0);
for(ll i = 0; i < N; i++){
cin >> v... | ALGO | 0.999951 | 4.011822 |
51cfde46-6b18-44e1-8c9b-ec27e4b32bf2 | tumblery/PS | BOJ/1242.소풍/1242_sovled.cpp | #include<stdio.h>
int main() {
int N, M, K, cnt;
cnt = 1;
scanf("%d%d%d", &N, &M, &K);
for (int i = 1; i <= N; i++) {
int nextM = M % (N - i + 1) == 0 ? N - i + 1 : M % (N - i + 1);
if (K == nextM || i == N) {
cnt = i;
break;
}
else {
K = K > nextM ? K - nextM : N - i + 1 + K - nextM;
}
}
print... | ALGO | 0.999988 | 3.097427 |
5bd2ddd2-04a0-4952-8bc3-6bad394596f7 | Mrbobrowitz/android_frameworks_base_derp | media/libstagefright/codecs/m4v_h263/dec/src/get_pred_adv_b_add.cpp | /*
------------------------------------------------------------------------------
INPUT AND OUTPUT DEFINITIONS
Inputs:
xpos = x half-pixel of (x,y) coordinates within a VOP; motion
compensated coordinates; native type
ypos = y half-pixel of (x,y) coordinates within a VOP; motion
compens... | ALGO | 0.999913 | 6.153373 |
53329c53-56a9-41b2-b850-adfa8d9eae6e | ishandutta2007/codeforces | pinkrabbit/normal/1008/D.cpp | //23
#include<bits/stdc++.h>
using namespace std;
#define F(i,a,b) for(int i=a;i<=(b);++i)
#define ll long long
typedef pair<int,int> pii;
inline int Gcd(int X,int Y){return Y?Gcd(Y,X%Y):X;}
int n;
int inp[100001],p[100001],pc,g[100001],h[100001];
void init(){
inp[0]=inp[1]=1;
g[1]=1;
F(i,2,100000){
if(!inp[i]) ... | ALGO | 0.999876 | 4.538151 |
bcfda5c0-ad23-48b3-8de5-f874c4849728 | leo-drive/avte.autoware_universe | control/mpc_lateral_controller/src/mpc_lateral_controller.cpp | #include "mpc_lateral_controller/mpc_lateral_controller.hpp"
#include "motion_utils/motion_utils.hpp"
#include "tf2_ros/create_timer_ros.h"
#include <algorithm>
#include <deque>
#include <limits>
#include <memory>
#include <string>
#include <utility>
#include <vector>
namespace autoware::motion::control::mpc_lateral... | TOOL | 0.923251 | 6.81401 |
c513b7c5-5100-43b1-85ca-cfd54c140bfc | Nonbangkok/Competitive_Programming | Contest/Junior_Dev/C1.cpp | #include <bits/stdc++.h>
#define coutf(n, m) cout << fixed << setprecision(n) << m
#define forr(i, a, n) for (int i = a; i < n; i++)
#define forl(i, a, n) for (int i = a; i > n; i--)
#define macos ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define endll "\n"
#define sp " "
typedef long long ll;
typedef unsigned lon... | ALGO | 0.99974 | 4.160601 |
9d4b8ce1-046b-4352-a36b-4691d26501f7 | hasansahin7/FL-Panora-3 | Marlin/src/lcd/menu/menu_bed_corners.cpp | //
// Level Bed Corners menu
//
#include "../../inc/MarlinConfigPre.h"
#if BOTH(HAS_MARLINUI_MENU, LCD_BED_TRAMMING)
#include "menu_item.h"
#include "../../module/motion.h"
#include "../../module/planner.h"
#if HAS_LEVELING
#include "../../feature/bedlevel/bedlevel.h"
#endif
#ifndef BED_TRAMMING_Z_HOP
#define ... | TOOL | 0.933911 | 5.563521 |
08fae2f8-5095-415d-872f-cd1f573be580 | AlekseyKravchuk/cpp | Yandex_Practicum/sprint_05/15_find_starts_with_in_case_whole_string.cpp | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
using namespace std;
template <typename RandomIt>
pair<RandomIt, RandomIt> FindStartsWith(RandomIt beginIt, RandomIt endIt, string prefix) {
// get the equivalent of std::equal_range for arbitraty prefix length
auto lowerBound = std:... | ALGO | 0.998064 | 4.964318 |
a7172997-98fb-422e-a7eb-2413c9800955 | avarshvir/LeetCode_Problems | 1480_Running_Sum_of_1D_Array/1480_running_sum_of_1d_array.cpp | #include<vector>
#include<iostream>
class Solution {
public:
vector<int> runningSum(vector<int>& nums) {
vector<int> result(nums.size()); // Create a result vector of the same size as nums
int currentSum = 0; // Initialize the cumulative sum to 0
for (int i = 0; i < nums.size(); ++i) {
... | ALGO | 0.999925 | 6.541794 |
52a80c81-2f47-4212-8efb-df49a99c8412 | ranjan0346/leetcode | Union of two arrays - GFG/union-of-two-arrays.cpp | // { Driver Code Starts
//Initial template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template in C++
class Solution{
public:
//Function to return the count of number of elements in union of two arrays.
int doUnion(int a[], int n, int b[], int m) {
... | ALGO | 0.99964 | 5.767382 |
252e97c4-b832-4aea-a28b-01260b00917b | akbtech17/dsa | Other/Nagarro Bootcamp/34-Lecture-Queue/2-ImplementationCQueueList.cpp | // 2-ImplementationCQueueList.cpp
#include<bits/stdc++.h>
using namespace std;
class ListNode {
public:
int val;
ListNode *next;
ListNode(int val) {
this->val = val;
this->next = NULL;
}
};
void insertAtTail(ListNode *&f, ListNode *&e, int val) {
ListNode *newnode = new ListNode(val);
if(!f) {
f = newnod... | ALGO | 0.988509 | 4.359601 |
af933de0-64f9-4b3d-ae31-22381d3bdb0e | lieahau/Online-Judge-Solution | Codeforces/1005C_Summarize to the Power of Two.cpp | /*
People who don't work hard
don't have the right
to be envious of the people with talent.
People fail because
they don't understand
the hard work necessary to be successful.
*/
#include <bits/stdc++.h>
using namespace std;
const int MAX = 120007;
int arr[MAX], pangkat[100], n, ans;
int bin... | ALGO | 0.999817 | 4.045084 |
47545843-6b0f-4365-908b-5e9e18238bf5 | sahilkadiyan/my_leetcode_gfg | 1578-minimum-time-to-make-rope-colorful/1578-minimum-time-to-make-rope-colorful.cpp | class Solution {
public:
int minCost(string colors, vector<int>& neededTime) {
int mx = neededTime[0];
int res = 0, cursum = neededTime[0];
for (int i=1;i<colors.size();i++){
if (colors[i]==colors[i-1]){
cursum += neededTime[i];
mx = max(mx , need... | ALGO | 0.999661 | 6.241117 |
6799f4dd-47d6-406e-a22e-fd56b07d05ca | werdnac92/harris-matching | sw/seam/backup_files/test_rotationmatchingworking.cpp | //#include "top.h"
#include "opencv_top.h"
#include "/opt/xilinx/Vivado_HLS/2013.2/include/hls_opencv.h"
#include "/opt/xilinx/Vivado_HLS/2013.2/include/hls_video.h"
#include <algorithm>
#include <iostream>
#include <vector>
#include <stdio.h>
#include "opencv2/core/core.hpp"
#include "opencv2/features2d/features2d.h... | ALGO | 0.991686 | 4.120907 |
a98a9c0b-6e3c-41fb-a268-555c2680f5bc | AK-Elshamy/LeetCode | Day 0014/Solution.cpp | #include <vector>
using namespace std;
class Solution
{
public:
vector<int> findEvenNumbers(vector<int> &digits)
{
// Count frequency of input digits
vector<int> digitFreq(10, 0);
for (int digit : digits)
{
digitFreq[digit]++;
}
// Vector to store va... | ALGO | 0.999958 | 6.288342 |
24917dd0-57da-4620-86e6-187a3b3644ed | aaronjen/FreezeCasting_GPU | eigen/doc/examples/class_FixedBlock.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
template<typename Derived>
Eigen::Block<Derived, 2, 2>
topLeft2x2Corner(MatrixBase<Derived>& m)
{
return Eigen::Block<Derived, 2, 2>(m.derived(), 0, 0);
}
template<typename Derived>
const Eigen::Block<const Derived, 2, 2>
topLeft2... | TOOL | 0.878996 | 6.64346 |
9e199ed3-f4d9-4827-abdb-d62b175ee377 | abdelhakim96/ROS_UNav-Sim | bluerov2_trajectory/scripts/bluerov2_pipe_following/bluerov_mpc/ACADOtoolkit/examples/multi_objective/plug_flow_reactor_ws.cpp | /**
* \file examples/multi_objective/plug_flow_reactor_ws.cpp
* \author Filip Logist, Boris Houska, Hans Joachim Ferreau
* \date 2009
*
* \ Weighted Sum for jacketed plug flow reactor with conflicting conversion and energy cost
* \ J = (1-W)*J1+W*J2 Weighted Sum
* \ J1 = Cin*(... | ALGO | 0.999731 | 5.380975 |
06cb44f6-c4db-4a16-a167-7801fe51d3fb | dhanashreeg368/DSA-Practice-Questions | 0002-add-two-numbers/0002-add-two-numbers.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* addTwoNumbe... | ALGO | 0.999931 | 6.420574 |
c0ad1b94-966b-45fd-a4ea-b853f9cb4717 | adryells/ymedu | just_do/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.998819 | 6.797273 |
b0a3c7b2-5cb2-45b9-b4ed-95c2b66acf7c | arvind-crate-7/Compatative-Coding | 38 Addition of two Binary Number.cpp | #include<bits/stdc++.h>
using namespace std;
string addBinary(string a, string b) {
string ans ;
int carry = 0;
int i = a.size() - 1;
int j = b.size() - 1;
while(carry || i >= 0 || j >= 0){
if(i >= 0){
carry = carry + a[i--] - '0';
}
if(j >= 0){
carry... | ALGO | 0.999958 | 5.704169 |
51cb974f-d7ef-4036-bc5b-58f19a994771 | ishandutta2007/codeforces | ra16bit/normal/513/D2.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int n,m,num,x,y,i,last,r[1000010];
vector<int> g[1000010][2];
char s[111];
bool q=true;
void dfs(int x) {
int i=++last;
if (g[i][0].size()) {
sort(g[i][0].begin(),g[i][0].end());
if (g[i][0][0]<=last) { q=false; return; }
dfs(... | ALGO | 0.999959 | 3.927916 |
65a5c230-96b9-4c64-93b8-f3ae000489f6 | heechan3006/CS | BOJ/BOJ_2933/Project1/소스.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cstring>
#include <queue>
#define MAXN 101
using namespace std;
char map[MAXN][MAXN];
bool visited[MAXN][MAXN];
int N, M;
int K;
int num[MAXN];
int dx[] = { -1,0,0,1 };
int dy[] = { 0,-1,1,0 };
int max_v = 0;
vector<pair<int, int> > cluster;
bool flag;
void... | ALGO | 0.999876 | 3.871248 |
bd878123-a0b1-49b2-94b3-b4b3f66aa781 | rtdev-com/cloud-renderer-project | ext/nanogui/ext/eigen/bench/sparse_product.cpp |
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.05 -DSIZE=2000 && ./a.out
// -DNOGMM -DNOMTL -DCSPARSE
// -I /home/gael/Coding/LinearAlgebr... | ALGO | 0.995187 | 4.164869 |
5830183e-9642-4838-add5-ba5f8ad1218e | gopoma/competitive-programming | tasks/1994A.cpp | //* sometimes pragmas don't work, if so, just comment it!
//? #pragma GCC optimize ("Ofast")
//? #pragma GCC target ("avx,avx2")
//! #pragma GCC optimize ("trapv")
//! #undef _GLIBCXX_DEBUG //? for Stress Testing
#include <bits/stdc++.h> //? if you don't want IntelliSense
using namespace std;
// building blocks
usi... | ALGO | 0.999881 | 4.301055 |
4ca93d59-f646-4885-a0c3-3c6dd6c9ae7f | Naman-72/CS204-DSA-LAB | Submission/PRACTICE_1/200101070.cpp | #include <iostream>
using namespace std;
class Array
{
public:
Array();
Array(int);
Array(int,int);
void mergeSortIterative(int n);
void mergeSort(int left,int right);
void mergeBoth(int left,int right,int middle);
void selectionSort();
void insertionSort();
void selectionSortUnstab... | ALGO | 0.999915 | 4.859284 |
429328d0-7616-4909-b37b-f489685f4424 | valina354/Source-Revitalize2.0-OLD | src/tier1/qsort_s.cpp | /******************************************************************/
/* qsort.c -- Non-Recursive ANSI Quicksort function */
/* */
/* Public domain by Raymond Gardner, Englewood CO February 1991 */
/* ... | ALGO | 0.999994 | 6.614483 |
b559daf4-cf19-4e26-a53a-4cdf47da9420 | phrock/acm | topcoder/sources/Quilting.cpp | #include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstr... | ALGO | 0.994031 | 4.654667 |
0f787dd6-9a90-465a-ac28-23c0a7dc3012 | thegamer1907/Code_Analysis | Codes/AC/956.cpp | #include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1024000000,1024000000")
#define mem(a,b) memset((a),(b),sizeof(a))
#define MP make_pair
#define pb push_back
#define fi first
#define se second
#define sz(x) (int)x.size()
#define all(x) x.begin(),x.end()
using namespace std;
#define _GLIBCXX_PERMIT_BAC... | ALGO | 0.999979 | 3.802548 |
6dc5529d-f996-4b14-ab59-17fe5e85e55c | anon-iiswc24/LLMServingSim | astra-sim/extern/network_backend/garnet/gem5_astra/src/systemc/tests/systemc/misc/cae_test/general/control/loop/while_fsm/while_fsm.cpp | /*****************************************************************************
while_fsm.cpp --
Original Author: Rocco Jonack, Synopsys, Inc., 1999-07-29
*****************************************************************************/
/****************************************************************************... | ALGO | 0.9683 | 3.489752 |
a4d37dff-f815-438b-bfb5-7fd7b70cf6fb | ocfbnj/Exercises | luogu/P2404.cpp | #include <iostream>
#include <vector>
void f(int b, int n, std::vector<int> v) {
for (int i = b; i <= n / 2; i++) {
std::vector<int> temp = v;
temp.pop_back();
temp.push_back(i);
temp.push_back(n - i);
f(i, n - i, std::move(temp));
}
if (v.size() != 1) {
for (size_t i = 0; i < v.size(); i++) {
if (... | ALGO | 0.999928 | 4.616646 |
0bb7b540-819f-4258-b837-74a38e3e7ecd | GaurishIIITNR/CP-Problems-III | PSO.cpp | #include<bits/stdc++.h>
using namespace std;
const int populationSize = 3; // Number of particles
const int dimN = 2; // Number of dimensions
const int mxItr = 5; // Maximum number of itrs
const double w = 0.9; // Inertia weight
const double c1 = 1.5; // correction coefficients
c... | ALGO | 0.999994 | 4.835385 |
39cb2b39-1dc0-4276-bd49-55a07617287c | NehaMittal1616/Leetcode-and-GeeksForGeeks | 2603-reward-top-k-students/2603-reward-top-k-students.cpp | class Solution {
public:
vector<int> topStudents(vector<string>& positive_feedback, vector<string>& negative_feedback, vector<string>& report, vector<int>& student_id, int k) {
int n=report.size();
unordered_set<string>positive;
unordered_set<string>negative;
positive.insert( positive_feedback.begin(), ... | ALGO | 0.999926 | 5.56583 |
1ba50969-6ba9-4284-87b8-e6d974db090f | grollcake/pacman | 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.998693 | 6.797273 |
2f7051d5-4f65-4e7d-bbbd-19cda1c3ba27 | sendoru/ps-cpp-new | source/boj/2573.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
using namespace std;
void bfs(vector<vector<int> >& v, vector<vector<bool> >& check, int r, int c)
{
int rSize = v.size();
int cSize = v[0].size();
vector<int> dr = { -1, 1, 0, 0 };
vector<int> dc = { 0, 0, -1, 1 };
if (check[r][c] || v... | ALGO | 0.999902 | 4.48005 |
e08fd142-eaca-4d07-9c3d-1063da88f82c | kaloronahuang/KaloronaCodebase | Practices/Luogu/P3846.cpp | // P3846.cpp
#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll p, a, b;
ll quick_power(ll base, ll tim)
{
ll tmp = 1;
while (tim)
{
if (tim & 1)
tmp = tmp * base % p;
base = base * base % p;
tim >>= 1;
}
return tmp;
}
map<ll, ll> hashTable;
int... | ALGO | 0.99999 | 3.992617 |
16769ddd-2da4-4ba8-ab02-7cd3912f23f7 | Rohan-2107/Placements | DAY 12 (Recursion)/replace_pi.cpp | #include<iostream>
using namespace std;
void replace(string s)
{
if(s.length() == 0)
{
return;
}
if(s[0] == 'p' && s[1] == 'i')
{
cout<<"3.14";
replace(s.substr(2));
}
else
{
cout<<s[0];
replace(s.substr(1));
}
}
int main()
{
replace("pi... | ALGO | 0.999527 | 3.325783 |
90cd4103-a6fe-4403-8027-df16050c5896 | mimakyuu/AtCoder | ABC/C213.cpp | #include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
//#define ACL
#ifdef ACL
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
#if __has_include("acl-all.h")
#include "acl-all.h" //on Wandbox
using namespace atcoder;
#endif
#endif //#ifdef ACL
typedef long... | ALGO | 0.999969 | 4.063469 |
a1f4c4f6-1bb3-4354-9c53-74955a681a76 | CTranLam/DSA-28tech | Sap xep & tim kiem/De quy/b16 cs min max.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll maxn(ll n){
if(n<10) return n;
else return max(maxn(n/10),n%10);
}
ll minn(ll n){
if(n<10) return n;
else return min(minn(n/10),n%10);
}
int main(){
ll n; cin >> n;
cout << maxn(n) <<" "<<minn(n) << endl;
}
| ALGO | 0.994806 | 4.065955 |
7178a286-4e6b-4fe5-9be7-1fbeb70e71b9 | ishandutta2007/codeforces | _su1sen/normal/1618/A.cpp | // #pragma comment(linker, "/stack:200000000")
#include <bits/stdc++.h>
#include <limits>
#include <type_traits>
namespace suisen {
// ! utility
template <typename ...Types>
using constraints_t = std::enable_if_t<std::conjunction_v<Types...>, std::nullptr_t>;
template <bool cond_v, typename Then, typename OrElse>
co... | ALGO | 0.999555 | 4.177789 |
d95594b7-4c75-4330-84a3-b28aeb5294d7 | Overstars/Practice | OJ/Codeforces/暴力/CF653 B. Bear and Compressing(DFS,字符串,1300).cpp | #include<bits/stdc++.h>
using namespace std;
vector<string> v[6];
map<string,bool> mp;
int ans=0;
void dfs(string s,int t)
{
if(s.length()==t)
{
if(!mp[s])
ans++,mp[s]=1;
return;
}
string tem;
// tem+=s[0];
// for(int i=0;i<s.length();i++)
// {
int p=s[0]-'a';
for(auto &j:v[p])
dfs(tem+j+s.substr(1),t... | ALGO | 0.99964 | 3.538019 |
9a1a112a-75b3-4c87-a2a6-fe01bf46a13a | shetkari03/LeetCode | 2792-neighboring-bitwise-xor/2792-neighboring-bitwise-xor.cpp | class Solution {
public:
bool doesValidArrayExist(vector<int>& derived) {
bool x = 0;
for(auto i:derived) x ^= i;
return !x;
}
}; | ALGO | 0.999126 | 5.633685 |
e3aca395-a037-4f70-961a-c35bbd11cac2 | ishandutta2007/codeforces | wygzgyw/normal/1046/C.cpp | #include <bits/stdc++.h>
using namespace std;
template <typename T> void read(T &t) {
t=0; char ch=getchar(); int f=1;
while ('0'>ch||ch>'9') { if (ch=='-') f=-1; ch=getchar(); }
do {(t*=10)+=ch-'0';ch=getchar();} while ('0'<=ch&&ch<='9'); t*=f;
}
const int maxn=(2e5)+10;
int n,m,a[maxn],b[maxn],pos,ans;
int main() ... | ALGO | 0.999981 | 3.416362 |
fc413173-4b4a-4aff-9df3-7f217803ea12 | AatirNadim/cpp-solutions | Counting/odd_numbers_in_range.cpp | // problem link --> https://leetcode.com/problems/count-odd-numbers-in-an-interval-range/
// my solution link --> https://leetcode.com/problems/count-odd-numbers-in-an-interval-range/discuss/3180001/C%2B%2B-oror-0ms-oror-2-line-oror-Short-and-Simple
class Solution {
public:
int countOdds(int low, int high) {
... | ALGO | 0.999972 | 5.62489 |
4563130b-d84a-403d-9f08-17d31582b422 | BdryBaptiste/test | Games/Othello/Othello.cpp | #include "Othello.h"
#include <iostream>
#include <sstream>
#include <time.h>
Othello::Othello(Display& display, Player* player1, Player* player2)
: Game(BOARD_SIZE, BOARD_SIZE, display) {
srand(static_cast<unsigned int>(time(NULL)));
currentPlayer = Symbol::PLAYER_BLACK;
this->player1.reset(player1);
... | ALGO | 0.94244 | 5.281884 |
228265c3-a279-41bf-b6f8-85df6a2fed88 | ShinYoungChan/Baekjoon | 프로그래머스/3/43164. 여행경로/여행경로.cpp | #include <string>
#include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;
unordered_map<string, vector<string>> um;
unordered_map<string, vector<bool>> check;
string str="Z";
int tsize = 0;
void dfs(string s, string st, int cnt){
if(cnt==tsize){
if(str>st)
str=st;... | ALGO | 0.998502 | 5.614632 |
74bb477d-3e6f-465e-b11f-e7c2d8bcfb31 | Ethan4582/Codeforces-solution | CODEFORCES/C-set/C_Alarm_Clocks_Everywhere.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
vector<long long> x(n), p(m);
for (int i = 0; i < n; ++i) {
cin >> x[i];
}
for (int i = 0; i < m; ++i) {
cin >> p[i];
}
long long g = x[1] - x[0];
for (int i = 2; i < n; ++i) {... | ALGO | 0.999957 | 3.89027 |
3601cca1-cbe1-42a9-9b37-90636f1f5ef1 | yukunqi/NiuKe | 第十二章_动态规划/LCS练习题/LCS.cpp | #include <iostream>
using namespace std;
const int N=300;
//dp[i][j]=k ַA[0...i-1]ַB[0...j-1]гΪk
int dp[N+1][N+1];
class LCS {
public:
int findLCS(string A, int n, string B, int m) {
int i,j;
int flag=0;
for(i=0;i<n;i++){//ʼһУַA[0...n-1]ַB0ַг
if(flag==1||A.at(i)==B.at(0)){//ڶӦλַȺһֱΪ1
dp[i][0... | ALGO | 0.999918 | 3.706414 |
6313152e-2480-4e67-93a2-a845454b242f | mahmoudnader150/tic_tac_toe_game | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
4d9d4026-f8c0-4fa0-b518-841beb1b38b2 | SaiKiranCode/CPLUSPLUSProblems | c++LabProblems/set5/q1.cpp | #include<iostream>
using namespace std;
class base
{
protected:
int i;
public:
virtual void display()
{
cout<<"inside base "<<endl;
cout<<"value of i is"<<i<<endl;
}
void set_value(int a)
{
i=a;
}
};
class derived1:virtual public base
{
public:
void display()
{
cout<<"inside derived... | TOOL | 0.902435 | 5.279902 |
a037703e-7ff9-4c56-9932-e31473f4a4bb | Jashanpreet645/Data-Structure-and-Algorithm | ch-1_Introduction/8_biinary_to_decimal.cpp | // #include<iostream>
// #include<math.h>
// using namespace std;
// int main(){
// int n;
// cin>>n;
// int answer =0;
// int i=0;
// while(n!=0){
// int rem=n%10;
// answer = (rem*pow(2,i))+answer;
// n=n/10;
// i++;
// }
// cout<<answer;
// return 0;
... | ALGO | 0.999966 | 4.614727 |
005d3983-f956-45be-9b0c-f65407613e8f | prakharrai1609/Leetcode-submissions | 1260-shift-2d-grid/1260-shift-2d-grid.cpp | class Solution {
public:
void turn(vector<vector<int>> &grid) {
int r = grid.size(), c = grid[0].size();
for (int i = 0; i < r; i++)
rotate(grid[i].begin(), grid[i].begin() + grid[i].size() - 1, grid[i].end());
int temp = grid[r - 1][0];
for (int i = r - 1; i >= 1; i--) {... | ALGO | 0.999991 | 6.091829 |
c20e0362-f356-4c7a-96d3-8c96514239ab | Freddy-Ms/Podstawy-Programowania | Ćwiczenia/Lista numer 4/Złożone struktury danych/Zadanie12.cpp | #include <iostream>
#include <string>
using namespace std;
struct Osoba {
string imie;
string nazwisko;
int wiek;
Osoba* poprzedni;
Osoba* nastepny;
};
Osoba* inicjujListe() {
return nullptr;
}
Osoba* stworzOsobe(const string& imie, const string& nazwisko, int wiek) {
Osoba* nowaOsoba... | TOOL | 0.979756 | 5.527741 |
cfbcff96-6cce-4a96-8ff7-5ccc4ab4876f | arangodb/arangodb | 3rdParty/boost/1.78.0/libs/geometry/doc/src/examples/geometries/segment.cpp | // Boost.Geometry
// QuickBook Example
//[segment
//` Declaration and use of the Boost.Geometry model::segment, modelling the Segment Concept
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/geometries.hpp>
namespace bg = boost::geometry;
int main()
{
typedef bg::model::poin... | TOOL | 0.962955 | 5.067235 |
fb779987-0c5a-4d7a-9777-5b898c9de1a4 | sanjay10985/100-days-of-dsa | 0088-merge-sorted-array/0088-merge-sorted-array.cpp | class Solution {
public:
void merge(vector<int>& nums1, int m, vector<int>& nums2, int n) {
int i = 0,j=0,k=i;
vector<int> ans(m+n);
while(i<m && j<n){
if(nums1[i]<nums2[j]){
ans[k] = nums1[i];
i++;
}
else{
a... | ALGO | 0.999957 | 5.061957 |
da137e04-ff4e-40ee-b00f-aaab67554bf9 | redot-rex/rex-engine | thirdparty/msdfgen/core/edge-selectors.cpp |
#include "edge-selectors.h"
#include "arithmetics.hpp"
namespace msdfgen {
#define DISTANCE_DELTA_FACTOR 1.001
TrueDistanceSelector::EdgeCache::EdgeCache() : absDistance(0) { }
void TrueDistanceSelector::reset(const Point2 &p) {
double delta = DISTANCE_DELTA_FACTOR*(p-this->p).length();
minDistance.distan... | ALGO | 0.994164 | 6.662984 |
bb570ca9-72a3-4f4a-9f09-a9a0ac9120f2 | allwinner-ics/platform_frameworks_compile_slang | BitWriter_2_9/ValueEnumerator.cpp | #include "ValueEnumerator.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Module.h"
#include "llvm/ValueSymbolTable.h"
#include "llvm/Instructions.h"
#include <algorithm>
using namespace llvm;
static bool isIntegerValue(cons... | TOOL | 0.913919 | 4.593793 |
345686bb-0dd6-4a34-99c6-c898fbd34c59 | Rohit--Sharma/CompetitiveCoding | LeetCode/010_RegularExpressionMatching.cpp | #include <cstdio>
#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <stack>
#include <map>
#include <queue>
#include <list>
#include <algorithm>
using namespace std;
/// TODO
class Solution {
public:
bool isMatch(string s, string p) {
return true;
}
};
int main()
{
... | ALGO | 0.999608 | 3.831937 |
b732613e-690b-4fa0-bebe-dff2aa560fdd | Robert19950512/libigl | include/igl/snap_to_canonical_view_quat.cpp | #include "canonical_quaternions.h"
#include "normalize_quat.h"
#include <cstdio>
#include <cassert>
// Note: For the canonical view quaternions it should be completely possible to
// determine this anaylitcally. That is the max_distance should be a
// theoretical known value
// Also: I'm not sure it matters in this c... | ALGO | 0.994699 | 6.598871 |
63af7933-58fd-4649-a541-a77bbab45e23 | yangtzhou2012/Introduction_to_Algorithms_3rd | Others/ComparisonSort/main.cpp | #include <ctime>
#include <cstring>
#include <iostream>
#include <fstream>
#include <vector>
#include "Sort.h"
using namespace std;
const int m_MinLength = 2;
const int m_MaxLength = 770;
const int m_LengthStep = 16;
const int m_Loop = 50;
int main()
{
clock_t start, end;
vector<int> x;
vector<long> y_insert;
ve... | ALGO | 0.99839 | 4.327372 |
b463eeab-2dc9-4c25-b0d7-f51fdf5bd647 | alaminmiah4274/algorithm | 0_1_knapsack_variations/equal_sum_partition.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
int equal_sum[n];
int sum = 0;
for (int i = 0; i < n; i++)
{
cin >> equal_sum[i];
sum += equal_sum[i];
}
if (sum % 2 == 0)
{
int sum_partition = sum / 2;
bool equal_sum_par... | ALGO | 0.999981 | 4.435233 |
a38f602f-bb18-4216-baa4-a12252fe10e7 | biyotteu/algorithms | C++/전력난.cpp | #include <bits/stdc++.h>
using namespace std;
class xy{
public:
int x;
long long int y;
xy(){x=0,y=0;}
xy(int a,long long int b){x=a,y=b;}
};
struct info{
int x,y;
long long int z;
bool operator<(info A) const{
return z > A.z;
}
};
vector<xy> graph[200005];
vector<bool> visit;
stack<int> st;
vector<vector<... | ALGO | 0.999916 | 3.997004 |
05b526a9-99c6-4189-a5de-d259f2ca189a | 123pk/CP-daily-problem-solving | Day86/B - Fun with even subarrays.cpp | /*
Platform :- Codefoces
Contest :- Codeforces Round 768 Div 2
Approach :- Start with the last element if the second last is not equal then we make it equal to last and increment our size and count of operation and descent to i-c index
if we found some element which is already equal then we just add to our ... | ALGO | 0.999804 | 4.370097 |
83de1c59-29c8-46bb-b5eb-cb64741eba3c | magyarakoos/contest-prog | codeforces/contest/1927/B/main.cpp | #include <bits/stdc++.h>
#define cinv(v) for (auto& e : v) cin >> e;
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define size(v) (int)v.size()
using namespace std;
using ll = long long;
void solve() {
int N;
cin >> N;
vector<int> v(N), alpha(26);
cinv(v);
string s;
... | ALGO | 0.999712 | 5.057706 |
2ea3de06-224c-4ddd-a37a-19b81a7faa4c | guilhermesilveira/uva-problems | uva/src/dois/p291/p291.cpp | // 88
#include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
#define ULTIMO (caras[caras.size()-1])
using namespace std;
vector<int> caras;
vector<int> passou;
void revoluciona();
void PROXIMO(int valor,int proximo) {
if(find(passou.begin(),passou.end(),valor)==passou.end()) {
caras.push... | ALGO | 0.999806 | 3.543628 |
d824ef7b-2b86-4996-8d56-a2735be686f8 | shvmsh20/GFG_POTD | Oct 2024/Rotate and delete.cpp | int rotateDelete(vector<int> &arr) {
// Your code here
int n = arr.size();
if (n == 1) return arr[0];
int x = (n - 1) / 4, y = (n - 1) % 4;
if (y == 0) return arr[x + 1];
if (y == 1) return arr[x + 1];
if (y == 2) return arr[x + 2];
if (y == 3) return arr... | ALGO | 0.999908 | 4.564432 |
dbd8536f-67a1-42b6-a7a3-105df74d40fb | sarasazevedo/FEUP_PROG | P05/longest-string.cpp | /*
Write a C++ function const char* longest(const char* pa[]) that takes a nullptr-terminated array pa of pointers to C strings and returns the array element (a C string pointer) corresponding to the longest string. In case there is more than one C string with maximum length, the rightmost element should be returned. Y... | ALGO | 0.997769 | 4.618423 |
977d9d67-f17c-4cf1-8ec0-6635e1355613 | anifilm/workspace | cpp/cpp_TimBuchalka_udemy/section11/PassByReference.cpp | // Section 11
// Pass-by-reference
#include <iostream>
#include <string>
#include <vector>
using namespace std;
void pass_by_ref1(int& num);
void pass_by_ref2(string& s);
void pass_by_ref3(vector<string>& v);
void print_vector(const vector<string>& v); // const
void pass_by_ref1(int& num) {
num = 1000;
}
v... | TOOL | 0.901703 | 4.387131 |
0995672c-92f1-4587-a260-9f4f5fbe0b5f | anonymous-secure-marl/PrivacyPreservingSupplyGame | EzPC/SCI/extern/eigen/doc/examples/tut_arithmetic_redux_basic.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::Matrix2d mat;
mat << 1, 2,
3, 4;
cout << "Here is mat.sum(): " << mat.sum() << endl;
cout << "Here is mat.prod(): " << mat.prod() << endl;
cout << "Here is mat.mean(): " << mat.mean() ... | ALGO | 0.99932 | 3.872858 |
0a0d4029-121d-41c6-8179-64e7b1a2bc86 | Noorius/pp1 | Final_preparation/lab4 2dArray/SumOfMinorDiagonal.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n,sum=0;
cin>>n;
int a[n][n];
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
cin>>a[i][j];
if(i+j==n-1)
sum+=a[i][j];
}
}
cout<<sum;
return 0;
} | ALGO | 0.999861 | 3.35945 |
bcac0c76-4882-4232-8469-db2b8f70ff27 | bibongbong/my_px4 | src/modules/ekf2/EKF/position_fusion.cpp | #include "ekf.h"
void Ekf::updateVerticalPositionAidStatus(estimator_aid_source1d_s &aid_src, const uint64_t &time_us,
const float observation, const float observation_variance, const float innovation_gate) const
{
float innovation = -_gpos.altitude() - observation;
float innovation_variance = getStateVariance<Sta... | ALGO | 0.992261 | 7.042644 |
c92b4ab9-2215-49dd-a937-d1ce4ae246b6 | MNivar/udemy | Challenge13/Movies.cpp | /******************************************************************
* Section 13 Challenge
* Movies.h
*
* Models a collection of Movies as a std::vector
*
* ***************************************************************/
#include <iostream>
#include "Movies.h"
/***********************************************... | TOOL | 0.912704 | 5.862949 |
f9c905d9-5498-4b32-8ee7-1cd4ddb12d30 | ishandutta2007/codeforces | abeker/normal/479/E.cpp | #include <cstdio>
using namespace std;
const int MAXN = 5005;
const int MOD = 1000000007;
int N, A, B, K;
void load() {
scanf("%d%d%d%d", &N, &A, &B, &K);
}
int dp[MAXN], nxt[MAXN];
inline void add(int &x, int y) {
x += y;
if (x < 0) x += MOD;
else if (x >= MOD) x -= MOD;
}
void inc(int lo, int hi, int val) {... | ALGO | 0.999791 | 3.496197 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.