uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
aab9f654-509c-4728-b0d9-6edec797cb5d | cosinehere/leetcode | 6.z-字形变换.cpp | /*
* @lc app=leetcode.cn id=6 lang=cpp
*
* [6] Z 字形变换
*
* https://leetcode-cn.com/problems/zigzag-conversion/description/
*
* algorithms
* Medium (50.65%)
* Likes: 1268
* Dislikes: 0
* Total Accepted: 296.8K
* Total Submissions: 586K
* Testcase Example: '"PAYPALISHIRING"\n3'
*
* 将一个给定字符串 s 根据给定的行数... | ALGO | 0.999969 | 6.377006 |
70c53fe2-82c1-4578-99dc-dd1a5a0f6e44 | HRithIkGowDA/Placement_Preperation | leetcode/combination_sum3.cpp | /*
Find all possible combinations of k numbers that add up to a number n, given that only numbers from 1 to 9 can be used and each combination should be a unique set of numbers.
Example 1:
Input: k = 3, n = 7
Output:
[[1,2,4]]
*/
class Solution {
public:
void printsmall(vector<int> small){
for(int i=0;... | ALGO | 0.999977 | 6.222858 |
4d0b2b8e-f50f-4486-8665-fee474bc1f63 | SnoozeZ/LeetCode | C++/301 Remove Invalid Parentheses.cpp | class Solution {
public:
vector<string> removeInvalidParentheses(string s) {
unordered_set<string> visited;// use set to eleminate the duplicate
vector<string> rlt;
queue<string> q;
q.push(s);
while(!q.empty()){
int size = q.size();
int flag = false;
... | ALGO | 0.999898 | 5.471681 |
9c631345-393b-4836-8188-8f628d6574a4 | soniayush12/Satellite-Tracker | satell.cpp | #include <iostream>
#include <cmath>
#include <ctime>
#include <iomanip>
#include <chrono>
#include <thread>
#include <windows.h>
#include <GL/freeglut.h>
const double PI = 3.14159265358979323846;
const double GM = 398600.4418; // Earth's gravitational constant (km^3/s^2)
const double EarthRadius = 6378.135; // Earth'... | TOOL | 0.906564 | 6.53318 |
68573752-3316-4688-b087-80c91a5a830c | ugurbolat/CoVO | src/covo.cpp | #include "ReadArgs.h"
#include "Feature.h"
#include "Matcher.h"
#include "Uncertainty.h"
#include "Optimizer.h"
#include "KeyframeTracker.h"
#include <nlohmann/json.hpp>
#include <arg/args.hxx>
#include <spdlog/spdlog.h>
#include <spdlog/sinks/stdout_color_sinks.h>
#include <fstream>
#include <opencv2/core.hpp>
#inclu... | DATA | 0.851328 | 5.659242 |
396fa1e9-f245-44fc-b07b-bf5820977548 | shoaibrayeen/Programmers-Community | Dynamic Programming/0-1 Knapsack Problem/SolutionbyShrishtiGoyal.cpp | #include <bits/stdc++.h>
using namespace std;
int knapsack(int max, vector<int>&wt, vector<int>&value, int n) //Knapsack function assigns the values into a matrix by tabular method
{
int dp[n + 1][max + 1];
for (int i = 0; i <= n; i++) {
for (int j = 0; j <= max; j++) {
if (i == 0 || j ... | ALGO | 0.999992 | 4.720718 |
6919a4c2-0bf9-419a-a98d-a9377360c289 | ahnsem824/baekjoon | BaekjoonTest/BaekjoonTest/1152_단어의개수.cpp | #include <iostream>
#include<vector>
#include<string>
using namespace std;
void ܾǰ_1152()
{
ios::sync_with_stdio(false), cout.tie(0), cin.tie(0); // ȭ ´
string a;
getline(cin, a);
int count = 1;
for (int i = 0; i < a.length(); i++)
{
if (a[i] == ' ')
{
count++;
}
}
if(a[0]== ' ')
{
count-... | ALGO | 0.998649 | 3.845203 |
7b38760c-62b9-4339-8a0c-28aaf42f60ff | SlickHackz/famous-problems-cpp-solutions | zzz_Unsorted/RandomizedQuickSortusingonlyXOR.cpp | #include<iostream>
using namespace std;
void printArray(int *arr,int n)
{
cout<<endl;
for(int i=0 ; i<=n-1 ; i++)
cout<<arr[i]<<" ";
cout<<endl;
}
void Swap(int *a,int *b)
{
if(a!=b)
{
*a = (*a) ^ (*b);
*b = (*a) ^ (*b);
*a = (*a) ^ (*b);
}
}
int Partition(int *arr,int si,int ei)
{
if(si > ei)
retur... | ALGO | 0.999965 | 4.528852 |
01ebfc33-8150-4c07-93a0-a9aa6a3d394d | swatimry/leetcode-practice | 1137-height-checker/height-checker.cpp | class Solution {
public:
int heightChecker(vector<int>& heights) {
vector<int> temp=heights;
int cnt=0;
sort(heights.begin(),heights.end());
for(int i=0;i<heights.size();i++){
if(heights[i]!=temp[i]){
cnt++;
}
}
ret... | ALGO | 0.999927 | 5.626358 |
2280f28f-f526-45cf-bcc4-26ed8555314c | Linux-enCaja/robotica | SIEBOT/Arduino-Wiring/libmaple/wirish/wirish_shift.cpp | #include "wirish.h"
void shiftOut(uint8 dataPin, uint8 clockPin, uint8 bitOrder, uint8 val) {
int i;
for (i = 0; i < 8; i++) {
if (bitOrder == LSBFIRST) {
digitalWrite(dataPin, !!(val & (1 << i)));
} else {
digitalWrite(dataPin, !!(val & (1 << (7 - i))));
}
... | TOOL | 0.909158 | 4.988724 |
3cd7b7e3-5c0c-4c54-8a42-f78043f2800f | 1119-2916/competitive-programming | atcoder/abc/035/c.cpp | #include <bits/stdc++.h>
using namespace std;
#define INF 1001000100010001000
#define MOD 1000000007
#define EPS 1e-10
#define int long long
#define rep(i, N) for (int i = 0; i < N; i++)
#define Rep(i, N) for (int i = 1; i < N; i++)
#define For(i, a, b) for (int i = (a); i < (b); i++)
#define pb push_back
#define e... | ALGO | 0.999932 | 3.943561 |
20e4afff-803b-493b-b0aa-152e1767815f | KomiMoe/Arkari | llvm/tools/llvm-opt-report/OptReport.cpp | #include "llvm-c/Remarks.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Demangle/Demangle.h"
#include "llvm/Remarks/Remark.h"
#include "llvm/Remarks/RemarkFormat.h"
#include "llvm/Remarks/RemarkParser.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/ErrorOr.h"
#inclu... | TOOL | 0.979033 | 7.825453 |
3c55dbab-c3a8-4bda-9fe3-90040d0c4dbe | ishandutta2007/codeforces | arsijo/normal/717/C.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef unsigned int ui;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<ii, ii> iii;
ll MOD = 10007;
const ld E = 1e-9;
#define null NULL
#define ms(x) memset(x, 0, sizeof(x))
#ifndef LOCAL
#define endl ... | ALGO | 0.999983 | 4.022466 |
f2ed13ea-1ac3-44c4-99c4-0b90f3e9039d | hma40/Cpp-Competitive-Programming | Codeforces/Gym545542/D.cpp | #include <bits/stdc++.h>
std::string to_string(__int128_t value) {
if (value == 0) return "0";
std::string result;
bool negative = (value < 0);
if (negative) value = -value;
while (value > 0) {
result += '0' + (value % 10);
value /= 10;
}
if (negative) result +... | ALGO | 0.999826 | 4.283752 |
2df5b698-26d0-4f8d-840d-baae24f9e67b | swapnil159/My-CP-Submissions | Educational_Rounds/39/D.cpp | /* winners never quit and quitters never win.
#swap */
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#pragma GCC optimize ("-O3")
#define mod 1000000007
#define inf 1000000000000000000
#define rk 256
#define pb push_back
#define mp ... | ALGO | 0.999943 | 4.119117 |
7438412e-1a72-48bd-9333-f00522077419 | u2vr/SiGameIRL | v2/Code/SiGameIRL_v2_ARD/lib/FastLED-master/bitswap.cpp | #define FASTLED_INTERNAL
#include "FastLED.h"
/// Simplified form of bits rotating function. Based on code found here - http://www.hackersdelight.org/hdcodetxt/transpose8.c.txt - rotating
/// data into LSB for a faster write (the code using this data can happily walk the array backwards)
void transpose8x1_noinline(un... | ALGO | 0.991598 | 5.11307 |
0c8de9e8-9b85-4354-8a0e-c143251747fd | RenanTashiro/URI | code/Estruturas e Bibliotecas/p-level-7/1500.cpp | /*
Nome: Consultas Horríveis
ID: 1500
Resposta: Accepted
Linguagem: C++ (g++ 4.8.5, -std=c++11 -O2 -lm) [+0s]
Tempo: 0.172s
Tamanho: 1,37 KB
Submissao: 08/06/17 18:25:18
*/
#include <bits/stdc++.h>
using namespace std;
#define LSOne(S) (S & (-S))
class BIT
{
private:
long long int *b1, *b2, size;... | ALGO | 0.999628 | 4.179871 |
0954822b-d5bf-44a3-9a96-fd682b562d3a | rodmartin30/competitive-programming | Training Camp 2015/Dia 1/4.cpp | #include <bits/stdc++.h>
#define fore(i,a,n) for(int i=a;i<n;i++)
using namespace std;
map<int,vector<int> > graph;
map<int,int> dfs_num,dfs_low,visited;
stack<int> s;
int N,r;
void tarjanSCC(int u) {
dfs_low[u] = dfs_num[u] = N++;
s.push(u);
visited[u] = 1;
fore(i,0,graph[u].size()) {
int v = graph[u][i];... | ALGO | 0.99972 | 3.954028 |
6a1c0a9d-b1b1-4ee8-90b0-da940d343dbc | Yadavkhushi18/Khushi-Yadav | 0322-coin-change/0322-coin-change.cpp | class Solution {
public:
int coinChange(vector<int>& coins, int amount) {
int n = coins.size();
vector<int> dp(amount+1,0);
vector<int> temp(amount+1,0);
for(int tar = 0; tar<=amount; tar++){
if(tar%coins[0] == 0) dp[tar] = tar/coins[0];
else dp[tar] = 1e9;
... | ALGO | 0.999763 | 5.825553 |
38e48426-6b9c-4221-8ada-aa9961266f4f | lansplansplansp/0707 | 0728/C++ Primer Plus/Chapter 18/variadic1.cpp | //variadic1.cpp -- using recursion to unpack a parameter pack
#include <iostream>
#include <string>
// definition for 0 parameters -- terminating call
void show_list3() {}
// definition for 1 or more parameters
template<typename T, typename... Args>
void show_list3( T value, Args... args)
{
std::cout << value << "... | TOOL | 0.915472 | 5.565797 |
e5ea7a66-fb11-46e4-aae7-44e37fe9ef77 | gabrielrussoc/competitive-programming | codeforces/725b.cpp | #include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
char s[123];
ll get(char c) {
if(c >= 'd') return 'f'-c+1;
else return c-'a'+1+3;
}
int main() {
scanf(" %s", s);
int n = strlen(s);
char seat = s[n-1];
s[n-1] = 0;
ll row = atoll(s);
row--;
l... | ALGO | 0.999868 | 3.891338 |
30beef18-033f-4b91-a869-e14dd04fe4c7 | oab224/CP-algorithm | W test case.cpp | #include <iostream>
#include <set>
#include <map>
#include <functional>
#include <iomanip>
#include <climits>
#include <queue>
#include <bitset>
#include <numeric>
#include <list>
#include <stack>
#include <vector>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <algorithm>
#define all(a) (a).begin(), (... | ALGO | 0.996949 | 3.003948 |
2e85008c-f4ac-493c-95b5-8423b6878f12 | raincross7/code-similarity | codes/train_code/problem411/problem411_45.cpp | #include<bits/stdc++.h>
using namespace std;
#define ALL(x) (x).begin(), (x).end()
int main() {
int a, b, c, d ;
cin >> a >> b >> c >> d;
int ab, cd;
if (a > b) ab = b;
else ab = a;
if (c > d) cd = d;
else cd = c;
cout << ab+cd << endl;
return 0;
} | ALGO | 0.999446 | 3.386673 |
c3d7f9b6-b037-4f80-bfbe-4da93cb2270e | suhliebe/TIL | c++/20200907/chapter02/ex_19_array_copy.cpp | #include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
int list[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
int list2[10];
//배열의 크기 계산 방법
int length = sizeof(list) / sizeof(int); // 40 / 4 => 10
// list의 메모리의 크기: int 크기(4) * 10개 --> 40byte
//복사 전 list2 출력
for (auto &i ... | TOOL | 0.884961 | 3.90221 |
2d38a515-42a7-4a94-bb50-4c0d75ecb7c7 | Nikhil9887/nikhil | daa/quick.cpp | #include <bits/stdc++.h>
#include <chrono>
using namespace std;
int deterministicPartition(vector<int> &arr, int low, int high)
{
int pivot = arr[low];
int i = low;
int j = high;
while (i < j)
{
while (arr[i] <= pivot && i <= high - 1)
i++;
while (arr[j] > pivot && j >=... | ALGO | 0.999701 | 6.089196 |
fff05ce1-42fa-44d6-be1b-159edaa234e3 | Ayush-Shambharkar7/Decision-making-statements | Greatest_number.cpp | //Ayush Shambharkar
//23070123034
//Aim - take 3 input from user and check which of the following number is the greates among the 3.
#include<iostream>
using namespace std;
int main() {
int a, b, c;
cout << "Enter the value of a, b, and c: ";
cin >> a >> b >> c;
if (a > b) {
if (a > c) {
... | ALGO | 0.999873 | 3.844712 |
bccae507-5042-492e-ad67-5edf12e032c4 | Nidhideveloper/6companies30dayschallenge | flipkart/mountainarray.cpp | /**
* // This is the MountainArray's API interface.
* // You should not implement it, or speculate about its implementation
* class MountainArray {
* public:
* int get(int index);
* int length();
* };
*/
class Solution {
public:
int findInMountainArray(int t, MountainArray& arr) {
auto l ... | ALGO | 0.999913 | 6.389085 |
2d00dd08-b898-4eb0-be3e-d6c350f70001 | kks227/BOJ | 2400/2481.cpp | #include <cstdio>
#include <vector>
#include <stack>
#include <queue>
#include <unordered_map>
#include <algorithm>
using namespace std;
const int INF = 1e9;
int main(){
int N, M, K, H[100000] = {0};
scanf("%d %d", &N, &K);
unordered_map<int, int> H2N;
for(int i=0; i<N; i++){
for(int j=0; j<K; j++){
int b;
... | ALGO | 0.999709 | 3.591801 |
6dc4a14c-4709-45fe-9b68-52d6c9889ada | Dev-Reddy/GFGProblems | Difficulty: Medium/Minimum Jumps/minimum-jumps.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// Function to return minimum number of jumps to end of array
class Solution {
public:
int minJumps(vector<int>& arr) {
// Your code here
int n = arr.size(), maxInd = 0, nextMaxInd = arr[0], res = 0;
... | ALGO | 0.999876 | 6.069671 |
14de8b19-c502-4f34-bb95-b6d3862609bd | CreativeMachinesLab/RibosomalRobotics | HyperNEAT/noveltyexp.cpp | #include "experiments.h"
#include <string.h>
#include "noveltyset.h"
#include "datarec.h"
#include "maze.h"
#include "histogram.h"
//#define DEBUG_OUTPUT 1
#include <algorithm>
#include <vector>
#include <cstring>
#include <iostream>
#include <fstream>
#include <math.h>
using namespace std;
static char output_dir[... | ALGO | 0.998628 | 3.737709 |
3b4a7410-64d4-4a6a-89f8-53a5e5522945 | alphaprojectv1/Programming | A_Watermelon.cpp | #include<bits/stdc++.h>
#define nl "\n"
#define blk " "
typedef long long ll;
// #define ll long long
using namespace std;
const int N=1e5+5;
int main()
{
int n;
cin>>n;
if(n%2==0 && (n/2)>1)
{
cout<<"YES";
}
else
{
cout<<"NO";
}
} | ALGO | 0.999832 | 3.493423 |
54492d80-d767-4d18-ab29-990519578221 | deepin-community/llvm-toolchain-15 | libc/src/math/generic/modff.cpp | #include "src/math/modff.h"
#include "src/__support/FPUtil/ManipulationFunctions.h"
#include "src/__support/common.h"
namespace __llvm_libc {
LLVM_LIBC_FUNCTION(float, modff, (float x, float *iptr)) {
return fputil::modf(x, *iptr);
}
} // namespace __llvm_libc
| ALGO | 0.960072 | 6.202712 |
83cdd0ad-602f-4acf-a43e-1280fd9bb13f | Recefi/DPCpp_labs | lab2/lab2.cpp | #include <iostream>
#include <sycl/sycl.hpp>
#include <cmath>
using _float_t = double;
int main(int argc, char* argv[]) {
// sin(x)cos(y)dxdy, x from 0 to 1, y from 0 to 1 ~= 0.3868223
constexpr _float_t EXP_RES = 0.3868223;
constexpr size_t GROUP_SIZE = 16;
const size_t intervalsCount = std::stoi(ar... | ALGO | 0.994962 | 5.620682 |
fb2406af-21a3-4f10-afac-7730ac9d7d5f | andrefakhoury/competitive-programming | problems/gyms/Latin American Subregional 2019/I.cpp | #include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
const int MAXN = 404;
int dist[MAXN][MAXN];
int dist2[MAXN][MAXN];
int ans[MAXN * MAXN];
in... | ALGO | 0.999939 | 4.169569 |
01ba4e18-35c3-4ef3-9c3f-b39d3a69c416 | Simba-97/Leetcode-solved-questions | 40-combination-sum-ii/40-combination-sum-ii.cpp | class Solution {
public:
void findCombination(int ind, int target, vector<int>& arr, vector<vector<int>>& ans, vector<int> &ds) {
if(target == 0) {
ans.push_back(ds);
return;
}
for(int i = ind; i < arr.size(); i++) {
if(i > ind && arr[i] =... | ALGO | 0.999992 | 6.270612 |
d8df4fed-99be-426d-9ca1-600ddd08e243 | pnkj51/Competitive_Programming | Recursion/xAtLast.cpp | #include<iostream>
using namespace std;
string xAtLast(string s)
{
if(s.length()==0)
{
return "";
}
char ch = s[0];
string ans = xAtLast(s.substr(1));
if(ch=='x')
{
return xAtLast(s.substr(1))+'x';
//return ans+ch;
}
// return ch+ans;
return ch+xAtLast(s.... | ALGO | 0.999533 | 3.197865 |
319e0022-fd54-4d57-8994-3ad7f3d34249 | Nanduner/Seminar | OptimizedBubble.cpp | #include "pch.h"
#include "OptimizedBubble.h"
template <typename T>
void opt_bubble(T* arr, int size) {
for (int i = 0; i < size - 1; i++)
{
bool swapped = false;
for (int j = 0; j < size - i - 1; j++)
{
if (arr[j] > arr[j + 1]) {
T tmp = arr[j];
arr[j] = arr[j + 1];
arr[j + 1] = tmp;
swapped... | ALGO | 0.998547 | 4.080507 |
dc5545be-f6f7-411d-a8b8-31340612e87b | MikhailPimenov/Algorithms-and-data-structures-CPP | lecture12/knuth_morris_pratt/knuth_morris_pratt3.cpp | #include "knuth_morris_pratt3.h"
int knuth_morris_pratt3(const char* s, int length, const char* ss, int slength)
{
--length;
--slength;
if (!length || !slength || length < slength)
return -1;
char* longstring = new char[slength + 1 + length];
for (int i = 0; i < slength; ++i)
longstring[i] = ss[i];
longs... | ALGO | 0.999683 | 3.987324 |
b568153e-90aa-4571-8dc7-2674993a7258 | zihanpeter/problems | nfls10A.cpp | #include <iostream>
using namespace std;
int n, a[5], b[5], ans;
bool tong[105][105][105];
bool check(int x, int y) {
if (x > y) swap(x, y);
if (abs(x - y) <= 2 || abs(x + n - y) <= 2) return true;
return false;
}
int main() {
scanf("%d", &n);
for (int i = 1; i <= 3; ++i) scanf("%d", a + i);
f... | ALGO | 0.999901 | 3.87668 |
56d5882d-5bbd-4794-9544-9ac49af46a3a | Sartazz7/CSES-Problem-Set | Mathematics/JosephusQueries.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int person(int n, int k, int s){
if(s==1){
if(k<=(n+1)/2)return 2*k-1;
return 2*person(n/2,k-(n+1)/2,1+n%2);
}
if(k<=n/2)return 2*k;
return 2*person((n+1)/2,k-n/2,2-n%2)-1;
}
int main(){
int t;
cin>>t;
whil... | ALGO | 0.999934 | 4.387281 |
41e8751b-d13b-4145-af44-25bb6e9ce3dd | quicklers/pytorch | aten/src/ATen/native/vulkan/ops/cumsum.cpp | #include <ATen/native/vulkan/ops/Common.h>
#include <ATen/native/vulkan/ops/Utils.h>
#include <torch/library.h>
namespace at {
namespace native {
namespace vulkan {
namespace ops {
namespace {
using namespace api::utils;
Tensor cumsum(
const at::Tensor& input_arg,
const int64_t dim,
const c10::optional<S... | TOOL | 0.88926 | 6.801009 |
ba754636-7735-4e8a-a272-f0f69f0ad05b | aqfaridi/Competitve-Programming-Codes | Contests/practice_4/XeniaAndTree.cpp | //Tanuj Khattar
#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> II;
typedef vector< II > VII;
typedef vector<int> VI;
typedef vector< VI > VVI;
typedef long long int LL;
typedef unsigned long long int ULL;
#define PB push_back
#define MP make_pair
#define F first
#define S second
#def... | ALGO | 0.999992 | 4.516369 |
f2916938-4980-4b9b-8ccd-5d5f2efd496a | Piyush13-ambure/DSA | Minimum Operations to Exceed Threshold Value II.cpp | /*You are given a 0-indexed integer array nums, and an integer k.
In one operation, you will:
Take the two smallest integers x and y in nums.
Remove x and y from nums.
Add min(x, y) * 2 + max(x, y) anywhere in the array.
Note that you can only apply the described operation if nums contains at least two elements.
Ret... | ALGO | 0.999988 | 6.705962 |
c9cb39f6-a544-477e-beac-0a81278b858a | necatiergin/BITSET | bitset_19.cpp | #include <iostream>
#include <bitset>
int main()
{
unsigned long x, y;
std::cout << "enter two integers : ";
std::cin >> x >> y;
std::bitset<32> bx{ x }, by{ y };
std::cout << " " << bx << '\n';
std::cout << " " << by << '\n';
std::cout << "and = " << (bx & by) << '\n';
std::cout << "or ... | ALGO | 0.994811 | 4.2268 |
be92ed48-b233-4506-b216-5f4470fed0b8 | strategist614/ACM-Code | 刷题比赛/牛客/牛客OI赛制测试赛2/B.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,k;
ll a[100][100];
ll c[100][100];
ll b[100][100];
int main ()
{
cin>>n>>k;
for(ll i = 1;i <= n;i++)
for(ll j = 1;j <= n;j++)
{
scanf("%lld",&a[i][j]);
b[i][j] = a[i][j];
}
for(ll ... | ALGO | 0.999928 | 3.015455 |
63db8235-18e1-42fb-8723-c22e08af8e2e | sincostanx/EmergencyDistribute-GA | Young-Scientist-Competition-2017/reference_solution.cpp | #include "stdio.h"
#include "vector"
#include "algorithm"
#define matrix vector<vector<int> >
#define super_matrix vector<vector<long long> >
#define point pair<int,int>
#define state pair<int,point>
#define f first
#define s second
#define INF 1e8
using namespace std;
class vertex{
public:int z,r,X,T;
public:v... | ALGO | 0.999695 | 3.706381 |
2ab56a13-2bb4-40ac-bea7-efe0fc2c81e4 | deep1205/Problem-Solving-Leetcode-DSA- | graph/graph.cpp | #include "bits/stdc++.h"
using namespace std;
#define int long long
#define pb push_back
#define ppb pop_back
#define pf push_front
#define ppf pop_front
#define all(x) (x).begin(),(x).end()
#define uniq(v) (v).erase(unique(all... | ALGO | 0.999773 | 5.003238 |
ac62abd6-17f0-4218-a48b-d2ed5a334177 | kartik3110/DSA-Coding-Ninjas | Graphs 1/isConnected.cpp | #include <bits/stdc++.h>
using namespace std;
void DFStraversal(int **edges, int v, bool *visited, int start = 0)
{
visited[start] = true;
for (int i = 0; i < v; i++)
{
if (edges[start][i] == 1 && !visited[i])
{
DFStraversal(edges, v, visited, i);
}
}
}
int main()
{... | ALGO | 0.99998 | 4.771308 |
1b7fe64d-c800-417a-9b21-e6653ba285fe | Calebisco/L.T.C.S | C++/minimum-obstacle-removal-to-reach-corner.cpp | // Time: O(m * n)
// Space: O(m * n)
// A* Search Algorithm without heap
class Solution {
public:
int minimumObstacles(vector<vector<int>>& grid) {
const pair<int, int> b = {0, 0}, t = {grid.size() - 1, grid[0].size() - 1};
return a_star(grid, b, t);
}
private:
int a_star(const vector<ve... | ALGO | 0.999961 | 6.763058 |
abada093-44bd-425c-a880-a3efe5a48c4c | ishandutta2007/codeforces | rniya/normal/1459/B.cpp | #include <bits/stdc++.h>
using namespace std;
const long long MOD=1000000007;
// const long long MOD=998244353;
#define LOCAL
#pragma region Macros
typedef long long ll;
typedef __int128_t i128;
typedef unsigned int uint;
typedef unsigned long long ull;
#define ALL(x) (x).begin(),(x).end()
const int INF=1e9;
const long... | ALGO | 0.999971 | 4.324005 |
68e0c53c-edeb-49ab-9574-c3a39755e419 | Distrotech/llvm | lib/CodeGen/SelectionDAG/ResourcePriorityQueue.cpp | #include "llvm/CodeGen/ResourcePriorityQueue.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/SelectionDAGNodes.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetLowering.h"
#include "llvm/Target/TargetMachine.h"
#i... | ALGO | 0.913723 | 6.961215 |
370dfb32-23d8-4d0f-8578-e66272ab6eb9 | vbvh98/CampusTechnicalPrograms | CPP/083-SecondSmallest.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int a[] = {4,2,5,97,57,3,6,9,7865,22,9,90};
int min, smin;
min = smin = a[0];
for(int i = 1; i < sizeof(a)/sizeof(a[0]); i++) {
if(a[i] < min) {
smin = min;
min = a[i];
} else if(smin > a[i]) {
smin = a[i];
}
}
cout << "Second minimum: " <... | ALGO | 0.999413 | 4.382877 |
cf7a9970-6953-4425-9f29-96feec9a2ca7 | sarvex/leetcode-ada | solution/1100-1199/1180.Count Substrings with Only One Distinct Letter/Solution.cpp | class Solution {
public:
int countLetters(string s) {
int ans = 0;
for (int i = 0, n = s.size(); i < n;) {
int j = i;
while (j < n && s[j] == s[i]) ++j;
ans += (1 + j - i) * (j - i) / 2;
i = j;
}
return ans;
}
}; | ALGO | 0.999943 | 6.156493 |
85f09519-3719-4610-ad87-3b001ef40197 | MaximSidorenkoNBI2/Zadachi-CPlusPlus | 3.1 урок/F16.cpp | // Урок 3 базовая с/р F16
#include <iostream>
#include <math.h>
using namespace std;
int main() {
double A;
int N;
cout << "Введите число A: ";
cin >> A;
cout << "Введите число N: ";
cin >> N;
for (int i = 1; i <= N; i++) {
cout << pow(A, i) << endl;
}
return 0;
} | ALGO | 0.999485 | 4.029852 |
b283bb49-b1ae-4a15-b07c-36d3454d3e49 | mechim/problems | codewars/A_wolf_in_sheep's_clothing.cpp | #include <vector>
#include <string>
std::string warn_the_sheep(const std::vector<std::string>& queue)
{
if(queue[queue.size()-1] == "wolf") return "Pls go away and stop eating my sheep";
for (int i = 0; i < queue.size(); i++){
if (queue[i] == "wolf") return "Oi! Sheep number " + std::to_string(queue.size() - i... | TOOL | 0.910139 | 4.507449 |
182fc150-430d-4454-880e-f331dd5c8c9c | MengqingCao/opencv_contrib_dvpp | modules/img_hash/src/phash.cpp | #include "precomp.hpp"
using namespace cv;
using namespace cv::img_hash;
using namespace std;
namespace {
class PHashImpl CV_FINAL : public ImgHashBase::ImgHashImpl
{
public:
virtual void compute(cv::InputArray inputArr, cv::OutputArray outputArr) CV_OVERRIDE
{
cv::Mat const input = inputArr.getMat()... | ALGO | 0.984394 | 5.924483 |
26d47dce-7330-404e-bc2d-2151f784fc0f | Davidalimazo/metamap_flutter | 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 |
0c7cfac5-a7e6-4f66-9052-735a82b50b69 | ishandutta2007/codeforces | neko_nyaaaaaaaaaaaaaaaaa/normal/1365/G.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ull;
int n;
ull ans[69];
vector <int> yo;
int main() {
for (int mask = 0; mask < 1 << 13; ++mask) {
if (__builtin_popcount(mask) == 6) {
yo.emplace_back(mask);
}
}
cin >> n;
for (int i = 0; i < 13; ++i) {
vector <int> cur;... | ALGO | 0.999887 | 3.245908 |
bedd5ce1-5885-498b-9170-51f453df673b | carushi/Radiam | Radiam.cpp | #include "Radiam.h"
namespace Rfold {
const char* Radiam::base = "ACGU";
struct Add {
Add(double Constant) : constant(Constant) {}
double constant;
double operator() (double value) const {
return Logsum(value, constant);
}
};
Mat& Radiam::Get_inner(bool inside, int type, bool mut)
{
Matri... | ALGO | 0.999846 | 4.908072 |
30735fa7-2c1e-40e4-955b-7da1d36416e1 | tanf1995/coding-record | 单项技能/C语言/C程序设计语言/1.导言/5.函数.cpp | #include <stdio.h>
#define LINEMAXLEN 100
int power(int, int);
void testArg(int);
int getLine(char line[], int maxLen);
void copyLine(char from[], char to[]);
int main() {
// test power
//for (int i = 0; i < 10; i++) printf("5%dη%lu\n", i, power(5, i));
// test testArg
/*int m = 5;
testArg(m);
printf("mֵ %d\n... | ALGO | 0.955162 | 3.106115 |
5de492e5-c3da-4b7f-9994-67ce061e77b8 | Tiger-raj/learning_dsa | Graph/mst_kruskal.cpp | #include <bits/stdc++.h>
using namespace std;
class DisjointSet
{
vector<int> rank, parent, size;
public:
DisjointSet(int n)
{
rank.resize(n + 1, 0); // n+1 so that if the indexing is 1 based it can work for that also, so it'll work for 0 based and 1 based indexing both
parent.resize(n + 1... | ALGO | 0.999975 | 5.09085 |
8defefd8-9f65-49b0-9a05-ba81962273e9 | shubhkush57/DSA-LEETCODE | 0074-search-a-2d-matrix/0074-search-a-2d-matrix.cpp | class Solution {
public:
bool searchMatrix(vector<vector<int>>& matrix, int target) {
int n = matrix.size(), m = matrix[0].size();
int start= 0, end = n*m-1;
while(start<=end){
int mid = start+(end-start)/2;
int row = mid/m,col = mid%m;
int ele = matrix[ro... | ALGO | 0.99997 | 6.254512 |
f0a98fd6-459e-4b57-8cb4-a68882865473 | gaaavr/type_and_data_structs | lab_5/infix_to_postfix.cpp | //
// Created by ssgavrilin on 24.03.2024.
//
#include "iostream"
#include "infix_to_postfix.h"
#include <map>
#include "calculate_opz.h"
using namespace std;
map<const char *, bool> allowedInfixChars = {
{"+", true},
{"-", true},
{"*", true},
{"/", true},
{"^", true}... | ALGO | 0.989115 | 4.519086 |
dce5978f-b8ea-49c7-a825-20142a8f20a2 | rhzx0r/comp | src/playeras.cpp | #include <iostream>
// #include <string>
#include <algorithm>
#include <vector>
#include <cstdint>
int main() {
int n;
std::cout << "Ingrese la cantidad de playeras: ";
std::cin >> n;
std::vector<int32_t> numeros(n);
std::cout << "Ingrese " << n << " numeros separados por espacios: ";
for (int i = 0; i ... | ALGO | 0.965093 | 4.037173 |
2919fdb1-0eba-4dc9-a825-83f604ecf825 | didrlgus/algorithm-practice | baekjoon/1202.cpp | // 보석 도둑
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int n,k;
ll ret;
vector<pair<int,int>> v;
vector<int> vv;
priority_queue<ll> pq;
int main() {
scanf("%d %d",&n,&k);
for(int i=0;i<n;i++) {
int weight,price;
scanf("%d %d",&weight,&price);
v.push_back({weight,... | ALGO | 0.999985 | 3.438615 |
9f1c6b2c-c5ec-4d64-97aa-a65ca8d615c6 | OneBitPython/Codeforces | Round793/B_AND_Sorting.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define all(c) c.begin(), c.end()
#define endl "\n"
const double PI = 3.14159265358979323846264338327950288419716939937510582097494459230;
void __print(int x) { cerr << x; }
void __print(long x) { cerr << x; }
void __print(unsig... | ALGO | 0.99992 | 4.990755 |
03a0486e-a384-4269-9706-4f037538050a | larissalages/code_problems | Codeforces_Contests/3_Edu_Round_85/B.cpp | /*
Author - Silent Knight
Institution - BIT Mesra
*/
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll t;
cin>>t;
while(t--)
{
ll n;
ld x;
cin>>n>>x;
... | ALGO | 0.999788 | 3.534235 |
ad69025d-98a8-4c78-942f-995805300a39 | FazeelUsmani/Leetcode | 2020 Leetcode Challenges/06 June Leetcode Challenge 2020/02 DeleteNodeLL.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
void deleteNode(ListNode* node) {
node->val = node->next->val;
node->next = node->next->next;
}
};
| ALGO | 0.999795 | 5.609488 |
68edf782-afab-471d-8f84-f09312282b93 | volleio/TVCOG-OCRmail | libraries/tess-two/jni/com_googlecode_tesseract_android/src/cube/cube_utils.cpp | #include <math.h>
#include <string>
#include <vector>
#include "cube_utils.h"
#include "char_set.h"
#include "unichar.h"
namespace tesseract {
CubeUtils::CubeUtils() {
}
CubeUtils::~CubeUtils() {
}
/**
* convert a prob to a cost (-ve log prob)
*/
int CubeUtils::Prob2Cost(double prob_val) {
if (prob_val < MIN_PRO... | TOOL | 0.960338 | 6.306487 |
51f9f361-1ce2-4ce6-860a-8a49fe92420b | Hdbcoding/cpp_scratchpad | src/dynamic_programming/04_subset_diff/naiveslow.cpp | #include <vector>
#include <cmath>
#include "naiveslow.hpp"
using namespace std;
int recursiveSlow(const vector<int> &nums, int sum1, int sum2, int index)
{
if (index == nums.size())
return abs(sum1 - sum2);
// either try adding this element in the first set, or don't
int diff1 = recursiveSlow(nu... | ALGO | 0.999919 | 5.83818 |
f65eaf84-9b6f-45c8-9821-6bc83759e552 | j2ibeo/askalcoin | src/support/lockedpool.cpp | #include <support/lockedpool.h>
#include <support/cleanse.h>
#if defined(HAVE_CONFIG_H)
#include <config/askalcoin-config.h>
#endif
#ifdef WIN32
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <windows.h>
#else
#include <sys/mman.h> // for mmap
#include <sys/resource.h> // for getrlimit
#include <limits.h> // for P... | TOOL | 0.85156 | 7.486267 |
bd813b84-112d-4504-865e-025be3a174d9 | MostafaMohamed2001/C-Data-Structure | .history/hello_20240701110148.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
string s;
cin >> s;
int s_size = s.length();
bool isLower = fals
if((s[0]>= 65 && s[0]<=90) && (s[1] >= 97 && s[1] <= 122) && (s[2]>= 65 && s[2]<=90)){
for (int i = 3; i < s_size; i++){
if(s[i] >= 97 && s[i]... | ALGO | 0.996659 | 3.786255 |
5d4584f1-1d1d-4a05-88ab-2b8f39b020a9 | DanialLiu/SkiaWin32Port | experimental/Intersection/ConvexHull_Test.cpp | #include "CurveIntersection.h"
#include "Intersection_Tests.h"
#include "IntersectionUtilities.h"
const Cubic convex[] = {
{{0, 0}, {2, 0}, {2, 1}, {0, 1}},
{{1, 0}, {1, 1}, {0, 1}, {0, 0}},
{{1, 1}, {0, 1}, {0, 0}, {1, 0}},
{{0, 1}, {0, 0}, {1, 0}, {1, 1}},
{{0, 0}, {10, 0}, {10, 10}, {5, 6}},
};
... | ALGO | 0.98872 | 6.989616 |
6ee062e8-e73a-4b89-bf86-f8fddd8559fd | sophdev2011/Tema231122 | ProblemaCifre.cpp | #include <iostream>
using namespace std;
int main()
{
int a;
cin >> a;
cout << (a%100)/10 + a%10;
return 0;
} | ALGO | 0.985945 | 3.369913 |
37736ee3-43e3-49fb-bb2b-94d0a47be87d | Manav-Aggarwal/competitive-programming | CodeChef/The First Cube.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
const ll M = 1000000;
ll arr[M+1], mod = 1e9 + 7;
vector<ll> primes;
void sieveOfEratosthenes()
{
ll i, j;
for(i = 2; i <= M; i++)
{
arr[i] = 1;
}
arr[0] = arr[1] = 0;
for(i = 2; i <= cbrt(M); i++)
{
if(arr[i] == 1)
{
... | ALGO | 0.999987 | 5.131938 |
8372d896-cb6b-4936-aee1-38af20b83765 | Lee-jisang/BOJ-and-Programmers | BOJ/단계별로 풀어보기/03_for문/07_A+B - 7_11021.cpp | /*
문제
두 정수 A와 B를 입력받은 다음, A+B를 출력하는 프로그램을 작성하시오.
입력
첫째 줄에 테스트 케이스의 개수 T가 주어진다.
각 테스트 케이스는 한 줄로 이루어져 있으며, 각 줄에 A와 B가 주어진다. (0 < A, B < 10)
출력
각 테스트 케이스마다 "Case #x: "를 출력한 다음, A+B를 출력한다. 테스트 케이스 번호는 1부터 시작한다.
*/
#include <iostream>
using namespace std;
int main(){
int T;
cin >> T;
int a,b;
for(i... | ALGO | 0.914301 | 6.46469 |
dee3910a-2069-43f9-ac9f-f213ef31b0a7 | manvanth-09-08/Code-Library | 46-kthLargestElementInAnArray.cpp | https://leetcode.com/problems/kth-largest-element-in-an-array/
class Solution {
public:
int findKthLargest(vector<int>& nums, int k) {
priority_queue<int,vector<int>,greater<int>>pq;
for(int i=0;i<k;i++){
pq.push(nums[i]); //inserting first k elments into heap
}
for(int ... | ALGO | 0.999943 | 5.011713 |
049d23b3-9575-4cf1-8335-e324fcd7d14d | tegar-gilang/STD_Tegar_Kang_Ageng_Gilang_2311104018 | 04_Single_Linked_List_01/UNGUIDED/soal_01.cpp | #include <iostream>
using namespace std;
// Definisi struktur Node
struct Node {
int data;
Node* next;
};
// Fungsi untuk membuat node baru di depan
void insertAtFront(Node*& head, int value) {
Node* newNode = new Node(); // Membuat node baru
newNode->data = value; // Mengisi nilai pada node bar... | ALGO | 0.997323 | 6.029744 |
80233e37-6618-45b9-a717-671defbff9bd | wangxinghu/leetcode_co | leetcode_chenhao/algorithms/validParentheses/validParentheses.cpp | // Source : https://oj.leetcode.com/problems/valid-parentheses/
// Author : Hao Chen
// Date : 2014-06-30
/**********************************************************************************
*
* Given a string containing just the characters '(', ')', '{', '}', '[' and ']',
* determine if the input string is valid.... | ALGO | 0.999077 | 5.979883 |
41252a2e-6133-4040-9afb-6c28a71d9eba | virendrakabra14/P2P-Network | client-phase3.cpp | #include <iostream>
#include <stdlib.h>
#include <string>
#include <cstring>
#include <vector>
#include <fstream>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <thread>
#include <chrono>
#include <netdb.h>
#include <unistd.h>
#include <mutex>
#include <algorithm>
#include <openssl/md5.... | WEB | 0.978527 | 3.088389 |
be631153-9a20-4907-a2de-043dafc61949 | ViNN280801/codewars | C++/Fundamentals/Tortoise racing.cpp | #include <iostream>
#include <vector>
class Tortoise
{
public:
/**
* @brief Calculates time on which B racer catch up the A. By default A has less speed.
* @param a_speed speed of the 1st member (feet/hour).
* @param b_speed speed of the 2nd member (feet/hour).
* @param lead_of_a lead of the 1s... | ALGO | 0.999128 | 5.149383 |
662a5b50-7baa-4a01-9f38-159734ab3fe5 | TrevorMinnix/SeniorDesign-MetagenomicPipeline | idba-master/src/tools/scaffold.cpp | /**
* @file scaffold.cpp
* @brief Build scaffolds on a set of contigs with multiple levels of insert libraries.
* @author Yu Peng (<EMAIL>)
* @version 1.0.6
* @date 2011-08-06
*/
#include <cmath>
#include <cstdio>
#include <deque>
#include <fstream>
#include <iostream>
#include <sstream>
#include <vector>
#incl... | DATA | 0.967558 | 3.956867 |
c4dab693-c649-48be-bc3d-24d1cffa2a8b | SakshamSahgal/Competitive-Programming | Codeforces + Codechef/B. Duff in Love.cpp | #include<iostream>
#include<algorithm>
#include<vector>
#include<cmath>
#define usi unsigned short int
#define ui unsigned int
#define ulli unsigned long long int
#define lli long long int
using namespace std;
bool lovely_number(lli n)
{
if( sqrt(n) - (int)sqrt(n) )
return 0;
for(lli i=2;i<=sqrt(n);i+... | ALGO | 0.999615 | 3.826513 |
016ff6e6-b9f4-4510-8bb3-2f385e2c922f | POC-2025/leetcode | solution/2400-2499/2486.Append Characters to String to Make Subsequence/Solution.cpp | class Solution {
public:
int appendCharacters(string s, string t) {
int n = t.length(), j = 0;
for (int i = 0; i < s.size() && j < n; ++i) {
if (s[i] == t[j]) {
++j;
}
}
return n - j;
}
}; | ALGO | 0.999977 | 6.253856 |
09b58992-afca-4ef9-9fe3-da672befd371 | lballabio/QuantLib | ql/methods/finitedifferences/solvers/fdmsimple2dbssolver.cpp | /* -*- mode: c++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*!
* \file fdmsimple2dbssolver.cpp
*/
#include <ql/methods/finitedifferences/operators/fdmblackscholesop.hpp>
#include <ql/methods/finitedifferences/solvers/fdm2dimsolver.hpp>
#include <ql/methods/finitedifferences/solvers/fdmsimple2dbs... | ALGO | 0.998223 | 7.593286 |
ba624692-e5fa-4e15-ba33-e283b6bbc2dd | KevinMackenzie/AmberRabbit | Source/BulletPhysics/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp | #include "btSphereSphereCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/CollisionDispatch/btCollisionObjectWrapper.h"
btSphere... | ALGO | 0.99914 | 6.552449 |
eaa36713-d65d-4778-a084-c179c9fe39f5 | Octavi-Testing/frameworks_av | media/codecs/amrnb/dec/src/d2_9pf.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/d2_9pf.c
Functions: decode_2i40_9bits
Date: 01/28/2002
------------------------------------------------------------------------------
REVISION HISTORY
Description: Modified to place file in the... | ALGO | 0.999685 | 7.253563 |
218ce72f-b85b-4b85-932a-93fc16707f2e | IamVigneshG/CP | CPP/PrasunTheDetective.cpp | #include <stdio.h>
#include <string.h>
int main()
{
char a[50],b[50];
int flag=0;
gets(a);
gets(b);
int len1=strlen(a);
int len2=strlen(b);
for(int j=0;j<len2;j++)
{
for(int i=0;i<len1;i++)
{
if(tolower(b[j])==tolower(a[i]))
{
b[j]='~';
break;
}
else if(i==len1-1)
... | ALGO | 0.999974 | 3.213457 |
f82b1fac-ac7f-4ce2-8366-a7bad1b63790 | litirnntir/lab3-cpp-4sem | Graph.cpp | #include "Graph.h"
#include "unordered_map"
template<typename Vertex, typename Distance>
std::vector<Vertex> Graph<Vertex, Distance>::vertices() const
{
std::vector<Vertex> vertexMap;
for (auto i = mapV.begin(); i != mapV.end(); i++)
{
vertexMap.push_back(i->first);
}
return vertexMap;
}
template<typename Vert... | ALGO | 0.99869 | 4.840684 |
e45bd62b-b906-4378-af69-ed8a2db83584 | micYn/FDS | 4.3.4.cpp | #include <iostream>
#include <cstdlib>
using namespace std;
template <class T> class Chain;
template <class T>
class ChainNode{
friend class Chain<T>;
public:
ChainNode(T element = 0,ChainNode<T>* ptr = NULL){data=element; next=ptr;}
private:
T data;
ChainNode<T>* next;
};
template <class T>
class Chain{
... | ALGO | 0.999214 | 3.052959 |
e9522ce3-174b-451b-a638-bb32f4e6b739 | ShreyasV7/Leetcode-Problems | Travelling Salesman Problem - GFG/travelling-salesman-problem.cpp | // { Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
int dp[11][1<<11];
int f(int i, int mask, vector<vector<int>> &cost) {
if(mask == 1 ) return dp[i][0] = cost[i][0] ;
if(dp[i][mask] != -1) return dp[i][mask];
int curAns = INT... | ALGO | 0.999945 | 5.725857 |
fff9539a-1803-4e78-a2aa-6475bb860d76 | black-shadows/LeetCode-Topicwise-Solutions | C++/minimum-unique-word-abbreviation.cpp | // Time: O(2^n)
// Space: O(n)
class Solution {
public:
string minAbbreviation(string target, vector<string>& dictionary) {
vector<int> diffs;
dictionary_to_diffs(target, dictionary, &diffs);
if (diffs.empty()) {
return to_string(target.length());
}
int bits =... | ALGO | 0.99947 | 6.445969 |
8a395ebd-828d-4a55-b75b-fc2ce9518041 | innatelab/msglm | src/cloud_stats.cpp | // [[Rcpp::depends(BH)]]
#include "binned_values.h"
#include "logging.h"
#include <algorithm>
#include <cmath>
#include <boost/math/distributions/normal.hpp>
#include <boost/accumulators/accumulators.hpp>
#include <boost/accumulators/statistics/stats.hpp>
#include <boost/accumulators/statistics/extended_p_square.hpp... | ALGO | 0.995354 | 7.141028 |
ab634e9e-e128-438d-8b8b-02f49d9e2832 | nikhilsharma270027/Striver-A2Z-DSA-Sheet | 13 Binary Trees [Traversals, Medium and Hard Problems]/Medium Problems/2 Check if the Binary tree is height-balanced or not.cpp | #include <bits/stdc++.h>
using namespace std;
struct Node {
int data;
Node* left;
Node* right;
Node(int val) : data(val), left(nullptr), right(nullptr) {}
};
class Solution {
public:
bool isBalanced(Node* root) {
if(root == NULL) {
return true;
}
... | ALGO | 0.999691 | 7.11219 |
902bfa91-b813-4669-b431-b8681db47ecf | chamodanethra/animated_cards_carousel | 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.998848 | 6.76073 |
69ce09d0-1854-40a3-b1e5-56ed2bc13f5c | Sakshamchawla19/DSA | 23_LinkedLists/ChallengesLinkedLists/2LL_k_Reverse.cpp | // LL - k Reverse (where k is the factor of N(total elements))
#include <iostream>
using namespace std;
class node{
public:
int data;
node*next;
//constructor
node(int d){
data = d;
next = NULL;
}
};
void insertAtTail(node*&head, int data){
if(head == NULL){
head = ne... | ALGO | 0.999997 | 3.845264 |
6d4bfb22-14b2-4773-bd94-f492900f57ec | ishandutta2007/codeforces | ftiasch/normal/24/C.cpp | #include <cstdio>
#include <cstring>
#include <iostream>
using std::cin;
const int N = 100000;
int n, x_0, y_0, x[N], y[N];
long long m;
int solve(int a_0, int* a) {
m %= 2 * n;
for (int i = 0; i < m; ++ i) {
a_0 = 2 * a[i % n] - a_0;
}
return a_0;
}
int main() {
cin >> n >> m >> x_0 >>... | ALGO | 0.999977 | 3.912231 |
07399e7f-5c9f-4eb8-a541-d29b632e282d | mschoenebeck/zeos-merkle-tree-updater | u.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include <map>
#include <cstring>
#include <sinsemilla_s.h>
typedef __int128 int128_t;
typedef unsigned __int128 uint128_t;
// helper from zeos-bellman/inc/groth16/bls12_381/util.hpp needed by Scalar
// also used for halo2 fp operations
/// C... | ALGO | 0.994132 | 5.404891 |
884b03df-78f2-436c-aed7-fcaad25e0d8e | nabobery/PROJECT-MADS | LeetCode/2101 - 2200/2185.cpp | // 2185. Counting Words With a Given Prefix
// Solution 1: Bruteforce and Straight forward
// Time complexity: O(n)
// Space complexity: O(n)
class Solution {
public:
int prefixCount(vector<string>& words, string pref) {
int res = 0, n= pref.size();
for(string& word : words)
if(word.siz... | ALGO | 0.999909 | 6.682324 |
85e1dfa5-e174-41f4-9bf0-27d9a54353ad | TheFiftGuy/Rollback-Networking-Shooter | ThirdParty/bullet3/src/BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.cpp | #include "btMinkowskiPenetrationDepthSolver.h"
#include "BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h"
#include "BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h"
#include "BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h"
#include "BulletCollision/CollisionShapes/btConvexShape.h"
... | ALGO | 0.999648 | 6.201314 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.