uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
6374614d-c83a-4808-8bd3-77a6b80f0048 | hacch141/Coding-Practice | LeetCode/0329.Longest-Increasing-Path-in-a-Matrix.cpp | // 329. Longest Increasing Path in a Matrix
class Solution {
public:
int delRow[4] = {-1,0,+1,0};
int delCol[4] = {0,-1,0,+1};
bool isValid(int x1, int y1, int x2, int y2, vector<vector<int>>& matrix) {
int n = matrix.size();
int m = matrix[0].size();
if(x2<0 || x2>=n || y2<0 || y... | ALGO | 0.999995 | 5.923033 |
cbcc1e92-aefd-41fd-91d2-e0d388407dd1 | webturing/2020NOIPWinterCamp | stl/mapdemo2.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
vector<int> v{1,2,3};
for(int &x:v)++x;
for(int x:v)cout<<x;
cout<<endl;
map<int,int> a;///pair<int,int>
int t;
while(cin>>t)
{
a[t]++;
}
for(auto x :a)cout<<x.first<<" "<<x.second<<endl;
return 0;
}
| ALGO | 0.99893 | 3.386318 |
a330084d-713d-4656-91be-e70529535d8d | ThiagoFBastos/programacao-competitiva | codeforces/The 2020 ICPC Asia Yinchuan Regional Programming Contest/B.cpp | #include "bits/stdc++.h"
using namespace std;
#define INF 1000000000
#define INFLL 1000000000000000000ll
#define EPS 1e-9
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define pb push_back
#define fi first
#define sc second
using i64 = long long;
using u64 = unsigned long long;
using ld = ... | ALGO | 0.999947 | 3.773258 |
3462a1bd-ba2b-4e24-8fd6-dca3ca72ff7e | K0nnyaku/Code | Data/CSP-JS2021二轮提高组数据/SD-00026/bracket/bracket.cpp | #include<bits/stdc++.h>
using namespace std;
int n,k,ans,f[505],t,f1[505];
char s[505];
void dfs(int x,int y,int z)
{
if(x==n+1)
{
if(y||s[n]=='*')
return;
ans++;
return;
}
if(s[x]=='(')
f[++t]=z,f1[t]=x,dfs(x+1,y+1,z);
else
if(s[x]=='*')
{
if(z+1-f[t]>k||t>1&&f[t]-f[t-1]&&s[... | ALGO | 0.999951 | 3.336812 |
b430c2bf-a732-4f57-ade2-67a210bb67ba | lxdlam/CP-Answers | CodeChef/MINEAT.cpp | #include <bits/stdc++.h>
using namespace std;
// Useful Marcos
//====================START=====================
// Compile use C++11 and above
#ifdef LOCAL
#define debug(args...) \
{ \
string _s = #args; \
replace(_s.begin(... | ALGO | 0.999986 | 4.800644 |
ad27e466-e761-4491-9ab3-56919b702565 | roahmlab/RAPTOR | Examples/Unitree-G1/VisualizationHelper.cpp | #include "G1MultipleStepOptimizer.h"
using namespace RAPTOR;
using namespace G1;
using namespace Ipopt;
const std::string filepath = "../Examples/Unitree-G1/data/";
int main() {
const std::string urdf_filename = "../Robots/unitree-g1/g1_12dof_floatingbase.urdf";
pinocchio::Model model;
pinocchio::urdf::... | ALGO | 0.998948 | 5.701196 |
a3b2a285-88fc-4355-947d-8e8cb9332385 | ToshikiShimizu/AOJ | ALDS1/6a.cpp | #include<bits/stdc++.h>
#define MAX_N 2000000
#define MAX_A 10000
using namespace std;
int main(){
int n;
cin >> n;
int A[MAX_N];
int B[MAX_N];
int C[MAX_A+1];
for (int i=0;i<n;i++){
cin >> A[i];
}
for (int i=0;i<MAX_A+1;i++){
C[i]=0;
}
for (int i=0;i<n;i++){
... | ALGO | 0.999998 | 3.507724 |
bf718655-51a8-42b1-a9c8-1b48fd3996f8 | greenbeanpie/OI-training | Luogu/P3/P38/P3835/generator.cpp | #include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace __gnu_pbds;
using namespace __gnu_cxx;
using namespace std;
#pragma GCC target("sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,lzcnt,abm,bmi,bmi2,fma,tune=native")
#define int __int128
#define double long double
#define endl "\n"
#define problemname "... | ALGO | 0.997878 | 3.305283 |
09ceb93a-2db2-4576-b258-8a9a921f596b | cooler-SAI/wow-Revelion-v2 | src/server/game/AI/ScriptedAI/ScriptedFollowerAI.cpp | /* ScriptData
SDName: FollowerAI
SD%Complete: 50
SDComment: This AI is under development
SDCategory: Npc
EndScriptData */
#include "ScriptedCreature.h"
#include "ScriptedFollowerAI.h"
#include "Group.h"
#include "Player.h"
const float MAX_PLAYER_DISTANCE = 100.0f;
enum ePoints
{
POINT_COMBAT_START = 0xFFFFFF
};... | TOOL | 0.92738 | 4.585406 |
b061ce69-4d57-46c3-b52b-73de6a458fa3 | Valera94/Portfolio | Portfolio/Source/Portfolio/AI/BTTasks/BTTask_FindPlace.cpp | #include "BTTask_FindPlace.h"
#include "AIController.h"
#include "NavigationSystem.h"
#include "AI/NavigationSystemBase.h"
#include "BehaviorTree/BlackboardComponent.h"
#include "BehaviorTree/BTFunctionLibrary.h"
#include "Portfolio/AI/MiniGameTeam.h"
#include <BehaviorTree\Blackboard\BlackboardKeyType_Object.h>
#inc... | ALGO | 0.947441 | 3.554084 |
29e88c92-7cc1-4ba9-8eba-3712042076ac | LinXin04/LeetCode | Container With Most Water.cpp | class Solution {
public:
int maxArea(vector<int>& height) {
int start=0;
int end=height.size()-1;
int MaxArea=-1;
while(start<end)
{
int Area=min(height[start],height[end])*(end-start);
MaxArea=max(MaxArea,Area);
if(height[start]<=height[en... | ALGO | 0.999966 | 6.46784 |
153f2748-7ebe-4f8d-b95f-53c9d44ad8c9 | AYUSH-MUKATI/Data-Structure-and-Algorithm | Wave_Sort.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int a[] = {1, 3, 4, 2, 7, 8};
int n = sizeof(a)/ sizeof(int);
// sort the array in wave form
for(int i = 0; i< n; i += 2){
// prev element
if(i != 0 and a[i]<a[i-1]){
swap(a[i], a[i-1]);
}
// next e... | ALGO | 0.999991 | 3.923316 |
6807ead6-9e23-439d-a0bf-3707acd08169 | StevenJiao/420_BLAZE_LABS | lab2/Code/main3.cpp | #include<stdio.h>
#include<stdlib.h>
#include<sys/types.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<arpa/inet.h>
#include<unistd.h>
#include<pthread.h>
#include"common.h"
#include"timer.h"
char **theArray;
pthread_rwlock_t rwlock;
// for timers
double* times = new double[COM_NUM_REQUEST];
void *ServerEc... | WEB | 0.887249 | 4.054568 |
e8a49128-4d26-4f16-88b3-a9187e8c0f72 | rbtre/rbtre.github.io | assets/code/B3650.cpp | #include <iostream>
using namespace std;
signed main() {
long long a, b = 0;
cin >> a;
for (int i = 1; i <= a; ++i) {
b += i;
cout << b << '\n';
}
} | ALGO | 0.999303 | 3.893734 |
92431642-7832-47a5-9950-f0957b673503 | ClemensLode/A-Search | AStarExercise/io.cpp | #include <fstream>
#include <sstream>
#include <vector>
#include <stdio.h>
#include <string.h>
#include "exception.hpp"
#include "io.hpp"
void IO::checkStreamIsOpen(std::ifstream& stream, const std::string& functionName, const std::string& fileName)
{
if(!stream.is_open())
{
std::ostringstream os;
os << "ERROR ... | TOOL | 0.879779 | 5.839026 |
5c1bdfd5-ecd6-4f12-ac3e-1da7ff3db849 | Yashwantyadav1/c_plus_plus | Array/vector/2D_vector.cpp | #include<iostream>
#include<vector>
using namespace std;
int main(){
vector<vector<int> >arr;
vector<int>a{1,2,5,4,6};
vector<int>b{5,4,6,7,6};
vector<int>c{6,4,7,5,25,78,4,2,0};
arr.push_back(a);
arr.push_back(b);
arr.push_back(c);
for(int i=0; i<arr.size();i++){
for(int j=0; ... | ALGO | 0.981825 | 3.084615 |
bc85a78c-2cf6-4bd8-b18c-6c64f4781433 | singlarohan/leetcode_sol | 0600-non-negative-integers-without-consecutive-ones/2023-06-21 01.42.41 - Accepted - runtime 3ms - memory 7.3MB.cpp | class Solution {
private:
int m;
vector<vector<int>> dp;
int num;
public:
int solve(bool ifsmall, int i){
if(i >= m) return 1;
if(dp[i][ifsmall] != -1) return dp[i][ifsmall];
int ans = 0;
if(ifsmall || (num & (1 << (m - i - 1))) != 0) {
if((i) < m - 1 && (num ... | ALGO | 0.999989 | 5.474535 |
b813d6f4-6762-4f55-95b2-eb829ee31325 | Hackeries/CP | VivekBhaiya(CP)/txt.cpp | #include <bits/stdc++.h>
#define lli long long
#define pii pair<int,int>
#define fr first
#define sc second
#define EB emplace_back
#define MP make_pair
#define vi vector<int>
#define vvi vector<vector<int>>
#define vpii vector<pair<int,int>>
#define all(o) (o).begin(), (o).end()
#define fr(i,n) for(lli i=0;i<n;++i)
#d... | ALGO | 0.998305 | 4.017114 |
196cd9e1-6fbb-4d30-a857-f307ce5f4bb3 | fobrs/yolov9_npu | Kits/DirectXTK12/Src/Geometry.cpp | #include "pch.h"
#include "Geometry.h"
#include "Bezier.h"
using namespace DirectX;
namespace
{
const float SQRT2 = 1.41421356237309504880f;
const float SQRT3 = 1.73205080756887729352f;
const float SQRT6 = 2.44948974278317809820f;
inline void CheckIndexOverflow(size_t value)
{
// Use >=, ... | ALGO | 0.991134 | 7.83062 |
518e6f50-2087-4794-b720-f349b70968e0 | zqchen90/leetcode | add-binary/add-binary.cpp | #include <iostream>
#include <string>
using namespace std;
void addBit(char a, char b, int prevp, int *sum, int *p) {
if (a == '0' && b == '0') {
*sum = prevp;
*p = 0;
return;
}
if (a != b) {
if (prevp == 0) { *sum = 1; *p = 0;}
else { *sum = 0; *p = 1;}
ret... | ALGO | 0.999991 | 5.679372 |
65daf642-bcc4-4726-ab04-adf8ccd7edcf | mao-zedong/mao-zedong | src/zerocoin/Params.cpp | /**
* @file Params.cpp
*
* @brief Parameter class for Zerocoin.
*
* @author Ian Miers, Christina Garman and Matthew Green
* @date June 2013
*
* @copyright Copyright 2013 Ian Miers, Christina Garman and Matthew Green
* @license This project is released under the MIT license.
**/
#include "Zeroco... | TOOL | 0.884522 | 6.621742 |
0e7debd3-12bc-4c52-9e5b-0a0fd0ca0089 | riccardoruocco/PrenotazioneTeatro | semafori.cpp | #include "semafori.h"
void wait_sem(int id_s,int n_s)
{
struct sembuf sem_buf;
sem_buf.sem_num=n_s;
sem_buf.sem_flg=0;
sem_buf.sem_op=-1;
semop(id_s,&sem_buf,1);
}
void signal_sem(int id_s,int n_s)
{
struct sembuf sem_buf;
sem_buf.sem_num=n_s;
sem_buf.sem_flg=0;
sem_buf.sem_op=11;
semop(id_s,&sem_buf,1);
}
| TOOL | 0.926538 | 3.444801 |
ea73be40-24ab-49ac-9850-9a0706a441ed | vivekrathod260/LeetCode | 2519-find-the-original-array-of-prefix-xor/2519-find-the-original-array-of-prefix-xor.cpp | class Solution {
public:
vector<int> findArray(vector<int> &v) {
int n = v.size();
vector<int> ans(n);
ans[0] = v[0];
for(int i = 1; i<n; i++)
{
ans[i] = v[i-1]^v[i];
}
return ans;
}
}; | ALGO | 0.999995 | 5.259106 |
d3208944-2493-46d0-a7c6-91e96f0d4f2e | prateekbhaisora/gem5-assignments | configs/my_scripts/bmm.cpp | #include <iostream>
#include <vector>
#include <cstdlib>
#include <ctime>
#define MAX_VAL 100
#define BSize 32
using namespace std;
void generateRandomInputs(vector<vector<int>> &matrix, int &rows, int &cols) {
matrix.resize(rows);
for (auto &row : matrix) {
row.resize(cols);
}
for (int i=... | ALGO | 0.999346 | 3.950301 |
90f7a00f-5741-4374-9872-1486967c9eb2 | ishandutta2007/codeforces | arthur.nascimento/normal/356/C.cpp | #include <iostream>
#include <algorithm>
#include <cmath>
#include <assert.h>
#include <stdio.h>
#include <ctime>
#include <cstdlib>
#include <utility>
#include <string.h>
#include <vector>
#include <queue>
#include <stack>
#include <set>
#include <map>
#define INF (1<<30)
#define pii pair<int,int>
#define pll pair<l... | ALGO | 0.99998 | 3.485106 |
bc8945b8-bd8b-4e56-a46e-f265b720c498 | Alexaneva/coffee_shop | 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.998809 | 6.763549 |
3b37bb02-5c07-4589-ba53-72dd2d3577f7 | pkp245464/Competitive-Programming | Heap/DisplayAllNodesLessAInMinHeap.cpp | #include<bits/stdc++.h>
using namespace std;
#define lli long long int
#define llu unsigned long long int
#define ld long double
#define phb push_back
#define phf push_front
#define ppf pop_front
#define ppb pop_back
#define in insert
#define as assign
#define nle "\n"
#define fastinput ios::sync_with_stdio(0),cin.tie(... | ALGO | 0.999892 | 3.821465 |
9b57fda5-4567-4286-a012-d5b5bffbd479 | awang801/Data_Structures | Leftist vs Skew Heap Comparions/Wang_Lab8/Timing/main.cpp | #include <iostream>
#include "Node.h"
#include "SkewHeap.h"
#include "BinarySearchTree.h"
#include "timer.h"
#include <fstream>
int main ()
{
long rando;
double duration;
long n = 50000;
double x;
BinarySearchTree Leftist;
SkewHeap Skew;
Timer timer;
for(int i=1; i<=4; i++)
{
... | ALGO | 0.916861 | 3.981934 |
2d7847c8-92dc-43a8-8f87-f0b155808f8f | tokudai0000/tokumemo_plus | tokumemo_plus/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.998727 | 6.785645 |
03b810ff-827b-4e5e-886d-cd95144c769d | urban-jungle/Code_Sprint | 프로그래머스/0/181887. 홀수 vs 짝수/홀수 vs 짝수.cpp | #include <string>
#include <vector>
using namespace std;
int solution(vector<int> num_list) {
int answer = 0;
int odd = 0, even = 0;
for(int i = 0; i < num_list.size(); i++){
if(i % 2 == 0 || i == 0){
odd += num_list[i];
}
else if(i % 2 == 1){
even += num_li... | ALGO | 0.999445 | 5.236136 |
a4147533-062d-49f3-9173-03d159d890a6 | MohamadAshrafSalama/User-Stories-generation | Code_Snippets/41-50/s377103641.cpp | #include <iostream>
#include <iomanip>
int main(void)
{
float a = 0;
float b = 0;
float c = 0;
float d = 0;
float e = 0;
float f = 0;
float x = 0;
float y = 0;
while (std::cin >> a >> b >> c >> d >> e >> f)
{
float tmp_a = a * e;
float tmp_c = c * e;
float tmp_d = d * b;
float tmp_f = f * b;
if ... | ALGO | 0.999419 | 3.763733 |
3c2fb2ca-e772-4952-ab60-caed520ca23e | Hanyeojun/BaekJoon | 5176.cpp | #include <iostream>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie();
int t, p, m;
cin >> t;
while (t--) {
int cnt = 0, arr[501] = {0};
cin >> p >> m;
for (int i = 0; i < p; i++) {
int x;
cin >> x;
... | ALGO | 0.99947 | 3.958576 |
ed84aa2b-b1c8-4431-9675-cd8d3f41b15a | wuzhupc/mangos | src/bindings/ScriptDev2/scripts/kalimdor/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp | /* ScriptData
SDName: mob_anubisath_sentinel
SD%Complete: 75
SDComment: Abilities selection needs further improvements. Shadow storm is not properly implemented in core it should only target ppl outside of melee range.
SDCategory: Temple of Ahn'Qiraj
EndScriptData */
#include "precompiled.h"
enum
{
EMOTE_GENERIC_... | TOOL | 0.926301 | 6.294531 |
4a531706-cba0-4f25-90d0-7a465e692138 | yunjie-guo/LeetCode-Practice | Top 100 Liked Questions/322-coin-change.cpp | class Solution {
public:
int coinChange(vector<int>& coins, int amount) {
if( coins.empty() ) return -1;
vector<int> dp( amount + 1, INT_MAX );
sort( coins.begin(), coins.end(), greater<int>() );
dp[0] = 0;
/*
F(3)=min{F(3−c1),F(3−c2),F(3−c3)}+1
=min{F(3−1... | ALGO | 0.999933 | 5.8117 |
2160c056-d39a-41bb-ad33-1893f1562108 | SapphireFang1998/University-All-Semester-Codes | 2.2/CSE 2208/18_Kruskal.cpp | #include<bits/stdc++.h>
using namespace std;
priority_queue<pair<int , pair<int, int> > > q;
int s[100];
sort_edges(vector<pair<int, int> > v[], int n)
{
for(int i = 1; i <= n; i++)
{
for(int j = 0; j < v[i].size(); j++)
{
q.push(make_pair(-v[i][j].second, make_pair(i, v[i][j].fi... | ALGO | 0.999968 | 4.44951 |
714526d4-b13e-41c3-b9f0-534c94bd00dd | shivkaraman/DSA | 01_Pep coding/Level 2/02_Bit Manipulation/34_LongestAwesomeString.cpp | /*
You have been given a string s. An awesome substring is a non-empty substring of s such that we can make any number of swaps (0 to infinite) in order to make it a palindromic string.
Sample Input
3242415
Sample Output
5
https://www.youtube.com/watch?v=rZPCi5JySY4
*/
#include <iostream>
#include <string>
#... | ALGO | 0.99988 | 4.963894 |
e3711595-5dd9-4ef7-9e61-8091789ddfdf | jsh15932/BOJ_Solve | 4195.cpp | #include<bits/stdc++.h>
using namespace std;
int t;
int parent[20001];
int arr[20001];
int Find(int x) {
if(x == parent[x]) {
return x;
}
return parent[x] = Find(parent[x]);
}
void Union(int x1, int x2) {
x1 = Find(x1);
x2 = Find(x2);
if(x1 != x2) {
if(arr[x1] < arr[x2]) {
... | ALGO | 0.999917 | 4.547722 |
0715a8f1-e746-4878-bc13-35486a57ff84 | OleJohanBerg/gem5 | src/systemc/tests/systemc/misc/synth/blast/blast1/blast1.cpp | /*****************************************************************************
blast1.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/*****************************************************************************... | TOOL | 0.910069 | 4.159432 |
3dd3d932-623f-47bb-98b3-882e0a786887 | asalamatov/Cpp_Projects | CP_First_Milestone/Maps/Maps/Maps.cpp | #include<iostream>
#include<map>
using namespace std;
int main() {
map<string, int> menu; // lexicographic order
//insert key value pair inside the hashtable 0(logN) operation
menu["maggi"] = 15;
menu["colddrink"] = 20;
menu["dosa"] = 99;
menu["mag"] = 135;
menu["coddrink"] = 220;
menu["dsdfsdsa"] = 939;
/... | TOOL | 0.986138 | 4.613562 |
24fd0b88-cbdc-47d1-a009-6f37b2719658 | whitehatty/Programming-Principles-and-Practice-Using-Cpp | Programming-code/Chapter04/chapter.4.3.1.cpp |
//
// This is example code from Chapter 4.3.1 "Constant expressions" of
// "Programming -- Principles and Practice Using C++" by Bjarne Stroustrup
//
//------------------------------------------------------------------------------
int main()
{
const double pi = 3.14159265359;
//pi = 7; // error: as... | ALGO | 0.905016 | 5.327523 |
62b29c59-a627-49b8-8e78-6962e05b35e9 | ishandutta2007/codeforces | emilan/normal/1279/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define SZ(a) int(size(a))
#define ALL(a) begin(a), end(a)
#define RALL(a) rbegin(a), rend(a)
using ll = long long;
using i128 = __int128_t;
using ld = long double;
using pii = pair<int, int>;
const int kA = 1e6;
const int kMod = 998244353;
template <typename T>
T m... | ALGO | 0.999962 | 4.525712 |
5fee402f-fc0e-4719-923a-4d75d99272e4 | SRIKARREDDY-dotorg/Leetcode_Problems | Kth_Smallest_in_Lexicographical_order.cpp | // https://leetcode.com/problems/k-th-smallest-in-lexicographical-order/?envType=daily-question&envId=2024-09-22
class Solution {
public:
int findKthNumber(int n, int k) {
int curr = 1;
k--;
while (k > 0) {
int step = countSteps(n, curr, curr + 1);
if (step <= k) {
... | ALGO | 0.999763 | 7.629072 |
28b436b7-5be3-4894-8c31-44b147e49cd3 | suarej/Tree | inOrder by stack.cpp | #include <iostream>
#include <stack>
using namespace std;
class Node
{
int data;
struct Node* left;
struct Node* right;
Node (int data)
{
this->data = data;
left = right = NULL;
}
};
void inOrder(Node *root)
{
stack <Node *> s;
Node *curr = root;
while (curr !... | ALGO | 0.999983 | 5.830532 |
54f6e1db-8ee1-467d-819a-9b1b1b62fb19 | nikhilchowdary-yamani/AP20110010067-CS306-L | Week10-Lab-exercise/shift_reduce_parrer(1).cpp | #include<stdio.h>
#include<stdlib.h>
void pop(),push(char),display();
char stack[100]="\0", input[100], *ip;
int top=-1;
void push(char c)
{
top++;
stack[top]=c;
}
void pop()
{
stack[top]='\0';
top--;
}
void display()
{
printf("\n%s\t%s\t",stack,ip);
}
int main()
{
printf("E->E+E\n");
printf("E->E*E\n");
printf("E->(E... | ALGO | 0.999641 | 3.011401 |
f49a94a3-824b-4745-b30a-b9238a3b72d1 | phanirajkiran/Coding-Practise | 2 - Count Leaves in Binary Tree.cpp | #include <bits/stdc++.h>
using namespace std;
class node{
public:
int data;
node* left;
node* right;
};
int countLeaves(node* root){
if(root == NULL) return 0;
if(root->left == NULL && root->right == NULL) return 1;
else{
int l = countLeaves(root->left);
int r = countLeaves(root->right);
... | ALGO | 0.999759 | 5.3094 |
82b73dce-979d-40c8-b5ba-668def6e4505 | St333fan/strawberry-detection | opencv/modules/stitching/src/util.cpp | #include "precomp.hpp"
namespace cv {
namespace detail {
void DisjointSets::createOneElemSets(int n)
{
rank_.assign(n, 0);
size.assign(n, 1);
parent.resize(n);
for (int i = 0; i < n; ++i)
parent[i] = i;
}
int DisjointSets::findSetByElem(int elem)
{
int set = elem;
while (set != parent... | ALGO | 0.997275 | 5.520399 |
4c6e4ba6-2461-4a74-91ca-bb7b1dc2a048 | Gerrytty/parallel-programming-course | openMP/task2dd.cpp | #include <omp.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
#pragma omp parallel num_threads(3)
{
if (omp_get_num_threads() > 1) {
printf("Hello from area one, thread num = id, common num of threads = %i\n",
omp_get_thread_num(), omp_get_num_thr... | TOOL | 0.868288 | 4.559306 |
c923260d-f4db-4b92-aa40-08fba4e6230d | Pragna235/Geeks-for-Geeks | Floor in a Sorted Array.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
// Function to find floor of x
// n: size of vector
// x: element whose floor is to find
int findFloor(vector<long long> &v, long long n, long long x) {
// Your code here
... | ALGO | 0.999972 | 5.977587 |
a3d86e8b-7c13-448c-97a7-7481ad1c72e4 | minjoongkim99/algorithm | 프로그래머스/3/49189. 가장 먼 노드/가장 먼 노드.cpp | #include <string>
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
using namespace std;
vector<pair<int,int>> adj[20005];
int d[20005];
int visited[20005];
int solution(int n, vector<vector<int>> edge) {
int answer = 0;
for(auto e : edge){
adj[e[0]].push_back({1, e[1]});
... | ALGO | 0.997998 | 4.528704 |
43634599-e185-4e6b-99d3-58864786a232 | Amroning/Point-Cloud-Registration | SpinImage/test.cpp | #include<iostream>
#include<pcl/point_types.h>
#include<pcl/point_cloud.h>
#include<pcl/io/pcd_io.h>
#include<pcl/search/kdtree.h>
#include<pcl/features/normal_3d_omp.h>
#include<pcl/features/spin_image.h>
#include<pcl/filters/voxel_grid.h>
#include<pcl/visualization/pcl_plotter.h>
#include<boost/thread/thread.hpp>
usi... | ALGO | 0.961989 | 4.250171 |
7888bd46-c41c-4d26-96af-6183526a0606 | fupengfei058/algorithm | Leetcode/32. Longest Valid Parentheses.cpp | /*Longest Valid Parentheses:Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parentheses substring.*/
class Solution {
public:
int longestValidParentheses(string s) {
int ls = s.size();
int res = 0;
int cnt;
unordered_map<i... | ALGO | 0.99976 | 5.499651 |
c9065650-2352-4a04-8ccf-09b0e6dcf472 | lapalb/coursera-ds-algorithms | 4. String Algorithms/Programming-Assignment-1/trie_matching/trie_matching.cpp | #include <string>
#include <iostream>
#include <fstream>
#include <vector>
#include <map>
using namespace std;
using std::vector;
using std::string;
struct edge;
struct node {
public:
node(int i) {
index = i;
}
int index;
vector<edge> edges;
bool is_leaf() {return edges.empty();}
};
... | ALGO | 0.999586 | 4.660184 |
c77d6736-1884-436e-8368-d3db4f6d02d2 | 1604078-MEHEDI/Codeforces | codeforces/427/B.cpp | /*بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم*/
//#pragma GCC optimize("O3,unroll-loops")
//#pragma GCC target("avx,avx2,fma")
#include <bits/stdc++.h>
using namespace std;
#define FASTIO ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
typedef long long ll;
using pii = pair<int, int>;
const double PI = acos(-1.0)... | ALGO | 0.999967 | 3.909937 |
a4b82ac3-2b80-45ad-9f72-ce1f29f38cb0 | sohan-cse/My_c_plus_plus | Programiz.com/codeforces/petya and string.cpp | #include<iostream>
#include<cctype>
using namespace std;
int main()
{
string s,s1;
cin>>s;
cin>>s1;
// int i,j;
for( int i=0;i<s.size();i++)
{
s[i]=tolower(s[i]);
s1[i]=tolower(s1[i]);
}
if(s==s1)
cout<<0;
else
for( int i=0;i<s.size();i++)
{
... | ALGO | 0.999971 | 3.238408 |
8ef0577e-ba21-4c8d-abc8-4f3118059ddd | kumarsantosh3914/Pre-Placement-Program | Array questions/AssignmentQuestions8/question3.cpp | int longestCommonSubsequence(string text1, string text2)
{
int n = text1.size();
int m = text2.size();
vector<vector<int>> dp(n + 1, vector<int>(m + 1, -1));
for (int j = 0; j <= m; j++)
dp[0][j] = 0;
for (int i = 0; i <= n; i++)
dp[i][0] = 0;
for (int i = 1; i <= n; i++)
{
... | ALGO | 0.999934 | 5.568039 |
2d5233b6-958e-4488-ba77-0a966083f68c | guangyangai/CarND-MPC-Project | src/Eigen-3.3/doc/examples/TemplateKeyword_simple.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace Eigen;
void copyUpperTriangularPart(MatrixXf& dst, const MatrixXf& src)
{
dst.triangularView<Upper>() = src.triangularView<Upper>();
}
int main()
{
MatrixXf m1 = MatrixXf::Ones(4,4);
MatrixXf m2 = MatrixXf::Random(4,4);
std::cout << "m2 before copy:"... | TOOL | 0.976324 | 5.210898 |
01974c44-35b7-4ee0-89d8-a483b39454cc | RenardBleu/Flutter-TP6 | 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.998733 | 6.76775 |
d406f0f2-4e1b-4d3e-aef7-bac5cfd38644 | achenfengb/PRINCESS_opensource | ThirdParty/cryptopp562/rc5.cpp | // rc5.cpp - written and placed in the public domain by Wei Dai
#include "pch.h"
#include "rc5.h"
#include "misc.h"
NAMESPACE_BEGIN(CryptoPP)
void RC5::Base::UncheckedSetKey(const byte *k, unsigned int keylen, const NameValuePairs ¶ms)
{
AssertValidKeyLength(keylen);
r = GetRoundsAndThrowIfInvalid(params, thi... | ALGO | 0.998707 | 7.489835 |
31d862fb-303f-4263-8829-5a7541de7f48 | devilcoder2209/-CrackYourPlacement_devilcoder | day_3/day_3_third.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
long long findMinDiff(long long m, long long n,vector<long long> a ) {
// code
sort(a.begin(), a.end());
long long diff = 1e18;
long long i = 0, j = i + (m - 1);
while (j < n) {
diff = min(diff, a[j] - a[i]);
i++;
... | ALGO | 0.999961 | 5.08879 |
e1012432-1fe6-4fc8-9675-27009636dfc9 | congluvcode/foodponi-test | 2.24.cpp | #include<stdio.h>
#include<ctype.h>
#include<string.h>
#include<stdlib.h>
int main(){
char c[1000];
gets(c);
int n=0;
char a[10][50];
char *token=strtok(c," ");
while(token!=NULL){
strcpy(a[n],token);
n++;
token=strtok(NULL," ");
}
int ok=0;
for(int i=1;i<n;i++){
for(int j=0;j<i;j++){
if(strcmp(a[i... | ALGO | 0.999778 | 3.201655 |
5f5cde0f-5c64-4e2c-bdef-e2e7183e7b5f | lasp/basilisk | src/architecture/utilities/avsEigenSupport.cpp | #include "avsEigenSupport.h"
#include <math.h>
#include "architecture/utilities/macroDefinitions.h"
#include "rigidBodyKinematics.h"
/*! This function provides a general conversion between an Eigen matrix and
an output C array. Note that this routine would convert an inbound type
to a MatrixXd and then transpose the... | ALGO | 0.952987 | 5.895829 |
2bcb7b6c-823d-4648-8097-a146eaf0280f | JulioMelo-Classes/lista-1-anacarolinedantas | filter/src/filter_students.cpp | #include <iostream>
#include <iterator>
int * filter( int * first_, int *last_ )
{
// Percorrer o intervalo do início ao fim, analisando cada elemento
while( first_ != last_ )
{
// Avaliar se o elemento deve ser filtrado ou não
if ( *first_ <= 0 ) // rejeitado
{
// Deslo... | ALGO | 0.999546 | 5.230651 |
71c1c0c0-d2b2-4f3b-8525-69e2df607cdf | gadidgc/volcano-simulation | Linking/BULLET/include/BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp | #include "btMinkowskiSumShape.h"
btMinkowskiSumShape::btMinkowskiSumShape(const btConvexShape* shapeA, const btConvexShape* shapeB)
: btConvexInternalShape(),
m_shapeA(shapeA),
m_shapeB(shapeB)
{
m_shapeType = MINKOWSKI_DIFFERENCE_SHAPE_PROXYTYPE;
m_transA.setIdentity();
m_transB.setIdentity();
}
btVector3 ... | ALGO | 0.983913 | 6.697566 |
dbde49ef-603c-4706-8602-4b6b25318299 | RohitRajoria28/pep_practice | BATCH 91/LECTURE 2/pat4.cpp | #include<iostream>
using namespace std;
void numdiamond(int n)
{
int nst=1;
int nsp=n-1;
for(int r=1; r<=n; r++)
{
for(int csp=1; csp<=nsp; csp++)
{
cout<<" ";
}
int val=r;
if(r>n/2+1)
val=n-r+1;
for(int cst=1;cst<=nst; cst++)
... | ALGO | 0.999598 | 4.236639 |
8559121d-71c6-4185-ab4f-2f06fb7589d0 | guozc09/ADT | src/main.cpp | #include <iostream>
#include <stack>
#include "linkList.h"
using namespace std;
int main()
{
#if 0
/* 栈的操作 */
stack<int> first; //构造一个用于存放int类型的空栈(默认底层容器为deque),size=0。
deque<int> mydeque(3, 100); //构造一个包含3个int元素的双端队列
stack<int> second(mydeque); //用自己的双端队列构造一个栈(size=3)
stack<int, vector<int>> thir... | ALGO | 0.955887 | 3.443639 |
10c9c5a6-5c07-4605-a82c-b93664beb695 | rakeshyadav36k/git-github-practice | Leetcode_daily_problem/50_2115.cpp | /**
* You have information about n different recipes. You are given a string array recipes and a 2D string array ingredients. The ith recipe has the name recipes[i], and you can create it if you have all the needed ingredients from ingredients[i]. A recipe can also be an ingredient for other recipes, i.e., ingredients... | ALGO | 0.99988 | 6.788229 |
8793e760-9f2c-42f8-a272-29800bcc4f25 | zobaer-ahmed-zihad/journeyToCode | 05_CP_Weekly_Mission/03_CP_Weeks/cp-solutions-random/C_Numeric_String_Template.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t;
cin >> t;
while (t--)
{
int n;
cin >> n;
vector<int> v(n);
for (int i = 0; i < n; i++)
{
cin >> v[i];
}
int m;
... | ALGO | 0.999874 | 5.203313 |
33c630b2-5e5e-4528-b0e6-fec0e4262076 | bnyorukoglu/CSE241_2016-2017 | HW6/CPU.cpp | //BENGI YORUKOGLU
//131044046
// File: CPU.cpp
//Created on 24 Ekim 2016 Pazartesi, 14:27
#include "CPU.h"
#include <string>
using namespace std;
//program countera 1 atanan setteri cagirir.ve registerlarin bulundugu arrayin
//atamalarinin yapildigi setteri cagirir
CPU::CPU() {
}
CPU::CPU(int option) {
setR... | TOOL | 0.87762 | 3.067008 |
6cf25253-05a4-45d3-91a0-ff3af5903515 | atique7465/algorithm_in_detail | Dynamic_programming/coin_change/light_oj_1231 - COIN CHANGE (I).cpp | #include<bits/stdc++.h>
#define ll long long int
using namespace std;
int i,t,n,value;
int coin[100],limit[100];
int dp[51][1001][21];
int coin_change(int i,int lim,int amount)
{
if(i>=n)
{
if(amount==0)
return 1;
else
return 0;
}
if(dp[i][amount][lim]!=-1)
... | ALGO | 0.999958 | 3.48361 |
d60e3dd6-8502-441b-a898-da910f09cf4b | vt167098/cpp | main5.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int main(int argc, char *argv[]) {
int n,i;
scanf("%d%*c",&n);
while(n--){
char s[1001];
int num[1000]={0},k=0,max=0,ans=0;
scanf("%[^\r]%*c",s);
fo... | ALGO | 0.999733 | 3.387894 |
71d999b4-3c91-4ef6-8660-93dcc162cd89 | apu52/GFG-Daily-Solutions | Maximize The Cut Segments.cpp | class Solution
{
public:
//Function to find the maximum number of cuts.
int maxCutUtils(int n, int x, int y, int z, vector<int>& dp) {
if (n == 0) {
return 0;
}
if (n < 0) {
return -1;
}
if (dp[n] != -1) {
return d... | ALGO | 0.999861 | 5.051915 |
f012abc6-241f-436d-9ec4-e283bf59f575 | surajjaiswal-cmd/courses | dsa/deletenode.cpp | #include <iostream>
using namespace std;
// 1. delete a node from start in linkd list.
// 2. delete end node in linkd list.
// 3. delete a perticuller node from linkdlist.
// 4. delete a perticuller node from linkdlist by function.
//======================================================================================... | ALGO | 0.999853 | 4.850512 |
b804e7c9-8adf-4c4a-a780-a13dcc1bdd84 | Jack--Ma/LeetCode | Paiza/S039/BossHome.cpp | #include <stack>
#include "BossHome.hpp"
/**
あなたはゲームエンジニアで、ダンジョンゲームの開発をしています。
ダンジョンのマップは縦 H マス × 横 W マスからなっており、このダンジョンのいくつかのマスは塞がっています。
あなたは、塞がっていないマスのみからなる長方形のうちで、面積が最大となる長方形をボスの部屋にしようと考えています。
このとき、ボスの部屋の面積を出力してください。
入力例1
4 5
.##..
.....
...##
#.###
出力例1
6
Leetcode: https://... | ALGO | 0.9997 | 5.86776 |
166c7310-d223-41af-b153-3f8749081217 | nafeeshossain/cpp_DSA | 11 Array1/1SyntexAndDeclaration.cpp | #include<iostream>
using namespace std;
int main(){
// int x[7];
// x[1] = 5;
int arr[7] = {1,7,8,5,6,7,9};
cout<<arr[3];
return 0;
} | ALGO | 0.953656 | 3.008933 |
2652ab0c-f03a-4185-8b4b-5c65601f9f12 | YoungJooYoo/For_Coding_Test | Leet Code/2960. Count Tested Devices After Test Operations.cpp | class Solution {
public:
int countTestedDevices(vector<int>& batteryPercentages)
{
const size_t LEN = batteryPercentages.size();
int result = 0;
for (size_t i = 0 ; i < LEN; ++i) {
if (batteryPercentages[i] - result > 0) ++result;
}
return result;
}
};
... | ALGO | 0.999294 | 6.666454 |
8843a2f7-b30c-4657-8f75-c4ffe9f98a60 | shinespeciall/mathcalc | mathcalc/eigen337/doc/examples/QuickStart_example2_dynamic.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
using namespace std;
int main()
{
MatrixXd m = MatrixXd::Random(3,3);
m = (m + MatrixXd::Constant(3,3,1.2)) * 50;
cout << "m =" << endl << m << endl;
VectorXd v(3);
v << 1, 2, 3;
cout << "m * v =" << endl << m * v << endl;
}
| ALGO | 0.999426 | 3.497552 |
aa2d9ed7-b98b-4bc2-8938-d0ab5a6e28cd | cozytk/programmers | dfs/1_mock_test/answer.cpp | #include <string>
#include <vector>
#include <iostream>
using namespace std;
vector<int> solution(vector<int> answers) {
vector<int> answer;
int i = -1;
int cnt1 = 0;
int cnt2 = 0;
int cnt3 = 0;
int max = 0;
while (answers[++i])
{
if (answers[i] == (i % 5 + 1))
cnt1... | ALGO | 0.999903 | 5.049116 |
39aac7f7-def3-41d0-893d-906e4a74e953 | ycsgg/oi_code | archieve/BZOJ4774/bzoj4774.cpp | #include <cstring>
#include <iostream>
#include <queue>
#include <vector>
using namespace std;
const int N = 1e4 + 5;
int n, m, d;
struct Graph {
struct Node {
int v, w;
};
vector<Node> edge[N];
void add(int u, int v, int w) {
edge[u].emplace_back(Node{v, w});
}
} G;
int f[(1 << 8) +... | ALGO | 0.999781 | 5.240525 |
2f7f2a88-93d5-4dbd-8340-f38dd13c8a1e | hjiang13/LLMs-in-IR | POJ-104/79/4035.cpp | #include <iostream>
using namespace std;
int monkey(int n1,int m1);
int main()
{
int m[301],n[301],j,i=0;
while (1)
{
cin >> "%d%d",&n[i],&m[i]);
if(m[i]==0&&n[i]==0)
break;
i++;
}
for(j=0; j<i; j++)
{
cout << "%d\n",monkey(n[j],m[j]));
}
return 0;
}
int monkey(int n1,int m1)
{
int res[301],k;
res[0]=0;
res[1]=0;
for(k... | ALGO | 0.999934 | 3.256525 |
309206e2-57b1-4efa-9350-a9586edeadad | sstuqtd/vocal | thridparty/boost/libs/geometry/doc/src/examples/algorithms/reverse.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
//[reverse
//` Shows how to reverse a ring or polygon
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/polygon.hpp>
#include <boost/geometry/geometries/ring.hpp>
#include <boost/geometry/geometries/adapted... | TOOL | 0.979206 | 7.230124 |
9de90ff5-5726-424c-beb7-f88445a894d1 | JimWongM/OptFuzz | webkit_for_optfuzz/Source/JavaScriptCore/b3/air/AirInsertionSet.cpp | #include "config.h"
#include "AirInsertionSet.h"
#if ENABLE(B3_JIT)
#include "AirBasicBlock.h"
#include <wtf/BubbleSort.h>
namespace JSC { namespace B3 { namespace Air {
void InsertionSet::insertInsts(size_t index, Vector<Inst>&& insts)
{
for (Inst& inst : insts)
insertInst(index, WTFMove(inst));
}
voi... | ALGO | 0.902659 | 6.34984 |
906a4850-29f9-442e-8da3-ece965eb97fa | HosseinMomeni2/winter2025 | Trainings/Clockwork/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define loop(n, i) for(int (i)=0; (i)<(n); (i)++)
#define cint(n) int (n); cin >> (n);
void solve()
{
cint(n);
vector<int> v(n); loop(n, i) cin >> v[i];
for(int i=0; i<n; i++)
{
if(2*max(n-i-1, i) >= v[i])
{
... | ALGO | 0.999317 | 3.948064 |
170dc627-e1b5-4f7d-8af4-a6596f74a183 | bg009/Data-Structures-and-Algorithms | binary_tree/lc_1457.cpp | #include<bits/stdc++.h>
using namespace std;
/**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x... | ALGO | 0.999848 | 5.321101 |
335de1ba-f431-4a7e-84e8-54f733b9a22f | pavellevap/code_antiplagiat | final_test/1/t9177_522_C_10193697.cpp | #include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
#include <set>
#include <map>
#include <ctime>
#include <cstring>
#include <cassert>
#include <bitset>
#include <sstream>
#include <queue>
#define pb push_back
#define mp make_pair
#define fs first
#define s... | ALGO | 0.999609 | 3.14227 |
6e1eb7db-ef58-4c09-acf1-cb62720f52df | younes38/Competitive-Programming | UVa-Solutions/UVa 10140.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
typedef vector<int > vi ;
typedef vector<ll> vl ;
#define endl '\n'
#define all(a) a.begin(),a.end()
#define open_file freopen("input.txt","r",stdin);
#define write_file freopen("output.txt","w",stdout);
#define mem(A,v) memset(A, v, sizeof(A));
#def... | ALGO | 0.999925 | 4.05687 |
1b2dc179-71c5-454c-8237-e0701aa2ddf8 | prashooshukla/datastructure-algorithm | Strings/palindrome-string.cpp | // https://www.interviewbit.com/problems/palindrome-string/
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int isPalindrome(string);
};
int Solution::isPalindrome(string A) {
int N = (int) A.length();
string B = "";
for (int i = 0; i < N; i++) {
if (isalpha(A[i... | ALGO | 0.999967 | 6.129813 |
3ab0650e-1d28-4df2-9d15-7137b2d65957 | ishandutta2007/codeforces | zhangzy/normal/895/D.cpp | #include<bits/stdc++.h>
#define mod 1000000007
#define ll long long
using namespace std;
int cnt[26],l,t[26],now;
char a[2001000],b[2001000];
ll jc[1001000],inv[1001000];
ll K(ll x,int y=mod-2){
ll t=1; for (;y;y>>=1,x=x*x%mod) if (y&1) t=t*x%mod; return t;
}
ll C(int x,int y){
return jc[x] *inv[y]%mod *inv[x-y]%mo... | ALGO | 0.999991 | 4.491765 |
f99ebd13-cea7-4168-94d5-55699de142f1 | flxcsx/Cc_solved | BROKENSTRING.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
yip:
while (t--)
{
int n;
cin >> n;
string s;
cin >> s;
int m = n / 2;
for (int i = 0; i < m; i++)
{
if (s[i] == s[i + m])
{
con... | ALGO | 0.999938 | 4.519013 |
bcceaff5-4003-45f2-8880-d0b83296e64c | EricWenyi/Eric_recent_work | PreviousCode_C&DataStructure/My_C++_Projects/Algorithm/test/main.cpp | #include <iostream>
#include<bits/c++io.h>
#include<vector>
using namespace std;
struct ListNode {
int val;
struct ListNode *next;
ListNode(int x) :
val(x), next(NULL) {
}
};
vector<int> printListFromTailToHead(struct ListNode* head) {
vector<int> results;
... | ALGO | 0.999954 | 4.019753 |
798b0468-74ff-4445-94fc-76f0ea3a4a26 | sugo14/Competitive-Programming | leetcode/completed/2554.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int maxCount(vector<int>& banned, int n, int maxSum) {
unordered_set<int> ban;
for (auto& x : banned) { ban.insert(x); }
int ans = 0, currCnt = 0;
for (int i = 1; i <= n; i++) {
if (currCnt + i > maxS... | ALGO | 0.999906 | 5.836209 |
3dd32400-f296-4de8-918c-c832fe8b0d36 | wyshim/Study | C/Test/23_12/26_Test.cpp | #include <iostream>
#include <string.h>
/*
struct Node
{
int data;
Node* next;
};
Node* createNode(int newData)
{
Node* newNode = new Node;
newNode->data = newData;
newNode->next = nullptr;
return newNode;
}
Node* insertNode(Node* current, int newData)
{
Node* newNode = new Node;
Node* after = current->next;... | ALGO | 0.992147 | 4.304281 |
8b3a0670-457b-4914-a294-930930b6a414 | hoangpc0112/dsa-ptit | Cây nhị phân/DSA11001 - CÂY BIỂU THỨC 1.cpp | #include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for (auto i = (a); i <= (b); ++i)
#define ROF(i, a, b) for (auto i = (a); i >= (b); --i)
#define sz(x) (int)(x).size()
#define pb push_back
#define ppb pop_back
#define endl '\n'
#define fi first
#define se second
#ifdef Juhan404
#include "debug.h"
#e... | ALGO | 0.998672 | 5.034903 |
837f6e38-d95f-4118-b4a5-92562da2a6a1 | girishetty/mytools | GraphsAndTrees/Graph/Graph.cpp | // Program to print BFS traversal from a given source vertex.
// BFS(int s) traverses vertices reachable from s.
#include <list>
#include <iomanip>
#include <iostream>
#include "Graph.h"
using std::cout;
using std::list;
using std::setw;
using std::vector;
/*
* Shortest distance between 2 nodes in a graph (distance... | ALGO | 0.999965 | 4.837571 |
680fd140-12b1-4749-88bf-5cccb897a44b | alexandraback/datacollection | solutions_1485490_0/C++/Radi/C.cpp | #define Long long long
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#includ... | ALGO | 0.9999 | 3.61356 |
c04e6a15-895d-4339-8299-8c280d69768f | ramster0111/Pac-man | code/ghost.cpp | #include"ghost.h"
#include<iostream>
#include"search.h"
#include"config.h"
#define DEBUG_LISTS 0
#define DEBUG_LIST_LENGTHS_ONLY 0
Ghost::Ghost(){
}
Ghost::Ghost(int color){
Color=color;
if(color==1){//pink
SetX(330);
SetY(300);
}
if(color==2){//red
... | ALGO | 0.876234 | 3.042625 |
16122d26-66be-4bf9-8efb-e6ede3108bdc | QianQNanami/JSOI-WC25 | PJ/judger/source/WC25-491/add.cpp | #include <bits/stdc++.h>
using namespace std;
int m,n;
int a[100010],s[100010],l[100010],r[100010];
int main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>a[i];
s[i]=s[i-1]+a[i];
}
cin>>m;
for(int i=1;i<=m;i++){
cin>>l[i]>>r[i];
}
for(int i=1;i<=m;i++){
cout<<s[r[i]]-s[l[i]]+a[l[i]]<<endl;
}
return 0;
}
| ALGO | 0.999827 | 3.367611 |
40184ba6-49e5-4aac-9cb2-fdfacdab27d8 | kktai1512/CS2040c | Kattis/PE Preparation/parsing_string.cpp | #include <bits/stdc++.h>
using namespace std;
/////////main template
int main() {
ios_base::sync_with_stdio(false); cin.tie(NULL);
freopen("in.txt", "r" , stdin);
string line; cin >> line;
//cout << line << endl;
cin.ignore();
//string a; getline(cin, a);
//cout << "this is " << a << endl;... | ALGO | 0.986456 | 3.793468 |
82f90684-c27f-47b7-85c2-39599ec734d2 | nomaannm/DS-ALGO-Sheets | HouseRobber.cpp | /**
@author NomanMumtaz
Problem No. : 198
*/
class Solution {
public:
int rob(vector<int>& nums) {
//if only one house return that
if(nums.size() < 2) return nums[0];
//creating an array to store maximum loot at each point.
vector<int> dp(nums.size(),0);
//Memoize max loot... | ALGO | 0.999817 | 5.900529 |
c15255be-115e-45b3-ae56-b09c9d14eb89 | Shikhar21121999/ds-algo-busted | next_permutation_string.cpp | // test next permutation
#include <bits/stdc++.h>
# define C continue
# define R return
# define D double
# define I insert
# define ll long long
# define ld long double
# define ull unsigned long long
# define ui unsigned int
# define pb push_back
# define pf push_front
# define vi vector < int >
# define vc... | ALGO | 0.999963 | 4.585822 |
90aab366-aa39-48c2-8700-69c9c0ae8050 | dinhthigaamer/ITK65 | IT_K65/Solution_Day_1/vknights.cpp | #include<bits/stdc++.h>
using namespace std;
#define MASK(i) (1<<i)
#define BIT(x,i) ((x>>i)&1)
#define int long long
int n;
int Z[105];
int f[105][10][10],cnt[105][10][10];
vector<int> g[105];
int check(int mask1,int mask2,int mask3)
{
if(BIT(mask2,0) && BIT(mask1,2)) return 0;
if(BIT(mask2,2) && BIT(mask1,... | ALGO | 0.999922 | 3.506163 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.