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 |
|---|---|---|---|---|---|---|
e3769b32-0596-463b-82fa-68dbcf6b4c6e | seheonnn/Algorithm | Programmers/DFS/다단계 칫솔 판매.cpp | #include <string>
#include <vector>
#include <map>
using namespace std;
map<string, string> parentsMap;
map<string, int> profitMap;
void DFS(string seller, int profit) {
if (seller == "-" || profit < 1) return;
int share = profit / 10;
int tmp = profit - share;
profitMap[seller] += tmp;
DFS(pare... | ALGO | 0.98841 | 4.226549 |
ed5391b9-5302-404d-9584-d1233457077b | GrubbyZebra/SKR-Marlin | Marlin/src/gcode/calibrate/G34_M422.cpp | #include "../../inc/MarlinConfigPre.h"
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
#include "../../feature/z_stepper_align.h"
#include "../gcode.h"
#include "../../module/motion.h"
#include "../../module/stepper.h"
#include "../../module/planner.h"
#include "../../module/probe.h"
#include "../../lcd/ultralcd.h" // for LCD_MES... | TOOL | 0.881591 | 6.299351 |
561dfc25-fbe4-4fcb-8dce-e55c34aafc43 | ishandutta2007/codeforces | used-fft/normal/1673/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
const int MOD = 1e9+7;
signed main() {
ios::sync_with_stdio(0), cin.tie(0);
int T; cin >> T;
while(T--) {
int ab, db, nb, ac, dc, nc;
cin >> ab >> db >> nb;
cin >> ac >> dc >> nc;
ab -= ac;
ac -= ac;
int ans {};
int rb = ab + (nb -... | ALGO | 0.999862 | 4.746863 |
57eb05ea-6484-4b19-b69a-4b7dae5a75a9 | InstitutoDOr/FriendENGINE | fsl/newmat/tmtd.cpp |
//#define WANT_STREAM
#include "include.h"
#include "newmatap.h"
#include "tmt.h"
#ifdef use_namespace
using namespace NEWMAT;
#endif
ReturnMatrix Inverter(const CroutMatrix& X)
{
Matrix Y = X.i();
Y.Release();
return Y.ForReturn();
}
void trymatd()
{
Tracer et("Thirteenth test of Matrix package");
... | ALGO | 0.99781 | 5.040071 |
fd24eb85-2d18-4094-a2bd-f05dbef3b517 | muskan184/DSA_problem | Convert Sorted Array to Binary Search Tree.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.999988 | 6.978679 |
161df031-8a95-4c83-b549-886672bf1410 | levelp/cpp_boost | libs/math/example/arcsine_example.cpp | // arcsine_example.cpp
// Example for the arcsine Distribution.
// Note: Contains Quickbook snippets in comments.
//[arcsine_snip_1
#include <boost/math/distributions/arcsine.hpp> // For arcsine_distribution.
//] [/arcsine_snip_1]
#include <iostream>
#include <exception>
int main()
{
std::cout << "Examples of Ar... | ALGO | 0.930728 | 6.580714 |
cf0b82e6-eb09-47cc-8023-892c08af6b00 | ishandutta2007/codeforces | wangzhikun/normal/995/E.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef long long l... | ALGO | 0.999975 | 3.527943 |
6f8613c8-cd4a-45d4-865a-8413fb01fa14 | PranavReddyP16/CP-Utils | CSES/DP/money_sums.cpp | #pragma GCC optimize("Ofast")
#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;
using namespace std::chrono;
#define int long long
#define ld long double
#define sz(c) ((int)c.size())
#define ordered_set tree<int, n... | ALGO | 0.999986 | 3.988457 |
c00d5a2c-61aa-4794-bca2-1db9da9cf203 | sarojku17/csAcademy | Fill_the_Glasses.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int N,K;
cin>>N>>K;
vector<int> glass(N);
for(int i=0;i<N;i++)
cin>>glass[i];
sort(glass.begin(),glass.end());
long sum=accumulate(glass.begin(),glass.begin()+K,0);
cout<<ceil((float)sum/100)<<endl;
}
| ALGO | 0.995449 | 3.49924 |
2df49f1e-c04c-468f-9c88-43f3fb002182 | KaloyanTs/DSP_22-23 | final_exam_prep/KN22/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
bool less(const int &a, const int &b)
{
return a > b;
}
int main()
{
std::vector<int> v;
v.push_back(3);
v.push_back(5);
v.push_back(2);
v.push_back(1);
v.push_back(6);
v.push_back(9);
v.push_back(2);
v.push_back(6);
... | ALGO | 0.999692 | 4.38705 |
9c5632c7-d27e-4d61-8d1d-43aa34cb51e6 | JakMio280081/Struktury-Danych-Projekt-2 | Struk_Dan_P2.cpp | // Struk_Dan_P2.cpp : Ten plik zawiera funkcję „main”. W nim rozpoczyna się i kończy wykonywanie programu.
//
#include "Kolejkapriorytetowa_kopiec.h"
#include "Priorityqueue_tablica.h"
#include <fstream>
#include <sstream>
#include <chrono>
#include <random>
using namespace std;
using namespace chrono;
vector<vecto... | ALGO | 0.997898 | 4.579111 |
786a661d-af90-4911-89ad-c5874bbdc89e | YoshikiTakashima/vert | benchmark/cpp_transcoder/CHECK_LARGE_NUMBER_DIVISIBLE_4_NOT/CHECK_LARGE_NUMBER_DIVISIBLE_4_NOT_towasm_mutated.cpp | #include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <limits.h>
#include <stdbool.h>
int min(int x, int y) { return (x < y)? x: y; }
int max(int x, int y) { return (x > y)? x: y; }
int cmpfunc (const void * a, const void * b) {return ( *(int*)a - *(int*)b );}... | ALGO | 0.999726 | 5.083266 |
6daa6f3f-4295-40e0-985d-20e107d393ac | Divyanshu-012/LeetcodeCommits | 2558-minimum-number-of-operations-to-sort-a-binary-tree-by-level/2558-minimum-number-of-operations-to-sort-a-binary-tree-by-level.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.999994 | 6.304529 |
654ecf54-bdd2-455c-a3cf-a83ea3564ab8 | Luccionium/SPA-dz | SPADZ2-LukaCucuk/SPADZ2-LukaCucuk/game_of_life.cpp | #include "game_of_life.h"
bool game_of_life::rand_value()
{
return rand() % 4 == 0;
}
bool game_of_life::taken_cell(int i, int j)
{
if (i < 0 || j < 0 || i >= ROW || j >= COLLUMN) {
return false;
}
return _gen[i][j];
}
game_of_life::game_of_life()
{
srand(time(nullptr));
// generiramo r... | ALGO | 0.997803 | 5.116905 |
befe0780-f432-4e4f-b6a7-4f4bc8f9876a | muhammederencennetkusu/FLUTTER-ILE-ALISTIRMALAR | alistirma2/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.997366 | 6.763549 |
84e219db-fb9e-4420-8539-2a157ce14aae | andreyciupitu/PA-Tema1 | points.cpp | #include <fstream>
#include <vector>
#include <algorithm>
#include <utility>
using namespace std;
int assignIntervals(vector<int> &points, vector<pair<int, int> > &intervals);
int main()
{
int n, m;
vector<int> points;
vector<pair<int, int> > intervals;
ifstream fin("points.in");
ofstream fout("p... | ALGO | 0.999963 | 5.071175 |
c440bada-593a-4723-b15a-c5de205b40eb | amityadav23112000/leetcode-solution | 1154-day-of-the-year/1154-day-of-the-year.cpp | class Solution {
public:
int dayOfYear(string date) {
int yy = stoi(date.substr(0,4));
int mm = stoi(date.substr(5,2));
int dd = stoi(date.substr(8,2));
int result = dd;
vector<int> month ({31,28,31,30,31,30,
31,31,30,31,30,31});
if(isLea... | ALGO | 0.999797 | 5.554869 |
e1ce7706-2a44-4d7d-9dc4-debb57d1c2fb | hoanganh04-11/Cpp | Set_Map/So_Luong_Tu_Khac_Nhau_Trong_Xau.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
getline(cin, s);
stringstream ss(s);
set<string> se;
string w;
while(ss >> w){
se.insert(w);
}
cout << se.size() << endl;;
for(auto x : se){
cout << x << " ";
break;
}
for(auto it = se.rbegin(); it != se.rend(); it++){
cout << *it <<... | ALGO | 0.999304 | 3.153602 |
c844efb2-90f5-4f52-a740-d9bef1007d2b | Jiangpeiqi44/cppRepos | prac_IpAdress/ipAdress.cpp | #include <iomanip>
#include <iostream>
#include <string>
using namespace std;
int main()
{
int a, b, c, d;
cout << "ipַ" << endl;
cin >> a;
cin.get();
cin >> b;
cin.get();
cin >> c;
cin.get();
cin >> d;
cout << "ipַ16Ϊ" << endl
<< setiosflags(ios::uppercase) //תΪд
... | ALGO | 0.968984 | 3.381767 |
402d4035-03a9-4192-987d-3a4dd72d5a96 | SumitPrakash1999/LeetCode-Solutions | 494-target-sum/target-sum.cpp | class Solution {
public:
// int solve(int ind,int target, vector<int> & nums,vector<vector<int>>& dp){
// if(ind==0){
// if(target==0&&nums[0]==0) return 2;
// if(target==0||nums[0]==target) return 1;
// else return 0;
// }
// if(dp[ind][target]!=-1) retur... | ALGO | 0.999991 | 5.798651 |
d3b2fb1e-b830-4b61-8558-5ee5a925bbb7 | kkeswani99/SPOJSolutions | COINS.cpp | #include <bits/stdc++.h>
#define ll long long int
using namespace std;
vector<int> dp;
void maxProfitcalc()
{
dp.push_back(0);dp.push_back(1);dp.push_back(2);dp.push_back(3);
for(ll i=4;i<=pow(10,7);i++)
{
ll temp = dp[i/2] + dp[i/3] + dp[i/4];
ll ans = max(temp,i);
dp.push_back(ans);
}
return;
}
ll maxPro... | ALGO | 0.999865 | 4.518298 |
9c3d30b9-633f-4728-8f50-e9164f860177 | AbiterVX/In-ClassLearning | 计算机图形学/作业/4/实习4/distrib/Mesh.cpp | #include "Mesh.hpp"
#include <fstream>
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <utility>
#include <sstream>
bool Mesh ::intersect( const Ray& r , Hit& h , float tmin ) {
bool result = false;
for( unsigned int i = 0 ; i < t.size() ; i++){
Triangle triangle(v[t[i][0]],
v[t[i][1]],v[t[i... | ALGO | 0.916026 | 4.513558 |
f155063f-6fd1-4d4e-99a9-3ff5ca7f75f3 | AakashGaur03/DSA-TUF | 8_Array_Hard_Problems/5_Number_of_Subarray_with_XOR_K.cpp | #include <bits/stdc++.h>
using namespace std;
int bruteCountSubarraysWithXOR(vector<int> &arr, int size, int k) {
int cnt = 0;
for (int i = 0; i < size; i++) {
int xr = 0;
for (int j = i; j < size; j++) {
xr ^= arr[j];
if (xr == k)
cnt++;
}
}
return cnt;
}
int optimalCountSuba... | ALGO | 0.999978 | 5.88104 |
583aacdd-5ff6-4d80-b790-6f0b82487d57 | liuqun/cpp_lessons | ch-9/ch9-lesson1/ch9-lesson1.cpp | #include <algorithm>
#include <iostream>
using namespace std;
template <class T>
T FindMid(T array[], size_t len)
{
std::sort(array, array+len);
T mid;
mid = array[len/2];
return mid;
}
int main()
{
size_t j;
int *iArray;//int iArray[10] = {3,1,4,5,2, 6,8,9,7,10};
double *dArray;
siz... | ALGO | 0.999954 | 3.629078 |
6b5426c5-4e80-475a-aaba-f51d86d59fe1 | vishnu510/LeetCode_Problem | Special Keyboard - GFG/special-keyboard.cpp | // { Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User function Template for C++
#define lli long long int
class Solution{
public:
long long int optimalKeys(int N){
// code here
if(N<6){
return N;
}
... | ALGO | 0.999782 | 5.752562 |
06beee0e-5cb7-42a4-bd11-a83c16bee7c5 | hmofrad/CodingPractice | skinnyleetcode/removeStones.cpp | /*
* https://leetcode.com/problems/most-stones-removed-with-same-row-or-column/
* (c) Mohammad Hasanzadeh Mofrad, 2020
* (e) <EMAIL>
*/
class Solution {
public:
int dfs(std::unordered_map<int, std::vector<int>>& rows, std::unordered_map<int, std::vector<int>>& cols, unordered_set<int>& visited_rows, int row)... | ALGO | 0.999404 | 5.920608 |
b5b9c5ca-87e3-4628-b05f-c5e4ead074be | naolchala/CSE1102 | Assignment/Lecture-1/Example6-A.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
double bonus, net_salary, gross_salary;
int years;
cout << "Bonus Calculator" << endl
<< "----------------" << endl;
cout << "Enter Your Salary: ";
cin >> gross_salary;
cout << "Enter Year Worked: ";
cin >> years;
bo... | TOOL | 0.974362 | 4.255379 |
a3190b86-1945-4feb-9776-184742cb19a7 | kangsw1025/TIL | SolveProblem/20/20.11/20_11_10/201110_2210_숫자판 점프.cpp | #include<iostream>
#include<set>
#include<algorithm>
using namespace std;
int arr[5][5];
set<int> vec;
int n_x[4] = { 0,1,0,-1 };
int n_y[4] = { 1,0,-1,0 };
void solve(int w, int h, int word, int idx) {
if (idx == 5) {
vec.insert(word);
return;
}
for (int i = 0; i < 4; i++) {
int nx = w + n_x[i];
int ny =... | ALGO | 0.995423 | 3.991068 |
a3fceb27-0554-4331-9253-69c5832e40e6 | Razdeep/Codeforces-Solutions | contests/Codeforces Round #687 Div 2/Prison_break.cpp | #include <bits/stdc++.h>
#define trace(x) cerr << #x << ": " << x << endl;
#define all(v) v.begin(), v.end()
#define int ll
typedef long long ll;
using namespace std;
int diff(int a, int b, int y, int x) {
return abs(a - y) + abs(b - x);
}
void solve() {
int n, m, r, c;
cin >> n >> m >> r >> c;
int ans = diff(1,... | ALGO | 0.999664 | 4.164249 |
f5ffcd91-95d5-4ad9-93c7-5a2be2563e5c | paraschuri/CP_Practice | Leetcode Daily/Determine_if_Two_Strings_Are_Close.cpp | class Solution {
public:
bool closeStrings(string word1, string word2) {
vector<int> freq1(26,0),freq2(26,0);
for(auto i: word1)freq1[i-'a']++;
for(auto i: word2)freq2[i-'a']++;
sort(freq1.begin(),freq1.end());
sort(freq2.begin(),freq2.end());
for(int i=0;i<26;i++... | ALGO | 0.999986 | 5.893149 |
4c5b0d80-b1a7-4bfe-b894-866c61892c05 | raincross7/code-similarity | codes/train_code/problem467/problem467_447.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long lol;
//マクロ
//forループ関係
//引数は、(ループ内変数,動く範囲)か(ループ内変数,始めの数,終わりの数)、のどちらか
//Dがついてないものはループ変数は1ずつインクリメントされ、Dがついてるものはループ変数は1ずつデクリメントされる
#define REP(i,n) for(lol i=0;i<lol(n);i++)
#define REPD(i,n) for(lol i=n-1;i>=0;i--)
#define FOR(i,a,b) for(lol i=a;i<=lol(b);i+... | ALGO | 0.999638 | 3.220395 |
1075cb49-1c07-4123-9f98-af1629012a6e | rprakashdass/Leetcode-Problems | DSA/Medium/621. Task Scheduler/maxheapAndQueue.cpp | class Solution {
public:
int leastInterval(vector<char>& tasks, int n) {
unordered_map<char, int> counter;
for(char ch: tasks) counter[ch]++;
priority_queue<int> maxHeap;
for(auto [_, freq]: counter) {
maxHeap.push(freq);
}
// time, freq
... | ALGO | 0.999971 | 6.663708 |
66d3d1e7-a129-4593-8a02-a78f869dabbf | us2ahmad/Programming-Using-Cpp-Level-1 | #######29.cpp | //#include <iostream>
//
//using namespace std;
//
//short ReadInputNumber()
//{
// short number;
// cout << "Please Enter number bigger zero\n";
// cin >> number;
//
// while (number <= 0)
// {
// cout << "Worng number , Please Enter number bigger zero Again\n";
// cin >> number;
// }
//
// return number;
//}
//
//i... | ALGO | 0.999494 | 4.028379 |
b91c75be-3c43-413a-94d3-244d272cdfde | Angkur03/LeetCode-Solution | 1696-jump-game-vi/1696-jump-game-vi.cpp | class Solution {
public:
int maxResult(vector<int>& nums, int k) {
int sz = nums.size();
int res[sz];
priority_queue<pair<int,int> > pq;
for(int i=sz-1; i>=0; i--) {
while(pq.size() && pq.top().second > i + k) pq.pop();
res[i] = nums[i];
... | ALGO | 0.999974 | 5.548685 |
332cc5a1-6006-42d5-8220-b101c2ef8da3 | danielitomoros03/projectOne | AyED/practica2.cpp | /* Dado un arreglo de N números enteros, diseñar algoritmos recursivos que calculen:
● El mayor elemento del arreglo.
● La suma de los elementos del arreglo. listo
● La media de todos los elementos del arreglo. listo
● Verificar si el arreglo está ordenado
*/
int sumaRecursiva(int* ar... | ALGO | 0.999295 | 5.2789 |
23163687-097a-4362-8e94-b2a2467687eb | zubayersust/CodeForces-Solve | 1928A-Rectangle Cutting.cpp | /**
Online Judge : CodeForces
Problem No : 1928A
Problem Name : Rectangle Cutting
Author : Zubayer Rahman
Email : <EMAIL>
Time Limit : 1.000s
CPU : 0.015s
Memory : 0KB
Algorithm : Implementation
*/
#include<bits/stdc++.h>
using namespace std;
int main()
{
#ifndef ONLINE_JUDGE
f... | ALGO | 0.999804 | 4.718951 |
804835c2-f799-4552-b0ba-ea179e459a15 | mterada1228/atcoder | atcoder_begginer_contests/ABC204/b/b.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int sum = 0;
for (int i = 0; i < n; ++i) {
int a;
cin >> a;
if (a > 10) {
sum = sum + a - 10;
}
}
cout << sum << endl;
return 0;
} | ALGO | 0.999311 | 4.11699 |
175872aa-b1ee-45dc-bad1-f1b2c9024086 | humblers/godot | modules/bullet/godot_collision_configuration.cpp | /*************************************************************************/
/* godot_collision_configuration.cpp */
/*************************************************************************/
/* This file is part of: */
/* ... | TOOL | 0.88537 | 7.340037 |
db3380f4-7644-4416-a1d7-23b1119d572b | E-Sangho/Programmers | C++/Level.1/음양더하기.cpp | //
// 음양더하기.cpp
// Programmers
//
// Created by 이상호 on 2021/06/04.
//
#include <stdio.h>
#include <stdbool.h>
#include <stdlib.h>
// absolutes_len은 배열 absolutes의 길이입니다.
// signs_len은 배열 signs의 길이입니다.
int solution(int absolutes[], size_t absolutes_len, bool signs[], size_t signs_len) {
int answer = 0;
... | ALGO | 0.99968 | 4.311868 |
247acbac-d9fc-4819-b482-8d3a74e38527 | suiyoubi/GodotWithIMapLibrary | thirdparty/misc/hq2x.cpp | #include "hq2x.h"
#include "core/math/math_funcs.h"
static const uint32_t AMASK = 0xFF000000;
static const uint32_t YMASK = 0x00FF0000;
static const uint32_t UMASK = 0x0000FF00;
static const uint32_t VMASK = 0x000000FF;
_FORCE_INLINE_ static uint32_t ARGBtoAYUV(
uint32_t value )
{
uint32_t A, R, G, B, Y, U, V;
... | ALGO | 0.973482 | 5.38418 |
c9c72ef8-480c-41e3-bb8b-7c4559643c59 | blacksea3/leetcode | cpp/leetcode/414. third-maximum-number.cpp | #include "public.h"
//4ms, 99.22%
//״̬,
class Solution {
public:
int thirdMax(vector<int>& nums) {
int bigbig = INT_MIN;
int bigmedium = INT_MIN;
int bigsmall = INT_MIN;
int valid_big_nums = 0;
for (auto& num : nums)
{
switch(valid_big_nums)
{
case 0:
{
bigbig = num;
valid_big_nums... | ALGO | 0.999963 | 5.259943 |
c056c4ae-5dc4-4340-87e2-800a012d6d21 | stalker5217/problem-solving | LEETCODE/542.cpp | #include <vector>
#include <queue>
using namespace std;
class Solution {
public:
vector<vector<int>> updateMatrix(vector<vector<int>>& mat) {
queue<pair<int, int>> q;
vector<vector<int>> answer(mat.size(), vector<int>(mat[0].size()));
for(int i = 0 ; i < mat.size() ; i++) {
... | ALGO | 0.999965 | 6.027486 |
56baadf2-cbff-40af-9eea-e5038e3c3a12 | rohitb2310/Advance_Data_Structure | prims.cpp | /*
You have a business with several offices;
you want to lease phone lines to connect them up with each other;
and the phone company charges different amounts of money to connect different pairs of cities.
You want a set of lines that connects all your offices with a minimum total cost.
Solve the problem by suggest... | ALGO | 0.999788 | 3.311704 |
e4921168-b5d5-4e97-9c65-bc9ce895291d | avinashw50w/practice_problems | AtCoder/Beginner Contest 178/B. Product Max.cpp | /*Given four integers a,b,c and d. If x and y are integers and a <= x <= b and c <= y <= d holds.
Then what is the maximum value of x * y */
/**
* [a .. b]
* [c .. d]
* ans will be maximum of these four combinations: b*d, a*c, b*c, a*d
*/
int solve() {
int a, b, c, d;
cin >> a >> b >> c >> d;
int p = m... | ALGO | 0.998737 | 3.787901 |
e6d4e695-245a-4eb1-95ea-f2369d255a3a | ishandutta2007/codeforces | andrew/normal/1092/B.cpp | #include <bits/stdc++.h>
#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>
#define fi first
#define se second
#define p_b push_back
#define pll pair<ll,ll>
#define m_p make_pair
#define all(x) x.begin(),x.end()
#define ld long double
#define sset ordered_set
using namespace std;
using namesp... | ALGO | 0.999986 | 3.96037 |
baac9f4c-65af-4ecb-9965-f0e48d6977c9 | TanYongF/algorithm | 团体设计大赛/14.cpp | #include<bits/stdc++.h>
using namespace std;
typedef unsigned long long ull;
#define ms(s, val) memset(a, val, sizeof(a))
const int MAXN = 2e6+10;
vector<vector<int>> g(MAXN);
bool hav[MAXN];
vector<vector<int>> ans;
// vector<int> temp;
void dfs(int cur, vector<int> temp){
if(g[cur].size() == 0){
ans.push_back(tem... | ALGO | 0.999896 | 3.206181 |
5ef48267-7c63-4f43-bb50-1688c4e909d5 | doorcs/Algorithm | BOJ/02562.cpp | include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
cin.tie(nullptr);
cout.tie(nullptr);
ios_base::sync_with_stdio(false);
int ans, max = 0;
for (int i = 0; i < 9; i++) {
int tmp; cin >> tmp;
if (tmp > max) {
max = tmp;
ans = i+1;
}
}
cout << max << '... | ALGO | 0.999858 | 3.676506 |
ed4c8688-ddd5-4d08-99c9-572f1d1f1779 | Azarenok-cpp/lesson52Solution | task03/logic.cpp | #include "logic.h"
bool is_power_of_three(int n) {
if (n <= 0) {
return false;
}
if (n == 1) {
return true;
}
if (n % 3 != 0) {
return false;
}
return is_power_of_three(n / 3);
} | ALGO | 0.996756 | 4.967022 |
a5d5755a-f84f-41ed-b20c-cd9ecd924e62 | hyungupark/coding-test | leetcode/algorithms/83_remove_duplicates_from_sorted_list/main.cpp | #include <cstddef>
class Solution
{
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) {}
};
public:
ListNode *deleteDuplicates(ListNode... | ALGO | 0.999905 | 5.896735 |
7e16772c-f44f-4938-a619-2f53f17a0464 | ishandutta2007/codeforces | emthrm/normal/1523/D.cpp | #define _USE_MATH_DEFINES
#include <bits/stdc++.h>
using namespace std;
#define FOR(i,m,n) for(int i=(m);i<(n);++i)
#define REP(i,n) FOR(i,0,n)
#define ALL(v) (v).begin(),(v).end()
using ll = long long;
constexpr int INF = 0x3f3f3f3f;
constexpr long long LINF = 0x3f3f3f3f3f3f3f3fLL;
constexpr double EPS = 1e-8;
constex... | ALGO | 0.999927 | 4.281625 |
f5a96f28-aca7-4dbf-a7f8-678334e9000a | SoumyadeepMandal2003/GFG-DSA | Arrays/storckBuyandSell.cpp | #include <iostream>
#include <vector>
using namespace std;
int maxProfit(const vector<int>& prices) {
int profit = 0;
for (size_t i = 1; i < prices.size(); ++i) {
if (prices[i] > prices[i - 1]) {
profit += prices[i] - prices[i - 1];
}
}
return profit;
}
int main() {
int... | ALGO | 0.998047 | 5.982394 |
7f55127f-4921-4882-a2aa-479cfb0362cf | ShivamK2002/leetCodeProblems | 26-remove-duplicates-from-sorted-array/remove-duplicates-from-sorted-array.cpp | class Solution {
public:
int removeDuplicates(vector<int>& arr) {
int i = 0;
int j = 0;
int k = 1;
while(j<arr.size()){
if(arr[i]==arr[j]){
j++;
}
else{
k++;
arr[i+1] = arr[j];
i++;
... | ALGO | 0.999936 | 5.94511 |
91ee825c-b4b1-486b-8aa6-e710458a3cdb | paulovitorccc/online-judge-solutions | Codeforces/381A-SerejaAndDima.cpp | #include <iostream>
#include <stdio.h>
using namespace std;
int main()
{
int casos;
scanf("%d", &casos);
int cartas[casos];
for(int i = 0; i < casos; i++){
scanf("%d", &cartas[i]);
}
int pointer1 = 0;
int pointer2 = casos - 1;
bool sereja = true;
int somaSereja = 0;
int somaDi... | ALGO | 0.999869 | 3.635138 |
3db09a9d-8b68-4b0b-93ea-9e937bccfd66 | aRKO872/data-structures-in-cpp | graphs/minimum-spanning-tree.cpp | // Prim's Algorithm :
int findLowest (vector<int>& key, vector<int>& mst) {
int lowInd = -1;
int low = INT_MAX;
for (int i = 0; i < key.size(); i++) {
if (mst[i] == 0 && key[i] < low) {
low = key[i]; lowInd = i;
}
}
return lowInd;
}
int spanningTree(int V, vector<vector<int>> adj[])... | ALGO | 0.999873 | 5.18514 |
1c156b03-4dd9-4738-b11b-0198754437d7 | KadaliAswinkumar/Coding-Leetcode-GFG | 0485-max-consecutive-ones/0485-max-consecutive-ones.cpp | class Solution {
public:
int findMaxConsecutiveOnes(vector<int>& nums) {
int maxi =0;
int cnt=0;
for(int i=0;i<nums.size();i++)
{
if(nums[i]==1)
{
cnt++;
maxi = max(maxi,cnt);
}
else
{
... | ALGO | 0.999961 | 6.056855 |
47a56acd-d625-465e-8376-0f3d98ee258b | SpencerL-Y/Z3-SLHV | src/qe/qe_arith_plugin.cpp | #include "qe/qe.h"
#include "ast/ast_pp.h"
#include "ast/rewriter/expr_safe_replace.h"
#include "ast/rewriter/bool_rewriter.h"
#include "ast/bv_decl_plugin.h"
#include "ast/arith_decl_plugin.h"
#include "smt/arith_eq_solver.h"
#include "ast/rewriter/arith_rewriter.h"
#include "ast/rewriter/th_rewriter.h"
#include "ast/... | ALGO | 0.995087 | 6.0519 |
f560beff-9917-4a4b-be69-33c182bb2514 | huythedev/Code_archive | CONTESTS/CF_2110/C.cpp | // Author: huythedev
// Problem Link: https://codeforces.com/contest/2110/problem/C
#include <bits/stdc++.h>
using namespace std;
#define NAME "C"
#define ln "\n"
#define sz size()
typedef long long ll;
typedef long double ld;
void fastio() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL... | ALGO | 0.999988 | 4.507464 |
b38906ae-4186-4959-bfda-38b8e705baf7 | KDE/kstars | kstars/ekos/capture/exposurecalculator/optimalsubexposurecalculator.cpp | #include <QLoggingCategory>
#include <cmath>
#include "optimalsubexposurecalculator.h"
#include "imagingcameradata.h"
#include "calculatedgainsubexposuretime.h"
#include "cameraexposureenvelope.h"
#include "optimalexposuredetail.h"
#include <ekos_capture_debug.h>
namespace OptimalExposure
{
/*
* For UI presentation... | ALGO | 0.884385 | 4.725254 |
4a42259e-2f08-4725-9bda-5476038db11e | Kashi1311/DSA-in-C-language | tut300.cpp | #include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
int balancedString(string s) {
const int n = s.length();
const int k = n / 4;
int ans = n;
vector<int> count(128);
for (const char c : s)
++count[c];
for (int i = 0, j = 0; i < n; ++i) {
--count[s... | ALGO | 0.99984 | 5.334085 |
ebad55a6-4b14-48e2-a292-755bb8a3bff3 | gunn333/CODE-CHALLENGES- | 100 Days Code/DAY 77/Time_Nedded_Buy_Tickets.cpp | //! Time needed to buy tickets (LeetCode 2073)
// Question Link:
//
#include <bits/stdc++.h>
using namespace std;
int timeRequiredToBuy(vector<int> &tickets, int k) {
// time keeps the track of the time taken to buy the tickets
int time = 0;
// index i is used to iterate over the tickets vector
int i = 0;
... | ALGO | 0.999842 | 5.982796 |
dac6dc5f-e4af-4506-b47d-b5e3dd9664bb | mathpz/competitive-programming | Codes/CDP-UTFPR/cf1373c-StonksOverflow.cpp | #include <bits/stdc++.h>
#define MAX 1123456
char s[MAX];
typedef long long int ll;
int main()
{
int t;
scanf("%d", &t);
while(t--)
{
scanf(" %s", s);
ll ans = strlen(s);
ll cur=0,mn=0;
for(int i=0; i< (int)strlen(s);i++){
if(s[i] == '+') cur += 1;
... | ALGO | 0.999893 | 4.159967 |
a9b8b39c-a36b-4d8c-b418-d23b392f8027 | lucasnlm/antimine-android | sgtatham/src/main/cpp/sgtatham.cpp | #include <jni.h>
#include <algorithm>
#include <functional>
#include <cassert>
#include <string>
#include <cstdint>
#include <iostream>
#include <list>
#include "common.h"
#include "tree234.h"
#include "random_generator.h"
#include "minefield_creator.h"
#define sresize(array, number, type) \
( (type *) srealloc... | ALGO | 0.996025 | 5.228563 |
e8b29945-4801-4dda-bacc-88777a1b22a6 | Asevenx174/CP-source-code- | 02_OJ_solution/Cf contest/820 div3/e.cpp | #include<bits/stdc++.h>
#define pf printf
#define ff first
#define ss second
#define sef second.first
#define ses second.second
#define ms(a,b) memset(a, b, sizeof(a))
#define pii pair <int,int>
///%I64d %Lf
/// ios::sync_with_stdio(0); cin.tie(0);
/// ar.resize(n+10, vector<int>(m+10)); ... | ALGO | 0.99988 | 3.551371 |
0ddab58a-5bfe-471f-8bf5-3c09bbb5c5bc | haastregt/occlusion_tracking | occlusion_package/CGAL-5.5.2/examples/RangeSegmentTrees/segment_tree_set_2.cpp | // Implementation: Testprogram for 2-dimensional Segment Trees
// Example for the construction of a two dimensional segment tree.
// The data type of the first dimension is double and for the second
// dimension double.
// The elements that should be stored in the tree are pushed into
// a list. Then a two dimensional ... | ALGO | 0.998958 | 6.336859 |
7fc15118-a745-4230-b538-c3c324bab413 | clairemiller/MultiscaleModellingDesquamationInIFE | src/CellModifiers/KLKOdeModelCellModifierWithAdaptiveHeight.cpp | #include "KLKOdeModelCellModifierWithAdaptiveHeight.hpp"
template<unsigned DIM>
KLKOdeModelCellModifierWithAdaptiveHeight<DIM>::KLKOdeModelCellModifierWithAdaptiveHeight(double heightStartSC, unsigned vertical)
: KLKOdeModelCellModifier<DIM>(heightStartSC,heightStartSC,vertical),
mSamplingHeightTimesteps(120), m... | ALGO | 0.874055 | 6.996184 |
581de41d-190b-4e60-879e-d7fa70ef0492 | andrefakhoury/competitive-programming | problems/solutions/GEMA/GEMA Tree/1/D.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL_PC
#define debug(args...) { cout.flush(); fflush(stdout); fprintf(stderr, args); }
#else
#define debug(args...) ; /* */
#endif
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define fi first
#define se second
using ll = long long;
using p... | ALGO | 0.999574 | 5.107908 |
b572fe2e-e40f-4b6a-9c3b-f4dbccc589ed | alcohol-study/2024-programmers | programmers/algorithm/level2/Hong0329/정수 삼각형.cpp | //
// Created by hong jun chung on 7/28/24.
//
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int solution(vector<vector<int>> t) {
int answer = 0;
for (int i = t.size() - 1; i > 0 ; i--) {
for (int j = 0; j < t[i].size() - 1; j++)
t[i - 1][j] += max(t[i][j],... | ALGO | 0.999887 | 5.99777 |
df37e4da-227b-4630-a422-20bd4b31f8e0 | CodderPrince/C-Plus-Plus | OTHER'S/arrsort.cpp | //Static Array Sort. In static array don't use vector
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define nl endl
int main()
{
ll arr[] = {3, 2, 1, 5, 7};
ll n = 5;
sort(arr, arr + n);
cout << "Sort in Ascending Order\n";
for (auto x : arr)
{
cout << x << " "... | ALGO | 0.997269 | 4.553038 |
50f68ab9-02b5-4183-aae6-2344d0f97a6b | ZhangGroup-MITChemistry/Explicit_Ion_Chromatin | Code/example_lammps_src/universe.cpp | #include <mpi.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "universe.h"
#include "version.h"
#include "error.h"
#include "force.h"
#include "memory.h"
using namespace LAMMPS_NS;
#define MAXLINE 256
static char *date2num(const char *version);
/* --------------------------... | TOOL | 0.955589 | 4.777105 |
1f782870-e0ad-4c1f-9c1c-0c7a82b5d0b8 | czqsole/codeforces | cf/552/e.cpp | /*
* @Author: czqsole
* @Date: 2019-04-18 17:11
*/
#include <bits/stdc++.h>
using namespace std;
int main() {
int n, k;
cin >> n >> k;
vector<pair<int, int>> a(n);
for (int i = 0; i < n; ++i) {
cin >> a[i].first;
a[i].second = i;
}
sort(a.rbegin(), a.rend());
queue<int> ... | ALGO | 0.999998 | 3.563471 |
db83ef76-3e55-4f76-a7f8-b3aaa2016324 | Huangyan0804/luogu | P1049/P1049/P1049.cpp | #include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int f[20001];
int main() {
int n, m;
cin >> m;
cin >> n;
int v;
for (int i = 0; i < n; i++) {
cin >> v;
for (int j = m; j >= v; j--) {
f[j] = max(f[j], f[j - v] + v);
}
}
cout << m - f[m] << endl;
return 0;
} | ALGO | 0.999955 | 3.042586 |
6402af19-9dde-475d-a960-7400a4c466fd | NewCapital/TWINS-Core | src/kernel.cpp | #include <boost/assign/list_of.hpp>
#include "db.h"
#include "kernel.h"
#include "script/interpreter.h"
#include "timedata.h"
#include "util.h"
#include "stakeinput.h"
#include "ztwinschain.h"
using namespace std;
bool fTestNet = false; //Params().NetworkID() == CBaseChainParams::TESTNET;
// Modifier interval: time... | ALGO | 0.980739 | 6.223775 |
1dd25ca5-e59a-4613-9b1e-b62feb0100e2 | alexandraback/datacollection | solutions_5738606668808192_0/C++/Fildi/ConsoleApplication2.cpp | // ConsoleApplication2.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int primeNumbers[] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89 };
int primeCount = sizeof(primeNumbers) / sizeof(int);
v... | ALGO | 0.999745 | 4.690657 |
39b8a6c2-d007-408c-a116-a511db50a80e | Altudy/solutionheejoon | 백준/2798_블랙잭.cpp | #include <iostream> // 백준 2798
using namespace std;
int main()
{
int N, M, card[100] = {};
cin >> N >> M;
for (int i = 0; i < N; i++)
cin >> card[i];
int max = 0;
for (int i = 0; i < N - 2; i++)
{
for (int j = i + 1; j < N - 1; j++)
{
for (int k = j + 1; k < N; k++)
{
if (((card[i] + card[j] + ca... | ALGO | 0.999985 | 4.251282 |
a06c21b1-838e-4c8c-bff2-05e04dba9ecf | Fertlas/hotel-recommend-v1.1 | myenv/Lib/site-packages/sklearn/svm/src/liblinear/tron.cpp | #include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "tron.h"
#ifndef min
template <class T> static inline T min(T x,T y) { return (x<y)?x:y; }
#endif
#ifndef max
template <class T> static inline T max(T x,T y) { return (x>y)?x:y; }
#endif
static void default_print(const char *buf)
{... | ALGO | 0.999676 | 5.847107 |
185d5fee-1073-4a86-b6d7-179379b869ef | KIET-Github/2024-B-Training | 2000290120095/Week_3/Binary_Search-Binary_Heap-Hash_Table/Problems/pageAllocationProblem.cpp | #include<iostream>
using namespace std;
bool possible(int arr[],int n,int m,int limit){
int studentRequired =1,sum=0;
for(int i=0;i<n;i++)
{
if(arr[i]>limit)
return false;
if(sum+arr[i]>limit)
{
studentRequired++;
sum = arr[i];
if(stud... | ALGO | 0.999946 | 4.683274 |
3ebb4c17-2306-463d-87c0-a057e731c140 | GQY2012/MPIandOMP | src/pi_MPI.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <mpi.h>
#include <math.h>
double f(double);
int main(int argc,char *argv[]) {
double starttime = 0.0, endtime = 0.0;
double pi = 0.0, l = 0.0, sum = 0.0, x = 0.0;
int numprocs = 0, myid = 0;
int n = 0;
double t1, t2;
MPI_Init(&argc, &argv);
MPI_Comm... | ALGO | 0.999849 | 3.79121 |
593a66bf-f418-488a-a302-24a0a47335c5 | Scary-Spark/myLearning | c++/dsaByApnaCollege/_6_binary_Number_System/_6_2_binary_To_Decimal.cpp | #include <iostream>
using namespace std;
long long int decimalForm(long long int n)
{
int ans = 0, remainder, pow = 1;
while (n > 0)
{
remainder = n % 10;
n /= 10;
ans += remainder * pow;
pow *= 2;
}
return ans;
}
int main()
{
long long int n;
cout << "Enter a... | ALGO | 0.99972 | 5.103109 |
c7dd2157-f8b8-4133-946b-a370145efe5e | NUS-LinS-Lab/Jade | dart/trajectory/SingleShot.cpp | #include "dart/trajectory/SingleShot.hpp"
#include <vector>
#include "dart/dynamics/Skeleton.hpp"
#include "dart/neural/BackpropSnapshot.hpp"
#include "dart/neural/NeuralUtils.hpp"
#include "dart/neural/RestorableSnapshot.hpp"
#include "dart/simulation/World.hpp"
// Make production builds happy with asserts
#define ... | ALGO | 0.98304 | 6.208906 |
61135a55-4d77-4cc4-bbf3-39440bd82006 | Carlos161104/Equipo5 | CodeTareaFinal/Dijkstra.cpp | #include <iostream>
#include <climits>
using namespace std;
const int INF = INT_MAX;
const int V = 4; // Número de vértices en el grafo
// Función para encontrar el vértice con la distancia mínima, de los que aún no han sido procesados
int minDistance(int dist[], bool sptSet[]) {
int min = INF, min_index;
f... | ALGO | 0.999976 | 6.113582 |
e88a8480-d126-4c41-9847-ce4e8fc0db17 | hasibul134409/uva-solved | 10004.cpp |
#include<cstdio>
#include<queue>
#include<cstring>
using namespace std;
int main()
{
int node,edge,st,en;
int arr[200+5][200+5];
int color[205];
while(scanf("%d",&node)&&node!=0)
{
queue<int> v;
memset(arr,0,sizeof(arr));
memset(color,-1,sizeof(color));
scanf("%d... | ALGO | 0.993534 | 4.41258 |
7dc1a350-5daa-4d76-a880-02087e0519d9 | blogdefotsec/Unitree_SDK_Extended | original_SDK/unitree_slam/20250410/module/Odometer_service/src/opengv/test/test_triangulation.cpp | #include <stdlib.h>
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <opengv/triangulation/methods.hpp>
#include <opengv/relative_pose/CentralRelativeAdapter.hpp>
#include <sstream>
#include <fstream>
#include "random_generators.hpp"
#include "experiment_helpers.hpp"
#include "time_measurement.hpp"
... | ALGO | 0.984533 | 5.886593 |
f5153c01-56fc-496e-9f15-066641846f0f | MiyamuP/AtCoder | ABC261/a.cpp | #include <iostream>
#include <vector>
using namespace std;
#define ll long long
#define rep(i, n) for (ll i = 0; i < n; i++)
int main()
{
ll l1, r1, l2, r2;
cin >> l1 >> r1 >> l2 >> r2;
ll num = 0;
ll f = -1;
ll l = -1;
rep(i, 101)
{
if (f != -1)
{
if (!(l1 <= i && i < r1 && l2 <= i && i < r2))
{
... | ALGO | 0.999827 | 3.219288 |
8e6f1995-f0ed-4451-bdf1-704cef065efc | Krishrajput1107/Data-Structure-Algorithms | lecture3/prog2.cpp | #include<iostream>
using namespace std;
int main(){
char ch;
cout<<"enter any character "<<endl;
cin>>ch;
if((ch>=48)&&(ch<=57)){
cout<<"This is numeric value"<<endl;
}
else if((ch>=65)&&(ch<=90)){
cout<<"Upper case character"<<endl;
}
else{
cout<<"Lower case char... | ALGO | 0.997215 | 3.118009 |
98fa6038-f698-4283-845d-5cd79f78baab | Aadik1ng/LC | 260-Single-Number-III.cpp | class Solution {
public:
vector<int> singleNumber(vector<int>& nums) {
unsigned int xorr = 0;
for (unsigned int x : nums) {
xorr ^= x;
}
// Find the rightmost set bit
unsigned int setbit = xorr & -xorr; // Isolate the rightmost set bit
... | ALGO | 0.999985 | 5.526062 |
d1e5b8ef-e00f-4d64-919d-5bfd460d0886 | yoloytz/cppcode2023 | study2023/menu1/demo25.cpp | #include <iostream>
using namespace std;
void countChar(char* str, int& total, int& upper, int& lower, int& digit, int& other) {
total = 0;
upper = 0;
lower = 0;
digit = 0;
other = 0;
while (*str != '\0') {
total++;
if (*str >= 'A' && *str <= 'Z') {
upper++;
... | ALGO | 0.996423 | 4.533891 |
287c0357-325b-4761-969e-f0cb68b7f4a7 | Randowlh/Project_ACM_2021 | code/competition/ACM_lesson_17/5.cpp | #include <bits/stdc++.h>
using namespace std;
const int inf = 0x7FFFFFFF;
typedef long long ll;
#define int long long
const ll mod = (0 ? 1000000007 : 998244353);
const ll mod2 = 999998639;
const double eps = 1e-7;
const ll llinf = 4223372036854775807;
inline void out(int a)
{
if (a)
cout << "Yes" << endl;
... | ALGO | 0.999998 | 4.434336 |
49c0402d-d2f8-425d-a592-efa622e51232 | pingchungchang/CP | c423.cpp | #include <bits/stdc++.h>
using namespace std;
int root(string s){
int returns = 0;
for(auto i:s){
returns += i-'0';
}
if(returns<10)return returns;
else return root(to_string(returns));
}
int main(){
int n,r;
cin>>n>>r;
string s;
cin>>s;
set<string> ans;
for(int i = 0;i<=n-1;i++){
for(char j = '0';j<='9... | ALGO | 0.999797 | 4.22833 |
390b8327-7e37-4e22-b007-69770bbad216 | logicmd/leetcode | Triangle.cpp | class Solution {
public:
int minimumTotal(vector<vector<int> > &triangle) {
// Start typing your C/C++ solution below
// DO NOT write int main() function
if(triangle.size() == 0) {
return 0;
}
if(triangle.size() == 1) {
return triangle[0][0];
... | ALGO | 0.999961 | 5.947218 |
f846ce34-f08e-47fa-bf37-0ab8f3a49755 | dscoder1/dscoder1 | CPrime.cpp | //WAP TO FIND A NUMBER IS PRIME OR NOT USING CONSTRUCTOR
#include<iostream>
using namespace std;
class ChckPrime{
int num,flag=0;
public:
ChckPrime(){
cout<<"Enter A Number You Want To Check:";
cin>>num;
for(int i=2;i<=num/2;i++){
if(num%i==0){
flag=1;
break;
}
}
if(num==1){
cout<<"1 Is Neither Prime Nor Composite"<<en... | ALGO | 0.998431 | 4.467403 |
f7f5d6c8-b53e-415e-951a-0763f9f0ccf5 | me1208/NYUbridgeProgramAssignments2019 | mfr363_hw10_q2.cpp | #include <iostream>
#include <string>
#include <array>
#include <vector>
using namespace std;
int* findMissing(int arr[], int n, int& resArrSize);
void printMissingNumArry(int arr[], int arrSize);
int main(){
int arr[6]={3, 1, 3, 0, 6, 4};
int n = 6;
int resArrSize = 0;
int *missingNums = findMissing(arr, n, r... | ALGO | 0.996612 | 4.670546 |
04a62abf-0017-49e3-bf05-3918eebe1f31 | M-Awwab-Khan/Competitive-Programming | spelling_check.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
int prefix_len(const string &a, const string &b, int l2) {
int i = 0;
while (i < l2 && a[i] == b[i]) {
i++;
}
return i;
}
int suffix_len(const string &a, const string &b, int l1) {
int count = 0;
int i = l1 - ... | ALGO | 0.999949 | 4.16518 |
900bff6e-e961-4269-9ecb-317b8b0dabb5 | adar2/Maze-Solver | Algorithms/BiDirectionalAStar.cpp |
#include "BiDirectionalAStar.h"
#include "PairHashing.h"
#include <set>
using std::multiset;
using std::unordered_map;
int BiDirectionalAStar::run_algorithm(double **array, int dimension, int *source, int *goal, float time_limit) {
//open list front search
multiset<shared_ptr<Node>, lessCompNodePointers> fr... | ALGO | 0.999998 | 5.43041 |
c0b17d20-79f5-4782-9a44-48240816ac51 | harshitasaini16/Leetcode-Practise | 498-diagonal-traverse/498-diagonal-traverse.cpp | class Solution {
public:
vector<int> findDiagonalOrder(vector<vector<int>>& mat) {
vector<int>ans;
int n=mat.size();
int m=mat[0].size();
int turn=0;
for(int i=0;i<n;i++){
int x=i;
int y=0;
vector<int>v1;
while(x>=0 && y<m){
... | ALGO | 0.999991 | 6.211153 |
00ebcf0f-0030-46b1-9724-d3ab19a16f6b | ankitmeofficial/DSA-with-C- | 04_PATTERN/04_pattern-5/2-pattern.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cout << "Enter the number of rows: ";
cin >> n;
int i = 1; // Row counter
while (i <= n) {
int j = 1; // Space counter
while (j <= n - i) {
cout << " "; // Print spaces
j++;
}
int ... | ALGO | 0.987216 | 4.802269 |
b94c9961-db7b-49c3-85c5-47b0aeab15d5 | CompOpt4Apps/VariationsOnATheme | themes/VIBE/VIBE-FusedParallelBlur_Optimized-CUDA-driver.cpp | #include "VIBE-FusedParallelBlur_Optimized-CUDA-kernel.h"
#include "../common/Configuration.h"
#include "../common/Measurements.h"
#include "verification.h"
#include "opencv2/opencv.hpp"
#include "timer.h"
#include <iostream>
#include <stdio.h>
#include <string>
#include <cmath>
#include <time.h>
#define VIDEO
using ... | ALGO | 0.997099 | 4.963414 |
73f07a4a-12b1-4b5b-bb68-11b027a4444d | sarvex/leetcode-g-forth | lcof2/剑指 Offer II 094. 最少回文分割/Solution.cpp | class Solution {
public:
int minCut(string s) {
int n = s.size();
vector<vector<bool>> dp1(n, vector<bool>(n));
for (int i = n - 1; i >= 0; --i) {
for (int j = i; j < n; ++j) {
dp1[i][j] = s[i] == s[j] && (j - i < 3 || dp1[i + 1][j - 1]);
}
}
... | ALGO | 0.999965 | 6.101069 |
7b6cc88d-1279-48f3-b15f-a3e1b0cae3d2 | hotuanan/codeforces | Keanu Reeves/main.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
int n;
string a;
cin >> n >> a;
int hist[2] = {0};
for(auto c : a) hist[c - '0']++;
if(hist[0] != hist[1]) {
cout << 1 << endl;
cout << a << endl;
}
else {
cout << 2 << endl;
cout << a[0] << " ... | ALGO | 0.999896 | 3.797534 |
32243e09-0b33-4099-89d2-cc0f4d7699d9 | PranjaliBhardwaj/Daily-DSA-Dose | June/Dayfour.cpp | class Solution {
public:
int longestPalindrome(const std::string& s) {
// Initialize a set to keep track of characters with odd frequencies
std::unordered_set<char> charSet;
// Initialize the length of the longest palindrome
int length = 0;
// Iterate over each chara... | ALGO | 0.999921 | 6.908533 |
b152e677-b8ce-41fd-8202-ae3ff40b5399 | marco-park/problemSolving | ALGOSPOT/DP1/ASYMTILING.cpp | #include <iostream>
#include <cstring>
#define MOD 1000000007
long long d[101];
int n;
using namespace std;
int foo(int x){
if(x<=1)return 1;
long long &ret = d[x];
if(ret!=-1)return ret;
return ret = (foo(x-1)%MOD+foo(x-2)%MOD)%MOD;
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NUL... | ALGO | 0.999917 | 4.482967 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.