uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
5be4f544-794d-4639-955e-8059c97f6fe6 | Bkmakwana2002/DSA | Graphs/topological-sort(bfs).cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to return list containing vertices in Topological order.
vector<int> topoSort(int n, vector<int> adj[])
{
// code here
vector<int> ans;
queue<int> q;
vector<int> inde... | ALGO | 0.99992 | 6.753719 |
4eb94056-15bd-41e2-a845-d18b47535dd6 | Yawn-Sean/Daily_CF_Problems | daily_problems/2024/07/0710/personal_submission/cf1060e_tsreaper.cpp | #include <bits/stdc++.h>
#define MAXN ((int) 2e5)
using namespace std;
int n, m;
long long ans;
vector<int> e[MAXN + 10];
int f[MAXN + 10][2];
long long g[MAXN + 10][2];
void dfs1(int sn, int fa) {
for (int fn : e[sn]) if (fn != fa) {
dfs1(fn, sn);
f[sn][0] += f[fn][1];
f[sn][1] += f[fn][... | ALGO | 0.999871 | 4.208024 |
b5ca6f2d-12b6-4f08-a250-56c69b5e7e9c | Sarvesh-maker14/Daily-DSA-practice | week11/recursion/power.cpp | #include<iostream>
#include<bits/stdc++.h>
using namespace std;
// void gun(){
// cout<<"hello sarvesh gun"<<endl;
// }
int power(int a , int b){
if( b==0) return 1;
return a*power(a,b-1);
}
int main()
{
cout<<power(3,2);
} | ALGO | 0.999831 | 4.411468 |
27cd2e9c-199f-47ec-8f8c-a270d83c0b15 | olirrrt/Games202-In-Unity | 202/Assignment2/prt/ext/eigen/doc/examples/DenseBase_template_int_middleRows.cpp | #include <Eigen/Core>
#include <iostream>
using namespace Eigen;
using namespace std;
int main(void)
{
int const N = 5;
MatrixXi A(N,N);
A.setRandom();
cout << "A =\n" << A << '\n' << endl;
cout << "A(1..3,:) =\n" << A.middleRows<3>(1) << endl;
return 0;
}
| ALGO | 0.942261 | 3.230579 |
6919d73a-eda2-4611-9033-92391093f67e | openkylin/kwin | src/plugins/nightcolor/suncalc.cpp | #include "suncalc.h"
#include "constants.h"
#include <QDateTime>
#include <QTimeZone>
#include <QtMath>
namespace KWin
{
#define TWILIGHT_NAUT -12.0
#define TWILIGHT_CIVIL -6.0
#define SUN_RISE_SET -0.833
#define SUN_HIGH 2.0
static QTime convertToLocalTime(const QDateTime &when, const QTime &utcTime)
{
const Q... | TOOL | 0.939262 | 6.808012 |
649aabdc-322d-4c36-a317-90c455b345ad | sinedanat/cpp_all-in-one_for_dummies_mueller_2020 | book1/ch04/bk04_add_integer-2.cpp | #include <iostream>
using namespace std;
int main()
{
int start;
int time;
int total;
start = 37;
time = 22;
total = start + time;
cout << total << endl;
return 0;
}
// 59
| ALGO | 0.998079 | 3.527913 |
20dba5ae-2bb5-45b0-ba92-156716927322 | z-abe/C-.coursework | tower_of_hanoi.cpp | #include <iostream>
using namespace std;
void hanoi(int n, char source, char target, char temporary) {
if (n == 1) {
cout << "Move disk 1 from " << source << " to " << target << endl;
return;
}
hanoi(n - 1, source, target, temporary);
cout << "Move disk " << n << " from " << source << ... | ALGO | 0.99997 | 6.486266 |
2796fb5c-e523-407f-ba8d-7b5f7d145c6a | VarshaBandi/My_Genesis_Training | Modern_CPP/Day_8/sliding.cpp | #include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
void maxSlidingWindow(vector<int>& nums, int k) {
int sz = nums.size();
for(int i=0;i<sz-k;i++)
{
int max=nums[i];
for(int j=0;j<k;j++)
{
if(nums[i+j]>max)
... | ALGO | 0.999986 | 5.272624 |
a17e10fc-9c43-460a-a74f-342f5694467e | allwellll/cf_code_jiangly | cuiaoxiang/1103/1103E-E-Radixsum.cpp | // url:https://codeforces.com/contest/1103/problem/E
// time:2022-04-06 18:06:28
// name:E-Radixsum
// #define LOCAL
#define _USE_MATH_DEFINES
#include <array>
#include <cassert>
#include <cstdio>
#include <cstring>
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
#include <vector>
#include ... | ALGO | 0.999932 | 4.553616 |
3aa7dc3e-f5a4-4c06-a7da-4c9694a71958 | elnfach/Catch-up | Engine/libs/box2d/src/dynamics/b2_prismatic_joint.cpp | #include "box2d/b2_body.h"
#include "box2d/b2_draw.h"
#include "box2d/b2_prismatic_joint.h"
#include "box2d/b2_time_step.h"
// Linear constraint (point-to-line)
// d = p2 - p1 = x2 + r2 - x1 - r1
// C = dot(perp, d)
// Cdot = dot(d, cross(w1, perp)) + dot(perp, v2 + cross(w2, r2) - v1 - cross(w1, r1))
// = -dot(p... | ALGO | 0.997698 | 7.604907 |
4697bde2-4a04-40b5-9aa1-1324e10fbe25 | jsouliss/DSA | NeetCode/00-StaticArrays/LeetCode/concatArray.cpp | //
// Created by Jerry Solis on 11/15/24.
//
// LeetCode Problem: 1929. Concatenation of Array
#include <iostream>
#include <vector>
using namespace std;
class Solution {
public:
vector<int> getConcatenation(vector<int>& nums) {
vector<int> result;
for (int i = 0; i < 2; ++i) {
for (in... | ALGO | 0.998372 | 6.421282 |
706452f8-9285-4057-8deb-b82477e6a552 | Aveosoftware/aveo_login_lite | 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.99887 | 6.783439 |
8e2c7fdc-5c39-4933-af9d-4ffe064b02ae | 2Sumin/2022-1 | 2022-1_Algo/W12/AL12.2.cpp | #include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <math.h>
using namespace std;
/*
input-1
4 9
1 2 2
1 3 9
2 1 1
2 3 6
2 4 4
3 2 7
3 4 8
4 1 6
4 2 3
output-1
21
1 3 4 2 1
1 7 21
2 0 1
2 4 10
2 6 20
3 1 8
3 4 14
3 5 12
4 0 6
4 1 4
*/
/*
TSP - DP
W : 주어진 그래프 G=(V,E)의 인접 행렬
V : 모든 도시의 집합
A :... | ALGO | 0.999982 | 4.087975 |
bbef2a0a-37a1-41be-979a-879b27426e67 | cerberodev/io_extended_23 | 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 |
e6b7988c-f5a6-441a-a5bb-0d581def7c18 | randompitch/Data-Structures-Algorithms | Contests/codechef/04/3.cpp | #include <iostream>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <algorithm>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <limits.h>
using namespace std;
typedef long long ll;
void solve(){
int n,x;
cin >> n >> x;
string s;
... | ALGO | 0.999975 | 4.591825 |
34635e0c-b4b0-414d-b0ab-8fd5c50d1724 | ishandutta2007/codeforces | dlalswp25/normal/1515/D.cpp | #include <bits/stdc++.h>
using namespace std;
int N, L, R;
int A[202020];
vector<int> vl[202020];
vector<int> vr[202020];
int main() {
int tc; scanf("%d", &tc);
while(tc--) {
scanf("%d%d%d", &N, &L, &R);
for(int i = 1; i <= N; i++) {
vl[i].clear(); vr[i].clear();
}
for(int i = 1; i <= N; i++) {
scanf... | ALGO | 0.999852 | 3.757591 |
8e48962f-ea62-40a8-9e9d-3971b53048fa | gupta-manas6268/learning-C | TLE Eliminators/TLE Eliminators Level-2/Ch-010/0_42_pr.cpp | // This is Mentor's code.
// Correct.
// AGGRCOW - Aggressive cows
// https://www.spoj.com/problems/AGGRCOW/
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define int long long
const int MOD = 1e9 + 7;
const int INF = LLONG_MAX >> 1;
int check(long long mid, vector<long long> &x, long long c){
... | ALGO | 0.999997 | 5.457963 |
0de1f06a-94c3-4a30-afab-0fc00d55e6df | ramandpkaur/dsa-using-cpp | 00_Assignments/Day5.cpp | #include<iostream>
using namespace std;
int main() {
// Print number from 280 to 250 with the help of for loop.
for(int i=280; i>=250; i--) {
cout<<i<<" ";
}
cout<<endl;
cout<<endl;
// Print char from ‘A’ to ‘Z’ with the help of a for loop.
char letter = 'A';
for(int i=0; i<26;... | TOOL | 0.978898 | 3.147449 |
d3527c5e-e9db-4045-980c-99657e236171 | ishandutta2007/codeforces | anandoza/normal/1249/A.cpp | #include <bits/stdc++.h>
using namespace std;
// clang-format off
// template {{{
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define f first
#define s second
#define sz(x) int((x).size())
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define trav(a, x) for (auto... | ALGO | 0.99944 | 5.293989 |
54c581d7-7714-4f3b-9efb-26e8b634b555 | DWWC-22BCSKPIT-901/day-2-assignments-Pawan94580 | Day 2/Medium2.cpp | //Ques 3. Determine if a 9 x 9 Sudoku board is valid. Only the filled cells need to be validated according to the following rules:
Each row must contain the digits 1-9 without repetition.
Each column must contain the digits 1-9 without repetition.
Each of the nine 3 x 3 sub-boxes of the grid must contain the digits 1-9... | ALGO | 0.999938 | 7.497619 |
dcfd3e7c-da21-4374-9904-723542bc7299 | Shen-Lab/BAL | dependencies/eigen_library/doc/examples/TutorialLinAlgExComputeSolveError.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
MatrixXd A = MatrixXd::Random(100,100);
MatrixXd b = MatrixXd::Random(100,50);
MatrixXd x = A.fullPivLu().solve(b);
double relative_error = (A*x - b).norm() / b.norm(); // norm() is L2 norm
cout << "The ... | ALGO | 0.999874 | 3.645256 |
b6113b9e-b1ac-40a6-91c0-0fe14a0c1dda | anshumankr001/CS204 | PostMidsemLab_3/Black_White.cpp | #include <bits/stdc++.h>
#define f(i, a, b) for(int i=a; i<b; i++)
using namespace std;
int visited[10000][10000];
int input[10000][10000];
int COUNT;
bool is_valid(int, int, int, int, int);
void BFS(int, int, int, int, int, int);
void reset_visited(int, int);
void func(int, int);
int main()
{
int n, m, k, a, b;... | ALGO | 0.999952 | 3.953872 |
b8312066-0845-48d2-b563-af0538595657 | Kashshaf-Labib/Codeforces_Problems- | 354_Sum_in_binary_tree.cpp | /*“So, be patient. Surely Allah’s promise is true, and let not the disbelievers shake your firmness” (Quran, 30:60)*/
#include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
ios_base ::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--)
{
ll n;
ci... | ALGO | 0.999985 | 5.327199 |
8072146c-bb6f-49e0-9d04-de1e2e68e165 | vantung21/learning | vinhdinhcoder/sexyprime.cpp | #include<iostream>
#include<cmath>
using namespace std;
int prime[1000001];
void sieve(){
for(int i=0; i<1000001; i++){
prime[i]=1;
}
prime[0]=prime[1]=0;
for(int i=2; i<=1000; i++){
if(prime[i])
for(int j=i*i; j<=1000000; j+=i){
prime[j]=0;
}
... | ALGO | 0.999899 | 3.687546 |
f9b0e6f1-aa3c-4bcc-ad99-dda5be6c05ea | fsjhhh/acm_title | cpp/atcoder/abc331/B.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <queue>
#include <deque>
#include <iomanip> // std::fixed std::setprecision(x) 保留x位小数
#include <array>
#include <bitse... | ALGO | 0.999626 | 4.2274 |
0e13dc96-32c5-4f7c-a800-030dab45926a | NguyenHuuVanh/All-File | C++/Day_0/bt12.cpp | #include <iostream>
using namespace std;
int main()
{
int a, b;
cout << "Nhap a va b:";
cin >> a >> b;
if (a == 0 || b == 0)
{
cout << "Uoc chung lon nhat cua " << a << " va " << b << " la " << a + b;
}
else if (a > b)
{
cout << "Uoc chung lon nhat cua " << a << " va " <... | ALGO | 0.999228 | 3.585532 |
9d9f617f-36d7-4ebb-a20a-fd8bf40577fb | rajanraj2/CodeForces | Contests/CF_Round_958_D2/C.cpp | // You are given a positive integer n
// . Find the longest sequence of positive integers a=[a1,a2,…,ak]
// that satisfies the following conditions, and print the sequence:
// ai≤n
// for all 1≤i≤k
// .
// a
// is strictly increasing. That is, ai>ai−1
// for all 2≤i≤k
// .
// ai|ai−1=n
// for all 2≤i≤k
// , where... | ALGO | 0.999908 | 5.465975 |
50c8f944-d9a8-4a75-b6df-eb770ffe5c6b | oh980225/Tools_Algorithm | MyAlgor/MyAlgor/Programmers_Square.cpp | #include <string>
#include <vector>
using namespace std;
long long solution(int w, int h) {
long long answer;
long long W = w;
long long H = h;
if (w == h) {
answer = (W * H) - W;
}
else {
long long a=W, b=H, c;
while (b != 0) {
c = a % b;
a = b;
b = c;
}
l... | ALGO | 0.999503 | 4.515447 |
8b082006-b01a-4f84-b2fa-f1af036bb7e6 | MonikaPriya-CubeNSquare/ipl-score-predictor | venv/Lib/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.998272 | 7.214447 |
55a1673b-f336-40b5-a030-984243d7a615 | codacy-open-source-projects-scans/gpdb | src/backend/gporca/libgpopt/src/xforms/CXformImplementTVF.cpp | #include "gpopt/xforms/CXformImplementTVF.h"
#include "gpos/base.h"
#include "gpopt/operators/CExpressionHandle.h"
#include "gpopt/operators/CLogicalTVF.h"
#include "gpopt/operators/CPatternMultiLeaf.h"
#include "gpopt/operators/CPhysicalTVF.h"
using namespace gpopt;
//----------------------------------------------... | TOOL | 0.896887 | 7.168699 |
934080c5-a2ad-42c7-9ae1-49ae1eb4a484 | kushkumarkashyap7280/DSA | day_058/leetcode_20.cpp | //20. Valid Parentheses
//https://leetcode.com/problems/valid-parentheses/
/*
Given a string s containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.
An input string is valid if:
Open brackets must be closed by the same type of brackets.
Open brackets must be closed ... | ALGO | 0.96703 | 7.307714 |
5fbf2c12-806c-408c-9045-108ecbda47be | ricosjp/monolish-debian-package | src/internal/math/float_math.cpp | #include "../../../include/monolish_blas.hpp"
#include "../monolish_internal.hpp"
namespace monolish {
namespace internal {
//////////////
// sqrt
//////////////
void vsqrt(const size_t N, const float *a, float *y, bool gpu_status) {
Logger &logger = Logger::get_instance();
logger.func_in(monolish_func);
if (g... | ALGO | 0.993004 | 6.789144 |
4f5b62a7-999d-4a7f-94f1-e6efdc6f609e | IshanC05/LeetCode-Questions | 0084-largest-rectangle-in-histogram/0084-largest-rectangle-in-histogram.cpp | class Solution {
public:
vector<int> PrevSmaller(vector<int>& arr, int n){
vector<int>ans(n);
stack<int>st;
st.push(0);
ans[0] = -1;
for(int i = 0; i < n; i++){
while(!st.empty() && arr[st.top()] >= arr[i])
s... | ALGO | 0.999993 | 6.144344 |
d0a1e9f7-9746-4cbc-9bfb-f95147f0b385 | bioconductor-source/muscle | src/ppscore.cpp | #include "muscle.h"
#include "textfile.h"
#include "msa.h"
#include "tree.h"
#include "profile.h"
#include "objscore.h"
#include <R.h>
bool g_bTracePPScore = false;
MSA *g_ptrPPScoreMSA1 = 0;
MSA *g_ptrPPScoreMSA2 = 0;
static ProfPos *ProfileFromMSALocal(MSA &msa, Tree &tree)
{
const unsigned uSeqCount = msa.GetSe... | ALGO | 0.903763 | 4.726811 |
d22910db-8185-402c-a91a-e4df1e91b268 | AizaAsim/DSA | DSA1/DSA_QUESTIONS/week3Q3.cpp |
#include<iostream>
using namespace std;
class node
{public:
int data;
node*next;
};
class LinkedList
{public:
node *head=nullptr;node*temp;
void create()
{
int choice = 1; temp = head;
while (choice) {
node* newnode = new node;
cout << "Enter the value" << endl;
cin >> newnode->data;
new... | ALGO | 0.999574 | 3.438987 |
97c2384b-3186-4959-8201-86ac888601ef | ishandutta2007/codeforces | qiqi20021026/normal/666/C.cpp | #include<bits/stdc++.h>
using namespace std;
#define LL long long
#define N 300000
#define M 240000
const LL mod=1000000007;
LL n,m,op,x,ans,xb,fac[N],ifac[N],pw25[N],pw26[N],ipw26[N],c[N][2],h[N];
map<int,int> f[N],g[N];
char s[N];
LL C(LL x,LL y){
return fac[x]*ifac[y]%mod*ifac[x-y]%mod;
}
LL inv(LL x){
return... | ALGO | 0.999899 | 4.158216 |
49960b30-06e6-4ce5-987d-312f75f533d9 | ishandutta2007/codeforces | olphe/normal/1327/C.cpp | #include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "stack"
#include "set"
#include "functional"
#include "algorithm"
#include "string"
#include "map"
#include "unordered_map"
#include "unordered_set"
#include "iomanip"
#include "cmath"
#include "random"
#include "bitset"
#include "cstdio"
... | ALGO | 0.999477 | 3.029064 |
09267c0b-2a34-4dcd-9d3f-44209d4b28e2 | hlcool/MINI_CAFFE | src/layers/argmax_layer.cpp | #include <algorithm>
#include <functional>
#include <utility>
#include <vector>
#include "./argmax_layer.hpp"
namespace caffe {
void ArgMaxLayer::LayerSetUp(const vector<Blob*>& bottom,
const vector<Blob*>& top) {
const ArgMaxParameter& argmax_param = this->layer_param_.argmax_param();... | DATA | 0.914214 | 6.639448 |
c66e49c8-204f-4625-89a9-5b94bc3a259b | Safwan-Ibrahim/CPP | Contest/Brain Booster/IEEE/Rough.cpp | // Created on: 2025-02-26 10:46
// Author: Safwan_Ibrahim
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
void Try() {
int x, a, b; cin >> x >> a >> b;
int s = abs(x - a), m = abs(x - b);
if (s < m) {
cout << "7vai\n";
}
else if (m < s) {
cout... | ALGO | 0.997857 | 4.327839 |
fd7f6916-fa81-4fe9-ba5a-f18d57731827 | genwockz/e-test | EmissionTesting/lib/opencv/sources/modules/calib3d/src/homography_decomp.cpp | #include "precomp.hpp"
#include <memory>
namespace cv
{
namespace HomographyDecomposition
{
//struct to hold solutions of homography decomposition
typedef struct _CameraMotion {
cv::Matx33d R; //!< rotation matrix
cv::Vec3d n; //!< normal of the plane the camera is looking at
cv::Vec3d t; //!< translatio... | ALGO | 0.999881 | 6.196867 |
41e84d09-cc0f-4a65-a615-b209eec55159 | JongssLee/codetree-TILs | 240919/최고의 33위치/best-place-of-33.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <algorithm>
#include <stack>
using namespace std;
int n, m;
int board[100][100] = { 0, };
stack < pair<pair<int, int>, int>> S;
int res = 0;
int dx[3] = { 1,1,1 };
int dy[3] = {-1, 0, 1};
int dp[3000][3000];
int main() {
cin >> n;
for (int i = 1; i <= n... | ALGO | 0.999824 | 3.83071 |
e61165f8-6f0d-473d-98ac-955968d84f02 | yyjqr/Eangel | c_cpp_Important_code/STL/listTest/main.cpp | /*
* @Descripttion:
* @Author: Jack
* @Date: 2022-03-02 22:21:58
* @LastEditors: Jack
* @LastEditTime: 2024-02-20 21:43:20
*/
//使用list对整数进行升序排序
//对double进行排序
#include <iostream>
#include <vector>
#include <list>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
vector<int> vec={1,3,5};
... | ALGO | 0.998301 | 3.84703 |
5cab6b58-1181-4f32-b5e8-f9644c8f1d2d | EKRoy/daily-practics-problem | week-12/day4/A_Creating_Words.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define TC(t) int t; cin >> t; for(int i = 1; i <= t; i++)
#define pii pair<int,int>
#define ft ios::sync_with_stdio(false); cin.tie(NULL);
#define endl "\n"
#define pb push_back
#define... | ALGO | 0.999858 | 3.762023 |
de94243c-3d87-41bc-9fd6-4ebd9fc9aed5 | arnab7070/BeyondCoding | C++ Programs/Practice Problems/mergeSort.cpp | #include <iostream>
using namespace std;
void merge(int *arr, int low, int high)
{
int mid = (low + high) / 2;
int l1 = mid - low + 1;
int l2 = high - mid;
int arr1[l1], arr2[l2];
int mai = low;
for (int i = 0; i < l1; i++)
{
arr1[i] = arr[mai++];
}
int idx2 = 0; // Initiali... | ALGO | 0.999997 | 5.089377 |
f06b3289-4353-4c82-8e28-cdd11f65d991 | NinomaeKanade/Praktikum-Algoritma-Pemrograman | Job Sheet 5-Flow Control (Decision Making)/Tugas/Tugas 1 - Kalkulator Sederhana.cpp | /*
Nama : Rafli Arianto
NIM : 23343051
Prodi : Informatika
*/
#include <stdio.h>
int main() {
double a,b;
char pilihan;
printf("Input jenis operasi yang akan dilakukan (+, -, /, *)\n");
scanf("%c", &pilihan);
printf("Input angka 1: ");
scanf("%lf", &a);
printf("Input angka 2: ");
scanf("%lf", &b);
s... | TOOL | 0.987653 | 3.575914 |
2a5069bb-e85e-4907-9d4a-9698a6003460 | dye8128/ABC | 302A.cpp | #include <iostream>
using namespace std;
int main() {
long a, b;
cin >> a >> b;
long t = 0;
t = a / b;
if(a % b != 0) t++;
cout << t << endl;
} | ALGO | 0.999281 | 3.737151 |
938eade5-d282-4b92-b003-fbead1fc4a28 | singh-gurkawalbir/LeetCode_Solns | 1026. Maximum Difference Between Node and Ancestor/Sol.cpp | class Solution {
public:
int maxDifference = 0;
void findMaxAncestorDifference(TreeNode* currentNode, int minValue, int maxValue) {
if (currentNode) {
minValue = std::min(minValue, currentNode->val);
maxValue = std::max(maxValue, currentNode->val);
maxDifference = s... | ALGO | 0.99998 | 7.250657 |
2fee440e-7553-4a11-852c-5f54175591c6 | annemiekie/Plucker | libraries/eigen-3.4.0/doc/examples/Tutorial_BlockOperations_colrow.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
int main()
{
Eigen::MatrixXf m(3,3);
m << 1,2,3,
4,5,6,
7,8,9;
cout << "Here is the matrix m:" << endl << m << endl;
cout << "2nd Row: " << m.row(1) << endl;
m.col(2) += 3 * m.col(0);
cout << "After adding 3 times the first colu... | ALGO | 0.995006 | 3.576145 |
505f2af3-a8bf-4a20-86de-8efd1e6d5211 | hammadhassan94/Cheetay-Test | q1.cpp | int *spirallyTraverse(int R, int C, int **matrix) {
if (R < 1 || C < 1) {
return NULL;
}
int remainingTraverses = R * C;
int cur_direction = 0; //0: Left, 1:Down, 2:Right, 3:Up
int *result = new int[R * C];
int looped = -1; // increase depth in spiral
int ri = 0, ci = -1; //curren... | ALGO | 0.999596 | 4.335455 |
87dfdaf0-d503-4e3f-9941-2511fc14febc | tim-brich/https-github.com-tim-brich-lab-tester | results/0a339a40-6633-4087-b356-e23e20f1edd7.cpp | #include <iostream>
using namespace std;
int main() {
int x;
cin >> x;
cout << 25 << endl;
return 0;
}
| ALGO | 0.973903 | 3.030406 |
4b02041b-50de-4a94-8136-fe6053e9df10 | sarvex/leetcode-ocaml | solution/0400-0499/0421.Maximum XOR of Two Numbers in an Array/Solution.cpp | class Trie {
public:
vector<Trie*> children;
string v;
Trie()
: children(2) {}
void insert(int x) {
Trie* node = this;
for (int i = 30; ~i; --i) {
int v = (x >> i) & 1;
if (!node->children[v]) node->children[v] = new Trie();
node = node->child... | ALGO | 0.999985 | 5.733659 |
eafbe150-4a75-4799-9f1a-8f503352e435 | hridita-deb/Codeforces-solutions | 800-Level/Fair Playoff.cpp |
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int a,b,c,d;
cin>>a>>b>>c>>d;
int max_1=max(a,b) ;
int max_2=max(c,d) ;
vector<int>v= {a,b,c,d};
sort(v.begin(),v.end());
int max_1st=v[3];
int max_2... | ALGO | 0.999873 | 3.899343 |
a08c3299-c326-47ac-ac50-67bdcb09c0c9 | KVSchandra/GeeksForGeeks | Easy/Normal BST to Balanced BST/normal-bst-to-balanced-bst.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
struct Node *left;
struct Node *right;
Node(int x){
data = x;
left = NULL;
right = NULL;
}
};
// } Driver Code Ends
/*Structure of the Node of the BST is as
struct Node
{
int data;
Node* left, *right;
... | ALGO | 0.999393 | 6.708442 |
2f4afa34-22aa-4db1-bf38-df7dbc30f409 | minhieu03/baitap1 | thuvienLL/Drivers/CMSIS/NN/Examples/ARM/arm_nn_examples/cifar10/arm_nnexamples_cifar10.cpp | /**
* @ingroup groupExamples
*/
/**
* @defgroup CNNExample Convolutional Neural Network Example
*
* \par Description:
* \par
* Demonstrates a convolutional neural network (CNN) example with the use of convolution,
* ReLU activation, pooling and fully-connected functions.
*
* \par Model definition:
* \par
*... | DATA | 0.851294 | 5.572511 |
49a4e0e6-9efe-4da0-aab6-3ae947f54711 | codingNoob12/algorithm-study | cpp/바킹독_알고리즘/이분탐색/14921.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
int a[100'000];
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
int ans = 0x7f7f7f7f;
for (int i = 0; i < n; i++) {
auto l = lower_bound(a, a + n, -a[i]);
for (in... | ALGO | 0.999974 | 4.482955 |
6b7ab454-b857-4b2b-9cc7-b29065f9d902 | priya0498/Leetcode | 532-k-diff-pairs-in-an-array/532-k-diff-pairs-in-an-array.cpp | class Solution {
public:
int findPairs(vector<int>& nums, int k) {
sort(nums.begin(), nums.end());
int i = 0, j = 1, count = 0;
while (i < nums.size() && j < nums.size())
{
if (i == j || nums[j] - nums[i] < k) j++;
else if (nums[j] - nums[i] > k) i++;... | ALGO | 0.99988 | 5.867989 |
7d14ac8e-68f5-4889-b72d-57efddbb8866 | ishandutta2007/codeforces | eureka/normal/288/C.cpp | #include <vector>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <string>
#include <cstring>
#include <ctime>
#include <complex>
using namespace std;
typedef long long lld;
//typedef __int64 lld;
typedef unsigned lon... | ALGO | 0.999969 | 3.123981 |
7146f7a0-1983-4454-83a7-2232479a5672 | harshkvr7/DSA | 14_dec_23/pattern_9.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int rows;
cin >> rows;
for (int x = 0; x < rows; x++)
{
for (int y = 0; y < rows; y++)
{
if (x + y == rows-1 || x == y)
{
cout << "* ";
}
else
{
... | ALGO | 0.99981 | 3.847923 |
24ac2095-7484-4370-a530-1215cae74148 | SaifullahMnsur/Problem-Setting | ICE Programming Club/Contest 3.2 (29-05-2024)/How many caps v4/generator.cpp | #include <bits/stdc++.h>
using namespace std;
int generateRandom(int n) {
random_device rd;
mt19937 gen(rd());
uniform_int_distribution<> dis(1, n);
return dis(gen);
}
int compare(const void *a, const void *b) {
return (*(int*)b - *(int*)a);
}
int main()
{
// directory verification
string... | ALGO | 0.999827 | 3.489073 |
ea80783e-125e-4d5a-b0d4-2c2cdafadb63 | daniel-oliv3/Introducao-a-Programacao_500-Algoritmos-Resolvidos-Por-Lopes-Garcia | Capítulo 3 - Estrutura de Seleção/linguagem-c/98_exercicio.cpp | #include<stdio.h>
#include<stdlib.h>
#include<locale.h>
/* 98 - A prefeitura do rio de janeiro abriu uma linha de crdito para funcionrios estatutrios.
O valor mximo da prestao no poder ultrapassar 30% do salrio bruto. fazer um algoritmo
que permita entrar com o salrio bruto e o valor da prestao e informar se o emprst... | ALGO | 0.932854 | 3.092817 |
91ef0d43-45f3-4bd2-8026-2163a1f1a4c2 | ishandutta2007/codeforces | qwertypi/normal/1271/A.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int a, b, c, d, e, f;
cin >> a >> b >> c >> d >> e >> f;
int t_a = a;
int t_b = min(b, c);
if(e < f){
swap(e, f);
swap(t_a, t_b);
}
int st;
int ans = 0;
st = min(d, t_a);
ans += st * e;
d -= st;
st = min(d, t_b);
ans += st * f;
cout << ans << ... | ALGO | 0.999894 | 3.545087 |
f329a4e6-02e1-41e8-8e9a-8ff44822fa77 | jyothisivani/Cpp | Experiment 12/program12a.cpp | #include <iostream>
using namespace std;
class Add
{
public:
int add(int a,int b)
{
return a + b;
}
int add(int a,int b,int c)
{
return a + b + c;
}
};
int main()
{
Add a;
cout<<"Sum of 10,20 is:"<<a.add(10,20)<<endl;
cout<<"Sum of 10,20,30 is:"<<a.add(10,20,30)<<endl;
return 0;
}
| TOOL | 0.938547 | 4.781843 |
fd225e77-71ea-4ba3-ba23-7c9ca7d5b656 | xionglin123/FishBox | Fish_Box_Test/Fish_Box_Test/libs/Box2D/Dynamics/Joints/b2RopeJoint.cpp | #include <Box2D/Dynamics/Joints/b2RopeJoint.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2TimeStep.h>
// Limit:
// C = norm(pB - pA) - L
// u = (pB - pA) / norm(pB - pA)
// Cdot = dot(u, vB + cross(wB, rB) - vA - cross(wA, rA))
// J = [-u -cross(rA, u) u cross(rB, u)]
// K = J * invM * JT
// = inv... | ALGO | 0.94518 | 7.495905 |
b081f340-6f80-4682-8a6f-d5bd2ac51b17 | LaoZZZZZ/bartender-1.0 | src/src/clustercenterlinkgenerator.cpp | #include "clustercenterlinkgenerator.h"
#include <iostream>
#include <string>
#include <vector>
#include <array>
#include "kmers_bitwisetransform.h"
using namespace std;
namespace barcodeSpace {
void ClusterCenterLinkGenerator::printFrequency(const vector<array<int,4>>& frequencies) {
cout << "******************... | ALGO | 0.997993 | 3.885209 |
6bbd881b-4a7a-4740-b186-95bcc864b235 | facebookarchive/clangir | llvm/lib/CodeGen/PHIEliminationUtils.cpp | #include "PHIEliminationUtils.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
using namespace llvm;
// findCopyInsertPoint - Find a safe place in MBB to insert a copy from SrcReg
// when following the CFG edge to SuccMBB. This needs to be af... | ALGO | 0.998482 | 7.585486 |
349bd67a-b5d6-4c55-8f2d-065fc6cc54ab | bharatk5003/Competitive-Coding | 11-07-2021/easy1.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main()
{
#ifndef ONLINE_JUDGE
// for getting input from input.txt
freopen("../input.txt", "r", stdin);
// for writing output to output.txt
freopen("../output.txt", "w", stdout);
#endif
int n;
cin >> n;
for (int i = (n + 1) ; i <= 90000... | ALGO | 0.999472 | 4.911984 |
596b34c4-72d8-4952-880e-796c1a0db5a5 | superAman07/Cpp-basic-STL-to-advance-DSA | 123. Repeating element without change original array with conditions.cpp | // Repeating element Conditions arr size >=2, only one element is repeats and all
// elements from 0 to max(arr) are present
//O(n) naive solution
// #include<iostream>
// #include<algorithm>
// using namespace std;
// int main(){
// int arr[]{0,2,1,3,2,2};
// int n = sizeof(arr)/sizeof(arr[0]);
// sort(a... | ALGO | 0.999948 | 4.852352 |
10b543fd-8e33-417c-98c1-5bc9dc5da16a | anant0059/Leetcode-Solution | problems/Easy/26. Remove Duplicates from Sorted Array.cpp | class Solution {
public:
int removeDuplicates(vector<int>& nums) {
int i=0, n=nums.size();
for(int j=1;j<n;++j){
if(nums[i]!=nums[j]) i++, nums[i]=nums[j];
}
return i+1;
}
}; | ALGO | 0.999656 | 6.244574 |
335cfa90-2cae-407a-bea8-4f879d1e995e | Metrolina-Regional-Model-Team/MRM22v2.0 | pgm/ModeChoice/Transims60/Transims60/Simulator_Service/Sim_Node/Look_Ahead.cpp | //*********************************************************
// Look_Ahead.cpp - attempt a lane change
//*********************************************************
#include "Sim_Node_Process.hpp"
#include "Simulator_Service.hpp"
//---------------------------------------------------------
// Look_Ahead
//---------------... | ALGO | 0.999711 | 6.03941 |
86a0c848-ec57-4dd3-9e27-97c60bc438f0 | ahryncyszyn/UWr_courses | [2025 lato] algortymika praktyczna/lista0/zad6_rozmiary_poddrzew.cpp | #include <iostream>
#include <vector>
using namespace std;
int dfs(int node, vector<vector<int>> &tree, vector<int> &subtree_size)
{
for (auto child : tree[node - 1])
{
subtree_size[node - 1] += dfs(child, tree, subtree_size) + 1;
}
return subtree_size[node - 1];
}
// zlozonosc czas: O(n)
int ... | ALGO | 0.999955 | 5.135272 |
e4eb970e-cbfa-47b8-bf1a-a15c4246a7e7 | matla91/Time-Series-Classification | TP_2/main.cpp | #include "sin.h"
#include "stp.h"
#include "gau.h"
#include "tsdata.h"
#include "knn.h"
#include <iostream>
#include <vector>
using namespace std;
int main() {
TimeSeriesDataset trainData(false, true), testData(false, false);
GaussianGenerator gsg;
SinWaveGenerator swg;
StepGenerator stg;
vector<d... | ALGO | 0.977098 | 5.746493 |
37354cc9-500a-4acb-a7f2-3797fe1c1637 | SinglePlayerProject/cmangos-ai-tbc | src/game/AI/ScriptDevAI/scripts/outland/coilfang_reservoir/steam_vault/boss_hydromancer_thespia.cpp | /* ScriptData
SDName: Boss_Hydromancer_Thespia
SD%Complete: 80
SDComment: Timers may need small adjustments; Elementals summon needs further research
SDCategory: Coilfang Resevoir, The Steamvault
EndScriptData */
/* ContentData
boss_hydromancer_thespia
mob_coilfang_waterelemental
EndContentData */
#include "AI/Script... | TOOL | 0.855027 | 3.181925 |
1141e714-3c6d-482e-a8fb-f8e4d966f98b | qlife/oj_codes | uva10008/uva10008-2.cpp | #include<cstdio>
#include<cctype>
#include<cstring>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
typedef struct {
char c;
int n;
} alpha;
struct pCmp : public binary_function<alpha, alpha, bool> {
bool operator() (alpha lhs, alpha rhs)
{
if (lhs.n == rhs.n)
... | ALGO | 0.999167 | 3.987529 |
a669bc08-0458-4b4a-b945-6a4ad9403b5b | 24Pranav/Leetcode_practice | leetcode-main/leetcode-main/Distance of nearest cell having 1 - GFG/distance-of-nearest-cell-having-1.cpp | //{ Driver Code Starts
#include<bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to find distance of nearest 1 in the grid for each cell.
vector<vector<int>>nearest(vector<vector<int>>grid)
{
// Code here
int n=grid.size();
int m=grid[0].size();
... | ALGO | 0.999954 | 6.440557 |
171b1c4e-673f-41a1-99d9-f09337722a78 | mukulgpt17/CP | CodeForces/69B.cpp | #include<bits/stdc++.h>
#define ull unsigned long long int
#define ll long long
#define vi vector<int>
#define vll vector<ll>
#define pb push_back
#define Loop(i,a,b) for (int i=a;i<b;i++)
using namespace std;
void solve()
{
ll n, m;
cin>>n>>m;
vector<ll> ve(n+1,-1);
vector<ll> pro(m+1);
vector<ll> time(m+1);
... | ALGO | 0.999905 | 3.63826 |
c135780d-3041-4dcb-9f12-c158bb9c4e4a | ctzsm/Tsunemori-Akane | Codeforces/Croc Champ 2013 - Round 1/292A.cpp | #include <cstdio>
#include <cstring>
#include <cstdlib>
#include <algorithm>
#include <queue>
using namespace std;
int n;
int t[1005], c[1005];
int end[1005];
int main(int argc, char** argv) {
// freopen("in", "r", stdin);
scanf("%d", &n);
for (int i = 0; i < n; ++i) scanf("%d%d", &t[i], &c[i]);
... | ALGO | 0.999876 | 3.524723 |
6841f2c0-53ba-472d-aba9-e8897b92eebc | ramancoder123/100-Days-of-DSA | Day72/cycle.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
bool cycleCheck(int node, unordered_map<int, bool> &vis, unordered_map<int, bool> &dfsCheck, vector<int> adj[]){
vis[node] = true;
dfsCheck[node] = true;
for(int i ... | ALGO | 0.99982 | 6.369317 |
35d76bed-62ff-42ff-9cd4-fb6e361afdad | csfx-py/hacktober2020 | algorithm/sorting/Quicksort.cpp | #include <iostream>
#include<vector>
#include<algorithm>
#include<utility>
#include<set>
#include<map>
#include<unordered_map>
using namespace std;
int partition (int arr[], int low, int high)
{
int pivot = arr[high]; // pivot
int i = (low - 1); // Index of smaller element
for (int j = low; j <= high- 1; j++) ... | ALGO | 0.999977 | 5.262341 |
4067323c-811f-4951-a6b6-45aabd7bef48 | zaizai945/adavanced-programming | Online judge/10323.cpp | #include<iostream>
using namespace std;
int main(){
int c,under=1,over=1;
long long tmp=1,data[100];
for(int i=2;;i++){
tmp*=i;
if(tmp>6227020800)
break;
over++;
if(tmp<=10000)
under++;
else
data[over]=tmp;
}
under++;
in... | ALGO | 0.999949 | 3.127171 |
a5e336d5-b60f-4906-954d-24bc5a01b8ca | samar-gupta/DSA_POTD | GFG/Strings Rotations of Each Other.cpp | class Solution {
public:
// Function to check if two strings are rotations of each other or not.
bool areRotations(string &s1, string &s2) {
// Your code here
if(s1.length()!=s2.length()) return false;
string ans=s1+s1;
return ans.find(s2)!=-1;
}
};
| ALGO | 0.999644 | 6.013951 |
ec13e9fc-5fb6-451d-9bf7-652c9939d671 | daspers/Random-Things | cpp/radixsort_v1.cpp | //radix sort
//My implementation based on observing the radix sort animation
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
#define mp make_pair
#define pb push_back
typedef long long ll;
ll n, arr[1000006], pos[1000006], neg[1000006];
ll ps, ns;
void radix(ll base=10){
queue<ll>... | ALGO | 0.999862 | 4.156167 |
e12d335a-c1c1-46b7-9e32-77997d4d302c | TheGrayed/advanced-programming-homework | EmployeeDataFormatter/employee_comparer.cpp | #include "stdafx.h"
#include "Employee.h"
#include "employee_comparer.h"
void employee_comparer::sort(employee* employees, short(*comparer)(employee, employee), int length, bool ascending)
{
const short criteria = ascending ? 1 : -1;
for (int i = 0; i < length - 1; ++i)
{
for (int j = 0; j < length - i - 1; ++j)... | TOOL | 0.99481 | 4.470086 |
eb945eb8-a339-4fba-9525-ac4a3df51450 | Tomy-Lee/Cpp_ProblemsCodes | 自下而上语法分析.cpp | /*时间限制:1秒 内存限制:256兆 题目描述
输入开始符号,非终结符,终结符,产生式,LL(1)分析表
输出LL(1)分析表
输入格式
输入开始符号;
非终结符个数,非终结符,空格符分隔;
终结符个数,终结符,空格符分隔;
产生式的个数,各产生式的序号,产生式的左边和右边符号,空格符分隔;
LL(1)分析表中的产生式个数,序号,行符号,列符号,产生式编号,空格符分隔;
输入一个算术式符号串,用#结束
输出格式
输出推导过程,每一步一行,中间“ & ”前是已经识别的子串,后是栈中信息。
*/
#include <iostream>
#include<string>
using namespace std;
st... | ALGO | 0.999953 | 3.379081 |
8b982296-81ef-493f-8150-bc5bf442a79d | Rahulkumar8967/HackDsa | striverseries/Design and Analysis of Algo/17DFS.cpp | #include <bits/stdc++.h>
using namespace std;
// dfs algorithm // adjList, vis , start chaiye
// tc = O(V + E) , sc = O(V) for the visited array
void dfs(int node, vector<int> &vis, vector<int> &ans, vector<int> adj[]){
vis[node] = 1;
ans.push_back(node);
for (auto it : adj[node])
{
if (!vis[it])
{
... | ALGO | 0.999936 | 5.635873 |
6a835d97-024c-4c33-ace0-534a559258da | TDSn3/codingame | winter_challenge_2023/sources/class/Data/distance.cpp | /* ************************************************************************** */
/* */
/* ::: :::::::: */
/* distance.cpp :+: :+: :+: ... | ALGO | 0.992051 | 4.817906 |
0bece258-907c-4806-90e6-8525b38e5d95 | por-se/por-se | lib/Solver/AssignmentValidatingSolver.cpp | #include "klee/Expr/Constraints.h"
#include "klee/Expr/Assignment.h"
#include "klee/Solver/Solver.h"
#include "klee/Solver/SolverImpl.h"
#include <vector>
namespace klee {
class AssignmentValidatingSolver : public SolverImpl {
private:
Solver *solver;
void dumpAssignmentQuery(const Query &query, const Assignment... | ALGO | 0.947696 | 7.903996 |
cc2b2a4e-530a-4c8a-afde-d2e448506f7e | Junbro0708/Algorithm | 51_Ceasar/main.cpp | #include <iostream>
#include <string>
/*
* [51] 프로그래머스 시저 암호
*/
using namespace std;
string solution(string s, int n) {
for(int i = 0; i < s.size(); i++){
if(s[i] >= 97 && s[i] <= 122){
if(s[i] + n > 122) s[i] = s[i] + n -26;
else s[i] += n;
}
if(s[i] >= 65 && s[... | ALGO | 0.999867 | 6.098672 |
910137ea-47f6-43f6-b99f-511be6df723d | MUTHUSE/DSAPractice | 4.pattern/16.pattern16.cpp | #include <bits/stdc++.h>
using namespace std;
/**
* A
* BB
* CCC
* DDDD
* EEEEE
*/
int main() {
// Write C++ code here
int n;
cout<<"\n Enter the n value : ";
cin>>n;
char ch = 'A';
for(int i=0;i<n;i++){
for(int j=0;j<=i;j++){
... | ALGO | 0.99959 | 4.095478 |
1279108a-8ecf-4e92-a90e-69d58c6b1bbc | tnextday/HappyShake | HappyShake/IniMem.cpp | //IniMem.cpp
/************************************************************************/
/*
2009-10-21 :
ֶһһַʱ, дbug
*/
/************************************************************************/
#include <stdio.h>
#include <TCHAR.H>
#include <WCHAR.H>
#include <vector>
#include "IniMem.h"
TCHAR *stristr(LPCTSTR lpFir... | TOOL | 0.942486 | 3.67251 |
93aca8c9-83e1-430c-93f8-334a5948640b | ankitverma-123-code/CPP-Data-Structures-Algorithms-Launchpad-master | 08. Recursion/4. Subset Based/3. 01 Knapsack/practice.cpp | #include<bits/stdc++.h>
#define ll long long
#define pb push_back
#define MAX 100005
#define mod 1000000007 // 1e9+7
#define inf 1e18
using namespace std;
int price[MAX], weight[MAX], n, capacity, maxP = 0;
void subset(int i, int cw, int cp) {
//Base Case
if (i == n) {
if (cw <= capacity) {
maxP = max(maxP, c... | ALGO | 0.999968 | 4.305357 |
b1559216-098d-417e-80fd-a8aa19430321 | joseatort/Estructura-de-Datos | Prueba ED 5/Project1/Project1/plantilla5.cpp | /*
* Nombre y apellidos del alumno: José Antonio Tortosa Aranda & Alvaro Velasco García
*
* Usuario del juez: E65 & E66
*/
//El coste del algortimo empleado es lineal O(n)
#include <iostream>
#include <fstream>
#include "Arbin.h"
//#include "Arbin_Smart.h" //Puedes usar esta clase si lo prefieres
... | ALGO | 0.999984 | 5.390498 |
2858a871-fc42-4197-990c-49ed5a5afebd | ishandutta2007/codeforces | nikarabika/normal/677/A.cpp | //sobskdrbhvk
#include <bits/stdc++.h>
using namespace std;
typedef long long int LL;
typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
#define PB push_back
#define MP make_pair
#define L first
#define R second
#define sz(x) ((int)(x).size())
#define smax(x, y) ((x) = max((x), (y)))
#define smin(x, y) ((x) = min... | ALGO | 0.999892 | 3.50615 |
1cf95545-6b65-4ce7-b86b-e061762f285a | ishandutta2007/codeforces | prabowo/normal/762/D.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const long long INF = 1e18;
int n;
int a[3][N];
long long dp[3][N][2];
long long f(int x, int y, int z) {
if (y == n-1) {
if (z) {
if (x == 0) return 1LL * a[0][y] + a[1][y] + a[2][y];
return -INF;
}
... | ALGO | 0.999882 | 3.575089 |
86917943-af4e-4d07-bffe-edd17adecd54 | Tointech/Leetcode-solutions | HashTable/Hash-Set.cpp | #include <bits/stdc++.h>
using namespace std;
// Linear Probing
class MyHashSetA {
private:
vector<list<int>> myBuckets;
int size;
public:
MyHashSetA() {
size = 100;
myBuckets.resize(size);
}
int hashFunction(int key) {
return key%size;
}
list<int> :: iterator sea... | ALGO | 0.999798 | 5.067348 |
afcf9f24-54c0-49ce-ab41-78154eb5f845 | karnapathak/gem5_dev | src/systemc/tests/systemc/misc/synth/combo/switch5/switch5.cpp | /*****************************************************************************
switch5.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/****************************************************************************... | TOOL | 0.98155 | 4.533247 |
f772589a-ef91-4999-abb5-2fc9b78c3cc5 | SamaaAlaa1/Data-Structure | Linked-Lists/Doubly-Linked-List.cpp | #include <iostream>
using namespace std;
// Node structure for the doubly linked list
/*
Linked list in which every node has a next pointer and a back pointer
Every node contains address of next node
Except last node
Every node contains address of previous node
Except the first node
*/
struct Node
{
int data; /... | ALGO | 0.999534 | 6.654014 |
a56ed383-4a82-4162-9f46-06fca19918c0 | JoelSjogren/project-euler-solutions | src/solution_0053.cpp | /**********************************
* solution_0053.cpp *
**********************************/
#include "solution_0053.h"
#include <iostream>
using std::cout;
using std::endl;
Solution0053 s0053;
Solution0053::Solution0053() : Solution(53, this) {};
answer_t Solution0053::get_answer() {
answer_t answer... | ALGO | 0.99886 | 4.276472 |
792ed8a9-ca1f-4a88-8d28-a8e55531e768 | putdata/algorithm-problem-solving | NOJAM/16431.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
ios::sync_with_stdio(0); cin.tie(0);
int br, bc, dr, dc, jr, jc;
cin >> br >> bc >> dr >> dc >> jr >> jc;
int bx = abs(br - jr), by = abs(bc - jc), dx = abs(dr - jr), dy = abs(dc - jc);
int bMove = bx + by - min(bx, by), dMove = dx + dy;
if (bMove ... | ALGO | 0.999918 | 4.458849 |
bb3f6b44-8390-48d8-b854-3d6053e44c3f | offshore0315/Data-structures | Data structures and algorithms/计算器.cpp | #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#define MAX 150
typedef struct{
int *data;
int length;
int top;
}SqStack;
typedef struct {
char *a;
int length;
int top;
}LinkStack;
int main()
{
int initSqStack(SqStack *LS);
int initLinkStack(LinkStack *LS);
int SqStackEmpty(SqStack s);
... | ALGO | 0.999987 | 3.363485 |
2ac2484f-6dfd-4a3a-b32d-3216a7c32e22 | ping29065147/Exam-Collection | UVa/11677 - Alarm Clock.cpp | #include <iostream>
using namespace std;
int main()
{
int h1, m1, h2, m2;
int sleep, different;
while(1){
sleep=0;
cin >> h1 >> m1 >> h2 >> m2;
if (h1==0 && m1==0 && h2==0 && m2==0)
break;
if (h1==h2 && m1<=m2)
sleep += m2-m1;
else{
... | ALGO | 0.999642 | 3.868848 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.