uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
07fc2dd0-4496-4244-a1a5-6b37080eca67 | jinclef/algorithm | programmers/30_42839.cpp | // 완전탐색 - 소수 찾기
#include <string>
#include <vector>
#include <set>
using namespace std;
typedef long long ll;
const ll MAX_VALUE = 10000000; // 길이 7 -> 9999999 -> 10000000
bool complex[MAX_VALUE]; // 1~9999999. false로 초기화. false면 prime.
void eratos(){
complex[0] = true;
complex[1] = true;
for (ll i=2; ... | ALGO | 0.999325 | 5.415168 |
b51acb24-2fc0-424e-bcd7-039b32320ffa | PetterS/monolith | minimum/linear/examples/shift_scheduling.cpp | // Petter Strandmark.
//
// Reads and solves problem files from “Employee Shift Scheduling Benchmark
// Data Sets”
// http://www.cs.nott.ac.uk/~tec/NRP/
//
// First argument to the program is the problem .txt file.
//
#include <fstream>
#include <iostream>
#include <map>
#include <random>
#include <string>
#include <tu... | ALGO | 0.977979 | 5.882662 |
bf422c94-5f71-400e-ae0a-5bae7d1d21e9 | ampl/coin | Couenne/Cbc/examples/driver2.cpp | #include <cassert>
#include <iomanip>
// For Branch and bound
//#include "CbcStrategy.hpp"
#include "CoinPragma.hpp"
#include "OsiCbcSolverInterface.hpp"
#include "CoinTime.hpp"
//#############################################################################
/*********************************************************... | ALGO | 0.993665 | 5.85414 |
d362348a-6d8e-4e59-8ed7-188285ff9398 | murilogontijo/URI-accepted-solutions | uri 1213.cPP | #include <bits/stdc++.h>
using namespace std;
int main() {
int n,k=1,count,qui;
while(scanf("%d", &n)!=EOF)
{
count = 1,qui=0,k=1;
long int w1=1;
while(k){
if(w1<n){
w1 = w1*10 +1;
count++;
}
qui = w1 % n;
if(qui==0)
break;
else w1 = qui... | ALGO | 0.999628 | 3.293202 |
8b7d626e-dbec-417d-a169-1f412de8cf4e | coolmanish01/DS | Insertion.cpp | #include<iostream>
using namespace std;
int main(){
int ar[20],t,n;
cout<<"Enter Size of Array : ";
cin>>n;
int i,j;
for(i=0;i<n;i++){
cout<<"Enter the "<<i+1<<" Element of Array : ";
cin>>ar[i];
}
int key;
for(i=1;i<n;i++){
key=ar[i];
for(j=i-1;(key<ar[j]... | ALGO | 0.999934 | 3.510735 |
b48e4e1e-da76-4f8f-9088-80cf5ba38174 | burhanrashid52/marquee_list | 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 |
68943080-7c89-4d5a-9404-b8669de7afb0 | basavarajakj/DataStructure_Algo_CPP | 10-Queue/01-BasicsQuestions/04-reverseQueue.cpp | #include<iostream>
#include<stack>
#include<queue>
using namespace std;
void reverseQueue(queue<int> &qu) {
stack<int> st;
// Push elements of the queue onto the stack
while(!qu.empty()) {
int frontElement = qu.front();
qu.pop();
st.push(frontElement);
}
// Pop elements from the stack and push... | ALGO | 0.999912 | 5.449419 |
a576a490-022d-4ff3-acac-ca0e157a3a60 | phitronio/Conceptual-Sessions-Code | Batch 6/Algorithm/Week 1-1/2_ListTomatrix.cpp | /**
* All Praise to Allah
* ---------------------
* Author: Asif Mohammed Sifat
* Created: 2025-02-03 12:56:16
* Source:
*/
/*
Problem 1: Convert Adjacency List To Adjacency Matrix
Problem Statement:
Given an adjacency list, convert it into an n × n adjacency matrix representation.
Example:
Input:
3 2
0 1
0 ... | ALGO | 0.999973 | 5.244792 |
ff25832e-3970-4025-aad7-122d4c9b257e | HnpawsPham/CP-PROBLEMS | IT_Squad_Journey/THCS/deHSG/pdf2_6-2-24/MT3/b1.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cout<<"Nhap so cong nhan: ";
cin>>n;
struct Cong_nhan{
string ten[1000];
int nam_sinh[1000];
int gio_lam[1000];
} list;
// nhập công nhân
for(int i=1; i<=n; i++){
cout<<"Nhap cong nhan thu "<<... | TOOL | 0.998078 | 3.707829 |
954b458b-59c5-4255-b9c0-58c6f8ff2dca | edge555/Online-Judge-Solves | Toph/Interesting Pyramid.cpp | #include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define pf printf
#define sc scanf
#define sf(num) scanf("%d",&num)
#define sff(num1,num2) scanf("%d %d",&num1,&num2)
#define sfff(num1,num2,num3) scanf("%d %d %d",&num1,&num2,&num3);
#define sl(num) scanf("%lld",&num)
... | ALGO | 0.999899 | 3.496247 |
74930aa3-c6eb-4121-a75b-555dd7d0de91 | ishandutta2007/codeforces | antontrygubo_o/normal/1009/B.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
string s;
cin>>s;
int n = s.length();
vector<char> kek;
for (int i = 0; i<n; i++) if (s[i]!='1') kek.push_back(s[i]);
int ones = n - kek.size();
bool t = false;
for (int i = 0; i<kek.size(); i++)
{
... | ALGO | 0.999961 | 3.540692 |
a957b823-f847-46a3-a1c5-149bcef5e530 | DataShrimp/LeetCode | cpp/LeafSimilar.cpp | // Leetcode 872
#include <cstdio>
#include <vector>
#include <iostream>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x): val(x), left(NULL), right(NULL) {}
};
class Solution {
public:
vector<int> leaves1;
vector<int> leaves2;
bool leafSim... | ALGO | 0.999732 | 5.643605 |
e219d6d7-cbd3-476a-9ee6-a43b8c9db5d9 | Asif-102/DSA | Sliding_Window/6_longest_subarray_with_positive_and_negative_value_with_sum_K.cpp | #include <bits/stdc++.h>
using namespace std;
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, k;
cin >> n >> k;
int a[n];
for(int i = 0; i < n; i++){
cin >> a[i];
}
unordered_map<int, int> ump;
int sum = 0;
int ans = 0;
for(int i = 0; i < n; i++){
... | ALGO | 0.99998 | 5.523932 |
f1ce4861-12ec-4f4a-840c-76c67bcbf06e | pgosar/Algorithms | codeforces/permutationsAndPrimes.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
long long t;
cin >> t;
while (t--) {
long long n;
cin >> n;
vector<long long> a(n);
a[0] = 2;
a[n - 1] = 3;
a[n / 2] = 1;
long long count = 4;
for (int i = 1; i < n - 1; i++) {
if (i == n / 2)
co... | ALGO | 0.999835 | 3.605741 |
f12341a6-e5ee-434f-bdce-e53969129c86 | creydit/cd-assignment | libcxx/test/std/algorithms/ranges_robust_against_proxy_iterators.pass.cpp | // UNSUPPORTED: c++03, c++11, c++14, c++17
// <algorithm>
//
// Range algorithms should work with proxy iterators. For example, the implementations should use `iter_swap` (which is
// a customization point) rather than plain `swap` (which might not work with certain valid iterators).
#include <algorithm>
#include <nu... | TEST | 0.910705 | 7.79186 |
2123c542-9f7b-479b-b380-740861776679 | sarvex/leetcode-raku | solution/1300-1399/1347.Minimum Number of Steps to Make Two Strings Anagram/Solution.cpp | class Solution {
public:
int minSteps(string s, string t) {
int cnt[26]{};
for (char& c : s) ++cnt[c - 'a'];
int ans = 0;
for (char& c : t) {
ans += --cnt[c - 'a'] < 0;
}
return ans;
}
}; | ALGO | 0.999993 | 6.125963 |
19623e78-71cb-4ddb-bf43-1fa26e9dc37a | ingallz/Algorithm | Greedy/CF742-C.cpp |
/* 𝑪𝒓𝒆𝒂𝒕𝒆𝒅 𝒃𝒚 𝑻𝒓𝒂𝒏 𝑫𝒖𝒄 𝑯𝒖𝒚 */
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#include <ext/pb_ds/detail/standard_policies.hpp>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
using namespace __gnu_pbds;
// #define ... | ALGO | 0.99958 | 4.975353 |
369b7c3b-793b-4e23-a518-e5c9dd293ff9 | ShinoharaYuuyoru/ShYy_Jianzhi | JZ13/JZ13.cpp | // Extra vector
class Solution {
public:
void reOrderArray(vector<int>& array) {
vector<int> partitioned;
for (int i = 0; i < array.size(); i++) {
if (array[i] % 2 == 1) {
partitioned.push_back(array[i]);
}
}
for (int i = 0; i < array.size(); i... | ALGO | 0.999985 | 5.711042 |
3da3f6f0-6438-48f9-a23f-0cfeec11a25a | AnonMiraj/Competitive-solving | CodeChef/START135D/Invert And Equalize2.cpp | // ﷽
// Contest: START135D
// Judge: CodeChef
// URL: https://www.codechef.com/START135D/problems/INVEQ
// Memory Limit: 256
// Time Limit: 1000
// Start: Wed 22 May 2024 06:07:26 PM EEST
// Reading Time :
// Thinking Time :
// Coding Time :
// Comments :
#include <bits/stdc++.h>
#ifdef ALGOAT
#include "debug.hpp"
#el... | ALGO | 0.999808 | 4.264475 |
594a1772-e24d-4365-a45b-909aabb09cf4 | raincross7/code-similarity | codes/train_code/problem412/problem412_244.cpp | #include <iostream>
#include <vector>
using namespace std;
int main(void){
long long int x, y;
cin>>x>>y;
if(x>0&&y>0){
long long int ans=abs(y-x);
if(x>y) ans+=2;
cout<<ans<<endl;
}else if(x>0&&y<0){
if(x!=abs(y)) cout<<abs(abs(y)-x)+1<<endl;
if(x==abs(y)) cout<<... | ALGO | 0.999998 | 3.721943 |
96044224-d27e-4d43-bc37-af87e4938107 | Bikash61/C-Practice | LOOPS IN C++/problem9.cpp | //Write a program to print odd number from 1 to 100 \
#include <iostream>
using namespace std;
int main(){
for ( int i = 1; i<=100 ; i++ ){
if ( i%2 !=0){
cout <<i<<endl;
}
}
return 0;
} | ALGO | 0.99875 | 3.599808 |
307d4938-c330-421a-af4d-bc0db699e088 | 0at01/Templates | Helper Functions/custom_hash.cpp | struct custom_hash {
static uint64_t splitmix64(uint64_t x) {
x += 0x9e3779b97f4a7c15;
x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
return x ^ (x >> 31);
}
size_t operator()(uint64_t x) const {
static const uint64_t FIXED_RANDO... | TOOL | 0.901782 | 5.846312 |
a61fcc35-aad2-4a5d-bb53-cd088030da6c | r3yc0n1c/probsol | prac/3394_grid_cut.cpp | /*
OJ: https://leetcode.com/problems/check-if-grid-can-be-cut-into-sections/description
Time:
Space:
*/
#include <bits/stdc++.h>
using namespace std;
class Solution {
public:
bool checkValidCuts(int n, vector<vector<int>>& rectangles) {
vector<pair<int, int>> x, y;
for (int i = 0; i < rec... | ALGO | 0.999925 | 5.746738 |
a71629d9-f5d2-4537-825a-fe70ed0e27a6 | Lan-Jing/Leetcode-Submissions | 115(TLE).cpp | #include <iostream>
using namespace std;
#include <string>
#include <cstring>
#include <vector>
class Solution {
public:
int numDistinct(string s, string t) {
if(!t.length() || s.length() < t.length()) return 0;
int ls = s.length(), lt = t.length();
cout<<lt<<' '<<ls<<endl;
vector<v... | ALGO | 0.99998 | 4.718233 |
d6ac4536-2a33-4034-a1d3-30ced7fb07bc | CodeAayu/CompilerClass | Aayush Ahuja 16JE002440/lab2_1.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
vector <pair<string,int> > a;
string s;
cout << "Input the identifiers to check validity. Press Q/q to end the input." << endl;
while(cin >> s)
{
if(s=="Q" or s=="q")
break;
bool valid=false;
if(( s[0] >= 'a' and s[0] <= 'z' ) or ( s[0] >= 'A' an... | ALGO | 0.982506 | 3.500541 |
bc0b0e52-d4c4-414c-903d-8d77a923240b | insozhao/kmp_get_next | kmp_get_next/kmp_get_next.cpp | // kmp_get_next.cpp : ̨Ӧóڵ㡣
//
#include "stdafx.h"
#include <stdlib.h>
#include <string.h>
void get_next(char *p, int *next);
void main()
{
char str[] = "aabaabaaa";
int *next = (int *)malloc(sizeof(int)*strlen(str));
get_next(str, next);
for (int i = 0; i < strlen(str); i++)
{
printf("%d", next[i]);
}
sys... | ALGO | 0.998813 | 4.049214 |
bda4eb08-07fc-4f42-a695-9f4a9d7b21d7 | pinkogeneral/Self_Taught_Programming | 2. CodingTest/1. BackJoon/Backjoon/입출력/[입출력] 2446 - 별 찍기_9.cpp | #include<iostream>
using namespace std;
int main()
{
int n;
cin >> n;
for (int i = 0; i < n; ++i)
{
for (int j = 0; j < i; ++j)
{
cout << " ";
}
for (int j = 1 + (2 * (n - i - 1)); j > 0; --j)
{
cout << "*";
}
if(i!=n)
cout << "\n";
}
for (int i = 0; i < n - 1; ++i)
{
for (int j = 0; ... | ALGO | 0.999913 | 3.753622 |
f83edcf5-38e8-4d62-9cce-7699a36749ac | mahim007/Online-Judge | codeforces/C. Cinema.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long int
map<ll,ll>M;
ll audio[200009];
ll subtitle[200009];
int main(){
ll n,i,j,k,d,movie,mxaudio,mxsubtitle;
cin>>n;
for(i=1;i<=n;i++){
cin>>d;
M[d]++;
}
ll m;
cin>>m;
for(i=1;i<=m;i++) cin>>audio[i];
for(i... | ALGO | 0.999639 | 4.055263 |
93f73a62-47e8-4dec-9746-91f57df104c7 | HRithIkGowDA/DSA-PROJECTS | sudoku.cpp | /*
* C++ Program to Solve Sudoku Problem using BackTracking
*/
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
using namespace std;
#define UNASSIGNED 0
#define N 9
bool FindUnassignedLocation(int grid[N][N], int &row, int &col);
bool isSafe(int grid[N][N], int row, int col, int num);
... | ALGO | 0.99998 | 7.144783 |
b2a217c6-d194-4e18-8435-f59642d914d4 | Tail-Wag-Games/frag | thirdparty/Jolt/Physics/Collision/BroadPhase/QuadTree.cpp | #include <Jolt/Jolt.h>
#include <Jolt/Physics/Collision/BroadPhase/BroadPhaseQuadTree.h>
#include <Jolt/Physics/Collision/RayCast.h>
#include <Jolt/Physics/Collision/AABoxCast.h>
#include <Jolt/Physics/Collision/CastResult.h>
#include <Jolt/Physics/Collision/SortReverseAndStore.h>
#include <Jolt/Physics/Body/BodyPair.h... | ALGO | 0.997614 | 7.648759 |
1ba165aa-edda-49b5-b692-126a25fa6516 | Robbbert/mameui | src/mame/atari/orbit_a.cpp | /*************************************************************************
atari\orbit_a.cpp
*************************************************************************/
#include "emu.h"
#include "orbit_a.h"
/************************************************************************/
/* orbit Sound System Analog em... | TOOL | 0.859801 | 3.896785 |
6f0c2753-f6fc-4073-abe7-5da446aec096 | glerium/acm-life | codeforces/2071-div-2/B.cpp | #include <bits/stdc++.h>
#define endl '\n'
#define rep(i,x,y) for(int i=x;i<=y;i++)
using namespace std;
typedef long long ll;
constexpr int maxn = 2e5+10;
constexpr ll mod = 998244353;
bool check(ll x) {
ll aa = round(sqrt(x));
if(aa * aa == x)
return true;
else return false;
}
void solve() {
i... | ALGO | 0.999842 | 5.315357 |
b446c624-51c5-4e80-a954-a18f1de30fd4 | Zeirdo/TopMGQuant | src/search/oneptmsearch/one_ptm_search_processor.cpp | #include <string>
#include <algorithm>
#include "common/util/logger.hpp"
#include "common/util/file_util.hpp"
#include "seq/proteoform.hpp"
#include "seq/proteoform_factory.hpp"
#include "seq/db_block.hpp"
#include "ms/spec/msalign_reader.hpp"
#include "ms/spec/msalign_util.hpp"
#include "prsm/simple_prsm.hpp"
#includ... | ALGO | 0.957223 | 4.849639 |
168c6989-538f-4eb5-aea8-d31acc633ba1 | hidekiriyuga/leet-luffy | 2218-maximum-value-of-k-coins-from-piles/2218-maximum-value-of-k-coins-from-piles.cpp | class Solution {
public:
int func(int i, int k, vector<vector<int>>& piles, vector<vector<int>>& dp){
if (dp[i][k] > 0) return dp[i][k];
if (i == piles.size() || k == 0) return 0;
int res = func(i + 1, k, piles, dp), cur = 0;
for (int j = 0; j < piles[i].size() && j < k; ++j) {
... | ALGO | 0.999863 | 5.840741 |
6dfb5712-7b58-4879-9cec-552662facc85 | Gabr002/competitive-programming | introductionprogramation/ad_hoc/2929.cpp | #include <bits/stdc++.h>
#include <stdio.h>
using namespace std;
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
string opc;
int num, value;
stack<int> stack_;
cin >> num;
while(num--){
cin >> opc;
if(opc == "PUSH"){
cin >> value;
if... | ALGO | 0.999893 | 4.818512 |
e7b794be-aaff-4ede-97d8-efb2206da6dd | Jrana1/leedCode_problem_solutions | triangle.cpp | #include <bits/stdc++.h>
using namespace std;
// top to bottom approach
int fun(vector<vector<int>> &tri)
{
for (int i = 1; i < tri.size(); i++)
{
int st = 0;
int end = tri[i].size();
while (st < end)
{
if (st == 0)
{
tri[i][st] += tri... | ALGO | 0.999971 | 4.897203 |
b27eb2c8-16ce-40c7-bb8c-870cebaec8aa | gajgeospatial/boost_1_81_0 | libs/graph/example/min_max_paths.cpp | #error \
"This example appears to be incorrect; it uses edge weights that are smaller than 0 using the comparison operator passed to Dijkstra's algorithm, which is not allowed."
#include <boost/config.hpp>
#include <iostream>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/graph_utility.hpp>
#includ... | ALGO | 0.999884 | 4.933839 |
9ec98391-c2b3-40b9-ac0e-cd89818f1265 | chdb-io/chdb | src/Functions/bitHammingDistance.cpp | #include <Functions/FunctionBinaryArithmetic.h>
#include <Functions/FunctionFactory.h>
#include <bit>
namespace DB
{
namespace ErrorCodes
{
extern const int ILLEGAL_COLUMN;
}
template <typename A, typename B>
struct BitHammingDistanceImpl
{
using ResultType = std::conditional_t<(sizeof(A) * 8 >= 256), UInt16... | ALGO | 0.992581 | 7.286102 |
2c3cdef5-ff9d-4579-88c3-5aa5c682a79c | Nisha1203/Logic-Building | program246.cpp | #include<iostream>
using namespace std;
typedef unsigned int UINT;
UINT ToggleBit(UINT iNo)
{
UINT iMask = 0X00000040;
return (iNo ^ iMask);
}
int main()
{
UINT iValue = 0;
UINT iRet = 0;
cout<<"Enter number : "<<"\n";
cin>>iValue;
iRet = OffBit(iValue);
cout<<"Result is : "<<iRet<<... | ALGO | 0.99884 | 5.096934 |
a2302b49-9369-465e-a390-d8ec161ab252 | mysteriousding/learner | 2024/12/12/24work10.cpp | /*(46)输出链表偶数结点
//先输入N个整数,按照输入的顺序建立链表。然后遍历并输出偶数位置上的结点信息。
//
//输入格式:
//首先输入一个正整数T,表示测试数据的组数,然后是T组测试数据。
//每组测试的第一行输入整数的个数N(2≤N);第二行依次输入N个整数。
//
//输出格式:
//对于每组测试,输出该链表偶数位置上的结点的信息。每两个数据之间留一个空格。
//
//输入样例:
//2
//8
//12 56 4 6 55 15 33 62
//3
//1 2 1
//输出样例:
//56 6 15 62
//2
#include<iostream>
using namespace std;
struct su... | ALGO | 0.999793 | 4.13473 |
a06b3b8b-d5fb-4a20-a965-6ca933af51d9 | abhishek18124/PPCPPOct2023 | Lecture 10/004Arrays_InsertionSort.cpp | #include<iostream>
using namespace std;
int main() {
int arr[] = {50, 40, 10, 30, 20};
int n = sizeof(arr) / sizeof(int);
// iterating over the passes
for (int i = 1; i <= n - 1; i++) {
// insert the 1st element of the unsorted part of the arr[]
// i.e. arr[i] to its correct position in the sorted part
... | ALGO | 0.999923 | 4.041541 |
bb68853b-b7f5-4642-b1ea-06c0583a7401 | ashutoshvrm8/Codechef-Solutions-C-Cpp | Exam results.cpp | #include<iostream>
#include<algorithm>
using namespace std;
long long int a[200000];
int main()
{
long long int n,i;
cin>>n;
for(i=0;i<n;i++)
cin>>a[i];
sort(a,a+n);
cout<<a[n-1]<<" "<<a[n-2];
return 0;
}
| ALGO | 0.999897 | 3.183647 |
454ca470-317e-4140-88a3-a91bcb66a326 | qc-mountain/Data-Structures-and-Algorithms | code/001.cpp | /* */
#include <cstdio>
#include <algorithm>
using namespace std;
const int MAXN = 110;
int n, num[MAXN];
int main()
{
int ans = 0;
scanf("%d", &n);
for(int i = 0; i < n; ++i)
scanf("%d", &num[i]);
for(int i = 0; i < n; ++i) {
for(int j = i + 1; j < n; ++j) {
for(int k... | ALGO | 0.999919 | 3.694326 |
fbe95559-e16d-49b7-9ac0-e5429ae00cf8 | atharvakej/Repo_of_Codes | Practice/B_1_Bouquet_Easy_Version.cpp | #include <bits/stdc++.h>
using namespace std;
#define POP pop_back
#define MOD 1e7+10
#define PI 3.1415926535897932
#define PB push_back
#define MP make_pair
#define pb push_back
#define ppb pop_back
int power(int a, int b){
int r=1;
while(b){
if(b&1)r=(r*a);
a=(a*a); b/=2;
}
return r;
}
typedef long long ... | ALGO | 0.999992 | 4.662941 |
d361da24-7179-48d9-9c77-2e72b74957e7 | cosmolejo/cosmolejo.github.io | IntroPC/Tarea 6/Combinatoria/combinatoria.cpp | #include <cstdio>
#include"rutinas.cpp"
using namespace std;
int main (void)
{
double L,P,combi;
printf("ingrese el numero de elementos a combinar: ");
scanf("%lf",&L);
printf("en grupos de cuanto desea combinarlos??: ");
scanf("%lf",&P);
combi=combinatoria(L,P);
printf("si se tienen %.0lf element... | ALGO | 0.999379 | 3.781228 |
f70ae672-9a3c-487e-ad19-5b7efed61cf6 | benMcChesney/KinectHacks | FireIce/ofxBox2d/src/lib/Box2D/Source/Collision/b2PairManager.cpp | #include "b2PairManager.h"
#include "b2BroadPhase.h"
#include <algorithm>
// Thomas Wang's hash, see: http://www.concentric.net/~Ttwang/tech/inthash.htm
// This assumes proxyId1 and proxyId2 are 16-bit.
inline uint32 Hash(uint32 proxyId1, uint32 proxyId2)
{
uint32 key = (proxyId2 << 16) | proxyId1;
key = ~key + (ke... | TOOL | 0.957728 | 7.304061 |
f04c0c92-4944-435a-89d7-f2ffd4b18bbc | Easynodecoin/ENC | src/easynodecoin-tx.cpp | #include "base58.h"
#include "clientversion.h"
#include "coins.h"
#include "consensus/consensus.h"
#include "core_io.h"
#include "keystore.h"
#include "policy/policy.h"
#include "primitives/transaction.h"
#include "script/script.h"
#include "script/sign.h"
#include <univalue.h>
#include "util.h"
#include "utilmoneystr.... | TOOL | 0.889316 | 5.659498 |
30bd43d8-6452-4c89-a799-c34813f8ab59 | WYK15/swift-Ollvm12 | llvm/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp | #include "llvm/Transforms/AggressiveInstCombine/AggressiveInstCombine.h"
#include "AggressiveInstCombineInternal.h"
#include "llvm-c/Initialization.h"
#include "llvm-c/Transforms/AggressiveInstCombine.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Analysis/BasicAliasAnalysis.... | ALGO | 0.981435 | 7.895505 |
d61ceee5-6b28-469c-8b07-8728a722c3be | YangKlee/C-plus-learning | CTDL/nodeTest.cpp | #include <bits/stdc++.h>
using namespace std;
struct Student{
string name;
int age;
double gpa;
};
struct NodeStudent
{
Student data;
NodeStudent *next;
};
void insert(NodeStudent* &p, Student std);
void inilazie(NodeStudent* &head);
void deleteStudent(NodeStudent* &p);
///typedef NodeStudent* Node... | TOOL | 0.950325 | 3.575183 |
75c2e0ec-de0f-48b0-8feb-4e29294e6866 | Hengle/windows_2000_source_code | windows_2000_source_code/win2k/private/net/snmp/subagent/snmpevnt/evntwin/evntfind.cpp | // evntfind.cpp : implementation file
//
#include "stdafx.h"
#include "eventrap.h"
#include "evntfind.h"
#include "source.h"
#include "globals.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CEven... | TOOL | 0.884302 | 6.000154 |
8f484133-23a1-4e6d-b249-59b38a46656e | wliu1197/glycospectrumscan | glycoSpectrumScan/R/win-library/2.15/Rcpp/examples/ConvolveBenchmarks/convolve9_cpp.cpp | // -*- mode: C++; c-indent-level: 4; c-basic-offset: 4; tab-width: 8 -*-
// this version expands convolve8_cpp by making Vec mimic the structure of
// NumericVector. It peforms well, so this is is not the structure of
// NumericVector that is the problem. So what is it then ?
//
// could it be because NumericVector ... | ALGO | 0.995598 | 6.497269 |
2a02171c-1632-40a8-8693-c07a1b33df8e | EpsilonsQc/Programming-projects | Programmation-II/Project 016 (Count char array length)/Main.cpp | // Count char array length
// Main.cpp (Main function | Program execution begins and ends there)
#include <iostream>
using namespace std;
void displayIntro();
int countLength(const char*);
int main()
{
displayIntro();
char string1[80];
// Infinite loop
while (true)
{
cout << "Enter a string: ";
cin >> ... | ALGO | 0.954819 | 5.089232 |
5aa578a7-4936-4291-ac77-ca1679eb6b05 | matilde-t/Parallel-Programming | in-class-1/student_submission.cpp | #include "Utility.h"
#include <chrono>
/*
* Our message is encrypted/decrypted NUM_ITERATIONS times (in main).
* At each iteration one layer is decrypted using this function and the result
* is stored in the same decryptedMessage array. In order to decrypt a message,
* the location of each character from decrypted... | ALGO | 0.998836 | 5.126674 |
31dd12cd-1142-45ee-adad-d09c0a6cf999 | dante-won/algorithms | boj/4013.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<vector<int>> vvi;
#define endl '\n'
#define rep(i, n) for (int i = 0; i < (n); ++i)
#define fastio \
ios_base::sync_with_stdio(0); \
... | ALGO | 0.99991 | 4.09233 |
9a2e35e9-f2b3-44e6-bd6a-848270df65fe | dongjinjeon/readercoin | src/policy/policy.cpp | // NOTE: This file is intended to be customised by the end user, and includes only local node policy logic
#include <policy/policy.h>
#include <consensus/validation.h>
#include <coins.h>
#include <span.h>
CAmount GetDustThreshold(const CTxOut& txout, const CFeeRate& dustRelayFeeIn)
{
// "Dust" is defined in term... | TOOL | 0.897338 | 7.73161 |
f46cd21e-d2b3-4b68-bd7f-dacae9d861a3 | Akrobatik/ps | BaekJoon/11000/11579.cpp | // Title : 초차원전쟁 이나
// Link : https://www.acmicpc.net/problem/11579
// Time : 692 ms
// Memory: 3128 KB
#include <bits/stdc++.h>
using namespace std;
int memo[500][500];
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
vector<int64_t> arr;
int t;
cin >> t;
while (t--) {
int n;
ci... | ALGO | 0.999956 | 4.046677 |
93b71986-ba20-4b6a-8d00-890d4acc23eb | aimingeye/CSES-solutions | Introductory Problems/1094/1094.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef vector<pll> vpll;
typedef vector<vi> vvi;
typedef vector<vl> vvl;
#define fi first
#define se second
#define all(x)... | ALGO | 0.999895 | 4.097907 |
91fb8fa6-32b4-47f4-9e06-10bd9c06231f | ishandutta2007/codeforces | yhchang3/normal/1202/E.cpp | #include<bits/stdc++.h>
using namespace std;
int n;
const int MAXN = 2e5+10;
const int ALPHASIZE = 26;
string t,s[MAXN];
int fail[MAXN],trans[MAXN][ALPHASIZE];
int Trieidx;
int cnt[MAXN];
long long int ans1[MAXN],ans2[MAXN];
void init(){
memset(trans,0,sizeof trans);
memset(fail,0,sizeof fail);
memset(cnt,0,sizeof... | ALGO | 0.999992 | 4.099838 |
194029b4-f5bc-4e9c-95d8-c637f3b329f5 | DavidLara004/Semana-9 | Otros/Proyectoa/Sin Nombre1.cpp | // Online C compiler to run C program online
#include <stdio.h>
int main() {
float num1;
float num2;
float suma;
float resta;
float multiplicacion;
float division;
char op;
printf("-----Bienvenido a su calculadora personal virtual---- \n" );
printf("Ingrese la operacin. Ponga + para ... | TOOL | 0.908131 | 3.190238 |
a00a23da-2345-4637-8814-697d0f00dd39 | mizuirorivi/kyopuro | ABC068proC.cpp | #include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
#define INF 999999999
typedef long long int Int;
typedef pair<int,int> P;
using ll... | ALGO | 0.9999 | 4.31149 |
939f0504-cf0e-451d-abbc-571181278422 | jsegeren/ParallelMandelbox | 3d_para.cpp | #include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <string.h>
#include "3d_para.h"
//---------------------------------------------------------------------------------------------
//when projection and modelview matricies are static (computed only once, and camera does not mover)
int UnProject(double win... | ALGO | 0.997605 | 4.108524 |
3ff7ab0c-711f-44db-ac4e-1268e0ab6dc3 | COMBINE-lab/EDS | src-cpp/readEDS.cpp | #include <Rcpp.h>
#include <zlib.h>
using namespace Rcpp;
// C++ internal function to figure out the spaces to reserve
size_t getReserveSpaces(size_t numOfGenes, size_t numOfOriginalCells,
Rcpp::IntegerVector& bitVecLengths,
std::string& countMatFilename) {
// opening gz... | DATA | 0.908089 | 6.198226 |
7eaaf7fa-387d-43dd-aee6-04293e53e369 | someone2060/contest-practice | kattis/1.4.4.i - Still Easy/missingnumbers.cpp | //#include <bits/stdc++.h>
#include <iostream>
int main()
{
std::ios::sync_with_stdio(false);
int n;
std::cin >> n;
bool right{ true };
int next{ 1 };
while (n--) {
int i;
std::cin >> i;
if (i != next) {
right = false;
while (next != i) {
std::cout << next << '\n';
+... | ALGO | 0.999941 | 4.408027 |
31acb44d-a900-4891-a73d-10a281255282 | NMK-Ai/Comma-Ai | phonelibs/eigen/unsupported/doc/examples/MatrixLogarithm.cpp | #include <unsupported/Eigen/MatrixFunctions>
#include <iostream>
using namespace Eigen;
int main()
{
using std::sqrt;
MatrixXd A(3,3);
A << 0.5*sqrt(2), -0.5*sqrt(2), 0,
0.5*sqrt(2), 0.5*sqrt(2), 0,
0, 0, 1;
std::cout << "The matrix A is:\n" << A << "\n\n";
std::cout << "... | ALGO | 0.999065 | 3.595733 |
ad83d9d7-1347-4932-bffb-8e216366ef17 | sirkp/DSA | GOC/6. longest_path_having_same_level.cpp |
// https://leetcode.com/problems/longest-univalue-path
int util(Node* node, int& ans){
if(node!=NULL){
int l = util(node->left, ans);
int r = util(node->right, ans);
if(node->left!=NULL && node->right!=NULL && node->data==node->left->data && node->data==node->right->data){
... | ALGO | 0.999743 | 6.064222 |
ac9725a2-32d1-47f6-b890-abe06ac66be4 | WhiteCells/code | cpp/STL/unordered_map/unordered_map.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
/*
使用哈希表去重 (1, 0),(0, 1) (x, y) (y, x)
将 x, y 映射到 x * n + y
*/
void UnorderedMap() {
std::vector<std::vector<int>> edges {
{ 1, 0 },
{ 0, 1 },
{ -1, 0 },
{ 0, -1 },
{ 1000, 200 },
{ 200, 1000 },
};... | ALGO | 0.982993 | 4.595819 |
c45599b8-591b-443a-83af-923881cb7df3 | atharvtem/Sem-3-DSA-including-DSA-and-DM-PBL- | StackUsingArray.cpp | #include<iostream>
using namespace std;
#define MAX 1000
class stack
{
int top;
public:
int a[MAX];
Stack() {top=-1;}
bool push(int x);
int pop();
int peek();
bool isempty();
};
bool stack::push(int x)
{
if(top>=(MAX-1))
{
cout<<"\nStack Overfl... | ALGO | 0.995584 | 4.05617 |
d079a6fc-44c9-4cc8-a709-cc7c02afcf90 | GuacheSuede/MSSubmission1234567890 | submission/sma/boost_1_69_0/libs/asio/example/cpp03/spawn/parallel_grep.cpp | #include <boost/asio/dispatch.hpp>
#include <boost/asio/post.hpp>
#include <boost/asio/spawn.hpp>
#include <boost/asio/strand.hpp>
#include <boost/asio/thread_pool.hpp>
#include <boost/thread/thread.hpp>
#include <boost/bind.hpp>
#include <fstream>
#include <iostream>
#include <string>
using boost::asio::dispatch;
usi... | TOOL | 0.964459 | 6.411865 |
47ca6ce7-a86d-4cca-ba18-cbc9db2b7128 | sylvainprigent/BioImageLib | BioImageLib/src/blRAT/blRATTracker.cpp | /// \file blRATTracker.cpp
/// \brief blRATTracker class
/// \author Sylvain Prigent
/// \version 0.1
/// \date 2015
#include "blRATTracker.h"
#include <lemon/preflow.h>
#include <lemon/smart_graph.h>
#include <lemon/lgf_reader.h>
#include <lemon/lgf_writer.h>
#include <lemon/capacity_scaling.h>
#include <lemon/list_... | ALGO | 0.992247 | 4.48835 |
78029813-72b7-48c0-bade-f7af22c451b5 | Palander1/GraphAlgorithms | heap.cpp | #include "heap.h"
#include <iostream>
#include <cmath>
#include <cstdlib>
// Creates a new heap with the specified capacity.
pHEAP createHeap(int capacity) {
pHEAP heap = (pHEAP)malloc(sizeof(HEAP));
heap->capacity = capacity;
heap->size = 0;
heap->H = (int*)malloc((capacity + 1) * sizeof(int)); // All... | ALGO | 0.999821 | 5.530502 |
96f104b4-866b-4a24-819f-9dc14e235b3e | CytoComp/ethereum-ObjectiveC | LocalPods/boost/1.55.0/libs/geometry/doc/index/src/examples/rtree/interprocess.cpp | //[rtree_interprocess
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/point.hpp>
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/index/rtree.hpp>
#include <boost/foreach.hpp>
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/allocators/alloc... | TOOL | 0.995803 | 3.959213 |
9718a61b-d465-44c2-9ac9-56a041e44aa9 | axelu/leetcode | cpp/03000-03499/permutationsiii.cpp |
// 3437. Permutations III
// https://leetcode.com/problems/permutations-iii/
class Solution {
private:
vector<vector<int>> ans;
int n;
void rec(int pos, int state, bool pre_even, vector<int>& t) {
if( pos == n ) {
ans.push_back(t);
return;
}
for(int i = 1;... | ALGO | 0.999957 | 6.250002 |
7cb8f4c3-2dd0-44a4-90ff-dc7f9bc3fa27 | 2RoN4eG/Regula-Test-Task | OpenCV/sources/modules/video/src/bgfg_gaussmix2.cpp | /*//Implementation of the Gaussian mixture model background subtraction from:
//
//"Improved adaptive Gausian mixture model for background subtraction"
//Z.Zivkovic
//International Conference Pattern Recognition, UK, August, 2004
//http://www.zoranz.net/Publications/zivkovic2004ICPR.pdf
//The code is very fast and perf... | ALGO | 0.997525 | 6.282336 |
48750a6a-7959-4e27-a2a2-902d746facf9 | Able2002/Leetcode_Daily_Challenge | First Unique Character in a String.cpp | class Solution {
public int firstUniqChar(String s) {
HashMap<Character, Integer> count = new HashMap<Character, Integer>();
int n = s.length();
// build hash map : character and how often it appears
for (int i = 0; i < n; i++) {
char c = s.charAt(i);
count.pu... | ALGO | 0.992575 | 3.950793 |
2cf274f7-7f54-4ad1-8c77-0df0d20ab8ba | HEDEZ44/DSA-PRACTICE | LINKEDLIST/Remove Linked List Elements.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* removeEleme... | ALGO | 0.999937 | 5.764729 |
fd61f21d-b26d-4847-a8e8-08dc2d3da645 | ESeokhwan/cpp-codingtest-practice | baekjoon/prob_14867/solution.cpp | #include <bits/stdc++.h>
using namespace std;
int a, b, c, d;
int dp[4][100001];
bool is_updated;
void update_dp_value(int idx1, int idx2, int new_value) {
if(dp[idx1][idx2] == -1 || dp[idx1][idx2] > new_value) {
dp[idx1][idx2] = new_value;
is_updated = true;
}
}
int main(void) {
ios::sync_with_stdio(false... | ALGO | 0.999881 | 3.818821 |
0896f724-3a60-411d-9c46-e3a2a8026c42 | SieGe0701/DSE | Year 2/Semester 4/DAA lab/Week 8/w8q1.cpp | #include <iostream>
using namespace std;
struct Node {
Node *left;
Node *right;
int data;
};
Node *insert() {
int data;
Node *p;
cout << "Enter data, -1 for NULL\n";
cin >> data;
if (data == -1) {
return NULL;
}
p = new Node;
p->data = data;
cout << "Left child\n";
p->left = insert();
cout << "Ri... | ALGO | 0.999916 | 5.603137 |
2e1a520f-bc2b-4d4d-b473-0c7b25d40138 | dunan/MultiVariatePointProcess | 3rd-party/igl/doublearea.cpp | template <typename DerivedV, typename DerivedF, typename DeriveddblA>
IGL_INLINE void igl::doublearea(
const Eigen::PlainObjectBase<DerivedV> & V,
const Eigen::PlainObjectBase<DerivedF> & F,
Eigen::PlainObjectBase<DeriveddblA> & dblA)
{
if (F.cols() == 4) // quads are handled by a specialized function
retur... | TOOL | 0.882641 | 7.334431 |
974a383f-922d-4e18-9ac0-1a5301fbd202 | liguigui/kamyu104-LeetCode | C++/water-and-jug-problem.cpp | // Time: O(logn), n is the max of (x, y)
// Space: O(1)
// Bézout's identity (also called Bézout's lemma)
class Solution {
public:
bool canMeasureWater(int x, int y, int z) {
return z == 0 || (z <= x + y && z % gcd(x, y) == 0);
}
private:
int gcd(int a, int b) {
while (b != 0) {
... | ALGO | 0.999709 | 5.915646 |
a53b058f-8694-4028-b218-cffd4014fc21 | vandreas19/POJ_sol | 3507/5431835_AC_32MS_220K.cpp | #include<iostream>
using namespace std;
int main(){
while(true){
bool end=true;
int sum=0,max=INT_MIN,min=INT_MAX;
for(int i=0;i<6;i++){
int grade;
cin>>grade;
sum+=grade;
if(max<grade)
max=grade;
if(min>grade)
min=grade;
if(grade!=0)
end=false;
}
if(end)
break;
cout<<(sum... | ALGO | 0.999756 | 3.61554 |
541b87be-f4a7-43e3-bed2-064d82c4301b | leeuihyun/Baekjoon-study-with | LEE/220106/1697/1697.cpp | #include <iostream>
#include <queue>
#define MAX 100001
using namespace std;
int n, k;
bool visited[MAX];
int bfs(int n, int k) {
queue <pair<int, int>> q;
q.push(make_pair(n, 0));
visited[n] = true;
while (!q.empty()) {
int x = q.front().first;
int y = q.front().second;
q.pop();
if (x == k)return y;
if... | ALGO | 0.999648 | 3.981103 |
b52442e1-dd99-4068-b6b2-b2115c5ab36f | bmjones92/Kattis | Solutions/guessthedatastructure/guessthedatastructure.cpp | /**
* Solution to the "I Can Guess the Data Structure!" problem on Kattis.
* @author Brendan Jones
*/
#include <cstdint>
#include <iostream>
#include <queue>
#include <stack>
// Bit masks for different data structures.
enum BitFlag : uint32_t {
None = 0,
Stack = (1 << 0),
Queue = (1 << 1),
PQueue = ... | ALGO | 0.999699 | 5.46562 |
f6625efb-eb27-4284-8307-c6d257a0e19f | pikasonix/SoICT | t1.cpp | #include <stdio.h>
#include <string.h>
int main()
{
const char haystack[20] = "VietJackTeam";
const char needle[10] = "Team";
char *ret;
ret = strstr(haystack, needle);
printf("Chuoi con la: %s\n", ret);
return(0);
}
| ALGO | 0.998127 | 3.168122 |
d44b240a-05b0-449f-82f9-3bf6c07038ef | jefo3/programacao-competitiva | NEPS/Flíper.cpp | #include <iostream>
using namespace std;
int main(){
int p, r;
cin >> p >> r;
if(p == 1 && r == 0) cout << "B";
else if(p == 0) cout << "C";
else cout << "A";
return 0;
}
| ALGO | 0.999555 | 3.243365 |
50d1db9a-b727-446e-8a4f-059c4ee7345b | HyoBN/Algorithm_Study | Programmers/가장 큰 수.cpp | #include <string>
#include <vector>
#include <cmath>
#include <algorithm>
using namespace std;
bool cmp(string a, string b){
return a+b > b+a;
}
string solution(vector<int> numbers) {
string answer = "";
vector<string> numStr;
bool allZeroCheck=true;
for(int i=0;i<numbers.size();i++){
... | ALGO | 0.999908 | 6.093819 |
780c6651-f267-41e3-8858-0997e4ee9763 | ishandutta2007/codeforces | golovanov399/normal/951/B.cpp | #include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(), (v).end()
using li = long long;
using ld = long double;
void solve(bool read);
#define int li
ostream& dbgPrintContainer(ostream& os, const auto& container, const char* brackets = "[]") {
os << brackets[0] << " ";
for (auto& elem : ... | ALGO | 0.999934 | 3.683937 |
f4ecd061-d837-4a05-acff-0e16b0694d08 | lalverdacakir/DataStructures | stack-array.cpp | #include <iostream>
using namespace std;
class Stack{
int* arr;
int size;
int top;
public:
Stack(int s);
void push(int val);
void push(int* values,int n);
int Top();
int pop();
bool isEmpty();
bool isFull();
void disp();
};
Stack::Stack(int s){
size=s;
arr=new int[s];
top=-1;
}
int Stack::Top(){
return... | ALGO | 0.982248 | 4.269341 |
9f37319b-86ab-4d4a-a4e8-1b87e5b9e025 | shayash22/Popular-cpp-Questions | reversearray.cpp | #include <bits/stdc++.h>
using namespace std;
#define m1 1000000007
#define int long long
#define float double
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(), c.end()
#define mid(l, r) (l + (r - l) / 2)
#define loop(i, a, b) for(int i = (a); ... | ALGO | 0.99998 | 3.90879 |
f17d1519-cd8b-4320-93d5-b6095bfcd11c | BechirTr/Some_Projects | C++/Trajectory/graph.cpp | #include <iostream>
#include <iterator>
#include <map>
#include <cmath>
#include <vector>
#include <limits.h>
#include <stdio.h>
#include <fstream>
#include<omp.h>
#include "graph.h"
using namespace std;
void graph::confirmGraph(){
for(int i=0;i<A.size();i++)
{
cout<<"arc numero"<<i+1<<"\n"<<A[i]<<... | ALGO | 0.999551 | 3.986449 |
45b45d51-04d4-47f6-b918-71ff9361abc3 | ankit777666/DSA | patterns/sliding-window/Maximum point you can obtain from cards.cpp | class Solution {
public:
long long maxScore(vector<int> &cardPoints, int N, int k) {
// code here
long long ans; long long currSum=INT_MAX;
long long sum=0; long long arrSum=0;
int j=0,i=0;
for(int i=0; i<N; i++)
arrSum+=cardPoints[i];
if(N-k==0) return ... | ALGO | 0.99999 | 4.839953 |
6bf4cb20-f5c9-4599-a64b-f3c2c422d303 | jailsonevora/leetcode-problem-set | Array & String/15.MinimumSizeSubarraySum.cpp | #include<iostream>
#include<vector>
#include<algorithm>
#include<cmath>
#include<numeric>
#include<cmath>
using namespace std;
class Solution {
public:
int minSubArrayLen(int target, vector<int>& nums) {
int ans = INT_MAX;
int left = 0, sum = 0;
for (int i = 0; i < nums.size(); i++)
... | ALGO | 0.999964 | 5.34873 |
7f311984-9767-429a-bf19-bfa3d86bee61 | wocantudou/ncnn-20240410 | tools/pnnx/src/pass_onnx/dead_code_elimination.cpp | #include "dead_code_elimination.h"
#include <string>
#include <unordered_set>
namespace pnnx {
namespace onnx2pnnx {
void dead_code_elimination(onnx::ModelProto& model)
{
// collect all nodes that have no links with graph outputs
std::vector<std::string> dead_outputs;
std::vector<int> dead_node_indexes;... | ALGO | 0.976458 | 7.284078 |
b7d08662-2a70-46c4-8bf1-5b5fc1f81e21 | rajyan/AtCoder | others/la-virtual2/F.cpp | //#include <cassert>
//#include <cstdio>
//#include <cmath>
//#include <iostream>
//#include <iomanip>
//#include <sstream>
//#include <vector>
//#include <set>
//#include <map>
//#include <queue>
//#include <numeric>
//#include <algorithm>
//
//using namespace std;
//using lint = long long;
//constexpr int MOD = 10000... | ALGO | 0.99929 | 4.743919 |
8a8452f2-ca42-4fb0-a322-a184f7748679 | Kawser-nerd/CLCDSA | Source Codes/CodeJamData/10/52/13.cpp | #include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
static unsigned int gcd(unsigned int a, unsigned int b) {
return a==0 ? b : gcd(b%a, a);
}
static void runTest() {
unsigned long long L;
unsigned int N;
cin >> L >> N;
vector<unsigned int> B(N);
for (unsigned int i=0; i<N; i++)
ci... | ALGO | 0.999907 | 4.070057 |
b50c523e-e0e1-4585-8bee-7b0cf1cd4b2c | keienx/labs | 13lab/13lab/main3.cpp | //#include <iostream>
//#include <list>
//#include <map>
//#include <vector>
//#include <algorithm>
//#include <functional>
//#include "Pair.h"
//using namespace std;
//
//ostream& operator<<(ostream& out, map<double, Pair>& m) {
// for (map <double, Pair>::iterator it = m.begin(); it != m.end(); it++) {
// cout << "С... | ALGO | 0.90915 | 3.559292 |
003a1fd6-274b-44a9-914f-e7e4a1262f86 | anikinmatvey/code-review | 12_E.cpp | #include <iostream>
const unsigned long long kShift = 30;
std::pair<unsigned long long, unsigned long long> Decomposition(
unsigned long long pp) {
unsigned long long count = 0;
while (pp % 2 == 0) {
++count;
pp /= 2;
}
std::pair<unsigned long long, unsigned long long> result(count, pp);
return ... | ALGO | 0.999977 | 5.083225 |
547a4ea0-54b7-4eec-bb38-c1d546c72c55 | asu-crypto/mpsica | thirdparty/linux/boost/libs/endian/example/conversion_use_case.cpp | // endian/example/conversion_use_case.cpp
// This program reads a binary file of fixed length records, with a format defined
// in a header file supplied by a third-party. The records inserted into a vector,
// and the vector is sorted. The sorted records are then written to an output file.
// Full I/O error tes... | DATA | 0.87603 | 6.138855 |
92920515-1422-488e-ab27-fb34183dfea3 | dattabiplab/CompetitiveProgramming | Code Forces/DCC-CP A2OJ/A_Watermelon.cpp | #include <iostream>
using namespace std;
int main(){
int w;cin >>w;
if (w>2){
if((w==0) || (w%2!=0)){
cout<<"NO"<<endl;
}
else if (w%2==0){
cout<<"YES"<<endl;
}
}
else{
cout<<"NO"<<endl;
}
return 0;
} | ALGO | 0.999886 | 3.229729 |
04e1a09b-effc-4ac9-8aa7-aca6cf40ef71 | peng-yq/the-way-to-find-a-job | algo-learning/dynamic_programming/edit_distance_problem/edit_distance_problem.cpp | #include <bits/stdc++.h>
using namespace std;
int editDistanceDP(string s, string t) {
int n = s.size(), m = t.size();
vector<vector<int>> dp(n+1, vector<int>(m+1, 0));
for (int j = 1; j < m+1; j++)
dp[0][j] = j;
for (int i = 1; i < n+1; i++)
dp[i][0] = i;
for (int i = 1; i < n+1; i... | ALGO | 0.999997 | 5.510505 |
19683794-d1b8-4114-b274-b5ffbb0488ef | Divyansh1316/3rd-SEM | C++/pat3.cpp | #include <iostream>
using namespace std;
/*int main()
{
int n, row, col, num = 1;
cout << "Enter number of lines : ";
cin >> n;
for (row = 1; row <= n; row++)
{
int currentNum = num + 2 * (row - 1);
for (col = 1; col <= row; col++)
{
cout << currentNum << " ";
... | ALGO | 0.999554 | 3.930228 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.