uuid stringlengths 36 36 | repo_name stringlengths 5 133 | relative_path stringlengths 3 3.76k | content stringlengths 282 4.03M | category stringclasses 6
values | algo_rel_score float32 0.9 1 | quality_score float32 3 8.13 | source_meta dict |
|---|---|---|---|---|---|---|---|
227ee5f2-b2e9-40af-8d93-0dcdafa562d4 | Ra1nWarden/Online-Judges | leetcode/mergeKSortedLists.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
typedef pair<ListNode*, int> LI;
class CompareListNode {
public:
bool operator()(LI& one, LI& two) {
if(one.first == NULL)
return fal... | ALGO | 0.999977 | 6.063573 | {
"github_metadata": {
"branch": "master",
"commit_count": 208,
"repo_created_at": "2014-04-02T05:35:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 38,
"pull_requests": 0
},
"file_meta": {
"content_id": "f59f9a5... |
30241b0e-cb86-42ad-9a8d-468084ff87bc | alaneos777/club | project euler/627.cpp | #include <bits/stdc++.h>
using namespace std;
using lli = long long int;
const lli mod = 1e9 + 7;
lli power(lli a, lli b){
lli ans = 1;
if(b < 0) b += mod-1;
while(b){
if(b&1) ans = ans * a % mod;
b >>= 1;
a = a * a % mod;
}
return ans;
}
int main(){
int M = 30;
lli N = 10001;
int d = 10;
vector<lli> ... | ALGO | 0.999869 | 4.689844 | {
"github_metadata": {
"branch": "master",
"commit_count": 34,
"repo_created_at": "2018-08-06T04:13:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b5933d9bd... |
fad4b839-b379-41f8-bdb5-f5d2a2a6c2e8 | MingshanJia/DataFlowAnalysis | CloneBen/google_code/41/4/dzhulgakov_2_0.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <algorithm>
#include <numeric>
#include <string>
#include <cstring>
#include <set>
#include <map>
#include <vector>
#include <queue>
#include <iostream>
#include <iterator>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <sstream>
#include <cassert>
using namespa... | ALGO | 0.999461 | 3.530922 | {
"github_metadata": {
"branch": "master",
"commit_count": 802,
"repo_created_at": "2019-10-14T10:49:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "acbf515c... |
709564e5-733c-4650-bdc9-8ce4d24b0283 | haozzzzzzzz/osgEarthX | environment/build/3rdParty/include/geos/geos/operation/polygonize/EdgeRing.h | /**********************************************************************
*
* GEOS - Geometry Engine Open Source
* http://geos.osgeo.org
*
* Copyright (C) 2006 Refractions Research Inc.
* Copyright (C) 2001-2002 Vivid Solutions Inc.
*
* This is free software; you can redistribute and/or modify it under
* the ter... | TOOL | 0.960858 | 5.996141 | {
"github_metadata": {
"branch": "master",
"commit_count": 28,
"repo_created_at": "2015-09-19T06:19:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 75,
"forks": 48,
"issues": 3,
"pull_requests": 0
},
"file_meta": {
"content_id": "1438f5c... |
3b9524d0-dafe-4f57-a45d-4579a0733d07 | ganeshmittal223/Cpp | Graphs 1/Islands.cpp | /*
Islands
Send Feedback
An island is a small piece of land surrounded by water . A group of islands is said to be connected if we can reach from any given island to any other island in the same group . Given V islands (numbered from 1 to V) and E connections or edges between islands. Can you count the number of conne... | ALGO | 0.999944 | 5.232587 | {
"github_metadata": {
"branch": "main",
"commit_count": 18,
"repo_created_at": "2022-06-30T09:42:55.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b87e031e10d... |
a4882745-d8b5-4610-89c4-7924693ebb4d | L0rd-AK/Competitive-Programming-practice | CodeForces-Problems/445A.cpp | #include <bits/stdc++.h>
using namespace std;
#ifndef ONLINE_JUDGE
#define LOCAL
#endif
#define ll long long
#define f(x1, y1, z1) for (int x1 = y1; x1 < z1; x1++)
#define endl "\n"
#define yn(f) cout << (f ? "YES\n" : "NO\n")
#define pr(x) cout << x << "\n"
#define all(x) x.begin(), x.end()
#define vl vector<ll>
#de... | ALGO | 0.999825 | 3.837778 | {
"github_metadata": {
"branch": "main",
"commit_count": 616,
"repo_created_at": "2023-08-23T17:29:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2df55d5ce9... |
002d7e73-ef50-41a8-85d7-08f54ee331bf | simran279/100-days-of-DSA | adhoc problems/CEqualize.cpp | /*
You are given two binary strings a and b of the same length.
You can perform the following two operations on the string :
Swap any two bits at indices i and j respectively (1≤i,j≤n), the cost of this operation is |i−j|, that is, the absolute difference between i and j
Select any arbitrary index i (1≤i≤n) and... | ALGO | 0.999987 | 4.2402 | {
"github_metadata": {
"branch": "master",
"commit_count": 30,
"repo_created_at": "2020-08-06T17:34:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b5c9d59c9... |
fe9e2de9-dd40-42c0-8c1f-3dd37283b6a4 | gazon1/algorithms-codeforce | 544 div 3/E.cpp | #include <bits/stdc++.h>
using namespace std;
int get_1_max_team(int n, int skills[]) {
sort(skills, skills + n);
int max_team = 0; // maximum size of a team
int j = 1;
int idx = 0; // index of skills array where a team starts
for (int i = 0; i < n; i++) {
if (skills[i] == -1) {
++j;
conti... | ALGO | 0.999969 | 4.052011 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2019-06-03T09:34:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6a360c2f70... |
d7b3c307-0c63-4687-935c-8c1b37485bc9 | jamiul-islam/mlh-global-hack-week | 3.rock-paper-scissors.cpp | #include <iostream>
#include <ctime>
#include <cstdlib>
enum Choice
{
ROCK,
PAPER,
SCISSORS
};
enum Result
{
WIN,
LOSE,
DRAW
};
Choice getPlayerChoice()
{
int choice;
do
{
std::cout << "Enter your choice (0 for Rock, 1 for Paper, 2 for Scissors): ";
std::cin >> cho... | TOOL | 0.940575 | 5.552371 | {
"github_metadata": {
"branch": "main",
"commit_count": 11,
"repo_created_at": "2024-01-09T17:34:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "84d6946f1c4... |
ccdeff9a-555a-481c-94df-dba449f48de9 | AdityaRPawar101/My_Algorithms | linear queue using array.cpp | #include <stdio.h>
#include <conio.h>
#include <string.h>
#include <stdlib.h>
#define MAX 6
int Q[MAX];
int front, rear;
// fucntion to insert an element in linear queue
void insertQ()
{
int data;
if (rear == MAX)
{
printf("\n Linear Queue is full");
return;
}
else
{
pr... | ALGO | 0.983635 | 3.973726 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2023-05-22T14:50:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cdc1c3b7fb73... |
c86e6912-730b-421d-9ceb-29ec02819ac6 | sojungoh/algorithm-ps | baekjoon/b-1406/b-1406.cpp | #include <iostream>
#include <list>
#include <string>
using namespace std;
list<char> parsing(const string& s) {
list<char> l;
for(int i = 0; i < s.size(); ++i)
l.push_back(s[i]);
return l;
}
int main() {
ios::sync_with_stdio(0); cin.tie(0);
string s; cin >> s;
list<char> l = parsing... | ALGO | 0.999734 | 4.447676 | {
"github_metadata": {
"branch": "main",
"commit_count": 351,
"repo_created_at": "2021-03-18T14:25:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f3dc655547... |
8d68a6d8-b623-4fd3-a336-cc235004d414 | hxzinh/VOI | CHIEF/main.cpp | #include <bits/stdc++.h>
#define ll long long
#define oo 99999999999
#define MASK(x) (1LL >> (x))
#define BIT(x,i) ((x) << (i))
#define FastIO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const int NM = 5e3 + 10;
int n,k;
int f[NM][NM], a[NM];
bitset<20> tmp;
void readfile(){
freope... | ALGO | 0.999761 | 3.658165 | {
"github_metadata": {
"branch": "main.cpp",
"commit_count": 2,
"repo_created_at": "2023-04-04T10:59:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "28e5e031... |
b6583976-b352-44ac-978f-651c139771ee | AveryFerrante/FinalProject | word.h | #ifndef WORD_H
#define WORD_H
#include <vector>
#include <cstring>
#include <iostream>
#include <cassert>
#include <fstream>
#include "documentandfrequency.h"
#include <algorithm>
#define MAX_RESULTS 14 // Enter 1 less than you want displayed (i.e. 14 will display 1 - 15 results on the screen)
//Word class that repr... | TOOL | 0.95312 | 3.369706 | {
"github_metadata": {
"branch": "master",
"commit_count": 82,
"repo_created_at": "2014-11-13T21:42:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c8e0f3f7b... |
7a2ac01e-d7b9-4091-845c-78c7fa755f86 | SabdullahZ/diamond-shape | q3.cpp | /*name: <NAME>
roll no. bsef20a044
section: afternoon*/
#include<iostream>
using namespace std;
int main()
{
int input;
cout << "enter a positive odd integer greater than 3: ";
cin >> input;
//input validation
while (!(input % 2 == 1 && input > 3))
{
cout << "ERROR! Invalid input...you have to enter a positive... | ALGO | 0.999621 | 3.957581 | {
"github_metadata": {
"branch": "main",
"commit_count": 11,
"repo_created_at": "2021-08-21T09:11:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "76f6d05c09e... |
426d1f93-c940-492e-9c8b-d6df2fe50c99 | shruti-shrz/Codechef | dataset/sample_2/ex_0.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 998244353ll
#define pb push_back
#define vl vector<ll>
#define pll pair<ll,ll>
#define mp make_pair
using namespace std;
#define pi (long double)3.14159265358979323846
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie... | ALGO | 0.999924 | 4.861719 | {
"github_metadata": {
"branch": "master",
"commit_count": 29,
"repo_created_at": "2020-07-05T16:07:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0668df3f6... |
4c21de30-0fd5-4cbe-a183-25e54fbf55d7 | overload-development-community/DLE.NET | DLE/Managers/SegmentManager.h | #ifndef __segman_h
#define __segman_h
// -----------------------------------------------------------------------------
#define MAX_SEGMENTS_D1 800 // descent 1 max # of cubes
#define MAX_SEGMENTS_D2 900 // descent 2 max # of cubes
#define SEGMENT_LIMIT 20000 // D2X-XL max # of cubes
#define MAX_SEGMENTS ((theM... | TOOL | 0.972715 | 4.201928 | {
"github_metadata": {
"branch": "master",
"commit_count": 187,
"repo_created_at": "2020-02-23T22:50:30.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 2,
"forks": 2,
"issues": 2,
"pull_requests": 0
},
"file_meta": {
"content_id": "e6a0e1ac3... |
5e881cd5-65d2-40b0-bf9f-a6eb297b4a89 | QAQLeonard/BUAA-Algorithm-2022 | Algorithm/Standard/C7/C7-I.cpp | #include <bits/stdc++.h>
#define maxn 200086
using namespace std;
typedef long long ll;
struct node{
ll x, y;
int f, id;
void getf(){
if(x >= 0 && y > 0) f = 1;
else if(x < 0 && y >= 0) f = 2;
else if(x <= 0 && y < 0) f = 3;
else f = 4;
}
bool operator < (const nod... | ALGO | 0.999724 | 4.790511 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2023-03-02T11:51:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "696ac3e214dc... |
7f2d53f0-5fd3-4cbd-8e63-11d9fe66716f | Parzival1509/GFG_POTD | 2023/2023-09/GFG_POTD_2023-09-29_Number_of_Enclaves.cpp | // GFG POTD 2023/09/29
// Number of Enclaves
// Medium
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int dx[4] = { -1 ,0 ,0, 1};
int dy[4] = { 0, -1, 1, 0};
void dfs(vector<vector<int>>& grid, int i, int j, int& n, int& m) {
grid[i][j] = -1;
for(int d = 0; d <... | ALGO | 0.999969 | 6.321862 | {
"github_metadata": {
"branch": "main",
"commit_count": 32,
"repo_created_at": "2023-06-01T09:54:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f01f6796bdb... |
4aa918eb-2790-4c5f-aa75-834abe140d58 | peter-fh/Chess_Engine | engine/Bithack.h | #include <cstdint>
#include <map>
#include <stdint.h>
#include <stdbool.h>
#include <string>
class Bithack
{
public:
Bithack();
// Ray functions
uint64_t getHorizontal(int position);
uint64_t getVertical(int position);
uint64_t getDiagonal(int position);
uint64_t getCounterDiagonal(int positi... | ALGO | 0.989428 | 4.874162 | {
"github_metadata": {
"branch": "main",
"commit_count": 51,
"repo_created_at": "2024-01-29T02:51:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cf7c161e1ac... |
bf043360-2add-430e-8bb6-7a68f2ee3768 | enzo1982/smooth | classes/misc/binary.cpp | /* The smooth Class Library
* Copyright (C) 1998-2014 <NAME> <<EMAIL>>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of "The Artistic License, Version 2.0".
*
* THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WIT... | TOOL | 0.987997 | 6.374332 | {
"github_metadata": {
"branch": "master",
"commit_count": 1379,
"repo_created_at": "2017-08-20T16:44:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 29,
"forks": 12,
"issues": 4,
"pull_requests": 1
},
"file_meta": {
"content_id": "f579b... |
53873ac1-00c4-46bf-98b7-96e191b03704 | AndrejTica/School | temp/dynamic_memory/main.cpp | #include <iostream>
void stackArray(int size) //stack array
{
int arr[size];
for(int i=0; i<size; i++)
{
arr[i]=i;
std::cout << "arr[" << i << "]=" << arr[i] << std::endl;
};
};
void heapArray(int size)
{
int* ptr = new int[size];
for(int i=0; i<size; i++)
... | TOOL | 0.936489 | 3.52024 | {
"github_metadata": {
"branch": "master",
"commit_count": 95,
"repo_created_at": "2020-09-30T06:09:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "847b6f6f0... |
550b51cd-2b0a-4ffc-a3f1-96d3a3d565ab | bvquoc/CP-Trainning-2021 | 0 - Contest 2020/VNOI Online 2021/z-Contestants/KH-12 Truong Tran Nhat Huy/PERMEOW.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int N = 2e5 + 5, MOD = 1e9 + 7;
int n, fac[N], dp[N];
void add(int &a, int b) {
a = (a + b) % MOD;
}
void mul(int &a, int b) {
a = a * b % MOD;
}
void precomputation() {
fac[0] = 1;
for (int i = 1; i <= n; ++i) {
fac[i] = fac[i - 1];
... | ALGO | 0.999972 | 4.288791 | {
"github_metadata": {
"branch": "master",
"commit_count": 611,
"repo_created_at": "2020-06-03T07:47:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9b3dfb48... |
8b01ae2d-4356-4b20-91b5-60f4d85d058d | ardRiriy/cp-libs | atcoder/abc184/e.cpp | #include <bits/stdc++.h>
#include "input.hpp"
using namespace std;
// using namespace atcoder;
#ifdef ADRY
#include <dbg.h>
#else
// DO NOTHING
#define dbg(...)
#endif
#define all(v) v.begin(),v.end()
#define resort(v) sort(v.rbegin(),v.rend())
using ll = long long;
using ull = unsigned long long;
using vll=vector<l... | ALGO | 0.999809 | 3.926111 | {
"github_metadata": {
"branch": "main",
"commit_count": 699,
"repo_created_at": "2024-02-03T20:19:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 6,
"pull_requests": 0
},
"file_meta": {
"content_id": "15fda222fb... |
de02f07b-0796-4fc0-9836-c1094fbdf2aa | vivek-yamsani/algos-Task | task2/algos-Task2-a.cpp | #include <iostream>
#include <string>
#include <vector>
#include <stack>
#include <bits/stdc++.h>
#define ll long long int
#define mod 1000000007
#define For(i, n) for (int i = 0; i < n; i++)
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t;
c... | ALGO | 0.999697 | 3.917171 | {
"github_metadata": {
"branch": "master",
"commit_count": 10,
"repo_created_at": "2021-06-06T14:13:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "23bdf7b16... |
735a447b-64a9-4e01-a81c-173e2371f887 | fonadius/mindstorm | registration/improc.cpp | #include "improc.h"
#include <memory>
#include <list>
using namespace std;
using namespace cv;
namespace registration {
size_t segmentation(const Mat &im, img<size_t> &labels)
{
memset(labels.samples, 0, labels.width * labels.height * sizeof(size_t)); // label all pixels as background
size_t regions = 1;
... | ALGO | 0.999099 | 5.012192 | {
"github_metadata": {
"branch": "master",
"commit_count": 13,
"repo_created_at": "2016-03-18T17:18:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "add3bbd43... |
135b5f49-d5ae-4371-9b35-852b31d80b9f | Sandia2014/exercises | intrepid-playground/ContractFieldFieldTensor.cu | // -*- C++ -*-
// matrixMultiplication.cc
// a huge comparison of doing naive and tiled matrix multiplication using many
// different methods and technologies
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <string>
#include <algorithm>
// yucky, but for asking the system how many co... | ALGO | 0.969629 | 4.988885 | {
"github_metadata": {
"branch": "master",
"commit_count": 181,
"repo_created_at": "2014-09-29T17:25:04.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4e0853000... |
6d7550cd-0e11-4998-b983-47f30f397419 | Mehulcoder/Leetcode | 685.cpp | class DSU {
public:
int connected;
vector<int> parent, rankk;
DSU() {}
void init(int n) {
parent.clear();
rankk.clear();
parent.resize(n, 0);
rankk.resize(n, 0);
for (int i = 0; i < n; i++) {
parent[i] = i;
rankk[i] = 0;
}
connected = n;
}
int findSet(int u) {
if (parent[u] == u) return ... | ALGO | 0.999989 | 4.843794 | {
"github_metadata": {
"branch": "master",
"commit_count": 31,
"repo_created_at": "2020-08-17T11:18:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b63bf1fdf... |
95a8bd77-54b6-433c-b8fb-d43b1f812f06 | Ascnbeta/oi_code | luogu/P3313.cpp | #include <bits/stdc++.h>
#define size siz
using namespace std;
const int maxn = 1e5+10;
int n,q;
int w[maxn],c[maxn];
vector<int> e[maxn];
int dfn[maxn],top[maxn],son[maxn],size[maxn],f[maxn],dep[maxn],rnk[maxn],cnt;
void dfs1(int u,int fa) {
size[u] = 1;
son[u] = 0;
dep[u] = dep[fa] + 1;
for (auto &v :... | ALGO | 0.999894 | 4.264513 | {
"github_metadata": {
"branch": "main",
"commit_count": 119,
"repo_created_at": "2025-01-08T11:30:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a31703bd51... |
6cc02781-1af8-431e-9560-d5e34b4715f3 | StephenGe1114/cpp | 8-13/polymorphism/virtual2.cc | ///
/// @file virtual2.cc
/// @author gsw(<EMAIL>)
///
#include <iostream>
using std::cout;
using std::endl;
class Base
{
public:
// 构造函数不能声明为虚函数,为什么?
// 答:根据虚函数被激活的条件,可以看出,虚函数执行时,
// 是在对象创建完毕之后;对象创建完毕之后才有了虚函数指针
//
// virtual
Base(double ibase)
: _ibase(ibase), _ix(_ibase)
{
cout << "Base(int)... | TOOL | 0.935455 | 4.80975 | {
"github_metadata": {
"branch": "master",
"commit_count": 10,
"repo_created_at": "2023-07-11T06:07:25.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "664479f19... |
f887280e-0d4a-42c1-9470-2d7b6abc66eb | wahaaj263/Class-Assignments | Third Semester/Class DSA Assigmnets 2/BS-AI-DSA Assignment (Girls)/2023-BS-AI-037/multi array 4.cpp | #include <iostream>
using namespace std;
int main() {
int arr[3][4] = {
{3, 5, 7, 2},
{8, -1, 4, 10},
{12, 6, 9, 0}
};
int rows = 3;
int cols = 4;
int row1 = 0, col1 = 2;
int row2 = 1, col2 = 3;
if (row1 >= 0 && row1 < rows && col1 >= 0 && col1 < cols &&
... | ALGO | 0.999794 | 5.899004 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2025-06-17T04:12:01.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "05f39d213f1b... |
aa972e96-e0ce-4e13-80f5-31457e8aa6db | simeaol/code-challenge | lcs.cpp | #include <bits/stdc++.h>
using namespace std;
int preffix[5011][5011];
int suffix[5011][5011];
void printa(int N, int M) {
for (int i = 1; i <= N; ++i) {
for (int j = 1; j <= M; ++j) {
cout << preffix[i][j] << " ";
}
cout << endl;
}
cout << "--------" << endl;
for (int i = 1; i <= N; ++i) {... | ALGO | 0.99997 | 4.230709 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2019-04-24T18:31:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9dde65888e... |
352a87dc-9123-403a-96b3-2708769b4815 | CoderLiLe/hello-algo | codes/cpp/剑指Offer/51_InversePairs/main.cpp | //
// main.cpp
// 51_InversePairs
//
// Created by LiLe on 2020/2/22.
// Copyright © 2020 lile. All rights reserved.
//
/**
面试题51:数组中的逆序对
题目:在数组中的两个数字,如果前面一个数字大于后面的数字,则这两个数字组成一个逆序对。
输入一个数组,求出这个数组中的逆序对的总数。例如,在数组{7, 5, 6, 4}中,一共存在5个
逆序对,分别是(7, 6), (7, 5), (7, 4), (6, 4) 和 (5, 4)。
*/
/**
分析:
蛮力法:顺序扫描整个数组,每扫描到... | ALGO | 0.999877 | 5.125294 | {
"github_metadata": {
"branch": "master",
"commit_count": 701,
"repo_created_at": "2019-05-21T08:29:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "da88cde4... |
7805dd34-67cc-42c4-9530-612fdebc3c44 | gabrielpessoa1/Competitive-Programming | North America Qualifier 2018/I.cpp | // North America Qualifier 2018
// I - Monitoring Ski Paths
// https://open.kattis.com/problems/monitoringskipaths
#include <bits/stdc++.h>
using namespace std;
const int ms = 3e5+2;
typedef pair<int, int> ii;
vector<int> g[ms];
ii rota[ms];
int vis[ms];
int mark[ms];
int routMark[ms];
vector<int> start[ms], finis... | ALGO | 0.999878 | 3.888169 | {
"github_metadata": {
"branch": "master",
"commit_count": 92,
"repo_created_at": "2019-04-16T00:08:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 9,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5df2e8a52... |
e6698982-3146-4617-8837-8ae2cb8aea4b | SushiStar/LC | Sorting_Searching/MedianOfTwoSortedArrays.cpp | /*
* There are two sorted arrays nums1 and nums2 of size m and n respectively.
* Find the median of the two sorted arrays. The overall run time complexity
* should be O(log(m+n)). You may assume nums1 and nums2 cannot be both empty.
*
* Date: 05/15/2022
* Author: <NAME>
*/
#include <vector>
using namespace std;... | ALGO | 0.999997 | 6.810147 | {
"github_metadata": {
"branch": "master",
"commit_count": 683,
"repo_created_at": "2018-10-01T23:10:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d2b19a2c... |
9af44d71-719d-4b87-9140-92ff387b2377 | geoffgeorgein/CP | 1/MIS.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
int maxSumIS(int arr[], int n)
{
// Your code goes here
int ma=0;
int dp[n+1];
for(int i=0;i<=n;i++){
dp[i]=arr[i];
}
// dp[0]=arr[0];
... | ALGO | 0.999913 | 5.846019 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2023-09-08T09:05:37.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d7d2fdafa519... |
cf72ed02-0da9-4a7d-ac78-8c9bb8ef5b38 | prompt412/Gold100 | 나경아/2022_05_27_12298_연속합2.cpp | #include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <tuple>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <climits>
#include <iostream>
using namespace std;
using ii = pair<int, int>;
using iii = tuple<int, int, int>;
#define X first;
#defin... | ALGO | 0.999977 | 3.76114 | {
"github_metadata": {
"branch": "main",
"commit_count": 107,
"repo_created_at": "2022-04-30T08:02:47.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2a00e03f51a... |
6b82e980-b897-42ad-aa16-f00d9616f967 | sourodipg/ComplexRootsPolynomial | QUINFINA.CPP | //Copyright 2022 <NAME>.
//Written in C++ in May 2012 when I was in my second year of Engineering Bachelor's.
#include<iostream>
#include<math.h>
double ddx(double,double,double,double,double,double);
double ddx1(double,double,double,double,double,double,double);
double f(double,double,double,double,double,double);
... | ALGO | 0.999647 | 3.120873 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2022-12-03T10:18:47.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "85a656ce5d1e... |
3cc2500b-bab2-4894-b73a-a2ac97863691 | heyuhhh/ACM | oj/codeforces/contests/1312/C.cpp | /*
* Author: heyuhhh
* Created Time: 2020/3/9 22:44:25
*/
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#include <assert.h>
#define MP make_pair
#define fi first
#define se second
#define pb push_back... | ALGO | 0.999796 | 4.093132 | {
"github_metadata": {
"branch": "master",
"commit_count": 693,
"repo_created_at": "2019-11-25T06:31:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "910c4eb3... |
f7365741-886d-4dcc-9483-637cc47a45d1 | NeilWangziyu/cxx_leetcode | cplusplus/letterCombinations/main.cpp | //
// main.cpp
// letterCombinations
//
// Created by 王子昱 on 2019/9/22.
// Copyright © 2019 王子昱. All rights reserved.
//
#include <iostream>
#include <vector>
#include <string>
#include <map>
using namespace std;
class Solution {
public:
vector<string> letterCombinations(string digits) {
vector<string... | ALGO | 0.999498 | 5.898373 | {
"github_metadata": {
"branch": "master",
"commit_count": 39,
"repo_created_at": "2019-06-28T07:25:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3fab1d95c... |
0d6ea967-ba67-4660-a214-909e5d700310 | jeyechoi/Study-Algorithms | Programmers/42862_체육복/main.cc | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int solution(int n, vector<int> lost, vector<int> reserve) {
int answer = 0;
sort(lost.begin(), lost.end());
sort(reserve.begin(), reserve.end());
for (auto lit = lost.begin(); lit != lost.end();) {
auto rit = fi... | ALGO | 0.999869 | 4.785173 | {
"github_metadata": {
"branch": "main",
"commit_count": 379,
"repo_created_at": "2021-09-18T04:58:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "116cddacea... |
bf68ed80-b307-4aa6-a4d5-2e805c8fb9e8 | alikhanmurat/ADS | Lab12/A.cpp | #include <bits/stdc++.h>
#define ll long long int
using namespace std;
const int INF = 1e9;
int a[505][505];
int b[505][505];
int c[1000000];
int d[1000000];
void solve(){
ll x;
cin >> x;
for(int i = 1; i <= x; i++) {
for(int j = 1; j <= x; j++) {
cin >> a[i][j];
b[i][j] = INF;
}
}
for(int i = 1; i... | ALGO | 0.999972 | 3.773803 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2023-05-08T16:29:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6428a9cd2566... |
bb4a9059-c39c-4d4a-beb6-56c1f321cd9d | illuxa8/6.2 | 6.2(1)/Source.cpp | #include <iostream>
#include <iomanip>
#include <time.h>
using namespace std;
void create(int* a, const int n, const int l, const int h);
void max(int* a, int n, int& a_max);
void min(int* a, int n, int& a_min);
int sum(int a, int b);
int main() {
srand((unsigned)time(NULL));
const int n = 20;
int a[n]... | ALGO | 0.990212 | 3.685064 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2021-11-04T23:28:43.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "dfa7918938... |
7ac23ed4-9e2d-4917-91f3-c93e92ece1c4 | joy-roy-swe/Competitive_Programming | SDE_Preparation/Warmhole.cpp | #include <iostream>
using namespace std;
int space[10][5], visited[10];
int ans, n, flag;
int MIN(int x, int y){
if(x>y) return y;
else return x;
}
int ABS(int a){
if(a<0) return -a;
else return a;
}
int getDistance(int sx, int sy, int dx, int dy){
int xd = ABS(dx-sx);
int yd = ABS(dy-sy);
... | ALGO | 0.999837 | 4.3058 | {
"github_metadata": {
"branch": "main",
"commit_count": 21,
"repo_created_at": "2021-08-03T09:37:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6c1ba5bd52b... |
3f05fb8b-0b01-438b-9944-3450754d131a | milon/UVa | Volume-7/UVa_740.cpp | //UVa Problem-740(Baudot Data Communication Code)
//Accepted
//Running time: 0.012 sec
//Author: Milon
#include<cstdio>
#include<cstring>
using namespace std;
char down_shift(char x[]){
if ( strcmp ("00000", x) == 0 )
return '<';
if ( strcmp ("00001", x) == 0 )
return 'T';
if ( strcmp ("00... | ALGO | 0.999864 | 3.440499 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2013-07-13T13:14:03.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 13,
"forks": 13,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2c2eb646... |
7c208278-eeaa-4ed1-94d3-c5a6ebc57785 | BinomialSheep/CompetitiveC-- | RasenBook/Rasen13/MST.cpp | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
typedef long long ll;
static const int MAX = 100;
static const int INFTY = (1 << 21);
static const int WHITE = 0;
static const int GRAY = 1;
static const int BLACK = 2;
int n, M[MAX][MAX];
int prim() {
int u, minv;
... | ALGO | 0.999981 | 3.849207 | {
"github_metadata": {
"branch": "master",
"commit_count": 34,
"repo_created_at": "2023-12-12T17:45:06.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "154a1bb55... |
f6fa3acf-bda9-4d98-be66-610ff7ffb92d | IvanAli/ACMICPC2017Training | VIIISamara/i2.cpp | #include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
int x, y;
string s;
int n;
int dx, dy;
bool ok(int xi, int yi, int t) {
int xt = x + dx * t;
int yt = y + dy * t;
int xx = abs(xt - xi);
int yy = abs(yt - yi);
return xx / 2 + (xx % 2) + yy / 2 + (yy % 2) <= t;
}
int main() {
cin >> x >> y;
c... | ALGO | 0.999976 | 4.517696 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2017-12-14T05:43:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b42a6e3bc2... |
946a4327-6ffd-423c-b807-7ae038f225a7 | Nandani-koli/Striver-SDEsheet-Challange | Day-12/IntersectionPointof2LL.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int data;
Node *next;
Node(int data)
{
this->data = data;
this->next = NULL;
}
};
//Using Hashing TC:- O(n+m) SC-> O(n)
int findIntersection(Node *firstHead, Node *secondHead)
{
//Write your code here
unord... | ALGO | 0.999982 | 4.777145 | {
"github_metadata": {
"branch": "main",
"commit_count": 184,
"repo_created_at": "2022-06-06T08:40:59.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a42ac176a9... |
9e63d952-3002-441d-b5bd-0361a54085de | AlperSaltabas/OR_Tools_Google_API | documentation/tutorials/cplusplus/routing_common/routing_solution.h | // Copyright 2011-2014 Google
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in wri... | TOOL | 0.94897 | 6.471465 | {
"github_metadata": {
"branch": "master",
"commit_count": 3052,
"repo_created_at": "2015-03-15T18:40:11.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "409293e... |
b985c0b4-2f2b-4f15-b445-5204b17bcf10 | WuzI38/Parallel | OpenMP/save_matrix_to_file.cpp | #include "headers\\methods_common.h"
#define MATRIX_SIZE 4096
#define DAMPING_FACTOR 0.85
#define MAX_ITERATIONS 1024
#define PRECISION 15
#define DIRECTORY "data\\"
int main(int argc, char* argv[])
{
// Init matrix
// I'm not making these sections parallel, as they may take longer to execute
// Because ... | ALGO | 0.981906 | 3.912096 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2024-05-22T17:51:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "08e2e0008014... |
7c93f9e3-893d-4104-a58e-9e1b7a4d920f | MaGuanqun/mfa-TDA | src/critical_point/root_error.cpp | //-----------
//Compute derivative control points of an MFA for an entrie block
#include <mfa/mfa.hpp>
#include <vector>
#include <iostream>
#include <cmath>
#include <string>
#include <diy/master.hpp>
#include <diy/reduce-operations.hpp>
#include <diy/decomposition.hpp>
#include <diy/assigner.hpp>
#include <diy/io/b... | ALGO | 0.976705 | 4.360976 | {
"github_metadata": {
"branch": "main",
"commit_count": 20,
"repo_created_at": "2025-05-28T19:39:45.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c63279e4835... |
2a29edde-0de7-491d-b693-90a5790714fa | ArthurRochette/Mandelbrot-Fractal | Mandelbrot.cpp | #include <iostream>
#include "SFML/Graphics.hpp"
#include "SFML/Window.hpp"
#include <math.h>
#include <complex>
#include <thread>
#include <string.h>
long double WINDOW_X_MAX = 2;
long double WINDOW_X_MIN = -2;
long double WINDOW_Y_MAX = 1.125;
long double WINDOW_Y_MIN = -1.125;
int WINDOW_X = 1920;
int WINDOW_Y = 1... | ALGO | 0.984976 | 4.525465 | {
"github_metadata": {
"branch": "Threading",
"commit_count": 36,
"repo_created_at": "2020-11-02T18:52:22.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "92e1fb... |
041890f9-1092-4332-8d83-659826b4443c | waiwai444/oj | uva/1442 - Cav/1442.cpp | #include <stdio.h>
#include <algorithm>
int n;
int p[1000002];
int s[1000002];
int left[1000002];
int solve()
{
int i, l = -1, ceil = 1000, sum = 0;
p[0] = p[n+1] = s[0] = s[n+1] = 1000;
for (i = 0; i <= n; ++i)
{
if(l >= 0 && s[i] < ceil)
ceil = s[i];
if(p[i] > p[i+1])
... | ALGO | 0.999917 | 3.211391 | {
"github_metadata": {
"branch": "master",
"commit_count": 21,
"repo_created_at": "2020-03-29T06:14:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "93147dfe2... |
f0275df2-f368-4392-a927-aa2284b6ce92 | ishandutta2007/codeforces-f | frame233/normal/1012/F.cpp | // Author -- xyr2005
#include<bits/stdc++.h>
#define lowbit(x) ((x)&(-(x)))
#define Finline __inline__ __attribute__ ((always_inline))
#define DEBUG fprintf(stderr,"Running on Line %d in Function %s\n",__LINE__,__FUNCTION__)
#define SZ(x) ((int)x.size())
#define mkpr std::make_pair
#define pb push_back
typedef long ... | ALGO | 0.999865 | 3.278708 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T01:43:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1a69413c14c5... |
5119c76c-80fc-469e-875d-d577069d13c0 | sjm150/ps | codeforces/rounds/901/c.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int gcd(int a, int b) {
if (b == 0) return a;
return gcd(b, a % b);
}
bool poss(int n, int m) {
int g = gcd(n, m);
ll unitrev = m / g;
ll i = 1;
while (i < unitrev) i *= 2;
return i == unitrev;
}
ll solve(int n, int m) {
... | ALGO | 0.999993 | 5.126346 | {
"github_metadata": {
"branch": "main",
"commit_count": 800,
"repo_created_at": "2023-02-14T08:02:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "bc728ec7b6... |
bcdf5a89-7498-4e6e-b719-52d29f8c5b2a | siddhanttomar2003/CP | 0132-palindrome-partitioning-ii/0132-palindrome-partitioning-ii.cpp | class Solution {
public:
int isPalen[2001][2001];
int dp[2001];
int build(string s, int i, int j) {
if (i > j)
return true;
if (i == j)
return isPalen[i][j] = true;
if (isPalen[i][j] != -1)
return isPalen[i][j];
if (s[i] == s[j]) {... | ALGO | 0.999995 | 5.092077 | {
"github_metadata": {
"branch": "main",
"commit_count": 3377,
"repo_created_at": "2023-10-03T09:03:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "be209de25... |
945f2464-2d0a-410f-8bd5-f7feedee501c | HristoHT/FMI | Pointers/4.5.cpp | #include<iostream>
using namespace std;
bool subArrays(int *arrays[], int npointers, int arrLengths[]) {
//Извежда адресите на елементите от масивите. Масив 3 е подмасив на 1.
for(int i = 0; i < npointers; i ++) {
for(int j = 0; j < arrLengths[i]; j ++) {
cout << (arrays[i] + j) << " ";
}
cout << endl;
... | ALGO | 0.987722 | 4.278586 | {
"github_metadata": {
"branch": "master",
"commit_count": 22,
"repo_created_at": "2019-12-15T10:05:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d587652b2... |
3c0b017b-78d0-4740-ae36-4e8b6c7bc048 | seoyeonjin/algorithm-study-cpp | 1197.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int find_parent(int x, int* parent){
if (parent[x] == x) return x;
else {
return parent[x] = find_parent(parent[x], parent);
}
}
int main() {
int node, edge;
scanf("%d %d", &node, &edge);
int minTree = 0;
... | ALGO | 0.999966 | 4.297131 | {
"github_metadata": {
"branch": "main",
"commit_count": 12,
"repo_created_at": "2024-11-06T07:27:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f7030ea2a62... |
92b556d8-8435-4527-aad2-5404c1c2c6fd | AniketChavan1123/DataStructures | CLionProjects/49Heapify/main.cpp | #include <iostream>
using namespace std;
void swap(int A[],int i,int j)
{
int temp=A[i];
A[i]=A[j];
A[j]=temp;
}
void Heapify(int A[],int n)
{
//no. of leaf elements: (n+1)/2
// index of last leaf element's parent =n/2-1
for(int i=(n/2)-1;i>=0;i--)
{
int j=2*i+1; //left child for ... | ALGO | 0.999938 | 4.541702 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2021-08-04T12:39:13.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2b3f0b2c8622... |
1f546a4d-7ed7-4b87-8d88-d5b2e06a354b | Guan-JW/HOCO | src/Compress_methods/TADOC/TADOC/src/sequenceWithCount.cc | #include"sequenceWithCount.h"
extern int words, rules;
extern vector<int>* tree;
extern int* treeSign;
extern struct RULE* rule_full;
extern set<int> splitSet;
extern int total;
extern int word1,word2,word3;
extern int word1fID,word2fID,word3fID;
extern int word1fLoc,word2fLoc,word3fLoc;
extern map<string,int... | ALGO | 0.985366 | 3.308155 | {
"github_metadata": {
"branch": "main",
"commit_count": 32,
"repo_created_at": "2023-04-15T19:20:18.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d080ec6dc9d... |
358f0718-a344-4a85-ad3b-b7caba861a35 | lars-frogner/RayImpact | RayImpact/src/MicrofacetDistribution.cpp | #include "MicrofacetDistribution.hpp"
#include "math.hpp"
#include "BSDF.hpp"
#include "spherical.hpp"
#include <algorithm>
#include <cmath>
namespace Impact {
namespace RayImpact {
// MicrofacetDistribution method definitions
imp_float MicrofacetDistribution::pdf(const Vector3F& outgoing_direction,
const... | ALGO | 0.997577 | 5.407999 | {
"github_metadata": {
"branch": "master",
"commit_count": 204,
"repo_created_at": "2018-01-10T10:16:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "dcf35e5c... |
f2d111ec-7684-4fad-9a82-9142c6542222 | dev-aiden/problem-solving | boj/1744.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int arr[53], visit[53];
int main(void) {
int n; cin >> n;
for(int i= 0 ;i < n; ++i) cin >> arr[i];
sort(arr, arr + n);
int ans = 0;
for(int i = n - 1; i >= 0; i -= 2) {
if(i - 1 < 0) break;
if(arr[i] > 1 && arr[i - 1] >... | ALGO | 0.999992 | 3.697246 | {
"github_metadata": {
"branch": "main",
"commit_count": 382,
"repo_created_at": "2021-08-15T09:27:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a993abe7d9... |
fda140b8-605f-4a16-a6ac-46a07fe0dd64 | PANFACTORY/PANSFEM2 | src/LinearAlgebra/Solvers/LU.h | //*****************************************************************************
// Title : LinearAlgebra/Solvers/LU.h
// Author : <NAME>
// Date : 2020/10/02
// Copyright : (C)2020 TanabeYuta
//*****************************************************************************
#pragma once
#include <vecto... | ALGO | 0.999011 | 5.313302 | {
"github_metadata": {
"branch": "master",
"commit_count": 412,
"repo_created_at": "2020-02-17T01:03:00.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 11,
"forks": 3,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "e3e0c6b... |
667f66de-eff2-4daa-8cfe-33e928be6d3e | MatrixWeb/acvving | 1_algorithm_basic/5_动态规划/10_1_no_leader_dance.cc | // https://www.acwing.com/problem/content/287/
// 树形DP
// f[u][0] : 所有从子树选,并且不选父节点u的方案最大值
// f[u][1] : 所有从子树选,并且选父节点u的方案最大值
#include <bits/stdc++.h>
using namespace std;
const int N = 6010;
int n;
int h[N], e[N], ne[N], idx;
int happy[N];
int f[N][2];
bool has_fa[N];
void add(int a, int b) {
e[idx] = b, ne[idx]... | ALGO | 0.999938 | 3.769903 | {
"github_metadata": {
"branch": "main",
"commit_count": 51,
"repo_created_at": "2022-08-15T13:32:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "43a27e14e6d... |
c1585d78-2b28-4215-9e89-a8ec0a2ba600 | sngkhiem/CompetitiveProgramming | Uva/12372.cpp | /*
Author: sngkhiem
Created On: 10/30/2021, 6:32:56 PM
*/
#include <bits/stdc++.h>
using namespace std;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
#define fastIO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define fi first
#define se second
#def... | ALGO | 0.993974 | 4.451001 | {
"github_metadata": {
"branch": "master",
"commit_count": 807,
"repo_created_at": "2021-09-11T16:22:39.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fd2c5b08... |
7d4676fc-540b-4591-8cf9-a7e064030f9f | spihill/cpp-snippets | Bellmanford.cpp | template<class T>
struct Graph {
struct Vertex {
T cost;
bool valid = false; // 到達不能または無限にコストが減るときfalse
Vertex(T v1) : cost(v1) {}
Vertex() {}
};
struct Edge {
int from;
int to;
T cost;
Edge(int t, T c) : to(t), cost(c) {}
Edge(int t, int u, T c) : from(t), to(u), cost(c) {}
Edge() {}
};
int sz... | ALGO | 0.999748 | 4.29677 | {
"github_metadata": {
"branch": "master",
"commit_count": 19,
"repo_created_at": "2019-07-28T03:49:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b847df93d... |
503a4008-85a4-44f9-9164-bea06b534714 | kele/mixed_connectivity | src/graph.hpp | #pragma once
#include "graph_common.hpp"
#include <vector>
#include <functional>
#include <algorithm>
#include <sstream>
template<
class Edge = edge_base_t,
typename = std::is_base_of<edge_base_t, Edge>
>
class Graph
{
public:
using edge_t = Edge;
explicit Graph(size_t n)
: E(n)
, nu... | ALGO | 0.946711 | 6.33504 | {
"github_metadata": {
"branch": "master",
"commit_count": 71,
"repo_created_at": "2015-12-11T23:29:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "97b658d2a... |
3e1b7681-6329-4996-b578-9141a86e9ec0 | aanto07/graphTheoryAssignment | connectivity.cpp | #include "iostream"
#include "stdlib.h"
using namespace std;
bool checkEmpty(int arr[], int n){
int flag = 0;
for(int i = 0; i < n; i++)
{
/* code */
if(arr[i] == 1){
flag = 1;
break;
}
}
if(flag)
return false;
else
return t... | ALGO | 0.999764 | 3.60237 | {
"github_metadata": {
"branch": "master",
"commit_count": 19,
"repo_created_at": "2018-11-20T03:22:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "eb3375e7b... |
07f6a4b4-cc43-4286-b799-0e1ed51103e3 | gustaaragao/COMP0493-GustavoSilva | Biblioteca/unidade1/strings/tokens.cpp | #include <bits/stdc++.h>
using namespace std;
vector<string> tokenizer(string s, string del = " ") {
// Time: O(n) Space: O(1)
vector<string> tokens;
int start, end = -1*del.size();
do {
start = end + del.size();
end = s.find(del, start);
tokens.push_back(s.substr(start, e... | ALGO | 0.914194 | 4.693577 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2024-11-30T21:45:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2864906fb3ea... |
7f6376e1-1a6a-47ba-aaff-02d8889954ed | YateetAgrawal001/DSA | Segment Trees/min_in_a_range/main.cpp | #include<iostream>
#include<vector>
using namespace std;
vector<int> st;
void buildtree(int arr[],int i, int lo, int hi ){
if(lo == hi) {
st[i] = arr[lo];
return;
}
int mid = (lo+(hi-lo)/2);
buildtree(arr, 2*i+1, lo, mid); //left subtree
buildtree(arr, 2*i+2, mid+1, hi); // right s... | ALGO | 0.999979 | 4.979019 | {
"github_metadata": {
"branch": "main",
"commit_count": 24,
"repo_created_at": "2024-06-22T12:13:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "cfd82b21b70... |
24e54e07-83ce-44af-aa30-77f9bc82800b | GuhanSGCIT/Trees-and-Graphs-problem | Camp Or Not.cpp | /*
The Ram camp takes place in about one month. Jafar wants to participate in the camp, but guess what? His coach is <NAME>.
kapil dev is a legendary coach, famous in the history of competitive programming. However, he is only willing to send to the camp students who solve really hard problems on Timus. He started a m... | ALGO | 0.99964 | 4.853064 | {
"github_metadata": {
"branch": "master",
"commit_count": 139,
"repo_created_at": "2020-06-14T06:21:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e6dc1400... |
2777195e-7fda-48fc-847e-7dae0a924dd5 | IannGeorges/neetcode-150 | stacks/validParentheses.c++ | class Solution {
public:
// 1. Stack Method, leverage Last In First Out to match parentheses
// Time: O(n)
// Space: O(1)
bool isValid(string s) {
deque<char> stack;
if (s.size() % 2 != 0) {
return false;
}
for (auto ch : s) {
// if openin... | ALGO | 0.998581 | 6.719955 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2023-10-15T02:01:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c385e33b9e86... |
2189d6c4-8a39-433e-9245-e6a0dcfbb009 | windystrife/UnrealEngine_NVIDIAGameWorks | Engine/Source/Runtime/Engine/Classes/Engine/TextureLODSettings.h | // Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "UObject/ObjectMacros.h"
#include "UObject/Object.h"
#include "Engine/TextureDefines.h"
#include "TextureLODSettings.generated.h"
class UTexture;
/** LOD settings for a single texture group. */
USTRUCT()
stru... | TOOL | 0.910805 | 5.598467 | {
"github_metadata": {
"branch": "4.18-GameWorks",
"commit_count": 14,
"repo_created_at": "2018-03-06T15:44:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 284,
"forks": 176,
"issues": 4,
"pull_requests": 2
},
"file_meta": {
"content_id"... |
d2b6dc43-0956-4aee-a149-3dad759ce3d8 | elemental/Elemental | src/lapack_like/funcs/Inverse/General/LUPartialPiv.hpp | /*
Copyright (c) 2009-2016, <NAME>
All rights reserved.
This file is part of Elemental and is under the BSD 2-Clause License,
which can be found in the LICENSE file in the root directory, or at
http://opensource.org/licenses/BSD-2-Clause
*/
#ifndef EL_INVERSE_LUPARTIALPIV_HPP
#define EL_INVERSE_LUPARTIA... | ALGO | 0.999256 | 6.950058 | {
"github_metadata": {
"branch": "master",
"commit_count": 3773,
"repo_created_at": "2012-05-06T08:37:42.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 513,
"forks": 110,
"issues": 38,
"pull_requests": 7
},
"file_meta": {
"content_id": "457... |
5bfed4dd-1a99-4d8f-aed5-7fa1c89bf979 | marcodemattia/OnCode | RemoveDuplicatesFromSortedList/RemoveDuplicatesFromSortedList.cc | #include <iostream>
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(0) {}
};
class Solution {
public:
ListNode *deleteDuplic... | ALGO | 0.999965 | 5.521558 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2014-05-02T18:58:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e55dc7f4bc... |
97b25758-ed12-4cd8-a1e7-d148303bd2ac | UestcXiye/C-Primer-Plus-exercise | chapter10/10.6.cpp | #include <stdio.h>
#include <stdlib.h>
void show_arr(const double arr[], int n);
void swap(double *a, double *b);
void reverse_sort(double arr[], int n);
int main(void)
{
double a[5] = {1.0, 3.0, 5.0, 7.0, 9.0};
printf("Original array: ");
show_arr(a, 5);
reverse_sort(a, 5);
printf("After sorting: "... | ALGO | 0.999994 | 4.875853 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2023-04-13T07:42:27.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "049adb7703... |
ab5d0675-36c0-47b6-9ec0-c3ea579a6b60 | u-noob-i/contest | Codeforces/Education round 150 div2/B.cpp | #include <iostream>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <utility>
#include <algorithm>
#include <math.h>
#include <numeric>
#include <queue>
#include <climits>
#include <sstream>
#include <tuple>
#include <iomanip>
using namespace std;
int n, m, i, j, k;
string s;
long long M = ... | ALGO | 0.999944 | 4.02143 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2021-09-01T17:42:58.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8e06958c7bff... |
a712c087-358d-4cf3-b099-beaab8c6ea6d | psi16181918161phi/absolute_cpp_new | chapter9/projects/replace_four_letter_words/four_letter_word.cpp | /**
* @file four_letter_word.cpp
* @author <NAME> (<EMAIL>)
* @brief
* @version 0.1
* @date 2023-03-13
*
* @copyright Copyright (c) 2023
*
*/
#include "F:/GitHubRepos/absolute_cpp/common.hpp" // common header file
using namespace std;
string text; // text to be read from command line
string replacement_w... | TOOL | 0.936791 | 4.461278 | {
"github_metadata": {
"branch": "master",
"commit_count": 99,
"repo_created_at": "2023-02-04T00:43:44.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "737442847... |
0948dd63-0edc-4324-aa59-fbd8f9a3262b | milesmiles902/C | Pattern Recognition and Machine Learning/chapter 13/HMM/hmmFilter.cpp | /*
* @file hmmFilter.cpp
* @Description HMM Forward Filtering Algorithm. The alpha returned by this function is normalized
* @Eqn: #13.59: c*alpha(z)=p(x|z)*sum[alpha(z_n-1)*p(z_n|z_n-1)];
*/
#include "nr3.h"
#include "inverse.cpp"
#include <csmath>
#include <iostream>
/*
*Input:
* X[1xn]: Integer vector which... | ALGO | 0.999899 | 5.994719 | {
"github_metadata": {
"branch": "master",
"commit_count": 282,
"repo_created_at": "2023-10-15T03:25:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e9c49e07... |
987d99a2-e45b-4a01-b005-0d86195fd551 | Yaseungho/myCodes | Baekjoon_Solving/Baekjoon_2653.cpp | #include <bits/stdc++.h>
using namespace std;
int N;
bool field[101][101], visited[101];
vector<int> Search(int n) {
visited[n] = 1;
vector<int> group;
group.push_back(n);
for (int i = 0; i < N; i++) {
bool flag = 1;
if (visited[i]) continue;
for (int j = 0; j < group.size(); j++) if (field[i][group[j]] == 1... | ALGO | 0.999913 | 4.754408 | {
"github_metadata": {
"branch": "master",
"commit_count": 33,
"repo_created_at": "2019-10-13T15:07:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "197f23a4a... |
70d4b884-cbe3-466f-9908-7d21841efc17 | homenc/HElib | src/norms.cpp | /* Copyright (C) 2012-2020 IBM Corp.
* This program is Licensed under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or a... | ALGO | 0.999009 | 6.082687 | {
"github_metadata": {
"branch": "master",
"commit_count": 1606,
"repo_created_at": "2013-04-05T13:55:09.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 3209,
"forks": 762,
"issues": 176,
"pull_requests": 7
},
"file_meta": {
"content_id": "6... |
2494d1ca-133a-4fbc-8fc5-e0444fefbb00 | hajindvlp/Algorithm | OnlineJudge/BOJ/2000/2636.cpp | #include <stdio.h>
#include <queue>
using namespace std;
queue<int> Q;
int n, m, cnt, asum, tsum;
int a[105][105], d[105][105];
int dy[4]={0, 1, 0, -1}, dx[4]={1, 0, -1, 0};
int sx, sy;
bool check()
{
int i, j;
tsum = 0;
for(i=1 ; i<=n ; i++)
for(j=1 ; j<=m ; j++)
if(a[i][j] == 1)
... | ALGO | 0.999969 | 3.192433 | {
"github_metadata": {
"branch": "master",
"commit_count": 36,
"repo_created_at": "2019-02-23T08:17:10.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f4bcf7fcf... |
0329bbe4-60f2-4f30-8b89-674d0f2292b4 | henryw7/electron-integral-playground | electron_integral_playground/c_library/boys_function.hpp |
#pragma once
#include "angular.h"
#include "boys_function_interpolate_parameter.h"
#include <math.h>
static const double boys_infinity_prefactor[MAX_BOYS_ORDER + 1] {
1.0/2.0*sqrt(M_PI),
1.0/4.0*sqrt(M_PI),
3.0/8.0*sqrt(M_PI),
15.0/16.0*sqrt(M_PI),
105.0/32.0*sqrt(M_PI),
945.0/64.0*sqrt(M_PI... | ALGO | 0.99874 | 6.625672 | {
"github_metadata": {
"branch": "main",
"commit_count": 56,
"repo_created_at": "2024-12-14T14:30:40.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8f7afac703a... |
d87018bf-c201-42f8-ac84-4845d250df39 | xkzhai2019/DataStructure | chap10/HashTable.h | #include "AVLTree.h"
#include "FileOperation.h"
template<typename Key, typename Value>
class HashTable {
private:
int M; // 取模的那个素数,表的长度
int size; // 表中存储数据的个数
AVLTree<Key, Value> **hashTable;
int hash(Key key) {
return (hashCode(key) & 0x7fffffff) % M;
}
int hashCode(Key key) {
... | ALGO | 0.976261 | 4.836476 | {
"github_metadata": {
"branch": "main",
"commit_count": 67,
"repo_created_at": "2024-08-17T06:52:50.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4ab359e91e7... |
27a11c13-682d-4520-8dcb-54b6c8cbc5c0 | anirudhgupta03/LeetCode | Binary Search/1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold.cpp | //Ref: https://www.youtube.com/watch?v=5pXWX2okpxw
//Approach - 1
class Solution {
public:
bool isValid(int x, int y, int m, int n){
if(x < m && y < n){
return true;
}
return false;
}
int maxSideLength(vector<vector<int>>& mat, int threshold) {
int m = m... | ALGO | 0.999933 | 6.304098 | {
"github_metadata": {
"branch": "main",
"commit_count": 1112,
"repo_created_at": "2021-01-04T09:39:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ac8c3f26b... |
b876627a-ee96-4996-be3d-445d0884280c | chhluo/PAT | 1127 ZigZagging on a Tree.cpp | #include <iostream>
#include <algorithm>
using namespace std;
#define MAXN 50
int N,in[MAXN],post[MAXN];
typedef struct BNode *BTree;
struct BNode {
int key;
BTree left,right;
BNode(int kk):key(kk),left(NULL),right(NULL) {}
};
void BuildTree(BTree &root,int in_s,int in_t,int post_s,int post_t) {
if(in_s < in_t) {
... | ALGO | 0.999997 | 3.895846 | {
"github_metadata": {
"branch": "master",
"commit_count": 147,
"repo_created_at": "2019-07-27T14:34:31.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9083bd0e... |
9eeae132-006f-4d59-a547-f97526fc9f8c | Grant1677/Blackjack-client-server | blackjack.cpp | /*============================================================================
Names: <NAME>., <NAME>., <NAME>. and <NAME>.
Purpose: This program uses a server to implement the card game
black jack.
============================================================================*/
#include "blackjack... | ALGO | 0.962495 | 4.772985 | {
"github_metadata": {
"branch": "main",
"commit_count": 7,
"repo_created_at": "2022-12-24T04:32:52.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "dc9e6ae66c25... |
de3f22ad-1a75-40ac-9d91-bfd3974c02fb | wyk9787/Truth_Table | truth_table/symbolic_logic.cpp | #include <iostream>
#include <string>
#include <vector>
#include <stdio.h>
#include <math.h>
using namespace std;
enum state {both_symbol, left_symbol, right_symbol, neither_symbol, symbol};
//left_symbol means on the left of the command is a combination, which means the symbol is on the right; vice versa for the rig... | ALGO | 0.999729 | 3.231248 | {
"github_metadata": {
"branch": "master",
"commit_count": 15,
"repo_created_at": "2016-10-26T20:22:46.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "51aa39eab... |
74f0b4f1-fdd5-420f-8571-8d63f1fc3918 | anayy09/LeetCode | 0025-reverse-nodes-in-k-group/0025-reverse-nodes-in-k-group.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* reverseKGro... | ALGO | 0.99998 | 6.298407 | {
"github_metadata": {
"branch": "main",
"commit_count": 212,
"repo_created_at": "2023-09-05T08:57:11.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1b1c86ffb2... |
f80465a3-a500-44b1-bb77-822a93c627ab | surajpatil4899/DSA_prep | Rat in a Maze Problem - I/Rat_in_The_maze_1.cpp | class Solution{
public:
vector<string> ans;
void solve(int i,int j,vector<vector<int>> &a, int n,string move,vector<vector<int>> &vis){
if(i==n-1 && j==n-1){
ans.push_back(move);
return;
}
if(i+1<n && !vis[i+1][j] && a[i+1][j] == 1) {
v... | ALGO | 0.999992 | 5.458906 | {
"github_metadata": {
"branch": "master",
"commit_count": 411,
"repo_created_at": "2022-01-09T08:36:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6acfe42a... |
23b2b4b5-ba7d-429c-b741-95eba8f894b0 | sandeeprajkanna/design_patterns | BEHAVIOURAL/Visitor.cpp | #include <iostream>
// Forward Declarations
class Manager;
class Engineer;
// Visitor Interface
class TaxCalculator {
public:
virtual void visit(Manager* emp) = 0;
virtual void visit(Engineer* emp) = 0;
};
// Element Interface
class Employee {
public:
virtual void accept(TaxCalculator* visitor) = 0;
};
... | TOOL | 0.990995 | 7.110385 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2025-02-23T20:44:21.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "75ea4b1e4ebd... |
67b6b9f4-3a31-4cb3-830e-9eb0ec4d116b | pukumar2/leetcode_easy | sum_left_leaves.cpp | /* Run time 0ms and beats 100% of CPP Submissions */
/**
* 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:
void helper(TreeNode *root, int& sum){
... | ALGO | 0.999991 | 5.80093 | {
"github_metadata": {
"branch": "master",
"commit_count": 215,
"repo_created_at": "2018-12-31T09:09:08.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ba8c1c4c... |
b5ce407b-5843-4ba7-ac03-4276c4a62a59 | rudeUltra/DSA | 0214-shortest-palindrome/0214-shortest-palindrome.cpp | class Solution {
public:
string shortestPalindrome(string s)
{
reverse(s.begin(), s.end());
string rev = s;
reverse(s.begin(), s.end());
string temp = s + "@" + rev;
vector<int> vr = fail_fun(temp);
int maxm = vr[vr.size()-1];
temp = "";
for(int... | ALGO | 0.999971 | 5.997396 | {
"github_metadata": {
"branch": "main",
"commit_count": 2795,
"repo_created_at": "2023-03-26T19:25:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "35964176b... |
7af0802c-28fa-4929-b40c-92435687296c | hjfenghj/zuoshen_middlecalss | class04_problem07.cpp | #include<iostream>
#include<string>
#include<vector>
using namespace std;
class PROBLEM07
{
public:
string s;
string m;
vector<int> nexts;
PROBLEM07(string str, string match)
{
s = str;
m = match;
nexts.resize(m.size());
}
//产生匹配字符串的nexts数组
void get_nexts()
{
nexts[0] = -1;
nexts[1] = 0;
s = s +... | ALGO | 0.999252 | 3.740681 | {
"github_metadata": {
"branch": "main",
"commit_count": 19,
"repo_created_at": "2022-06-15T03:25:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "c92ec965845... |
ebd4edee-8caa-4cc2-870c-e88ae830b2dd | goodstudyqaq/leetcode | problems-cpp/word-ladder-ii/solution.h | /*
Code generated by https://github.com/goodstudyqaq/leetcode-local-tester
*/
#if __has_include("../utils/cpp/help.hpp")
#include "../utils/cpp/help.hpp"
#elif __has_include("../../utils/cpp/help.hpp")
#include "../../utils/cpp/help.hpp"
#else
#define debug(...) 42
#endif
class Solution {
public:
vector<vector<... | ALGO | 0.999967 | 6.267638 | {
"github_metadata": {
"branch": "main",
"commit_count": 303,
"repo_created_at": "2023-07-19T15:39:34.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "3313e9b4ed... |
fecf7c63-72c0-4be6-924d-f7f0a945ece2 | oudushu/LearnLeetCode | 8.字符串转换整数-atoi.cpp | /*
* @lc app=leetcode.cn id=8 lang=cpp
*
* [8] 字符串转换整数 (atoi)
*/
// @lc code=start
class Automaton {
public:
long long res = 0;
int sign = 1;
string currentState = "start";
map<string, vector<string>> stateMap = {
{"start", {"start", "sign", "num", "end"}},
{"sign", {"end", "end", ... | ALGO | 0.999708 | 5.335463 | {
"github_metadata": {
"branch": "main",
"commit_count": 70,
"repo_created_at": "2021-10-11T02:11:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b2463eef9b6... |
27a3615f-47c7-4780-8981-4275855a79d9 | MasterIceZ/TOI17_Practice | DP/Peatt_Matter.cpp | /*
* AUTHOR : Hydrolyzed~
* SCHOOL : RYW
* TASK : Peatt Matter
* ALGO : Dynamic Programming with Bitmask
* DATE : 17 Oct 2021
* */
#include<bits/stdc++.h>
using namespace std;
#define endl "\n"
#define all(x) (x).begin(), (x).end()
#ifdef _DEBUG
#include "template.hpp"
#else
#define dbg(...) 0
#endif
using ... | ALGO | 0.999607 | 4.24502 | {
"github_metadata": {
"branch": "main",
"commit_count": 101,
"repo_created_at": "2021-06-14T01:21:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b3900849d3... |
5a9c7b34-f55f-4252-89ec-a510b5099dc8 | runnia/ArduinoGame | circusCharlie/circusCharlie/circusCharlie.cpp | //
// main.cpp
// circusCharlie
//
// Created by Ксения on 29/10/2019.
// Copyright © 2019 <NAME>. All rights reserved.
//
#include <string>
#include "circusCharlie.h"
// Render
//
// 01234...
// ########################## 0
// endl
// endl
// endl
// if player is in air cout << " X"
// X & ... | ALGO | 0.953116 | 3.818965 | {
"github_metadata": {
"branch": "master",
"commit_count": 11,
"repo_created_at": "2019-09-05T18:35:09.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "06935ab6d... |
134c7fd8-6762-4e91-9a2b-9d181964fddc | manav-yb/LeetCode | Depth-firstSearch/StronglyConnectedComp.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#include <cmath>
#include <math.h>
#include <unordered_set>
#include <stack>
#include <queue>
using namespace std;
#define rep(i,a,b) for(int i=a;i<b;i++)
#define repR(i,a,b) for(int i=a;i>=b;i--)
#define ll l... | ALGO | 0.999893 | 4.038807 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2020-06-16T20:08:38.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2fcaef8048... |
55cf9cb2-5d39-44d2-981e-1b51c635a38c | BillMark98/algoZhe | week2/reversedList.cpp | #include <iostream>
#include <iomanip>
#include <map>
#include <string>
using namespace std;
struct Item {
int address;
// string address;
int data;
int nextAddress;
// string nextAddress;
int nextIndex;
int prevIndex;
Item():address(0),data(0),nextAddress(0),nextIndex(-1),prevIndex(-1)... | ALGO | 0.996766 | 3.777781 | {
"github_metadata": {
"branch": "master",
"commit_count": 7,
"repo_created_at": "2020-04-03T12:33:49.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7b46004e6c... |
bcdd77c6-49ec-4d5a-bef1-b8c0252818ce | joseatort/Estructura-de-Datos | Ejercicios Repaso/Arbol Zurdo/Project1/Project1/Source.cpp | // Nombre del alumno .....
// Usuario <NAME> ......
#include <iostream>
#include <iomanip>
#include <fstream>
#include "Arbin.h"
using namespace std;
// función que resuelve el problema
typedef struct
{
int altura;
int num_nodos;
bool zurdo;
}tZurdo;
tZurdo resolver(const Arbin<char> &arbol)
{
if ... | ALGO | 0.999972 | 4.350633 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-06-03T12:16:48.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "bcf873b0df38... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.