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 |
|---|---|---|---|---|---|---|
0490cec8-a47c-41e3-8d78-39cc4a5c46b2 | SURAJKORADE01/Data_Structure_and_Algorithm | Bit_Manipulation/program10.cpp | // Count the number of set bits
#include<iostream>
using namespace std;
int CountSetBits(int iNo)
{
int iCount = 0;
int iDigit = 0;
while(iNo != 0)
{
iDigit = iNo % 2;
if(iDigit == 1)
{
iCount++;
}
iNo = iNo / 2;
}
return iCount;
}
int C... | ALGO | 0.999478 | 5.948833 |
c0ee6663-17cb-475d-8030-08b551c7117b | Hush-Engine/hush-llvm | libcxx/test/std/algorithms/alg.sorting/alg.binary.search/binary.search/ranges.binary_search.pass.cpp | // UNSUPPORTED: c++03, c++11, c++14, c++17
// template<forward_iterator I, sentinel_for<I> S, class T, class Proj = identity,
// indirect_strict_weak_order<const T*, projected<I, Proj>> Comp = ranges::less>
// constexpr bool ranges::binary_search(I first, S last, const T& value, Comp comp = {},
// ... | TEST | 0.995603 | 7.7203 |
fee8973c-7bc8-4c6a-996d-a677cacbaa2a | claris-yang/knowledge_planet | luogu/P2158.cpp | //
// Created by yangtao on 20-8-25.
//
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;
const int N = 50005;
int n, ans;
int f[N];
int main() {
cin >> n;
if(n == 1) {
cout << 0 << endl;
return 0;
}
ans = (n - 1) * ( n - 1);
n--;
... | ALGO | 0.99999 | 4.298978 |
800161fb-000e-464d-9627-dc1daa7bbf76 | AlligatorTHPhat/Code_Practice | UpCoder/Advanved Programming/Stack and Queue/MINIGAME24.3: VECTOR.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n, q, tmp;
cin >> n;
vector<int> vec(n);
for (int& x : vec) cin >> x;
cin >> q;
while (q--) {
cin >> tmp;
auto it = lower_bound(vec.begin(), vec.end(), tmp);
cout << (vec[it - vec.begin()] == tmp ? "Yes" : "No");
cout << it -... | ALGO | 0.999976 | 4.22215 |
61698735-035b-4ff4-83cf-e5cc28d1cbac | dadm-projekt/dadm-cpp | eigen-3.3.7/doc/examples/class_CwiseUnaryOp_ptrfun.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
// define function to be applied coefficient-wise
double ramp(double x)
{
if (x > 0)
return x;
else
return 0;
}
int main(int, char**)
{
Matrix4d m1 = Matrix4d::Random();
cout << m1 << endl << "becomes: " << endl << ... | ALGO | 0.989899 | 4.120226 |
b4bfee10-7d3b-449b-a911-e76088df4ceb | NedkoPNedev/Introduction-To-Programming-Materials | IntroToProgrammingMaterials/практикум/Тринадесети практикум/zad9.cpp | #include<iostream>
using namespace std;
bool IsPalindrome(int a[], int Start, int End)
{ if (Start >= End) return true;
return (a[Start] == a[End]) && IsPalindrome(a, Start + 1, End - 1);
}
//Second Solution
/*bool IsPalindrome(int a[], int Start, int End)
{ if (Start >= End) return true;
if (a[Start] != a[End]) r... | ALGO | 0.999879 | 4.596527 |
3a0f6fcc-aa3b-4de7-b84b-7a2ced284fe8 | jerry762/UVa | UVa/00948.cpp | #include <iostream>
#include <algorithm>
#define SIZE 40
using namespace std;
int main()
{
int n = 0;
int num = 0;
int fib[SIZE] = {0, 1};
cin >> n;
for (int i = 2; i < SIZE; i++)
fib[i] = fib[i - 1] + fib[i - 2];
for (int i = 0; i < n; i++)
{
bool flag = false;
... | ALGO | 0.999879 | 3.589537 |
4650a866-ad39-419e-8b71-cea943f156cb | prakhar-singh09/Striver-Sheet | Arrays Part-II/Find_the_duplicate_in_an_array_of_N+1_integers.cpp | // Given an array of integers nums containing n + 1 integers where each integer is in the range [1, n] inclusive.
// There is only one repeated number in nums, return this repeated number.
// You must solve the problem without modifying the array nums and uses only constant extra space.
// Example 1:
// Input: nums... | ALGO | 0.999957 | 6.040716 |
389e9b7f-165f-4f47-8d7a-63f6f6686af2 | rahul-shoundic/Code | DETSCORE.cpp | #include <iostream>
using namespace std;
int main() {
// your code goes herey
int t,x,y;
cin>>t;
while(t--)
{
cin>>x>>y;
cout<<(x/10)*y<<endl;
}
return 0;
}
| ALGO | 0.997054 | 4.148638 |
7d0747ca-ecd8-4282-93c7-378e38f1cc33 | CYRUS-STUDIO/LLVM | llvm/lib/CodeGen/LiveVariables.cpp | #include "llvm/CodeGen/LiveVariables.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/DepthFirstIterator.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/Pas... | ALGO | 0.992825 | 7.929957 |
4af860ff-6d67-4f26-8769-2a848ba28223 | shyn48/BNCalculator | libs/expression-evaluation/expression-evaluation.cpp | /*
* Author: Alireza Jafartash
* Github: https://github.com/sleepingjempa
*/
#include <iostream>
#include <stack>
#include "expression-evaluation.h"
int precedence(char _operator) {
if(_operator == '+'|| _operator == '-') return 1;
if(_operator == '*'|| _operator == '/') return 2;
if(_operator == '^') retu... | ALGO | 0.999261 | 5.177191 |
c3e532e5-4fe0-4026-81e8-a694b21e2e05 | whddnjs5167/Algorithm | 6588.cpp | #include<bits/stdc++.h>
#define FASTio ios_base :: sync_with_stdio(false), cin.tie(NULL), cout.tie(NULL)
#define endl '\n'
using namespace std;
vector<bool> c(1000001,false);
void jud()
{
int cnt = 0;
for(int i=2; i<1000001; i++)
{
for(int j=2; j*j<=i; j++)
{
if(i%j==0)
... | ALGO | 0.999459 | 3.949181 |
dd7f39fd-cf70-4203-ae9d-2b244351ac35 | sanghoon21/cpp | week_02/p97_3.cpp | #include <iostream>
#include <iomanip> // setprecision 사용을 위한 라이브러리
using namespace std;
int main() {
int n;
cout << "정수 n을 입력하세요: ";
cin >> n;
if (n <= 0) {
cout << "n은 양의 정수여야 합니다." << endl;
return 1;
}
double pi = 0.0; // π의 근사값 저장
for (int i = 0; i < n; i++) {
... | ALGO | 0.999838 | 5.698735 |
3129238f-eb1c-465c-b6fd-bc002f59de70 | tegerafael/routes-flutter | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.9988 | 6.76073 |
4d32c942-9193-425a-87be-1a39025a57ff | Cchinchillaz/2110211-Data-Structure | cp_priority/k-ary_heapheight.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
long long n;
int k, height = 0;
cin >> n >> k;
if(k == 1){cout << n-1; return 0;}
n *= k-1;
while(n >= k){
n /= k;
++height;
}
cout << height;
} | ALGO | 0.999874 | 3.740214 |
fc72bd78-12cd-4bf7-90e7-f1f9d0a4f8cf | victorvikram/ARC-miscellany | solution-first-place-pruned/src/compose2.cpp | #include "precompiled_stl.hpp"
using namespace std;
#include "utils.hpp"
#include "core_functions.hpp"
#include "image_functions.hpp"
#include "image_functions2.hpp"
#include "visu.hpp"
#include "brute2.hpp"
#include "pieces.hpp"
#include "compose2.hpp"
#include "timer.hpp"
/*
struct Candidate {
vector<Image> imgs... | ALGO | 0.997531 | 4.762013 |
0906c3ee-b925-4c7c-bbd0-053d6349fb73 | christineJadeAvila/CPE112-School-Activities- | CPE112/Practices/headerfile.cpp | #include<iostream>
#include "headerfile.h"
using namespace std;
int main(){
int pal,din,r;
int n;
int num[100][100];
cout<<"Enter the Number: ";
cin>>n;
cout<<"--------------------------"<<endl;
cout << "Multiplication table" <<endl;
cout<<"--------------------------"<<endl;
for (int... | ALGO | 0.997857 | 3.372976 |
235394a1-42a2-47e7-8bb1-4876c7bf724d | juarezpaulino/coderemite | problemsets/USACO/CHAPTER 2/Secao 2.1/sort3.cpp | /**
*
* Author: Juarez Paulino(coderemite)
* Email: <EMAIL>
*
*/
/*
ID: juarezp1
PROG: sort3
LANG: C++
*/
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include ... | ALGO | 0.999926 | 3.746092 |
d08669f7-89f7-4f5f-b823-195ba51999d1 | seokahi/algoriithm | CPP/swea/D1/20.cpp | /////////////////////////////////////////////////////////////////////////////////////////////
// 기본 제공코드는 임의 수정해도 관계 없습니다. 단, 입출력 포맷 주의
// 아래 표준 입출력 예제 필요시 참고하세요.
// 표준 입력 예제
// int a;
// float b, c;
// double d, e, f;
// char g;
// char var[256];
// long long AB;
// cin >> a; // int 변수 1개 입력... | ALGO | 0.995278 | 3.995581 |
4f434311-5560-4a33-80d4-a25df74aff19 | anurag8602/leetcode | 0334-increasing-triplet-subsequence/0334-increasing-triplet-subsequence.cpp | class Solution {
public:
bool increasingTriplet(vector<int>& nums) {
int first = INT_MAX;
int second = INT_MAX;
for (int i=0;i<nums.size();i++)
if (nums[i] <= first)
first = nums[i];
else if (nums[i] <= second)
second = nums[i];
... | ALGO | 0.999956 | 5.764615 |
b2922f7c-5be6-493b-875c-550f4e7e7153 | mvogel521/ECE_413_Final_Project | ECE_413/src/heartRate.cpp | /*
Optical Heart Rate Detection (PBA Algorithm)
By: Nathan Seidle
SparkFun Electronics
Date: October 2nd, 2016
Given a series of IR samples from the MAX30105 we discern when a heart beat is occurring
Let's have a brief chat about what this code does. We're going to try to detect
heart-rate optically. This is ... | ALGO | 0.984633 | 6.820867 |
6c00cd95-eb66-484c-bf5d-971cc8936da9 | lee20h/TIL | Problem Solving/BOJ/17070. 파이프 옮기기 1.cpp | #include <bits/stdc++.h>
using namespace std;
int m[17][17];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
for (int i=1; i<=n; i++) {
for (int j=1; j<=n; j++) {
cin >> m[i][j];
}
}
queue<pair<int,int>> fr;
queue<pair<int,int>> ba;
fr.push({1,1});
ba.push({1,2});
int answer = 0... | ALGO | 0.999681 | 3.697048 |
f012e5a1-1f43-4bf4-b0e0-c21c1f84c366 | XZJIsme/running_learning | algorithm_learning/并查集/HDU - 1829 A Bug's Life.cpp | #include<bits/stdc++.h>
using namespace std;
using ll=long long;
int n1,n2,par[(ll)1e6],height[(ll)1e6];
void init(int n)
{
for(int i=0;i<n;i++) par[i]=i;
memset(height,0,sizeof(height));
}
int find(int x)
{
if(par[x]==x) return x; else return par[x]=find(par[x]... | ALGO | 0.999606 | 3.738447 |
ec709730-eebf-46db-9675-3fe1dd2e3f5f | chrisidefix/macosxbootloader | src/boot/Options.cpp | //********************************************************************
// created: 8:11:2009 18:33
// filename: Options.cpp
// author: tiamo
// purpose: process option
//********************************************************************
#include "stdafx.h"
//
// global
//
STATIC UINT32 BlpBootMode =... | TOOL | 0.913419 | 3.925308 |
92b15420-49e0-4ccc-b20c-469f0253c076 | trygas/example | example_algo/zifuchuan/1261.cpp | #include "general.h"
/*
* 思路是先遍历字符串, 如果某一个字符的数量小于k,
* 那么最终的答案中一定不会包含这个字符, 因此答案只有可能在这个字符的左右两侧的字符串
* 之后对于左右两边的串进行递归处理即可.
*/
int longestSubstring(string s, int k) {
if(s.size() == 0) return 0;
if(k <= 1) return s.size();
map<char,int> cnt;
for(int i = 0; i < s.size(); ++i) {
cnt[s[i]]++;
}... | ALGO | 0.999956 | 4.263226 |
8cc394b3-61c7-434c-88ef-9c443ea1d88e | wrk666/Robotics_Motion_Planning_Course | Ch9/Project/src/src/read_only/quadrotor_simulator/so3_quadrotor_simulator/include/ode/libs/numeric/odeint/examples/stochastic_euler.cpp | #include <vector>
#include <iostream>
#include <boost/random.hpp>
#include <boost/array.hpp>
#include <boost/numeric/odeint.hpp>
/*
//[ stochastic_euler_class_definition
template< size_t N > class stochastic_euler
{
public:
typedef boost::array< double , N > state_type;
typedef boost::array< double , N > der... | ALGO | 0.999449 | 5.73772 |
50962aa5-1ee6-410d-b064-f14a20ab316b | raincross7/code-similarity | codes/train_code/problem366/problem366_228.cpp | #include <bits/stdc++.h>
#define _GLIBCXX_DEBUG
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define repi(i, a, b) for (int i = (int)(a); i < (int)(b); i++)
using namespace std;
typedef long long ll;
int A, B, C, K;
int main(){
cin >> A >> B >> C >> K;
int ans = 0;
if (K < A) ans += K;
else{
ans +... | ALGO | 0.9999 | 3.505617 |
df49cd18-e193-4232-a948-d1525a43a08f | KMJAE/backjoon | 1904.cpp | #include <iostream>
using namespace std;
int dp[1000001];
int bin(int n){
if(n == 0){
dp[0] = 0;
return 0;
}
else if(n == 1){
dp[1] = 1;
return 1;
}
else if(n == 2){
dp[2] = 2;
return 2;
}
if(dp[n] != 0){
return dp[n];
}
else... | ALGO | 0.999852 | 4.525092 |
ee6f6a92-1d80-4111-805d-80c446fc2689 | kenhuang041/Cpp | zerojudge/apcs/p3/q838.cpp | // 2025/06/17 貪心闖關
#include<bits/stdc++.h>
using namespace std;
#define IO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define pii pair<int,int>
#define F first
#define S second
#define ID curr.S
#define int long long
signed main() {
IO;
int n,t,ans = 0,now;
cin >> n >> t;
priority_queue<pii... | ALGO | 0.999977 | 3.166287 |
911ba0a6-5803-439e-81ff-ce309b289bc1 | HarryShavlov/ProjectOnCpp | divF/1/01I.cpp | В математике функция sign(x) (знак числа) определена так:
sign(x) = 1, если x > 0,
sign(x) = -1, если x < 0,
sign(x) = 0, если x = 0.
Для данного числа x выведите значение sign(x).
#include <iostream>
using namespace std;
int main()
{
int x;
cin >>x;
if (x == 0)
cout<<0;
else
if (x... | ALGO | 0.999997 | 4.194974 |
24578a69-9582-4b10-89a6-67c846b41186 | chauhansatyam3112/DSA-problems | 0907-sum-of-subarray-minimums/0907-sum-of-subarray-minimums.cpp | class Solution {
public:
int sumSubarrayMins(vector<int>& arr) {
int n = arr.size();
stack<int> st1,st2;
vector<int> left(n,-1), right(n,n);
for(int i=0;i<n;i++)
{
while(!st1.empty()&& arr[st1.top()]>arr[i])st1.pop();
... | ALGO | 0.999996 | 5.85864 |
fa978dbf-40d8-4578-9f36-d2fbf6be7e33 | ridwanfahmi/185_ConditionalStatement | Pertemuan2_D_185/Pertemuan2_D_185.cpp | #include <iostream>
using namespace std;
int main()
{
int bilangan;
srand(time(0));
bilangan = rand()%10;
cout << "Bilangan awal = " << bilangan << endl;
if (bilangan >= 5){
bilangan = 2 * bilangan;
}
cout << "Bilangan akhir = " << bilangan << endl;
return 0;
} | ALGO | 0.988777 | 3.112397 |
b61a8500-d29e-44df-8831-8a924a7d56ad | raincross7/code-similarity | codes/train_code/problem170/problem170_311.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
using namespace std;
int main(){
int h,n,a,ans=0;
cin>>h>>n;
for(int i=1;i<=n;i++){
cin>>a;
ans=ans+a;
}
if(ans>=h){
cout<<"Yes";}else{
cout<<"No";}
} | ALGO | 0.999992 | 3.253596 |
7839479f-ac63-41dc-a984-5d80b96088dd | Katsudon10/Competitive-programming | Atcoder/ARC/ARC047/a.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;++i)
#define ALL(a) (a).begin(),(a).end()
const int inf = INT_MAX;
using ll = long long;
using P = pair<int,int>;
using Graph = vector<vector<int>>;
vector<int>dxs={1,0,-1,0};
vector<int>dys={0,1,0,-1};
//fixed << setprecision(10)
int ma... | ALGO | 0.999989 | 3.672725 |
86015d71-198b-4074-9b85-605bade6d224 | Vishal0906/coding-ninja-data-structure | Graphs 1/Lecture Codes/Has-Path.cpp | // Code : Has Path
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
bool hasPath(int **edges,int n,int sv,int ev,bool *visited){
if(sv==ev){
// cout<<sv<<" "<<ev<<endl;
return true;
}
// cout<<"sv : "<<sv<<" "<<output[output.size()-1]<<endl;
visited[sv]=true;
... | ALGO | 0.999953 | 4.390708 |
c513842c-bc6f-418e-aaea-9848bc98db9a | justhusnan/CppDroid | tutorials/learncpp.com#1.0#1/cpp_basics/comprehensive_quiz/source1.cpp | #include <iostream>
int ReadNumber()
{
using namespace std;
cout << "Enter a number: ";
int x;
cin >> x;
return x;
}
void WriteAnswer(int x)
{
using namespace std;
cout << "The answer is " << x << endl;
}
int main()
{
int x = ReadNumber();
int y = ReadNumber();
WriteAnswer(x+y)... | TOOL | 0.885577 | 4.37528 |
4f0a783e-db88-47b4-bf55-546198bc5acf | nazibur175/C- | E_Prime_Deletion.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long
#define mod 1000000007
#define test int t; cin>>t; while(t--)
bool isprime(int n){
if(n<2) return false;
if(n<=3) return true;
if(n%2==0) return false;
for(int i=3;i<=sqrt(n);i+=2){
if(n%i==0) return false;
}
return true;
}
void s... | ALGO | 0.999928 | 5.281415 |
57ec6a33-ba6a-44b9-af88-f5d274f8eb1e | jimar884/AOJ | PROBLEM/Vol0/0025.cpp | // hit&blow
#include <iostream>
#include <cstdio>
#include <cstdlib>
using namespace std;
int main(void) {
int a[4], b[4];
int hit, blow;
while(cin >> a[0] >> a[1] >> a[2] >> a[3] >> b[0] >> b[1] >> b[2] >> b[3]) {
hit = 0;
blow = 0;
for(int i = 0; i < 4; ++i) {
... | ALGO | 0.999311 | 3.867335 |
1f0af725-6e6a-4908-8361-e67dbe262b4a | duckbill413/baekjoonCode | priortyAutoHeap.cpp | //߿䵵!!!!!
// 1655 ؿ
#include <iostream>
#define HEAP_LEN 100010
using namespace std;
typedef int Data;
int N, Max_Heap_Idx, Min_Heap_Idx;
void HPush(Data data, bool T, Data Max_Heap[], Data Min_Heap[])
{
if (T == true)
{
int Idx = ++Max_Heap_Idx;
Max_Heap[Idx] = data;
while ((Idx != ... | ALGO | 0.999994 | 4.255927 |
8ff21f3b-622e-4633-9f9e-aa3feb5a2301 | VipulChauhan89/Leetcode-solutions | String/0389-Find_the_Difference.cpp | class Solution {
public:
char findTheDifference(string s,string t)
{
char ans;
sort(s.begin(),s.end());
sort(t.begin(),t.end());
for(int i=0;i<t.length();i++)
{
if(s[i]!=t[i])
{
ans=t[i];
break;
}
... | ALGO | 0.999898 | 6.096559 |
319e4410-885c-4b0d-a1c9-f4165f330b15 | juyonLee00/2022_CS_Study | juyonLee00/bj_9237.cpp | #include <iostream>
#include <vector>
#include <cstdio>
#include <algorithm>
using namespace std;
int main(){
int n;
int num;
int answer=0;
scanf("%d",&n);
vector<int> v;
vector<int> v2;
while(n--){
scanf("%d",&num);
v.push_back(num+2);
}
sort(v.begin(),v.end());reverse(v.begin(),v.end());
for(int i=0;i<... | ALGO | 0.999551 | 3.369959 |
7e4602f7-7df4-4776-9fbe-af88829c8817 | edemir1233/codigos | naketami.cpp | #include <bits/stdc++.h>
#define fore(i,a,b) for(int i=a;i<=b;i++)
#define forei(i,a,b) for(int i=a;i<b;i++)
typedef unsigned long long ull;
typedef long long ll;
using namespace std;
vector<int>portales_accesibles(int N,int K,vector<int> vec){
vector<int>r(N,0);
forei(i,0,N){
ll n=0;
forei(j,0,... | ALGO | 0.999599 | 3.553657 |
c4ba7204-dc08-4f3a-923e-96b47d2a29aa | clever2817/DSA-Practice | Data_Types/Bone_Appetit.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int bonesPeople, bloodPeople, bonesTreats, bloodTreats;
cin >> bonesPeople >> bloodPeople >> bonesTreats >> bloodTreats;
int totalTreats = (bonesPeople * bonesTreats) + (bloodPeople * bloodTreats);
cout << totalTreats << "\n";
return 0;
... | ALGO | 0.999259 | 3.908953 |
c901a5ed-ad9a-4f14-9b0d-b840d32e969f | raincross7/code-similarity | codes/train_code/problem354/problem354_386.cpp | #include <iostream>
#include <cstdio>
using namespace std;
int a, b, c, n, ans;
int main() {
int i, j, t;
cin >> a >> b >> c >> n;
for(i=0; i<=3000; i++) for(j=0; j<=3000; j++) {
t = n - a*i - b*j;
if(t<0) break;
if(t % c == 0) ans++;
}
cout << ans;
return 0;
} | ALGO | 0.999665 | 3.552652 |
6143ef93-b281-43a4-b961-7a8bec21f77f | RahulAdhi27/DSALab2025 | LAB9/q3.cpp | #include <iostream>
using namespace std;
class BST {
// Structure for a tree node
struct Node {
int data;
Node* left;
Node* right;
};
Node* root;
// Private helper functions
Node* insert(Node* node, int value);
void preorder(Node* node);
void inorder(Node* ... | ALGO | 0.999974 | 6.646256 |
276d907b-3531-4778-88ff-6525d519aac9 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_2124_6.cpp | #include <bits/stdc++.h>
using namespace std;
int n, mt[105][105];
int main() {
scanf("%d", &n);
if (n % 2 == 1) {
printf("-1");
return 0;
}
for (int i = 1; i <= n; i++) mt[0][i] = 0;
for (int i = 1; i <= n / 2; i++) {
for (int j = 1; j <= n; j++) mt[i][j] = mt[i - 1][j];
for (int j = i; j <= ... | ALGO | 0.999914 | 3.617096 |
b40ad997-b404-4b8e-a57b-8c3b771c05c4 | yb993161947/SCR | ThirdLib/eigen-eigen-07105f7124f9/bench/spbench/sp_solver.cpp | // Small bench routine for Eigen available in Eigen
// (C) Desire NUENTSA WAKAM, INRIA
#include <iostream>
#include <fstream>
#include <iomanip>
#include <Eigen/Jacobi>
#include <Eigen/Householder>
#include <Eigen/IterativeLinearSolvers>
#include <Eigen/LU>
#include <unsupported/Eigen/SparseExtra>
//#include <Eigen/Sp... | ALGO | 0.989531 | 4.29849 |
3c3cce0b-9030-4892-b27d-038dd09d0535 | kartikeyjangir/DSA450 | String/B_Friends_and_Candies.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fo(i, n) for (int i = 0; i < n; i++)
#define deb(x) cout << #x << '=' << x << endl
#define vll vector<ll>
#define pb push_back
#define F first
#define S second
#define pll pair<ll, ll>
#define vpll vector<pll>
void solve()
{
ll n, sum = 0;... | ALGO | 0.999764 | 4.150841 |
6fb83a55-6e2c-473c-aae8-69be1a83fa66 | emamhasan1804/XPSC | week -18/day -01/C_Napoleon_Cake.cpp | #include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
// template <typename T> using pbds = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; // for set
template <typename T> using pbds = tree<T, n... | ALGO | 0.999838 | 4.863636 |
ae53b07b-c533-4ae7-a8ac-473faf4630ea | sommerlukas/llvm-offload-jetson | llvm/lib/CodeGen/MachineBranchProbabilityInfo.cpp | #include "llvm/CodeGen/MachineBranchProbabilityInfo.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/IR/Instructions.h"
#include "llvm/InitializePasses.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
INITIALIZE_PASS_BEGI... | TOOL | 0.915491 | 7.848974 |
61512d30-3d23-4990-bbe9-ac4e48769a86 | Tasmia-Hossain/Data-Structures-Lab | BFS_PathPrint.cpp | // 1 -> 2 -> 6 -> 10
#include<bits/stdc++.h>
using namespace std;
vector<int>Node_Vec[11];
int level[11];
int parent[11]; //*
void BFS(int source)
{
for(int i=0;i<11;i++)
{
level[i]=INT_MAX;
parent[i]=i; //*
}
queue<int>Q;
Q.push(source);
level[source]=0;
while(!... | ALGO | 0.999989 | 4.674288 |
c333951f-3a7c-4287-b7bc-61bdb63148dd | KanchanRathore/Heuristics-and-Evolutionary-Algorithms-for-Electric-Vehicle-Charging-Station-Placement-Problem | EV Instances/EV_Instance.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <cstdlib>
#include <ctime>
#include <iomanip>
#include <sstream>
#include <algorithm>
using namespace std;
struct QKPInstance {
int n;
int density;
double f;
double capacity;
vector<double> linearCoefficients;
vector<vector<doub... | DATA | 0.853926 | 5.846642 |
fe0e5405-c7b1-454c-898e-eed0ac4a88f0 | prashant-smart/Leetcode-Daily-Questions | 307-range-sum-query-mutable/307-range-sum-query-mutable.cpp | class NumArray {
public:
vector<int> tree;
vector<int> arr;
int size;
void buildTree(int str,int end,int curr){
if(str==end){
tree[curr]=arr[str];
return;
}
if(str>end) return ;
int mid=(str+end)/2;
buildTree(str,mid,2*curr);
... | ALGO | 0.999943 | 6.20315 |
0d62d5d4-004b-4ca2-a981-1f18ac73844b | Shokanta-Roy/Assiut-University-Training---Newcomers__codeforces.com | Sheet #7 (Recursion)/I. Count Vowels.cpp | #include<bits/stdc++.h>
using namespace std;
int vowel(char c)
{
return c == 'a' || c == 'e' || c == 'i' || c == 'o' || c == 'u' || c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U';
}
int check(string value, int size)
{
if (size - 1 == 0)
{
return vowel(value[size - 1]);
}
return ... | ALGO | 0.999759 | 4.564377 |
a862b6d2-b5d3-4876-8c00-b4594b3bdd4d | Satzyakiz/CP | LeetCode/June_2020_Challenge/20th_June/Permutation_Sequence.cpp |
// The set [1,2,3,...,n] contains a total of n! unique permutations.
//
// By listing and labeling all of the permutations in order, we get the
// following sequence for n = 3:
//
// "123"
// "132"
// "213"
// "231"
// "312"
// "321"
// Given n and k, return the kth permutation sequence.
//
// Note:
//
// Given n will... | ALGO | 0.998248 | 6.060731 |
2c7912c6-e824-4999-a77e-fdeb35f928ca | deepak-ky/cpp-codes | cpp-codes/determine_if_a_string_has_all_unique_characters.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define varname(name) #name
#define mod 1000000007
#define wer(x) cout<<"\n"<<varname(x)<<" here : "<<x<<"\n"
#define asdf(a,n) ... | ALGO | 0.999967 | 4.136252 |
ab9516c8-8916-407a-82e0-ca522ecc22e7 | Ankit77760/LeetCode-POTD | August_2024/04_.cpp | //1508. Range Sum of Sorted Subarray Sums
/*
You are given the array nums consisting of n positive integers. You computed the sum of all non-empty continuous subarrays from the array and then sorted them in non-decreasing order, creating a new array of n * (n + 1) / 2 numbers.
Return the sum of the numbers from index ... | ALGO | 0.999954 | 6.055933 |
5d6aa218-f78d-47bf-8718-c0a3658ebb11 | Gobrielm/ClassWork_Cpp | lab30/main.cpp | /*
COMP 235
Lab 30 : Computing Stats with Lambda Functions (Start)
TODO:
Note the allValues list container in main
Iterate through the container using for_each
Compute and print out the following statistics using ONLY for_each and ”in-line” lambda functions (as arguments to the for_each call)
sum
average ... | ALGO | 0.99823 | 6.07486 |
b84a231a-3f8a-4e30-aea1-34cc33aa668e | EulerDanseur/MyWorks | Basics of Programming/week 12/StringFunctions.cpp | #include<iostream>
using namespace std;
int StrLen(char str[])
{
int count = 0;
for(int i = 0; str[i] != 0; i++)
count++;
return count;
}
void StrCat(char a[], char b[])
{
int aLen = StrLen(a);
int bLen = StrLen(b);
for(int i = 0; i < bLen; i++)
a[aLen + i] = b[i];
}
void St... | ALGO | 0.993329 | 3.56338 |
eec37fab-2b60-4017-a397-53db2f0d33e9 | SWEG-2014-EC-Batch/Code_Tamers | FoP-I/Class-Activities/Mastwal-Mesfin/Symbol-Checker/Character-Checker.cpp | #include<iostream>
#include<ctype.h>
using namespace std;
int main()
{
char Letter;
int U;
//U=Letter%2;
cout<<"Enter the character: ";
cin>>Letter;
if(Letter>='A' && Letter<='Z')
{
cout<<"Capital-Case Letter";
}
else if(Letter>='a' && Letter<='z')
{
cout<<"Small-... | ALGO | 0.943895 | 3.121977 |
a89677fc-4bc8-4ed9-825f-9be36581518b | trilinos/Trilinos | packages/ml/test/tmp/ml_test_nonsym.cpp | #include "ml_include.h"
#ifdef HAVE_MPI
#include "mpi.h"
#include "Epetra_MpiComm.h"
#else
#include "Epetra_SerialComm.h"
#endif
#include "Epetra_Map.h"
#include "Epetra_Vector.h"
#include "Epetra_CrsMatrix.h"
#include "Epetra_LinearProblem.h"
// required to build the example matrix
#include "Galeri_Maps.h"
#include "... | ALGO | 0.997693 | 4.199812 |
3f78fc90-b295-4a56-b816-ff84ae2467df | Prikshit-anthal/45_DAY_DSA_QUESTIONS | graphs/19.cpp | class Solution
{
public:
bool isPossible(int N, vector<pair<int, int>> &prerequisites)
{
// Code here
vector<vector<int>> adj(N);
for (auto i : prerequisites)
{
adj[i.first].push_back(i.second);
}
// DFS
// bool already_visited[N]={false},v... | ALGO | 0.999882 | 5.818815 |
64ec0487-8ef0-40e8-bc35-883198c6f477 | namdoel1412/CTDLGT | C++/DayConLienTiepCoTongLonNhat/main.cpp | #include <iostream>
using namespace std;
int main()
{
int t, n, a[120]={0}, values[120]={0};
cin >> t;
while(t--){
cin >> n;
for(int i = 1; i <= n; i++){
cin >> a[i];
}
// Values[] - Quyết định rằng với tổng liên tiếp hiện tại có tiếp tục nhận thêm giá trị hay ... | ALGO | 0.999928 | 3.810732 |
75ded9e5-f7f6-4d25-8b7f-3e6a97618680 | ashokabairwaideology/Leet-code-problem | solution/1300-1399/1371.Find the Longest Substring Containing Vowels in Even Counts/Solution.cpp | class Solution {
public:
int findTheLongestSubstring(string s) {
vector<int> pos(32, INT_MAX);
pos[0] = -1;
string vowels = "aeiou";
int state = 0, ans = 0;
for (int i = 0; i < s.size(); ++i) {
for (int j = 0; j < 5; ++j)
if (s[i] == vowels[j])
... | ALGO | 0.999862 | 5.603864 |
39289b41-a1e2-4307-a6e2-a95047b4758e | Adityaghatiya/Algorithm-Analysis-And-Design-Assigment | QuickSort.cpp | #include <iostream>
using namespace std;
int partition(int arr[], int start, int end)
{
int pivot = arr[start];
int count = 0;
for (int i = start + 1; i <= end; i++) {
if (arr[i] <= pivot)
count++;
}
int pivotIndex = start + count;
swap(arr[pivotIndex], arr[start]);
... | ALGO | 0.99996 | 4.818318 |
82a05594-da62-4f00-8ccf-525c5c4a9708 | ishandutta2007/codeforces | aid/normal/960/D.cpp | #ifdef DEBUG
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
#ifdef DEBUG
#define eprintf(...) fprintf(stderr, __VA_ARGS__), fflush(stderr)
#else
#define eprintf(...) ;
#endif
#define sz(x) ((int) (x).size())
#define TASK "text"
const int inf = (int) 1.01e9;
con... | ALGO | 0.9989 | 3.711964 |
697e56fe-60a9-4b62-9ecc-ad7cdce70025 | thegamer1907/Code_Analysis | Codes/AC/1953.cpp | #include "bits/stdc++.h"
using namespace std;
const int N = 2e5 + 5;
int in[N];
map<long long, int> L, R;
int main() {
int n, k;
scanf("%d %d", &n, &k);
for(int i = 1; i <= n; ++i) {
scanf("%d", &in[i]);
R[in[i]]++;
}
long long res = 0;
for(int i = 1; i <= n; ++i) {
R[in[i]]--;
if(in[i] % k... | ALGO | 0.999957 | 3.490324 |
86b25e5e-0f04-410f-be24-1857d1826069 | musou1500/atcoder_answers | abc139/c.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int main(int argc, const char *argv[])
{
int n;
cin >> n;
vector<int> hs(n);
for (int i = 0; i < n; i++) {
cin >> hs[i];
}
int ans = 0, cnt = 0, i = 0;
while (i < hs.size() - 1) {
if (hs[i] >= hs[i + 1]) {
cnt++;... | ALGO | 0.999916 | 4.505384 |
8affcbb7-975f-49ee-9937-61726dfcf981 | computervisionlearner/unimrcp_with_huaweicloud_asr | plugins/huawei-recog/huaweicloud_asr/third_party/boost-src/libs/asio/example/cpp14/executors/fork_join.cpp | #include <boost/asio/ts/executor.hpp>
#include <boost/asio/thread_pool.hpp>
#include <condition_variable>
#include <memory>
#include <mutex>
#include <queue>
#include <thread>
#include <numeric>
using boost::asio::dispatch;
using boost::asio::execution_context;
using boost::asio::thread_pool;
// A fixed-size thread p... | ALGO | 0.997051 | 7.623748 |
e5bfe454-4441-4b1f-be2f-728805e62036 | RaviKumar-Nemala/DATA-STRUCTURES | DYNAMIC_PROGRAMMING/ddos_folder/MAXIMUM_INCREASING_SUM_ALONG_WITH_SUBSEQUENCE.cpp | #include<bits/stdc++.h>
#include<iostream>
using namespace std;
class Solution
{
public:
int max_incr_sum(int arr[] , int n )
{
int max_incr_at_point[n];
int i , j ;
vector<int>values(n);
for (i= 0 ; i < n ; i++ )
{
... | ALGO | 0.999994 | 4.150553 |
757e55aa-f7ff-4d87-9dfb-14aa91c32b74 | Arthur-Systems/Cpp_Projects | Data Structures/Lab 9/HWa9.cpp | #include "HWBinaryTree.h"
/* This is test file for HWBinaryTree.h.
It hosts two test cases using the HWBinaryTree Tree.
The first test case tests interger values with all the functions.
The second test case tests double values with only
insert, delete, and print which was the in instruction.
*/
int main()
{
HWBina... | TEST | 0.983159 | 4.799068 |
949845ca-be75-4e80-8ddd-86144104c6e7 | darlenepetal/csc-5 | HMWK/Gaddis_9thEd_Chap5_Prob22_Rectangle/main.cpp | /*
* File: main.cpp
* Author: Noah Garthwaite
* Created on January 16, 2024, 5:15 PM
* Purpose: Gaddis_9thEd_Chap5_Prob22_Rectangle
*/
//System Libraries
#include <iostream> //Input/Output Library
using namespace std;
//User Libraries
//Global Constants, no Global Variables are allowed
//Math/Physics/Conv... | ALGO | 0.995467 | 3.907901 |
9faf10b8-8478-4f2d-ab50-69cae2e7c89e | arafat-hasan/problem-solving | leetcode/Hard/23.merge_k_sorted_lists.cpp | /*
* FILE: 23.merge_k_sorted_lists.cpp
* @author: Arafat Hasan Jenin <opendoor.arafat[at]gmail[dot]com>
* LINK: https://leetcode.com/problems/merge-k-sorted-lists/
* DATE CREATED: 05-02-22 22:58:21 (+06)
* LAST MODIFIED: 05-02-22 22:58:46 (+06)
* VERDICT: Accepetd
*/
/**
* Definition for singly-linked list.
*... | ALGO | 0.999852 | 6.427813 |
61ed4f59-ac46-48e5-ba3d-8176d2a4b1b2 | caenciso30/Programacion-2022-2 | 2022-09-09-Parciales/pi.cpp | #include <iostream>
#include <cmath>
#include <cstdlib>
void compute_pi(double eps);
int main(int argc, char **argv) {
if (argc != 2) {
std::cout << "ERROR. Usage:\n" << argv[0] << " eps\n";
return 1;
}
const double EPS = std::atof(argv[1]);
compute_pi(EPS);
return 0;
}
void compute_pi(dou... | ALGO | 0.999734 | 4.476109 |
39a74179-c821-4d3e-96ed-cc05f0429333 | the-illusionist/practice_code | twodogs.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
unsigned long n,x,t,i;
cin>>n>>x;
unsigned long a[n],c[n],l=0,r=n-1,b[n],j=0,k,pf1,pf2,pf3,pf4,sum=0,ans=10000000,g;
for(i=0;i<n;i++)
{
cin>>a[i];
}
for(i=0;i<n;i++)
{
c[i]=a[i];
}
sort (a,a+n);
while(l<r)
{
if (a[... | ALGO | 0.999983 | 3.883257 |
7fde5917-bb26-4609-83d6-a60a512593e8 | hssik508/baekjoon | 2024/2410/11404.cpp | #include <iostream>
#include <vector>
#include <queue>
using namespace std;
int main()
{
cin.tie(0)->sync_with_stdio(0);
int n, m;
cin >> n >> m;
vector<vector<int>> v(n + 1, vector<int>(n + 1, 100000000));
vector<vector<int>> allDist(n + 1, vector<int>(n + 1));
for (int i = 0; i < m; i++)
... | ALGO | 0.99997 | 4.632044 |
b4244a12-90f2-41ee-8620-a8eb5478b363 | whattadarsh/competitive-coding-online-platforms-solutions | codeChef/DSA_Series/contest2(DS)/compiler(4).cpp | #include<bits/stdc++.h>
using namespace std;
//Macros
#define fo(n) for(auto i =0;i<n;i++)
#define fn(x,n) for(;x<n;x++)
#define see(x) cout<<#x<<" = "<<(x)<<"\n"
#define look(v) cout<<#v<<" : "; for(auto x:v) cout<<x<<" "; cout<<endl
#define vi vector<int>
#define vui vector<uint64_t>
#define vvi vector<vector<int... | ALGO | 0.999744 | 3.199492 |
8af2dd6d-bc19-40fe-bcef-1be7dd40792a | kogito0325/boj | cpp_codes/boj10797.cpp | #include <iostream>
using namespace std;
int main()
{
int day;
int carNum;
int cnt = 0;
cin >> day;
for (int i = 0; i < 5; i++)
{
cin >> carNum;
if (carNum == day)
cnt++;
}
cout << cnt;
return 0;
} | ALGO | 0.999395 | 3.87046 |
efbbba32-a4f5-480b-9c15-cb6e0ef11956 | Kevin923/cpp_learningnotes | 二刷-5双指针/27.移除元素.cpp | /*
* @lc app=leetcode.cn id=27 lang=cpp
*
* [27] 移除元素
*/
// @lc code=start
#include <vector>
using namespace std;
class Solution {
public:
int removeElement(vector<int>& nums, int val) {
int l = 0;
for(int r = 0; r < nums.size(); r++){
if(nums[r] != val){
nums[l] = ... | ALGO | 0.999378 | 6.394979 |
db0c3713-5424-4dcc-8ace-134d50b1500e | SquarePants1991/EZGLKit | libs/bullet/BulletDynamics/Featherstone/btMultiBodyJointMotor.cpp | ///This file was written by Erwin Coumans
#include "btMultiBodyJointMotor.h"
#include "btMultiBody.h"
#include "btMultiBodyLinkCollider.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
btMultiBodyJointMotor::btMultiBodyJointMotor(btMultiBody* body, int link, btScalar desiredVelocity, btScalar maxMo... | ALGO | 0.870985 | 7.400224 |
7bf9474b-3602-4213-ad9b-f508da69d9f4 | NahushRana12/CompetitionCoding | Leetcode/707. Design Linked List.cpp | //Leetcode Problem: 707. Design Linked List(https://leetcode.com/problems/design-linked-list/)
#include <bits/stdc++.h>
using namespace std;
class MyLinkedList {
int val;
MyLinkedList* next;
int len{-1};
public:
/** Initialize your data structure here. */
MyLinkedList() {
val = 0;
... | ALGO | 0.999799 | 4.737172 |
650aa40f-3a4b-41f3-8e40-76d49d9d9233 | AshutoshXP05/POTD | DEC - 24/DAY - 9/task_a_.cpp | /*
Question 750A - Almost Prime
A number is called almost prime if it has exactly two distinct prime divisors.
Link :
https://codeforces.com/problemset/problem/26/A
Example 1:
Input :
10
Output:
2
Explanation:
2 numbers 6 and 10 who has exactly 2 distinct p... | ALGO | 0.999885 | 5.217612 |
ec9f9820-a76a-43c9-bde6-c65eea7a3e03 | PeterJochem/motion_planning_library | src/cpp/planning/src/utilities.cpp | #include "planning/utilities.hpp"
namespace planning {
float sum_square_errors(RobotState* state1, RobotState* state2) {
if (!state1 || !state2) {
// throw exception
}
else if (state1->dimension() != state2->dimension()) {
// throw exception
}
flo... | TOOL | 0.924329 | 5.17695 |
78325d34-38ef-43d9-bc60-cb61328fc3bd | heyymohit/Strivers-A2Z-DSA-Sheet | Pattern 12 - GFG/pattern-12.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
void printTriangle(int n) {
// code here
// [ space star space]
// [ 1 8 1 ]
// [ 2 6 2 ]
// [ 3 4 3 ]
// [ 4 2 4 ... | ALGO | 0.999896 | 5.964351 |
b7ee6bd2-8684-4cbe-982b-c8460d347152 | mub4shir/cpp | ns/distance.cpp |
#include <bits/stdc++.h>
using namespace std;
// Function to calculate distance
float distance(int x1, int y1, int x2, int y2)
{
// Calculating distance
return sqrt(pow(x2 - x1, 2) +
pow(y2 - y1, 2) * 1.0);
}
// Drivers Code
int main()
{
cout << fixed << setprecision(0) << distance(3, 4... | ALGO | 0.999828 | 4.289507 |
0bf01087-17d5-4ed5-8918-b700be64e047 | edges-collab/fastspec | pfb.cpp |
#include <algorithm>
#include <stdlib.h>
#include <unistd.h>
#include "pfb.h"
#include "utility.h"
#define THREAD_SLEEP_MICROSECONDS 5
// ----------------------------------------------------------------------------
// Constructor
// ----------------------------------------------------------------------------
PFB::PF... | TOOL | 0.941454 | 4.944989 |
49dfdc5c-3942-4a7d-b91c-7120148b4b2e | Abdullahhas/DSA | finals/removeduplicate.cpp | #include<iostream>
using namespace std;
struct node {
int info;
node *next;
};
node *head = NULL;
void insertbeg(int x) {
node *p = new node;
p->info = x;
p->next = head;
head = p;
}
void deletedubi() {
node *p = head;
node *q;
while (p != NULL && p->next != NULL) {
q = ... | ALGO | 0.999797 | 4.823224 |
68fb0493-4790-4d24-b971-9a41a92523d2 | nehcoah/algorithm-template | leetcode/weekly/423/a.cpp | class Solution {
public:
bool hasIncreasingSubarrays(vector<int>& nums, int k) {
auto check = [&](int l, int r) {
for (int i = l + 1; i < r; i++) {
if (nums[i] <= nums[i - 1]) {
return false;
}
}
return true;
};
... | ALGO | 0.999947 | 5.984793 |
0d697a0f-8aa7-4ded-a671-56339ab9a648 | fire-archive/godot-fire | servers/physics_2d/area_pair_2d_sw.cpp | /*************************************************************************/
/* area_pair_2d_sw.cpp */
/*************************************************************************/
/* This file is part of: */
/* ... | ALGO | 0.99725 | 7.092694 |
cb25d485-e83b-420a-8e65-35bbb4b80029 | amana2525/proiecte-informatica | tema 12 info/tema info 12- pr 13/main.cpp | #include <iostream>
using namespace std;
int main()
{ int i, n, s=0, d, sd=0;
cout << "n="; cin>>n;
for (i=1; i<=n; i++)
{
for (d=1; d<=i; d++)
if (i%d==0)
s=s+d;
for (d=1; d<=s-1; d++)
if (s%d==0)
sd=sd+d;
if (s==sd)
cout << i << " ";
else
... | ALGO | 0.999663 | 3.737905 |
097ce8bf-07e2-4b08-8454-9526672cbf4a | SaiKrishna1207/DSA-Practice | Week-4/Day-28/keys.cpp | class Solution {
public:
bool canVisitAllRooms(vector<vector<int>>& rooms) {
int i, j, k, n = rooms.size();
bool visited[n];
for(i = 0;i < n; i++)
visited[i] = false;
queue<int> q;
q.push(0);
while(!q.empty())
{
j = q.front();
... | ALGO | 0.999829 | 6.207891 |
f1fd38b4-6e84-4d6e-9aaf-59f1d3a09bd8 | Himangi-Malik/Main-Quest | #69 leetcode.cpp | class Solution {
public:
long long int binarysearch(int x)
{
int s=0;
int e = x;
long long int mid = s + (e-s)/2;
long long int ans;
while(s<=e){
long long int sq= mid*mid;
if(sq==x)
return mid;
if(sq<x){
... | ALGO | 0.999943 | 5.274573 |
29ecbcef-9bbc-4ae8-b07f-ff0982307e4d | hgo500c/Systems-2-OS-Concurrency-Virtualization-and-Security | exercise11.cpp | #include <iostream>
#include <cassert>
#include <string>
#include <vector>
#include <algorithm>
#include <thread>
#include <mutex>
#include <atomic>
#include <numeric>
#include <condition_variable>
// Forward declaration of a method to ease testing.
void increment(int& entry);
/** NOTE: You may add global variables a... | ALGO | 0.978529 | 6.37394 |
fcab598d-dea8-4ba7-9163-e024b68feee8 | zilongshanren/Spine-Cocos2D-X | cocos/math/Vec2.cpp | #include "math/Vec2.h"
#include "math/MathUtil.h"
#include "base/ccMacros.h"
NS_CC_MATH_BEGIN
// returns true if segment A-B intersects with segment C-D. S->E is the ovderlap part
bool isOneDimensionSegmentOverlap(float A, float B, float C, float D, float *S, float * E)
{
float ABmin = std::min(A, B);
float A... | TOOL | 0.918218 | 7.016965 |
2fc05b20-7251-4075-9e61-144f406c0669 | MOHIT-IITP/Leetcode | 841.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
bool canVisitAllRooms(vector<vector<int>> &rooms) {
int n = rooms.size();
unordered_set<int> visit;
dfs(rooms, visit, 0);
if (visit.size() == rooms.size())
return true;
return false;
}
void dfs(vector<vector<int>... | ALGO | 0.999304 | 5.822103 |
a9651e02-6170-4053-ace2-bb2336d18b1d | ManthanSharma298/Leetcode-Questions-OLD | Dynamic Programming/longest-common-subsequence.cpp |
// prob link: https://leetcode.com/problems/longest-common-subsequence/
// This is Top-Down Approach
int LongestCommonSubsequence(string r, string s, int indR, int indS){
if(indR < 0 || indS < 0) return 0;
if(r[indR] == s[indS]){
return 1 + LongestCommonSubsequence(r, s, indR-1, indS-1);
}
el... | ALGO | 0.996787 | 6.117994 |
fc9c052d-e81c-46d7-b794-9a14b836d03b | SakshiBhalla77/leetcode | 0001-two-sum/0001-two-sum.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
for(int i =0; i<nums.size();i++){
for(int j=1; j<nums.size(); j++){
if(nums[i] +nums[j] == target)
return {i,j};
}
}
return {};
}
}; | ALGO | 0.999854 | 6.052567 |
4be1c8b3-f140-4fd2-8a20-e0f57b1b877c | revanth1718/LeetCode-Graphs | 0075-sort-colors/0075-sort-colors.cpp | class Solution {
public:
void sortColors(vector<int>& nums) {
int n = nums.size();
int l = 0, mid = 0, high = n - 1;
while(mid <= high){
if(nums[mid] == 0){
swap(nums[mid],nums[l]);
l++;
mid++;
}
else if(nums... | ALGO | 0.999915 | 6.114544 |
a71a80ff-66d2-4ec0-90b0-cbae99cbdc0a | hitwlh/leetcode | 90_Subsets_II/solution.cpp | class Solution {
public:
vector<vector<int>> subsetsWithDup(vector<int>& nums) {
ret.push_back({});
if(nums.empty()) return ret;
quantile = 0;
sort(nums.begin(), nums.end());
dfs(0, nums);
return ret;
}
private:
int quantile;
void dfs(int start, vector<int... | ALGO | 0.999971 | 6.030324 |
b488449f-e14d-4fd4-a0ce-6c1222e29af1 | alexandraback/datacollection | solutions_5648941810974720_1/C++/jeremy624/Q1.cpp | #include <cstdio>
#include <algorithm>
#include <vector>
#include <cstring>
#include <cmath>
using namespace std;
int t,i,j,k,cnt[305];
char s[2005];
vector <int> ans;
int main(){
scanf("%d", &t);
int testcase = 0;
while(++testcase <= t){
ans.clear();
scanf("%s", s);
int l = strlen(s);
for(i = 0; i < l; i... | ALGO | 0.999537 | 3.764699 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.