uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
ac0f581c-f553-44e1-a9e6-dd113f75178b | abdurrezzakekidi/Algorithms-Problem-Solving-Level-2 | Problem02-PrimeNumbersFrom1ToN/Problem02-PrimeNumbersFrom1ToN.cpp | #include <iostream>
#include <string>
#include <cmath>
using namespace std;
enum enPrimeNotPrime { Prime = 1, NotPrime = 2 };
int ReadPositiveNumber(string Message)
{
float Number = 0;
do
{
cout << Message << endl;
cin >> Number;
} while (Number <= 0);
return Number;
}
enPrimeNo... | ALGO | 0.998903 | 4.032184 |
dd2fa744-3847-4993-9030-d57023134798 | Audacity-Team/Audacity | lib-src/FileDialog/win/FileDialogPrivate.cpp | // ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// -------------------------------------------------... | TOOL | 0.877899 | 6.314034 |
ed1a8b6e-b6b1-4ccb-bc0b-dad0e5232016 | gilbert12tw/CP-Code-Archive | Atcoder/ABC301B.cpp | #include<iostream>
#include<vector>
#include<string>
#include<utility>
#include<algorithm>
#include<queue>
#define loli
using namespace std;
typedef long long ll;
#define int ll
#define pii pair<int, int>
#define X first
#define Y second
#define F first
#define S second
#define SZ(a) ((int)a.size())
#define ALL(v) v.be... | ALGO | 0.999949 | 3.799415 |
7bafa0b4-bc7a-4f9b-8542-cfe049cb1e6c | pncel/ocp_mx_alu | cref/sum/sum_reference.cpp | // comment:
// g++ -o scoreboard scoreboard.cpp sum_reference.cpp
// ./scoreboard > test_result.txt
#include "mxint8_sum.h"
#include <iostream>
#include <bitset>
#include <cmath>
using namespace std;
FP32_ieee754 to_FP32(int MXINT8_sum_result, int shared_scale){
FP32_ieee754 FP32_sum_result;
FP32_sum_result... | ALGO | 0.946403 | 4.833985 |
0a59a761-3fba-458e-b756-258b0c38b1f0 | raincross7/code-similarity | codes/train_code/problem361/problem361_93.cpp | #define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <sstream>
#include <iomanip>
#include <cmath>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <stack>
#include <queue>
#include <vector>
#include <list>
#include <set>
#include <map>
#include <b... | ALGO | 0.999869 | 3.520455 |
9f560a0a-eb5e-4e8c-b76c-d26d7cd6e6a0 | sushiljacksparrow/Code | print_petrol.cpp | /*Sushil Kumar Singh */
#include <cassert>
#include <cctype>
#include <cfloat>
#include <cmath>
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <climits>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <functional>
#include <iostream>
#include <iom... | ALGO | 0.999947 | 3.647022 |
0da1fbee-5ddd-4941-8d52-efa38152e691 | sarvex/leetcode-clojure | solution/2400-2499/2426.Number of Pairs Satisfying Inequality/Solution.cpp | class BinaryIndexedTree {
public:
int n;
vector<int> c;
BinaryIndexedTree(int _n)
: n(_n)
, c(_n + 1) {}
void update(int x, int delta) {
while (x <= n) {
c[x] += delta;
x += lowbit(x);
}
}
int query(int x) {
int s = 0;
wh... | ALGO | 0.999997 | 6.077 |
3cc8b979-e02a-4304-a13e-4cb3a2caa103 | vishwast03/Programming-Problems | Coding Ninjas - CodeStudio/Data Structures & Algorithms Guided Path/xor_query.cpp | #include <algorithm>
vector<int> xorQuery(vector<vector<int>> &queries)
{
vector<int> result;
int x = 0;
for(int i = queries.size() - 1; i >= 0; i--) {
int q = queries[i][0];
int val = queries[i][1];
if(q == 1) {
result.push_back(val ^ x);
}
else {
... | ALGO | 0.999927 | 4.900371 |
e53a3d7a-2f7c-42ab-b419-b608fb0969de | The-Artist-CN/Algorithm | 697/Solution_697.cpp | #include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;
int findShortestSubarray(vector<int>& nums) {
unordered_map<int, int> count; // 记录出现频率
unordered_map<int, int> first; // 记录首次出现的索引
unordered_map<int, int> last; // 记录最后一次出现的索引
for (int i = 0; i < nums.size(); ++i... | ALGO | 0.999988 | 5.791285 |
df86212c-44cf-4642-b1d6-a7aec5aea204 | echo1999/FHEtool | SEAL/native/mytest/bgv_business.cpp | /*
业务要求:13位数,其中11位为整数,2位为小数,精度要求小数后5位;2次乘法;
1. 生成满足要求的随机数10个(11位整数+5位小数)
2. 做两次乘法,记录时间&精度
*/
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <bitset>
#include <cmath>
#include <limits>
#include "examples.h"
#include <chrono>
using namespace std;
using namespace se... | ALGO | 0.962927 | 3.766009 |
a42f9cc7-e593-4bc6-b496-bd64d6020900 | sbswarna/CodeForces | A. Arpa and a research in Mexican wave.cpp | #include<bits/stdc++.h>
using namespace std;
long long n,k,t;
int main()
{
cin>>n>>k>>t;
if(t>=1&&t<=k)
cout<<t<<endl;
else if(t>=n+1&&t<=n+k)
cout<<abs(abs(n-t)-k)<<endl;
else
{
cout<<k<<endl;
}
//main();
return 0;
}
| ALGO | 0.999925 | 3.238445 |
363f5bf8-c4a1-4e7f-be97-c11a46e5e3f9 | khaledsliti/CompetitiveProgramming | cses/Range_Queries/2134.cpp | // Guess Who's Back
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define endl '\n'
#define D(x) cerr << #x << " = " << (x) << '\n'
#define sz(x) ((int)(x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
typedef long long ll;
const int N ... | ALGO | 0.99997 | 4.876766 |
27909442-13c3-4490-9a87-3a6e63480651 | jmfs12/Algorithms-and-Data-Structures | avl/q1_1.cpp | #include <iostream>
using namespace std;
struct node{
int key;
int height;
int rank;
node *left;
node *right;
node(int key){
this->key = key;
height = -1;
rank = 1;
left = right = NULL;
}
};
class avl{
public:
int len;
node *root;
... | ALGO | 0.999824 | 4.771996 |
489dbb3a-2115-4764-b211-8f3f0b33d4a3 | harroshan/C-plus-plus-Assignments | Arrays/String Library/sortWithTokens.cpp | #include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
string extractStringKey(string str, int key){
//strtok take char* s i.e. character array
char *s = strtok((char *)str.c_str(), " ");
while(key>1){
s = strtok(NULL, " ");
key--;
}
return (string)s;
}
int c... | ALGO | 0.99985 | 4.470912 |
cef3a25a-1536-464a-a53c-3faf09d994d2 | PhiBao/Sophomore_Homework | OOP_BT02/BT02/Matrix.cpp | #include "Matrix.h"
#include<iomanip>
Matrix::Matrix(int row, int col, int n)
{
this->row = row;
this->col = col;
this->data = new int*[this->row];
for (int i = 0; i < this->row; i++)
*(this->data + i) = new int[this->col];
for (int i = 0; i < this->row; i++)
for (int j = 0; j < this->col; j++)
(*this)(i, j... | ALGO | 0.999502 | 3.102599 |
d86b8cca-7081-495b-963f-82c4d655d9e3 | gauravengine/CPP_Freak | c++/stack/classtemplastack.cpp | #include <climits>
template <typename T>
class stackusingarray{
int capacity; int nextindex=0;
T *data;
public:
stackusingarray(){
data=new T[4]; capacity=4;
//nextindex=0;
}
void push(T a ) {
if (nextindex==capacity) { //cout<<"stack overflow"<<endl; return;
T *newdata=new T[capacity*2];
for(int i=0;i<capaci... | ALGO | 0.99835 | 3.981903 |
3477683c-578e-4acc-8a8f-e7058ae9f287 | kaushav07/visualization_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.998859 | 6.785645 |
c96ed4a1-7050-415d-8e36-0daa7f4f9049 | Riyanshukumar/DSA | DSA/ARRAY/twoRepeatedElement.cpp | #include <iostream>
#include <vector>
#include <unordered_set>
std::vector<int> findTwoRepeatedElements(int arr[], int n) {
std::unordered_set<int> seen;
std::vector<int> result;
for (int i = 0; i < n + 2; i++) {
if (seen.find(arr[i]) != seen.end()) {
result.push_back(arr[i]);
... | ALGO | 0.999834 | 6.287169 |
a0d1c54b-9a7f-4db1-ba3f-6f1647b15f4c | Pablo784/CST_2403_FA23 | Odd_or_Even.cpp | /*
This program is from lecW4_selectLog_10e, slide 27, and the program uses the modulus operator to determine if the number is odd or even. If the number is evenly divisible by 2, it is an even number. A remainder indicates it is an odd number.
*/
#include <iostream>
using namespace std;
int main()
{
int number;
... | ALGO | 0.981366 | 4.65728 |
9b0c3b91-ede3-4349-b65b-721d463d5669 | ishandutta2007/codeforces | ppavic/normal/896/B.cpp | #include <cstdio>
#include <cstring>
using namespace std;
int a[1005],c,n,m,notwin = 1;
void add(int x){
if(x > c/2){
int st = n - 1;
while(st > 0 && a[st] >= x) st--;
printf("%d\n",st+1);
a[st] = x;
}
else{
int st = 0;
while(st < n -1 && a[st] <= x && a[st... | ALGO | 0.999997 | 3.677205 |
b9695b18-f5c4-4855-aaaf-acf0a5122a45 | bochen4566/C- | lab08/STARTER-lab08-main/test/linklist.cpp | #include <iostream>
using namespace std;
template<typename T>
struct node {
T val;
node *next;
};
// vector<int> v = new vector<int>();
template<typename T>
class LinkedList {
private:
node<T> *head;
node<T> *rear;
int size;
public:
LinkedList();
LinkedList( LinkedList<T> &obj );
~Li... | TOOL | 0.997131 | 3.413166 |
d32b7f9d-c788-4167-9974-5c119bd5b56f | Mrsandman327/windows-book-code-c- | winnt2000ppcode/CH19/1/TIMES.CPP | ====================== Listing 5 ======================
void multiply(const int *u, const int *v, int *w,
int n, int m); // multiply prototype
/* multiplication : lint3 = lint1 * lint2;
--------------------------------------- */
LargeInt LargeInt::operator*(const LargeInt& lint)
const {
if (sign == 0... | ALGO | 0.998893 | 4.037901 |
4d43d6a1-5c91-4a97-87a8-e5d2b4198eda | moxprox/leetcode-top-interview-150 | cpp/clone-graph/CloneGraph.cpp | #include <iostream>
#include <unordered_map>
#include <vector>
#include <functional>
using std::vector;
// Definition for a Node.
class Node {
public:
int val;
vector<Node*> neighbors;
Node() {
val = 0;
neighbors = vector<Node*>();
}
Node(int _val) {
val = _val;
nei... | ALGO | 0.999735 | 7.03805 |
34d905a5-bc43-4f7b-8e47-6ed17faf2640 | abhishekk2511/Personal-Notes | Recursion/Diving Into Recusion/QuickSort-Recursion.cpp | #include<bits/stdc++.h>
using namespace std;
int partition(int *a, int s, int e){
int i = s - 1;
for(int j = s; j < e; j++){
if(a[j] <= a[e]){
i++;
swap(a[i], a[j]);
}
}
swap(a[i + 1], a[e]);
return i + 1; // this whole partition return index .. jo segm... | ALGO | 0.999991 | 4.861347 |
12a9c17f-006d-4ba4-94ac-4b49a22aaecd | aldonovan/Algorithm-Challenges | project_euler/78.cpp | #include <iostream>
#include <vector>
// Be careful
int main() {
int num_coins = 4;
// int num_coins = 2798; // 3886
std::vector<std::vector<long long>> num_ways(num_coins+1, std::vector<long long>(num_coins + 1, 1));
while (true) {
// All of the sums up to num_coins - 1 can be reused
... | ALGO | 0.999963 | 5.16184 |
02a91135-64c0-4c96-ac1b-2241243d0eb8 | daniel-ankit/Leetcode | Longest Path in a matrix - GFG/longest-path-in-a-matrix.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
int dfs(int i, int j, int n, int m, vector<vector<int>>&dp, vector<vector<int>>&mat, int prev)
{
if(i<0 || i>=n || j<0 || j>=m || mat[i][j] <= prev) return 0;
if(dp[i][j] != -1) return dp... | ALGO | 0.99999 | 6.563859 |
b9c845c1-ddea-47b6-86e7-5e37e880ceaa | Zimse12345/Code | Newcoder_Contest/牛客挑战赛53/A.cpp | #include <cstdio>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <iostream>
#include <cstdlib>
#include <ctime>
#define int long long
#define ull unsigned long long
using namespace std;
int read(){int qrx=0,qry=1;cha... | ALGO | 0.999871 | 4.359973 |
40033368-4dbf-4d14-abfd-dcd4ebe02fc6 | wisamreid/NodUrIK | eigen/bench/product_threshold.cpp |
#include <iostream>
#include <Eigen/Core>
#include <bench/BenchTimer.h>
using namespace Eigen;
using namespace std;
#define END 9
template<int S> struct map_size { enum { ret = S }; };
template<> struct map_size<10> { enum { ret = 20 }; };
template<> struct map_size<11> { enum { ret = 50 }; };
template<> struct ... | TOOL | 0.948382 | 5.102006 |
f35af646-cb7d-4d5c-9e47-47a0f7b4c254 | Rikwithoutc/spotifyClone | practice/TargetSum.cpp | #include<iostream>
using namespace std;
//Find the number of pairs in an array adding up to a total of the given target x
int main() {
int array[] {2, 3, 4, 1, 6, -1};
int x = 5;
int ctr = 0;
for (int i = 0; i < 6; i++)
{
for (int j = i; j < 6; j++)
{
if (array[i]+... | ALGO | 0.999857 | 5.279073 |
7b48a3d2-2ac2-44aa-a713-6acdedaa9008 | apple/llvm-project-v5 | llvm/lib/CodeGen/MachineBranchProbabilityInfo.cpp | #include "llvm/CodeGen/MachineBranchProbabilityInfo.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/IR/Instructions.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
using namespace llvm;
INITIALIZE_PASS_BEGIN(MachineBranchProbabilityInfo, "machine-branch-prob",
... | ALGO | 0.91889 | 7.843834 |
22f9b6b8-9e7d-4827-af3e-4be61b07f7df | tausif39/Leetcode | 2333-minimum-sum-of-squared-difference/2333-minimum-sum-of-squared-difference.cpp | class Solution {
public:
long long minSumSquareDiff(vector<int>& nums1, vector<int>& nums2, int k1, int k2) {
map<long long, long long> mp;
for(int i = 0; i < nums1.size(); i++){
mp[abs(nums1[i]-nums2[i])]++;
}
long long totalOperations = k1+k2;... | ALGO | 0.999964 | 5.430991 |
256f6b1d-4c52-471e-8070-58733bffc969 | mumen-3eta/Magic_calculator | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998859 | 6.785645 |
1b12b3a4-4cf3-432d-ab9e-a8270786f0a0 | sagar-2529/DSA-PART-3 | lect23c.cpp | #include<iostream>
using namespace std;
void waveprint( int arr[][3], int n, int m){
int row = 0;
for(int j =0; j<m ; j++ ){
if ( row == 0){
for(int i=0; i< n; i++){
cout<< arr[i][j]<< " ";
row = i;
}
}
else{
for(int i=row; i>=... | ALGO | 0.999759 | 3.425098 |
b937cb25-ac6e-49f2-9342-210d4145ecf0 | rohitshakya/CodeBucket | 4. Hacker_Rank/day9 binary number.cpp | /*
* Author : Rohit Shakya
* Date : June-2020
* Compiler : g++ 4.9.2
* Flags : -std=c++14
* Time complexity : O(logn)
* Title : 30 days of code/ day 9 binary number
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
cin.ignore(numeric_limits<streamsize>::max(), '\n')... | ALGO | 0.999964 | 4.965948 |
7471039a-4924-41ce-84f3-70e34be71b2b | justin0u0/LeetCode | problems/2016-maximum-difference-between-increasing-elements/solution.cpp | /**
* Author: justin0u0<<EMAIL>>
* Problem: https://leetcode.com/problems/maximum-difference-between-increasing-elements/
* Runtime: 0ms (100.00%)
*/
class Solution {
public:
int maximumDifference(vector<int>& nums) {
int mn = INT_MAX;
int maxd = 0;
for (int i = 0; i < nums.size(); ++i) {
mn = ... | ALGO | 0.999794 | 5.852127 |
01d81a79-fb34-4d9b-a773-3d7b87fcffa2 | alexandraback/datacollection | solutions_5652388522229760_0/C++/Icemore/main.cpp | #include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
using namespace std;
#define forn(i, n) for(int i = 0; i < (n); ++i)
#define forv(i, a) forn(i, (int)(a).size())
typedef long long lng;
const int full_mask = (1<<10) - 1;
void fill_digits(lng num, int& mask)
{... | ALGO | 0.998671 | 5.420816 |
53fc0a19-e08b-4ca7-b83e-a43b98e07f2a | 2022831007/SDL2_PROJECT | task103'.cpp | #include<stdio.h>
#include<SDL2/SDL.h>
#include<math.h>
int SCREEN_WIDTH = 800;
int SCREEN_HEIGHT = 600;
SDL_Window* window=NULL;
SDL_Renderer* renderer=NULL;
bool game_running=false;
int rad1 = 70;
int cenx1 = -rad1;
int ceny1 = SCREEN_HEIGHT/2;
int rad2 = 30;
int cenx2 = SCREEN_WIDTH/2;
int ceny2 = rad2;... | ALGO | 0.97322 | 4.461367 |
4478eace-a9a1-4d0d-9e56-06d423b49bb2 | Pr8862/pr_hacktoberfest-2k22 | Graph-patterns/cycle-detection/dfs-undirected-cycle.cpp | class Solution
{
bool dfs(int node, int parent, vector<int> adj[], bool vis[])
{
vis[node] = true;
for (auto &i : adj[node])
if (vis[i] == false)
{
if (dfs(i, node, adj, vis) == true)
return true;
}
else if (i !... | ALGO | 0.999962 | 5.794511 |
603e465b-f3b5-4fb6-9e60-6334a048dc18 | mina-atallah/oop-book-by-R.L-exercises | chap-07/ex08.cpp | #include <iostream>
using namespace std;
/*
Another weakness of C++ is that it does not automatically check array indexes to see
whether they are in bounds. (This makes array operations faster but less safe.)
We can use a class to create a safe array that checks the index of all array accesses.
Write a ... | TOOL | 0.934342 | 5.368099 |
02ec6d38-79e2-40bc-b961-03cd30ec5cc8 | junesookang/asplos24-GMT | include/freestanding/libcxx/test/std/algorithms/alg.sorting/alg.sort/partial.sort.copy/partial_sort_copy.pass.cpp | // <algorithm>
// template<InputIterator InIter, RandomAccessIterator RAIter>
// requires ShuffleIterator<RAIter>
// && OutputIterator<RAIter, InIter::reference>
// && HasLess<InIter::value_type, RAIter::value_type>
// && LessThanComparable<RAIter::value_type>
// RAIter
// partial_sort_co... | TEST | 0.999051 | 6.332349 |
c5c05c9b-b594-49b6-a38f-aa3db5a80e59 | trutimka/Algorithms-and-data-structures | 4D/main.cpp | #include <iostream>
#include <vector>
struct Point {
int x_crd;
int y_crd;
int z_crd;
};
template <typename T>
class BinaryIndexedTree {
public:
BinaryIndexedTree();
void Update(Point point, int val);
int GetSum(int x_crd, int y_crd, int z_crd);
int GetRangeSum(Point point1, Point point2);
private... | ALGO | 0.982996 | 4.918369 |
027eabc1-09de-46bf-973f-8e41fb89106a | Osurac/EDA-FAL | ED/Ejercicio 10/main.cpp | //lvaro Miguel Rdrguez Mateos
//A67
#include <iostream>
#include <fstream>
#include "ListaDuplica.h"
bool resuelveCaso() {
int n;
std::cin >> n;
if (!std::cin) return false;
ListaDuplica<int> lista;
int elementos;
//Aadimos los n elementos a la lista
for (int i = 0; i < n; i++) {
... | ALGO | 0.984927 | 3.440914 |
501e30ca-8875-468f-856a-c6cf63606199 | info-ruc/web21projects | 2019000163/source/eigen3/unsupported/doc/examples/MatrixSquareRoot.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
const double pi = std::acos(-1.0);
MatrixXd A(2,2);
A << cos(pi/3), -sin(pi/3),
sin(pi/3), cos(pi/3);
std::cout << "The matrix A is:\n" << A << "\n\n";
std::cout << "The matrix square root of A is:... | ALGO | 0.999583 | 3.930508 |
78d9e29e-1cf9-4419-ac80-da995a5bfc29 | borankurut/GTU-Public | CSE-241/my solutions for absolute C++/18/2/whyTen.cpp | #include <iostream>
using std::cout;
using std::cin;
using std::endl;
void f1(int val) throw(int);
void f2(int val) throw(int);
void f3(int val) throw(int);
void f4(int val) throw(int);
void f5(int val) throw(int);
void f6(int val) throw(int);
void f7(int val) throw(int);
void f8(int val) throw(int);
void f9(int val)... | ALGO | 0.891741 | 5.245625 |
2d75fc39-02c4-49f1-afa0-0093d8add85d | ishandutta2007/codeforces | saketh/normal/750/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define TRACE(x) x
#define WATCH(x) TRACE(cout << #x" = " << x << endl)
#define WATCHR(a, b) TRACE(for (auto it=a; it!=b;) cout << *(it++) << " "; cout << endl)
#define WATCHC(V) TRACE({cout << #V" = "; WATCHR(V.begin(), V.end());})
#define all(x) (x).begin(), (x).end()
... | ALGO | 0.999967 | 3.55693 |
83a21fe9-4a9d-4830-8923-edcc87adcfa7 | SongWooYoung/sortAlgo | combSort.cpp | #include <iostream>
#include <vector>
using namespace std;
void combSort(vector<int>& array) {
int n = array.size();
//double shrinkFactor = 1.24733;
int gap = n;
bool swapped = true;
while (gap > 1 || swapped) {
gap = gap / 1.3; // Shrink the gap
if (gap < 1) gap = 1;
swa... | ALGO | 0.99984 | 5.835178 |
88cb24f8-d799-4294-a6d6-a479be59d705 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_9527_14.cpp | #include <bits/stdc++.h>
char tap[11][11][11];
int visited[11][11][11];
int n, m, k, ans = 0;
void dfs(int a, int b, int d) {
ans++;
if (a + 1 <= k && tap[a + 1][b][d] == '.' && !visited[a + 1][b][d]) {
visited[a + 1][b][d] = 1;
dfs(a + 1, b, d);
}
if (b + 1 <= n && tap[a][b + 1][d] == '.' && !visited[a... | ALGO | 0.999226 | 3.156974 |
1e5aeed8-cf69-4283-bb50-7728f07abd1a | jinzcdev/PTA | 数据结构与算法题目集(中文)/编程题/7-3 树的同构.cpp | // https://pintia.cn/problem-sets/15/exam/problems/type/7?problemSetProblemId=711
#include <bits/stdc++.h>
using namespace std;
struct node {
char data;
int left, right;
} bt1[15], bt2[15];
bool isIsomorphic(int a, int b) {
if (a == -1 && b == -1) return true;
if (a == -1 || b == -1) return false;
i... | ALGO | 0.999993 | 4.194919 |
de611d43-5f87-47c8-a340-537f9078c09c | ILW8/htsim-fyp | starlink/Eigen/eigen-eigen-323c052e1731/bench/vdw_new.cpp | #include <iostream>
#include <Eigen/Core>
using namespace Eigen;
#ifndef SCALAR
#define SCALAR float
#endif
#ifndef SIZE
#define SIZE 10000
#endif
#ifndef REPEAT
#define REPEAT 10000
#endif
typedef Matrix<SCALAR, Eigen::Dynamic, 1> Vec;
using namespace std;
SCALAR E_VDW(const Vec &interactions1, const Vec &inter... | ALGO | 0.999727 | 3.519938 |
f16e3e59-14e2-481e-b610-e59f8d63ff86 | lineage-mz6xx/external_skia | src/opts/SkXfermode_opts_arm_neon.cpp | #include "SkXfermode.h"
#include "SkXfermode_proccoeff.h"
#include "SkColorPriv.h"
#include <arm_neon.h>
#include "SkColor_opts_neon.h"
#include "SkXfermode_opts_arm_neon.h"
#define SkAlphaMulAlpha(a, b) SkMulDiv255Round(a, b)
////////////////////////////////////////////////////////////////////////////////
// NEON... | TOOL | 0.985612 | 7.204434 |
e12fa871-726d-45d8-a6f3-07f159ceba48 | Cyndi1/PAB1 | indonesia/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.998466 | 6.76775 |
d5f4a8e4-626f-42df-8665-952e1ba9ed63 | agegold/aragon777 | selfdrive/controls/lib/longitudinal_mpc/lib_mpc_export/acado_qpoases_interface.cpp | extern "C"
{
#include "acado_common.h"
}
#include "INCLUDE/QProblem.hpp"
#if ACADO_COMPUTE_COVARIANCE_MATRIX == 1
#include "INCLUDE/EXTRAS/SolutionAnalysis.hpp"
#endif /* ACADO_COMPUTE_COVARIANCE_MATRIX */
static int acado_nWSR;
#if ACADO_COMPUTE_COVARIANCE_MATRIX == 1
static SolutionAnalysis acado_sa;
#endif /* AC... | ALGO | 0.998939 | 4.715055 |
12774ee0-7c66-47b0-888a-436164e01713 | Kavin1421/Leetcode-Solution | 1400-1499/1409.Queries on a Permutation With Key/Solution2.cpp | class BinaryIndexedTree {
public:
int n;
vector<int> c;
BinaryIndexedTree(int _n)
: n(_n)
, c(_n + 1) {}
void update(int x, int delta) {
while (x <= n) {
c[x] += delta;
x += lowbit(x);
}
}
int query(int x) {
int s = 0;
wh... | ALGO | 0.999956 | 5.87826 |
a4f51a78-20d5-4bd5-bf07-45f5ef55b50e | K-a-y-D-e-e/newton_law_of_cooling | newton_reference.cpp | #include <iostream>
#include <cmath>
using namespace std;
// Function to calculate the derivative (rate of change) in Newton's Law of Cooling
double coolingDerivative(double temperature, double mediumTemperature, double coolingConstant) {
return -coolingConstant * (temperature - mediumTemperature);
}
// Function... | ALGO | 0.999991 | 5.827805 |
8eb05166-21cd-48a6-a3c1-8bb092d1aba8 | tanggeTom/ue5_2_1_mirror | Engine/Plugins/Experimental/WaveFunctionCollapse/Source/WaveFunctionCollapse/Private/WaveFunctionCollapseSubsystem.cpp | #include "WaveFunctionCollapseSubsystem.h"
#include "Engine/Blueprint.h"
#include "Engine/StaticMesh.h"
#include "WaveFunctionCollapseBPLibrary.h"
#include "Components/InstancedStaticMeshComponent.h"
#include "Subsystems/EditorActorSubsystem.h"
#include "Kismet2/ComponentEditorUtils.h"
#include "Editor.h"
DEFINE_LOG_C... | ALGO | 0.996467 | 4.883451 |
bf0d75f1-4f53-4e1f-89f8-dd5319a917cd | randbatch-md/lammps-rbe | lib/kokkos/algorithms/unit_tests/TestStdAlgorithmsAdjacentFind.cpp | #include <TestStdAlgorithmsCommon.hpp>
#include <std_algorithms/Kokkos_BeginEnd.hpp>
#include <std_algorithms/Kokkos_NonModifyingSequenceOperations.hpp>
#include <utility>
namespace Test {
namespace stdalgos {
namespace AdjacentFind {
namespace KE = Kokkos::Experimental;
// impl is here for std because it is only av... | TEST | 0.937594 | 6.612106 |
755eab50-20dd-4157-abc5-7a31e8facdd7 | fsjhhh/acm_title | cpp/模板/排列数字_DFS.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#define IOS ios::sync_with_stdio(false); \
cin.tie(0); \
... | ALGO | 0.999794 | 4.084454 |
77132e7e-d413-4587-bcda-9310c76d5d18 | sairudraksh/DSA | 234-palindrome-linked-list/palindrome-linked-list.cpp | class Solution {
public:
ListNode* reverse(ListNode* head) {
if(head==NULL) return NULL;
else if(head->next==NULL) return head;
ListNode* s=head;
ListNode* f=head->next;
ListNode* fs=head->next->next;
head->next=NULL;
while(f!=NULL){
f->next=s;
... | ALGO | 0.999927 | 6.004819 |
dce9a5d1-141b-43ed-9fa3-557e1f88f403 | tomrsae/inft2503-cpp-submissions | assignment-8/1.cpp | #include <iostream>
#include <iomanip>
#include <cmath>
template <typename T>
bool equal(T, T);
double equal(double, double);
int main() {
int a = 2;
int b = 2;
std::string c("somestr");
std::string d("somestr");
double e = 1.23456789;
double f = 1.2345689;
bool ab_eq = equal(a, b);
... | TOOL | 0.864352 | 5.907844 |
c7b21043-0ab6-4979-99e4-df33771d8ba9 | bipy/PAT-Advanced-Level-Practice | Solutions/1105 Spiral Matrix/源.cpp | #include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#define RIGHT 1
#define DOWN 2
#define LEFT 3
#define UP 4
using namespace std;
vector<vector<int> > fmap;
vector<int> seq;
bool cmp(const int& a, const int& b) {
return a > b;
}
void travel(int cur, int r, int c, int& m, int& n, int direction) {
... | ALGO | 0.999996 | 3.471077 |
1398d493-2875-4845-a875-72deaabc4531 | Siddeshwar002/DSA-again | Greedy/Fractional_Knapsack.cpp | #include <bits/stdc++.h>
// #include<iostream>
using namespace std;
// ! This is NOT 0/1 Knapsack
// ! Customized Comparision funciton --> Future applications
// TODO : This is a customised compare function
bool static comp(Item a, Item b)
{
double r1 = (double)a.value / (double)a.weight;
double r2 = (double)... | ALGO | 0.999751 | 4.732307 |
67d4839a-fdd1-4f12-a650-625621f4db8a | ordinarv/ACM | OJ/洛谷试炼场/新手村/2顺序-4/1909-买铅笔.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main()
{
int n,a,b,x,flag=1,ans;
cin>>n;
for(int i=0;i<3;i++){
cin>>a>>b;
if(a>=n){
x=1;
}
else{
x=n/a;
if(n%a) x++;
}
if(flag){
ans=b*x;
flag=0;
}
ans=min(b*x,ans);
}
cout<<ans<<endl;
return 0;
}
| ALGO | 0.999919 | 3.366712 |
1e62c23c-1eb3-4f3c-bdd7-1f13f6fcc25d | Jeonghwan-Yoo/Leetcode | Algorithms/Array/1007.cpp | // O(N)
class Solution {
public:
int minDominoRotations(vector<int>& A, vector<int>& B) {
int sz = (int)A.size();
vector<int> cntA(7);
vector<int> cntB(7);
vector<int> same(7);
for (int i = 0; i < sz; ++i)
{
++cntA[A[i]];
++cntB[B[i]];... | ALGO | 0.999985 | 5.843309 |
20084452-1b0d-4777-bf28-fbd482b2714c | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_1728_44.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
srand(time(NULL));
int n;
cin >> n;
if (n % 2 == 0)
cout << n / 2 - 1;
else {
cout << n / 2;
}
}
| ALGO | 0.999626 | 3.864325 |
7bf468d5-fe51-407f-aa82-2979a62008b6 | naimul3103/Data_structure | Week- 2/Assignment-2/Reverse_and_Original.cpp | /* Problem Statement
You need to take a singly linked list of integer value as input. Then you need to print the singly linked list in reverse order, after that print the original linked list also.
Note: You must use singly linked list, otherwise you will not get marks.
Input Format
Input will contain the values of... | ALGO | 0.999837 | 5.102005 |
28d13478-2b67-490f-8b01-2a65e6933464 | ojasaklechayt/DSA-Codes | Leetcode-Questions/547-number-of-provinces/number-of-provinces.cpp | class Solution {
public:
int findCircleNum(vector<vector<int>>& isConnected) {
int n = isConnected.size();
vector<int> adj[n];
for(int i=0; i<n; i++){
for(int j=0; j<n; j++){
if(isConnected[i][j] == 1 && i!=j){
adj[i].push_back(j);
... | ALGO | 0.999991 | 6.18753 |
008374a8-5dcb-4468-a444-f8cf808bcdf9 | MuursaleenBats/GemBot | winauto/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.997105 | 6.785645 |
f18fe638-6feb-4c1e-9bfb-d872649ea309 | JamieBriggsDev/Advent-of-Code-2024--CPP | cpp/algorithms/pathfinding/Maze.cpp | //
// Created by Jamie Briggs on 16/12/2024.
//
#include "Maze.h"
#include <iostream>
#include "PathFinder.h"
namespace pathfinding {
Maze::Maze(vector<string> input) {
const vector walls(input.size(), vector<bool>(input[0].size(), false));
this->walls = walls;
this->init(input);
// Add neighbours... | ALGO | 0.999178 | 5.624892 |
ad4521a4-f7a1-4cbd-8367-1756846096b1 | dingningpei/LLM_Semantics | serene-python-client-stp/stp/minizinc/chuffed-rel2onto_20170728/boost_1_87_0/libs/graph/example/cycle_ratio_example.cpp | #include <cassert>
#include <ctime>
#include <boost/random/mersenne_twister.hpp>
#include <boost/random/uniform_real.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/random.hpp>
#include <boost/graph/howard_cycle_ratio.hpp>
/**
* @author Dmitry Bufistov
* @author Andrey Parfenov
*/
using namesp... | ALGO | 0.996129 | 5.801914 |
fb97d677-3d2e-431b-8e17-2016f89b2cbb | devdeepsarkar/C---Programs | Basic_Math/prime.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
// Optimal Approach
int cnt=0;
for(int i = 1; i <= sqrt(n); i++){
if( n % i == 0){
cnt++;
if(i != n/i){
cnt++;
}
}
}
// cout << cnt << endl;
if... | ALGO | 0.999712 | 4.299779 |
93f19163-436a-403b-a586-e8ada93444ac | sarvex/leetcode-mini-kanren | solution/1700-1799/1774.Closest Dessert Cost/Solution.cpp | class Solution {
public:
const int inf = INT_MAX;
int closestCost(vector<int>& baseCosts, vector<int>& toppingCosts, int target) {
vector<int> arr;
function<void(int, int)> dfs = [&](int i, int t) {
if (i >= toppingCosts.size()) {
arr.push_back(t);
ret... | ALGO | 0.999966 | 5.635001 |
6e90985c-8aa7-46ea-9059-d5d7ff5fb1be | kaus98/Coding-Practice | Leetcode/Arrays/MaximumSumOfSubArrays-2461-Medium.cpp | class Solution {
public:
long long maximumSubarraySum(vector<int>& nums, int k) {
return maximumSubarraySumArray(nums, k);
}
//Array perform better with SubArrays
long long maximumSubarraySumArray(vector<int>& nums, int k) {
long long sum = 0;
long long maximum = 0;
... | ALGO | 0.999856 | 6.230543 |
fffb537f-d1c0-4fff-96ec-e515c892c10c | muhammadhasan01/cp | Online Judge/Codeforces/Contests/DIV2/DIV2-443/C.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 5;
const int B = 2;
int n;
pair<char, int> c[N];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> c[i].first >> c[i].second;
}
int onez = (1 << 1... | ALGO | 0.999992 | 4.038553 |
e7ebffc3-b03f-46a0-97a5-e3653abd37cb | krishna-raj007/BodhiTree-Annotation | CS101_Spring2020-21 /LAB4_L1/categorized/mod/one_passed/34_mod.cpp | #include<simplecpp>
main_program{
long int m,n,t,z;
cin>>n>>m;
t=n;
repeat(n-1){
n=n-1;
t=n*t;
}
z=t%m;
cout<<z<<endl;
}
| ALGO | 0.999953 | 3.58893 |
c46529ba-6d65-4059-9232-8d8ee1e838d1 | SoumyaAgrawal1/leetcode | 2089-find-target-indices-after-sorting-array/2089-find-target-indices-after-sorting-array.cpp | class Solution {
public:
vector<int> targetIndices(vector<int>& nums, int target) {
sort(nums.begin(),nums.end());
vector<int> ans;
for(int i=0; i<nums.size();i++){
if(nums[i]==target){
ans.push_back(i);
}
}
return ans;
}
}; | ALGO | 0.999958 | 6.455625 |
28a3c1ed-85b3-48ae-83b5-ccd6f23b817f | momchiltsanovv/Data-Structures-NBU | DynamicDataStructures/Durveta_narastvane-visochina/tursene.cpp | #include <iostream>
#include <limits> // за std::numeric_limits
using namespace std;
int COUNT;
typedef struct node* po;
struct node {
int data;
po left;
po right;
};
po root = NULL;
po build(int zakach) {
if (root == NULL) {
cout << "Zakacham koren " << endl;
root = new node;
... | ALGO | 0.999243 | 3.856821 |
d31e072c-dc56-4cea-a81d-efc7a236ba8a | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_10430_3.cpp | #include <bits/stdc++.h>
using namespace std;
const long long N = 2222, M = 998244353;
long long n, k, h[N], dp[N][2 * N];
int32_t main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n >> k;
for (long long i = 0; i < n; i++) cin >> h[i];
if (k == 1) {
cout << 0;
return 0;
}
if (h[0] == h[1 % ... | ALGO | 0.99999 | 4.406836 |
5ff286f4-376d-496c-b441-be01a2d72a49 | coder-Rishi05/Array-questions | 1d (single dimension) array(completed)/pg18.cpp | /* 18. Program to Find Largest Number in an array. */
#include<iostream>
using namespace std;
int main(){
int array[]={113,108,1157,836,55,726,256};
int largestnum=array[0];
cout<<"Array numbers : "<<endl;
int l=sizeof(array)/sizeof(int);
for(int i=0;i<l;i++){
cout<<array[i]<<" ";
}
for(int i=0;i<l... | ALGO | 0.999425 | 3.680659 |
d4f5967a-1c2b-49c8-b2b2-0f0b60edee56 | thelunartear/Coding_Test_Study | 프로그래머스/1/72410. 신규 아이디 추천/신규 아이디 추천.cpp | #include <string>
#include <vector>
#include <algorithm>
#include <regex>
using namespace std;
string solution(string new_id) {
string answer = "";
// 1단계
// transform(new_id.begin(), new_id.end(), new_id.begin(), ::tolower);
for(char &c:new_id)
c=tolower(c);
// 2단계
for(int i=0;i<new_i... | ALGO | 0.999266 | 6.272812 |
27e36ecd-269e-4c40-be30-81b8bdc4d1d9 | dEsquilas/aoc2020 | boost_1_74_0/libs/compute/perf/perf_stl_partial_sum.cpp | #include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
#include <boost/compute/system.hpp>
#include "perf.hpp"
int rand_int()
{
return static_cast<int>((rand() / double(RAND_MAX)) * 25.0);
}
int main(int argc, char *argv[])
{
using boost::compute::int_;
perf_parse_args(argc, argv... | ALGO | 0.989388 | 5.875501 |
84f35f6b-9087-4e87-ae40-e4e5eef15807 | Lan-ce-lot/POC | al/sy5_self.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <ctime>
#define INVALID -1
#define total_instruction 320
#define total_vp 32 //最大页数
int a[total_instruction];//指令序号数组
void createRandom() {
srand(10 *getpid()); //每次运行时进程号不同,用来作为初始化随机数队列的"种子
int s = (int)((float)(total_ins... | ALGO | 0.997719 | 3.22453 |
ea4b7a7a-1736-40fa-9f17-1b426f0148ed | afuu21/100daysofcode | day_33_next-greater-element.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
int nge[10];
stack<int> st;
for(int n=0; i<=2*n-1; i++) {
//pop the small elements
while(!st.empty() && st.top() <= a[i%n])
st.pop();
if(i<n) {
if(!st.empty() == false)
nge[i] = st.top(... | ALGO | 0.999943 | 3.708835 |
a93ea259-31c7-425d-a298-a5d0f514757f | TrucJ/codeforces-submissions | contest/1982/C.cpp | #define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <queue>
#include <stack>
#include <map>
#include <utility>
#define ll long long
#define II pair<int, int>
#define PQ priority_queue
#define MAX 200005
#define INF 1000000009
#define Fo... | ALGO | 0.999964 | 3.890656 |
e7866ad6-87df-44c4-a253-f58c855c0150 | hamzakalyar/DSA-ASSGN-3 | Source.cpp | #include "DoublyLinkedList.h"
int main() {
DoublyLinkedList list;
list.iAS(10);
list.iAS(20);
list.iAE(30);
list.iAE(40);
std::cout << "List after inserting 20, 10 at start and 30, 40 at end: ";
list.traverse();
list.dAS();
std::cout << "List after deleting from start: ";
lis... | ALGO | 0.884137 | 5.392505 |
f412a218-7df4-456d-b3c7-b479e7cdf11f | harshabangi/leetcode | cpp/binary_search/search_a_2d_matrix_ii.cpp | //
// Created by Harsha Vardhan on 28/05/22.
//
#include <iostream>
#include <vector>
using namespace std;
int getBinaryIndexSearch(vector<int> &nums, int &target) {
int l = 0, r = nums.size() - 1;
while (l < r) {
int mid = l + (r - l) / 2;
if (nums[mid] == target) {
return mid;
... | ALGO | 0.999935 | 6.159607 |
c7630eae-600c-4cc7-b964-7507f6251088 | tic40/atcoder | abc/abc278/d/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<(n);i++)
#define endl '\n'
using ll = long long;
int main() {
int n; cin >> n;
map<int,ll> mp;
REP(i,n) {
int a; cin >> a;
mp[i] = a;
}
int base = 0;
int q; cin >> q;
REP(_,q) {
int t; cin >> t;
if (t == 1) {
... | ALGO | 0.99409 | 4.173444 |
ed8f9abd-6105-4310-b55b-bd7ae57e7b8e | rraallvv/Ball-in-maze | bullet/src/BulletSoftBody/btSoftSoftCollisionAlgorithm.cpp | #include "btSoftSoftCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
#include "BulletCollision/CollisionShapes/btBoxShape.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletSoftBody/btSoftBodySolvers.h"
#include "btSoftBody.h"
#include "BulletCo... | ALGO | 0.992448 | 3.784431 |
29516a6a-3a52-4471-a515-c4866be53100 | Project-Astera/frameworks_av | media/libeffects/lvm/lib/Common/src/MixInSoft_D32C31_SAT.cpp | /**********************************************************************************
INCLUDE FILES
***********************************************************************************/
#include "Mixer_private.h"
#include "VectorArithmetic.h"
/**************************************************************************... | ALGO | 0.9963 | 6.147541 |
b819e836-a3c8-42e7-8d5f-ec11e3a5be64 | tjdlfgns1234/baekjoon | 4386번 별자리 만들기.cpp | #include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define all(a) a.begin(),a.end()
using namespace std;
// Beware of MAX & MIN value!
// Beware of floating point Error!
struct edge {
int p1, p2;
double w;
};
bool compare(edge a, edge b);
double dist(pair<double, double>& p1, pair<double, ... | ALGO | 0.999687 | 3.953441 |
43310acb-ca15-4e5f-a62b-265bb1e86c0d | WIZeaz/AlgorithmTemplateForAcm | Graph-Theorem/Flow/ISAP.cpp | #include<cstdio>
#include<cmath>
#include<iostream>
#include<queue>
#include<cstring>
#define ll long long
#define unll unsigned long long
const int N=2e2+5;
const int M=1e3+5;//点数
const ll MOD=1e9+7;
const int INF=1e9+7;//一个上限
const double Exp=1e-8;
const double PI=acos(-1);
using namespace std;
//边的结构定义
struct Pai... | ALGO | 0.998251 | 3.54483 |
4bfd8454-3a31-49e0-93e3-df0bc01bb6d1 | Arifulit/Competative-Programming | Algorithm/celebrity_problem.cpp | #include <iostream>
using namespace std;
int main()
{
int arr[][4] = {{0, 0, 1, 1},
{0, 0, 1, 1},
{0, 0, 0, 1},
{0, 0, 0, 0}};
int celebrity = -1;
for (int i = 0; i < 4; i++)
{
bool everyone_knows = true;
bool knows_anyone = f... | ALGO | 0.999809 | 4.087837 |
04ad8c9b-db92-4188-906a-2ce10bd4895b | xue-fc/PAT | PAT1027/PAT1027.cpp | //没有从char到string的构造函数,得用char数组作为中介
#include<iostream>
#include<cstring>
#include<string>
#include<vector>
#include<algorithm>
#include<queue>
#include<map>
using namespace std;
const int MAX = 10000;
string helper(int a);
int main(){
int a,b,c;
cin>>a>>b>>c;
cout<<"#"<<helper(a)<<helper(b)<<helper(c)<<en... | ALGO | 0.999512 | 3.976876 |
3c6b0876-ecf3-4923-8ae8-36ded54a0c3a | apaarkamal/LPU-Jun24 | cp/binary_trees.cpp | #include<bits/stdc++.h>
using namespace std;
struct node {
int val;
node *left, *right;
node() {val = 0, left = right = NULL;}
node(int _val) {val = _val, left = right = NULL;}
};
node* build_tree_preorder() {
int x;
cin >> x;
if (x == -1) return NULL;
node* cur = new node(x);
cur->left = build_tree_preorde... | ALGO | 0.999948 | 4.003988 |
d657881d-177f-4f7d-a04e-8e171461255f | openjdk/jfx22u | modules/javafx.web/src/main/native/Source/WebCore/html/MediaFragmentURIParser.cpp | #include "config.h"
#include "MediaFragmentURIParser.h"
#if ENABLE(VIDEO)
#include "HTMLElement.h"
#include "MediaPlayer.h"
#include "ProcessingInstruction.h"
#include "SegmentedString.h"
#include "Text.h"
#include <pal/text/TextEncoding.h>
#include <wtf/text/CString.h>
#include <wtf/text/StringBuilder.h>
#include <w... | TOOL | 0.889158 | 7.152785 |
bae80dbe-26a3-47da-8a02-9ccd268104d6 | RainPPR/oi-archive | 20231105 gym104759/b.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < int(n); ++i)
signed main() {
int T; scanf("%d", &T);
while (T--) {
int n; scanf("%d", &n);
vector<int> a(n);
rep(i, n) scanf("%d", &a[i]);
sort(a.begin(), a.end());
... | ALGO | 0.999173 | 4.34353 |
780fa91b-15c9-4abc-a8f3-a542d4c73c8f | dbdxnuliba/robotServer | RobotInterpreter/Common/functions.cpp | #include <stdio.h>
#include "functions.h"
#include <string.h>
#include <time.h>
#include <algorithm>
#ifdef __linux__
#include <sys/time.h>
#include <sys/times.h>
#include <libgen.h>
#else
#include <windows.h>
#endif
namespace Common {
template<typename TYPE>
bool
ReadLineToArray (const char* lpFileName,
... | TOOL | 0.941599 | 3.445241 |
5b4e3c90-d2cd-4d53-a781-37c7dc753adb | ivayloknchv/DSA_2024_2025 | Week 09/uniqueMorseRepresentations.cpp | // https://leetcode.com/problems/unique-morse-code-words/submissions/1467752216/?envType=problem-list-v2&envId=hash-table
class Solution
{
public:
int uniqueMorseRepresentations(vector<string>& words)
{
vector<string> morse = {".-","-...","-.-.","-..",".","..-.","--.","....","..",
".---","-.-... | ALGO | 0.999858 | 6.613624 |
9dd6dccb-523e-429a-bef9-692958e88042 | dhirajmishra98/Just-Code | 283-move-zeroes/283-move-zeroes.cpp | class Solution {
public:
void moveZeroes(vector<int>& nums) {
int n = nums.size();
int x=0,y=0;
for(int i=0;i<n;i++){
if(nums[y]!=0){
int temp = nums[y];
nums[y] = 0;
nums[x] = temp;
x++;
}
y+... | ALGO | 0.999963 | 6.396339 |
15de98bc-ca72-4843-8046-c128578eff83 | kimsooho/algorithm | cpp/baekjoon/baekjoon_1463.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
vector<int> v;
int N;
cin >> N;
int MAXNUM = 1000001;
v.resize(N+1, MAXNUM);
v[N] = 0;
for(int i=N; i > 0; --i)
{
//if(v[i] == MAXNUM) continue;
if(i%3 == 0) v[i/3] = min(v[i/3], v[i] + 1);
if(i%2 ... | ALGO | 0.99997 | 3.658743 |
6ec0d535-457c-441b-a0d7-ab942f423fd7 | nileshplays/data-structures-and-algorithms | Queue/reverseFirstKElements.cpp | class Solution
{
public:
// Function to reverse first k elements of a queue.
queue<int> modifyQueue(queue<int> q, int k) {
// add code here.
stack<int> s;
for(int i=0 ; i<k ;i++){
int ele = q.front();
q.pop();
s.push(ele);
}
... | ALGO | 0.999704 | 4.837158 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.