uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
53720a61-3e7e-4167-b293-120e16d60fd4 | isaacstaugaard/practiceAlgorithmsAndDataStructures | Greedy Algorithms/MarkAndToys.cpp | /* Mark and Toys */
//The problem can be found at: https://www.hackerrank.com/challenges/mark-and-toys/problem
#include <bits/stdc++.h>
using namespace std;
int maximumToys(vector <int> prices, int k) {
//First, we will sort the array of prices in ascending order
sort(prices.begin(), prices.end());
//Def... | ALGO | 0.999933 | 5.420598 |
216f0402-dfda-43e0-9f45-4bd4a57f6640 | krishankant10/C-language | NONAME02.CPP | #include<iostream.h>
#include<conio.h>
#include<process.h>
struct node
{
int info;
node *next;
}
*start,*newptr,*save,*ptr;
node *create_new_node(int);
void insert_beg(node*);
void display(node*);
void main()
{
start=NULL;
int inf;
char ch='y';
while(ch=='y'|| ch=='Y')
{
clrscr();
cout<<"\n enter info for t... | ALGO | 0.984789 | 3.489639 |
8714ad05-4961-4469-95e0-85a58fe5efef | arindhimar/FergussonCollege | Sem - 1/AAC/CE-2/Prac - 2/q17.cpp | #include <bits/stdc++.h>
using namespace std;
void sort(vector<int> &arr)
{
int n = arr.size();
for (int i = 0; i < n - 1; i++)
{
for (int j = 0; j < n - 1; j++)
{
if (arr[j + 1] < arr[j])
{
swap(arr[j + 1], arr[j]);
}
}
}
}
v... | ALGO | 0.999982 | 5.54507 |
92c9bc26-5327-4346-a113-ed18f417678f | varshap17/DSA | Arrays/Sum of product of x and y with floor n div x is y.cpp | //Input: n = 5
//Output: 21
//Explanation: Following are the possible
//pairs of (x, y):
//(1, 5), (2, 2), (3, 1), (4, 1), (5, 1).
//So, 1*5 + 2*2 + 3*1 + 4*1 + 5*1
// = 5 + 4 + 3 + 4 + 5
//= 21.
#include<iostream>
using namespace std;
long long int sumofproduct(int n)
{
long long sum=0;
int j=1;
... | ALGO | 0.999961 | 5.064472 |
978bc59d-95c2-43d6-95de-36d3ef0a92f0 | ha-rsh/Codechef-problems | Codechef c++/The one with all the candies.cpp | #include <bits/stdc++.h>
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define lld long long double
/*#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;*/
#define dbug(x) cout << #x << " " << x << "\n";
#define loop(n) for(int i = 0; i < ... | ALGO | 0.999678 | 3.77233 |
88bbcb2e-09bf-438c-ad11-9fedf79dd040 | vipinmishra0852/DecodeAssignment | Arrays2D/Assignment/Assignment1/5.cpp | #include <iostream>
using namespace std;
int main()
{
// Define the dimensions of the matrix
const int rows = 3;
const int cols = 4;
// Initialize the matrix
int matrix[rows][cols] = {
{1, 3, 5, 7},
{3, 4, 7, 8},
{1, 4, 12, 3}};
// Initialize variables to track the maximum sum and the c... | ALGO | 0.999976 | 6.119666 |
fb091420-1a0d-46d7-b1e3-43c4773cc430 | pi19404/m19404 | objdetect/LAC/CascadeClassifier.cpp |
#include <fstream>
#include <vector>
#include <math.h>
#include <algorithm>
#include <cv.h>
using namespace std;
#include "IntImage.h"
#include "SimpleClassifier.h"
#include "AdaBoostClassifier.h"
#include "CascadeClassifier.h"
#include "Global.h"
#include "FFS.H"
CascadeClassifier::CascadeClassifier():count(0),ac(NU... | ALGO | 0.951705 | 3.700135 |
c0b28065-874b-4fdd-bca1-90081d450f86 | ToshihideMatsuda/atcoder | programs/ABC/ABC100-199/ABC175/c/main.cpp | #include <iostream>
#include <vector>
#include <unordered_map>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iomanip>
#define rep(i,n) for(int i = 0; i < n; i++ )
#define reps(i,m,n) for(int i = m; i < n; i++ )
typedef long long ll;
using namespace std;
#define MAX_N 2*100000 + ... | ALGO | 0.999764 | 3.743906 |
077a7c56-34c2-492f-accb-90ab79e6dc01 | pranxol/codeforces_solution | 494 div 3/d.cpp | #include<bits/stdc++.h>
using namespace std;
#define SIZE_N 100000
#define SIZE_P 100000
bool flag[SIZE_N+5];
int primes[SIZE_P+5];
int seive()
{
int i,j,total=0,val;
for(i=2;i<=SIZE_N;i++) flag[i]=1;
val=sqrt(SIZE_N)+1;
for(i=2;i<val;i++)
if(flag[i])
for(j=i;j*i<=SIZE_N;j++)
... | ALGO | 0.999812 | 3.309176 |
e86fc9bb-2197-4d79-a7f7-f7d123cb7c0d | maxp3ng/adventOfCode2024 | day2/2.cpp | // https://adventofcode.com/2024/day/2
// solved 12/2/24
// comments: I CHOKEDDDDDD OMG should have just gone for the on^2 solve from the start
#include <bits/stdc++.h>
#include "../headers/quicksort.h"
using namespace std;
using ll = long long;
const ll MXN = 2e5 + 10;
using str = string;
using db = long double;
usi... | ALGO | 0.999415 | 4.415581 |
a7fffee3-55e0-437a-b250-f36458f0a336 | rancheng/DSO_noted | src/FullSystem/FullSystemOptPoint.cpp | /*
* KFBuffer.cpp
*
* Created on: Jan 7, 2014
* Author: engelj
*/
#include "FullSystem/FullSystem.h"
#include "stdio.h"
#include "util/globalFuncs.h"
#include <Eigen/LU>
#include <algorithm>
#include "IOWrapper/ImageDisplay.h"
#include "util/globalCalib.h"
#include <Eigen/SVD>
#include <Eigen/Eigenvalues... | ALGO | 0.995553 | 4.80407 |
45a3b0f5-5b3d-4a40-9d48-4c1e909533d3 | softarts/myoj | ojcpp/hht/021_minstack.cpp | //
// Created by rui zhou on 07/05/19.
//
#include <codech/codech_def.h>
#include <algorithm>
#include <type_traits>
using namespace std;
//LC 155 easy
namespace {
template<typename T>
class Stack {
public:
void push(const T& el) {
if (m_stack.empty()) {
m_min = el;
... | TEST | 0.999133 | 6.581904 |
17a56247-7cf7-454c-bb2d-640513441ad2 | Oaik/problems-solution | codeforces/contest/1144/c/52151548.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void Bezo() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
#endif
ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
}
const int N = 2e5 + 5, OO = 0x3f3f3f3f;
int arr[N], cnt... | ALGO | 0.999978 | 3.663437 |
7bfb8dab-682e-4045-8c4b-2bc36c443e31 | dsnow75/ds2454010 | Hmwk/HW 6/main.cpp | /*
* File: main.cpp
* Author: David Snow
* Created on July 23, 2014, 11:38 AM
*/
//System Libraries
#include <iostream>
#include <string>
#include <cmath>
#include <math.h>
#include <iomanip>
#include <fstream>
#include <cstdlib>
using namespace std;
//User Libraries
//Global Constants
const int Days = 7;
//Functi... | ALGO | 0.992493 | 3.854514 |
18dbfd84-91d7-49c2-a73d-0f593c7d80fe | Ankeet123/DSA | Data Structures/Linked List/sparseMatrix.cpp | #include<iostream>
using namespace std;
class node
{
public:
int col;
int val;
node *next;
};
class sparse
{
private:
int trow;
int tcol;
node **a; //take this as a double pointer
public:
sparse(int r,int c)
{
trow=r;
tcol=c;
node *t,*last;
a=new node*[r]; // create a array in heap
int i,x;
for(i=0;i<r;i++)
{
a[i]=NULL... | ALGO | 0.988506 | 3.632324 |
8edc36d6-f3f5-4484-a800-ce04d2477548 | gsm-pro/acm | olymp/olymp-solutions/7B12.CPP | #define _CRT_SECURE_NO_DEPRECATE
#include<iostream>
#include<algorithm>
#define NMAX 1111
using namespace std;
typedef long long LL;
LL f[NMAX][NMAX][4];
int tag[NMAX], an = 0, bn = 0, n, g;
struct node {
int cost, id;
friend bool operator < (const node &x, const node &y) {
return x.cost < y.cost;
}
} a[NMAX], b... | ALGO | 0.999921 | 3.562285 |
5657a998-c052-499f-8934-856757ca95e9 | Sumanth-NR/CompetitiveProgramming | Platforms/CodeForces/Infero/Infero2022_Rahul/N_Cows_and_time_travel.cpp | #include <bits/stdc++.h>
using namespace std;
// Data Types
typedef long long int ll;
typedef long double ld;
// Constants
const int MOD = 1000000007;
const double PI = 3.1415926535;
const int INF = INT_MAX;
const ll LINF = LONG_MAX;
const char NL = '\n';
// Some misc Macros
#define pb push_back
#define prec fixed <... | ALGO | 0.999829 | 4.334935 |
5abbaaea-e085-47bb-aa9d-8a799e21b64e | Merrill99/Nowcoder | partition/partition/partition.cpp | #define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>
struct ListNode {
int val;
struct ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Partition {
public:
ListNode* partition(ListNode* pHead, int x) {
// write code here
struct ListNode* lesshead, * le... | ALGO | 0.999972 | 4.352421 |
57f04036-ac18-492a-b717-213f011a3f96 | shawakation/PAT | Advanced Level/1046/main.cpp | /*
ע
*/
#include <cstdio>
#include <vector>
using namespace std;
int main()
{
int n,m,sum=0;
scanf("%d",&n);
vector<int> arr(n+1);
for (int i=1;i<=n;i++) {
int a;
scanf("%d",&a);
sum+=a;
arr[i]=sum;
}
scanf("%d",&m);
for (int i=0;i<m;i++) {
int a,b;
scanf("%d %d",&a,&b);
if (b<a) swap(a,b);
int ... | ALGO | 0.999823 | 3.782416 |
c10ce1f4-2162-4856-a83f-b252d20702d1 | phpgl/php-bullet | bulletphysics/src/BulletSoftBody/btDefaultSoftBodySolver.cpp | #include "BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "BulletCollision/CollisionShapes/btCollisionShape.h"
#include "btDefaultSoftBodySolver.h"
#include "BulletCollision/CollisionShapes/btCapsuleShape.h"
#include "BulletSoftBod... | ALGO | 0.895975 | 7.481757 |
3a450474-7e7c-4dee-9109-66dabcd04fa2 | radhikagpt1208/Data-Structures-Algorithms | 0.14. Recursion IV/generateSubsequences.cpp | #include<iostream>
using namespace std;
void generateSubsets(char *input , char *output , int i , int j){
//base case
if(input[i] == '\0'){
output[j] = '\0';
cout<<output<<endl;
return;
}
//rec case
//option 1:include the current character
output[j] = input[i];
gener... | ALGO | 0.999863 | 4.615345 |
db0fc565-cb7c-4cd5-bc41-079d5b511f21 | RMMichael/GeneralAlgorithms | NextPermutation/NextPermutation/main.cpp | #include <iostream>
#include <vector>
void swap(int* x, int* y){
int temp = *x;
*x = *y;
*y = temp;
}
void reverse(std::vector<int>& arr, unsigned long start){
unsigned long end = arr.size()-1;
while(start<end){
swap(&arr[start],&arr[end]);
start++;
end--;
}
}
... | ALGO | 0.99992 | 4.892054 |
e6cfa3e0-c7c0-4fd1-b042-81367764238c | yazuid4/algorithms | Graphs/Kruskal's algorithm.cpp | #include <iostream>
#include <queue>
#include <utility>
using namespace std;
int arr[10002];
priority_queue<pair<long long, pair<int, int>>, vector<pair<long long, pair<int, int>>>,
greater<pair<long long, pair<int, int>>>> Q;
int root(int i){
if(arr[i]==i)return i;
return arr[i] = root(arr[i]... | ALGO | 0.999976 | 4.468208 |
011bc579-53d9-4bcd-b497-71f60a229587 | InvalidNamee/OJ-AC-Repository-for-UPC | AC_code/跟随唐克练编程基础系列/3891_函数指针结构体/33_AH_墨汁.cpp | #include <cstdio>
int work(int n, const int &m) {
if (n == m - 1) return 1;
else if (n < m) return 0;
else return n / m + work(n / m + n % m, m);
}
int main() {
int n, m;
scanf("%d%d", &n, &m);
printf("%d\n", n + work(n, m));
return 0;
}
/***************************************************... | ALGO | 0.999978 | 3.640012 |
5057c615-8a8e-49bd-8356-6fc139966177 | swapnil282K/Code-Help-questions | Lecture0009/arr.cpp | #include<iostream>
using namespace std;
void print(int arr[],int size)
{
for(int i=0;i<size;i++)
{
cout<<arr[i]<<" ";
}
cout<<endl;
}
int main()
{
int arr[10];
//accessing an array
cout<<arr[0]<<endl;
int s[10]={4,5,6};
cout<<s[2]<<endl;
for(int i=0;i<10;i++)
{
cout<<s[i]<<" ";
}
cout<... | TOOL | 0.866816 | 3.523948 |
7c3d25c8-1d39-4417-9bc7-259e3ac9407b | AddisuAmbaye/Competitive-Programming | 2063-vowels-of-all-substrings/2063-vowels-of-all-substrings.cpp | class Solution {
public:
long long countVowels(string word) {
int n = word.size();
long long res = 0;
for(int i=0; i<n; i++){
if(word[i]=='a' || word[i]=='e' || word[i]=='i' || word[i]=='o' || word[i]=='u')
{
res += (long long)(n-i)*(long long)(i+1);
... | ALGO | 0.99984 | 6.072545 |
1dcd2433-baad-4e59-bf97-b8945ef59577 | vedh18/Advent-Of-Code-2024 | cpp/day19/b.cpp | /*
##################################################################
# #
# Advent of Code 2024 - Day 19, Part 2 #
# Problem Link: https://adventofcode.com/2024/day/19 # ... | ALGO | 0.999307 | 6.10772 |
dd96438e-9e5e-4cbb-a731-15f5635ecfc1 | keqhe/leetcode | round1/leetcode261.cpp |
class Solution {
public:
//ref: https://leetcode.com/discuss/69079/concise-java-solution-based-on-dfs
//ref: https://leetcode.com/discuss/56269/c-solution-dfs
//detect cycle in an directed graph: http://www.geeksforgeeks.org/detect-cycle-in-a-graph/
//detect cycle in an undirected graph:
bool... | ALGO | 0.999956 | 5.986609 |
83a5cd22-cf91-4101-8c22-67ab6faaf39c | rupert-li/USACO | Milk2/Milk2/milk2.cpp | /*
ID: rupertl1
PROG: milk2
LANG: C++
*/
#include <iostream>
#include <fstream>
#include <string>
#include <assert.h>
using namespace std;
int main() {
ofstream fout("milk2.out");
ifstream fin("milk2.in");
const int sz = 1000000;
int n;
fin >> n;
int* a = new int[sz];
for (int i = 0; i < sz; i++) a[i] = 0;
... | ALGO | 0.99994 | 3.872287 |
0a0219f7-488a-47aa-9edd-dae485cc1ada | divyansh12git/cf | 0contest/1014/problemC.cpp | // Author: * Divyansh Gupta ( divyansh_8 ) *
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp> // Common file
#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
using namespace std;
using namespace chrono;
using namespace __gnu_pbds;
/*_ _ _ _ _ _ _ _ _ _ _ _ _ _ ... | ALGO | 0.999895 | 4.405588 |
d845f90c-3779-41c6-90c1-b4d70f857a4b | wbf1015/Myleetcode | midium/96.cpp | class Solution {
public:
int numTrees(int n) {
int record[20] = {0};
record[0]=1;
record[1]=1;
for(int i=2;i<=n;i++){
for(int j=0;j<=i-1;j++){
record[i] += record[j]*record[i-j-1];
}
}
return record[n];
}
}; | ALGO | 0.999997 | 6.219726 |
a7986ecd-cb8f-47de-98e5-8ba73f1d5afc | gitee2github/ft_flutter | skia/third_party/externals/icu/source/i18n/double-conversion-cached-powers.cpp | // ICU PATCH: ifdef around UCONFIG_NO_FORMATTING
#include "unicode/utypes.h"
#if !UCONFIG_NO_FORMATTING
#include <stdarg.h>
#include <limits.h>
#include <math.h>
// ICU PATCH: Customize header file paths for ICU.
#include "double-conversion-utils.h"
#include "double-conversion-cached-powers.h"
// ICU PATCH: Wrap i... | TOOL | 0.864584 | 7.31735 |
61f3014a-2b2a-4d0f-aedf-da5fdc08407b | Rishab30Gupta/CppCodes21-22 | Level1/1)Basics_Of_Programming/3)Function And Arrays/Any_Base_Mulitplication.cpp | #include<bits/stdc++.h>
using namespace std;
int count_digits(int num) {
int count = 0;
while (num != 0) {
count++;
num /= 10;
}
return count;
}
int getProduct(int givenbase, int num1, int num2) {
int answer1 = 0;
int digits = count_digits(num1);
for (int i = 0; i < digits; i++) {
int n = num1 % 10;
ans... | ALGO | 0.999966 | 4.95723 |
6eea1825-3628-497c-b1d8-bc346e015000 | khanh22010449/Test | Pascal's Triangle.cpp | #include<bits/stdc++.h>
#include<windows.h>
#include<conio.h>
using namespace std;
vector<vector<int>> generate(int numRows) {
vector<vector<int>> retval;
for(int i=0;i<numRows;i++)
{
vector<int> temp(1,1);
for(int j=1;j<i;j++)
{
... | ALGO | 0.999979 | 3.557816 |
98ab2f3c-2c56-4ebc-9e34-e73984f4f4c9 | yashdubey369/Codef | C_Did_We_Get_Everything_Covered.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long int
#define fa(i,a,n) for (int i = a; i < n; i++)
#define f(i, n) fa(i,0,n)
#define inp(x) for(int i=0;i<n;i++) cin>>x[i];
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define all(x) x.begin(), x.end()
#define clr(x) me... | ALGO | 0.999933 | 3.43183 |
b2d125eb-47e6-47c3-83d8-8212e6fff353 | ishandutta2007/codeforces | nightglow/normal/985/F.cpp | #include<cstdio>
#include<algorithm>
#include<cstring>
#include<iostream>
#include<cstring>
#include<string>
#include<cmath>
#include<ctime>
#include<set>
#include<vector>
#include<map>
#include<queue>
#define N 300005
#define M 8000005
#define ls (t<<1)
#define rs ((t<<1)|1)
#define mid ((l+r)>>1)
#define mk make_p... | ALGO | 0.999992 | 4.000815 |
dccb62b0-aecb-4dfe-829d-2bcf475c5d5d | javagovindsharma/leetscode | solution/2000-2099/2044.Count Number of Maximum Bitwise-OR Subsets/Solution.cpp | class Solution {
public:
int mx;
int ans;
vector<int> nums;
int countMaxOrSubsets(vector<int>& nums) {
this->nums = nums;
mx = 0;
ans = 0;
for (int x : nums) mx |= x;
dfs(0, 0);
return ans;
}
void dfs(int i, int t) {
if (i == nums.size())... | ALGO | 0.999972 | 5.772043 |
d7aae1ce-e093-422e-b44c-b80f7149e584 | Mansi1975/SOC_CP | Week2/H.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <set>
using namespace std;
int dx[] = {0, 0, 1, -1}; // Right, Left, Down, Up
int dy[] = {1, -1, 0, 0};
int n;
bool isValid(int x, int y) {
return x >= 0 && x < 2 && y >= 0 && y < n;
}
pair<int, int> arrowMove(char arrow, int x, int y) {
if (ar... | ALGO | 0.999979 | 6.027664 |
2a2328e9-e189-42e6-9fb9-e3856c26d5ea | ung-steven/competitive_programming | upB. Average Superhero Gang Power.cpp | #include <bits/stdc++.h>
#define MEM(a, b) memset(a, (b), sizeof(a))
#define PI 3.1415926535897932384626433832795
#define endl '\n'
#define exists(s, e) (s.find(e)!=s.end())
#define WHILE(n)
#define pb push_back
#define f first
#define s second
#define UNI(vec) vec.erase(std::unique(vec.begin(), vec.end()),vec.end());... | ALGO | 0.999959 | 3.375643 |
68b1c82b-d7c1-48e1-bd18-709f793ea20b | poyiray/CCC-solutions | Project1/CCC '18 J2 - Occupy parking.cpp | #include<iostream>
#include<string>
using namespace std;
int main()
{
int n, sum = 0;
string y, t;
cin >> n >> y >> t;
for (int i = 0; i < n; i++)
{
if (y[i] == t[i] && y[i] == 'C') sum++;
}
cout << sum;
return 0;
} | ALGO | 0.999512 | 3.45016 |
340e68dc-a0c2-4ba7-9fc2-eb066a4935c9 | manikanta2901/ubuntu | .history/SRM/Implementations.cpp/Queue/Arr_20201104184746.cpp | #include <iostream>
using namespace std;
int queue[100], n = 100, front = - 1, rear = - 1;
void Insert(){
int val;
if (rear == n - 1)
cout<<"Queue Overflow"<<endl;
else {
if (front == - 1)
front = 0;
cout<<"Insert the element in queue : "<<endl;
cin>>val;
rear++;
queue[re... | ALGO | 0.993942 | 3.685792 |
779427ae-14f2-4d5e-aba2-4c45cb786c56 | thangitus/LeetCode-Solution | C++/Math/902. Numbers At Most N Given Digit Set.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
int atMostNGivenDigitSet(vector<string> &digits, int n) {
string num = to_string(n);
int digit = num.size(), result = 0, size = digits.size();
for (int i = 1; i < digit; i++)
result += pow(size, i);
... | ALGO | 0.999694 | 6.219709 |
954e169d-091e-4e6f-bcbf-0a74955a0432 | alexjilavu/TemaASD | Tema1/cautari/main.cpp | #include <iostream>
using namespace std;
int n, arr[100], k;
int secvential(){
for(int i = 0; i<n; i++)
if(arr[i] == k)
return i;
return -1;
}
int binary(int st, int dr){
int mid = (st + dr)/2;
if(st>dr)
return -1;
if(arr[mid] == k)
return mid;
if(arr[mid] > k... | ALGO | 0.999885 | 5.340793 |
c0cb6d66-1ae3-4183-9f87-5dccae57a523 | iriszero48/Trash | C++ Utility/Cryptography/Cryptography.cpp | #include "Cryptography.h"
#include <stdexcept>
#include <cstring>
#include <numeric>
#include <algorithm>
#include <charconv>
namespace Detail
{
namespace Bit
{
using __Detail::Bit::Endian;
using __Detail::Bit::BSwap;
template<typename T>
constexpr T RotateLeft(const T x, const int n)
{
return (x <<... | TOOL | 0.985112 | 7.090141 |
f6b5e451-4adf-4e83-9e52-d10a4c8a5251 | Meeperbunny/CompetitiveProgramming | archive/SAC/_1264.cpp | #include <bits/stdc++.h>
using namespace std;
#define HEADER ios::sync_with_stdio(0);cin.tie(0);if (fopen("file.in", "r")) {freopen("file.in", "r+", stdin);};
#define all(v) v.begin(), v.end()
using ll = long long;
void dbg_out() { cerr << endl; }
template<typename Head, typename... Tail> void dbg_out(Head H, Tail... T... | ALGO | 0.998936 | 4.705805 |
344fe39e-3b2a-4213-bd2d-a395938e8170 | taivu1898/28tech | C++/Problem/math/13.cpp | #include <iostream>
using namespace std;
using ll = long long;
const int MOD = 1e9 + 7;
const int MAX = 1000001;
int arr[MAX];
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
ll n, p;
cin >> n >> p;
ll e = 0;
for (ll i = p; i <= n; i *= p) {
e += n / i;
}
cout << e << endl;
return 0;... | ALGO | 0.999934 | 4.167501 |
e9c815a0-0cb9-4be6-a86b-7cccd86c038a | dhnesh12/codechef-solutions | 03-CodeChef-Medium/317--Grouping Chefs.cpp | #include <iostream>
#include <ctime>
#include <algorithm>
#include <vector>
#include <chrono>
#define fi first
#define se second
using namespace std;
const int maxN = 1e4 + 5;
typedef pair<int, int> ii;
vector<int> res, adj[maxN];
int n, m, k;
void prt(vector<int> cp){
sort(cp.begin(), cp.end());
for(int el:... | ALGO | 0.999951 | 4.504407 |
36c3a7d5-a4bb-4045-8908-d3268473d19e | lifecycles1/competitive-programming | neetcode/11. graphs/16.courseScheduleII.cpp | // There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1.
// You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates that you must
// take course bi first if you want to take course ai.
// For example, the pair [0, 1], indicates that to take course 0 y... | ALGO | 0.999876 | 6.713464 |
2e67ea5e-b6b6-4b94-9acb-1adc0883af06 | andrewknoll/IG_102 | color/Reinhard2005.cpp | /*
* Algorithm obtained from paper (Retrieved 15 December 2020)
* https://64.github.io/tonemapping/#extended-reinhard
*
*/
#include "Reinhard2005.hpp"
//***********************************************************************
// Class constructor.
// @param max Maximum light value in the image to be mapped.
//****... | ALGO | 0.981052 | 4.224911 |
592b9333-5e80-4e63-8f03-de5430f8fbfa | aasthasingh650/DAA | Assignment4/code.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
string lcp(string s[], int lo, int hi)
{
if (lo == hi)
return (s[hi]);
if (hi > lo)
{
int mid = lo + (hi - lo) / 2;
string str1 = lcp(s, lo, mid);
string str2 = lcp(s, mid + 1, hi);
string res;
... | ALGO | 0.999678 | 4.712459 |
051f6488-23a9-4b93-80a9-19e6b252d725 | ADMINGUOYU/COMP2012-HKUST- | ClsCode/Generic Programming/template/template-problem.cpp | #include <iostream> /* File: template-problem.cpp */
using namespace std;
template <typename T> const T&
larger(const T& a, const T& b) { return (a < b) ? b : a; }
int main()
{
const char* m = "microsoft";
const char* a = "apple";
cout << larger(a, m) << " is better!" << endl; // here, is ac... | ALGO | 0.998414 | 3.677369 |
d0dc0d97-6d0c-4518-8c00-c5044e57aa3c | celisej567/cool-source-archive | utils/vrad/vradstaticprops.cpp | #include "vrad.h"
#include "mathlib/vector.h"
#include "UtlBuffer.h"
#include "utlvector.h"
#include "GameBSPFile.h"
#include "BSPTreeData.h"
#include "VPhysics_Interface.h"
#include "Studio.h"
#include "Optimize.h"
#include "Bsplib.h"
#include "CModel.h"
#include "PhysDll.h"
#include "phyfile.h"
#include "collisionuti... | TOOL | 0.94344 | 6.112848 |
f76128f6-ccd6-46c5-85db-4c0ae37b7cac | CS-NextClient/NclNitroApi | src/SearchConfig.cpp | #include "SearchConfig.h"
#include <utility>
#include <iostream>
namespace nitroapi
{
SearchConfig::SearchConfig(std::string search_string, SearchType search_type) :
search_string(std::move(search_string)),
search_type(search_type),
offset(0)
{ }
SearchConfig::SearchConfig(uint32_... | TOOL | 0.880523 | 5.814857 |
13fa1bfc-2ded-471e-b737-ddd8a238ef64 | KW-CTM/KW-CodingTestMate | Kyeongjeong/2week/04-16(x).cpp | #include <iostream>
#include <map>
using namespace std;
int main() {
int N, temp, count = 0, maxCount = 0;
map<int, int> num;
cin >> N;
for(int i = 0; i < N; i++) {
cin >> temp;
num.insert({temp, i});
}
for(auto it = num.begin(); it != num.end(); it++) {
... | ALGO | 0.999851 | 3.757197 |
6a74f87e-4387-4dc8-a315-eaf4da25205d | Shekhu04/DSA-Questions | Tree/inOrder.cpp | #include<iostream>
using namespace std;
struct Node{
int data;
struct Node*left;
struct Node*right;
Node(int val){
data = val;
left = NULL;
right = NULL;
}
};
//LNR
void inOrder(struct Node* root ) {
//base case
if(root == NULL){
return;
}
inOrder(r... | ALGO | 0.999946 | 4.912553 |
dbed2ce7-d5e2-4d63-af24-0f5f0272c49f | ishandutta2007/codeforces | danya.smelskiy/normal/1141/A.cpp | # include <iostream>
# include <cmath>
# include <algorithm>
# include <stdio.h>
# include <cstdint>
# include <cstring>
# include <string>
# include <cstdlib>
# include <vector>
# include <bitset>
# include <map>
# include <queue>
# include <ctime>
# include <stack>
# include <set>
# include <list>
# include <random>
... | ALGO | 0.999983 | 3.854458 |
953cc8bc-c704-4586-98dd-198710e30479 | dinesh-2020-code/Data-Structures-and-Algorithms | Recursion/combinationSum.cpp | /**
* Given an array of distinct integers arr and a target integer target,
* return a list of all unique combinations of candidates where the chosen
* numbers sum to target. You may return the combinations in any order.
*
* I/p: arr[]={2, 3, 6, 7}; O/p: [2, 2, 3], [7]
*
* Problem Link: https://leetcode.com/... | ALGO | 0.999914 | 5.999763 |
5ae63e82-234d-4e60-9b38-cee965e3be15 | Robomanipal-Taskphase-Coding-2023/Ankur-Kumar | Task 1/Q5/main.cpp | #include <iostream>
using namespace std;
string dec_to_bin(int n)
{
string bin = "";
while ( n != 0)
{ char ch;
int r = n % 2;
ch = r+48;
bin = bin + ch;
n = n / 2;
}
int i = 0;
int j = bin.size()-1;
while (i <= j)
... | ALGO | 0.98979 | 4.907471 |
46c8d554-b40e-44dc-b84b-593bd230d07d | kartikkumar/emtg | branch/EMTG-David/src/EMTG_WORHP_interface.cpp | //Class interface to WORHP, to tidy-up global solvers which need to use it
//note this won't compile without WORHP so the whole thing lives in an #ifdef guard
//Jacob Englander 11/8/2013
#ifdef _use_WORHP
#include <cmath>
#include <float.h>
#include "missionoptions.h"
#include "problem.h"
#include "EMTG_WORHP_interfa... | ALGO | 0.991507 | 4.193865 |
f1c428d4-9b3c-4d0d-baad-108c9f42007c | kwin555/SingleLinkedList | extra3.cpp | #include <iostream>
#include <sstream>
#include <string.h>
#include <stdio.h>
#include <array>
using namespace std;
class arrayStack {
private:
int *array;
int currentIndex = 0;
int size;
public:
// by default array is going to have 10 int elements
arrayStack();
arrayStack(int initialSize);
... | ALGO | 0.966379 | 4.93991 |
0d674311-15ce-4782-868d-c51f42c9de24 | strimuer213p/AtCoder_Beginner_022_A | AtCoder_Beginner_022_A/Source.cpp | /*
問題文
高橋君は太りやすく痩せやすい体質です。そこで彼は N 日間の体重の変化量を記録してみました。
1 日目の高橋くんの体重は W キログラムでした。 i 日目 (2≦i≦N) の体重の変化量は Ai キログラムでした(Ai は負になり得ます)。 つまり i−1 日目の体重を X キログラムとすると、 i 日目の体重は X+Ai キログラムだったということです。
ところで、高橋君の個人的な価値観では、体重が S キログラム以上 T キログラム以下の体型が「ベストボディー」だと考えています。
体重を記録した N 日間のうち、高橋君がベストボディーであった日数を求めてください。
*/
#include<iostream>
#i... | ALGO | 0.999985 | 3.926995 |
01b0f5db-aa03-428e-8b9b-020b919ccdfb | tzuhsien/DSP | dsp_hw3/mydisambig.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <array>
#include <vector>
#include <unordered_map>
#include "Ngram.h"
using namespace std;
// Get P(W2 | W1) -- bigram
double getBigramProb(Vocab& voc, Ngram& lm, const char *w1, const char *w2)
{
VocabIndex wid1 = voc.getIndex(w1)... | ALGO | 0.983439 | 4.467992 |
fa0ec72b-8f5f-4718-9ef0-07e23641e8c6 | avoroshilov/physics_fem_rbd | source/math/m_LCPLemkeSolver.cpp | #include "m_LCPLemkeSolver.h"
#include "m_Const.h"
#include "helpers/debug.h"
using namespace math;
/*__int64 GetCPUClock()
{
__int64 res;
__asm
{
rdtsc
mov dword ptr res, eax
mov dword ptr res+4, edx
}
return res;
}*/
CLCPLemkeSolver::CLCPLemkeSolver()
{
mSize = 0;
mpInvba... | ALGO | 0.999793 | 3.079935 |
64239104-f60c-4e7c-b24f-a826b128d2f6 | pufe/programa | 2020-12-21/allergen.cpp | #include <cstdio>
#include <cstring>
#include <set>
#include <string>
#include <map>
#include <vector>
using namespace std;
map<string, set<string> > dict;
map<string, int> qt;
bool is_allergen_free(string a) {
for(auto it : dict) {
if (it.second.count(a)>0)
return false;
}
return true;
}
set<string>... | ALGO | 0.96154 | 3.605897 |
0e0eb7f4-807d-4b9f-ab03-38817ee3cad4 | minion142/algorithm_code | src/Algospot/quick_sort.cpp | //Minion142 - 19.01.08 - Quick_Sort
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
vector<int> Quick_Sort(vector<int>& array)
{
vector<int> child1;
vector<int> child2;
//base_case : 배열 길이가 1보다 작으면
if (array.size() < 1)
return array;
//나누는 부분!
int len = array.size();
for (in... | ALGO | 0.99993 | 4.936109 |
cc6862ce-366b-4bdb-b4bc-825037921d05 | magiccjae/cs650 | binarization/binarization.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <sstream>
#include <stdlib.h>
#include <math.h>
using namespace std;
int find_threshold(double threshold[], int max){
int index;
double maximum_value = 0;
for(int i = 0; i < max; i++){
if(threshold[i] > maximum_value){
m... | ALGO | 0.9548 | 4.705936 |
1303ac9c-4153-47f6-8fd8-25d7e5b76b3a | seo-bo/ProblemSolving | 백준/contest/32657.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
int main(void)
{
bool a1 = false, a2 = true;
cin.tie(0)->sync_with_stdio(0);
int n = 0;
cin >> n;
vector<pii>v(n + 1);
for (int i = 1; i <= n; ++i)
{
cin >> v[i].first >> v[i].second;
}
vector<vector<bool>>dp(n +... | ALGO | 0.999949 | 4.366656 |
0d7e4bb5-356a-4646-8993-e070f5abaea2 | nut-izhan/Programs-in-cpp-introductory-classes | arrow_shape_asterik.cpp | #include <iostream>
using namespace std;
int main() {
int height;
cout << "Enter the height of the arrow: ";
cin >> height;
for (int i = 0; i < height; i++) { // arrow head
for (int j = 0; j < height - i - 1; j++) cout << " ";
for (int k = 0; k < (2 * i + 1); k++) cout << "*";
... | ALGO | 0.956618 | 4.180161 |
f7197322-71e2-4529-84e8-d9a11fa7700d | gu1show/leetcode | c++/2485.cpp | // Link: https://leetcode.com/problems/find-the-pivot-integer/description/
// Runtime: 3 ms
// Memory: 7.16 MB
class Solution
{
public:
int pivotInteger(const int n)
{
int sumFrom1ToN = n * (1 + n) / 2;
int potentialPivot = std::sqrt(sumFrom1ToN);
if (potentialPivot * potentialPivot ... | ALGO | 0.999481 | 6.305819 |
10f44d15-f4ea-4775-bd81-c739def64910 | dc-orz/LeetCode_topic | 1_twoSum.cpp | #include <iostream>
#include <vector>
#include <map>
using std::vector,std::map;
class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
map<int,int> hash;
vector<int> res;
vector<int>::iterator it;
int i = 0;
for(it = nums.begin();it!=nums.end();++it){... | ALGO | 0.999915 | 5.604566 |
1618a2c3-eab4-4372-a3cf-ca377346a217 | Phubet66040/Algor | TemplateCode/QuickSort.cpp | #include <iostream>
using namespace std;
int partition(int a[],int l,int r){
int pivot,i,j,t;
pivot = a[l];
i = l;
j = r+1;
while(1){
do{
++i;
}while(a[i] <= pivot);
do{
--j;
}while(a[j]>pivot);
if(i>=j){
break;
}swap(a[i],a[j]);
}
swap(a[l],a[j]);
return j;
}
void quick(int a[],int l,int ... | ALGO | 0.999934 | 4.395821 |
993a088a-7c6a-4185-91b9-9c00b38d78aa | raincross7/code-similarity | codes/train_code/problem259/problem259_137.cpp | #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
int main() {
int r;
cin >> r;
if (r < 1200) cout << "ABC" << endl;
else if (1200 <= r && r < 2800) cout << "ARC" << endl;
else cout << "AGC" << endl;
return 0;
} | ALGO | 0.997654 | 3.978918 |
9c532ad0-2d0b-4860-9849-9ad1d716485c | marimuthusanthosh/problemSolving | Difficulty: Medium/Look and Say Pattern/look-and-say-pattern.cpp | //{ Driver Code Starts
// Initial template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
string f(int n) {
if (n == 1) {
return "1";
}
string prev = f(n - 1);
return say(prev);
}
string say(s... | ALGO | 0.999511 | 6.917222 |
d5df7337-27a3-4354-b3b8-faad5d7d4d09 | vss021/Data-Structures-And-Algorithms | Graph/topological_Sort_Theory.cpp | /*
Topological sorting is a linear ordering of the vertices of a directed acyclic graph (DAG)
such that for every directed edge uv from vertex u to vertex v,
u comes before v in the ordering.
In simpler terms, it's an ordering of the vertices such that all the directed edges go
from left to right.
key points abou... | ALGO | 0.999978 | 7.41807 |
e17ee27f-0efb-4915-af15-0484f02c7e0b | rladbwlsdlwl/Leetcode | NumberofIslands.cpp | class Solution {
private:
int m,n;
public:
int numIslands(vector<vector<char>>& grid) {
int cnt=0;
m=grid.size(), n=grid[0].size();
for(int i=0; i<m; i++){
for(int j=0; j<n; j++){
if(grid[i][j]=='1'){
dfs(grid, i, j);
cn... | ALGO | 0.999959 | 6.489491 |
812ba1ff-c001-4ef2-a51d-99d01ffa30de | csiefer2/TrilinosMirror2 | packages/sacado/test/performance/advection/advection.cpp | #include "Sacado.hpp"
#include "advection.hpp"
#include "common.hpp"
#include "Kokkos_Timer.hpp"
template<typename FluxView, typename WgbView, typename SrcView,
typename WbsView, typename ResidualView>
void run_fad_flat(const FluxView& flux, const WgbView& wgb,
const SrcView& src, const Wbs... | ALGO | 0.999587 | 6.232467 |
0818bc89-b50a-427f-8c94-d3160e88713a | CodeTeng/CPP-Primer-Plus-Exersise | code-5/1.cpp | #include <iostream>
int main()
{
int start, end;
std::cout << "Please input two numbers\n";
std::cout << "input first number: ";
std::cin >> start;
std::cout << "input second number: ";
std::cin >> end;
int sum = 0;
for (int i = start; i <= end; i++) {
sum += i;
}
std::c... | TOOL | 0.981156 | 4.222324 |
85ad7e86-eb7a-4665-8b94-4d8e11c73cdb | BinomialSheep/CompetitiveCpp | AtcoderContest/まよコン20230506/E.cpp | #pragma region header
#include <bits/stdc++.h>
// デバッグ用マクロ:https://naskya.net/post/0002/
#ifdef LOCAL
#include <debug_print.hpp>
#define debug(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#define debug(...) (static_cast<void>(0))
#endif
using namespace std;
using ll = long long;
using vi = vector<int>... | ALGO | 0.999782 | 4.945535 |
c3b9821c-4200-4016-b521-56dbd08c7b02 | CIS1900/2022-fall | 04/point4.cpp | #include <iostream>
#include <cmath>
class point
{
int x = 0;
int y = 0;
public:
point(int x, int y) : x {x}, y {y}
{}
double distanceFromOrigin()
{
return std::sqrt(x * x + y * y);
}
};
int main()
{
point p {1, -1};
std::cout << "distance from origin: " << p.distanceFro... | TOOL | 0.964968 | 5.249743 |
3dc3d2ff-05fd-4274-86e5-5b06695c524c | BonexGoo/Boss2D | Boss2D/addon/opencv-3.1.0_for_boss/samples/cpp/select3dobj.cpp | /*
*
* select3obj.cpp With a calibration chessboard on a table, mark an object in a 3D box and
* track that object in all subseqent frames as long as the camera can see
* the chessboard. Also segments the object using the box projection. This
* program is useful for col... | TOOL | 0.989062 | 5.853785 |
917e6c05-0f63-4e60-8490-850b31900d27 | kimbaekyu/C-for-practice | Project1/Project1/stars.cpp | #include<stdio.h>
int main() {
int i, j, n;
scanf_s("%d", &n);
for (i = 1; i <= n; i++) {
for (j = 1; j <= i; j++) {
printf("*");
}
printf("\n");
j = 1;
}
return 0;
} | ALGO | 0.999925 | 3.69642 |
62d891fb-802e-472c-8a1b-d947b4778c3a | harshsingh2304/C- | ggml/src/ggml-sycl/convert.cpp | #include "convert.hpp"
#include "dequantize.hpp"
#include "presets.hpp"
template <int qk, int qr, dequantize_kernel_t dequantize_kernel, typename dst_t>
static void dequantize_block(const void * __restrict__ vx, dst_t * __restrict__ y, const int64_t k,
const sycl::nd_item<3> &item_ct1) {
... | ALGO | 0.913901 | 4.023384 |
f96795b2-30cd-470a-9db3-a51c2b916430 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_1625_5.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
pair<int, int> f[maxn][2][2];
bool u[maxn][2][2];
vector<int> root;
int col[maxn], p[maxn];
vector<int> g[maxn];
int n;
vector<pair<int, int> > ans;
int par[maxn];
int croot;
inline pair<int, int> operator+(const pair<int, int>& a,
... | ALGO | 0.99992 | 3.735096 |
47ae6dcc-20bf-4deb-ba07-2f023b458e79 | himanshuagarwal407/LeetCode_GFG_Problems | 1260-shift-2d-grid/1260-shift-2d-grid.cpp | class Solution {
public:
vector<vector<int>> shiftGrid(vector<vector<int>>& grid, int k) {
int n=grid.size();
int m=grid[0].size();
k = k%(n*m);
if(k>=m)
{
int x=k/m;
k=k%m;
for(int i=0; i<x; i++)... | ALGO | 0.999986 | 6.467142 |
6730f139-4608-4b3e-b80e-a241a336881e | xiaohuihuigh/cpp | acm/shuoj/siweishixun2/2016.1.4/D.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int T;
cin>>T;
while(T--){
int a,b,m;
cin>>a>>b>>m;int yn = 0;
for(int i = m/a+1;i>=0;i--){
//cout<<i;
int sheng = m-a*i;
if(sheng>=0&&sheng%b == 0){
yn = 1;
cout<<i<<" "<<sheng/b<<endl;
break;}
}
if(yn == 0)cout<<"Impossible"<<endl;... | ALGO | 0.997995 | 3.385642 |
979f8791-79cb-4ee7-9c84-2a04d10f0fe8 | thangitus/LeetCode-Solution | C++/Depth-first Search/1706. Where Will the Ball Fall.cpp | #include <bits/stdc++.h>
#include "../Tree/TreeNode.h"
using namespace std;
class Solution {
public:
vector<int> findBall(vector<vector<int>> &grid) {
vector<int> result(grid[0].size());
for (int i = 0; i < grid[0].size(); ++i)
result[i] = dfs(grid, 0, i);
return result;
}
... | ALGO | 0.999974 | 5.158309 |
a35b96d5-16f3-43c1-a6a5-100806eba844 | NeoResearch/neopt | src/common/crypto/cryptopp/keccak.cpp | // keccak.cpp - modified by Wei Dai from Ronny Van Keer's public domain
// sha3-simple.c. All modifications here are placed in the
// public domain by Wei Dai.
// Keccack core function moved to keccakc.cpp in AUG 2018
// by Jeffrey Walton. Separating the core file all... | ALGO | 0.997665 | 6.847442 |
103997ce-a0a7-4c34-9b60-e187411b5b2e | floreaadrian/AlgCodes | Timus/1306. Sequence Median/main.cpp | #include <iostream>
#include <queue>
#include <iomanip>
using namespace std;
int main()
{
priority_queue <int> q;
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
int a;
cin>>a;
q.push(a);
}
if(n%2==0)
{
for(int i=1;i<(n/2);i++)
q.pop();
double... | ALGO | 0.999461 | 3.774047 |
3db6070a-fd07-46fe-beda-402ba79e1329 | primihub/hackathon | winning-project/MeteorLib/lib_eigen/doc/examples/TutorialLinAlgSVDSolve.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXf A = MatrixXf::Random(3, 2);
cout << "Here is the matrix A:\n" << A << endl;
VectorXf b = VectorXf::Random(3);
cout << "Here is the right hand side b:\n" << b << endl;
cout << "The least-squares ... | ALGO | 0.999799 | 3.896713 |
be6c5272-4a8c-4a67-a9a1-64843e3f3872 | applenhi123456/CTDL-GTthbuoi2 | CTDL>_Quick_Sort_1.cpp | //link tham khảo:https://gochocit.com/ky-thuat-lap-trinh/thuat-toan-sap-xep-quick-sort
#include <iostream>
using namespace std;
void Quick_Sort(int a[], int left, int right){
int i, j, x;
x = a[(left+right)/2];
i = left; j = right;
do{
while(a[i] < x) i++;
while(a[j] > x) j--;
if(i <= j){
swap(a[i],a[j]);
... | ALGO | 0.999961 | 4.724316 |
f5d7b76b-40dc-49af-8745-afffed88ed5f | SajanBrar/Codes-for-Computer-Science | Algorithms/code2.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cout << "\nEnter the number of elements in array: ";
cin >> n;
int A[n];
cout << "\nEnter the elements: ";
for (int i = 0; i < n; i++)
{
cout << "\nEnter element " << i << ": ";
cin >> A[i];
}
for (int i = ... | ALGO | 0.999961 | 4.529347 |
8f718f4a-27c7-432d-8bd7-b706b5804f59 | beamiter/cbp | cbp/cppad/example/general/change_param.cpp | # include <cppad/cppad.hpp>
/*
$begin change_param.cpp$$
$spell
Jacobian
$$
$section Computing a Jacobian With Constants that Change$$
$mindex multiple AD level$$
$head Purpose$$
In this example we use two levels of taping so that a derivative
can have constant parameters that can be changed. To be specific,
we con... | TOOL | 0.998703 | 7.037015 |
332a4903-e47a-4d3b-b129-11c37d779bad | lazybones1/Algorithms | 백준알고리즘/단계별로 풀어보기/22. 우선 순위 큐/P_Number_1655.cpp | #include <iostream>
#include <queue>
using namespace std;
struct cmp{
bool operator()(int a, int b){
return a>b;
}
};
int main() {
ios::sync_with_stdio(false);
cout.tie(NULL); cin.tie(NULL);
int n;
cin>>n;
priority_queue<int> small;
priority_queue<int, vector<int>, cmp> big;
for(int i = 0; i< n... | ALGO | 0.999985 | 4.239457 |
ff064c38-3611-43ef-874e-564f1b634eb1 | gourabsingha1/LeetCode-and-GFG-Problems | 0039-combination-sum/0039-combination-sum.cpp | class Solution {
public:
void helper(int target, int i, vector<int>& candidates, vector<int> v, vector<vector<int>> &res){
if(target <= 0 || i == candidates.size()){
if(!target) res.push_back(v);
return;
}
v.push_back(candidates[i]);
helper(target - candidates... | ALGO | 0.999986 | 6.646733 |
d68147fa-9221-4c84-b09d-a914a7b2bfa4 | Smriti925/leetcode_solutions | 82-remove-duplicates-from-sorted-list-ii/82-remove-duplicates-from-sorted-list-ii.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* deleteDupli... | ALGO | 0.999977 | 5.807143 |
2e3f9ec3-445e-47f5-a7f9-7bdb80cd3621 | velicof/Programming-Cpp | solved/vectori_secvente/862 secventa tema.cpp | #include <bits/stdc++.h>
using namespace std;
ifstream fin("sortare_divizori.in");
ofstream fout("sortare_divizori.out");
// #define cin fin
// #define cout fout
int main() {
int n, v[100005],t,k,l =0,nrs = 0;
cin >> n >> t >> k;
for (int i = 1; i <= n; i++){
cin >> v[i];
}
for (int i = 1; i... | ALGO | 0.999897 | 3.94906 |
c4e92dc8-1954-454f-aa05-3a5a895ad32b | ishandutta2007/codeforces | liti/normal/513/F1.cpp | /* In the name of Allah */
#include <bits/stdc++.h>
using namespace std;
#define sz(x) (((int) x.size()))
typedef long long ll;
const int maxN = 3*500;
const int maxM = 500*1000 + 100;
const int INF = 1e9;
int to[maxM], nex[maxM], cap[maxM], origCap[maxM];
ll wei[maxM];
int head[maxN];
int ptr[maxN];
int h[maxN];
i... | ALGO | 0.999857 | 4.244092 |
4d5a36e3-801f-42f6-869e-762c17dcd7c9 | ayushgupta5/GooglePremiumLeetcode | 293. Flip Game.cpp | /* 293. Flip Game
You are playing a Flip Game with your friend.
You are given a string currentState that contains only '+' and '-'. You and your friend take turns to flip two consecutive "++" into "--". The game ends when a person can no longer make a move, and therefore the other person will be the winner.
Return all... | ALGO | 0.999992 | 6.041243 |
6c2ec31a-f862-4169-8ce8-e8219b507312 | GaoGuangyong/LC | 牛客 华为/HJ48 从单向链表中删除指定值的节点.cpp |
// 题意:
// 输入一个单向链表和一个节点的值,从单向链表中删除等于该值的节点,删除后如果链表中无节点则返回空指针
// 链表的值不能重复
// 输入:6 2 1 2 3 2 5 1 4 5 7 2 2
// 第一个参数 6 表示输入总共 6 个节点
// 第二个参数 2 表示头节点值为 2
// 剩下的 2 个一组表示第 2 个节点值后面插入第 1 个节点值,[1 2] 表示 2 后面插入 1
// 最后一个参数为 2,表示要删掉值为 2 的节点
// 6 2 [1 2] [3 2] [5 1] [4 5] [7 2] 2
// 2 是头节点
... | ALGO | 0.999979 | 4.43889 |
a79a9c91-86cb-4bc0-912a-faaa6f45c83e | G33k1973/CodingGames | MailSystem.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
struct Order {
int index, freq;
Order() {
this->index = this->freq = -1;
}
Order(int a, int b) {
this->index = a;
this->freq = b;
}
bool operator>(Order& obj) {
if (this->freq == obj.freq)return this->index < obj.index;
return (this->freq... | ALGO | 0.999855 | 4.122203 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.