uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
be83d421-0f28-473f-b2fb-b640c501114a | ElrikSouza/bdtp2 | src/btree/bptree-leaf-block.cpp | #include "bptree-leaf-block.h"
#include "../buffer/buffer-utils.h"
BPTreeLeafBlock::BPTreeLeafBlock() {
_buffer = Buffer(BLOCK_SIZE);
// header data
_is_leaf = 1;
_buffer.write_2byte_number(_is_leaf);
_qt_keys = 0;
_buffer.write_2byte_number(_qt_keys);
_buffer.jump_to_absolute_position(B... | ALGO | 0.876456 | 3.868811 |
5696832c-9689-4f27-8713-f2019d4e2985 | raginigit6604/100DaysofCode | word_search.cpp | #include<iostream>
#include<vector>
#include<string>
using namespace std;
class Solution {
public:
vector<vector<int>> directions = {{1,0},{-1,0},{0,1},{0,-1}};
bool find(vector<vector<char>>& board, int i, int j, int index, string& word) {
if (index == word.length()) {
return true;
... | ALGO | 0.999779 | 6.674932 |
98d4f7de-d870-42c2-93dc-08ac7dd28453 | Rushi0508/Leetcode | Check if array is sorted - GFG/check-if-array-is-sorted.cpp | //{ Driver Code Starts
// Initial template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function template for C++
class Solution {
public:
bool arraySortedOrNot(int arr[], int n) {
// code here
for(int i=1;i<n;i++){
if(arr[i-1] > arr[i]){
... | ALGO | 0.999733 | 5.695374 |
afac3008-129e-4f16-b670-cc9465b952c7 | JimenaLeyva07/landing_page_fluttter_community | 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.998762 | 6.786404 |
23d8d8f8-4270-4bd7-bf60-6e9d0934f02b | gani0325/CppEmbedded | ProfessionalC++/solutions/Chapter4/4_1.cpp | // 객체 포인터 선언 및 활용
#include <iostream>
using namespace std;
class Circle
{
int radius;
public:
Circle() { radius = 1; }
Circle(int r) { radius = r; }
double getArea();
};
double Circle::getArea()
{
return 3.14 * radius * radius;
}
int main()
{
Circle donut;
Circle pizza(30);
// 객체 이름... | TOOL | 0.888037 | 5.936637 |
701897aa-90b9-4c39-b0a6-29c21f53f694 | yy214/INF585-erosion | project_code/lib/eigen-3.4.0/doc/examples/QuickStart_example.cpp | #include <iostream>
#include <Eigen/Dense>
using Eigen::MatrixXd;
int main()
{
MatrixXd m(2,2);
m(0,0) = 3;
m(1,0) = 2.5;
m(0,1) = -1;
m(1,1) = m(1,0) + m(0,1);
std::cout << m << std::endl;
}
| ALGO | 0.993439 | 3.474624 |
2708589d-0378-408d-b14e-c14c0c7ef23e | Anggerdhismakusuma/Algorithm-and-Programming | ArithmeticandOperation/S.cpp | #include <stdio.h>
int main(){
double l, b, h;
scanf("%lf %lf %lf", &l, &b, &h);
double luasSegitiga, luasPersegiPanjang;
luasSegitiga = (b * h);
luasPersegiPanjang = 3*(l*b);
printf("%.3lf\n",luasSegitiga+luasPersegiPanjang);
return 0;
}
| ALGO | 0.99865 | 3.455247 |
0d67574b-f143-4f36-8635-f853f3e0fc9b | Mallhw/CompetitiveProgramming | USACO/Silver/AngryMonk.cpp | #include "bits/stdc++.h"
using namespace std;
#define max(a, b) (a < b ? b : a)
#define min(a, b) ((a > b) ? b : a)
#define mod 1e9 + 7
#define FOR(a, c) for (int(a) = 0; (a) < (c); (a)++)
#define FORL(a, b, c) for (int(a) = (b); (a) <= (c); (a)++)
#define FORR(a, b, c) for (int(a) = (b); (a) >= (c); (a)--)
#de... | ALGO | 0.999827 | 3.828923 |
ca27ac87-fbbe-4e7f-8848-50dc7feb0846 | afrandormd/belajar-cpp | latihan-cpp/membership.cpp | #include <iostream>
using namespace std;
int main(){
int total = 0;
int hargaBaju = 50000;
int diskon, jumlahBarang;
bool isMember = false;
cout << "===== Program Membership Pembelian Baju toko Sharein's Boutiqeu =====\n";
cout << "Jumlah baju yang dibeli? ";
cin >> jumlahBarang;
co... | ALGO | 0.978772 | 4.450466 |
8c9150c0-c963-4c84-a45f-45836f864ace | pratippatel/LeetCode | 24-swap-nodes-in-pairs/24-swap-nodes-in-pairs.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* swapPairs(L... | ALGO | 0.999997 | 5.556121 |
2a45c3b3-ae45-4878-93bc-6505add9abc9 | ishandutta2007/codeforces | andreinet/normal/758/B.cpp | #include <bits/stdc++.h>
#define SZ(x) ((int) (x).size())
using namespace std;
typedef long long i64;
int main() {
#ifdef LOCAL_RUN
freopen("task.in", "r", stdin);
freopen("task.out", "w", stdout);
//freopen("task.err", "w", stderr);
#endif // ONLINE_JUDGE
ios::sync_with_stdio(false);
cin.... | ALGO | 0.999072 | 3.830279 |
e071918a-b51c-47d6-95a2-b9961d4b595b | AdvTrainEvalSrcDomain/adv-train-evaluation-source-code-domain | code-imitator/data/dataset_2017/dataset_2017_8/satos/3264486_5633382285312000_satos.cpp | #include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<algorithm>
#include<cmath>
#include<climits>
#include<string>
#include<set>
#include<map>
#include<iostream>
using namespace std;
#define rep(i,n) for(int i=0;i<((int)(n));i++)
#define reg(i,a,b) for(int i=((int)(a));i<=((int)(b));i++)
#define... | ALGO | 0.999457 | 3.995998 |
d9bb83c5-8939-40c2-a830-db1da37a35f6 | IRFAN374/AddSkillLeetCode | solutions/239. Sliding Window Maximum.cpp | class Solution {
public:
vector<int> maxSlidingWindow(vector<int>& nums, int k) {
deque<int> dq;
for(int i=0;i<k;i++){
while(!dq.empty() && nums[i]>=nums[dq.back()]){
dq.pop_back();
}
dq.push_back(i);
}
vector<int> ans;
... | ALGO | 0.999984 | 6.071437 |
66a0d782-cf9e-40fd-8433-bd7254f0758c | mahmoudmahgoub/leetcode | algorithms/e68.evaluate-boolean-binary-tree/e68_cplusplus.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.999918 | 6.223247 |
f5fba6d0-378c-48b6-85ac-0d28a3e770df | bingbingzhenbang/LeetCode_Answers | LeetCode/Insertion_Sort_List.cpp | //Sort a linked list using insertion sort.
#include "ListNode.h"
ListNode* insertNode(ListNode *head, ListNode *p)
{
if (p == 0)
return head;
if (head == 0)
{
head = p;
head->next = 0;
}
else
{
if (p->val < head->val)
{
p->next = head;
head = p;
}
else
{
ListNode *r = 0, *q = head;
w... | ALGO | 0.999982 | 5.408939 |
72907753-9a03-47ac-9695-f598a9721ea7 | Shilpabhavani1/Gfg | Basic/Pattern 8/pattern-8.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
void printTriangle(int n) {
// code here
for(int i=0;i<n;i++)
{
for(int j=0;j<i;j++)
{
cout << " ";
}
for(int j=0;j < 2*n-(2*i+1);j++)
... | ALGO | 0.999887 | 5.537139 |
a35f541f-3151-449f-ad5c-e61001eb4d01 | ppraval/Codez | cplusplus/increasingtriplet.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
vector<int> nums = {2, 1, 5, 0, 4, 5};
int n = nums.size();
int min = INT_MAX;
int mid = INT_MAX;
if(n < 3)
{
cout << "False";
return 0;
}
for (int i = 0; i < n; i++)
{
if(mid < nums[i])
... | ALGO | 0.999945 | 4.158785 |
9a613238-6cac-4d38-8365-a90110009c2a | Mwako/deps | boost/libs/numeric/odeint/examples/ublas/lorenz_ublas.cpp | #include <iostream>
#include <boost/numeric/odeint.hpp>
#include <boost/numeric/ublas/vector.hpp>
/* define ublas::vector<double> as resizeable
* this is not neccessarily required because this definition already
* exists in util/ublas_wrapper.hpp.
* However, for completeness and educational purpose it is repeate... | ALGO | 0.999705 | 7.168579 |
db82159c-5872-4489-95e0-2c1f9c9c36bb | raincross7/code-similarity | codes/train_code/problem223/problem223_240.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()
#define RALL(a) (a).rbegin(), (a).rend()
#define pb push_back
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
int main(){
int n; cin >> n;
vector<int> a(... | ALGO | 0.999967 | 4.357357 |
2542d065-c0ea-4a24-9e5c-c6b129a2dfa2 | RafaelCamilo1306/Linguage_de_Baixo_Nivel | C++/Sub-rotinas/conversorManual- DOLAR para REAL.cpp | //byRafaelCamilo
#include "stdio.h"
#include "math.h"
#include "iostream"
#include "cstdlib"
#include "string"
using namespace std;
float converter(float cotacao, float valReal);
int valor;
float cotacao;
string moeda;
int main(){
cout<<"========= Casa de cambio!!! ==============";
cout<<"\nDigite... | TOOL | 0.872056 | 4.839975 |
d5a196ec-1e71-4351-bfc8-ea7acdab000f | keshavskn123/DSA-in-CPP | Extra Questions/uniqueNumberInArray.cpp | #include<iostream>
using namespace std;
int main(){
int arr[] = {1,2,3,2,1,3,5,4,4};
for(int i = 0; i < 9; i++){
for(int j = i+1 ; j < 9 ; j++){
if(arr [i] == arr [j]) { //Always remember that inside if(condition is given ==(Relational) not Assignment(=)
ar... | ALGO | 0.999967 | 3.457332 |
0f947700-d880-4abb-a7bc-73b4d93f5d0a | versa-syahptr/cpp_repo | psHandler/tes.cpp | #include <stdio.h>
#include <tchar.h>
#include <windows.h>
int _tmain(int argc, _TCHAR* argv[])
{
if (argc != 2)
{
wprintf(L"Argument is required: Process ID to kill\n");
return -1;
}
if (wcsspn(argv[1], L"01234567890") < wcslen(argv[1]))
{
wprintf(L"Process ID should be positive intege... | TOOL | 0.91175 | 5.258015 |
9dbe8ebb-18c8-4c71-be42-ad33c66246e8 | lionelfung7/luogu | p1023.cpp | #include <iostream>
using namespace std;
int main(void){
int advice_price(0), cost(0), price(0), last_price(0), _sales(0), dec(0), ans(0) ;
int sales[100000]{0};
cin >> advice_price;
cin >> cost >> sales[cost];
while(true){
cin >> price >> _sales;
if(price == -1 && _sales == -1) break;
last_price = price;
... | ALGO | 0.999924 | 3.594984 |
04875f35-d528-4970-9ffd-96e4ff736d5f | mirthfulLee/AlgorithmExecise | 浙软OJ/测试6/排长队.cpp | // 排长队
#include <iostream>
#include <vector>
using namespace std;
vector<int> p(100000), num(100000);
int n, m, temp, x, y;
char query;
int root(int x)
{
while (x != p[x])
x = p[x];
return x;
}
void merge(int x, int y)
{
int root_x = root(x);
int root_y = root(y);
if (num[root_x] < num[ro... | ALGO | 0.999967 | 4.30271 |
7b1f441c-9ec8-4ddd-bec7-c2b5c93a379f | xiaobbei/practice | 验证平衡二叉树.cpp | #include<iostream>
int* last = NULL;
bool isValidBST(TreeNode* root) {
if (root){
if(!isValidBST(root->left)) return false;
if (last && *last>=root->val) return false;
last = &root->val;
if(!isValidBST(root->right)) return false;
return true;
... | ALGO | 0.999894 | 4.914515 |
f459c488-e033-4377-a3ed-858a544d60cf | Nikitasalunke123/cpp | prime or not.cpp | #include<iostream>
using namespace std;
class test
{
public:
int check(int x)
{
int i,p=0;
for (i=2;i<x;i++)
{
if(x%i==0)
{
p=1;
break;
}
}
return p;
}
};
int main()
{
int x,p;
cout<<"enter a number";
cin>>x;
test obj;
p=obj.check(x);
if (p==0)
{
cout<<"number is prime:"<<x;
}
else
{
cout<<"number is ... | ALGO | 0.999801 | 3.551116 |
a4fc7e17-dfbf-4e3a-925e-a7767bf4cfe2 | rzando-org/leetcode | solution/0900-0999/0982.Triples with Bitwise AND Equal To Zero/Solution.cpp | class Solution {
public:
int countTriplets(vector<int>& nums) {
int mx = *max_element(nums.begin(), nums.end());
int cnt[mx + 1];
memset(cnt, 0, sizeof cnt);
for (int& x : nums) {
for (int& y : nums) {
cnt[x & y]++;
}
}
int ans ... | ALGO | 0.999976 | 5.470551 |
81924fb7-e249-469b-8e3e-9392cda18de2 | RameshtaVishwakarma/Data-Structures-and-Algorithms | Array Manipulation/Sorting/Merge Three Sorted Array.cpp | /*Given three sorted arrays A, B and C of size N, M and P respectively. The task is to merge them into a single array which must be sorted in
increasing order.
Example:
Input:
N = 4, A[] = [1 2 3 4]
M = 5, B[] = [1 2 3 4 5]
P = 6, C[] = [1 2 3 4 5 6]
Output: 1 1 1 2 2 2 3 3 3 4 4 4 5 5 6
Explanation: Merging these thre... | ALGO | 0.999805 | 4.628517 |
e52d1919-f685-464c-a4d1-79e604ca7e98 | i2mx/NZOI | NZIC 2024 Round 3/drive.cpp | #include <bits/stdc++.h>
#define int long long
#define endl '\n'
using namespace std;
const int B = 1474560;
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int disks = 0;
int N, M;
cin >> N >> M;
for (int i = 0; i < N; i++) {
char command;
cin >> command;
if (command == '... | ALGO | 0.997669 | 4.529329 |
cd4e1a3e-9a82-4a84-81e3-6a8533dc1ad3 | garyhubley/ProjectEuler | src/problem028.cpp | /*
* File: Problem028.cpp
* Author: Gary Hubley
* Company: Self
* Description:
* This is my attempt at problem028 from projecteuler.net
*
* Starting with the number 1 and moving to the right in a clockwise direction
* a 5 by 5 spiral is formed as follows:
*
* 21 22 23 24 25
* 20 7 8 9 10
* 19 6 1 2 1... | ALGO | 0.998527 | 6.042945 |
6a48c0b7-61c5-4f9f-9063-95738512d70f | findstr/Dijiang | deps/assimp/code/PostProcessing/TextureTransform.cpp | /** @file A helper class that processes texture transformations */
#include <assimp/Importer.hpp>
#include <assimp/postprocess.h>
#include <assimp/DefaultLogger.hpp>
#include <assimp/scene.h>
#include "TextureTransform.h"
#include <assimp/StringUtils.h>
using namespace Assimp;
// -----------------------------------... | TOOL | 0.851202 | 7.736214 |
18cdf5e5-83dc-484a-9635-63d2d1b045e5 | Kuro-orzz/CP | Marisaoj/Level_0/Basic/Array/026.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define MOD (ll)(1e9+7)
#define all(x) (x).begin(),(x).end()
#define vi vector<int>
#define pii pair<int, int>
#define fi first
#define se second
void solve(){
int n; cin >> n;
vi a(n);
for(int i = 0; i < n; i++)
cin >> a[i];
... | ALGO | 0.999971 | 4.146972 |
12edd4a1-eb52-4037-8365-b792a4f5ee8b | hyunjin0915/Algorithm-Practice | 프로그래머스/2/135807. 숫자 카드 나누기/숫자 카드 나누기.cpp | #include <string>
#include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
int hahaha(vector<int> array);
int solution(vector<int> arrayA, vector<int> arrayB) {
int answer = 0;
sort(arrayA.rbegin(),arrayA.rend());
sort(arrayB.rbegin(),arrayB.rend());
int a = hahaha(arrayA);
i... | ALGO | 0.999894 | 4.301493 |
a3a21d0b-9175-42ed-b79f-01579ff969a8 | Mahboob-A/algorithms-recap | Two Pointers/moore_voting_prac.cpp | // recap on 300124, Tuesday, 09.30 pm
// Moore's Vooting Algorithm (Find Majority Element Algorithm)
#include <bits/stdc++.h>
using namespace std;
vector<int> findMajorityElement(int *arr, int n)
{
int count = 1;
// index
int possible_major_elem = 0;
for (int i = 0; i < n; i++)
... | ALGO | 0.999992 | 5.21855 |
9e8709a2-36ff-42a7-be7b-52170cdaef2b | rQAQ/code | PAT/PAT 1059.cpp | #include<cstdio>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
struct node{
int data,f;
}a[10005];
inline int read(){
int s=0,w=1;
char ch=getchar();
while(ch<'0'&&ch>'9'){if(ch=='-')w=-1;ch=getchar();}
while(ch>='0'&&ch<='9') s=s*10+ch-'0',ch=getchar();
return s*w;
}
int isprime(... | ALGO | 0.999464 | 3.104631 |
632a2271-1d58-4c13-964b-1fdb0987d133 | antelero/Poo_2023_Com_2 | 01 repaso/2.cpp | #include <iostream>
using namespace std;
float factura(float importe);
int main(){
int p;
cout << "Ingrese importe\n";
cin >> p;
cout << factura(p);
return 0;
}
float factura(float importe){
importe += importe*0.13;
if (importe > 50)
importe = importe - importe*0.05;
return im... | TOOL | 0.987089 | 3.9128 |
2f27c60c-02c7-4788-bbdb-2a00a2ab9fad | martine-stdo/CppCode | dfs.cpp | #include <iostream>
using namespace std;
const int N = 10;
int path[N];
bool st[N];
int n;
void dfs(int u)
{
if (u == n)
{
for (int i = 0; i < n; i++)
{
printf("%d ", path[i]);
}
puts("");
}
else
{
for (int i = 0; i < n; i++)
{
... | ALGO | 0.999885 | 4.286491 |
ca909286-ae0d-4073-b4a2-5579ba4fdb04 | ashtoshkumar0897/Leetcode-Problem-s | 3189-find-champion-ii/3189-find-champion-ii.cpp | class Solution {
public:
int findChampion(int n, vector<vector<int>>& edges) {
vector<int> in_degree(n,0); // Track the number of incoming edges for each node.
for(auto edge : edges){
int u = edge[0],v = edge[1];
in_degree[v]++; // Increment in -degree for destinatio... | ALGO | 0.999974 | 5.907754 |
e07ea162-6064-415e-baab-25b6e1a3e5be | KevinStigma/SoftRender | SoftRender/eigen3/eigen3/bench/sparse_transpose.cpp |
//g++ -O3 -g0 -DNDEBUG sparse_transpose.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out
// -DNOGMM -DNOMTL
// -DCSPARSE -I /home/gael/Coding/LinearAlgebra/CSparse/Include/ /home/gael/Coding/LinearAlgebra/CSparse/Lib/libcsparse.a
#ifndef SIZE
#define SIZE 10000
#endif
#ifndef... | ALGO | 0.994415 | 5.110691 |
3762041d-3806-4687-b789-67597a6063e5 | oceantran27/cpp-projects-collection | 0704/google_monster-mash/third_party/libigl/include/igl/count.cpp | template <typename XType, typename SType>
IGL_INLINE void igl::count(
const Eigen::SparseMatrix<XType>& X,
const int dim,
Eigen::SparseVector<SType>& S)
{
// dim must be 2 or 1
assert(dim == 1 || dim == 2);
// Get size of input
int m = X.rows();
int n = X.cols();
// resize output
if(dim==1)
{
... | ALGO | 0.993708 | 5.298262 |
5258eac7-748d-422e-9305-3fb4fcfdcd91 | Edith-mounting/Competitive_programming_problems_solution | B_Bash_s_Big_Day.cpp | #include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
using namespace std;
#define ff first
#define ss second
#define int long long
#define pb push_back
#define mt make_tuple
#define pi... | ALGO | 0.999965 | 3.545943 |
53bccf80-2aa0-4d47-a23b-3194dbaea622 | Tornado025/Competitive-Programming | Codeforces/1873B_Good_Kid.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int t;cin>>t;
while(t--){
int n;cin>>n;int arr[n];
int pro=1;
for(int i=0;i<n;i++){
cin>>arr[i];
}
sort(arr,arr+n);
arr[0]++;
for(int i=0;i<n;i++)pro*=arr[i];
cout<<pro<<"\n";
... | ALGO | 0.999884 | 3.753699 |
3e3a8848-a6d1-49cd-ae8c-bf93ef89db30 | hjiang13/LLMs-in-IR | POJ-104/76/805.cpp | #include <iostream>
using namespace std;
int main(){
int n,i,min,max=0,j=1,k,t=0;
int a[10001][2];
cin >> "%d",&n);
for(i=0; i<n; i++){
cin >> "%d %d",&a[i][0],&a[i][1]);
}
min=a[0][0];
for(i=0; i<n; i++){
for(k=0; k<(n-1); k++){
if(a[k][0]>a[k+1][0]){
t=a[k][0];
a[k][0]=a[k+1][0];
a[k+1][0]=t;
}
if(a[k][1]>a[k+1][1]){... | ALGO | 0.999951 | 3.380697 |
733937c7-de69-4477-b776-b4450db4621d | ravi2320/LeetCode | Day_12_344_Reverse_String.cpp | /*
344. Reverse String
Solved
Easy
Topics
Companies
Hint
Write a function that reverses a string. The input string is given as an array of characters s.
You must do this by modifying the input array in-place with O(1) extra memory.
Example 1:
Input: s = ["h","e","l","l","o"]
Output: ["o","l","l","e","h"]
Example 2:... | ALGO | 0.999454 | 6.529493 |
3c09c9c2-e103-41e8-b373-fbacd31b7117 | neerajkumarsi20/Design---Analysis-of-Algorithms-Codes | sumofsubset.cpp | #include<iostream>
using namespace std;
void Sumofsubset(int *A,int *X,int s,int k,int r,int m){
X[k]=1;
if((s+A[k])==m){
cout<<"[";
for(int i=0;i<=k;i++){
if(X[i]==1){
cout<<A[i];
if(i!=k)cout<<",";
}
}
cout<<"]"<<endl;
}
else if(s+A[k]+A[k+1]<=m)
Sumofsubset(A,X,s+A[k],k+1,r-A[k],m);
if(... | ALGO | 0.999816 | 3.688638 |
2d3d6c51-7c53-451a-b58a-daf14bdaaf2e | ishandutta2007/codeforces | rush_d_cat/normal/1372/B.cpp | #include <bits/stdc++.h>
using namespace std;
int t, n;
int main() {
scanf("%d", &t);
while (t --) {
scanf("%d", &n);
int ans = 1e9, A, B;
for (int i = 1; i * i <= n; i ++) {
if (n % i == 0) {
{
int x = i, y = n - i;
if (x == 0 || y == 0) continue;
if (x % y == 0 || y % x == 0) {
... | ALGO | 0.999936 | 4.398809 |
2d11813e-2353-447e-bd47-e66cfb662bc8 | lucianmot/codechef-problems | C++ - Age Limit.cpp | // C++ - Age Limit
// Rating - 245
// https://www.codechef.com/submit/AGELIMIT
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while(t--) {
int x, y, a;
cin >> x >> y >> a;
if (( a >= x ) && ( a < y )) {
cout << "YES" << endl;
} else {
cout << "NO" ... | ALGO | 0.999711 | 4.038002 |
ade27dae-1fc8-42b1-bffc-7b5af95742d5 | MaTianmao/src | src/boost/libs/compute/example/opencv_histogram.cpp | //Code sample for calculating histogram using OpenCL and
//displaying image histogram in OpenCV.
#include <iostream>
#include <string>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <boost/compute/source.hpp>
#include <boost/compute/system.hpp>
#include <boost/compute/containe... | TOOL | 0.955738 | 6.709821 |
67908b81-7ad8-48a9-957e-f3f43a1ea5ff | ngthanhtrung23/CompetitiveProgramming | VNOJ/2022_olp/latsan.cpp | /**
* Repeat these steps:
* 1. Ask a random query (x, y)
* 2. Find cells that can be covered in only 1 way
* 3. Repeat 2 until no such cells
*/
#include "bits/stdc++.h"
using namespace std;
const vector<pair<int,int>> DIRS = {
{0, -1},
{0, 1},
{-1, 0},
{1, 0},
};
int main() {
ios::sync_with_s... | ALGO | 0.999364 | 3.069283 |
2bc362c6-7086-42ed-a9f7-867c10ac86fe | robodays/cpp | Skillbox/module_28_Thread/28_1_100_meter_swim/main.cpp | #include <iostream>
#include <vector>
#include <thread>
#include <mutex>
#include <string>
std::mutex update;
class Swimmer {
std::string name;
int speed;
int distance = 0;
int resultSec = 0;
public:
Swimmer(std::string inName, int inSpeed): name(std::move(inName)), speed(inSpeed) {
}
std... | ALGO | 0.986575 | 4.549063 |
3ffd7d3c-6619-43e9-b4e2-3535625ae9f2 | tridibsamanta/Hackerrank | Designer_PDF_Viewer.cpp | /**
* Title : Designer_PDF_Viewer.cpp
* Author : Tridib Samanta
* Created : 28-01-2020
* Link : https://www.hackerrank.com/challenges/designer-pdf-viewer/problem
**/
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cstdlib>
#include <map>
#include <iostream>
#include <vector... | ALGO | 0.999291 | 4.012796 |
8d215357-1898-4ee8-98ce-849613ceed52 | kimdanang7131/DN_Coding | 프로그래머스/unrated/181858. 무작위로 K개의 수 뽑기/무작위로 K개의 수 뽑기.cpp | #include <string>
#include <vector>
#include <iostream>
using namespace std;
vector<int> solution(vector<int> arr, int k) {
vector<int> answer;
answer.push_back(arr[0]);
for(int i=1; i<arr.size(); i++)
{
bool chk = false;
for(int j=0; j < answer.size(); j++)
{
... | ALGO | 0.999941 | 4.817439 |
1e732695-516e-422f-9e14-1eef5be4e914 | davidcepeda1/ESPE14542-ESTRUCTURADEDATOS | Primer Parcial/Ejercicios/JUNIO/32.JUEVES_20/EJ1/main.cpp | #include <iostream>
#include <functional>
using namespace std;
template<typename T>
struct Nodo {
T dato;
Nodo* siguiente;
};
template<typename T>
class Pila {
private:
Nodo<T>* cima;
public:
Pila() : cima(nullptr) {}
~Pila() {
while (!estaVacia()) {
desapilar();
}
... | TOOL | 0.998852 | 5.554292 |
55a32ac1-7b3d-478b-abc4-33511f05eecb | maxpricop/max_programare_ceiti | programareStructurata/studiuIndividual/studiul2/cod/exercitiul3.cpp | #include <iostream>
using namespace std;
/*Eu sunt numarul 26 in catalog, fac exercitiul 26
Se consideră şirul de caractere S.
Să se compună un program care transformă literele mici în literele respective mari.*/
int main() {
// Declararea variabilei ce va avea lungimea s[];
unsigned lungime;
// Introdue... | ALGO | 0.972569 | 5.058548 |
40c0c39d-020b-4cc8-8993-4cdca98978bd | kobe24o/LeetCode | algorithm/leetcode5474.cpp |
class Solution {
int ans = 0;
public:
int countPairs(TreeNode* root, int distance) {
dfs(root, distance);
return ans;
}
vector<int> dfs(TreeNode* root, int distance)
{
if(!root) return {};
auto l = dfs(root->left,distance);
auto r = dfs(root->right,distance)... | ALGO | 0.999955 | 6.277605 |
5f96bc09-6499-4975-be18-258d55cba505 | jrevote/3DA-3DVisualizer | 1.11/Concrete/Noise.cpp | ***********************************************************************
Noise - Class for Perlin noise arrays with spline evaluation.
Copyright (c) 2000-2007 Oliver Kreylos
This file is part of the 3D Data Visualizer (Visualizer).
The 3D Data Visualizer is free software; you can redistribute it and/or
modify it under... | ALGO | 0.990669 | 6.532806 |
756fabb1-ca4c-4f98-a236-06c3b4005c63 | huanmaiw/ShopMeow | 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 |
56f37f45-478a-4472-8a67-532d6dba1cd9 | ShuyiLU/leetcode | leetcode-algorithms/046. Permutation/46. Permutations.cpp | #include<iostream>
#include<vector>
#include<cstring>
using namespace std;
class Solution {
public:
vector<vector<int> > permute(vector<int>& nums) {
int n = nums.size();
if(n==0) return vector<vector<int> > {};
vector< vector<int> > res;
// vector<int> tmp(n, 0);
backtrack(num... | ALGO | 0.99999 | 4.407985 |
f528cad8-2145-4db7-8ec7-06e749ee1b68 | Amber-MD/cpptraj | src/Cluster/Algorithm_DBscan.cpp | #include <limits> // double max
#include <algorithm> // sort
#include "Algorithm_DBscan.h"
#include "Cframes.h"
#include "List.h"
#include "MetricArray.h"
#include "Node.h"
#include "../CpptrajStdio.h"
#include "../ArgList.h"
#include "../ProgressBar.h"
#include "../StringRoutines.h" // integerToString
#ifdef _OPENMP
... | ALGO | 0.998634 | 3.438202 |
ba6b781d-4a52-4a4d-898b-389690e95db1 | satyam-software-developer/DSA-in-CPP | introduction to c++/Strings/string_palindrome.cpp |
/*
Problem statement
Given a string, determine if it is a palindrome, considering only alphanumeric characters.
Palindrome
A palindrome is a word, number, phrase, or other sequences of characters which read the same backwards and forwards.
Example:
If the input string happens to be, "malayalam" then as we see that th... | ALGO | 0.999879 | 6.524493 |
920a20f9-b59d-4f84-96f5-7dac3ee38cd7 | AnshT013/50Days-Coding-Challenge | BuyAndSellStocks_Day19.cpp | #include <iostream>
#include <vector>
using namespace std;
int maxProfit(vector<int>& prices) {
int minPrice = prices[0], maxProfit = 0;
for (int i = 1; i < prices.size(); i++) {
if (prices[i] < minPrice) minPrice = prices[i];
else maxProfit = max(maxProfit, prices[i] - minPrice);
}
ret... | ALGO | 0.999319 | 6.213392 |
4a3dc3c0-f858-4039-a65f-28cd30e07480 | UtaWashu/6Ned | 412/412.cpp | class Solution {
public:
vector<string> fizzBuzz(int n) {
vector<string> answer;
for (int i = 1; i <= n; i++) {
if (i % 3 == 0 && i % 5 == 0) {
answer.push_back("FizzBuzz");
} else if (i % 3 == 0) {
answer.push_back("Fizz");
} else i... | ALGO | 0.999936 | 6.891283 |
c52a9a48-8ec5-4bd9-a1df-8c7802283145 | jizhuoran/EasyFHE | aten/src/ATen/native/cpu/HistogramKernel.cpp | #define TORCH_ASSERT_ONLY_METHOD_OPERATORS
#include <ATen/native/Histogram.h>
#include <ATen/core/Tensor.h>
#include <ATen/Dispatch.h>
#include <ATen/Parallel.h>
#include <c10/util/irange.h>
#ifndef AT_PER_OPERATOR_HEADERS
#include <ATen/Functions.h>
#include <ATen/NativeFunctions.h>
#else
#include <ATen/ops/aminmax.... | ALGO | 0.99791 | 6.387787 |
e5a9a4ff-2884-458a-850f-5da93eebf021 | csh1668/ProblemSolving | ps_cpp/solved_baekjoon/5916_농장 관리.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int SZ = 100'100, SGSZ = 1 << (33 - __builtin_clz(SZ));
struct node {
ll v, lazy;
node(ll v = 0) : v(v) {}
};
struct HLD_LazySegTree {
/*
HLD
sz[i] = i를 루트로 하는 서브 트리의 크기
dep[i] = i의 깊이
par[i] = i의 부모 노드
top... | ALGO | 0.999841 | 4.848796 |
867fcc7c-1ad6-4d07-853a-85f4192a4e70 | xianlihua/dsalgo | c++/bailian/2679.cpp | /**
* 2679:整数的立方和
* http://bailian.openjudge.cn/practice/2679/
*/
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
short k;
int m = 0;
cin >> k;
for (short i = 1; i <= k; i++) {
m += i * i * i;
}
cout << m;
return 0;
}
| ALGO | 0.999807 | 4.201619 |
e7967e27-024a-49ce-add9-c081252fe9ef | IronDumpling/computer-graphics-algos | kinematics-a/src/forward_kinematics.cpp | #include "forward_kinematics.h"
#include "euler_angles_to_transform.h"
#include <functional>
void forward_kinematics(const Skeleton & skeleton,
std::vector<Eigen::Affine3d,Eigen::aligned_allocator<Eigen::Affine3d>> & T)
{
///////////////////////////////////////////////////////////////////////... | ALGO | 0.99132 | 6.038835 |
12f2f9cb-a201-4eaa-8e72-4f05f061980f | Brightlpf/MY-LEARN | cpp/C++PrimerPlus/funtemp.cpp | #include <iostream>
using namespace std;
template <typename T>
void Swap(T & a, T & b);
int main()
{
int i = 10;
int j = 20;
double d1 = 12.6;
double d2 = 42.8;
cout << "i , j = " << i << ", " << j << endl;
cout << "d1 , d2 = " << d1 << ", " << d2 << endl;
Swap(i, j);
Swap(d1, d2);
cout << "After swap: \... | ALGO | 0.995902 | 5.46595 |
c25f8562-e15c-404c-9517-40163cc48e26 | AnasAbdullh/Programming-Using-Cplusplus-Level-2 | References/ Call_ByRef.cpp | #include <iostream>
using namespace std;
void Function1(int &x)
{
x++;
}
int main()
{
int a = 10;
Function1(a);
cout << "\n a after calling function1 = " << a << endl;
return 0;
} | TOOL | 0.914338 | 3.929204 |
aab902aa-a10d-4b98-ab11-452b100900f6 | ishandutta2007/codeforces | oleh1421/normal/1360/D.cpp | //#pragma GCC optimize("O2")
//#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
typedef long long ll;
#define endl '\n'
using namespace std;
const int N=200010;
int a[N];
void solve(){
vector<int>d;
int n,k;cin>>n>>k;
for (int i=1;i*i<=n;i++){
if (n%i) continue;
d.push_back(i);
... | ALGO | 0.999871 | 4.150246 |
42c4a752-385e-4e8d-8a8c-5859f1880b7a | liwei2088/oi | 牛客网/02数据结构/02并查集/NC15121.cpp | #include <iostream>
using namespace std;
int n, m;
int p[55];
int find(int x) {
if (p[x] != x) p[x] = find(p[x]);
return p[x];
}
int main() {
int x, y, px, py;
while (cin >> n >> m) {
for (int i = 1; i <= n; i++) p[i] = i;
while (m--) {
cin >> x >> y;
if (x == n... | ALGO | 0.999986 | 4.509517 |
e2d9d112-71d3-4a7a-ac44-fdd41b4f7c93 | shchae7/baekjoon_sol | 구현/8958.cpp | /*
OX퀴즈
알고리즘 분류: 구현, 문자열
*/
#include <iostream>
#include <string>
using namespace std;
int quiz_score(string result)
{
int cont_os(0), score(0);
for(int i = 0; i < result.length(); i++)
{
if(result[i] == 'O')
{
score += (1 + cont_os);
cont_os += 1;
}
... | ALGO | 0.999236 | 5.311074 |
0289d106-11bb-4c7e-a868-fbd5f2229e4b | linson7017/MIPF | Plugins/Mipf_Plugin_Simulation/DER/libs/dlib-18.9/examples/parallel_for_ex.cpp | /*
This is an example illustrating the use of the parallel for loop tools from the dlib
C++ Library.
Normally, a for loop executes the body of the loop in a serial manner. This means
that, for example, if it takes 1 second to execute the body of the loop and the body
needs to execute 10 times the... | ALGO | 0.85822 | 5.92785 |
25f5384d-34f7-43ed-828e-029d46132f60 | hardiktreats/Competetive-Coding | Maximum path sum from any node - GFG/maximum-path-sum-from-any-node.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// Tree Node
struct Node {
int data;
Node *left;
Node *right;
Node(int val) {
data = val;
left = right = NULL;
}
};
// Function to Build Tree
Node *buildTree(string str) {
// Corner Case
if (str.length() ... | ALGO | 0.999787 | 7.161757 |
03573b02-aede-46ea-9596-fbd3bc00cf38 | bonawoo/Kwak_Practice | codeup_100/1072_23992986(AC).cpp | #include <iostream>
using namespace std;
int main(){
int n;
cin >> n;
int m[n];
for(int i=0; i<n;i++){
cin >> m[i];
}
for(int i=0; i<n;i++){
cout << m[i] << endl;
}
return 0;
}
| ALGO | 0.998585 | 3.089468 |
43c518d2-9e25-44fe-aeb2-8e2ef8fcd2f2 | jmanday/Master | TFM/library/boost_1_63_0/libs/graph/example/cycle-file-dep.cpp | using namespace boost;
namespace std
{
template < typename T >
std::istream & operator >> (std::istream & in, std::pair < T, T > &p)
{
in >> p.first >> p.second;
return in;
}
}
typedef adjacency_list < listS, // Store out-edges of each vertex in a std::list
vecS, // Store v... | ALGO | 0.999071 | 6.032049 |
7d994c4b-c159-4427-a9bb-76e60e14f717 | miharu1414/Atcoder | AtCoder/ABC/ABC215/b.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using pll = pair<long long,long long>;
using vec = vector<int>;
using vecll = vector<long long>;
using mat = vector<vector<int>>;
using matll = vector<vector<long long>>;
#define rep(i, n) for(int i = 0; i < (int)(n); i... | ALGO | 0.999949 | 4.859608 |
254af749-a11b-4db0-bace-142fa50605b7 | Aqib8/zcoin | src/bitcoinrpc.cpp | #include "init.h"
#include "util.h"
#include "sync.h"
#include "ui_interface.h"
#include "base58.h"
#include "bitcoinrpc.h"
#include "db.h"
#include <boost/asio.hpp>
#include <boost/asio/ip/v6_only.hpp>
#include <boost/bind.hpp>
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
#include <boost/iostreams/con... | WEB | 0.955406 | 3.802545 |
8156e244-bbd1-4bf4-b8bd-176ffcb3d933 | melalonso/CompetitiveProgramming | Codeforces/Codeforces_Problem B. Travelling Camera Problem/main.cpp | #include <bits/stdc++.h>
#define MAXN 300005
using namespace std;
// ACC
double cameras[MAXN];
int m, n;
double answer, pos, curr, r;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> m >> n >> r;
//scanf("%d %d %lf", &m, &n, &r);
cin >> curr;
//scanf("%lf", &curr);
cameras[... | ALGO | 0.999923 | 3.859801 |
94daf53b-5cc5-4d04-9eef-b8017e123f03 | amikey/sumatrapdf | src/tools/signfile.cpp | // signfile produces a cryptographic signature of a given file
// using a (self-signed) certificate from the local store.
// The idea is that an application ships using the certificate's public key
// and is then able to verify whether external data (e.g. an update downloaded
// over a non-secure channel) is from the ... | TOOL | 0.861514 | 5.860261 |
16d4a0be-86f8-4fa9-bb02-064796fc9b3b | FellipeV540/estruturaDeDados-POO | beecrowd/1019/1019.cpp | #include <iostream>
using namespace std;
int main() {
int total_seconds;
cin >> total_seconds;
int hours = total_seconds / 3600;
int minutes = (total_seconds % 3600) / 60;
int seconds = total_seconds % 60;
cout << hours << ":" << minutes << ":" << seconds << endl;
return 0;
}
| ALGO | 0.882942 | 5.333984 |
e9ac77a4-6084-4c00-bbb7-0c39b3223ebb | fanju1984/introduction-to-programming | introduction-to-programming/code/lcm.cpp | #include<iostream>
using namespace std;
int main(){
int x=0, y=0, z=0, w=0; // 整型变量
cout << "请输入两个整数,用空格隔开:"; // 提示信息
cin >> x >> y;
if ( x < y ) { // 让 x 表示两者中的大数
w = x; x = y; y = w;
}
z = x; // 将一个大数赋给 z
while ( z % y != 0 ) // 当z不能被y整除时,让z累加x
z = z... | ALGO | 0.999574 | 3.423115 |
3b5dbfb9-ba46-44e2-bde7-3c5e9cb69ab9 | HwH-qwq/State-Try-Out-2022 | [前期 1] 线段树平衡树/P1471方差.cpp | #include<bits/stdc++.h>
using namespace std;
/*
sigma (a[i]-(a-increase))^2 //Ƶ̣еincrease е decrease
sigma (a[i]-a+increase)^2
sigma (a[i]-a)^2+increase^2+2*(a[i]-a)*increase
fang*len+ sigma increase^2+2*a[i]*increase-2*a*increase
fang*len+2*sum*increase+len*increase^2 -2*a*len*increase
*/
typedef double ld;
const i... | ALGO | 0.999942 | 4.499942 |
769ac260-39b8-4ef3-a6c2-15c6bd65b04d | zhuminjie/OpenSeesPy | SRC/analysis/integrator/HHTHSIncrReduct.cpp | // $Revision$
// $Date$
// $URL$
// Written: Andreas Schellenberg (<EMAIL>)
// Created: 10/05
// Revision: A
//
// Description: This file contains the implementation of the HHTHSIncrReduct class.
#include <HHTHSIncrReduct.h>
#include <FE_Element.h>
#include <FE_EleIter.h>
#include <LinearSOE.h>
#include <AnalysisMode... | ALGO | 0.965905 | 5.634972 |
33639680-ece1-4867-a589-1363f302ef97 | ELO-Lab/SAAS-HC | src/ls.cpp | #include <stdio.h>
#include <assert.h>
#include <stdlib.h>
#include <limits.h>
#include "ls.h"
#include "inout.h"
#include "thop.h"
#include "ants.h"
#include "utilities.h"
#include "algo_config.h"
long int ls_flag; /* indicates whether and which local search is used */
long int nn_ls; /* maximal de... | ALGO | 0.999957 | 4.738593 |
f0a918dd-9ee6-47ec-b58f-44559b291d61 | SalvatorePiccolo/RL24_Homework3 | ros2_vision/aruco_ros/aruco/src/aruco/fractallabelers/fractalmarker.cpp | #include "fractallabelers/fractalmarker.h"
#include <bitset>
namespace aruco
{
FractalMarker::FractalMarker()
{
}
FractalMarker::FractalMarker(int id, cv::Mat m, std::vector<cv::Point3f> corners,
std::vector<int> id_submarkers)
{
this->id = id;
this->_M = m;
for (auto p : corners)
... | ALGO | 0.971991 | 5.428104 |
7f785a11-f1cc-42b7-adc7-924ae9e76829 | MaksKalinichenko/lab11_kalinichenkoIKM724a | Індивідуальне завдання 3/Індивідуальне завдання 3.cpp | // Завдання 3
#include <iostream>
#include <cmath>
#include <windows.h>
using namespace std;
int main() {
setlocale(LC_CTYPE, "ukr");
SetConsoleOutputCP(65001);
int n = 7;
int* a = new int[n] {12, 30, 45, 30, 60, 30, 90};
int set = 25;
int lastIndex = -1;
for (int i = 0; i < n; i++) {
... | ALGO | 0.999457 | 3.236399 |
9676ecb1-93b6-40a5-a84c-c89121460670 | Divyanshu9794/GFG_POTD | Medium/Check if frequencies can be equal/check-if-frequencies-can-be-equal.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
bool sameFreq(string s)
{
int arr[26];
memset(arr,0,sizeof(arr));
set<char> st;
int maxFreq = INT_MIN;
for(char c : s){
arr[c-'a']++;
... | ALGO | 0.999745 | 5.648496 |
6e84ef67-576a-4f16-8959-d5cab0b06fe4 | LinPP0000/2023aaia3 | week13/week13-2.cpp | #include <iostream>
using namespace std;
int main()
{
int a,b;
while(cin >> a >> b && a!=0 && b!=0)
{
int temp=0;
int count=0;
while(a>0 || b>0)
{
if(a%10+b%10+temp>9)
{
temp=1;
a/=10; b/=10;
count++;
}
else
{
temp=0;
a/=10; b/=10;
}
}
if(count==1) cout << "1 carry o... | ALGO | 0.999874 | 3.528902 |
82c45f5f-46b1-455f-9f96-2ac53511c8f0 | tmyksj/atcoder | AtCoder Beginner Contest 115/B - Christmas Eve Eve/main.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int sum = 0, max = 0;
for (int i = 0; i < n; i++) {
int p;
cin >> p;
if (max < p) {
sum += max;
max = p;
} else {
sum += p;
}
}
sum += max / 2;
... | ALGO | 0.999848 | 4.15483 |
ad5e76a3-1505-4169-b1e8-17804bff1323 | Bhagatsakshi/Swapping_methods | call_by_reference.cpp | //values are pass by reference i.e.a method of passing the address of an argument in the calling function to a corresponding parameter in the called function
#include<iostream>
using namespace std;
void swap(int *value1,int *value2) //value of a is in value1 and value of b is in value2;
{
int temp; ... | ALGO | 0.999624 | 4.65148 |
b1002b28-fb4e-4159-bb8f-592aeda55775 | arrows-1011/CPro | AOJ/Volume02/0238.cpp | #include <iostream>
using namespace std;
int main()
{
int t, n, s, f, total;
while (cin >> t, t) {
total = 0;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> s >> f;
total += f - s;
}
if (total >= t) {
cout << "OK" << endl;
... | ALGO | 0.999478 | 4.331162 |
ae2a5cf8-9454-4ac4-9700-42b7609f4044 | Ayush-Balodi/CrackYourInternship | remove-linkedlist-elements.cpp | /*
https://github.com/Ayush-Balodi/CrackYourInternship.git
https://leetcode.com/problems/remove-linked-list-elements
TC = O(n) + O(n) = O(n) O(n) comes from first while loop as [7,7,7,7] where it can max go upto whole length
SC = O(1) as minimal extra space is used
*/
class Solution {
public:
List... | ALGO | 0.999729 | 5.997776 |
cd0db39a-5740-4882-a0d0-68b8f9737485 | Samir-Sadaf25/CSE-Fundamentals-with-Phitron | Algorithm/Week - 4 (Graph Recap)/M - 13 (Graph Convertions For Online Judge)/adjList_to_edgeList.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, e;
cin >> n >> e;
vector<pair<int, int>> adj[n];
vector<pair<int, pair<int, int>>> edgeList;
while (e--)
{
int a, b, c;
cin >> a >> b >> c;
adj[a].push_back({b, c});
}
for (int i = 0; i < n; i++)
... | ALGO | 0.999961 | 3.452396 |
652094d5-f8b6-4094-ba7c-c4d5709a64e4 | huangwei4478/algorithm-playground | VS2019/leetcode_template/leetcode_template.cpp | // leetcode_template.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//
#include <iostream>
#include <string>
using namespace std;
class Solution_find_difference {
public:
char findTheDifference(string s, string t) {
char ret = 0;
for (auto ch : s + t) {
ret ^= ch;
}
return re... | ALGO | 0.999236 | 6.158769 |
817696c8-4267-4923-b2fa-087904034805 | spsujoy007/Phitron-CPP | Semister 1/C++ Modules/Practice 1 second week/A_Lucky.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
for (int testc = 0; testc < n; testc++)
{
string t;
cin >> t;
int first = t[0] + t[1] + t[2];
int second = t[3] + t[4] + t[5];
if (first == second)
{
cout << "YES";
... | ALGO | 0.999938 | 4.459324 |
158fa87e-3ac9-4a43-813a-acff91cd4cec | JotaJrJr/game_2042 | 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 |
639e4c2d-503d-4fbd-ac9a-0947ab5f626e | ishandutta2007/codeforces | summitwei/normal/983/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;
typedef vector<pair<int, int> > vpii;
typedef pair<int, int> pii;
typedef long long ll;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
typedef vector<ll> vll;
#define INF 0x3f3f3f3f
#define MOD 1000000007LL
#define EPSILON 0.00001
#defin... | ALGO | 0.999787 | 3.434319 |
5b3ee1e0-0ff9-4cca-99f0-38bba12e78b9 | marmik599/Leetcode | Perfect Sum Problem - GFG/perfect-sum-problem.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
int m=1e9+7;
int perfect(int arr[],int n,int sum,vector<vector<int>>&dp){
if(n==0){
// if(sum==arr[0])return 1;
if(sum==0&&arr[0]==0)return 2;
if(sum==0||arr[0]==sum)return... | ALGO | 0.999814 | 5.597075 |
d58ae63e-1a4a-4d33-9eb8-ebbc6ded6d71 | JamesDong621/hw4 | equal-paths.cpp | #ifndef RECCHECK
//if you want to add any #includes like <iostream> you must do them here (before the next endif)
#include <utility>
#include <algorithm>
#endif
#include "equal-paths.h"
using namespace std;
// Helper function to check if all paths are of equal length
std::pair<bool, int> checkEqualPaths(Node *node) ... | ALGO | 0.999804 | 5.699998 |
0630481b-4733-4979-acce-f8c7fb75827c | longaadream/OI | 省选后做题集合/Atcoder/dp/s.cpp | #include<bits/stdc++.h>
#define endl '\n'
// #define int long long
using i64=long long;
using u64=unsigned long long;
using u32=unsigned int;
using pii=std::pair<int,int>;
//using i128=__int128;
bool Mbe;
const int N = 1e4 + 5, mod = 1e9 + 7;
char s[N];
i64 dp[N][105][2];
int n, k, ori[N];
bool Med;
template<class T>in... | ALGO | 0.999971 | 4.683975 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.