uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
376d35d6-3e41-407f-ae6a-98cb824333b6 | gerald-yang/iotivity-demo | iotivity-1.0.1/extlibs/boost/boost_1_58_0/libs/spirit/example/qi/compiler_tutorial/conjure2/vm.cpp | #include "config.hpp"
#include "vm.hpp"
#if defined(_MSC_VER)
# pragma warning(disable: 4800) // forcing value to bool 'true' or 'false'
// (performance warning)
#endif
namespace client
{
int vmachine::execute(
std::vector<int> const& code
, std::vector<int>::const_it... | TOOL | 0.853678 | 5.538898 |
eb72a21b-c907-4fd7-93ef-2e54922e3ad7 | Yoshiyuki194/CSC14120_Parallel-Programming_Final-Project | mini-dnn-cpp-master/third_party/eigen/bench/vdw_new.cpp | #include <iostream>
#include <Eigen/Core>
using namespace Eigen;
#ifndef SCALAR
#define SCALAR float
#endif
#ifndef SIZE
#define SIZE 10000
#endif
#ifndef REPEAT
#define REPEAT 10000
#endif
typedef Matrix<SCALAR, Eigen::Dynamic, 1> Vec;
using namespace std;
SCALAR E_VDW(const Vec &interactions1, const Vec &inter... | ALGO | 0.999821 | 3.537879 |
ba52ac25-ca2d-4c8c-b2ee-a294368c9d2d | Abdul-Rahimm/LeetCode_2023 | 8. Novermber/11. 2642h. Design Graph With Shortest Path Calculator.cpp | class Graph {
public:
typedef pair<int,int> pr;
unordered_map<int, vector<pr>> adj;
int N;
Graph(int n, vector<vector<int>>& edges) {
N = n+1;
for(vector<int> &row : edges){
int u = row[0];
int v = row[1];
int w = row[2];
... | ALGO | 0.999867 | 5.606379 |
bf25017e-8661-4b01-9b5f-c7c009407f27 | pankajjindal/DailyCoding | c++/datastructures/stl/algo/rotate1.cpp | #include "algostuff.hpp"
using namespace std;
int main()
{
vector<int> coll;
INSERT_ELEMENTS(coll,1,9);
PRINT_ELEMENTS(coll,"coll: ");
// rotate one element to the left
rotate (coll.begin(), // beginning of range
coll.begin() + 1, // new first element
coll.end()... | ALGO | 0.982932 | 4.210655 |
ef854263-88dd-4ded-9208-3445df50bb83 | anik-ewu/C-O-N-T-E-S-T | CodeChef/February Lunchtime 2021 Division 2/T.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e9;
#define what_is(x) cerr<<#x<<" is "<<x<<"\n";
#define read(x) freopen("in.txt","r",stdin);
#define write(x) freopen("out.txt","w",stdout);
#define Fast ios_base::sync_with_stdio(false);cin.tie(0);cout.... | ALGO | 0.996176 | 3.041911 |
5dba03a6-24ad-407d-a3cd-fb5a878a8097 | mansinerkar-11/GeeksForGeeks | Count_zeros_in_a_sorted_matrix.cpp | //{ Driver Code Starts
#include <iostream>
#include<vector>
using namespace std;
// } Driver Code Ends
//Back-end complete function Template for C++
class Solution{
public:
int countZeros(vector<vector<int> >A)
{
int n=A.size();
int m=A[0].size();
int i=0;
int ans=0;
int j=m-1;
while(i... | ALGO | 0.999798 | 6.86173 |
6439d5c5-980b-4b9f-970e-cb68c7317cae | developerNishtha/Cpp-Competitive-Programming- | code forces/1802B.cpp | #include <iostream>
#include <bits/stdc++.h>
#define ll long long
using namespace std;
void nishtha(){
int n;
cin >>n;
int a[n];
for (int i = 0; i < n; i++)
{
cin >>a[i];
}
int known=0,unknown=0,ans=0;
for (int i = 0; i < n; i++)
{
if(a[i]==2){
known+= unknown;
if(known>0) {ans=max(ans,(known+2)/... | ALGO | 0.998894 | 4.867894 |
aa979cbd-8c72-4c97-aeb1-e0cc27e044d8 | owl1753/Algorithm_Study | 2000/2562.cpp | #include <iostream>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int arr[9];
int max;
int cnt = 1;
for (int i = 0; i < 9; i++)
{
cin >> arr[i];
}
max = arr[0];
for (int i = 1; i < 9; i++)
{
if (max <= arr[i])
{
max = arr[i];
cnt = i + 1;
}... | ALGO | 0.999956 | 3.839335 |
a77d63bf-695b-42dc-999c-f8081078e4ef | FanYucai/Pintools | pin-3.2-81205-gcc-linux/source/tools/ManualExamples/d.cpp | #include <cstring>
#include <string.h>
#include <set>
#include <map>
#include <vector>
#include <cassert>
#include <iostream>
#include <iomanip>
#include <fstream>
#include "pin.H"
extern "C" {
#include "xed-interface.h"
}
typedef struct distCount
{
vector<REG> _RregVec;
vector<REG> _WregVec;
struct d... | TOOL | 0.883961 | 5.745364 |
52d6ae8d-0513-49ff-96a1-773b281be527 | flavioc/GoogleInterviews | radix.cpp |
#include <iostream>
#include <cstring>
using namespace std;
static void
radix_sort(int *a, size_t size)
{
if(size == 0)
return;
int largest = a[0];
for(size_t i(1); i < size; ++i)
largest = max(largest, a[i]);
int count[10];
int output[size];
int exp = 1;
while(exp < largest) {
... | ALGO | 0.999801 | 5.463076 |
3f7fc32c-b14d-4542-a52e-c510b6ba33ac | st117205/2023.cpp.autumn | 2023.cpp.autumn.homework/2023.01.10.homework3/task2.cpp | #include <iostream>
int main(int argc, char* argv[]) {
long long n = 0;
std::cin >> n;
while (n % 10 == 0) {
n = n / 10;
}
while (n > 0) {
std::cout << n % 10;
n = n / 10;
}
return EXIT_SUCCESS;
} | ALGO | 0.999462 | 4.888004 |
45f45366-912d-4675-bd5e-06d427ed522e | Prachi3899/6Companies30days | Count the Number of Square-Free Subsets.cpp | class Solution {
public:
int squareFreeSubsets(vector<int>& nums) {
const int MOD = 1e9 + 7;
vector<int> primes = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29};
unordered_map<int, int> primeMask; // Map number to its prime factorization bitmask
// Precompute the prime masks for numbe... | ALGO | 0.999968 | 6.544661 |
4362bd69-eb65-4144-a090-4bab991f7edb | Saipranathi77/Operating-system- | lab pro- 23=scan disk average scheduling.cpp | #include <stdio.h>
#include <stdlib.h>
#define MAX_REQUESTS 1000
int main()
{
int requests[MAX_REQUESTS], num_requests, head_pos, direction, disk_size, total_head_movement = 0;
printf("Enter number of disk requests (max %d): ", MAX_REQUESTS);
scanf("%d", &num_requests);
printf("Enter the requests:\... | ALGO | 0.99991 | 4.367108 |
22e0d2e5-c391-4685-b753-1a3826a6d896 | WL-Sparta6/DSA | leetcode/Medium/633. Sum of Square Numbers/633.cpp | class Solution {
public:
bool judgeSquareSum(int c) {
long long l = 0, r = static_cast<long long>(sqrt(c));
while(l <= r) {
if(l * l + r * r == c) return true;
else if(l * l + r * r > c) r--;
else l++;
}
return false;
}
};
// TC: O(sqrt(c))
/... | ALGO | 0.999917 | 5.701977 |
7a8a7cee-cc5b-4b53-9b1e-ebb739274e03 | saechimdaeki/Solving-ALGORITHM | Boj-CPP/백준 2445번 별찍기-8.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=1; i<=n; i++)
{
for(int a=1; a<=i; a++)
cout<<"*";
for(int a=1; a<=n*2-i*2; a++)
cout<<" ";
for(int a=1; a<=i; a++)
cout<<"*";
cout<<endl;
}
for(int i=1; i<n; i++)
{
for(int a=1; a<=n-i; a++)
cout<<"*";
for(int a... | ALGO | 0.999914 | 3.329456 |
d325413c-8e39-4449-9af0-627ac49a8872 | broccoli-97/libigl | include/igl/copyleft/cgal/triangle_triangle_squared_distance.cpp | template < typename Kernel>
IGL_INLINE bool igl::copyleft::cgal::triangle_triangle_squared_distance(
const CGAL::Triangle_3<Kernel> & T1,
const CGAL::Triangle_3<Kernel> & T2,
CGAL::Point_3<Kernel> & P1,
CGAL::Point_3<Kernel> & P2,
typename Kernel::FT & d)
{
typedef CGAL::Point_3<Kernel> Point_3;
typedef C... | ALGO | 0.999526 | 6.766523 |
08f1bf6e-58f8-48fd-8a9d-024a37a35632 | Alexsandr314/OOP | Указатели/6.cpp | #include <iostream>
#include <clocale>
using namespace std;
int compstr(char* s1, char* s2) {
while (*s1 && *s2) {
if (*s1 < *s2) return -1;
if (*s1 > *s2) return 1;
s1++;
s2++;
}
if (*s1) return 1;
if (*s2) return -1;
return 0;
}
int main() {
setlocale(LC_ALL, ... | ALGO | 0.999465 | 3.726571 |
dd7f86c9-b2b4-4aaf-a215-2ea91690fe96 | ishandutta2007/codeforces | fqw/normal/407/B.cpp | #include <iostream>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <vector>
#include <set>
#include <map>
using namespace std;
#define forint(i, a, b) for(int i=(int)(a); i<=(int)(b); ++i)
#define forintdown(i, a, b) for(int i=(int)(a); i>=(int)(b); --i)
#define forn(i, n) forint(i, 0, (n)-1)
#define... | ALGO | 0.999927 | 3.467612 |
9e47cfb5-f7b8-4534-b6e8-ee783617de17 | Tinyshellzz/leetcode | Q0131. Palindrome Partitioning_1.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <iostream>
using namespace std;
#include <vector>
#include <algorithm>
#include "utils/to_string.h"
class Solution {
vector<vector<string>> ans;
public:
vector<vector<string>> partition(string s) {
string helper =... | ALGO | 0.999724 | 4.192482 |
e3e93f18-3e51-4433-8af1-648d2749d3a3 | arash16/prayers | UVA/vol-102/10229.cpp | /*
>>~~ UVa Online Judge ACM Problem Solution ~~<<
ID: 10229
Name: Modular Fibonacci
Problem: https://onlinejudge.org/external/102/10229.pdf
Language: C++
Author: Arash Shakery
Email: <EMAIL>
*/
#include <math.h>
#include <stdio.h>
#include <iostream>
using namespace std;
#define Long long long
unsig... | ALGO | 0.999944 | 4.134258 |
32320de6-2c84-4355-b2be-413ff8e232c5 | WJ-self/algorithm | .history/acwing/basic/贪心/区间问题/906_区间分组_20230913162245.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 1e5+10;
typedef pair<int,int> PII;
priority_queue<int, greater<int>> pq; //每一组的最右端
PII p[N];
int n,a,b;
int main() {
cin >> n;
for(int i=0; i<n; i++) {
cin >> a >> b;
p[i] = {a,b};
}
sort(p,p+n); //按左端点排序
for(int i=0; i<n; ... | ALGO | 0.999908 | 4.265166 |
a1b93184-98ae-458e-bb89-d079d501abf5 | ishandutta2007/codeforces | sd0061/normal/406/D.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <algorithm>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
using namespace std;
typedef long long LL;
#define N 100005
int n , m;
struct Point {
LL x , y;
P... | ALGO | 0.999991 | 3.768842 |
d7fc8e4f-d039-4fc8-8955-bfde4b9a08cf | facebookarchive/BOLT | llvm/lib/CodeGen/GlobalISel/GISelKnownBits.cpp | #define DEBUG_TYPE "gisel-known-bits"
using namespace llvm;
char llvm::GISelKnownBitsAnalysis::ID = 0;
INITIALIZE_PASS(GISelKnownBitsAnalysis, DEBUG_TYPE,
"Analysis for ComputingKnownBits", false, true)
GISelKnownBits::GISelKnownBits(MachineFunction &MF, unsigned MaxDepth)
: MF(MF), MRI(MF.getRe... | ALGO | 0.990922 | 7.805931 |
9ff2870d-16b3-458f-8d99-de615f9d6f52 | harshalchavan7/Optimized-Algorithms | Sorting/bubbleSort.cpp | #include <iostream>
#include <vector>
using namespace std;
void bubbleSort(vector<int>& arr)
{
for(int i=0;i<arr.size();i++) for(int j=i+1;j<arr.size();j++) if(arr[i]>arr[j]) swap(arr[i],arr[j]);
}
void displayArray(vector<int> arr)
{
for(int i=0;i<arr.size();i++) cout<<arr[i]<<" ";
}
int main()
{
vector... | ALGO | 0.999799 | 5.104764 |
02682aff-2d9f-4766-9423-dd7caeb13bb3 | m-talha/Self-Driving-Car-Udacity | P7-Path-Planning-Project/src/Eigen-3.3/bench/perf_monitoring/gemm/lazy_gemm.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <Eigen/Core>
#include "../../BenchTimer.h"
using namespace Eigen;
#ifndef SCALAR
#error SCALAR must be defined
#endif
typedef SCALAR Scalar;
template<typename MatA, typename MatB, typename MatC>
EIGEN_DONT_INLINE
void lazy_gemm(const MatA &A, const Ma... | ALGO | 0.968949 | 6.117427 |
502c8468-4fbc-4c40-80b7-c8631a70b2e8 | mangoleaves/ErrorImage | GCLF-ImageTriSimp/LinearSimplification/LocalOperations/LEdgeSplitter.cpp | #include "LEdgeSplitter.h"
#include "LinearSimplification/LinearSimplifier.h"
namespace GCLF
{
namespace ImageTriSimp
{
LEdgeSplitter::LEdgeSplitter(LinearSimplifier* _simplifier)
:LLocalOperation(_simplifier)
{}
/// @brief Initialize neccessary data before splitting.
bool LEdgeSplitter::init(EdgeHandle _e, size_t ... | ALGO | 0.980949 | 6.271173 |
c4df07b7-a75e-4bca-bdaa-b4e2dd3a65aa | eyangch/competitive-programming | CSES/Introductory_Problems/grid_paths.cpp | #include <bits/stdc++.h>
using namespace std;
char s[49];
int dx[128], dy[128];
long long vis;
int ans = 0;
char ar[5] = {'L', 'U', 'R', 'D', 'L'};
bool invalid(int x, int y){
return (x < 0 || y < 0 || x >= 7 || y >= 7 || vis&(1LL<<(x+7*y)));
}
int deadend(int x, int y){
if(invalid(x, y)) return 1;
... | ALGO | 0.99987 | 3.749288 |
a0ceb91d-1a34-4e9a-847c-a4680769524c | jesushilarioh/DelMarCSi.cpp | Chapter-7-Arrays/7.6-processing-array-contents/7-13.cpp | //***********************************************************
// This program stores, in an array, the hours worked by
// employee who all make the same hourly wage.
//
// By: JESUS HILARIO HERNANDEZ
// Last Updated: October 26, 2016
//***********************************************************
#include <iostream>
#in... | TOOL | 0.951926 | 5.389532 |
3330ed04-af8f-43a3-a350-d17ec2a9ce07 | ishandutta2007/codeforces | platelet/normal/1726/C.cpp | #include <bits/stdc++.h>
#define rep(i, l, r) for(int i = (l); i <= (r); i++)
#define per(i, r, l) for(int i = (r); i >= (l); i--)
#define mem(a, b) memset(a, b, sizeof a)
#define For(i, l, r) for(int i = (l), i##e = (r); i < i##e; i++)
#define pb push_back
#define eb emplace_back
template<class T> T& cmin(T& a, const... | ALGO | 0.999451 | 3.876614 |
6943dd7c-140a-4cf0-8f8e-9a952743666f | vandreas19/POJ_sol | 3364/2614950_AC_0MS_88K.cpp | #include<iostream.h>
void main()
{
while(true)
{
int row,column,corner;
cin>>row>>column>>corner;
if(row==0)
break;
cout<<((row-7)*(column-7)+corner)/2<<endl;
}
}
| ALGO | 0.997891 | 3.147671 |
8ed94ec6-0311-4756-a4c9-e340355368c5 | shawonkst21/OS_Lab | algorithm/FCFS.cpp | #include<bits/stdc++.h>
using namespace std;
struct process
{
int id;
int arrival_time;
int burst_time;
int completion_time;
int waiting_time;
int turnaround_time;
};
void calculate_COmpletion_time(vector<process> &p,int n)
{
p[0].completion_time=p[0].arrival_time+p[0].burst_time;
for(in... | ALGO | 0.999987 | 4.521283 |
474b2624-c520-4ee9-b918-ab47f8dcb9c6 | mendoncagary/self-driving-car | project_10_MPC_control/src/Eigen-3.3/test/sparse_permutations.cpp | static long int nb_transposed_copies;
#define EIGEN_SPARSE_TRANSPOSED_COPY_PLUGIN {nb_transposed_copies++;}
#define VERIFY_TRANSPOSITION_COUNT(XPR,N) {\
nb_transposed_copies = 0; \
XPR; \
if(nb_transposed_copies!=N) std::cerr << "nb_transposed_copies == " << nb_transposed_copies << "\n"; \
VERIFY( (#XPR... | TEST | 0.903911 | 6.2616 |
44e6e443-5672-4d39-94dc-8c45f2988087 | bradactis/cpp-matrix | example/example.cpp | #include <iostream>
#include "mathLib/matrix.hpp"
#include "mathLib/vector.hpp"
int main() {
//we start by creating our first matrix via the provided Matrix class, lets name it 'A' and give it size 3x3
matrix::Matrix A = matrix::Matrix(3,3);
//now this matrix is empty
// [0 0 0]
// [0 0 0]
//... | ALGO | 0.994657 | 4.385896 |
fdff9a8c-c37e-4c4a-ab8a-becde7edfe2d | colour-y/algorithm-2025_with_coloury | 2025/杭电春季联赛6/英逃.cpp | #include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define deb(...) 114514
#endif
const char nl = '\n';
typedef long long ll;
typedef long double ld;
using i64 = unsigned long long;
using i32 = unsigned;
using i128 = unsigned __int128;
#define all(x) (x).begin(), (x).end()
void s... | ALGO | 0.999977 | 5.301466 |
8ade94af-8e2f-412a-b961-5f8d8a14d2a4 | bbulkow/FastLED-idf | components/FastLED-idf/bitswap.cpp | #define FASTLED_INTERNAL
#include "FastLED.h"
/// Simplified form of bits rotating function. Based on code found here - http://www.hackersdelight.org/hdcodetxt/transpose8.c.txt - rotating
/// data into LSB for a faster write (the code using this data can happily walk the array backwards)
void transpose8x1_noinline(un... | ALGO | 0.995505 | 5.098794 |
f87ae75f-9f3b-4899-8296-492f0e2a2b50 | priyasahu22/lab-5-continue | lab5_qn23.cpp | #include<iostream>
using namespace std;
// to show the number in reverse order
int main()
{
int n,i;
cout<<"program to show the number in reverse order:";
cout<<"\nfrom where u want to print:";
cin>>n;
i=n;
while(i>0)
{
cout<<i<<endl;
i--;
}
return 0;
}
| ALGO | 0.998834 | 3.008585 |
a1b9d430-08bd-4d7a-9166-e6223a90ba02 | nickchen111/Leetcode | Binary_Search/3296. Minimum Number of Seconds to Make Mountain Height Zero.cpp | /*
3296. Minimum Number of Seconds to Make Mountain Height Zero
*/
// 二分 TC:O(nlgU) SC:O(1) U≤ 5⋅10^15是二分上界
class Solution {
using LL = long long;
public:
long long minNumberOfSeconds(int mountainHeight, vector<int>& workerTimes) {
auto check = [&](LL mid)->bool{
LL left_h = mount... | ALGO | 0.99999 | 6.126259 |
4c569779-6a22-4a02-a052-64d804e95a36 | KAYTERDOESTHINGS/Cpp-Practice | KTLT-Baitap/Chuong3/Bai8Chuong3.cpp | #include<iostream>
using namespace std;
void nhap(int &a);
void xuat(int a);
int xuLy(int a);
int main()
{
int a;
nhap(a);
int kq=xuLy(a);
xuat(kq);
return 0;
}
void nhap(int &a)
{
cin>>a;
}
int xuLy(int a)
{
double s=0;
int n=1;
while(s<=a)
{
s += 1.0/(double)n;
if(s>a)
break;
n++;
}
return ... | ALGO | 0.999811 | 3.460825 |
b0017a5a-2dc2-43d1-9a88-f732bd5c3ce1 | Andrew-Velox/XPSC | WEEK - 03/DAY - 06/A_Compare_T_Shirt_Sizes.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define vc vector<char>
#define pi pair<int,int>
#define pll pair<ll,ll>
#define srt(v) sort(v.begin(),v.end())
#define grtsrt(v) sort(v.begin(),v.end(),greater<ll>())
#define rev(v)... | ALGO | 0.999984 | 4.580207 |
e52ce663-8a79-48a7-9957-76974ab0639b | Anu0825/DSA | bit manipulation/clear_ith_bit.cpp | //if ith bit is zero then reamin as it is if 1 convert to 0
#include<iostream>
using namespace std;
int main(){
int n,bit;
cout<<"enter n:";
cin>>n;
cout<<"enter bit:";
cin>>bit;
n=n&(~(1<<bit));
cout<<n<<endl;
} | ALGO | 0.998122 | 3.66677 |
74a050a7-3f0c-44e5-affb-927a6c408eae | allem40306/Competitive-Programming | atcoder/abc140F.cpp | /*
source: ABC 140 F Many Slimes
*/
#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> v, w;
bool sol()
{
map<int, int, greater<int>> tb;
for(int i = 1; i != (int) v.size(); ++i)
{
if(tb.find(v[i]) == tb.end())
{
tb[v[i]] = 0;
}
++tb[v[i]];
}
... | ALGO | 0.999997 | 4.072053 |
9af94aa4-8ad9-4651-8acb-604a235c4c13 | andi611/Hidden-Markov-Model-Digital-Signal-Processing | src/hmm.cpp | #include "hmm.h"
#include <string.h>
using namespace std;
/************************************/
/* class HMM Functions */
/************************************/
void HMM::initialize_HMM()
{
_initial = vector<double> (MAX_STATE, FLT_MAX);
_transition = vector<vector<double>>(MAX_STATE, vector<double>(M... | ALGO | 0.971259 | 4.617646 |
efe9018c-ba12-4427-b6a7-222186ea41ec | Phanthuanthanh/Phanthuanthanh_ENGKS24B_C_Session-10 | Session 10_Lesson 09.cpp | #include <stdio.h>
int main() {
int n;
printf("Moi ban nhap so dong va so cot: ");
scanf("%d", &n);
int arr[n][n];
printf("Moi ban nhap cac phan tu cua mang:\n");
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
printf("[%d][%d]: ", i, j);
scanf("%d... | ALGO | 0.999883 | 3.80915 |
f3c70f46-c8d1-40eb-acf4-6cacfc026ca2 | denisprytov/BioInformatics | 1.3 Reverse Complement Problem/main.cpp | #include <iostream>
#include <string>
using namespace std;
int main()
{
string s1 = "", s2 = "";
cin >> s1;
size_t size = s1.size();
for (size_t i = 0; i < size; i++)
{
switch(s1[i])
{
case 'A':{
s1[i] = 'T';
break;
}
... | ALGO | 0.999828 | 5.351809 |
09183e36-f8d1-4e9a-bad5-b6b852b9b665 | Mahmoud-Ameen/Problem_Solving | Dynamic Programming/Codeforces 456C Boredom.cpp | //
// Problem link: https://codeforces.com/contest/456/problem/C
//
#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> points;
int main(){
cin >> n;
points.resize(n);
for (int i = 0; i < n; ++i)
cin>>points[i];
sort(points.begin(),points.end());
vector<vector<long long>> d... | ALGO | 0.99998 | 4.477898 |
77d26ebd-378b-418e-9c1c-8f838d92b781 | CongJyu/my-Codeforces-contest | 705A/main.cpp | // codeforces 705a
#include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(false);
int n{};
cin >> n;
for (int i{}; i < n; ++i) {
if (i % 2 == 0) {
cout << "I hate ";
} else {
cout << "I love ";
}
if (i != n - 1) {
... | ALGO | 0.999853 | 4.124108 |
77dd8829-b89d-4a7c-b3c0-68daf6fdd6f2 | phumipatc/C_Competitive_Programming | C++ - 2561/Camp 2/String_Matching_Algorithm/Oh_My_God_KMP.cpp | /*
Author : Phumipat C.
School : RYW
Language: C++
*/
#include<bits/stdc++.h>
using namespace std;
char a[1000010],b[1000010];
int KMP[1000010];
int main(){
int lena,lenb,j = 0;
scanf(" %s %s",a+1,b+1);
lena = strlen(a+1),lenb = strlen(b+1);
for(int i=2;i<=lenb;i++){
while(j>0 && b[j+1]!=b[... | ALGO | 0.999946 | 3.110271 |
78f83078-0ca9-4355-b67f-1ae16a980fc1 | KhoaText/Khoa-s-CODESTORAGE | GRAPHHHHHH/basic/matranketodske.cpp | #include <bits/stdc++.h>
using namespace std;
#define MOD (ll)(1e9+7)
#define pb(n) push_back(n)
#define fi first
#define se second
#define print(a) cout<<(a)<<"\n";
typedef long long ll;
typedef long double ld;
ll n;
ll ds[1001][1001];
int main(){
//freopen(".INP", "r", stdin);
//freopen(".OUT", "w", stdout);... | ALGO | 0.998693 | 3.078422 |
c972e25e-7841-4d1f-ac81-1a222dbeb5d8 | AbhayDixitDev/cpp-cybrom | 3 june 24/for_loop_question_12_factorial_of_given_number.cpp | //Write a program to find the factorial value of any number
#include<iostream>
using namespace std;
int main()
{
int n,facto=1;
cout<<"enter a number for factorial value :";
cin>>n;
for(int i=n;i>=1;i--){
facto=facto*i;
}
cout<<"factorial of "<< n<<" is :"<< facto;
}
| ALGO | 0.999933 | 3.546332 |
b9f92f44-1467-4ad5-b5bf-5f750a9af6cc | WilliamX1/leetcode | Solutions/Power-of-Four.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
bool isPowerOfFour(int n)
{
while (n > 0)
{
if (n % 4 == 0)
n /= 4;
else
break;
};
return n == 1;
}
}; | ALGO | 0.998963 | 5.203062 |
38da4b9a-e569-4288-8ad6-eb750ba7fc39 | vuicoin-project/vui-bitcore | src/coins.cpp | #include "coins.h"
#include "consensus/consensus.h"
#include "memusage.h"
#include "random.h"
#include <assert.h>
bool CCoinsView::GetCoin(const COutPoint &outpoint, Coin &coin) const { return false; }
bool CCoinsView::HaveCoin(const COutPoint &outpoint) const { return false; }
uint256 CCoinsView::GetBestBlock() con... | TOOL | 0.876435 | 7.52615 |
35313710-93b0-40ad-b933-8efc0a075a4c | rvnSenkuuu/cpp-modules | cpp09/ex02/PmergeMe.cpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* PmergeMe.cpp :+: :+: :+: ... | ALGO | 0.997927 | 5.050827 |
b4015acc-8a4b-46bb-9fb9-28091feb53aa | JeongHyeon-Kim/Algorithms | Interview Preparation Kit/Trees/Tree - Height of a Binary Tree.cpp | // problem source: https://www.hackerrank.com/challenges/tree-height-of-a-binary-tree/problem
#include <bits/stdc++.h>
using namespace std;
class Node {
public:
int data;
Node *left;
Node *right;
Node(int d) {
data = d;
left = NULL;
right = NULL;... | ALGO | 0.999887 | 6.109101 |
5f190609-01fa-4fa0-94b3-e2b9905d7079 | ishandutta2007/codeforces | baba/normal/721/D.cpp | //Tanuj Khattar
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> II;
typedef vector< II > VII;
typedef vector<int> VI;
typedef vector< VI > VVI;
typedef long long int LL;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define SZ(a) (int)(a.size())
#define AL... | ALGO | 0.999965 | 3.004956 |
86c14f77-6671-459e-be37-1b380ebc8a99 | fuuzen/parallel-programming | lab2/lib/verify.cpp | #include "lib.h"
#include <cmath>
void serial_matrix_mult(double *A, double *B, double *C_serial, int m, int n, int k) {
for (int i = 0; i < m; i++) {
for (int j = 0; j < k; j++) {
C_serial[i * k + j] = 0.0;
for (int p = 0; p < n; p++) {
C_serial[i * k + j] += A[i * n + p] * B[p * k + j];
... | ALGO | 0.99605 | 4.539772 |
117d54f4-8d1b-4c59-9855-802c1f1262c2 | chandank013/CPP-Course-Practice | Practice/PointerArithmitic112.cpp | #include <iostream>
using namespace std;
int main()
{
int A[5]={2,4,6,8,10};
int *p=A,*q=&A[4];
cout<<*p<<endl;
cout<<endl;
p++;
cout<<*p<<endl;
cout<<endl;
p--;
cout<<*p<<endl;
cout<<endl;
cout<<p<<endl;
cout<<p+2<<endl;
cout<<endl;
cout<<*p<<e... | ALGO | 0.992464 | 3.053437 |
2ebf5229-a585-40a1-bbfc-6ddb7356c778 | ishandutta2007/codeforces | geniucos/normal/679/C.cpp | #include<bits/stdc++.h>
using namespace std;
int best, nr, curr, N, K, to_rem[2016], ap[509][509], sz[250009], ap2[250009], ap3[250009];
char sir[509][509];
int dx[] = {-1, 1, 0, 0};
int dy[] = {0, 0, -1, 1};
bool DEB = 0;
void dfs (int i, int j)
{
ap[i][j] = nr, sz[nr] ++;
for (int k=0; k<4; k++)
if... | ALGO | 0.999815 | 3.082979 |
dd32a1e0-ab17-4f8b-a03c-714e91dfa152 | ishandutta2007/codeforces | marckess/normal/623/B.cpp | #include <bits/stdc++.h>
#define endl '\n'
#define fi first
#define se second
#define MOD(n,k) ( ( ((n) % (k)) + (k) ) % (k))
#define forn(i,n) for (int i = 0; i < n; i++)
#define forr(i,a,b) for (int i = a; i <= b; i++)
#define all(v) v.begin(), v.end()
#define pb push_back
using namespace std;
typedef long long ... | ALGO | 0.999967 | 3.840219 |
c51f266e-9081-4226-b724-ad7838331c60 | ishandutta2007/codeforces | pavement/normal/1287/C.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
int N, evcnt, oddcnt, arr[105], mem[105][105][105][2];
bool h[105];
int dp(int n, int a, int b, bool p) {
if (a < 0 || b < 0) return 1e9;
if (n == N) return 0;
if (mem[n][a][b][p] != -1) return mem[n][a][b][p];
int r;
if (arr[n] && n) r = dp(n +... | ALGO | 0.999996 | 4.330628 |
d21cdc8d-4b94-4943-a5ac-71bcc6fc85d3 | sharma-anubhav/cppCode | lcs.cpp | /******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, OCaml, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run a... | ALGO | 0.999978 | 4.962798 |
64275c17-cfcd-4043-9ff2-3d06069a3d0e | MANISHDUTT224/GeeksForGeeks | Difficulty: Medium/Look and Say Pattern/look-and-say-pattern.cpp | //{ Driver Code Starts
// Initial template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
string countAndSay(int n) {
// code here
string prev="1",next;
for(int i=2;i<=n;i++){
int count=1;
int len=prev.size();
... | ALGO | 0.999398 | 6.837846 |
88d0c7af-4026-4fda-a216-291c0116a4ce | Cysheper/ACM-Note | 基础算法/递归/P1010.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
// #define int ll
void dfs(int x) {
while(x != 0) {
int num = 0;
while(pow(2, num) <= x) num ++;
num --;
cout << 2;
if(num == 0 || num == 2) {
cout << "(" << num << ")";
x -= pow(2, n... | ALGO | 0.998639 | 5.03122 |
523b2d87-2347-495e-9a08-586381597898 | cdegree/ACM | 日常/7-21/H.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cctype>
#include <vector>
#include <stack>
#include <queue>
#include <map>
#include <algorithm>
#include <iostream>
#include <string>
#include <set>
#define X first
#define Y second
using namespace std;
typedef long long LL ;
const int... | ALGO | 0.99995 | 3.39199 |
118e4bdc-82cd-4829-9d6a-db80712296f7 | aplecom/SAPR | SAPR(SPO)/temp_code.cpp | #include <iostream>
using namespace std;
int main()
{
int i = 5;
while ( i > 0 )
cout << ++i << endl;
return 0;
}
| ALGO | 0.991738 | 3.054623 |
5c870bce-927a-418c-9fc7-b84a4e2f67b1 | liyansong0015/c-primer | Unit12/test12_6.cpp | #include<iostream>
#include<vector>
using namespace std;
vector<int> * fun()
{
return new vector<int> ();
}
void fun1(vector<int> *q)
{
int in=0;
while(cin>>in)
q->push_back(in);
}
void fun2(vector<int> * q)
{
for(int i=0;i<q->size();i++)
{
cout<<(*q)[i]<<endl;
}
}
int main()
{
auto test=fun();
fun1(t... | ALGO | 0.99628 | 3.64883 |
36fee0e1-4a6e-4687-ad78-607cef98469a | ANDRmark/Practice2017Ess | Chapter2/labs2.3/Lab2.3.19(2)/Lab_2_3_19(2).cpp | #include <iostream>
using namespace std;
int main()
{
double pi4 = 0.;
long n;
cout << "Number of iterations? ";
cin >> n;
for (long i = 1; i <= n; i++)
{
pi4 += (i % 2 * 2 - 1) * 1.0 / (i * 2 - 1);
}
cout.precision(20);
cout << "Pi = " << (pi4 * 4.) << endl;
system("pause");
return 0;
} | ALGO | 0.99969 | 3.853097 |
d2f679b9-c578-427f-bf0d-11f9204826d4 | Ian-Codding-II/CS150 | Quiz/TestForFinal/findUnique.cpp | #include <iostream>
#include <vector>
using namespace std;
int unique(int arr[], int size);
int main()
{
int arr[] ={1, 2, 3, 4, 2, 4, 1};
int size = sizeof(arr) /sizeof(arr[0]);
cout << unique(arr, size) << endl;
}
int unique(int arr[], int size) {
for (int i = 0; i < size; i++) {
int count... | ALGO | 0.999408 | 5.407286 |
50d5f48f-f32d-4335-92a9-58f021ed6c25 | sharath101/cp-templates | String Hashing Rabin_Karp.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define mp make_pair
#define deb(x) cout<< #x << " " << x << "\n";
#define MAX 9223372036854775807
#define MIN -9223372036854775807
#define PI 3.141592653589
#define setbits(n) __builtin_popcountll(n)
#define mkunique(a) a.resiz... | ALGO | 0.999992 | 4.162791 |
3f3c5bf4-fc63-4325-aefe-bce4bf56dc17 | Tahsin-Zaman-Jilan/Codeforce-Solutions-By-ZIlanJaman | Smaller than the element.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
long long int tcase,A;
set<long long int>s{-1};\
cin>>tcase;
for(int i=0;i<tcase;i++){
cin>>A;
s.insert(A);
auto it=--s.lower_bound(A);
cout<<*it<<"\n";
}
}
| ALGO | 0.999908 | 3.858468 |
f41cca23-952e-4ded-9c99-79e8d429ce66 | joaovritter/algoritmos | Operação Conjuntos - 27.10/trabalho.cpp | #include <iostream>
#include <unordered_set>
#include <sstream>
using namespace std;
typedef unordered_set<int> Conjunto; // Definindo um tipo para representar conjuntos de inteiros
// Função para imprimir os elementos de um conjunto
void imprimirConjunto(Conjunto conjunto) {
cout << "{ ";
for (auto elemento... | ALGO | 0.993499 | 5.763436 |
aa30703b-0754-4418-bdc4-fead9d0037d8 | AlgoHacker3112/CP | CF/A4.cpp | /**
* author: AlgoHacker3112
* created: 2022-11-03 14:01:43
**/
#include <bits/stdc++.h>
#define all(a) begin(a),end(a)
#define ll long long
using namespace std;
#ifdef DEBUG
#include <bits/debug.h> // replace with your path
#else
#define debug(x)
#endif
int32_t main(){
ios_base::sync_with_stdio(false);
... | ALGO | 0.999932 | 4.432405 |
db6ff984-44ae-4535-bd7e-35f7082f3978 | PrinceWang-Cal/p4-clothsim | ext/nanogui/ext/eigen/demos/mandelbrot/mandelbrot.cpp | #include "mandelbrot.h"
#include <iostream>
#include<QtGui/QPainter>
#include<QtGui/QImage>
#include<QtGui/QMouseEvent>
#include<QtCore/QTime>
void MandelbrotWidget::resizeEvent(QResizeEvent *)
{
if(size < width() * height())
{
std::cout << "reallocate buffer" << std::endl;
size = width() * height();
i... | ALGO | 0.862775 | 5.79494 |
354eb703-312c-4bf9-8879-a3bffe47e683 | mohit701473/cpp | DSA Questions/Topic - 16 DP/Step 5 - DP on Stocks/Que2_buyAndSellStockPart2.cpp | // LeetCode -> 122. Best Time to Buy and Sell Stock II
https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii/
// Approch -> 1: recursion
// T.C. = O(2^N)
// S.C. = O(N)
class Solution {
int solve(int idx, int buy, vector<int> prices){
// bases cases
if(idx >= prices.size())
... | ALGO | 0.999842 | 6.310967 |
809b1675-5688-4437-a123-cf5266721e37 | 220001002AG/CS254 | DSA_assignment/assignment7/question2/greedy.cpp | #include <bits/stdc++.h>
using namespace std;
#include <fstream>
struct Job
{
char id;
int dead;
int profit;
};
struct jobProfit
{
bool operator()(Job const &a, Job const &b)
{
return (a.profit < b.profit);
}
};
void JobScheduling(Job arr[], int n)
{
vector<Job> result;
sort(ar... | ALGO | 0.999976 | 4.59902 |
133bdb23-2e30-4d2e-bc54-1ff3953ea196 | randbatch-md/lammps-rbe | src/compute_chunk_spread_atom.cpp | // clang-format off
#include "compute_chunk_spread_atom.h"
#include "arg_info.h"
#include "atom.h"
#include "compute.h"
#include "compute_chunk_atom.h"
#include "error.h"
#include "fix.h"
#include "memory.h"
#include "modify.h"
#include "update.h"
#include <cstring>
using namespace LAMMPS_NS;
/* ------------------... | TOOL | 0.963866 | 7.22225 |
394dc331-0076-4cab-998c-c921b4e6f8c7 | MaazCodeCraft/c_plusplus_course | Fundamental Programming/Leacture_002/5_Sum_Of_Numbers_1-to-Nth_term.cpp | #include <iostream>
using namespace std;
int main() {
int n;
cout << "Enter the value of nth : ";
cin >> n;
int i = 1;
int sum = 0;
while(i <= n) {
sum = sum + i;
i = i + 1;
}
cout << "Sum of nth numbers = " << sum << endl;
}
| ALGO | 0.996155 | 4.194042 |
e13dd442-d9e5-4969-a426-496ddeec26f2 | Taejin1221/Problem-Solving | Baekjoon/Baekjoon20047.cpp | // Baekjoon20047.cpp
// https://www.acmicpc.net/problem/20047
#include <iostream>
#define SIZE 10'001
using namespace std;
int main(void) {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
char strS[SIZE], strT[SIZE];
cin >> strS >> strT;
int c1Idx, c2Idx;
cin >> c1Idx >> c2Idx;
char co... | ALGO | 0.999997 | 4.396395 |
9c0d812e-9ff3-4501-aaf0-cf5bda8579fa | Shahidul-Islam-Jony/OLD_CPP_Code | Data Structure & C & Cpp PS/M(31-3) Construct a Binary tree using Pre and In order traversal.cpp | #include<bits/stdc++.h>
using namespace std;
class treeNode{
public:
int data;
treeNode *leftChild;
treeNode *rightChild;
treeNode(int value){
data=value;
leftChild=NULL;
rightChild=NULL;
}
};
void printTree(treeNode* root,int level);
void spacePrint(int level);
void inOrde... | ALGO | 0.999996 | 4.987851 |
23caf3d6-e4b7-4495-b354-cd3f0ec09bbf | superQCman/Chiplet_Heterogeneous_newVersion_old | gpgpu-sim/src/intersim2/gputrafficmanager.cpp | #include <sstream>
#include <fstream>
#include <limits>
#include "gputrafficmanager.hpp"
#include "interconnect_interface.hpp"
#include "globals.hpp"
GPUTrafficManager::GPUTrafficManager( const Configuration &config, const vector<Network *> &net)
:TrafficManager(config, net)
{
// The total simulations equal to num... | TOOL | 0.924793 | 5.119153 |
45459db5-509b-4d89-8979-af6d0078e17d | saipreetam55555/cpp_codes | 8 (Friend Functions)/ComplexAdd8.cpp | #include <iostream>
using namespace std;
class Complex
{
float re, im; // Real and imaginary parts of the complex number
public:
// Constructor to initialize real and imaginary parts
Complex()
{
re = 0;
im = 0;
}
// Friend function to add two complex numbers
friend Com... | ALGO | 0.996059 | 5.14615 |
df224cb3-21e9-422b-9428-0cf0b0bb6d34 | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/Year2021/January/FairElections_20210101171738.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#define vv vector
#define F first
#define S second
#define MP make_pair
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define printM... | ALGO | 0.999996 | 3.212375 |
b8087bbd-c43f-4125-9f3c-98e3c3bc1e79 | AndroidBBQ/android10 | frameworks/av/media/libaudioprocessing/AudioResamplerCubic.cpp | #define LOG_TAG "AudioResamplerCubic"
#include <stdint.h>
#include <string.h>
#include <sys/types.h>
#include <log/log.h>
#include "AudioResamplerCubic.h"
namespace android {
// ----------------------------------------------------------------------------
void AudioResamplerCubic::init() {
memset(&left, 0, size... | ALGO | 0.931734 | 6.907433 |
e8662cd1-f459-4336-8b91-de52dc7bc77e | yash-gargji/codeforces-solution | D_Petya_and_Array.cpp | // #include<bits/stdc++.h>
// using namespace std;
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/tree_policy.hpp>
// using namespace __gnu_pbds;
// #define ordered_set tree<long long, null_type,less_equal<long long>, rb_tree_tag,tree_order_statistics_node_update>
// int main(){
// long ... | ALGO | 0.999915 | 4.613398 |
afeaf123-b7aa-4761-a2e4-6746dc726ef6 | ishandutta2007/codeforces | user202729_/normal/1242/A.cpp | #ifndef LOCAL
#define NDEBUG
#endif
#include<cassert>
#include<iostream>
int main(){
std::ios::sync_with_stdio(0);std::cin.tie(0);
int64_t n;std::cin>>n;
for(int64_t j=2;j*j<=n;++j){
if(n%j==0){
do
n/=j;
while(n%j==0);
if(n==1)
std::cout<<j<<'\n';
else
std::cout<<"1\n";
return 0;
}
}... | ALGO | 0.999997 | 4.690248 |
a3fb78c2-2921-4d14-b5c0-1496cb929521 | mohammad-abdollahi/algorithm | CodeForces/Given Length and Sum of Digits.cpp | #include <iostream>
#include <string.h>
using namespace std;
int main()
{
int m,s, t, i;
cin>>m>>s;
string a, b;
if (s == 0)
{
cout << (m == 1 ? "0 0" : "-1 -1") << endl;
return 0;
}
for (i = 0; i < m; i++)
{
t = min(s, 9);
b += t + '0';
s ... | ALGO | 0.999915 | 4.150921 |
970816c0-db45-4a8c-b2f9-a4776cf452f3 | sallyshin/2020_2_OOP_week13 | week13/실습2.cpp | #include <iostream>
#include <string>
auto sum() {
return 0;
}
template<typename T, typename...Args>
auto sum(T x, Args... args) {
return x + sum(args...);
}
int main() {
auto x = sum(42.5, 10, 11.1f);
std::cout << x;
getchar();
} | ALGO | 0.962113 | 4.048215 |
003d4565-b03f-4955-a5ea-3fb12c03e772 | big-quantum/all_code | code/dance.cpp | #include<bits/stdc++.h>
using namespace std;
string s;
bool yes = true;
int main(){
cin >> s;
for(int i = 0;i < s.size();i++){
if (i % 2 == 0 && s[i] == 'L'){
yes = false;
break;
}
if (i % 2 == 1 && s[i] == 'R'){
yes = false;
break;
}
}
if (yes)
cout << "Yes" << endl;
else
cout << "No" ... | ALGO | 0.999989 | 3.94381 |
17fe7b81-db62-4b51-bd52-bc89bb4cacbf | skypaul100/CP-Problems | Recursion/12.Calculate Power using Recursion(extra).cpp | int power(int a, int b) // a ^ b
{
//base
if(b==0)
return 1;
if(b==1)
return a;
//recursive call
int ans= power(a,b/2);
//if b is even
if(b%2 == 0)
{
return ans*ans;
}
//if b is odd
else{
return a*ans*ans;
}
}
| ALGO | 0.999699 | 3.774696 |
ed9e95b8-6cb5-4991-be38-e2c175bdfb97 | KarthickPrabhakaran99/Data-Structure | Untitled1.cpp | #include<stdio.h>
#include<stdlib.h>
#define size 7
struct node{
int data;
struct node *next;
} *chain[size];
int hash(int num,int size)
{
struct node *temp,*head;
int index=num%size;
if(chain[index]==NULL)
{
head=(struct node *)malloc(sizeof(struct node));
head->data=num;
head->next=NULL;
chain[index]... | ALGO | 0.999587 | 3.321089 |
f1b0f6c2-e6db-408e-987e-57d77092e978 | dhkimxx/Baekjoon | c++/1149.cpp | #include <iostream>
using namespace std;
int min(int a, int b) {
return(a < b ? a : b);
}
int main() {
int N; cin >> N;
int weight[3][1000];
for (int i = 0; i < N; i++) {
for (int j = 0; j < 3; j++) {
cin >> weight[j][i];
}
if (i == 0)continue;
weight[0][i] += min(weight[1][i - 1], weight[2][i - 1]);
... | ALGO | 0.999873 | 3.798689 |
00dbc5b6-6b05-49a2-b116-490cc2e8ac2c | Anujkesarwani1/DSA-Solutions | Strings/Easy/MaxDepth.cpp | // Coding Ninjas
// Maximum Nesting Depth Of The Paraentheses
// Input: S = '1+(3*6+(9-3))'
// Output: 2
int maxDepth(string s)
{
int cnt = 0, maxCnt = 0;
for (int i = 0; i < s.size(); i++)
{
if (s[i] == '(')
cnt++;
else if (s[i] == ')')
cnt--;
maxCnt = max(... | ALGO | 0.996997 | 4.302178 |
e06e9d7b-5311-4160-986b-93bc45a24ad5 | open-problem-solving/baekjoon | 04/20254/root2.cpp | #include <iostream>
using namespace std;
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
#define INT32_INF 0x3f3f3f3f
#define INT64_INF 0x3f3f3f3f3f3f3f3f
#define LOG2_10_4 14
#define LOG2_10_5 17
#define LOG2_10_6 20
void
solve (void)
{
int U_R, T_R, U_O, T_O;
cin >> U_R >> T_R >> U_O >> T_O;
co... | ALGO | 0.999385 | 3.837702 |
b3be97b7-433d-4573-b982-aaf60f2a02ae | shaonlipal2468/DSA | love_babbar_450/matrix/median_in_row_wise_Sorted_matrix.cpp | #include<bits/stdc++.h>
using namespace std;
int counter(vector<vector<int>> v,int mid)
{
int row = v.size();
int col = v[0].size();
int count=0;
for(int i=0;i<row;i++)
{
for(int j=col-1;j>=0;j--)
{
if(v[i][j]<=mid)
{
count+=j+1;
break;
}... | ALGO | 0.999992 | 5.532445 |
a48ce4f2-efb9-4154-a777-ccdf7c03a893 | neilkimn/stream_hash | src/stream_hash.cpp | #include <stdint.h>
#include <hls_stream.h>
#include <string.h>
#include <constants.h>
#include <ap_int.h>
#include <ap_axi_sdata.h>
typedef ap_axiu<200,0,0,0> datap;
bool krnl_cmp(char* target, char* source, unsigned int offset, size_t SIZE){
unsigned int is_eq = 1;
krnl_cmp:
for (int i = 0; i < SIZE; i++) {
... | ALGO | 0.989267 | 4.882341 |
f8413113-aa25-46f3-a904-6f431ddcd607 | sarvex/leetcode-free-basic | solution/2500-2599/2561.Rearranging Fruits/Solution.cpp | class Solution {
public:
long long minCost(vector<int>& basket1, vector<int>& basket2) {
int n = basket1.size();
unordered_map<int, int> cnt;
for (int i = 0; i < n; ++i) {
cnt[basket1[i]]++;
cnt[basket2[i]]--;
}
int mi = 1 << 30;
vector<int> nu... | ALGO | 0.999985 | 5.260447 |
74777a72-9fbb-4494-8dc1-82d44f008c0b | LemuriaX/luogu | 奖学金.cpp | #include<bits/stdc++.h>
using namespace std;
struct stu{
int no;
int yw;
int math;
int eng;
int sum;
};
bool cmp(stu a,stu b){
if(a.sum<b.sum){
return true;
}
else if(a.sum == b.sum){
if(a.yw < b.yw){
return true;
}
else if(a.yw == b.yw){
if(a.no > b.no){
return true;
}
}
}
return fals... | ALGO | 0.999812 | 3.279929 |
e5011cf7-abb5-4644-8fb3-9542e9847665 | EhsanulHaqueSiam/DSA-practice | Data Structure/Stack/Parenthesis Problems/ExtendedBalancedParenthesisUsingSTLStack-Map.cpp | #include <iostream>
#include<cstring>
#include <stack>
#include <map>
using namespace std;
int isBalanced(char* exp){
// Create map
map<char, char> mapping;
mapping['}'] = '{';
mapping[')'] = '(';
mapping[']'] = '[';
// Create map iterator
map<char, char>::iterator itr;
// Creat... | ALGO | 0.978138 | 5.452903 |
bf65dfb8-6204-4f77-9c7d-136f10ad3474 | anupma-Kumari57/Daily-LeetCode-Practise | 0796-rotate-string/0796-rotate-string.cpp | class Solution {
public:
bool rotateString(string s, string goal) {
if(s.size()!=goal.size()){
return false;
}
string temp=s+s;
if(temp.find(goal)!=string::npos){
return true;
}
return false;
}
}; | ALGO | 0.999977 | 5.746818 |
06cb86db-aa09-43cc-b945-e7629eb84bb0 | varunmehra1661/CB-classroom | stacks-queues/Queues/QueueSTL.cpp | #include <bits/stdc++.h>
using namespace std;
void reverse(queue<int> &q)
{
if (q.empty())
{
return;
}
int data = q.front();
q.pop();
reverse(q);
q.push(data);
}
void print(queue<int> &q)
{
while (!q.empty())
{
cout << q.front() << " ";
q.pop();
}
c... | ALGO | 0.999708 | 4.952332 |
e9a4f72e-71ba-4499-b343-f0665d392f25 | rainhope-c/Data-struction | data_structure/sort/base/insert_sort.cpp | //注意这些代码的排序结果都是递增排列
//插入排序
//插入排序的总体思路是把待排序区分为有序区和无序区 然后按照一定的顺序把无需求的东西插入到有序区中
//插入排序包括直接插入排序 折半插入排序和希尔排序等
#include <iostream>
#include <vector>
using namespace std;
//直接插入排序
//每次从无序区拿出第一个元素放在有序区的相应位置 进行n-1次排序
void InsertSort(vector<int>&R,int n) //直接插入排序
{
for(int i=0;i<n;i++)
{
if(R[i]<R[i-1]) ... | ALGO | 0.999958 | 4.559929 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.