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 |
|---|---|---|---|---|---|---|
5c6e1857-9252-4d23-a8e7-f43b2ca4cc0f | RabsuiraGH/Study | University/Course_1/BAaP/Lab_5/Lab_5_main.cpp | #include <iostream>
#include <string>
using namespace std;
template <typename T> T SafeInput(const string& inputMessage, const string& errorMessage)
{
T tempValue;
while (true)
{
cout << inputMessage << endl;
if (!(cin >> tempValue) || (cin.peek() != '\n'))
{
cout << ... | ALGO | 0.999775 | 4.494237 |
271068ca-2b8d-4c40-8653-21b292a7aad5 | adarsh-fr/Meals | 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.998841 | 6.783336 |
9c35d419-26fc-495b-b108-a8d422504238 | echoCodeScript/Data-Structures-And-Algorithms | Graph Theory/Pepcoding/Graph_Advanced3.cpp | #include<bits/stdC++.h>
using namespace std;
#define ll long long int
#define vi vector<int>
#define vil vector<ll>
#define vc vector<char>
#define vf vector<float>
#define vul vector<ull>
#define vb vector<bool>
#define vii vector<vector<int>>
#define vpii vector<pair<int,int>>
#define sti stack<int>
#define stc stack... | ALGO | 0.999807 | 3.764506 |
1777df02-2b92-466f-90e0-825ab3e3fb9c | muffin3864/Algorithm | C_plus/BOJ/02_conditional_statement/1330_compare_number/1330_compare_number.cpp | # include <iostream>
using namespace std;
int main()
{
int A, B;
cin >> A >> B;
if (A > B)
{
cout << ">";
}
else if (A < B)
{
cout << "<";
}
else if (A == B)
{
cout << "==";
}
return 0;
} | ALGO | 0.999986 | 3.808665 |
4a954b88-dfc7-439d-99f9-4fde099a9950 | ilyesLtifi/Competitive-Programming | TopCoder/SRM463-D2-1000.cpp | #include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define sz(x) (int)(x).size()
const long double PI = 3.141592653589793238L , EPS = 1e-12L;
const int N = 200005 , MOD = 1000000007;
using namespace std;
/**
* Editorial: https://apps.topcoder.com/wiki/display/tc/SRM+463... | ALGO | 0.999621 | 4.254187 |
c9d5c6f6-a18d-43c2-8092-a46f3f6ee1fb | luannfirme/ResidenciaTIC18-CPP | PI-P007/Exercicio4.cpp | #include <iostream>
#include <math.h>
using namespace std ;
int main(void) {
int aux, coun, Max=100, div;
cout << " Os numeros primos de 1 ate 100 sao: " << endl;
for(aux=2 ; aux<=Max ; aux++){
div=0;
for(coun=2; coun<=sqrt(aux); coun++)
if(aux%coun==0)
div++;
... | ALGO | 0.997946 | 4.03247 |
f1a6f3a3-95b1-4101-a2bc-2bc9cbab3384 | KailasMahavarkar/interview-prep | leetcode/find_all_anagrams_in_a_string_leetcode_438.cpp | #include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <vector>
#pragma GCC optimize("O3,unroll-loops")
using namespace std;
class Solution {
public:
// Function to find the starting indices of anagrams of string p in string s
vector<int> findAnagrams(string s, string p) {
... | ALGO | 0.999958 | 6.32597 |
ba499d36-cb01-40c0-b85f-590b36b39634 | CongJyu/Pitaya | HNU-CG/EX9-Q03/EX9-Q03/main.cpp | //
// main.cpp
// EX9-Q03 招聘
//
// Created by Rain Chen on 2021/12/6.
//
#include <iostream>
using namespace std;
struct Pj {
int a[100];
};
int main() {
int n, i, j, k, s = 0, t;
cin >> n;
Pj pj[4];
for (j = 1; j <= 3; j++) {
for (i = 1; i <= n; i++) {
cin >> pj[j].a[i];
... | ALGO | 0.999841 | 3.906949 |
62b73eeb-0e13-4c33-bc8c-4bef006641fa | JLUVicent/leetcode_solution | 0739.每日温度/0739-每日温度.cpp | class Solution {
public:
vector<int> dailyTemperatures(vector<int>& temperatures) {
vector<int> answer(temperatures.size(),0);
stack<int> st;
st.push(0);
for( int i = 1; i < temperatures.size(); i++){
if( temperatures[i] <= temperatures[st.top()]){
st.push... | ALGO | 0.999963 | 6.414838 |
69ad5185-fbf6-4c39-ba34-51fbaaf83435 | watislul/Ads_22B031261 | lab10/A.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
void bfs(vector <vector <int> > g, queue <pair <int, int> > q, int n, int m, int num, int twos) {
vector <vector <bool> > visited(n, vector<bool> (m, false));
visited[q.front().first][q.front().second] = true;
int cnt = 0;
whi... | ALGO | 0.999957 | 4.770617 |
5be2201d-7dd3-44b7-b728-6979104dcbfe | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_2566_133.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int a;
cin >> a;
cout << (a % 2);
}
| ALGO | 0.999514 | 3.34927 |
4687096a-7f16-4fd3-9670-41ff62c95029 | kazama679/ss2-C | ss2Bai9.cpp | #include <stdio.h>
int main() {
int n;
printf("Nhap vao n cho arr: ");
scanf("%d", &n);
if (n <= 0 || n > 1000) {
printf("Yeu cau nhap so lon hon 0 va nho hon 1000.\n");
return 0;
}
int arr[n];
for (int i = 0; i < n; i++) {
printf("Nhap phan tu thu %d: ", i);
... | ALGO | 0.999908 | 4.732327 |
44754987-191e-4ba5-9e01-aa1d6adcf162 | TonyMooori/studying | 2016_10/ANT_P027/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define N_PRIME 1000000007
#define ll int64_t
int n,m;
vector<int> k;
vector<int> kk;
bool binary_search(int x){
int l = 0;
int r = kk.size();
while( r - l >= 1 ){
int i = (l+r)/2; // lになりうる
if( kk[i] == x )return true;
else if(... | ALGO | 0.999996 | 4.018043 |
d18a09d1-2a12-4614-b6f7-574d65723cab | hsd1807/Coder-Army | Data Structures and Algorithms/HomeWork Sheets/086. Add two numbers represented by linked lists | Reverse a Linked List in groups of given size/HomeWork Sheet Solutions/1. Reverse a sublist of a linked list.cpp | //User function Template for C++
/*Link list node
struct Node {
int data;
struct Node *next;
Node(int x) {
data = x;
next = NULL;
}
};*/
class Solution
{
public:
Node* reverseBetween(Node* head, int m, int n)
{
Node* temp = new Node(0);
temp->next = head;
head = temp;
... | ALGO | 0.999975 | 5.559649 |
8e6d0288-69e5-4159-83ba-c610dd0b414a | alankrulfeld/Asteroids | AsteroidsR/pong/Juego.cpp | #include "juego.h"
#include <iostream>
#include "menu.h"
#define PLAYER_BASE_SIZE 20.0f
#define METEORS_SPEED 3.0f
namespace asteroids
{
namespace game
{
Texture2D backgrounds;
Rectangle player1;
const int screenWidth = 800;
const int screenHeight = 500;
Music musicPunch;
Music musicGamep... | TOOL | 0.942237 | 5.158941 |
f6225e09-e744-4f5d-83ad-26516fb7da4b | PengJiaqiao/LeetCode_Diary | src/0767_Reorganize_String/Reorganize_String.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
class Solution
{
public:
string reorganizeString(string S)
{
if (S.size() == 0)
return "";
vector<pair<int, char>> v(26);
for (int i = 0; i < 26; ++i)
v[i] = make_pair(0, 'a' + i);
... | ALGO | 0.999987 | 5.681232 |
05a427fe-2867-40ef-95c3-470806f7f1e8 | Gemmus/Cpp_language | Set4/Lab6/main.cpp | /* Smart pointers
Implement class Apartment for storing information about rented apartment. The class must contain a shared_ptr to House
(the class you implemented in an earlier exercise), apartment number, size of the apartment in m2 and the monthly rent.
All data members must be private.
There can be multiple ap... | TOOL | 0.919484 | 5.753021 |
33413d89-b132-4c04-a818-14da3482eba1 | ishandutta2007/codeforces | hjqiusl/normal/587/F.cpp | //~~
#define setI(x) freopen(x,"r",stdin)
#define setO(x) freopen(x,"w",stdout)
#include<bits/stdc++.h>
#define poly vector<int>
#define IOS ios::sync_with_stdio(false)
#define ll long long
#define mp make_pair
#define mt make_tuple
#define pa pair < int,int >
#define fi first
#define se second
#define inf 1e18
#define... | ALGO | 0.999951 | 4.124142 |
408c73d5-f856-4d06-8acb-9837a8830ee7 | NikBulygin/3Dcurveshierarchy | curves/ellipse/ellipse.cpp | #include "ellipse.h"
Ellipse::Ellipse(double radiusX, double radiusY) : a(radiusX), b(radiusY) {}
//For an ellipse lying in the XoY plane, its parametric representation is:
//x(t)=acos(t)x(t)=acos(t)
//y(t)=bsin(t)y(t)=bsin(t)
QVector3D Ellipse::getPoint(double t) const {
double x = a * std::cos(t);
double... | TOOL | 0.965971 | 6.917153 |
46280711-1d5a-4ed7-afb8-4b674ec38d0c | ishandutta2007/codeforces | belonogov/normal/571/B.cpp | #include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <string>
#include <cstring>
#include <queue>
#include <ctime>
#include <cassert>
#include <cstdio>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
using namespace std;
#define fr firs... | ALGO | 0.99997 | 3.518891 |
e1bc6b60-4692-4061-9e05-59dd038420d5 | murilogontijo/URI-accepted-solutions | uri 2166.cPP | #include <bits/stdc++.h>
using namespace std;
int main() {
int n,i,j,k;
double d;
cin>>n;
d = 2.5;
if(n>1){
while(n>2){
n--;
//d = 2+d;
d = 2+(1/d);
}
printf("%.10lf\n",1+(1/d));
}else if(n==1)
printf("%.10lf\n",1.5000000000);
else if(n==0)
printf("%.10lf\n",1.0000000000);
return 0;
}
| ALGO | 0.999412 | 3.027792 |
aa114ad2-5c44-47d9-9bb4-513fd66f30b7 | lyuzlion/Computer-Graphics-exps | project4/python/jnerf/ops/op_include/eigen/doc/snippets/Tutorial_solve_triangular.cpp | Matrix3f A;
Vector3f b;
A << 1,2,3, 0,5,6, 0,0,10;
b << 3, 3, 4;
cout << "Here is the matrix A:" << endl << A << endl;
cout << "Here is the vector b:" << endl << b << endl;
Vector3f x = A.triangularView<Upper>().solve(b);
cout << "The solution is:" << endl << x << endl;
| ALGO | 0.999653 | 3.055453 |
0aac5992-6f83-49f5-b321-f4343395715f | overhelmingcoder/CSE-281 | exp3prctc5.cpp |
/*Write a C++ program to delete the first node of a DLL. [Consider possible
edge cases] */
#include<bits/stdc++.h>
using namespace std;
struct node
{
struct node*prev;
int data;
struct node*next;
};
struct node*addtoempty(struct node*head,int data)
{
struct node*temp=(node*)malloc(sizeof(node));
... | ALGO | 0.999741 | 4.818197 |
3731c275-cc73-4195-88e2-e53d3cfafcc6 | bggillmore/CS251A_Gem5 | src/systemc/tests/systemc/misc/unit/data/datawidth_unsigned/extension/datawidth.cpp | /*****************************************************************************
datawidth.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/**************************************************************************... | ALGO | 0.965087 | 5.331775 |
89652f84-2506-4844-a43e-96ee12574d60 | sonapraneeth-a/competitive-programming_submissions | platforms/binarysearch/practice/hard/882__wildfire-sequel/solutions.cpp | // clang-format off
/**
* FILE DESCRIPTION
*
* Filename: 882__wildfire-sequel/solutions.cpp
* Created on: 05 September 2021
* Last modified: 05 September 2021
* Author: sonapraneeth_a
* Description: BinarySearch submission for 'Wildfire Sequel' problem
*/
/**
* CHANGELOG
*
* Date... | ALGO | 0.999951 | 5.566631 |
a4a6ab19-c842-4881-a23a-599dd8bf85cc | 4nc3str4l/course_high_performance_cpp | Section01/main.cpp | #include <pthread.h>
#include <iostream>
using namespace std;
void* threadProc(void *param)
{
for(int count = 0; count < 3; ++count)
{
cout << "Message => " << count << " from " << pthread_self() << endl;
}
pthread_exit(0);
}
int main()
{
pthread_t thread1, thread2, thread3;
pthread_... | ALGO | 0.881191 | 5.131765 |
3b4d0f8c-f962-4c9d-bb1c-9cb5326f778b | paperfrog1228/Algorithm | Baekjoon/11948_과목선택.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int ans,a[6];
int main(){
for(int i=0;i<6;i++) scanf("%d",&a[i]);
for(int i=0;i<4;i++)
for(int j=i+1;j<4;j++)
for(int k=j+1;k<4;k++)
ans=std::max(ans,a[i]+a[j]+a[k]);
ans+=max(a[4],a[5]);
printf("%d",ans);
}
| ALGO | 0.999942 | 3.895711 |
f9fbffa5-e4f1-4a1e-9753-d37e3bfecf03 | vivek7mehta/Udacity-CarND-MPC-Project | src/Eigen-3.3/bench/quat_slerp.cpp | #include <iostream>
#include <Eigen/Geometry>
#include <bench/BenchTimer.h>
using namespace Eigen;
using namespace std;
template<typename Q>
EIGEN_DONT_INLINE Q nlerp(const Q& a, const Q& b, typename Q::Scalar t)
{
return Q((a.coeffs() * (1.0-t) + b.coeffs() * t).normalized());
}
template<typename Q>
EIGEN_DONT_INL... | ALGO | 0.993242 | 6.23297 |
9df92813-1bfa-406a-8731-4b4906ecd8ca | leoI0II/N_Body_problem | N_body_project/solver_Adams_Bashforth.cpp | #include<vector>
#include"particle.hpp"
#include"angular_momentum.hpp"
#include"barycenter.hpp"
#include"barycenter_zeroing.hpp"
#include"barycenter_velocity.hpp"
#include"systems_energy.hpp"
#include"grav_func.hpp"
#include<fstream>
#include"kepler.hpp"
void Adams_Bashforth(std::vector<Particle>& pars,
do... | ALGO | 0.999884 | 4.434741 |
1f4de3fd-5dd8-4d60-8226-08f014bd4012 | raincross7/code-similarity | codes/train_code/problem306/problem306_17.cpp | #include <bits/stdc++.h>
using namespace std;
int x[100005];
int next1[100005];
int p[100005][20];
int N;
int kthparent(int x, int k){
for(int i = 19; i >= 0; i --){
if(k >= (1<<i)){
x = p[x][i];
k -= (1<<i);
if(x == N){return x;}
}
}
return x;
}
int ... | ALGO | 0.999973 | 3.253135 |
5b8f1624-5b93-4862-929f-757f318c254c | Saha-Kamalika/cpp-programming | STL/algorithm.cpp | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> v = {2, 3, 4, 1, 87};
for (int i : v) {
cout << i << " ";
}
sort(v.begin(), v.end());
cout << "After sorting" << endl;
for (int i : v) {
cout << i << " ";
}
cout << "7 found? -> " << binary_s... | ALGO | 0.999446 | 4.155367 |
a00a1137-8785-480a-af2e-5ca7254a9db1 | yanbcxf/cpp | MyToolKit/NumericalRecipes/recipes/qrupdt.cpp | #include <cmath>
#include "nr.h"
using namespace std;
void NR::qrupdt(Mat_IO_DP &r, Mat_IO_DP &qt, Vec_IO_DP &u, Vec_I_DP &v)
{
int i,k;
int n=u.size();
for (k=n-1;k>=0;k--)
if (u[k] != 0.0) break;
if (k < 0) k=0;
for (i=k-1;i>=0;i--) {
rotate(r,qt,i,u[i],-u[i+1]);
if (u[i] == 0.0)
u[i]=fabs(u[i+1]);
... | ALGO | 0.999944 | 3.811788 |
85d64d01-48e7-42c6-a5b1-bcd4955d5fc9 | TheWindISeek/VSCodeProjects | codes/unionFindWithArrays.cpp | // simple unite/find using 1D array
#include <iostream>
#include "myExceptions.h"
using namespace std;
int *equivClass, // equivalence class array
n; // number of elements
void initialize(int numberOfElements)
{// Initialize numberOfElements classes with one element each.
n = numberOfElements;
... | ALGO | 0.995251 | 5.681329 |
3d1aba1e-9405-4f28-820a-725a8a8ef199 | isudiptodas/Study-Files | Practice Set/C++/ReferenceVariable.cpp | // Reference variable (same variable with different names)
#include<iostream>
using namespace std;
int update(int &n){
n++;
return n;
}
int main(){
int a = 10; // a is assigned 10
int &b = a; // b is also pointed to a
cout<<a<<endl; // 10 will be printed
c... | TOOL | 0.940932 | 4.750238 |
ff5738a7-096d-4e10-baea-2d89d0466d70 | jadrian77/leetcode-problem-solving | 74.搜索二维矩阵.cpp | /*
* @lc app=leetcode.cn id=74 lang=cpp
*
* [74] 搜索二维矩阵
* 把二维当成一维数组,然后用二分法查找
*/
#include <vector>
#include <math.h>
using namespace std;
// @lc code=start
class Solution {
public:
bool searchMatrix(vector<vector<int>>& matrix, int target) {
int iVerSize = matrix.size();
int iHorSize = iVerSize... | ALGO | 0.999935 | 6.429449 |
d287fbcd-04c4-4e9d-910c-ca41838ed872 | LukePhairatt/SDC-PathPlanning-Project1-T3 | src/Eigen-3.3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_reductions_bool.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
using namespace Eigen;
int main()
{
ArrayXXf a(2,2);
a << 1,2,
3,4;
cout << "(a > 0).all() = " << (a > 0).all() << endl;
cout << "(a > 0).any() = " << (a > 0).any() << endl;
cout << "(a > 0).count() = " << (a > 0).count() << endl... | ALGO | 0.932798 | 3.859743 |
6952575a-6ddc-41d1-a86e-4f6b7a624137 | itpaulin/ExerciciosFaculdade | Lista de Exercicios 01 e 02/3 Ponteiros/exec 9.cpp | #include <stdio.h>
#include <math.h>
float pontomedio (float xi,float yi, float xf, float yf, float *xm, float *ym){
*xm = (xi+xf/2);
*ym = (yi+yf/2);
}
main(){
float xi = 2;
float yi = 1;
float xf= 7;
float yf= 6;
float xm;
float ym;
pontomedio(xi,yi,xf,yf,&xm,&ym);
printf("%f, %f", xm, ym);
}
| ALGO | 0.98933 | 3.697345 |
6e0e8b19-a551-4bcc-a13f-a4e8453b1f26 | openshmem-org/lsms-shmem | src/Main/buildLIZandCommLists.cpp | #include <vector>
#include <cmath>
#include <stdio.h>
#include "Real.hpp"
#include "SystemParameters.hpp"
#include "Communication/LSMSCommunication.hpp"
class LIZInfoType{
public:
int idx;
Real p1,p2,p3;
Real dSqr;
};
// for buildLIZ see LSMS_1 neighbors_c.f
int buildLIZ(CrystalParameters &crystal, int idx,st... | ALGO | 0.997971 | 5.026374 |
a531cc74-a9e3-44ff-97ba-c75e29fb5aed | liaohuangg/RfCgraTrans | llvm/libcxx/test/std/algorithms/alg.nonmodifying/alg.search/search_n_pred.pass.cpp | // <algorithm>
// template<class ForwardIterator, class Size, class T, class BinaryPredicate>
// constexpr ForwardIterator // constexpr after C++17
// search_n(ForwardIterator first, ForwardIterator last, Size count,
// const T& value, BinaryPredicate pred);
#include <algorithm>
#include <cassert>
... | TEST | 0.998404 | 7.341774 |
bfd379af-f3c8-4a1b-90c3-dc246aa99726 | luoshuifan/Engine | Source/ThirdParty/ICU/icu4c-64_1/source/test/intltest/colldata.cpp | #include "unicode/utypes.h"
#if !UCONFIG_NO_COLLATION
#include "unicode/unistr.h"
#include "unicode/usearch.h"
#include "cmemory.h"
#include "unicode/coll.h"
#include "unicode/tblcoll.h"
#include "unicode/coleitr.h"
#include "unicode/ucoleitr.h"
#include "unicode/regex.h" // TODO: make conditional on regexp ... | TOOL | 0.851844 | 7.233231 |
4c76cbc8-6553-4acd-9447-a21319f4faa5 | ArchitKumar1/LeetCode-Submissions | univalued-binary-tree/Accepted/2-19-2019, 9:50:35 PM/Solution.cpp | // https://leetcode.com/problems/univalued-binary-tree
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
int a;
int ans = 1;
void dfs(Tr... | ALGO | 0.99986 | 6.499716 |
e078aedc-716f-4703-90bd-41c4e7b5ba08 | soojjung/nyu-tandon-bridge | homework15/sj5155_hw15.cpp | // payments_amount_first_payersflag.cpp
// 형식: [금액] [이름(여러 단어 가능)]
// 예) 20 Alice
// 50 Bob Charles
// 빌드: g++ -std=c++11 -O2 -Wall payments_amount_first_payersflag.cpp -o
// payments 실행: ./payments
#include <algorithm>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <strin... | ALGO | 0.997895 | 5.235379 |
0535ddef-1aa5-4444-a412-130bf2666f10 | Thalisson-Alves/Competitive-Programming | submissions/CSES/download-speed.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef DEBUG
#include "debug.cpp"
#else
#define dbg(...) 4269
#endif
#define all(x) x.begin(), x.end()
using ll = long long;
using ull = unsigned long long;
const vector<pair<int, int>> dir4{{1,0},{-1,0},{0,1},{0,-1}};
template <typename T>
struct MaxFlow {
vector... | ALGO | 0.999939 | 5.286249 |
387c65ba-53ab-4829-9437-6450f1e61340 | Aty-0/S2DE | Libs/boost_1_76_0/libs/graph_parallel/test/distributed_shortest_paths_test.cpp | // Authors: Douglas Gregor
// Andrew Lumsdaine
#define PBGL_ACCOUNTING
#include <boost/graph/use_mpi.hpp>
#include <boost/config.hpp>
#include <boost/throw_exception.hpp>
#include <boost/graph/distributed/delta_stepping_shortest_paths.hpp>
#include <boost/graph/distributed/mpi_process_group.hpp>
#include <b... | TEST | 0.995164 | 6.054136 |
4b3aa848-a0d8-4b21-934b-c03a9bab48c9 | ZwodahS/LD30 | ConnectedWorlds/zf/zf_strings.cpp | #include "zf_strings.hpp"
#include <sstream>
namespace zf
{
/**
* These 2 functions are taken from
* http://stackoverflow.com/questions/236129/how-to-split-a-string-in-c
*/
std::vector<std::string>& splitStringByDelimiter(const std::string &s, char delim, std::vector<std::string> &elems)
{
... | TOOL | 0.944408 | 4.887999 |
c12ed5c2-ad20-4859-a165-17e3ebcd6670 | renatostanz/gemp | classes/12-Recursion/exercises/beecrowd_1257.cpp | #include <iostream>
using namespace std;
int hash_da_linha(int linha, string str, int pos = 0, int hash = 0);
int main() {
int num_de_testes;
cin >> num_de_testes;
int resultados[num_de_testes]{0};
for (int k = 0; k < num_de_testes; k++) {
int num_de_linhas;
cin >> num_de_linhas;
for (int linha = 0; lin... | ALGO | 0.999399 | 4.154045 |
c86b8594-b584-45f6-a69f-405f3298709f | ChangkunLi/Shabby_2D_DG_solver | MassMatrix2D.cpp | #include "headers.h"
MatrixXd MassMatrix2D(const MatrixXd& C, int p, MatrixXd& Phi){
int N = (p+1)*(p+2)/2;
MatrixXd M_proto;
// compute Phi
int nq;
MatrixXd xyq_2d,wq_2d;
quad2d(2*p+1, nq, xyq_2d, wq_2d);
MatrixXd A(nq, N);
for(int i=0; i<nq; i++){
int k = 0;
for(i... | ALGO | 0.999086 | 5.098523 |
43b747b0-6bb0-40fb-935b-8d931dab5430 | SewerynKaminski/AdventOfCode | year2022/day24/day_24.cpp | #include "day"
#include <ranges>
#include <iomanip>
#include <unordered_set>
#include <cmath>
//---------------------------------------------------------------------------//
namespace aoc::YEAR::DAY {
//---------------------------------------------------------------------------//
// Test data
std::string testinput
{
... | ALGO | 0.999792 | 5.537808 |
edafbda2-87d1-49fd-bec4-07c063b6d063 | smrt-crypto/smrt | src/rpcnet.cpp | #include "rpcserver.h"
#include "clientversion.h"
#include "main.h"
#include "net.h"
#include "netbase.h"
#include "protocol.h"
#include "sync.h"
#include "timedata.h"
#include "util.h"
#include "version.h"
#include <boost/foreach.hpp>
#include "json/json_spirit_value.h"
using namespace json_spirit;
using namespace... | WEB | 0.943806 | 6.463405 |
f5410f81-f905-47d9-bdfc-d88c5a82504e | vectar31/Spoj-solutions-and-other-c-codes | ACPC11B/main.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int abso(int x)
{
if(x>0)
return x;
return -x;
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
int n1,n2;
scanf("%d",&n1);
int h1[n1];
for(int i=0;i<n1;i++)
scan... | ALGO | 0.999927 | 3.315802 |
569c8843-9e64-475d-aad6-09668c6aaa54 | chenchienkuo9010/c-cpp-practice | wdd/cpp/stl/day01/09sort/main.cpp | #include <algorithm>
#include <iostream>
using namespace std;
template<typename T>
void swap_(T& a, T& b) {
T tmp = a;
a = b;
b = tmp;
}
template<typename T>
void show(T arr[], size_t l) {
for(int i=0; i < l; ++i) {
cout << arr[i] << ' ';
}
cout << endl;
}
template<typename T>
bool le... | ALGO | 0.999668 | 4.598745 |
b1cfe876-10bc-4fd2-843c-9a5cda558902 | yogeshkumar9071/LPU-COLAB-SOLUTIONS | CPP/Unit-3/LEC-15/COD/Jai_and_rekha_planning_to_paint.cpp | //Jai and Rekha are planning to paint their newly built house and are trying to automate the calculation of their wall area in order to order the amount of paint they might need.
//calculateArea
#include <iostream>
#include <iomanip>
using namespace std;
class Wall {
private:
float length;
float height;
... | TOOL | 0.882856 | 5.690537 |
6cebecc7-1b0e-4308-b9b2-f96219de711f | donnyrla10/CodingTest | BOJ/cpp/1417.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
//국회의원 후보 n명
//마을의 주민 M명의 마음 모두 읽음
//다른 모든 사람의 득표수보다 많은 득표수를 가질 때, 그 사람이 국회의원에 당선
//매수해야 하는 사람의 최솟값 출력하기
bool comp(int a, int b){
return a > b;
}
int main(){
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n, ans=0, das... | ALGO | 0.999937 | 3.923336 |
d27973cb-a1e7-4502-9b87-cdcdb24dbe8e | liv1n9/competitive-programing | codeforces/1206/1206d.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
using ull = unsigned long long;
const double INF = 1e18;
const double EPS = 1e-8;
const int MOD = 1e9 + 7;
const int N = 1e5 + 8;
#define len(x) (int)(x).size()
#define lowest(x) (*(x).begin())
#define highest(x) (*(x).rbe... | ALGO | 0.999794 | 4.168345 |
ac8ae51b-bf8f-4fb5-be69-fa129e623ade | geekanamika/Interview-Prep-DS-Algo | strings/c++/findNoOfCharToDeleteToMakeStringsAnagram.cpp | /*
Anagram of String
Given two strings S1 and S2 in lowercase, the task is to make them anagram. The only allowed operation is to remove a character from any string. Find minimum number of characters to be deleted to make both the strings anagram. If two strings contains same data set in any order then strings are call... | ALGO | 0.999928 | 6.19967 |
8596c0ea-dcc5-4fd7-8a5a-5a5ce8e60e2f | Praneethpshetty24/C_DSA | Pattern/7.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int i =1;
while(i<=n){
int j =1;
while(j<=n){
char ch = 'A'+i+j-2;
cout<<ch<<" ";
ch++;
j++;
}
cout<<endl;
i++;
}
return 0;
} | ALGO | 0.999653 | 3.635931 |
1bde58b1-5f97-4fe9-8ef7-897ec8133d7b | SwedeshnaMishra/DSA | LeetCode/Reverse Bits.cpp | // 190. Reverse Bits
// Reverse bits of a given 32 bits unsigned integer.
// Note:
// Note that in some languages, such as Java, there is no unsigned integer type. In this case, both input and output will be given as a signed integer type. They should not affect your implementation, as the integer's internal binary re... | ALGO | 0.999824 | 6.18247 |
736c3e8e-2ee7-4216-845c-741da2ab654e | Johniel/uva | 443.cpp | #include <iostream>
#include <algorithm>
#include <queue>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <complex>
#include <cstdlib>
#include <climits>
#include <utility>
#include <sstream>
#define REP(i, n) for(long long i=0; i<(long long)n; i++)
#define ALL(c) (c).begin(),(c).end()
using... | ALGO | 0.999691 | 4.115932 |
ee76ae2e-ed4a-44b9-8d88-4a3f768b4ef2 | bhartik021/6Companies30Days | Company-4-[Flipkart]/1095. Find in Mountain Array.cpp | /**
* // This is the MountainArray's API interface.
* // You should not implement it, or speculate about its implementation
* class MountainArray {
* public:
* int get(int index);
* int length();
* };
*/
class Solution {
public:
int findInMountainArray(int target, MountainArray &mountainArr) {
... | ALGO | 0.99999 | 6.400246 |
733d3ad7-811a-48e3-a98d-f9bdab908a38 | JanDub-code/C-plus-plus | Algorithmization/hloubastromu.cpp | #include <iostream>
using namespace std;
struct Prvek{
char *hodnota;
Prvek*levy;
Prvek*pravy;
};
int hladina(Prvek*pr){
if(pr==nullptr){
return 0;
}
else{
int lev=hladina(pr->levy);
int prav=hladina(pr->pravy);
}
if(lev<prav){
... | ALGO | 0.995967 | 3.330176 |
7d6459cd-9756-40aa-bb6f-ece2ba1ea5f9 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_1487_13.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 300100;
int a[N];
int previdx[N];
int maxdist[N];
int main() {
cin.tie(0);
cin.sync_with_stdio(0);
int tt;
cin >> tt;
while (tt--) {
int n;
cin >> n;
for (int i = 0; i < n; ++i) cin >> a[i];
for (int i = 0; i <= n; ++i) previdx[i] = -... | ALGO | 0.999976 | 4.548666 |
2db69967-21fb-4542-980a-9cb0ae928074 | MuditaShakya/Leetcode | 2130-maximum-twin-sum-of-a-linked-list/2130-maximum-twin-sum-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:
int pairSum(ListNode*... | ALGO | 0.999992 | 5.349454 |
4f63dd39-d52e-4f34-a8df-e4afb4926d5c | zhaoxiaohui/LeetCode | Single Number.cpp | /**
* Description:
* Author: zhaoxiaohui
* Site: zhaoxiaohui.sinaapp.com
* Date: 2014
*/
class Solution {
public:
int singleNumber(int A[], int n) {
if(n==0)return 0;
int ret = A[0];
for(int i=1;i<n;i++){
ret ^= A[i];
}
return ret;
}
}; | ALGO | 0.999819 | 5.144293 |
17edd65d-fff4-4212-a5ce-f92542625c8e | olcaytaner/201-DataStructures-Exam-CPP | src/Array/Hash.cpp | //
// Created by Olcay Taner YILDIZ on 17.04.2023.
//
#include "Hash.h"
namespace array {
int Hash::hashFunction(int value) {
return value % N;
}
Hash::Hash(int N) {
table = new Element *[N];
deleted = new bool[N];
this->N = N;
}
Hash::~Hash() {
for (int ... | ALGO | 0.963148 | 4.667295 |
0c22e560-ffb4-4477-91ee-953378579321 | bxr99/Stroustrup_ppp | Chapter_5/ex08.cpp | #include "std_lib_facilities.h"
int main()
{
try {
vector<int> values;
int N = 0;
cout << "Enter the number of values you want to sum: ";
cin >> N;
cout << "Enter some integers (press '|' to stop): ";
for (int i; cin>>i;)
values.push_back(i);
int sum = 0;
for (int i = 0; i < ... | ALGO | 0.937179 | 5.601493 |
53512970-e402-4fe0-a80a-70c817df2a24 | littlepsyduck/PROPTIT-Algorithm | CONTEST PROPTIT/D. [ProPTIT-Practice-Algorithm] Rut go.cpp | #include <bits/stdc++.h>
#define ll long long
#define mod 1000000007
#define endl '\n'
#define pb push_back
using namespace std;
const int Nmax = 1e6;
void fast()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
void solve()
{
ll n, k;
cin >> n >> k;
ll k1 = n / k;
if (k1 % 2 ... | ALGO | 0.999813 | 5.010557 |
a99849fc-e181-4cf3-bf4c-f598a0aa2808 | akhilravipati97/adventOfCode | helpers/template.cpp | #include <fstream>
#include <iostream>
#include <string>
#include <unordered_set>
#include <unordered_map>
#include <numeric>
#include <vector>
#include <cassert>
#include <algorithm>
#include "../helpers/readInputFile.cpp"
int run_part1(std::vector<std::string>& lines) {
return 0;
}
int run_part2(std::vector<std... | ALGO | 0.934902 | 4.961412 |
18c4be3c-3209-44fa-a76e-8f0f5ea4b800 | l2371792777/leetcode | old/finish/leet_673/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <limits.h>
using namespace std;
int findNumberOfLIS(vector<int> &nums)
{
int n = nums.size() - 1;
vector<int> nl(n + 1);
vector<int> nt(n + 1);
int max_num = 0;
int res = 0;
for (int i = 0; i <= n; i++)
{
nl[i] = ... | ALGO | 0.999936 | 5.167492 |
9e68e964-30bf-4a64-8f54-c12f5b68e21a | JeevanPurohit11/Data-Structure-and-Algorithm | LC-Combination Sum II.cpp | class Solution {
public:
//slight change compare to combination sum I
void comSum(int ind,int sum,vector<int>& candidates, int target,vector<vector<int>>&ans,vector<int>&temp,int n){
if(sum==target){
ans.push_back(temp);
return;
}else if(sum>target){
return;
}
for(int i=ind;i<n;i++){
/... | ALGO | 0.999969 | 6.056373 |
96c6a7ef-6d80-4629-9ec7-e86da1cceef5 | ShantoOBS/Interview_DS_Algorithm | Backtracking/Solve the Sudoku.cpp | /*
Company Tags : Zoho, Flipkart, Amazon, Microsoft, MakeMy Trip, Ola Cabs, Oracle, MAQ Software, Directi, PayPal, Samsung
GFG Link : https://www.geeksforgeeks.org/problems/solve-the-sudoku-1587115621/1
*/
/*************************************************************** C++ *****************************... | ALGO | 0.9983 | 6.228841 |
d61f60dd-6345-4192-b2ad-30c1315f76c0 | Akrobatik/ps | BaekJoon/26000/26675.cpp | // Title : Punkty rankingowe
// Link : https://www.acmicpc.net/problem/26675
// Time : 0 ms
// Memory: 2020 KB
#include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
vector<int> arr(n + 1), memo(n + 1, INT_MAX >> 1);
memo[0] = 0;
... | ALGO | 0.999951 | 4.309816 |
00512493-efad-45c3-bd90-39daa142854f | TengFeiyang01/Algorithm | bishi/5-11荣耀/d.cpp | #include <bits/stdc++.h>
const int inf = 0x3f3f3f3f;
using i64 = long long;
void solve() {
int n;
std::string s;
std::cin >> n >> s;
std::string ans;
for (int i = 0; i < n; ++i) {
if (isdigit(s[i])) {
int j = i;
i64 cnt = 0;
while (j < n and isdigit(s[j])) {
cnt = cnt... | ALGO | 0.999586 | 5.674698 |
bec780fd-51d1-4e4f-a005-0e3d451a8b02 | shubhansu-kr/Recursion-Striver | Revision/03_ReverseArray.cpp | // Reverse an array using recursion
#include <bits/stdc++.h>
using namespace std ;
class Solution2{
// Smart Parameters.
public:
void solve(vector<int> &nums, int i, int j) {
if (i >= j) return;
swap(nums[i], nums[j]);
solve(nums, i+1, j-1);
}
vector<int> reversArr(vector<int... | ALGO | 0.999967 | 6.007412 |
b7b7b834-3fa8-4908-aa62-c4a757b4e4a5 | Manik-Aggarwal/Leetcode | Count total set bits - GFG/count-total-set-bits.cpp | //{ Driver Code Starts
//Initial Template for C++
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution{
public:
//find a power of 2 which is less than or equal to n, eg n=11, nearest power is 8
int countpower(int n){
int x=0;
... | ALGO | 0.999909 | 6.333676 |
8963b39b-7f0e-463c-acf6-ed75a116627b | adikul30/competitive-programming | codechef/CLEANUP.cpp | #include <bits/stdc++.h>
using namespace std;
#define INF (int)1e9
#define EPS 1e-9
#define REP(i, a, b) for(int i = a; i < b; ++i)
#define PB push_back
#define MP make_pair
typedef long long ll;
typedef pair<int, int> PII;
// vector<int> VI,chef,chefas;
typedef vector<string> VS;
typedef vector<PII> VII;
const flo... | ALGO | 0.999873 | 3.29582 |
986858de-c857-4193-9f7d-ddfa635f51c2 | codeforboston/anypia-js | oactobjs32/piadata/BendPoints.cpp | // Functions for the <see cref="BendPoints"/> class to handle PIA and MFB
// formula bend points.
// $Id: BendPoints.cpp 1.6 2017/09/18 10:37:22EDT 277133 Development $
#include <cmath> // for floor
#include "BendPoints.h"
#include "avgwg.h"
using namespace std;
| ALGO | 0.994696 | 5.386163 |
793abe28-ada8-4fad-b788-75cbbcaf92b7 | ci9ci/IED-Esame-3-anno | app_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.99897 | 6.785645 |
9c388e3e-c616-4fc4-9c43-50a70fa6a9c9 | datmieu204/DSA | DSA_DAT/Algorithms/Sorting/MergeSort.cpp | #include<iostream>
#include<vector>
using namespace std;
// O(n logn)
// Trộn 2 dãy con được sắp xếp tăng dần
void merge(int a[], int left, int mid, int right){
vector<int> leftarray(a+left, a+mid+1); //dãy bên trái
vector<int> rightarray(a+mid+1, a+right+1); //dãy bên phải
int i=0; // chỉ số dãy trái
... | ALGO | 0.999987 | 4.466935 |
93497433-6d57-4ecb-9fb3-65a035207be1 | bhutamanav11/LeetCode | Easy/Special-Array-I.cpp | class Solution {
public:
bool isArraySpecial(vector<int>& nums) {
for(int i = 1;i<nums.size();i++){
if(nums[i]%2==nums[i-1]%2){
return false;
}
}
return true;
}
};
| ALGO | 0.999543 | 5.516364 |
9ea68550-4215-4fa5-bab6-f9c8fbcd0016 | Abhisays27/SDE-Sheet | 1653-minimum-deletions-to-make-string-balanced/1653-minimum-deletions-to-make-string-balanced.cpp | class Solution {
public:
int minimumDeletions(string s) {
int b_count = 0;
int deletions = 0;
for (char c : s) {
if (c == 'b') {
b_count++;
} else if (c == 'a') {
if (b_count > 0) {
deletions++;
... | ALGO | 0.999553 | 6.275116 |
fb15c746-2a40-4e93-9bed-1a79afb00396 | i-aman0/Cpp-Codes | TreesNew/Binary Tree/CreateBinaryTreeFromLevelOrder.cpp | #include<iostream>
#include<queue>
using namespace std;
class node{
public:
int data;
node* left;
node* right;
// Constructor
node(int data){
this->data=data;
this->left=NULL;
this->right=NULL;
}
};
// function to build the tree
... | ALGO | 0.999884 | 4.931337 |
dcd6eaf5-6758-4ee0-906c-f8b50e8f8347 | abusomani/Leetcode | Practice/minimum-remove-to-make-valid-parantheses.cpp | class Solution {
public:
string minRemoveToMakeValid(string s) {
int N = s.size();
vector<int> toAdd(N,1);
vector<pair<char,int>> V;
for(int i=0;i<N;i++){
if(s[i] == '(')
V.push_back({'(', i});
else if(s[i] == ')')
{
... | ALGO | 0.999939 | 6.078915 |
5e949be0-abe7-4097-a1fd-e088d618c240 | ShivamSinghal1/Competitive-Programming-Algorithms | General_Algo/Activity-Selection.cpp | //Unweighted Activity Selection
//Also called as unweighted interval Selection/ interval selection
#include<iostream>
#include<cstdio>
#include<vector>
#include<utility>
#include<algorithm>
#define strt(i) vec[i].second
#define fin(i) vec[i].first
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
... | ALGO | 0.999896 | 4.390434 |
738789db-86c6-4db4-94f8-8879a7ffccc0 | harrySentinel/DSA | Array/alternatingMatrix.cpp | #include <iostream>
using namespace std;
// Function to generate and display the alternating 0s and 1s matrix
void generateMatrix(int size) {
for (int i = 0; i < size; i++) {
for (int j = 0; j < size; j++) {
cout << ((i + j) % 2) << " "; // Alternates between 0 and 1
}
cout << e... | ALGO | 0.94917 | 6.497149 |
2ecaedc1-06af-41ec-8c7c-ebe12c03d0fb | Dahshatking/ADA_college | ADA Lab/select sort path by partition/SelecSortbyPartition.cpp | // Read-up : In selection sort, we iterate through the array from idx-> 0 to n and each time we get the shortest element from the array particularly from idx+1 till the end.
// Now instead of getting that smallest elt by iterating through array yet again , we're doing the same using quick sort and partition wherein the... | ALGO | 0.997485 | 5.307676 |
385beb6e-a425-4a5e-9dd0-a46fcddd487b | Shivang309/Problem-Solving | day9_4.cpp | /*
Handshake
https://www.hackerrank.com/challenges/handshake/problem
#include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
/*
* Complete the 'handshake' function below.
*
* The function is expected to return an INTEGER.
* The function accepts INTEGER n as para... | ALGO | 0.999772 | 5.749382 |
99a5eff0-71c3-460d-805c-5731463e0a71 | saadrafi/XPSC | week05/day4/N_Long_Long.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
long long int a[n], sum = 0;
bool flag = false;
int count = 0;
for (int i = 0; i < n; i++)
... | ALGO | 0.999554 | 4.33845 |
c4b806c7-dc31-49a3-80b9-0215b5a9a0a5 | DnV1eX/Telegram-iOS | third-party/openh264/third_party/openh264/src/codec/decoder/core/src/manage_dec_ref.cpp | #include "manage_dec_ref.h"
#include "error_concealment.h"
#include "error_code.h"
#include "decoder.h"
namespace WelsDec {
static PPicture WelsDelShortFromList (PRefPic pRefPic, int32_t iFrameNum);
static PPicture WelsDelLongFromList (PRefPic pRefPic, uint32_t uiLongTermFrameIdx);
static PPicture WelsDelShortFromLis... | TOOL | 0.937537 | 4.984951 |
2384cf9c-6bcd-4305-a2ae-5b37c496be7d | agul/contest-tasks | caide_archive/2016-05-22/yandexUnknown/submission.cpp | #pragma comment(linker, "/STACK:66777216")
#include <cstdio>
#pragma warning(disable : 4996)
#include <algorithm>
#include <array>
#include <cstdlib>
#include <vector>
#include <cstring>
#include <string>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <utilit... | ALGO | 0.999917 | 4.129152 |
eb2a0f91-e42a-4a3d-b895-6745017d1444 | DipankerSingh/IntroToProgrammingFALL2015 | final_reverselist.cpp | // AIM: Implemet a linked list and reverse it
//MADE BY: DIPANKER SINGH(397/COE/14)
#include <bits/stdc++.h>
#include <conio.h>
using namespace std;
struct node
{
int data;
node *next;
}*head,*rear;
node* createnode();
int menu(int flag);
void insert();
void del();
void display();
int underflow();
void rev... | ALGO | 0.999563 | 4.106751 |
66c94fea-8d7c-4727-ad93-143d87ef41e7 | IAmFunkyFrog/EigenValuesFinder | libs/MatrixUtils/MatrixUtils.cpp | #include "MatrixUtils.h"
#include "../RationalNum/RationalNum.h"
#include <vector>
#include <algorithm>
#include <cmath>
#include <set>
using namespace std;
RationalNum getMainMinor(RationalNum** matrix, vector<unsigned int>&rows) {
if(rows.empty()) return 1ll;
vector<unsigned int>permutation;
for(int i ... | ALGO | 0.999535 | 4.088737 |
658b9f83-11e7-4305-95fa-7653c72996ec | slonoten/algo-handbook | fib.cpp | #include <iostream>
int main() {
size_t n;
std::cin >> n;
switch (n)
{
case 0:
std::cout << 0;
break;
case 1:
std::cout << 1;
break;
default:
long fnm2{0};
long fnm1{1};
for (size_t i{2}; i <= n;... | ALGO | 0.999966 | 5.188885 |
a225ee88-cc1b-4c98-ae00-57300734b565 | satyajit-patel/NOTES | algoCamp/3_recursion/Sum of Array.cpp | // https://practice.geeksforgeeks.org/problems/sum-of-array2326/1?utm_source=gfg&utm_medium=article&utm_campaign=bottom_sticky_on_article
class Solution{
public:
int f(int i, int N, int* arr, vector<int>& dp) {
// base case
if(i >= N) return 0;
if(dp[i] != -1) return 0;
// r... | ALGO | 0.9999 | 6.012282 |
bb39bbf3-8d8a-41a6-a2bf-6c35bd6e0cb6 | shitcodebykaushik/DSA_Workspace | leetcode/Hashing/1748.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int sumOfUnique(vector<int>& nums) {
unordered_map <int,int> freq;
// count the frequecy of each number
for(int num:nums){
freq[num]++;
}
int sum = 0;
// Sum the number that appears e... | ALGO | 0.999939 | 5.680805 |
99ade6c7-aefa-4b92-bf00-19875d79b29d | anubhvshrma18/Leetcode-Daily-Challenges | October 2024/Day 04. Divide Players Into Teams of Equal Skill.cpp | class Solution {
public:
long long dividePlayers(vector<int>& S) {
if(S.size()==2) return S[0]*S[1];
int ts = accumulate(S.begin(), S.end(),0);
int tt = S.size()/2;
if(ts%(tt) != 0) return -1;
int tS = ts/tt;
unordered_map<int,int> mp;
for(int num:S) ... | ALGO | 0.99988 | 4.359547 |
a75ca049-8723-4616-b860-cab364e0c13f | piyushDSM/Cpp-DSA-Practice | Subset.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
void subsetSumsHelper(int ind, vector < int > & arr, int n, vector < int > & ans, int sum) {
if (ind == n) {
ans.push_back(sum);
return;
}
//element is picked
subsetSumsHelper(ind + 1, arr, n, ans, sum +... | ALGO | 0.99996 | 5.423017 |
4d48bdc0-1263-4386-ba5a-395a6ecfcb6c | huipengly/CppLearn | 程序员代码面试指南/chap5/字符串的统计字符串.cpp | #include <vector>
#include <string>
#include <iostream>
using namespace std;
string getCountString(const string& str)
{
if (str.empty())
return "";
int start = 0;
string countStr{};
for (int i = 1; i != str.size(); ++i)
{
if (str[i] != str[start])
{
if (start != 0)
countStr += string{ "_" };
coun... | ALGO | 0.999864 | 4.25166 |
37291997-6606-491d-9a94-c827d42803a3 | Muto-Yuka/Game | 作品/2.メイドイン・アソウ/ソースコード/src/MyLib/Collision/Collision.cpp | #include "Collision.h"
// {bNXm
bool CCollision::CheckHitBoxToBox(VECTOR pos1, VECTOR pos2, VECTOR size1, VECTOR size2)
{
VECTOR halfSize1 = { size1.x * 0.5f, size1.y * 0.5f, size1.z * 0.5f };
VECTOR halfSize2 = { size2.x * 0.5f, size2.y * 0.5f, size2.z * 0.5f };
if (pos1.x - halfSize1.x < pos2.x + halfSize2.x
&... | ALGO | 0.953512 | 4.407424 |
86e2b582-43eb-4f52-b0c9-45fc054b3ec1 | ishandutta2007/codeforces | crtsir/normal/3/C.cpp | #include<bits/stdc++.h>
using namespace std;
int cnt[2];
bool w[2];
bool win(char c,char s[9])
{
if(s[0]==c&&s[3]==c&&s[6]==c)return true;
if(s[1]==c&&s[4]==c&&s[7]==c)return true;
if(s[2]==c&&s[5]==c&&s[8]==c)return true;
if(s[0]==c&&s[1]==c&&s[2]==c)return true;
if(s[3]==c&&s[4]==c&&s[5]==c)return true;
if(s[6]... | ALGO | 0.999989 | 3.548447 |
93d058b3-dae8-4635-932a-1f95f5f247b4 | HtetYalKyaw/C | math.cpp | #include<iostream>
#include<cmath>
using namespace std;
int main(){
double x = 4.245;
double y = 3;
double z;
//z = max(x , y); max = chose the maximum
//z = min(x , y); min = chose the mininum
//z = pow(2, 3); pow = 2 power 3
//z = sqrt(3); sqrt = square root of
//z = abs (-24)... | ALGO | 0.996854 | 3.379023 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.