uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
c4cf218d-1ba7-4f28-9d19-bc506ae30af4 | sarvex/leetcode-c | solution/0100-0199/0137.Single Number II/Solution.cpp | class Solution {
public:
int singleNumber(vector<int>& nums) {
int a = 0, b = 0;
for (int c : nums) {
int aa = (~a & b & c) | (a & ~b & ~c);
int bb = ~a & (b ^ c);
a = aa;
b = bb;
}
return b;
}
}; | ALGO | 0.999983 | 5.690276 |
f275ab33-48cc-48a5-9643-a0c376249775 | PhoenixAthens/Essentials_of_CPP | EssentialsOfCPP/primeNumberCal.cpp | #include <iostream>
#include <format>
#include <cmath>
using std::cout;
using std::format;
int main(int argc, char** argv){
int arr[25]{};
int ind = 0;
for(int i = 2;ind<25;i++){
int factors = 0;
for(int j=2;j<=(int)sqrt(i);j++){
if(i%j==0){
factors++;
... | ALGO | 0.996195 | 4.336698 |
15fcfec4-955d-4bcb-83b6-3beb7e64634a | hjiang13/LLMs-in-IR | POJ-104/80/334.cpp | #include <iostream>
using namespace std;
int main()
{
int month[13] = {
0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}
;
int y1, m1, d1, y2, m2, d2;
cin >> y1 >> m1 >> d1 >> y2 >> m2 >> d2;
int sum = 0, i, j;
if (y1 == y2 && m1 == m2)
{
cout << d2 - d1 << endl;
return 1;
}
if (y1 == y2)
{
if ((y1 % 4 == 0 && y1 % 1... | ALGO | 0.99998 | 3.969057 |
f6b4b73d-78f3-4634-9648-4720ccd9c1ce | Farid4hmed/-CrackYourInternship | Graph (Easy-Medium)/floydWarshall.cpp | class Solution {
public:
void shortest_distance(vector<vector<int>>&matrix){
int n = matrix.size();
int m = matrix[0].size();
for(int k=0; k<n; k++){
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
if(matrix[i][k]==-1 || matrix[k][j] == -1)continue;
if(matri... | ALGO | 0.999942 | 5.523856 |
d694af3d-fe58-419b-b412-a7ed10690940 | yeohj0710/algorithm-implementation | [09][Silver II] 우선순위 큐 pair와 cmp 함수 정의.cpp | #include <bits/stdc++.h>
#define int long long
using namespace std;
struct cmp {
bool operator()(pair<int, int> a, pair<int, int> b) {
return (double)a.second/a.first < (double)b.second/b.first;
}
};
int32_t main() {
cin.tie(0)->sync_with_stdio(0);
int N, M, K; cin >> N >> M >> K;
priori... | ALGO | 0.999978 | 4.125717 |
e5698c3f-1571-490b-80db-c23b390fa1be | Chirag-Jani/90DaysDSA-Extended | 90daysDSA/Arrays/matrix_multiply.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n1, n2, n3;
cin >> n1 >> n2 >> n3;
int m1[n1][n2];
int m2[n2][n3];
int ans[n1][n3];
// matrix 1
for (int i = 0; i < n1; i++)
{
for (int j = 0; j < n2; j++)
cin >> m1[i][j];
}
// matrix 2
for (i... | ALGO | 0.999945 | 3.437461 |
0a2d47f1-edb4-4846-ae04-169fffbdd985 | VedantPatil3110/DSA | Difficulty: Basic/Count Linked List Nodes/count-linked-list-nodes.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
struct Node {
int data;
struct Node *next;
Node(int x) {
data = x;
next = NULL;
}
};
// } Driver Code Ends
/* Link list node */
/*
struct Node
{
int data;
Node* next;
Node(int x) { data = x; next = NUL... | ALGO | 0.997764 | 6.462597 |
6f963780-9c1d-4060-9b29-891cf10e382b | manishkrjha/Leetcode-Solutions | 1544-make-the-string-great/1544-make-the-string-great.cpp | class Solution {
public:
string makeGood(string s) {
while(s.size()){
cout << s << "\n";
bool flag = false;
for(int i=0;i<s.size()-1;i++){
if(abs(s[i]-s[i+1])==abs('a'-'A')){
flag = true;
... | ALGO | 0.999697 | 4.909097 |
f90d7d5b-643c-4056-b371-88a03bc05357 | pjswarnpath2709/Self-Learning | GFG DSA course/BitMagic/CountSetBitsOn.cpp | #define pb push_back
#define ppb pop_back
#define ff first
#define ss second
#define mset multiset
#define uset unordered_set
#define umap unordered_map
#define vi vector<int>
#define vll vector<long long>
#define vc vector<char>
#define vs vector<string>
#define pi pair<int, int>
#define pll pair<long long, long long>... | ALGO | 0.999817 | 3.847577 |
f4042495-b62f-4bfd-9bef-924dc8d8c5b2 | KaisHasan/Codeforces | CodeForces_Devu_and_his_Brother.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int , int> pi;
typedef pair<double , int > dpi;
typedef pair<long long , long long> pll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<pi> vpi;
typedef unsigned long long ull;
#define MP make_pair
#define mem(a , v) mems... | ALGO | 0.999824 | 3.36734 |
e8c3c3bf-0cf9-470f-940f-1aa80868ba92 | AniketSaliya/Data-Structure-and-Algorithm | Dynamic Programming/Matrix Chain Multiplication.cpp | class Solution{
public:
int static t[101][101];
int matrixMultiplication(int N, int arr[])
{
memset(t, -1, sizeof(t));
int i=1;
int j =N-1;
return solve(arr, i, j);
}
int solve(int arr[], int i, int j) {
int mini =INT_MAX;
if(i>=j)
return ... | ALGO | 0.999992 | 5.543059 |
3e483b43-6d05-44de-9d0b-dca073749915 | Charbel-11/Competitive-Programming | CSES/Additional Problems/Pyramid Array.cpp | #include <iostream>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
typedef long long ll;
struct FT {
int n;
vector<ll> vals;
FT(const int n) : n(n), vals(vector<ll>(n + 1, 0)) { }
//Adds x
void update(int i, const ll x) {
for (++i; i... | ALGO | 0.99992 | 4.433356 |
c5422a53-c08b-4f06-8ac1-59dfbaf048fb | rishabhgargdps/coding_prep | queue/backspace_string_compare.cpp | #include<iostream>
using namespace std;
class Solution {
public:
bool backspaceCompare(string s, string t) {
stack<int>stk1;
stack<int>stk2;
for(char c :s) {
if(c!='#') stk1.push(c);
else if(c=='#' && !stk1.empty()) stk1.pop();
}
for(char c:t) {
... | ALGO | 0.999837 | 5.418056 |
27af0a53-c46a-4c01-b85b-c827acebed25 | KhangPham205/ControlStructeExercise | LTMMC/117/Source.cpp | #include <iostream>
using namespace std;
void Nhap(int[], int&);
void Xuat(int[], int);
int ktTonTaiKhong(int[], int);
int main()
{
int a[100];
int n;
Nhap(a, n);
cout << "Mang ban dau: ";
Xuat(a, n);
if (ktTonTaiKhong(a, n) == 1)
cout << "\nTon tai 0";
else
cout << "\nKhong ton tai 0";
return 0;
}
vo... | ALGO | 0.996298 | 3.937824 |
1a0b5ca7-21cd-495d-944f-1b2333ee5acd | guilhermerezende10/aulas-C | c++/ex 22.08/ex005.cpp | /*Feito por Guilherme Rezende e Daniel Alonso*/
/*5- E1p que, é dado dois vetores de 10 posições cada, efetue operações aritiméticas básicas, indicadas do terceiro vetor cujo os dados também são conhecidos pelo usuário, gerando e exibindo no quarto vetor.*/
#include <iostream>
#include <math.h>
using namespace std;
int... | ALGO | 0.995234 | 3.28439 |
8337059f-2875-446e-a5c4-26b101cad4b8 | Avi8010/Data-Structures | array/subarray.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
int a[n];
int maxsum=INT_MIN;
for(int i=0;i<n;i++){
cin>>a[i];
}
for(int i=0;i<n;i++){
for(int j=i;j<n;j++){
int sum=0;
for(int k=i;k<=j;k++){
sum+=a[k];
... | ALGO | 0.999913 | 4.4481 |
9d62a4dc-534d-44b7-a7bd-405baf81beb9 | Sunday-Okey/python-oop | env/Lib/site-packages/sklearn/svm/src/liblinear/tron.cpp | #include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "tron.h"
#ifndef min
template <class T> static inline T min(T x,T y) { return (x<y)?x:y; }
#endif
#ifndef max
template <class T> static inline T max(T x,T y) { return (x>y)?x:y; }
#endif
static void default_print(const char *buf)
{... | ALGO | 0.999425 | 5.847107 |
82432021-32ac-4324-93e6-17622707c690 | luqmanarifin/cp | Educational Codeforces Round 45/d.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1005;
bool is[N][N];
int n;
int par[N], done[N];
void reverse() {
for (int i = 0; i < n; i++) {
for (int j = i + 1; j < n; j++) {
is[i][j] ^= 1;
is[j][i] ^= 1;
}
}
}
int find(int u) {
return par[u] = (par[u] == u? u : find(par[u]... | ALGO | 0.999795 | 3.267483 |
4e78d90a-0a83-4169-b3c9-ff7188dd16a3 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_1961_0.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
char n[20];
int flag=1,i;
scanf("%s",n);
for(i=1;i<strlen(n);i++)
{
if(n[i]!='9')
flag=0;
}
printf("%d",(strlen(n)-1)*9+(flag?n[0]-'0':n[0]-'1'));
return 0;
} | ALGO | 0.999768 | 3.242545 |
d0cec2cd-17d1-48e6-b78c-73055f2020f5 | Th0masAndy/KKRT16 | thirdparty/linux/miracl/miracl_osmt/source/make_k1.cpp | #include <iostream>
#include <fstream>
#include "ecn.h"
#include "zzn.h"
using namespace std;
Miracl precision(36,0);
int main()
{
ofstream params("xk1.ecs");
miracl *mip=&precision;
Big q,p,c,lambda;
lambda=pow((Big)2,80)+pow((Big)2,16);
q=lambda*lambda+lambda+1;
/*
forever
{
... | ALGO | 0.997624 | 3.013819 |
598ac3a6-3a81-4477-ab37-375be40fea02 | rishabh26malik/Leetcode-Solutions | EASY/MATH/DI String Match.cpp | class Solution {
public:
vector<int> diStringMatch(string S) {
int n=S.length(), inc=0, dec=n;
int i=0;
vector <int> out(n+1);
for(auto ch : S){
if(ch=='I'){
out[i]=inc;
inc++;
}
else{
out[i]=dec;
... | ALGO | 0.999798 | 5.3884 |
df94a734-8978-4573-9cd3-bfb805368207 | ishandutta2007/codeforces | rafi22/normal/1358/D.cpp | #include <bits/stdc++.h>
using namespace std;
long long sum(long long a)
{
return a*(a+1)/2;
}
long long calculate(long long s)
{
}
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
long long n,x;
cin>>n>>x;
long long tab[n+7];
long long pref[n+7];
long long re... | ALGO | 0.999933 | 3.809786 |
de0dbf34-d959-4db4-babf-71f941bd9010 | svn2github/libtorrent-rasterbar | tags/libtorrent_0_16_2/examples/parse_request_log.cpp | #include "libtorrent/file.hpp"
#include "libtorrent/io.hpp"
#include <cstring>
#include <boost/bind.hpp>
#include <stdlib.h>
#include <map>
#include <vector>
using namespace libtorrent;
using namespace libtorrent::detail; // for write_* and read_*
void print_usage()
{
fprintf(stderr, "usage: parse_request_log log-fi... | TOOL | 0.908279 | 4.19643 |
1cd6be61-4f13-4a1b-9211-f5b09b736bfe | grantmwilliams/Project-Euler-Solutions | C++/Euler8/anotherEuler8.cpp | #include <iostream>
#include <vector>
#include <cctype>
using namespace std;
int print_adj(vector<int> const &);
int main() {
// initializing vector... each element is a digit
cout << "Enter the number (copy-paste can be used). "
<< "End with any non-digit character... " << endl;
vector<int> digits; /... | ALGO | 0.999588 | 4.157427 |
d1661a02-60a9-46aa-951c-01fb759c1db4 | roytam1/mypal68-changes | security/ct/BTVerifier.cpp | #include "BTVerifier.h"
#include <stdint.h>
#include "CTUtils.h"
#include "SignedCertificateTimestamp.h"
#include "hasht.h"
#include "mozpkix/pkixnss.h"
#include "mozpkix/pkixutil.h"
namespace mozilla {
namespace ct {
using namespace mozilla::pkix;
typedef mozilla::pkix::Result Result;
// Common prefix lengths
st... | ALGO | 0.929291 | 7.893374 |
2e80c367-0b29-4c9b-af46-0fc727105d7e | 082-Rishikant/DSA-NITT | C++ course Apna College/32_5_Hahsing_prefixSum_No_ofSubArr_with_Sum_Zero.cpp | #include<iostream>
#include<unordered_map>
#include<vector>
using namespace std;
int main()
{
/*int ans=0;
int n=6;
int arr[n]={1, -1, 1, -1, 1,-1};
int preSum[n+1]={0};
int hsh[100]={0};
for(int i=0;i<6;i++)
{
preSum[i+1]=arr[i]+preSum[i];
hsh[preSum[i]]++;
}
hsh[0]+=1;
for(int i=0;i<100;i+... | ALGO | 0.999983 | 3.928942 |
b8851cff-6f9d-47f5-8570-f9598ec649af | 459893719/Class-Lab | 算法与数据结构/Lab2/Lab2.1/Lab2.1/main.cpp | //main.cpp
#include "LinkStack.h"
using namespace std;
int main() {
while (1) {
int num;
int d;
cout << "ҪתƵʮ(-1˳): ";
cin >> num;
if (num == -1) {
break;
}
cout << "Ҫתʲô? ";
cin >> d;
cout << numSwitch(num, d) << endl << en... | ALGO | 0.99018 | 3.931322 |
a2a36f41-d7c7-4589-bd90-eb5803cc7428 | corey33p/School | EECS 268/LAB 07/main.cpp | /*
@author - Corey Anderson
@file - Main.cpp
@date - 10/12/2019
@brief - To solve the following puzzle: You are in a tank traveling up,
down, left, right and diagonally
through electric fields. If you travel
through two minus signs in a row,
your battery is drained and you are stuck. If you
travel through two plus sign... | ALGO | 0.998688 | 3.961955 |
01bf00cf-145a-407e-81ac-153de5f0eed0 | amandhakad13/Dsa-Series | recursion/power_of_number.cpp | #include<iostream>
using namespace std;
int power(int num, int pow) {
if(pow == 0) {
return 1;
}
return num * power(num, pow-1);
}
int main() {
int num, pow;
cout<<"Enter the number : ";
cin>>num;
cout<<"Enter the power : ";
cin>>pow;
cout<<"power of a number is : "<<powe... | ALGO | 0.999861 | 5.586881 |
0faca964-90ca-4462-8c94-fbd2710b3fb0 | ta7uw/competitive-programming | AtCoder/ABC145/B.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using P = pair<ll, ll>;
using Graph = vector<vector<ll>>;
#define rep(i, n) for(ll i=0;i<(ll)(n);i++)
#define rep2(i, m, n) for(ll i=m;i<(ll)(n);i++)
#define rrep(i, n, m) for(ll i=n;i>=(ll)(m);i--)
const int dx[4] = {1, 0, -1, 0};
const int dy[4] = ... | ALGO | 0.999974 | 5.954416 |
c4047366-7e8a-41a5-865e-41d7cf080b46 | thiagohfo/URIOnlineJudge | Beginner/Nível 6/URI 2493.cpp | #include <stdio.h>
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
int T, numero_temp;
string temp;
char lixo;
vector<string> perdedores;
while(cin >> T){
long long int numeros[T][3];
int numeros_escolhidos[T], acertos = 0;
s... | ALGO | 0.988563 | 3.81839 |
a8fcbd63-bd30-4335-9d2b-c4d7b692d333 | Shiny-Shine/CPP-practice | BOJ-17087(숨바꼭질 6).cpp | /*
2021-02-20 BOJ - 17087(숨바꼭질 6)
*/
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int GCD(int a, int b)
{
while (b != 0)
{
int r = a % b;
a = b;
b = r;
}
return a;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
long long n, s, ans;
cin >> n >> s;
... | ALGO | 0.999756 | 3.552948 |
b32b93ab-f479-4653-b22a-9986066eebb1 | Mr-Patty/algorithms-and-data-structures | DZ/3/shell.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cstdio>
#include <cmath>
using namespace std;
struct Point {
int x, y;
Point(int x1, int y1) : x(x1), y(y1) {}
Point() : x(0), y(0) {}
double distance(const Point &p) {
return sqrt((p.x - x) * (p.x - x) + (p.y - y) * (p.y -... | ALGO | 0.999234 | 4.524727 |
ce854934-4e2b-4ced-98fd-da200c126f1a | andjelabusiness/OS_Kernel | OS Kernel/src/kernsem.cpp | #include "kernsem.h"
#include "pcblist.h"
#include "kernel.h"
#include "pcb.h"
#include "schedule.h"
KernelSem::KernelSem(int init){
if(init>0){
v=init;
}
else{
v=0;
}
blockedList= new PCBList();
}
KernelSem::~KernelSem(){
if( v<0 ){
signal(-v);
}
delete blockedList;
}
int KernelSem::wait(Time maxTi... | TOOL | 0.945346 | 4.342326 |
c5014432-6292-4901-b2b7-0b21a4058119 | fanxiaochen/freeimage-cmake | Source/OpenEXR/IlmImf/ImfDeepCompositing.cpp | #include "ImfDeepCompositing.h"
#include "ImfNamespace.h"
#include <algorithm>
#include <vector>
OPENEXR_IMF_INTERNAL_NAMESPACE_SOURCE_ENTER
using std::sort;
using std::vector;
DeepCompositing::DeepCompositing()
{
}
DeepCompositing::~DeepCompositing()
{
}
void
DeepCompositing::composite_pixel (float outputs[],
... | ALGO | 0.966714 | 5.113023 |
00dd6738-7647-4b5f-bba0-cb1c7adb61c3 | amiteshvsth/DSA-C-Plus-Plus | sqrtUsingBinarySearch.cpp | #include <iostream>
using namespace std;
long long int binarySearch(int n)
{
int s = 0;
int e = n;
long long int mid = s + (e - s) / 2;
long long int ans = -1;
while (s <= e)
{
long long int sq = mid * mid;
if (sq == n){
return mid;
}
if (sq < n){
... | ALGO | 0.999938 | 4.475585 |
f0840ad3-c618-40ad-9024-a0cf70d06b9f | igasa-KCompetitiveProgramming/Atcoder | ABC381/d.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pint = pair<int,int>;
using pll = pair<long long, long long>;
#define v(a,i,b) vector<ll> a(i,b)
#define vv(a,i,j,b) vector<vector<ll>> a(i, vector<ll>(j,b))
#define vp(a,i,b,c) vector<pll>> a(i,{b,c})
#define vvp(a,i,j,b,c) vector<vector<pll>> ... | ALGO | 0.999928 | 3.998835 |
acb56e3c-dfbe-4b34-ad60-994f095e82a2 | mr-ma/secret-sharing | SecretSharing.Lib/WinNTL-8_1_2/src/ZZX.cpp |
#include <NTL/ZZX.h>
#include <NTL/new.h>
NTL_START_IMPL
const ZZX& ZZX::zero()
{
NTL_THREAD_LOCAL static ZZX z;
return z;
}
void conv(ZZ_pX& x, const ZZX& a)
{
conv(x.rep, a.rep);
x.normalize();
}
void conv(ZZX& x, const ZZ_pX& a)
{
conv(x.rep, a.rep);
x.normalize();
}
istream& operator>>(istr... | ALGO | 0.960376 | 4.166647 |
40ad5266-f699-4615-ac7b-74e73bd8dea0 | simodf7/Programmazione | Prove/PageRank/Web.cpp | // web.cpp
#include "Web.h"
#include <list>
#include <iostream>
Web::Web(int n): nPages{n} {
weblist = new std::list<int>[n];
for(int i=0; i<n; ++i){
Page p(i,0, static_cast<double>(1)/n);
pages.push_back(p);
}
}
void Web::addLink(int pa, int pb){
weblist[pa].push_front(pb);
pages[... | ALGO | 0.99986 | 3.900889 |
495d65cc-a153-4ce2-bb24-9a93cefe6663 | SauravSarkar-CodersArcade/PESCE-MARCH-2025 | RatInAMaze.cpp | #include <iostream>
using namespace std;
bool isPathSafe(int ** arr, int x, int y, int n){
if (x < n && y< n && arr[x][y] == 1){
return true;
}return false;
}
bool ratInMaze(int ** arr, int x, int y, int n, int ** resultantArray){
// Base Case: What if rat has already reached destination ?
if (x... | ALGO | 0.999988 | 6.763876 |
5833c259-c896-441c-bdc4-7138c3a58bcf | Changhe160/cplusplus2019-2020-2 | code/chapter5.3/chapter5.3.cpp | #include<iostream>
#include<vector>
using namespace std;
//5.3.1 ֵ
void Swap(int x, int y) {
int z(x);
x = y;
y = z;
}
/*void Swap(int x, int y) {
int z(x);
x = y;
y = z;
}*/
void Swap(int *x, int *y) { //ָxyֱָʵi j
int z(*x); //z ָxָĶֵʵi
*x = *y; //òʡ
*y = z;
}
//5.3.3 constβ
void f_cval(const int i)... | ALGO | 0.966103 | 3.538851 |
06431da2-d4cb-4e36-b1ed-2fbce1c83ff7 | VladBlackeru/Search_Engine | assig2/main.cpp | #include <iostream>
#include <string>
#include <vector>
#include <thread>
#include "SearchEngine.h"
#include <filesystem>
#define MAX_CACHE_SIZE 2048
namespace fs = std::filesystem;
int main() {
std::string rootPath;
std::cout << "Enter directory for search: ";
std::getline(std::cin, rootPath);
while... | TOOL | 0.875286 | 4.496409 |
9b740c7f-bb0a-404e-abe9-8622e2a2f1a2 | Aryant-Tripathi/StriverSdeSheetChallange | June-21-2022(String)/5)Longest_Common_Prefix.cpp | string longestCommonPrefix(vector<string>&arr, int n)
{
// Write your code here
if(n == 1) return arr[0];
string pre = "";
for(int i = 0; i < min(arr[0].length(), arr[1].length()); i++)
{
if(arr[0][i] == arr[1][i])
{
pre += arr[0][i];
}
else
... | ALGO | 0.999827 | 4.913555 |
ea1f5229-64b1-4219-800b-b4c2994c88ab | Meleeri/leetcode | Media_of_Two_Sorted_Arrays/main.cpp | #include <stdio.h>
int binsearch(int a[], int len, int elem) {
int i = 0, mid = len>>1;
while (mid < len) {
if (a[mid] < elem) i = mid+1;
else len = mid;
mid = (i+len)>>1;
}
return mid;
}
int max(int a, int b) {
return a>b? a: b;
}
double median(int a[], int a_len, int b[], int b_len) {
int k;
int low =... | ALGO | 0.999851 | 3.910311 |
d4697514-4d31-409d-943b-da2bfd68336b | Yi-Demos/languages | cpp/algorithms/sort/temp.cpp | #include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
vector<int> sort(vector<int> &nums) {
for (int i = nums.size() - 1; i >= 0; --i) {
for (int j = 0; j < i; ++j) {
if (nums[j] > nums[j + 1]) swap(nums[j], nums[j + 1]);
}
}
return nums;
}
};
int m... | ALGO | 0.999938 | 5.783517 |
e81b7578-591c-4a50-89b6-a6187225e99f | fengzhiyugithub/JianZhi_Offer | 二叉树的深度/Solution.cpp | /*
* @Author: yufeng
* @Date: 2018-10-11 23:35:30
* @Last Modified by: yufeng
* @Last Modified time: 2018-10-11 23:35:51
* @Email: <EMAIL>
* @Blog: http://fzhiy.com/
*/
/*
struct TreeNode {
int val;
struct TreeNode *left;
struct TreeNode *right;
TreeNode(int x) :
val(x), left(NULL), right(NULL) {
}
};*/
cl... | ALGO | 0.999867 | 5.746894 |
45d8753a-bbc7-41e4-b910-78ecdb0c6f90 | sakaridis/MGCDA | source/Semantic_segmentation/refinenet/libs/matconvnet/matlab/src/bits/impl/bilinearsampler_cpu.cpp | // @file bilinearsampler_cpu.cu
// @brief Bilinear sampler CPU implementation
// @author Ankush Gupta
// @author Andrea Vedaldi
#include "bilinearsampler.hpp"
#include "../data.hpp"
#include <assert.h>
#include <float.h>
#include <cstdio>
#include <math.h>
#include <string.h>
// use a template to define both directio... | ALGO | 0.989401 | 6.706809 |
0bae64eb-4102-415a-a429-f6ff6fe5c674 | linjiafengyang/c-and-cpp | c/26利用递归求阶乘.cpp | #include <stdio.h>
int fact(int i);
int main() {
int i;
for(i = 0; i < 6; i++) {
printf("%d != %d\n", i, fact(i));
}
}
int fact(int i) {
int sum;
if(i == 0) {
sum = 1;
}
else {
sum = i * fact(i - 1);
}
return sum;
}
| ALGO | 0.97626 | 3.960708 |
c7cc3de0-46d4-4495-8344-17a9ed366f4a | dskrenta/csci-2400 | perflab/FilterMain.cpp | #include <stdio.h>
#include "cs1300bmp.h"
#include <iostream>
#include <fstream>
#include "Filter.h"
using namespace std;
#include "rdtsc.h"
//
// Forward declare the functions
//
Filter * readFilter(string filename);
double applyFilter(Filter *filter, cs1300bmp *input, cs1300bmp *output);
int
main(int argc, char *... | TOOL | 0.950219 | 4.157551 |
df717089-cccb-4225-9b07-c111efcc7d9a | IVLDen/skillbox_practic_8.6 | z4_main.cpp | #include <iostream>
#include <cmath>
// так как в задании не указано, какого типа числа применять, программа создалась для условий, где вводятся целые числа
int main() {
int file_mb; //размер файла
int mb_per_sec; // скорость загрузки
float complete_load_mb = 0; // количество загрженных мб
int time... | ALGO | 0.951733 | 3.229549 |
78b7ef60-219b-42ea-9064-21dbb064034f | rishisingh34/codeforces | Contest/1996A.cpp | #include<bits/stdc++.h>
using namespace std ;
int main() {
int t ;
cin >> t ;
while(t--) {
int leg ;
cin >> leg ;
if( leg % 4 !=0) {
cout << (leg / 4 )+ 1 << endl ;
} else {
cout << leg / 4 << endl ;
}
}
} | ALGO | 0.999583 | 3.614329 |
970b1957-ca1b-4f57-b0a5-078cd30665a7 | NurungjiBurger/codetree-TILs | 240704/최단 거리 9/shortest-distance-9.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
struct Edge{
int to;
int cost;
vector<int> path;
bool operator<(Edge right) const{
return cost > right.cost;
}
};
int n, m;
int from, to;
vector<int> anspath;
vector<Edge> edges[1001];
int dist[1001];
void dijkst... | ALGO | 0.999998 | 4.256772 |
6706f1b3-10ec-4e20-82bf-b229b3ca0684 | sanket-pixel/100-days-of-cpp | day_10/15_min_size_subarray_sum.cpp | #include <algorithm>
#include <deque>
#include <iostream>
#include <limits.h>
#include <unordered_map>
#include <unordered_set>
#include <vector>
using namespace std;
class Solution {
public:
int minSubArrayLen(int target, vector<int> &nums) {
int l = 0;
int min_sub_length = INT_MAX;
int total = 0;
f... | ALGO | 0.999949 | 5.97546 |
c4e37ebb-5bee-475e-ae62-582a2ee47897 | pistachiyoda/kyo-pro | AtCoder_Problems/Easy_33_B_Postal_Code.cpp | #include <iostream>
#include <string>
#include <cctype>
using namespace std;
int main() {
int a, b;
string s;
cin >> a >> b; // a部分、b部分の郵便番号文字数
cin >> s; // 文字列
string ans = "Yes";
for (int i = 0; i < a + b + 1; i ++) {
if (i < a || i > a + 1) {
if (!isdigit(s[i])) ans = ... | ALGO | 0.999779 | 3.854037 |
a4092937-afc0-4932-84a8-522cd4e58c63 | everyday-special/leetcode_solutions | c++/2_Add_Two_Numbers/solution.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* addTwoNumbe... | ALGO | 0.99996 | 6.385025 |
1f5f7469-0bff-482d-b3e1-e2d5c7b32746 | ned14/boost-trunk | libs/geometry/doc/src/examples/algorithms/intersection_segment.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
//[intersection_segment
//` Calculate the intersection point (or points) of two segments
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/io/wkt/wkt.hpp>
#include <b... | ALGO | 0.999713 | 4.824604 |
672a0f59-de09-4a91-a3ac-398de4d85333 | pritthiprokashsarkar/problem-set | knowledge through problem solving/queue/queue.cpp | /* #include<bits/stdc++.h>
using namespace std;
int calPoints(vector<string>&xxx) {
stack<int>a,b;
int x,sum1=0;
for(auto it: xxx)
{
if(it>="0" and it<="9")
{
x = stoi(it);
a.push(x);
}
else if( it=="C")
... | ALGO | 0.999322 | 4.710198 |
58f762ee-7063-4df9-a290-06153de56355 | Arihant140206/DSA | 1646-kth-missing-positive-number/kth-missing-positive-number.cpp | class Solution {
public:
int findKthPositive(vector<int>& arr, int k) {
int start = 0 , end = arr.size()-1 , mid , ans=arr.size();
while(start<=end)
{
mid = start+(end-start)/2;
if(arr[mid]-mid-1>=k)
{
ans=mid;
end=mid-1;
... | ALGO | 0.999969 | 5.191401 |
7fd4170a-2129-4ac0-b4d2-c719ec0edc48 | JuLieAlgebra/COP3530 | sparse_matrix.cpp | /*
COO Sparse Matrix Test using Linked List implementation.
*/
#include <iostream>
#include <sstream>
#include <vector>
#include <cassert>
using Scalar = int;
//////////////////////////////////////////////////
class DenseMatrix {
private:
std::vector<std::vector<Scalar>> data;
uint nrows;
uint ncols;
public:
... | ALGO | 0.994385 | 4.076061 |
8a64f6bb-771a-441a-936b-10e9d9192dca | kevinalvarez91/CS31 | Lecture6/problem7.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> v1 = {1, 2, 3, 4, 5, 6};
int k = 2;
for (size_t i = 0; i < k; i++) {
int firstElement = v1[0];
for (int j = 0; j < v1.size() - 1; j++) {
v1[j] = v1[j + 1]; // Correct index: move the element f... | ALGO | 0.999796 | 3.788258 |
3f372327-84c2-4668-ae3c-980fdc64607c | souraexx/100-C-Plus-Plus-STL-Algorithms | numeric algorithms/accumulate.cpp |
// C++ program to demonstrate working of accumulate()
#include <iostream>
#include <numeric>
using namespace std;
// User defined function
int myfun(int x, int y)
{
// for this example we have taken product
// of adjacent numbers
return x * y;
}
int main()
{
// Initialize sum = 1
int sum = 1;
... | ALGO | 0.999591 | 6.322532 |
9316597b-665d-41de-84fa-bb229df8bc20 | adeeb-404/ADA | Dijkstra's.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cout<<"Enter number of vertices\n";
cin>>n;
vector<pair<int,int>> adj[n];
for(int i=0;i<n;i++){
cout<<"Enter number of edges for node "<<i<<endl;
int m;
cin>>m;
cout<<"Enter destination node and corres... | ALGO | 0.999908 | 4.311268 |
390bcf22-25c9-4839-974e-52054aeb0011 | ishandutta2007/codeforces | farhod_farmon/normal/924/A.cpp | #include <bits/stdc++.h>
#define fi first
#define se second
#define fin(s) freopen( s, "r", stdin );
#define fout(s) freopen( s, "w", stdout );
const long long N = 55;
const long long Q = 10100;
const long long mod = 1e9 + 7;
const long long block = sqrt(N);
using namespace std;
int n;
int m;
int a[N];
int b[N];
ch... | ALGO | 0.999987 | 4.081304 |
1ee3ce0b-ef61-4145-90df-96081d2ad13c | amit839/Interview-Problems | Contests/Weekly Contest 184/1408. String Matching in an Array.cpp | // https://leetcode.com/contest/weekly-contest-184/problems/string-matching-in-an-array/
bool comp(string &a, string &b){
if(a.size() == b.size()) return a < b;
return a.size() < b.size();
}
bool found(string &a, string &b){
return b.find(a) != string::npos;
}
class Solution {
public:
vector... | ALGO | 0.999989 | 5.857539 |
dfc2333f-0104-4497-9c6a-cd1b6346f809 | abhinav99ash29/DSA-problems | leetcode/delete-node-in-a-linked-list.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
void deleteNode(ListNode* node) {
ListNode* temp = node;
temp->val = temp->next->val;
temp->next = temp->nex... | ALGO | 0.999806 | 5.639549 |
f64bbf9a-21f7-4781-99ea-695177c2f415 | saumya66/Competitive-Programming- | CODEFORCES/A2OJ Practice/1300 Codeforces Rating 1399/Cakeminator.cpp |
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve()
{
ll r, c;
cin>>r>>c;
char ar[r][c];
for(ll i=0;i<r;i++)
{
string s;
cin>>s;
for (ll j = 0; j < c; ++j)
{
ar[i][j]=s[j] ;
}
}
ll ans=0;
for(ll i=0;i<r;i++)
{
ll f=0,c1=0;
for (ll j = 0; j < c... | ALGO | 0.999769 | 3.335725 |
a3697312-21be-45f1-a8c0-51cd61ed810a | BlingstarHamal/flutter_study | parking/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.998123 | 6.76073 |
4a8f1f6c-6051-4552-9e9f-aa40f17e76a1 | sarthakkapoor44/CP | test.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
#include <string>
using namespace std;
const int MOD = 1000000007;
// Function to check if James wins
bool jamesWins(char james, char lily) {
return (james == 'R' && lily == 'S') ||
(james == 'P' && lily == 'R') ||
(james == 'S' ... | ALGO | 0.999981 | 5.996451 |
a338bb1c-ceb5-4521-ba9f-a11e9b421b88 | harshitspakhariya/CP.begin-- | 828B.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(i,a,b) for(ll i=a;i<b;i++)
#define PNO cout<<"NO\n"
#define PYES cout<<"YES\n"
#define vll vector<ll>;
int main()
{
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
ll t;
cin>>t;
while(t--)
{
l... | ALGO | 0.998388 | 3.225467 |
b3a8389b-d41e-4352-abb6-0eb7f91ba5c4 | dseco/acmudec | DiegoGataca/Semestre1-2017/4215.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
long long int solucion[100];
solucion[0] = 1;
solucion[1] = 5;
for(long long int i = 2; i < 100; i++)solucion[i]=(i+1)*(i+1)+solucion[i-1];
while(1){
int n;
scanf("%d",&n);
if(n == 0)break;
printf("%lld\n",solucion[n-1]);
}
return... | ALGO | 0.999847 | 4.553209 |
1c18c064-e921-44ca-b410-483660d1d679 | ishandutta2007/codeforces | ngfam/normal/762/C.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 123456;
int nxt[N][30], fix[N][30], f[N], g[N], suffix[N];
char a[N], b[N];
int main(){
#ifndef ONLINE_JUDGE
freopen("1.inp", "r", stdin);
freopen("1.out", "w", stdout);
#endif
scanf("%s%s", a + 1, b + 1);
int n = strlen(a + 1), m = strlen(b + 1... | ALGO | 0.999963 | 3.299788 |
1ec3a029-35e6-4023-ba7c-6eeb2e001d0a | ishandutta2007/codeforces | irkstepanov/normal/480/B.cpp | #include <bits/stdc++.h>
#define mp make_pair
#define pb push_back
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair <int, int> pii;
const int N = 100500;
int a[N], n;
bool ok (int c)
{
int l = 0, r = 0;
while (1)
{
++r;
if (r >= n) return false;
w... | ALGO | 0.999996 | 3.590022 |
3c90568e-21c2-4b62-b04e-e7301d448bb8 | OpenCAXPlus/OpenCAXPlus | OpenDigitalTwin-main/tools/cgal/examples/Optimal_transportation_reconstruction_2/otr2_list_output_example.cpp | #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Optimal_transportation_reconstruction_2.h>
#include <fstream>
#include <iostream>
#include <string>
#include <iterator>
#include <vector>
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef K::FT ... | ALGO | 0.999253 | 5.201056 |
1d4bd9f1-5f33-4e33-94c0-48a7ddc97dec | 00light00/PAT | Advanced/A1123.cpp | #include <bits/stdc++.h>
using namespace std;
struct node {
int value, height;
node* left, right;
node(int v = 0, int w = 1) : value(v), bs(w) {
left = right = NULL;
}
}
vector<int> ans;
int getheight(node* root) {
if (root == NULL)
return 0;
else
return root->height;
}
node* Lrotate(node* root) {
node... | ALGO | 0.999999 | 4.054562 |
24c9d3a4-e30f-4b6e-9610-f4d7b97bb6c0 | Ahmedsabib/Problem_Solving | CSES/Graph/Road Construction.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int maxn = 3e5 + 9;
// Time complexity - O(1)
// Space complexity - O(n)
struct DSU {
vector<int> par, rnk, sz;
int c;
DSU(int n) : par(n + 1), rnk(n + 1, 0), sz(n + 1, 1), c(n) {
for (int i = 1; i <= n; ++i) {
par[i] = i;
... | ALGO | 0.999982 | 4.468437 |
1c3b75ca-d173-4561-a6a0-39bbefddbde7 | Cleffa-00/CS_225 | lab_dict/entry/factorial.cpp | #include "fac.h"
#include <iostream>
#include <cstring>
#include <stdexcept>
using namespace std;
const string USAGE =
"USAGE: fac [NUM] [OPTIONS]\n"
"Calculates [NUM]! .\n"
"\n"
" -m Use memoization (defaults to not).\n";
int main(int argc, char* argv[])
{
unsigned long n = 0;
bool memoization = fals... | ALGO | 0.999134 | 6.899404 |
d17a4474-7741-45ae-95f9-59101a91f19d | Aleezay-1/bookish-guide | minMax.cpp | /*Write a function that takes an integer array and its size and finds the difference
between the maximum and minimum elements in the array*/
#include <iostream>
using namespace std;
int maxArr(int n, int arr[])
{
int max = 0;
for (int i = 0; i < n; i++)
{
if (arr[i] > max)
{
max... | ALGO | 0.999832 | 4.585948 |
2fff9a3e-cff2-45b6-8a7d-becc3a9ce7d4 | amang234/GeeksForGeeks-DSA | Difficulty: Medium/Print Anagrams Together/print-anagrams-together.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
public:
vector<vector<string>> anagrams(vector<string>& arr) {
// code here
vector<vector<st... | ALGO | 0.99931 | 6.557697 |
be4b8798-e11d-424f-9108-d9d2b4a9d8fa | ParasAnxi/LeetCode-CPP | Q0901-1000/997.Find_the_Town_Judge.cpp | class Solution {
public:
int findJudge(int n, vector<vector<int>> trust) {
if (trust.size() == 0 && n == 1)
return 1;
vector<int> count(n + 1);
for (auto x : trust) {
count[x[0]]--;
count[x[1]]++;
}
for (int x = 0; x < count.size(); x++) {... | ALGO | 0.999928 | 5.306935 |
3e549a52-4249-4d55-a484-a734db705d3f | TruecoderSri/DSA-ProgramList | Arrays & Misc/PatternWordMatching.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
// s->size of str array,p->size of pattern
// TC:O(s+p(s[i].size()))
// SC:O(p+s)
public:
bool wordPattern(string pattern, string s)
{
int j = 0;
map<char, string> mp1;
map<string, char> mp2;
int c = 1;... | ALGO | 0.999825 | 5.782766 |
3e2ec645-0551-433f-b411-d63e60b030a6 | ishandutta2007/codeforces | couplefire/normal/1739/F.cpp | #include <bits/stdc++.h>
using namespace std;
const int C = 12;
const int N = 1005;
struct DSU {
int fa[C], siz[C];
DSU() {
for (int i = 0; i<C; ++i) {
fa[i] = i;
siz[i] = 1;
}
}
int find(int v) {
return fa[v]==v ? fa[v] : fa[v] = find(fa[v]);
}
... | ALGO | 0.999998 | 4.708585 |
b804f948-bd43-497a-b010-f9dd18b99e73 | ArielGarciaM/CompetitiveProgramming | Codeforces/510/B.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
map<string, int> mp;
for(int i = 0; i < n; i++)
{
int a;
string s;
cin >> a >> s;
sort(s.begin(), s.end());
//cout << s << endl;
if(mp[s]) mp[s] = min(a, mp[s]);
else mp[s] = a;
}
int ans = 100000000;
string peeps[7] = {"A... | ALGO | 0.999843 | 3.714567 |
caed4547-4a34-4b8f-b510-1b22ed7f0e05 | algo-geek/Codes | Linked List/sort 0s 1s 2s.cpp | // 1
#include <bits/stdc++.h>
using namespace std;
struct Node{
int data;
Node* next;
Node(int d){
data=d;
next=NULL;
}
};
Node *insertEnd(Node *head,int x){
Node *temp=new Node(x);
if(head==NULL)return temp;
Node *curr=head;
while(curr->next!=NULL){
curr=cur... | ALGO | 0.999996 | 4.899329 |
4d2e53e8-059e-4453-9b3a-723d1cf50def | Northstrix/Midbar | STM32F407VET6 Version/V1.0/extra/Firmware_N64_Controller_only/Crypto.cpp | #include "Crypto.h"
/**
* Byte order helpers
*/
//#if BYTE_ORDER == BIG_ENDIAN
/*
inline static uint16_t crypto_htons(uint16_t x)
{
return x;
}
inline static uint16_t crypto_ntohs(uint16_t x)
{
return x;
}
inline static uint32_t crypto_htonl(uint32_t x)
{
return x;
}
inline static uint32_t crypto_nt... | ALGO | 0.987706 | 6.425103 |
6fa897ba-8ebf-4d66-a549-ef4bb7214984 | JavierRibaldelRio/competitive-programming | Acepta_el_Reto/Volumen5/551_Mensaje_Secreto/main.cpp | #include <iostream>
#include <string>
using namespace std;
bool caso()
{
string s;
cin >> s;
if (!cin)
{
return false;
}
for (int i = 0; i < s.length(); i = i + 2)
{
int n = (s.at(i) - '0') * 10 + (s.at(i + 1) - '0');
if (n < 32)
{
n = n * 10... | ALGO | 0.999016 | 4.009477 |
dc532389-10f7-43b5-9d4b-7ec9f5263f46 | acm-clan/algorithm-stone | user/leetcode/154.寻找旋转排序数组中的最小值-ii.cpp | /*
* @lc app=leetcode.cn id=154 lang=cpp
*
* [154] 寻找旋转排序数组中的最小值 II
*/
// @lc code=start
class Solution {
public:
int findMin(vector<int>& nums) {
int low = 0;
int high = nums.size() - 1;
while (low < high) {
int m = low + (high - low) / 2;
if (nums[m] < nums[hig... | ALGO | 0.999962 | 6.722698 |
9437b4e7-1d15-42d1-9160-be395c19218d | Karan234Iamneo/SKCT_DSA_IRC | trees/tree1/BST_implementation_insertion_display.cpp | #include<iostream>
using namespace std;
// Define a class node to represent each node in the binary search tree (BST)
class node
{
public:
int data; // Stores the data of the node
node *left; // Pointer to the left child of the node
node *right; // Pointer to the right child of the node
};
// Initializ... | ALGO | 0.999997 | 6.491297 |
908306de-4519-4990-be84-651965ace6e0 | Choirin/cost_map_proto | src/depth_to_scan.cpp | #include "depth_to_scan/depth_to_scan.hpp"
namespace depth_to_scan {
DepthToScan::DepthToScan(int width, int height, double fx, double fy, double cx,
double cy, double factor)
: width_(width),
height_(height),
fx_(fx),
fy_(fy),
cx_(cx),
cy_(cy),
factor_... | TOOL | 0.852312 | 6.342598 |
9db027e5-0428-4504-800d-b459c2635493 | jaymehta132/CSES-Solutions | Introductory Problems/Missing-Number.cpp | #include <iostream>
#include <set>
#include <vector>
#include <algorithm>
#include <stack>
#include <queue>
#define ll long long int
using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
#define ordered_set tree<int, null_type,less<int>, r... | ALGO | 0.999859 | 3.756349 |
0f30f091-c916-43bd-b845-c80749de263c | KunalBansal12/KUNALBANSAL12 | 114-flatten-binary-tree-to-linked-list/flatten-binary-tree-to-linked-list.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.999973 | 5.655341 |
ba02fa59-1b54-44d2-93c9-e4492d74630b | raincross7/code-similarity | codes/train_code/problem390/problem390_99.cpp | #pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
type... | ALGO | 0.999966 | 4.349611 |
f4bb52a0-4847-4a66-aa0b-73500af15b13 | nupur1262/CodeWithArsh | Goldman Sachs/Array Pair Sum Divisibility Problem .cpp | bool canPair(vector<int> nums, int k)
{
if(nums.size()%2)
return false;
vector<int>v(nums.size());
map<int,int>mp;
for(int i=0;i<nums.size();i++)
{
v[i]=nums[i]%k;
mp[v[i]]++;
//cout<<v[i]<<" ";
//cout<<v[i]<<"->"<<mp[v... | ALGO | 0.99991 | 4.342593 |
644be5f1-1b49-496c-b55a-e992e87558ef | ritesh0402/Algorithm | LeetCode/Practice/1200_Minimum_Absolute_Difference.cpp | class Solution
{
public:
vector<vector<int>> minimumAbsDifference(vector<int> &arr)
{
sort(arr.begin(), arr.end());
vector<vector<int>> ans;
int mindiff = arr[1] - arr[0];
for (int i = 0; i < arr.size() - 1; i++)
{
if (mindiff < arr[i + 1] - arr[i])
... | ALGO | 0.99998 | 5.82307 |
6e751aff-26ba-4fb3-95aa-a6fabd482387 | udit043/little_bit_competitive | chef/QUADROOT.cpp | #include <bits/stdc++.h>
using namespace std;
#define mx 100007
#define ll unsigned long long
#define sd(x) scanf("%d",&x)
#define pd(x) printf("%d \n", x)
#define sll(x) scanf("%lld",&x)
#define pll(x) printf("%lld \n", x)
//fill_n(a, 102, mx);
int main()
{
float a, b, c, x1, x2;
cin >> a >> b >> c;
x1 = (sqrt(... | ALGO | 0.999798 | 3.626966 |
b623f737-b624-4088-986c-ab1211a78f89 | thigiacmaytinh/TGMTcpp | lib/opencv342/contrib/tracking/src/trackerKCF.cpp | #include "precomp.hpp"
#include "opencl_kernels_tracking.hpp"
#include <complex>
#include <cmath>
/*---------------------------
| TrackerKCFModel
|---------------------------*/
namespace cv{
/**
* \brief Implementation of TrackerModel for KCF algorithm
*/
class TrackerKCFModel : public TrackerModel{
public... | ALGO | 0.982541 | 6.587006 |
b0ddd4b0-2741-4c9a-bc55-c81bc2ae3079 | MiroKaku/Musa.Runtime | Microsoft.VisualC.Runtime/UCRT/10.0.26100.0/ucrt/startup/argv_wildcards.cpp | #include <corecrt_internal.h>
#include <ctype.h>
#include <corecrt_internal_traits.h>
#include <limits.h>
#include <mbstring.h>
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <wrl/wrappers/corewrappers.h>
namespace
{
template <typename Character>
class argument_list
{
public:
... | TOOL | 0.926002 | 5.803003 |
4b18a69c-3fbb-4881-81ec-0ea9b0ddb161 | selbrk/LeetCodeDaily | 1642-water-bottles/water-bottles.cpp | class Solution {
public:
int numWaterBottles(int numBottles, int numExchange) {
int empty = 0, ans = 0;
while (numBottles) {
ans += numBottles;
empty += numBottles;
numBottles = 0;
numBottles += empty / numExchange;
empty = empty % numExcha... | ALGO | 0.999819 | 5.262854 |
d753492d-fcdb-4dd9-9a9d-4f4ca04e9743 | deepti-iiitr/LeetCode_Practice | 45-jump-game-ii/45-jump-game-ii.cpp | class Solution {
public:
int helper(int inx, vector<int>& nums, vector<int>& dp){
if(inx >= nums.size()-1){
return 0;
}
if(dp[inx] != -1) return dp[inx];
int minJumps = 10e5;
for(int i=1; i<=nums[inx]; i++){
minJumps = min(minJumps, 1 + helper... | ALGO | 0.999979 | 5.936142 |
f4c89411-ef74-4e33-82dc-d38d48c7be2c | StealthWorm/FILES_SCRIPTS_C | JOGO_MEMORIA/Exemplo_Jogo ja resolvido.cpp | #include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include <locale.h>
#include <conio.h>
#include <windows.h>
#define N 5
#define M 4
#define L 10
char TAB[N][M];
char TAB_mostrar[N][M];
char FIG[L]={'a','b','c','d','e','f','g','h','i','j'};
//Prottipos
void inicializacao();
void embaralhar();
void mostrar();
voi... | ALGO | 0.999382 | 3.280075 |
423c0dcc-c5fa-4cee-b322-44432991dd02 | abhi00rnair/LEARN_DSA | 3110-score-of-a-string/3110-score-of-a-string.cpp | class Solution {
public:
int scoreOfString(string s) {
int i=0;
int ret=0;
while(i<s.size()-1){
//cout<<(int)name[i]<<endl;
ret+=abs((int)s[i]-(int)s[i+1]);
i++;
}
//cout<<ret;
return ret;
}
}; | ALGO | 0.999959 | 4.779763 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.