uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
2c612313-0106-460c-8616-0bc20de16364 | GrihsaIvanenko/code228 | Tinkoff_2019_2020/ТУРЫ/A.cpp | #include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) {
if (b == 0)
return a;
return gcd(b, a % b);
}
int main () {
int n;
cin >> n;
map<pair<int, int>, long long> q_of_lines;
map<pair<pair<int, int>, int>, long long> Flines;
long long sum = 0;
for (int i = 0; i ... | ALGO | 0.999694 | 3.792733 |
1b4745a6-98f2-4601-ab3c-4464e4259c48 | sakshi324/CPP-Program | constructBST.cpp | #include<iostream>
using namespace std;
struct Node{
int data;
struct Node* left;
struct Node* right;
Node(int val){
data=val;
left=NULL;
right=NULL;
}
};
Node* constructBST(int preorder[], int* preorderIdx, int key, int min, int max,int n){
if(*preorderIdx>=n){
return NULL;
... | ALGO | 0.999983 | 5.376841 |
136a2f36-2def-4a7d-b076-ce6a36da9dc2 | spa5k/LeetcodeCpp | src/21.merge-two-sorted-lists.cpp | /*
* @lc app=leetcode id=21 lang=cpp
*
* [21] Merge Two Sorted Lists
*/
#include <headers.h>
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) {}
};
// @lc code=start
/*... | ALGO | 0.999696 | 6.132439 |
8c63b13f-6852-4a81-9be6-a8a48b60473f | nqtwilford/Misc | CppShortCode/模板与包容器/Inserter.cpp | #include <iostream>
#include <vector>
#include <list>
#include <iterator>
using namespace std;
template <class T>
void print(const T &val)
{
cout<<val<<endl;
}
int main(int argc, char **argv)
{
vector<int> vec;
vec.push_back(1);
vec.push_back(2);
vec.push_back(3);
list<int> lst;
lst.push_back(0);
lst.push_ba... | TOOL | 0.940164 | 3.565726 |
fa257914-c592-4ba0-b00b-4f8fb8f22e53 | rhagenson/muscle | refinesubfams.cpp | #include "muscle.h"
#include "msa.h"
#include "tree.h"
#include "clust.h"
#include "profile.h"
#include "pwpath.h"
#define TRACE 0
static void ProgressiveAlignSubfams(const Tree &tree, const unsigned Subfams[],
unsigned uSubfamCount, const MSA SubfamMSAs[], MSA &msa);
// Identify subfamilies in a tree.
// Returns ... | ALGO | 0.981016 | 5.638768 |
3f20a5a9-af5e-4712-a5ca-68bf04f82e8e | Omar-26/Assiut_University_Training_Newcomers | Sheet #1 (Data type - Conditions)/X. Two intervals.cpp | #include <iostream>
using namespace std;
int main()
{
long long l1, r1, l2, r2;
cin >> l1 >> r1 >> l2 >> r2;
if (max(l1, l2) > min(r1, r2))
cout << -1;
else
cout << max(l1, l2) << " " << min(r1, r2);
} | ALGO | 0.999179 | 3.555661 |
980c6e93-e3af-477a-b208-e5697c3e36e0 | Rishabh-Pagaria/Data-Structures | Queue/linkedlist_implementation.cpp | #include <iostream>
using namespace std;
class node{
public:
int data;
node* next;
node(int val){
data = val;
next = NULL;
}
};
class queue{
public:
node* front;
node* back;
queue(){
front = back = NULL;
}
void push(int x){
node* n = new nod... | ALGO | 0.98849 | 4.330362 |
59adbcab-400b-4a5d-aea4-0f2777b6012c | ayushmorbar/Code-Directory | ADA/QuickSort.cpp | /*
* File: QuickSort.cpp
* Purpose: Perform a quick sort on an array of integers.
* Author: Ayush Morbar
* Date and Time: 14:58 IST March 12, 2024
*/
#include <iostream>
// Avoid using namespace std globally
// It can lead to name clashes in larger projects
// Function to swap two elements
void swap(int* a, in... | ALGO | 0.999938 | 6.324984 |
dd540b0a-ea0f-4b8d-8111-729b4e0f8617 | JakubSzwedowicz/Projects-CPP | Projects/Sieve_Of_Eratosthenes/main.cpp | #include <iostream>
#include <chrono>
#include "Functions.hpp"
std::ostream& operator<<(std::ostream& a_out, const std::vector<int>& a_data)
{
for(const int& k : a_data)
a_out << k << ' ';
return a_out;
};
class Timer
{
private:
std::chrono::system_clock::time_point start;
public:
void Start()... | TOOL | 0.937438 | 6.051077 |
650ccd31-45df-478d-be4c-c368ab0b04eb | HrishitDas2000/OpenCV | samples/cpp/camshiftdemo.cpp | #include "opencv2/core/utility.hpp"
#include "opencv2/video/tracking.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/videoio.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
#include <ctype.h>
using namespace cv;
using namespace std;
Mat image;
bool backprojMode = false;
bool selectObject = false;
int ... | ALGO | 0.963741 | 6.418211 |
f29e044f-8d13-4b10-a71e-d204d005cbde | prajwal12vr/dsa-flow | 3 STL/24_PriorityQueueStl.cpp | #include <iostream>
#include <queue>
using namespace std;
int main(){
//max heap
priority_queue<int>maxp;
//min heap
priority_queue< int,vector<int> , greater<int> >minp;
maxp.push(1);
maxp.push(3);
maxp.push(2);
maxp.push(0);
int n=maxp.size();
cout<<" The size of queue is ... | ALGO | 0.98793 | 4.278559 |
d4f881ac-c5f4-4a00-a15a-dfda4c108e91 | Sharmishtha1907/DSA-450 | Move All Negative Numbers To Beginning And Positive To End.cpp | #include <bits/stdc++.h>
vector<int> separateNegativeAndPositive(vector<int> &nums){
int p=0,i=-1;
{
for(int j=0;j<nums.size();j++)
{
if(nums[j]<p)
{
i++;
swap(nums[i],nums[j]);
}
}
}
return nums;
}... | ALGO | 0.99997 | 4.648051 |
74b47413-a739-44b6-b9c5-058f4464669a | danieltrt/SBFL | benchmarks/python/STACK_PERMUTATIONS_CHECK_IF_AN_ARRAY_IS_STACK_PERMUTATION_OF_OTHER.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <cstdlib>
#include <string>
#include <vector>
#include <queue>
#include <fstream>
#include <iomanip>
#include <vector>
#include <queue>
#include <map>
#include <unordered_map>
#include <set>
#incl... | ALGO | 0.999729 | 5.482403 |
3727d4f7-b061-44e5-a688-c7850b840e7d | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-coop-gpt4/Codenet/p00442/671067482/response_7.cpp | #include <algorithm>
#include <cstdio>
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define REP(i, n) FOR(i, 0, n)
typedef pair<int, int> pii;
int n, m;
vector<int> edge[5000];
int cnt[5000];
int main() {
cin >> n >> m;
REP(i, m) {... | ALGO | 0.999913 | 3.965414 |
4b895554-25a0-439e-bb82-293ca1825f63 | Sanidhya2101/Important-Algorithm | Heap/kth_smallest.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define ul unsigned long int
int getksmallest(vector<int>& a,int k)
{
priority_queue<int> p;
for(int i=0;i<a.size();i++)
{
p.push(a[i]);
if(p.size()>k)
p.pop();
}
return p.top();
}
int getklargest(vec... | ALGO | 0.999965 | 4.210956 |
28a17b82-645e-4189-a12b-d4223002177c | saniaahmad6/cpp | Recursion/hanoi.cpp | #include <iostream>
using namespace std;
void toh(int n,int source,int aux,int destination){
if (n==1) cout<<"MOVE DISK 1 form "<<source<<" to "<<destination<<endl;
else{
toh(n-1,source,destination,aux);
cout<<"MOVE DISK "<<n<<" from "<<source<<" to "<<destination<<endl;
toh(n-1,aux,source,destinat... | ALGO | 0.999353 | 4.286903 |
fde9e33e-4539-4b94-bc66-5b397bbbcda9 | XDEv11/Codeforces | Edu_Round_137/C.cpp | //#pragma GCC optimize ("O3")
#include <ios>
#include <iostream>
#include <vector>
#include <limits>
#include <algorithm>
using namespace std;
void solve() {
int n;
cin >> n;
vector<char> c(n);
vector<int> v(n);
for (auto& x : c) cin >> x;
for (auto& x : v) cin >> x;
int ans{0};
int i{0};
while (i < n && c... | ALGO | 0.999671 | 4.833412 |
a15ce43c-01b2-42e0-9910-63d4bd0efc0a | jeffnamkung/Burrtools | src/lib/tabs_1/generator_1.cpp | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "tablesizes.inc"
double matrix[NUM_TRANSFORMATIONS_MIRROR][9] = {
#include "rotmatrix.inc"
};
/* this matix contains the concatenation of 2 transformations
* if you first transform the piece around t1 and then around t2
* you can as well transform a... | ALGO | 0.999769 | 4.054005 |
cf833dc5-cd72-4ef0-801b-b31452e204b2 | ForestMS1/codetree-TILs | 240110/배열 놀이/play-with-array.cpp | #include <iostream>
using namespace std;
int main() {
// 여기에 코드를 작성해주세요.
int n,q;
cin >> n >> q;
int arr[101];
for(int i = 1; i <= n; i++) {
cin >> arr[i];
}
int num, arr_num,b;
for(int i = 0; i < q; i++) {
cin >> num >> arr_num;
if(num == 1) {
cout <... | ALGO | 0.999921 | 4.054318 |
a41bcc5c-fbad-4820-a510-58ebbbc8f70e | jondo/winmerge2011 | Src/editlib/verilog.cpp | #include "StdAfx.h"
#include "ccrystaltextview.h"
#include "ccrystaltextbuffer.h"
#include "SyntaxColors.h"
#include "string_util.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// Verilog keywords
static LPTSTR s_apszVerilogKeywordList[] =
{
_T ("always"),
... | TOOL | 0.877944 | 3.878224 |
72343cbc-b702-469f-8fbd-47308396c90f | sarvex/leetcode-nushell | solution/2100-2199/2167.Minimum Time to Remove All Cars Containing Illegal Goods/Solution.cpp | class Solution {
public:
int minimumTime(string s) {
int n = s.size();
vector<int> pre(n + 1);
vector<int> suf(n + 1);
for (int i = 0; i < n; ++i) pre[i + 1] = s[i] == '0' ? pre[i] : min(pre[i] + 2, i + 1);
for (int i = n - 1; ~i; --i) suf[i] = s[i] == '0' ? suf[i + 1] : min(... | ALGO | 0.999956 | 5.916837 |
ef93ca81-5338-4dde-b0c3-d9edb718179f | RafikEmad/EmbeddedLinux | 02_C++/06_Algorithms/02_Modifying/AlgP3.cpp | #include <iostream>
#include <algorithm>
#include <vector>
int main() {
std::vector<int> numbers = {1, 2, 2, 3, 4, 5, 2, 6, 7, 8, 9, 2, 10};
// std::replace: Replace all occurrences of a value with another value
std::replace(numbers.begin(), numbers.end(), 2, 20);
// std::replace_if: Replace elements... | ALGO | 0.998873 | 5.726453 |
4b079e1c-78e5-4796-999b-00291f8ccb2d | andreysusakov/Skillbox_Qt | Topic 15/Task_1/Task_1.cpp | #include <iostream>
#include <vector>
using namespace std;
int main()
{
vector <int> a = {1,2,3,-7,-5,6,7,-8,9};
int maxSum = 0;
int minInd = 0;
int maxInd = 0;
int start = 0;
int sum = 0;
int i = 0;
for (i = 0; i < a.size(); i++){
sum += a[i];
if (sum < 0){
... | ALGO | 0.999975 | 4.91856 |
48e25d23-d33c-45af-996a-94fdadb65cce | Avinash0308/LeetCode_POTD_2024 | 13_May_Score_After_Flipping_Matrix_Solution.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
int matrixScore(vector<vector<int>> &grid)
{
int n = grid.size(), m = grid[0].size();
int res = (1 << (m - 1)) * n;
for (int j = 1; j < m; j++)
{
int val = 1 << (m - 1 - j);
int set = ... | ALGO | 0.99991 | 5.918208 |
79fb7de8-fb89-422d-9506-e5cc598bdcae | theassassin010/Competitive-Programming | Codechef/Long Challenges/CHFTIRED.cpp | #include <iostream>
using namespace std;
int main(){
long a, b, t;
cin >> t;
while(t--){
cin >> a >> b;
cout << "YES" << endl;
}
} | ALGO | 0.999758 | 4.298502 |
8fafbf96-61ed-4d33-b239-5fac82987bef | Md-sakib-al-hasan/c_push_push_1 | Module seven/sort.cpp | #include<bits/stdc++.h>
using namespace std;
class Student {
public:
string name;
int mark ;
int bach;
};
int main()
{
int n=4;
Student ar[n];
for(int i=0;i<n;i++){
getline(cin,ar[i].name);
cin>>ar[i].mark>>ar[i].bach;
cin.ignore();
}
for(int i=0;i<n;i++){
cout<<ar[i].name<<"... | ALGO | 0.999406 | 3.938231 |
46794144-0f45-4bb8-9a78-7c743e40727c | leeseooo/boj | 1743.cpp | #include<iostream>
#include<algorithm>
#include<vector>
#include<queue>
#include<set>
#include<memory.h>
using namespace std;
int n, m, k;
int arr[101][101];
bool visit[101][101];
int dx[4] = { -1,1,0,0 };
int dy[4] = { 0,0,-1,1 };
queue<pair<int, int>>q;
int ans = 0;
void bfs(int a,int b) {
int size = 1;
q.push({ a,... | ALGO | 0.999933 | 4.018794 |
ba08562f-c2a8-4384-92d3-64ec285218c5 | makspll/mini-physics-engine | src/RigidBodyGravity.cpp | #pragma once
#include "MathFunctions.h"
#include "RigidBodyGravity.h"
using namespace phy;
RigidBodyGravity::RigidBodyGravity(RigidBody* attractor, const real gravityConstant)
: attractor(attractor), G(gravityConstant) {}
void RigidBodyGravity::updateForce(
RigidBody *body,
const real timeDelta)
{
//if the body... | ALGO | 0.967638 | 4.852991 |
93b87a1c-a257-4e16-84e6-ffada9eeade4 | hhaewon/baekjoon | unsolved/13705.cpp | #include <iostream>
#include <cmath>
const double PI = 3.14159265358979323846;
using namespace std;
typedef long long ll;
ll A, B, C;
int n = 100;
long double sint(long double x)
{
x = fmod(x, 2 * PI);
if (x > PI)
x -= 2 * PI;
else if (x < -PI)
x += 2 * PI;
long double result = 0;
... | ALGO | 0.999716 | 3.911172 |
b0b4657a-2993-45ae-8be9-83ac49faffe1 | suffianhamzah/CS106X-C- | Huffman/lib/StanfordCPPLib/dawglexicon.cpp | /*
* File: dawglexicon.cpp
* ---------------------
* A lexicon is a word list. This lexicon is backed by two separate data
* structures for storing the words in the list:
*
* 1) a DAWG (directed acyclic word graph)
* 2) a Set<string> of other words.
*
* Typically the DAWG is used for a large list read from a f... | TOOL | 0.907123 | 6.890213 |
45960c92-2ee4-4201-89ef-b50e112a45bf | he89302/leetcode | 394.decode-string.cpp | /*
* @lc app=leetcode id=394 lang=cpp
*
* [394] Decode String
*
* https://leetcode.com/problems/decode-string/description/
*
* algorithms
* Medium (57.53%)
* Likes: 9966
* Dislikes: 442
* Total Accepted: 596.3K
* Total Submissions: 1M
* Testcase Example: '"3[a]2[bc]"'
*
* Given an encoded string, ... | ALGO | 0.999313 | 7.286237 |
0558ff9b-bfd6-46ae-adcc-3a39f41bf16d | ar1nd0m/ar1nd0m | algorithm/cycle_detection_using_dfs_in_directed_graph.cpp | #include<bits/stdc++.h>
using namespace std;
bool ans=0;
bool visited[1005]={0};
bool path[1005];
vector<int> v[1005];
void dfs(int src){
visited[src]=1;
path[src]=1;
for(auto child:v[src]){
if(path[child]){
ans=1;
}
if(!visited[child]){
dfs(child);
}
... | ALGO | 0.999974 | 4.022038 |
23a8a780-e6c2-4221-9ddc-45388aa94fb5 | shraddhaekhande/my_project | book_library.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;
// Book structure to hold book information
struct Book {
string title;
string author;
string ISBN;
bool available;
string studentName;
double price;
};
// Library class to manage books
class Libr... | TOOL | 0.959194 | 7.520124 |
4d5eef04-9ba0-4eab-9b58-4bbe3eb6d574 | blockpeople/c-code | 【例4.3】输出奇偶数之和.cpp | #include<iostream>
using namespace std;
int main(){
int n,sum=0,sum2=0;
cin>>n;
for(int i=0;i<=n;i++){
if(i%2==0){
sum+=i;
}
else{
sum2+=i;
}
}
cout<<sum<<" "<<sum2;
return 0;
}
| ALGO | 0.999648 | 3.062821 |
d024f6d1-0ced-46de-a4fc-d1519bbf5722 | Fela-Slavenburg/coding-file-examples- | Flutter opdrachten/tableapp/windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.996585 | 6.76775 |
b89bf242-5439-488b-ad37-2778a818b37d | shRamim13/Algorithem-and-Data_Structure | Algo_graph_tree/New folder/ConnectedComponent_SHOW_CC_HOW_manyCycle.cpp | #include <bits/stdc++.h>
using namespace std;
#define MX 100000
bool vis[MX];
vector<int> G[MX];
vector<vector<int>> cc;
vector<int> current_cc;
void dfs(int source)
{
vis[source] = 1;
current_cc.push_back(source);
for (int child : G[source])
{
if (vis[child] == 1)
continue;
... | ALGO | 0.999981 | 4.870553 |
db1b71f4-a815-4337-8654-5bd511cd5936 | ishandutta2007/codeforces | kroosthekeenglint/normal/1701/A.cpp | #include<set>
#include<map>
#include<list>
#include<queue>
#include<stack>
#include<string>
#include<math.h>
#include<time.h>
#include<vector>
#include<bitset>
#include<memory>
#include<utility>
#include<fstream>
#include<stdio.h>
#include<sstream>
#include<iostream>
#include<stdlib.h>
#include<string.h>
#include<algor... | ALGO | 0.999575 | 3.356588 |
e76eaa03-94d1-4c2a-9653-cb2cd260235a | Mythili007/CodePractice | GeeksForGeeks/Easy/getPrimeFactorsOfNum.cpp | /*
* https://practice.geeksforgeeks.org/problems/largest-prime-factor2601/1
*/
#include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
vector<long long int> getPrimeFactors(int num)
{
vector<long long int> v;
while (num % 2 == 0)
{
v.push_back(2);
... | ALGO | 0.999929 | 4.911508 |
5549f02d-046f-40ec-9393-f2b0f3abced8 | ishandutta2007/codeforces | raveman/normal/273/B.cpp | #include<iostream>
#include<algorithm>
#include<cstdio>
#include<complex>
#include<vector>
#include<set>
#include<map>
#include<cmath>
#include<queue>
#include<string>
#include<cstdlib>
#include<memory.h>
#include<ctime>
using namespace std;
typedef long double ld;
typedef long long ll;
typedef pair<int,int> pii;
ty... | ALGO | 0.999991 | 3.751558 |
958f055c-fcce-4264-af76-05fdca93e7fe | GaisaiYuno/OI-Record-exe-deleted | Grade 10-12/2018 autumn/NOIP/NOIP2018提高组Day2程序包/answers/GD-0516/game/game.cpp | #include<cstdio>
#define mod 1000000007
using namespace std;
long long n,m,tmp,ans,
f[300],last[300];
int main()
{
freopen("game.in","r",stdin);
freopen("game.out","w",stdout);
scanf("%lld%lld",&n,&m);
if (n==3&&m==3){
printf("112");
return 0;
}
for (int i=0;i<(1<<n);i++)last[i]=1;
for (in... | ALGO | 0.999988 | 3.474415 |
5158f77e-49ec-4a03-b54b-8720bc734526 | MohammadAli1010/DSA-Practice | remove_smallest.cpp | #include <iostream>
using namespace std;
int main()
{
int arr[5];
for (int i = 0; i < 5; i++)
{
cin >> arr[i];
}
int smallest = INT16_MAX;
for (int i = 0; i < 5; i++)
{
if (arr[i] < smallest)
{
smallest = arr[i];
}
}
cout << "The smallest ... | ALGO | 0.992953 | 3.414859 |
c0a3bb26-7708-476d-ac14-08a103130f1f | maheshkumarsingh/PBC | CppAdvanceLearning/BasicScaler/Coding_Logic/test.cpp | #include<bits/stdc++.h>
using namespace std;
int bar(int x , int y)
{
if(y ==0) return 0;
return (x + bar(x , y-1));
}
int foo(int x , int y)
{
if(y==0) return 1;
return bar(x, foo(x, y-1));
}
int main()
{
system("cls");
cout<<foo(3,5);
return 0;
} | ALGO | 0.999876 | 4.13778 |
9cdd083a-325b-4208-9fff-60dff2b2096b | rainbow-auto/rainbow-codes | Comp/22-11-19 LGR2/test.cpp | #include <iostream>
#include <string>
#include <map>
#include <queue>
#include <vector>
using namespace std;
int main ()
{
priority_queue <int> q;
q.push(1);
q.push(2);
q.push(3);
cout << q.top() << endl;
return 0;
}
| ALGO | 0.998514 | 3.355956 |
b0392115-5093-4c4b-a69b-124665b80e48 | beehive-lab/Maxine-Graal | src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp | #include "precompiled.hpp"
#include "classfile/symbolTable.hpp"
#include "classfile/systemDictionary.hpp"
#include "code/codeCache.hpp"
#include "gc_implementation/parallelScavenge/generationSizer.hpp"
#include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
#include "gc_implementation/parallelScavenge/ps... | TOOL | 0.882162 | 6.557641 |
856a63c6-a917-480b-95e8-35b2b13749be | hussain-shahbaz/PF-SEM1 | Week09/PFL09/task12_cp.cpp | #include<iostream>
using namespace std;
bool isSpecial(int arr[],int size){
for(int i=0;i<size;i++){
if(i%2==0){
if(arr[i]%2 != 0) return false;
}
else{
if(arr[i]%2 == 0) return false;
}
}
return true;
}
int main(){
cout<<"Enter the size of the arr... | ALGO | 0.999094 | 4.183681 |
7adc0113-f8ec-409d-bf0b-9cf64b527fe3 | tersiteab/graph-reorder | omega/benchmarks/cc/graphit_compiled/std/cc_benchmark.gt__push-pull.gt__.cpp | #include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
#include "intrinsics.h"
#ifdef GEN_PYBIND_WRAPPERS
#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <pybind11/numpy.h>
namespace py = pybind11;
#endif
Graph edges;
int * __restrict IDs;
template <typename APPLY_FUNC , typena... | ALGO | 0.99929 | 5.274652 |
beecd99c-17c7-4a02-a767-59cf4443812f | crazy-kid/learning-boost | boost_1_88_0/libs/graph/example/topo-sort-file-dep2.cpp | using namespace boost;
namespace std
{
template < typename T >
std::istream& operator>>(std::istream& in, std::pair< T, T >& p)
{
in >> p.first >> p.second;
return in;
}
}
typedef adjacency_list< listS, // Store out-edges of each vertex in a std::list
vecS, // Store vertex set in a std::vector
directe... | ALGO | 0.999507 | 5.506413 |
3db7c170-00bf-4361-97cc-7d898d40d6e1 | Sandip-Kanzariya/GFG-LeetCode | Easy/Pascal Triangle/pascal-triangle.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// #define ll long long
class Solution{
public:
vector<long long> nthRowOfPascalTriangle(int n) {
// code here
vector <vector <long long>> ans(n, vector <long long> (n, 1));
const lo... | ALGO | 0.999908 | 6.236403 |
9cc49e1f-1666-4cea-bb21-64106c79f23c | CaptainHarryChen/OIerCode | CQBZOJ/2283转圈游戏.cpp | #include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int PowMod(int a,int b,int p)
{
int res=1;
while(b)
{
if(b&1)
res=1LL*res*a%p;
a=1LL*a*a%p;
b>>=1;
}
return res;
}
int main()
{
int n,m,k,x,ans;
scanf("%d%d%d%d",&n,&m,&k,&x);
... | ALGO | 0.999875 | 4.048386 |
05e235d0-48ff-443d-9262-716f6e377b8e | saraparva/FonamentsD-infromatica | C1_Ejemplo_examen4.cpp | #include <iostream>
using namespace std;
const int NomSort=3;
int main(){
float h,w,Wid,oro;
char complexio,sexe;
cout<<"Indica la teva alcada (cm), el teu pes (kg), la teva complexio (R,P,N) i el teu sexe (H,D): "<<endl;
cin>>h>>w>>complexio>>sexe;
if (1.12<(h/w) && (h/w)<3.80 && (sexe=='D'||sexe==... | ALGO | 0.995915 | 3.461228 |
8a2defc5-0b8d-48c5-bda7-bc071dc7e376 | sumniy/algorithm_study | samsung sw test/BOJ 16235 나무재테크/tree_ver3.cpp | // 기존 풀이법의 시간 복잡도를 개선한 버전
// 백준사이트의 다른 사람의 풀이를 참조
#include <iostream>
#include <stdio.h>
#include <fstream>
#include <vector>
using namespace std;
typedef pair < int, int> pii;
int N, M, Year;
int food[10][10];
vector<pii> ground[10][10];
int add_food[10][10];
int dr[8] = {-1, -1, 0, 1, 1, 1, 0, -1};
int dc[8] = {... | ALGO | 0.999873 | 4.225081 |
a6b005b8-b27b-416d-82d6-d394d511ea82 | ShuYuMo2003/Generative-Articulated-Object-s- | third_party/ManifoldPlus/3rd_party/eigen/test/visitor.cpp | #include "main.h"
template<typename MatrixType> void matrixVisitor(const MatrixType& p)
{
typedef typename MatrixType::Scalar Scalar;
Index rows = p.rows();
Index cols = p.cols();
// construct a random matrix where all coefficients are different
MatrixType m;
m = MatrixType::Random(rows, cols);
for(Ind... | TEST | 0.903063 | 6.376028 |
1470427a-7fd5-4604-81b4-9a0d61b77e1a | EdgarFx/CUHKSZ-CSC3002-EdgarFei | Assignment4/src/KnightsTour.cpp | /*
* File: KnightsTour.cpp
* ---------------------
* This program find a knight's tour on an N x M chessboard.
*/
#include <iostream>
#include <iomanip>
#include "grid.h"
using namespace std;
/* Function prototypes */
void solveKnightsTour(int n, int m);
void displayBoard(Grid<int> & board);
bool findKnightsTou... | ALGO | 0.999776 | 6.395998 |
2cc8320f-a294-4c44-9683-a4c8761407fe | KennethRuan/competitive-programming | DMOJ/dpb.cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
const int mxN = 1e5+5;
int n, k, dp[mxN], st[mxN];
int main(){
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
cin >> n >> k;
for (int i = 0; i < n; i++){
cin >> st[i];
}
for (int i = 1; i < n; i++){
dp[... | ALGO | 0.999963 | 4.471759 |
1e34926c-7342-4a09-92c1-173fc82542f1 | numenoreon/LeetCode | Top Interview Question Hard/ArrayAndStrings/FirstMissingPositive.cpp | class Solution {
public:
int firstMissingPositive(vector<int>& nums) {
map <int,int> mapping;
for(auto &i:nums){
mapping[i]++;
}
for(int i=1; i<INT_MAX ; i++){
if(mapping[i]==0)
return i;
}
return 0;
... | ALGO | 0.999809 | 5.250947 |
d53e8f09-d09d-47ae-a3f8-8382f6bbfd61 | Devil200207/Codeforces | Rating (0 -800)/Drinks.cpp | #include<bits/stdc++.h>
#define int long long int
#define mod 1000000007
using namespace std;
void solve()
{
int n;
cin>>n;
double ans = 0;
int* arr = new int[n];
for(int i=0;i<n;i++)
{
cin>>arr[i];
ans+= (arr[i]);
}
ans/=n;
//ans*=100;
cout<<setprecision(12)<<fixed<<ans<<'\n';
... | ALGO | 0.998422 | 4.103082 |
35175df2-89e4-4cc5-b051-ee676b4657e0 | Compiler-Dependency-Analysis/llvm-levioso | compiler-rt/lib/fuzzer/FuzzerCrossOver.cpp | #include "FuzzerDefs.h"
#include "FuzzerMutate.h"
#include "FuzzerRandom.h"
#include <cstring>
namespace fuzzer {
// Cross Data1 and Data2, store the result (up to MaxOutSize bytes) in Out.
size_t MutationDispatcher::CrossOver(const uint8_t *Data1, size_t Size1,
const uint8_t *Dat... | ALGO | 0.962249 | 6.084689 |
afb05301-4630-4946-a325-c20c444f3e76 | bhushanblaster/July-Leetcode-Challenge | 12.cpp | /*
Reverse Bits
Solution
Reverse bits of a given 32 bits unsigned integer.
Example 1:
Input: 00000010100101000001111010011100
Output: 00111001011110000010100101000000
Explanation: The input binary string 00000010100101000001111010011100 represents the unsigned integer 43261596,
so return 964176192 which its binary ... | ALGO | 0.999922 | 6.565222 |
00988747-edd6-4175-bfac-57c6a722df91 | alifakahr186/Data-Structures-and-Algorithms | Array/Insertion/InsertAtSpecifiedPosition.cpp | #include <iostream>
using namespace std;
int main() {
const int MAX_SIZE = 50;
int arr[MAX_SIZE];
int size, num, pos;
cout << "Enter the size of the array (max " << MAX_SIZE << "): ";
cin >> size;
if (size < 0 || size > MAX_SIZE) {
cout << "Error: Invalid size. Size must be be... | ALGO | 0.999597 | 5.324279 |
2673a2e3-3f0a-49bd-b03a-ca10d4afe270 | yujin1292/Solved-Algorithm-problem | BOJ/[백준] 13549 숨바꼭질 3/[백준] 13549 숨바꼭질 3/소스.cpp | #include<iostream>
#include<queue>
#define MAX 100001
using namespace std;
int n, k;
const int dx[2] = { -1, 1 };
bool visited[MAX];
queue<pair<int, int>> q;
int main() {
cin >> n >> k;
q.push({ n, 0 });
visited[n] = 1;
for (int i = 2; i * n <= MAX + 1; i *= 2) {
if (n == 0) break;
q.push({ i * n, 0 });
v... | ALGO | 0.999955 | 3.373125 |
2b2f94b0-b0e9-464f-a7bc-d808a4b169f0 | lmakinaa/cpp | module-08/ex00/main.cpp | #include "easyfind.hpp"
#include <iostream>
#include <vector>
int main()
{
int initX[] = {-1,1,2,3,4,5,6,7};
std::vector<int> x (initX, initX + 8);
std::vector<int>::iterator i;
try {
i = easyfind(x, 5);
}
catch (std::exception& e) {
std::cout << "Exception caught: " << e.what()... | ALGO | 0.892372 | 4.330399 |
0cb24b0c-648e-4cf7-8424-ca681b697efe | mrvanny/Cpp-All-concepts- | hybrid3.cpp | #include<iostream>
using namespace std;
class Student
{
protected:
int h1,s1,m1,h2,s2,m2;
public:
void satish(int,int,int);
void manish(int,int,int);
};
void Student::satish(int a,int b,int k)
{
h1=a;
s1=b;
m1=k;
//cout<<h1<<" "<<s1<<" "<<m1<<endl;
}
void Student::manish(int a,int b,... | ALGO | 0.994785 | 3.187424 |
bbeeff28-5691-4e35-bb6c-14dceff8afd3 | bit24/Competitive-Programming | Contests/JOI/commuter.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;
typedef pair<ll, ll> pl;
typedef vector<int> vi;
typedef vector<ld> vd;
typedef vector<ll> vl;
#define pb push_back
#define f first
#define s second
namespace debug {
const int DEBUG = true;
... | ALGO | 0.999881 | 5.260135 |
9fb7ee16-e7ad-4f91-b7cd-b96734c65fba | orehusLina/uni-bullshit | inf-proga/9. graphs/4.cpp | // Дан неориентированный граф. Определить содержит ли он циклы. Если да, то вывести их.
#include <iostream>
#include <vector>
#include <set>
#include <fstream>
#include <algorithm>
using namespace std;
ifstream in("test5.txt");
int n, m;
vector<vector<int>> g;
vector<int> used; // вектор посещенных вершин
vector<int> ... | ALGO | 0.999613 | 4.813838 |
3f702ab1-99fc-4f2f-933d-c548c5e9e175 | sheepduke/leetcode | src/74. Search a 2D Matrix/main.cpp | /*
Write an efficient algorithm that searches for a value in an m x n matrix. This
matrix has the following properties:
Integers in each row are sorted from left to right.
The first integer of each row is greater than the last integer of the previous row.
Example 1:
Input:
matrix = [
[1, 3, 5, 7],
[10, 11, 16... | ALGO | 0.9997 | 7.172285 |
60f6d35e-5d97-478f-a2f5-067c942d3d78 | Rupeshkumar4/CPP_DSA | Accenture/AutoBiographic.cpp | #include <iostream>
#include<map>
#include<set>
using namespace std;
int FinndAutoCount(string &n)
{
unordered_map<int,int>mp;
set<char>st;
for(int i=0;i<n.length();i++){
st.insert(n[i]);
mp[n[i]-'0']++;
}
int sz = n.length();
for(int i=0;i<sz;i++){
if(mp[i] != n[i... | ALGO | 0.999839 | 4.164042 |
c7485bc2-b6ad-4574-a7e3-f2ed0aaceac2 | eunaJung01/Algorithm-Solving | BOJ/KMP/BOJ1305.cpp | #include <iostream>
#include <string>
using namespace std;
int L;
string str;
int *pattern;
void findPattern() {
pattern[0] = 0;
int j = 0;
for (int i = 1; i < L; ++i) {
while (j > 0 && str[i] != str[j]) {
j = pattern[j - 1];
}
if (str[i] == str[j]) {
patte... | ALGO | 0.999947 | 4.370425 |
3bfe12dc-cde5-4339-be40-87168b40f05a | mateuszkp96/pobr-image-recognition | ImageUtils.cpp | #include "ImageUtils.h"
#include <algorithm>
#include <cmath>
#include <deque>
#include <iostream>
#include "Utils.h"
#include "Constants.h"
cv::Mat ImageUtils::changeContrast(cv::Mat &I, float percent) {
CV_Assert(I.depth() != sizeof(uchar));
switch (I.channels()) {
case 1:
for (int i = 0... | TOOL | 0.913797 | 6.146408 |
66ba8728-0868-4bd6-befd-c6b5d877edf2 | ShadmanAfzal/GFG-Algorithms | Dynamic Programming/0 1 Knapsack/main.cpp | #include <bits/stdc++.h>
using namespace std;
int findMaxProfit(vector<int> profit, vector<int> weight, int size, int W)
{
int dp[size+1][W+1];
for(int i=0;i<=size;i++)
{
for(int w=0; w<=W; w++)
{
if(i==0 || w==0)
{
dp[i][w] = 0;
}
... | ALGO | 0.999684 | 4.808128 |
74cbc27d-bfb5-4e46-a8c2-1ec0e2a6090c | abhi-pandey6/Coding-Practice-with-C-- | Practice Problems/31numOFword.cpp | // 31: Number of words in a text
#include<iostream>
#include<string>
using namespace std;
int main (){
string str;
int ch=0, word=0;
cout<<"Enter line of string: ";
getline(cin,str);
for(int i=0;str[i]!='\0';i++)
{
if(str[i]==' '){
word ++;
}
}
cout<<"total ... | ALGO | 0.998814 | 3.895064 |
eef3b7fc-533b-40f1-b8c5-b8223723d586 | stdcall0/code | LG/P4114.cpp | #include <cstdio>
#include <algorithm>
const int N = 1e5 + 5;
struct SegmentTree {
struct Node {
int L, R;
int l, r, v;
};
int c;
Node a[N * 4];
SegmentTree() {
c = 1;
}
void build(int l, int r, int *v, int x = 1) {
a[x] = {l, r, 0, 0, 0};
if (l == r) {
a[x].v = v[l];
... | ALGO | 0.999918 | 5.265466 |
a1374ea4-0f03-4ec7-a4b8-2a2b0da17364 | omtrivediw/Leetcode_Questions | MakeTheStringGreat.cpp | class Solution {
public:
string makeGood(string s) {
stack<char>string_stack;
string result = "";
for(int i = 0 ; i < s.length() ; i++){
if(!string_stack.empty()){
char topper = string_stack.top();
if(((int)topper - 32 == (int)s[i]) or ((int)topper + 32 ==... | ALGO | 0.999854 | 6.344294 |
e10a5e54-e0aa-4635-b8e3-87081de4f0e2 | tarikcoskun94/oop1-lesson-project-point-cloud | sourceCodes/eigen-3.3.7/doc/examples/Tutorial_ArrayClass_interop.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXf m(2,2);
MatrixXf n(2,2);
MatrixXf result(2,2);
m << 1,2,
3,4;
n << 5,6,
7,8;
result = (m.array() + 4).matrix() * m;
cout << "-- Combination 1: --" << endl << result << endl << e... | ALGO | 0.99967 | 4.531452 |
84e3b52f-7fe7-4b3f-9b45-ac88c554a782 | raymondtruongdev/WatchApp | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
934a0360-bb6e-40da-8f18-ade9f30d0ed9 | anishpawarrr/osl_lab | bankers.cpp | #include <iostream>
#include <vector>
using namespace std;
const int NUM_PROCESSES = 5;
const int NUM_RESOURCES = 3;
int available[NUM_RESOURCES] = {3, 3, 2};
int maximum[NUM_PROCESSES][NUM_RESOURCES] = {
{7, 5, 3},
{3, 2, 2},
{9, 0, 2},
{2, 2, 2},
{4, 3, 3}
};
int allocation[NUM_PROCESSES][NUM... | ALGO | 0.999917 | 6.338668 |
d38d99ab-6a61-443c-a126-b116163af53c | JorgeIba/Competitive-Programming-Problems | Training Camp 2023 Medellín/Contest 8/M.cpp | #include <bits/stdc++.h>
#define endl '\n'
#define lli long long int
#define ld long double
#define all(v) v.begin(), v.end()
#define fastIO(); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define SZ(s) int(s.size())
#define debugg(x) cerr << #x << " = " << x << endl;
#define forn(i, n) for(int i = 0; i < (... | ALGO | 0.99998 | 4.248476 |
b3f70049-13a8-432a-afdf-ec8e79c6bd96 | roggersanguzu/Data-Structures-And-Algorithms | Data Structures and Algorithms Folder/Linear And Binary Searchings/Deleting Using Binary.cpp | #include<iostream>
using namespace std;
int i,n;
double array[100];
void getvalues(){
cout<<"How Many Values Are you Entering: "<<endl;
cin>>n;
cout<<"Enter the Values: "<<endl;
for(i=0;i<n;i++){
cin>>array[i];
}
}
void print(){
cout<<"The Valuesa are: \n"<<endl;
for(i=0;i<n;i++){
cout<<array[i]<<" ";
}
}... | ALGO | 0.999803 | 4.03973 |
b1e5bd61-7414-4f12-89ea-7d7ee7ab6d2e | freesummer/SIMD-Matcher | boost-hana/example/functional/on.cpp | #include <boost/hana/first.hpp>
#include <boost/hana/functional/on.hpp>
#include <boost/hana/integral_constant.hpp>
#include <boost/hana/less.hpp>
#include <boost/hana/pair.hpp>
#include <boost/hana/plus.hpp>
#include <boost/hana/sort.hpp>
#include <boost/hana/tuple.hpp>
#include <boost/hana/type.hpp>
namespace hana = ... | TEST | 0.926004 | 5.05077 |
71826355-8437-4998-880e-86c32addee00 | jefferyyellow/UE4 | UnrealEngine-4.26/Engine/Plugins/Experimental/MeshModelingToolset/Source/ModelingOperatorsEditorOnly/Private/CompositionOps/VoxelBooleanMeshesOp.cpp | #include "CompositionOps/VoxelBooleanMeshesOp.h"
#include "Engine/StaticMesh.h"
#include "MeshDescription.h"
#include "StaticMeshAttributes.h"
#include "MeshDescriptionToDynamicMesh.h"
#include "MeshSimplification.h"
#include "MeshConstraintsUtil.h"
#include "CleaningOps/EditNormalsOp.h"
void FVoxelBooleanMeshesOp::... | ALGO | 0.878999 | 7.417083 |
2e513fcd-e879-46f5-95bb-ea6b706d275c | surajmate007/700_Topicwise_DSA_Solved_Problems | 07_Binary_Search_Tree/18_Check_preorder_is_valid_or_not.cpp | // This is not the actual code for this problem.
unordered_map<int, int> mp;
int idx = 0;
Node* formTree(int in[], int lo, int hi){
if(lo > hi){
return NULL;
}
Node* temp;
for(int k=lo; k<=hi; k++){
if(mp[in[k]] == idx){
temp = newNode(in[k]); idx++;
temp->... | ALGO | 0.999979 | 5.311518 |
b3e2f5e1-59e5-4e0d-af97-9c3181f6e110 | Nakib-Arman/CSE318---ArtificialIntelligence | 4.DecisionTree/.history/a_20250710011255.cpp | #include<bits/stdc++.h>
using namespace std;
class Node {
int column_num;
string label;
unordered_map<string,Node*> children;
float threshold;
public:
Node(int column_num){
this->column_num = column_num;
this->label = "";
this->threshold = 0;
}
Node(string labe... | ALGO | 0.99939 | 4.733817 |
ed82cc68-5330-4349-a4f9-f36ede6f50f0 | minnce/codechef | 1400-1600/superheroAndVillain.cpp | #pragma GCC optimize("O2,no-stack-protector,unroll-loops,fast-math")
#include <iostream>
#include <bits/stdc++.h>
#define ll long long
#define PB push_back
#define F first
#define S second
#define uset unordered_set
#define umap unordered_map
#define MP make_pair;
#define vt vector
#define all(x) begin(x), end(x)
#defi... | ALGO | 0.999235 | 3.560126 |
f2aadd2d-69cc-498d-918e-348b9d7281ac | ishandutta2007/codeforces | krk/normal/1165/F2.cpp | #include <bits/stdc++.h>
using namespace std;
const int Maxm = 400005;
int n, m;
int A[Maxm], B[Maxm];
vector <int> my[Maxm];
bool Okay(int d)
{
fill(B, B + Maxm, 0);
int b = 0;
int has = d;
for (int i = d; i > 0; i--) {
has = min(has, i);
for (int j = 0; j < my[i].size(); j++) {
... | ALGO | 0.999993 | 4.339865 |
86ccd7f3-9a55-45bb-82d1-5205ee572487 | neonwatty/udacity_mlnd_lab_face_detection | dlib-19.1/tools/imglab/src/cluster.cpp | #include "cluster.h"
#include <dlib/console_progress_indicator.h>
#include <dlib/image_io.h>
#include <dlib/data_io.h>
#include <dlib/image_transforms.h>
#include <dlib/misc_api.h>
#include <dlib/dir_nav.h>
#include <dlib/clustering.h>
#include <dlib/svm.h>
// ---------------------------------------------------------... | ALGO | 0.978199 | 6.823582 |
ee580692-e6b3-4178-b7f5-3610d7976f80 | ashita-agarwal/DSA-Practice-Cpp | Basics/patternTriangle.cpp | #include<iostream>
using namespace std;
int main(){
int i,j,N,val,space;
cin>>N;
for(i=0;i<N;i++){
//spaces
val=i+1;
for(space=1;space<(N-i);space++){
cout<<"\t";
}
//numbers
for(j=1;j<=((2*i)+1);j++){
if(j<=i){
cout<<val<<"\t";
val++;
}
else{
cout<<val<<"\t";
val--;
... | ALGO | 0.999929 | 3.405142 |
2e63b30a-cdd0-403c-9982-09fae7e82875 | MuxPotato/Parallel-Computing-CS3210- | Lab5/reduce.cpp | /**
* CS3210 - Collective communication in MPI.
*/
#include <mpi.h>
#include <cstdio>
#include <cstdlib>
int main(int argc, char *argv[])
{
int numtasks, rank, sendcount, recvcount, source;
MPI_Init(&argc,&argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &numtasks);
source = 0;
sen... | ALGO | 0.999553 | 3.779548 |
8fcd9ae0-ceb3-45e3-bfc1-a57959cef454 | weiweimonster/CS184 | p4-clothsim-sp22-heathcliff-4/ext/nanogui/ext/eigen/doc/examples/TutorialLinAlgComputeTwice.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix2f A, b;
LLT<Matrix2f> llt;
A << 2, -1, -1, 3;
b << 1, 2, 3, 1;
cout << "Here is the matrix A:\n" << A << endl;
cout << "Here is the right hand side b:\n" << b << endl;
cout << "Computing LLT... | ALGO | 0.99993 | 3.137396 |
8585dec7-7071-424f-9e43-45a10c3c5b0f | whuyao/GeoInversionApp | UrbanChangeCAIteration.cpp | #include "UrbanChangeCAIteration.h"
//#include "UrbanChangeProbabilityAnalysis.h"
#include "global_include.h"
#include "haplib.h"
#include "hapbegbase.h"
#include "HAPBEGThread.h"
#include "hapbegfactory.h"
#include <QtCore/QString>
#include <stdio.h>
#include <stdlib.h>
#include <QtCore/QStringList>
#include <QtCo... | ALGO | 0.982386 | 3.414649 |
1e5535d6-edaa-4de1-b250-c220b68a79d5 | luotuoqingshan/google-coding-contest | codejam/2019/Round1/B/a.cpp | #include <cstdio>
#include <cstring>
#include <algorithm>
#include <iostream>
using namespace std;
const int maxn = 1e5 + 5;
int X[maxn], Y[maxn];
int main(){
int T;
cin >> T;
int P, Q;
int cas = 0;
while(T--){
memset(X, 0, sizeof(X));
memset(Y, 0, sizeof(Y));
cin >> P >> ... | ALGO | 0.999955 | 3.396698 |
85101a17-f83d-4191-8e96-d7dc22a52a30 | anuj-singhh/question.cpp | countop.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cout<<"enter a number : ";
cin>>n;
int count=0;
// int a=n;
// while(n>0)
// {
// n/=10;
// count++;
// }
// if(a==0)cout<<1;
// else{cout<<count;
// }
while(n>0){
n/=10;
coun... | ALGO | 0.999565 | 3.667061 |
5480c8d1-22ec-4a32-9bb6-998645cb8885 | songhii/Algorithm | 16194/main.cpp | //
// main.cpp
// 16194
//
// Created by songhee on 2021/04/29.
//
#include <iostream>
#include <algorithm>
#define MAX 1000+1
using namespace std;
int N;
int P[MAX], dp[MAX];
int main(int argc, const char * argv[]) {
scanf("%d", &N);
for(int i = 1; i <= N; i++) scanf("%d", &P[i]);
for(int i = 1; i <=... | ALGO | 0.999402 | 4.095179 |
b3b93d51-2a80-43b0-a116-2e0c27ffa5a0 | mkp0/CP | Greedy/Job sequencing Problem.cpp | #include <bits/stdc++.h>
using namespace std;
class Job
{
public:
int deadline;
int profit;
};
bool comp(Job a, Job b)
{
if (a.deadline < b.deadline)
{
return true;
}
if (a.deadline == b.deadline)
{
if (a.profit > b.profit)
{
return true;
}
... | ALGO | 0.999922 | 5.618421 |
aa31e8ff-b40d-4df2-88ba-bf7e76db204e | hungryrag/CP | Practice/petya_and_strings.cpp | #include<bits/stdc++.h>
using namespace std;
void solve();
int main()
{
ios_base::sync_with_stdio(false); cin.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("error.txt", "w", stderr);
freopen("output.txt", "w", stdout);
#endif
int t = 1;
//cin>>t;
while (t--)
... | ALGO | 0.999997 | 4.25957 |
4768e904-4a6b-42cd-8a59-53c60a1ba63d | ishandutta2007/codeforces | songsenteringdream/normal/1706/D2.cpp | #include<cstdio>
#include<iostream>
using namespace std;
const int o=1e5+10;
int T,n,k,c[o],ans,st[o],tp;
int main(){
for(scanf("%d",&T),st[0]=o*100;T--;printf("%d\n",ans)){
scanf("%d%d",&n,&k);ans=o;
for(int i=0;i<o;++i) c[i]=i+1;
for(int a;n--;tp=0){
scanf("%d",&a);
for(int i=1;i<=k&&i<=a;i=a/st[tp]+1) s... | ALGO | 0.999661 | 3.103177 |
95dbcf07-eaaa-4238-9073-67b17072bcd5 | fyzel527/UnrealEngine-4.24Toon | Engine/Source/ThirdParty/CryptoPP/5.6.5/include/ida.cpp | // ida.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "config.h"
#include "ida.h"
#include "algebra.h"
#include "gf2_32.h"
#include "polynomi.h"
#include "polynomi.cpp"
#include <functional>
ANONYMOUS_NAMESPACE_BEGIN
static const CryptoPP::GF2_32 field;
NAMESPACE_END
NAMESPACE_B... | ALGO | 0.969631 | 5.839145 |
2dcf9689-e8f8-4fce-b329-965ee583758a | IbrahimMasalubu/Pemrograman-Terstruktur | PERTEMUAN KE-9 FUNGSI/C++LatihanPenjumlahan.cpp | #include <iostream>
using namespace std;
// untuk menambah data
int tambah(int a, int b) {
return a + b;
}
// fungsi utama
int main() {
// panggil fungsi
int bilA, bilB;
cout <<"Masukkan Nilai Pertama : ";
cin >> bilA;
cout <<"Masukkan Nilai Kedua : ";
cin >> bilB;
int hasil = tambah(b... | ALGO | 0.891209 | 3.512578 |
a8c6358f-26a3-4126-a185-a3165b4cd067 | shimanshu16/LeetCode-Solved-Questions | 0160-intersection-of-two-linked-lists/0160-intersection-of-two-linked-lists.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* getIntersectionNode(ListNode* headA, ListNode* headB) {
if (!headA || !headB) return nullptr;
ListNode* p... | ALGO | 0.9999 | 5.535618 |
4e6c6532-bca7-4002-aade-80fe48f10b92 | Man-kaur/GeeksForGeeks | SearchInARowColumnSortedMatrix.cpp | bool matSearch(vector<vector<int>> &mat, int ele) {
int n = mat.size();
int m = mat[0].size();
for(int i=0;i<n;i++){
if(ele <= mat[i][m-1]){
int start = 0, end = m-1;
while(start<=end){
int mid = start + (end-start)/2;
... | ALGO | 0.99962 | 4.91889 |
c90f0bdf-64dc-4a35-9eee-27aa85058669 | md-mohabbat-ezekiel/Phitron-3 | Data structure/module 2.5/Y_Range_sum_query.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int N, Q;
cin >> N >> Q;
vector<int> A(N);
for (int i = 0; i < N; i++)
{
cin >> A[i];
}
vector<int> P(N + 1, 0); // Prefix sum array
for (int i = 1; i <= N; i++)
{
P[i] = P[i - 1] + A[i - 1];
}
... | ALGO | 0.999913 | 5.282025 |
469702a4-da81-447c-818b-dd05f4285e49 | archelogos/CarND-MPC-Project | src/Eigen-3.3/doc/examples/TutorialLinAlgExComputeSolveError.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXd A = MatrixXd::Random(100,100);
MatrixXd b = MatrixXd::Random(100,50);
MatrixXd x = A.fullPivLu().solve(b);
double relative_error = (A*x - b).norm() / b.norm(); // norm() is L2 norm
cout << "The ... | ALGO | 0.99955 | 3.625966 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.