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 |
|---|---|---|---|---|---|---|
499b6de6-806f-400a-9f2e-1c5e31c02deb | lakshits11/LeetCode | 1802-maximum-value-at-a-given-index-in-a-bounded-array/1802-maximum-value-at-a-given-index-in-a-bounded-array.cpp | class Solution {
public:
int maxValue(int n, int index, int maxSum) {
maxSum -= n;
int left = 0, right = maxSum, mid;
while (left < right) {
mid = (left + right + 1) / 2;
if (test(n, index, mid) <= maxSum)
left = mid;
else
... | ALGO | 0.999872 | 5.263178 |
3291b37b-2038-4e54-ac8f-ee2df543d0bb | kajal0176/leetcode | 3809-properties-graph/3809-properties-graph.cpp | class DisjointSet {
public:
vector<int> rank, parent;
DisjointSet(int n) {
rank.resize(n + 1, 0);
parent.resize(n + 1);
for (int i = 0; i <= n; i++) {
parent[i] = i;
}
}
int findUPar(int node) {
if (node == parent[node])
return node;
... | ALGO | 0.999975 | 5.603328 |
454db5a0-7118-4569-826a-19cfe30709a5 | Tiphereth-A/CP-lib | usage/ds/odt.cpp | #define PROBLEM "https://www.luogu.com.cn/problem/P4979"
#include "../../include/ds/odt.hpp"
using namespace tifa_libs;
const strn YN_[2] = {"No", "Yes"};
int main() {
u32 n, m;
strn s;
std::cin >> n >> s >> m;
ds::ODT<char> odt;
for (u32 l = 0, r = 0; l < n; l = r) {
while (r < n && s[++r] == s[l]);
... | ALGO | 0.999854 | 4.904443 |
f850b73d-2518-4cb3-9378-bc9562b56de6 | kalpana-kumarii/c-code | binary_search.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cout<<"enter the size of array";
cin>>n;
int arr[n], num, ct=0, beg=0, end=n-1, mid;
cout<<"enter the element in array";
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
cout<<"enter the value to search position";
cin>>num;... | ALGO | 0.99971 | 4.319582 |
eadcdcdb-93cf-4876-8aee-af86700a5bd3 | WHFF521/OJSolutions | CodeForces/EducationalCodeforcesRound171(RatedforDiv2)/a.cpp | #include<iostream>
#include<cstdio>
#include<map>
#include<cmath>
#include<string>
#include<algorithm>
#include<iomanip>
using namespace std;
int main(){
int T;
scanf("%d", &T);
while(T--){
int X, Y, K;
scanf("%d%d%d", &X, &Y, &K);
int len = min(X,Y);
printf("0 0 %d %d\n",le... | ALGO | 0.999219 | 3.342193 |
d49199a9-4b72-4077-9c5b-0c1011508f23 | havefun02/bitcoin-clone | src/node/eviction.cpp | #include <node/eviction.h>
#include <algorithm>
#include <array>
#include <chrono>
#include <cstdint>
#include <functional>
#include <map>
#include <vector>
static bool ReverseCompareNodeMinPingTime(const NodeEvictionCandidate &a, const NodeEvictionCandidate &b)
{
return a.m_min_ping_time > b.m_min_ping_time;
}
... | ALGO | 0.997451 | 7.774124 |
e1426906-f84a-48e7-8c5e-a39ccba51d20 | Rishabh6395/DSA-in-JS-and-Cpp | Coder army/SqurtofX/main.cpp | // Given a non-negative integer x, return the square root of x rounded down to the nearest integer. The returned integer should be non-negative as well.
// You must not use any built-in exponent function or operator.
#include <iostream>
#include <limits.h>
#include <vector>
using namespace std;
class Solution {
publ... | ALGO | 0.9999 | 5.43213 |
830fe0c1-c99c-487a-a240-9a8ec11074de | Lee-Duck-03/template_cp | codetumlumtala/Truyentin.cpp | /* ________ _______ _______ _____ _______
| _____| | \ | \ / \ | \
| |_____ | 0 | | 0 | | _ | | 0 |
| _____| | _ / | _ / | |_| | | _ /
| |_____ | | \ \ | | \ \ | | | | \ \
|________| |__| \__\ |__| \__\ ... | ALGO | 0.999594 | 3.998641 |
6292d1d3-eeef-4f5d-bc5c-1174c213b5d6 | vfolunin/archives-solutions | URI Online Judge/1551.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
void solve() {
string line;
getline(cin, line);
set<char> letters;
for (char c : line)
if (isalpha(c))
letters.insert(tolower(c));
if (letters.size()... | ALGO | 0.997415 | 3.980393 |
665552a0-d51d-44c6-80c4-060695f1225f | karouzakisp/llvm-dev | libcxx/test/std/algorithms/alg.sorting/alg.merge/merge.pass.cpp | // <algorithm>
// template<InputIterator InIter1, InputIterator InIter2, typename OutIter>
// requires OutputIterator<OutIter, InIter1::reference>
// && OutputIterator<OutIter, InIter2::reference>
// && HasLess<InIter2::value_type, InIter1::value_type>
// && HasLess<InIter1::value_type, InIte... | TEST | 0.998579 | 6.728796 |
98982d89-39ec-43c6-b195-0bb696a9df76 | VirtuousCrane/ble_test | 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.998784 | 6.761023 |
364531f8-a4bd-4521-a065-8a5221b4197b | raincross7/code-similarity | codes/train_code/problem215/problem215_99.cpp | #include <stdio.h>
#include <vector>
#include <iostream>
#include <queue>
#include <bits/stdc++.h>
#define rep(i,n) for (int i=0;i<(n);++i)
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef pair<int, int> pi;
struct node{
ll num;
int cnt;... | ALGO | 0.999967 | 4.07876 |
15f293b8-275e-4841-8c6d-ea0e2b89cbd8 | 848deepak/GeeksForGeeks | Difficulty: School/Sum of AP series/sum-of-ap-series.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
long sum_of_ap(long n,long a, long d)
{
long sum=(n*(2*a+(n-1)*d))/2;
return sum;
}
};
//{ Driver Code Starts.
int main(){
int T;
cin >> T;
while(T--)
{
long n, ... | ALGO | 0.99961 | 4.927719 |
8cf2c71c-1a8b-40c5-b89f-480b32e33b88 | Prathamesh1916/LeetCode | Easy/557. Reverse Words in a String III.cpp | class Solution {
public:
string reverseWords(string s) {
int lastSpaceIndex = -1;
int len = s.size();
for (int strIndex = 0; strIndex <= len; strIndex++) {
if (strIndex == len || s[strIndex] == ' ') {
int startIndex = lastSpaceIndex + 1;
int endInd... | ALGO | 0.999947 | 6.337946 |
d9eb14f7-db80-4b68-b8f3-90245056a292 | actium/codeforces | 1300/70/1373b.cpp | #include <iostream>
void answer(bool v)
{
constexpr const char* s[2] = { "NET", "DA" };
std::cout << s[v] << '\n';
}
void solve(const std::string& s)
{
size_t f[2] = {};
for (const char c : s) {
++f[c - '0'];
}
const size_t k = std::min(f[0], f[1]);
answer(k % 2 == 1);
}
void te... | ALGO | 0.99901 | 5.508429 |
4033b058-286a-4b18-a6f1-6bbb45cb3842 | ddeka0/random-codes-gate-prep | t.cpp | #include <stdio.h>
int main() {
int row,column;
for(row = 1;row <= 5;row++) {
for(column = 1;column<=5;column++) {
printf("*");
}
printf("\n");
}
} | ALGO | 0.998008 | 3.184585 |
94976a88-ee0e-4f60-bc47-d15ce6aaf61c | tanvir14012/Sphere-Online-Judge-My_Solutions | spoj LPIS try1.cpp | #include <bits/stdc++.h>
using namespace std;
int a[1000000];
int main()
{
int n,mx,temp;
while(scanf("%d",&n)!=EOF)
{
mx = 1;
for(int i= 0; i<n; i++)
{
scanf("%d",&temp);
if(a[temp-1] != 0) {
a[temp] = a[temp-1]+1;
mx = (a[tem... | ALGO | 0.999915 | 3.696246 |
43b54386-702e-4e9f-afd9-c940726720ea | finetglazer/finetglazer | DI3.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
int t;
cin >> t;
for (int i = 0; i < t; ++i) {
string a;
getline(cin>>ws,a);
string t2;
if (a[0]=='+'&&a[1]=='8'&&a[2]=='4') {
a.erase(a.begin(),a.begin()+3);
a="0"+a;
}
... | ALGO | 0.987298 | 3.917814 |
8015c4ea-7e05-42c5-82bf-b7e10520a2e0 | shiver/blaze-lib | blazemark/src/eigen/Mat6TMat6Mult.cpp | //=================================================================================================
//=================================================================================================
//*************************************************************************************************
// Includes
//****... | ALGO | 0.995881 | 5.446157 |
72df6db3-4c32-47f7-bf52-92778d431cac | SoulTree-Lovers/CppClass | Ch19/19-16.cpp | //Program to demonstrate use of the generic find function.
#include <iostream>
#include <vector>
#include <algorithm>
using std::cin;
using std::cout;
using std::endl;
using std::vector;
using std::vector<char>::const_iterator;
using std::find;
int main( )
{
vector<char> line;
cout << "Enter a line of text:\... | ALGO | 0.996133 | 4.527824 |
be053ac9-2722-4d51-bc50-3047cccddd40 | JavierCunat/LeetCode | 1833-find-the-highest-altitude/1833-find-the-highest-altitude.cpp | class Solution {
public:
int largestAltitude(vector<int>& gain) {
int maxSeen = 0, size = gain.size(), curr = 0;
for(int i = 0; i < size; i++) {
curr+=gain[i];
maxSeen = max(maxSeen, curr);
}
return maxSeen;
}
}; | ALGO | 0.999919 | 6.228629 |
711c0f88-c881-4420-a347-3d18abd48151 | raincross7/code-similarity | codes/train_code/problem025/problem025_475.cpp | #include<iostream>
using namespace std;
int main(){
long double ax[100],ay[100],bx[100],by[100],cx[100],cy[100],dx[100],dy[100];
int n;
cin>>n;
for(int i=0;i<n;i++){
cin>>ax[i]>>ay[i]>>bx[i]>>by[i]>>cx[i]>>cy[i]>>dx[i]>>dy[i];
}
for(int i=0;i<n;i++){
long double A=0,B=0;
A=(by[i]-ay[i])/(bx[i]-ax[i]);
B=(... | ALGO | 0.999784 | 3.646789 |
7a296815-d1d1-46f1-b8b4-9cb1b0516ca6 | JGEC-Winter-of-Code/JWoC_Algorithms | minDifference.cpp |
#include <bits/stdc++.h>
using namespace std;
const int sz = 1e5;
bool isPrime[sz + 1];
void sieve()
{
memset(isPrime, true, sizeof(isPrime));
isPrime[0] = isPrime[1] = false;
for (int i = 2; i * i <= sz; i++) {
if (isPrime[i]) {
for (int j = i * i; j < sz; j += i) {
isPrime[j] = false;
... | ALGO | 0.999935 | 4.623712 |
f5650086-d7a0-4229-b90d-5fb122a5c345 | riyamudgal/Summer-Internship-Program | LeetCode-Programs/Minimum Number of Moves to Seat Everyone.cpp | class Solution {
public:
int minMovesToSeat(vector<int>& seats, vector<int>& students) {
sort(seats.begin(),seats.end());
sort(students.begin(),students.end());
int sum=0;
for(int i=0;i<seats.size();i++)
{
sum=sum+abs(students[i]-seats[i]);
}
retur... | ALGO | 0.999895 | 4.680784 |
64f5c8d1-06e7-4fa7-8b21-2c5c348d9846 | f2rkan/intro-to-Programming-w-c-plus-plus | part-4/8/4.cpp | #include<iostream>
int main(void)
{
using namespace std;
double balance_simple, balance_compound, interest_simple, interest_compound;
const int principle = 100;
int years = 0;
balance_simple = balance_compound = principle;
while(balance_compound <= balance_simple)
{
interest_simp... | ALGO | 0.977736 | 3.937908 |
88eba349-0ebc-4b3b-93db-e9e90cc36291 | alperenunuvar/Cpp-Exercises | heads_or_tails.cpp | #include <iostream>
using namespace std;
int main()
{
// Variables
int hot;
srand(time(NULL));
hot=rand()%2;
if(hot==0)
{
cout << "Heads" << endl;
}
else
{
cout << "Tails" << endl;
}
return 0;
} | ALGO | 0.985689 | 4.072736 |
7607d5ee-c631-47c7-8924-e84d4e31cb17 | AleValeRacz/University | Semester 2/Object Oriented Programming/Test 3/Service.cpp | #include "Service.h"
vector<Document> Service::get_documents_sorted()
{
vector <Document> documents = this->repo.get_documents();
auto comparator = [](Document& a, Document& b)
{
return a.get_name() < b.get_name();
};
sort(documents.begin(), documents.end(), comparator);
return documents;
}
vector <Documen... | TOOL | 0.918049 | 4.058038 |
065d2f6d-4727-4047-876f-769299e0b101 | shlagbaum/quantlib-1.0 | ql/time/calendars/turkey.cpp | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
#include <ql/time/calendars/turkey.hpp>
namespace QuantLib {
Turkey::Turkey() {
// all calendar instances share the same implementation instance
static boost::shared_ptr<Calendar::Impl> impl(new Turkey::Impl);
... | TOOL | 0.857847 | 6.179087 |
d83fdb98-e094-43e1-86d9-a8a9415d2f04 | jinluchang/Qlattice | examples-cpp/vector_utils_cpps/control_point_average_mom_qlat.cpp | #include <sys/sysinfo.h>
#include "general_funs.h"
#include "utils_io_vec.h"
#include "utils_construction.h"
#include "utils_eigen_ov.h"
#include "utils_check_fun.h"
#include "utils_smear_vecs.h"
#include "utils_lms_funs.h"
using namespace qlat;
inline void write_corr_zero(corr_dat<Ftype >& res, qlat::vector_gpu<Comp... | ALGO | 0.975268 | 3.561508 |
4807baee-aa42-410a-95be-a859047cc3ac | class1c-j/FEUP-CAL | TP3/ex1.cpp | #include "exercises.h"
#include <limits>
#include <thread>
#include <algorithm>
#include <cmath>
const double MAX_DOUBLE = std::numeric_limits<double>::max();
Point::Point(double x, double y) {
this->x = x;
this->y = y;
}
Point::Point(int x, int y) {
this->x = x;
this->y = y;
}
double Point::distan... | ALGO | 0.998943 | 6.040592 |
686af84b-eed1-471c-8676-cadad120ff87 | BENDENG1/FourCppAlgorithmStudy | 2023_07/WEEK3/김동균_할인 행사.cpp | #include <string>
#include <vector>
#include <unordered_map>
using namespace std;
int solution(vector<string> want, vector<int> number, vector<string> discount) {
int answer = 0;
int n = discount.size();
for (int i = 0; i <= n - 10; i++) { // 10일 동안의 반복
int j;
for (j = 0; j < want.size(); ... | ALGO | 0.999491 | 5.475639 |
4b3c11cf-5eb2-407f-b14f-fa2a150c34ce | radhiaauliaa/pratikum-struktur-data | Jobsheet 10 - Shell and Quick Sort/Percobaan/Percobaan 6.cpp | //created by Radhia Aulia Nisa 23343049
#include <stdio.h>
#include <stdlib.h>
#define MAX 10
#define MaxStack 10
int Data[MAX]; // = {12,35,9,11,3,17,23,15,31,20};
// Prosedur menukar data
void Tukar (int *a, int *b){
int temp;
temp = *a;
*a = *b;
*b = temp;
}
// Prosedur pengurutan metode Quick Sor... | ALGO | 0.999954 | 4.656093 |
73713950-3517-483b-8440-92594ebc0b9f | LeoLanehh/CustomQGroundControl | libs/eigen/doc/examples/class_CwiseUnaryOp.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
// define a custom template unary functor
template<typename Scalar>
struct CwiseClampOp {
CwiseClampOp(const Scalar& inf, const Scalar& sup) : m_inf(inf), m_sup(sup) {}
const Scalar operator()(const Scalar& x) const { return x<m_... | ALGO | 0.949922 | 6.417363 |
021f2725-95e2-4222-b426-3da2a4514862 | buniatyann/Hackerrank | Interview Preparation Kit/Linked Lists/InsertingANodeIntoASortedDoublyLinkedList.cpp | #include <bits/stdc++.h>
class DoublyLinkedListNode {
public:
int data;
DoublyLinkedListNode *next;
DoublyLinkedListNode *prev;
DoublyLinkedListNode(int node_data) {
this->data = node_data;
this->next = nullptr;
this->prev = nullptr;
}
};... | ALGO | 0.999804 | 6.311085 |
d215216b-b546-4758-8f6c-8e63be52be54 | ixray-team/xray-vss-archive | net.ssa/xrLC/OGF_Face_Sphere.cpp | #include "stdafx.h"
#include "build.h"
#include "ogf_face.h"
#pragma warning(disable:4995)
#include "MgcCont3DMinSphere.h"
#pragma comment(lib,"MagicFM.lib")
BOOL f_valid (float f)
{
return _finite(f) && !_isnan(f);
}
BOOL SphereValid (xr_vector<Fvector>& geom, Fsphere& test)
{
if (!f_valid(test.P.x) || !f_val... | ALGO | 0.996579 | 5.862392 |
5d22ce8f-1e1e-4511-aded-aef7d4db1cdd | rickors560/LeetCode | DeleteTheMiddleNodeOfALinkedList.cpp | #include <bits/stdc++.h>
using namespace std;
struct ListNode
{
int val;
ListNode *next;
ListNode() : val(0), next(nullptr) {}
ListNode(int x) : val(x), next(nullptr) {}
ListNode(int x, ListNode *next) : val(x), next(next) {}
};
class Solution
{
public:
ListNode *deleteMiddle(ListNode *head)
... | ALGO | 0.999839 | 5.785584 |
3a0d87c2-e368-4298-88c3-d013bb012f14 | ishandutta2007/codeforces | yukihana0416/normal/1469/A.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <cmath>
#include <climits>
#include <cassert>
#include <iostream>
#include <vector>
#include <queue>
#include <list>
#include <stack>
#include <deque>
#include <map>
#include <set>
#include <unordered_map>
#include <unordered_set>
#inc... | ALGO | 0.999949 | 3.714753 |
928ada25-8015-414d-8329-233224cf2294 | bae-sh/BOJ | 1259/1259/1259.cpp | #include<iostream>
#include<string>
using namespace std;
int main() {
ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
while (true) {
string a; cin >> a;
if (a == "0") {
break;
}
else {
int len = a.size();
bool p = true;
for (int i = 0; i <= (len / 2) - 1; i++) {
if (a[i] != a[len - i -... | ALGO | 0.999928 | 4.283348 |
dc1e2b39-e49b-458a-bf8b-8ad4b3cf31b4 | weiweimonster/CS184 | p4-clothsim-sp22-heathcliff-4/ext/nanogui/ext/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_visitors.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Eigen::MatrixXf m(2,2);
m << 1, 2,
3, 4;
//get location of maximum
MatrixXf::Index maxRow, maxCol;
float max = m.maxCoeff(&maxRow, &maxCol);
//get location of minimum
MatrixXf::Index minRow, m... | ALGO | 0.9996 | 4.008351 |
0f36cbaa-5544-4eab-aae2-b4ea5d597575 | vaishnavi2699/Functions.cpp | 22124 ATM .cpp | //write a functions to display deposit amt,withdraw amt and bal enq,exit?
#include<iostream>
using namespace std;
void viewoptions();
void validate();
void deposit();
void withdraw();
void num_of_notes(int amt);
int bal=5000,pincount=1,wcount=1; //Global variable;
void validate()
{
int pin;
cout<<"enter pin number: ... | TOOL | 0.866249 | 3.601818 |
e56a7ab5-da9b-4400-81c7-3ff66e32a627 | divanshu31/Leetcode | 1667-find-kth-bit-in-nth-binary-string/find-kth-bit-in-nth-binary-string.cpp | class Solution {
public:
char findKthBit(int n, int k) {
if (n == 1) return '0';
int len = pow(2, n) - 1;
if (k - 1 == len / 2) return '1';
if (k - 1 < len / 2) return findKthBit(n - 1, k);
return findKthBit(n - 1, len - k + 1) == '0' ? '1' : '0';
}
}; | ALGO | 0.999993 | 6.469321 |
01e3765c-0d0c-42d3-b65a-b0a9759f5bd8 | FPSG-UIUC/Pandora | simulator/src/systemc/tests/systemc/misc/cae_test/general/control/loop/for_exit/for_exit.cpp | /*****************************************************************************
for_exit.cpp --
Original Author: Rocco Jonack, Synopsys, Inc., 1999-07-29
*****************************************************************************/
/*****************************************************************************... | ALGO | 0.925585 | 3.42969 |
1e85c96a-141d-48b2-a5af-9d12ad7de4f8 | Cron191/DSA | ONDSACUOIKY/36.cpp | #include <iostream>
using namespace std;
struct Hocsinh
{
int Maso;
string Hoten;
int Namsinh;
bool Gioitinh;
double TBK;
};
void Input(Hocsinh &x)
{
cin >> x.Maso;
getline(cin >> ws, x.Hoten);
cin >> x.Namsinh;
cin >> x.Gioitinh;
cin >> x.TBK;
}
void Output(Hocsinh hs)
{
c... | ALGO | 0.964534 | 3.539271 |
e8bf5089-bad7-496a-9030-b3976ffcbcd1 | has2/Problem-Solving | boj-solved.ac/Gold4/2550.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
int N,a[10001],b[10001],c[10002],dp[10002];
pair<int,int> trc[10001];
int main(){
scanf("%d",&N);
for(int i=1;i<=N;i++){
int v;
scanf("%d",&v);
a[v]=i;
}
for(int i=1;i<=N;i++) scanf("%d",&b[i]);
for... | ALGO | 0.999999 | 3.344555 |
f1d92369-31cc-4c94-a6fe-1a6b378b9d35 | pseudo-usama/my-undergrad-coding | 1 Semesters/3/Data structures/Programs/Pre semester self learning/80Others/ahmed puzzle.cpp | // ahmed puzzle.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include"iostream"
using namespace std;
void main() {
int Array[8] = { 1, 3, 5, 7, 9, 11, 13, 15 };
int a = 0, b = 0, c = 0;
while (a != 8){
if (Array[a] + Array[b] + Array[c] == 30){
cout << Array[a] << " " <<... | ALGO | 0.998396 | 3.316163 |
1c600197-8e66-4f82-9f6a-06ab407933aa | rifatbroh/CODE__MONK | Contest_(CF) 69/B_Aleksa_and_Stack.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin >> t;
while(t--) {
int x = 1e8;
int n; cin >> n;
for (int i = 0; i < n; i++){
cout << x + i << " \n"[i == n - 1];
}
}
return 0;
}
| ALGO | 0.998547 | 3.979794 |
36bbf5de-6feb-4471-8702-fbfb45519343 | fafa1899/BuildCppDependency | Source/boost-1.86.0/libs/math/test/git_issue_959.cpp | #include <iostream>
#include <array>
#include <vector>
#include <boost/math/interpolators/bezier_polynomial.hpp>
using tControlPoints = std::vector<std::array<double, 3>>;
void interpolateWithPoints(tControlPoints cp)
{
const auto cpSize = cp.size();
auto bp = boost::math::interpolators::bezier_polynomial(std... | ALGO | 0.967331 | 5.227931 |
d5cc7546-244b-4af8-8e9d-c5c21b6c604e | amrit12001703/6Companies30Days | Q76. max probabilty.cpp | class Solution {
public:
double maxProbability(int n, vector<vector<int>>& edges, vector<double>& succProb, int start, int end) {
vector<vector<pair<int, double>>> graph(n);
priority_queue<pair<double, int>> pq;
pq.push({ (double)1.0, start });
for (int i = 0; i < edges.size(); i++)... | ALGO | 0.999977 | 5.706578 |
615a2bbe-f476-4c52-a131-f17e09fd213e | ajitkumar108/c-- | 12.cpp | #include<iostream>
using namespace std;
int linearsearch(int arr[],int size,int element)
{
for (int i = 0; i < size; i++)
{
if(arr[i]==element)
{
return i;
}
}
return -1;
}
int binarysearch()
{
}
int main()
{
int arr[]={1,00,20,35,44,21,200,11,7,4,69};
int size = sizeof(arr)/sizeof(int);
in... | ALGO | 0.999514 | 4.000305 |
00375d8c-cdf2-41d8-a057-b533fcded860 | sukiand/LeetCode-LintCode | Validate Binary Search Tree.cpp | #include <iostream>
#include <vector>
#include <stack>
using namespace std;
class TreeNode {
public:
int val;
TreeNode *left, *right;
TreeNode(int val) {
this->val = val;
this->left = this->right = NULL;
}
};
vector<int> traversal(TreeNode *root){
stack<TreeNode *> store;
vector<int> result;
Tr... | ALGO | 0.999961 | 5.975032 |
ea96cb14-f476-4b64-ab28-573ea3249890 | ebattenberg/partconv | src/testSignaling.cpp | #include <stdio.h>
#include <sys/time.h>
#include <pthread.h>
#include <sched.h>
#define TRIALS (10000)
#define THREADS (2)
#define NAIVE
//#define BROADCAST
//#define ATOMIC
double get_time()
{
//output time in seconds
struct timeval t;
gettimeofday(&t,NULL);
return (double)(t.tv_sec+t.tv_usec/1E6);
... | TOOL | 0.990785 | 4.65264 |
95928952-f17f-4395-897d-ecd6a2388729 | atulpatil511/SDAccel_examples | getting_started/kernel_opt/systolic_array_ocl/src/host.cpp | /*******************************************************************************
Description:
This is a matrix multiplication which showcases the "Systolic Array" based
algorithm design. Systolic array type of implementation is well suited for
FPGAs. It is a good coding practice to convert base algorit... | ALGO | 0.99891 | 5.331182 |
c5c63810-3613-4ab6-80bf-b4214eab680b | Gonagi/Algorithm | 백준/9_탈옥_9376.cpp | // // 탈옥
// // 9376
// #include <algorithm>
// #include <deque>
// #include <iostream>
// #include <string>
// #include <vector>
// struct Direction
// {
// int y, x;
// };
// Direction dir[4] = {{0, 1}, {0, -1}, {1, 0}, {-1, 0}};
// Direction prison1, prison2;
// int c, h, w;
// void input(std::vector<std::vecto... | ALGO | 0.999937 | 4.084318 |
f295f116-ce56-494e-8bdd-06c1476fba73 | IDA-TUBS/lwW2RP | thirdparty/boost_1_73_0/libs/numeric/odeint/examples/multiprecision/lorenz_mp.cpp | #include <iostream>
//[ mp_lorenz_defs
#include <boost/numeric/odeint.hpp>
#include <boost/multiprecision/cpp_dec_float.hpp>
using namespace std;
using namespace boost::numeric::odeint;
typedef boost::multiprecision::cpp_dec_float_50 value_type;
typedef boost::array< value_type , 3 > state_type;
//]
//[ mp_lorenz_... | ALGO | 0.998587 | 7.042813 |
0fcf76b1-c926-460f-af99-e22fe15467d7 | kumarnutan204/STLPractice | Iterators.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
vector<int> v ={2,3,5,6,7};
for(int i=0;i<v.size();++i)
{
cout<< v[i] << " ";
}
cout<< endl;
//syntax for iterators
// container syntax :: iterator var_name = container_var.begin()
vector<int>::iterator it= v.begin();
... | ALGO | 0.954347 | 3.34984 |
6355ef91-1ada-4e05-9856-dca6ed3a4950 | ki7348/Algorithm | cpp/dynamic_programming/7570.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int n;
int d[1000001];
int main() {
cin.tie(NULL);
ios::sync_with_stdio(false);
cin >> n;
int result = 0;
for(int i=1;i<=n;i++){
int x;
cin >> x;
d[x] = d[x-1] + 1;
result = max(result,... | ALGO | 0.999858 | 3.688391 |
72e2fc3e-27cc-4833-b7ac-117c985fdf57 | viiccwen/Competitve-programming | PurpleBook/main.cpp | #include <bits/stdc++.h>
using namespace std;
set<char> st;
void solve() {
string s = "cbacdcbc";
string ret;
for (auto c : s) st.insert(c);
for (int i = 0; i < s.size(); i++) {
if (s[i] == *st.begin()) {
for (int j = i; j < s.size(), st.empty(); j++) {
auto ite = st.find(s[j]);
if... | ALGO | 0.999971 | 5.009686 |
9f8553f4-edc2-4a1a-ab15-508b7adf74f3 | ishandutta2007/codeforces | generic_placeholder_name/normal/1249/D2.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/trie_policy.hpp>
#include <ext/rope>
#pragma GCC optimize("Ofast")
#pragma GCC optimization("unroll-loops")
#pragma GCC target("avx,avx2,fma")
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
mt19937 rng(... | ALGO | 0.999974 | 4.016738 |
e722e868-6894-4feb-9ae0-5362de590f2c | Aman2241/Self-Driving-Car | project_10_MPC_control/src/Eigen-3.3/doc/examples/TutorialLinAlgRankRevealing.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix3f A;
A << 1, 2, 5,
2, 1, 4,
3, 0, 3;
cout << "Here is the matrix A:\n" << A << endl;
FullPivLU<Matrix3f> lu_decomp(A);
cout << "The rank of A is " << lu_decomp.rank() << endl;
c... | ALGO | 0.999592 | 3.720849 |
2c599929-7012-4842-a092-b27d987828d3 | LeeDa16/Homework-of-software | S03/P02/main.cpp | #include <iostream>
#include <fstream>
#include <ctime>
#include <cmath>
using namespace std;
#include "CP_Prime.h"
#include "CP_PrimeTest.h"
int main()
{
int m, n;
gb_input(m, n);
//ʱڲԳٶ
//int tim = clock();
gb_sort(m, n);
gb_primeList_1(n);
cout << "The results of method 1 are:" << endl;
gb_output(flag_1... | ALGO | 0.999334 | 4.15225 |
1eb2a12f-de1a-4c0f-85b3-d23d4b8e3f1a | ishandutta2007/codeforces | szb/normal/1545/B.cpp | #pragma GCC optimize("Ofast")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
#define For(i,x,y) for(ll i = (ll)(x);i <= (ll)(y);++i)
#define rep(i,x,y) for(ll i = (ll)(x);i < (ll)(y);++i)
#define FOr(i,x,y) for(ll i = (ll)(x);i >= (ll)(y);--i)
#define fi first
#define se second... | ALGO | 0.99997 | 4.479909 |
f1fe5b52-95c5-45da-bec9-f64e2b938f8d | eliseydudin/ict-solutions | informatics/204.cpp | #include <algorithm>
#include <iostream>
#include <map>
#include <utility>
#include <vector>
struct int_m_one {
int number = -1;
operator int() { return this->number; }
int_m_one(int n) { this->number = n; }
int_m_one() {}
};
typedef std::map<std::pair<int, int>, int_m_one> dp_type;
int lcs(dp_type &dp, std... | ALGO | 0.99995 | 3.77294 |
a2afb0fa-266d-44cc-9192-b0cc3dcff235 | shawakation/PAT | Basic Level/1029/标准解.cpp | #include <iostream>
#include <string>
#include <cctype>
using namespace std;
int main()
{
string s1,s2,broken;
cin>>s1>>s2;
for (int i=0;i<s1.length();i++) {
if (s2.find(s1[i])==string::npos&&broken.find(toupper(s1[i]))==string::npos)
broken+=toupper(s1[i]);
}
cout<<broken;
return 0;
}
| ALGO | 0.999949 | 3.493082 |
6db0b1dc-4c38-47ad-a7b9-2b82b05e94eb | richoux/LearningErrorFunctions | explored/eigen/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXf mat(2,4);
Eigen::VectorXf v(4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
v << 0,1,2,3;
//add v to each row of m
mat.rowwise() += v.transpose();
std::cout << "Broadcasting result: " << std::... | ALGO | 0.995195 | 4.259387 |
8df68d55-2a91-42e1-a6db-db6ea3b96a93 | Y3rnur/just_some_DSA_problems | CF_800/486A.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main() {
long long a;
cin >> a;
if (a % 2 == 0) {
a = a / 2;
} else {
a = (-1) * (a + 1) / 2;
}
cout << a << "\n";
return 0;
} | ALGO | 0.999777 | 3.750603 |
f8d345e2-7a92-495f-92b2-0c93279ff14d | SUYASHHAGARWAL/-CrackYourPlacement | Linked List/RemoveDuplicates_from_Sorted_List_II.cpp | /*
day6
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
class Solution {
public:
ListNode* del... | ALGO | 0.999837 | 5.132865 |
b67cccd2-c853-4f5f-83a1-0a6bf1eaf112 | aerice/cs180 | assignment3/Code/main.cpp | #include <iostream>
#include <opencv2/opencv.hpp>
#include "global.hpp"
#include "rasterizer.hpp"
#include "Triangle.hpp"
#include "Shader.hpp"
#include "Texture.hpp"
#include "OBJ_Loader.h"
static float Dot(const Eigen::Vector3f& v1, const Eigen::Vector3f& v2)
{
return v1.x() * v2.x() + v1.y() * v2.y() + v1.z() ... | TOOL | 0.865678 | 3.796354 |
d5af35a8-befb-43cd-8080-90f09aa55fa8 | dilipsuthar60/leetcodeSolution | 3336-find-the-number-of-subsequences-with-equal-gcd/3336-find-the-number-of-subsequences-with-equal-gcd.cpp | class Solution {
public:
const int mod=1e9+7;
long long dp[201][201][201];
long long find(vector<int>&nums,int index,int g1,int g2){
if(index>=nums.size()){
return g1&&g2&&(g1==g2);
}
if(dp[index][g1][g2]!=-1) return dp[index][g1][g2]%mod;
long long ans=find(nums,... | ALGO | 0.999987 | 5.419718 |
cd1b93bf-b111-4f46-bdf0-1fbb397cc837 | SpatikaP/DSA-solutions | 2448-minimum-cost-to-make-array-equal/2448-minimum-cost-to-make-array-equal.cpp | class Solution {
public:
long long solve(vector<int>& nums, vector<int>& cost, int m){
long long res=0;
for(int i=0; i<nums.size(); i++){
res+=(long long)abs(nums[i]-m)*cost[i];
}
return res;
}
long long minCost(vector<int>& nu... | ALGO | 0.999982 | 5.68587 |
4c2713c2-4e42-4814-9ae8-6eb4b7c8d9a5 | Super-long/C- | C++练习/test虚函数/test_vptr.cpp | #include <bits/stdc++.h>
using namespace std;
class A1
{
public:
A1(int _a1 = 1) : a1(_a1) { }
virtual void f() { cout << "A1::f" << endl; }
virtual void g() { cout << "A1::g" << endl; }
virtual void h() { cout << "A1::h" << endl; }
~A1() {}
public:
int a1;
};
class C : public A1
{
public:
... | ALGO | 0.859668 | 3.738871 |
0a85bb0c-dfa8-442a-b130-a9c5ecc205f9 | potato-coin/react-native-potato-crypto | crypto/blake2b.cpp | #include <string>
#include "blake2b.h"
#include "blake2_common.h"
#include "memzero.h"
typedef struct blake2b_param__
{
uint8_t digest_length; /* 1 */
uint8_t key_length; /* 2 */
uint8_t fanout; /* 3 */
uint8_t depth; /* 4 */
uint32_t leaf_length; /* 8 */
uint32_t node_... | ALGO | 0.986845 | 7.043059 |
a7dfd38c-2b80-4375-92b3-1ed8abe4ef7c | trinhminhtriet/leetcode | solutions/0300-0399/0398.random-pick-index/Solution.cpp | class Solution {
public:
vector<int> nums;
Solution(vector<int>& nums) {
this->nums = nums;
}
int pick(int target) {
int n = 0, ans = 0;
for (int i = 0; i < nums.size(); ++i) {
if (nums[i] == target) {
++n;
int x = 1 + rand() % n;
... | ALGO | 0.999913 | 6.429359 |
daa062c8-1621-4c70-b89d-23311e1d0c2c | raincross7/code-similarity | codes/train_code/problem100/problem100_345.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> P;
typedef pair<P,ll> PLL;
typedef pair<P,P> PP;
typedef vector<ll> llVEC;
typedef vector<P> PVEC;
typedef priority_queue<P,PVEC,greater<P> > PPQ;
typedef priority_queue<ll, llVEC, greater<ll> > llPQ;
#define rep(i,a,n) for(ll i =... | ALGO | 0.999968 | 3.423768 |
b805dd74-2885-4e3d-bf82-68569dbb04ec | mshokry10/Algorithms-and-Data-Structures | Online-Judges/UVA/11554.cpp | /*
* After observing the results by brute force, I found a pattern that goes like this:
* Starting from the 3rd result, the result in even positions increase by powers of 2,
* like 1, 4, 9, 16, ...
* And the result in odd positions increase by multiples of 2, like 2, 4, 6, ...
* So I precalculated the results for ... | ALGO | 0.999544 | 5.23305 |
4260a206-f655-4213-97e8-2753594ed76a | ZHENZHI76/CPP_OJ_exercise | C++算法编程课C1/c++练习/OJ练习/4091_test.cpp | #include <iostream>
using namespace std;
int main() {
int a, b, c;
cin >> a >> b >> c;
int tb = a * 10 * 8 + b * 8 + c;
int boxes = tb / (24 * 10 * 8);
int rb = tb % (24 * 10 * 8);
int br = rb / (10 * 8);
rb = rb % (10 * 8);
int p = rb / 8;
rb = rb % 8;
cout << boxes << end... | ALGO | 0.996402 | 3.484351 |
f30d5faf-87e6-4143-b431-824b1d61d7e7 | yash0501/codeforces | a2oj(ladder_4_div_2_a)/presents.cpp | // http://codeforces.com/problemset/problem/136/A
#include <iostream>
using namespace std;
int main() {
int i,n,a;
cin>>n;
int arr[n];
for(i=1;i<=n;i++){
cin>>a;
arr[a-1]=i;
}
for(i=0;i<n;i++){
cout<<arr[i]<<" ";
}
return 0;
}
| ALGO | 0.999865 | 3.588025 |
80c8d561-ca7b-478a-b6ea-3d1232899fcc | thucvu2001/c-dsa | #9.ThuatToanThamLam/Bai5.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
int a[n], b[n];
for (int i = 0; i < n; i++) {
cin >> a[i];
b[i] = a[i];
}
sort(b, b + n);
for (int i = 0; i < n; i++) {
if (!(a[i] == b[i] || a[i] == b[n - i - 1])) {
cout << "NO\... | ALGO | 0.999998 | 3.780429 |
c86d3882-649c-4649-a5ab-4b1b83becdb1 | yossi77/opencv | modules/calib3d/perf/perf_pnp.cpp | #include "perf_precomp.hpp"
namespace opencv_test
{
using namespace perf;
CV_ENUM(pnpAlgo, SOLVEPNP_ITERATIVE, SOLVEPNP_EPNP, SOLVEPNP_P3P, SOLVEPNP_DLS, SOLVEPNP_UPNP)
typedef tuple<int, pnpAlgo> PointsNum_Algo_t;
typedef perf::TestBaseWithParam<PointsNum_Algo_t> PointsNum_Algo;
typedef perf::TestBaseWithParam<int... | TEST | 0.893073 | 7.081458 |
78a9c068-7631-4d19-98a9-4f24bf18d6f5 | Mohd-3/Codeforces-Solutions | Normal/570/B.cpp | #include <bits/stdc++.h>
#define endl "\n"
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using ll = long long;
const int INF = 0x3f3f3f3f;
using namespace std;
int n, m;
int main()
{
IOS
cin >> n >> m;
if (m ==1) {
if (n==1) {
cout << 1 << endl;
} else {
... | ALGO | 0.999949 | 3.462688 |
a3cb6416-acf1-474c-ba13-6cc43a346b95 | sarvex/leetcode-c-sharp | solution/1100-1199/1180.Count Substrings with Only One Distinct Letter/Solution.cpp | class Solution {
public:
int countLetters(string s) {
int ans = 0;
for (int i = 0, n = s.size(); i < n;) {
int j = i;
while (j < n && s[j] == s[i]) ++j;
ans += (1 + j - i) * (j - i) / 2;
i = j;
}
return ans;
}
}; | ALGO | 0.999942 | 6.146346 |
298b17c0-10de-4c8e-9cf2-b405e46f7e6d | nguyencongvan10022002/CTDL_GTH | codeptit/tong_gan_0_nhat.cpp | #include<bits/stdc++.h>
using namespace std;
main(){
long long t;
cin >> t;
while(t--){
long long n;
cin >> n;
long long a[n];
for(long long i = 0; i < n; i++) cin >> a[i];
long long res = INT_MAX;
long long ma = INT_MAX;
for(long long i = 0; i < n - 1... | ALGO | 0.999955 | 3.862772 |
538e1e76-c8ee-49c7-8031-6bed509b22fd | JulesDommartin/LangagesPourLeWeb | RO/code_squelettesv2/affiche.cpp | #include "affiche.h"
#include <iostream>
#include <vector>
using namespace std;
// **************** BINOME ****************
// Etudiant 1: DOMMARTIN Jules:
// Etudiant 2: JIMENEZ Pablo:
/* Fonction qui affiche la matrice d'adjacence passee en paramètre */
void afficheGraphe(vector<vector<int> > &G)
{
cout << end... | ALGO | 0.868673 | 3.722047 |
69f88bce-fdc0-4d85-9b3f-9bec6545a9e6 | Raaina83/C_plus_plus | c++/array/rotateArr.cpp | #include<iostream>
#include<vector>
using namespace std;
void rotateArr(vector<int>& v,int k);
int main(){
int n,k;
cout<<"Enter length for the array:"<<endl;
cin>>n;
vector<int> v(n);
for(int i=0;i<n;i++){
cout<<"Enter value for "<<i<<" index ";
cin>>v.at(i);
}
cout<<"Ente... | ALGO | 0.999713 | 4.644568 |
60e5917b-1154-4210-8f2f-17b93128298a | SantaDud/BytewiseFellowship | Task4.cpp | // BST Implementation
#include <iostream>
struct Node
{
int data;
Node* smaller;
Node* larger;
Node(int d, Node* s, Node* l)
{
this->data = d;
this->smaller = s;
this->larger = l;
}
};
void Push(Node* node, int number)
{
if (node->data > number)
if (node->... | ALGO | 0.999909 | 5.639592 |
a6985a73-91ec-41bc-a066-31d071fdf295 | vaibhavchaubey/DSA-Practice | 0094-binary-tree-inorder-traversal/0094-binary-tree-inorder-traversal.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.999989 | 6.642808 |
1131fd31-2929-4869-8275-e8fb8ab5c15d | looneyd-rohit/cp_templates | cp_old/learn_practice/apna_college/q2.cpp | /******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
******************************************... | ALGO | 0.999864 | 4.158534 |
272afd9e-b4ef-46d2-9cde-5f7939d812d7 | rohan8789/Languages | C++/chapter09/practice/22_StringRevByLoop.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
// string c;
// getline(cin, c);
// int i = 0;
// for(i = c.length()-1; i >= 0; --i)
// {
// cout<<c[i];
// }
char c[50];
cin.getline(c, 50);
int i = 0;
int len = strlen(c);
for(i = len - 1; i >= 0; --i)
... | ALGO | 0.999293 | 3.416386 |
1677af04-fcc1-494d-afcc-871168f4dd37 | viren-joshi/DSASubmissions | problems/two_sum_ii_-_input_array_is_sorted/solution.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& numbers, int target) {
int i=0, j=numbers.size() - 1, temp;
while(i<j) {
temp = target - numbers[i];
if(temp == numbers[j]) {
return {i+1,j+1};
} else if (temp < numbers[j]) {
... | ALGO | 0.999653 | 6.422479 |
67f2130e-2a36-40af-bdae-6e13a903115e | pinebai/Combustion | CNSReact/src/CNSReact_advance.cpp | #include <winstd.H>
#include "CNSReact.H"
#include "CNSReact_F.H"
using std::string;
Real
CNSReact::advance (Real time,
Real dt,
int iteration,
int ncycle)
{
Real dt_new = dt;
dt_new = advance_hydro(time,dt,iteration,ncycle);
Real cur_time = state[S... | ALGO | 0.984809 | 5.356354 |
b8f96836-667e-44c7-844e-fce4d51a75cf | nychitman1/android_frameworks_av | media/libstagefright/codecs/amrnb/enc/src/c4_17pf.cpp | /*----------------------------------------------------------------------------
; INCLUDES
----------------------------------------------------------------------------*/
#include "c4_17pf.h"
#include "typedef.h"
#include "inv_sqrt.h"
#include "cnst.h"
#include "cor_h.h"
#include "set_sign.h"
#include "basic_op.h"
/*---... | ALGO | 0.999979 | 5.243907 |
eb0567f3-54bb-46bb-a3c3-700134bd238f | RE2105A23/CSE256 | HackerRank Notes/20231018/SpiralReversalOfMatrix.cpp | /*
Given a M X N matrix, traverse the matrix in spiral form in clock-wise.
Input:
M = 4, N = 3
matrix[][] = {{1, 2, 3},
{4, 5, 6},
{7, 8, 9},
{10, 11, 12}}
Output:
1 2 3 6 9 12 11 10 7 4 5 8
Input Format
first line reads the M and N
Next M lines reads the elemnts of the matrix
Example:
2 3
1 2 3
4 5 6
Constraints
... | ALGO | 0.999973 | 6.292537 |
88cf4993-0107-47f6-878a-6e8ae67b1c07 | louis-bompart/8IAR125-01 | lib/boost_1_61_0/libs/multi_index/example/rearrange.cpp | #if !defined(NDEBUG)
#define BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING
#define BOOST_MULTI_INDEX_ENABLE_SAFE_MODE
#endif
#include <boost/config.hpp>
#include <boost/detail/iterator.hpp>
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/random_access_index.hpp>
#include <boost/random/binomial_dis... | TEST | 0.968623 | 6.947739 |
38ff2621-5c52-4ddd-9c7e-5b729c028e26 | Park-MinJe/codetree-TILs | 240311/뿌요뿌요/puyo-puyo.cpp | #include <iostream>
using namespace std;
int n, blockSize = 0;
int** board;
bool** isVisited;
int dr[4] = {-1, 0, 1, 0},
dc[4] = {0, 1, 0, -1};
bool inRange(int r, int c){
return 0<=r&&r<n && 0<=c&&c<n;
}
void dfs(int r, int c, int num){
for(int i = 0; i < 4; ++i){
int nr = r + dr[i],
... | ALGO | 0.999857 | 4.297207 |
a220975c-04f0-4f4b-9956-80ad76c697da | Aazat/C_plus_plus | DSA/Containers/Sequential containers/std_vector.cpp | #include <vector>
#include <string>
#include <iostream>
int main(){
// initializing with initializer list;
std::vector<int> a {1,2,3,4,5};
// = operator for initialization.
std::vector<string> b = {"some", "thing", "here"};
// for each loop for accessing values of vectors
for (auto x : a){
std::cout << x <<... | ALGO | 0.960992 | 3.848527 |
246120e7-b1c8-4019-a3b1-f3dbe27b456a | Nithishkumar654/CrackYourPlacement | Day_2/subArraySumEqualsK.cpp | class Solution {
public:
int subarraySum(vector<int>& nums, int k) {
int ans = 0;
map<int, int> mp;
int sum = 0; mp[0]++;
for(int x : nums){
sum += x;
ans += mp[sum - k];
mp[sum]++;
}
return ans;
}
}; | ALGO | 0.999925 | 6.174346 |
923650a4-af37-47c1-ab15-6f5f592dbfb0 | ITESA-DYPCOE/Coffee-and-code | Geekforgeeks/A)Math/5_GCD.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
long long gcd(int a,int b)
{
if(b==0)
{
return a;
}
return gcd(b,a%b);
}
int main()
{
int n,m;
cin >> n>>m;
cout << gcd(n,m) << endl;
return 0;
} | ALGO | 0.999973 | 4.251621 |
c2b270e4-0478-4b8d-a0c2-03a937f667ea | samarec1812/UniversityProject | build arifmetic string without blocks (yellow belt 4 week).cpp | #include <iostream>
#include <iterator>
#include <vector>
#include <algorithm>
#include <deque>
using namespace std;
struct Operation {
char type = 0;
int number = 0;
};
bool NeedBrackets(char last, char current) {
return (last == '+' || last == '-') && (current == '*' || current == '/');
}
int main() ... | ALGO | 0.99973 | 5.517306 |
d882e40f-c475-40d8-94cd-83e5dc7de92c | MdAbuNafeeIbnaZahid/Competitive-Programming | CODEFORCES/Codeforces Round #418 (Div. 2)/a.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#include <ext/pb_ds/detail/standard_policies.hpp>
using namespace std;
using namespace __gnu_pbds;
using namespace __gnu_cxx;
// Order Statistic Tree
/* Sp... | ALGO | 0.999993 | 3.631976 |
a10f9380-e537-4ace-af7a-c1d3f5d2cf5d | 11fenil11/Competitive-Programming | Codeforces/prob1_A_div2_645.cpp | #include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define int long long
using namespace std;
int32_t main()
{
IOS
int tt;
cin>>tt;
for(int tc=0;tc<tt;tc++)
{
int n,m;
cin>>n>>m;
if((n*m)%2==0)
{
cout<<(n*m)/2<<endl;
... | ALGO | 0.999967 | 4.763822 |
140a4604-b751-4e39-a2d4-f97d7b5e452f | orijoon98/Algorithm_Study | C++/baekjoon/소수와펠린드롬_1747.cpp | #include <bits/stdc++.h>
using namespace std;
bool isPrime(int number) {
if (number == 1) return false;
for (int i = 2; i < number; i++) {
if (number % i == 0) return false;
}
return true;
}
bool isPal(int number) {
string strNum = to_string(number);
for (int i = 0; i < strNum.size(); i++) {
if (strNum[i] !... | ALGO | 0.999942 | 4.988594 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.