uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
de6d1814-7555-41ed-b4b7-d76c939519c2 | siliviu/algorithms | trees/hld/original.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int n, inv[1 << 18];
ll st[1 << 19], lazy[1 << 19];
void Build(int node = 1, int left = 1, int right = n) {
if (left == right) {
st[node] = inv[left];
return;
}
int m = (left + right) / 2;
Build(2 * node, left, m), Build(2 * node + 1, m + 1,... | ALGO | 0.999967 | 5.164541 |
d1dcb6c0-d852-490c-8098-33fb057eb737 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_12321_6.cpp | #include <bits/stdc++.h>
using namespace std;
const long long hell = 1000000007;
const long long mod = 1000000007;
vector<long long> v[1001];
long long vis[1001];
long long solve() {
long long n;
cin >> n;
n = n / 1000;
if (n & 1)
cout << 1;
else {
cout << 2;
}
return 0;
}
signed main() {
ios_ba... | ALGO | 0.999467 | 3.758661 |
c8433e26-c695-4c78-bddb-255fa103e9a3 | xuyuanxin/notes | algocoding/leetcode/path_sum.cpp | /*******************************************************************************
Path Sum(Easy)
*******************************************************************************
Given a binary tree and a sum, determine if the tree has a root-to-leaf path such
that adding up all the values alo... | ALGO | 0.999932 | 6.182665 |
6c1ceac9-fb84-4455-94af-d2e695c3cdbd | sntwr/UVa-Solved-Problems | solved/UVa11679/11679.cpp | #include <bits/stdc++.h>
#define MAX_BANKS 50
int
main ()
{
int n_banks, n_debentures;
while (scanf ("%d%d", &n_banks, &n_debentures),
(n_banks || n_debentures)) {
int reserve[MAX_BANKS];
for (int b = 1; b <= n_banks; b++)
scanf ("%d", reserve + b);
for (int d = 1; d <= n_debentures; d++) {
int deb... | ALGO | 0.998781 | 3.473182 |
8aaa97f7-e22a-4cb6-aa20-0ee0373be992 | AkashAryan58/Code-Library | longest palindrome.cpp | class Solution {
public:
int longestPalindrome(string s) {
unordered_map<char,int> map;
int flag=0;
for(int i=0;i<s.length();i++)
{
map[s[i]]++;
}
int counter=0,x;
for(auto it:map)
{
if(it.second>1)
{
... | ALGO | 0.99989 | 5.799657 |
0613052b-56b7-49e7-9ee7-dac3980b9e57 | gnobisP/beecrowd | URI/bee2391.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int N; cin >> N;
vector<int> num;
for (int i = 0; i < N; i++)
{
int a; cin >> a;
num.push_back(a);
}
int contador = 1;
int diferencaA = num[0] - num[1];
for (int i = 1; i < N; i++)
{
if (diferencaA != ... | ALGO | 0.999934 | 3.852655 |
1dd3ad1c-a0be-4638-8cf3-2d94e4d16e56 | Misaka2298/Misaka2298_OI_Project | 比赛/Accoders/2025春季B层测试十/正解/acc2025B10-B 连接多位数.cpp | //T2正解
#include <bits/stdc++.h>
using namespace std;
const int maxn = 22;
int n;
string nums[maxn];
bool numcmp(string a, string b)
{
return a+b > b+a;
}
signed main()
{
cin >> n;
for(int i = 0 ; i < n ; i++)
cin >> nums[i];
sort(nums, nums+n, numcmp);
if(nums[0] == "0")
{
cout << 0;
exit(0);
}
... | ALGO | 0.999852 | 4.332398 |
af4376af-4375-49b2-839b-54e1909f01a2 | Seraphsnow/CP | codechef/starter_63/ml1.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
int n;
cin >> n;
string s, ans = "";
cin >> s;
int j = 0;
if (n == 1)
{
cout << "YES\n";
return;
}
bool find1 = false;
for (int i = 0; i < n; i++)
{
if (!find1)
{
if (s[i... | ALGO | 0.999844 | 4.689147 |
45e1da56-4868-4c26-bdbe-daee87347541 | Ri-Nai/CompetitionCode | ACM/2024-2025-1/12-08-2024-Lanqiao/A.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int a, b, c;
cin >> a >> b >> c;
const int mod = 998244353;
auto Qpow = [](int x, int p, int mod)
{
int res = 1;
for (; p; p >>= 1, x = 1ll * x * x % mod)
if (p & 1)
res = 1ll * res * x % mod;
... | ALGO | 0.999988 | 5.64914 |
508a7f91-668b-4786-ba82-47f47cf642ed | ishandutta2007/codeforces | theoneyouwant/normal/447/A.cpp | //By TheOneYouWant
#pragma GCC optimize ("-O2")
#include <bits/stdc++.h>
using namespace std;
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(),x.end()
#define memreset(a) memset(a,0,sizeof(a))
#defin... | ALGO | 0.99974 | 3.645237 |
353426b9-8f60-40a5-acbd-2eccdad16235 | truta193/utcn | sem02/sda/lab6_extra/rollinghash/main.cpp | #include <iostream>
#include "rollingHash.h"
#include <string>
#include <fstream>
using namespace std;
int main() {
string text;
string pattern;
int cand = 0;
ifstream fin("../date.in", ios::in);
fin >> text;
while (fin >> pattern) {
int pHash = hashingFunction(pattern.length(),pattern)... | ALGO | 0.992043 | 4.193794 |
948f6abd-914b-4484-937b-18dc177f5688 | anonymouss/my-leetcode-cpp | src/0188-Best-Time-to-Buy-and-Sell-Stock-IV.cpp | /**
* Say you have an array for which the i-th element is the price of a given stock on day i.
* Design an algorithm to find the maximum profit. You may complete at most k transactions.
*
* Note:
* You may not engage in multiple transactions at the same time (ie, you must sell the stock before
* you buy again).
... | ALGO | 0.99991 | 6.100342 |
0d17ba23-ebe5-4e3c-9411-c8e22eb2e70b | ayooooou/SproutOJ | 12-2/4949.cpp | #include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
int main(){
int n,q,l,r;
int m[1000000];
cin >> n >>q;
for(int i=0;i<n;i++){
cin >> m[i];
}
sort(m,m+n);
for(int i=0;i<q;i++){
cin >> l >>r;
int* ptr1 = lower_bound(m,m+n,l);
int... | ALGO | 0.999974 | 3.591987 |
b370f705-5016-4455-a92f-17779b960cfb | siludose/ACM-ICPC | subject/connected graph/poj3694(Tarjan建新图+LCA最近公共祖先).cpp | /*
这是一个无向图
首先还是要求出图的强连通分块,图的割点数量
然后题意说会输入一些边,问每一次加边桥的数量剩下多少割点
我们可以知道从这条边的两个点作为起点,到其最近公共祖先的所有点都是需要删除的割点
当然,有些点是会被重复删除的,我们需要对其做标记
这时候要用LCA算法求最近公共祖先
LCA的算法原理是什么
首先建好的新图由于不存在环,是可以当成树的
我们先随便选一个点当作根对其进行dfs或者bfs求树的每个节点的深度
然后根据这个深度去找两个点的最近祖先
*/
#include<iostream>
#include<cstdio>
#include<string.h>
#include<algorithm>
#inclu... | ALGO | 0.999875 | 4.232869 |
a907a173-9040-4cdc-ba86-14a9ca7849c6 | zxf-work/GraphProfile | boost_1_63_0/libs/program_options/src/value_semantic.cpp | #define BOOST_PROGRAM_OPTIONS_SOURCE
#include <boost/program_options/config.hpp>
#include <boost/program_options/value_semantic.hpp>
#include <boost/program_options/detail/convert.hpp>
#include <boost/program_options/detail/cmdline.hpp>
#include <set>
#include <cctype>
namespace boost { namespace program_options {
... | TOOL | 0.979462 | 7.624641 |
733f767a-193b-4f8a-8c4a-4728af3be645 | abdelqayyim/C-Tic-Tac-Toe | build-mac/Boost/libs/math/example/airy_zeros_example.cpp | #ifdef _MSC_VER
# pragma warning (disable : 4512) // assignment operator could not be generated.
# pragma warning (disable : 4996) // assignment operator could not be generated.
#endif
#include <iostream>
#include <limits>
#include <vector>
#include <algorithm>
#include <iomanip>
#include <iterator>
// Weisstein, E... | ALGO | 0.998691 | 6.639414 |
fb2b437c-bf58-4b80-901e-c8cc9e496a20 | raincross7/code-similarity | codes/train_code/problem273/problem273_313.cpp | #include <iostream>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <cmath>
#include <queue>
#include <set>
#include <map>
#include <cassert>
#include <fstream>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
const ll mod = 1e9 + 7;
vector<ll... | ALGO | 0.999857 | 4.060976 |
4c1ccd28-6db5-43c5-b75a-5914d48fe025 | thisisrajneel/CPP-DSA | Linked List/circular.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
class node {
public:
int data;
node* next;
node(int val) {
data = val;
next = NULL;
}
};
void insertAtHead(node* &head, int val) {
node* n = new node(val);
if(head == NULL) {
n->next = n;
... | ALGO | 0.999754 | 3.84701 |
bbd7f5a0-5fae-4589-a489-1be9095e9ad4 | Paradoxinum/HPC_Integral | Source/calculationSerial.cpp | #include "../Header/Helper.hpp"
int main(){
std::cout << Helper::serialCalculateIntegral(MathEquations::testFunction,0.00,5.00 ,0.0000001) << std::endl;
return 0;
}
| ALGO | 0.912338 | 3.592576 |
f06891d8-27bc-4549-a27a-c28b2905f9c8 | SincereXIA/gitlab-code | 155.最小栈.cpp | /*
* @lc app=leetcode.cn id=155 lang=cpp
*
* [155] 最小栈
*
* https://leetcode-cn.com/problems/min-stack/description/
*
* algorithms
* Easy (57.33%)
* Likes: 1030
* Dislikes: 0
* Total Accepted: 284.4K
* Total Submissions: 496.1K
* Testcase Example: '["MinStack","push","push","push","getMin","pop","top... | ALGO | 0.999472 | 6.498225 |
1ade46d3-1f91-45c9-ac63-bf66b15c291a | MaTianmao/src | src/boost/libs/graph/test/bellman-test.cpp | // From Louis Lavery <<EMAIL>>
/*Expected Output:-
A: 0 A
B: 11 A
Actual Output:-
A: 0 A
B: 2147483647 B
*/
#include <iostream>
#include <iomanip>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/bellman_ford_shortest_paths.hpp>
#include <boost/cstdlib.hpp>
#include <boost/test/minimal.hpp>
int t... | ALGO | 0.998847 | 5.519931 |
5195d7ca-70fe-4e72-98a5-d90e7ef58169 | mtfuka/competitive-programming | AtCoder/AtCoder_Beginner_Contest/191/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < n; i++)
int main(){
int N,X;
cin >> N >> X;
vector<int> A(N);
rep(i, N) {
cin >> A[i];
}
rep(i,N){
if(A[i]==X){
cout << "";
}
else
cout << A[i] <<" ";
}
retur... | ALGO | 0.999843 | 3.364169 |
46d3cb7d-d7bd-47d5-847b-0aa9f039b743 | IshanRakte/LeetCode-Solutions | 1220-count-vowels-permutation/1220-count-vowels-permutation.cpp | class Solution {
public:
int countVowelPermutation(int n) {
long a = 1, e = 1, i = 1, o = 1, u = 1, mod = pow(10, 9)+7;
long a2, e2, i2, o2, u2;
for (int j = 2; j <= n; j++) {
a2 = (e + i + u) % mod;
e2 = (a + i) % mod;
i2 = (e + o) % mod;
... | ALGO | 0.999963 | 6.612546 |
c7482255-ea58-4d9f-abae-f54a21974091 | x-junzhu/datastructure-algorithm | Algorithm/Search-Graph/Dijkstra849-0324.cpp | #include <iostream>
#include <cstring>
#include <algorithm>
using namespace std;
const int N = 510;
int n, m;
/*邻接矩阵存储图*/
int g[N][N];
/*dist[i]表示从0->i的最短距离*/
int dist[N];
/*st[i]表示第i个节点已经确定最短距离*/
bool st[N];
int dijkstra()
{
memset(dist, 0x3f, sizeof dist);
/*第一个节点到本身的距离为0*/
dist[1] = 0;
for (int i = 0; i < ... | ALGO | 0.999988 | 4.217589 |
77cb34f9-546f-497f-991e-613b22c47be4 | jorgektch/google-code-jam | 2021/Qualification-Round-2021/moons-and-umbrellas-5pts-11pts-1pts.cpp | #include<bits/stdc++.h>
using namespace std;
void replace(string &s, int first, int last){
char c;
if(first == -1 && last == s.length()){
c = 'J';
}else{
if(last == s.length()) c = s[first];
else c = s[last];
}
for(int pos=first+1; pos<last; pos++){
s[pos] = c;
}
... | ALGO | 0.999819 | 3.923345 |
20bd4dfa-b314-433a-b774-b18a0529062f | coding-corner-courses/Strukturno-Programiranje-Cpp | Tema4/Exercises-from-lesson/013_zadaca.cpp | #include <iostream>
using namespace std;
//Напиши програма која за внесен број ќе првери дали бројот е совршен.
//Резултатот да се отпечати.
//Дефиниција: Совршен број е број чија сума од неговите делители (без самиот број) го дава истиот тој број.
//Пр. Бројот 6 е совршен број
int main()
{
int n;
cin>>n;
... | ALGO | 0.99993 | 5.161101 |
073fb023-555f-42c6-89df-03d7c5017ffd | IshyWishy17/Competitive-Coding | codeforces/lemonade.cpp | #include <iostream>
#include <string>
#include <bits/stdc++.h>
using namespace std;
void solve (int t) {
long long int n, k;
cin >> n >> k;
vector<long long int> arr(n);
for (long long int i = 0; i < n; i++) {
cin >> arr[i];
}
sort(arr.begin(), arr.end());
long long int rounds = 0; ... | ALGO | 0.999948 | 4.186336 |
bd35234a-3ca6-4277-bd27-fcc0ebfb06b8 | PablooDario/Competitive-Programming | Codeforces/DP/BasketballEsxercise.cpp | //https://codeforces.com/contest/1195/problem/C
#include <bits/stdc++.h>
using namespace std;
int n;
long long dp[100000][2];
bool visited [100000][2]={0};
long long solve(int x, int h)
{
if(x>n-1) return -1;
if(visited[x][h]) return dp[x][h];
long long DP;
if(!h)
DP=max(solve(x+1,h+1),s... | ALGO | 0.999987 | 3.825968 |
40c41645-4a95-4018-84a7-7af8032ba584 | slack2450/csgo-dma-overlay | dma/boost_1_69_0/tools/inspect/link_check.cpp | // link_check implementation -----------------------------------------------//
#include "link_check.hpp"
#include "boost/regex.hpp"
#include "boost/filesystem/operations.hpp"
#include <boost/algorithm/string/case_conv.hpp>
#include <cstdlib>
#include <set>
// #include <iostream>
namespace fs = boost::filesystem;
... | TOOL | 0.917457 | 7.753358 |
5c567d74-9f22-433e-8775-ae3221625f6e | prutha96/Tess | libraries/tess-two/jni/com_googlecode_tesseract_android/src/cube/char_bigrams.cpp | #include <algorithm>
#include <math.h>
#include <string>
#include <vector>
#include "char_bigrams.h"
#include "cube_utils.h"
#include "ndminx.h"
#include "cube_const.h"
namespace tesseract {
CharBigrams::CharBigrams() {
memset(&bigram_table_, 0, sizeof(bigram_table_));
}
CharBigrams::~CharBigrams() {
if (bigram... | ALGO | 0.887015 | 5.997954 |
1f7330d4-e926-47eb-81f6-be9506a14109 | oxygen-hunter/Flashboom | data/leetcode_cpp/count-numbers-with-unique-digits.cpp | // Time: O(n)
// Space: O(1)
class Solution {
public:
int countNumbersWithUniqueDigits(int n) {
if (n == 0) {
return 1;
}
int result = 1;
for (int i = 0, cnt = 1; i < n - 1; ++i) {
cnt *= 9 - i;
result += cnt;
}
return 1 + 9 * res... | ALGO | 0.99989 | 7.673335 |
c27b0748-0247-42ec-9bb1-42b0dad2e11b | NasirAli1419/CodeCastle | CSES/sum_of_two_values.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define MOD 1e9+7
int main() {
int n,x;
cin>>n>>x;
map<int,int> map;
for(int i=0;i<n;i++){
int val;
cin>>val;
if(map.count(x-val)){
cout<<i+1<<" "<<map[x-val]<<endl;
... | ALGO | 0.999956 | 4.330834 |
844cbc56-2b97-4677-a480-9a6ab59f8f1d | Fangjiajie11/SD2024 | exp5/exp5/main.cpp | #include <iostream>
#include <cassert>
#include <cstdlib>
#include <chrono>
using namespace std;
using namespace chrono;
//
void Swap(int* a, int* b) {
int temp = *a;
*a = *b;
*b = temp;
}
// ð
void BubbleSort(int* a, int n) {
assert(a);
for (int i = 0; i < n - 1; i++) {
bool flag = false... | ALGO | 0.998946 | 5.038026 |
0d141925-be88-4fc3-8caa-71bd1dba1eeb | cf3i/leetcode_solution_cn | BackTraverse/37.cpp | #include "header.h"
class Solution {
public:
void solveSudoku(vector<vector<char>>& board) {
traverse(0, 0, board);
}
bool traverse(int row, int col, vector<vector<char>>& board) { // 填第(row, col)个格子
// 由于寻找一种解,所以返回值是bool
if (row == 8 && col == 9) { // 此时说明全填完了
return t... | ALGO | 0.999725 | 6.217775 |
1d8f225f-cdd1-4812-844d-7c0f93b5030b | leverimmy/Codes | 比赛/学校/2019-11-7测试/HB-熊泽恩/2/2.cpp | #include <bits/stdc++.h>
#define ll long long
#define rgi register int
#define rgl register ll
#define il inline
const int N = 10 + 10;
int n, len;
std::string str[N];
int main() {
freopen("2.in", "r", stdin);
freopen("2.out", "w", stdout);
std::cin >> n;
for(rgi i = 1; i <= n; ++i) std::cin >> str[i];
len = st... | ALGO | 0.999916 | 4.55395 |
0b9a5092-97e0-4a35-99d6-6a13f46e856d | Reid-Harris/Cplusplus-console-apps | marathon.cpp |
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
using namespace std;
//declare the gobal array of type double
double average[5];
//declare the function prototypes
void getData(ifstream& inf, string n[], double runData[][8],int count);
void calculateAverage(double runData[][8], int ... | TOOL | 0.851105 | 3.638658 |
0c881ef0-403b-407d-9967-ddd4052c06d3 | hammadrahim-06/OOP-Lab-Spring-2025 | OOP Lab 8/Task3.cpp | #include <iostream>
#include <string>
using namespace std;
class Teacher;
class Student {
private:
string fullName;
int marks[3];
public:
Student(string n, int m1, int m2, int m3) {
fullName = n;
marks[0] = m1;
marks[1] = m2;
marks[2] = m3;
}
friend class ... | TOOL | 0.912401 | 7.36287 |
96b22224-0033-4261-a467-28c2d965dba1 | mkaszkowiak-cs-put/przetwarzanie-rownolegle | koncepcyjne/2_sito_v1.cpp | #include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include "../measure_time.cpp"
std::vector<int> findPrimes(int lower, int upper, long long *additions, long long *divisions)
{
std::vector<int> primes;
std::vector<bool> prime(upper + 1, true);
prime[0] = false;
prime[1] = fals... | ALGO | 0.998811 | 4.990063 |
9c4fb1a2-6d2e-43bb-824f-ad3399d86cf8 | TonuruRikkon/Tin-VL | luyende2024/ThanhHoa2223/MATMA.cpp | #include <bits/stdc++.h>
using namespace std;
bool cmp(int x,int y)
{
return x>y;
}
int main()
{
bool is_ten=false;
long long tol=0;
string n;
cin>>n;
for(char x:n){
tol+=x-'0';
if(x=='0') is_ten=true;
}
if(tol%3==0&&is_ten==true){
sort(n.begin(),n.end(),cmp);
... | ALGO | 0.999795 | 4.593321 |
9ddf9ad2-c81b-4f05-a5bb-129ee8a15622 | F-Quasimo/DEBTHE | ocvHuffmanLikeHE/ocvHuffmanLikeHE.cpp | // huffmanLikeEqualizetion.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <opencv2/opencv.hpp>
#include "ColorLevelTree.h"
#include <iostream>
#include <vector>
#include <opencv2/imgproc/imgproc.hpp>
using namespace cv;
using namespace std;
int getCountPixel(Mat image);
sta... | TOOL | 0.988402 | 3.485351 |
b4b2d890-82f5-4bcf-ae57-0cf1436eca2c | ParkSeonghyeon2003/CodingTest_Study | week1/P11.cpp | #include <vector>
#include <unordered_map>
using namespace std;
int solution(vector<int> array)
{
unordered_map<int, int> umap; // ؽ
int max, maxV = 0; // ֺ pair first, second
// Ʈ
for (int i = 0; i < array.size(); i++) umap[array[i]]++;
// ͷͷ ȸϸ ֺ Ʈ
for (auto iter : umap) {
if (ite... | ALGO | 0.999748 | 4.821755 |
280ecc29-0fb6-42b6-9ac2-8bd05f355442 | rishigithub001/FOCcodings | C program to print the digits of an integer in text.cpp | #include<stdio.h>
#include<conio.h>
int main()
{
int n, digit, reversed = 0;
printf("Enter a positive integer number: ");
scanf("%d", &n);
while (n != 0)
{
digit = n % 10;
reversed = reversed * 10 + digit;
n /= 10;
}
while (reversed != 0)
{
digit = reversed % 10;
switch (digit)
{
case 0:
printf("Zero ");
break;
cas... | ALGO | 0.99972 | 3.720337 |
002c6f1b-e5ec-460a-a32a-93aa5ef85f5e | snykk/Competitive-Programming | LeetCode/Remove Duplicates from Sorted List II.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* deleteDupli... | ALGO | 0.999979 | 6.015152 |
4960b1f2-3506-4be4-b24e-0a85496cd58c | xuyangustc/cavity_design | src/geometry/src/line.cpp | /*
* line.cpp
*
* Created on: 2016年11月3日
* Author: hyliu
*/
#include "geometry/line.h"
using namespace NSPgeometry;
XYZ Line::perpendicular_foot(const XYZ & point) const{
return origin+dot(point-origin,direction)*direction;
}
bool Line::contains(const XYZ &point) const {
static const double EPSINON=1.e-... | TOOL | 0.945615 | 5.036506 |
fd515c56-3283-4652-8679-bb206a434cff | hadleyhzy34/data_structure_and_algorithm | tree/leetcode_tree/450_delete_node_in_a_BST.cpp | #include <stdio.h>
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <unordered_map>
#include <stack>
#include <cstring>
#include <queue>
#include <functional>
#include <numeric>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
Tre... | ALGO | 0.999967 | 5.657463 |
69b407f4-c28d-4b4e-a07b-36d557225388 | KJ1113/Algorithm_2021 | 문제 : 삼성기출/test.cpp | #include <stdio.h>
#include <iostream>
using namespace std;
const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { -1, 0, 1, 0 };
const int wx[4][9] =
{
{-1, 1, -1, 1, -1, 1, -2, 2, 0}, // LEFT
{-1, -1, 0, 0, 1, 1, 0, 0, 2}, // DOWN
{-1, 1, -1, 1, -1, 1, -2, 2, 0 }, // RIGHT
{1, 1, 0, 0, -1, -1, 0, 0, -2... | ALGO | 0.999442 | 3.233446 |
0fe990da-afd1-49e1-b19c-85ed856d903a | ishandutta2007/codeforces | demoralizer/normal/901/B.cpp | #include "bits/stdc++.h"
using namespace std;
#define int long long
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define all(x) (x).begin(),(x).end()
#define uniq(v) (v).erase(unique(all... | ALGO | 0.999911 | 3.039232 |
760fcf6a-de53-43ec-be43-9e83f55dfa7b | mahirshahriar1/Competitive_Programming | 1. Topics/Dynamic_Programming/Knapsack.cpp | int n;
int price[1100],weight[1010];
int dp[1100][40];
int knapsack(int i,int w){
if(i>=n) return 0;
if(dp[i][w]!=-1) return dp[i][w];
int val1=0,val2=0;
if(w-weight[i]>=0){
val1=price[i]+knapsack(i+1,w-weight[i]);
}
val2=knapsack(i+1,w);
return dp[i][w]=max(val1,val2);
}
... | ALGO | 0.999995 | 4.313746 |
ed0903ac-cfc4-4ba8-8009-82ea79ea8af7 | maverickreal/leetcode-solutions | range-sum-query-immutable/range-sum-query-immutable.cpp | class NumArray {
private:
vector<vector<int>> dp;
bool zerocase;
public:
NumArray(vector<int>& v) {
if(!v.size()){
zerocase=true;
return;
}
zerocase=false;
dp=vector<vector<int>>(v.size(),vector<int>(v.size()));
dp[0][0]=v[0];
for(int i=0;i<v.size();++i){
for(... | ALGO | 0.999897 | 6.034951 |
13cdf273-3eac-4115-b705-29db6bfb2f78 | Michaelmilk/leetcode | lt2/recursive/Unique Paths II.cpp | #include <iostream>
#include <vector>
using namespace std;
/*
int dp[101][101];
int uniquePathsWithObstacles(vector<vector<int> > &obstacleGrid)
{
int rSize = obstacleGrid.size();
if (0 == rSize)
{
return 0;
}
int cSize = obstacleGrid[0].size();
for (int i = 0; i < rSize; i++)
{
if (obstacleGrid[i][0] == ... | ALGO | 0.999184 | 4.396203 |
c1c1b26d-1a18-4843-9ad1-5265022bc226 | InoriRus/Kyty | source/3rdparty/vulkan/source/opt/dead_insert_elim_pass.cpp | #include "source/opt/dead_insert_elim_pass.h"
#include "source/opt/composite.h"
#include "source/opt/ir_context.h"
#include "source/opt/iterator.h"
#include "spirv/1.2/GLSL.std.450.h"
namespace spvtools {
namespace opt {
namespace {
const uint32_t kTypeVectorCountInIdx = 1;
const uint32_t kTypeMatrixCountInIdx = 1;... | ALGO | 0.914083 | 8.004223 |
e8ccefa8-3593-4f53-99f2-5b25e3be84b8 | Pulkit1822/GeeksforGeeks | Difficulty: Easy/Remaining String/remaining-string.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function template for C++
class Solution {
public:
string printString(string s, char ch, int count) {
// Your code goes here
for(int i=0;i<s.length();i++){
if(!count) return s.s... | ALGO | 0.999775 | 5.482634 |
ef636d11-2eb8-4f6e-a70b-5865e83ee123 | kdlqudrb/Exercise | swacademy/second/mountainroad.cpp | #include <bits/stdc++.h>
using namespace std;
int N, K, answer;
int mountain[8][8], coloring[8][8];
int dx[4] = { -1, 0, 1, 0 };
int dy[4] = { 0, 1, 0, -1 };
queue<pair<int, int> >q;
int isrange(int r, int c){
if (r < 0 || c < 0) return 0;
if (r >= N || c >= N) return 0;
return 1;
}
void dfs(int r, int c, int gon... | ALGO | 0.999641 | 3.635866 |
9fadbeed-790a-4455-bf85-87019c4199e4 | ishandutta2007/codeforces | kobus/normal/888/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define f first
#define s second
typedef long long ll;
typedef pair<int,int>pii;
#define MAXN 512345
#define INF INT_MAX/2
#define MOD 1000000007
#define int long long
int resp[5];
int32_t main(){
ios::sync_with_stdio(false);
... | ALGO | 0.999846 | 3.666427 |
3324d20c-91be-407f-90d7-4eb3cb1942e3 | zach-xing/games101 | Assignment02/rasterizer.cpp | //
// Created by goksu on 4/6/19.
//
#include "rasterizer.hpp"
#include <math.h>
#include <algorithm>
#include <opencv2/opencv.hpp>
#include <vector>
rst::pos_buf_id rst::rasterizer::load_positions(
const std::vector<Eigen::Vector3f>& positions) {
auto id = get_next_id();
pos_buf.emplace(id, positions);... | ALGO | 0.952623 | 6.43265 |
53e0217d-431d-4b28-9acb-634eb1c56c14 | Kanchii/Online_Judge_Problems | Uri/1437.cpp | #include <bits/stdc++.h>
using namespace std;
#define INF (1 << 30)
#define LINF (1LL << 63)
#define BIT(x) (1LL << (x))
#define pb(x) push_back((x))
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
template <typename T>
int prime(T x){
T k = floor(sqrt(x));
for(T i = 2; i <= k; i++){... | ALGO | 0.999885 | 4.337796 |
810187c0-b7ca-4802-a68e-af9f46326df5 | vaishalidewangan786/DSA_CPP | hashng.cpp | //finding frequencies of elements...
/*
#include<bits/stdc++.h>
using namespace std;
int main(){
unordered_map<int , int>ump;
int arr[]={2,4,4,5,5,5,5,7,2,3,1};
for(int i=0; i<11; i++){
// if(ump.find(arr[i])!=ump.end()){
// ump.find(arr[i])->second++;
// }
// else{
// pair<int,int> p(arr[i],... | ALGO | 0.999506 | 4.254739 |
b9b6763a-10d9-4530-a3f8-1d6d1fb5d346 | wyl-lab/raspbian | IntelligenceHomeSys/SecuritySubsystem/SecuritySubsystem/基于OpenCV的人脸识别/opencv-master/samples/cpp/matchmethod_orb_akaze_brisk.cpp | #include <opencv2/core.hpp>
#include <opencv2/imgproc.hpp>
#include <opencv2/features2d.hpp>
#include <opencv2/highgui.hpp>
#include <vector>
#include <iostream>
using namespace std;
using namespace cv;
static void help(char* argv[])
{
cout << "\n This program demonstrates how to detect compute and match ORB BRIS... | ALGO | 0.998348 | 6.530829 |
28c8f081-04ea-4d87-b7d6-8e7d468b1e8d | ishandutta2007/codeforces | .tx/normal/1016/D.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
template <typename K, typename V = __gnu_pbds::null_type>
using tree = __gnu_pbds::tree<K, V, less<K>, __gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;
using llong = long ... | ALGO | 0.999999 | 3.904398 |
02b02ee8-b107-4eea-96ab-4eb1610eec78 | me0giazodoi/T2207A-LBEP | Doan a,b chua cac so nguyen.cpp | #include <stdio.h>
int main (){
int n;
printf("Nhap so phan tu cua mang: ");
scanf("%d",&n);
int ary[n];
printf("Nhap cac so nguyen:\n");
for(int i=0;i<n;i++){
scanf("%d",&ary[i]);
}
int a,b,i;
int max=0;
int min=0;
for(i=0;i<n;i++){
if(ary[i]>max){
max=ary[i];
}
}
b=max;
for(i=0;i<n;i++){
if(a... | ALGO | 0.999203 | 3.305299 |
23d16974-d705-43b9-9788-4080b228442b | augustompm/multiOne | muscle-5.3/src/relabel.cpp | #include "muscle.h"
void cmd_relabel()
{
MultiSequence M;
M.FromFASTA(opt(relabel));
FILE *f = OpenStdioFile(opt(labels2));
string Line;
vector<string> Fields;
map<string, string> OldLabelToNewLabel;
uint LabelCount = 0;
while (ReadLineStdioFile(f, Line))
{
Split(Line, Fields, '\t');
if (SIZE(Fields) !... | TOOL | 0.867962 | 4.241381 |
dda58338-810e-4fb9-8517-4deec4877871 | andyvand/ReactOS-Source | rosapps/applications/net/netreg/netreg.cpp | #include <windows.h>
#include <stdlib.h>
#include <stdio.h>
#include <map>
#include <string>
#include <sstream>
#include <iomanip>
using std::hex;
using std::setw;
using std::setfill;
using std::map;
using std::string;
using std::ostringstream;
const char *root_entries[] = {
"HKEY_LOCAL_MACHINE",
"HKEY_CURRENT_US... | WEB | 0.924111 | 4.021334 |
f0095b0c-704a-467d-9eef-8a5b82e0eb44 | shivamkumar4344/Data-Structures-Algorithms | Heap/PriorityQueueBasics.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
//max_heap - by default
priority_queue<int> max_heap;
max_heap.push(10);
max_heap.push(30);
max_heap.push(50);
max_heap.push(110);
max_heap.push(90);
cout<<"Top element of the max heap is : "<<max_heap.top()<<endl;
max_heap.... | ALGO | 0.942221 | 4.133113 |
28c3ea5a-9c8b-4398-8e1b-3f5471d651f3 | ivanchuchulski/fmi-introduction-to-programming | up-hw2/kosio-4th-problem.cpp | #include <iostream>
#include <cstring>
#include <ctime>
using namespace std;
int ExtractSubstrings(char *string, char *substArr[])
{
int len = strlen(string);
int wordsToExtract = rand() % 3 + 2;
int arrIdx = 0;
while (wordsToExtract--)
{
int start = rand() % len;
int wordLen... | TOOL | 0.936112 | 3.40681 |
641ec904-556a-4275-a4be-1d90c92861b3 | youtube/cobalt_sandbox | buildtools/third_party/libc++/trunk/test/std/algorithms/alg.sorting/alg.min.max/ranges.minmax.pass.cpp | // <algorithm>
// UNSUPPORTED: c++03, c++11, c++14, c++17
// template<class T, class Proj = identity,
// indirect_strict_weak_order<projected<const T*, Proj>> Comp = ranges::less>
// constexpr ranges::minmax_result<const T&>
// ranges::minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {});
// ... | TEST | 0.982734 | 7.249632 |
8ef903f6-d263-4341-8ca7-a306ee7b517b | leodoprado/Cplusplus_College | URI-Judge/1T21-Algoritmos/L3_Repetição/1072.cpp | #include <iostream>
#include <cstdio>
#include <cmath>
using namespace std;
int main() {
int i=0, n=0, in=0, out=0;
cin >> n;
int valores[n];
for(i=0; i<n; i = i+1){
cout << valores[i] << endl;
}
for (i=0; i<n; i++){
if(valores[i] >= 10 && valores[i] <= 20) in++;
else out++;
}
cout << in << " in" << ... | ALGO | 0.975513 | 3.074511 |
39a81fed-da76-4cf1-9ac6-c59d79483bb7 | EvaIsKami/3DProgram | BaseFramework/Src/Framework/Math/KdAnimation.cpp | #include "KdAnimation.h"
#include "../Direct3D/KdModel.h"
// 二分探索で、指定時間から次の配列要素のKeyIndexを求める関数
// list … キー配列
// time … 時間
// 戻り値 … 次の配列要素のIndex
template<class T>
int BinarySearchNextAnimKey(const std::vector<T>& list, float time)
{
int low = 0;
int high = (int)list.size();
while (low < high)
{
int mid = (low ... | ALGO | 0.967835 | 5.216592 |
1b8cb27f-65b1-4d1c-bf79-2e0bc3fdc595 | amana632/Competetive-Programming | Leetcode/Counting Bits.cpp | class Solution {
public:
vector<int> countBits(int num) {
vector<int> dp(num+1,-1);
dp[0]=0;
dp[1]=1;
dp[2]=1;
for(int i=3;i<=num;i++){
int m=floor(log2(i));
// cout<<m;
dp[i]=1+dp[i-pow(2,m)];
}
return dp;
}
}; | ALGO | 0.999983 | 5.735312 |
250628d8-c5de-4c99-8c76-ebaa2398e5ba | wangyongliang/nova | poj/1207/POJ_1207_2201405_AC_31MS_24K.cpp | #include <stdio.h>
void main(){
long i,j,k,n,counter,max;
while(scanf("%ld %ld",&i,&j)!=EOF)
{
printf("%ld %ld ",i,j);
if(i>j) {n=i;i=j;j=n;}
max=0;
for(k=i;k<=j;k++)
{counter=1;
n=k;
while(n!=1)
{
if(n%2) {n=3*n+1;counter++;}
else {n=n/2;counter++;}
}
if(max<counter) max=counter;
}
printf("%... | ALGO | 0.999977 | 3.703066 |
b9de1ed8-c6dd-46f8-b9a7-703209f7b9bd | haozx1997/C | 1星/迪杰斯特拉.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <vector>
#include <queue>
using namespace std;
const int INF = 1000000000;
const int maxn = 500 + 5;
struct Edge{
int from,to,dist;
};
struct HeapNode{
int d,u;
bool operator < (const HeapNode& rhs) const{
... | ALGO | 0.999852 | 3.759675 |
14cd19c8-55d4-4c94-a971-6809234931dd | vfolunin/archives-solutions | MCCME/112670.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
map<int, int> factorize(int n) {
map<int, int> factorization;
for (long long d = 2; d * d <= n; d++) {
while (n % d == 0) {
factorization[d]++;
n /= d... | ALGO | 0.999971 | 5.066397 |
ef9c340f-63a9-4c49-8ffb-25ff905664ac | Code-Disk/CSES-Introductory-Problems | Two_Sets.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll n = 0;
cin >> n;
ll sum = 0;
vector<ll> set1, set2;
sum = (n * (n + 1)) / 2;
if (sum % 2 == 0)
{
cout << "YES\n";
ll mid = sum / 2;
... | ALGO | 0.999912 | 3.841831 |
8fde33ad-90fa-401a-8c94-0180e68734cc | elmergustavo/ProgramasC | Programas en C++/ejercicios de vectores/ejercicio 2/main.cpp | //escriba un programa que defina un vector de numeros y calcule la multiplicacion acumulada de sus elementos
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int numero[]={1,2,3,4,5,6};
int resultado=1;
for (int i=0; i<6; i++)
{
resultado=resultado * numero[i];
... | ALGO | 0.998634 | 3.49502 |
0182ee2c-f584-4afa-bf3f-9b363ba83577 | sarvex/leetcode-ion | solution/1200-1299/1257.Smallest Common Region/Solution.cpp | class Solution {
public:
string findSmallestRegion(vector<vector<string>>& regions, string region1, string region2) {
unordered_map<string, string> m;
for (auto& region : regions)
for (int i = 1; i < region.size(); ++i)
m[region[i]] = region[0];
unordered_set<stri... | ALGO | 0.999982 | 5.652899 |
cc64cef8-35ee-4c7e-b6c6-0329830bfdb9 | AJAMEY77/gfg_potd | Bal_Tree.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// Tree Node
struct Node {
int data;
Node* left;
Node* right;
};
// Utility function to create a new Tree Node
Node* newNode(int val) {
Node* temp = new Node;
temp->data = val;
temp->left = NULL;
... | ALGO | 0.99938 | 6.870855 |
a6abdd75-3e55-4c2b-b3ea-a1d3b478dde6 | naonao-cola/MyQt | qt5ch20/OpenCV_3.4.3-Source/modules/cudafeatures2d/src/brute_force_matcher.cpp | #include "precomp.hpp"
using namespace cv;
using namespace cv::cuda;
#if !defined (HAVE_CUDA) || defined (CUDA_DISABLER)
Ptr<cv::cuda::DescriptorMatcher> cv::cuda::DescriptorMatcher::createBFMatcher(int) { throw_no_cuda(); return Ptr<cv::cuda::DescriptorMatcher>(); }
#else /* !defined (HAVE_CUDA) */
namespace cv {... | TOOL | 0.961213 | 7.720017 |
959d6f09-dfea-443c-81ef-c0229b14e130 | Darthpwner/Algorithms | Algorithms/Dutch National Flag Problem/Dutch National Flag Problem/main.cpp | #include <iostream>
void swap(int *a, int *b)
{
int temp = *a;
*a = *b;
*b = temp;
}
/* Utility function to print array arr[] */
void printArray(int arr[], int arr_size)
{
printf("array after segregation ");
int i;
for (i = 0; i < arr_size; i++)
printf("%d ", arr[i]);
printf("\n\n"... | ALGO | 0.999954 | 5.056959 |
4c62695c-41e9-47bd-a956-5b1a9400943b | quanglm1998/competitive-programming | opencup/XXI/Krakow/g.cpp | #include <bits/stdc++.h>
using namespace std;
// debugger, source: tourist
template <typename A, typename B>
string to_string(pair<A, B> p);
string to_string(const string &s) { return '"' + s + '"'; }
string to_string(const char *s) { return to_string((string)s); }
string to_string(bool b) { return (b ? "true" : "fal... | ALGO | 0.999962 | 5.184726 |
08d687ac-bfc3-4bbf-a58f-6b4ef6861b15 | alimirza093/Cpp-Course | Templates in Cpp/Basic Template/template_sith_multi_perameters.cpp | #include <iostream>
using namespace std;
template <class T1 , class T2>
class sum{
public:
T1 num1 ;
T2 num2;
T2 calSum(void){
return num1 + num2;
}
};
int main() {
sum <int , float> s1;
s1.num1 = 5.4;
s1.num2 = 9.1;
cout<<"Sum = "<<s1.calSum();
return 0;
} | TOOL | 0.942224 | 4.730735 |
36c298b4-657d-4c62-af1b-b567f590b641 | Katsudon10/Competitive-programming | Atcoder/ABC/ABC072/d.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define ALL(a) (a).begin(),(a).end()
const int inf = INT_MAX;
using ll = long long;
const ll INF = 1e18;
using P = pair<int,int>;
struct Edge{
int to;
ll cost;
Edge(int to,ll cost):to(to),cost(cost){}
};
using Graph = vecto... | ALGO | 0.999842 | 3.775142 |
8b8bd49d-1304-4aef-8bce-7ecb77b477e8 | ujjwal-45/codeforces | B_Burglars_and_matches.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define endl '\n'
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep1(i, n) for (int i = 1; i <= n; i++)
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
const ll mod = 1000000007;
struct Container
{
int matchesPerBox;
... | ALGO | 0.999976 | 4.65743 |
9aa7b0dd-c2ff-4400-ad53-920fbe340250 | Abheast12/programming-contests | codeforces/1025/A.cpp | #include<iostream>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<algorithm>
#include<tuple>
#include<random>
#include<numeric>
#include<string>
#include<cmath>
#define int long long
using namespace std;
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
ci... | ALGO | 0.999894 | 4.363131 |
4705efe0-7189-4a12-b497-38c8ac318499 | Yawn-Sean/Daily_CF_Problems | daily_problems/2025/02/0207/personal_submission/cf1017c_tsreaper.cpp | #include <bits/stdc++.h>
#define MAXN ((int) 1e5)
using namespace std;
int n, A[MAXN + 5];
int calc(int x) {
return x + (n + x - 1) / x;
}
int main() {
scanf("%d", &n);
int s = sqrt(n), best = s;
for (int i = max(1, s - 2); i <= min(n, s + 2); i++)
if (calc(i) < calc(best)) best = i;
for ... | ALGO | 0.999984 | 3.44359 |
9ce6441d-8b9b-4bdc-9f28-d571bda235e0 | AshishKhatkar/Codechef | NOV14/DISCHAR.cpp | /*
ID: ashish1610
PROG:
LANG: C++
*/
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD 1000000007
void solve_subtask1_subtask2(string str)
{
int ar[26];
memset(ar,0,sizeof(ar));
int len=str.length();
for(int i=0;i<len;++i)
ar[str[i]-'a']++;
int ans=0;
for(int i=0;i<26;++i)
if(a... | ALGO | 0.999922 | 4.371644 |
7d06d1a0-a8af-4b82-835b-e0ca6d922bd8 | 1xingao/1xingao | leetcode/141.环形链表.cpp | /*
* @lc app=leetcode.cn id=141 lang=cpp
*
* [141] 环形链表
*/
// @lc code=start
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
bool hasCycle(ListNode *head) {
if(!head |... | ALGO | 0.999793 | 5.71871 |
95e93606-c3bc-4a38-bb16-cac8ecc5c73f | bkaradzic/bgfx | 3rdparty/glsl-optimizer/src/glsl/lower_if_to_cond_assign.cpp | /**
* \file lower_if_to_cond_assign.cpp
*
* This attempts to flatten if-statements to conditional assignments for
* GPUs with limited or no flow control support.
*
* It can't handle other control flow being inside of its block, such
* as calls or loops. Hopefully loop unrolling and inlining will take
* care of... | ALGO | 0.945367 | 8.080283 |
a3552b8a-ae9a-45b2-a677-0a5c3cee19c4 | Amod03/Leetcode | 1547-minimum-cost-to-cut-a-stick/1547-minimum-cost-to-cut-a-stick.cpp | class Solution {
public:
int minCost(int n, vector<int>& cuts) {
int c=cuts.size();
cuts.push_back(n);
cuts.insert(cuts.begin(),0);
sort(cuts.begin(),cuts.end());
vector<vector<int>>dp(c+2,vector<int>(c+2,0));
for(int i=c;i>=1;i--)
{
for(int j=1;j<... | ALGO | 0.999876 | 5.673589 |
905fd4c1-15a9-4f31-ac89-630e135838ea | TohaRhymes/algo_and_ds_itmo_spring2020 | Block3_data_structures/p3214_AChangalidi_1628_white.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool columns_compare(pair<int, int> p1, pair<int, int> p2) {
if (p1.second != p2.second)
return p1.second < p2.second;
return p1.first < p2.first;
}
bool rows_compare(pair<int, int> p1, pair<int, int> p2) {
if (p1.fir... | ALGO | 0.999919 | 3.816058 |
58a5da36-a261-4692-96d8-d6ccbd1814cd | Zhenghao-Liu/LeetCode_problem-and-solution | 1828.统计一个圆中点的数目/solution.cpp | class Solution {
public:
vector<int> countPoints(vector<vector<int>>& points, vector<vector<int>>& queries) {
int sz=queries.size();
vector<int> ans(sz);
for (int i=0;i<sz;i++) {
int a=queries.at(i).at(0),b=queries.at(i).at(1);
int len=queries.at(i).at(2)*queries.at(i... | ALGO | 0.999734 | 5.53194 |
8db3cee3-97bf-4d9f-bdb2-cb477e1d7fff | suncoin-network/suncoin-core | src/pubkey.cpp | #include "pubkey.h"
#include <secp256k1.h>
#include <secp256k1_recovery.h>
namespace
{
/* Global secp256k1_context object used for verification. */
secp256k1_context* secp256k1_context_verify = NULL;
}
/** This function is taken from the libsecp256k1 distribution and implements
* DER parsing for ECDSA signatures, ... | TOOL | 0.948451 | 7.455348 |
d9cf94d2-fd9f-4cbb-a3c0-095c841048a6 | Syed-Waleed-Hussain/Data-Structure | Heap.cpp | #include<iostream>
using namespace std;
void maxheap(int arr[],int size,int i){
int largest = i;
int left = i * 2 +1;
int right = i * 2 +2;
if(left > size && arr[left] > arr[largest]){
largest = left;
}
if(right > size && arr[right] > arr[largest]){
largest = right;
}
... | ALGO | 0.999746 | 4.32576 |
e081b7b8-b3f2-4c61-aaf3-bb793033ca2e | manikanta2901/ubuntu | .history/practice/hackerEarth/MonkAndHisFriends_20200723145053.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#define vv vector
#define F first
#define S second
#define MP make_pair
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define printM... | ALGO | 0.999631 | 3.028337 |
07282e7b-46e5-4fa9-bb94-2dbed2076d1e | lunaisnotaboy/MacApp | MacApp/Apple C++ Frameworks/Network/Libraries/Text/ParseTools.cpp | /*
Change History
10/14/99 Added SkipPastCRLF and SkipToCRLF. Added some consts.
10/13/99 Adopted by MacApp.
Originally written by: the cyberdogs
*/
#ifndef __ParseTools__
#include "ParseTools.h"
#endif
// Network
#ifndef __ASCII__
#include "ASCII.h"
#endif
// Toolbox
#include <OSUtils.h>
// ANSI
#ifndef... | TOOL | 0.988469 | 4.149496 |
dcbdfd1d-ac04-42cf-88ca-44cd932e8d71 | blockspacer/chrome-view | chrome/src/buildtools/third_party/libc++/trunk/test/std/containers/associative/multiset/lower_bound.pass.cpp | // <set>
// class multiset
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
#include <set>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.hpp"
int main()
{
{
typedef int V;
typedef std... | TEST | 0.925566 | 4.928567 |
3670c7c7-a1f7-4903-bdfd-9040a2190871 | terra-quantum-public/tq42-pqc-oss | examples/aes/aes_ofb_example.cpp | #include <iostream>
#include <cstring>
#include <pqc/aes.h>
// parties can obtain a common key through asymmetric key exchange
// OFB
// OFB takes a fixed length iv, fixed-length key and
// fixed-length plaintext. Plaintext size MUST be multiple of AES_BLOCKLEN;
// Decryption works in the same way
// Party A enc... | ALGO | 0.999227 | 5.504383 |
c1833212-1d4d-4815-bbb7-e4bc251d8045 | openjdkgit/-jfx | modules/javafx.web/src/main/native/Source/ThirdParty/icu/source/common/umath.cpp | #include "putilimp.h"
U_CAPI int32_t U_EXPORT2
uprv_max(int32_t x, int32_t y)
{
return (x > y ? x : y);
}
U_CAPI int32_t U_EXPORT2
uprv_min(int32_t x, int32_t y)
{
return (x > y ? y : x);
}
| TOOL | 0.994576 | 5.317235 |
2a1b3ac2-f495-4a6b-b122-1f2eeee888e1 | evilArsh/LeetCodeMyself | 28.cpp | class Solution {
public:
int strStr(string haystack, string needle) {
int hs=haystack.size(),ns=needle.size(),index=-1;
if(ns==0){return 0;}
if(ns>hs){return -1;}
for(int i=0;i<hs-ns+1;i++){
int j=0;
for(;j<ns;j++){
if(haystack[i+j]!=needle[j])... | ALGO | 0.999942 | 5.798519 |
48921b01-c6de-4233-bb7a-ce1dd65fe5d3 | chucknology/boost-155 | boost_1_55_0/libs/graph/example/filtered_graph_edge_range.cpp | /*
Sample output:
filtered edge set: (A,B) (C,D) (D,B)
filtered out-edges:
A --> B
B -->
C --> D
D --> B
E -->
*/
#include <boost/config.hpp>
#include <iostream>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/filtered_graph.hpp>
#include <boost/graph/graph_utility.hpp>... | ALGO | 0.999161 | 6.295903 |
8b591084-b09a-4e4f-8ecc-d683ddd21409 | WenjieSun1996/PAT_Advanced | 1121~1159/1138.cpp | #include <bits/stdc++.h>
using namespace std;
vector< int > pre, in ,post;
int k;
void postOrder(int prel, int inl, int inr) {
if (inl > inr ) return;
int i = inl;
while (in[i] != pre[prel]) i++;
post[--k] = in[i];
postOrder(prel+i-inl+1, i+1, inr);
postOrder(prel+1, inl, i-1);
}
int main() {
... | ALGO | 0.999978 | 3.579823 |
d8f13073-2675-49ad-93db-1f8040640310 | Kishore121523/STL_KIshore | LinkedList/SinglyLL/Problems/SortLL.cpp | #include<bits/stdc++.h>
using namespace std;
class Node{
public:
int data;
Node* next;
public:
Node(int data1, Node* next1){
data = data1;
next = next1;
}
public:
Node(int data1){
data = data1;
next = nullptr;
}
};
Node* convertToLL(vector<int> &arr){
Node* head = new Node(arr[0... | ALGO | 0.999989 | 5.550663 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.