uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
53222e77-4272-4e3b-a433-26385174c7f4 | Dallin343/PathTracingRenderer | Parser/MySDFVisitor.cpp | //
// Created by Dallin Hagman on 9/3/21.
//
#include <Lights/DirectionalLight.h>
#include <Renderable/Sphere.h>
#include <Lights/PointLight.h>
#include <Renderable/Triangle.h>
#include <Lights/AreaLight.h>
#include "Material/TextureLoader.h"
#include "MySDFVisitor.h"
antlrcpp::Any MySDFVisitor::visitScene(antlrcpp::... | TOOL | 0.872229 | 6.870656 |
c3e2f9a2-87cc-4000-9f3e-58619bb0f51b | hack-parthsharma/LeetCode | 1631-path-with-minimum-effort/1631-path-with-minimum-effort.cpp | struct T {
int i;
int j;
int d;
T(int i, int j, int d) : i(i), j(j), d(d) {}
};
class Solution {
public:
int minimumEffortPath(vector<vector<int>>& heights) {
const int m = heights.size();
const int n = heights[0].size();
const vector<int> dirs{0, 1, 0, -1, 0};
auto compare = [](const T& a, c... | ALGO | 0.999988 | 6.460831 |
c2f527e7-8858-442e-a43e-68eb9dfe4d68 | sammochen/cp-submissions | codeforces/1436C.cpp | #define _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
typedef double db;
typedef vector<string> VS;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<ll> VLL;
typedef vector<VLL> VVLL;
typedef vector<VVLL> VVVLL;
typedef pair<ll,ll> PLL;
typedef map<ll,ll> ML... | ALGO | 0.999932 | 4.076963 |
7bce663b-deb2-43dd-9f8f-327bc55498f0 | ColtOS/android_frameworks_av | media/libstagefright/codecs/mp3dec/src/pvmp3_imdct_synth.cpp | /*
------------------------------------------------------------------------------
PacketVideo Corp.
MP3 Decoder Library
Filename: pvmp3_imdct_synth.cpp
Date: 09/21/2007
------------------------------------------------------------------------------
REVISION HISTORY
Description:
--------------------... | ALGO | 0.999746 | 4.159706 |
cae32911-3180-4fae-b7db-c3238c6051c8 | geoffgeorgein/CP | 1/647B.cpp | #include<bits/stdc++.h>
using namespace std;
#define all(x) (x).begin(),(x).end()
#define rall(x) x.rbegin(),x.rend()
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define F first
#define S second
#define ll ... | ALGO | 0.999855 | 4.294457 |
b8f35924-6891-48fc-b433-f59926f10f99 | bcm-uga/pcadapt | tmp-save/test.cpp | #include <Rcpp.h>
using namespace Rcpp;
// [[Rcpp::export]]
NumericVector prodGx(const NumericMatrix &G,
const NumericVector &x,
const NumericVector &p) {
int nSNP = G.nrow();
int nIND = G.ncol();
NumericVector res(nSNP);
for (int k = 0; k < nSNP; k++) {
double val... | ALGO | 0.999759 | 6.411263 |
bbab6ecf-64f4-47c5-a2bb-c532c62faac7 | thanostriantafyllou3/ph-dropout | 3d-gaussian-splatting/submodules/diff-gaussian-rasterization/third_party/glm/test/core/core_func_integer_find_lsb.cpp | #include <glm/glm.hpp>
#include <cstdio>
#include <cstdlib> //To define "exit", req'd by XLC.
#include <ctime>
int nlz(unsigned x)
{
int pop(unsigned x);
x = x | (x >> 1);
x = x | (x >> 2);
x = x | (x >> 4);
x = x | (x >> 8);
x = x | (x >>16);
return pop(~x);
}
int pop(unsigned x)
{
x = x - ((x >> 1) & 0... | ALGO | 0.993841 | 4.794778 |
c519c1cb-d9ac-48a0-b0c3-b5a434b85a7b | saikatcodec/CP | CSES/Range_Xor_Queries.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
// clang-format off
#define nl "\n"
#define ll long long
#define setbits(x) __builtin_popcountll(x)
#define zrobits(x) __builtin_ctzll(x)
#define mod 1000000007
#defin... | ALGO | 0.999985 | 5.299115 |
d1e2153b-cd83-4b2d-ad8b-4f98256097be | M0D4/Competitive-Programming-Problems-Solutions | Atcoder/C++ (GCC 9.2.1)/abc114_d/19729339.cpp | #include "bits/stdc++.h"
#pragma GCC optimize("Ofast")
using namespace std;
#define endl "\n"
#define all(v) v.begin(), v.end()
#define debug(x) cerr << #x << " is " << x << endl;
#define isOdd(n) (n&1)
#define pow(n, m) (ll)powl(n, m)
#define clr(x, val) memset(x, val, si... | ALGO | 0.999785 | 4.018615 |
19f58b1d-5573-422b-820c-ce80a327efff | savieee/Romi_autonomous_robot | src/main.cpp | #include <Arduino.h>
#include <Romi32U4Motors.h>
#include <Romi32U4Encoders.h>
// Motor and encoder objects
Romi32U4Motors motors;
Romi32U4Encoders encoders;
// PID Controller Parameters
float Kp = 0.; // Proportional Gain
float Ki = 0.005; // Integral Gain
float Kd = 0.2; // Derivative Gain
// Distance Constan... | ALGO | 0.905275 | 6.110193 |
21de2996-8a43-427e-9877-83e003177b45 | AymanAtiia/udemy_cpp_4_critical_skills | recursive_function_hw/homework_13.cpp | #include<iostream>
/*
Problem : is prefix
bool is_prefix(string main, string prefix, int start_pos = 0)
E.g. is_prefix(“abcdefgh”, “abcd”) ⇒ true
E.g. is_prefix(“abcdefgh”, “”) ⇒ true
E.g. is_prefix(“abcdefgh”, “abd”) ⇒ false
*/
using namespace std;
bool is_prefix(string m, string prefix, int start_pos = 0)
{... | ALGO | 0.99972 | 4.357793 |
f359fb24-6d25-4f01-9c1c-d897a3f4b3c2 | funkytomato/Asteroid-Fighter-Game | Asteroid/Box2D/Box2D/Dynamics/Joints/b2PrismaticJoint.cpp | #include <Box2D/Dynamics/Joints/b2PrismaticJoint.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2TimeStep.h>
// Linear constraint (point-to-line)
// d = p2 - p1 = x2 + r2 - x1 - r1
// C = dot(perp, d)
// Cdot = dot(d, cross(w1, perp)) + dot(perp, v2 + cross(w2, r2) - v1 - cross(w1, r1))
// = -dot... | ALGO | 0.99459 | 7.704068 |
74e243d5-b099-4113-a6c4-4a535a150356 | ponmak/CS-KU-01418231-65 | week 1/The-Trial-of-a-Young-Mage.cpp | #include <cmath>
#include <iostream>
#include <vector>
#include <sstream>
using namespace std;
int Multiplier(int level) {
int percent = 0;
for (int i = 1; i <= level; ++i) {
if (i <= 5) percent += 10;
else if (i <= 7) percent += 15;
else percent += 20;
}
return percent;
}
dou... | ALGO | 0.997716 | 3.464728 |
be4ce3b9-e598-4ec9-a7a9-52742aade7f8 | Gurmeet-Singh657/LeetCode-GFG | 0012-integer-to-roman/0012-integer-to-roman.cpp | class Solution {
public:
string intToRoman(int num) {
string ones[] = {"","I","II","III","IV","V","VI","VII","VIII","IX"};
string tens[] = {"","X","XX","XXX","XL","L","LX","LXX","LXXX","XC"};
string hrns[] = {"","C","CC","CCC","CD","D","DC","DCC","DCCC","CM"};
string ths[]={"","M","M... | ALGO | 0.997437 | 6.297191 |
6a44bcd3-415a-49d4-bb65-3e55aaf53ec9 | duckdb/duckdb-test-staging | extension/icu/third_party/icu/common/ucharstrie.cpp | #include "unicode/utypes.h"
#include "unicode/appendable.h"
#include "unicode/ucharstrie.h"
#include "unicode/uobject.h"
#include "unicode/utf16.h"
#include "cmemory.h"
#include "uassert.h"
U_NAMESPACE_BEGIN
UCharsTrie::~UCharsTrie() {
uprv_free(ownedArray_);
}
UStringTrieResult
UCharsTrie::current() const {
... | ALGO | 0.987749 | 7.289391 |
1fe2c421-e260-42fe-bc48-bdfe4ad6444e | Shipu/OnlineJudgeProblemSolutionWithCPlusPlus | uva/12700/12700.cpp | /******************************************************************
*** Problem : ***
*** Author : Shipu Ahamed (Psycho Timekiller) ***
*** E-mail : <EMAIL> ***
*** University : BUBT,Dept. of CSE ... | ALGO | 0.999833 | 3.799055 |
29375dbc-ed00-43d3-bbbe-d040c13d5528 | Shivtej5151/cp-experiments | cp(expt 7.4).cpp | #include <iostream>
#include <vector>
using namespace std;
vector<int> intersectionOfSortedArrays(const vector<int>& arr1, const vector<int>& arr2) {
vector<int> intersection;
int i = 0, j = 0;
while (i < arr1.size() && j < arr2.size()) {
if (arr1[i] < arr2[j]) {
++i;
} else i... | ALGO | 0.999942 | 6.161745 |
63e8f31e-ccf9-44a4-b641-f07df08d81de | Goluanand/CipherSchools | week1/Lectuure17.cpp | #include <iostream>
using namespace std;
void printHi(){
cout<<"Hi"<<endl;
return;
}
int sum(int a,int b){
int c;
c=a+b;
return c;
}
int main(){
printHi();
int a,b;
a=4;
b=6;
int d;
d=sum(a,b);
cout<<"The sum is equal to "<<d;
return 0;
} | TOOL | 0.9305 | 3.537133 |
28658b11-749f-4092-a7dc-8c0557710f52 | mxuexxmy/2019HolidaysTrain | ICPC/Til the Cows Come Home -djs.cpp | //
// Created by longxing on 19-7-29.
//
//#include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <cstring>
#include <queue>
using namespace std;
const int Inf = 0x3f3f3f3f;
const int Max = 1000010;
struct node{
int v,c;
bool operator <(const node & a) const {
return c > a.c;
... | ALGO | 0.99979 | 4.08171 |
f1012a19-5595-4268-b08d-706c0da18d1e | EvgeniyPrudnikov/Magistracy | Algorithms/Labs/K1/a_plus_b/a_plus_b/a_plus_b.cpp |
//#include "stdafx.h"
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
int a;
int b;
int c;
ifstream infile("input.bin", ios::in | ios::binary);
ofstream outfile("output.bin", ios::out| ios::binary);
infile.read((char *)&a, sizeof(int));
infile.read((char *)&b, sizeof(int));
c = a... | ALGO | 0.991069 | 3.9591 |
adcb50b5-850a-4945-8d35-a45e974c9716 | Besha101/cppSIDF | Practice/Week2/task12.cpp | #include <iostream>
using namespace std;
int main() {
int year;
cout<<"Enter a year"<<endl;
cin>>year;
if(year%4==0 and not year%100==0){
cout<<"Leap year"<<endl;
}
else if(year%400==0){
cout<<"Leap year"<<endl;
}
else cout<<"Not a leap year"<<endl;
}
| ALGO | 0.999788 | 3.605793 |
bb3d00ac-29b9-4ef8-9df2-4d176f88b00d | raincross7/code-similarity | codes/train_code/problem242/problem242_357.cpp | #include <iostream>
#include <algorithm>
using namespace std;
const int N_MAX=1000;
typedef long long int LLI;
int main() {
int N;
LLI x[N_MAX];
LLI y[N_MAX];
cin >> N;
for (int i = 0; i < N; ++i) {
cin >> x[i] >> y[i];
}
bool impossible = false;
bool odd;
for (int i = 0; i < N; ++i) {
if ... | ALGO | 0.99989 | 3.057941 |
0ff783b8-098d-4f60-8458-0c91f3e3f800 | mattstvan/arc | src/propagation/rungekutta4.cpp | #include <rungekutta4.h>
/*
Fourth-order Runge-Kutta methods
*/
// Direct constructor (default settings)
RungeKutta4::RungeKutta4(ICRF initial_state) : NumericalPropagator{ initial_state } {}
// Direct constructor (full settings)
RungeKutta4::RungeKutta4(ICRF initial_state, double step_size, ForceModel force_model) ... | ALGO | 0.999869 | 6.60174 |
6dea8243-170e-43e2-a150-6b92af9f7faa | Umer8627/barcode-input-listener | example/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.998787 | 6.76775 |
d0e194cc-3c60-43b1-a32b-1cdad31b3257 | ph03iA/cpp | C_Traffic_Light.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <unordered_map>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <cassert>
#define gc getchar_unlocked
#define fo(i, n) for (int i = 0; i < n; i++)
#define Fo(i, k, n) for (... | ALGO | 0.998878 | 3.485554 |
16d60cf2-fed5-42d1-abc7-c7163bbfd2b0 | ayoubmajid67/Basic-roadmap | 02 - Algorithms & Problem-Solving Level 1/code/21-problem.cpp |
// problem 21:
/*
write a program to calculate circle area along the circumference then print it on the screen :
the use should enter : l
area = l^2/4*π
*/
#include <iostream>
// include iomanip for using set the number of decimal digit by 2 :
#include <iomanip>
// include math library for using pow function... | ALGO | 0.989783 | 4.674439 |
55097914-8e54-4842-af15-ea31f3f9e245 | partho-das/CompetitiveProgrmming | CP_CODE/Codeforces/Pinely Round 4 (Div. 1 + Div. 2)/c.cpp | #include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
//____________________________________________________________________________________________________________________________________
#define PI 2*acos(0.0)
#define pf printf
#define sc scanf
#define ff first
#define ss second
#define pb push_ba... | ALGO | 0.999831 | 3.621997 |
147f8c7f-98b7-46f4-8d84-8f37b7c55bfd | pli482004/usaco | unknown.cpp | #include <iostream>
#include <vector>
#include <map>
#include <set>
#include <array>
#include <algorithm>
#include <cmath>
#include <string>
using namespace std;
int main() {
int N, M; cin >> N >> M;
vector<int> same[N];
vector<int> diff[N];
for (int i=0; i<N; i++) {
string a; int b, c;
... | ALGO | 0.999639 | 3.085712 |
1fb56170-4780-44ae-b1ab-04bb5a1101bc | harsh-srivastv/March-Leetcode-Challenge-2023 | 0142-linked-list-cycle-ii/0142-linked-list-cycle-ii.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode *detectCycle(ListNode *head) {
ListNode* slow = head;
ListNode* fast = head;
int flag = fa... | ALGO | 0.99997 | 5.597125 |
6e75a680-f6f7-49da-a304-3251c742c1df | RickyLiu0w0/myLeetCodeCode | cpp/886_可能的二分法.cpp | /*
* @lc app=leetcode.cn id=886 lang=cpp
*
* [886] 可能的二分法
*/
#include "AllInclude.h"
// @lc code=start
/**
* Accepted 2022-10-16
* 70/70 (224 ms)
* Your runtime beats 15.54 % of cpp submissions
* Your memory usage beats 36.51 % of cpp submissions (69.2 MB)
*/
class Solution {
public:
bool possibleBipartit... | ALGO | 0.999855 | 6.169563 |
1566775e-d70d-4cda-88b4-ab3bff6f3a5d | Debjit0001/Bisu-Da-Cpp-Assignments | Question 2/main.cpp | // 2. WAP to reverse a number.
#include <iostream>
using namespace std;
class Reverse
{
public:
void rev(int num)
{
int reversedNum = 0;
while (num != 0)
{
int digit = num % 10;
reversedNum = reversedNum * 10 + digit;
num /= 10;
}
co... | ALGO | 0.933165 | 4.623291 |
cb172a06-b453-4753-aa42-0891aba87cf3 | jonathanlandGit/C_CPP | VariableSizeArrays.cpp | /*
Jonathan Land
Output Format
For each pair of and values (i.e., for each query), print a single integer denoting the element located at index of the array referenced by . There should be a total of lines of output.
Sample Input
2 2
3 1 5 4
5 1 2 8 9 3
0 1
1 3
Sample Output
5
9
*/
#include <cmath>
#include <c... | ALGO | 0.999949 | 4.139189 |
81d2b166-7d2e-4245-ad3a-c1f7504da7cc | ishandutta2007/codeforces | emorgan5289/normal/241/E.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9+10;
const ll inf_ll = 1e18+10;
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define cmax(x, y) (x = max(x, y))
#define cmin(x, y) (x = min(x, y))
#ifndef LOCAL
#define debug(...) 0
#else
#include "../../debug.cpp"
#e... | ALGO | 0.999981 | 4.175546 |
333377b4-8d17-46a0-89c7-80148d33b67a | SajidanhPerwin/Algoritma-dan-struktur-data | pertemuan 8 matriks.cpp | #include <iostream>
using namespace std;
int main()
{
int baris, kolom, matriksA[100][100], matriksB[100][100], penjumlahan[100][100], pengurangan[100][100], perkalian[100][100], a, b;
cout << "Masukan Jumlah Baris ( between 1 and 100) : ";
cin >> baris;
cout << "Masukan Jumlah kolom (between 1 and 100) : ";
... | ALGO | 0.996911 | 3.627177 |
b095ac90-7bbf-4820-ac2d-4575bf34e90b | lwxwl/CodePractise | C++/03_03.cpp | #include <iostream>
using namespace std;
int main()
{
char str[100];
cin >> str;
int n = strlen(str);
for (int i = 0; i < n; i++) {
cout << str[n - i - 1];
}
return 0;
}
| ALGO | 0.992398 | 3.95499 |
0883ebf5-96e0-4320-8653-ef6e1c9eb1a0 | KsongloveCv/LeetCode-SK | Solutions/151.Reverse_Words_in_a_String/ReverseWordsinaString.cpp | /*
* Author: Sker <<EMAIL>>
* Descripton: (数组翻转) O(n)
*分两步操作:
*将字符串中的每个单词逆序,样例输入变为: “eht yks si eulb”;
*将整个字符串逆序,样例输入变为:“blue is sky the”;
*时间复杂度分析:整个字符串总共扫描两遍,所以时间复杂度是 O(n)。且每次翻转一个字符串时,可以用两个指针分别从两端往中间扫描,每次交换两个指针对应的字符,所以额外空间的复杂度是 O(1)。
*/
class Solution {
public:
string reverseWords(string s) {
int ... | ALGO | 0.999752 | 4.94516 |
22551008-62fd-4728-a82a-f54cc3a43e69 | manasvi83/Leetcode | 0367-valid-perfect-square/0367-valid-perfect-square.cpp | class Solution {
public:
bool isPerfectSquare(int num) {
if(num==1)
return true;
for(int i=1;i<=num/2;i++)
if(num/i==i && num%i==0)
return true;
else if(num/i<i)
return false;
return false;
}
}; | ALGO | 0.999854 | 5.488368 |
d1b5ee26-560f-4ad2-8b0e-bb6cf1d68588 | Ha2yuni/prepareCodingTest | 250329/굉장한 수/amazing-number.cpp | #include <iostream>
using namespace std;
int main() {
// Please write your code here.
int N(0);
cin >> N;
if (((N%3==0) && (N%2==1)) || (N%5==0) && (N%2==0))
cout << "true";
else
cout << "false";
return 0;
} | ALGO | 0.99992 | 3.506577 |
08628987-e761-47cd-a448-5af65e740d24 | yeseongmoon/hanhwa_veda | Basic_Cpp_language/ch03/fibonacci.cpp | #include <iostream>
using namespace std;
int main(int argc, char *argv[]) {
int size;
cout << "배열의 전체 크기를 입력하세요: ";
cin >> size;
int *fibo = new int[size];
for (int i = 0; i < size; i++) {
if (i == 0)
fibo[i] = i;
else if (i == 1)
fibo[i] = i;
else {
fibo[i] = fibo[i - 2] + f... | ALGO | 0.977656 | 4.546896 |
fbb4867b-1975-4062-ab79-482130d14536 | rstolys/CMPT-225 | textbookCode/Fig01_24.cpp | #include <iostream>
#include <vector>
#include <string>
#include <strings.h>
using namespace std;
// Generic findMax, with a function object, Version #1.
// Precondition: a.size( ) > 0.
template <typename Object, typename Comparator>
const Object & findMax( const vector<Object> & arr, Comparator cmp )
{
int maxInd... | ALGO | 0.983283 | 5.437362 |
ab0364cd-262b-4451-92bb-e730b07114c9 | dheerajsarupuri/rpef | utilities_src/squashfs4.2/lzma465/CPP/7zip/Compress/LZMA_Alone/LzmaBenchCon.cpp | // LzmaBenchCon.cpp
#include "StdAfx.h"
#include <stdio.h>
#include "LzmaBench.h"
#include "LzmaBenchCon.h"
#include "../../../Common/IntToString.h"
#if defined(BENCH_MT) || defined(_WIN32)
#include "../../../Windows/System.h"
#endif
#ifdef BREAK_HANDLER
#include "../../UI/Console/ConsoleClose.h"
#endif
#include "... | TOOL | 0.914255 | 6.092199 |
364291b5-8421-4e3c-9797-ce53e9ffa0ef | shelltdf/osgall | prebuild/boost_1_82_0/libs/config/tools/generate.cpp | //
// This progam scans for *.ipp files in the libs/config/test
// directory and then generates the *.cpp test files from them
// along with config_test.cpp and a Jamfile.
//
#define _CRT_SECURE_NO_WARNINGS
#include <boost/regex.hpp>
#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#inc... | TEST | 0.879892 | 5.704362 |
4c2feb47-acd0-421f-a447-7fd744c2fe38 | seanlewertow/Projects | PageRank/pagerank.cpp | #include "pagerank.h"
Graph::Graph() : vCount(0) {}
void Graph::addVertex(const string& id){
// if the vertex is not already present in map
if (vertexMap.find(id) == vertexMap.end()) {
vertexMap[id] = vCount++; // add count by 1
vertices.push_back({0});
adjList.emplace_back();
}
... | ALGO | 0.999934 | 4.664526 |
ac1eb499-c58a-4c3a-bf5a-65728b7cedcd | Bayashat/My-C_Plus_Plus | 5.C++提高编程/5.算法/5.算术生成/1(Accumulate).cpp | /* 1. Accumulate
功能 : 计算区间内 容器元素累计总和
函数原型: accumulate(iterator beg, iterator end, value);
// beg 开始迭代器
// end 结束迭代器
// value 起始值
*/
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;
void test01()
{
vector<int> v;
for (int i = 0; i <= 100; i++)
{
v.push_b... | ALGO | 0.995565 | 5.234829 |
e30cec39-47cf-48e6-ba97-ac2ccf1f5ed7 | Saran-sama/leetcode-solutions | Copy_List_with_Random_Pointer.cpp | /*
// Definition for a Node.
class Node {
public:
int val;
Node* next;
Node* random;
Node(int _val) {
val = _val;
next = NULL;
random = NULL;
}
};
*/
class Solution {
public:
Node* copyRandomList(Node* head)
{
if (!head)
{
return hea... | ALGO | 0.999252 | 5.305937 |
a5762c00-5bbd-4e16-b6d9-ec8ff4ad3826 | VictorE076/Graph_Problems_Leetcode | Camionas_Infoarena.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <fstream>
#include <climits>
#include <limits>
using namespace std;
//ifstream f("camionas.in.txt");
//ofstream g("camionas.out.txt");
ifstream f("camionas.in");
ofstream g("camionas.out");
const int MAX_LIMIT = INT_MAX;
vector<int> dist;
struct min_heap
... | ALGO | 0.999658 | 4.025548 |
088069d1-d9a7-4d0e-a6a0-6c754d69e0b7 | zkroliko/ADPTO-Project--Queens | src/Solver.cpp | #include <algorithm>
#include <iostream>
#include "../include/Solver.h"
#include "../include/Debugging.h"
#include "../include/Tools.h"
bool Solver::possible(unsigned int solutionRequirement) {
target = solutionRequirement;
queenCount = countQueens();
outlineQueens();
DEBUG("Solver: We have: " << leftQ... | ALGO | 0.999886 | 5.331807 |
7866e28c-d57d-4610-ad22-dec09839bdd1 | joan12222/algorithme | abc/abc-334-d.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int n,q,a[200005];
ll s[200005];
int main(){
cin>>n>>q;
for(int i=1;i<=n;i++) cin>>a[i];
sort(a+1,a+n+1);
for(int i=1;i<=n;i++) s[i]=s[i-1]+a[i];
while(q--){
ll x;
cin>>x;
cout<<upper_bound(s+1,s+n+1,x)-s-1<<endl;
}
return 0;
}
| ALGO | 0.999949 | 4.195023 |
49434f19-ac79-4eb8-ba9e-fafa157c2e4d | wilfeli/DMGameBasic | ExternalTools/Eigen/unsupported/doc/examples/PolynomialSolver1.cpp | #include <unsupported/Eigen/Polynomials>
#include <vector>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
typedef Matrix<double,5,1> Vector5d;
Vector5d roots = Vector5d::Random();
cout << "Roots: " << roots.transpose() << endl;
Eigen::Matrix<double,6,1> polynomial;
roots_to_mo... | TEST | 0.999497 | 4.659281 |
ab2734b4-329e-4761-984f-43b8bd91c4fa | Aksgo/Competitive-Programming-Sheet | Solution/Beautyofthemountain.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define veci vector<int>
#define pii pair<int,int>
#define rep(i,st,n) for(int i=st; i<n; i++)
#define ceil(x,y) (x+y-1)/y//least integer function
#define sz(x) (int)(x).size()
#define PI 3.141592653589793238
#define ull unsigned long long
#define pb p... | ALGO | 0.999959 | 3.463413 |
4b5df9aa-b18c-4040-a623-2b3115b401e3 | fuekiyuta-19/hard_ware | for_study_cpp/loop.cpp | #include <iostream>
void loop()
{
int i = 0;
while(i<5)
{
std::cout << "Hello, World" << std::endl;
i += 1;
}
}
void break_cont()
{
int value[] = {-20, 10, 5, -40, 0, 10, -30};
int i = 0;
while(i < 7)
{
if(value[i] < 0)
{
std::cout << "conti... | TOOL | 0.96822 | 3.24948 |
a13a21ea-fa05-45aa-9a8f-dbad812dba98 | MasudRanaMushfiq/Algorithm-Problem-Solve | More Solved Problems/Math/1566A.cpp | #include <bits/stdc++.h>
#define endl "\n";
#define ll long long
using namespace std;
int main()
{
ll t;
cin>>t;
while(t--) {
ll n, s;
cin>>n>>s;
int rem_places = n - ceil(n/2.0) + 1;
int median = s / rem_places;
cout<<median<<endl
}
return 0;
} | ALGO | 0.999951 | 3.240325 |
444878e3-ca9d-44d6-8873-64553816270c | Mukesh0097/check | arry/stldeque.cpp | #include<iostream>
#include<deque>
using namespace std;
int main(){
deque <int> d;
d.push_back(1);
d.push_front(2);
//d.pop_back();
// d.pop_front();
cout<<"print first index element "<<d.at(0)<<endl;
cout<<"first "<<d.front()<<endl;
cout<<"last "<<d.back()<<endl;
cout<<"empty or not... | TOOL | 0.951991 | 4.15646 |
ff794df3-0a19-4257-b140-76164b1b00e4 | ashokabairwaideology/Leet-code-problem | solution/0400-0499/0464.Can I Win/Solution.cpp | class Solution {
public:
bool canIWin(int maxChoosableInteger, int desiredTotal) {
if ((1 + maxChoosableInteger) * maxChoosableInteger / 2 < desiredTotal) {
return false;
}
unordered_map<int, int> f;
function<bool(int, int)> dfs = [&](int mask, int s) {
if (f.... | ALGO | 0.999841 | 6.084324 |
4a6ce1f3-e563-4ae6-9555-a531f04e95ea | Alaxe/noi2-ranking | 2019/solutions/E/ANY-Sofia/odd.cpp | #include <iostream>
using namespace std;
int main () {
long long otKolko,doKolko,kolkoDelitelq=0,otgovor=0;
cin>>otKolko>>doKolko;
for(int delimo=otKolko;delimo<doKolko;delimo++) {
kolkoDelitelq=0;
for(int delitel=1;delitel<doKolko;delitel++) {
if(delimo%delitel==0) {
... | ALGO | 0.999869 | 3.922454 |
1dcf8c37-b185-49db-8b68-86ee0732e42e | WoodJohn/Algorithm-Practice | 2112/main.cpp | /*
POJ 2112
һͼǰKΪ̵㣬CΪţҪţʹÿţ䵽һ̵㣬ߵԶţ·̣
ÿ̵ţM
Կһͼƥ䣨11⣬ʹ㷨ҵ⣩ijmaxdΪƵ£һһ
ÿţǷ㡣ǣijھڵļ̵δռţAõ㣻öڸĵڵ
ţBѰǷһü̵BȻһݹḶ́ٽAõ㡣ȻöַöٿеmaxdҵСֵɡ
Ҫջݴ𰸵ķԼ㷨ƹ㵽Ȼģ
*/
#include <stdio.h>
#include <string.h>
#define INF 99999999
int k, c, m;
int dist[231][231];
bool used[31];
int list[31][201];
void init()
{
int t;
memset(dist, 0, si... | ALGO | 0.999934 | 3.407909 |
3d6effff-b994-4648-aecb-ea444b3d1021 | seamoonshimer/ndnSIM | ndnSIM-back/ns-3/src/ndnSIM/NFD/daemon/table/name-tree-hashtable.cpp | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
#include "name-tree-hashtable.hpp"
#include "core/city-hash.hpp"
#include "core/logger.hpp"
namespace nfd {
namespace name_tree {
NFD_LOG_INIT(NameTreeHashtable);
class Hash32
{
public:
static HashValue
compute(const void* buffer, size_t length)
... | ALGO | 0.86982 | 7.140935 |
093c5b45-d087-4149-bca7-b03bc02e9356 | YeKYLI/leetcode | 待整理/leetcode-0.2.0/solution/0400-0499/0452.Minimum Number of Arrows to Burst Balloons/Solution.cpp | class Solution {
public:
int findMinArrowShots(vector<vector<int>>& points) {
sort(points.begin(), points.end(), [](vector<int>& a, vector<int>& b) {
return a[1] < b[1];
});
int ans = 0;
long long last = -(1LL << 60);
for (auto& p : points) {
int a = p... | ALGO | 0.999965 | 6.163126 |
a8f0781b-efb2-4a93-a840-250ae86744c0 | ShodanHo/code-and-tools | cplusplus/145532.cpp | /* vectormat.cpp */
#include <iostream>
//#include <conio>
class matrix;
class vector
{
static int n;
float *v;
public:
vector();
vector(float *);
vector(const vector &);
~vector();
void display();
static int & Size(){return n;};
friend vector operator*(matrix &, vector &);
friend class matr... | ALGO | 0.999473 | 3.575643 |
e06e3076-ca5a-4841-8dec-42d60ef48cd5 | mohitGitHxb/DataStructuresAndAlgo | Contests Upsolving Leetcode and GFG/Graph/DFS - BFS/3249. Count the Number of Good Nodes.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
// Adjacency list to represent the tree
unordered_map<int, vector<int>> adjList;
// Variable to store the count of good nodes
int goodNodeCount = 0;
// Depth-First Search (DFS) function to traverse the tree and count good node... | ALGO | 0.999918 | 6.434724 |
220cf821-5503-4274-8696-86fec3646d82 | bzztbomb/win32libs-lightspark | llvm/lib/CodeGen/PHIElimination.cpp | #define DEBUG_TYPE "phielim"
#include "PHIElimination.h"
#include "llvm/CodeGen/LiveVariables.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/MachineDominators.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/... | ALGO | 0.996393 | 7.67342 |
31e2a06c-8132-440a-ad81-5e936724d23a | BRsurendra31/DSA-Tutorial-Patternwise | Lecture064 Tree Interview Questions Day2/zigzag.cpp | // { Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
#define MAX_HEIGHT 100000
// Tree Node
struct Node {
int data;
Node* left;
Node* right;
};
// Utility function to create a new Tree Node
Node* newNode(int val) {
Node* temp = new Node;
temp->data = va... | ALGO | 0.999949 | 6.177535 |
561b17d8-feeb-4381-ac2c-e3f8adb54abf | Asif032/code-library | Graphs/graph_coloring_backtracking.cpp | #include<bits/stdc++.h>
using namespace std;
string s = "#RGB";
vector<int> a[101];
int res;
int col[101];
int n, m, x, y;
void print() {
for(int i = 1; i <= n; i++) {
cout << s[col[i]] << ' ';
}
cout << '\n';
}
void graph_coloring(int v) {
if(v == n + 1) {
print();
res++;
return;
}
for(i... | ALGO | 0.999901 | 4.808386 |
0ad04dff-d3c0-4ed9-a92e-7f9f59c8b19c | adityaraj5200/Leetcode-Problems | 438-find-all-anagrams-in-a-string/438-find-all-anagrams-in-a-string.cpp | class Solution {
public:
vector<int> findAnagrams(string s, string p) {
int n = s.length(), m = p.length(), i=0;
if(n<m) return {};
vector<int> pFreq(26,0),sFreq(26,0);
while(i<m){
sFreq[s[i]-'a']++;
pFreq[p[i]-'a']++;
i++;
}
... | ALGO | 0.999941 | 6.045274 |
d2b72953-1cea-4cba-a7f1-20deb8736c7d | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_4131_11.cpp | #include <bits/stdc++.h>
using namespace std;
const int RLEN = 1 << 20 | 1;
inline char gc() {
static char ibuf[RLEN], *ib, *ob;
(ob == ib) && (ob = (ib = ibuf) + fread(ibuf, 1, RLEN, stdin));
return (ob == ib) ? EOF : *ib++;
}
inline int read() {
char ch = getchar();
int res = 0, f = 1;
while (!isdigit(ch)... | ALGO | 0.999986 | 4.33424 |
e0595d4d-3fe4-43f6-b6a6-beabc15cac60 | AndreyShyshkin/Labs | op/labs/lab2/Завдання 2 В25.cpp | #include <iostream>
#include <cmath>
using namespace std;
bool isValidInput(double &x)
{
if (cin >> x)
{
return true;
}
cin >> ws;
return false;
}
int main()
{
cout << "---------------------------------------" << endl;
cout << "Лабораторна робота №2" << endl;
cout << "Студен... | ALGO | 0.993393 | 4.537277 |
e6b8b1e2-9a09-440c-ba70-06b4d9576ae2 | nk185545/c-DSA | c++ programs/gfg[postfixtoinfix].cpp | #include<iostream>
#include<cstring>
#include<stack>
using namespace std;
void postfixtoinfix(stack<string>&s,char ch[])
{
int i=0;
while(ch[i])
{
if(isalpha(ch[i]))
{
{
string str(1,ch[i]) ;
s.push(str);
}
}
string a,b;
else(ch[i]=='+' || ch[i]=='-' || ch[i]=='*'|| ch[i]=='/' || ch[i]=='^')
{
... | ALGO | 0.99995 | 4.429639 |
dbad329a-af8f-4201-8665-1bfe204d5fe5 | Talent-Pentagon/Tests | cpp/002.cpp | #include <stdio.h>
int main() {
int a, b;
scanf("%d %d", a, b);
printf("%d\n", a + b);
return 0;
}
| ALGO | 0.983223 | 3.036416 |
5deabddf-e25b-4657-b179-57c956604b0f | EraEKV/PP1_LABS | 5/P.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
string s, l = "abcdefghijklmnopqrstuvwxyz";
cin >> s;
int i = 0;
for(int i = 0; i < s.size(); i++) {
for(int j = 0; j < 26; j++) {
if(s[i] == l[25]) {
cout << "a";
break;
... | ALGO | 0.999895 | 3.471143 |
509e9ebe-3d11-43e5-ad4b-33be1e084eee | Miracle-cl/Algorithms | Tree/reversepairs.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
using std::vector;
using std::unordered_map;
class BIT {
private:
int size;
vector<int> sum;
public:
BIT(int n) : size(n), sum(n+1) {}
void update(int id, int val) {
while (id <= size) {
sum[id] +=... | ALGO | 0.999971 | 5.76271 |
2a384d0d-2557-4058-8354-da18f40f72ba | YuuOrKillua/Cpp | ForLoopsSol2.cpp | #include <iostream>
#include <cstdio>
using namespace std;
int main() {
// Complete the code.
int a, b;
cin >> a >> b;
string numbers[9] = {"one", "two", "three", "four", "five", "six", "seven", "eight", "nine"};
for (int i = a; i <= b; i++){
if (i < 10){
cout << numbers[i ... | ALGO | 0.999685 | 4.008408 |
c6c03673-8559-440b-88fd-ad988cc7f751 | dilevin/CSC417-a6-rigid-body-contact | extern/libigl/tests/include/igl/circulation.cpp | #include <test_common.h>
#include <igl/circulation.h>
#include <igl/edge_flaps.h>
#include <igl/unique_edge_map.h>
#include <igl/matlab_format.h>
TEST_CASE("circulation: single_edge", "[igl]")
{
// 7
// /₆|₇\
// 4 - 5 - 6
// |₂/₃|₄\₅|
// 1 - 2 - 3
// \₀|₁/
// 0
cons... | TEST | 0.974717 | 5.151936 |
19e582ad-992f-413e-b21c-9f46d389f525 | NeoAnomaly/xray | 3rd party/MagicSoftware/FreeMagic/Source/Curve2D/MgcTCBSpline2.cpp | #include "MgcIntegrate.h"
#include "MgcPolynomial.h"
#include "MgcTCBSpline2.h"
using namespace Mgc;
// This used to be declared in the method GetLengthKey, but MipsPro 7.2.x on
// IRIX core dumps in that case.
class _TCBSpline2ThisPlusKey
{
public:
_TCBSpline2ThisPlusKey (const TCBSpline2* pkThis, int iKey)
... | ALGO | 0.997528 | 6.494994 |
260f9012-d8f2-44d0-9cb4-4762d6d428b8 | we-are-kicking-lhx/xinxinalgorithm | L069. Sqrt(x).cpp | class Solution {
public:
int mySqrt(int x) {
int l = 0, r = x/2+1, ans = -1;
while (l <= r) {
int mid = l + (r - l) / 2;
if ((long long)mid * mid <= x) {
ans = mid;
l = mid + 1;
}
else {
r = mid - 1;
... | ALGO | 0.999975 | 5.442523 |
0d1cea19-662b-4154-85b2-e9b8af114cc0 | rishabh-in/DSA | Lecture 3 (Patterns)/pattern7.cpp | // 1
// 2 3
// 4 5 6
// 7 8 9 10
// 11 12 13 14 15
#include<iostream>
using namespace std;
int main() {
int row = 1, n, count = 1;
cin>>n;
while(row <= n) {
int column = 1;
while(column <= row) {
cout<<count<< " ";
count++;
column++;
}
cout<<endl;
row++;
}
} | ALGO | 0.999661 | 4.144382 |
425d763b-e53a-4ac1-9815-3f83cf7c4a16 | Sovego/Algorithms-And-Programing | CalcOnStack.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
struct Stack {
char value = '\0';
double data = 0.1;
Stack* next = nullptr;
};
double CharToInt(char ch);
char IntToChar(int value);
Stack* CreateStack();
Stack* Push(Stack* current, const char value, bool* check);
Stack* Delete(Stack* ... | ALGO | 0.999813 | 5.028245 |
e053993a-7777-4741-bbd7-2f2012fecc9e | raincross7/code-similarity | codes/train_code/problem055/problem055_192.cpp | #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(false); cin.tie(0);
#define FOR(i,s,n) for(int i = (s); i < (n); i++)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) for(int i = (n); i >= 0; i--)
#define ALL(n) (n).begin(), (n).end()
#define RALL(n) (n).rbegin(), (n).rend()
#define ATYN(n) ... | ALGO | 0.99988 | 4.051689 |
0cd203ec-5573-4b50-83cf-da77a93e49d7 | hetufict/AlgorithmNotes | DataStructure/Graph/table.cpp | #include <iostream>
#include<vector>
#include <list>
#include <string>
#include <cstring>
#include <queue>
using namespace std;
class Digraph{
public:
//从配置哦文件读入顶点和边的信息,生成邻接表
void readFile(string filePath){
FILE* pf=fopen(filePath.c_str(),"r");
if(!pf){
throw filePath+" not exists";
... | ALGO | 0.997359 | 3.953145 |
af2c7a9c-58c5-4d28-8c93-8924d32d17fb | IIIIIGODIIIII/LeetCode | 3. Hard/2444. Count Subarrays With Fixed Bounds.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
long long countSubarrays(vector<int>& nums, int minK, int maxK) {
long ans = 0;
int j = -1;
int prevMinKIndex = -1;
int prevMaxKIndex = -1;
for (int i = 0; i < nums.size(); ++i) {
if (nums[i] < minK || nums[i] > maxK)
... | ALGO | 0.999836 | 5.024215 |
d6b83a3d-08a3-49c6-9847-ebe8c0cc4010 | MaacrroX/Taller-2-Juego-del-gato | src/Nodo.cpp | #include "../headers/Nodo.h"
#include "../headers/Tablero.h"
Nodo::Nodo(Tablero t, char c) : tablero(t), jugador(c), valor(0) {}
Nodo::~Nodo() {
for(Nodo* hijo : hijos) {
delete hijo;
}
}
void Nodo::generarHijos() {
char sgteJugador = (jugador == 'X') ? 'O' : 'X';
for (int i = 0; i < 3; ++i) ... | ALGO | 0.936627 | 4.236469 |
293bbf8e-bf28-41af-b64c-345d0e36350c | Katpa/Programmers | LV2/멀쩡한 사각형/Source.cpp | using namespace std;
//----------------------------------------------------------
// β մ 밢 ġ
// = ̿ ̴ִ.
//
// μ ִ Ŭ ȣ ؼ ϸ ȴ.
//----------------------------------------------------------
//Ŭ ȣ
int GCD(int num1, int num2)
{
while (true)
{
int r = num1 % num2;
if (r == 0)
r... | ALGO | 0.999929 | 4.545667 |
762ec048-9623-4bb2-a63a-ecd3f6293cff | Zhiyi-Zhang/ndnSIM-NFD-NDN-DDoS | core/network.cpp | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
#include "network.hpp"
#include <ndn-cxx/net/address-converter.hpp>
#include <boost/utility/value_init.hpp>
#include <algorithm>
namespace nfd {
Network::Network() = default;
Network::Network(const boost::asio::ip::address& minAddress,
... | TOOL | 0.867603 | 7.440466 |
df1a5c3c-7c09-4c35-8fea-e96157783b13 | JITGH/cpp | threethree.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int n;
cin>>n;
for(int i=0;i<n;i++){
cout<<n;
}
} | ALGO | 0.996642 | 3.219167 |
eabb1f44-683b-47a1-a04f-6e9b81faf21f | Orlandovpjunior/regressao_linear_multipla | .venv/lib/python3.10/site-packages/sklearn/svm/src/liblinear/tron.cpp | #include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#include "tron.h"
#ifndef min
template <class T> static inline T min(T x,T y) { return (x<y)?x:y; }
#endif
#ifndef max
template <class T> static inline T max(T x,T y) { return (x>y)?x:y; }
#endif
static void default_print(const char *buf)
{... | ALGO | 0.999543 | 5.847107 |
16c3510e-84ed-4a90-816e-e1148c1f0b69 | Matthew-A-Acs/Foundations-of-Computer-Sci | all_area_semi.cpp | /******* ASSIGNMENT 4 ALL_AREA_SEMI *******/
// Student: Matthew Acs Z23536012
// Total Possible Points: 10
// Due Date: 6/23/2020
// Course: COP 3014
// Assignment: Assignment 4
// Professor: Dr. Bullard
// Description: This program gets an input of three side lengths of a triangle
// and determines the area and semi... | ALGO | 0.982185 | 6.373116 |
e97180c2-2501-4b87-a7e1-c57cee730601 | satyam15/Coding | Random/edtrf44.cpp | #include<stdlib.h>
#include<stdio.h>
int min(int b[],int ,int);
int main(void)
{
int a[50],i,j,c=0,t,g;
for(i=0;i<50;i++)
a[i]=rand();
for(i=1;i<49;i++)
{
t=min(a,i,49);
c++;
if(a[i-1]>=a[t])
{
g=a[i-1];
a[i-1]=a[t];
a[t]=g;
}
}
for(i=0;i<49;i++)
printf("%d ",a[i]);
printf("\n%d",c);
return 0;
... | ALGO | 0.999918 | 3.255506 |
d0f4a807-9134-4cd4-9a55-4c10e57c4f8e | Husainbw786/LeetCode | 2595-number-of-even-and-odd-bits/2595-number-of-even-and-odd-bits.cpp | class Solution {
public:
vector<int> evenOddBit(int n) {
int even = 0;
int odd = 0;
int count = 0;
while(n)
{
if(n&1 == 1 && count % 2 == 0)
{
even++;
}
if(n&1 == 1 && count % 2 != 0)
{
... | ALGO | 0.999926 | 5.778476 |
4632499f-c2f4-47f6-957a-9afffe84fd46 | JohnnyGProjects/cprojects | A3_JGebre/A3_JGebre/A3_JGebre.cpp | #include <stdio.h>
// Name: JohnnyCproject
//globalvar so it can be accessed by all functions
const double MY_PI = 3.14159;
double diameter = 2;
double circlefunction(double radius) {
//algorthim for calcuating area of a circle
double areaCircle = MY_PI * radius * radius;
return areaCircle;
}
double Cylinderfuncti... | ALGO | 0.987729 | 3.272346 |
8a7c06af-3041-4b28-8e79-7c77264e0d81 | ishandutta2007/codeforces | jiangly/normal/913/E.cpp | #include <bits/stdc++.h>
using i64 = long long;
bool cmp(const std::string &a, const std::string &b) {
if (a.empty()) {
return false;
}
if (b.empty()) {
return true;
}
if (a.length() != b.length()) {
return a.length() < b.length();
}
return a < b;
}
int main() {
... | ALGO | 0.99991 | 4.683348 |
84819259-8978-4e99-a787-58fbbab66959 | nvhongson/COS10007-DevelopingTechnicalSoftware | Lab 11 - Assignment 2 Demo/Lab Task/q3_b.cpp | #include <iostream>
class Rectangle {
protected:
double length;
double width;
public:
Rectangle(double len, double wid) : length(len), width(wid) {}
double area() {
return length * width;
}
};
class Box : public Rectangle {
private:
double depth;
public:
Box(double len, double w... | TOOL | 0.904698 | 5.521581 |
392230a0-4fa7-4443-bb35-b26cdd34e09b | Singh-Nitin-15/CP | CodeForces/Div2/1041/A.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define all(x) (x).begin(),(x).end()
#define rep(i, a, b) for (int i = a; i < b; i++)
#define per(i, a, b) for (int i = a; i >= b; i--)
#define pb push_back
#define ff first
#define ss second
#define endl '\n'
#define YES cout << "YES\n"
#define NO cou... | ALGO | 0.999308 | 4.082633 |
e0b301b0-48b3-4155-82b9-8a8c295cb7a5 | Vedant285/LeetCode | 2469-longest-subsequence-with-limited-sum/longest-subsequence-with-limited-sum.cpp | class Solution {
public:
vector<int> answerQueries(vector<int>& nums, vector<int>& queries) {
sort(nums.begin(), nums.end());
int n = nums.size();
vector<int>prefSum(n, 0);
prefSum[0] = nums[0];
for (int i = 1; i < n; i++) {
prefSum[i] = prefSum[i-1] + nums[i];
... | ALGO | 0.999978 | 6.160819 |
5d4f9f93-e12f-4ea5-9ebc-33bd5f53e435 | olegshnitko/libboost | libs/algorithm/string/example/trim_example.cpp | // Boost string_algo library example file ---------------------------------//
// See http://www.boost.org for updates, documentation, and revision history.
#include <string>
#include <iostream>
#include <boost/algorithm/string/trim.hpp>
#include <boost/algorithm/string/classification.hpp>
using namespace std;
usi... | TOOL | 0.947285 | 6.979093 |
0f09f291-525f-4462-9c41-03bcec12db43 | balajiofficial/CompetitiveProgramming | Codeforces/707A.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
int n, m;
cin >> n >> m;
char a;
bool ok = 0;
for(int i = 0; i < n; ++i) {
for(int j = 0; j<m;++j) {
cin >> a;
if (a != 'B' && a != 'W')
ok = 1;
}
}
if (ok)
cout << "#Color\n";
else
cout << "#Black&White\n";
}
| ALGO | 0.998175 | 3.907024 |
c4cfffb2-47e6-4882-b0ed-db3181007714 | hs094/CP | AtCoder/AtCoder Beginner Contest 245/B.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
// freopen("input.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// freopen("error.txt", "w", stderr);
int N;
cin >> N;
vector<int> A(N);
set<int> s;
for(int i=0;i<N;i++) {
cin >> A[i];
s.insert(A[i]);
... | ALGO | 0.999573 | 3.709128 |
51bafa87-2a42-448f-aee6-cb9fd51e86d6 | dabavil/Path-Planner | src/Eigen-3.3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_maxnorm.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXf mat(2,4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
MatrixXf::Index maxIndex;
float maxNorm = mat.colwise().sum().maxCoeff(&maxIndex);
std::cout << "Maximum sum at position " << maxIndex << std:... | ALGO | 0.999774 | 4.220459 |
d13907f0-584a-491b-85e6-311ca1eb9af2 | dpidpalyi/lippman | ch10/ex_10_15.cpp | #include <iostream>
using std::cin;
using std::cout;
using std::endl;
void adder(int a) {
auto add = [a](int b) { return a + b; };
cout << add(10) << endl;
}
int main() {
int a, b;
cin >> a >> b;
cout << [](int a, int b) { return a + b; }(a, b) << endl;
adder(a);
return 0;
}
| TOOL | 0.906891 | 5.488092 |
888ee05b-cb4a-4f21-b511-9346d5c11948 | ssk4988/Coding | UCFPT/25regionals/e.cpp | #include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using vi = vector<int>;
using vvi = vector<vi>;
#define f first
#define s second
#define pb push_back
#define rep(i, a, b) for (int i = a; i < (b); ++i)
int main()
{
int n, q; cin >> n >> q;
vi furthest(n), comp(n), diam;
vvi adj(n);
rep(i... | ALGO | 0.99988 | 4.355634 |
a21577b4-f58b-4e11-9c36-1990dd2c3a6f | Kaminyou/MyLeetcode | cpp_solutions/924.cpp | class DisjointSet {
private:
vector<int> parent;
vector<int> rank;
vector<int> size;
public:
DisjointSet(int n) {
parent.resize(n, 0);
rank.resize(n, 0);
size.resize(n, 1);
for (int i = 0; i < n; ++i) parent[i] = i;
}
int find(int x) {
if (parent[x] != x) ... | ALGO | 0.999995 | 6.041836 |
cf4ed346-6417-46a6-a138-540dc7fdd324 | 4gote/pp1_labs | lab3_8.cpp | #include <iostream>
using namespace std;
int main() {
int m[4][4], max = 0, row = 0;
for (int i = 0; i < 4; i++) {
int sum = 0;
for (int j = 0; j < 4; j++) {
cin >> m[i][j];
sum += m[i][j];
}
if (sum > max) {
max = sum;
row = i + 1;... | ALGO | 0.999865 | 5.458366 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.