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 |
|---|---|---|---|---|---|---|
48f80556-7007-48bb-a1aa-171efc642009 | aditya-agr/GeeksForGeeks-POTD | Subset Sum Problem.cpp | class Solution {
public:
bool solve(vector<int> &arr, int sum, int i, vector<vector<int>> &dp){
if(sum == 0)
return true;
if(i == arr.size())
return false;
if(dp[i][sum]!=-1)
return dp[i][sum];
bool pick = false, nopick = false;
if(arr[i]... | ALGO | 0.999987 | 5.860886 |
101dbf76-5a4c-4f87-80e5-eb7179b398b3 | EinPy/Competition_lib | ICPC_Practice/Dp/minCoin.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int coins, targ;
cin >> coins >> targ;
vector<int> dp(targ+ 1, 1e9);
vector<int> c;
int a;
while (coins--)... | ALGO | 0.999956 | 4.241323 |
5ee33b58-4a80-4f79-83b4-b64f38af0669 | md-mudassir7/Cpp-programs-list | maxSumProblem.cpp | #include<bits/stdc++.h>
using namespace std;
int getMaxSum(int n)
{
int dp[n+1]={0};
for(int i=1;i<=n;i++)
{
dp[i]=max(i,dp[i/2]+dp[i/3]+dp[i/4]);
}
return dp[n];
}
int main()
{
//A number n can be broken into three parts n/2, n/3 and n/4 (consider only integer part).
//Each number o... | ALGO | 0.999976 | 4.585958 |
91363977-cc0f-4a6c-9c06-75dc6caaf692 | bol-edu/2020-fall-ntu | final-project/repositories/Key-enabled_Secure_Access_and_Execution_Environment_for_Vehicles(KSAE)/2020_MSOC_FINAL-master/ecdsa_sign/src/ecdsa_tb.cpp | #include "ecdsa.hpp"
#ifndef __SYNTHESIS__
#include <iostream>
#endif
void ecdsa_sign(ap_uint<256> hash,
ap_uint<256> k,
ap_uint<256> privateKey,
ap_uint<256>& Qx,
ap_uint<256>& Qy,
ap_uint<256>& r,
ap_uint<256>& s,
bool& kValid) {
#pragma HLS INTER... | ALGO | 0.997864 | 5.701524 |
0dc975f2-4eaa-45f2-98fd-330dd33851f6 | shreyagupta428/CPP_codes | job_sequencing.cpp |
#include<iostream>
#include<algorithm>
using namespace std;
struct Job
{
char id;
int dead;
int profit;
};
bool comparison(Job a, Job b)
{
return (a.profit > b.profit);
}
void printJobScheduling(Job arr[], int n)
{
sort(arr, arr+n, comparison);
int result[n];
bool slot[n];
for (int i=0; i<n; i++)
slot... | ALGO | 0.99995 | 4.960451 |
0881150c-a5d4-4389-9b9a-35471e13d6da | CodeTest-StudyGroup/Code-Test-Study | EmilyPaek/[5] 백준/14891_톱니바퀴.cpp | #include <cstdio>
#include <deque>
#include <cmath>
using namespace std;
deque<int> sawtooth[4];
int K;
bool isCheck[4];
int answer = 0;
void Input(){
char dir;
for(int i=0; i<4; i++){
for(int j=0; j<8; j++){
scanf("%c", &dir);
if(j==7) getchar();
sawtooth[i].push_ba... | ALGO | 0.99965 | 3.739729 |
39a47ab0-bf3b-4baa-9ed5-e42fafe670f4 | fuguigui/Computer-graphics | Wave0702_v1.0/fluid.cpp | #include<stdlib.h>
#include"fluid.h"
#include"test.h"
Fluid::Fluid(long n, long m, float d, float t, float c, float mu)
{
width = n; //
height = m; //߶
long count = n * m; //
buffer[0] = new Vector3D[count]; //1
buffer[1] = new Vector3D[count]; //2
renderBuffer = 0; //Ⱦ
normal =... | ALGO | 0.85588 | 3.467246 |
4fb08c7e-8105-4d9e-9b31-2d6d1a2772e2 | virajgudhetwar/DSA-SHEET- | 04.Searching & Sorting/02.countingSort.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
#define RANGE 255
// } Driver Code Ends
//User function Template for C++
class Solution{
public:
//Function to arrange all letters of a string in lexicographical
//order using Counting Sort.
string countS... | ALGO | 0.999978 | 5.990562 |
09bf728d-5067-4001-9169-6cd44745765e | knockcat/CodeForces | Codeforces Round 993 (Div. 4)/a.cpp | // JAI SHREE RAM
// KNOCKCAT
#include <bits/stdc++.h>
using namespace std;
#define fast \
std::ios::sync_with_stdio(false); \
cin.tie(nullptr);
#define int long long int
#define endl "\n"
typedef unsigned long long ull;
typedef long long ll;
typedef long double ld;
const ll mod = 1e... | ALGO | 0.999623 | 4.816722 |
63f076ad-365c-40ed-a0d5-0668b9d624aa | Rajeshnds/Competitive-Programming | codeforces/dragonmas/codeforces(c++)_old/Kyoya_and_Photobooks.cpp | #include<bits/stdc++.h>
using namespace std;
string s;
main(){
cin>>s;
cout<<26*(s.size()+1)-s.size();
}
| ALGO | 0.99719 | 3.384914 |
4838900b-76be-4e42-8003-1b08cb35dca1 | ISOLDE-Project/riscv-llvm | llvm/lib/Transforms/Utils/MoveAutoInit.cpp | #include "llvm/Transforms/Utils/MoveAutoInit.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Analysis/MemorySSA.h"
#include "llvm/Analysis/MemorySSAUpdater.h"
#include "llvm/Analysis/ValueTracking.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/IRBui... | ALGO | 0.997147 | 7.795714 |
7bd2f666-3e66-4d61-8be4-5a7c5c1a87bf | cormoran/CompetitiveProgramming | src/contest/codeforces/354div2/A/A.comp.cpp | #include<iostream>
#include<vector>
#include<cassert>
#include<string>
#include<algorithm>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<stack>
#include<queue>
#include<set>
#include<map>
#include<tuple>
#include<numeric>
using namespace std;
using pii = pair<int,int>;
using ll = long long;
#define rep(i... | ALGO | 0.999567 | 4.136224 |
43b220f2-481d-4991-b08f-68d311e7dae4 | noob-nilarghya/Striver-SDE-Sheet | Day-17/treeTraversal.cpp | // 3 Traversal (Normal Way - any one can do !)
vector<int> in; vector<int> pre; vector<int> post;
void inOrder(BinaryTreeNode<int>* root){
if(root==NULL){ return; }
inOrder((*root).left);
in.push_back((*root).data);
inOrder((*root).right);
return;
}
void preOrder(BinaryTreeNode<int>* root){
... | ALGO | 0.999988 | 5.822625 |
cf210679-29d1-4ea3-87d2-bb68442eb869 | atharva9699/Daily_Programming_Challenge | first_Ass.cpp | #include <bits/stdc++.h>
void sort012(int *arr, int n)
{
int low = 0, mid = 0, high = n - 1;
while (mid <= high) {
if (arr[mid] == 0) {
swap(arr[low], arr[mid]);
low++;
mid++;
} else if (arr[mid] == 1) {
mid++;
} else { // arr[mid] == 2
... | ALGO | 0.999866 | 4.475243 |
7441634d-4bc3-4f7b-ba9e-3b0cbf944dbf | uvafan/ICPC_Practice | uhunt/821.cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> ii;
typedef vector<ii> vii;
typedef vector<int> vi;
#define INF 1000000000
int main(){
int a,b,i,j,k;
int coun = 0;
while(1){
coun++;
cin>>a>>b;
if(!a&&!b)break;
vector<vi> adjMat(100,vi(100,INF));
f... | ALGO | 0.988637 | 3.777561 |
3b46a904-b157-48fc-9e9d-8bd93d4cc65e | rbfxSamples/rbfx-2 | Source/ThirdParty/Bullet/Bullet/BulletCollision/CollisionShapes/btConvex2dShape.cpp | #include "btConvex2dShape.h"
btConvex2dShape::btConvex2dShape(btConvexShape* convexChildShape) : btConvexShape(), m_childConvexShape(convexChildShape)
{
m_shapeType = CONVEX_2D_SHAPE_PROXYTYPE;
}
btConvex2dShape::~btConvex2dShape()
{
}
btVector3 btConvex2dShape::localGetSupportingVertexWithoutMargin(const btVector3... | ALGO | 0.886294 | 7.572961 |
ac6c4eac-1b19-4cb5-b1e1-39bbf4847f69 | AdrianArceredillo/GarapenIngurumenak | 2_Dev_C/Swith_ariketak/ariketa5.cpp |
#include <stdio.h>
#include <string.h>
int main(){
int zenb;
char oper;
printf("Sartu zenbaki bat: \n");
scanf("%d",&zenb);
printf("Escribe 'p' para saber si es PAR o 'i' para saber si es IMPAR: \n");
scanf(" %c",&oper);
switch(oper){
case 'p':
if (zenb%2==0) {
p... | ALGO | 0.999579 | 3.401123 |
f8a8c3ae-78d2-44fa-9242-4683dd555c93 | youessaitch/myDSA | 2586-longest-square-streak-in-an-array/2586-longest-square-streak-in-an-array.cpp | class Solution {
public:
// int n;
// vector<vector<int>> dp;
// int solve(int i, int prev, vector<int>&nums){
// if(i>=n) return 0;
// if(dp[i][prev+1]!=-1) return dp[i][prev+1];
// int take = 0;
// if(prev==-1 || nums[i] == nums[prev]*nums[prev]){
// take = 1... | ALGO | 0.999959 | 4.949282 |
374c6ca0-e636-40c7-b45c-17897fc110c2 | cod4i3/MyAtcoder | ABC100_199/ABC159/d.cpp |
#include <algorithm>
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;
using ll = long long;
#define FOR(i, n) for (ll i = 0; i < (ll)(n); i++)
#define all(x) (x).begin(), (x).end()
int main() {
ll N;
cin >> N;
vector<ll> A(N), B(N);
FOR(i, N) {
cin >> A[i];
B[i] = A[i];
... | ALGO | 0.999941 | 3.70683 |
47df054f-105e-4820-986e-3eb5161c7e0c | ishandutta2007/codeforces | greenheadstrange/normal/1726/C.cpp | #include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define fi first
#define se second
#define pb push_back
#define vi vector<int>
#define pi pair<int, int>
#define mod 998244353
template<typename T> bool chkmin(T &a, T b){return (b < a) ? a = b, 1 : 0;}
template<typename T> bool chkmax(T &a, T b){return... | ALGO | 0.999785 | 4.382683 |
3f990ce5-4772-49d3-a610-535bc1fad6e9 | nysanier/cf | cf/contest/cf603/1263C.cpp | #include "bits/stdc++.h"
int t;
void Case() {
std::set<int> setx;
int n;
scanf("%d", &n);
setx.insert(0);
for (int k = 1; k * k <= n; ++k) {
setx.insert(k);
setx.insert(n / k);
}
printf("%d\n", (int)setx.size());
for (auto v : setx) {
printf("%d ", v);
}
... | ALGO | 0.998774 | 4.527238 |
b5932f0e-3cff-4f40-bc2e-df546e5c569b | CarolineRinks/CS302 | crypto/Crypto2.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
#include <iomanip>
using namespace std;
#include "PPM.h"
#include "Rnumgen.h"
const char ETX = 0x3;
struct pixel {
pixel(int r=0, int c=0) { row = r; col = c; }
int row;
int col;
};
/* @brief: Populates a vector with al... | TOOL | 0.96888 | 4.85875 |
1e59a2fa-a3f4-4350-a04e-f1d6cf0c567f | ishandutta2007/codeforces | monkeyking/normal/1058/C.cpp | #include <iostream>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <map>
#include <queue>
#include <set>
#include <string>
#include <string.h>
#include <stack>
#define Endl endl
#define mp make_pair
#define rep(N) for(int i=0;i<N;i++)
#define repj(N) for(int j=0;... | ALGO | 0.999965 | 3.621262 |
9d42d07e-8f50-46a5-8a4c-ca83e016da0e | s0urav6529/Codeforces-Solutions | 1208B CF.cpp | #include<bits/stdc++.h>
#define fast ios::sync_with_stdio(0);cin.tie(0);
using namespace std;
using ll=long long;
using dd=double;
set<ll>s;
int a[2005],prefix[2005],suffix[2005];
void solve()
{
int n;
cin>>n;
int ans=0;
map<int,int>mp;
for(int i=1;i<=n;i++) {
cin>>a[i];
mp[a[i]]++;... | ALGO | 0.999595 | 3.287043 |
e6a9e896-cba2-492e-85bb-3f90372a3fce | Rahul735124/D.S.A-Problem-solution- | Painter's_Partition_Problem.cpp | #include<iostream>
using namespace std;
// NO SOLUTION, THERE is EROR
bool ispossible(int arr[],int m,int n,int mid){
int StudentCount=1;
int PageSum=0;
for(int i=0;i<n;i++){
if(PageSum+arr[i]<=mid){
PageSum+=arr[i];
}
else{
StudentCount++;
... | ALGO | 0.999992 | 4.771209 |
d9cedfbf-efd9-4956-b0cb-9037c709e6a3 | shah-zx/plus-plus-C | .history/Unordered map/vir_20220826221540.cpp | #include <bits/stdc++.h>
#include <stack>
#include <queue>
#include <math.h>
#include <limits.h>
#include <algorithm>
#include <unordered_set>
#include <unordered_map>
using namespace std;
#define vi vector<int>
#define vii vector<pair<int, int>>
#define pii pair<int, int>
#define rep(i, a, b) for (int i = a; i < b; i+... | ALGO | 0.999984 | 4.132557 |
d06a6db3-ac94-4697-a20a-940127272efd | Coldereac/Algorithms | Prakt7/main.cpp | //
// Created by malinka on 22.10.24.
//
#include <iostream>
#include "functions.h"
int main() {
cout << "Forming a tree. Enter first student:\n";
tree *root = formTree();
displaySymmetrical(root);
string name;
float grade;
cout << "Enter student to delete: ";
cout << "Enter student name: ... | ALGO | 0.978799 | 3.875494 |
d21a1707-ebc5-4ec6-82da-89b401f921e8 | BryanYangZL/LeetCode | src/0031-next-permutation.cpp | /*
Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.
If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order).
The replacement must be in-place and use only constant extra memory.
Here are so... | ALGO | 0.999928 | 5.924881 |
9ad9367b-445f-408b-83e8-309253296f44 | vanitas-23/Daily_progress | 1627-last-moment-before-all-ants-fall-out-of-a-plank/1627-last-moment-before-all-ants-fall-out-of-a-plank.cpp | class Solution {
public:
int getLastMoment(int n, vector<int>& left, vector<int>& right) {
int ans = 0;
for (int num : left)
ans = max(ans, num);
for (int num : right)
ans = max(ans, n - num);
return ans;
}
}; | ALGO | 0.999863 | 5.86906 |
7efff635-5cc6-4ee5-b40c-cc1450c99d06 | russellfolk/Cpp-Primer | Chapter 01/Exercise-1.9.cpp | /**
* Exercises Section 1.4.1
* Exercise 1.9
* C++ Primer, 5th Edition
* @author Russell Folk
*
* Write a program that uses a `while` to sum the numbers from 50 to 100.
*/
#include <iostream>
int main()
{
int sum = 0, n = 50;
while (n <= 100)
{
sum += n;
++n;
}
std::cout << "The sum of the numbers b... | ALGO | 0.998997 | 3.468594 |
19a8f404-28b3-4434-9a61-5da82eabaae3 | Komal-J04/DSA | Recursion/aggressiveCows.cpp | #include<iostream>
#include<limits.h>
using namespace std;
void print(int *arr, int size)
{
cout<<"The array is - ";
for(int i=0;i<size;i++)
{
cout<<arr[i]<<" ";
}
cout<<endl;
}
void sort(int *arr, int n)
{
bool swapped = false;
for(int i=0;i<n ;i++)
{
int maxi=arr[i... | ALGO | 0.999981 | 4.413285 |
8bf3cd0e-2789-4700-87ee-cdde94f462bb | DeveloperAkashx/Cpp | areaperimeter.cpp | #include<iostream>
using namespace std;
int main()
{
float l,b;
float area = l*b;
float perimeter = 2*(l+b);
cout<<"Enter the length : ";
cin>>l;
cout<<"Enter the Breadth : ";
cin>>b;
cout<<"Area is : "<<l*b<<endl;
cout<<"Perimeter is "<<2*(l+b)<<endl;
if( area > perimeter )
{
cout<<"Area ... | ALGO | 0.999261 | 3.491329 |
f2d898cc-d38c-4d4a-be6a-d362b0462454 | bradleybossard/c-plus-plus-practice | bitset.cpp | #include <iostream>
#include <bitset>
using namespace std;
int main() {
// Initial bitset of size 10, initialized to 0.
bitset <10> s;
s[0] = 1;
for (int i = 0; i < 10; i++) {
cout << s[i] << " ";
}
cout << endl;
// Alternate method for creating bitset
// Note that string get cut off after 1... | TOOL | 0.994155 | 4.397375 |
77c59087-fca1-4ea7-9112-768c570ebaf2 | TheStranger512/Competitive-Programming-Stuff | SPOJ/WTK.cpp | /* Solved
* 10285. Why this kolaveri di
* File: WTK.cpp
* Author: Andy Y.F. Huang
* Created on March 29, 2013, 12:55 PM
*/
#include <algorithm>
#include <bitset>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#i... | ALGO | 0.997691 | 3.939985 |
ae588b27-bf88-4216-bb06-82f4b6f48bc2 | how3v3r/study | navigation-noetic-devel/base_local_planner/src/latched_stop_rotate_controller.cpp | /*
* latched_stop_rotate_controller.cpp
*
* Created on: Apr 16, 2012
* Author: tkruse
*/
#include <base_local_planner/latched_stop_rotate_controller.h>
#include <cmath>
#include <Eigen/Core>
#include <angles/angles.h>
#include <nav_msgs/Odometry.h>
#include <base_local_planner/goal_functions.h>
#include... | TOOL | 0.953146 | 6.801949 |
75ba7470-a867-443c-99cd-553ad2f7f1e1 | TusharCanCode/400-Questions-Babbar-Sheet | Array_ques_4.cpp | #include <bits/stdc++.h>
using namespace std;
void sort012(int a[], int n)
{
int one = 0;
int zero = 0;
int two = 0;
for (int i = 0; i < n; i++)
{
if (a[i] == 0)
zero++;
else if (a[i] == 1)
one++;
else
two++;
a[i] = 2;
}
f... | ALGO | 0.999813 | 5.148681 |
6d54fe71-340a-4e26-ae07-b495b5afb16c | KhaledAbdelgalil/competitive-programming-book | chapter 3/problems/Complete Search/Iterative(Two Nested Loops)/01260.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
std::ifstream in ("input");
std::streambuf * cinbuf = std::cin.rdbuf (); //save old buf
std::cin.rdbuf (in.rdbuf ()); //redirect std::cin to in.txt!
int t;
cin>>t;
while(t--){
int n;
cin>>n;
std::vecto... | ALGO | 0.999552 | 3.903227 |
bf826b03-472c-4980-9d3c-bce6448f8cea | Asad51/Data_Structures_And_Algorithms | Backtracking/GraphColoring.cpp | #include "bits/stdc++.h"
using namespace std;
class GraphColoring
{
int numOfNode;
vector<int>color;
int s;
public:
GraphColoring(int n){
numOfNode = n;
for(int i=0; i<n; i++){
color.push_back(-1);
}
s = 0;
}
void printSolution(){
cout<<"Solution #"<<++s<<endl;
for(int i=0; i<color.size(); i++){
... | ALGO | 0.999849 | 4.513591 |
69d17411-87a0-4c88-8914-ca3175ae4c7d | hakomori64/atcoder | abc/113c.cpp | #include <bits/stdc++.h>
#define REP(i, n) for(ll i = 0; i < n; i++)
#define REPR(i, n) for(ll i = n; i >= 0; i--)
#define FOR(i, m, n) for (ll i = m; i < n; i++)
#define INF LLONG_MAX
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
int mai... | ALGO | 0.999944 | 3.804082 |
72fa33ca-86f5-4942-96d7-43ed5c799023 | muradmia/batch-3_Algorithm | Module 5/adjlist_undirect_graph.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 1e5+5;
vector<pair<int,int>>adj[N];
int main(){
int n,m;
cin>>n>>m;
for(int i=0;i<m;i++){
int u,v,data;
cin>>u>>v>>data;
adj[u].push_back({v,data});
adj[v].push_back({u,data});
}
for(int i=1;i<=n;i++){
... | ALGO | 0.999472 | 3.838248 |
29280074-2d0c-4112-8023-1b7be31ccbe0 | SuuTTT/acm | kattis_Uva_jisuanke/rmc17-public/b.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i = (int)j;i <= (int)k;i ++)
#define debug(x) cerr<<#x<<":"<<x<<endl
const int maxn=(int)1e6+5;
typedef long long ll;
void rd(int& n){cin>>n;}
void print(ll n){cout<<n<<endl;}
namespace Dinic {
const int N = 1e4 + 7, M = 2e5 + 7;
const ll... | ALGO | 0.999867 | 3.286089 |
4e444100-4526-4167-95ff-7405d094942f | Deadly-Smile/UVa_codes | 10107 - What is the Median?.cpp | //----------------------Created by Anik Saha---------------------------//
#include <bits/stdc++.h>
using namespace std;
#define FastIO ios_base::sync_with_stdio(false); cin.tie(NULL)
#define Ignore cin.ignore()
typedef unsigned char Byte;
typedef long long ll;
typedef unsigned long long ull;
typedef std::pair<int, ... | ALGO | 0.999968 | 4.626294 |
c8c89c97-dc7a-4e87-946e-89ef12a3f1b7 | TrifanBogdan24/Probleme-PBINFO | pbinfo/coduri-cpp/clasa-IX/chenar2.cpp | // #2825 - Chenar2
#include <iostream>
using namespace std;
int nr;
int main()
{
// declararea si initializarea variabilelor
int n = 0, m = 0, x = 0, a[105][105];
for (int i = 0; i < 105; i++)
for (int j = 0; j < 105; j++)
a[i][j] = 0;
// citirea matricii
cin >> n >> m... | ALGO | 0.999897 | 4.806328 |
41bfd0ee-9998-42fe-a0e5-dbb914a0cb94 | JayKapadia389/daily_leetcode | maximum-employees-to-be-invited-to-a-meeting.cpp | class Solution {
public:
int maximumInvitations(vector<int>& favorite) {
int n = favorite.size();
vector<vector<int>> reversedGraph(n);
for (int person = 0; person < n; ++person) {
reversedGraph[favorite[person]].push_back(person);
}
// Helper function for BFS
... | ALGO | 0.999936 | 6.033373 |
912e70b7-80d9-4853-af9d-b6dc3163fe37 | sumanthneerumalla/proj4a | test3.cpp | // File: test3.cpp
//
// CMSC 341 Spring 2017 Project 4
//
// Check insert, deleteMin and deleteMax
// with MinMaxHeap instantiated with NoCopyString class.
//
// Should compile with: g++ test3.cpp NoCopyString.cpp
//
#include <iostream>
#include <string>
#include "MinMaxHeap.h"
#include "NoCopyString.h"
using nam... | TEST | 0.930024 | 5.893157 |
ac351184-77c6-4805-a1d4-eeb675455e19 | Pulkith/Competitive | CodeForces/1486/b/b.cpp | /**
*
* author: DespicableMonkey
* created: 05.03.2021 00:32:57
*
* Potatoes FTW!
*
**/
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <sstream>
#include <cmath>
#include <cstdio>
#include <deque>
#include <bitset>
#include <iterator>
#include <queue>
#inclu... | ALGO | 0.99984 | 4.337621 |
6b30a999-3bef-4499-82a2-ecb5dd07be26 | 77Arafat383/Previous-contest-problem | B_Little_Girl_and_Game.cpp | //**************BISMILLAHIR RAHMANIR RAHIM****************
//*******************Md Yeasin Arafat****************
#include<bits/stdc++.h>
using namespace std;
#define check cout<<'?'<<endl;
#define ll long long
const int M = 1e9+7;
const ll bM = 998244353;
const ll INF = 1e18;
#define all(x) ... | ALGO | 0.999997 | 4.388369 |
e61ed676-41ea-48b1-8aa0-097996792cf3 | ByteofSpaghetti/CMP-102 | Dartboard.cpp | #include "Dartboard.h"
#include "Player.h"
#include <ctime>
Dartboard::Dartboard() {
srand(time(NULL));
}
Dartboard::~Dartboard() {
}
int Dartboard::throw_bull(int p) {
// Throw for the bull with accuracy p% (20<p<85)
int r = rand() % 100;
if (r < (p - 20))
{
return 50;
}
else if (r < 85)
{
return ... | ALGO | 0.939061 | 4.635612 |
6f664355-3656-4f1b-8651-91c8f74e8ce2 | ShawnTSH1229/XEngine | ThirdParty/boost_1_78_0/libs/sort/example/sample.cpp | // See http://www.boost.org/libs/sort for library home page.
#include <boost/sort/spreadsort/spreadsort.hpp>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <vector>
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
using namespace boost::sort::spreadso... | ALGO | 0.991883 | 4.604353 |
326dab16-8235-4020-bf9b-903bbc49946d | nhz2/BNK-E100-reader | firmware/libraries/SdFat/src/ExFatLib/upcase.cpp | #include "upcase.h"
#ifdef __AVR__
#include <avr/pgmspace.h>
#define TABLE_MEM PROGMEM
#define readTable8(sym) pgm_read_byte(&sym)
#define readTable16(sym) pgm_read_word(&sym)
#else // __AVR__
#define TABLE_MEM
#define readTable8(sym) (sym)
#define readTable16(sym) (sym)
#endif // __AVR__
struct map16 {
uint16_... | TOOL | 0.892998 | 5.971581 |
0cb4e81e-e296-42ec-885d-123010e8c8c5 | OneBitPython/Codeforces | Round811/C_Minimum_Varied_Number.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(unsigned x)... | ALGO | 0.999846 | 5.33546 |
950106bc-74b2-4c8f-b6c0-0b40108aaacb | allem40306/Competitive-Programming | uva/Volume004/uva00483.cpp | #include <iostream>
#include <string>
#include <sstream>
using namespace std;
#define gor(a,b,c) for(a=b;a<c;a++)
void ooo(string a){
int len=a.length();
for(int i=len-1;i>=0;i--)
printf("%c",a[i]);
}
int main() {
string s;
while(getline(cin,s)){
stringstream ss(s);
string w;
int o=0;
while(ss>>w){
... | ALGO | 0.998917 | 3.627465 |
ce915152-e189-47d9-89ba-8d03b5e39f58 | BeezCrypto/BeezCore | src/beez-cli.cpp | #include "chainparamsbase.h"
#include "clientversion.h"
#include "rpcclient.h"
#include "rpcprotocol.h"
#include "util.h"
#include "utilstrencodings.h"
#include <boost/filesystem/operations.hpp>
#define _(x) std::string(x) /* Keep the _() around in case gettext or such will be used later to translate non-UI */
using... | WEB | 0.969364 | 6.979091 |
294038b8-1aea-455d-a288-f4c8759a27b0 | pegvr/proj_phase1 | CosineSim.cpp | #include "CosineSim.h"
CosineSim::CosineSim(string temp,string temp1)
{
name = temp1; //Name = itemY
id=temp; //id = distances from other items
length = id.length();
}
CosineSim::CosineSim(const CosineSim& orig) {
}
CosineSim::~CosineSim()
{
//cout << "Cosine is des... | ALGO | 0.971283 | 3.504871 |
8e53fa0d-0036-4486-bae5-e3c8e9009f64 | Shikhar8990/CGO_Project | scripts/program_analyzer_fraction_of_accesses_to_pages_which_have_x_unique_cachelines_touched_cnn.cpp | #include <iostream>
#include <fstream>
#include <deque>
#include "map"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <sstream>
#include <iomanip>
#include <bitset>
#include <climits>
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/filtering_stream.hpp... | ALGO | 0.913261 | 3.612891 |
1416eb34-7c8c-4c81-8179-016974291723 | Anur4ik/C-Plus | laba12/laba12(1).cpp | #include <iostream>
using namespace std;
int main() {
int vector[] = {3, -50, 7, 10, -4, 14, 5, 2, -13};
int n = sizeof(vector) / sizeof(vector[0]);
int *p = vector;
int *minNumber = vector;
for (int i = 0; i < n; i++) {
if (*minNumber > *(p + i)) {
minNumber = p + i;
}
// cout << p + i<< endl;
}
... | ALGO | 0.999824 | 3.436328 |
264933ca-1990-4555-823f-7f6736002350 | yokojin/Pointers-and-links | 14 неделя.cpp | // 14 неделя.cpp : Этот файл содержит функцию "main". Здесь начинается и заканчивается выполнение программы.
//
#include <iostream>
using namespace std;
void distriBution(int* SIZEa) {
cout << "\tInput size Array: ";
cin >> (*SIZEa);
cout << endl;
}
int* test(int *&pA, int SIZEa) {
*&pA = new int[SIZEa];
return p... | ALGO | 0.997254 | 3.840446 |
a317db0d-b187-43b2-b361-5e59cb09c1fc | Prashanth261993/LeetCodeExercises | count_primes/count_primes.cpp | //https://leetcode.com/problems/count-primes/
#include<iostream>
#include<math.h>
#include<vector>
using namespace std;
int countPrimes(int n) {
if(n<=1)
return 0;
vector<int> prime_numbers;
prime_numbers.reserve(sqrt(n));
if(n%2 == 0)
{
prime... | ALGO | 0.999728 | 5.181743 |
a21d6975-8d99-49b1-93ab-ed3354e3c3e6 | sarvex/solution-cpp | 0687.longest_univalue_path.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.999683 | 6.592721 |
a41b3a62-ef0e-4af3-89b2-ff8d9b6c53a4 | joker-eph/mlir-filtered | mlir/lib/Dialect/Arith/Transforms/EmulateWideInt.cpp | #include "mlir/Dialect/Arith/Transforms/Passes.h"
#include "mlir/Dialect/Arith/IR/Arith.h"
#include "mlir/Dialect/Arith/Transforms/WideIntEmulationConverter.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Func/Transforms/FuncConversions.h"
#include "mlir/Dialect/Vector/IR/VectorOps.h"
#include "mli... | TOOL | 0.96166 | 6.066419 |
99303aef-a457-4110-b23a-5530d4c60235 | Raja58/Sorting | Gridland Metro.cpp | // <!--
// ============================
// @Author : raja_5
// @Version : 1.0
// @Date : 22 Nov 2021
// @Detail : Gridland Metro (HackerRank)
// ============================
// -->
bool myComp(vector<int> &a, vector<int> &b)
{
if(a[0] == b[0])
return a[1] < b[1];
... | ALGO | 0.999556 | 5.254052 |
3cb773a7-6837-471f-9ef8-32b5c43c06f6 | salman415-462/phishing-email-detector | backend/venv/lib/python3.10/site-packages/sklearn/utils/src/MurmurHash3.cpp | // Note - The x86 and x64 versions do _not_ produce the same results, as the
// algorithms are optimized for their respective platforms. You can still
// compile and run any of them on any platform, but your performance with the
// non-native version will be less than optimal.
#include "MurmurHash3.h"
//-------------... | ALGO | 0.997659 | 7.200464 |
bb7840e4-daca-4d70-917d-2acf99803f09 | morris821028/UVa | volume114/11407 - Squares.cpp | #include <stdio.h>
#define oo 10000
int main() {
int t, N, i, j;
scanf("%d", &t);
long long DP[10001] = {};
DP[0] = 0;
for(i = 1; i <= 10000; i++) DP[i] = oo;
for(i = 1; i <= 100; i++) {
for(j = i*i; j <= 10000; j++)
DP[j] = DP[j] < DP[j-i*i]+1 ? DP[j] : DP[j-i*i]+1;
}
while(t--) {
scanf("%d", &N);
pri... | ALGO | 0.99941 | 3.596725 |
a2cf5129-fbe1-4d2c-8d65-7a4db310aeaf | arjo31/Personal-DSA-Problems | Tree/Binary Tree/level_order_traversal.cpp | /*Given the root of a binary tree, return the level order traversal of its nodes' values. (i.e., from left to right, level by level).*/
#include "binary_tree.h"
void levelOrder(TreeNode *root)
{
queue<TreeNode *> q;
if (root == nullptr)
return;
q.push(root);
while (!q.empty())
{
Tr... | ALGO | 0.999766 | 5.166084 |
b9e65f45-f162-42a3-99f7-ac59c8fe0a95 | ishandutta2007/codeforces | 137_345_2814/normal/1091/B.cpp | #include<cstdio>
using namespace std;
int lm=1e8,rm=1e8,ls=-1e8,rs=-1e8,n,a,b;
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%d%d",&a,&b);
if(a<lm||(a==lm&&b<rm))lm=a,rm=b;
}
for(int i=1;i<=n;i++)
{
scanf("%d%d",&a,&b);
if(a>ls||(a==ls&&b>rs))ls=a,rs=b;
}
printf("%d %d\n",lm+ls,rm+rs);
} | ALGO | 0.999931 | 3.679558 |
711bbfd7-4c74-4a55-a336-807b06d63626 | amitesh-singh/algorithms | algo/searching/BinarySearch/BinarySearch.cpp | #include<iostream>
#include<vector>
using namespace std;
template<typename T1,typename T2>
int BinarySearch(T2 &arr,int arrSize,T1 &key)
{
int lo =0,mid,hi = arrSize - 1;
while(lo <= hi)
{
mid = (lo + hi)/2;
if(key<arr[mid])
hi = mid - 1;
else if(key > arr[mid])
lo = mid + 1;
else
return mid;
}
... | ALGO | 0.999909 | 4.563549 |
0b0c3c71-4cbc-4420-8537-a767ccec7a03 | Noodle3D/ZCookie | algorithm/HDU/HDU1090 A+B for Input-Output Practice (II).cpp | #include<stdio.h>
#include<stdlib.h>
int main()
{
int t,a,b;
scanf("%d",&t);
while(t--)
{
scanf("%d%d",&a,&b);
printf("%d\n",a+b);
}
return 0;
}
| ALGO | 0.999597 | 3.958168 |
bb4ca461-962c-4f30-aa06-12f0816ad817 | DrCod/my-daily-coding-problem-solutions | StanfordCPPLib/util/stringutils.cpp | /*
* File: stringutils.cpp
* ---------------------
* This file contains implementations of utility functions related to strings.
* See stringutils.h for documentation of each member.
*
* @author Marty Stepp
* @version 2017/10/20
* - changed string to const string& in all functions
* @version 2016/11/09
* - a... | TOOL | 0.968529 | 6.986712 |
a010ff6a-287d-47f5-9005-fce9f38d6c0a | SrayanBhattacharyya/CP_SolvedProblems | codeforces/813/B.cpp | //Srayan Bhattachrayya JU EE
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ld long double
const ll INF = 1e18;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cout << fixed;
cout << setprecision(0);
ld x, y;
cin >> x >> y;
ld l, r;
cin ... | ALGO | 0.999868 | 3.668928 |
7f07d2e8-e159-4004-93ca-757fc2842b5c | bluewhitesheen/Leetcode | matrix-diagonal-sum/Accepted/12-23-2022, 10_28_10 PM/Solution.cpp | // https://leetcode.com/problems/matrix-diagonal-sum
class Solution {
public:
int diagonalSum(vector<vector<int>>& mat) {
int ans = 0;
for(int i = 0; i < mat.size(); i++){
if(mat.size() - 1 - i - i)ans += mat[i][i] + mat[mat.size() - 1 - i][i];
else ans += mat[i][i];
... | ALGO | 0.999971 | 5.973505 |
aba125fc-76f7-493f-be94-95b8add8307c | HentaiOS-Joyeuse/platform_frameworks_av | media/codecs/m4v_h263/dec/src/zigzag_tab.cpp | #include "mp4dec_api.h"
#include "mp4def.h"
#include "zigzag.h"
/*----------------------------------------------------------------------------
; MACROS
; Define module specific macros here
----------------------------------------------------------------------------*/
/*----------------------------------------... | ALGO | 0.995992 | 3.532503 |
addf2521-0b4a-40a1-b619-1b30608a2ee8 | WYK15/swift-Ollvm12 | clang-tools-extra/clang-include-fixer/IncludeFixer.cpp | #include "IncludeFixer.h"
#include "clang/Format/Format.h"
#include "clang/Frontend/CompilerInstance.h"
#include "clang/Lex/HeaderSearch.h"
#include "clang/Lex/Preprocessor.h"
#include "clang/Parse/ParseAST.h"
#include "clang/Sema/Sema.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/raw_ostream.h"
#define DE... | TOOL | 0.924168 | 6.150492 |
c27e6210-b770-40da-9c51-7a78c9b714f2 | manishSRM/solvedProblems | interviewPro/majorityele.cpp | #include <cstdio>
#include <algorithm>
#include <iostream>
#include <cmath>
#include <vector>
#include <limits.h>
#include <stack>
#include <sstream>
#include <queue>
#include <iomanip>
#include <list>
#include <set>
#include <deque>
#include <bitset>
#include <map>
#include <assert.h>
#include <utility>
#include <stri... | ALGO | 0.999938 | 3.982002 |
481d13e4-7fcb-4100-aceb-642034570174 | GChalkidis/Guidely | 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 |
a4d0db7c-9d99-4e69-82a7-79affb6ca1fe | jeete121/Coding | Programs/Practice/Prac/GraphAlgorithms/implement_queue_using_stacks.cpp | #include <bits/stdc++.h>
using namespace std;
class MyQueue
{
public:
stack<int> s1;
stack<int> s2;
void push(int x)
{
while (!s1.empty())
{
s2.push(s1.top());
s1.pop();
}
s1.push(x);
while (!s2.empty())
{
s1.push(s2.t... | ALGO | 0.980471 | 4.783006 |
79ff97af-9b23-4bd8-a625-eea1213441fb | ordinary-developer/lin_education | books/techno/cpp/__intermediate/cpp_common_knowledge_s_c_dewhurst/code/item_5-REFERENCES_ARE_ALIASES_NOT_POINTERS/case_3-lifetime_of_references/main.cpp | #include <iostream>
template <typename T>
void swap(T& a, T& b) {
T temp(a);
a = b;
b = temp;
}
int main()
{
int x = 1, y = 2;
swap(x, y);
int grades[] = { 1, 2, 3 };
swap(grades[1], grades[2]);
for (auto& element: grades) {
std::cout << element << std::endl;
}
return... | ALGO | 0.98881 | 5.92284 |
11bf5349-e65c-438a-a6e6-504b1901c2b3 | mahir-mahtab/practice-c-and-cpp | cpp code/rec1.cpp | #include <bits/stdc++.h>
using namespace std;
int maze(int d,int open,int close,string s){
if(close>open){
return 0;
}
else if(open==d&&close == d){
cout<<s<<endl;
return 0;
}
else if(open>d){
return 0;
}
maze(d,open+1,close,s+'(');
maze(d,open,close+1,s+'... | ALGO | 0.999821 | 3.956364 |
31657e00-fed4-41eb-9941-88b7be01e64e | coin50/templates | cpp/counting.cpp | #define ll long long
#define MOD 0x3b800001
#define pow p0w
ll p0w(ll x,ll e){
ll acc = x;
ll p = 1;
while(e){
if(e&1) p = p*acc%MOD;
acc = acc*acc%MOD;
e >>= 1;
}
return p;
}
#define MAX 100
ll fact[MAX+1];
ll anti[MAX+1];
void init_fact(){
fact[0] = 1;
for( int i =... | ALGO | 0.999703 | 3.825887 |
e2a8a4a8-41ba-413e-b845-caab548389f5 | naipings/Data-structure-and-algorithm-school-study | 13-2表达式求值改进.cpp | //表达式求值:中序表达式转后序表达式,利用顺序栈实现
//改进版1:可以计算10位及以上整数
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
using namespace std;
#define MAXSIZE 10
typedef struct BTNode{//树节点
char *key;
struct BTNode *lchild;
struct BTNode *rchild;
}BTNode;
#define STACK_INIT_SIZE 100 //存储空间初始分配量
#defi... | ALGO | 0.999982 | 3.570101 |
d96d7206-ae29-4a15-b152-0787cec60a95 | td2447437/DeJacoTatiana_CSC5_40717 | Hmwk/Assignment2/Part1/Savitch_9thEd_Chap2_ProgProb3/main.cpp | /*
* File: main.cpp
* Author: Tati
* Created on January 13, 2015, 4:47 PM
*
* Homework:
* Modify your program from Programming Project 2 so that it calculates the
* retroactive salary for a worker for any number of months, instead of just
* 6 months. The number of months is entered by the user.
*/
#incl... | ALGO | 0.958526 | 4.615651 |
3227b124-6113-4c55-84e2-4ed1a0f0ff3d | Seungchan0325/baekjoon | solutions/2091_0.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXX = 10005;
int x, a, b, c, d;
int units[] = {1, 5, 10, 25};
int limit[4];
int dp[MAXX][5];
int main() {
cin >> x;
for(int i = 0; i < 4; i++) cin >> limit[i];
memset(dp, -1, sizeof(dp));
dp[0][0] = dp[0][1] = dp[0][2] = dp[0][3] = dp[0][4] =... | ALGO | 0.999791 | 3.232193 |
7a2e5870-43d0-480c-af98-7b3b3bdf5669 | whlongg/HSG11 | VNOJ/Contest21/bedao_r21_a.cpp | //VNOJ/Contest21/bedao_r21_a.cpp
//https://oj.vnoi.info/problem/bedao_r21_a
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define file(inp, out) freopen((inp), "r", stdin);freopen((out), "w", stdout);
#define FASTIO ios_base::sync_with_stdio(false);cin.tie(nullptr... | ALGO | 0.999692 | 3.506161 |
a20dc398-2198-4d08-b0db-433f9dd02294 | sarvex/leetcode-powershell | solution/0900-0999/0983.Minimum Cost For Tickets/Solution.cpp | class Solution {
public:
vector<int> t = {1, 7, 30};
vector<int> days;
vector<int> costs;
vector<int> f;
int n;
int mincostTickets(vector<int>& days, vector<int>& costs) {
n = days.size();
this->days = days;
this->costs = costs;
f.assign(n, -1);
return df... | ALGO | 0.999881 | 5.647646 |
e8371b92-8705-4da3-ba64-1a5761a16885 | jhanvi0319/signup | 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.998687 | 6.797341 |
1b42085f-1f77-43d3-a640-eb54b34ab3ca | suhaas02/Data-structures-and-algorithms | DSA self paced course/4.Recursion/problems/03.count-digits.cpp | //count digits
// { Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
int evenlyDivides(int N){
if (N / 10 == 0)
{
return 1;
}
return (1 + evenlyDivides(N / 10));
}
};
// { Driver Code Starts.
int main() ... | ALGO | 0.999763 | 6.155227 |
517c1a95-012d-4f24-97c8-3d22934dc6d6 | amir-kedis/problem-solving-solutions | azhar-sheet-01/L_The_Brothers.cpp | #include <iostream>
#include <string>
#include <algorithm>
#include <ctype.h>
#include <cmath>
#include <set>
#include <vector>
using namespace std;
int main()
{
string s1, s2, s3, s4;
cin >> s1 >> s2 >> s3 >> s4;
if (s2 == s4)
cout << "ARE Brothers";
else
cout << "NOT";
return 0;
} | ALGO | 0.989796 | 3.123832 |
64e3ef81-96d5-43e0-b254-e36c3e00b0e0 | SATTU3108/DSA_Solutions | Length Of Last Word.cpp | int lengthOfLastWord(string s) {
int l=s.length();
int idx=l-1;
while (s[idx]==' ') idx--;
int count=0;
for (int i=idx;i>=0;i--) {
if (s[i]!=' ') count++;
else break;
}
return count;
}
| ALGO | 0.994187 | 4.445279 |
60e4b8c1-b7aa-4d46-8c06-7652f39f07fc | theSrijan13/DS | first_lass_occ_ina_array.cpp | #include <iostream>
using namespace std;
int firstocc(int arr[],int n,int key)
{
int s=0;
int e=n-1;
int ans= -1;
int mid= s + (e-s)/2;
while(s<=e)
{
if(mid==key)
{
ans=mid;
s=mid+1;
}
else if(key<arr[mid])
{
e=mid-1;
... | ALGO | 0.99989 | 4.911898 |
2710bb1e-b98d-4233-b821-757254b7f242 | ArchitKumar1/LeetCode-Submissions | divide-array-in-sets-of-k-consecutive-numbers/Accepted/4-29-2020, 1:34:23 AM/Solution.cpp | // https://leetcode.com/problems/divide-array-in-sets-of-k-consecutive-numbers
class Solution {
public:
bool isPossibleDivide(vector<int>& nums, int k) {
int n = nums.size();
if(n%k != 0)return 0;
unordered_map<int,int> m1;
set<int> s;
for(int c : nums) m1[c]++,s.insert(c);... | ALGO | 0.999966 | 5.723439 |
d5b9350e-0c9e-4bb1-b1c0-957015f91e4d | s2loves27/algorithm | 10000/14000/14501.cpp | #include <iostream>
using namespace std;
int N;
int T[16];
int P[16];
int dp[16];
int max(int a, int b){
if(a>=b) return a;
else return b;
}
int f(int k){
if(k >= N) return 0;
if(dp[k] != 0) return dp[k];
int result = 0;
for(int i = 1 ; i < N ; i++)
result = max(result ,f(k+i));
if(k + T[k] <= N)
result ... | ALGO | 0.999936 | 3.310077 |
02a37421-a600-4158-9bb7-0004af755a58 | sanjaysj6282/DotSlash | Reorganize_string.cpp |
#include <bits/stdc++.h>
using namespace std;
#define FAST {ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);}
#define ll long long int
#define ld long double
#define pb push_back
#define pi pair<ll, ll>
#define ff first
#define ss second
#define vi vector<ll>
#define vb vector<bool>
#define vii vector<pi>
#... | ALGO | 0.999786 | 4.085425 |
963a8cbd-30e3-48b0-8ecc-6dac00fa8692 | ishandutta2007/codeforces | neko_nyaaaaaaaaaaaaaaaaa/normal/383/C.cpp | #include <bits/stdc++.h>
using namespace std;
int n, m, t = 0;
vector<int> tree(800008);
vector<vector<int>> adj(200002);
vector<int> lv(200002);
vector<int> fi(200002);
vector<int> se(200002);
vector<int> tr(1);
void dfs(int now, int prev) {
lv[now] = lv[prev] + 1; t++;
fi[now] = t;
tr.push_back(now);
for (au... | ALGO | 0.999961 | 4.542393 |
5e06cd91-2410-46c0-acc1-b56c04c45a08 | liaohui-2002/Matu | chapter9-2/ex_167/Shape.cpp | //
// Created by liaohui on 2021/11/21.
//
#include "Shape.h"
class Rectangle : public Shape {
private:
double width;
double length;
public:
Rectangle(double l,double w){
width = w;
length = l;
}
~Rectangle(){}
double GetPerimeter() override//周长
{
return 2*(width+len... | TOOL | 0.880418 | 4.061844 |
d6c64a04-c5c9-4eb4-8222-0912b2342033 | cryptSky/CarND-MPC-Project | src/Eigen-3.3/bench/perf_monitoring/gemm/gemm.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <Eigen/Core>
#include "../../BenchTimer.h"
using namespace Eigen;
#ifndef SCALAR
#error SCALAR must be defined
#endif
typedef SCALAR Scalar;
typedef Matrix<Scalar,Dynamic,Dynamic> Mat;
EIGEN_DONT_INLINE
void gemm(const Mat &A, const Mat &B, Mat &C)
{... | TEST | 0.963626 | 5.689105 |
d64aad4b-0b07-4ed2-a630-aaf225027e4f | ramkrishnareddy24/DataStructures | C++ DS Problems and Algorithms/Magnets.cpp | #include <iostream>
using namespace std;
int Magnets(int arr[],int n)
{
int c=1;
for(int i=0;i<n-1;i++)
{
if(arr[i]!=arr[i+1])
c++;
}
return c;
}
int main()
{
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
cout<<Magnets(arr,n);
} | ALGO | 0.999962 | 4.48932 |
42633039-bf99-4d8e-9329-19b847033dac | sorcererq/meshlab | src/other/vcglib/eigenlib/unsupported/test/NumericalDiff.cpp | #include <stdio.h>
#include "main.h"
#include <unsupported/Eigen/NumericalDiff>
// Generic functor
template<typename _Scalar, int NX=Dynamic, int NY=Dynamic>
struct Functor
{
typedef _Scalar Scalar;
enum {
InputsAtCompileTime = NX,
ValuesAtCompileTime = NY
};
typedef Matrix<Scalar,InputsAtCompileT... | TEST | 0.983131 | 6.185318 |
1f9f99ce-93c9-4456-a8a4-bfe30f4a2cc5 | rocket3989/hackerEarth2019 | september easy/special.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
vector<long> vals;
long n, k, temp;
cin >> n >> k;
for(int i = 0; i < n; i++){
cin >> temp;
vals.push_back(temp);
}
sort(vals.begin(), vals.end());
... | ALGO | 0.99995 | 3.957284 |
4428c169-b499-4ae9-89ad-ded806de6d4c | tsunghuanghsieh/leetcode | problems/meeting-rooms-ii/main.cpp | #include <fstream>
#include <iostream>
#include <regex>
#include <vector>
using namespace std;
#include "Solution.cpp"
#include "Solution2.cpp"
int main(int argc, char** argv) {
Solution s;
Solution2 s2;
ifstream fin(argv[1]);
if (!fin) {
cout << "Error opening " << argv[1] << endl;
e... | ALGO | 0.997866 | 5.469596 |
ee751f59-51a6-40c9-b670-d015884a24cd | HyeonDKIM/AlgorithmStudy | BOJ/5622.cpp | #include <iostream>
#include <string>
using namespace std;
//5622번 다이얼
// 숫자 1은 2초, 한 칸 옆의 숫자는 +1초
int main() {
string DialLetter;
cin >> DialLetter;
int time = 0;
for (int i = 0; i < DialLetter.size(); i++) {
if (DialLetter[i] < 'D')
time = time + 3;
else if (DialLetter[i] < 'G')
time = time + 4;
... | ALGO | 0.998929 | 3.632838 |
5b92a752-5101-431e-9ee4-92e57746d79e | josuerom/Competitive-Programming | Training/UVa/CP3/Data Structures and Libraries/Linear DS/11988 - Broken Keyboard.cpp | // C++ STL list
#include <bits/stdc++.h>
using namespace std;
int main() {
string line;
while (cin >> line) {
line.push_back(']');
list<string> l;
string s;
char key = '[';
for (int i = 0; i < line.size(); i++) {
char c = line[i];
if (c == '[' || c == ']') {
if (key == '[') l.push_front(s);
i... | ALGO | 0.997151 | 4.013016 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.