uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
9c11f9b4-b0c5-4913-9e27-08e755bcbcde | szmybs/PhysIKA_Cloud | Extern/opencv-2.4.13/modules/ocl/src/stereobp.cpp | /*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, instal... | ALGO | 0.993689 | 6.323085 |
286062a2-fd73-4026-89a4-6df8c25d6316 | ishandutta2007/codeforces | cheetose/normal/1325/C.cpp | #include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
#define X first
#define Y second
#define y0 y12
#define y1 y22
#define INF 987654321987654321
#define PI 3.141592653589793238462643383279502884
#define fup(i,a,b,c) for(int (i)=(a);(i)<=(b);(i)+=(c))
#define fdn(i,a,b,c) for(int (i)=(a);(i)>=(b);(i)-=(c... | ALGO | 0.999991 | 4.13691 |
cff498a1-05b2-44a3-ba15-973ff82aa01d | lucastdcj/maratona | grafos/testes/uva-10989.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int n, m;
// Maximum number of vertices in the graph
#define MAXN 212
// Maximum edge weight (MAXW * NN * NN must fit into an int)
#define MAXW 1000
// Adjacency matrix and some internal arrays
int g[MAXN][MAXN], v[MAXN], w[MAXN], na[MA... | ALGO | 0.999989 | 5.117565 |
c9db2bfc-04c5-4d4e-ad64-0cab151ea8a3 | max-kazak/SensorFusion | 3D_Object_Tracking/src/camFusion_Student.cpp |
#include <iostream>
#include <algorithm>
#include <numeric>
#include <set>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include "camFusion.hpp"
#include "dataStructures.h"
using namespace std;
// Create groups of Lidar points whose projection into the camera falls into the same bou... | ALGO | 0.994638 | 3.006475 |
bf556949-4812-4063-a2f8-36236083d97b | singhalshreya/DSA | BasicCodes/perfectno.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
int main(){
int n,sum=0;
cin>>n;
for(int i=1;i<n;i++){
if(n%i==0){
sum += i;
}
}
if(n==sum){
cout<<"Perfect no"<<endl;
}
else{
cout<<"No"<<endl;
}
return 0;
} | ALGO | 0.999971 | 4.453374 |
bb2f0565-39ae-45ff-bd27-b14abc1af45f | Ahmed-M-Aboutaleb/Problem-Solving | Vjudge/Gym-102961G.cpp | #include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define all(v) v.begin(), v.end()
#define endl '\n'
#define vi vector<int>
#define vll vector<ll>
using namespace std;
void solve() {
ll n, x; cin >> n >> x;
vll nums(n);
vector<pair<ll, int>> indexedNums;
for (int i = 0; i < n; ++i) {
... | ALGO | 0.999917 | 4.618309 |
757289f2-4aa6-4414-b1dc-6879414e3884 | Yash-kaushik29/DSA-practice-questions-Set-1 | Yash-kaushik29/Bitwise and of number range.cpp | class Solution {
public:
int rangeBitwiseAnd(int left, int right) {
int c = 0;
while( left != right)
{
left = left >> 1;
right = right >> 1;
c++;
}
return left<<c;
}
};
| ALGO | 0.999961 | 5.961781 |
2329f7c5-4195-4aa4-8c4b-7a38e31e5a74 | 42somoim/42somoim1 | suntlee/week9/회의실배정.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct meeting {
int start;
int end;
};
bool cmp(meeting a, meeting b)
{
if (a.end == b.end)
return a.start < b.start;
return a.end < b.end;
}
void print(meeting m)
{
cout << "Start: " << m.start << ", " << "End: " << m.end << '... | ALGO | 0.999792 | 4.688687 |
5705bb94-fbb2-40fe-ba1d-d5dc78e3f13a | memory118/Arm_compute_library | tests/validation/reference/Erode.cpp | #include "Erode.h"
#include "Utils.h"
#include "tests/validation/Helpers.h"
#include <algorithm>
#include <array>
namespace arm_compute
{
namespace test
{
namespace validation
{
namespace reference
{
template <typename T>
SimpleTensor<T> erode(const SimpleTensor<T> &src, BorderMode border_mode, T constant_border_val... | ALGO | 0.990787 | 7.423615 |
426237f1-d522-4d84-a70c-bab1bd8b070d | AiMiDi/C4D_MMD_Tool | sdk_2025/frameworks/modeling_geom.framework/source/maxon/tangentspacenormalhelper.cpp | #include "maxon/matrix.h"
#include "maxon/branch.h" // remove once feature switch is gone.
#include "tangentspacenormalhelper.h"
namespace maxon
{
namespace TangentSpaceNormalHelper
{
Vector ComputeNormal(const Vector& prevPoint, const Vector& currPoint, const Vector& nextPoint)
{
return !(Cross(nextPoint - cu... | ALGO | 0.995752 | 7.608758 |
34b06b09-0cf3-4e1c-b9e3-6bf905409fee | Tushar-K24/LeetCode | 1689-partitioning-into-minimum-number-of-deci-binary-numbers/1689-partitioning-into-minimum-number-of-deci-binary-numbers.cpp | class Solution {
public:
int minPartitions(string n) {
int x = 0;
for(char c:n){
x = max(x,c-'0');
}
return x;
}
}; | ALGO | 0.99986 | 5.931111 |
76fdd9b5-764d-4309-a9c0-8271400b346e | sicongyu/Unreal-Lightmass-SH-based-GI | Engine/Source/ThirdParty/PhysX3/PxShared/src/foundation/src/PsMathUtils.cpp | #include "foundation/PxMat33.h"
#include "foundation/PxMathUtils.h"
#include "foundation/PxVec4.h"
#include "foundation/PxAssert.h"
#include "PsMathUtils.h"
#include "PsUtilities.h"
#include "PsBasicTemplates.h"
using namespace physx;
using namespace physx::shdfnd;
using namespace physx::intrinsics;
PX_FOUNDATION_API... | ALGO | 0.999567 | 7.781999 |
d0a1bec9-29ab-471e-8d11-1c38d9762077 | Mangern/kattis | sannvirdi/main.cpp | #include <bits/stdc++.h>
using namespace std;
const int mxN = 200005;
int n, q;
pair<int,string> a[mxN];
pair<int,int> query[mxN];
string ans[mxN];
int main() {
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> a[i].second >> a[i].first;
}
cin >> q;
for (int i = 0; i < q; ++i) {
ci... | ALGO | 0.999425 | 4.202584 |
dd584f15-8ff6-4170-854b-e1d6d5879fdf | RudraGFG/AITAM-Batch2 | 2July-Hashmap-Set/firstUniqueCharacterInAString.cpp | // approach 1 using map
class Solution {
public:
int firstUniqChar(string s) {
unordered_map<char, int> mp;
for(char ch : s) mp[ch]++;
for(int i=0; i<s.size(); i++){
if(mp[s[i]] == 1) return i;
}
return -1;
}
};
// approach 2 using frequency arr... | ALGO | 0.999861 | 6.158956 |
5376c978-f4a4-4191-a492-ad81a00bcfd1 | sachin-611/practicals_sem3 | oops/assignment_7/d2.cpp | #include <iostream>
#include <set>
#include <string>
using namespace std;
template<class t>
class sets
{
set<t>s1;
public:
void insert_value()
{
t temp;
cout<<"Enter value : ";
cin>>temp;
s1.insert(temp);
cout<<"value sucessfully added\n";
}
void delete_value... | TOOL | 0.894133 | 3.697794 |
edce800c-6bfa-46ba-b295-b43b0a4fcc8a | suupia/Siv3D-GameJam | Utility/RectFUtility.cpp | #include "../stdafx.h"
#include "RectFUtility.h"
RectF RectFUtility::calc_relative_rect(double offset_x_ratio, double offset_y_ratio, double width_ratio, double height_ratio)
{
return RectF{ offset_x_ratio * Scene::Width(), offset_y_ratio * Scene::Height(), width_ratio * Scene::Width(), height_ratio * Scene::Height()... | TOOL | 0.90067 | 5.736907 |
e56bbdce-7e77-492b-9104-a1042e3d1f3f | taivop/eth-algolab | chunks/cgal/elementary/constructions.cpp | #include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Iso_rectangle_2.h>
#include <CGAL/Min_circle_2.h>
#include <CGAL/Min_circle_2_traits_2.h>
#include <iostream>
using namespace std;
typedef CGAL::Exact_predicates_exact_constructions_kernel K;
typedef CGAL::Min_circle_2_traits_2<K> Traits;
... | ALGO | 0.999646 | 3.926938 |
f224ca72-9d96-4252-895a-7a47a27707b5 | nguyenign/micmac4wasm | BenchElise/SaisieLiaisons.cpp | /*
bouton 2 : geometrie (translation/homotetie)
bouton 3 : menu contextuel
o recal : clik (b1/b3) sur rouge puis bleu
pour fixer valeur du decalage global;
*/
#include "general/all.h"
#include "private/all.h"
#include "im_tpl/image.h"
#include "MICMAC.h"
using namespace NS_ParamMICM... | TOOL | 0.859967 | 3.564176 |
14285eed-09e4-4089-89cc-0115815b3200 | smh997/Problem-Solving | Online Judges/Kattis/nine.cpp | /*
* https://open.kattis.com/problems/nine
* Author: https://github.com/smh997/
*/
#include <bits/stdc++.h>
using namespace std;
#define mod 1000000007
long long int d, res;
long long int fast_power(long long int a, long long int b){
if(b == 0)
return 1;
if(b % 2 == 1)
return (a * fast_po... | ALGO | 0.999926 | 4.414229 |
6e51b67d-dd1e-4dd5-b43e-db58c72938f0 | jiho7407/PS | BaekJoon/Morgorithm_Daily/2024-M5/0518/14794.cpp | #include <bits/stdc++.h>
#define ll long long
#define rep(i,l,r)for(ll i=(l);i<(r);i++)
using namespace std;
typedef pair<int, int> pii;
void fastio(){
cin.tie(0);
cout.tie(0);
ios_base::sync_with_stdio(false);
}
int N, K;
void solve(){
cin >> N >> K;
return;
}
int main(){
fastio();
... | ALGO | 0.999141 | 4.332736 |
36e106f0-94b0-4408-9f8c-98b6e74b16ef | arrows-1011/CPro | AOJ/Volume28/2804.cpp | #include <bits/stdc++.h>
using namespace std;
#define EPS (1e-10)
struct Point {
double x, y;
Point() {}
Point (double x, double y) : x(x), y(y) {}
Point operator + (const Point &p) const {
return Point(x + p.x, y + p.y);
}
Point operator - (const Point &p) const {
... | ALGO | 0.999915 | 3.88271 |
d3650fe2-08c6-4020-9e64-45677566d04a | raincross7/code-similarity | codes/train_code/problem136/problem136_201.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const long long INF = 1LL<<60;
ll GCD(ll x,ll y){
if(y == 0) return x;
else return GCD(y,x%y);
}
ll LCM(ll a,ll b){
return a / GCD(a,b) * b;
}
const int MOD = 1000000007;
//void warshall_floyd(int n){
// for(int k=0;k<n;k++){
// ... | ALGO | 0.999991 | 5.161601 |
b8526503-155b-4183-9db5-38ee1ffe42c0 | manikanta2901/ubuntu | .history/practice/cpp/codeforces/Watermelon_20210115144524.cpp | #include <bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#include<queue>
using namespace std;
#define trav(dataType,DataStruct,name) for(dataType<DataStruct>::itt ip = name.bb(); ip != name.ee(); ip++)
//Pre processors & typedefs
... | ALGO | 0.999958 | 3.559983 |
7867d48b-b31d-4654-984b-8a5f170af2e1 | sxu39/TP-RPMD | lammps-stable_2Aug2023_update2/src/OPENMP/npair_half_size_multi_newtoff_omp.cpp | // clang-format off
#include "npair_half_size_multi_newtoff_omp.h"
#include "atom.h"
#include "atom_vec.h"
#include "domain.h"
#include "error.h"
#include "molecule.h"
#include "my_page.h"
#include "neighbor.h"
#include "neigh_list.h"
#include "npair_omp.h"
#include "omp_compat.h"
using namespace LAMMPS_NS;
/* ---... | ALGO | 0.998967 | 6.261489 |
d2d46d3b-14f1-4061-8e08-582629755377 | naumazeredo/competitive-programming | codeforces/518C.cpp | #include <cstdio>
int e[200000];
int p[200000];
int n, m, k;
long long r;
int main() {
scanf("%d%d%d", &n, &m, &k);
for (int i = 1; i <= n; ++i) {
scanf("%d", &e[i]);
p[e[i]] = i;
}
r = 0;
int a;
for (int i = 0; i < m; ++i) {
scanf("%d", &a);
r += ((p[a] - 1) / k) + 1;
if (p[a] > 1) {... | ALGO | 0.999887 | 3.544976 |
d5c3a079-0bdb-45a5-ad60-9d6fa0b450d1 | foorhad/basic-data-structure | MOD 10.5 practice day/prob5.cpp | #include <iostream> // Input/output streams (cin, cout, cerr, etc.)
#include <fstream> // File streams (for file input/output)
#include <iomanip> // Input/output manipulators (for formatting)
#include <string> // String manipulation
#include <vector> // Dynamic arrays
#include <list> /... | ALGO | 0.999851 | 4.735314 |
1f6b0715-a98b-49ee-8e11-53c5eb78f985 | Atharv-09/OLD_DSA | SmallestPosMissingNum.cpp | #include<bits/stdc++.h>
using namespace std;
/*running using java hashset
public int firstMissingPositive(int[] nums) {
HashSet<Integer> hs = new HashSet<>();
for(int i=0;i<nums.length;i++){
hs.add(nums[i]);
}
int count=1;
for(int... | ALGO | 0.999916 | 3.696285 |
bbe0e686-3279-4149-9c0c-308df372543e | himanshu-20021/cg | CIRCLE.CPP | #include <graphics.h>
#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <iostream.h>
void circlePlotPoint(int xc,int yc,int x,int y)
{
int xmax = getmaxx()/2, ymax = getmaxy()/2;
putpixel(xmax+(xc+x),ymax-(yc+y),255);
putpixel(xmax+(xc-x),ymax-(yc+y),255);
putpixel(xmax+(xc+x),ymax-(yc-... | ALGO | 0.981205 | 4.197156 |
76476347-838c-43b1-89e2-abf5952cd9a0 | Alaxe/noi2-ranking | 2020/solutions/A/BNS-Smolyan/winter.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 5;
int n, m;
vector <int> graph[MAXN];
void read_input()
{
scanf("%d %d", &n, &m);
int v, w;
for(int i = 0; i < m; i++)
{
scanf("%d %d", &v, &w);
graph[v].push_back(w);
graph[w].push_back(v);
}
}
bool ... | ALGO | 0.999805 | 4.7817 |
b0ab1afd-a70e-421f-a285-0b91ca76930c | ishandutta2007/codeforces | orzfootballking/normal/1348/B.cpp | #pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
#define ll long long
#define gmax(x,y) x=max(x,y)
#define gmin(x,y) x=min(x,y)
#define F first
#define S second
#define P pair
#define FOR(i,a,b) for(int i=a;i<=b;i++)
#define rep(i,a,b) for(int i=a;i<b;i++)
#define V vector
#define RE return
#define ALL(a) a.begin(... | ALGO | 0.999599 | 3.58507 |
a08a7042-e298-4506-857d-c857b666b4a4 | hiddely/eth-algolab | week11/san_francisco/main.cpp | //
// Created by Hidde Lycklama on 12/27/18.
//
// Includes
// ========
// STL includes
#include <iostream>
#include <cstdlib>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
// BGL includes
#include <boost/graph/adjacency_list.hpp>
// BGL Graph definitions
// =====================
// Graph T... | ALGO | 0.9998 | 4.424106 |
b0d4098f-ee73-430a-bf0a-85843e172365 | zshangGEO/gmsh | contrib/QuadMeshingTools/qmtDiskQuadrangulationRemeshing.cpp | #include "qmtDiskQuadrangulationRemeshing.h"
/* System includes */
// #include <vector>
// #include <array>
// #include <unordered_map>
// #include <cstdint>
// #include <cmath>
// #include <queue>
// #include <algorithm>
/* Gmsh includes */
#include "GmshMessage.h"
#include "OS.h"
#include "GVertex.h"
#include "GEdg... | ALGO | 0.99914 | 6.178977 |
32a86a79-e677-4e0f-9fd9-9346e02cb708 | ishandutta2007/codeforces | anandoza/normal/1621/A.cpp | #include <bits/stdc++.h>
using namespace std;
// clang-format off
// template {{{
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define f first
#define s second
#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define trav(a, x) for (auto... | ALGO | 0.999918 | 4.864034 |
986e7328-a3ac-4a40-b44b-cda072718386 | nupurd23/DataStructures | stack/balanced_paranthesis.cpp | #include<iostream>
#include<stack>
using namespace std;
bool matching(char a, char b){
return ((a=='(' && b==')') || (a=='{' && b=='}') || (a=='[' && b==']'));
}
bool isbalanced(string str){
stack<int>s;
for(int i=0;i <str.length();i++){
if(str[i]=='(' || str[i]=='[' || str[i]=='{'){
s... | ALGO | 0.999046 | 5.568299 |
63683a01-e587-4818-afad-253e748b234b | Piyush13-ambure/DSA | Kth Smallest Number in Multiplication Table.cpp | /*Given three integers m, n and k. Consider a grid of m * n, where mat[i][j] = i * j (1 based index). The task is to return the kth smallest element in the m * n multiplication table.
*/
#include <iostream>
using namespace std;
class Solution {
public:
int countLessEqual(int m, int n, int mid) {
int count... | ALGO | 0.999976 | 5.980057 |
e700bd3f-1ade-446a-b15c-5ae3aaff3600 | himeshps/Competitive-Programming- | Graphs/FloydWarshall.cpp |
/* It is a trivial DP approach to the shrotest distance problem
in graphs and derivative algorithms .
I'll keep updating the cases where it is ultimately
beneficial to use the floyd warshall approach.
dp[start][destination] = dp[start][i] + dp[i][destination] ; loop over it
dp[i][j] = dp[i][k] + dp[k][j] ;
min(... | ALGO | 0.999991 | 5.21503 |
f2d4d7fd-b30b-4670-83aa-f51c63ce363c | Simone-Lemes/Sistemas-para-internet | exercícios C++/Soreteio em Vetor ímpar.cpp | #include <iostream>
#include <locale>
using namespace std;
int main()
{
setlocale(LC_ALL, "ptb");
{
int num,ind,tentativas=0, numeros[10];
bool achou=false;
cout <<"*** Rodada do 1o. jogador ***\n";
for (ind=0;ind<=9;ind++)
{
cout <<"Informe o "<<ind+1<<"o. nmero: ";
cin >>numeros[ind];
}
cout <<"*** Rodada do... | ALGO | 0.997723 | 3.435683 |
068d0c12-38ca-46cb-a5e3-8b9c549ba883 | JoelBrown1/nextGen | 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 |
cf4ee91b-5d86-4958-88bf-dde802c021b9 | minstaar/beakjoon | 2024/1655.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef tree<int, null_type, less_equal<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
int main()
{
ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int N; cin >> N;
... | ALGO | 0.999827 | 4.148103 |
b112d4a1-91f7-47bf-8c7e-7e4cec3a6917 | lphansen/ClimateUncertaintySpillover | src/cppcore/eigen3/bench/bench_gemm.cpp |
// g++-4.4 bench_gemm.cpp -I .. -O2 -DNDEBUG -lrt -fopenmp && OMP_NUM_THREADS=2 ./a.out
// icpc bench_gemm.cpp -I .. -O3 -DNDEBUG -lrt -openmp && OMP_NUM_THREADS=2 ./a.out
// Compilation options:
//
// -DSCALAR=std::complex<double>
// -DSCALARA=double or -DSCALARB=double
// -DHAVE_BLAS
// -DDECOUPLED
//
#include... | TOOL | 0.971536 | 5.829477 |
291a2854-9a68-4c15-9e4b-43a07a4df921 | Vamsi-Krishna8/LeetCode | 2024/FEBRUARY/10) Palindromic Substrings.cpp | //BRUTE FORCE
class Solution {
public:
bool check(string s,int i,int j){
if(i>j) return true;
if(s[i]==s[j]){
return check(s,i+1,j-1);
}
return false;
}
int countSubstrings(string s) {
int n=s.size();
int count=0;
for(int i=0;i<n;i++){
... | ALGO | 0.999986 | 6.225584 |
0c10487e-f86a-4174-8c71-88b9e9077a94 | rushawx/dataEngineeringContest | contestFive/problemI/main.cpp | #include <iostream>
#include <vector>
using namespace std;
int firstNonNegativeIdx(vector <int> a) {
for (int i = 0; i < a.size(); i++) {
if (a[i] > 0) {
return i;
}
}
return -1;
}
int lastNonNegativeIdx(vector <int> a) {
for (int i = a.size() - 1; i >= 0; i--) {
i... | ALGO | 0.999976 | 4.239375 |
add9966e-b229-4c17-a479-e9b14e96ba7b | WGree/solutions | Codeforces/Div1.2/637/D.cpp | //D.cpp
#include <bits/stdc++.h>
using namespace std;
const int N = 2e3 + 5;
int dp[N][N + 100];
pii to[N][N + 100];
int main() {
int mp[10] = {0x77, 0x24, 0x5d, 0x6d, 0x2e, 0x6b, 0x7b, 0x25, 0x7f, 0x6f};
int n, k;
cin >> n >> k;
vector<vector<pii>> a(n);
string s;
for (int i = 0, t; i < n; +... | ALGO | 0.999935 | 4.082437 |
ead65dc9-325c-4155-b0c8-cba8f815cc23 | rishabhdvn/leetcode | 0169-majority-element/0169-majority-element.cpp | class Solution {
public:
int majorityElement(vector<int>& nums) {
map<int,int> frequencyMap;
for(int num:nums){
frequencyMap[num]++;
}
int maxFreq=0;
int mostFreqval=-1;
for(const auto &pair :frequencyMap){
if(pair.second>maxFreq){
... | ALGO | 0.999942 | 5.691192 |
2a333a72-9047-447a-bfee-ce552b6b9031 | cea-trust-platform/trust-documentation | doc/source/srcs/doxy/src/ThHyd/Multiphase/Correlations/Frottement_interfacial_bulles_composant.cpp | #include <Frottement_interfacial_bulles_composant.h>
#include <Pb_Multiphase.h>
#include <TRUSTTab.h>
Implemente_instanciable(Frottement_interfacial_bulles_composant, "Frottement_interfacial_bulles_composant|Frottement_interfacial_bulles", Frottement_interfacial_base);
Sortie& Frottement_interfacial_bulles_composant:... | TOOL | 0.974584 | 5.376854 |
afeda912-7702-4cad-a7f4-5ccf471b4531 | KylusheL/CppPractice | Daily PS/BOJ/스도쿠(2239, G4).cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
vector<string> graph;
vector<pair<int, int>> blanks;
bool check_row(int r, int n) {
for (int c = 0; c < 9; c++) {
if (graph[r][c] == n + '0')
return false;
}
return true;
}
bool check_co... | ALGO | 0.999873 | 5.963163 |
e767dd70-6f63-40fa-8932-8a7c27a57b76 | IshanManchanda/competitive-cpp | Codeforces/ProblemSet/602B - Approximating a Constant Range.cpp | //#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx,avx2,fma,tune=native")
#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define all(x) begin(x), end(x)
#define rall(x) (x).rbegin(), (x).rend()
#define PB emplace_back
#define MP make... | ALGO | 0.999601 | 3.900906 |
74640bd2-76b9-4353-8d03-8fa5393de56e | jakeminns/Project-Euler-Problem-Solutions | Euler Problem 10/main.cpp | #include <iostream>
#include <vector>
#include <fstream>
using namespace std;
int count =1;
int count_print =1;
int long long maxNum = 2000000;
int long long sum=0;
vector<int > n(maxNum);
int main()
{
for(int x = 2; x<maxNum;x++){
bool check = false;
for(int y = 2; y<x;y++){
i... | ALGO | 0.987145 | 3.279148 |
563987ee-9f43-4b12-942e-be8cf616e6eb | Paul-Arts/cplus | kap45Stdlib_lst138-45numAdiff.cpp | #include <numeric> // adjacent_difference
#include <functional> // plus
#include <algorithm> // copy
#include <iostream>
#include <iterator> // ostream_iterator
#include <vector>
using std::cout; using std::vector;
int main() {
// Streamausgabeiterator f?r int;
std::... | ALGO | 0.999945 | 5.082319 |
4b373fd2-5feb-4ab5-8b00-86f9b2cceefb | zhangchunbao515/leetcode | leetcode-02/126. Word Ladder II/s1.cpp | class Node {
public:
int index;
vector<Node*> next;
Node (int i) {
index = i;
}
};
class Solution {
private:
vector<string> dict;
unordered_map<string, int> m;
vector<vector<string>> ret;
int endIndex;
void dfs(Node *root, vector<string> &path) {
if (root->index == en... | ALGO | 0.999969 | 5.981778 |
f64201e7-b189-4081-a27f-503dc3cebd8d | ishandutta2007/codeforces | correlationdecay/normal/757/C.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
#include <cmath>
#include <map>
#include <vector>
#define maxn 1000009
using namespace std;
const int MOD = 1e9 + 7;
long long fact[maxn];
map<int,int>mp;
vector<pair<int,int> >G;
vector<int>a[maxn];
int st[maxn];
int id[maxn];
bool cmp(int a... | ALGO | 0.999905 | 3.484214 |
e9228ad0-e1bf-4a57-b294-dffdcda2aa1c | Foridul35962/DSA-Algorithm-and-Code | Knapsack_problem(Fractional)/code.cpp | #include<iostream>
using namespace std;
float Knapsack(int p[], int w[], int m, int n)
{
float x[n],sum=0;
int b;
for(int i=0;i<n;i++)
{
x[i]=(float)p[i]/w[i];
}
while(m!=0)
{
int l=-1;
for(int i=0;i<n;i++)
{
if(x[i]>l)
{
... | ALGO | 0.999991 | 3.895003 |
fbc9eb49-c51a-4b4c-a192-429a8fad9710 | nsk6282/cp-algorithms | Graphs/DSU and MST/PrimsAlgorithm.cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair<int,pair<int,int>> pii;
int minimumSpanningTree(vector<vector<int>>& edges, int n){
int sum=0;
vector<pair<int,int>> MST;
vector<pair<int,int>> adj[n];
for(auto it:edges){
adj[it[0]].push_back({it[1],it[2]});
adj[it[1]].push_back... | ALGO | 0.999974 | 4.79511 |
28a7fd85-c9dc-4222-8930-d7a1cf626f54 | son-of-mountain/problem-solving | codeforces/.history/icpc_mansoura/session4/Partial-Sum_20240909083728.cpp | #include<bits/stdc++.h>
using namespace std;
#define sonic ios_base::sync_with_stdio(false) ; cin.tie(NULL) ; cout.tie(NULL);
// stopped at 1:04:37
int main(){
sonic ;
int v,n,q ; cin >> n >> q;
int l,r;
int arr[n]={};
int update[n];
int val;
cin >> val;
update[l] += val ; ... | ALGO | 0.999527 | 3.27506 |
874b710b-3e78-415b-8b4c-eaaa21d689e8 | YinshiSanchez/vsag | src/algorithm/hnswlib/algorithm_interface.cpp | #include "algorithm_interface.h"
namespace hnswlib {
template <typename dist_t>
std::vector<std::pair<dist_t, LabelType>>
AlgorithmInterface<dist_t>::searchKnnCloserFirst(const void* query_data,
size_t k,
size_t ef,
... | ALGO | 0.999912 | 5.827305 |
61a93a3a-480c-469d-abda-1a1b738838b8 | pieropr2k/2023-2D-goals-CRUD | 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 |
a2f91ed1-0866-4d09-87aa-b6eec2488d5a | ZaidRauf/2d-inverse-kinematics-demo | src/main.cpp | #include <iostream>
#include <string>
#include <SFML/Graphics.hpp>
struct Joint {
float rotation = 0.0f;
float chain_length = 0.0f;
};
struct Vector2 {
float x = 0.0f;
float y = 0.0f;
Vector2 normalized() const {
float length = std::sqrt(this->x * this->x + this->y * this->y);
ret... | ALGO | 0.980505 | 4.977055 |
15958da0-a5f6-4f48-9098-26420a830739 | not-a-dev0/Awesome-Quant-Machine-Learning-Trading | C++/maximal-rectangle.cpp | // Time: O(m * n)
// Space: O(n)
// Ascending stack solution.
class Solution {
public:
int maximalRectangle(vector<vector<char> > &matrix) {
if (matrix.empty() || matrix[0].empty()) {
return 0;
}
int res = 0;
vector<int> height(matrix[0].size(), 0);
for (int i ... | ALGO | 0.999953 | 7.148682 |
c3a89bcc-c45d-4d87-b8cb-5609bbb48380 | mprat/closedloophomographies | calculate_cumulative_homographies.cpp | #include <opencv2/opencv.hpp>
#include <string.h>
#include <cstring>
#include <cmath>
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include "homography_custom.h"
using namespace cv;
const char* test_name;
const char* test_set_name;
int main(int argc, const char* argv[])
{
if (argc != 5) {
pri... | ALGO | 0.93031 | 4.18908 |
ff0e01f3-6cde-48fb-8675-cff8243265c3 | crazy-nuclei/DSA | Dynamic_Programming/LCS_problems/short_common_superseq.cpp | #include "../../myHeaders.h"
using namespace std;
string rev(string an) {
string ans;
for(int i = an.length()-1; i >= 0; i--) {
ans += an[i];
}
return ans;
}
void print_scs(string s1, string s2, vector<vector<int>> &dp) {
int i = dp.size();
int j = dp[0].size();
string ans;
... | ALGO | 0.999986 | 4.241412 |
4b2f717c-c1cc-41e4-9c4e-969bd17eea52 | adityahongal/DSA-CPP | cpp-basics/ControlflowStatements/Nested_If.cpp | #include<iostream>
using namespace std;
int main(){
int height;
cout << "Enter height in feet :" << endl;
cin >> height;
int weight;
cout << "Enter weight in kgs :" << endl;
cin >> weight;
if(height > 5){
if(weight > 70){
cout << "You have good BMI" << endl;
... | TOOL | 0.992247 | 4.646551 |
81ea9399-a365-4305-8b2d-ddf85ec15f46 | tory1103/srtviz | source/algorithms/insertion.cpp | //
// Created by adria on 07/11/2023.
//
#include "../../include/algorithms/insertion.h"
#include "../../include/utils.h"
void srtviz::algorithms::insertion_sort(int *numbers, int len, sf::RenderWindow &window)
{
for (int i = 1; i < len; i++)
{
int temp_pos = i, temp = numbers[i];
while (temp_... | ALGO | 0.999937 | 4.198598 |
3b425d8c-aeb1-48de-9030-49d8b6a28eaa | FengJiong-123/DecoupleCache | src/systemc/tests/systemc/misc/user_guide/chpt3.1/fsmr.cpp | /*****************************************************************************
fsmr.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/*****************************************************************************
... | ALGO | 0.998598 | 4.888353 |
e21cf753-2453-4892-8244-b79d13f6363b | PrabhatChowdhary/Cpp-basics | arrays.cpp | #include <iostream>
using namespace std;
/*
Question 1:
Write a code that given an array A of size n, creates a new array B so that B[i]=A[0]+.....+A[i].
Question 2:
Write a code that given an array A of size n, and an integer num, finds all pairs in A whose sum is equal to num.
Question 3:
Write a code that given an... | ALGO | 0.999278 | 4.979305 |
1262b990-4b3f-43f3-81ec-68582768adaf | VidevichA/algs-4-sem | Графы/Индивидуальные/Problem 2. Остовное дерево/[OK]739913.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <fstream>
void dfs(int node, std::vector<bool> &visited, const std::vector<std::vector<int>> &graph, std::vector<std::pair<int, int>> &edges)
{
visited[node] = true;
for (size_t i = 0; i < graph[node].size(); ++i)
{
if (graph[node]... | ALGO | 0.999822 | 4.683929 |
1c011f95-83ea-4ed6-836c-ee1fbb29fcfe | enlighten0707/CS158_OpenJudge_Solution | myOJ/HDU4027/main.cpp | #include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
const int N=100005;
long long a[N],sum[N<<2],maxn[N<<2];
#define LSON rt<<1
#define RSON rt<<1|1
int Max(int x,int y){return x>y?x:y;}
void Swap(int &x,int &y){int tmp=x;x=y;y=tmp;}
void pushUp(int rt){
sum[rt]=sum[LSON]+sum[RSON];
m... | ALGO | 0.999868 | 3.660837 |
c2d4d596-b05a-4004-ba84-14157a7d6b7c | yiouejv/algorithm_travel | array/double_pointer/844.cpp | /*
给定 s 和 t 两个字符串,当它们分别被输入到空白的文本编辑器后,请你判断二者是否相等。# 代表退格字符。
如果相等,返回 true ;否则,返回 false 。
注意:如果对空文本输入退格字符,文本继续为空。
示例 1:
输入:s = "ab#c", t = "ad#c"
输出:true
解释:S 和 T 都会变成 “ac”。
示例 2:
输入:s = "ab##", t = "c#d#"
输出:true
解释:s 和 t 都会变成 “”。
示例 3:
输入:s = "a##c", t = "#a#c"
输出:true
解释:s 和 t 都会变成 “c”。
示例 4:
输入:s = "a#c", t = "b... | ALGO | 0.99931 | 6.483762 |
27a16302-2202-40f4-8578-e9acf47ed875 | Harleen365/100_Days_Coding_Challenge | maximum_subarray.cpp | class Solution {
public:
int maxSubArray(vector<int>& nums) {
int maxsum=INT_MIN;
int currentsum=0;
for(int i=0;i<nums.size();i++){
currentsum+=nums[i];
if(currentsum > maxsum){
maxsum=currentsum;
}
if(currentsum<0){
... | ALGO | 0.999921 | 6.318693 |
9e6a5d73-8aa0-4e2d-b6ff-364e99045a3b | Young-workspace/HYU | 2학년/알고리즘 및 문제해결 기법/과제9/Matrixchain.cpp | #include <iostream>
#include <stdio.h>
using namespace std;
void order ( int i , int j, int *S[]);
int main()
{
int N, i, j, k;
cin >> N; //number of matrix
int P[102], M[101][101];
for( i = 0; i<N+1; i++)
{
cin >> P[i];
}
int **S = new int *[N];
for(i =1; i<N; i++)
{
S[i] = new int [ N+1];
}
f... | ALGO | 0.999979 | 3.383768 |
68f733cf-8ddc-4288-a616-4ce78f168835 | Noverish/codingtest-cpp | boilerplates/string.cpp | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main() {
string str1 = "abcdefg";
string str4(10, '0'); // "0000000000"
// reverse string
reverse(str1.begin(), str1.end()); // gfedcba
cout << str1 << "\n";
// copy string reverse order
string str2(str1... | ALGO | 0.99558 | 4.488031 |
34cee469-0ea9-4d37-ad73-986edf7e6100 | prateeks97/Cpp_Data_Structures_and_Algorithms | C++ Practice/Data Structures and Algorithms/Trees/delete_node_binary_tree.cpp | #include <iostream>
using namespace std;
struct Node{
int data;
Node* left;
Node* right;
};
Node* GetNewNode(int data){
Node* newNode = new Node();
newNode->data = data;
newNode->right = NULL;
newNode->left = NULL;
return newNode;
}
Node* Insert(Node* root, int data){
if (root == ... | ALGO | 0.999912 | 4.014042 |
b932c195-e9d6-42c4-8742-d11723783db3 | timmy61109/C-How-to-Program | example/C++教學手冊-第三版/範例程式/ch09/prog9_12.cpp | // prog9_12, ƫЪϥ
#include <iostream>
#include <cstdlib>
using namespace std;
int square(int); // wqsquare()ƪ쫬
int main(void)
{
int (*pf)(int); // wqƫpf
pf=square; // ϨƫpfVsquare()
cout << "square(5)=" << (*pf)(5) << endl; // LXsquare(5)
system("pause");
return 0;... | TOOL | 0.945149 | 3.635334 |
1b0ee958-ee88-4fa8-8ae7-95793e7ae38c | AlbertMukhammadiev/UniversityHomeworks | First_semester/tests/test_3/task_3/task_3/graph.cpp | #include "stdafx.h"
#include <iostream>
#include <fstream>
#include "graph.h"
int **createGraph(int size)
{
int **matrix = new int*[size] { nullptr };
for (int i = 0; i < size; ++i)
{
matrix[i] = new int[size];
}
return matrix;
}
void printGraph(int **matrix, int size)
{
for (int i = 0; i < size; ++i)
{
fo... | ALGO | 0.998889 | 4.061233 |
940b6142-b4dd-409b-a9ba-00dfa16a9d77 | kaiboy05/CodingPractice | CrackingCodingInterview/01_01.cpp | #include <iostream>
#include <vector>
using namespace std;
// tests:
// abcdegh => true
// aanwqqhwejqwh => false
// ABCDE => true
bool isUnique(string s) {
vector<bool> used(1 << (sizeof(char) * 8), false);
for(int i = 0; i < s.size(); i++) {
if(used[s[i]]) {
return false;
} else {
used[s[i]] = true;
... | ALGO | 0.997375 | 4.647939 |
66f90c22-8232-4e61-bf1f-915893136898 | cbshiles/KALX-xllgsl | randist/xll_ran_gumbel1.cpp | // xll_ran_gumbel1.cpp - Type-1 Gumbel variates, density, cumulative distribution, and inverse
// http://www.gnu.org/software/gsl/manual/html_node/The-Type_002d1-Gumbel-Distribution.html#The-Type_002d1-Gumbel-Distribution
#include "../xll_rng.h"
#include "../xll_randist.h"
//#define EXCEL12
#include "xll/xll.h"
using ... | ALGO | 0.998818 | 4.398289 |
a9e8916d-b84b-4a6b-8509-cf5689e439c7 | HarshGalav/Leetcode-Best-Practice | 0987-vertical-order-traversal-of-a-binary-tree/0987-vertical-order-traversal-of-a-binary-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999995 | 6.005287 |
1000a380-ded6-447b-b2bb-49e0ef0ec973 | puneet2501/GFG_POTD | cpp codes/Array Pair Sum Divisibility Problem.cpp | class Solution {
public:
bool canPair(vector<int>& nums, int k) {
if (nums.size() % 2 == 1) return false;
vector<int> arr(k, 0);
for (int i = 0; i < nums.size(); ++i) arr[nums[i] % k]++;
int i = 1, j = k - 1;
if (arr[0] % 2 == 1) return false;
while (i <= j) {
... | ALGO | 0.999922 | 5.652041 |
8d077dcc-5689-4ba8-a7eb-655bdeeb44a7 | xyfJASON/competitive-programming-template | 数学 Mathematics/数论 Number Theory/code/欧拉函数(线性筛).cpp | #include<cstdio>
using namespace std;
const int N = 100005;
int n;
int phi[N], pList[N], pID;
bool notP[N];
void Euler(int n){
notP[0] = notP[1] = 1;
phi[1] = 1;
for(int i = 1; i <= n; i++){
if(notP[i] == 0){
pList[++pID] = i;
phi[i] = i - 1;
}
for(int j = 1; j <= pID; j++){
if(1ll * i * pList[j] ... | ALGO | 0.999837 | 3.811323 |
4f3ce8bf-41cf-4234-9acb-edd36162ef7d | Coco0828/codingPractice | C++/20221031/d985.cpp | #include <iostream>
#include <vector>
using namespace std;
int main(){
int N;
cin >> N;
for(int i = 1; i <= N; i ++){
int M;
cin >> M;
int Mtemp = M;
vector<int> min;
vector<int> sec;
vector<int> sum;
while(M){
int a, b;
cin >> a >> b;
min.push_back(a);
sec.push_back(b);
sum.push_b... | ALGO | 0.999521 | 4.394973 |
21f8d6bd-0b19-4a84-b26c-31a792ad0afa | dirkneuhaeuser/exercise-problems | own_ds/segment_tree/codeforces_edu_st_part2/step4/e.cpp | #include"bits/stdc++.h" // using "" instead of <>, so it will search locally for the precompiled version first
using namespace std;
// int up to 2*10^9 (2^31-1)
typedef long long ll; // ll up to 9*10^18 (2^63 -1)
typedef unsigned long long ull; ... | ALGO | 0.999954 | 4.373712 |
e518fdb4-c370-498a-8e66-759214b66469 | PritamMagdum/Daily-DSA-Practice | Heaps [ Learning, Medium, Hard Problems ]/Hard Problems/347. Top K Frequent Elements.cpp | class Solution {
public:
typedef pair<int,int> P;
vector<int> topKFrequent(vector<int>& nums, int k) {
unordered_map<int,int> mp;
for(int &num : nums){
mp[num]++;
}
// min heap
priority_queue<P,vector<P>, greater<P>> pq;
// push elements in min-heap
... | ALGO | 0.999993 | 5.973123 |
f6e028be-9e32-4853-98cd-0b30cb39db29 | walkccc/LeetCode | solutions/352. Data Stream as Disjoint Intervals/352.cpp | class SummaryRanges {
public:
void addNum(int val) {
if (intervals.contains(val))
return;
const int lo = lowerKey(val);
const int hi = higherKey(val);
// {lo, intervals[lo][1]} + val + {hi, intervals[hi][1]} = {lo,
// intervals[hi][1]}
if (lo >= 0 && hi >= 0 && intervals[lo][1] + 1 ==... | ALGO | 0.999203 | 6.997373 |
178173c9-c0a2-4385-aa53-1c649953351a | ParasAnxi/LeetCode-CPP | Q2301-2400/2392. Build a Matrix With Conditions.cpp | class Solution
{
public:
void solve(int k, vector<vector<int>> &condition, unordered_map<int, int> &position)
{
vector<vector<int>> v(k + 1);
vector<int> parents(k + 1, 0);
for (auto i : condition)
{
v[i[0]].push_back(i[1]);
parents[i[1]]++;
}
... | ALGO | 0.999914 | 5.45054 |
614eb8b6-6aad-4572-a48c-c6de813a05a3 | madomigo/programacion-competitiva | Curso LoC/Week13/f13.cpp | #include <bits\stdc++.h>
using namespace std;
#define int long long
int n, m;
vector<set<int>> graph;
vector<bool> visited;
vector<int> color;
bool Bipartite(int x) {
for (auto i : graph[x]) {
if (!visited[i]) {
visited[i] = true;
if (color[x] == 0) color[i] = 1;
... | ALGO | 0.999938 | 4.641984 |
0b4fc8b0-917c-45e0-97db-0a9fe79501ec | agungnuraditia/Latihan-Pertemuan-5 | Perulangan2.cpp | #include <iostream>
using namespace std;
int main() {
int x, y;
cout << "perulangan";
for (x = 1; x <= 10; x++) {
cout << endl;
cout << x;
}
cout << "\n perulangan menurun";
for (y = 10; y >= 1; y--) {
cout << endl;
cout << y;
}
} | TOOL | 0.982356 | 3.350698 |
596349e8-587b-44a5-984b-70ac2fcc2bcf | ishandutta2007/codeforces | black_horse2014/normal/856/F.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 1<<20;
const long long INF = 1LL<<62;
long long add[MAXN<<1], d[2][MAXN<<1];
long long a[MAXN], b[MAXN];
int mask[MAXN];
void renew(int u, long long x) {
add[u] += x, d[0][u] += x, d[1][u] += x;
}
void push_down(int u) {
if (add[u]) {
for (int j = ... | ALGO | 0.999989 | 3.77957 |
6896c161-59d3-4bf8-91c4-e61169d23e1a | ChrissyWager/lhs-for-hypergraphs | implementations/probminhash/c++/buffer_size_test.cpp | #include "minhash.hpp"
#include "bitstream_random.hpp"
#include <iostream>
#include <iomanip>
#include <random>
#include <chrono>
#include <cmath>
using namespace std;
struct ExtractFunction {
uint64_t operator()(const std::tuple<uint64_t,double>& d) const {
return std::get<0>(d);
}
uint64_t ope... | ALGO | 0.99786 | 5.939462 |
480495cb-e52b-4640-8f60-dd22a5f93b5d | lluisalemanypuig/metaheuristics | metaheuristics/algorithms/genetic_algorithms/rkga.cpp | #pragma once
#include <metaheuristics/algorithms/genetic_algorithms/rkga.hpp>
// C++ includes
#include <iostream>
#if defined (GENETICS_DEBUG)
#include <iomanip>
#endif
// metaheuristics includes
#include <metaheuristics/misc/time.hpp>
#if defined (GENETICS_DEBUG)
#include <metaheuristics/macros.hpp>
#endif
namespa... | ALGO | 0.999593 | 6.404401 |
08abdef4-9fe9-448c-a420-bb1bb87288fd | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_12538_2.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
const int N = 100005;
int a[N];
int pos[N];
vector<pair<int, int> > ans;
int p[N], prime[N], prime_num;
void fuck_prime() {
prime_num = 0;
memset(p, 0, sizeof(p));
for (int i = 2; i < N - 1; i++) {
if (!p[i]) {
prime[++prime_num] = i;
for (int j... | ALGO | 0.999884 | 3.366103 |
8c2c8348-185d-4f4c-9610-208ad2d9f78e | MehrabZishaan/LeetCode_Solved_Problems | First_Unique_Character_in_a_String.cpp | // First_Unique_Character_in_a_String
// https://leetcode.com/problems/first-unique-character-in-a-string/
class Solution {
public:
int firstUniqChar(string s) {
int count[26] = {0};
for (char c : s) {
count[c - 'a'] += 1;
}
for (int i = 0; i < s.length(); ++i) {
... | ALGO | 0.999375 | 6.469534 |
bcf2b32f-f928-4f87-98f2-151c0ab084ac | Next-Gen-UI/Hacktober | Leetcode/2001-3000/2139. Minimum Moves to Reach Target Score/2139.cpp | class Solution {
public:
int minMoves(int target, int maxDoubles) {
int steps = 0;
while (target > 1 && maxDoubles) {
if (target & 1) {
--target;
} else {
target /= 2;
--maxDoubles;
}
++steps;
}
return steps + target - 1;
}
};
| ALGO | 0.999533 | 6.705815 |
d80d8e72-13b7-4a4b-bba0-5b1bcef8854f | dmej103/C- | Nqueens.cpp | #include <iostream>
using namespace std;
bool ok(int q[], int c) {
for(int i = 1;i <= c; i++)
if (q[c] == q[i-1] || q[c]-i == q[c-i] || q[c]+i == q[c-i])
return false;
return true;
}
// This function should return the number of solutions for the given board size. (you don't need to print the solu... | ALGO | 0.999843 | 4.581472 |
93188ef7-bf49-4cf4-8762-abd136d860dd | hujaifa18/DSA | Bitwise and Binary Number/binToDec.cpp | #include <iostream>
using namespace std;
int binToDec(int binNum)
{
int ans = 0, pow = 1;
while (binNum > 0)
{
int rem = binNum % 10;
ans += (rem * pow);
binNum /= 10;
pow *= 2;
}
return ans;
}
int main()
{
int binNum;
cout << "Binary : ";
cin >> binNum;
... | ALGO | 0.992861 | 5.259833 |
32707afc-c837-4801-b4ab-c82c40db7a62 | falk-dev/maratona-de-programacao | Algorithms School/Aula 01 - Entrada e Saída/1010 - Cálculo Simples/main.cpp | // 1010 - CÁLCULO SIMPLES | RESOLVIDO EM C++
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int C1 = 0;
int N1 = 0;
float V1 = 0;
int C2 = 0;
int N2 = 0;
float V2 = 0;
float P = 0;
cin >> C1 >> N1 >> V1;
cin >> C2 >> N2 >> V2;
P = (N1 * V1) + (N2 * ... | ALGO | 0.983736 | 4.236966 |
fcd4839e-208e-4fdd-bca9-9bb7b35f71ec | mumumu6/kyopro | other/cpctf/cp/tree_dp.cpp | #include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using ll = long long;
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define reps(i, a, b) for (ll i = (a); i < (b); i++)
bool chmin(auto &a, auto b) { return a > b ? a = b, 1 : 0; }
bool chmax(... | ALGO | 0.999824 | 4.532686 |
7713a3ee-2c69-4d29-a9d8-33d2d75787bc | abhijeetsde1/DSA | DSA Crack Sheet/solutions/Word Break.cpp | /*
Word Break
==========
Given a string A and a dictionary of n words B, find out if A can be segmented into a space-separated sequence of dictionary words.
Example 1:
Input:
n = 12
B = { "i", "like", "sam", "sung", "samsung", "mobile",
"ice","cream", "icecream", "man", "go", "mango" }
A = "ilike"
Output: 1
Explanat... | ALGO | 0.999723 | 5.968375 |
d7399bc9-5ff8-4e4a-9967-a5cbd8f8b74b | BME-MIT-IET/iet-hf-2022-smells-like-team-spirit | code/sorting/src/median_sort/median_sort.cpp | #include <iostream>
using namespace std;
// Part of Cosmos by OpenGenus Foundation
void swap(int *a, int *b)
{
int temp;
temp = *a;
*a = *b;
*b = temp;
}
int Partition(int a[], int low, int high)
{
int pivot, index, i;
index = low;
pivot = high;
for (i = low; i < high; i++)
i... | ALGO | 0.999993 | 4.494491 |
78ef941d-57b0-4cde-a8ca-7709799fb163 | ishandutta2007/codeforces | eecs/normal/1635/F.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 300010;
int n, q, x[maxn], w[maxn], ql[maxn], qr[maxn];
ll ans[maxn], c[maxn];
vector<int> cand[maxn];
vector<array<int, 2>> Q[maxn];
void upd(int p, ll v) {
for (; p; p -= p & -p) c[p] = min(c[p], v);
}
ll query(int p) {
ll... | ALGO | 0.999978 | 3.805574 |
3c0da97b-3921-45ba-a001-b872979d8750 | UtkarshMishra12/LeetCode_Solutions | LeetCode/Array/Element Appearing More Than 25% In Sorted Array.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
int findSpecialInteger(vector<int>& arr) {
unordered_map<int,int> m;
for(auto i:arr){
m[i]++;
}
int ans=0,occ=0;
for(auto i:m){
if(i.second>occ){
ans=i.first;
... | ALGO | 0.999164 | 4.473991 |
df856384-a185-452e-b901-8d4c64ab8632 | ArchitGupta07/DSA | C++/Basics/function.cpp | #include<iostream>
using namespace std;
void name(string name){
cout<<name;
}
void byValue(string s){ // it doesn't changes the original s in the main and only copies the value of s
s += 'a';
cout<< "By value Function gives " <<s<<endl;
}
void byReference(string &s){ // it changes the original s in the... | TOOL | 0.970927 | 4.28729 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.