uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
ede3f174-647c-4635-b39c-1e50b5073416 | benjamindelasoie/so-tp3-ghost | applications/core/src-reverse/reverse.cpp | #include <stdio.h>
#include <string.h>
#include <iostream>
#include <ghost.h>
/**
*
*/
int main(int argc, char** argv) {
for (std::string line; std::getline(std::cin, line);) {
size_t linelen = line.length();
char* rev = new char[linelen + 1];
for (int i = 0; i < linelen; i++) {
rev[i] = line[linelen - i ... | TOOL | 0.963529 | 3.332547 |
1bd88507-5dfa-4f45-bae2-1736e9dd72fb | HitarthThakkar/LeetCode-Submissions | 0766-flatten-a-multilevel-doubly-linked-list/0766-flatten-a-multilevel-doubly-linked-list.cpp | class Solution
{
public:
Node* resolveChildIssues(Node* node)
{
if(!node->child) return node;
Node* flattenedBoy = flatten(node->child);
node->next = flattenedBoy;
flattenedBoy->prev = node;
node->child = NULL;
while(node->next != NULL) node = node->next;
... | ALGO | 0.999815 | 5.473181 |
4eb9e8e0-fe9e-4e8b-9176-5171a0133010 | MartHage/AoC23 | Day 17/part12.cpp | #include "util.hpp"
#define H 0
#define V 1
struct Node
{
int d;
int h;
int x, y;
int sD;
};
void pr(Node no)
{
cout << "(" << no.x << ", " << no.y << ") "
<< " D:" << no.sD << " ";
}
int h(vector<vector<int>> grid, int x, int y)
{
return grid.size() - y + grid[0].size() - x - 2;
}... | ALGO | 0.999645 | 3.763765 |
8c97a388-abc3-4eb3-b4c5-8334370335e5 | austin880625/problem_solving | Uva/1252.cpp | #include <iostream>
#include <stdio.h>
#include <string.h>
#define MAXN 140
#define MAXM 13
#define INF 0x3f3f3f3f
using namespace std;
int N,M;
int dp[1<<MAXM][1<<MAXM];
char s[MAXM];
int val[MAXN];
void print(int x)
{
for(int i=0;i<M;i++)
{
printf("%d",(x>>(M-i-1))&1);
}
puts("");
}
int DP(in... | ALGO | 0.999887 | 3.90849 |
87c36457-83ea-468c-9476-a1bb648b7773 | stellaraccident/iree-forge | trees/llvm-project/lldb/source/Host/windows/Windows.cpp | // This file provides Windows support functions
#include "lldb/Host/PosixApi.h"
#include "lldb/Host/windows/windows.h"
#include "llvm/Support/ConvertUTF.h"
#include <cassert>
#include <cctype>
#include <cerrno>
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <io.h>
int vasprintf(... | TOOL | 0.851495 | 6.17414 |
5c177417-4849-42a1-8b94-f25a53e57cd3 | habiburrahmantalha/UVA-online-Judge | 10893_Creating_Sudoku_puzzles_vector.cpp | #include<stdio.h>
#include<string.h>
#include<math.h>
#include<vector>
using namespace std;
#define N 11
#define V2 vector<vector<int> >
int n,m,cnt,Count;
int column[N][N],row[N][N],squre[N][N][N];
int new_column[N][N],new_row[N][N],new_squre[N][N][N];
V2 solved;
vector<pair<int,int> >next,new_next;
int sc(int i)
{... | ALGO | 0.999515 | 3.859856 |
a941339a-3b7a-49a5-b82b-707d6a3d39c1 | LimeMun/BaekJoon | DP/LIS_Advanced_1.cpp | #include <iostream>
#include <vector>
#include <cstring>
#include <algorithm>
using namespace std;
#define forLoop(start, end) for(int i = start; i < end; i++)
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
// 변수 선언 및 초기화
int input;
int cache[100];
vector<pair <int, int>> inputLine;
//입력 받기
cin >... | ALGO | 0.999886 | 3.76672 |
e30ba78e-cbc1-4f09-8935-1e9fc68e918e | Noor-Nasri/daily-leetcode | 2299-merge-nodes-in-between-zeros/merge-nodes-in-between-zeros.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* mergeNodes(... | ALGO | 0.999949 | 5.507476 |
f062124f-23da-48b3-a607-4da3f7988387 | bsarvan/code_algorithms | TreeDeleteNodeReturnForest.cpp | #include <iostream>
#include <unordered_set>
using namespace std;
//Definition for a binary tree node.
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
TreeNode* helper(TreeNode* root, std::unorde... | ALGO | 0.99996 | 6.704754 |
d74ffd1d-92ae-4427-af31-8dd962831917 | nyanpoleon/misc-cpp | C++ New/multidimesional array project.cpp | #include<iostream>
using namespace std;
int main()
{
int n; //to take input
int table [10][3]; //table
cout << "Input a number" << flush;
cin >> n;
// Generating output
for (int i = 0; i < 10; i++)
{
table[i][0] = i + 1;
table[i][1] = n;
table[i][2] = table[i][0] * table[i][1];
}
for (int i = 0; i... | ALGO | 0.996292 | 3.765682 |
11f25cd5-661f-41b7-b5e0-f572d2c83a64 | alwanfauzy/dicoding-bfaf | 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.99887 | 6.783439 |
f57cdaa3-6108-4503-b209-ed4fdc395f8e | yryrrf/LeetCode | Problems/C++/Medium/String/8. String to Integer (atoi).cpp | /*
Runtime: 0 ms, faster than 100.00% of C++ online submissions for String to Integer (atoi).
Memory Usage: 7 MB, less than 51.54% of C++ online submissions for String to Integer (atoi).
*/
class Solution {
public:
int myAtoi(string s) {
int i = 0;
int ans = 0;
int N = false;
while(s... | ALGO | 0.998635 | 5.005455 |
a8b83add-dff8-4b3f-849f-cfb5486cf869 | nhu220840/C-plus-Tutorial | String/Trung binh/SoDep3.cpp | #include <bits/stdc++.h>
using namespace std;
bool increase(string s){
for(int i = 1; i < s.length(); i++){
if(s[i] < s[i - 1])
return false;
}
return true;
}
bool decrease(string s){
for(int i = 1; i < s.length(); i++){
if(s[i] > s[i - 1])
return false;
}
... | ALGO | 0.999984 | 4.293223 |
21b55ebc-6105-4b2f-8896-17ab42d142e3 | SI-Abid/Hello-world | Codeforces/1726C.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
for (int tc = 1; tc <= t; tc++)
{
// printf("Case %d: ",tc);
int n;
cin >> n;
string s;
cin >> s;
n += n;
int ans = 0;
char last = '.';
for (int i = 0; i ... | ALGO | 0.995327 | 3.4284 |
9bed4e2a-9eca-46d3-ac41-c0adab9dd9b0 | DWWC-22BCSKPIT-901/day-3-assignment-greepix | day3ques4.cpp | #include <iostream>
using namespace std;
bool isPowerOfThree(int n) {
if (n <= 0) return false;
while (n % 3 == 0) {
n /= 3;
}
return n == 1;
}
int main() {
int n;
cout << "Enter an integer: ";
cin >> n;
if (isPowerOfThree(n)) {
cout << n << " is a power of three." <<... | ALGO | 0.999396 | 5.955404 |
7bd2a3df-4194-4b82-89b8-7bb69a69e39b | NilFoundation/zkllvm-circifier | libcxx/test/std/algorithms/alg.sorting/alg.min.max/max.pass.cpp | // <algorithm>
// template<LessThanComparable T>
// const T&
// max(const T& a, const T& b);
#include <algorithm>
#include <cassert>
#include "test_macros.h"
template <class T>
void
test(const T& a, const T& b, const T& x)
{
assert(&std::max(a, b) == &x);
}
int main(int, char**)
{
{
int x = 0;
... | TEST | 0.923127 | 5.800577 |
d9ba2489-9c9e-42eb-969f-3cd502b8731d | maxnelso/algorithms_competitions | codeforces/problem_set/771B.cpp | #include <bitset>
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cm... | ALGO | 0.999935 | 3.131641 |
a6078b80-015a-47c7-99fc-d1258069c61f | timofeybrat/cpp-intro | copy-dynamic-array.cpp | void fillArray(int* const arr, const int size)
{
for (int i = 0; i < size; i++)
{
arr[i] = rand() % 20;
}
}
int main()
{
setlocale(LC_ALL, "ru");
srand(time(0));
int size = 10;
int* arr = new int[size];
int* newArr = new int[size];
fillArray(newArr, size);
delete[] newArr;
newArr = new int[size];
fo... | TOOL | 0.960499 | 3.46592 |
69882e6b-ff22-42a6-8563-61820645db55 | Suryansh555/CPP | LittlePonnyExtraQuestion.cpp | #include<bits/stdc++.h>
using namespace std;
vector<int> solve(vector<int> &A) {
vector<int> ans ;
int size = A.size();
int min = INT_MAX ;
for(int i = 0 ; i < size ; i++)
if(A[i] < min)
min = A[i];
int count = 0 ;
for(int i = 0 ; i < size ; i++)
if(A[i] == min)
... | ALGO | 0.999744 | 3.92653 |
a79f70fd-1e16-45b1-ba33-2a11777acfd1 | dmlary/godot-hex-map | src/core/iter_axial.cpp | #include "iter_axial.h"
#include "cell_id.h"
void HexMapIterAxial::advance() {
if (cell.r < r_max) {
cell.r++;
} else if (cell.q < q_max) {
cell.r = r_min;
cell.q++;
} else if (cell.y < y_max) {
cell.r = r_min;
cell.q = q_min;
cell.y++;
} else {
c... | ALGO | 0.880215 | 6.47804 |
07c48b49-a443-40f4-9cae-2718f3889433 | saymi313/Data-Structures-Project-Cpp | Graph_p2_lib.cpp | #include "Graph_p2_lib.h"
#include <iostream>
#include <cstring>
using namespace std;
Distance distances[50] = { nullptr };
Queue::Queue() {
Front = NULL;
rear = NULL;
counter = 0;
}
void Queue::insertQueue(char data) {
Qnode* newnode = new Qnode;
newnode->data = data;
if (empty()) {
... | ALGO | 0.999928 | 3.94767 |
f38e8fc5-5618-44f1-acf8-ac17f8989487 | Sahil-Badkul/leetcode | 127-word-ladder/127-word-ladder.cpp | class Solution {
public:
int ladderLength(string beginWord, string endWord, vector<string>& wordList) {
unordered_set<string> list(wordList.begin(), wordList.end()); // to make search in O(1);
queue<pair<string,int>> q;
q.push({beginWord,1});
while(!q.empty()){
string str... | ALGO | 0.999985 | 5.764367 |
6f0520e7-ab71-4390-906a-b18c15815939 | ajaxlt/OnlineProgram | LeetCode:cpp/0230. 二叉搜索树中第K小的元素.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;
/*
* 来源: LeetCode
* 题目: 二叉搜索树中第K小的元素(Kth Smallest Element in a BST)
*
* 描述:
* 给定一个二叉搜索树,编写一个函数 kthSmallest 来查找其中第 k 个最小的元素
*
* 思路:
* 简单题
*/
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
... | ALGO | 0.999991 | 5.975452 |
68ef7c0e-63c4-41ad-8aad-cc19d3cb9471 | sourabhossain/codeforces | A/992.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int T, n;
set <int> s;
scanf("%d", &T);
while(T--) {
scanf("%d", &n);
if(n != 0) {
s.insert(n);
}
}
printf("%d\n", s.size());
return 0;
} | ALGO | 0.997895 | 4.820365 |
f40d0d4d-979d-4ac4-9df5-ee22a212e2d3 | gy1016/cpp-primer | chapter1/1_11.cpp | #include <iostream>
int main()
{
std::cout << "Enter two number: " << std::endl;
int a = 0, b = 0;
std::cin >> a >> b;
int tag = a > b ? b : a;
int max = a + b - tag;
while(tag <= max)
{
std::cout << tag++ << std::endl;
}
return 0;
}
| ALGO | 0.999618 | 3.924403 |
10278bba-49e7-4b89-8f5f-2718db843c65 | seojmm/bbb_algostd | group#1/8주차-안전영역.cpp | #include <iostream>
#include <queue>
#include <cstring>
using namespace std;
int N, a, ans, tmp = 0;
int graph[101][101];
int visited[101][101];
int dx[4] = {-1, 0, 1, 0};
int dy[4] = {0, 1, 0, -1};
int main(){
// input
scanf("%d", &N);
for(int i=0; i<N; i++){
for(int j=0; j<N; j++){
s... | ALGO | 0.999738 | 4.2323 |
c10fb384-d647-484f-a66e-bc8ac01d2812 | flaviu2001/High-School-Small-Projects | ONI/ONI 2017/Probleme Rezolvate/Dinamica/echilibru.cpp | #include <fstream>
#include <vector>
using namespace std;
vector<int> v1, v2, s1, s2;
int n, m;
bool r1[50005], r2[50005];
void read();
void sum(bool [], vector<int>, vector<int>&);
int sums();
void write();
int main()
{
read();
sum(r1, v1, s1);
sum(r2, v2, s2);
write();
return 0;
}
void read()... | ALGO | 0.999918 | 3.218815 |
97ab9a0f-32c4-4023-9111-5c5431caa9d9 | geetsonawane/C- | Chapter 4 - Polymorphism/Compile Time Polymorphism/Function Overloading/sum4.cpp | #include<iostream>
using namespace std;
int sum(int x,int y)
{
return x+y;
}
float sum(float x,float y)
{
return x+y;
}
float sum(float x,int y)
{
return x+y;
}
int main()
{
int a;
float b;
a=sum(10,20);
cout<<"\n\n Sum of Two integers "<<a;
b=sum(20.0F,40.0F);
cout<<"\n\n Sum of Two floats "<<b;
b=su... | ALGO | 0.960801 | 4.387501 |
80e5d8c6-a4f4-4d8f-ac7b-87da902f858f | filipeabelha/gym-solutions | uva/12911.cpp | #include <bits/stdc++.h>
using namespace std;
#define st first
#define nd second
#define mp make_pair
#define pb push_back
#define cl(x, v) memset((x), (v), sizeof(x))
#define db(x) cerr << #x << " == " << x << endl
#define dbs(x) cerr << x << endl
#define _ << ", " <<
typedef long long ll;
typedef long double ld;
ty... | ALGO | 0.999955 | 4.673703 |
5cbe0533-bf41-421d-a894-78db4b89189a | AamirSohail07000/MUJ_Practical | DSA/searching_&_sorting/firstcoccurance.cpp | // Given a sorted array (can have duplicate elements), find the first and last index of a given number using binary search.
#include <iostream>
using namespace std;
// Function to find the first occurrence of key
int firstOccurrence(int arr[], int n, int key) {
int low = 0, high = n - 1;
int result = -1;
... | ALGO | 0.999998 | 7.206297 |
560221ae-211a-4758-b1fc-4a8ca5d42829 | Katpa/Programmers | LV2/조이스틱/Source.cpp | #include <string>
#include <vector>
using namespace std;
int answer = 100000;
string nameStr;
void Finder(string str, int countSum, int curIndex, int moveTo, vector<pair<int, bool>> remainIndex)
{
for (auto& vec : remainIndex)
{
if (vec.first == moveTo)
{
vec.second = true;
... | ALGO | 0.999943 | 4.945195 |
be1f6c8b-1ccf-4540-859d-028e1cff252d | KDNprog/Algoritmusok_es_adatszerkezetek | 5_Tavoli_bolygo_DNS-e.cpp | #include <iostream>
#include <string>
#include <map>
using namespace std;
map<string, int> countGeneticCodes(const string& sequence, int K) {
map<string, int> freq;
for (size_t i = 0; i < sequence.size(); i += K) {
string code = sequence.substr(i, K);
freq[code]++;
}
return freq;
}
int... | ALGO | 0.999722 | 4.921503 |
776ffc08-829f-49ff-81db-3047ce5dae24 | Sahil-pillania/Data_Structures | functions/CalculateFormula.cpp | #include <iostream>
using namespace std;
int factorial(int n)
{
int factorial = 1;
for (int i = 2; i <= n; i++)
{
factorial *= i;
}
return factorial;
}
int main()
{
int n, r;
cin >> n >> r;
int result = factorial(n) / (factorial(r) * factorial(n - r));
cout << result << en... | ALGO | 0.999906 | 5.570082 |
32d986d8-5e9c-4459-9a4f-f003a1bad185 | tanvirs27/Solved_CP_Problems | Light OJ/1141 - Number Transformation/1141.cpp | #include<cstdio>
#include<sstream>
#include<cstdlib>
#include<cctype>
#include<cmath>
#include<algorithm>
#include<set>
#include<queue>
#include<stack>
#include<list>
#include<iostream>
#include<fstream>
#include<numeric>
#include<string>
#include<vector>
#include<cstring>
#include<map>
#include<iterator>
using namespa... | ALGO | 0.999805 | 4.041699 |
ef47d8dc-5f35-4413-8463-937fe9ad0d51 | suchanek-tom/microworld_td_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.998733 | 6.76775 |
102e6a4a-dfde-48ee-81bc-773bd66f40b4 | Acka1357/ProblemSolving | BeakjoonOJ/15000/15765_FamilyTree.cpp | #include <stdio.h>
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <memory.h>
using namespace std;
int par[202], chk[202][2], cnt;
string A, B, name[202];
map<string, int> mp;
void set_chk(int cur, int dist, int idx){
chk[cur][idx] = dist;
if(par[cur] >= 0) set_chk(par[cur], dist + 1... | ALGO | 0.999954 | 4.021205 |
64eab889-d2a9-4d98-97e2-a7dcfd49b26e | Livinfly/AlgorithmPromble_Code | AtCoder/2023/abc043/c.cpp | #pragma GCC optimize(2)
#include <bits/stdc++.h>
#define fi first
#define se second
#define mkp(x, y) make_pair((x), (y))
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
void solve() {
int n;
cin >> n;
vector<int> a(n);
for(auto &x : a)
... | ALGO | 0.999891 | 4.035284 |
a20f1a7f-a5d7-4a70-a3cc-f3ffaf5be06e | TszwangKo/Circuit_Simulator | eigen-3.3.7/doc/examples/DenseBase_template_int_middleCols.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
int main(void)
{
int const N = 5;
MatrixXi A(N,N);
A.setRandom();
cout << "A =\n" << A << '\n' << endl;
cout << "A(:,1..3) =\n" << A.middleCols<3>(1) << endl;
return 0;
}
| ALGO | 0.97134 | 3.154174 |
fd2075ef-bd4c-4c7c-9b10-e9f85532fe72 | wcz0/flutter_getx_template | 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 |
be57b563-917d-4ec5-a776-b7e0914f604b | Manav-Aggarwal/competitive-programming | SPOJ/Scuba Diver.cpp | /* Written By Manav Aggarwal */
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define INF 999999999999999
ll oxyCylinder[1011], nitroCylinder[1011], wt[1011], dp[1011][22][80];
ll solve(ll n, ll oxyNeed, ll nitroNeed)
{
if(dp[n][oxyNeed][nitroNeed] != -1)
{
return dp[n][oxyNe... | ALGO | 0.999737 | 4.202285 |
dbe5e5d4-5bcc-40c4-ab3c-d76be0c53f48 | platanus-build-night/build-night-1-jcrucesdeveloper | ggml/src/ggml-cann/kernels/get_row_f16.cpp | #include "kernel_operator.h"
// optimize me. Use template to avoid copy code.
using namespace AscendC;
#define BUFFER_NUM 2
class GET_ROW_F16 {
public:
__aicore__ inline GET_ROW_F16() {}
__aicore__ inline void init(GM_ADDR input, GM_ADDR indices, GM_ADDR output,
int64_t *in... | ALGO | 0.90195 | 5.758277 |
efec22a4-9109-4545-b60e-a952b62d584c | ishandutta2007/codeforces | nfssdq/normal/611/F.cpp | #include <bits/stdc++.h>
using namespace std;
#define xx first
#define yy second
#define pb push_back
#define mp make_pair
#define LL long long
#define inf INT_MAX/3
#define mod 1000000007ll
#define PI acos(-1.0)
#define linf (1ll<<60)-1
#define FOR(... | ALGO | 0.999937 | 3.879135 |
17100a69-6029-4c51-88ae-09b8452f3eb4 | bhoslerushi155/Lab-codes | HPC /Assignment-2/binary.cpp | #include<iostream>
#include<cstdlib>
#include<omp.h>
using namespace std;
class binary{
int* arr;
int size;
public:
void initArray(int);
void binarySerial(int arr[],int n);
void binaryParallel(int arr[],int n);
int binarySearch(int low,int high,int key);
};
void binary::initArray(int s){
size=s;
arr=new int[s... | ALGO | 0.999876 | 5.293532 |
b201028a-4d47-495e-b850-6c7752262137 | Warisha32/Data-Structures | Queue/Minimum Cost of ropes.cpp | #include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to return the minimum cost of connecting the ropes.
long long minCost(long long arr[], long long n) {
// Your code here
priority_queue <long long, vector<long long>, greater<long long> ... | ALGO | 0.999919 | 5.667443 |
fa7d6770-bb1e-4263-b9e2-990db5b88903 | dvlab-research/APD | lib/psa/src/cpu/psamask.cpp | #include <torch/torch.h>
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
void psamask_collect_forward(const int num_,
const int feature_H_, const int feature_W_,
const int mask_H_, const int mask_W_,
const int half_mask_H_, const... | DATA | 0.913528 | 5.556561 |
6355e271-295e-476c-8aec-096634835987 | Kamrul-Hasan-1971/LightOJ | 1122 - Digit Count.cpp | #include<bits/stdc++.h>
using namespace std;
#define zero(a) memset(a,-1,sizeof a)
#define pb push_back
vector<int>v;
int m, n;
int dp[12][12];
int fun( int baki,int pre)
{
if( baki == 0 ) return 1;
if( dp[baki][pre] != -1 ) return dp[baki][pre];
if(baki>0 ... | ALGO | 0.999778 | 3.631336 |
2841dc38-5ef4-4607-8518-74d63393d346 | Forsyth-Creations/ForsythCreations | Marlin Builds/Astrobotics Build/Marlin/src/feature/bedlevel/ubl/ubl_motion.cpp | #include "../../../inc/MarlinConfig.h"
#if ENABLED(AUTO_BED_LEVELING_UBL)
#include "../bedlevel.h"
#include "../../../module/planner.h"
#include "../../../module/stepper.h"
#include "../../../module/motion.h"
#if ENABLED(DELTA)
#include "../../../module/delta.h"
#endif
#include "../../../MarlinCore.h"
#include <m... | ALGO | 0.988236 | 7.586849 |
22a0f24d-e091-40a3-b7e3-68332ab5c5ee | UjjwalSharma07/LeetCodes | 124-binary-tree-maximum-path-sum/124-binary-tree-maximum-path-sum.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.999969 | 6.366757 |
bef99bb6-c176-4c0c-97c7-72d70a2791ec | aviaryan/competitive | codeforces/297div2/C_ilya_sticks.cpp | #include "bits/stdc++.h"
#define MODULO 1000000007
using namespace std;
typedef unsigned long long ull;
typedef long long ll;
typedef vector<int> vi;
typedef vector<int>::reverse_iterator viit;
int main(){
int t, i, in;
cin >> t;
vi arr, done;
ull ans=0;
for (i=0; i<t; i++){
cin >> in;
arr.push_back(in);
}... | ALGO | 0.99981 | 3.789937 |
37dcca55-1a6f-4d61-bd36-384bad9f86fe | seventhsense07/Geeks-for-Geeks-POTD-Solved | December 2022/POTD 18-12-2022(updated test cases).cpp | class Solution {
public:
long long maxGcd(int N) {
// code here
long long int ans1 = N*(N-1);
long long int ans2 = (N-2)*(N-1);
int a=0;
long long int i=N-2;
while(a<2 && i>2){
if(__gcd(ans1,i)==1){
a++;
ans1*=i;
... | ALGO | 0.999965 | 5.450173 |
db4eeb45-f4d1-4b43-aa62-ff9a20fd0493 | npnet/QuectelShare | system/core/adb/adb_client.cpp | #define TRACE_TAG TRACE_ADB
#include "sysdeps.h"
#include "adb_client.h"
#include <errno.h>
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <string>
#include <vector>
#include <base/stringprintf.h>
#include <bas... | TOOL | 0.959827 | 7.379422 |
945f7f29-9853-4738-be60-b0a91fae9725 | minhyuk2/solving | baekjoon/2747.cpp | #include <bits/stdc++.h>
using namespace std;
int N;
long long int dp[10001];
int main(void){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> N;
dp[0] = 0;
dp[1] = 1;
dp[2] = 1;
for(int i=3;i<=N;i++){
dp[i] = dp[i-1]+dp[i-2];
}
cout << dp[N] << "\n";
} | ALGO | 0.999989 | 4.586662 |
3eb6ece2-5b11-4699-bc21-56714538b231 | flyingSnow-hu/games202 | 2/prt/ext/eigen/doc/examples/TutorialLinAlgExSolveColPivHouseholderQR.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix3f A;
Vector3f b;
A << 1,2,3, 4,5,6, 7,8,10;
b << 3, 3, 4;
cout << "Here is the matrix A:\n" << A << endl;
cout << "Here is the vector b:\n" << b << endl;
Vector3f x = A.colPivHouseholderQr... | ALGO | 0.999932 | 3.356631 |
927730bb-b6ca-47cd-8557-9e379a9af1e5 | Bishwanath-Dey-Nayan/Problem-Solving-Practise | Big Array Sum.cpp | #include<iostream>
using namespace std;
int main()
{
long int j=10000000000;
long int ar[j];
long int total;
for(int i=0;i<j;i++)
{
cin>>ar[i];
}
for(int i=0;i<j;i++)
{
total=total+ar[i];
}
cout<<total;
return 0;
}
| ALGO | 0.99945 | 3.253525 |
cb0af6ac-165d-44b5-927c-b5895865970a | yanchernyavsky/IGPM_Python | C++/ИГПМ/lab4/lab4/Source.cpp | #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES
#include <iostream>
#include <vector>
#include <cmath>
#include "Windows.h"
using namespace std;
double Fx(double x)
{
return pow(x, 3) - 5 * pow(x, 2);
}
double Ms(double alfa, double e)
{
double x0 = alfa;
double it = 0;
double de, xk;
double h = 0.01;
... | ALGO | 0.999184 | 3.685331 |
f5cdceb4-d2a9-49c8-aef0-f133d092854c | dpjudas/SurrealEngine | SurrealEngine/Collision/BottomLevel/TraceAABBModel.cpp |
#include "Precomp.h"
#include "TraceAABBModel.h"
CollisionHitList TraceAABBModel::Trace(UModel* model, const dvec3& origin, double tmin, const dvec3& dirNormalized, double tmax, const dvec3& extents, bool visibilityOnly)
{
Model = model;
CollisionHitList hits;
Trace(origin, tmin, dirNormalized, tmax, extents, visi... | ALGO | 0.995695 | 7.74579 |
535bf1bc-2a4a-4c7e-9782-b10f44989119 | Tazim43/Competitive-Programming | Prefix Sum(1D & 2D).cpp | /* Author: Tazim(The_crawler) */
#include<bits/stdc++.h>
using namespace std;
int main() {
// start
int n;
cin >> n;
vector<int> ar(n);
// 1D Prefix sum
vector<int> p_sum;
int sum = 0;
p_sum.push_back(0); // Making first element 0 to avoiding out of bound error
for (int i = 0; i < n; i+... | ALGO | 0.999686 | 3.602817 |
43f62a7e-69ad-49b0-83ec-d9df35f7d43b | arielwhittingham/100_days_of_code | cpp_practice/function_templates.cpp | #include <iostream>
// source: https://www.learncpp.com/cpp-tutorial/function-templates/
// Functon templates relevant for overloaded functions, like an add() function that is declared for ints,
// longs, and doubles, etc.
// using namespace std;
template <typename T> // define what the template is for and what th... | TOOL | 0.956108 | 6.127286 |
57191650-1896-48a5-8dc1-6cb3b0848bb6 | henrisve/Webocado | Test/src/igamain.cpp | #include "igamain.h"
#include <QDebug>
#include "qmath.h"
#include "window.h"
#include "BentoBlock.h"
#include <QList>
#include <QHash>
#include <QDoubleSpinBox>
#include <random>
#include <QColor>
#include "Page.h"
#include <unordered_set>
#include <QTime>
QTime myTimer2;
//For test?
//Now
/* TODO!
* Important tod... | ALGO | 0.905951 | 3.335179 |
6ba5178d-6588-405f-b2aa-9a07d0e4f072 | sikuner/book-code | C++ Standard Library Quick Reference/Chapter 3/06 - list.cpp | #include <iostream>
#include <list>
int main()
{
std::list<int> list1{ 1,7,5 }, list2{ 5,6,2 }, list3{ 3,4 };
list1.sort(); // 1,5,7
list2.sort(); // 2,5,6
list1.merge(list2); // list1 = 1,2,5,5,6,7
// list2 = empty
list1.unique(); // 1,2,5,6,7
auto splicePosition = std::next(begin(li... | ALGO | 0.994512 | 4.781157 |
7b6546ac-649f-44f2-8501-5f53882232a8 | fudoge/Problem_Solving | 0776-n-ary-tree-postorder-traversal/0776-n-ary-tree-postorder-traversal.cpp | // Definition for a Node.
/*
class Node {
public:
int val;
vector<Node*> children;
Node() {}
Node(int _val) {
val = _val;
}
Node(int _val, vector<Node*> _children) {
val = _val;
children = _children;
}
};
*/
class Solution {
private:
void traverse(Node* root, ... | ALGO | 0.999897 | 6.22811 |
5fdd9254-e1c4-4409-9e0c-6ce8dc2fb150 | ishandutta2007/codeforces | wasa855/normal/1025/C.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
string a;
cin>>a;
a+=a;
int maxn=1;
int t=1;
for(int i=1;i<a.length();i++)
{
if(a[i]!=a[i-1])
{
t++;
maxn=max(t,maxn);
}
else
{
maxn=max(t,maxn);
t=1;
}
}
// cout<<maxn<<endl;
int ttt=a.length()/2;
cout<<min(maxn,ttt)<<endl;;
r... | ALGO | 0.999885 | 3.086436 |
d662cb27-9e6e-4f95-bb8f-5adab473f8a8 | GXDE-OS/boost1.67 | libs/math/example/binomial_sample_sizes.cpp | #ifdef _MSC_VER
# pragma warning(disable: 4512) // assignment operator could not be generated.
# pragma warning(disable: 4510) // default constructor could not be generated.
# pragma warning(disable: 4610) // can never be instantiated - user defined constructor required.
#endif
#include <iostream>
using std::cout; ... | ALGO | 0.980291 | 7.057256 |
0091ea83-5143-4f16-864a-1fd832d641b9 | zipper177/havoc-mayhem-177 | firmware/common/adsb.cpp | #include "adsb.hpp"
#include "sine_table.hpp"
#include <math.h>
namespace adsb {
void make_frame_adsb(ADSBFrame& frame, const uint32_t ICAO_address) {
frame.clear();
frame.push_byte((DF_ADSB << 3) | 5); // DF and CA
frame.push_byte(ICAO_address >> 16);
frame.push_byte(ICAO_address >> 8);
frame.push_byte(ICAO_ad... | TOOL | 0.851549 | 7.180222 |
dab44d9a-ab07-4aa2-9e8c-5d945ab8a462 | emmasteimann/ANDSemu | jni/desmume/src/android/agg/src/agg_trans_affine.cpp | #include "agg_trans_affine.h"
bool is_equal_eps_hacked(const double v1, const double v2, const double epsilon)
{
return fabs(v1 - v2) <= double(epsilon);
}
namespace agg
{
//------------------------------------------------------------------------
const trans_affine& trans_affine::parl_to_parl(const double* ... | TOOL | 0.947839 | 6.466779 |
2f19e249-ff28-4079-8de0-31e417ea6e00 | nebula912/pat | a1032/源.cpp | #include<cstring>
#include<cstdio>
const int maxn=100010;
struct Node
{
char data;
int next;
bool flag;
}node[maxn];
int main() {
for (int i = 0; i < maxn; i++) {
node[i].flag = false;
}
int s1, s2, n;
scanf("%d%d%d", &s1, &s2, &n);
int address, next;
char data;
for (int i = 0; i < n; i++) {
scanf("%d %c ... | ALGO | 0.999786 | 3.274074 |
36d2d1d3-fd06-4c67-b96f-d40c615e5113 | mreppell/Karp | karpeigen/test/denseLM.cpp | #include <iostream>
#include <fstream>
#include <iomanip>
#include "main.h"
#include <Eigen/LevenbergMarquardt>
using namespace std;
using namespace Eigen;
template<typename Scalar>
struct DenseLM : DenseFunctor<Scalar>
{
typedef DenseFunctor<Scalar> Base;
typedef typename Base::JacobianType JacobianType;
typed... | TEST | 0.982223 | 5.886444 |
a3a6fe5f-03b5-4118-9dbd-f7f43c74e5cc | ChicoState/BlxMusicMaker | LIBRARIES/Maximilian/libs/fft.cpp | /*
fft.cpp
Based on K+R Numerical recipes in C and some other stuff hacked about.
*/
#include "fft.h"
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <iostream>
int **gFFTBitTable = NULL;
const int MaxFastBits = 16;
inline int IsPowerOfTwo(int x)
{
if (x < 2)
return... | ALGO | 0.998414 | 5.167865 |
58e8b1df-8192-4c71-b949-2d603231118e | ggnkua/Atari_ST_Sources | Docs/cpptut/SOURCE/CLASS1.CPP | // Chapter 2 - Program 3
#include <iostream.h>
class animal {
public:
int weight;
int feet;
};
main()
{
animal dog1, dog2, chicken;
animal cat1;
class animal cat2;
dog1.weight = 15;
dog2.weight = 37;
chicken.weight = 3;
dog1.feet = 4;
dog2.feet = 4;
chicken.f... | TOOL | 0.945803 | 3.419901 |
177df942-46fb-4aff-a98b-1ddc7359b682 | ryanannis/snowy | extlib/eigen/bench/perf_monitoring/trmv_lot.cpp | #include "gemv_common.h"
EIGEN_DONT_INLINE
void trmv(const Mat &A, Vec &B, const Vec &C)
{
B.noalias() += A.transpose().triangularView<Lower>() * C;
}
int main(int argc, char **argv)
{
return main_gemv(argc, argv, trmv);
}
| ALGO | 0.97559 | 5.021466 |
e865d7b6-e2d6-4600-8f43-750959620841 | shashwat22473/CrackYourInternship | minimum-deletions-to-make-character-frequencies-unique.cpp | class Solution {
public:
int minDeletions(string s) {
int n=s.size();
map<char,int> mapp;
for (int i=0;i<n;i++){
mapp[s[i]]++;
}
vector<int> haha(n+1,0);
for (auto x:mapp){
haha[x.second]++;
}
int ans=0;
for (int i=n;i>=... | ALGO | 0.99997 | 5.699689 |
4a8ec8a7-4369-490f-aa9c-b613fbb54a9c | zhuqiweigit/leetcode | code/236.cpp | #include <iostream>
#include <vector>
#include <limits>
#include <queue>
#include <map>
#include <stack>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(nullptr), right(nullptr) {}
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
... | ALGO | 0.999987 | 5.899373 |
715d0401-41bf-4a05-a482-79bfa47f4554 | x0beR-143n/LTNC_HOMEWORK | BT05_LapTrinhNangCao/bai11.cpp | #include<iostream>
#include<vector>
#include<math.h>
using namespace std;
void convert10to2(int n)
{
vector<int> vc;
int b;
while(n>0)
{
b=n%2;
n=n/2;
vc.push_back(b);
}
for(int i=vc.size()-1 ; i>=0; i--)
{
cout << vc[i];
}
cout << endl;
}
int convert... | ALGO | 0.999391 | 4.190178 |
888712b6-2dce-44d5-a407-15f1c87c14d8 | H-Shen/MyCodeCollection | Leetcode/1182/1182.cpp | class Solution {
public:
vector<int> shortestDistanceColor(vector<int>& colors, vector<vector<int>>& queries) {
vector<int> pos1, pos2, pos3;
int n = (int)colors.size();
for (int i = 0; i < n; ++i) {
if (colors[i] == 1) {
pos1.emplace_back(i);
}
... | ALGO | 0.999448 | 5.700602 |
16474618-5165-4a87-9bc5-ad444b8d6336 | mapefast/mute_neurips | OpenTSTOOL/mex-dev/NN/range_search.cpp | // Count nearest neighbors within distance eps
// from some given reference indices (which point to vectors inside the data set)
// or to explicitly given reference vectors
#include "mextools/mextools.h"
// this includes the code for the nearest neighbor searcher and the prediction routines
#include "NNSearcher/point... | ALGO | 0.999428 | 6.819376 |
9a86672d-afbc-4fa9-91ec-8e742498d63c | xg-wang/leetcodes | CppCode/M_392_Is_Subsequence.cpp | #include "lc_header.h"
using namespace std;
class Solution {
public:
bool isSubsequence(string s, string t) {
string::iterator sl = s.begin(), sr = s.end() - 1;
string::iterator tl = t.begin(), tr = t.end() - 1;
return substr_issubsequence(sl, sr, tl, tr);
}
private:
bool substr_i... | ALGO | 0.999673 | 5.508069 |
4402f153-635e-4103-9418-23daef46cb15 | EthanKim8683/High-School-Competitive-Programming | Codeforces/Problemset/DP/1195c.cpp | #include<iostream>
#include<cstdio>
using namespace std;
using I=int;
using Lli=long long int;
const I N=1e5;
I h_arr[2][N];
Lli dp[N+1][2];
void cmb(Lli&a,Lli b){
a=max(a,b);
}
I main(){
cin.tie(0)->sync_with_stdio(0);
I n;cin>>n;
for(I i=0;i<n;i++)cin>>h_arr[0][i];
for(I i=0;i<n;i++)cin>>h_arr[1][i];
... | ALGO | 0.999968 | 3.275508 |
1e5f43c6-a9c5-44e6-a505-fa71a4971dca | jeongukchoi/Algorithms | 프로그래머스/1/12918. 문자열 다루기 기본/문자열 다루기 기본.cpp | #include <string>
#include <vector>
using namespace std;
bool solution(string s) {
bool answer = true;
if (s.length() == 4 || s.length() == 6) {
for (size_t i = 0; i < s.length(); i++) {
if (!isdigit(s[i])) {
answer = false;
break;
}
}
... | ALGO | 0.994883 | 5.554718 |
ecb0a32b-a111-4c2f-b53d-5520241121f9 | hmsirajul/Data-Structures-and-Algorithm- | insertion _sort/insertionSort_Task(01_C).cpp | #include <iostream>
#include<cstring>
using namespace std;
int i, j;
void insertionSort(string arr[], int size)
{
for ( i = 1; i < size; ++i)
{
string key = arr[i];
j = i - 1;
while (j >= 0 && arr[j] > key)
{
arr[j + 1] = arr[j];
--j;
}
... | ALGO | 0.999593 | 5.013729 |
93fede5f-a00e-44a4-bff6-bfc2119fdfc1 | Leo-Mun/CS | cpp/C++05/main.cpp | #include <iostream>
#include <fstream>
using namespace std;
int main()
{
ifstream inFile;
inFile.open("input.txt");
int time;
inFile >> time;
for (int i = 0; i < time; i++)
{
int total = 1, count, num;
inFile >> count;
for (int j = 0; j < count; j++)
{
... | ALGO | 0.99922 | 4.537327 |
87eeb89e-b2ee-43ee-ab5d-c40ab7c5f876 | tominhtien2003/new_ctdl | floyd.cpp | #include<bits/stdc++.h>
using namespace std;
#define int long long int
const int mod=1e9+7;
main(){
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n,m,q;cin >> n >> m >> q;
vector<vector<int>>matrix(n,vector<int>(n,1e9));
for (int i=0;i<m;i++){
int u,v,w;cin >> u >> v >> w;
--... | ALGO | 0.999979 | 4.796051 |
393c6250-5977-4ce0-b585-9a3c2a2afbb9 | otavioon/COLA-2022-Tools | datasets/src/optz/codenet/3/p03408_s019586388.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int N;
cin >> N;
vector<string>blue(N);
for(int i=0;i<N;i++) {
cin >> blue.at(i);
}
int M;
cin >> M;
vector<string>red(M);
for(int i=0;i<M;i++) {
cin >> red.at(i);
}
int answer =0;
for(int i=0;i<N;i++) {
int x=0;
f... | ALGO | 0.996221 | 4.2695 |
c2d10f8d-1024-4707-b0a1-09119e329870 | 1AHSANULHAK/COMMON-PROBELS-IN-C-PLUS-PLUS-LANGUAGE- | factorialprogram.cpp | //Write a program to print the factorial of a number by defining a function named 'Factorial'.
/*Factorial of any number n is represented by n! and is equal to 1*2*3*....*(n-1)*n. E.g.-
4! = 1*2*3*4 = 24
3! = 3*2*1 = 6
2! = 2*1 = 2
Also,
1! = 1
0! = 0*/
#include<iostream>
using namespace std;
int factorial(int);
int ma... | ALGO | 0.99893 | 4.689576 |
fbe3753c-6671-472e-b734-b24507c12556 | meetanupam/Leetcode-Problem-Solutions | 1456. Maximum Number of Vowels in a Substring of Given Length.cpp | class Solution {
public:
int maxVowels(string s, int k) {
int ans = 0, maxi = 0;
unordered_set<char> vowels = {'a', 'e', 'i', 'o', 'u'};
for (int i = 0; i < s.size(); i++) {
if (vowels.count(s[i])) {
maxi++;
}
if (i >= k && vowels.... | ALGO | 0.999886 | 6.366203 |
b01412c8-3547-4363-9053-14e4ce8bf1db | dinaxhtml/cpp-problems-solving | whatsTheRealFloor.cpp | /*
codewars: What's the real floor?
Americans are odd people: in their buildings, the first floor is actually the ground floor and there is no 13th floor (due to superstition).
Write a function that given a floor in the american system returns the floor in the european system.
With the 1st floor being replaced by th... | ALGO | 0.998922 | 4.935426 |
1e9f109a-3a0a-4c3e-a10f-c5858f7f7124 | baoanth/da22ttc-th-ctdlgt | nguyen_van_tong/TH3_SAP_XEP/sortng_algos.cpp | #include <bits/stdc++.h>
using namespace std;
void swap(int &a, int &b)
{
int tam = a;
a = b;
b = tam;
}
void in(int a[100], int n)
{
for (int i = 0; i < n; i++)
{
cout << a[i] << " ";
}
cout << "\n";
}
void in1(int a[100], int n)
{
for (int i = 1; i <= n; i++)
{
cout << a[i] << " ";
}
cout << "\n";
... | ALGO | 0.999793 | 3.797102 |
0b943077-b7b7-42b1-9cee-f506c6e74ff9 | SeanDougherty/AdventOfCode2021 | 13/part1.cpp | #include <iostream>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
int buildInput(set<pair<int,int>> &pairs, queue<pair<char,int>> &folds) {
ifstream input("input.txt");
string buff;
int y, x;
while (input.is_open()) {
try {
getline(input, buff);
if (buff.length() == 0) {continue... | ALGO | 0.986953 | 4.368626 |
d92f1acd-b7a2-410e-9ec8-69fd9e5e7695 | Harsha22hemanth/DSA0151-C- | day 3 programs/23)harshad number.cpp | #include <iostream>
using namespace std;
bool isHarshad(int num) {
int sum = 0;
int temp = num;
while (temp != 0) {
sum += temp % 10;
temp /= 10;
}
return num % sum == 0;
}
int main() {
int num;
cout << "Enter a number: ";
cin >> num;
if (isHarshad(num)) {
c... | ALGO | 0.995674 | 5.469897 |
0bb5ef23-7bb7-4f1c-8b8e-24577443ffb5 | Haribala-09/hyprdots | User/History/-1125a4e8/f9pe.cpp | #include <bits/stdc++.h>
using namespace std;
#define rev(ans) reverse(ans.begin(), ans.end())
#define mems(a, n) memset(a, n, sizeof(a))
#define pb push_back
#define fst first
#define scd second
#define int long long
using pii = pair<int, int>;
using pci = pair<char, int>;
void dbg_out() { cerr << endl; }
template ... | ALGO | 0.99995 | 4.862141 |
b935163d-eee6-47bb-a13c-1e3f66c8a30c | haowu007/-Choose-your-own-adventure-game-program | 099_bst_set/test.cpp | #include <iostream>
#include "bstset.h"
int main(void) {
BstSet<int> * test = new BstSet<int>;
int Nodes[] = {2, 4, 1, 7, 3, 9, -1, 88, 17, -23, 16, 44, 77, 99};
for (int i = 0; i < 14; i++) {
test->add(Nodes[i]);
}
test->inorderprint(test->root);
std::cout << "\n";
if (test->contains(17) == true)... | TEST | 0.925071 | 4.568507 |
5f7be7c4-e7a3-48f9-8163-498ad6edeb09 | Deus1704/1337C0D3_6r1ND | 3222-find-the-winning-player-in-coin-game/3222. Find the Winning Player in Coin Game.cpp | class Solution {
public:
string losingPlayer(int x, int y) {
int m75 = x;
int m10 = y/4;
int minMoves = min(m75,m10);
if (minMoves%2) return "Alice";
else return "Bob";
}
}; | ALGO | 0.999967 | 5.336432 |
a5eaed9d-0eac-4848-bb09-efa3a3e024d4 | nayan-dubey-14/Leetcode_Solution | kthSmallestElementInBinaryTree/kthSmallestElementInBinaryTree.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.999997 | 6.097938 |
e4589ea2-a08f-4be5-a511-a30f877599fd | NguyenTichDuy/DataStructuresAndAlgorithms | codelearn/checkSort.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool checkSort(std::vector<int> a)
{
vector<int>::iterator it = unique(a.begin(), a.end());
a.erase(it, a.end());
for(auto i : a)
{
cout << i << endl;
}
return true;
}
int main()
{
vector<int> a = {1,1,1,... | ALGO | 0.999856 | 4.313878 |
30ab188d-c696-4fb3-9c22-3e9c1383eb49 | BBBBBbruce/PhysicsSimPro | external_lib/MFEM/mfem-4.3/miniapps/adjoint/adjoint_advection_diffusion.cpp | #include "mfem.hpp"
#include <fstream>
#include <iostream>
#include <algorithm>
#ifndef MFEM_USE_SUNDIALS
#error This example requires that MFEM is built with MFEM_USE_SUNDIALS=YES
#endif
using namespace std;
using namespace mfem;
// Implement the adjoint rate equations in AdvDiffSUNDIALS
class AdvDiffSUNDIALS : pub... | ALGO | 0.9999 | 6.046512 |
5f310db1-e8d3-4343-a549-10e354ad4208 | ishandutta2007/codeforces | tdpencil/normal/1457/A.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
ll recalc(ll a, ll b, ll c, ll d) {
return abs(a-c) + abs(b-d);
}
int main() {
ll T;
cin >> T;
while(T--) {
ll a, b, c, d;
cin >> a >> b >> c >> d;
ll ans = max(recalc(1, 1, c, d), max(recalc(1, b, c, d), max(recalc(a, 1, c, d), recalc(a, b, c... | ALGO | 0.999824 | 4.653939 |
d216cc26-5538-44b0-9dd4-e2709aecba1e | hikjik/cses | solutions/playlist/main.cpp | #include <algorithm>
#include <iostream>
#include <map>
#include <vector>
int main() {
int n;
std::cin >> n;
std::vector<int> nums(n);
for (auto &a : nums) {
std::cin >> a;
}
int start = 0, length = 0;
std::map<int, int> positions;
for (int i = 0; i < n; ++i) {
if (auto it = positions.find(nu... | ALGO | 0.99996 | 4.817605 |
2477f292-769a-4472-ad03-290e7b5869b5 | SamarNegm/Problem-Solving | Lucky Numbers (easy)3.cpp | #include<iostream>
#include<string>
#include<stdlib.h>
#include<cmath>
using namespace std;
char s[1001],temp[1001];
int leno(char x)
{
int sum=0;
for(int i=0; s[i]; i++)
sum++;
return sum;
}
int main()
{
cin>>s;
int l=leno(s[1001]);
if(l%2!=0)
l++;
cout<<l<<" l \n";
f... | ALGO | 0.999961 | 3.048582 |
75a82cd7-ec25-47f1-ab61-7125bb73f329 | oO777Oo/LeetCode | BinarySearch/CountNegativeNumbersInASortedMatrix1351/main.cpp | #include <iostream>
#include <vector>
using namespace std;
int countNegatives(vector<vector<int>>& grid) {
int counter = 0;
for(int i = 0; i < grid.size(); i++) {
int size = grid[i].size();
int mid = size / 2;
int start = 0;
int end = size;
while (true) {
if... | ALGO | 0.999956 | 6.078457 |
cdbe969a-a2d7-4405-96ab-f52c00708c00 | ncode404/geeks-for-geeks-solutions | Queue Operations - GFG/queue-operations.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
// Helper class Solution to implement
// insert() and findFrequency()
class Solution{
public:
// Function to insert element into the queue
unordered_map<in... | ALGO | 0.99888 | 5.506362 |
e2a13e28-516c-413b-91d3-833b7e028da6 | canhhuynh2k2/Applications_of_Algorithm_SAMSUNG_2022 | 1521_GiaiMaXauKyTu.cpp | #include<bits/stdc++.h>
using namespace std;
bool isNum(string s){
for(int i = 0; i < s.size(); i++)
if(s[i] < '0' || s[i] > '9') return false;
return true;
}
int main(){
int t;
cin >> t;
while(t--){
string s;
cin >> s;
stack<string> st;
for(int i = 0; i < s... | ALGO | 0.999603 | 5.180916 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.