uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
1d8a28d0-e0eb-4f64-9ba3-c83595078e99 | johnduffymsc/msc_phas0100assignment2 | Code/3rdParty/Eigen-3.2.2.1/unsupported/doc/examples/FFT.cpp | // To use the simple FFT implementation
// g++ -o demofft -I.. -Wall -O3 FFT.cpp
// To use the FFTW implementation
// g++ -o demofft -I.. -DUSE_FFTW -Wall -O3 FFT.cpp -lfftw3 -lfftw3f -lfftw3l
#ifdef USE_FFTW
#include <fftw3.h>
#endif
#include <vector>
#include <complex>
#include <algorithm>
#include <iterator>... | ALGO | 0.991383 | 6.121914 |
0889cb53-2f4d-495a-9532-b7fdf645783b | rubengm11/ie0217 | Trabajos_previos/trabajo_previo_3/sesion_1/STL_algoritmos.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
bool myfunction (int i, int j) { return (i<j); }
struct myclass{
bool operator() (int i, int j) {return (i<j);}
} myobject;
int main(){
int myints[]={32, 71, 12, 45, 26, 80, 53, 33};
vector<int> myvector(myints, myints+8);
... | ALGO | 0.998791 | 4.300107 |
c0f5da0a-2469-47a7-bf6f-182bba59666a | shreyansh2000rawat/Datastructure-and-Algorithm | Recursion/ Digital Root_gfg/main.cpp | #include <iostream>
using namespace std;
int sumofdigit(int n,int s)
{
if(n==0)
{
if(s/10==0)
{
return s;
}
else
{
n=s;
s=0;
return sumofdigit(n,s);
}
}
s=s+n%10;
return (sumofdigit(n/10,s));
}
int main()
{
in... | ALGO | 0.999831 | 4.67793 |
e3b9504f-7429-46e1-9f04-faa583bde6c9 | ishtiak-billah-emon/Contest-practice | 875 Div2/A.cpp |
#include <bits/stdc++.h>
using namespace std;
#define lln long long int
#define ld long double
#define ll long long
#define endl "\n";
#define sc(n) scanf("%d",&n);
#define scl(n) scanf("%lld",&n);
#define scd(n) scanf("%lf",&n);
#define pf(res) printf("%d\n",res);
#define pfl(res) printf("%lld\n",res);
#define pfd(r... | ALGO | 0.999859 | 4.093659 |
f5853228-2f1b-4007-9bf9-200644b4f0eb | ishandutta2007/codeforces | bicsi/normal/578/C.cpp | #include<bits/stdc++.h>
using namespace std;
int V[500000];
int n;
double check(double x, bool output = 0) {
double s1 = 0, s2 = 0;
double best1 = 0, best2 = 0;
for(int i=1; i<=n; i++) {
s1 += double(V[i]) - x;
s2 += double(V[i]) - x;
if(s1 < 0) s1 = 0;
if(s2 > 0) s2 = 0;... | ALGO | 0.99997 | 4.005469 |
c008a22a-8bd5-4909-aec0-c347350b1143 | kantv-ai/kantv | core/ncnn/ncnn-src/src/layer/arm/rnn_arm_vfpv4.cpp | #include "cpu.h"
#include "mat.h"
#include "layer.h"
#include "arm_activation.h"
#include "arm_usability.h"
namespace ncnn {
#include "rnn_int8.h"
void rnn_int8_gate_output_vfpv4(const Mat& gates, Mat& hidden_state, Mat& top_blob, int ti, int elemtype, const Option& opt)
{
rnn_int8_gate_output(gates, hidden_stat... | DATA | 0.964062 | 5.897672 |
1a34e84e-bb23-4676-8da8-4caced792a31 | VidyaBipin/CPPrograms-cpp-c | GFG/anagram.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
public:
bool isAnagram(string a, string b)
{
sort(a.begin(), a.end());
sort(b.begin(), b.end());
if (a == b)
{
return true;
}
return false;
}
};
int main()
{
int t;
cin >> t... | ALGO | 0.999968 | 6.307759 |
69eb8208-0d3f-4bb7-8408-ad3eeacef495 | youlive789/AlgorithmStudy | BackJoon/string/5789.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
int caseCount;
cin >> caseCount;
while (caseCount--) {
string target;
cin >> target;
int compare1 = (target.size() / 2);
int compare2 = compare1 - 1;
if (target[compare1] == target... | ALGO | 0.999806 | 5.610285 |
ed1bb543-38e8-43f2-82f5-284f0d419167 | gem5-X/ALPINE | gem5-X-ALPINE/src/systemc/tests/systemc/misc/cae_test/general/control/loop/while_fsm/while_fsm.cpp | /*****************************************************************************
while_fsm.cpp --
Original Author: Rocco Jonack, Synopsys, Inc., 1999-07-29
*****************************************************************************/
/****************************************************************************... | ALGO | 0.984179 | 3.464247 |
8c6f0371-6839-44d3-8091-d9ba88e851b7 | Alaxe/noi2-ranking | 2020/solutions/A/SNB-Shumen/SNB/sort.cpp | #include<iostream>
#include<stack>
#include<algorithm>
#include<cmath>
using namespace std;
int const maxn=100005;
int const inf=999999999;
int n;
int a[maxn];
int b[maxn];
stack<pair<int,int> >st;
int ans;
void sort_1()
{
int i,tmax=b[0];
pair<int,int>p;
p.first=p.second=0;
for(i=1;i<n;i++)
{
... | ALGO | 0.999989 | 3.86482 |
ec1c65b0-c4df-4add-af3e-d23c020dd802 | suryyanshomar44/crack-your-placement | DayWise/Day7/Add Two Numbers II.cpp | //https://leetcode.com/problems/add-two-numbers-ii/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
... | ALGO | 0.999948 | 6.066329 |
4984d107-ef7f-4e04-8bc1-835240fd9420 | Hieu0112/Code-basic | Khaibaolop/1Khaibaolopphanso.cpp | #include<bits/stdc++.h>
using namespace std;
class PhanSo{
public:
long long tu,mau;
PhanSo(long long tu,long long mau)
{
this->tu=tu;
this->mau=mau;
}
void rutgon()
{
long long x=__gcd(tu,mau);
tu/=x;
mau/=x;
}
friend istream &operator>>(istream &is,PhanSo &p)
{
is>>p.tu>>p.ma... | ALGO | 0.993294 | 4.809339 |
7694b662-e985-40cb-b3bc-802853eec56e | sahadat-11/Atcoder | abc/45/C.cpp | //In The Name of ALLAH
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
string s; cin >> s;
int n = s.size();
int ans = 0;
int sub_cnt = (1ll << (n - 1));
for(int mask = 0; mask < sub_cnt; mask++) {
int sum = 0, now = 0;
for... | ALGO | 0.999843 | 4.500858 |
dafa740d-d0da-4f85-8d6c-15d09281de28 | amityadav23112000/leetcode-solution | 2385-amount-of-time-for-binary-tree-to-be-infected/2385-amount-of-time-for-binary-tree-to-be-infected.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.999986 | 6.004342 |
9fc82e1e-5820-4c58-8864-ae4698581cf7 | thegamer1907/Code_Analysis | contest/1542589382.cpp | #include <bits/stdc++.h>
#define N 100020
#define ll long long
using namespace std;
inline int read(){
int x=0,f=1;char ch=getchar();
while(ch>'9'||ch<'0')ch=='-'&&(f=0)||(ch=getchar());
while(ch<='9'&&ch>='0')x=(x<<3)+(x<<1)+ch-'0',ch=getchar();
return f?x:-x;
}
char ch[5];
char str[5];
int main(int ar... | ALGO | 0.999963 | 3.558164 |
8e51d686-fce0-4e07-9700-d76c1489a44c | P1aster/AiZO_1 | tests/testSorting.cpp | #include <chrono>
#include <iostream>
#include "testSorting.h"
#include "../sort_algorithms/bubbleSort.h"
#include "../sort_method/sortHandler.h"
#include "../sort_algorithms/quickSort.h"
#include "../sort_algorithms/insertionSort.h"
#include "../sort_algorithms/mergeSort.h"
#include "../sort_algorithms/heapSort.h"
#in... | TEST | 0.940667 | 6.239058 |
31572bab-1a62-4b14-8c2b-3400de3850d9 | DS-yash29/CodeCrunch-DSA_Edition | Stacks/SortStack.cpp | #include<bits/stdc++.h>
using namespace std;
/*
Sort a Given Stack Using Recursion.
Without any Auxiliary Space.
*/
void printStack(stack<int> s){
if(s.empty()) cout<<"No Data To Print\n";
else{
while(!s.empty()){
cout<<s.top()<<" ";
s.pop();
}
cout<<e... | ALGO | 0.999932 | 5.253621 |
894861d2-5c48-4bbf-b87d-4596a3d76c17 | dbekinalkar/leetcode | cpp/703.kth-largest-element-in-a-stream.cpp | /*
* @lc app=leetcode id=703 lang=cpp
*
* [703] Kth Largest Element in a Stream
*/
// @lc code=start
class KthLargest {
public:
KthLargest(int k, vector<int>& nums) : k_(k) {
for(int num : nums) {
pq_.push(num);
if(pq_.size() > k_) {
pq_.pop();
}
... | ALGO | 0.999696 | 6.16521 |
b27514ef-97ab-45fb-a6f7-249b23c6aebd | miffyKing/acmicpc_git | boj_study/cpp_code/boj_13414.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
#include <algorithm>
using namespace std;
int main()
{
int n,m;
string tmp;
unordered_map <string, int> list;
cin>>n>>m;
for(int i = 0; i<m; i++)
{
cin>>tmp;
if(list.find(tmp) != list.end()) //찾은 경우
{
... | ALGO | 0.999972 | 3.72925 |
e72913bd-09b3-4994-9b6d-0471a7415533 | AhmedElsheekh/Array-Implementation | main.cpp | #include <iostream>
using namespace std;
//1- Static Array
// no enlarge or merge in static array
const int siz = 100;
class ArrayStatic
{
private:
int length;
int items[siz];
public:
ArrayStatic()
{
length = 0;
}
void filling() //time O(n) memory O(n)
{
cout << "ent... | ALGO | 0.996542 | 3.881062 |
eee1c972-5e09-495a-902d-7b9d14197417 | twistedmove/CS106B-1 | cs106b-hw4-boggle-starter-files/Boggle/src/Boggle.cpp | #include "Boggle.h"
#include "shuffle.h"
#include "random.h"
#include "foreach.h"
#include "bogglegui.h"
#include "strlib.h"
#include <algorithm>
#include <cstring>
using namespace std;
using namespace BoggleGUI;
// letters on all 6 sides of every cube
static string CUBES[16] = {
"AAEEGN", "ABBJOO", "ACHOPS", "AF... | ALGO | 0.95167 | 5.095773 |
e2d2a376-96b6-4a26-b2d1-97b38c15e0d1 | pnookala/X-OpenMP | llvm/lib/Transforms/Utils/BypassSlowDivision.cpp | #include "llvm/Transforms/Utils/BypassSlowDivision.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/None.h"
#include "llvm/ADT/Optional.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Transforms/Utils/Local.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/BasicBlock.... | ALGO | 0.978747 | 7.926867 |
b7e5dfb9-6320-4cb5-a56f-d4a4de43d9b9 | raincross7/code-similarity | codes/train_code/problem110/problem110_109.cpp | #include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); i++)
#define REP(i,j,n) for(int i = j;i < (n);i++)
#define intput(i) cout << i << endl
#define ll long long
#define stringput(s) cout << (string)(s) << endl
int main(){
ll N, M, K;
cin >> N >> M >> K;
string ans = "No";
rep(... | ALGO | 0.999981 | 3.626821 |
394a2771-87ee-40d2-8c0d-a22561857d86 | alexandraback/datacollection | solutions_1483485_0/C++/zz1215/A.cpp | #include<iostream>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<queue>
#include<stack>
#include<string>
#include<map>
#include<set>
#include<cmath>
#include<cassert>
#include<cstring>
#include<iomanip>
using namespace std;
#ifdef _WIN32
#define i64 __int64
#define out64 "%I64d\n"
#define in64 "%I64d"... | ALGO | 0.999769 | 3.558394 |
13359e34-f6c9-488c-8b7a-ad2367cd42c4 | Hiyabye/Baekjoon | 16xxx/16674.cpp | #include <iostream>
using namespace std;
bool one(int n) {
while (n) {
int x = n % 10;
if (x != 2 && x != 0 && x != 1 && x != 8) return false;
n /= 10;
}
return true;
}
bool two(int n) {
bool a = false, b = false, c = false, d = false;
while (n) {
int x = n % 10;
if (x == 2) a = true;
... | ALGO | 0.999561 | 4.173919 |
587d569a-52c3-4786-b7cf-ea830a360820 | Arup-Deb/60Days-POTD-Challenge | 64 M-Coloring Problem.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
// Function to determine if graph can be coloured with at most M colours such
// that no two adjacent vertices of graph are coloured with same colour.
bool isSafe(int node, int color[], bool... | ALGO | 0.99982 | 6.023615 |
04540ef2-d34a-4fd7-bb61-45cdb0fbc7b1 | ExtraTea/Atcoder | Tessoku/a02.cpp | #include <bits/stdc++.h>
using namespace std;
int main(void){
int n, x;
cin >>n >>x;
vector<int> a(n);
for(int i=0; i<n; i++){
cin >>a.at(i);
}
string count = "No";
for(int i=0; i<n; i++){
if(int(a.at(i)) == int(x)) count = "Yes";
// cout <<a.at(i) <<" " <<x <<endl;
... | ALGO | 0.999979 | 3.98781 |
5600bb1a-a895-48a6-9de2-f304fb6ee4fa | astrid-dm/Algorithms | Baekjoon/BJ_C++_2178.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
int n = 0, m = 0, ty = 0, tx = 0, ny = 0, nx = 0;
int arr[101][101], my[4] = {1,0,-1,0}, mx[4] = {0,1,0,-1};
int ch[101][101];
bool track(int y, int x){
if(y<1||y>n||x<1||x>m||arr[y][x]==0||ch[y][x]>0) return false;
... | ALGO | 0.999887 | 3.823919 |
9908f506-cb08-45fc-ba15-8bd05047c497 | cropsinsilico/ePhotosynthesis_C | src/MB/EPS_MB.cpp | #include "Variables.hpp"
#include "modules/EPS.hpp"
#include "modules/FIBF.hpp"
#include "modules/CM.hpp"
#include "modules/BF.hpp"
// This model includes the mass balance equations for the full model of the light reactions.
using namespace ePhotosynthesis;
using namespace ePhotosynthesis::modules;
using namespace eP... | ALGO | 0.930796 | 3.963709 |
7e1c0a29-433a-495a-9dbf-0f7ad4854903 | sidjha57/Competitive | C++/Codechef/Sieve_of_Eratosthenes.cpp | //template
#include <iostream>
#include <string>
#include <set>
#include <list>
#include <map>
#include <unordered_map>
#include <stack>
#include <queue>
#include <deque>
#include <vector>
#include <utility>
#include <iomanip>
#include <sstream>
#include <bitset>
#include <cstdlib>
#include <iterator>
#include <algorit... | ALGO | 0.999731 | 4.261867 |
aecb403c-f7ba-4be3-8813-02d1c09f9126 | Alex-Beng/ojs | FuckDataStructure/CpSkill/T004单链表的归并.cpp | #include <iostream>
using namespace std;
template<class T>
struct LinkNode {
T data;
LinkNode<T>* next;
LinkNode() {
next = NULL;
}
};
template<class T>
class SingleList {
protected:
LinkNode<T>* head;
int len;
public:
SingleList();
~SingleList();
void PushBack(T x);
T... | ALGO | 0.999772 | 3.437445 |
4927755a-059b-4e3e-9b61-b9f2ff3cd1b3 | nzsakib/uva-problems | 11586.cpp | #include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int test, male, female;
char track[200];
cin >> test;
getchar();
while( test-- )
{
male = female = 0;
cin.getline(track, 200);
for(int i=0; track[i] != '\0'; i++)
if( track[i] == 'M' )
male++;
else if( track[i] == 'F' )... | ALGO | 0.99987 | 3.372316 |
8d016cfb-3e13-4403-8646-cbee3cd0b1dd | DISASTER-RUMBLING/CODE | 算法/Leetcode/Leetcode 2379. 得到 K 个黑块的最少涂色次数.cpp | #define _CRT_SECURE_NO_WARNINGS
#include<string>
using namespace std;
class Solution {
public:
int minimumRecolors(string blocks, int k) {
int res = 100, ans = 0, times = 0, l = 0;
for (int i = 0; i < blocks.size(); i++) {
if (ans == k) {
res = min(times, res);
... | ALGO | 0.999694 | 4.793594 |
bf751e14-e0e0-425b-96d4-a9545856f8c8 | moonsong98/AlgorithmPractice | codeforces/edu127/a.cpp | #include<bits/stdc++.h>
#define sz(x) (int)x.size()
using namespace std;
int main(void) {
cin.tie(nullptr)->sync_with_stdio(false);
int t; cin >> t;
while(t--) {
string str;
cin >> str;
int cnt=1;
char ch=str[0];
for(int i=1; i<sz(str); ++i) {
if(ch!=str[i]) {
if(cnt==1) break;
cnt=1;
ch=st... | ALGO | 0.99981 | 4.750314 |
3dda17bb-4118-47b0-b6c3-84944ae33fec | xarmison/raytracing | tests/mc_integration.cpp | #include "../include/utility.h"
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
inline double pdf(const vec3& p) {
return 1 / (4 * pi);
}
int main() {
int N = 1000000;
double sum = 0.0;
// Approximating the integral int cos^2 (theta)
for (int i = 0; i < N; i++) {
... | ALGO | 0.992886 | 3.832936 |
8d1e2ffd-4af2-49fd-96af-eaa1c065edf9 | kamal-singh819/LeetCodeLeetHub | Make Palindrome - GFG/make-palindrome.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution{
public:
bool makePalindrome(int n, vector<string> &arr){
unordered_set<string> st;
for(auto x : arr){
string str = x;
... | ALGO | 0.999857 | 6.176571 |
b043d6e0-6e8b-4a83-8394-76092ffc9a95 | alexpizarroj/competitive-programming | src/leetcode/contests/weekly-51/C.cpp | #include <iostream>
#include <vector>
#include <map>
using namespace std;
class Solution {
public:
vector<int> findRedundantConnection(vector<vector<int>>& edges) {
nNodes = edges.size();
vector<vector<int>> originalInput = edges;
map<int, int> mapFromOriginalToNew;
for (int i = 0; i < nNodes; +... | ALGO | 0.999921 | 5.566988 |
eb1dbe13-d887-4749-93dd-c0dc1ad42a1e | mdyamin99/CSE-Fundamentals-with-Phitron | Algorithm/Module-12/edge_to_adj_list.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,e;
cin>>n>>e;
vector<pair<int,int>> v[n];
while(e--)
{
int a,b,c;
cin>>a>>b>>c;
v[a].push_back({b,c});
}
for(int i=0;i<n;i++)
{
cout<<i<<" -> ";
for(pair<int,int> child:v[i])
... | ALGO | 0.999617 | 3.622096 |
c54996c1-c94e-432d-a7f9-a3fb31aecafd | cesarkawakami/cryptopals | prim.cpp | #include "prim.h"
#include "ByteStr.h"
#include "aes.h"
#include "modes.h"
#include "range/v3/algorithm/any_of.hpp"
#include "range/v3/algorithm/copy.hpp"
#include "range/v3/view/chunk.hpp"
#include "range/v3/view/repeat_n.hpp"
#include "range/v3/view/reverse.hpp"
#include "utils.h"
#include <iterator>
#include <rijnda... | TOOL | 0.966809 | 7.778358 |
d0c9ee55-b128-411e-be66-049c86a0cb5b | TrinhDuongHoan/CSES_solution | Sorting and Searching/Collecting_Numbers.cpp | #include <bits/stdc++.h>
#define int long long
#define all(a) a.begin(),a.end()
#define el '\n'
#define inf 0x3f3f3f3f3f3f3f3f
#define _Robert_ main
using namespace std;
const int maxn = 1e6+5;
const int mod = 1e9+7;
int n;
int id[maxn];
void Solve() {
cin >> n;
for(int i = 1,x; i <= n; ++i){
cin ... | ALGO | 0.999683 | 4.3407 |
a30b9326-d195-4fd6-bbbf-34a5a76f9ccd | Pingan-Li/leetcode | solutions/delete_node2.cpp | /**
* @file delete_node2.cpp
* @author lipingan (<EMAIL>)
* @brief
* @version 0.1
* @date 2022-01-11
*
* @copyright Copyright (c) 2022
*
*/
#include "solutions/delete_node2.h"
namespace leetcode {
ListNode *DeleteNode2(ListNode *head, int val) {
ListNode *prev = nullptr;
ListNode *curr = head;
while (... | ALGO | 0.999929 | 6.083257 |
a34fa7e8-5b71-48d8-9315-a11ce58406cb | programmer-k/Baekjoon-Online-Judge-Submission | 5520.cpp | #include <iostream>
#include <vector>
using namespace std;
bool answerExist;
int arr[3][3], moveCnt[9];
vector<int> currentAnswer, candidate;
void GetInput()
{
for (int i = 0; i < 3; i++)
for (int j = 0; j < 3; j++)
cin >> arr[i][j];
}
void MoveClock(int i, int j)
{
(arr[i][j] == 3) ? arr[i][j] = 0 : arr[i][j... | ALGO | 0.999946 | 4.029702 |
7f2655f0-331b-4648-a69a-c3120c1b01f6 | HrishiPol10/SD | assignment5.cpp | #include<iostream>
using namespace std;
int minimum(int *v,int *d, int n)
{
int index;
int min=9999;
for(int i=0;i<n;i++)
{
if(d[i]<min && v[i]==0)
{
min= d[i];
index=i;
}
}
return index;
}
int main()
{
int n_v,n_e,u,v,value;
cout<<"enter the no of CITIES and no of PA... | ALGO | 0.999913 | 3.506596 |
bfe0616b-ceb8-4af3-8986-517e5c72db3c | deshabhakt/Sem-I | DSA (MA722)/DSA Programs/Assignment 1/Q4-1_Singly_linked_List.cpp | // Singly Linked List Execution and its operations
// Roll No. 202cd005
#include <iostream>
#include <stdlib.h>
#include <limits>
using namespace std;
template <class T>
class Node
{
public:
int key;
T data;
Node<T> *next;
Node()
{
key = 0;
data = 0;
next = NULL;
}
... | ALGO | 0.999368 | 5.926118 |
8a26ad7b-8136-451c-8de8-aa2afebf5113 | Djokovic0311/LeetCode | problems/shortest_word_distance/solution.cpp | class Solution {
public:
int shortestDistance(vector<string>& wordsDict, string word1, string word2) {
int n = wordsDict.size();
int w1=-1, w2=-1, min_dist = INT_MAX;
for(int i=0;i<n; i++){
if(wordsDict[i] == word1) w1 = i;
else if (wordsDict[i] == word2) w2 = i;
... | ALGO | 0.999964 | 5.96154 |
961efe63-3194-4659-ae1e-422f7b5e4ab7 | Advait2211/cp_dsa | stryvers/basics/bubble_sort.cpp | class Solution {
public:
vector<int> sortArray(vector<int>& nums) {
// bubble sort
for(int i = 0; i < nums.size(); i++){
auto swapped = "False";
for(int j = 0; j < nums.size() - i - 1; j++){
if (nums[j] > nums[j+1]){
swap(nums[j], nums[j+1]... | ALGO | 0.999969 | 5.515219 |
c268a4a6-5d04-44f2-9266-7e8a85b14a05 | ankitpnwr/Placement_Class | Day _13/Q3.powerOfTwo.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
bool isPowerOfTwo(int n) {
if(n<=0) return false;
return ((n&(n-1)) == 0);
}
}; | ALGO | 0.998099 | 5.345187 |
7980dd6a-ac3e-4baa-99ce-4f59c0977123 | Akhilesh286/cpp | project4/solutions/p8.cpp | #include <iostream>
using namespace std;
int main() {
int n1, n2;
cout << "Enter the number of elements in the first array: ";
cin >> n1;
int arr1[n1];
cout << "Enter the elements of the first array: ";
for (int i = 0; i < n1; i++) {
cin >> arr1[i];
}
cout << "Enter the number... | ALGO | 0.999337 | 5.020412 |
211620e8-2055-439a-a499-0317f5c748ac | MrHDMai/Cpp_Deep_Dive | Algorithms/mergesort.cpp | #include<iostream>
#include<vector>
using namespace std;
void sort(vector<int>& v, int left, int mid, int right){
int n1 = mid - left + 1;
int n2 = right - mid;
vector<int>l(n1),r(n2);
for(int i = 0; i < n1; i++)
l[i] = v[left + 1];
for(int j = 0; j < n2; j++)
r[j] = v[mid + 1 + j]... | ALGO | 0.999996 | 4.586511 |
82b11ff2-b2ec-417b-a367-bc6f94e3606f | borcakalem/data_structures | main.cpp | //
// Created by aldin on 28/05/2025.
//
#include "../include/Entry.h"
#include "../include/FileUtils.h"
#include "../include/Operations.h"
#include <iostream>
#include <string>
#define NUM_ENTRIES 1000000
#define UNSORTED_FILE "phonebook_unsorted.csv"
#define SORTED_FILE "phonebook_sorted.csv"
int main() {
// R... | TOOL | 0.908717 | 5.324019 |
f60507fe-10a4-429a-9471-2048286b2998 | KacperSkelnik/Komputerowa_Analiza_Danych_Doswiadczalnych | lab3/macro.cpp | /*
KADD lab3
Kacper Skelnik
*/
#include <iostream>
#include <TMath.h>
#include <TStyle.h>
#include <TCanvas.h>
#include <TF2.h>
#include <TF12.h>
using namespace std;
Double_t sigma_x = 0.5;
Double_t sigma_y = 1;
Double_t c1;
TF2 *fun;
double dx1 = 0.1;
double dx2 = 0.2;
Double_t myFunc(double *x, double *par){
... | ALGO | 0.99882 | 4.384429 |
7fe44404-b674-43c1-b598-c5d28e9af9e6 | goru00/prog_homework | prog_c++/insortSort.cpp | void insortSort(int mass[], int length)
{
int i, key = 0;
for (int j = 0; j < length; j++)
{
key = mass[j];
for (i = j - 1; i >= 0; i--)
{
if (mass[i] < key)
{
mass[i + 1] = mass[i];
}
else {
mass[i] = ke... | ALGO | 0.998026 | 4.637873 |
868d56c6-d600-4a78-bd33-e60e2cf3789e | Ryb7532/AtCoder | submissions/abc264/b.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define rep(i,n) for (int i=0; i<(n); i++)
#define rrep(i,n) for (int i=n-1; i>=0; i--)
#define print(a) cout << a << endl
#define fix(n) fixed << setprecision(n)
#define fill_c(c, n) setfill(c) << setw(n)
#define all(v) v.begin... | ALGO | 0.999666 | 3.67713 |
3ae13a3d-8d67-46a2-a7c8-8d6c9115321b | sa-y-an/leetAction | solutions/problems/most_frequent_subtree_sum/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.046301 |
cb8840eb-13a1-4e06-9d7d-6c118c3e83f5 | azwreith/ICT-2113 | L9Q1.cpp | #include <iostream>
#include <conio.h>
using namespace std;
class node {
node *next;
int coeff, power;
public:
node() {
coeff = power = 0;
next = this;
}
node* insert(node*, int, int);
void display(node*);
node* add(node*, node*, node*);
node* mult(node*, node*, node*);
};
node* node::insert... | ALGO | 0.999318 | 3.722702 |
983178a7-5b57-42eb-8adf-255c053a6e65 | OYousryB/Codeforces | 129A - Cookies/Cookies.cpp | #include <iostream>
using namespace std;
int main()
{
int n, a, odd(0), even(0);
cin >> n;
while (n--)
{
cin >> a;
if (a % 2 == 0)
{
even += 1;
}
else
{
odd += 1;
}
}
cout << (odd % 2 == 1 ? odd : even) << endl;
... | ALGO | 0.999849 | 4.358517 |
c4fcb111-be73-4478-a110-eae7af807ad2 | h3136514/Algorithm | baekjoon/브루트포스/1476.cpp | #include <iostream>
using namespace std;
int E, S, M, a, b, c, CNT;
// 날짜 계산
int main(){
cin >> a >> b >> c;
while(true){
CNT++;
E++;
S++;
M++;
if(E >= 16)
E = 1;
if(S >= 29)
S = 1;
if(M >= 20)
M = 1;
... | ALGO | 0.999591 | 3.367406 |
787d7fc0-56fc-4dd2-9500-d3cf3df52216 | jyotirmoy1997/Data-Structures-Files | Dynamic Programming/DistinctSubsequencesMemoization.cpp | #include<bits/stdc++.h>
using namespace std;
int func(int i, int j, string &s1, string &s2, vector<vector<int>> &dp){
if(j < 0)
return 1;
if(i < 0)
return 0;
if(dp[i][j] != -1)
return dp[i][j];
if(s1[i] == s2[j])
return dp[i][j] = func(i-1, j-1, s1, s2, dp) + func(i-1,... | ALGO | 0.999976 | 5.219349 |
c653d59d-a4c9-4dce-ac70-aeaafdbaecbc | 192210074ss/Cryptography-and-network- | program 6.cpp | #include <stdio.h>
int main() {
// Known mappings
int cipher_B = 1; // 'B' in the cipher
int plain_E = 4; // 'E' in plaintext
int cipher_U = 20; // 'U' in the cipher
int plain_T = 19; // 'T' in plaintext
// Calculate 'a' and 'b'
int a, b;
// Solving for 'a'
for (a = 1; a... | ALGO | 0.999965 | 3.061219 |
f7c7321e-05ec-4e15-b4c7-d63d665b2922 | kingarthur11/leetcode | solution/0300-0399/0357.Count Numbers with Unique Digits/Solution.cpp | class Solution {
public:
int countNumbersWithUniqueDigits(int n) {
if (n == 0) return 1;
if (n == 1) return 10;
int ans = 10;
for (int i = 0, cur = 9; i < n - 1; ++i) {
cur *= (9 - i);
ans += cur;
}
return ans;
}
}; | ALGO | 0.999911 | 7.229005 |
be43dd32-3c66-4b5f-bdfe-cf7eb930783c | SUKANT007/DSA | DP/Shortest_common_Subsequence.cpp | #include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
#define boost ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); // remove for interactive
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef long long ll;... | ALGO | 0.999954 | 3.238359 |
8e28e855-e484-45eb-8e2b-f26732c88476 | Akhiljai111/Data-Structure | DataStructures/queue-using-two-stacks.cpp | #include <iostream>
#include <stack>
using namespace std;
class Queue
{
stack<int> s1, s2;
public:
// This algorithm makes the push operation costly: O(n)
void push(int num)
{
while (!s1.empty())
{
s2.push(s1.top());
s1.pop();
}
s1.push(num);
... | ALGO | 0.996478 | 4.997095 |
fa6dcad3-68ca-416a-a1c9-61e75d1484d6 | triSYCL/sycl | libcxx/src/filesystem/directory_iterator.cpp | #include <__assert>
#include <__config>
#include <errno.h>
#include <filesystem>
#include <stack>
#include "filesystem_common.h"
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
using detail::ErrorHandler;
#if defined(_LIBCPP_WIN32API)
class __dir_stream {
public:
__dir_stream() = delete;
__dir_stream& operator=(const __dir_... | TOOL | 0.874042 | 7.641819 |
1711fe8e-e1cc-4756-84d8-66dbc9b44335 | ariel1031/codetree-TILs | 240925/변수 값 교체하기 3/replacing-variable-values-3.cpp | #include <iostream>
using namespace std;
int main() {
int a = 3, b = 5;
int temp;
temp = a;
a = b;
b = temp;
cout << a << endl;
cout << b;
return 0;
} | ALGO | 0.996921 | 3.230452 |
8e928965-d7bd-4b35-a0af-7fecacd70df4 | raincross7/code-similarity | codes/train_code/problem301/problem301_127.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int N;
cin>>N;
deque<int>W;
for (int i = 0; i < N; i++)
{
int w;
cin>>w;
W.push_back(w);
}
int front=W.front();
W.pop_front();
auto T=abs(front-(accumulate(W.begin(),W.end(),0)));
for (int i = 1;... | ALGO | 0.999985 | 4.025901 |
016279ef-8bcf-4fcc-95ed-0d6ae6968a43 | maaaaaaaaad/bbbb | .ccls-cache/@home@runner@ssssssss/best_set.cpp | #include <string>
#include <vector>
using namespace std;
vector<int> solution(int n, int s) {
vector<int> answer;
if (n > s) {
answer.emplace_back(-1);
return answer;
}
int quo = s / n;
int rem = s % n;
int num = 0;
if (s % n != 0)
num = 1;
for (int i = 0; i < n; i++)
if (i >= n - re... | ALGO | 0.999629 | 3.87355 |
78441f29-8419-44dc-9037-c4fc41df8d5c | anchigel/SR | src/MazeRouter.cpp | #include "MazeRouter.h"
#include "oaDesignDB.h"
#include "Definitions.h"
#include "ClosestPairIndices.h"
#include <iostream>
using namespace oa;
using namespace std;
MazeRouter::MazeRouter()
{
__keepoutRadius_lateral_dbu = 0;
__keepoutRadius_lateral = 0;
__keepoutRadius_longitudinal_dbu = 0;
__keepout... | ALGO | 0.995643 | 5.847097 |
9ae28727-dc94-48fc-94ce-b708d5b4e693 | Lucas04-nhr/ProgrammingHomework | 06-期中模拟1/760/760.cpp |
/*-------------------------------------------------------
【程序设计】
---------------------------------------------------------
题目:
求Y=1-1/2+1/3-1/4+…+1/n
输出结果见图:样张.JPG
要求与输出样张一样才能得到满分。
-------------------------------------------------------*/
#include <iostream>
using namespace std;
int main( )
{
/**********Program**... | ALGO | 0.999888 | 3.484236 |
a807c3e9-3e08-4f9a-924c-de24ab37bb7b | brunsky/WS171-frameworks-base | tools/localize/file_utils.cpp | #include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include "file_utils.h"
#include "Perforce.h"
#include <sys/fcntl.h>
#include <sys/stat.h>
#include <errno.h>
#include <host/Directories.h>
#include "log.h"
string
translated_file_name(const string& file, const string& locale)
{
const char* str = file.c_s... | TOOL | 0.867966 | 5.801321 |
f8ec98cb-419a-4572-b5d7-311f569c73a0 | Altudy/Solution-Chanwoo | AtCoder_Beginner157/A_Duplex Printing.cpp | /* #lev1 */
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <deque>
#include <map>
#include <iomanip>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstdint>
#include <cstring>
//#pragma warning(disable:4996)
using namesp... | ALGO | 0.999345 | 3.484518 |
51b52e43-5b1a-4704-a842-ba78da14eb72 | daleroberts/heston-qmc | barrier.cpp | //
// Dale Roberts <<EMAIL>>
//
#include <iostream>
#include <iomanip>
#include <vector>
#include <boost/random.hpp>
#include <boost/math/distributions/non_central_chi_squared.hpp>
#include <boost/math/distributions/normal.hpp>
#include <ql/quantlib.hpp>
#include "euro.h"
#include "exact.h"
#include "sobolpoints.h"
#i... | ALGO | 0.998652 | 4.836565 |
5b1e5ed7-dd6c-41a2-b3f8-7f61b4e27833 | luowanqian/LeetCode | 301-400/387_FirstUniqueCharacterInAString/solution2.cpp | #include <iostream>
#include <string>
#include <vector>
using namespace std;
class Solution {
public:
int firstUniqChar(string s) {
int res = s.size();
vector<int> idxes(26, -1), counts(26, 0);
for (int i=0; i<s.size(); i++) {
int num = s[i] - 'a';
counts[num]++;
... | ALGO | 0.999754 | 5.386703 |
b98ed993-73d6-4c5a-aceb-18856a2ea7b8 | tasninanika/Codeforces_Problems-1000 | Ski Resort/skiResort.cpp | #include<iostream>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
int n, k, q;
cin >> n >> k >> q;
int t[n];
int d = 0;
long long ans = 0;
for(int i = 0; i < n; i++){
cin >> t[i];
if(t[i] <= q){
d++;
... | ALGO | 0.9998 | 3.47995 |
bccf6873-4a4d-42d8-8949-40eb14a39a9e | ishandutta2007/codeforces | invusr/normal/810/A.cpp | #include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <cmath>
using namespace std;
inline int getint()
{
static char c;
while ((c = getchar()) < '0' || c > '9');
int res = c - '0';
while ((c = getchar()) >= '0' && c <= '9')
res = res * 10 + c - '0';
return res;
}
int n, k, sum... | ALGO | 0.999657 | 3.182571 |
3340be89-d007-44df-99cf-e16e08638f49 | tixidi/ros_stent_graft | iiwa_vs_core/src/iiwaControl/iiwa/Eigen-3.3.3/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.990372 | 3.576145 |
21a819cf-86fe-4380-8773-60ced94ca07d | rbunpat/posn-camp1 | 07/bonus.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
char payType;
int payAmount, workAge, bonusAmount;
cin >> payType >> workAge >> payAmount;
payType = toupper(payType);
switch (payType) {
case 'M':
bonusAmount = 1500;
break;
case 'B':
bonusAmount... | ALGO | 0.986649 | 4.105772 |
5c654c8d-d8cb-4bf3-8712-402180a82a8e | muskan184/DSA_problem | Count Special Quadruplets.cpp | class Solution {
public:
int countQuadruplets(vector<int>& nums) {
int n = nums.size();
int count =0;
for(int i=0;i<n;i++){
for(int j=i+1;j<n;j++){
for(int k=j+1;k<n;k++){
for(int l=k+1;l<n;l++){
int sum=nums[i]+nums[j]... | ALGO | 0.999776 | 5.858483 |
dd31ecee-5ad0-4e3f-a5e2-4e6c7b5bb840 | Parag-Koshti/native_integration_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.9988 | 6.76073 |
27070bed-5729-4f6a-a951-36a048a18dd1 | Akshay2224/Competitive-Programming-23-24 | twoFactors.cpp | #include<iostream>
using namespace std;
int main() {
// Write your code here
int n;
bool twoFactor = false;
cin>>n;
int i=2;
while(i<n)
{
if(n%i==0)
{
cout<<i<<" ";
twoFactor = true;
}
i++;
}
if(!twoFactor)
{
cout<<-1;
}
}
| ALGO | 0.999973 | 4.776075 |
1155889f-f8c5-4602-a390-c34a7b6ec4f0 | zenvite2/DSAA_PTIT | XÂU NHỊ PHÂN TRƯỚC.cpp | /*
Cho xâu nhị phân X[], nhiệm vụ của bạn là hãy đưa ra xâu nhị phân trước của X[]. Ví dụ X[] =”111111” thì xâu nhị phân trước của X[] là “111110”. Với xâu X[] =“000001” thì xâu nhị trước của X[] là “000000”. Chú ý: nếu xâu dữ liệu trong input là xâu đầu tiên thì trước nó sẽ là xâu cuối cùng.
Input:
Dòng đầu tiên đưa... | ALGO | 0.999963 | 5.57568 |
2951cd44-bca8-426a-bba9-4661f97ca722 | hirbu/pbinfo-solutions | distincte1.cpp | #include <iostream>
using namespace std;
int a, b, c;
int main()
{
cin>>a>>b>>c;
if(a==b && a==c) cout<<1;
else if(a==b && a!=c) cout<<2;
else if(b==c && b!=a) cout<<2;
else if(a==c && a!=b) cout<<2;
else if(a!=b && b!=c && a!=c) cout <<3;
return 0;
} | ALGO | 0.999973 | 4.403023 |
85455c98-d3f6-4380-8d09-414bfd5892e5 | Garyyyyyyy/bustub | third_party/murmur3/MurmurHash3.cpp | // This source file was originally from:
// https://github.com/PeterScott/murmur3
//
// We've changed it for use with VoltDB:
// - We changed the top-level functions defined below to return
// their hash by value, rather than accept a pointer to storage
// for the result
// Note - The x86 and x64 versions ... | ALGO | 0.984485 | 7.048966 |
e9e7e7d2-bf3e-48cc-8309-526d36dd2c03 | rmeertens/advent_of_code_2020 | cpp/day01.cpp | #include <iostream>
#include <vector>
#include <fstream>
#include <string>
int main(int argc, const char * argv[]) {
std::vector<int> integers;
std::string line;
std::ifstream myfile("/Users/rmeertens/Dropbox/workspace/adventofcode2020/inputs/day01.txt");
if (myfile.is_open())
{
while ( ... | TOOL | 0.958697 | 3.51453 |
8a95c907-ca9f-4728-bbf1-2743a7b35bce | luobuyu/Code-test-daily | written_test/aliyun/aliyun0324/kmp.cpp | #include <bits/stdc++.h>
#define ll long long
namespace FAST_IO
{
template <class T>
inline void read(T &x)
{
T flag = 1;
x = 0;
char ch = getchar();
while (ch < '0' || ch > '9')
{
if (ch == '-')
flag = -1;
ch = getchar();
... | ALGO | 0.999927 | 3.515422 |
9b865580-d927-400e-aadb-33e653e4cdc5 | andersonmrib/Competitive-Programming | UVA/11713 - Abstract Names.cpp | #include <bits/stdc++.h>
#define speedBoost ios::sync_with_stdio(0); cin.tie(0);
using namespace std;
bool isVowel(char c){
return (c == 'a' || c == 'e' || c == 'i' ||
c == 'o' || c == 'u');
}
int main(){
speedBoost;
int t; cin >> t;
while(t--){
string name, nickname;
cin >> name >> nickna... | ALGO | 0.999983 | 5.457201 |
45390570-6c7d-4694-b64f-0406d488e419 | m4oughi/100DaysofCode | pureCPP/0037. Day 37/Standard Template Library Basics/026. Algorithms - Modifying Algorithms/003. Removing Elements Conditionally with stdremove_if/main.cpp | #include <iostream>
#include <vector>
#include <algorithm>
int main() {
std::vector<int> vec = {1, 2, 3, 4, 5, 6, 7};
auto newEnd = std::remove_if(vec.begin(), vec.end(), [](int x) { return x % 2 == 0; });
std::cout << "After remove_if: ";
for (auto it = vec.begin(); it != newEnd; ++it) {
std... | ALGO | 0.99907 | 5.779626 |
e096b168-5439-4a15-a9bd-4352bae3d03f | LukePhairatt/SDC-PathPlanning-Project1-T3 | src/Eigen-3.3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_rowwise.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXf mat(2,4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
std::cout << "Row's maximum: " << std::endl
<< mat.rowwise().maxCoeff() << std::endl;
}
| ALGO | 0.99932 | 3.881483 |
767f73f3-0efe-4031-b8e9-7316e93885c6 | prashant280920/DSA | Interview_bit/Linked_list/Rotate_List.cpp | #include<bits/stdc++.h>
using namespace std;
class ListNode {
public:
int val;
ListNode* next;
ListNode(int x) : val(x), next(NULL){}
};
void append(ListNode** head_ref, int new_data){
ListNode* new_node = new ListNode(new_data);
ListNode* last_node = *head_ref;
if(last_node == NULL){
... | ALGO | 0.999989 | 3.848283 |
0784fb63-44a2-4ede-a0ce-3400644120d6 | pearlesezobor/Library | lab4/Algorithim.cpp | #include <random>
#include "sorting.h"
using namespace std;
// An optimized version of Bubble Sort
void bubbleSort(std::vector<int> arr, int n)
{
int i, j;
bool swapped;
for (i = 0; i < n - 1; i++) {
swapped = false;
for (j = 0; j < n - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
... | ALGO | 0.999734 | 5.356561 |
6b50828a-1673-4b92-9783-7e7c42cf30a0 | LucaTheOne/CorsoCPP | p81/stl5.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
namespace My_region
{
void minus(int i)
{
cout << "L'opposto di " << i << " e' " << -i << '\n';
}
template <class T> class Sum
{
T res;
public:
Sum() : res(T(0)) {}
void operator()(T x) { res += x;}
T result() const { ret... | ALGO | 0.999058 | 4.59555 |
0b29215e-8ac5-421b-ae07-fd4e0d62b441 | joojis/programming-contests | codeground/2016/round_1_qualification/stone_bridge/source.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long int LLI;
typedef vector<LLI> VLLI;
const LLI Z = 1000000009;
void solveCase()
{
int N, K, L;
cin >> N >> K >> L;
vector<bool> trap = vector<bool>(N+1, false);
for (int i=0; i<L; i++) {
int l;
cin >> l;
trap[l] =... | ALGO | 0.999616 | 3.447746 |
b4432731-d93a-4da3-8709-91cc5d10d7c8 | kanghuiseon/algorithmStudy | Rare4_구현/juny/3190_뱀.cpp | #include <iostream>
#include <vector>
#include <deque>
#define endl '\n'
#define MAX 101
using namespace std;
int N, K, L;
int map[MAX][MAX];
int dx[] = {0,0,1,-1};
int dy[] = {1,-1,0,0};
int turn(int d, char di) {
if(di == 'D') {
if(d == 0) return 2;
if(d == 1) return 3;
if(d == 2) retu... | ALGO | 0.999871 | 4.312522 |
7ec08472-5506-4304-bc0b-26fb469c7aac | hitarth-gg/CP | CodeForces/archive/2065C2 - Skibidus and Fanum Tax hard version.cpp | // clang-format off
#include <bits/stdc++.h>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace chrono;
using namespace __gnu_pbds;
/* ----------------------- int128 ----------------------- */
// typedef __int128 lll;
// istream &operator>>(istream &cin,... | ALGO | 0.99997 | 4.018482 |
68975236-7ba2-481a-ab2a-0885a05cbb77 | sevmarc/project_euler | problems/03.cpp | #include <iostream>
#include <vector>
#include <math.h>
using namespace std;
bool is_prime(unsigned int num) {
if (num == 2) {
return true;
}
for (unsigned int i = 2; i <= (sqrt(num) + 1); ++i) {
if (num % i == 0) {
return false;
}
}
return true;
}
vector<unsign... | ALGO | 0.999709 | 4.707165 |
35e12c4f-bba5-4379-b295-c84b73ed64c4 | Vivek1898/leetcode-practice | 1768-merge-strings-alternately/1768-merge-strings-alternately.cpp | class Solution {
public:
string mergeAlternately(string word1, string word2) {
int i=0,j=0;
string ans="";
while(i<word1.length() && j<word2.length())
{
ans+=word1[i++];
ans+=word2[j++];
}
while(i<word1.length())
ans.push_back(word1... | ALGO | 0.999974 | 5.808468 |
660b3940-e365-424e-b1eb-d01e5dc10d9c | dayashankerprasad/DS_Algo | backtracking/sudoku.cpp | #include <iostream>
#include <vector>
using namespace std;
constexpr uint32_t NEED_TO_FILL{0};
/**
* find very first row and col which needs to be filled
*/
bool findVacant(std::vector<std::vector<uint32_t>> const &grid, uint32_t &row, uint32_t &col)
{
for (row = 0; row < grid.size(); ++row)
for (col = 0; col <... | ALGO | 0.995573 | 6.284655 |
bbb66327-317f-4305-9b67-5e6cf4950bf2 | sarvex/leetcode-small-basic | solution/1400-1499/1463.Cherry Pickup II/Solution.cpp | class Solution {
public:
int cherryPickup(vector<vector<int>>& grid) {
int m = grid.size(), n = grid[0].size();
vector<vector<vector<int>>> dp(m, vector<vector<int>>(n, vector<int>(n)));
vector<vector<vector<bool>>> valid(m, vector<vector<bool>>(n, vector<bool>(n)));
dp[0][0][n - 1] ... | ALGO | 0.999992 | 5.625732 |
98d4306d-d4bb-4854-8727-e12ae14fe4af | ishandutta2007/codeforces | far_from_noob/normal/489/B.cpp | #include <iostream>
using namespace std;
#include<bits/stdc++.h>
int main() {
int n;
cin >>n ;
int boys[n];
for (int i=0;i<n;i++){
cin>> boys[i];
}
int m;
cin >>m ;
int girls[m];
for (int i=0;i<m;i++){
cin>> girls[i];
}
sort(boys,boys+n);
sort (girls,girls... | ALGO | 0.999984 | 3.378462 |
032bc5e2-59f0-4678-8968-367d9c35cacc | jayeshpatel8/Coding-Practise-using-Leetcode-Coding-Platform | problems/merge_k_sorted_lists/solution.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* mergeKLists... | ALGO | 0.999907 | 5.8569 |
72f6b5ad-1860-48ba-b429-74b02d33900c | JUTURUHARSHITHA/DSA-problems | 2394-count-subarrays-with-score-less-than-k/2394-count-subarrays-with-score-less-than-k.cpp | typedef long long ll;
class Solution {
public:
long long countSubarrays(vector<int>& nums, long long k) {
ll ans = 0;
ll cur = 0, l = 0;
for (int i = 0; i < nums.size(); i++) {
cur += nums[i];
while (cur * (i - l + 1) >= k) {
cur -= nums[l];
... | ALGO | 0.999956 | 5.401772 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.