uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
f2fd6fc6-20a7-4a40-a758-ff7f065b68ba | garyellow/LC-GFG-solution | 2131-longest-palindrome-by-concatenating-two-letter-words/2131-longest-palindrome-by-concatenating-two-letter-words.cpp | class Solution {
public:
int longestPalindrome(vector<string>& words) {
map<string, int> record;
int cnt = 0;
for(auto &&word : words) {
string r({word.rbegin(), word.rend()});
if(record[r]) {
cnt += 4;
record[r]--... | ALGO | 0.999981 | 5.954134 |
a0aa5a4d-8922-4e9c-bf1b-7159d12b6c22 | TiChuot97/Codeforces | 1198A.cpp | #include <iostream>
#include <algorithm>
#include <map>
#include <cmath>
using namespace std;
const int maxN = 4e5 + 10;
int a[maxN], m, n, res;
map < int, int > mmap;
void remove(int x) {
if (--mmap[x] == 0) mmap.erase(x);
}
int csize() {
return n * ceil(log2(1.0l * mmap.size()));
}
bool dnf() {
retu... | ALGO | 0.999978 | 3.976232 |
70aae10c-2713-4ef9-a097-65b7e3454be6 | ehnryx/acm | kattis/commercials.cpp | #include <bits/stdc++.h>
using namespace std;
#define _USE_MATH_DEFINES
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef complex<ld> pt;
typedef vector<pt> pol;
const char nl = '\n';
const int INF = 0x3f3f3f3f;
const ll INFLL = 0x3f3f3f3f3f3f3f3f;
const ll MOD = 1e9+7;
const ld EPS = 1... | ALGO | 0.999849 | 3.505551 |
48d62004-010f-495e-b22f-a19a129a28ba | DiyanKalaydzhiev23/Softuni-CPlusPlus-Basics | FirstStepsInCodingExercise/09_fishTank.cpp | #include <iostream>
using namespace std;
int main() {
int length, width, height;
cin >> length >> width >> height;
double percentTaken;
cin >> percentTaken;
int tankVolume = width * height * length;
double tankLiters = static_cast<double>(tankVolume) / 1000;
double freeSpace = tankLiters... | ALGO | 0.990393 | 3.683953 |
e2a2b6b2-d240-4ea8-9612-d70ee5db3284 | Harsh72019/dsa | harsh/dynamicProgramming/longestCommonSubstring.cpp | #include<bits/stdc++.h>
using namespace std;
int solver(int i, int j, string &str1, string &str2, vector<vector<int>> &dp, int &maxLen) {
if (i < 0 || j < 0) return 0;
if (dp[i][j] != -1) return dp[i][j];
if (str1[i] == str2[j]) {
dp[i][j] = 1 + solver(i - 1, j - 1, str1, str2... | ALGO | 0.999985 | 5.748802 |
acef4616-e707-4b3e-83ed-d91ea51f633c | ishandutta2007/codeforces | _runtimeterror_/normal/632/C.cpp | #include<bits/stdc++.h>
using namespace std ;
#define ll long long
#define pb push_back
#define mem0(a) memset(a,0,sizeof(a))
#define mem1(a) memset(a,-1,sizeof(a))
#define memf(a) memset(a,false,sizeof(a))
#define all(v) v.begin(),v.end()
#define sz(a) (ll)a.size()
#define F first
#define S second
#define INF 200000... | ALGO | 0.999963 | 4.960004 |
29d6314b-a431-4e55-b689-051a96f30b03 | Haribala-09/hyprdots | User/History/-5f27eaf8/UCUK.cpp | #include<iostream>
using namespace std;
int main()
{
int n=4;
for(int r=1;r<4;r++)
{
for(int s=1;s<=n-r;s++) cout<<" ";
for(int c=r;c<=2*r+1;c++)
{
cout<<c;
}
for(int c=2*r-1;c>=r;c--)
{
cout<<c;
}
cout<<endl;
}
} | ALGO | 0.999945 | 3.107807 |
beb1ebae-9a32-429c-82e0-498308639db2 | PlasmaControl/FreeMHD | OpenFOAM-v2206/ThirdParty/sources/boost/boost_1_74_0/libs/geometry/test/algorithms/disjoint/disjoint_seg_box.cpp | // Boost.Geometry
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#inc... | TEST | 0.982019 | 7.842838 |
4e84859d-c6de-4804-a64c-601335d2bef2 | schutzwerk/PROBoter | firmware/Marlin/src/libs/heatshrink/heatshrink_decoder.cpp | #include "../../inc/MarlinConfigPre.h"
#if ENABLED(BINARY_FILE_TRANSFER)
/**
* libs/heatshrink/heatshrink_decoder.cpp
*/
#include "heatshrink_decoder.h"
#include <stdlib.h>
#include <string.h>
#pragma GCC optimize ("O3")
/* States for the polling state machine. */
typedef enum {
HSDS_TAG_BIT, /* ... | ALGO | 0.911178 | 4.962111 |
e499c54b-3943-4d03-b7b6-cee03eeb7797 | persi0815/Algorithm | 프로그래머스/1/258712. 가장 많이 받은 선물/가장 많이 받은 선물.cpp | #include <iostream>
#include <string>
#include <vector>
#include <sstream> // 문자열 처리
#include <unordered_map>
using namespace std;
// 주고받은 선물 기록으로 다음 달에 누가 선물 받이 받을지 예측하려함
unordered_map<string, int> name_num; // 이름과 번호 매핑
vector<int> gett[50]; // 누구에게 선물 받았는지 나타내는 인접 리스트
vector<int> score(50, 0); // 이름에 대응하는 선물 지수 파악
... | ALGO | 0.99827 | 5.603333 |
1b8d3940-ed49-48f3-b08b-8c71e4de9a24 | RinCloud/TrickCatcher | Datasets/TrickyBugs/GenProgs/dpp_generated_progs_cpp/p03019/p03019_num5_parsed.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int N, X;
cin >> N >> X;
vector<int> b(N), l(N), u(N);
for (int i = 0; i < N; i++) {
cin >> b[i] >> l[i] >> u[i];
}
long long sum_c = 0;
for (int i = 0; i < N; i++) {
sum_... | ALGO | 0.99991 | 4.475577 |
93995e3f-5c96-45ef-bc07-59b110767910 | Karansingh1221/DSA | 2470-removing-stars-from-a-string/removing-stars-from-a-string.cpp | class Solution {
public:
string removeStars(string s) {
int n=s.size();
// stack<char> st;
// for(int i=0;i<n;i++){
// if(s[i]=='*'){
// if(!st.empty()){
// st.pop();
// }
// }else{
// st.push(s[i]);
... | ALGO | 0.999948 | 5.807096 |
bac0389c-0760-4296-935c-741132d98820 | AndreyKolomiets/coursera_cpp_white_belt | a_plus_b/reverse.cpp | #include <vector>
using namespace std;
void Reverse(vector<int>& v){
int n = v.size();
for (int i=0; i < n/2; i++) {
int tmp = v[i];
v[i] = v[n-i-1];
v[n-i-1] = tmp;
}
}
| ALGO | 0.999666 | 4.60485 |
aff3f367-c2d6-4c9a-8344-04f8a6a26874 | hmatheus08/URI | URI2727.cpp | #include<stdio.h>
#include<string.h>
#define TF 50
int main()
{
int N, i, j, cont, result, pos;
char vet[TF][40];
while(scanf("%d", &N) != EOF)
{
getchar();
for(i = 0; i < N; i++)
{
gets(vet[i]);
strcat(vet[i], " ");
}
for(i = 0; i < N; i++)
{
pos = 0;
while(vet[i][pos] != ' ')
pos++... | ALGO | 0.999533 | 3.127137 |
ad977e4b-f160-439f-95fb-458434947aa0 | NouemanKHAL/Competitive-Programming | Codeforces/116/A [Tram].cpp | #include <algorithm>
#include <functional>
#include <array>
#include <iostream>
using namespace std;
int main(){
int n;
int sum=0;;
int max=-1;
cin >> n;
int a[n];
int b[n];
for(int i=0;i<n;i++){
cin >> a[i] >> b[i];
}
for(int i=0;i<n;i++){
sum+=b[i]-a[i];
if(sum>max) max=sum;
}
cout << max;
... | ALGO | 0.999811 | 3.259743 |
fd56a890-ab4b-4352-88f7-9ad5404f5730 | KrishanKantAgnihotri/CP-Solutions | Atcoder/C++ (GCC 9.2.1)/abc206_a/23572704.cpp | //Author : Krishan Kant Agnihotri
#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;
//ordered_set
template<class T> using oset =tree<T, null_type, less<T>, rb_tree_tag,tree_order_statistics_node_update> ;
#defi... | ALGO | 0.999995 | 4.388656 |
693af2e0-59c3-4f34-bae9-07100e8f7d78 | mingg123/study | src/c++/15650.cpp | #include <iostream>
#include <queue>
using namespace std;
int N, M;
int arr[1001];
int visited[1001];
int visited2[1001];
void ans(int cnt)
{
if (cnt == M)
{
for (int i = 0; i < M; i++)
{
printf("%d ", arr[i]);
}
printf("\n");
return;
}
if (cnt == 0)
{
for (int i = 1; i <= N; i++)
{
if (visited... | ALGO | 0.999968 | 3.733142 |
2bf10ac9-73b2-4ca4-a851-ee80cba9830a | shinjbin/algorithm | programmers/level3-1.cpp | #include <string>
#include <vector>
#include <queue>
using namespace std;
int MAP[101][101];
struct state
{
int x;
int y;
int step;
};
int directionX[] = {0, 1};
int directionY[] = {1, 0};
int solution(int m, int n, vector<vector<int>> puddles)
{
queue<pair<int, int>> q;
bool puddle[m + 1][n + 1... | ALGO | 0.99948 | 5.123737 |
f7c0b5a8-c6e5-4fab-84d7-bd55c36a4465 | jiayuanmark/hackerrank | game-theory/TowerBreakersRevisited.cpp | #include <cstdio>
#include <cstring>
#include <set>
using namespace std;
int g[1000005];
int grundy(int x) {
if (g[x] != -1)
return g[x];
set<int> st;
st.insert(0);
for (int y = 2; y * y <= x; ++y) {
if (x % y == 0) {
st.insert(grundy(y));
st.insert(grundy(x / y));
}
}
int &res = g[x];
res = 0;
... | ALGO | 0.999356 | 4.073894 |
a9f16354-4b2d-42e7-b0e8-5d5332b1b622 | Sajjat004/LeetCode-Solutions | Contest/Weekly Contest 454/Q4_Find Weighted Median Node in Tree.cpp | vector<vector<pair<int, int>>> graph;
class LowestCommonAncestor {
private:
vector<int> depth;
vector<vector<int>> sparseTable;
vector<vector<long long>> pathSum;
void dfs(int u, int par = -1, int d = 0) {
depth[u] = d;
sparseTable[u][0] = par;
for (int k = 1; k <= 20; ++k) {
if (sparseTabl... | ALGO | 0.999997 | 5.788152 |
7c0474dd-a678-4b8f-8653-85071fa78dc8 | heryms/PathPlanning | PathPlanning/eigen3.3.3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXf mat(2,4);
Eigen::VectorXf v(2);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
v << 0,
1;
//add v to each column of m
mat.colwise() += v;
std::cout << "Broadcasting result: " << std::endl;... | ALGO | 0.995563 | 4.136906 |
af602641-3573-41f5-8aba-7c9f4b7140a7 | rahulmansharamani14/essential_DSA | recursion/types of recursion/TailRecursion.cpp | #include <iostream>
using namespace std;
void func(int n){
if(n>0){
func(n-1);
cout<<"n: "<<n<<endl;
}
}
int main()
{
int x = 5;
func(x);
} | ALGO | 0.999049 | 4.933874 |
b1062cf4-3747-4216-9402-84565a728eb3 | luisrafaelo/Practica_ETN_307 | Programas_5/ListaEnlazada.cpp | #include <iostream>
using namespace std;
// Creamos un nodo
struct Node {
int data;
struct Node* next;
};
void insertAtBeginning(struct Node** head_ref, int new_data) {
//Asignar memoria a un nodo
struct Node* new_node = (struct Node*)malloc(sizeof(struct Node));
// Insertamos los datos
new_node->data = n... | ALGO | 0.999959 | 4.730217 |
24207636-27ef-4bda-acd3-b54d56669659 | qqee1133/Algorithm | 0x0B/1074.cpp | #include <bits/stdc++.h>
using namespace std;
int func(int n, int r, int c){
if(n == 0){
return 0;
}
int half = 1 << (n-1);
if(r < half && c < half) return func(n-1, r, c);
else if(r < half && c >= half) return half * half + func(n-1, r, c-half);
else if(r >= half && c < half) retur... | ALGO | 0.999826 | 3.406412 |
71b5abab-e4c7-4cf8-b840-b2b7c4d63d2a | SHIVANGISINGH1/DSA-codes | priorityqueue/KsortedArray.cpp | #include <bits/stdc++.h>
using namespace std;
int sortK(int arr[], int n, int k) {
priority_queue<int> q;
for (int idx=0; idx<n; idx++) {
if (idx<=k) {
q.push(-1 * arr[idx]);
}
else {
int val = q.top();
cout << -1 * val << endl;
q.... | ALGO | 0.99997 | 4.043811 |
cfd4b61b-88bd-4ea2-8e61-417030eb9096 | eiichirosatoru/Nhapmonlaptrinh | [matran]sochan_dichphaixoayvong_tongcacptu.cpp | #include <iostream>
#include <conio.h>
using namespace std;
const int MAX_SIZE = 100;
bool kiemTraSoChan(const int matrix[][MAX_SIZE], int n, int m)
{
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
if (matrix[i][j] % 2 == 0)
{
return tru... | ALGO | 0.999941 | 4.771723 |
d732505e-9ceb-41c5-beee-39698a76c601 | feel-coding/algorithm-practice | Card game.cpp | #include <iostream>
using namespace std;
int main() {
int a[10];
int b[10];
for (int i = 0; i < 10; i++) {
cin >> a[i];
}
for (int i = 0; i < 10; i++) {
cin >> b[i];
}
int aScore = 0;
int bScore = 0;
for (int i = 0; i < 10; i++) {
if (a[i] > b[i]) {
aScore++;
}
else if (b[i] > a[i]) {
bScore++... | ALGO | 0.999988 | 3.900887 |
3448e589-88f1-4d2e-b5b3-fe46229a0c36 | jubitaneja/souper-cgo20-artifact | performance/test/stockfish/baseline/src/bitboard.cpp | #include <algorithm>
#include "bitboard.h"
#include "misc.h"
uint8_t PopCnt16[1 << 16];
int SquareDistance[SQUARE_NB][SQUARE_NB];
Bitboard SquareBB[SQUARE_NB];
Bitboard FileBB[FILE_NB];
Bitboard RankBB[RANK_NB];
Bitboard AdjacentFilesBB[FILE_NB];
Bitboard ForwardRanksBB[COLOR_NB][RANK_NB];
Bitboard BetweenBB[SQUARE_... | CONFIG | 0.995605 | 5.722514 |
e0a6d496-dad4-45d5-a4d4-b2457a9a06c0 | viraj071/SPOJ | 4301. Tables/AE1B.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int main()
{
int n,k,s;
int a[1000];
scanf("%d",&n);
scanf("%d",&k);
scanf("%d",&s);
for(int i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
sort(a,a+n);
int sum=k*s;
int count=0;
for(int i=n-1;i>=0;i--)
{
if(sum<=0)
{
break;
... | ALGO | 0.999081 | 3.123645 |
752fb4b0-be86-46f3-9a5f-b61b5a24b304 | idknowwhy123/2110104-ComputerProgramming-Problems | Mock_02/Mock_04.cpp | #include <iostream>
using namespace std;
int arr[1010] = {};
int S(int n, int k) {
// Stirling numbers of the second kind
if(n == 0 && k == 0)return 1;
else if((n == 0 && k > 0) || (k == 0 && n > 0) )return 0;
return k*S(n-1,k)+S(n-1,k-1);
}
int B(int n) {
// Bell number
if(n == 0)return 1;
i... | ALGO | 0.999798 | 4.08088 |
6cbccb54-2223-4b09-8e5b-a8f98745a824 | vfolunin/archives-solutions | MCCME/3334.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <unordered_set>
#include <map>
#include <string>
using namespace std;
struct Participant {
int region, score, wild;
};
bool can(vector<Participant> &participants, int maxWinnerCount, int limit) {
int winnerCount = 0;
unordered_set<int> pr... | ALGO | 0.999962 | 4.848976 |
e4d853d7-6bce-4fd0-a831-0f52da441690 | ma5terdrag0n/Competitive-Programming | GeeksForGeeks/Lowest Common Ancestor in a BST.cpp | struct Node {
int data;
Node * right, * left;
};*/
/*You are required to complete
this function*/
Node* LCA(Node *root, int n1, int n2)
{
//Your code here
if(!root)return NULL;
if(root->data > n1 && root->data > n2){
return LCA(root->left, n1, n2);
}
if(root->data < n1 && root->data < n2){... | ALGO | 0.999995 | 5.961618 |
5a59df35-02fb-484d-868f-f96a5d1f3a76 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_3505_0.cpp | #include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
cerr << name << " : " << arg1 << std::endl;
}
templat... | ALGO | 0.999993 | 3.594775 |
f836ee60-b634-4c3d-ab7c-4e7737769c42 | Altius01/mfem_diploma | examples/ex22p.cpp | // MFEM Example 22 - Parallel Version
//
// Compile with: make ex22p
//
// Sample runs: mpirun -np 4 ex22p -m ../data/inline-segment.mesh -o 3
// mpirun -np 4 ex22p -m ../data/inline-tri.mesh -o 3
// mpirun -np 4 ex22p -m ../data/inline-quad.mesh -o 3
// ... | ALGO | 0.998118 | 5.714277 |
c8262fb7-c4c9-4b66-9b2c-f781602294f7 | Adam-Zhou-Hust/LeetCode | 二分法/74_search_a_2D_matrix.cpp | #include <vector>
using namespace std;
class Solution {
public:
// bool searchMatrix(vector<vector<int>>& matrix, int target) {
//
// }
bool searchMatrix(vector<vector<int>>& matrix, int target) {
// bool flag = false;
// for (int i = 0; i < matrix.size(); i++) {
// flag... | ALGO | 0.999944 | 5.976331 |
f0e43814-a371-4159-988f-bc165c584ed9 | zidootech/zidoo-kodi-14.2 | lib/libsquish/maths.cpp | /*! @file
The symmetric eigensystem solver algorithm is from
http://www.geometrictools.com/Documentation/EigenSymmetric3x3.pdf
*/
#include "maths.h"
#include "simd.h"
#include <cfloat>
namespace squish {
Sym3x3 ComputeWeightedCovariance( int n, Vec3 const* points, float const* weights )
{
// compute the centroi... | ALGO | 0.99987 | 6.393174 |
87741692-e556-4ea4-a611-197e14b7ea98 | verra11/competitive_programming_library | tests/game_theory/test_game.cpp | #include <bits/stdc++.h>
#include "../../lib/game_theory/game.hpp"
using namespace std;
void test_game()
{
game g;
string fname = "test.gbt";
g.GAMBIT_input(fname);
// // uncomment only if need to see game
// cout<<"game table"<<endl;
// cout<<g<<endl;
debug(g.num_players);
debug(g.n... | ALGO | 0.998531 | 4.234684 |
88d98400-fb10-4944-a439-ff225d732237 | zig-gamedev/zphysics | libs/Jolt/Physics/Collision/CollisionDispatch.cpp | #include <Jolt/Jolt.h>
#include <Jolt/Physics/Collision/CollisionDispatch.h>
#include <Jolt/Physics/Collision/CastResult.h>
JPH_NAMESPACE_BEGIN
CollisionDispatch::CollideShape CollisionDispatch::sCollideShape[NumSubShapeTypes][NumSubShapeTypes];
CollisionDispatch::CastShape CollisionDispatch::sCastShape[NumSubShapeT... | ALGO | 0.983105 | 7.840589 |
6160551b-3a33-4167-af35-0e6ff523e637 | sparrow84001/oneAPI | oneapi-essentials-training/04_DPCPP_Sub_Groups/lab/sub_group_reduce.cpp | using namespace sycl;
static constexpr size_t N = 256; // global size
static constexpr size_t B = 64; // work-group size
int main() {
queue q;
std::cout << "Device : " << q.get_device().get_info<info::device::name>() << "\n";
//# initialize data array using usm
int *data = malloc_shared<int>(N, q);
for (i... | ALGO | 0.990043 | 3.865337 |
b7ec08b3-c154-409e-9f1a-96c4e4a5e7a7 | fordream/MC | Calculate/Calculate.cpp | #include "Calculate.h"
#include <iostream>
using namespace std;
double Calculate::GetTimeDipositNYearsLater(float fMonthCapital, float fYearRate, int n)
{
cout<<"月定存-> "<<fMonthCapital<<" 元"<<endl;
cout<<"年利率 -> "<<fYearRate<<endl;
cout<<n<<" 年"<<endl;
double fYearCapital = GetMonthTimeDipositOneYear(fMonthCapi... | ALGO | 0.876285 | 3.938753 |
72dec82b-dea5-4749-9dc4-e19e2007380b | givenharshit/Code | test/EuclidAlgorithm.cpp | #include <iostream>
using namespace std;
// Euclid Algorithm for finding GCD of two numbers
// Time Complexity: O(log(min(a, b)))
// Space Complexity: O(1)
int gcd(int a, int b) {
while (a > 0 && b > 0) {
if (a > b) a = a % b;
else b = b % a;
}
if (a == 0) return b;
return a;
}
// Euc... | ALGO | 0.999625 | 6.335151 |
5e0ce1a7-c0ff-469d-9059-afb1abb072de | dev-rajm/ds-algo-lib | takeuforword/2-16-missing-repeating-number.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define nline "\n"
#define pb push_back
#define all(x) (x).begin(), (x).end()
// T.C => O(N^2)
// S.C => O(1)
vector<int> missingRepeating(vector<int> &arr)
{
int rt = -1, ms = -1;
int n = arr.size();
for (int i = 1; i <= n; i++)
{
... | ALGO | 0.999958 | 3.850136 |
d2f6f9d4-f4a9-449c-a28a-fd30a502f528 | haopham24/CTDL-GT2021 | CTDL_bieu_dien_do_thi_co_huong.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int t;cin>>t;
while(t--)
{
int v, e;
cin >> v >> e;
int a[v+5][v+5]={};
int n, m;
while(e--)
{
cin >> n >> m;
a[n][m] = 1;
}
for(int i = 1; i <= v; i++)
{
cout << i <<... | ALGO | 0.999575 | 3.894065 |
83e11329-537d-4947-b276-442cf8820883 | yCeifaZ/Nivel-2-Mundo-4 | 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 |
dbbef1e3-3514-45f5-a558-227eda493b1d | mpawank/Decode-CPP-2.0-PW | 61. Dynamic Programming 06/Leetcode72_EditDistance.cpp | #include "iostream"
#include "vector"
using namespace std;
vector<vector<int>> dp;
int helper(string& s1, string& s2, int i, int j){
if (i < 0) return j+1;
if (j < 0) return i+1;
if (s1[i] == s2[j]) return dp[i][j] = helper(s1, s2, i-1, j-1);
if (dp[i][j] != -1) return dp[i][j];
else {
int ... | ALGO | 0.999964 | 5.330068 |
cbeb20ad-cbbd-4ae9-9f48-821bb8a73007 | 2694048168/LeetCodeAlgorithm | C++/twoSum3.cpp | /**
* @File : twoSum3.cpp
* @Brief : 和为s的两个数字
* @Link : https://leetcode-cn.com/problems/he-wei-sde-liang-ge-shu-zi-lcof/
* @Author : Wei Li
* @Date : 2021-09-14
*/
#include <iostream>
#include <vector>
class Solution
{
public:
std::vector<int> twoSum(std::vector<int> &nums, int target)
{
... | ALGO | 0.999867 | 5.191132 |
0f35c893-b503-41c7-8931-54bf1ebe338c | 1990yanjing/MyLeetCode | Array/Array--removeDuplicates.cpp | #include "Solution.h"
/**
* Array
* Remove Duplicates from Sorted Array
* 注意判断边界条件
* date:2014.12.31
*/
int removeDuplicates(int A[], int n)
{
if(n == 0)
return n;
int index = 1;
for(int i = 0; i < n; i++)
{
if(i + 1 < n && A[i] != A[i + 1])
{
A[index] = A[i + 1];
index++;
}
}
return index;
}
| ALGO | 0.999266 | 4.213714 |
710a26f4-92cc-4076-9bdf-7646e6aa2237 | ICraZZyBoY/Algorithms-Trainings | LYCEUM (contests, homework, etc.)/CPP TRAININGS/GRAPH/A4.cpp | #include <fstream>
#include <vector>
using namespace std;
int main()
{
ifstream cin("input.txt");
ofstream cout("output.txt");
ios_base::sync_with_stdio(false); cin.tie(0); cout.tie (0);
int n, s, f;
cin >> n >> s >> f;
s--; f--;
vector < vector <int> > v(n, vector <int> (n));
for (int... | ALGO | 0.999985 | 3.973125 |
7b6686a1-c1d1-4f4b-b512-b6f0f2c4a58a | rhazem13/LeetCode | 0589-n-ary-tree-preorder-traversal/0589-n-ary-tree-preorder-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 {
public:
void preord(Node* root,vect... | ALGO | 0.999971 | 5.920991 |
d4614427-ad50-4479-a021-c785f7820496 | Luigisvc/Marlin_Sources | Marlin-B1-SKR2_UBL-2.1/Marlin/src/lcd/menu/menu_motion.cpp | //
// Motion Menu
//
#include "../../inc/MarlinConfigPre.h"
#if HAS_MARLINUI_MENU
#define LARGE_AREA_TEST ((X_BED_SIZE) >= 1000 || (Y_BED_SIZE) >= 1000 || (Z_MAX_POS) >= 1000)
#include "menu_item.h"
#include "menu_addon.h"
#include "../../module/motion.h"
#include "../../gcode/parser.h" // for inch support
#includ... | TOOL | 0.861451 | 6.783445 |
76b4ccf1-a0c6-4a9a-9858-e93a1d0256a2 | YushinSong/MyStudy | CodingTest/DP-MakeNumberToOne.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
// vector ε ڸ Ѵ.
// ڿ ִ Ѵ.
int solution(int num)
{
vector<int> numVector;
numVector.assign(num + 1, 0);
//numVector[0] = 0; numVector[1] = 0; // 0 1 0̴.
for (int i = 2; i < num + 1; ++i)
{
numVector[i] = numVector[i - ... | ALGO | 0.999857 | 4.734131 |
8b2d866b-b55a-4e6b-8445-bf89c3757054 | Justake565/SKFU | 3LB/4(6).cpp |
#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
int main() {
setlocale(LC_ALL, "Russian");
string str1, str2;
cout << "Введите первую строку (Str1): ";
getline(cin, str1);
cout << "Введите вторую строку (Str2): ";
getline(cin, str2);
// Создаем карту дл... | ALGO | 0.999591 | 5.547344 |
3d66946c-5b07-42eb-94d2-ab53b62c7ef9 | harsh-quare/LeetRoad | 0303-range-sum-query-immutable/0303-range-sum-query-immutable.cpp | class NumArray {
private:
vector<int> pref;
int n;
public:
NumArray(vector<int>& nums) {
n = nums.size();
pref.resize(n+1);
pref[0] = 0;
for(int i = 0; i < n; i++){
pref[i+1] = pref[i] + nums[i];
}
}
int sumRange(int left, int right){
... | ALGO | 0.999833 | 6.663958 |
b82cf9e0-0fef-42a6-aa57-58fa2b32d73b | Akeepers/algorithm | leetcode/179.cpp | #include <algorithm>
#include <climits>
#include <iostream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
#include <numeric>
using namespace std;
class Solution
{
public:
string largestNumber(vector<int> &nums)
{
string res = "";
if (nums.empty())
... | ALGO | 0.999915 | 5.97597 |
331c5291-b933-4db1-8ac8-062653bbd9bb | khaledsliti/CompetitiveProgramming | Codeforces/Contests/CF1208/CF1208-D12-C.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 1005;
int n;
int arr[N][N];
int main()
{
int n;
cin >> n;
int cnt = 0;
for(int i = 0 ; i < n ; i += 4){
for(int j = 0 ; j < n ; j += 4){
for(int k = 0 ; k < 4 ; k++)
for(int l = 0 ; l < 4 ; l++)
arr[i + k][j + l] = cnt++;... | ALGO | 0.998897 | 3.038424 |
65e44a9b-8c96-4fd5-8758-b80b2a2395be | jNikolov98/cpp-fundamentals-november-2017 | Lect04Homework/02.PositionsOf.cpp | /*
Write a program that reads a matrix of integers from the console, then a number, and prints all the positions at
which that number appears in the matrix.
The matrix definition on the console will contain a line with two positive integer numbers R and C – the number of
rows and columns in the matrix –... | ALGO | 0.999382 | 4.717258 |
4d3940e7-dfdb-44fe-8413-b6f17f1f5fc4 | juliadsilva/Algoritmos-I | Matrix/Matriz.cpp | #include <iostream>
#include <cmath>
#include <math.h>
using namespace std;
int main(){
int matriz1[100][100];
int matriz2[100][100];
int resultado[100][100];
int L, C;
int i, j;
cin >> L >> C;
for(i=0;i<L;i++)
for(j=0;j<C;j++)
cin >> matriz1[i][j];
for(i=0;... | ALGO | 0.99997 | 3.293741 |
979f7919-c567-480c-9e1b-5f3d9d146d05 | asmitamitra/algorithmcodes | competitive/angryprof.cpp | #include<iostream>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n, k;
cin>>n;
cin>>k;
int count=0;
int a;
for(int i=0;i<n;i++)
{
cin>>a;
//early bcche
if(a<=0)
{
... | ALGO | 0.999656 | 3.56628 |
05b9c89e-ba88-45a5-9942-55a2a2c7562b | prajwalsable99/CPP--practice-DSA | _180.cpp | #include <bits/stdc++.h>
#include <queue>
#include <stack>
using namespace std;
struct node{
int data;
node* left;
node* right;
};
node* newNode(int data)
{
node* temp = new node;
temp->data = data;
temp->left = temp->right = NULL;
return temp;
}
int createSumtree(node* root){
if(root==NULL){
... | ALGO | 0.999977 | 5.146553 |
51db91ec-de94-453d-af97-02a580b05e93 | ntalfer/codingame | mars_lander_niveau_1.cpp | #include <iostream>
#include <string>
#include <sstream>
#include <vector>
using namespace std;
int parse_int(stringstream& ss)
{
string val;
getline(ss, val, ' ');
return stoi(val);
}
int power_up(int p)
{
if(p == 4)
return 4;
return p+1;
}
int power_down(int p)
{
if(p == 0)
... | ALGO | 0.999919 | 4.044858 |
a70b22d2-2761-4058-a116-39cf5ad44c21 | dimsunlight/c_curved_space | CGAL-5.6/examples/Arrangement_on_surface_2/spherical_insert.cpp | //! \file examples/Arrangement_on_surface_2/spherical_insert.cpp
// Constructing an arrangement of arcs of great circles.
#include <list>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Arrangement_on_surface_2.h>
#include <CGAL/Arr_geodesic_arc_on_sphere_traits_2.h>
#include <CGAL/Arr_sp... | ALGO | 0.984789 | 4.818922 |
020abf68-3f70-4e4f-9a25-7d4f9ad6e709 | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/Year2021/January/WatchingCplAnswer_20210109173207.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.999986 | 4.401251 |
9c395378-72c4-48b3-af1f-73cfe25731cd | FrankCCCCC/2021_computer_programming_2 | past_oj/程式設計2/期中考B/Encoding and decoding.cpp | #include <iostream>
#include <string>
#include <sstream>
#include <cctype>
class Codec {
public:
virtual void encode() = 0;
virtual void decode() = 0;
virtual ~Codec() { } // Do nothing
virtual void show(std::ostream& os) const = 0;
virtual bool is_encoded() const = 0;
};
class DummyCodec: public ... | ALGO | 0.997942 | 4.862117 |
47524144-0993-4dce-bf9f-4339283841e1 | Sachin-Khati/C-Projects | Car.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
class ParkingSystem
{
private:
int capacity;
int occupied;
public:
ParkingSystem(int cap)
{ // Constructor
capacity = cap;
occupied = 0;
}
bool parkCar()
{
if (occupied < capacity)
... | ALGO | 0.962688 | 6.607164 |
5e8aa478-8408-41e0-9639-aba381c6d109 | SonarSystems/Cocos2d-x-Multi-Device-2.0 | Project Templates/MultiResCPP/cocos2d/tools/simulator/libsimulator/lib/runtime/ConfigParser.cpp |
#include "json/document.h"
#include "json/filestream.h"
#include "json/stringbuffer.h"
#include "json/writer.h"
#include "ConfigParser.h"
#include "FileServer.h"
// ConfigParser
ConfigParser *ConfigParser::s_sharedConfigParserInstance = NULL;
ConfigParser *ConfigParser::getInstance(void)
{
if (!s_sharedConfigPars... | TOOL | 0.925954 | 5.2456 |
b461cf17-1432-4793-a5dd-761ca0ffcf1c | safaanwar1122/whatsapp_ui_design | 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.998859 | 6.785645 |
c3c902c0-9280-4a1a-bd36-75f15dee880d | devanshi-code/CODE-HELP | Lecture 5/bitwiseoperator1.cpp | #include<iostream>
using namespace std;
int main() {
int a = 4;
int b = 6;
cout<<" a&b " << (a&b) << endl;
cout<<" a|b " << (a|b) << endl;
cout<<" ~a " << ~a << endl;
cout<<" a^b " << (a^b) << endl;
cout<<(17>>2)<<endl;
cout<<(14<1)<<endl;
//pre-increment and post increment
... | ALGO | 0.861342 | 3.033373 |
ded92b16-56bc-4211-b0af-2d9cb74e32ab | ishandutta2007/codeforces | bigbag/normal/16/D.cpp | #include <set>
#include <cmath>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const int max_n = 111111, inf = 111111111;
int n, ans, a[max_n];
char s[222];
int main() {
//freopen("input.txt", "r", stdin);
//freopen("ou... | ALGO | 0.997653 | 3.645312 |
3c0e668e-3061-44ad-99e1-327cf6c7499a | xR3b0rn/dbcppp | third-party/boost/libs/spirit/classic/example/fundamental/number_list.cpp | ///////////////////////////////////////////////////////////////////////////////
//
// This sample demontrates a parser for a comma separated list of numbers
// This is discussed in the "Quick Start" chapter in the Spirit User's Guide.
//
// [ JDG 5/10/2002 ]
//
///////////////////////////////////////////////////////... | TOOL | 0.941185 | 7.075739 |
9337160e-89d9-4c9a-944d-acf7330ddb52 | tmuttaqueen/MyCodes | Online Judge Code/lightoj/1161 - Extreme GCD.cpp | #include <bits/stdc++.h>
using namespace std;
const double pi = 3.141592653589793;
#define xx first
#define yy second
#define mp make_pair
#define intl long long
#define filein freopen("input.txt", "r", stdin)
#define fileout freopen("output.txt", "w", stdout)
#define debug... | ALGO | 0.999817 | 3.721995 |
2e7233c8-271e-419a-821c-286e3a41a73e | liangjisheng/C-Cpp | books/C++_advanced_programming/code/Chapter21/TemplateMetaProgramming/TemplateMetaProgramming.cpp |
#include <iostream>
using std::cout;
using std::endl;
// ģԪ̵ĿڱִһЩ㣬ִС
// Ԫ̻C++֮ϵһСͱԡ
// ʾڱǼһĽ׳ˣʹõģݹ飬
// ҪһݹģֹͣݹĻģ壬0Ľ׳Ϊ1ģ
template<unsigned char f>
class Factorial
{
public:
static const unsigned long long val = (f * Factorial<f - 1>::val);
};
// ģػ
template<>
class Factorial<0>
{
public:
static const unsigned lo... | ALGO | 0.999083 | 4.341763 |
73b181af-b2f0-45c9-ab7b-1fceed09440d | KailasMahavarkar/interview-prep | Graph Concept/core/kahn_algorithm.cpp | #include <algorithm>
#include <climits>
#include <iostream>
#include <queue>
#include <unordered_map>
#include <vector>
#include <list>
#pragma GCC optimize("O3,unroll-loops")
using namespace std;
// Kahn's Algorithm
// Time Complexity: O(V+E)
// Space Complexity: O(V)
// What is Kahn's Algorithm?
// Its nothing but ... | ALGO | 0.999999 | 6.570037 |
36de60f0-8277-42dc-aea7-ae51c51bf6f8 | RomeoV/FasterSLAM | src/core/tests/predict_true_test.cpp | #include "predict_true.h" // import file to test
#include <math.h>
#include "ut.hpp"
using namespace boost::ut;
using namespace boost::ut::bdd;
int main() {
"predict_true"_test = [] {
given("I have the arguments V, G, WB, dt, xv") = [] {
double V = 1.0;
double G = M_PI/3.0; //60°... | TEST | 0.87405 | 5.873182 |
9ca0f720-0702-408e-9290-72d78497832b | hazerMf/Code-Ptit | BT/C++/rearrange.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int runs;
cin >> runs;
while(runs--){
int len;
cin >> len;
int list[len];
for(int i=0;i<len;i++){
cin >> list[i];
}
int check[len];
for(int i=0;i<len;i++){
if(list[i]>=0... | ALGO | 0.99938 | 3.995029 |
0749077b-19cd-4ec0-9bb9-cdd4085631ea | Mohammed-Ebrahim-Ahmed/Modern_cpp_udemy | lab1/function.cpp |
#include <iostream>
#include <string>
#include "function.hpp"
int Add(int x, int y)
{
return x+y;
}
extern "C"{
int Add(int *a, int *b)
{
return (*a)+(*b);
}
}
void print(char c)
{
for(int i = 0; i < 10 ; i++)
{
std::cout<<c<<std::endl;
}
std::cout<<std::endl;
}
void AddVal(int *a, i... | TOOL | 0.965705 | 3.94631 |
26568def-7101-4b80-b863-0217c92919f4 | aakriti7x7/put-your-secc-code-here | Matrix multiplication in C++.cpp | #include <iostream>
using namespace std;
int main()
{
int a[10][10],b[10][10],mul[10][10],r,c,i,j,k;
cout<<"enter the number of row=";
cin>>r;
cout<<"enter the number of column=";
cin>>c;
cout<<"enter the first matrix element=\n";
for(i=0;i<r;i++)
{
for(j=0;j<c;j++)
{
cin... | ALGO | 0.997314 | 3.141802 |
b6923da2-c0db-4520-ac13-18603a4d3f71 | ittc706/LTEV2X | LTEV2X/Matrix.cpp | /*
* =====================================================================================
*
* Filename: Matrix.cpp
*
* Description: Matrixʵ
*
* Version: 1.0
* Created:
* Revision:
* Compiler: VS_2015
*
* Author: HCF
* LIB: ITTC
*
* ===========================... | ALGO | 0.989106 | 3.554795 |
750c85cb-5364-421c-a409-226571d5387f | Satyam-nitp/DSA | 01_Pattren_printing_1/Alphabetical_square.cpp | #include<iostream>
using namespace std;
int main(){
int x;
cout<<"Enter no. of rows: ";
cin>>x;
for(int i=1;i<=x;i++){
for(int j=1;j<=x;j++){
cout<<char(j+64)<<" ";
}
cout<<endl;
}
} | ALGO | 0.987995 | 3.400434 |
2bd38583-f5da-4f5c-9533-25ee9758aead | AnissL93/mlir | libcxx/test/std/algorithms/alg.nonmodifying/alg.find/find_if_not.pass.cpp | // <algorithm>
// template<InputIterator Iter, Predicate<auto, Iter::value_type> Pred>
// requires CopyConstructible<Pred>
// constexpr Iter // constexpr after C++17
// find_if_not(Iter first, Iter last, Pred pred);
#include <algorithm>
#include <functional>
#include <cassert>
#include "test_macros.h"
#inclu... | TEST | 0.9561 | 6.536047 |
0ff02c22-6d4c-4ebf-a036-9996bcbfb26a | bhargav-joshi/DS-Algo | Leetcode/Longest Palindromic Substring.cpp | class Solution
{
public:
string longestPalindrome(string s)
{
int maxlen = 0, len = 0, len1 = 0, len2 = 0;
int left = 0, right = 0;
for(int i = 0; i<s.length(); i++)
{
len1 = palindrome(s, i, i);
len2 = palindrome(s, i, i+1);
len = max(len1, ... | ALGO | 0.999988 | 5.899313 |
8dc6627f-d47e-43fc-ac01-da3ee35989f6 | willard-yuan/CNN-for-Face-Image-Retrieval | matconvnet-1.0-beta17/matlab/src/bits/impl/bnorm_cpu.cpp | // @file bnorm_cpu.cpp
// @brief Batch normalization implementation (CPU)
// @author Sebastien Ehrhardt
// @author Andrea Vedaldi
#include "bnorm.hpp"
#include "../data.hpp"
#include <math.h>
#include <memory.h>
#include <cstdlib>
#include <algorithm>
#include <limits>
#include <cassert>
/* -----------------------... | ALGO | 0.998056 | 7.298825 |
59aee6db-9822-4c64-92f3-b39871e64f2f | LemuriaX/luogu | 数字反转.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string s;
cin >> s;
if(s[0]!='-'){
reverse(s.begin(),s.end());
int i = 0;
while(s[i] == '0'){
s.erase(0,1);
}
}
else{
reverse(s.begin()+1,s.end());
int i = 1;
while(s[i] == '0'){
s.erase(1,1);
}
}
cout << s;
return 0;
}
| ALGO | 0.999697 | 3.910564 |
f314244c-1b88-411e-bb6b-5f6bb489c65f | VishnupriyaThammina/leetcodeSolves | 130-surrounded-regions/surrounded-regions.cpp | class Solution {
public:
void solve(vector<vector<char>>& b) {
int cc[] = {0,0,1,-1};
int rr[] = {1,-1,0,0};
vector<vector<int>> vis(b.size(),vector<int>(b[0].size()));
queue<pair<int,int>>q;
int flag = 0;
vector<pair<int,int>> im;
for(int i = 0; i <b.size();i++){... | ALGO | 0.999773 | 5.652067 |
78a156b8-3d1b-48be-8079-65e264583b6f | jeanlemotan/silkopter | eigen/doc/snippets/Tutorial_AdvancedInitialization_LinSpaced.cpp | ArrayXXf table(10, 4);
table.col(0) = ArrayXf::LinSpaced(10, 0, 90);
table.col(1) = M_PI / 180 * table.col(0);
table.col(2) = table.col(1).sin();
table.col(3) = table.col(1).cos();
std::cout << " Degrees Radians Sine Cosine\n";
std::cout << table << std::endl;
| ALGO | 0.936452 | 3.543272 |
c67e8d55-839b-47dd-905b-bb89f247924f | fgomezgo/ttrax | navigation/base_local_planner/src/simple_trajectory_generator.cpp | #include <base_local_planner/simple_trajectory_generator.h>
#include <cmath>
#include <base_local_planner/velocity_iterator.h>
namespace base_local_planner {
void SimpleTrajectoryGenerator::initialise(
const Eigen::Vector3f& pos,
const Eigen::Vector3f& vel,
const Eigen::Vector3f& goal,
base_local_pl... | ALGO | 0.998251 | 6.352531 |
9a7b9b7b-2a22-4457-aa6d-56a0bbc2bb68 | jpdotcom/comp_prog-archive | Auto_Upload_Codeforces/Codeforces_Round_808_Div_1/B_Difference_Array.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define pb push_back
#define FOR(b) for(int i=0;i<b;i++)
#define mp(a,b) make_pair(a,b)
typedef std::vector<int> vi;
typedef std::pair<int, int> pi;
typedef long long ll;
typedef std::priority_queue<int> pq;
#define F... | ALGO | 0.999842 | 4.330112 |
ea88d8c4-9783-4340-8793-b3f4449aa1cf | ishandutta2007/codeforces | monkeyking/normal/510/E.cpp | #include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#include <assert.h>
#define Endl endl
#define mp make_pair
#define ll long long
#define pii pair<int,i... | ALGO | 0.999754 | 3.060584 |
6efec119-0b45-4679-b203-6af41a6c7c05 | moinologics/HackerRank-Solutions | Practice/Algorithms/Two Strings.cpp | string twoStrings(string s1, string s2)
{
map<char,int> freq;
for(char c: s1)
{
freq[c]++;
}
for(int i=0; i<s2.size(); i++)
{
if(freq[s2[i]] > 0)
{
return "YES";
}
}
return "NO";
} | ALGO | 0.999983 | 4.267667 |
78ecf2f4-c840-4a77-bed6-6290c5b279c7 | dtsdwarak/algorithms | algo-and-ds/binary-search/sorted-array-rotation.cpp | #include <iostream>
# include <vector>
using namespace std;
int main() {
vector<int> arr = {11,13,20,22,29,4,6,8,9,10};
int n = arr.size();
int high=arr.size()-1, low=0,mid;
if (arr[low] <= arr[high]) {
cout<<"Array already sorted";
exit(1);
}
while(low<=high) {
mid = (high+low)/2;
int next... | ALGO | 0.999822 | 4.572344 |
e2e3ffeb-1a3b-49d6-98f8-e1df05afa087 | swerty21/cses-problems | sorting-searching/02-apartments.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int,int>;
const int MOD = (int)1e9 + 7;
const int maxn = (int)2e5+10;
int a[maxn], b[maxn];
int main() {
int n,m,k;
cin >> n >> m >> k;
for(int i=0; i<n; ++i) cin >> a[i];
for(int i=0; i<m; ++i) cin >> b[i];
sort(a,a+n);
... | ALGO | 0.999972 | 3.485323 |
b903a8e5-85f8-418a-a74c-d6d9fa7fc5af | Ahmad-AlDeeb/Problem-Solving | Leetcode/0033. Search in Rotated Sorted Array.cpp | class Solution {
int findPivot(vector<int>& nums) {
int left{1}, right = nums.size() - 1;
while(left <= right) {
int mid = left + (right - left) / 2;
if(nums[mid] < nums[mid - 1]) {
return mid;
}
else if(nums[mid] > nums.back()) {
... | ALGO | 0.999994 | 6.22072 |
b78c8967-c30d-440d-a409-334351d42c59 | paras-aghija/placement_DSA | DSA/Trees/Segment_tree/sum_st.cpp | #include<bits/stdc++.h>
using namespace std;
void updateValueUtil(int* st, int l, int r, int i, int diff, int curr) {
if(i < l || i > r) return;
st[curr] += diff;
if(l == r)
return;
int mid = l + (r - l) / 2;
updateValueUtil(st, l, mid, i, diff, 2 * curr + 1);
updateValueUtil(st, mid + 1, r, i, diff, 2 * curr ... | ALGO | 0.99988 | 5.414034 |
301fcd1b-a100-42eb-ae28-3237bf9148f2 | Pulkith/Competitive | CodeForces/581/c/c.cpp | /**
*
* author: DespicableMonkey
* created: 05.18.2021 16:42:02
*
* Potatoes FTW!
*
**/
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <cstdio>
#include <deque>
#include <bitset>
#include <iterator>
#include <queue>
#inclu... | ALGO | 0.999802 | 4.052948 |
9103a9f8-6560-4cdf-86f0-b47c365ec57d | Elics/cppLab | Lab 7.cpp |
#include <iostream>
#include<iomanip>
using namespace std;
//function prototype
double sumcal(double);
int main()
{
int i;
cout << "\ti" << setw(14) << "m(i)" << endl;
for (i = 1; i <= 20; i++)
{
double sum = sumcal(i);
cout << "\t" << (static_cast <int>(i))<< setw(12) << sum << endl;
}
return 0;
}... | ALGO | 0.981572 | 4.040626 |
478b13aa-f8cc-4a5d-a9e4-4d4ca10ea701 | aerosayan/solution | src/SUMOFTWONUMBERS.cpp | // https://www.spoj.com/problems/CHITEST1/
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int a, b;
double x, y;
for (int i = 1; i <= n; i++) {
cin >> x >> y;
cout << x + y << endl;
}
return 0;
}
| ALGO | 0.982964 | 4.386232 |
70edef08-ec68-4f5e-b80b-9493b37c9b27 | yipu3/algorithm-practice | ST2014/networkFlow/d.cpp | #include<iostream>
#include<cstdio>
#include<cstring>
#include<cstdlib>
#include<climits>
#include<algorithm>
#include<vector>
#include<stack>
#include<set>
#include<queue>
#include<map>
#include<cmath>
#include<sstream>
#include<string>
#define MAX_V 20100
#define INF 1000000000
#define MAX_E 1000005
typedef long lon... | ALGO | 0.99988 | 4.385452 |
9b4e8122-8eb6-4218-8221-dcdc1d97644c | sdwalker233/ICPC | codeforces/#385-div1(2016.12.18)/A.cpp | #include <bits/stdc++.h>
using namespace std;
int n,m,k;
int fa[1010],a[1010],num[1010];
int find(int x)
{
if(fa[x]==x) return x;
return fa[x]=find(fa[x]);
}
int main()
{
int i,x,y,fx,fy;
cin>>n>>m>>k;
for(i=1;i<=n;i++){
fa[i]=i;
num[i]=1;
}
for(i=1;i<=k;i++) scanf("%d",&a[i]);
for(i=1;i<=m;i++){
scanf(... | ALGO | 0.999934 | 3.482594 |
0dfdcfd8-5fa4-478e-9ce8-fdd025a59c00 | gitslagga/c-c--example | c++-primer-plus/Chapter 5/forloop.cpp | // forloop.cpp -- introducing the for loop
#include <iostream>
int main()
{
using namespace std;
int i; // create a counter
// initialize; test ; update
for (i = 0; i < 5; i++)
cout << "C++ knows loops.\n";
cout << "C++ knows when to stop.\n";
// cin.get();
return 0;
}
| ALGO | 0.974257 | 3.514106 |
8d77eb45-7fe2-4b6c-b58d-0c9ce98b54a3 | BijanRegmi/Competitive-Coding | HackerRank/Find_Digits.cpp | #include <bits/stdc++.h>
using namespace std;
string ltrim(const string &);
string rtrim(const string &);
/*
* Complete the 'findDigits' function below.
*
* The function is expected to return an INTEGER.
* The function accepts INTEGER n as parameter.
*/
int findDigits(int n) {
int copy = n;
int cnt = 0... | ALGO | 0.999421 | 6.356183 |
fd2eafb3-ab07-4051-9f5d-d7a9306713ac | kosirobwada/AtCoderSubmit | submissions/abc236/b.cpp | #include <bits/stdc++.h>
using namespace std;
using Graph = map<int, vector<int>>;
const int INF = 1e9;
using ll = long long;
using P = pair<int, int>;
int main() {
int N;
cin >> N;
vector<int> a(4 * N);
vector<int> b(N + 1, 0);
for (int i = 1; i < 4 * N; i++) {
cin >> a[i];
b[a[i]]++;
}
for (int... | ALGO | 0.999972 | 3.848583 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.