uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
a1bcdc8c-4bb9-4fe1-b872-2f15de586123 | imrann2005/OperatingSystemAlgo-CP | fifoPageReplacement.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cout << "Enter Size of Page Ref String\n";
cin >> n;
cout << "Enter Page Ref String\n";
int pg[n];
for (int i = 0; i < n; i++)
{
cin >> pg[i];
}
int f;
cout << "Enter No. of Frames\n";
cin >> f;
int fr... | ALGO | 0.999429 | 3.846804 |
f1d02fba-1a6a-449e-9a17-223e29e6da13 | MykhailoMikhnenko/OpenUSD-22.05b | pxr/usd/sdf/layerUtils.cpp | #include "pxr/pxr.h"
#include "pxr/usd/sdf/layerUtils.h"
#include "pxr/usd/sdf/assetPathResolver.h"
#include "pxr/usd/sdf/fileFormat.h"
#include "pxr/usd/sdf/layer.h"
#include "pxr/usd/ar/packageUtils.h"
#include "pxr/usd/ar/resolver.h"
#include "pxr/base/tf/pathUtils.h"
#include "pxr/base/trace/trace.h"
using std::s... | TOOL | 0.866758 | 4.894311 |
f4d0d7fe-6ff7-4bf0-b279-769bd1a5981c | SparshJain2000/GFG_Solutions | Trees/level-order-traversal-in-spiral-form.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// Tree Node
struct Node {
int data;
Node* left;
Node* right;
};
// Utility function to create a new Tree Node
Node* newNode(int val) {
Node* temp = new Node;
temp->data = val;
temp->left = NULL;
temp->right = NULL;
... | ALGO | 0.999975 | 6.728221 |
5690df37-2e4b-4569-935c-d676a34cc6d4 | ishandutta2007/codeforces | evilbuggy/normal/1174/F.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 200005;
vector<int> g[N];
int sz[N], bc[N], bl[N], dep[N], par[N];
void dfs1(int v, int p, int d = 0){
sz[v] = 1; dep[v] = d; par[v] = p;
for(int u : g[v]){
if(u != p){
dfs1(u, v, d + 1);
sz[v] += sz[u];
}
}
}
void dfs2(int v, int p){
bc[v] =... | ALGO | 0.999764 | 4.227441 |
fa0cefec-b3a6-45d0-9fb1-3d797b8833d2 | xconfigurator/test_20200428_c_cpp | 02_C++/03_tju_lvfengzhu/04_function/01.10.cpp | /**
* @file 01.10.cpp
* @author your name (<EMAIL>)
* @brief 分析程序运行结果
*
* 引用做返回值
*
* @version 0.1
* @date 2023-10-20
*
* @copyright Copyright (c) 2023
*
*/
#include <iostream>
using namespace std;
int &f1(int n, int s[]) {
// 写法1
/*
int &m = s[n];
return m;
*/
// 写法2 liuyang
... | ALGO | 0.980495 | 3.41208 |
1af6e021-dcc2-42e5-b1b4-4da5d0deacdb | xXxSpicyBoiiixXx/Parallel-and-Distributed-Process | Homework/Programming-Assignments/PA-3/examples/wiki_ex.cpp | #include <iostream>
using namespace std;
void solve(double* a, double* b, double* c, double* d, int n) {
n--;
c[0] /= b[0];
d[0] /= b[0];
for(int i = 1; i < n; i++) {
c[i] /= b[i] - a[i] * c[i-1];
d[i] = (d[i] - a[i] * d[i-1]) / (b[i] - a[i] * c[i-1]);
}
d[n] = (d[n] - a[n] * d[n-1]) / (b[n]... | ALGO | 0.999981 | 3.010237 |
0b584961-c269-4347-89e0-8b4d48cd65b9 | andyyang200/CP | Competitive Programming/Contests/CodeForces/Contests/Educational Rounds/Educational Codeforces Round 2/Queries/queries.cpp | //Andrew Yang
#include <iostream>
#include <stdio.h>
#include <sstream>
#include <fstream>
#include <string>
#include <string.h>
#include <vector>
#include <deque>
#include <queue>
#include <stack>
#include <set>
#include <unordered_set>
#include <map>
#include <unordered_map>
#include <algorithm>
#include <functional>... | ALGO | 0.999993 | 3.831552 |
74e00648-ceee-4da4-85f6-c359685319ae | K-Chinmay/cp_course | backtracking/word_search.cpp | // Link : https://leetcode.com/problems/word-search/
#include<bits/stdc++.h>
using namespace std;
class Solution {
public:
vector<int> drow = {0,-1,0,1} ;
vector<int> dcol = {-1,0,1,0} ;
bool bounded(int i, int j, int n, int m){
return (i >= 0 && j >= 0 && i < n && j < m) ;
}
bool helper... | ALGO | 0.999794 | 5.996261 |
a582b7cc-1d26-4dc6-8656-42b131ed6ab6 | ajbass/lit | src/qfc_CompQuadFormPackage.cpp | // CODE FROM COMPQUADFORM UTILIZED WITHIN LIT
#define UseDouble 0 /* all floating point double */
#include <R.h>
#include "Rmath.h"
#include <setjmp.h>
// Incorporate our header
#include "qfc.h"
using std::atan;
using std::exp;
using std::sin;
using std::log;
using std::fabs;
using std::sqrt;
using std::f... | ALGO | 0.999396 | 4.177266 |
d98eaae6-1671-4672-8684-2b9e2f14e156 | sheeluofficial/practice | OthersCode/LeetCode-Solutions-master/LeetCode-Solutions-master/C++/longest-common-subpath.cpp | // Time: O(m * nlogn)
// Space: O(n)
class Solution {
public:
int longestCommonSubpath(int n, vector<vector<int>>& paths) {
int left = 1, right = size(*min_element(cbegin(paths), cend(paths),
[](const auto& x, const auto& y) {
... | ALGO | 0.999969 | 6.334981 |
65d66503-10b3-4d23-9b6f-4dcaf4b06b40 | uukh22/Problem-Solving | sheets ICPC ASSUIT/3# Arrays/R/main.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long n;
cin>>n;
int arr[10005];
int arr1[10005];
for(int i=0;i<n;i++){
cin>>arr[i];
}
sort(arr,arr+n);
for(int i=0;i<n;i++){
cin>>arr1[i];
}
sort(arr1,arr1+n);
int flag = false;
for(int i=0;i<n;i++){
if(arr[i] != arr1[i]){ flag = true; ... | ALGO | 0.999988 | 3.368806 |
e90dcef9-cad2-4798-8eb8-5979b2481260 | external-validations/swift | unittests/AST/ArithmeticEvaluator.cpp | using namespace swift;
using namespace llvm;
class ArithmeticExpr {
public:
enum class Kind {
Literal,
Binary,
} kind;
// Note: used for internal caching.
Optional<double> cachedValue;
protected:
ArithmeticExpr(Kind kind) : kind(kind) { }
};
class Literal : public ArithmeticExpr {
public:
con... | TOOL | 0.925744 | 7.889431 |
e2501860-3ee0-437b-84b3-9c9ae65b6a4c | alisha0903/LeetcodePractice | 0152-maximum-product-subarray/0152-maximum-product-subarray.cpp | class Solution {
public:
int maxProduct(vector<int>& nums) {
if(nums.empty())
return 0;
int best=INT_MIN;
int maxProd=1;
int minProd=1;
for(int n:nums)
{
if(n<0)
swap(maxProd,minProd);
maxProd=max(maxProd*n,n);
m... | ALGO | 0.999988 | 6.046658 |
4cec2f88-0c27-463f-b691-c8588bdd1ee5 | sumit-kushwah/Labs | os/CPU Scheduling Algorithms/round_robin.cpp | #include <bits/stdc++.h>
using namespace std;
struct Process
{
int id;
int burst_time;
int finish_time;
int rem_burst_time;
int wait_time;
};
void about()
{
cout << "*******************************************************************" << endl;
cout << "\t"
<< "ROUND ROBIN CPU SCHE... | ALGO | 0.999325 | 4.728415 |
7b4e8d08-a970-4186-8d0f-5028c3d54bca | benjiro52/course.C.plus.plus | old_tasks_3/if_1_if_0.cpp | #include <iostream>
using namespace std;
int main()
{
int number1, number2, a;
cin >> number1 >> number2 >> a;
if (a == 0) {
cout << min(number1, number2);
} else {
cout << max(number1, number2);
}
return 0;
} | ALGO | 0.997693 | 3.519007 |
506ed362-4235-4d6c-882b-5d72ef558d8f | webguybit/500-interview-questions-CPP | Arrays/7. Maximum product of two elements in an array.cpp | /*
Name : Aman jain
Date: 23-06-20
Question : Maximum Product of two elements in an array
Problem Link : https://leetcode.com/problems/maximum-product-of-two-elements-in-an-array/
Solution to leetcode :
*/
Method 1 - > Find maximum element twice O(n) (Only for positive numbers)
int max_elements(vector<int> &v){
... | ALGO | 0.999947 | 5.414341 |
0cf2c7bf-633d-4adb-8edb-bfac81c83e4b | sx-aurora-dev/llvm-vp-project | libc/src/math/generic/frexp.cpp | #include "src/math/frexp.h"
#include "src/__support/common.h"
#include "utils/FPUtil/ManipulationFunctions.h"
namespace __llvm_libc {
LLVM_LIBC_FUNCTION(double, frexp, (double x, int *exp)) {
return fputil::frexp(x, *exp);
}
} // namespace __llvm_libc
| ALGO | 0.878186 | 4.81422 |
c81e3d4e-d4a7-4fbb-b7d9-c4631ab41f5e | devo8604/Maps_Lab6 | Maps_Lab6/CharityAward.cpp | //*************************************************************************
// TITLE: STL Set Lab
// FILENAME: CharityAward.cpp
// PREPARED FOR: CS230
// PROGRAMMER(S): Devon J. Smith
// DEVELOPMENT DATE: 08/24/14
// COMPILER USED: Apple LLVM Version 5.1
// TARGET PLATFORM: M... | TOOL | 0.966063 | 5.747197 |
a989215d-354c-4cbc-b4d6-3217809a3e42 | HasnainKabir-repos/IUT-Files | Algorithms/Labs/Lab 1/200042102_T1.cpp |
#include<iostream>
#include<queue>
#include<map>
using namespace std;
int main(){
int n;
cin>>n;
int adj[n][n];
map<int, bool> is_celebrity;
for(int i=0;i<n;i++){
int count = 0;
for(int j=0;j<n;j++){
cin>>adj[i][j];
if(adj[i][j] == 1) count++;
}... | ALGO | 0.999877 | 4.214421 |
825fa5b4-89f1-46f6-bb98-fa39fec203e4 | abcivashritt/codechef | Chef and Interactive Contests.cpp | #include <iostream>
using namespace std;
int main() {
int n, r,temp;
cin>>n>>r;
while(n--) {
cin>>temp;
cout<<(temp < r ? "Bad boi" : "Good boi")<<"\n";
}
return 0;
}
| ALGO | 0.996432 | 4.452767 |
96fecb61-5fc4-40bd-bf97-594f47893dd3 | Ashish-equinox/DSA-CPP- | L44_pt3_circularLL.cpp | <<<<<<< HEAD
#include<iostream>
using namespace std;
// circular LL--> we don't need a head pointer for a CLL as its tail pointer can be used for both pointing at head & tail simultaneously, using tail->next points to head of CLL
class Node{
public:
int data;
Node* next;
// constructor
Node(int d)... | ALGO | 0.999852 | 5.175387 |
ca18645f-a69a-4a32-bbb8-3597bf7692bb | StateFromJakeFarm/compProgramming | hackerrank/the_quickest_way_up.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
enum {
w = 0,
g = 1,
b = 2
};
// Return distance to square 100, or -1 if impossible
int shortestPathDFS(const vector<int> & board, const vector<int> & outPoints) {
vector<int> colors(100);
vector<int> rolls(100);
queu... | ALGO | 0.999587 | 5.25516 |
0586cf68-7131-4248-b84e-e31befe9c463 | BIR-K/controller-firmware | ArduCopter/mode_rtl.cpp | #include "Copter.h"
#if MODE_RTL_ENABLED == ENABLED
/*
* Init and run calls for RTL flight mode
*
* There are two parts to RTL, the high level decision making which controls which state we are in
* and the lower implementation of the waypoint or landing controllers within those states
*/
// rtl_init - initialis... | ALGO | 0.874757 | 4.071505 |
ca57cdc6-44bb-4a66-8f74-4401f55e00f0 | Jobayer75/PROGRAMMING-EOP | loop.cpp | #include<iostream>
using namespace std;
int main()
{
int i,j,k=1,y;
cout<<" October 2017"<<endl;
cout<<" SU"<<"\t"<<"Mon"<<"\t"<<"Tu"<<"\t"<<"WED"<<"\t"<<"TH"<<"\t"<<"Fr"<<"\t"<<"SAT"<<endl;
for (i=1;i<=5;i++)
{
for(j=1;j<=7;j++)
{
if(k>=1&&k<=31)
{
cout<<"\t "<<k;
k+=1;
}
... | ALGO | 0.997216 | 3.164592 |
9e34245e-5c53-446c-a774-c5bf2bcdc57f | rgap/C-Competitive-Programming-Codes | OTRAS_FBASICAS/todo.cpp | //bellman ford
typedef vector< pair<pair<int ,int> ,int> > nodo;
int resp[MAXS];
bool centi;
bool BF(nodo grafo,int num_nodos,int key){
fill(resp,resp+num_nodos,INF);//changevable if start in 1
resp[key]=0;
centi=true;
for(int i=0;(i<num_nodos-1&¢i);i++){
centi=false;
for(int j=0;j<grafo.size();j++){
if... | ALGO | 0.999976 | 3.893228 |
5dfea450-eaf6-4192-a262-8df04d1572bb | izanami-01/Journal_App | DSA/DIVTHREE1.cpp | /////*31022618*/////
//_MONU KUMAR
#include <bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define tc ll t=1; cin>>t; while(t--)
#define ll long long int
#define ld long double
#define ull unsigned long long
#define pll pair<ll,ll>
#define vll std::vector<ll>
... | ALGO | 0.999898 | 3.565355 |
6219b4ac-9e50-489d-8689-38b89e6c3857 | Naman21-web/CrackYourInternship | Trees/Medium/FindKthSMallestEleInBST.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999996 | 6.001978 |
604ed48d-c2cc-462e-80b7-e6cde0ba9266 | gantavyamalviya/LeetCode-Solution | 1329-sort-the-matrix-diagonally/1329-sort-the-matrix-diagonally.cpp | class Solution {
public:
vector<vector<int>> diagonalSort(vector<vector<int>>& mat) {
int r = mat.size();
int c = mat[0].size();
unordered_map<int, priority_queue<int, vector<int>, greater<int>>> m;
for(int i = 0; i<r; i++){
for(int j = 0; j<c; j++){
... | ALGO | 0.999982 | 6.062561 |
07acf637-5781-4cca-832e-fdcd2d8250b5 | ishandutta2007/codeforces | cinnamoroll/normal/1110/D.cpp | // warm heart, wagging tail,and a smile just for you!
//
//
//
//
... | ALGO | 0.999987 | 3.681153 |
af127342-e996-4e9e-8d77-a0b321fcc38c | ishandutta2007/codeforces | haj_lemon/normal/1013/B.cpp | #include<bits/stdc++.h>
using namespace std;
int n,x,y,ansn=3,f[100010],g[100010];
int main(){
cin>>n>>x;
for (int i=1;i<=n;i++){cin>>y;f[y]++;if (y!=(y&x))g[y&x]++;}
for (int i=0;i<=100000;i++){
if (f[i]>=2){ansn=min(ansn,0);}
if (f[i]>=1&&g[i]>=1) ansn=min(ansn,1);
if (g[i]>=2) ansn=min(ansn,2);
}
if (ansn... | ALGO | 0.999977 | 3.557878 |
39bc8d45-f149-4030-854f-403b26d824e1 | bachtn002/-CTDL-GT | Data-Structure-and-Algorithms-PTIT-2020-master/Contest_10-Graph_continue/BAI18.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5;
vector < pair < int, int > > graph[MAX + 5];
priority_queue < pair < long long, long long >,
vector < pair < long long, long long > >,
greater < pair < long long, long long > > > min_heap;
long long dist[MAX + 5];
long long f[MAX +... | ALGO | 0.999944 | 4.315899 |
2e75ad2f-86d6-4cff-be6c-9b3088a75d11 | RehanAyub56/Programming-Fundamental-CPP-Programs | Complex pattrens, Loops, Password, Encoding Decoding/Q6.cpp | #include <iostream>
using namespace std;
int main() {
int n;
bool isprime=true,isPrime = true;
int count = 0, num = 2,sum=0;
cout<<"Enter the number : ";
cin>>n;
while(n>98 || n<1){
cout<<"Number is out of range Enter between (1-98) : ";
cin>>n;
}
while(static_ca... | ALGO | 0.99963 | 3.011067 |
c3bc284d-3228-41fd-adcd-821e607d2708 | ishandutta2007/codeforces | wxhtzdy/normal/1676/H2.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <queue>
#include <ctime>
#include <cassert>
#include <complex>
#include <string>
#include <cstring>
#include <chrono>
... | ALGO | 0.999767 | 4.102269 |
31496dc8-85df-4d11-ba60-5283dc9a0d05 | sunlight-bytes/COP-2000-IRSC | programming-homework-assignment-5/prog-assg-5-baby-weights.cpp | /*
COP 2000 - Introduction to Programming
Program: Baby Weights
Written by: Aaliyah Lucien
Created: 07/4/2022, 9:13 PM
Last modified: 07/5/2022, 8:13 PM
*/
#include <iostream>
#include <iomanip>
using namespace std;
// This function displays the program's title, intructions for entering weights, and the developer's ... | ALGO | 0.994072 | 5.223092 |
e80e025a-1380-4248-8447-7156d6502b69 | ngctnnnn/evo_optim_cpp | include/boost/libs/math/tools/rational_tests.cpp | #include "mp_t.hpp"
#include <boost/random.hpp>
#include <boost/math/tools/rational.hpp>
#include <iostream>
#include <fstream>
int main()
{
using namespace boost::math;
using namespace boost::math::tools;
std::cout << std::scientific << std::setprecision(40);
boost::mt19937 rnd;
boost::variate_genera... | TEST | 0.928458 | 5.370524 |
e3f56d86-97c8-4976-8f9a-2beebbbb685a | roy7077/POTD-Leetcode | 451. Sort Characters By Frequency.cpp | // Time complexity - O(NlogN)
// Space complexity- O(N+2*N)
class Solution {
public:
string frequencySort(string s) {
unordered_map<char,int> mp;
for(auto it:s)
mp[it]++;
vector<pair<int,char>> ans;
for(auto it:mp)
ans.push_back({it.second,it.first});
... | ALGO | 0.999982 | 5.95134 |
cb17b579-0f42-4b0b-9ea1-1e513212ced7 | yo00unis/Problems | 262A. Roma and Lucky Numbers.cpp |
/*
problem link --> https://codeforces.com/contest/262/problem/A
*/
#include <iostream>
using namespace std;
short countLuckyNumbers(int n){
short ans = 0;
while(n){
if(n%10 == 4 || n%10 == 7)ans++;
n /= 10;
}
return ans;
}
int main(){
short n, k;
cin>>n>>k;
short ans =... | ALGO | 0.999495 | 3.856821 |
6e53cc2e-cb6b-4436-9516-e5a8b5a28473 | acc-cosc-1337-spring-2020/acc-cosc-1337-spring-2020-Ruby1909 | src/examples/13_module/01_recursion/recursion.cpp | #include "recursion.h"
#include<iostream>
//
void display(int n)
{
if (n == 0)
{
std::cout << "base case\n";
return;
}
std::cout << "hello\n";
display(n-1);
}
int factorial(int n)
{
int f = 1;
if (n == 0)
{
std::cout << "base case \n";
return f;
}
std::cout << "load stack"<<n<<' \n';
f = n * ... | ALGO | 0.975961 | 4.566632 |
2b5ff85f-0f26-4fd7-8c56-aac88dae9216 | zorchp/dsa | math/sieve-method/cpp_version.cpp | #include <iostream>
#include <bitset>
using namespace std;
#define X 1e7
constexpr int maxn = X + 10;
bitset<maxn> pri;
int primes[maxn];
void era() {
int N = X, cnt = 0;
double s = clock();
for (int i = 2; i * i <= N; ++i) {
if (!pri[i]) {
for (int j = i * i; j <= N; j += i)
... | ALGO | 0.999466 | 4.378706 |
1def16c6-77f4-413a-a3da-215e953308a6 | sxu39/TP-RPMD | lammps-stable_2Aug2023_update2/src/OPENMP/pair_coul_dsf_omp.cpp | // clang-format off
/* ----------------------------------------------------------------------
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */
#include "omp_compat.h"
#include "pair_coul_dsf_omp.h"
#include <cmath>
#include "atom.h"
#includ... | ALGO | 0.999448 | 6.812786 |
32d8934e-207e-469d-802c-bcc3d6739282 | ishandutta2007/codeforces | natsugiri/normal/208/C.cpp | #include<cstdio>
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<cstring>
#include<queue>
using namespace std;
typedef long long LL;
int n, m;
vector<int>G[128];
int len0[128], len1[128];
double next[128], prev[128];
void func(int s, int t, double ne[], int l[]) {
l[s]=0;
ne[s]=1... | ALGO | 0.999783 | 3.935978 |
de30558a-7eac-4110-b607-f4c334fa19a2 | shamsuddoha123/UVA-online-judge-25-problems | UVA 102 - Ecological Bin Packing.cpp | #include<stdio.h>
int main()
{
int brown[3],green[3],clear[3];
int moves[6];
int i,minMoves;
while(scanf("%d %d %d %d %d %d %d %d %d", &brown[0], &green[0], &clear[0], &brown[1], &green[1], &clear[1], &brown[2], &green[2], &clear[2]) != EOF)
{
moves[0] = green[0] + clear[0] + brown[1] + gree... | ALGO | 0.999891 | 3.41387 |
7b65c076-52f3-4bb0-aab6-eafe9409ecdb | priyanshu082/DSA-QUESTION | CP/cool_partition.cpp | #include<iostream>
#include<vector>
#include<map>
#include<set>
using namespace std;
int findPartition(vector<int> arr , int n){
set<int> prev,total;
int part=0;
for(int i=0;i<n;i++){
total.insert(arr[i]);
if(prev.count(arr[i])){
prev.erase(arr[i]);
}
if(prev.si... | ALGO | 0.999611 | 4.816811 |
0f27565c-b62d-4ab8-a71e-f067340c413c | syelan34/ICS4U | Unit 1/06/b/main.cpp | #include <iostream>
#include <math.h>
char* format(int);
int main() {
int *fbuf;
int x, y;
std::cin >> x;
std::cin >> y;
double r_delta = sqrt(y - x);
int WIDTH = fmax(1, floor(r_delta)), HEIGHT = fmax(1, ceil(r_delta));
fbuf = new int[WIDTH * HEIGHT];
for (int i = x, sw_flag = 0, ... | ALGO | 0.999764 | 3.386607 |
155115a4-6bb5-4e6f-ad09-e3d20f98c831 | Miracle-cl/Algorithms | LinkedList/IntersectionTwoLinkedLists.cpp | #include <iostream>
#include <vector>
using std::vector;
struct ListNode {
int val;
ListNode* next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
public:
ListNode * create_linked_list(const vector<int>& nums) {
ListNode dummy(-1);
ListNode* p = &dummy;
for (auto ... | ALGO | 0.999881 | 5.343599 |
b9f6402b-a192-4cd1-b88a-4be9c279d511 | thegamer1907/Code_Analysis | contest/1542573393.cpp | #include <bits/stdc++.h>
#define maxn 100100
#define INF 0x3f3f3f3f
typedef long long ll;
using namespace std;
int ans[210];
string s[210];
int f(int num){
for(int i=1;i<=10;i++){
for(int j=0;j<=(1<<i)-1;j++){
string t;
for(int k=0;k<i;k++){
if(j&(1<<k)) t += '1';
... | ALGO | 0.999716 | 3.98433 |
b44c7071-f781-4f83-99ba-f3f4c18aa0de | SpencerTSmith/FPGA-Sparse-Matrix-Implementations | csr_vmul/csr_vmul.cpp | #include "csr_vmul.h"
void csr_vmul(const CSR_Matrix *matrix, const Vector *vector, Vector *out) {
/*
NOTES for my own understanding: INTERFACE is a bit like declaring the registers, wires and what
not in verilog
the first argument is the mode of the data, how is it given to the kernel
For the data... | ALGO | 0.987221 | 3.588022 |
22423bd9-22a0-4b2a-b3d0-25b4296f40b0 | deepanshu1422/AlibabCloud_Work_Updates | FirstRepeatingElement.cpp | #include<iostream>
using namespace std;
#include<set>
#include<bits/stdc++.h>
int main()
{
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
sort(arr,arr+n);
set<int> s;
for(int i=0;i<n;i++){
s.insert(arr[i]);
}
set<int>::iterator itr;
itr=s.begin(... | ALGO | 0.999922 | 3.232823 |
bf92fe1f-2bda-4e56-8cb0-1d6d86bf2e31 | Noisey1Boy/stl | Codes/setA/stackprob.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string s = " hello world this is mahim";
stack<string> st;
// cout<<"enter text: ";
//cin>>s;
stringstream s1 (s);
string word;
while(s1 >> word){
st.push(word);
}
cout<<"output :"<<endl;
while (!st.empt... | ALGO | 0.996032 | 3.228644 |
ad778827-dfa7-4010-a30a-94de382ece9f | neyna/initial3d | src/core/objects/Sphere.cpp | #include "Sphere.hpp"
using glm::vec3;
using glm::mat4;
namespace initial3d {
namespace objects {
void Sphere::computeOctahedron() {
// creating the octahedron around the origin
// we add 2 points per axis, on all axis. All adding to the origin the normalized direction vector of that axis
// we add them triangle ... | ALGO | 0.934771 | 5.848379 |
10c2fb0a-ff8f-4c19-844a-1ffef318c87b | Fisher87/leetcode | cplus/find-building-where-alice-and-bob-can-meet.cpp | // Time: O(n + qlogn)
// Space: O(n)
// online solution, segment tree, binary search
class Solution {
public:
vector<int> leftmostBuildingQueries(vector<int>& heights, vector<vector<int>>& queries) {
vector<int> result(size(queries), -1);
SegmentTree st(heights);
for (int i = 0; i < size(q... | ALGO | 0.99996 | 6.043986 |
dcaf47a6-c6aa-4fb8-86f0-e24baa34bcde | randomblame/android_device_motorola_clark | recovery/recovery_updater.cpp | #include <errno.h>
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <string>
#include <vector>
#include "edify/expr.h"
#include "otautil/error_code.h"
#include "updater/inst... | TOOL | 0.907924 | 5.379106 |
80570003-1ec3-48f4-9b7f-75c1cbee6333 | Prochnost55/DS_Algo_CPP | Array/findDisappearedNumbers.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <climits>
using namespace std;
void printVector(vector<int> &arr){
for (int i = 0; i < arr.size(); i++)
{
cout << arr[i] << " ";
}
cout << endl;
};
// void printArray(int arr[], int len){
// for (int i = 0; i < len; i++)
//... | ALGO | 0.999497 | 4.630355 |
4af1ff14-2bf6-43c9-924d-feef8be57303 | royshil/HHParticleFilter | CurveSignature.cpp | #include "std.h"
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/flann/flann.hpp>
#include <opencv2/flann/dist.h>
using namespace cv;
#include "CurveCSS.h"
#include "CurveSignature.h"
#ifndef WITHOUT_OPENCL
#include "CLSignatureMatching.h"
#endif
#pragma mark Utilities
bool fileExists(const std::stri... | ALGO | 0.993766 | 4.244946 |
8914f60f-381f-4adf-a764-39971286d2a1 | ohnley/stroustrup_ppp_exercises | Part 1/ch_six_ex_10.cpp | #include "../std_lib_facilities.h"
long bounded_factorial(long start, long bound){
// if (start < 0 || bound << 0) error("Invalid inputs, less than 0");
// if (bound > start) error("Picking too many");
if (start > bound) return start * bounded_factorial(start - 1, bound);
return 1;
}
long permutation(... | ALGO | 0.993454 | 4.73703 |
256edf1f-56d1-453e-87ef-369d995378a5 | gustnv/cryptopals-solutions | detect_single_character_xor/detect_single_character_xor.cpp | #include "detect_single_character_xor.hpp"
string detect_single_character_xor(string file_path) {
// extracting file
ifstream file(file_path);
if (!file.is_open()) {
cerr << "is was not possible to open the file" << endl;
}
vector<string> lines_encrypted;
string line;
while (getli... | ALGO | 0.971571 | 4.506316 |
59c5e742-7e21-4fbe-a7af-0c49b1133c95 | miteshkumar77/LC | largest-divisible-subset/Accepted/6-20-2021, 2:38:05 PM/Solution.cpp | // https://leetcode.com/problems/largest-divisible-subset
class Solution {
public:
vector<int> largestDivisibleSubset(vector<int>& nums) {
sort(nums.begin(), nums.end());
int n = nums.size();
vector<int> dp(n, 1);
vector<int> pr(n, -1);
int idx = 0;
for (int i = 1; i... | ALGO | 0.999989 | 6.15111 |
a83e5fee-2c52-4da9-8b13-d94638b9b7f4 | het875/CPP | Cout & Cin/Control_flow/conditional_statment_IF_ELSE/if/fibonacci_with_function.cpp | #include<iostream>
using namespace std;
// A function to print the Fibonacci series up to a given number n
void fibonacci(int n) {
// Declare and initialize the first two terms of the series
int a = 0, b = 1;
// Print the first term
cout << a << " ";
// Loop until the next term is less than or e... | ALGO | 0.999747 | 6.157016 |
6eaa08c5-44bf-42f1-9c2d-6adb8f991f87 | AlexHPGrall/LeetCodeSolutions | problems/minimum_deletions_to_make_character_frequencies_unique/solution.cpp | class Solution {
public:
int minDeletions(string s) {
vector<int> freq(26,0);
unordered_map<int, int> freqMap;
for(char c:s)
{
freq[c-'a']++;
}
sort(freq.begin(),freq.end());
for(int i:freq)
freqMap[i]++;
int res=0;
for(in... | ALGO | 0.99996 | 5.30547 |
f9dd351e-5e47-40d6-9895-c11a6b59e5ad | master-hkshenoycse/CP | Contests/Leetcode/BiWeekly_145/LC_3378.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int get_par(int v,vector<int> &par){
if(par[v]==v){
return v;
}
return get_par(par[v],par);
}
void do_dsu(int x,int y,vector<int> &par,vector<int> &sz){
int px=get_par(x,par);
int py=ge... | ALGO | 0.999985 | 4.492237 |
6229d04d-137a-4541-b40f-34d30fd3428f | vbonnici/grafe-sim | analysis/data/p02257/s553151554.cpp | #include<bits/stdc++.h>
using namespace std;
bool isprime(int x)
{
if(x == 2) return true;
if(x < 2 || x % 2 == 0) return false;
for(int i=3;i*i <= x;i+=2)
{
if(x % i == 0)return false;
}
return true;
}
int main(){
int n,x;
int cnt=0;
cin >> n;
for(int i=0;i < n;i++)
{
cin... | ALGO | 0.999662 | 3.86348 |
7fe78c76-72d6-4cee-93b0-7eb23e3e5a70 | Hoksly/KNU | Year1/1sem/Lab_6/functions.cpp | #include "classes.h"
typedef long double coordinate;
coordinate Det2x2(coordinate a11, coordinate a12, coordinate a21, coordinate a22)
{
return a11 * a22 - a12 * a21;
}
Point VectorProduct(const Point& A, const Point& B, const Point& C)
{
Point a = B - A;
Point b = C - A;
return Point (Det2x2(a.y, a.... | TOOL | 0.984715 | 4.008204 |
9308f0e8-a377-41d4-a3c0-40c4d354e46d | S-Ekin/myC | mytest1.cpp | #include <iostream>;
using namespace std;
typedef int DataType;
typedef struct node
{
DataType data;
struct node* next;
}Node, * LinkList;
void print_link_list(LinkList head)
{
LinkList p, q, r, s;//q和s是当前比较的两个结点,p是q的前驱,r是s的前驱
while (head->next != NULL)
{
p = q = r = head->next;//连续赋值
s = r->next;
while (s... | ALGO | 0.999963 | 3.53513 |
2ed06e55-3d75-432e-853d-07ef792e62a7 | 18-RAJAT/ONLINE-JUDGE | C_Heavy_Intervals.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
void sol()
{
int n;
cin>>n;
int l[n],r[n],c[n];
for(int i=0;i<n;++i)
{
cin>>l[i];
}
for(int i=0;i<n;++i)
{
cin>>r[i];
}
for(int i=0;i<n;++i)
{
cin>>c[i];
}
sort(c,c+n,greater<in... | ALGO | 0.99999 | 3.522031 |
8810ca6f-a4d4-4cc4-9922-d4b941f1018e | Vadman97/ROS-Workspace | clm_bridge/lib/3rdParty/dlib/include/dlib/test/optimization.cpp | #include "optimization_test_functions.h"
#include <dlib/optimization.h>
#include <dlib/statistics.h>
#include <sstream>
#include <string>
#include <cstdlib>
#include <ctime>
#include <vector>
#include "../stl_checked.h"
#include "../array.h"
#include "../rand.h"
#include "tester.h"
namespace
{
using namespace ... | TEST | 0.950361 | 5.777524 |
2bb52161-30ce-400e-a832-ac3bf98c72c5 | Keshav0907/Data-Structure-and-Algorithms | 0931-minimum-falling-path-sum/0931-minimum-falling-path-sum.cpp | class Solution {
public:
int minSum(int i,int j,vector<vector<int>> &dp,vector<vector<int>> &matrix,int m,int n) {
if(i >=m || j>=n || i<0 || j<0) {
return 1e9;
}
if(i==m-1) {
return matrix[i][j];
}
if(dp[i][j]!=-200) {
... | ALGO | 0.999992 | 6.103825 |
49f16d4a-6380-4ef1-9502-5e4142b6e8f4 | yh100112/Cpp_test | 템플릿/템플릿특수화.cpp | #include<iostream>
#include<string>
using namespace std;
template <typename T>
T sum(T a, T b){
return a+b;
}
template<>
char* sum<char*>(char* s1, char* s2){
char *str = "char* 문자열은 더할 수 없습니다.";
printf("%s\n",s1);
printf("%s\n",s2);
return str;
}
template<>
const char* sum<const char*>(const char* s1,cons... | ALGO | 0.973679 | 4.509711 |
5bc80f8f-fa0d-4ea6-ae0f-469cb2c4f2d4 | ishandutta2007/codeforces | chenxiaoyan/normal/1295/D.cpp | /*
D P
l l
*/
#include<bits/stdc++.h>
using namespace std;
#define int long long
int gcd(int x,int y){return y?gcd(y,x%y):x;}
void mian(){
int a,b;
cin>>a>>b;
b/=gcd(a,b);
int cpy=b;
set<int> st;
for(int i=2;i<=sqrt(b);i++)
while(b%i==0)st.insert(i),b/=i;
if(b>1)st.insert(b);
for(set<int>::iterator i=st.be... | ALGO | 0.999941 | 5.175987 |
930cabfc-e9b5-4568-b4c1-ea35af59be5a | SaberDa/LeetCode | C++/309-bestTimeToBuyAndSellStockWithCooldown.cpp | #include <iostream>
#include <vector>
using namespace std;
int maxProfit(vector<int>& prices) {
int n = prices.size();
if (n < 2) return 0;
vector<int> buy(n), sell(n), rest(n);
buy[0] = -prices[0];
sell[0] = 0, rest[0] = 0;
for (int i = 1; i < n; i++) {
buy[i] = max(buy[i - 1], rest[i... | ALGO | 0.999515 | 5.812699 |
ed32f63f-87a1-457e-bccc-f8432daffb74 | rehmanghani2/2D-Arrays-Lab-10 | Q1.cpp | /* 1. Write a program to subtract two matrixes */
#include <stdio.h>
#define row 2
#define col 3
void print_array(int a[][col]);
void input_in_array(int a[][col]);
void add(int a[][col],int b[][col],int c[][col]);
main()
{
int array1[row][col];
printf("\nEnter values in Array1:\n");
input_in_array(array1);
puts("V... | ALGO | 0.99789 | 3.762553 |
f786b1f9-b920-4cf9-badb-17908c470ac9 | alekseylopez/PCA-Visualizer | src/Projector.cpp | #include "pca/Projector.hpp"
#include <stdexcept>
namespace pca
{
std::vector<std::pair<double, double>> project(const std::vector<std::vector<double>>& eigenVecs)
{
// ensure ≥2 eigenvectors
if(eigenVecs.size() < 2)
throw std::runtime_error("project: must have ≥2 eigenvectors");
size_t N =... | ALGO | 0.991886 | 5.822067 |
7cb533a7-1f30-4f62-9065-027dfc765a57 | sarvex/leetcode-purescript | solution/2500-2599/2559.Count Vowel Strings in Ranges/Solution.cpp | class Solution {
public:
vector<int> vowelStrings(vector<string>& words, vector<vector<int>>& queries) {
vector<int> t;
unordered_set<char> vowels = {'a', 'e', 'i', 'o', 'u'};
for (int i = 0; i < words.size(); ++i) {
if (vowels.count(words[i][0]) && vowels.count(words[i].back()))... | ALGO | 0.999935 | 6.37284 |
5a18080a-1646-43b1-8a67-37c69d592fb1 | hjhhoni/c | 做过的题/12.12/2.cpp | #include <iostream>
#include <string>
using namespace std;
typedef long long ll;
void solve(){
string s;
cin>>s;
ll cnt = 0;
char ori = s[0];
ll i=1;
ll len = 1;
while (i<s.length())
{
if(ori!=s[i]){
len++;
}else{
if(len>=2){
cnt+=... | ALGO | 0.999889 | 3.91096 |
4d9945cf-0ac5-47f1-aff0-479de0e9628e | ritik1123/cpp-full-placement-code | Bit manipulation/bit1.cpp | #include<iostream>
using namespace std;
int getbit(int n,int position){
return (n & (1 << position) != 0);
}
int setbit(int n,int position){
return n | (1 << position) ;
}
int clearbit(int n,int position){
int mask = ~(1 << position);
return(n & mask);
}
int updatebit(int n,int position,int value){
... | ALGO | 0.995181 | 4.112576 |
2e65a5cf-18be-4176-8a12-a467a0efacbe | Bhavesh-0909/DSA | problem/leet1207.cpp | #include<iostream>
using namespace std;
bool uniqueElement(int arr[],int size){
}
int main(){
int arr[6] = {1,1,4,1,3,4};
int arr1[5] = {1,1,4,4,3};
bool ans = uniqueElement(arr, 6);
cout<<ans<<endl;
bool ans1 = uniqueElement(arr1, 5);
cout<<ans1<<endl;
return 0;
} | ALGO | 0.998075 | 4.226564 |
c37f6fbe-320e-4f39-b40f-baba4d3d5c5a | Harshdeep-Yadav/GFG_Corner | Must-Do/LinkedList/Given a linked list of 0s, 1s and 2s, sort it.cpp | class Solution
{
public:
// Function to sort a linked list of 0s, 1s and 2s.
Node *segregate(Node *head)
{
// vector<int> v;
Node *p = head;
int count0 = 0;
int count1 = 0;
int count2 = 0;
while (p)
{
if (p->data == 0)
... | ALGO | 0.999945 | 5.211513 |
b26f0f38-0153-4bd4-a461-baec101482d7 | KavyaMoturi/GFGproblems | Difficulty: Basic/Replace all 0's with 5/replace-all-0s-with-5.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// Driver program to test above function
// } Driver Code Ends
class Solution{
public:
/*you are required to complete this method*/
int convertFive(int n)
{
//Your code here
int sum=0;
for(int i=0;n>0;n=n/10,i++){
... | ALGO | 0.999846 | 5.838624 |
25046431-335c-409b-b9b9-4d71f99de038 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_5733_17.cpp | #include <iostream>
int main(){
int a,b;
std:cin>>a>>b;
std::cout<<a/b<<" "<<a%b<<" "<<std::fixed<<float(a)/b<<"\n";
return 0;
} | ALGO | 0.996704 | 3.360939 |
e7176ca2-3975-46c2-bfb1-764d227047ab | EQEmu/Server | common/crc16.cpp | #include "crc32.h"
uint16 CRC16(const unsigned char *buf, int size, int key)
{
// This is computed as the lowest 16 bits of an Ethernet CRC32 checksum
// where the key is prepended to the data in little endian order.
uint8 keyBuf[] = {(uint8)((key >> 0) & 0xff),
(uint8)((key >> 8) & 0xff),
(uint8)((key >>... | ALGO | 0.851046 | 5.514248 |
30584028-487c-4ef7-ab08-44a6ae83a0d0 | NafiHasan/HabiJabi | C++/sublime test/344B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define en "\n"
#define fast_io() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define w(t) int t; cin >> t; while (t--)
void file_io(){
fast_io();
#ifndef ONLINE_JUDGE
freopen ("input.txt", "r", stdin);
freopen ("output.... | ALGO | 0.999943 | 4.080955 |
96462431-4e12-420b-aae2-d4c121f3e43d | raincross7/code-similarity | codes/train_code/problem298/problem298_208.cpp | #include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
int N,K;
cin>>N>>K;
int ansN=0,anslis[30000][2]={0};
int topa=0;
if(((N-1)*(N-2))/2<K){
puts("-1");
return 0;
}
else{
for(int i=1;i<=N;i++){
... | ALGO | 0.999901 | 3.952781 |
bd2af251-576e-4ef3-9158-ecf2caa6f795 | spyshiv/HR_Solutions | In C++/Algorithms/Implementation/ServiceLane.cpp | #include <iostream>
#define max 100000
using namespace std;
int main() {
int L, T,i,j,k=0,min=0;
int a[max];
cin>>L>>T;
while(L--)
{
cin>>a[k];
k++;
}
while(T--)
{
cin>>i>>j;
min=a[i];
for(k=i;k<j;k++)
{
if(a[k]<min... | ALGO | 0.999969 | 3.414196 |
807a581a-7772-4cb5-bca4-5137225ac47b | gupta-manas6268/learning-C | TLE Eliminators/TLE Eliminators Level-3/Ch-009/101_02_Quiz.cpp | // This is Part-02 of this Lecture.
//
// Minimal Rotation
// https://cses.fi/problemset/task/1110/
// In Page-7, Slide-2
// To get cyclic shift of string-s, We can take Sliding-Window of
// Size = n, of string - s+s = 2*s. (As, Size of String-s = n.)
// i.e. Here, abacabac = string 2*s.
// So, string s ... | ALGO | 0.999975 | 5.324491 |
a650d687-59dd-4609-ad96-cb8e38dbe7c3 | VenkataAnilKumar/InterviewBit-CPlusPlus | Backtracking/Minimum number of swaps required for arranging pairs adjacent to each other.cpp | void updateindex(vector<int> &index, int a, int ai, int b, int bi) {
index[a] = ai;
index[b] = bi;
}
int minSwapsUtil(vector<int> &A, vector<int> &pairs, vector<int> &index, int i, int n) {
if (i > n)
return 0;
if (pairs[A[i]] == A[i+1])
return minSwapsUtil(A, pairs, index, i+2, n);
... | ALGO | 0.999908 | 5.21985 |
efef5e4f-c220-465f-a3b4-af7a32fb7821 | Anup0099/450DSA_Question | 2500-delete-greatest-value-in-each-row/2500-delete-greatest-value-in-each-row.cpp | class Solution {
public:
int deleteGreatestValue(vector<vector<int>>& grid) {
for (int i = 0; i < grid.size(); i++)
{
sort(grid[i].begin(), grid[i].end());
}
int ans=0;
for (int i = 0; i < grid[0].size(); i++)
{
int maximum = INT16_MIN;
for (int j = 0; j < grid.si... | ALGO | 0.999946 | 5.845012 |
7937a37f-37be-49d6-80fa-d2febd21b60b | timothyshull/epicode | cpp/combinations.cpp | #include <algorithm>
#include <cassert>
#include <iostream>
#include <random>
void directed_combinations(int, int, int, std::vector<int>&, std::vector<std::vector<int>>&);
// @include
std::vector<std::vector<int>> combinations(int n, int k)
{
std::vector<std::vector<int>> result;
std::vector<int> t;
direc... | ALGO | 0.998922 | 6.587005 |
fdd4921c-0c0a-406d-9e3d-a0ba0503c273 | ZxMYS/Xiaos-ACM-Solution-Set | 09.05.16 - FDU/G.cpp | #include<stdio.h>
#include<stdlib.h>
#include<time.h>
#include<math.h>
#include<assert.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<numeric>
#include<vector>
#include<string>
#include<map>
#include<queue>
#include<list>
#include<sstream>
using namespace std;
#define LOOP(x,y,z) for((x)=(y);(x)<... | ALGO | 0.997378 | 3.472564 |
625e6678-8baa-4c4c-a0be-cf913136e944 | atanughosh01/Leetcode-grinder | 2470-number-of-subarrays-with-lcm-equal-to-k/2470-number-of-subarrays-with-lcm-equal-to-k.cpp | class Solution {
private:
int lcm(int a, int b) {
return (a * b) / __gcd(a, b);
}
public:
int subarrayLCM(vector<int> &nums, int k) {
int res = 0, n = nums.size();
for (int i = 0; i < n; i++) {
int g = nums[i];
if (g == k) res++;
for (int j = i + 1... | ALGO | 0.999941 | 5.161859 |
c4a011de-7839-414b-a73b-40528ccbac52 | saral7/AOC2023 | 20.1/20.1.cpp | #include <bits/stdc++.h>
using namespace std;
#define lli long long int
struct module {
string name;
int type = 0;
bool on = false;
int mask = 0;
int insNum = 0;
friend bool operator < (module a, module b) {
return a.name < b.name;
}
};
string getName (string line) {
string pom = "";
for (int i = 0; i <... | ALGO | 0.999005 | 3.546909 |
20ffdf22-ea2a-4cf1-9024-2f426e930640 | ngthanhtrung23/CompetitiveProgramming | codeforces/274/D.cpp | #include <sstream>
#include <iomanip>
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <string>
#include <deque>
#include <complex>
#define FOR(i,a,b) for(int i=(a... | ALGO | 0.999962 | 3.638886 |
9cfb451b-de72-47c2-82f9-43f289aa81fa | pehprado/SPOJ-BRASIL | ELEVADO2.cpp | #include <iostream>
using namespace std;
int main() {
int n, c;
cin >> n >> c;
int total = 0;
bool passou = false;
for (int i = 0; i < n; i++) {
int s, e;
cin >> s >> e;
total += ((-s) + e);
if (total > c) passou = true;
}
if (passou) cout << "S" << endl;
... | ALGO | 0.999972 | 4.043636 |
5358f9f0-d4e2-4dec-ba50-c04cf6a5f7e6 | ajmat6/DSA | CC_Small_Smaller_Smallest.cpp | #include<bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<long, long> pll;
typedef vector<pii> vpii;
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, ... | ALGO | 0.999931 | 4.500498 |
7021cc8d-9364-4a40-8a55-fa541209591b | jack41402/Cplusplus | TNFSHOJ/18/main.cpp | #include <iostream>
using namespace std;
int check(string str)
{
string temp="" ;
int i , S=0 ;
for (i=0 ; i<str.size() ; i++)
{
if (str[i]>=65 && str[i]<=90)
{
temp += str[i]+32 ;
}
else if (str[i]>=97 && str[i]<=122)
{
temp += str[i] ;
... | ALGO | 0.951216 | 3.80509 |
538c9af1-e804-4cbe-a45d-3d7eae47e170 | turjo25/Phitron_DataStructure | Module-10 (STL List)/cycle_detect_in_linked_list.cpp | #include <bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node *next;
Node(int val)
{
this->val = val;
this->next = NULL;
}
};
int main()
{
Node *head = new Node(10);
Node *a = new Node(20);
Node *b = new Node(30);
Node *c = new Node(48);
Node ... | ALGO | 0.999828 | 4.253993 |
c53e0062-c846-4e26-ab61-4f58824e8846 | FishinLab/Algorithms_FisHinLab | topcoder/typing_distance/typing_distance.cpp | #include <iostream>
#include <string>
#include <math.h>
using namespace std;
int get_distance(string, char, char);
int main(int argc, const char* argv[])
{
string keyboard(argv[1]);
string type_str(argv[2]);
int type_str_len = type_str.size();
int result = 0;
for(int i = 1; i < type_str_len; ++i)... | ALGO | 0.999583 | 3.907169 |
59e4dd2d-6203-4fe9-8b5a-5ac565a11152 | magengbin/algorithm | sort/shell_sort/shell_sort.cpp | void shell_sort(int A[], int n)
{
int tmp;
for (int increment = n/2; increment > 0; increment /= 2)
{
for (int i = increment; i < n; i++)
{
tmp = A[i];
int j = 0;
for (j = i; j >= increment; j -= increment)
{
if (tmp < A[j - inc... | ALGO | 0.999851 | 4.331958 |
075a2d26-015a-451a-b144-0534fe312537 | MdShah-alam/D_S_-Linked_List | Search a value (Duplication enabled List).cpp | #include<bits/stdc++.h>
using namespace std;
class Node
{
public:
int val;
Node *Next;
Node(int val)
{
this->val=val;
Next=NULL;
}
};
struct Test
{
int position[10000];
};
void insert_at_tail(Node *&head,int val)
{
Node *newNode=new Node(val);
if(head==NULL)
{
... | ALGO | 0.999824 | 4.014104 |
1a99acc3-3162-4b0e-9228-2ef388ceb957 | esl-epfl/xheep_matrix_spec | llvm-project/libcxx/test/std/algorithms/alg.sorting/alg.permutation.generators/ranges.prev_permutation.pass.cpp | // <algorithm>
// UNSUPPORTED: c++03, c++11, c++14, c++17
// template<bidirectional_iterator I, sentinel_for<I> S, class Comp = ranges::less,
// class Proj = identity>
// requires sortable<I, Comp, Proj>
// constexpr ranges::prev_permutation_result<I>
// ranges::prev_permutation(I first, S last, Comp... | TEST | 0.981153 | 7.860847 |
92dae537-904c-4a16-a0a8-e26c475ea2f4 | UestcXiye/Leetcode | 334.递增的三元子序列.cpp | /*
* @lc app=leetcode.cn id=334 lang=cpp
*
* [334] 递增的三元子序列
*/
//@lc code = start
// class Solution
// {
// public:
// bool increasingTriplet(vector<int> &nums)
// {
// if (nums.size() < 3)
// return false;
// int n = nums.size();
// // leftMin[i] 表示 nums[0,...,i] 的最小值
/... | ALGO | 0.999978 | 6.327511 |
5f9c7bd5-ab49-40ec-905f-2755fe43d38d | Shauryaa007/Accenture-Coding-Round | 3sept2024/Prob1.cpp | // permutation
#include <bits/stdc++.h>
int fact(int n)
{
if(n==0||n==1) return 1;
int ans=1;
while(n>0)
{
ans*=n--;
}
return ans;
}
int main() {
string s;
cin>>s;
unordered_map<char,int>mp;
mp['A']++;
mp['E']++;
mp['I']++;
mp['O']++;
mp['U']++;
... | ALGO | 0.999759 | 4.574486 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.