uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
feb7e3d8-2c38-4673-a6bf-06cc73d6aed3 | ramalloc/A2Z-DSA | Step-4/BS22.cpp | // K-th element of two sorted arrays
/*
-> We have given two arrays, both are sorted. So we need to merge them hypothetically and get an array which is int sorted order.
-> At last we have to return the kth element from the combined hypothetical array, {k} also given.
*/
/*
-> We are using same concept of median here. ... | ALGO | 0.999986 | 5.779294 |
b301b822-b5be-47b8-a8f9-e3c2f57a1cce | Krishnapatil28113/Placements | A2Z Sheet/LinkedList/Hard Problems of Linked List/flattening_a_LL.cpp | /*
# Question Link: https://www.naukri.com/code360/problems/flatten-a-linked-list_1112655
# Problem Statement: Flatten a given Linked List
# How to think:
* Firstly, we should think about solving a smaller part of the problem, like, flattening a smaller part of the linked list, in this case
* After we have figured out... | ALGO | 0.999991 | 5.717121 |
a23bdab7-8ca1-4d16-af3f-0d83694d8ee0 | kapil4457/Contests | AtCoder Contests/AtCoder Beginner Contest 303/.history/C_Dash_20230527182647.cpp | #include <bits/stdc++.h>
#define ll long long int
#define pb push_back
#define mod 1000000007ll //998244353ll
#define mii map<int, int>
#define pii pair<int, int>
#define TEST int t=1;while(t--)
int power(int a,int b){int result =1; while(b>0){if(b%2) result*=a; a*=a;b/=2;} return result;}
using namespace std;
void Sol... | ALGO | 0.999985 | 3.940803 |
2ed9c279-8fbd-477d-87f0-6460c88db87c | ishandutta2007/codeforces | roki/normal/261/A.cpp | #pragma comment(linker, "/STACK:167177216")
#include<stdio.h>
#include<stack>
#include<math.h>
#include<time.h>
#include<iostream>
#include<algorithm>
#include<string.h>
#include<string>
#include<set>
#include<memory.h>
#include<vector>
#include<map>
#include<queue>
using namespace std;
typedef long long li;
#defin... | ALGO | 0.999958 | 3.11037 |
c80f8023-7bd4-491e-a474-4a3c7d06fa2b | Oaik/problems-solution | codeforces/contest/372/b/60232853.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define clr(a,b) memset(a,b,sizeof(a))
#define all(v) ((v).begin()),((v).end())
#define read freopen("input.in", "rt", stdin);
#define write freopen("output.in", "wt", stdout);
#define fastIO cout << fixed << setprecision(0), ios::sync_with_stdio(false)... | ALGO | 0.99938 | 4.376607 |
ae542057-796c-4790-ba11-9ccc950d72e2 | arin2002/Hacktoberfest-2022 | C++/LeetCode/1288.remove-covered-intervals.cpp | using interval = vector<int>; // length 2
// [1, 3] and [1, 19]
// [1, 19] can contain [1, 3]
bool comparator(const interval &left, const interval &right) {
if(left[0] == right[0])
return left[1] > right[1];
return left[0] < right[0]; // asc order of starting time
}
class Solution {
public:
int rem... | ALGO | 0.999818 | 5.798512 |
f6953e34-3c4e-426b-92d6-4df92c041444 | anindiangeek/450DSA | Graphs/DFS.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
bool CheckForCycle(int Node, int Parent, vector<int> &vis, vector<int> adj[])
{
vis[Node] = 1;
for (auto x : adj[Node])
{
if (!vis[x])
if (Chec... | ALGO | 0.999962 | 6.116973 |
76a346b8-f63c-4fe7-8485-9123d71ca400 | clouds440/RandomPrograms | stack.cpp | #include<iostream>
using namespace std;
class stack {
private:
int data[5];
int top;
public:
stack(){
top = -1;
}
void push(int value){
if (top == 4){
cout<<"Stack overflow!";
}
else{
top++;
data[top] = value;
cout<<"Value inserted!\n";
cout<<"Data = "<<data[... | ALGO | 0.995208 | 4.059042 |
aa0e1a94-5fda-4fa5-ab33-327fbb55e5b4 | ARAFATH-SH/Problem-Solving | CSES Problem Set/Sorting and Searching/Factory Machines.cpp | #include<bits/stdc++.h>
using namespace std;
const int N =2e5+7;
int a[N];
int n,x;
bool products(long long int y){
long long int sum = 0;
// cout<<x<<'\n';
for(int i=1; i<=n; i++){
sum+= y/a[i];
if(sum>=x) break;
}
return sum>=x;
}
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin>... | ALGO | 0.999972 | 4.200491 |
33d0fbd5-d97e-414a-a905-8c6f3114bb34 | yjnnlee/Algorithm | dp/1463 1로 만들기_바텀업.cpp | #include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int dp[10000001];
int main() {
int x;
cin >> x;
dp[1] = 0;
for (int i = 2; i <= x; i++) {
dp[i] = dp[i - 1] + 1;
if (i % 3 == 0) dp[i] = min(dp[i / 3] + 1, dp[i]);
if (i % 2 == 0) dp[i] = min(dp[i / 2] + 1, dp[i]);
}
cout << dp... | ALGO | 0.999961 | 4.342002 |
9cf4858d-161b-4a46-8e30-b951deaa5d6f | ParkHaeChan/DataStructureAndAlgorithmCPP | Test/Monthly_Code_Challenge/Season3_Oct/test1.cpp | #include <string>
#include <vector>
using namespace std;
int solution(int n) {
int answer = 0;
for(int i=2; i<n; ++i)
{
if(n%i == 1)
{
answer = i;
break;
}
}
return answer;
} | ALGO | 0.999832 | 4.901947 |
f716a711-6cc0-40cb-82c5-b1fa77446f3c | DracoHawke/Topics-DS | Conversions/postfix_answer.cpp | #include<iostream>
#include<math.h>
using namespace std;
int stack_[50];
char postfix[50];
int top=-1,a=0;
void push(int res)
{
top++;
stack_[top]=res;
}
int pop()
{
a=stack_[top];
top--;
return a;
}
int main()
{
cout<<"Enter the postfix " << endl;
char ch,res;
int i=0;
cin>>ch;
... | ALGO | 0.99989 | 3.672097 |
46b32f5e-dec8-4eb9-8753-414d760ce4d7 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_9282_268.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
long long n, m, k;
cin >> n >> m >> k;
if (m >= n && k >= n)
cout << "YES";
else
cout << "NO";
return 0;
}
| ALGO | 0.999929 | 3.512606 |
66ffa40e-712a-4488-99b8-ee192bec657a | Mahbub2001/Practice_C_Plus_Plus | priority_queue_heap_sort.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
priority_queue<int> pq;//max heap
// priority_queue<int,vector<int>,greater<>>pq;//min heap
int n;
cin >> n;
for (int i = 0; i < n; i++)
{
int x;
cin >> x;
pq.push(x);
}
while (!pq.empty())
{
... | ALGO | 0.999895 | 4.349851 |
2bd4cd64-f100-42ba-b6b1-2fe47230077f | AlgoLeadMe/AlgoLeadMe-2 | Redish03/week4.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
string S, T;
cin >> S >> T;
while (true)
{
if (T[T.size() - 1] == 'A')
{
T.pop_back();
}
else if (T[T.size() - 1] == 'B')
{
T.pop_back();
reverse(T.beg... | ALGO | 0.99995 | 3.952358 |
5fd53c6f-0a24-4e7c-9b43-0def2f8b4012 | Maczuga/ElysiumCore | src/game/vmap/DynamicTree.cpp | #include "DynamicTree.h"
#include "Log.h"
#include "Timer.h"
#include "BIHWrap.h"
#include "RegularGrid.h"
#include "GameObjectModel.h"
template<> struct HashTrait< GameObjectModel>
{
static size_t hashCode(const GameObjectModel& g)
{
return (size_t)(void*)&g;
}
};
template<> struct PositionTrait<... | ALGO | 0.897787 | 5.582076 |
bb98a07a-aecf-4ea3-9383-e55aebc922c7 | BhaveshPatil12/CPP-Basic-Programs | StringS19.cpp | #include<iostream>
#include<string.h>
#include<stdio.h>
using namespace std;
void concatString(char[], char[]);
int main()
{
char str1[50], str2[30];
cout<<"\n Enter First String : ";
gets(str1);
cout<<"\n Enter Second String : ";
gets(str2);
concatString(str1, str2);... | ALGO | 0.93846 | 3.440664 |
7fe9eb58-2f18-4ee5-a196-4b346905d36c | Dhruv-2134/6Companies30Days | Company-3 (Adobe)/Ques12 (Shortest Unsorted Continuous Subarray).cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int findUnsortedSubarray(vector<int>& nums) {
vector<int> tmp;
tmp = nums;
sort(tmp.begin(),tmp.end());
int n = nums.size();
int i = 0;
int j = n-1;
for(;i<n;i++)
{
... | ALGO | 0.999959 | 5.13238 |
5ae80631-7cd7-4256-8d20-007cb79ec007 | kirillvelyugo/School-zadachi | 2020-2021/Paragraf 58/P. Stepeni chisla 2.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n;
bool isDetected = false;
cin >> n;
for (int i = n; i >= 2; i--){
if (i % 2 == 0){
cout << int(pow(2, i)) << ' ';
isDetected = true;
}
}
if(!isDetected){
cout ... | ALGO | 0.999985 | 3.959856 |
601f1385-6a24-422d-81dd-a799ef4b85ac | AdityaKoranga/practical_ | Question_02.cpp | //remove the duplicates from an array
#include<bits/stdc++.h>
using namespace std;
int main(){
set<int> s;
int arr[]= {1,1,2,3,5,5,6};
int n= sizeof(arr)/sizeof(arr[0]);
for (int i=0; i<n; i++){
s.insert(arr[i]);
}
// set<int>::iterator itr;
for(auto i: s){
cout<<i<<" ";
... | ALGO | 0.996878 | 4.093645 |
15b44ea6-f6a2-422e-bae0-1bc749660254 | myunbin/PS | BOJ/3058.cpp | #include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,tune=native")
#pragma GCC optimize("unroll-loops")
#define fileio() freopen("input.txt","r",stdin); freopen("output.txt","w",stdout)
#define fio() ios_base::sync_with_std... | ALGO | 0.99976 | 3.179843 |
6f452ad5-1ce2-41fa-942a-3f6062d3c490 | ishandutta2007/codeforces | alireza_kaviani/normal/1707/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<int, int> pii;
#define all(x) (x).begin(),(x).end()
#define X first
#define Y second
#define sep ' '
#define endl '\n'
#define SZ(x) ll(x.size())
const ll MAXN = 1e... | ALGO | 0.999911 | 3.936279 |
f8d5c4e8-1caa-45e3-8693-788c3b2dbb9a | YafimK/CPP_Trainning | LinkedList/driver.cpp |
#include "LinkedList.h"
#include "LinkedListAlgo.h"
#include "DoubleLinkedListXor.h"
#include <iostream>
int main(void)
{
LinkedList<int> sample1{};
for(int i = 0; i<=10; i++)
{
sample1.insertNode(i);
}
sample1.printLinkedList();
LinkedListAlgo<int> temp{};
// test mthElement from the end search algo
c... | TEST | 0.884309 | 4.100883 |
4a295934-9f22-4df4-a94a-e7af6bba3c06 | hhsaez/crimild | core/src/Behaviors/Conditions/DistanceToTarget.cpp | #include "DistanceToTarget.hpp"
#include "Crimild_Coding.hpp"
#include "SceneGraph/Node.hpp"
using namespace crimild;
using namespace crimild::behaviors;
using namespace crimild::behaviors::conditions;
DistanceToTarget::DistanceToTarget( void )
{
}
DistanceToTarget::DistanceToTarget( crimild::Real32 value, std::str... | TOOL | 0.939166 | 6.260805 |
ca46d3d9-9424-42d6-b5f4-bbac2eb260a1 | NguyenMinhThuan24112001/Data_structures_and_Algorithms_PTIT | gia tri nho nhat cua xau tt hang doi.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);
int t;cin>>t;
while (t--){
int k;
string s;
cin>>k>>s;
long long d[255]={0};
for (int i=0;i<s.size();i++) d[s[i]]++;
priority_queue<long long> pq;
for (int i=0;i<255;i++)
if (d[i]>0) pq.push(d[i]);
wh... | ALGO | 0.999709 | 4.174972 |
ebb4bc49-d183-45da-9400-a6491a33d4e9 | bconstantine/LeetCodesCollection | Past School Practices/AVL.cpp | #include <iostream>
using namespace std;
struct Node
{
int value;
Node* left;
Node* right;
int height; //including itself, so the height will always be max of height child + 1
};
void printPre(Node* head)
{
if (head == NULL)
{
return;
}
else
{
cout << head->value <<... | ALGO | 0.999848 | 5.08321 |
d73716bc-4c24-431c-9af6-92a1f5cd4ec3 | Edith-mounting/Competitive_programming_problems_solution | B_Morning_Jogging.cpp | #include <iostream>
#include <algorithm>
#include <queue>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define mp make_pair
#define... | ALGO | 0.999962 | 3.235372 |
ec3200a4-71fe-48e5-8a44-80234c690108 | EdwinTran/CS4440 | Project 2/airline.cpp | /*
Creates N passengers and have them go through a baggage handler,
security screening, and seating.
*/
#include <iostream>
#include <fstream>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <semaphore.h>
#include <pthread.h>
#include <unistd.h>
#include <sys/wait.h>
using namespace std;
... | ALGO | 0.988004 | 4.658961 |
e3244afe-6e19-4763-ad66-e44af26f6c70 | skagrawal/Udacity-SDC-ND--term-2 | CarND-MPC-Quizzes/global_kinematic_model/src/Eigen-3.3/unsupported/doc/examples/MatrixLogarithm.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
using std::sqrt;
MatrixXd A(3,3);
A << 0.5*sqrt(2), -0.5*sqrt(2), 0,
0.5*sqrt(2), 0.5*sqrt(2), 0,
0, 0, 1;
std::cout << "The matrix A is:\n" << A << "\n\n";
std::cout << "... | ALGO | 0.9981 | 3.621207 |
02246830-ba7e-41e7-9161-a557f0788e87 | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Gemma/top0-100/double-modular-exponentiation-Solution.getGoodIndices/177799_Overflow.cpp | _XcursorReadImage (XcursorFile *file,
XcursorFileHeader *fileHeader,
int toc)
{
XcursorChunkHeader chunkHeader;
XcursorImage head;
XcursorImage *image;
int n;
XcursorPixel *p;
if (!file || !fileHeader)
return NULL;
if (!_XcursorFileReadChunkHeader (file, fileHeader, ... | TOOL | 0.880748 | 4.232497 |
5976b09b-5fa5-44e6-88ff-cdc552667f3c | KKRainbow/LeetCode | Accepted/14.longest-common-prefix.139515013.ac.cpp | class Solution {
public:
string longestCommonPrefix(vector<string>& strs) {
if (strs.empty()) return "";
string tmp = strs[0];
int end = tmp.length();
for (auto &str : strs) {
int curIdx = 0;
while (curIdx < str.length() && curIdx < end && str[curIdx] == tmp[c... | ALGO | 0.999783 | 5.920681 |
c0e647e7-7161-4cb2-9155-bde2db7b3f0c | CuuvuivevaSoixam/code | SPOJ PTIT/ITACM06.cpp | // https://code.itptit.com/problems/100008
// Tạo số chính phương
#include <bits/stdc++.h>
using namespace std;
string s;
int len;
bool a[15];
vector<string> v;
bool isSquare(string s)
{
/* Xử lý num bằng stoi() hoặc atoi(s.c_str()) và int sq bị sai */
long long num = 0;
for (int i = 0; i < s.length(); +... | ALGO | 0.999747 | 4.256505 |
ddc8841a-de38-456c-8cf8-81609111d286 | pa9879/Coding-Career-Journey | leetcode/May Challenge/Day24_BSTFromPreorder.cpp | //https://leetcode.com/explore/challenge/card/may-leetcoding-challenge/537/week-4-may-22nd-may-28th/3339/
//M1 - O(N^2)
class Solution {
TreeNode *makeBST(TreeNode* &root, int ele) {
if(!root) {
root = new TreeNode(ele);
return root;
}
if(root->val > ele){
... | ALGO | 0.999996 | 6.274362 |
2235f7e3-ca1b-4648-9217-3cf2550ee9b8 | sadev-ai/CodePlayground | queraQuestions/college/dataStructures&Algorithms/enter-to-algorithms-world/integerMiddle.cpp | // https://quera.org/college/3016/chapter/10131/lesson/146597/?comments_page=1&comments_filter=ALL&submissions_page=1
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> arr(n);
for (int i = 0; i < n; i++) {
... | ALGO | 0.999974 | 5.804176 |
a05381f9-407d-41f8-8a00-cb095439dccf | prey176/Codebook | articulationPoints&Bridges.cpp | #include <bits/stdc++.h>
using namespace std ;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// #include <ext/pb_ds/detail/standard_policies.hpp>
// using namespace __gnu_pbds;
#define ll long long
#define fast_io() ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#d... | ALGO | 0.999951 | 4.78652 |
69ab347f-6b20-4717-93f2-e68679699d34 | AlexeyDmitriev/team-notebook | segment-tree-from-up-to-down.cpp | const int shift = 1 << 19;
struct Node {
};
Node tree[2 * shift];
void push(int v) {
for (int h = 0; h < 2; ++h) {
}
}
Node merge(const Node& l, const Node& r) {
Node res;
return res;
}
Node rmq(int v, int tl, int tr, int l, int r) {
if (tr <= l || r <= tl) {
return ;
}
if (l <= tl && tr <= r) {
... | ALGO | 0.999856 | 4.932065 |
a367cdb6-3660-44e3-9946-a2989f0038c7 | hieunv183534/ttud | ttud/DP/test.cpp | #include<bits/stdc++.h>
using namespace std;
int x[26];
bool visited[26];
int* findNext(int k){
int *next;
next = new int[4];
next[0] = k+1;
next[1] = k-1;
next[2] = k-5;
next[3] = k+5;
if(k<=5){
next[2] = -1;
}
if(k%5==0){
next[0] = -1;
}
if(k>=21){
... | ALGO | 0.999952 | 3.397602 |
4ae70d0c-2751-463c-82e0-412b5a6609be | nccaiteam/histopathology_annotation_nia | libs/boost_1_67_0/libs/graph/test/core_numbers_test.cpp | #include <vector>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/core_numbers.hpp>
#include <boost/property_map/property_map.hpp>
#include <stdio.h>
using namespace boost;
const char* errstr = "";
int test_1() {
// core numbers of sample graph
typedef adjacency_list<vecS,vecS,undirectedS> Gr... | ALGO | 0.974807 | 5.3349 |
1d023d4c-22b4-4f27-aef3-9fbed0c21d14 | AnishkaKesaria/DSA_Supreme | Week 1/Patterns/HalfPyramid.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
for(int row = 0; row<n; row++)
{
for(int col = 0; col<=row; col++)
cout<<"* ";
cout<<endl;
}
return 0;
} | ALGO | 0.999961 | 3.993796 |
b3610350-0b8a-48b2-8c1e-cee538e1247b | ruidias10/learning | c++/lessons/tutorial-01/lesson-25.cpp | #include <iostream>
using namespace std;
string dar_agua_as_plantas(int dias, bool suculentas) {
if (dias > 3 && !suculentas) {
return "E tempo de regar as plantas.";
}
else if (dias < 12 && suculentas) {
return "Nao regue as plantas.";
}
else if (dias > 12 && suculentas) {
... | TOOL | 0.981953 | 5.520848 |
0d4c4dad-d751-4cb7-9a88-55632dbbd5fb | kwl3434/boj | 1057.cpp | #include<cstdio>
int N,ji,im;
int main(){
scanf("%d %d %d",&N,&ji,&im);
int c=18;
ji--,im--;
int two=2;
int ans=0;
while(c--){
ans++;
if(ji/two==im/two) break;
two*=2;
}
printf("%d\n",ans);
} | ALGO | 0.999776 | 3.069803 |
55a12dd8-2138-4fe3-83aa-cd615f901d18 | moon1198/Leetcode | hot100/merge_sort.cpp | #include <bits/stdc++.h>
using namespace std;
vector<int> merge(vector<int> a, vector<int> b) {
if (a.empty()) {
return b;
} else if (b.empty()) {
return a;
}
vector<int> ans;
int idx1 = 0, idx2 = 0;
while (idx1 < a.size() && idx2 < b.size()) {
if (a[idx1] < b[idx2]) {
... | ALGO | 0.999987 | 4.893552 |
dfb98ace-e30b-4ff5-8468-85c9e8f24eb5 | YuchengYang0918/Code-Challenge | moveit/moveit_ros/moveit_servo/src/low_pass_filter.cpp | /* Title : low_pass_filter.cpp
* Project : moveit_servo
* Created : 1/11/2019
* Author : Andy Zelenak
*/
#include <moveit_servo/low_pass_filter.h>
#include <cmath>
#include <string>
#include <ros/ros.h>
namespace moveit_servo
{
namespace
{
constexpr char LOGNAME[] = "low_pass_filter... | ALGO | 0.968149 | 6.780369 |
ceb2e5f2-70ab-42ed-a984-75156f6abcad | closekn/procon | AtCoder/ABC/143/C/C.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
string s;
cin >> n;
cin >> s;
int ans = 1;
for ( int i = 1; i < n; i++ ) {
ans += ( s[i] != s[i-1] ) ? 1 : 0;
}
cout << ans << endl;
return 0;
}
| ALGO | 0.999989 | 4.067477 |
8b1bd534-b05b-4e15-a3c9-6e0474c4c580 | Bhanupal22600/CANDIDATE-MASTER | Cp31Sheet900/8.cpp | #include<iostream>
#include<vector>
using namespace std;
void calc(){
int n;
cin>>n;
vector<char> s(n);
int cn1=0;
int cn2=0;
int len=1;
for(int i=0;i<n;i++){
cin>>s[i];
}
char prev='>';
if(s[0]=='>') {
prev='>';
}
else{
prev='<';
}
int mx=... | ALGO | 0.999591 | 3.496892 |
7f131a1c-9f2d-43ac-ba23-f18400dc8304 | vjethava/DynBP | src/Tracker.cpp | #include "Tracker.h"
Tracker::Tracker() {
vreader = NULL;
graph = NULL;
model = NULL;
last_frame = NULL;
track_frame = NULL;
curr_frame = NULL;
C = 0;
epsilon = 0;
counter = 0;
}
void Tracker::initVideo(string videoName, int NL, bool isGray) {
FPRINTF(stderr, "Tracker:... | ALGO | 0.990245 | 4.483421 |
b5f8f71b-ed90-48b9-bbf2-540ca80664e3 | tkddn204/coding-test-training-cpp | done/personal/1238.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl "\n"
int n, m, x;
int town[2][1001][1001];
int dist[2][1001];
void dstra(int v) {
priority_queue<pair<int, int>, vector<pair<int, int>>, greater<>> pq;
fill(dist[v] + 1, dist[v] + n + 1, INT_MAX);
pq.push({x, 0});
dist[v][x] = 0;
while (!pq.empty(... | ALGO | 0.999957 | 5.787384 |
18a85b3b-215c-4043-9a19-caee402448d9 | mathislebel/direct-school | flutter_application_1/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.997848 | 6.761023 |
08f0530b-62a4-41b0-b813-61fb12e2ee41 | kifah-s/Problem_Solving | Gammal_Tech_Academy/3_Data_Structures/Exercises/Pro_1_From_1_To_N_Using_Recursion_Program/From_1_To_N_Using_Recursion_Program_V1.cpp |
//* From 1 To N Using Recursion Program (Version 1).
/*
* Write a program to print numbers from 1 to N using recursion.
! Input:
! Please, enter a number: 5
! Output:
! Numbers from 1 to 5: 1 2 3 4 5
*/
#include <iostream>
#include <array>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#in... | ALGO | 0.998786 | 5.34768 |
fc9dbb31-8c03-4398-b6cf-548f9ef983c0 | junaidrahim/Hacktoberfest-KIIT-2021 | ROHIT KUMAR SINGH (Hacktober Contribution)/C++ STL topics/unordered_map.cpp | //This is to implement the use of unordered map
/* 1. It does not gives the output in ordered way.
2. This method is faster than the map because it is stored as "HASH TABLES". */
#include<iostream>
#include<unordered_map>
using namespace std;
int main()
{
unordered_map<int,string> ump;
ump[1] = "One";
... | TOOL | 0.967087 | 4.917271 |
aa951238-511f-4388-b9a3-199b44401833 | GlebGerr/HSE_Algorithms | 8 contest (Scanline)/C.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n, m;
cin >> n >> m;
vector<int> L(n), R(n), P(m), answer(m);
vector<pair<int, int>> points;
for (int i = 0; i < n; i++) {
cin >> ... | ALGO | 0.999995 | 5.036039 |
c5dd35fe-a2c2-407f-8202-46895c00ce83 | ishandutta2007/codeforces | cherrym/normal/1332/G.cpp | #include <bits/stdc++.h>
#define p2 p << 1
#define p3 p << 1 | 1
template <class T>
inline void read(T &res)
{
res = 0; bool bo = 0; char c;
while (((c = getchar()) < '0' || c > '9') && c != '-');
if (c == '-') bo = 1; else res = c - 48;
while ((c = getchar()) >= '0' && c <= '9')
res = (res << 3) + (res << 1) + ... | ALGO | 0.999988 | 3.723477 |
53fe609a-fdc6-4571-9a0a-ee99ebd9ae04 | Modding-Zaibatsu/Pre-Unreal-4.14 | Engine/Source/ThirdParty/nvTextureTools/nvTextureTools-2.0.8/src/src/nvcore/Radix.cpp | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/**
* Contains source code from the article "Radix Sort Revisited".
* \file Radix.cpp
* \author Pierre Terdiman
* ... | ALGO | 0.999993 | 6.590717 |
2e12985e-f38c-4ae2-832c-dd2118025baa | nonecalculate/Algorithm | 프로그래머스/2/12924. 숫자의 표현/숫자의 표현.cpp | #include <string>
#include <vector>
using namespace std;
int solution(int n) {
int answer = 0;
for (int i = 1; i <= n; i++)
{
int k = 0;
int j = i;
while (k <= n)
{
k += j;
j++;
if (k == n)
{
answer++;
}
}
k = 0;
}
return answer;
} | ALGO | 0.999897 | 4.379053 |
411e680a-2152-4af0-977d-6893aa1ad208 | neamul-haq/XPSC_DailyCodes | week3/Day4(19.6.23)/A_Polycarp_and_the_Day_of_Pi.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define fast() {ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);}
void solve();
int main()
{
fast()
ll t; cin >> t;
while(t--) solve();
}
void solve(){
ll ans=0;
string s,s2;
s2="314159265358979323846264338327";
... | ALGO | 0.999841 | 4.56296 |
375d4b03-8223-4e70-872f-9cc4283ccb6e | RukiWang/2023aaib3 | week06/week06-1.cpp | ///week06-1.cpp
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<int> a;
a.push_back(30);
a.push_back(20);
a.push_back(10);
for(int i=0;i<3;i++){
cout << a[i] << "\n";
}
sort(a.begin(),a.end()); ///pjƧ
for(int i=0;i<3;i++){
... | ALGO | 0.998873 | 3.341014 |
3111897d-723f-42e4-9fb4-8e3f26426358 | RubberDog/Uni_Uebungen | Semester2/C_CPP/Extra-Krams_KW30/Loesungsvorschlaege/loesung_Aufgabe2.cpp | #include <iostream>
#include <cctype>
int toUpper(char* zeichenkette) {
int counter = 0;
for (int i = 0; zeichenkette[i] != '\0'; i++) {
if (std::islower(zeichenkette[i])) {
zeichenkette[i] = std::toupper(zeichenkette[i]);
counter++;
}
}
return counter;
}
int ma... | TOOL | 0.939104 | 5.129579 |
8017805a-5b51-4dc6-934b-9282f237e377 | Mayank17M/DSA-Final450 | LinkedList/add_two_linkedlist.cpp | /**
* Add two numbers represented by linked lists.
*
* Reference: https://www.geeksforgeeks.org/sum-of-two-linked-lists/
*/
#include <bits/stdc++.h>
using namespace std;
// A linked List Node
class Node{
public:
int data;
Node* next;
};
// to push a new node to linked list
void push(Node**... | ALGO | 0.999693 | 5.873939 |
09671736-38fc-4484-823c-3e99102ebf0d | all1m-algorithm-study/2021-1-Algorithm-Study | week5/Group4/boj1966_edit8080.cpp | // 1. 클래스를 통해 큐 구현 (push, pop, empty, front)
// 2. 우선순위값이 체크하려는 목록보다 큰 값이 있으면(is_max) pop 이후 push
// 3. 없으면 order에 현재 순서 저장, 이후 pop
//
// 시간복잡도 = O(n^2) (역순으로 정렬되어있어서 전부를 탐색할 때)
#include <iostream>
#include <algorithm>
#include <vector>
#define SIZE 10000
using namespace std;
class queue {
private:
pair<int, int> ... | ALGO | 0.999997 | 5.053872 |
8f2007bd-c2be-4cc1-b6a3-3a93e98cb4e3 | polockprog2/Compiler-Design | assignment.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <cctype>
using namespace std;
bool ValidIdentifierChar(char c) {
return isalnum(c) || c == '_';
}
bool ValidOperatorChar(char c) {
return c == '+' || c == '-' || c == '*' || c == '/' || c == '%' || c == '=' || c == '<' || c == '>';
}
int main... | ALGO | 0.965327 | 5.111796 |
502c8ce8-2675-4544-9b52-160a4e240807 | idervalcsn/CaixeiroViajante | src/main.cpp | #include "readData.h"
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#include <time.h>
#include <math.h>
#include <random>
#include <limits>
#include <chrono>
using namespace std;
//teste
struct CustoInsercao {
int noInserido;
int arestaRemovida;
double custo;
};
double **m... | ALGO | 0.998604 | 3.126989 |
42f87ba6-b60b-4e88-90f6-5bc86ed765cb | akshay090703/Learning-Cpp | OOPs/inheritance/types of inheritance/hierarchical.cpp | #include <iostream>
using namespace std;
// Hierarchical Inheritance
class A
{
public:
void func1()
{
cout << "Inside Function 1" << endl;
}
};
class B : public A
{
public:
void func2()
{
cout << "Inside Function 2" << endl;
}
};
class C : public A
{
public:
void func3()
... | ALGO | 0.945013 | 5.102395 |
7631036e-79b3-441f-9c4f-53cdf097fcac | swkhitorie/gpm | src/modules/attitude_estimator/attitude_estimator_q.cpp | #include "attitude_estimator_q.h"
/**
* imu axes(right hand) x to front / y to left / z to up
* this algorithm axes(right hand) x to front / y to right / z to down
*/
using matrix::Dcmf;
using matrix::Eulerf;
using matrix::Quatf;
using matrix::Vector3f;
using matrix::wrap_pi;
using namespace UParams;
AttitudeE... | ALGO | 0.993555 | 5.748489 |
3cf4c5b0-0aee-4408-9d3b-908d5b67f7b2 | VenkataAnilKumar/InterviewBit-CPlusPlus | Arrays/Count of Range Sum.cpp | int mergeSort(vector<long>& sum, int lower, int upper, int low, int high)
{
if(high-low <= 1) return 0;
int mid = (low+high)/2, m = mid, n = mid, count =0;
count =mergeSort(sum,lower,upper,low,mid) +mergeSort(sum,lower,upper,mid,high);
for(int i =low; i< mid; i++)
{
while(m < high && sum[m] ... | ALGO | 0.999986 | 5.519777 |
34cb9347-fe1d-4c12-81af-524313b3b04c | atifkarim/Basic-Cplusplus | function1st/main.cpp | #include <iostream>
using namespace std;
// function declaration
//int max(int num1, int num2);
int main () {
// local variable declaration:
// int a = 100;
// int b = 200;
int a,b;
int ret;
cin>>a;
cin>>b;
// calling a function to get max value.
ret = max(a, b);
cout << "Max value is : " <<... | ALGO | 0.997725 | 4.652011 |
b69b99d3-e27f-4e76-94ea-2e888699b5a5 | grips8/p2-lab | zadanie4/zadanie4.cpp | #include <regex>
int zadanie4_main() {
std::string bridge_of_death = R"(""ARTHUR: Three questions may cross in safety "
"ROBIN: What if you get a question wrong? "
"ARTHUR: Then you are cast into the Gorge of Eternal Peril. "
"ROBIN: Oh, I won... | ALGO | 0.91873 | 3.71991 |
3fb550ef-ab78-4da4-b01c-52593fe0ac8c | dmsrb1002/algorithm | 1200/1297.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main() {
double a,b,c;
double k;
cin >> c >> a >> b;
k = sqrt(c*c / (a*a + b*b));
cout << (int)(a*k) << " " << (int)(b*k) << endl;
return 0;
}
| ALGO | 0.999291 | 3.050024 |
14bc2281-caba-4913-ac6e-ab811194c5b9 | hjiang13/LLMs-in-IR | POJ-104/44/406.cpp | #include <iostream>
using namespace std;
int reverse(int u){
int a[33]={
0}
;
int j,k;
int x=0;
for(j=0; u>0; j++){
a[j]=u%10;
u=u/10;
}
for(k=0; k<j; k++){
x=x*10+a[k];
}
return x;
}
int main(){
int n,b;
int i;
for(i=0; i<6; i++){
cin >> "%d",&n);
if(i!=0){
cout << "\n");
}
if(n<0){
cout << "-");
n=-n;
}
b=reverse(n);... | ALGO | 0.99978 | 3.585576 |
0116b461-37f7-4829-9c9b-71994141f1bf | KhanhKitin/spoj_ptit | daysohailstone_p148proa.cpp | //#include<stdio.h>
//int main(){
// int dem=0;
// long n;
// do{
// scanf("%ld",&n);
// if(n==0) return 0;
// while(n!=1){
// // if(n==1) return 0;
// if(n%2==0){
// n=n/2;
// // printf("%ld ",n);
// dem++;
// }
// else {
// n=3*n+1;
// //printf("%ld ",n);
// dem++;
// }
// }
// printf("... | ALGO | 0.999983 | 4.031528 |
d0b4f4fd-42cb-4864-ba73-308a66ddd375 | korimart/BaekJun | 15665/Source.cpp | #include <iostream>
#include <algorithm>
int main()
{
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int CandidateCount, SequenceSize;
std::cin >> CandidateCount >> SequenceSize;
int Candidates[10];
for (int i = 0; i < CandidateCount; ++i)
{
std::cin >> Candidates[i];
... | ALGO | 0.999982 | 4.770204 |
ff81d812-2077-4c00-a055-3fffc2206c16 | garvitkumar854/Mastering-the-DSA | 03_Patterns/square_pattern.cpp | /*
1 2 3 4
1 2 3 4
1 2 3 4
1 2 3 4
*/
#include <iostream>
using namespace std;
int main(){
int n;
cout << "Enter a Number: ";
cin >> n;
for(int i=1; i<=n; i++){
for(int j=1; j<=n; j++){
cout << j << " ";
}
cout << endl;
}
cout << endl;
fo... | ALGO | 0.998727 | 3.142835 |
3a30a4c1-4120-4d25-9917-f96657d7f871 | tuituji/CS148-Stanford-CG | hw4/eigen3.1.1/doc/examples/TutorialLinAlgRankRevealing.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix3f A;
A << 1, 2, 5,
2, 1, 4,
3, 0, 3;
cout << "Here is the matrix A:\n" << A << endl;
FullPivLU<Matrix3f> lu_decomp(A);
cout << "The rank of A is " << lu_decomp.rank() << endl;
c... | ALGO | 0.999899 | 3.725084 |
29cb4b87-877e-4f00-b630-b1dedeaa7c54 | AbhishekCS3459/Leet-Code-Submissions | 0015-3sum/0015-3sum.cpp | class Solution {
public:
// concept lies here is that we convert the three sum into two sum by fixing one number and applying the same logic to nums
vector<vector<int>> threeSum(vector<int>& nums) {
sort(nums.begin(),nums.end());
vector<vector<int>>ans;
set<vector<int>>st;
for(int i=0;i... | ALGO | 0.999776 | 5.791163 |
c1494f2e-eda6-46bf-926b-42a42e34b477 | laxin56/Grafy_ | main.cpp | #include "macierz.hpp"
#include "kruskal.hpp"
#include "lista.hpp"
#include "prime.hpp"
#include <iostream>
#include <cstdlib>
#include <ctime>
#include <fstream>
using namespace std;
int main()
{
//wykonuje dwie funkcje, ktore testuja nam odpowiednio algorytmy kruskala i prima
testuj_kruskal();
testuj_prime();
... | ALGO | 0.979412 | 3.354899 |
fd22fb42-c07b-475d-a4b1-fb9f9b0e4084 | sarvex/leetcode-ruby | solution/0000-0099/0089.Gray Code/Solution.cpp | class Solution {
public:
vector<int> grayCode(int n) {
vector<int> ans;
for (int i = 0; i < 1 << n; ++i) {
ans.push_back(i ^ (i >> 1));
}
return ans;
}
}; | ALGO | 0.999967 | 6.050643 |
ae557fd6-2ade-41cc-b7ea-7bb43f682722 | jackrabbit-start/PS | 볼록_정다각형.cpp | #define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
#define modn 998244353
using ll = long long int;
using ld = long double;
string s;
ld midx, midy;
ld pii;
void findCircumcenter(ld a1, ld b1, ld a2, ld b2, ld a3, ld b3)
{
double A = a2 - a1;
double B = b2 - b1;
... | ALGO | 0.999809 | 5.213479 |
b7690ad6-5972-4cfe-806c-f0addca06427 | debacoding/1.CPP | Language Details/CPP Basics/CPP020_Goto_statement.cpp | #include <iostream>
using namespace std;
int main(){
int num; cout<<"Enter a number: "; cin>>num;
if (num % 2==0){
goto print;
}
else {
cout<<"Odd Number";
}
print:
cout<<"Even Number";
return 0;
}
/*
Output:
Enter a number: 42
Even Number
*/ | ALGO | 0.998413 | 4.226266 |
90ea7aba-cbd4-45de-ac06-c2b1e69c9080 | juliamauri/Physics-2 | Box2D - Class1/Box2D/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.cpp | #include <Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.h>
#include <Box2D/Common/b2BlockAllocator.h>
#include <Box2D/Dynamics/b2Fixture.h>
#include <new>
b2Contact* b2PolygonAndCircleContact::Create(b2Fixture* fixtureA, int32, b2Fixture* fixtureB, int32, b2BlockAllocator* allocator)
{
void* mem = allocator->All... | ALGO | 0.962288 | 7.291923 |
f357e4bb-b9cc-4ec1-88d8-d067b2294105 | reverg/PS | leetcode/273.cpp | class Solution
{
public:
string ones(int num)
{
switch (num)
{
case 1:
return "One";
case 2:
return "Two";
case 3:
return "Three";
case 4:
return "Four";
case 5:
return "Five";
case 6:
... | ALGO | 0.997433 | 6.340426 |
c0de6bc5-dfc4-4d66-aa24-610f0ddeb4d0 | trinhminhtriet/leetcode | solutions/0000-0099/0042.trapping-rain-water/Solution.cpp | class Solution {
public:
int trap(vector<int>& height) {
int n = height.size();
int left[n], right[n];
left[0] = height[0];
right[n - 1] = height[n - 1];
for (int i = 1; i < n; ++i) {
left[i] = max(left[i - 1], height[i]);
right[n - i - 1] = max(right[... | ALGO | 0.99999 | 6.844737 |
cfb4fc65-3a9c-4079-b28b-5f68feaa6ac0 | f4bD3v/acg13 | nori_framework/src/ex4/path.cpp | NORI_NAMESPACE_BEGIN
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
// put your group number here!
#define GROUP_NUMBER 42
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
GROUP_NAMESPACE_BEGIN()
/**
* Simple path tracer implementation
*/
class Path... | ALGO | 0.995728 | 7.768886 |
1a99bdd4-c1ad-443e-8996-3fbbef3287b2 | gaoyinfeng/TrajGen | Lanelet2/lanelet2_traffic_rules/src/GenericTrafficRules.cpp | #include "lanelet2_traffic_rules/GenericTrafficRules.h"
#include <lanelet2_core/geometry/Area.h>
#include <lanelet2_core/geometry/Lanelet.h>
#include <lanelet2_core/primitives/RegulatoryElement.h>
#include <lanelet2_core/utility/Units.h>
#include "lanelet2_traffic_rules/Exceptions.h"
namespace lanelet {
namespace tr... | TOOL | 0.874242 | 4.721994 |
d0ef593f-1664-49f4-a6e8-5ebc12d0849b | athrpf/sipopt2 | Ipopt/tutorial/CodingExercise/Cpp/1-skeleton/TutorialCpp_nlp.cpp | // This file is part of the Ipopt tutorial. It is the skeleton for
// the C++ implemention of the coding exercise problem (in AMPL
// formulation):
//
// param n := 4;
//
// var x {1..n} <= 0, >= -1.5, := -0.5;
//
// minimize obj:
// sum{i in 1..n} (x[i]-1)^2;
//
// subject to constr {i in 2..n-1}:
// (x[i]^2+1.5*... | ALGO | 0.999815 | 6.320724 |
3c008b3d-3ff2-4742-82eb-20086667144c | Nguyenthithuhang0406/UDTT | BT1_SauKLL_TH11.TienHauTo.cpp | #include<bits/stdc++.h>
using namespace std;
string longestOverlap(string a, string b){
int m = a.length(), n = b.length();
int max_l = 0;
for(int i = min(m, n); i > 0; i--){
if(a.substr(m-i) == b.substr(0, i)){
max_l = i;
break;
}
}
//substr: cat b tu vi tri max_l
return b.substr(max_l);
}
string... | ALGO | 0.999147 | 3.640248 |
1d3532c1-56ed-490c-8166-808a187e1b1b | AnahiSU/PracticasProgramacionCompetitiva | ejerciciosVariadosDeContest/discoveringGraphlandia.cpp | /*
- Deja ir el pasado y camina hacia el futuro.
- El trabajo duro supera al talento cuando el talento no trabaja duro.
- Del fracaso se aprende, del éxito no mucho.
- Para sentirse vivo se necesita una meta en la que trabajar.
- ¡Demonios Rocky! No hay ningún mañana.
*/
#define srt(a) sort(a.begin(),a.end())
#include... | ALGO | 0.999991 | 4.62866 |
229abd6f-8d5d-4e20-a0cb-f0c41ea30953 | aadi1307/High-Performance-Computing | TempProject/FinalProject/eigen-3.4.0/unsupported/doc/examples/MatrixFunction.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
std::complex<double> expfn(std::complex<double> x, int)
{
return std::exp(x);
}
int main()
{
const double pi = std::acos(-1.0);
MatrixXd A(3,3);
A << 0, -pi/4, 0,
pi/4, 0, 0,
0, 0, 0;
std::... | ALGO | 0.999386 | 4.353816 |
52d57212-9861-417d-ae31-3217a9611390 | 15pengyi/Art_of_Algorithm | 20_leet_code/leetcode_104_Maximum_Depth_of_Binary_Tree.cpp | #include <algorithm>
using namespace std;
struct TreeNode
{
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
};
class Solution
{
public:
int maxDepth(TreeNode *root)
{
if (nullptr == root)
{
return 0;
}
... | ALGO | 0.999843 | 6.20787 |
e821d3e5-3a83-443e-9d21-7ff0408edd31 | hemantsingh443/NNinCpp | lib/eigen-3.4.0/unsupported/doc/examples/MatrixExponential.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
const double pi = std::acos(-1.0);
MatrixXd A(3,3);
A << 0, -pi/4, 0,
pi/4, 0, 0,
0, 0, 0;
std::cout << "The matrix A is:\n" << A << "\n\n";
std::cout << "The matrix exponential ... | ALGO | 0.999515 | 3.730493 |
7e33efca-c315-4d97-886b-a665d10d0196 | nparent/PS2 | eigen/unsupported/doc/examples/PolynomialUtils1.cpp | #include <unsupported/Eigen/Polynomials>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
Vector4d roots = Vector4d::Random();
cout << "Roots: " << roots.transpose() << endl;
Eigen::Matrix<double,5,1> polynomial;
roots_to_monicPolynomial( roots, polynomial );
cout << "Polynomial:... | ALGO | 0.998259 | 4.015535 |
1bb75437-6ea9-483f-b8d9-de8f32d54b25 | palm7710/algorithm | Algorithm/CumulativeSum02.cpp | #include <iostream>
using namespace std;
int N, A[100009], S[100009];
int Q, L[100009], R[100009];
int main() {
//入力
cin >> N >> Q;
for (int i = 1; i <= N; i++) cin >> A[i];
for (int j = 1; j <= Q; j++) cin >> L[j] >> R[j];
//累積和の計算
S[0] = 0;
for (int i = 1; i <= N; i++) S[i] = S[i - 1] +... | ALGO | 0.999958 | 4.46402 |
fc071ea8-6b27-47bc-ab2e-652617713c43 | PramodModi/Datastructure | C++/Matrix-RectangaleMania/rectangleMania.cpp | /*
Write a function that takes in a list of Cartesian coordinates
(i.e., (x, y) coordinates) and returns the number of rectangles formed by these
coordinates. A rectangle must have its four corners amongst the coordinates
in order to be counted, and we only care about rectangles with sides parallel to
the x and y a... | ALGO | 0.99974 | 5.398086 |
a4e2c128-9841-41f0-8666-4edd206a1709 | anaa-matrix/DAAL | floyds.cpp | #include <bits/stdc++.h>
using namespace std;
void floydsAlgorithm(vector<vector<int>>& graph) {
int numVertices = graph.size();
vector<vector<int>> dist(numVertices, vector<int>(numVertices, 0));
for (int i = 0; i < numVertices; i++) {
for (int j = 0; j < numVertices; j++) {
if (i == j) {
dis... | ALGO | 0.999948 | 5.707676 |
5f88b5a2-a528-4251-a4fb-bca29494d6f7 | JiDulSooDul/Connecting_Campus | Connecting_Campus_Bio/VRTutorial_v3/ovr_openxr_mobile_sdk_57.0/SampleCommon/Src/OVR_Uri.cpp | // (c) Meta Platforms, Inc. and affiliates. Confidential and proprietary.
/************************************************************************************
Filename : OVR_Uri.cpp
Content : URI parser.
Created : July 1, 2015
Authors : Jonathan E. Wright
*************************************... | TOOL | 0.881873 | 6.889432 |
d1fb9985-0a56-4792-8e77-1d3ea8fdbc05 | lmyisahandsomeboy/my-ubuntu-bustub1 | src/optimizer/sort_limit_as_topn.cpp | #include "optimizer/optimizer.h"
namespace bustub {
/**
* @brief optimize sort + limit as top N
*/
auto Optimizer::OptimizeSortLimitAsTopN(const AbstractPlanNodeRef &plan) -> AbstractPlanNodeRef {
// TODO(student): implement sort + limit -> top N optimizer rule
return plan;
}
} // namespace bustub
| ALGO | 0.994651 | 5.358917 |
02c17c45-d598-40b8-94df-8c3b416032cf | albertorobles2000/Ejercicios-de-pilas-y-colas-con-la-stl | src/ejercicio08.cpp | /*
10. Usando una pila y una cola, implementa una funcion que compruebe si un string es un palindromo.
*/
#include <iostream>
#include <queue>
#include <stack>
using namespace std;
bool es_palindromo(string n){
int mitad = n.size()/2;
queue<char> cola;
stack<char> pila;
for(int i=0; i<mitad; i++){
cola.push(... | ALGO | 0.9972 | 5.881315 |
54b378a3-21b9-4dd4-9c38-8d1c99b1e99a | MeghaSilori/Code_g2 | Day-6/3isToeplitz.cpp | class Solution {
public:
bool isToeplitzMatrix(vector<vector<int>>& matrix) {
for(int i=1; i<matrix.size(); i++){
for(int j=1; j<matrix[0].size(); j++){
if(matrix[i][j] != matrix[i-1][j-1])
return false;
}
}
return true;
}
};
| ALGO | 0.999877 | 6.217416 |
c36d84f4-4019-4dde-badb-ae2b7c52ba73 | galacean/physX.js | physx/source/geomutils/src/mesh/GuBV4Build.cpp | #include "foundation/PxVec4.h"
#include "foundation/PxMemory.h"
#include "geometry/PxTriangle.h"
#include "GuBV4Build.h"
#include "GuBV4.h"
#include "GuCenterExtents.h"
#include "CmPhysXCommon.h"
#include "PsBasicTemplates.h"
#include <stdio.h>
using namespace physx;
using namespace Gu;
#include "PsVecMath.h"
using ... | ALGO | 0.99659 | 7.733808 |
7dce6f6c-0fda-4e02-a9cc-8cecd0452455 | HargovindArora/Programming | Dynamic_Programming/lis3.cpp | #include<algorithm>
#include<iostream>
#include<climits>
using namespace std;
// Time Complexity O(NLOG(N))
int lisBottomUp(int arr[100], int n){
int dp[n+1];
dp[0] = INT_MIN;
for(int i=1; i<=n; i++){
dp[i] = INT_MAX;
}
for(int i=0; i<n; i++){
int length = upper_bound(dp, dp+n+1, ... | ALGO | 0.999987 | 4.791638 |
186d6ee4-1496-4f35-84f9-224b834dd496 | nbonneel/pathtracer | PointSet.cpp | #include "PointSet.h"
BBox PointSet::build_bbox(int i0, int i1) {
BBox result;
result.bounds[1] = vertices[i0] + Vector(radius[i0], radius[i0], radius[i0]);
result.bounds[0] = vertices[i0] - Vector(radius[i0], radius[i0], radius[i0]);
for (int i = i0; i < i1; i++) { // indice de triangle
result.bounds[0] = min(... | ALGO | 0.993375 | 3.847118 |
304f7975-b92c-4816-9a92-278db8fe215c | slk000/newbie | leetcode/53_maximum-subarray_divide.cpp | class Solution {
public:
int crossArea(vector<int> &nums, int s, int e, int mid){
int leftMax = -0x3f3f3f3f;
int rightMax = leftMax;
int sum = 0;
for(int i = mid; i >=s; i--){
sum += nums[i];
leftMax = max(sum, leftMax);
}
sum = 0;
for(... | ALGO | 0.999994 | 6.011589 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.