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 |
|---|---|---|---|---|---|---|---|
509b025c-03ac-4ae5-86ab-f6c561e479e5 | tywenrick3/Polynomial | Polynomial.cpp | //
// Polynomial.cpp
// h8Final
//
// Created by <NAME> on 5/2/22.
//
#include "Polynomial.hpp"
using namespace std;
Polynomial::Polynomial() {
head = new PolyNode(0, 0, nullptr);
degree = 0;
}
PolyNode::~PolyNode() {
if (next != nullptr) {
delete next;
}
next = nullptr;
}
Polynomial... | ALGO | 0.980959 | 4.627118 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2022-05-03T13:50: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": "3da0c75826... |
0cda3bd0-c53c-4494-b8b4-481a31cdbeb6 | ishandutta2007/codeforces-k | kostia244/normal/555/B.cpp | #pragma GCC target ("avx2")
#pragma GCC target ("sse2")
#pragma GCC optimize ("Ofast")
#pragma GCC push_options
#pragma GCC optimize ("unroll-loops")
#include<bits/stdc++.h>
#define pb push_back
#define eb emplace_back
#define __V vector
#define all(x) x.begin(), x.end()
#define rall(x) x.begin(), x.end()
#define oit o... | ALGO | 0.999992 | 4.073041 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-04-11T06:06: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": "3dd2cb785a44... |
a6d709ca-0d5a-4440-9856-23a762e445d2 | ishandutta2007/codeforces-z | zimpha/normal/402/D.cpp | #include <set>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
using namespace std;
typedef long long LL;
const int MAXN = 5000 + 10;
set<int> bad;
int a[MAXN], b[MAXN], g[MAXN];
int gcd(int a, int b) {
if (b == 0) return a;
else return gcd(b, a % b);
}
int calc(int x) {
int ret = 0;... | ALGO | 0.999775 | 3.466782 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:43:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fb3b0107fc0f... |
1d987a53-d5c4-4400-999c-ca906b134cbb | giriraj1995/CompetitiveCoding | DS & Algorithms/Strings/Atoi/Atoi/main.cpp | #include <iostream>
#include <vector>
using namespace std;
int convert(vector<int> x){
int n = x.size();
if(n == 0)
return 0;
long long int g = x[0];
int i = 1;
while(--n>0){
g = g * 10 + x[i];
i++;
if(g > INT_MAX)
return INT_MAX;
}
... | ALGO | 0.998599 | 3.853977 | {
"github_metadata": {
"branch": "master",
"commit_count": 791,
"repo_created_at": "2020-08-04T11:52:12.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2839858b... |
5c520d12-21db-4730-93a6-928550a9b98f | EngSolimanSayed/CPP-El-zero-Assignments | Week4/ass6.c++ | #include <iostream>
using namespace std;
int main()
{
/*
We Need To Use This Operators In Solutions
- &&
- >=
- <=
- >
- <
- ==
- !
- ||
*/
int a = 10;
int b = 25;
int c = 15;
cout << (a < b) << "\n"; // True=1
cout << (c > a) << "\n"; // True=1
cout << ... | ALGO | 0.939821 | 3.44693 | {
"github_metadata": {
"branch": "main",
"commit_count": 14,
"repo_created_at": "2025-06-18T13:39: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": "f9a239ccec6... |
e4fc7207-5ccb-42e5-acff-9fb343d1259b | syllcs/leetcode | 655.cpp | /*
Print a binary tree in an m*n 2D string array following these rules:
The row number m should be equal to the height of the given binary tree.
The column number n should always be an odd number.
The root node's value (in string format) should be put in the exactly middle of the first row it can be put. The column an... | ALGO | 0.999995 | 6.048429 | {
"github_metadata": {
"branch": "master",
"commit_count": 16,
"repo_created_at": "2018-05-03T09:13:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b4cd88644... |
d755c971-7911-43be-bedb-d6b449af4317 | codingkick/Leetcode_questions | range-sum-query-mutable/range-sum-query-mutable.cpp | class NumArray {
public:
vector<int> sum;
vector<int> arr;
int n;
NumArray(vector<int>& nums) {
arr = nums;
n = nums.size();
int val = (int)sqrt(n);
int c = n/val;
for(int i=0;i<c;i++)
{
int add = 0;
for(int j=i*val;j<(i+1)*(val);j+... | ALGO | 0.999938 | 6.214396 | {
"github_metadata": {
"branch": "main",
"commit_count": 513,
"repo_created_at": "2021-10-07T15:49: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": "4607716a5f... |
4aca6fa7-b90b-4605-9f2f-830139c1fefd | neelaryan2/CompetitiveProgramming | CodeForces/C++/1304E.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "trace.h"
#else
#define trace(args...)
#endif
using ll = long long;
using ld = long double;
using pii = pair<int, int>;
using vi = vector<int>;
#define mp make_pair
#define ub upper_bound
#define lb lower_bound
#define fi first
#define se second
#defi... | ALGO | 0.999956 | 5.48874 | {
"github_metadata": {
"branch": "master",
"commit_count": 80,
"repo_created_at": "2019-10-22T18:55: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": "95ceb2c48... |
9a9ff6f2-75f9-40b5-bf45-1d1151af4789 | Magoxter/competitive | SPOJ-BR/ENERGIA/energia.cpp | #include <iostream>
#include <map>
#include <vector>
int E, L;
typedef std::map<int, std::vector<int>> Graph;
void dfsVisit(int v, Graph graph, std::vector<int> &visited) {
// Mark vertix as visited
visited[v] = 1;
// Go through all the adjacent vertices, if it wasn't visited yet, call DFS to visit it
... | ALGO | 0.999693 | 4.768281 | {
"github_metadata": {
"branch": "master",
"commit_count": 97,
"repo_created_at": "2018-05-07T17:48:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "125954fa1... |
3fe4f02d-4638-4212-8bc7-ebd9faa00f56 | sanyamgoel10/Leetcode-Questions | 0433-minimum-genetic-mutation/0433-minimum-genetic-mutation.cpp | class Solution {
public:
int minMutation(string start, string end, vector<string>& bank) {
//store all valid strings in an unordered set to find any string in O(1) time
unordered_set<string> hmap;
for(auto x : bank){
hmap.insert(x);
}
//if end st... | ALGO | 0.999875 | 4.960579 | {
"github_metadata": {
"branch": "main",
"commit_count": 682,
"repo_created_at": "2022-08-30T06:00: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": "4f9dc5984a... |
747ee5cf-1116-48f1-b71c-99c90e68a077 | i32jiura/Metaheuristica | practica2/Practica2/LocalSearchKP.hpp | /*
* File: SolGeneratorKP.hpp
* Author: cristiangj
*
* Created on 7 de marzo de 2016, 13:02
*/
#ifndef SOLGENERATORKP_HPP
#define SOLGENERATORKP_HPP
using namespace std;
#include "Solucion.hpp"
#include "InstanceKP.hpp"
#include "LocalSearch.hpp"
#include <vector>
#include <cmath>
#include <cstdlib>
#include... | ALGO | 0.993062 | 4.643886 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2016-02-24T13:18:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "41826734da... |
ebf496db-2a14-48ff-b311-76c3ac222b3d | DarkDemon135/HomeWork_5 | H_W_23.09.23/Task2.cpp | #include <iostream>
#include <cmath>
#include <random>
double objectiveFunction(double x) {
return std::sin(x); // Пример целевой функции
}
double acceptanceProbability(double currentEnergy, double newEnergy, double temperature) {
if (newEnergy < currentEnergy) {
return 1.0;
} else {
retur... | ALGO | 0.999995 | 5.942515 | {
"github_metadata": {
"branch": "main",
"commit_count": 20,
"repo_created_at": "2023-01-29T15:10:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "a03471a65c0... |
90b3fc40-6d98-49b4-a6e5-5a88f9a610cd | anmolalgorist7110/Interview-Prep | 0799-minimum-distance-between-bst-nodes/0799-minimum-distance-between-bst-nodes.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.999942 | 6.353234 | {
"github_metadata": {
"branch": "main",
"commit_count": 364,
"repo_created_at": "2023-05-29T05:33: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": "02da2df5a5... |
e2dbfaab-aaf2-4832-a4e2-76361887bd27 | MasterBoxer03/Codings | CODINGS/CaseRetailsPlacement.cpp | #include <string>
#include <iostream>
#include <sstream>
using namespace std;
int check(int arr[],int k){
for(int i=0;i<size(arr);i++){
if(arr[i]==k){
return i;
}
}
}
int main()
{
int i,j;
string input;
// read input
getline(cin, input);
int len=input.length();
int ... | ALGO | 0.999539 | 3.524366 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2022-06-29T10:43: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": "dc109bf2104e... |
8e5209c9-980f-49e2-80cd-a638d11ad37f | japneet644/Random-codes | Gambler.cpp | #include"iostream"
#include"math.h"
#define Goal 100
float ph=0.45;
float max(float * Q,int n, int * P,int u)
{
float m = -100;
for (int i = 0; i <n ; i++) {
if(Q[i]>m) { m = Q[i]; P[u] = i+1;}
}
return m;
}
int min(int a,int b)
{
if(a<b) return a;
return b;
}
int main() {
float * s... | ALGO | 0.999989 | 3.451955 | {
"github_metadata": {
"branch": "master",
"commit_count": 33,
"repo_created_at": "2018-12-15T14:39: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": "e3a9e4d80... |
0f1f4a0e-0059-4a97-9159-b7fb50651b6f | syedtaha22/Intro-to-Programming-CPP | 08_Pointers/examples/example5.cpp | #include <iostream>
// Recursive Function that swaps the elements of an array
void swap(int* start, int* end) {
// Base case
if (start >= end) return;
// Swap the elements
int temp = *start;
*start = *end;
*end = temp;
// Recursive
swap(start + 1, end - 1);
}
int main() {
int n =... | ALGO | 0.999592 | 6.282231 | {
"github_metadata": {
"branch": "main",
"commit_count": 44,
"repo_created_at": "2024-08-20T17:20:33.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1c7a137cb9e... |
9a240e9f-663d-4c8b-aeda-a85586ceea02 | Dhiraj-Wadile/SE-IT_PICT_Pune | SE_IT 4th SEM/CGL_23361/9.Necklace.cpp | /*
Write a program in OpenGL on Linux Platform to draw
a design shown on Right using Bresenhem Circle
Drawing Algorithm. User should only give centre
coordinates and radius. Rest should be drawn
automatically. Use Mouse/Without Mouse to Plot the
Points. (necklace)
*/
#include <GL/glut.h>
#include <iostream>
#include <... | ALGO | 0.999186 | 5.498425 | {
"github_metadata": {
"branch": "main",
"commit_count": 36,
"repo_created_at": "2023-04-12T11:30:07.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8c7baaae95f... |
c4440ff2-3b3b-40c6-847d-bb97e83fa5de | Aaron1Zhang/Algorithm | basic_test/backTracking_AllCombnation.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <set>
using namespace std;
//set {1,2,3}, print all combantion
//{1,2,3}, {1,3,2},{2,1,3},{2,3,1},{3,1,2},{3,2,1}
// void Permution(vector<int>& nums, vector<vector<int>>& results, vector<int>& cur) {
// if(nums.size() == 0) {
//... | ALGO | 0.999459 | 5.207834 | {
"github_metadata": {
"branch": "main",
"commit_count": 123,
"repo_created_at": "2021-03-24T14:15: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": "855434d42a... |
5196a13c-d79b-49d7-9eb9-ac2609313569 | rkpathak/Algorithms | lru.cpp | #include <iostream>
#include <unordered_map>
#include <list>
class LRUCache {
public:
LRUCache(int capacity) : capacity(capacity) {}
int get(int key) {
auto it = cache.find(key);
if (it == cache.end()) {
return -1;
}
// Move the accessed item to the front of the lis... | ALGO | 0.999633 | 6.997071 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2014-09-02T16:14:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7478382372... |
ee30e5ec-67d0-4608-b30c-77b98b3abbda | ishandutta2007/codeforces-n | nick452/normal/1566/G.cpp | #ifdef _MSC_VER
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
struct Container {
vector<pair<ll, int>> a;
ll s3;
};
Container build(const set<pair<ll, int>>& s) {
Container c;
auto it = s.begin();
c.s3 = 0;
for (int i = 0; i < 3; ++i) {
if (it ==... | ALGO | 0.999667 | 4.984715 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T15:35: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": "bcd481c84567... |
6c8e8e51-ff11-464b-981a-1d48a9b671d4 | atipozitiv/calendar | calendar2.0.cpp | /**********************************
* ПИ-221 *
* <NAME> *
* Календарь 2.0 *
* https://onlinegdb.com/cCCM9PZ2s *
* 22.11.2022 *
**********************************/
#include <iostream>
#include <iomanip>
#include <string>
using namespace st... | ALGO | 0.999191 | 3.88824 | {
"github_metadata": {
"branch": "main",
"commit_count": 6,
"repo_created_at": "2022-11-15T03:35:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "81842a8ca292... |
4a72e484-3002-42df-986d-7f2659ff78da | ZikaTheNerd/dpj_rokovi | 2023/sep2/5.cpp | #include <cstdlib>
#include <iostream>
#include <functional>
using namespace std;
class Igrac {
public:
string ime;
int rejting;
Igrac(string ime = "", int rejting = 0) : rejting(rejting), ime(ime) { }
bool operator<(const Igrac &other) {
if (rejting == other.rejting) {
return im... | ALGO | 0.999933 | 3.995544 | {
"github_metadata": {
"branch": "trunk",
"commit_count": 8,
"repo_created_at": "2024-06-08T22:14:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "197ddef1825... |
6fc6252d-00a3-48a2-9597-b984250bd577 | AngelOlanC/competitive-programming | AdventOfCode/2024/20/hard.cpp | #include <bits/stdc++.h>
using namespace std;
constexpr int DI[4] = {-1, 0, 1, 0}, DJ[4] = {0, 1, 0, -1};
void bfs(int si, int sj, vector<vector<bool>>& mat, vector<vector<int>>& d) {
int n = (int)mat.size();
queue<pair<int, int>> q;
d[si][sj] = 0;
q.emplace(si, sj);
while (!q.empty()) {
auto [i, j] = q... | ALGO | 0.999963 | 4.796625 | {
"github_metadata": {
"branch": "main",
"commit_count": 29,
"repo_created_at": "2024-06-30T04:52:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fa0436688a8... |
86a6b369-bc4d-4b9b-a53a-a74e74a1c462 | DominikSlomma/Efficient-and-Accurate-Template-based-Reconstruction-of-Deformable-Surfaces | src/modules/Tracking.h | #ifndef TRACKING_H
#define TRACKING_H
#include <opencv2/opencv.hpp>
#include <Eigen/Core>
#include <vector>
#include <yaml-cpp/yaml.h>
namespace stbr {
class MeshMap;
class Extractor;
class Tracking {
public:
Tracking(cv::Mat &frame, Eigen::Matrix3d K, std::vector<Eigen::Vector3d> &vertices, std::vector... | TOOL | 0.970368 | 5.770197 | {
"github_metadata": {
"branch": "main",
"commit_count": 55,
"repo_created_at": "2024-03-04T13:34:41.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "33da49a4743... |
8702f9c2-2cd9-4b68-ae49-50cc04e2fbcc | Yamon955/Code | CppCode/暑假训练/第5周:KMP.字符串哈希.字典树.01字典树.AC自动机/基础/E.01字典树+贪心.cpp | //HDU 4825
#include<iostream>
#include<cstdio>
#include<cstring>
#include<math.h>
#include<stack>
#include<queue>
#include<map>
#include<vector>
#include<algorithm>
#define mem(a,b) memset(a,b,sizeof a)
using namespace std;
typedef long long ll;
const int inf = 0x3f3f3f3f;
const int N = 1e5+5;
int T,n,m;
ll a[N];
ll va... | ALGO | 0.999994 | 3.755369 | {
"github_metadata": {
"branch": "master",
"commit_count": 3,
"repo_created_at": "2025-01-24T06:47: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": "7a29248c7f... |
de848a90-5f7d-40a7-9567-a1c944287518 | xxxsssyyy/Leetcode | LinkedList/LC0138.cpp | // Created by xingsiyuan on 2021/2/24 15:38.
// Copyright (c) <EMAIL>
#include<stdio.h>
#include<stdlib.h>
#include<iostream>
#include<vector>
#include<map>
#include<algorithm>
using namespace std;
/*
题目描述:
给你一个长度为 n 的链表,每个节点包含一个额外增加的随机指针 random ,该指针可以指向链表中的任何节点或空节点。
构造这个链表的深拷贝。深拷贝应该正好由 n 个 全新 节点组成,其中每个新节点的值都设为其对应的原... | ALGO | 0.99854 | 5.445634 | {
"github_metadata": {
"branch": "main",
"commit_count": 2,
"repo_created_at": "2021-04-06T01:42:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "f3a29271f4de... |
a8f58c40-b46f-46b2-9012-c6f22a1de427 | pariramb/Algorithms | L.cpp | #include <iostream>
#include <vector>
#include <random>
#include <algorithm>
template <typename T, T Default>
class TreapReverse {
struct Node {
size_t prior;
T value;
Node* parent;
Node* right;
Node* left;
size_t size;
explicit Node(const T& value) : value(value), parent(nullptr), right(... | ALGO | 0.999888 | 5.278486 | {
"github_metadata": {
"branch": "main",
"commit_count": 64,
"repo_created_at": "2023-10-26T17:12:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "2c8311082b2... |
9a5707cd-f86d-4378-91b0-cf9d6db40eb0 | arunabh-arnav/CTCI | M9/main.cpp | /*
Operations: Write methods to multiply, subtract and divide operations using only add operator. Assume that results are only integers.
@author <NAME>
6:18pm
*/
/*Pre-examples and assumptions
-3*4 = -12
-3/-3=1
12-(-9)=21
*/
/*Pre-constraints
*/
/*BST and idea generation
multiplication
x=-3, y=4
take absolute value... | ALGO | 0.993114 | 4.227051 | {
"github_metadata": {
"branch": "master",
"commit_count": 16,
"repo_created_at": "2017-01-04T19:24:35.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4b4b04c49... |
fc14f673-9c1a-4e0f-a8ce-a6a7050ac17c | mzry1992/workspace | OJ/CDOJ/Nuclear Fusion2.cpp | #include <iostream>
#include <algorithm>
#include <queue>
#include <cstdio>
#include <string>
#include <cstring>
#define M 230
#define INF 1<<30
using namespace std;
int c[M][M];/*容量*/
int flow[M][M];/*流量*/
int up[M][M];/*上界*/
int low[M][M];/*下界*/
int pre[M];/*路径标号*/
int d[M];/*距离标号*/
int num[M];/*同距离标号个数,用于间隙优化*/
int... | ALGO | 0.999964 | 3.359938 | {
"github_metadata": {
"branch": "master",
"commit_count": 19,
"repo_created_at": "2012-11-03T05:40:03.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "379465b2f... |
f34d2f14-d752-40cf-a9db-e300e2fc9f5a | omagr/cpp-lang-repository | Chapter 30 - Data Structures/Queue/3_w_linked_list.cpp | #include <bits/stdc++.h>
using namespace std;
template <typename T>
class Node {
public:
T value; Node* next;
Node(T data) : value(data), next(nullptr) {};
};
template <typename T>
class Queue {
Node<T>* front; Node<T>* rear;
public:
Queue(): front(nullptr), rear(nullptr) {};
bool is_Empty... | TOOL | 0.956712 | 4.918244 | {
"github_metadata": {
"branch": "main",
"commit_count": 5,
"repo_created_at": "2022-08-12T18:42:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "92cb6a660fd4... |
144a5a5e-a72e-40cb-b0de-409bcd631441 | raincross7/code-similarity | codes/train_code/problem063/problem063_245.cpp | #include <string>
#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_set>
#include <utility>
#include <cmath>
#include <stdlib.h>
#include <stdio.h>
#include <iterator>
#include <chrono>
#include <iomanip>
#include <set>
#include <map>
#include <list>
#include <iterator>
#include <deque>
#i... | ALGO | 0.999182 | 4.498299 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-03-06T05:07:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "4cc12f4014be... |
7bc4c6cc-dd5c-4e93-8ce8-38f1bc11eaa0 | samalegen/cPlusPlus | v1.cpp | #include <iostream>
#include <string>
#include <map>
#include <vector>
using namespace std;
void CHANGE_CAPITAL(const string& country, const string& new_capital, map<vector<string>, vector<string>>& m) {
vector<string> vCountry, vCountryNew;
vector<string> vCapital, vCapitalNew;
bool flag = true;
for ... | ALGO | 0.988963 | 5.014795 | {
"github_metadata": {
"branch": "master",
"commit_count": 49,
"repo_created_at": "2021-10-21T06:14: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": "ed4c49d95... |
e8073e14-437c-4c0b-934a-26c1d1869df1 | iqraarshad199/Lab-Journal-6 | Exercise 4/Task4.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <cctype>
using namespace std;
class Stack {
private:
int* arr;
int top;
int size;
public:
// Constructor
Stack(int s) {
size = s;
arr = new int[size];
top = -1;
}
// Destructor
~... | ALGO | 0.994077 | 5.346098 | {
"github_metadata": {
"branch": "main",
"commit_count": 17,
"repo_created_at": "2024-11-25T16:02:57.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "574a124a868... |
8e6da22b-e70d-4cb8-aa84-af12cd137418 | haoel/leetcode | algorithms/cpp/binaryTreeZigzagLevelOrderTraversal/binaryTreeZigzagLevelOrderTraversal.cpp | // Source : https://oj.leetcode.com/problems/binary-tree-zigzag-level-order-traversal/
// Author : <NAME>
// Date : 2014-07-05
/**********************************************************************************
*
* Given a binary tree, return the zigzag level order traversal of its nodes' values.
* (ie, from left... | ALGO | 0.999991 | 5.623827 | {
"github_metadata": {
"branch": "master",
"commit_count": 788,
"repo_created_at": "2014-10-20T03:22:04.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 17857,
"forks": 4931,
"issues": 26,
"pull_requests": 28
},
"file_meta": {
"content_id": ... |
3507f0ac-81b8-4e97-a49c-da2dfbf21545 | jubnzv/sandbox | leetcode/easy/1-two-sum.cpp | // https://leetcode.com/problems/two-sum
// Given an array of integers, return indices of the two numbers such that they
// add up to a specific target.
// You may assume that each input would have exactly one solution, and you may
// not use the same element twice.
// Example:
// Given nums = [2, 7, 11, 15], target... | ALGO | 0.999767 | 6.350942 | {
"github_metadata": {
"branch": "master",
"commit_count": 81,
"repo_created_at": "2017-08-02T01:33:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 2,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5f441e121... |
c6ed2e6c-f4de-4a07-a833-aabdffd6120c | mjenrungrot/competitive_programming | UVa Online Judge/v11/1198.cc | /*=============================================================================
# Author: <NAME> - https://github.com/mjenrungrot/
# FileName: 11047.cc
# Description: UVa Online Judge - 11047
=============================================================================*/
#include <bits/stdc++.h>
... | ALGO | 0.999934 | 4.795382 | {
"github_metadata": {
"branch": "master",
"commit_count": 258,
"repo_created_at": "2015-11-17T04:41: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": "0147fb0b... |
82adc651-18dd-4971-b446-3d9dcac876c3 | Cassel-College/LearningCpp | picture_process/src/common/basicOperation.cpp | //
// Created by <NAME> on 2/25/23.
//
#include "basicOperation.h"
#include <math.h>
#include <iostream>
#include "stdlib.h"
#include "stdio.h"
#include "perspective_transform.h"
using namespace std;
unsigned char * basicOperation::bmpScale(unsigned char * bmp, int width, int height, int linebyte, float times1, flo... | ALGO | 0.905859 | 4.557868 | {
"github_metadata": {
"branch": "main",
"commit_count": 87,
"repo_created_at": "2023-02-21T14:50:27.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "aab3449eb6bb... |
1776a5e2-9e6b-45c8-bf35-bc7d4e12fcaf | akash19jain/COMPETITIVE-PROGRAMMING | CODEFORCES/CONTESTS/1337/D.cpp | /* AUTHOR: <NAME>
* EMAIL: <EMAIL>
* ID: akash19jain
* DATE: 16-04-2020 19:19:28
*/
#include<algorithm>
#include <bits/stdc++.h>
using namespace std;
#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
#include<stdbool.h>
#include<ctype.h>
#define SC1(x) scanf("%lld",&x... | ALGO | 0.999804 | 3.898775 | {
"github_metadata": {
"branch": "master",
"commit_count": 441,
"repo_created_at": "2019-03-01T16:29:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 6,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "51941769... |
7c84742e-40a0-4cbe-b07c-c7e064310211 | Cpp4/Data-Structures-using-Cpp | Section_7_Array ADT/improved_Linear_Search.cpp | #include <iostream>
#include <windows.h>
using namespace std;
struct Array
{
int *a; // contains the address of the allocated blocks of the memory in the heap.
int size , len; // contains total size and no. of elements in the array.
} arr;
int com = 0;
int LinearSearch(int key)
{ int pos = -1;
... | ALGO | 0.999846 | 3.600614 | {
"github_metadata": {
"branch": "main",
"commit_count": 17,
"repo_created_at": "2022-07-27T02:59:30.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "5e1e7c9d90f... |
987d09cc-8145-4ed1-b81b-d887e6a3a1d2 | Randgalt/kway | c_example.cpp | #include "k_merge_tree.h"
#include <vector>
#include <iostream>
using namespace std;
/*
A trivial example that sorts 4 vectors of sequential ints
*/
void main(void)
{
vector<int> v1;
vector<int> v2;
vector<int> v3;
vector<int> v4... | ALGO | 0.999509 | 5.090953 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2015-06-27T22:33:05.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 2,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "595b3ee44d... |
04c2517c-c91d-49d1-bd6b-c014d726086c | rkapobel/Algo3-2c-2016 | rtp1/ej1-test/velocidadesIguales.cpp | //Recibir los parametros como esta en el enunciado
//Generar todas las tuplas posibles
// A los pares los identifico por el numero de fila y columna que representan en una matriz donde las filas son los arqueologos seguidos por los canibales
#include <iostream>
#include <fstream>
#include "Escenario2.hpp"
#include <chr... | ALGO | 0.987128 | 3.373233 | {
"github_metadata": {
"branch": "master",
"commit_count": 1098,
"repo_created_at": "2016-08-10T22:27: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": "37dc263... |
7d3d19bd-3b69-4afd-b3ea-33624d43c25f | Vinitha14/CN-Lab | dijkstra.cpp | #include <iostream>
using namespace std;
class dijkstra
{
int b[50][50];
int d[50];
int m[50];
int pre[20];
int V,E,s;
public:
dijkstra()
{
cout << "\nEnter the number of Vertices: ";
cin >> V;
for(int i=1;i<=V;i++)
for(int j=0;j<=V;j++)
b[i][... | ALGO | 0.999966 | 4.390656 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2021-02-02T18:13: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": "c5b28513ad... |
9d881ce1-a385-4a69-8b55-f3992edda167 | booof/FTHI | Core/Source/Source/Algorithms/Sorting/SortingAlgorithms.cpp | #include "SortingAlgorithms.h"
#include "Render/Struct/DataClasses.h"
template<class Type>
Type* Algorithms::Sorting::bubbleSort(Type object[], int size, int offset)
{
// Iterate Through Size of Array Until All is Sorted
for (int i = offset; i < size + offset; i++)
{
// Iterate Through Each Element in Array
for... | ALGO | 0.998066 | 5.021444 | {
"github_metadata": {
"branch": "main",
"commit_count": 43,
"repo_created_at": "2022-10-09T01:22: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": "e862a630c9f... |
a512e294-a5a7-403c-9ffd-cb07629c16ed | VROOM-Project/vroom | src/structures/vroom/raw_route.cpp | /*
This file is part of VROOM.
Copyright (c) 2015-2025, <NAME>.
All rights reserved (see LICENSE).
*/
#include "structures/vroom/raw_route.h"
namespace vroom {
RawRoute::RawRoute(const Input& input, Index i, unsigned amount_size)
: _zero(amount_size),
_fwd_peaks(2, _zero),
_bwd_peaks(2, _zero),
_del... | ALGO | 0.901049 | 7.029158 | {
"github_metadata": {
"branch": "master",
"commit_count": 3026,
"repo_created_at": "2015-09-05T12:58:42.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1511,
"forks": 369,
"issues": 33,
"pull_requests": 6
},
"file_meta": {
"content_id": "33... |
fd8ba9ca-2a0b-4f6f-b664-cb261740b90b | ThanTranNghiep/DanhSachLienKetDon | dslk/TH2.cpp | #include<bits/stdc++.h>
using namespace std;
struct Node{
int Data;
Node*next;
};
struct List{
Node*tail;
Node*head;
};
void CreateList(List &l){
l.head=NULL;
l.tail=NULL;
}
Node*CreateNode(int x){
Node *a=new Node();
if(a!=NULL){
a->Data=x;
a->next=NULL;
}
return... | ALGO | 0.999681 | 3.601321 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2021-08-17T05:02:51.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9c9f8c820... |
60b04070-7338-4c3d-ace3-cb31fd042e7f | raincross7/code-similarity | codes/train_code/problem475/problem475_238.cpp | #include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cassert>
using namespace std;
typedef long long LL;
template <typename F, typename S> std::ostream& operator<<(ostream& os, const ... | ALGO | 0.999815 | 3.845997 | {
"github_metadata": {
"branch": "main",
"commit_count": 3,
"repo_created_at": "2024-03-06T05:07:19.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "8b1f60a07de6... |
e16c2d1c-9147-4da5-af0c-52f4b5e8e85a | shubhammor0403/EMNIST_Android | jni-build/jni/include/tensorflow/contrib/tensor_forest/core/ops/tree_utils.h | // Copyright 2016 Google Inc. All Rights Reserved.
//
// 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... | ALGO | 0.943925 | 7.614929 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2018-07-19T13:34:14.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 5,
"forks": 2,
"issues": 0,
"pull_requests": 1
},
"file_meta": {
"content_id": "886cc9351... |
09c3fea3-e92a-42dd-9429-3799ebd03d82 | Al17OTON/BOJ | BaekJoon/SWEA/1249.cpp | #include<iostream>
#include<queue>
#define MAX 100
using namespace std;
typedef struct NODE
{
int x, y;
};
int map[MAX][MAX];
int visit[MAX][MAX];
int dirX[4] = { 1, 0, -1, 0 }; //하 우 상 좌
int dirY[4] = { 0, 1, 0, -1 };
int result, N;
void bfs()
{
queue<NODE> q;
q.push({ 0,0});
visit[0][0] = 0;
while (!q.empty()... | ALGO | 0.99995 | 4.056229 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2024-01-04T11:27:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "aa58a53685... |
c0bb3c0b-d0ae-4bb2-b56d-9d82b2b63f58 | sleepingtap/DSA | Edit Distance - GFG/edit-distance.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
// int f(int i,int j,string s, string t,vector<vector<int>>&dp)
// {
// if(i<0)
// {
// return j+1;
// }
// if(j<0)
// {
// ret... | ALGO | 0.999997 | 6.306787 | {
"github_metadata": {
"branch": "main",
"commit_count": 1048,
"repo_created_at": "2022-04-09T13:51:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "64ef95129... |
e7c8ff42-adb9-4e8b-bff9-0bc3b4997929 | plamen-atanasoff/daa-cpp | Solutions/Savior.cpp | #include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
namespace {
int T;
double x1, y, x2, y2, v1, v2;
}
double calcTimeTo(double x) {
return sqrt(y * y + (x1 - x) * (x1 - x)) * (1.0 / v1) +
sqrt(y2 * y2 + (x2 - x) * (x2 - x)) * (1.0 / v2);
}
void minTime() {
double l = min(x1, x2);
dou... | ALGO | 0.999892 | 5.166744 | {
"github_metadata": {
"branch": "main",
"commit_count": 40,
"repo_created_at": "2024-03-27T07:48: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": "2c6eb17d891... |
7416c723-1647-4dd0-a6a3-2fd1dc2cab64 | Kiids/OJ_Practice | 无重复字符的最长子串.cpp | /*
给定一个字符串 s ,请你找出其中不含有重复字符的 最长子串 的长度。
示例 1:
输入: s = "abcabcbb"
输出: 3
解释: 因为无重复字符的最长子串是 "abc",所以其长度为 3。
示例 2:
输入: s = "bbbbb"
输出: 1
解释: 因为无重复字符的最长子串是 "b",所以其长度为 1。
示例 3:
输入: s = "pwwkew"
输出: 3
解释: 因为无重复字符的最长子串是 "wke",所以其长度为 3。
请注意,你的答案必须是 子串 的长度,"pwke" 是一个子序列,不是子串。
提示:
0 <= s.length <= 5 * 10^4
s 由英文字母、数字、符号和空格组成... | ALGO | 0.999926 | 5.830963 | {
"github_metadata": {
"branch": "master",
"commit_count": 1531,
"repo_created_at": "2019-10-23T13:47: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": "98ffd40... |
b60f8999-c507-4a53-9f9c-35fa0bcfb44f | grondo/mvapich-cce | examples/nt/mandel/funcs.cpp | #include "funcs.h"
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
#include "pmandel.h"
double drand48()
{
return ((double)rand() / (double)RAND_MAX);
}
// fraction is a part of the rainbow (0.0 - 1.0) = (Red-Yellow-Green-Cyan-Blue-Magenta-Red)
// intensity (0.0 - 1.0) 0 = black, 1 = full color, 2 = white
M... | TOOL | 0.951165 | 4.113185 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2012-02-13T17:32:26.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d057c83065... |
b0656bf5-720f-44c8-88cc-b21897c5fdfe | ishmeet09/DSA | Queue/3_CircularQueue.cpp | #include<iostream>
using namespace std;
class MyCircularQueue {
public:
// Initialize front and rear
int rear, front;
// Circular Queue
int size;
int *arr;
MyCircularQueue(int k) {
size=k;
arr = new int[size];
front=rear=-1;
}
bool enQueue(int value) {
if ((fro... | ALGO | 0.998578 | 5.252371 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2025-01-22T19:02:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "fee2745582de... |
db4ce12b-0cdd-4dd9-bedf-2b731cd4d498 | moondemon68/cp | Codeforces/PastContests/1281/C.cpp | #include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define MOD 1000000007
#define pii pair<int,int>
#define LL long long
using namespace std;
int main () {
//clock_t start = clock();
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
... | ALGO | 0.999492 | 3.829632 | {
"github_metadata": {
"branch": "master",
"commit_count": 184,
"repo_created_at": "2018-09-17T12:29: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": "484861ac... |
68732d4f-ae91-414c-a919-32da1cf54d45 | onlyrobot/Tool | code/fireworks.cpp | /********************************************************************************
*File name:Fireworks.cpp
*Author:彭瑶
*Version:1.0
*Date:2018.07.11
*Debug Environment:Visual Studio 2017
*Description:在屏幕中画出变换的烟花,可以用于程序的背景
*********************************************************************************/
#include<graphic... | TOOL | 0.978552 | 4.698125 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2018-12-12T04:03: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": "251e42d7bb... |
484dc19f-25d2-4fc3-903c-544ea20886e9 | abhati27/Algo-and-leetcode-grinding | qtn1_5.cpp | #include <iostream>
using namespace std;
// this is a solution for one chenge string checker
//helper
// this function checks if only one letterhas been changed
bool letterDif(string inp1, string inp2) {
int dif = 0;
for (int i = 0; i < inp1.size(); i++) {
if (inp1[i] != inp2[i]) {
dif++;
if (dif... | ALGO | 0.999604 | 4.836311 | {
"github_metadata": {
"branch": "main",
"commit_count": 12,
"repo_created_at": "2023-06-15T03:36: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": "6a199cad3b3... |
64c55ff7-77fe-4d47-a2e5-289c16d7957d | SI-Abid/Hello-world | Weekly/w114c.cpp | #include "bits/stdc++.h"
using namespace std;
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define be begin()
#define en end()
#define all(x) (x).begin(), (x).end()
#define out cout << setprecision(20)
typedef vector<int> vi;
typedef ve... | ALGO | 0.999988 | 3.256904 | {
"github_metadata": {
"branch": "master",
"commit_count": 669,
"repo_created_at": "2017-11-14T13:37: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": "27b41801... |
3b34af67-0f33-4e62-b0e3-26b9b3ca758a | gabriel88766/C-CPP-AlgorithmsAndContests | Codeforces/1722/A.cpp | #include <bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
const ll INF_LL = 0x3f3f3f3f3f3f3f3f, MOD = 1e9+7;
const int INF_INT = 0x3f3f3f3f;
const long double PI = acosl(-1.), EPS = 1e-9;
using namespace std;
//cout << fixed << setprecision(6)
int main(){
ios_base::sync_with_stdio(fal... | ALGO | 0.999881 | 5.191933 | {
"github_metadata": {
"branch": "master",
"commit_count": 436,
"repo_created_at": "2020-08-21T00:21: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": "6afdfa27... |
b747aa6f-9190-4abf-92d7-e785898cf46e | Derek12345678910/Competitve-Coding | olyimpiads/nov30/q4.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;
#if 0
vector<vector<int>> adj(1001);
vector<bool> vis(1001);
int n;
int tot = 0;
int components = 0;
void dfs(int u) {
vis[u] = true;
for (int v : adj[u]... | ALGO | 0.999936 | 4.266401 | {
"github_metadata": {
"branch": "main",
"commit_count": 62,
"repo_created_at": "2024-07-24T01:07: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": "5a152715984... |
7aa7d26f-3ec9-4027-a81b-0c40c89dd023 | Mohammadreza-mz/icpc-cheatsheet | String/hash.cpp | const ll M=2e5+137,T= 4;
const ll bas[]= {31, 53, 727, 727};
const ll mod[]= {(ll)1e9+7, (ll)1e9+9, (ll)1e9+7, (ll)1e9+9};
ll pw[T][M],hs[T][M],n;
ll substr(int t, int l, int r){ //1-based closed-closed range
return (hs[t][r] -(hs[t][l-1]* pw[t][r-l+1]%mod[t]) + mod[t])%mod[t];
}
ll substrRev(int t, int l, int r){
... | ALGO | 0.999984 | 3.786692 | {
"github_metadata": {
"branch": "main",
"commit_count": 36,
"repo_created_at": "2022-10-08T19:25:28.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 18,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6592a2feb0... |
0040ddc5-23d8-4254-aa09-ec21a1f75a9b | aniket-2003-das/GFG-Problems | Day231_Graph_and_Vertices.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
class Solution {
public:
// Function to calculate factorial
long long factorial(int n) {
if (n==0 || n==1) return 1;
return n*factorial(n-1);
... | ALGO | 0.999846 | 5.911416 | {
"github_metadata": {
"branch": "main",
"commit_count": 233,
"repo_created_at": "2024-06-02T18:02:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 13,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "9ebdd5045... |
fe33c42c-627f-404d-97e6-de2a3c193d4d | MasterMind90/cppractice | codeforces/1371/C.cpp | #ifndef LOCAL
#pragma GCC optimize("O3")
#endif
#include "bits/stdc++.h"
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ... | ALGO | 0.999982 | 4.707886 | {
"github_metadata": {
"branch": "master",
"commit_count": 1713,
"repo_created_at": "2021-01-12T19:00:54.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "e33612c... |
57b4c64a-277c-429a-a7a2-a2c983b2a53c | AritraS05/all_codes | B_Deja_Vu.cpp | #include<iostream>
#include<bits/stdc++.h>
#define int long
using namespace std;
int32_t main(){
int t;
cin>>t;
while(t--){
int n,q;
cin>>n>>q;
vector<int>a(n);
for(int i = 0; i<n; i++){
cin>>a[i];
}
vector<bool>flag(31,false);
int mini = ... | ALGO | 0.999591 | 3.080418 | {
"github_metadata": {
"branch": "main",
"commit_count": 22,
"repo_created_at": "2024-08-05T14:39: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": "640742be27f... |
ed0df050-0dbd-4d1d-b818-eb76e854f3a1 | signkite/baekjoonNprogrammers | 백준/Silver/2108. 통계학/통계학.cc | #include<iostream>
#include<string>
#include<cmath>
#include<algorithm>
using namespace std;
int N;
int num_cnt[8001]; // 수의 개수 num_cnt[x] == N개의 수 중 x - 4000의 개수 (최빈값 구할 때 사용)
int nums[500000];
int sum;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin >> N;
int num;
for (int i... | ALGO | 0.999971 | 3.945574 | {
"github_metadata": {
"branch": "main",
"commit_count": 292,
"repo_created_at": "2022-08-16T10:38:32.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1a4dd52329... |
29905a1e-674a-4a70-8598-d16803475190 | mongodb/mongo | src/third_party/boost/libs/math/include/boost/math/special_functions/pow.hpp | // Boost pow.hpp header file
// Computes a power with exponent known at compile-time
// (C) Copyright <NAME> 2008.
// (C) Copyright <NAME> 2024.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// See ... | ALGO | 0.930612 | 6.932541 | {
"github_metadata": {
"branch": "master",
"commit_count": 90314,
"repo_created_at": "2009-01-15T16:15:18.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 27329,
"forks": 5655,
"issues": 0,
"pull_requests": 82
},
"file_meta": {
"content_id": ... |
5ab06bf5-3b68-495c-a6db-3206711e402f | jallier7/Pricing-C- | src/BSmodel.cpp | #ifndef BSMODEL_CPP
#define BSMODEL_CPP
#include"BSmodel.h"
#include <iostream>
#include <vector>
#include <random>
#include <cmath>
// Constructors
BlackScholes::BlackScholes(){
};
BlackScholes::BlackScholes(double time, double stockPrice, double volatility,double drift, double riskFreeRate){
this->tim... | ALGO | 0.9793 | 6.086064 | {
"github_metadata": {
"branch": "main",
"commit_count": 53,
"repo_created_at": "2023-12-06T14: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": "d9cfba54231... |
d2593c80-b581-426e-9ea6-8cee2e176ae0 | h1mkr/memory-management | main.cpp | #include <bits/stdc++.h>
#include <vector>
#include <fstream>
#include <string>
#include <sstream>
#include <queue>
#include <ctime>
#include <unordered_set>
#include <set>
#include <map>
using namespace std;
struct Process {
int pid;
string name;
int size; // in pages
vector<int> pa... | ALGO | 0.997283 | 4.886911 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-08-10T18:10:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "29222181b566... |
3fc4521e-b2c6-413d-97d5-72886fb7f298 | 1-WEEK/PAT-Basic-Level | 1028.cpp | #include <iostream>
#include <stdio.h>
using namespace std;
struct people {
string name;
int BirthYear,
BirthMonth,
BirthDay;
};
int Younger( const people * p1, const people * p2) {
int res = -1;
if( p1->BirthYear > p2->BirthYear)
res = 1;
else if( p1->BirthYear == p2->BirthYear)
if( p1->BirthMonth > p2-... | ALGO | 0.99912 | 3.501702 | {
"github_metadata": {
"branch": "master",
"commit_count": 33,
"repo_created_at": "2016-01-20T10:20:15.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "905371e9f... |
eea4d8bf-47f8-4212-9d75-247892f4032c | dhnesh12/codechef-solutions | 03-CodeChef-Medium/92--In a planet far far away.cpp | #include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
// #define MOD 1000000007LL
#define INF 1000000000000000018LL
#define F first
#define S second
#define ll long long
#define ld long double
#define eps 1e-9
ll gcd(ll a, ll b)
{
if(a == 0LL)
return b;
if(b == 0LL)
return a;
... | ALGO | 0.999977 | 4.407921 | {
"github_metadata": {
"branch": "master",
"commit_count": 2,
"repo_created_at": "2021-04-06T05:27: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": "425c8f3c11... |
98fc69c7-ed9c-4081-96dd-7e3223c1834e | aratrikchandra/Journey-Through-LeetCode-s-DSA-Challenges | Trie/longest_string_with_all_prefixes.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
// member variables
Node *links[26]; // Array to store links to child nodes, each index represents a letter
bool flag = false; // marks the end of a word using true
// member functions
bool containsKey(char ch) // checks if the ... | ALGO | 0.99984 | 5.528428 | {
"github_metadata": {
"branch": "main",
"commit_count": 14,
"repo_created_at": "2024-05-24T19:15: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": "33c8f9d71e5... |
c967ca65-b6b7-4dd3-b22f-a0fb4855b9c2 | Yu-Gua/-Introduction-to-Computation-A-from-LXZ-s-class | 函数递归第一次/4.red&black.cpp | /*题目 红与黑
来源:Japan 2004 Domestic[ 下一题 ]
[ 提交程序 ] [ IDE ] [ 提交记录 ]
题目描述
有一间长方形的房子,地上铺了红色、黑色两种颜色的正方形瓷砖。
你站在其中一块黑色的瓷砖上,只能向相邻的四块瓷砖中的黑色瓷砖移动。
请写一个程序,计算你总共能够到达多少块黑色的瓷砖。
关于输入
包括多个数据集合。每个数据集合的第一行是两个整数W和H,
分别表示x方向和y方向瓷砖的数量。W和H都不超过20。
在接下来的H行中,每行包括W个字符。每个字符表示一块瓷砖的颜色,规则如下
‘.’:黑色的瓷砖
‘#’:红色的瓷砖
‘@’:黑色的瓷砖,并且你站在这块瓷砖上。
该字符在每个数据集合中... | ALGO | 0.99964 | 4.089391 | {
"github_metadata": {
"branch": "main",
"commit_count": 65,
"repo_created_at": "2024-11-30T13:47:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "eec14484929... |
b4ecee87-63cb-4e4a-b748-d96f3fafc5d9 | alikhan880/ACM | stringpower.cpp | #include <iostream>
#include <cmath>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <string>
#include <cstring>
#define rep(i,a,b) for(int i = a; i < b; i++)
#define sz(a) ((int)(a.size()))
#define pb push_back
#define... | ALGO | 0.999987 | 3.338735 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2018-05-10T17:36: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": "07bfcd164b... |
21ce3277-5890-4982-9845-21e95bb5a052 | WebKit/WebKit-http | Source/ThirdParty/libwebrtc/Source/webrtc/modules/desktop_capture/differ_block.cc | /*
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contribut... | TOOL | 0.950882 | 7.35801 | {
"github_metadata": {
"branch": "master",
"commit_count": 231005,
"repo_created_at": "2011-01-11T13:50:19.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 4992,
"forks": 1983,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "... |
d3eb7c05-6aab-41e3-b6bd-11b1edb78158 | biggysmith/advent_of_code_2018 | src/day19/day19.cpp | #include <iostream>
#include <ostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <map>
#include <numeric>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <regex>
struct instruction_t{
size_t op;
size_t i[3];
};
struct registers_t{
size_t r[6];
};
bool ... | ALGO | 0.997494 | 4.95973 | {
"github_metadata": {
"branch": "master",
"commit_count": 36,
"repo_created_at": "2021-01-06T13:15: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": "dbc4682ee... |
a3a62f64-6f73-40bb-8723-bbd82faade8e | shahsk/stochastic-receding-horizon-control | computeProbability.cpp | /*
EM Euler-Maruyama method to simulate an SDE
Compute solution of the PDE using Feynman-Kac formula
Parallel code to simulate SDEs and compute function g(q)
Simulation for Omni-directional robot x, y , theta are the variables
Copyright (C) 2011 - 20012, <NAME>,
All rights reserved. ... | ALGO | 0.99997 | 3.925254 | {
"github_metadata": {
"branch": "master",
"commit_count": 5,
"repo_created_at": "2015-03-18T13:10:17.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "6f172a16bd... |
f1bf8e64-20a0-4c88-8121-e7487338da11 | sangeunnn/Algorithms | algorithms/algo2020/oil2/oil2/oil.cpp | #include "oil.h"
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
bool myfun(int a,int b){ return (a>b);}
bool oil_left_find(double i,double j,double pre_i,vector<double>& oil){
int l=observe(i,j); cout << i <<' '<<j<<' '<< pre_i <<'\n';
if(l==2) {
cou... | ALGO | 0.999823 | 3.272114 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2020-05-16T06:20:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "716e3e77d7... |
b1f10134-832c-4811-904a-83a235350659 | Saikat-S/acm-problems-solutions | Codeforces/1335/E1.cpp | /***************************************************
* Problem Name : E1.cpp
* Problem Link : https://codeforces.com/contest/1335/problem/E1
* OJ : Codeforces
* Verdict : AC
* Date : 2020-04-13
* Problem Type : Div/Edu -
* Author Name : <NAME>
* University : CSE, MBSTU
***************... | ALGO | 0.999846 | 3.814297 | {
"github_metadata": {
"branch": "master",
"commit_count": 73,
"repo_created_at": "2018-05-10T18:16:20.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ebd9a7c0f... |
6f7c9b07-4349-47c3-96e3-d50397d71e42 | diegocalero0/Maraton | solved/Uva/11504.cpp | #include<bits/stdc++.h>
using namespace std;
typedef vector< vector<int> > vvi;
vvi g(100000);
int seen[100000], dfs_low[100000], dfs_num[100000], n, m, dfs_count, visited[100000], nulled[100000];
vector<int> S;
int parent[100000], rango[100000];
int num_scc;
void make_set(int n){
for(int i = 0; i < n; i++){
... | ALGO | 0.999942 | 4.422055 | {
"github_metadata": {
"branch": "master",
"commit_count": 124,
"repo_created_at": "2016-12-04T00:52: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": "d37ba101... |
2f9ee5f9-75ab-4b7d-8885-f6c18506ce9f | tmatthey/booga | framework/object/include/Viewing3D.h | /*
* Viewing3D.h
*
* View transformation from 3-space to 2-space.
*
* Copyright (C) 1994-96, <NAME> <<EMAIL>>
* <NAME> <<EMAIL>>
* University of Berne, Switzerland
*
* All rights reserved.
*
* This software may be freely copied, modified, and redistributed
* pro... | TOOL | 0.983398 | 6.126992 | {
"github_metadata": {
"branch": "master",
"commit_count": 11,
"repo_created_at": "2024-05-09T11:34: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": "c4e2949ff... |
7c491d57-2cb8-4fef-ae29-d75bc68bb951 | GuyFirst/AlgoBucketGame | BucketGame/Game1.cpp | #include "Game1.h"
#include <iostream>
#include <queue>
#include <vector>
#include <map>
#include <algorithm>
using namespace std;
void Game1::buildG()
{
for (int i = 0; i <= _l; ++i) {
for (int j = 0; j <= _s; ++j) {
Vertex u = { i, j };
if (i > 0)
_gL.AddEdge(u, {... | ALGO | 0.999882 | 3.472993 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2025-05-15T23:48: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": "8b453b6a3c98... |
c98c30c0-5691-411f-b5c5-408006d77a67 | radu781/Train-manager | Server/src/wordoperation.cpp | #include "pc.h"
#include <sstream>
#include "utils/wordoperation.hpp"
std::string WordOperation::removeDiacritics(std::string str)
{
if (str == "")
return "";
const std::unordered_map<const char *, char> dict = {
{"ă", 'a'},
{"â", 'a'},
{"â", 'a'},
{"î", 'i'},
{"... | TOOL | 0.923186 | 6.183018 | {
"github_metadata": {
"branch": "main",
"commit_count": 69,
"repo_created_at": "2021-11-20T15:08: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": "964f3a967e7... |
cc663cc4-5884-4f70-b8eb-9bd09fd357dd | priojeetpriyom/competitive-programming | uva/10921 - Find the Telephone.cpp | #include <iostream>
#include <cstdio>
#include <string.h>
#include <math.h>
using namespace std;
int main() {
int i;
char str[31];
while(gets(str)) {
for (i=0;i<strlen(str);i++) {
if (str[i]>64 && str[i]<91) {
if (str[i]> 64 && str[i]< 68) printf("2");
... | ALGO | 0.996573 | 3.050787 | {
"github_metadata": {
"branch": "master",
"commit_count": 12,
"repo_created_at": "2018-09-19T15:14:42.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 1,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "0712f5a5c... |
57eea819-00a2-4afd-97f0-29c06d4ede44 | ishandutta2007/codeforces-s | shayan.p/normal/855/G.cpp | // Phoenix
#include<bits/stdc++.h>
#define F first
#define S second
#define PB push_back
#define sz(s) int((s).size())
#define bit(n,k) (((n)>>(k))&1)
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const int maxn=1e5+10,mod=1e9+7;
const ll inf=1e18;
vector<int>v[max... | ALGO | 0.999572 | 4.124176 | {
"github_metadata": {
"branch": "main",
"commit_count": 1,
"repo_created_at": "2024-10-30T16:07:53.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "b2b75ab1f19b... |
5243dd0e-8b31-4f70-83d9-fe302a70c231 | shivamrajpoot7070/Solver_hu_bhaiya | 0662-maximum-width-of-binary-tree/0662-maximum-width-of-binary-tree.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999646 | 5.542204 | {
"github_metadata": {
"branch": "main",
"commit_count": 895,
"repo_created_at": "2024-11-03T19:14: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": "3ee4053143... |
0391b0f8-9cdd-45a6-856b-25195cf12462 | Noppadol35/Algorithm | Mid-term/LAB/LAB_1_1/LAB_1_1.cpp | #include <bits/stdc++.h>
#include <iostream>
using namespace std;
// ฟังก์ชัน QuickSort
int partition(int arr[], int l, int r)
{
int pivot = arr[r];
int i = l - 1;
for (int j = l; j < r; j++)
{
if (arr[j] < pivot)
{
i++;
swap(arr[i], arr[j]);
}
}
... | ALGO | 0.999976 | 4.600306 | {
"github_metadata": {
"branch": "main",
"commit_count": 41,
"repo_created_at": "2024-12-12T09:59: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": "6f33588f2fb... |
712b96b0-8814-4bd0-a9d8-7de77bb1b72e | aakashyap/JuneLeetCodeChallenge | two_city_scheduling.cpp | /*
There are 2N people a company is planning to interview. The cost of flying the i-th person to city A is costs[i][0], and the cost of flying the i-th person to city B is costs[i][1].
Return the minimum cost to fly every person to a city such that exactly N people arrive in each city.
Example 1:
Input: [[10,20]... | ALGO | 0.999971 | 5.902642 | {
"github_metadata": {
"branch": "master",
"commit_count": 6,
"repo_created_at": "2020-06-28T08:10: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": "a99eac368b... |
e8abbb6a-963c-46d2-8513-8d52ccd89dce | fstqwq/Nemesis | SCL_others/Other/Nightfall/src/Geometry/三维凸包.cpp | int mark[N][N], cnt;
D mix(const Point & a, const Point & b, const Point & c) { return a.dot(b.cross(c)); }
double volume(int a, int b, int c, int d) { return mix(info[b] - info[a], info[c] - info[a], info[d] - info[a]); }
typedef array<int, 3> Face; vector<Face> face;
inline void insert(int a, int b, int c) { face.pus... | ALGO | 0.999874 | 3.596179 | {
"github_metadata": {
"branch": "master",
"commit_count": 248,
"repo_created_at": "2019-09-08T16:45:23.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 43,
"forks": 4,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "d438127... |
741ffd39-4d55-4831-8e20-8e23c4c7abcb | drunkwater/leetcode | hard/cpp/c0038_174_dungeon-game/00_leetcode_0038.cpp | // DRUNKWATER TEMPLATE(add description and prototypes)
// Question Title and Description on leetcode.com
// Function Declaration and Function Prototypes on leetcode.com
//174. Dungeon Game
//The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x ... | ALGO | 0.999701 | 4.073564 | {
"github_metadata": {
"branch": "master",
"commit_count": 1,
"repo_created_at": "2018-04-03T03:07:16.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "ee358c36d0... |
5f117998-76a8-4b79-b28e-ca6ce9995d04 | Ankit97yy/My-codes | HW_CW/arr_stack.cpp | #include <iostream>
using namespace std;
int p = -1;
int arr[5] = {0, 0, 0, 0, 0};
bool isfull(int arr[]){
for(int i=0;i<5;i++){
if(arr[i]==0) return false;
}
return true;
}
void push(int arr[])
{ if(isfull(arr)) cout<<"stack is full"<<endl;
else {
int num;
cout << endl
<< "en... | ALGO | 0.978295 | 3.598553 | {
"github_metadata": {
"branch": "main",
"commit_count": 20,
"repo_created_at": "2021-01-21T19:21:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "19b51fe5529... |
3a0f1422-b4bf-4a48-80fd-7618cf4bd62d | g0dd4mnmath/X-Ray-Image-Noise-Model-And-Denoising | K-SVD/omp.cpp | #include "omp.h"
std::vector<float> omp(
std::vector<float> srcPatch,
std::vector<float> dictionary,
ompPara oPara
) {
int srcPatchSize = srcPatch.size() / oPara.featureSize;
std::vector<float> sparseCodeRes(srcPatchSize * oPara.atoms);
float weight = 0;
int chosenAtomIndex;
for (int patchIndex = 0; patchInd... | ALGO | 0.999482 | 4.699817 | {
"github_metadata": {
"branch": "main",
"commit_count": 4,
"repo_created_at": "2023-03-22T10:10: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": "ce536c32577f... |
56945520-11ae-48a7-8a80-4d0b2d6fb4ae | Rasen1018/PRACTICE | C++/0826/123.cpp | #include <stdio.h>
#include <stdlib.h>
struct NODE {
struct NODE* next;
int data;
};
struct NODE* append(struct NODE* parent, int data) // 기준 노드 뒤에 노드를 추가하는 함수
{
struct NODE* node = (struct NODE*)malloc(sizeof(struct NODE));
node->next = NULL; // 초기화
node->data = data;
if (parent != NULL)
... | ALGO | 0.99944 | 4.696515 | {
"github_metadata": {
"branch": "main",
"commit_count": 12,
"repo_created_at": "2022-09-20T11:09: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": "2bc73d7c690... |
3ecf0175-333f-4398-8326-973b0e33ef6f | RangeLFR/ACM | training/liang/h.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
using namespace std;
#define maxn 100005
struct point1{
int x;
int y;
}point[maxn];
int ans[maxn];
int n;
bool cmp_x(const point1& a, const point1& b)
{
if(a.x == b.x) return a.y < b.y;
return a.x < b.x;
}
int... | ALGO | 0.999966 | 3.82232 | {
"github_metadata": {
"branch": "master",
"commit_count": 8,
"repo_created_at": "2018-08-10T06:47: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": "6e512c57a1... |
6233b638-5f93-4764-b9f2-243177043b2a | Maryam-Amir00/CPP | Day4-Random-Prize-Generator/Task4.cpp | #include<iostream>
#include<cstdlib>
#include<ctime>
using namespace std;
int main()
{
int win;
cout<<"\n\t\tWelcome to the Random Prize Generator\n\n";
cout<<"Enter The number of Winners: ";
cin>>win;
while (1)
{
if (!cin || cin.peek() != '\n' || isalpha(cin.peek())) {
... | TOOL | 0.945832 | 3.770146 | {
"github_metadata": {
"branch": "main",
"commit_count": 13,
"repo_created_at": "2024-06-04T16:07: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": "8251b73ed55... |
f7e33ce2-eadc-466e-a8e4-d97053061159 | chaeyoon-lee-rae/cpp-algorithm | 백준/Gold/10942. 팰린드롬?/팰린드롬?.cc | #include <iostream>
using namespace std;
int n, a[2001], m, s, e;
bool dp[2001][2001];
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin >> n;
for (int i = 0; i < n; ++i) {
cin >> a[i];
dp[i][i] = 1;
}
for (int i = 0; i < n - 1; ++i) {
... | ALGO | 0.999949 | 4.577971 | {
"github_metadata": {
"branch": "main",
"commit_count": 491,
"repo_created_at": "2023-10-09T14:46:02.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "7ab5ac12ba... |
de843adb-5bcb-4724-8898-723d1f2c7577 | InsightSoftwareConsortium/ITK | Modules/Segmentation/DeformableMesh/include/itkDeformableSimplexMesh3DFilter.hxx | /*=========================================================================
*
* Copyright NumFOCUS
*
* 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
*
* https://www.apache.o... | ALGO | 0.967681 | 6.440533 | {
"github_metadata": {
"branch": "main",
"commit_count": 57165,
"repo_created_at": "2010-07-27T15:48:04.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 1517,
"forks": 701,
"issues": 268,
"pull_requests": 49
},
"file_meta": {
"content_id": "8... |
253c7db5-e254-477a-a267-4719c4f64deb | myx2002/mei-ZJUCSstudy | 数据库基础(cg+89)/code of lab6/src/index/b_plus_tree.cpp | #include "index/b_plus_tree.h"
#include <string>
#include "glog/logging.h"
#include "index/basic_comparator.h"
#include "index/generic_key.h"
#include "page/index_roots_page.h"
/**
* TODO: Student Implement
*/
BPlusTree::BPlusTree(index_id_t index_id, BufferPoolManager *buffer_pool_manager, const KeyManager &KM,
... | ALGO | 0.977242 | 5.202025 | {
"github_metadata": {
"branch": "main",
"commit_count": 31,
"repo_created_at": "2024-02-06T09:44:29.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 0,
"forks": 1,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "dc2538b7456... |
267dd44c-aa01-4500-9210-a2a44d3be0fb | helios-base/helios-base | src/player/basic_actions/body_smart_kick.cpp | // -*-c++-*-
/*!
\file body_smart_kick.cpp
\brief smart kick action class source file.
*/
/*
*Copyright:
Copyright (C) <NAME>
This code is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
v... | ALGO | 0.954038 | 6.105861 | {
"github_metadata": {
"branch": "master",
"commit_count": 59,
"repo_created_at": "2020-12-29T12:35:11.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 36,
"forks": 48,
"issues": 1,
"pull_requests": 0
},
"file_meta": {
"content_id": "c9a59a88... |
21b04ccb-c97e-4573-b5d0-ec34308e81d7 | shvmmshr/LeetCode-Practice | 2494-sum-of-prefix-scores-of-strings/2494-sum-of-prefix-scores-of-strings.cpp | class Solution {
public:
struct TrieNode {
TrieNode* children[26] = {};
int count = 0;
};
vector<int> sumPrefixScores(vector<string>& words) {
TrieNode* root = new TrieNode();
for (const string& word : words) {
TrieNode* node = root;
for ... | ALGO | 0.999972 | 6.429338 | {
"github_metadata": {
"branch": "main",
"commit_count": 1867,
"repo_created_at": "2024-08-03T07:54:24.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 3,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "807aa64e2... |
5d5d8c5b-81da-47a5-aab7-2a18ba07e823 | snulion-study/algorithm-int | sangwon/ch08_DynamicProgramming/8-14.cpp | // 8.14 원주율 외우기 문제를 해결하는 동적 계획법 알고리즘
// 길이 3 4 5 인 조각으로 나눈다
// 모두 같으면 1, 단조 증가 or 감소 2, 번갈아가며 나타난다 4, 등차수열 5, 이 외의 경우 10
const int INF = 987654321;
string N;
// N[a..b] 구간의 난이도를 반환한다. size 는 이 때 정해진다
// 길이 3 4 5 인 구간들을 만든다. 난이도를 최소로 만드는 조합을 찾는 것은 아래 memorize 함수에서 처리
int classify(int a, int b) {
// 숫자 조각을 가져온다, [a.... | ALGO | 0.999945 | 4.034212 | {
"github_metadata": {
"branch": "master",
"commit_count": 263,
"repo_created_at": "2020-09-07T06:57:35.000Z",
"is_fork": false,
"is_org_owned": true,
"forked_from": null,
"stars": 0,
"forks": 3,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "1a2b49580... |
7e36c8fc-6431-4bda-accc-f7f3b97c2bcf | hello-sources/Coding-Training | LeetCode/59螺旋矩阵Ⅱ.cpp | class Solution {
public:
vector<vector<int>> generateMatrix(int n) {
int max_num = n * n, cur = 1;
int rols = 0, cols = 0;
int dir_ind = 0;
vector<vector<int>> ans(n, vector<int>(n));
vector<vector<int>> dir = {{0, 1}, {1, 0}, {0, -1}, {-1, 0}};
while (cur <= max_num)... | ALGO | 0.99996 | 6.20901 | {
"github_metadata": {
"branch": "master",
"commit_count": 1403,
"repo_created_at": "2020-03-11T17:01:36.000Z",
"is_fork": false,
"is_org_owned": false,
"forked_from": null,
"stars": 4,
"forks": 0,
"issues": 0,
"pull_requests": 0
},
"file_meta": {
"content_id": "69b9c22... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.