uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
fd86181a-a231-48ed-bbf0-c644195f82e4 | nikitgokhale/practice_codes | DS/Tree/Traversals/BFS/levelOrderTraversal.cpp | /* C++ code for Deapth First Traversal(BFS)
1. Level Order Traversal */
#include <bits/stdc++.h>
using namespace std;
using std::vector;
using std::stack;
using std::queue;
struct Node
{
int data;
Node* left;
Node* right;
Node(int x) {
data = x;
left = NULL;
right = NULL;
}
};
class binaryTree
{
priva... | ALGO | 0.99992 | 4.858278 |
87182696-3b9e-4eeb-827b-625431c958d2 | UCLA-VAST/heterohalide | Halide/test/correctness/gameoflife.cpp | #include "Halide.h"
#include <stdio.h>
using namespace Halide;
Expr u8(Expr a) {
return cast<uint8_t>(a);
}
/* Do n unrolled iterations of game of life on a torus */
Func gameOfLife(ImageParam input, int n) {
Var x, y;
Func in;
if (n == 1) {
in(x, y) = input(x, y);
} else {
in = g... | ALGO | 0.99879 | 7.607461 |
ccfc9568-3730-4520-98b9-a5117099d8b1 | YoshikiTakashima/vert | benchmark/cpp_transcoder/SUM_PAIRWISE_PRODUCTS/SUM_PAIRWISE_PRODUCTS.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
using namespace std;
long long int f_gold ( int n ) {
long long int sum = 0;
for ( int i = 1;
i <= n;
i ++ ) for ( int j = i;
j <= n;
j ++ ) sum = sum + i * j;
return sum;
}
//TOFILL
long lo... | ALGO | 0.996867 | 5.567566 |
8efc4aec-8d4e-4aa3-a536-0064f3201b5c | Nou4r/tarkov-client | dependencies/libs/imgui_tricks.cpp | #include "imgui_tricks.hpp"
namespace ImTricks {
namespace Animations {
int FastIntLerp(ImGuiID identifier, bool state, int min, int max, int speed) {
std::unordered_map<ImGuiID, int> valuesMapInt;
auto value = valuesMapInt.find(identifier);
if (value == valuesMapInt.end()) {
valuesMapInt.insert({ ... | TOOL | 0.924809 | 6.057068 |
5de8238a-ea10-424e-a09a-1d9c8c085732 | AmanPratap965/LeetCode_Practice | 45-jump-game-ii/jump-game-ii.cpp | class Solution {
public:
int jump(vector<int>& nums) {
int jumps=0,l=0,r=0;
int n=nums.size();
while(r<n-1){
int farthest=0;
for(int ind=l;ind<=r;ind++){
farthest=max(farthest,ind+nums[ind]);
}
l=r+1;
r=farthest;
... | ALGO | 0.999984 | 5.986922 |
d491d9ef-971e-4da0-85b8-204fffdfe28b | arrows-1011/CPro | AOJ/Volume13/1316.cpp | #include <bits/stdc++.h>
using namespace std;
int H,W;
bool visited[25][25];
char field[25][25];
map<string,int> mp;
const int dx[] = {-1,-1,-1,0,0,1,1,1};
const int dy[] = {-1,0,1,-1,1,-1,0,1};
void rec(int x,int y,int d,string s){
if(visited[y][x]) return;
visited[y][x] = true;
int nx = (x + dx[d] +... | ALGO | 0.999916 | 4.129781 |
32eefee3-9a78-42f5-abd1-3161315deb7a | Jbernardiss/cotil2024 | DDM/09.06/flutter_application_swapi/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.9985 | 6.76775 |
bab0a7a5-c444-429c-8194-fab0ca37d8e8 | jiatuhao/cocos2d-x-lite-3-zjt | cocos/base/UTF8.cpp | #include "base/UTF8.h"
#include "base/Log.h"
#include "ConvertUTF/ConvertUTF.h"
#include <stdarg.h>
#include <stdlib.h>
namespace cc {
namespace StringUtils {
std::string format(const char *format, ...) {
#define CC_MAX_STRING_LENGTH (1024 * 100)
std::string ret;
va_list ap;
va_start(ap, format);
... | TOOL | 0.892611 | 6.508379 |
f30183d0-7608-43b9-a4fa-dae372ba1b02 | hameem008/Competitive_Programming | Codeforces_and_others/SkiResort.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define gap ' '
typedef long long ll;
typedef long double lld;
const ll infinite = INT64_MAX;
void solve(int I, int T)
{
ll i, j, k, a, b, c, d, m, n, p, q;
bool flag;
// solve starts
cin >> n >> k >> q;
vector<ll> v(n);
for (auto ... | ALGO | 0.999111 | 3.775588 |
f14beb8c-ceca-48b2-a550-313ee84da12b | Sudhanshu2306/Leetcode | 718-maximum-length-of-repeated-subarray/maximum-length-of-repeated-subarray.cpp | class Solution {
public:
int findLength(vector<int>& nums1, vector<int>& nums2) {
int n=nums1.size(); int m=nums2.size();
vector<vector<int>> dp(n+1,vector<int>(m+1,0));
for(int i=0;i<=n;i++) dp[i][0]=0;
for(int i=0;i<=m;i++) dp[0][i]=0;
int maxi=0;
for(int i... | ALGO | 0.999984 | 6.194751 |
c8048f7e-2da7-4530-a700-ec733b5b4f50 | lucasdbr05/competitive-programming | fase_2/longuest_f_route.cpp | #include <bits/stdc++.h>
using namespace std;
#define sws ios::sync_with_stdio(false); cin.tie(nullptr);cout.tie(nullptr);
#define endl '\n'
#define int long long int
const int MAX=1e6+10;
// #define ii pair<int, int>
vector<int> graph[MAX];
// set<pair<int, int>> graph[MAX];
int n, m;
int dist[MAX], parent[MAX], deg[... | ALGO | 0.999994 | 4.487679 |
ff1ae6d4-f6fa-46a4-958f-a67bbd8dec25 | QinHongZhe/hongzhe-leetcode | solution/2100-2199/2157.Groups of Strings/Solution.cpp | class Solution {
public:
int mx, n;
vector<int> groupStrings(vector<string>& words) {
unordered_map<int, int> p;
unordered_map<int, int> size;
mx = 0;
n = words.size();
for (auto& word : words)
{
int x = 0;
for (auto& c : word) x |= 1 << (... | ALGO | 0.999903 | 5.812212 |
b4901290-e3ea-4fe2-b69c-05ce14a71d42 | mikerainey/taskparts | benchmark/tpal/mandelbrot.cpp | #ifndef TASKPARTS_TPALRTS
#error "need to compile with tpal flags, e.g., TASKPARTS_TPALRTS"
#endif
#include <taskparts/benchmark.hpp>
#include <cstdint>
#include <cmath>
#include <complex>
#include <emmintrin.h>
unsigned char* output = nullptr;
double _mb_x0 = -2.5;
double _mb_y0 = -0.875;
double _mb_x1 = 1;
double _m... | ALGO | 0.957536 | 6.03915 |
6749bbf5-18f2-42a6-815c-115ba8e74a90 | Cypall/hAthena | src/common/des.cpp | #include "des.hpp"
/// DES (Data Encryption Standard) algorithm, modified version.
/// @see http://www.eathena.ws/board/index.php?autocom=bugtracker&showbug=5099.
/// @see http://en.wikipedia.org/wiki/Data_Encryption_Standard
/// @see http://en.wikipedia.org/wiki/DES_supplementary_material
/// Bitmask for accessing i... | ALGO | 0.999061 | 7.178405 |
bf8fe2d1-577f-4901-9b5f-0577236b7fbf | buggyAdii/android_device_xiaomi_santoni | gps/utils/LocHeap.cpp | #include <LocHeap.h>
class LocHeapNode {
friend class LocHeap;
// size of of the subtree, excluding self, 1 if no subtree
int mSize;
LocHeapNode* mLeft;
LocHeapNode* mRight;
LocRankable* mData;
public:
inline LocHeapNode(LocRankable& data) :
mSize(1), mLeft(NULL), mRight(NULL), mDa... | ALGO | 0.997664 | 6.427727 |
84aa5ec4-3fbb-40c4-915e-dfba38447439 | ou3slati/competitive-programming | Implementations/Codes (post IOI_21)/Selection/F.cpp | //Never stop trying
#include "bits/stdc++.h"
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
typedef long long ll;
typedef string str;
typedef long double ld;
typedef pair<int, int> pi;
#define fi first
#define se second
typedef vector<int> vi;
typedef vector<pi> vpi;
#defi... | ALGO | 0.99987 | 4.161626 |
5e804f1b-5b32-4f05-b478-06c3da28f4c4 | vaibhavchandrana/object-oriented-programming | object_returning.cpp | #include<iostream>
using namespace std;
class Example{
public :
int a;
Example add(Example E)
{
Example f;
f.a=a+E.a;
return f;
}
};
int main()
{
Example e1,e2,e3;
e1.a=10;
e2.a=15;
e3=e1.add(e2);
cout<<e3.a;
} | TOOL | 0.976744 | 3.910784 |
667c1094-62e9-404b-897a-9119e62be762 | coderpheonix/My-LeetCode-Solutions | 154.Find Minimum in Rotated Sorted Array II.cpp | /*
* LeetCode Problem: Find Minimum in Rotated Sorted Array II
* Problem ID: 154
* Difficulty: Hard
*
* Problem Description:
* Given a rotated sorted array `nums` (which may contain duplicates),
* find the minimum element in the array.
* The array was initially sorted in ascending order and then rotated
* at s... | ALGO | 0.999996 | 7.69342 |
22a7d48e-ce2c-4efd-8e69-08ccf0fbeb76 | son-of-mountain/problem-solving | codeforces/icpc_mansoura/.history/contest#3/F - Mrs Boo and Shalby Sullivan_20240815213355.cpp | #include<bits/stdc++.h>
using namespace std;
#define sonic ios_base::sync_with_stdio(false) ; cin.tie(NULL) ; cout.tie(NULL);
/*
I SHOULD GET A HINT ABOUT
*/
int main(){
sonic ;
string s,newstr="";
int n = s.length();
cin >> s;
bool nogreatthan4 = true;
for(int i=0; i<n; i++){
... | ALGO | 0.999944 | 4.273999 |
9443ea9c-87b9-45f9-93fc-c5f327480d46 | KhangPham205/ControlStructeExercise | CTDK/144/144.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cout << "Nhap n: ";
cin >> n;
int dem = 0;
int i = 1;
while (i <= n)
{
if (n % i == 0)
dem++;
i++;
}
if (dem == 2)
cout << "So nguyen to" << endl;
else
cout << "Khong phai so nguyen to" << endl;
return 0;
} | ALGO | 0.999812 | 4.108233 |
2c54eb44-e55b-4f13-9a94-4dfb907d4ab8 | bcxiao2106/Portfolio-optimization | portfolio/gurobi701/linux64/examples/c++/mip1_c++.cpp | /* This example formulates and solves the following simple MIP model:
maximize x + y + 2 z
subject to x + 2 y + 3 z <= 4
x + y >= 1
x, y, z binary
*/
#include "gurobi_c++.h"
using namespace std;
int
main(int argc,
char *argv[])
{
try {
GRBEnv env = GRBEnv();... | ALGO | 0.998927 | 6.980824 |
305ab5b4-8ce0-4246-ad48-5a7acf55ec70 | pavja2/eoshield | contracts/libc++/upstream/test/std/algorithms/alg.sorting/alg.heap.operations/sort.heap/sort_heap_comp.pass.cpp | // <algorithm>
// template<RandomAccessIterator Iter, StrictWeakOrder<auto, Iter::value_type> Compare>
// requires ShuffleIterator<Iter> && CopyConstructible<Compare>
// void
// sort_heap(Iter first, Iter last, Compare comp);
#include <algorithm>
#include <functional>
#include <random>
#include <cassert>
#inclu... | TEST | 0.987603 | 5.916107 |
e11aa028-5a65-4ea8-a839-637a00c065db | TheFenrisLycaon/DSA-C-- | cp/CodeForces/0500-0599/558B.cpp | #include <cstdio>
#include <vector>
#include <map>
struct cont{
long start;
long end;
long count;
};
int main(){
long n; scanf("%ld\n", &n);
long ansStart(0), ansEnd(0), maxCount(1), minDist(1);
std::map<long, cont> dets;
for(int p = 0; p < n; p++){
long t; scanf("%ld", &t);
... | ALGO | 0.999959 | 3.868608 |
97e510fc-f20a-4685-8faa-87505a0e4d05 | Haribala-09/hyprdots | User/History/-3a8245a2/uMNo.cpp | #include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using u64 = unsigned long long;
using u32 = unsigned;
using u128 = unsigned __int128;
void solve()
{
int a, b;
cin >> a >> b;
i64 mx = max(a, b);
i64 sq = 1LL * (mx - 1) * (mx - 1);
if (mx & 1)
{
// a>b then it is i... | ALGO | 0.999944 | 4.995618 |
dfd9ed41-0266-4dfc-9f6b-fe76e842e9a9 | msole/ambix-plugins.reposutori | JUCE/modules/juce_cryptography/encryption/juce_RSAKey.cpp | RSAKey::RSAKey()
{
}
RSAKey::RSAKey (const String& s)
{
if (s.containsChar (','))
{
part1.parseString (s.upToFirstOccurrenceOf (",", false, false), 16);
part2.parseString (s.fromFirstOccurrenceOf (",", false, false), 16);
}
else
{
// the string needs to be two hex numbers, c... | ALGO | 0.992899 | 7.013362 |
4f4514c8-1532-454a-8c08-da5a18f5e199 | abdullaabdullazade/codeforces-solutions | solutions/979A.cpp | #include <bits/stdc++.h>
using namespace std;
#define all v.begin() v.end()
#define int long long
void solve()
{
int n;
cin >> n;
if (n == 0)
{
cout << 0 << endl;
}
else if ((n + 1) % 2 == 0)
{
cout << (n + 1) / 2 << endl;
}
else
{
cout << n + 1 << endl... | ALGO | 0.999859 | 4.499889 |
51ecf6c6-d557-4c7c-97fe-68dea69a8feb | 0point1Zishan/CP | DSA Practice/LinkedList/2. Add Two Numbers.cpp | class Solution {
public:
ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) {
ListNode* head = l1;
ListNode* l2Head = l2;
ListNode* tail = NULL;
int carry = 0;
while(l1 || l2 || carry){
int sum = (l1 ? l1->val : 0) + (l2 ? l2->val : 0) + carry;
carry ... | ALGO | 0.999938 | 6.483434 |
ef3fa762-4926-4c33-8715-63662a4bfef3 | NYCU-Yamada/Code | 220928_GYM101986/F-s-WIP.cpp | #ifdef local
#define _GLIBCXX_DEBUG 1
#endif
#pragma GCC optimize("Ofast", "unroll-loops")
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define double long double
using pii = pair<int, int>;
template<typename T> using MaxHeap = priority_queue<T>;
template<typename T> using MinHeap = priority_que... | ALGO | 0.99991 | 4.71422 |
2f60f396-ba74-4940-bfe0-587c4ff398c5 | vnniciusg/leetcode-solutions | 485-max-consecutive-ones/main.cpp | class Solution {
public:
int findMaxConsecutiveOnes(vector<int>& nums) {
int max_ones = 0;
int curr_ones = 0;
for (int i = 0; i < nums.size(); ++i) {
if (nums[i] == 1) {
curr_ones += 1;
max_ones = std::max(max_ones, curr_ones);
... | ALGO | 0.999898 | 6.27985 |
34d5ee74-2a64-4123-b3f6-93359aa5de48 | zolcsika71/CodeInGames_C | test/test.cpp |
#include "stdio.h"
#include "math.h"
#include <iostream>
#include <algorithm>
#include <functional>
#include <list>
#include <map>
#include <memory>
#include <vector>
#include <random>
using namespace std;
auto rng = default_random_engine{};
constexpr int CP = 0;
constexpr int POD = 1;
constexpr int DEPTH = 6;
con... | ALGO | 0.999788 | 4.702508 |
a79b391e-870a-462e-8985-1b5b6df64b11 | wenqingliu/happyroulette | frameworks/cocos2d-x/cocos/platform/winrt/CCWinRTUtils.cpp | #include "CCWinRTUtils.h"
#ifndef WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#endif
#include <Windows.h>
#include <wrl/client.h>
#include <ppl.h>
#include <ppltasks.h>
#include <sstream>
#if CC_TARGET_PLATFORM != CC_PLATFORM_WP8
using namespace Windows::UI::Xaml;
using namespace Windows::UI::Xaml::Controls;
#en... | TOOL | 0.94055 | 5.805555 |
9388cefd-681a-48aa-8d9d-df05a02abe28 | sarvex/leetcode-cpp | solution/0800-0899/0821.Shortest Distance to a Character/Solution.cpp | class Solution {
public:
vector<int> shortestToChar(string s, char c) {
int n = s.size();
vector<int> ans(n);
for (int i = 0, j = INT_MAX; i < n; ++i) {
if (s[i] == c) j = i;
ans[i] = abs(i - j);
}
for (int i = n - 1, j = INT_MAX; i >= 0; --i) {
... | ALGO | 0.999981 | 6.153657 |
dda6a2f2-7b5d-42fa-8ff7-d25d2cfc1b0f | GeoEnergyLab-EPFL/BigWham | il/il/benchmark/parallel/reduce/kmeans_main.cpp | #include <il/benchmark/parallel/reduce/kmeans_main.h>
#include <chrono>
#include <cstdio>
#include <string>
#include <il/Array2D.h>
#include <il/benchmark/parallel/reduce/kmeans_clustering.h>
#include <il/io/png.h>
void kmeans_main() {
std::string directory{"/Users/fayard/Desktop/"};
il::Status status{};
il::... | ALGO | 0.971793 | 5.752525 |
c83dc200-842f-44ff-b4c4-d17f761e604f | diegods-ferreira/uri-online-judge | 1_Iniciante/1048/main.cpp | #include <iostream>
#include <iomanip>
using namespace std;
main() {
float salario, salario_novo, reajuste;
int percentual;
cin >> salario;
if (salario > 0 && salario <= 400) percentual = 15;
else if (salario > 400 && salario <= 800) percentual = 12;
else if (salario > 800 && salario <= 1200) percentual =... | ALGO | 0.977571 | 3.916198 |
b52cf8da-e558-45e3-8bc5-f3aa4998b9ef | allenlin316/UVa | Data_Structure_class/536-Tree Recovery.cpp | #include<iostream>
using namespace std;
void toPostorder(string preorder, string inorder){
if(preorder.size() == 0)
return;
if(preorder.size() == 1){
cout << preorder;
return;
}
char parent = preorder[0];
int k=0;
for(int i=0; i<inorder.size(); i++){
if(parent ==... | ALGO | 0.999983 | 4.691248 |
d82f043d-4aad-49f6-bf72-428118d94c60 | yangders123/snap_through | source_files/calc_long_timescales.cpp | /*
/////////////////////////////////////////////////////
/////////////////////////////////////////////////////
Calculate 'dialling in' time and damping coefficient based on toy model
stretching and bending analyses. The 'Long times' are approximate characteristic
times for the longest-wavelength modes in the system f... | ALGO | 0.944241 | 5.430871 |
75c281f9-8459-4b7e-9264-71a5ebe9a18c | pareksha/Data-Structures | data_structures_C++/double_linked_list.cpp | #include<iostream>
using namespace std;
class DoubleLinkedList {
private:
struct node {
int data;
struct node* pre_link;
struct node* next_link;
};
struct node* start;
struct node* end;
public:
DoubleLinkedList() {
start = ... | ALGO | 0.99988 | 4.603845 |
2a0bb12f-4af9-4ea5-92a0-38b3204e877c | BigOrangeQWQ/acm-problems | Sort_4.cpp | #include <iostream>
#include <vector>
using namespace std;
void solve() {
int n;
cin >> n;
vector<int> p(n + 1);
for(int i = 1; i <= n;i ++) {
cin >> p[i];
}
int cnt = 0;
for(int i = 1; i <= n;i ++) {
}
}
int main() {
ios::sync_with_stdio (false);
cin.tie(n... | ALGO | 0.998865 | 4.450095 |
11062d8d-b656-4ce0-8d05-027d966b39a8 | s-1-n-t-h/leetcode-solved | 1-two-sum/two-sum.cpp | class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
unordered_map<int,int> numMap;
int n = nums.size();
for(int i = 0; i < n ; i++){
int complement = target-nums[i];
if(numMap.find(complement) != numMap.end())
return {numMap[com... | ALGO | 0.999514 | 6.257489 |
4c9dce35-c78b-4ac9-aa5d-f74881ce8421 | kyeah/Cloth-Fluids-Solver | cloth/eigen_3.2.2/doc/examples/MatrixBase_cwise_const.cpp | #define EIGEN2_SUPPORT
#include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
int main()
{
Matrix3i m = Matrix3i::Random();
cout << "Here is the matrix m:" << endl << m << endl;
Matrix3i n = Matrix3i::Random();
cout << "And here is the matrix n:" << endl << n << endl;
cout << ... | ALGO | 0.992862 | 4.018187 |
52a03802-5ea1-4ce1-9131-f6c2616026a4 | 17171717171717/CSES | Tree Algorithms/Tree Distances I.cpp | #include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for(int i = 0; i < n; i++)
#define REP1(i, n) for(int i = 1; i <= n; i++)
#define vin(v) for( int i = 0 ; i < v.size() ; i++ ) cin >> v[i];
#define vpiiin(v) for( int i = 0 ; i < v.size() ; i++ ) cin >> v[i].first >> v[i].second;
#define debugv(v) for (i... | ALGO | 0.999606 | 4.610464 |
9fc42940-ff83-4319-9f3f-539fbe4da3c3 | Jawad606/Project-C- | Project133/Project133/Source.cpp | #include<iostream>
using namespace std;
class Int
{
private:
int value1,value2;
public:
void in()
{
cout << "Enter the value :" << endl;
cin >> value1>>value2;
}
int out()
{
int c = value1 + value2;
return c;
}
};
int main()
{
int b;
Int i1;
i1.in();
i1.out();
b = i1.out();
cout << b << endl;
} | TOOL | 0.885322 | 3.820775 |
e5802186-a3b3-439f-aa35-dd94354e17f0 | anubhav-bhard/Competitive-Programming-June-Course- | Aman/Arrays & strings/Move Zeroes.cpp | class Solution {
public:
void moveZeroes(vector<int>& nums) {
int n=nums.size();
int j=0,fl=0;
for(int i=0;i<n;i++)
{
if(nums[i]==0 && fl==0)
{
fl=1;
j=i;
}
else if(nums[i]!=0 && fl==1)
{
... | ALGO | 0.999968 | 6.260605 |
eca1daac-2e65-45fe-aa73-422a573601b6 | donbasta/leetcode-submissions | Easy/3151.cpp | class Solution {
public:
bool isArraySpecial(vector<int>& nums) {
int n = nums.size();
for (int i = 1; i < n; i++) {
if (!((nums[i] + nums[i - 1]) & 1)) {
return false;
}
}
return true;
}
}; | ALGO | 0.999872 | 5.717727 |
fb680b55-bf24-49cd-a16b-42b819b1c31d | ishandutta2007/codeforces | kevinwan/normal/576/B.cpp | #include <bits/stdc++.h>
using namespace std;
const int mn=1e5+10;
int p[mn];
bool vis[mn];
vector<vector<int>> c[mn];
vector<pair<int,int>>ans;
vector<int> g[mn];
void connect(int a,int b){
int i;
for(i=0;i<max(a,b);i++){
ans.push_back({c[a][0][i%a],c[b][0][i%b]});
}
}
void dfs(int x){
vis[x]=... | ALGO | 0.99999 | 3.25012 |
5db436c8-ba2b-4947-9368-1c71597792a0 | icebeartellsnolies/leetcode | cpp_files/practice/dsa/adj_list.cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <unordered_map>
#include <set>
using namespace std;
unordered_map<int,vector<int>> adj_lst(vector<vector<int>>& edges){
unordered_map<int,vector<int>> adj;
for(int i=0; i<edges.size();i++){
adj[edges[i][0]].push_back(edg... | ALGO | 0.99949 | 5.070469 |
3bfdf3f9-520a-40e7-a6a1-a6282e59519c | Narendra-Jadhav/DSA-Practice | 12_2D_Arrays/07_74_BinarySearch_in_2D_Matrix.cpp | #include <iostream>
#include <vector>
using namespace std;
//* BINARY SEARCH in 2D Matrix
//? Time Complexity: O(log n) => O(log row*col)
//! Matrix is row wise sorted and next row has greater elements than the previous row
bool searchMatrix(vector<vector<int>> &matrix, int target) {
int row = matrix.size();
... | ALGO | 0.999909 | 5.513515 |
bcdcd680-4361-4fa2-bc4f-b41269902362 | subnr01/subs-practice | leet_code/trees/easy/trimBST.cpp | /*
Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree
so that all its elements lies in [L, R] (R >= L). You might need to change the root
of the tree, so the result should return the new root of the trimmed binary search tree.
Example 1:
Input:
1
/ \
0 2
L = 1
... | ALGO | 0.999995 | 6.641621 |
15d37be1-56b4-49b0-9354-ea38399f6a7e | codebymahmud24/DSA | Graph/Medium2/kosaraju.cpp | // ? Strongly Connected
//* Time Complexity: O(V+E), Space Complexity: O(V+E)
// dfs -> O(V+E), reverseDfs -> O(V+E), countSCCs -> O(V+E)
// stack -> O(V), visited -> O(V), adj -> O(V+E), reversedAdj -> O(V+E)
#include <bits/stdc++.h>
using namespace std;
void dfs(int node, vector<vector<int>>& adj, vector<bool>& vis... | ALGO | 0.999962 | 6.785474 |
7e145e4c-c00d-4143-ba19-d80d0e40ca65 | saifsust/problemSolving | algoexpert/topological sort/main.cpp | #include <vector>
using namespace std;
const int N= 100;
void dfs(int source, vector<vector<int>> deps, vector<bool> &visited, vector<int> &sorted){
visited[source] = true;
for(vector<int> next : deps){
if(next[0] == source){
if(!visited[next[1]]){
dfs(next[1], deps, visited, sorted);
... | ALGO | 0.999983 | 4.769284 |
1cc4c177-d551-4b35-b641-ae1792ad0c8a | luoshunchong/Cplusplus-Leetcode | Leetcode/154.find-minimum-in-rotated-sorted-array-ii.cpp | /*
* @lc app=leetcode id=154 lang=cpp
*
* [154] Find Minimum in Rotated Sorted Array II
*/
// @lc code=start
class Solution {
public:
int findMin(vector<int>& nums) {
// int res = INT_MAX;
// for (int i = 0; i < nums.size(); ++i) {
// if (res > nums[i]) res = nums[i];
// }
... | ALGO | 0.999984 | 6.373648 |
34fa176c-5ef6-49b4-8e1e-fc92322bff6d | DodgeHo/VMD_cpp | Eigen/test/visitor.cpp | #include "main.h"
template<typename MatrixType> void matrixVisitor(const MatrixType& p)
{
typedef typename MatrixType::Scalar Scalar;
Index rows = p.rows();
Index cols = p.cols();
// construct a random matrix where all coefficients are different
MatrixType m;
m = MatrixType::Random(rows, cols);
for(Ind... | TEST | 0.851697 | 6.890114 |
c27db197-be82-4212-a8af-e6d83dc5b849 | AndrzejBon/Programowanie | Zadania Szkopul (C++ i Java)/Kalendarze/Kalendarze.cpp | #include<bits/stdc++.h>
using namespace std;
int A[1000046]; // kalendarz arbuzan
int B[1000046]; // kalendarz bananitow
int Ap[1000046];
int Bp[1000046];
int n, m, z; // n - liczba miesiecy kalendarz arbuzan, m - liczba miesiecy kalendarz bannanitow, z - liczba zapytan
int t1, t2, y; // t1 - liczba dni w zapytaniu, ... | ALGO | 0.999901 | 3.632363 |
42019cf0-2e99-4d7b-b30e-69f13abf5e24 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_10163_18.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int x;
cin >> x;
cout << (x - 1) * 2 << " " << 2 << '\n';
cout << 1 << " " << 2;
}
| ALGO | 0.998585 | 3.418445 |
4b3ef7bd-10de-4fcf-b96a-e3d6faa66a63 | heavenMOJANG/ICPC | .history/programmes_C_Cpp/AtCoder/abc406/C_20250517201835.cpp | #pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3, "Ofast", "inline")
#include <bits/stdc++.h>
#define int long long
using namespace std;
constexpr int INF = 0x7fffffff;
void solve() {
int n; cin >> n;
vector<int> a(n + 1);
for (int i = 1; i <= n; ++ i) cin >> a[i];
vector<int> p0, ... | ALGO | 0.999897 | 4.985056 |
06592dbe-e6a6-48b2-9d25-df094298ee71 | shibam05/Codeforces_ProblemSet | A_Magnets.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
long long t;
cin >> t;
int res = 1;
if (t == 1)
{
res = 1;
cout << res << endl;
return 0;
}
string first;
cin >> first;
int prev = first[1];
for (int i = 1; i < t; i++)
{
s... | ALGO | 0.999805 | 3.406483 |
50f51718-6c03-43cf-b588-f0bc89548e26 | alifahmed/shadow | clones/xz/20M/genCode.cpp | #include <cstdlib>
#include <cstdint>
#include <cstdio>
#include "immintrin.h"
__attribute__((always_inline)) static inline uint64_t bounded_rnd(uint64_t bound) {
static uint64_t hash = 0xC32ED012FEA8B4D3ULL;
hash = (hash << 1) ^ (((int64_t)hash < 0) ? 7 : 0);
return (hash * (__uint128_t)bound) >> 64;
}
... | ALGO | 0.983251 | 3.110722 |
e0cb54ec-5490-4692-b65e-24f85f9aa202 | Minyeob/Algorithm | Algorithm Practice/Algorithm Practice/7562.cpp | #include <cstdio>
#include <queue>
#include <string.h>
using namespace std;
bool check[501][501];
int result[100000];
typedef struct{
int x;
int y;
int count;
}point;
queue<point> q;
int next_x[8] = { -2, -2, -1, -1, 1, 1, 2, 2 };
int next_y[8] = { 1, -1, 2, -2, 2, -2, 1, -1 };
int bfs(point n, point goal,int si... | ALGO | 0.999613 | 3.922353 |
ce38e6e5-c544-400c-bb23-92d0a3db37bb | nagarshivang/c- | rrevers.cpp | # include <iostream>
using namespace std;
int main (){
int number,rev=0;
cout<<"enter a number";
cin>>number;
int ans=number;
while(number>0){
int last=number%10;
rev=rev*10+last;
number=number/10;
}
if(rev==ans){
cout<<"palindrom";
}
else{
cout<<"not an palindrom";
}
}
| ALGO | 0.999864 | 3.874532 |
24392a03-546d-4861-8a0c-197b05ccc379 | zhoucatcat/support_cpu0 | llvm/lib/Transforms/IPO/PartialInlining.cpp | #include "llvm/Transforms/IPO/PartialInlining.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/BlockFrequencyInfo.h"
#includ... | ALGO | 0.998148 | 7.908749 |
287f0bab-71ee-4341-a34b-83c872bbb042 | edengold/gomoku | GomokuDll/GomokuDll/IaGomoku.cpp | #include "IaGomoku.h"
#pragma region ForDll
MYGOMOKU_API IAGomoku* CreateIAGomoku()
{
return new IAGomoku();
}
MYGOMOKU_API void DeleteIAGomoku(IAGomoku *ia)
{
delete ia;
}
MYGOMOKU_API void SetIa(IAGomoku *ia, GomokuApi *api)
{
ia->setIA(api, false, false);
}
MYGOMOKU_API void RunIa(IAGomoku *ia, GomokuApi *api,... | ALGO | 0.979883 | 3.957942 |
7519f7c4-f7f7-44be-89ae-788d2da46b61 | Stapelzeiger/eigen | doc/examples/Tutorial_BlockOperations_colrow.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
int main()
{
Eigen::MatrixXf m(3,3);
m << 1,2,3,
4,5,6,
7,8,9;
cout << "Here is the matrix m:" << endl << m << endl;
cout << "2nd Row: " << m.row(1) << endl;
m.col(2) += 3 * m.col(0);
cout << "After adding 3 times the first colu... | ALGO | 0.995653 | 3.586171 |
d9faad1c-34d2-4c5b-aae6-6df5040e0554 | enochcheng/android_frameworks_av | media/libstagefright/ClockEstimator.cpp | //#define LOG_NDEBUG 0
#define LOG_TAG "ClockEstimator"
#include <utils/Log.h>
#include <math.h>
#include <media/stagefright/ClockEstimator.h>
#include <media/stagefright/foundation/ADebug.h>
namespace android {
WindowedLinearFitEstimator::WindowedLinearFitEstimator(
size_t headLength, double headFactor, si... | ALGO | 0.981177 | 5.887321 |
7546fb5a-4639-42f7-9224-2b6b33312046 | ishandutta2007/codeforces | .tx/normal/630/E.cpp | #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <deque>
#include <string>
#include <memory.h>
#define sci(a) scanf("%d", &a)
#define scii(a, b) scan... | ALGO | 0.999052 | 3.595651 |
243aa1f0-0ead-43b2-9f58-4ee8133f6a80 | ejonghan/Geometry-Transformation | forward/main.cpp | #include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include "transformations/geometry.hpp"
int main()
{
cv::Mat original_image, forward_result_image, backward_result_image;
original_image = cv::imread("cat.bmp", cv::IMREAD_GRAYSCALE);
GeometryTransformator transfor... | ALGO | 0.941784 | 6.108391 |
1268bef8-c695-4d21-8375-1c8cfb0713fb | Hritikgoswami/Tree | Preorder.cpp | #include<bits/stdc++.h>
using namespace std;
struct node{
int data;
struct node* left;
struct node* right;
node(int value)
{
data = value;
left=right=NULL;
}
};
//ROOT LEFT RIGHT
void preorder(node* root)
{
if(!root)
return;
cout<<root->data<<" ";
preorder(... | ALGO | 0.999991 | 4.63749 |
4dd4e0a6-5607-4776-9df7-df56efc4203e | G1DY/ladybird | Libraries/LibCore/ArgsParser.cpp | #include <AK/Format.h>
#include <AK/JsonObject.h>
#include <AK/OptionParser.h>
#include <AK/String.h>
#include <LibCore/ArgsParser.h>
#include <LibCore/Version.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>
#define TRY_OR_ERROR_IF_NOT_OOM(expr, user_input) \
... | TOOL | 0.911416 | 6.822631 |
27e12c56-a6a2-44d1-b8da-4a2fe3bdf83c | khuda-4th/KHUDA-Algorithm-Study | SangyeongPark/Programmers/Lv0/arrflip2.cpp | #include <string>
#include <vector>
using namespace std;
/*
string solution(string my_string, vector<vector<int>> queries) {
for(int i =0; i < queries.size(); i++) {
string new_str = my_string.substr(queries[i][0], queries[i][1]);
for(int j = 0; j < new_str.size(); j++) {
}
... | ALGO | 0.999488 | 4.652383 |
8bdba598-5f86-4511-b0a8-ff1585b660b9 | Krishnarjunj/Striver-Notes | Graphs/WordLadder.cpp | class Solution {
public:
int ladderLength(string beginWord, string endWord, vector<string>& wordList) {
unordered_set<string> st(wordList.begin(), wordList.end());
st.erase(beginWord);
queue<pair<string, int>> q;
q.push({beginWord, 1});
while(!q.empty()){
auto [w... | ALGO | 0.999982 | 5.828012 |
75b7e17b-7351-4c72-8e58-18d5062fa89b | pusnik/robot-human-follower | Tracker/src/boost_1_49_0/libs/numeric/ublas/doc/samples/vector_range.cpp | #include <boost/numeric/ublas/vector.hpp>
#include <boost/numeric/ublas/vector_proxy.hpp>
#include <boost/numeric/ublas/io.hpp>
int main () {
using namespace boost::numeric::ublas;
vector<double> v (3);
vector_range<vector<double> > vr (v, range (0, 3));
for (unsigned i = 0; i < vr.size (); ++ i)
... | ALGO | 0.865495 | 3.024602 |
f3613e11-e88b-4dd0-8156-21b730b407bc | fqde-inc/SREP-Steamphonk | submodules/SimpleRenderEngine/submodules/glm/test/core/core_func_integer_bit_count.cpp | // This has the programs for computing the number of 1-bits
// in a word, or byte, etc.
// Max line length is 57, to fit in hacker.book.
#include <stdio.h>
#include <stdlib.h> //To define "exit", req'd by XLC.
#include <ctime>
unsigned rotatel(unsigned x, int n)
{
if (static_cast<unsigned>(n) > 63) {printf("rotat... | ALGO | 0.99928 | 4.67767 |
e02cb885-a57d-493a-a1f6-f7b2869049c1 | azizoghlemi/furniture_app | 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 |
5f036cae-155d-4ae9-bff8-c8c1c097e3f2 | Bhawna751/LeetCode-Solutions | 2265-partition-array-according-to-given-pivot/2265-partition-array-according-to-given-pivot.cpp | class Solution
{
public:
vector<int> pivotArray(vector<int> &nums, int pivot)
{
int low = 0;
int same = 0;
int high;
for (auto n : nums)
{
if (n < pivot)
{
++low;
}
else if (n == pivot)
{
... | ALGO | 0.999963 | 5.765543 |
cf3ec8c3-d385-43fb-b938-676d1271dcb1 | Muhammadjunaidjalal/DSAWithApnaCollege | SelectionSort.cpp | #include <iostream>
using namespace std;
//Insertion Sorting Using in... O(N^2)
void insertionSort(int arr[], int size){
for(int i =0; i<size; i++){
int curr = arr[i];
int prev = i-1;
while(prev>=0 && arr[prev]>curr){
arr[prev+1] = arr[prev];
prev--;
}
... | ALGO | 0.999987 | 5.274502 |
fb856d1e-f15d-4baf-ab74-73af0ed68fa0 | raincross7/code-similarity | codes/train_code/problem327/problem327_463.cpp | #include <algorithm>
#include <cmath>
#include <deque>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <tuple>
#include <vector>
using namespace std;
typedef long long ll;
ll const INF = 1LL << 60;
int main() {
int W, H, x, y;
cin >> W >> H >> x >> y;... | ALGO | 0.995718 | 3.553243 |
f0522fec-d7c0-40d4-b36b-2de6b9ec0c45 | shubhamsaket49/Coding-Contest | Contests/Codechef/LunchTime/August21 div2/1.cpp | #include<bits/stdc++.h>
using namespace std;
int largest(int arr[], int n)
{
int i;
int max = arr[0];
for (i = 1; i < n; i++)
if (arr[i] > max)
max = arr[i];
return max;
}
int main()
{
int t;
cin>>t;
while(t--)
{
int n,k,count=0;
cin>>n>>k;
int *arr= new int[n];
... | ALGO | 0.999941 | 3.810588 |
c1f24354-6cd2-45b2-a356-d0c750c5cdbb | ishefalichopra/CPP | 163_MaxSubProduct.cpp | #include<bits/stdc++.h>
using namespace std;
#include <bits/stdc++.h>
#include <vector>
int subarrayWithMaxProduct(vector<int> &arr) {
// Write your code here.
int pre = 1, suff = 1;
int ans = INT_MIN;
int n = arr.size();
for (int i = 0; i < n; i++) {
if (pre == 0)
pre = 1;
if (suff == 0)
... | ALGO | 0.999906 | 5.008116 |
743d9725-1c61-482a-845c-c3322f6e4200 | Sean10/Algorithm_code | leetcode_archived/LeetCode_338_cnt_bits.cpp | class Solution {
public:
vector<int> countBits(int num) {
vector<int> ans(num+1,0);
for(int i = 1;i <= num;i++)
{
ans[i] = ans[i&(i-1)]+1;
}
return ans;
}
};
| ALGO | 0.999989 | 5.961839 |
b1cf0528-2928-4198-ba60-ca647e2f9eac | FPSG-UIUC/Pandora | simulator/src/systemc/tests/systemc/misc/semantic/2.3/T_2_3_5_1/T_2_3_5_1.cpp | /*****************************************************************************
T_2_3_5_1.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/**************************************************************************... | ALGO | 0.954267 | 4.205744 |
dffd67c7-9b89-4ad2-a42b-b6fe6c86d1a5 | joaovsmathias/cppProjs | ConceptsLang/main.cpp | #include<iostream>
#include <algorithm> // Para std::copy
#include <vector>
using namespace std;
int& GetValue()
{
static int value = 10;
return value;
}
void PrintName(const string& name){
cout << "[lvalue] " << name << endl;
}
void PrintName(string&& name){
cout << "[rvalue] " << name << endl;
}... | TOOL | 0.859302 | 4.241599 |
56ba58a1-5044-455f-a039-87d184823312 | LeeHyungGeol/Algorithm_BaekJoon | 백준_if문/[백준 실버 1] 11403번.cpp | // dfs, bfs Ȥ ÷̵ ȷ Ǯ ִ
// ÷̵ Ǯ
#include <iostream>
#include <vector>
using namespace std;
int N;
int graph[100][100] = { 0, };
int main() {
cin >> N;
for (int i = 0; i < N; ++i) {
for (int j = 0; j < N; ++j) {
cin >> graph[i][j];
}
}
for (int k = 0; k < N; ++k) {
for (int i = 0; i < N; ++i) {
fo... | ALGO | 0.999986 | 4.515698 |
3db0612d-104d-43d1-bf9e-f2972936d09a | juyingguo/android-knowledge-principle-interview | 18-c-and-cpp/cpp/C++程序设计题解与上机指导(第2版)-byeink/教材例题程序/c4/c4-15-2.cpp | //file2.cpp
int max(int x,int y)
{
int z;
z=x>y?x:y;
return z;
}
| ALGO | 0.993557 | 3.982996 |
0549f9a9-631f-4450-be5d-a9af98f1f5fb | ndbaolam/Algorithms | DSA/STRING/bai41.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
string s; cin >> s;
int k; cin >> k;
int n = (int)s.size();
for(int i=n-1;i>=n-k;i--)
{
if(s[i]-'0')
{
cout <<"NO";
return 0;
}
}
cout << "YES";
}
| ALGO | 0.999792 | 4.354569 |
72e4d1c7-37cd-4650-924f-9050df038b79 | apaarkamal/LPU-Jun24 | cp/number_theory_product_of_three_numbers.cpp | #include<bits/stdc++.h>
using namespace std;
#define db(...) __f(#__VA_ARGS__, __VA_ARGS__)
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) { cout << name << " : " << arg1 << '\n'; }
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
const char* com... | ALGO | 0.999829 | 4.44348 |
c9c3bb10-c3ac-4e9a-93f0-0926c3a14a66 | Hasibol-Hoda-Inu/cpp_for_DSA | module_7/sort_array_of_objects.cpp | #include <bits/stdc++.h>
using namespace std;
class Student{
public:
string name;
int roll;
int marks;
void func()
{
cout << "Hello ami function bolchi\n";
}
};
bool cmp(Student l, Student r){
if(l.marks > r.marks){
return true;
}else{
return false;
}
}
in... | ALGO | 0.995954 | 4.081446 |
8a61db3a-abbc-4996-adeb-002bb7d21ba3 | ishandutta2007/codeforces | enanimant/normal/1195/D2.cpp | // July 16, 2019
//
/*
*/
#include <bits/stdc++.h>
using namespace std;
const int MOD = 998244353;
const int MAXN = 100000;
long long pow10[30];
int N;
vector<int> v[MAXN];
int len[11]; // 10^9 has 10 digits
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
#ifdef _DEBUG
freopen("input.txt"... | ALGO | 0.999818 | 5.645638 |
993a4851-e416-4136-bb17-89f592d5b15b | HuuLoc0212/Search_Page | 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.998689 | 6.787361 |
7e927e3e-de79-4924-87d5-03c9799416bd | jeffreyjose07/leetcodesubmissions | problems/symmetric_tree/solution.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.999973 | 6.642409 |
0aabdd87-bfed-4c07-aed6-9cc99e9b522b | ili0n/Parallel_regression | TaskParallelRegression.cpp | //
// Created by uros on 18/05/22.
//
#include "TaskParallelRegression.h"
struct PointsCalculatorT {
/**struct that enables to calculate uniform points using parallel for
@param uses previously generated points and uniformly distributed points on x axis
*/
tbb::concurrent_vector<Point> &points;
tbb::c... | TEST | 0.997896 | 5.678349 |
acf6b449-ad68-4b64-a07a-e275e9666258 | Volverman/procon-archive | atcoder.jp/arc029/arc029_1/Main.cpp | #include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define MOD 1000000007
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
using P = pair<int,int>;
int main()
{
... | ALGO | 0.999953 | 4.239832 |
94fdabe1-1cba-4304-a582-b0cdc44a5342 | langyanashish/Competitive-Programming | CHEFRRUN.CPP | /* August Challenge 2016 */
#include<bits/stdc++.h>
using namespace std;
#define LL long long
#define LD long double
#define PB push_back
#define LOOP(i,n) for(int i=0;i<(n);i++)
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define mod 1000000007
int main()
{
int t;
cin>>t;
while(t--)
{
LL n;
cin>>n... | ALGO | 0.99982 | 3.70563 |
ad61e3be-7a40-44dd-88fe-507180a3600a | microcai/examplecpp | 3rd/boost/libs/math/src/tr1/assoc_legendref.cpp | extern "C" float BOOST_MATH_TR1_DECL boost_assoc_legendref BOOST_PREVENT_MACRO_SUBSTITUTION(unsigned l, unsigned m, float x) BOOST_MATH_C99_THROW_SPEC
{
return (m&1 ? -1 : 1) * c_policies::legendre_p BOOST_PREVENT_MACRO_SUBSTITUTION(l, m, x);
}
| TOOL | 0.942533 | 4.12418 |
e9fb708d-86c2-4be1-846e-bbf90513f6b4 | yuekunli/cpp1 | Project1/Leetcode/0939_Minimum_Area_Rectangle.cpp | #include<iostream>
#include<string>
#include<sstream>
#include<map>
#include<set>
#include<unordered_map>
#include<vector>
#include<algorithm>
namespace _0939_Minimum_Area_Rectangle {
using namespace std;
/*
* All solutions below derive from the same idea.
* Process all points, make the first map, key is the x-c... | ALGO | 0.999975 | 6.027507 |
b952ace6-e6a4-46fa-8da2-3cd89cabf48b | Mani-Manohar/DSA | Recursion/Tower_of_Hanoi.cpp | #include<iostream>
using namespace std;
int c=0;
void TOH(int n, int A, int B, int C)
{
if(n>0)
{
TOH(n-1,A,C,B);
cout<<c<<"-Shift a disk from "<<A<<" to "<<C<<endl;
c++;
TOH(n-1,B,A,C);
}
}
int main()
{
int n;
cout<<"Enter the number of disks:- ";
cin... | ALGO | 0.99995 | 4.603556 |
bbbf4810-e623-488a-bfc7-c09fec45a26d | coolyuyuyu/leetcode | algorithm_1000-1999/1400-Construct K Palindrome Strings/main.cpp | class Solution {
public:
bool canConstruct(string s, int k) {
if (k > s.size()) {
return false;
}
vector<int> cnts(26, 0);
for (char c : s) {
++cnts[c - 'a'];
}
int cntOdds = std::count_if(cnts.begin(), cnts.end(), [](int cnt){ return cnt & 1... | ALGO | 0.999944 | 6.49519 |
695434be-bf77-4b29-ac9c-3fdc6911e718 | c1uc/leetcode | daily/3479.fruits-into-baskets-iii.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;
struct Tree {
typedef int T;
static constexpr T unit = INT_MIN;
T f(T a, T b) { return max(a, b); } // (any associative fn)
vector<T> s; int n;
Tree(int n = 0, T def = unit) : s(2*n, def), n(n) ... | ALGO | 0.999974 | 5.562595 |
99d9e7dd-7fe9-4178-852c-4a2405c4a7c5 | KingSK1998/CPP-Programs | Programming Pearls Book/Left0Right1.cpp | #include <bits/stdc++.h>
using namespace std;
main(){
char c[6] = {'0', '1', '0', '1', '1', '1'};
//? Method 1: Takes O(n + n) == O(n)
for (char z : c) if (z == '0') cout << z;
for (char z : c) if (z == '1') cout << z;
cout << endl << endl;
//! Method 2: Takes O(n log n)
sort(c, ... | ALGO | 0.999924 | 3.694104 |
e984908e-f102-4839-9853-4ca1b36d2423 | Jeevesh23/College | OOPS/expt4-2.cpp | #include <iostream>
using namespace std;
class num
{
int x;
public:
num() { x = 0; }
num(int n) { x = n; }
friend num operator+(int, num);
friend num operator*(num, num);
friend num operator-(num, int);
void display(void) { cout << "Value of the object is: " << x << endl; }
};
num operato... | ALGO | 0.990437 | 4.806777 |
6c2e8b83-ec2b-4152-9f60-df249687e153 | ranjeetkumarmrj2005/LeetCode | dynamic-programming/reducing-dishes.cpp | class Solution {
public:
int maxSatisfaction(vector<int>& satisfaction) {
sort(satisfaction.begin(),satisfaction.end());
int n=satisfaction.size();
vector<int>suf(n);
int idx=-1;
int sum=0;
int x=1;
for(int i=n-1;i>=0;i--){
if(i==n-1) suf[i]=satisf... | ALGO | 0.999886 | 5.634101 |
c9fb76b1-42eb-4dd4-b226-5195b63198f1 | Oaker1/Proga-2021-2022 | LK2.cpp | #include <iostream>
#include <string.h>
#include <stdlib.h>
using namespace std;
class FooString
{
char* buf;
int dlina, a;
public:
FooString(char* tbuf)
{
dlina = strlen(tbuf) + 1;
buf = new char[dlina];
for (int i = 0; i < dlina; i++)
buf[i] = tbuf[i];
}
~FooString()
{
delete[] buf;
}
voi... | TOOL | 0.936184 | 3.63244 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.