uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
8a1c4753-d95b-4939-8356-91b856d74898 | ishandutta2007/codeforces | humbertoyusta/normal/1586/D.cpp | #include<bits/stdc++.h>
using namespace std;
// Pragma
#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline","03")
// Macros:
#define f first
#define s second
typedef long long ll;
// debugging macros
#define db(x) cerr << #x << ": " << (x) << '\n';
#define db_v(x) cerr << #x << ": ["; for( auto i :... | ALGO | 0.999976 | 3.371015 |
3c8caf5d-5214-4e87-8f5b-55d3faf9b127 | ManaswibRane/DSA | 278-first-bad-version/first-bad-version.cpp | // The API isBadVersion is defined for you.
// bool isBadVersion(int version);
class Solution {
public:
int firstBadVersion(int n) {
int st=1,end=n,potans;
while(st<=end){
int mid=st+(end-st)/2;
if(isBadVersion(mid)) {
end=mid-1;
potans... | ALGO | 0.999926 | 6.4964 |
beaf1dd5-e4b5-46c8-b5e0-00f81f6fa88c | iamsile/ACM | Ignatius and the Princess III-dp求组合数.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
while (cin >> n) {
int i,j,k,c1[10001],c2[10001];
for (i=0; i<=n; i++) {
c1[i]=1;
c2[i]=0;
}
for (i=2; i<=n; i++) {
for (j=0; j<=n; j++)
for (k=0; j+k<=n; k+=i)
... | ALGO | 0.999886 | 3.937671 |
b1eb60db-3e17-4423-9731-06e284f7303d | ishandutta2007/codeforces | wxhtzdy/normal/1360/E.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int t;scanf("%i",&t);
while(t--){
int n;scanf("%i",&n);
char s[n][n];
for(int i=0;i<n;i++)scanf("%s",&s[i]);
bool ok=1;
for(int i=0;i<n-1;i++)for(int j=0;j<n-1;j++)if(s[i][j]=='1'){
if(s[i+1][j]=='0'&&s... | ALGO | 0.999697 | 4.005022 |
592cb361-b575-413c-ba0f-682e9a5adefc | sarvex/leetcode-ruby | solution/1400-1499/1489.Find Critical and Pseudo-Critical Edges in Minimum Spanning Tree/Solution.cpp | class UnionFind {
public:
vector<int> p;
int n;
UnionFind(int _n)
: n(_n)
, p(_n) {
iota(p.begin(), p.end(), 0);
}
bool unite(int a, int b) {
if (find(a) == find(b)) return false;
p[find(a)] = find(b);
--n;
return true;
}
int find(in... | ALGO | 0.999987 | 5.350977 |
dc11b05e-538d-4ff1-a32f-36d846baae93 | WilmaAura/Semester-2 | Queue/stack.cpp | #include <iostream>
using namespace std;
struct Stack
{
int data;
Stack *next;
};
typedef struct Stack stack;
stack *TOP = nullptr;
bool isEmpty()
{
return TOP == nullptr;
}
void push(int value)
{
stack *newNode = new stack;
newNode->data = value;
newNode->next = TOP;
TOP = newNode;
... | ALGO | 0.954062 | 4.653011 |
e7c73f2d-1929-4187-bceb-64599a2a1f72 | Md-Salih/My-First-Language | Check if an Edge Exists in a Graph.cpp | #include <iostream>
#include <vector>
bool edgeExists(const std::vector<std::vector<int>>& graph, int vertex1, int vertex2) {
for (int neighbor : graph[vertex1]) {
if (neighbor == vertex2) {
return true;
}
}
return false;
}
int main() {
std::vector<std::vector<int>> graph =... | ALGO | 0.999769 | 6.458035 |
5fac1f96-7bc5-449a-82ce-74675b50702f | AV2409/DSA_Codes | Trees/diagonal_traversal.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
Node(int x)
{
data = x;
left = NULL;
right = NULL;
}
int data;
Node *left;
Node *right;
};
Node *buildTree()
{
int x;
cout << "\nEnter data: ";
cin >> x;
if (x == -1)
{
retur... | ALGO | 0.99989 | 4.683011 |
69733a95-3feb-4023-be21-8921328c8978 | vibrantvarun/Hackerrank | CircularArrayRotation.cpp | #include <bits/stdc++.h>
#include <vector>
void reverseArray(std::vector<int> &a, int start, int end)
{
while (start < end) {
int temp = a[start];
a[start] = a[end];
a[end] = temp;
start++;
end--;
}
}
std::vector<int> circularArrayRotation(std::vector<int> a, int k, std::vector<int> queries)
{
... | ALGO | 0.99983 | 5.073384 |
190035db-59a9-4713-bed5-5ea3651df3fb | MathProgrammer/SPOJ | C Programs/C Programs - 2/Ontole Needs Your Help.cpp | #include <cstdio>
int main()
{
int no_of_numbers;
scanf("%d", &no_of_numbers);
int lonely_number = 0;
for(int i = 1; i <= no_of_numbers; i++)
{
int number_i;
scanf("%d", &number_i);
lonely_number ^= number_i;
}
printf("%d\n", lonely_number);
return 0;
}
| ALGO | 0.999922 | 4.247979 |
8c8fd73e-810e-4b4c-ad8b-7e2e814f8551 | blip9/Codeforces | 1972b.cpp | #include<bits/stdc++.h>
#define ll long long int
#define ull unsigned long long int
#define vi vector<int>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define llvi vector<long long int>
using namespace std;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
/*ifndef ONLINE_JUDGE
freopen("in.txt","r",stdin);
... | ALGO | 0.998999 | 3.839771 |
9ab6c162-15b7-424a-a483-b608a8507bff | b1060t/datastructure-algorithm | leetcode/24.swap-nodes-in-pairs.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* swapPairs(ListNode* head) {
if(head==NULL || head->next==NULL) return head;
ListNode* next = head->next;
... | ALGO | 0.999989 | 5.670717 |
de5be790-d79f-49a8-ba5d-c773539e58f9 | BMOLKAIST/Inverse_solver | Codes/sub_code/goldstein_GPU/save/_OLD1_get_branches_goldstein.cpp | /**
* @file pctdemo_life_mex_texture.cpp
* @brief MEX gateway for a stencil operation.
* Copyright 2013 The MathWorks, Inc.
*
*/
#include <stdint.h>
#include "tmwtypes.h"
#include "mex.h"
#include <stdint.h>
#include <math.h>
#include "get_branches_goldstein_compute.hpp"
#include <vector>
#include <array>
/**
... | ALGO | 0.988483 | 3.683506 |
5532cfbc-c9fc-4cb8-9694-623319d3753e | AaronGrissomCU/Homework3 | deleteCity.cpp | city* deleteCity(city *head, string cityName)
{
city* del = head;
city* prev = head;
while (del->name != cityName && del != NULL)
{
del = del->next;
}
if (del == NULL)
{
cout << "City does not exist." << endl;
return head;
}
else
{
if (de... | ALGO | 0.989624 | 3.828673 |
f9b9bf43-a316-4baa-ad5c-bd563b8e16d7 | KhaledHegazy222/Problem-Solving | UVA/11417/main.cpp | #include <bits/stdc++.h>
#define all(a) a.begin(),a.end()
#define fast cin.tie(0),ios::sync_with_stdio(0),cout.tie(0)
typedef long long ll;
typedef unsigned long long ull;
using namespace std;
int main(void){
#ifdef Khaled
freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout);
#endif... | ALGO | 0.999164 | 4.478105 |
3b8d829c-b2b9-43e9-a63b-c17a82d04040 | NorthStarUAS/rc-flight-legacy | src/control/tecs.cpp | // Total Energy = Potential Energy (altitude) + Kinetic Energy (speed)
// PE = alt_m * kg * g
// KE = 0.5 * kg * vel^2
// This system controls altitude and airspeed with throttle and pitch
// angle. Throttle and pitch angle are used as analogs for power and
// flight path angle.
// We observe: (1) Throttle (thrust, ... | ALGO | 0.997933 | 4.339993 |
3e7e16f6-49e4-4736-9ea7-21ad5c5d48f8 | anasschoukri2/CSES | MoneySums.cpp | #include <bits/stdc++.h>
#define ms(x, a) memset(x, a, sizeof(x))
#define oo 100000000
#define ll long long int
#define MOD 1000000007
using namespace std;
int n,m;
int dp[104][100004];
vector<int>s;
vector<int>v;
int p[100007];
void cnt(int i,int sum){
if(i==v.size()){if(!p[sum]){p[sum]=true;s.push_back(sum);}retu... | ALGO | 0.999928 | 3.728009 |
b145d62f-51bc-4063-a286-98a181304f7c | BigJohnn/SoftVision | src/sfm/sfmStatistics.cpp | #include "sfmStatistics.hpp"
#include <sfm/pipeline/localization/SfMLocalizer.hpp>
#include <sfm/pipeline/regionsIO.hpp>
#include <sfm/pipeline/pairwiseMatchesIO.hpp>
#include <track/TracksBuilder.hpp>
#include <camera/IntrinsicsScaleOffsetDisto.hpp>
namespace sfm {
void computeResidualsHistogram(const sfmData::SfM... | ALGO | 0.861924 | 7.168901 |
ab01ffb6-df5d-4519-84d9-314399e368fc | okmd/codingblocks | 10-challenge-arrays/04-selection-sort.cpp | #include <iostream>
#include <vector>
using namespace std;
int main(){
int n, min,j,min_i;
cin>>n;
int a[n];
// read
for(int i=0;i<n;i++)
cin>>a[i];
// sort o(n^2)
for(int i=0;i<n-1;i++){
min_i = i;
for(j=i+1;j<n;j++){
if(a[j]<a[min_i]){
min_i = j;
}
}
// swap i with j-1;
min = a[min_i];
... | ALGO | 0.999974 | 3.986335 |
737814e6-17d4-41c3-af0c-a89b3d52018b | AlexMan2000/Stanford_CS106 | CS106B_X/assigns/Assignment 9/GUI/GUIUtils.cpp | #include "GUIUtils.h"
#include "strlib.h"
#include "filelib.h"
#include <sstream>
#include <vector>
#include <cmath>
using namespace std;
namespace {
/* Multiplier of the line height to use between natural linebreaks. */
const double kLineSpacing = 1.1;
/* Multiplier of the line height to use between para... | TOOL | 0.9739 | 6.381767 |
36e987ed-90cf-4bda-900d-80f8e331da87 | WhyR2017/UrbanSensorsMaterials | Results/pearson/packrat/lib/x86_64-apple-darwin15.6.0/3.4.1/Rcpp/examples/ConvolveBenchmarks/convolve3_cpp.cpp | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
// This is a rewrite of the 'Writing R Extensions' section 5.10.1 example
#include <Rcpp.h>
RcppExport SEXP convolve3cpp(SEXP a, SEXP b){
Rcpp::NumericVector xa(a);
Rcpp::NumericVector xb(b);
int n_xa = xa.size() ;
int n_xb = xb... | ALGO | 0.911061 | 5.93702 |
b728af9d-a9d0-4b4c-86f1-81182bb9f90a | Andycode3759/competitions | 2023_Q3/JNtest.Day1_8.2/D/D.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
int n;
int main()
{
scanf("%d",&n);
int ans=0;
for(int c=1;c<=n;c++)
{
for(int i=n/c;i>=2;i--)
{
int a=i*c;
if((a^c)==a-c) ans++;
}
}
printf("%d\n",ans);
return 0;
}
| ALGO | 0.999681 | 3.60146 |
b120d3d3-b32f-4322-9499-4c8b423ff2d4 | Turing551/Codechef | May Long Challenge 2021/VPATH.cpp | #include <bits/stdc++.h>
using namespace std;
typedef unsigned long long int uint64;
const int mod = 1e9+7;
class Path{
public:
vector<uint64> arr1,arr2;
vector<vector<int>> vec;
void add(int a,int b);
void dfs(int a,int c);
};
void Path::dfs(int a, int c){
arr1[a]=1, arr2[a]=1;
uint64 x=0, y=0;
for(int i=0; ... | ALGO | 0.999823 | 4.471993 |
4a517bf9-f4f6-46aa-8495-fc0f8eacc6bb | sarthak2004/Practice-CPlusPlus | pattern3.cpp | #include<iostream>
using namespace std;
int main() {
int num, counter = 1;
cin >> num;
for (int i = 1; i <= num; i++) {
for (int a = num; a >= i; a--) {
cout << " ";
}
for (int j = 1; j <= i; j++) {
cout << j << " ";
}
cout << endl;
}
... | ALGO | 0.99997 | 3.963531 |
3ebc8543-90a1-47ff-afe5-f28c0b7d5877 | FortunateRui/Tetris | Home.cpp | //Home.cpp
#include "Home.h"
Home::Home(){}
void Home::init()
{
// 初始化option文件
std::ifstream infile;
infile.open("option.txt");
if (!infile) {
std::ofstream outfile("option.txt");
outfile <<3<<' '<<4;
outfile.close();
}
infile.close();
// 初始化record文件
infile.open... | TOOL | 0.958941 | 3.63504 |
fcbd755f-8249-48b3-b0bc-f7f5a1e1d7ef | ChavaVennela/LeetCode | 2348-number-of-zero-filled-subarrays/2348-number-of-zero-filled-subarrays.cpp | class Solution {
public:
long long zeroFilledSubarray(vector<int>& nums) {
long long count=0, ans=0, i;
vector<long long>a;
for(i=0; i<nums.size(); i++){
if(nums[i]==0){
count++;
}
else{
if(count>0){
a.pu... | ALGO | 0.99998 | 5.87482 |
164374fb-ce34-47fd-ab23-118ede673af4 | hkrupsky/automated_pet_feeder | libraries/movingAvg/src/movingAvg.cpp | #include <movingAvg.h>
// initialize - allocate the interval array
void movingAvg::begin()
{
m_readings = new int[m_interval];
}
// add a new reading and return the new moving average
int movingAvg::reading(int newReading)
{
// add each new data point to the sum until the m_readings array is filled
if (m_... | TOOL | 0.894093 | 5.429952 |
e0f4ac15-ea58-4709-87f0-426b5f4656f9 | eggeek/constrained-jps | warthog/src/util/geography.cpp | #include "geography.h"
#include "constants.h"
#include <cmath>
double
deg_to_rad(double deg)
{
return deg * M_PI / 180;
}
double
rad_to_deg(double rad)
{
return fmod(rad * 180 / M_PI + 360, 360);
}
// Project the Earth onto a plane and into account the variation between
// meridians with latitude.
//
// http... | ALGO | 0.995032 | 4.683957 |
1462be5d-b1ca-4d6c-89a4-104cc6ea1f23 | milanow/LeetCodePractice | 400+/408_Valid_Word_Abbreviation.cpp | /* 408. Valid Word Abbreviation
* A two-pointer solution, iterting two words to see any mismatch between them
*/
class Solution {
public:
bool validWordAbbreviation(string word, string abbr) {
int i = 0, j = 0;
int m = word.length(), n = abbr.length();
while(i != m && j != n){
... | ALGO | 0.99983 | 6.427382 |
65d789e8-8d9a-4048-a858-6b3ffdcb02e4 | wojiushimogui/leetCode | invertTree.cpp |
/**
* Definition for a binary tree node.*/
struct TreeNode {
int val;
struct TreeNode *left;
struct TreeNode *right;
};
void invertTreeHelper(struct TreeNode* root){
if(root==NULL){
return;
}
if(root->left!=NULL||root->right!=NULL){
struct TreeNode * tempNode=root->left;
root->left=roo... | ALGO | 0.999949 | 6.056777 |
c1e32065-ffe4-47d9-83d0-f3b8f06d85e5 | Zlin0509/Zlin_ACM | _CF/CONTEST/1500-1999/1934/D1.cpp | #include<bits/stdc++.h>
using namespace std;
void solve()
{
long long n,m;
cin>>n>>m;
int l1=64-__builtin_clzll(n)-1;
int l2=64-__builtin_clzll(m)-1;
if(l1==l2)
{
cout<<"1"<<endl;
cout<<n<<" "<<m<<endl;
return;
}
long long N=n-(1ll<<l1);
if(N==0)
{
... | ALGO | 0.999513 | 4.116016 |
887eef36-b287-4e70-b597-d1f1d4b3bc86 | DeepAQ/Cpp-Homework | Homework4/Q47/Source.cpp | #include <iostream>
#include <cmath>
using namespace std;
class Point
{
public:
Point(int x, int y) : x(x), y(y) {}
void Output() const
{
cout << "(" << x << "," << y << ")";
}
double Distance(Point& p) const
{
return round(sqrt(pow(p.x - x, 2) + pow(p.y - y, 2)) * 100.0) / 100.0;
}
private:
int x, y;
};
... | ALGO | 0.999632 | 4.382133 |
2634c247-e473-43aa-bba8-7ca593e2f696 | alexandraback/datacollection | solutions_5769900270288896_0/C++/thiagocarvp/b-small.cpp | #include <bits/stdc++.h>
#define maxn 101000
#define inf 0x3F3F3F3F
#define linf 0x3F3F3F3F3F3F3F3FLL
#define eps 1e-9
#define pb push_back
#define mp make_pair
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vii;
typedef priority_queue<pii, vii, gre... | ALGO | 0.998894 | 3.861411 |
543b6b21-e90f-4079-a8a9-a8f8536e2f45 | viviansh/234313 | libraries/Filter/LowPassFilter.cpp | //
/// @file LowPassFilter.cpp
/// @brief A class to implement a low pass filter without losing precision even for int types
/// the downside being that it's a little slower as it internally uses a float
/// and it consumes an extra 4 bytes of memory to hold the constant gain
#include "LowPassFilter.h... | TOOL | 0.981399 | 5.459754 |
52f51db0-b608-485b-a61e-84ff515a86f7 | Archie3d/teensy4_synth | src/engine/Envelope.cpp | #include <cmath>
#include "engine/Envelope.h"
// Ported from
// https://www.earlevel.com/main/2013/06/03/envelope-generators-adsr-code/
const float Envelope::logAttackTR = -logf((1.0f + Envelope::AttackTargetRatio) / Envelope::AttackTargetRatio);
const float Envelope::logDecayReleaseTR = -logf((1.0f + Envelope::Decay... | ALGO | 0.872143 | 5.579911 |
94a3dd07-7310-4160-9833-7ef09db75a9c | Jha01Sarvjeet/Practice-Cpp | 16 Recursion/12_printZigZag.cpp | // to print zig zag
/*
i/p o/p
1 111
2 211121112
3 321112111232111211123*/
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
void printZIgZag(int n)
{
if (n == 0)
return;
cout << n;
printZIgZag(n - 1);
cout << n;
printZIgZag(n - 1);
... | ALGO | 0.999935 | 4.528062 |
6ff779ae-a03b-46a6-9f01-edf499bac220 | avidLearnerInProgress/EPI_solutions | buy_sell_stock_twice_variant1.cpp | //https://ide.geeksforgeeks.org/yVoA0hzepN
//buy sell stock twice variant 1
#include<bits/stdc++.h>
using namespace std;
int mod=1e9+7;
#define F(a, b, var) for(int var=a;var<b;var++)
#define FAST_INP ios_base::sync_with_stdio(false);cin.tie(NULL)
double min(double a, double b) {
return a<b ?a:b;
}
int main(){... | ALGO | 0.99999 | 4.331612 |
a0cb8476-c04b-41ba-8117-07ba65f16c6d | letelete/algorithms-and-data-structures | codeforces/practice/000287_B.cpp | #include <bits/stdc++.h>
#pragma GCC target("popcnt")
#define fastIO \
std::cin.tie(0); \
std::cout.tie(0); \
std::ios::sync_with_stdio(0);
#define endl "\n"
template <typename T>
using v = std::vector<T>;
template <typename T>
using q = std::queue<T>;
template <typename T>
using pq = std::priority_queue<T>... | ALGO | 0.999979 | 4.753793 |
d29ca40c-bee7-4e75-97e3-6ad814b95ec5 | dbsrjs/UnReal_Lecture | 08.11/source/ArrayList.cpp | #include <iostream>
#include <stdexcept>
using namespace std;
class ArrayList {
private:
int* data;
int capacity;
int length;
void resize(int newCapacity) {
int* newData = new int[newCapacity];
for (int i = 0; i < length; i++)
newData[i] = data[i];
delete[] data;
data = newData;
capacity = newCapac... | TOOL | 0.891421 | 5.125177 |
89632b51-6456-466b-8de6-531c4196fd8d | starwar57/Dsa_c- | Array/nextpermutation.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int arr[]={1,2,3};
sort(arr,arr+3);
cout<<"the 3! possible permutation with 3 elements\n";
do
{
cout<<arr[0]<<" "<<arr[1]<<" "<<arr[2]<<"\n";
}while(next_permutation(arr,arr+3));
cout<<"after loop"<<arr[0]<<' '<<arr[1]<<' '<<arr[2]<<"\n";
... | ALGO | 0.99995 | 3.836343 |
ad69524c-eb05-4e4c-b64f-d437f4b8db61 | raincross7/code-similarity | codes/train_code/problem073/problem073_229.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long int
int main()
{
ll i,x,p=0,k,j=0;
string str;
cin>>str;
cin>>k;
for(i=0;i<str.size();i++)
{
x=(str[i]-48);
if(x==1){
p++;
}
else{
j=i;
break;
... | ALGO | 0.999944 | 3.166435 |
8e1dd7d7-69e9-4ecf-8117-d218ea8200fe | Yaro2709/AlgoProblems | 7/181A.cpp | #include <iostream>
using namespace std;
int main() {
int row, col;
cin >> row >> col;
char arr[200][200];
int r, c;
int count = 0;
for (int i = 0; i < row; i++) {
for (int j = 0; j < col; j++) {
cin >> arr[i][j];
}
}
for (int i = 0; i < row; i++) {
count = 0;
for (int j = 0; j < col; j++) {
... | ALGO | 0.999954 | 3.212252 |
3a102acf-884e-4023-b266-8f4c8495a9b7 | Claudiomancinelli90/CutLocus | libs/libigl/include/igl/collapse_small_triangles.cpp | #include "bounding_box_diagonal.h"
#include "doublearea.h"
#include "edge_lengths.h"
#include "colon.h"
#include "faces_first.h"
#include <limits>
#include <iostream>
void igl::collapse_small_triangles(
const Eigen::MatrixXd & V,
const Eigen::MatrixXi & F,
const double eps,
Eigen::MatrixXi & FF)
{
using na... | ALGO | 0.997147 | 5.808984 |
c70cbe14-686a-4262-ba56-a8c71d7d1638 | SiyangShao/codes | codeforces/2021/Global18/A.cpp | #include <bits/stdc++.h>
typedef long long ll;
using namespace std;
void solve() {
ll n;
cin >> n;
ll sum = 0;
vector<ll> a(n);
for (auto &i : a) {
cin >> i;
sum += i;
}
if (sum % n) {
cout << 1 << "\n";
} else {
cout << 0 << "\n";
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr), cout.... | ALGO | 0.999646 | 3.603083 |
2d28e613-7506-4de9-9998-4e423f095b34 | MoeinGhaniyoun/LLVM-SLH-RISCV | mlir/lib/Dialect/Affine/Transforms/DecomposeAffineOps.cpp | #include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Affine/Transforms/Transforms.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/Transforms/GreedyPatternRewriteDriver.h"
#include "llvm/Support/Debug.h"
using namespace mlir;
using namespace mlir::affine;
#define DEBUG_TYPE "decompose-affine-ops"
#... | ALGO | 0.991379 | 7.855148 |
563feb74-f83e-4f6c-b625-c2fed00897df | Yosuamuliawan19/algorithm-bank | Leetcode_submissions/problems/combinations/solution.cpp | class Solution {
public:
vector<vector<int>> ans;
void dp(int n, int k, vector<int> cur){
if (k == 0){
ans.push_back(cur);
return;
}
for (int i=n;i>=1;i--){
cur.push_back(i);
dp(i-1, k-1, cur);
cur.pop_back();
}
}
... | ALGO | 0.999988 | 6.041698 |
1b37c7f2-98d9-4f56-9f94-598f9e525af3 | fast-nd-steady/Graphs | cycleDetetectionInDirectedGraphUsingBFS.cpp | #include <bits/stdc++.h>
using namespace std;
bool isCyclic(int n, vector<int> adj[])
{
queue<int> q;
int indegree[n];
memset(indegree, 0, sizeof(indegree));
for (int i = 0; i < n; i++)
{
for (auto ele : adj[i])
indegree[ele]++;
}
for (int i = 0; i < n; i++)
{
... | ALGO | 0.999964 | 5.304562 |
b14283dc-bc5f-4810-94aa-2ecb8e54cfef | anand5090/Sorting | bin.cpp | /*
#include <iostream>
using namespace std;
int binary_Search(int array[],int x,int low,int high)
{
while (low <= high) {
int mid = low + (high - low) / 2;
if (array[mid] == x)
return mid;
if (array[mid] < x)
low = mid + 1;
else
high = mid - 1;
}
return -1;
}
int main(void)
{... | ALGO | 0.999487 | 5.386314 |
98f5a564-426c-4d1b-ad86-d5725647cb3b | LeeKeeEE/AlgorithmExercise | DS/DoubleVariables/438.cpp | #include <bits/stdc++.h>
#include <unordered_set>
using namespace std;
class Solution {
public:
int charToint(char c){
int ret = c - 'a';
return ret;
}
vector<int> findAnagrams(string s, string p) {
unordered_map<char,int>p_map; // p中各字母的出现次数
unordered_set<char>set;
... | ALGO | 0.999886 | 5.528883 |
e6a2928b-e30f-41d4-b725-ae57125a90ef | adrianabadin/marlinEnderLaser | Marlin-2.1.2.1/Marlin/src/gcode/probe/G38.cpp | #include "../../inc/MarlinConfig.h"
#if ENABLED(G38_PROBE_TARGET)
#include "../gcode.h"
#include "../../module/endstops.h"
#include "../../module/motion.h"
#include "../../module/planner.h"
#include "../../module/probe.h"
inline void G38_single_probe(const uint8_t move_value) {
endstops.enable(true);
G38_move =... | ALGO | 0.926898 | 7.684132 |
5071ad28-4caa-4eb8-9a9b-047b7c495bd2 | nishatlea/Programming | leetcode/Count Pairs Whose Sum is Less than Target.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
vector<int>nums = {-6,2,5,-2,-7,-1,3};
int target = -2;
sort(nums.begin(), nums.end());
int left=0, right=nums.size()-1;
int cnt =0;
while(left < right)
{
if(nums[left]+nums[right] < target)
{
cnt+= (right-left);
left+=1;
}
else
right-=1;
}
cout<<cnt;
}
| ALGO | 0.999974 | 4.868083 |
cc6e92f7-1f3d-4fd5-bb13-b42fd80d673d | sarvex/leetcode-dart | solution/1700-1799/1708.Largest Subarray Length K/Solution.cpp | class Solution {
public:
vector<int> largestSubarray(vector<int>& nums, int k) {
auto pos = max_element(nums.begin(), nums.begin() + nums.size() - k + 1);
return {pos, pos + k};
}
}; | ALGO | 0.999882 | 5.986624 |
78d30afc-4d92-4452-9928-9702a1b3f1f6 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Gemma/top0-100/stamping-the-sequence-Solution.movesToStamp/177811_DoS.cpp | aspath_put (struct stream *s, struct aspath *as, int use32bit )
{
struct assegment *seg = as->segments;
size_t bytes = 0;
if (!seg || seg->length == 0)
return 0;
if (seg)
{
/*
* Hey, what do we do when we have > STREAM_WRITABLE(s) here?
* At the moment, we would write out a par... | ALGO | 0.999038 | 4.685397 |
88e83eec-5c67-4216-9203-e858fb2f9be6 | mugicha101/AdventOfCode24 | day10a.cpp | #include "./setup.h"
int main() {
vector<string> grid(1);
while (cin >> grid.back()) grid.emplace_back();
grid.pop_back();
int rows = grid.size();
int cols = grid[0].size();
vector<pair<int,int>> q;
auto qPush = [&](int r, int c) {
grid[r][c] = grid[r][c] + 16;
q.emplace_back(r, c);
};
auto ... | ALGO | 0.998883 | 5.503025 |
39d441a0-b056-4d8c-9c72-f2419eba1640 | cxlove/ACM_ICPC | Online_judge/poj/poj_2689.cpp | #include<iostream>
#include<cstring>
#include<queue>
#include<cstdio>
#include<cmath>
#include<algorithm>
#define N 100005
#define inf 1<<30
#define MOD 9973
#define LL long long
#define eps 1e-7
#define zero(a) fabs(a)<eps
#define equal(a,b) zero(a-b)
using namespace std;
bool flag[100005];
int prime[1... | ALGO | 0.999872 | 3.322804 |
aa4b0477-ca73-45f9-9f24-3b6a96d13827 | Sid-80/CP | 217-contains-duplicate/contains-duplicate.cpp | class Solution {
public:
bool containsDuplicate(vector<int>& nums) {
unordered_map<int,int> m;
for(auto it : nums){
if(m.count(it) > 0){
return true;
}else{
m[it] = 1;
}
}
return false;
}
}; | ALGO | 0.999859 | 6.021511 |
1ae498e7-df04-4cd7-acdb-9cc1a4901030 | Md-Bidyuth/Hackerrank | HR-Library Fine.cpp | #include<iostream>
#include<cstdlib>
using namespace std;
int main(){
int d1,d2,m1,m2,y1,y2;
cin>>d1>>m1>>y1;
cin>>d2>>m2>>y2;
/* if(y1==y2 && m1==m2 && d1>d2)
cout<<15*abs((d1-d2));
else if(y1==y2 && m1!=m2)
cout<<500*abs((m2-m1));
else if(y1!=y2)
cout<<10000;
else if(y1==y2 && m... | ALGO | 0.999848 | 3.739508 |
0970ab85-5026-4f5b-8caa-982719f0f165 | matigodoy/AED-II | TPs/TP1 - Mati - Fede/Codigos/Archivos.cpp | #include<iostream>
#include<string>
#include<fstream>
using namespace std;
class Grafo{
private:
int v;
int** distancia;
string** calle;
public:
Grafo();
void agregar(int,int,int,string);
void guardar();
};
Grafo::Grafo(){
this->v = 15; //cantidad de nodos
... | ALGO | 0.879925 | 3.723374 |
4c551b77-d007-44ed-aa6d-23c45013852a | harshrajranjan0/Programming-Basic | OOPs_Basics(c++)/Array_Of_Object/complex1.cpp | #include <iostream>
using namespace std;
class complex
{
int real, img;
public:
void SetData(int a, int b)
{
real = a;
img = b;
}
void PrintData()
{
cout << "Your Imaginary Number: " << real << "+" << img <<"i"<< endl;
}
void SumNum(complex x, complex y, complex ... | TOOL | 0.938187 | 3.84756 |
61571bc6-43a8-499f-8f7e-1241fc0b4f20 | ishandutta2007/codeforces | i_love_tigersugar/normal/799/A.cpp | #include<bits/stdc++.h>
#define FOR(i,a,b) for (int i=(a),_b=(b);i<=_b;i=i+1)
#define FORD(i,b,a) for (int i=(b),_a=(a);i>=_a;i=i-1)
#define REP(i,n) for (int i=0,_n=(n);i<_n;i=i+1)
#define FORE(i,v) for (__typeof((v).begin()) i=(v).begin();i!=(v).end();i++)
#define ALL(v) (v).begin(),(v).end()
#define fi first
#defi... | ALGO | 0.999881 | 3.736493 |
30853e41-0b57-425d-80d7-00eaf88072ae | Mostafa6155/LeetCode_Solutions | 713-Subarray-Product-Less-Than-K.cpp | class Solution {
public:
int numSubarrayProductLessThanK(vector<int>& nums, int k) {
if (k <= 1) return 0;
int c = 0;
int last = 0;
long long p = 1;
for (int right = 0; right < nums.size(); ++right) {
p *= nums[right];
while (p >= k) {
p /= nums[last];
las... | ALGO | 0.999935 | 5.490584 |
ce5cdb27-abb2-42c0-9394-ac12aeb65a71 | hieugiax145/DSA | DSA10009 FLOYD.cpp | #include<bits/stdc++.h>
using namespace std;
int n,m,q;
vector<pair<int,int>> dinh[1001];
int d[1001][1001];
void Floyd(){
for(int i=1;i<=n;i++){
for(int j=1;j<=n;j++){
d[i][j]=1e9;
}
d[i][i]=0;
}
while(m--){
int st,en,w;
cin>>st>>en>>w;
d[st][en]=d[en][st]=w;
}
for(int k=1;k<=n;k++){
for(int i=... | ALGO | 0.999985 | 4.778876 |
53e8d40d-4dcd-4b17-964e-bf34cce2436d | DuaMohyyudin/Object_Oriented_Programming | Assignment#02/Q2_21L-5797.cpp | #include<iostream>
using namespace std;
class MyString
{
//You can add your code here
private:
char* str;
int lenght; //including the null char here
//Add GetStringFromBuffer as private member (helper)
//Add Concatenate as private member (helper)
//You can add your class members here
public:
//-------------DO_NOT_CHANG... | TOOL | 0.948667 | 3.856886 |
92ad2485-a9d8-46f6-bd9b-ed0f927d8526 | YusukeKato/Competitive_Programming | Codeforces/HCC2018/A1_DeathStars.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
vector<string> rotated(int n, vector<string> map_ori)
{
vector<string> map = map_ori;
for(int i = 0; i < n; i++)
{
for(int j = 0; j < n; j++)
{
map[i][j] = map_ori[j][n-i-1];
}
}
return ... | ALGO | 0.999996 | 4.064321 |
77de55a3-ab1d-4807-a35b-ab483c0ea376 | abhinavsiingh/CP_Codefile | 16Drinks.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
int arr[t];
float sum=0.0,x;
for(int i=0;i<t;i++){
cin>>arr[t];
x=(float)arr[t]/100;
sum+=x;
}
cout<<(sum/t)*100<<endl;
} | ALGO | 0.996804 | 3.74076 |
b44c1a84-9a72-4906-bdb5-0237161d0b92 | Joni32do/NumSim | src/discretization/central_differences.cpp | #include "central_differences.h"
CentralDifferences::CentralDifferences(std::array<int, 2> nCells, std::array<double, 2> meshWidth) : Discretization(nCells, meshWidth)
{
}
double CentralDifferences::computeDu2Dx(int i, int j) const
{
double u_iminus_j = 0.5 * (u(i, j) + u(i - 1, j));
double u_iplus_j = 0.5 * ... | ALGO | 0.997278 | 6.597347 |
e45ecbd4-1ba8-49fa-845d-b7fec4ffda2e | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/Year2021/January/aaa_20210105142652.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
int size,target;
cin >> size >> target;
vector<int>h;
for(int i = 0; i < size; i++){
int a;
cin >> a;
h.push_back(a);
}
sort(h.begin(),h.... | ALGO | 0.999898 | 3.599052 |
65bfd83d-eba5-4b47-9f81-c0d407ce0b6c | GQH123/Renatus-ACM-Codes | Educational Codeforces Round 88 (Rated for Div. 2)/c/c.cpp | #include <bits/stdc++.h>
#define rep(i, l, r) for (register int i = l; i <= r; i++)
#define per(i, r, l) for (register int i = r; i >= l; i--)
#define srep(i, l, r) for (register int i = l; i < r; i++)
#define sper(i, r, l) for (register int i = r; i > l; i--)
#define erep(i, x) for (register int i = h[x]; i; i = e[i].... | ALGO | 0.999794 | 3.244647 |
3469a225-825e-41b4-b92f-aa1d39e34d65 | xiahare/fusaco | fusaco/2023_2024/2324BcQ2/MilkExchange.cpp | #include <iostream>
#include <vector>
#include <fstream>
using namespace std;
using ll = long long ;
struct Group {
char rl;
ll most,least;
};
int positiveMod(int x, int mod){
return (x+mod)%mod;
}
int main() {
//ifstream cin("/Users/lei/Downloads/prob2_bronze_feb24/7.in");
int n,m;
cin >... | ALGO | 0.999941 | 4.152859 |
0d860d2f-ffad-44a7-a1bc-2d845c2dd0cc | raincross7/code-similarity | codes/train_code/problem145/problem145_438.cpp | #include<bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
const int INF = 1e9;
int h,w;
vector<vector<char>> v(100);
int main(){
cin >> h >> w;
rep(i,h){
vector<char> r(w);
rep(j,w){
cin >> r.at(j);
}
... | ALGO | 0.999788 | 4.268086 |
eb92653f-e0c8-44b4-9b3a-e91bba8b0c61 | rakib54/Algorithm-and-problem-solving | online_judge_problem/convert_sorted_list_to_BSt_leetcode.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) {}
* };
*/
/**
* Definition for a binary tree node.
* struc... | ALGO | 0.999997 | 6.188718 |
ebfbc012-6e62-4cb1-b245-6d63b6dde698 | adityanjr/code-DS-ALGO | Olympiad Solutions/SPOJ/JEDNAKOS.cpp | // Ivan Carvalho
// Solution to https://www.spoj.com/problems/JEDNAKOS/
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
const int MAXN = 1001;
const int MAXS = 5001;
char entrada[2*MAXN];
int dp[MAXN][MAXS];
int zeromaisadireita[MAXN];
int N,S;
int calcula(int ini,int fim){
int val = 0;
... | ALGO | 0.999752 | 3.420243 |
8a413d13-d392-4cfa-9bfc-a0ff1f3da9ec | sealddr/MyAtCoder | ABC14x/ABC145/D/ans.cpp | #include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#define rep(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
using namespace std;
const ll mod = 1000000007;
ll pow(ll b, ll e) {
if(e == 0)
return 1LL;
if(e % 2 == 1)
return pow(b, e - 1) * b % mod;
ll m = pow(b, e >> 1)... | ALGO | 0.999961 | 4.28845 |
e0939100-2b8e-4f44-a2ab-6966f33c0a29 | BhargavaRam123/dsa | stackadditional/nstacksinanarray.cpp | // Online C++ compiler to run C++ program online
#include <iostream>
using namespace std;
class nstack{
public:
int* a, *next,*top;
int size;
int n;
int freepointer;
nstack(int n,int size){
this->a = new int[size];
this->next = new int[size];
this->top = new int[n];
... | ALGO | 0.999435 | 4.20863 |
92f64917-c763-45ca-b6f3-c14d1dc32e9b | tokabe333/OkabeAtcoder | ABC_250to300/ABC_274/C-Ameba.cpp | #include <algorithm>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;
const double PI = 3.141592653589793... | ALGO | 0.999933 | 3.272207 |
637925c2-fc50-4860-8175-29db55727d05 | fiscalobject/uniasset | src/base58.cpp | #include <base58.h>
#include <hash.h>
#include <uint256.h>
#include <util/strencodings.h>
#include <assert.h>
#include <string.h>
/** All alphanumeric characters except for "0", "I", "O", and "l" */
static const char* pszBase58 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
static const int8_t mapBa... | TOOL | 0.917689 | 6.955701 |
969779af-5d8e-41cd-aeca-166d595c069b | mdshadesh/Beecrowd-Online-Judge-main | 2721.cpp | #include <iostream>
#include<stdio.h>
#include<math.h>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<vector>
#include<math.h>
#include<string>
#include<list>
using namespace std;
#define ll long long
#define input scanf
#define output printf
#define Loop while
#define echo ... | ALGO | 0.997646 | 3.227939 |
ad61e596-5006-4441-9233-283c0d423ff4 | Cattle0Horse/algorithm-problem | leetcode/leetcode_1306.cpp | /**
* @file leetcode_1306.cpp
* @author Cattle_Horse (<EMAIL>)
* @brief https://leetcode.cn/problems/jump-game-iii/description/
* @version 0.1
* @date 2024-06-19
*
* @copyright Copyright (c) 2024
*
*/
#include <functional>
#include <queue>
#include <set>
#include <unordered_map>
#ifdef OY_LOCAL
#include <vecto... | ALGO | 0.999994 | 5.52368 |
0f32612b-1bc1-42aa-ae32-3c3c4724f549 | bipro-b/DSA-Practice | rePermutaionsPrint.cpp | #include<bits/stdc++.h>
using namespace std;
void permutation(string s,string ans){
if(s.length()==0){
cout<<ans<<endl;
return;
}
for(int i=0;i<s.length();i++){
char ch = s[i];
string ros = s.substr(0,i) + s.substr(i+1);
permutation(ros,ans+ch);
}
}
int main()... | ALGO | 0.999957 | 4.772 |
eb3009d9-8291-4514-9df9-905eff010780 | Alvf/Collision-Penalty-Analysis | ext/eigen-3.3.7/bench/eig33.cpp | #include <iostream>
#include <Eigen/Core>
#include <Eigen/Eigenvalues>
#include <Eigen/Geometry>
#include <bench/BenchTimer.h>
using namespace Eigen;
using namespace std;
template<typename Matrix, typename Roots>
inline void computeRoots(const Matrix& m, Roots& roots)
{
typedef typename Matrix::Scalar Scalar;
con... | ALGO | 0.999774 | 5.613888 |
ec697c12-f9d0-4f6e-b19f-b87daa8d978c | PRINCERAHUL1/6Companies30Days | Company 2 - Amazon/Brackets in Matrix Chain Multiplication.cpp | class Solution {
public:
pair<string, int> helper(vector<int> &arr, int i, int j, vector<vector<pair<string, int>>> &v)
{
if(i == j)
{
string st = "";
st += 'A'+i-1;
return {st, 0};
}
if(v[i][j].second != -1)
... | ALGO | 0.999864 | 5.355499 |
1573e8c5-6282-46a3-a1a3-b74c8c814052 | bytendpixel/Leetcode-Solution | Distinct Subsequences.cpp | class Solution {
public:
int numDistinct(string s, string t) {
const int m = s.length();
const int n = t.length();
vector<unsigned long> dp(n + 1);
dp[0] = 1;
for (int i = 1; i <= m; ++i)
for (int j = n; j >= 1; --j)
if (s[i - 1] == t[j - 1])
dp[j] += dp[j - 1];
retu... | ALGO | 0.999958 | 6.76103 |
a662d4f5-d595-46dc-a8eb-2e43782d3e43 | Living-Hell/LeetCode | DP/#1871-Jump Game VII.cpp | // M1
// Using DP
// Faster than 68.19% (55ms)
class Solution
{
public:
bool canReach(string s, int minj, int maxj)
{
int n = s.size();
if (s[n - 1] == '1')
return 0;
vector<bool> ans(n, 0);
ans[0] = 1;
int left = 0, right = 0;
for (int i = 0; i < n;... | ALGO | 0.999896 | 5.766114 |
1f22806c-468c-45bb-b30d-33c0debaa7e0 | piyush1146115/Competitive-Programming | Intra University Contest/Practice Of Basic Combinatorics/N - Selection of Personnel.cpp | #include<bits/stdc++.h>
using namespace std;
long long dp[800][10];
long long nCr(long long n, long long r)
{
if(r == 1){
return n;
}
if(n == r){
return 1;
}
if(dp[n][r] != -1){
return dp[n][r];
}
else{
dp[n][r] = nCr(n - 1, r) + nCr(n - 1, r - 1);
... | ALGO | 0.999969 | 4.110047 |
e5a23510-d860-437a-9276-ff4e86edcd8e | PeterNex14/profile_unity | 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 |
1097bcf3-7b1c-48ae-949c-84043e28a522 | vinicius-cardoso/beecrowd | iniciante/1010.cpp | #include <iostream>
#include <iomanip>
using namespace std;
typedef struct Peca{
int codigo;
int nr_pecas;
float valor;
};
int main(){
Peca p1, p2;
float total;
cin >> p1.codigo >> p1.nr_pecas >> p1.valor;
cin >> p2.codigo >> p2.nr_pecas >> p2.valor;
total = (p1.nr_pecas * p1.va... | ALGO | 0.998541 | 4.458577 |
9c5d785b-317d-4f63-bfe7-f97ab34bfb77 | Andrealavi/Computer-Programming-II | Exercises/exercise24.cpp | #include <iostream>
#include <fstream>
#include <cstring>
using namespace std;
struct elemBFS {
int inf;
elemBFS* pun;
};
typedef elemBFS* lista;
typedef struct {
lista head;
elemBFS* tail;
} codaBFS;
static elemBFS* new_elem(int n) {
elemBFS* p = new elemBFS;
p->inf = n;
p->pun = NULL;
return p;
}
codaBF... | ALGO | 0.999167 | 4.093318 |
1676e92a-5075-468f-9ecb-adc4e7c1b683 | klishtshashank/Programming-Problems | 516-longest-palindromic-subsequence/516-longest-palindromic-subsequence.cpp | class Solution {
public:
int lcs(string &s , string &t)
{
int n= s.size();
int dp[n+1][n+1];
for(int i=0;i<=n;i++)
{
dp[i][0]=0;
dp[0][i]=0;
}
for(int i=1;i<=n;i++)
{
for(int j=1;j<=n;j++)
{... | ALGO | 0.99996 | 6.359068 |
2edc8a42-af90-448b-99fa-68708d2f3050 | ttnhathuy313/cp-career | Codeforces/Contest1175/TaskG.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
typedef pair <int, int> ii;
const int N = 3e5 + 5, oo = 1e18;
int n, block_size, ans[N], a[N], b[N], type[N], time_end[N];
struct Line {
int a, b;
Line() {}
Line(int _a, int _b) : a(_a), b(_b) {}
val(int x) {
return a * x + b;
}
};
struct Co... | ALGO | 0.99977 | 3.752795 |
928cf1a5-1a09-41b7-be96-bf5d24ee14a4 | Equlnox/IITP-ACM-Notebook | code/graphs/Dinic.cpp | // from stanford notebook
struct edge {
int u, v;
ll c, f;
edge() { }
edge(int _u, int _v, ll _c, ll _f = 0): u(_u), v(_v), c(_c), f(_f) { }
};
int n;
vector<edge> edges;
vector<vector<int> > g;
vector<int> d, pt;
void addEdge(int u, int v, ll c, ll f = 0) {
g[u].emplace_back(edges.size());
edges.emplace_back(ed... | ALGO | 0.999131 | 4.398843 |
f4cc2395-8eb1-4273-b0d1-21c1d01cd4f8 | calgagi/leetcode | 0817/answer.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
int numComponents(ListNode* head, vector<int>& G) {
unordered_set<int> s(G.begin(), G.end());
int r = 0;
wh... | ALGO | 0.99992 | 5.71691 |
9a0a52cb-41ac-4959-8173-27640f3deac7 | icf/Code | C++ code/GpBCS_S.C.CPMC/SC_afqmcConstraintPathBP_4/include/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXf mat(2,4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
MatrixXf::Index maxIndex;
float maxNorm = mat.colwise().sum().maxCoeff(&maxIndex);
std::cout << "Maximum sum at position " << maxIndex << std:... | ALGO | 0.999896 | 4.220459 |
be27c396-e6ff-4695-a147-06099623e681 | raincross7/code-similarity | codes/train_code/problem291/problem291_280.cpp | #include <iostream>
using namespace std;
int main(void) {
unsigned d, x, s;
while(cin >> d) {
x = 0; s = 0;
while(x < 600) {
s += x * x * d;
x += d;
}
cout << s << endl;
}
} | ALGO | 0.998782 | 3.515355 |
dff4c008-8232-4a61-8b15-3e58ded17ce5 | rxb8k/Algorithm | 그리디/1439_문자열뒤집기.cpp | #include <iostream>
using namespace std;
#define SIZE 1000000
int main(){
char s[SIZE]={};
cin>>s;
int count0=0, count1=0; // 문자열 내 0 영역 및 1 영역의 개수
for(int i=0;i<=SIZE;i++) {
if(i==0) s[i]=='1' ? count1++ : count0++;
else{
if(s[i-1]=='1'&&s[i]=='0') count0++; // 1->0으로 바뀌면... | ALGO | 0.999986 | 4.208415 |
4ee86323-ebda-401c-a12f-e392bc098648 | arangi0072/arpit_rangi | 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 |
2103b081-a741-4446-9208-39226c599310 | IrinaMBejan/Personal-work-contests | Algorithmics/Problems from various contests/windws.cpp | #include <fstream>
#define Nmax 105
using namespace std;
ifstream fin("windows.in");
ofstream fout("windows.out");
struct fereastra
{
int ls,ld,cs,cd;
}f[Nmax];
int N;
int in[Nmax];
int rez;
void Citire();
int peste(int a, int b);
void Citire();
void Afisare();
void Inchide();
void rezolv();
int main()
{
Cit... | ALGO | 0.999135 | 3.517731 |
451fa1ec-7f8d-485d-b35c-b0b34500c545 | Sekakou/OIsrc | data_structure/balanced/4402robotic_sort.cpp | // P4402 & P3165 & UVA1402 & SPOJ-CERC07S
#include <bits/stdc++.h>
using namespace std;
inline int read()
{
int p = 0;
char c = getchar();
while (c < '0' || c > '9')
c = getchar();
while (c >= '0' && c <= '9')
p = p * 10 + c - '0', c = getchar();
return p;
}
const int INF = 0x3fffff... | ALGO | 0.999986 | 3.805864 |
165ce816-6843-4aa5-9301-c3b27125946f | Amrutanshu-Mishra/Dsa-progress | Recursion/friends-pairing-problem.cpp | #include<iostream>
#include<string>
using namespace std;
int friends_pairing(int n){
if(n==2){
return 2;
}
if(n==1){
return 1;
}
return friends_pairing(n-1)+(n-1)*friends_pairing(n-2);
}
int main(){
cout<<friends_pairing(4);
} | ALGO | 0.999964 | 4.372901 |
4fdd373a-8f81-4cd5-9a67-81b9b501910c | DungNguyenCoder/THCS2_PTIT | C06014.cpp | #include <stdio.h>
#include <math.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
typedef long long ll;
#define mx 100005
int CHECK = 1;
char s[1000];
char c[105][105];
void solution()
{
fgets(s,1000,stdin);
s[strlen(s) - 1] = NULL;
int n = strlen(s);
for(int i = 0; i < n; i++)
{
... | ALGO | 0.998978 | 3.468266 |
d73ed937-47fc-49f8-a480-3559b30862e4 | qk1512/DSA_2_HK231 | Huffman/Part_2/buildHuff.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <math.h>
#include<vector>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include <utility>
#include <algorithm>
#include <sstream>
using namespace std;
class Node{
public:
int weight;
char c;
int height;
Node* left;
N... | ALGO | 0.999649 | 4.049586 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.