uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
b94a41ab-b992-499b-972d-fc6e12ac4c07 | Tenchmarn/Books | 1. Lafore_R_-_Obektno-orientirovannoe_programmirovanie/5 chapter/example/static.cpp | #include <iostream>
using namespace std;
float getavg(float);
int main()
{
setlocale(LC_ALL, "RUS");
float data = 1, avg;
while (data != 0)
{
cout << "Введите число: ";
cin >> data;
avg = getavg(data);
cout << "Среднее значение: " << avg << endl;
}
return 0;
}
float getavg(float newdata)
{
static... | ALGO | 0.970371 | 3.443168 |
e6265bd8-4fcf-4ee1-b13b-be9853be81d1 | ishandutta2007/codeforces | qazswedx2/normal/1582/F2.cpp | #include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int n,a[1000005],m,lim,b[5005][9005],bt[5005],f[9005];
void ins(int x,int y)
{
for(int i=y+1;i<f[x];i++)
b[i][++bt[i]]=x;
f[x]=y;
}
int main()
{
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
scanf("%d",&a[i]);
m=max(m,a[i]);
}
lim=1;
wh... | ALGO | 0.999974 | 3.607817 |
830e63d7-d50f-451c-b745-a3b8e927dc8a | mrkimkim/Competitive-Programming-Summary | Samsung SW Test Pre/13460.cpp | #include <iostream>
#define MAX 12
using namespace std;
int N, M;
char Arr[MAX][MAX];
int Status[MAX][MAX][MAX][MAX][MAX];
int rx, ry, bx, by;
int Move(int i, int rx, int ry, int bx, int by, int ax, int ay) {
bool Flag = false;
bool r = false;
if (ax * (rx - bx) < 0 || ay * (ry - by) < 0) {
rx ^= bx, bx ^= rx, ... | ALGO | 0.999771 | 4.038771 |
574a4ec6-4322-4f96-b06c-0758f0a0d0fe | kaiuki2000/TIF330 | 1st Part/Prob_Sets/PSet2/FFTW_Real_Testing.cpp | #include <iostream>
#include <cmath>
#include <fftw3.h>
/* Potential */
double V(double x, double y){
return(-5. * pow((1. + pow(x/5., 2.) + pow(y/4., 2.)), -4.));
}
int main(int argc, const char** argv) {
int N = 11;
double *in, *outR;
fftw_complex *out;
fftw_plan p, p_Inverse;
... | ALGO | 0.99962 | 4.31025 |
bb5a9104-025f-4e39-9f9a-5b347356d62a | AbdullahAlZubaerOfficial/DSA | Basic C++/9.cpp | // switch
#include<bits/stdc++.h>
using namespace std;
/*
Take the day no and print the corresponding day
for 1 print Monday,
for 2 print Tuesday and so on for 7 print Sunday.
*/
int main() {
int day;
cin>> day;
switch(day) {
case 1:
cout<< "Monday";
br... | ALGO | 0.996868 | 3.584991 |
b3e584b5-a856-4778-a057-bbb1c5a12256 | ishandutta2007/codeforces | ecnerwala/normal/1086/B.cpp | #include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e5;
int N;
int deg[MAXN];
int main() {
ios_base::sync_with_stdio(0);
int S;
cin >> N >> S;
for (int i = 0; i < N-1; i++) {
int u, v; cin >> u >> v;
deg[u] ++;
deg[v] ++;
}
int leafs = 0;
for (int i = 1; i <= N; i++) {
leafs += (deg[i] == 1)... | ALGO | 0.99865 | 3.776254 |
7ce26a30-6d0c-46f6-bdff-2d2338bf2863 | Roonil03/LeetCodeR03 | ProblemStatements/1306. JumpGameIII/jumpGame3.cpp | class Solution {
public:
bool canReach(vector<int>& arr, int start) {
int n = arr.size();
queue<int>q;
vector<bool> vis(n, false);
q.push(start);
vis[start] = false;
while(!q.empty()){
int cur = q.front();
q.pop();
vector<int> np = ... | ALGO | 0.999995 | 5.486256 |
0bd182e7-50ca-4fbb-bec2-b2dbcdb49a39 | saipraneethd-zz/CarND-MPC | src/Eigen-3.3/doc/examples/TutorialLinAlgRankRevealing.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
using namespace Eigen;
int main()
{
Matrix3f A;
A << 1, 2, 5,
2, 1, 4,
3, 0, 3;
cout << "Here is the matrix A:\n" << A << endl;
FullPivLU<Matrix3f> lu_decomp(A);
cout << "The rank of A is " << lu_decomp.rank() << endl;
c... | ALGO | 0.999665 | 3.720849 |
73f97866-1c15-49ab-bf86-96b02d6e9bba | XiaojianTang/Udacity-Path_Planning-Project | src/Eigen-3.3/bench/sparse_lu.cpp |
// g++ -I.. sparse_lu.cpp -O3 -g0 -I /usr/include/superlu/ -lsuperlu -lgfortran -DSIZE=1000 -DDENSITY=.05 && ./a.out
#define EIGEN_SUPERLU_SUPPORT
#define EIGEN_UMFPACK_SUPPORT
#include <Eigen/Sparse>
#define NOGMM
#define NOMTL
#ifndef SIZE
#define SIZE 10
#endif
#ifndef DENSITY
#define DENSITY 0.01
#endif
#ifnd... | ALGO | 0.996381 | 4.187482 |
f38f2212-e3ad-4039-9557-6c972e859d7f | Shreyashpatil056/Codeforces | DAY37/B_Emordnilap.cpp | //this code belongs to Shreyash Shriram Patil
#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
//this code belongs to Shreyash Shriram Patil
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long ... | ALGO | 0.999958 | 5.248851 |
25b91a87-c823-4024-97c7-a4d1efca887e | ShriyanshJaiswal01/CPP | INTRO/first.cpp | #include<iostream>
using namespace std;
int main(){
char ch;
cin>>ch;
int a = ch;
if(a>=65 && a<=90){
cout<<"upper case"<<endl;
}else if(a>=97 && a<=122){
cout<<"lower case"<<endl;
}else if(a>=48 && a<=57){
cout<<"numeric value"<<endl;
}
} | ALGO | 0.971915 | 3.217001 |
9dfdef38-297d-4e79-ac1b-83580950a14a | BetterOIer/competitive-cpp-code-backup | C++PrimerPlus/Origin/Chapter 16/vect3.cpp | // vect3.cpp -- using STL functions
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
struct Review {
std::string title;
int rating;
};
bool operator<(const Review & r1, const Review & r2);
bool worseThan(const Review & r1, const Review & r2);
bool FillReview(Review & rr);
void Show... | ALGO | 0.999479 | 5.710224 |
683fbe5f-f352-47f4-a6a4-f1501ef8776e | aceyan/UE4.18.3_release | Engine/Source/Runtime/Engine/Private/SkeletalRender.cpp | /*=============================================================================
SkeletalRender.cpp: Skeletal mesh skinning/rendering code.
=============================================================================*/
#include "SkeletalRender.h"
#include "SkeletalRenderPublic.h"
#include "SceneManagement.h"
#include... | TOOL | 0.864228 | 4.415055 |
b669387e-92a8-4ab8-997d-91d92af1bd87 | claby2/gol | example/beacon_oscillator.cpp | // Implements a beacon oscillator and steps 4 times
// beacon oscillators have a period of 2
#include "../single_include/gol/gol.hpp"
#include <iostream>
gol::Board board(10, 10);
// Prints the board and then updates with next step
void printAndStep() {
std::cout << "\n";
for(int i = 0; i < board.height();... | ALGO | 0.9995 | 7.210455 |
fbf93239-8090-45ca-abd5-45881f45dced | trinhminhtriet/leetcode | solutions/0800-0899/0858.mirror-reflection/Solution.cpp | class Solution {
public:
int mirrorReflection(int p, int q) {
int g = __gcd(p, q);
p = (p / g) % 2;
q = (q / g) % 2;
if (p == 1 && q == 1) {
return 1;
}
return p == 1 ? 0 : 2;
}
}; | ALGO | 0.99996 | 5.405123 |
86a3d0ef-b067-458a-aa2e-4d846b8eb8a9 | YhomiAce/flutter_practices | 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.998809 | 6.763549 |
9c3da757-3f54-46e3-9442-65ce07062f23 | FelixFu520/Demo_CMake | 14.2/src/main.cpp | #include "sum_integers.hpp"
#include <iostream>
#include <string>
#include <vector>
// we assume all arguments are integers and we sum them up
// for simplicity we do not verify the type of arguments
int main(int argc, char *argv[]) {
std::vector<int> integers;
for (auto i = 1; i < argc; i++) {
integers.push... | ALGO | 0.854962 | 5.927844 |
365a7f7e-50a9-4796-8bc0-ec142eba9e29 | vsajip/llvm | lib/Support/SmallPtrSet.cpp | #include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/DenseMapInfo.h"
#include "llvm/Support/MathExtras.h"
#include <algorithm>
#include <cstdlib>
using namespace llvm;
void SmallPtrSetImpl::shrink_and_clear() {
assert(!isSmall() && "Can't shrink a small set!");
free(CurArray);
// Reduce the number of buckets.
... | ALGO | 0.925973 | 7.669432 |
32f4ddc8-d38b-4595-a2e1-60e9d625ff6a | jinbeomdev/daily-algorithm-problems | 카카오 프렌즈 컬러링북/카카오 프렌즈 컬러링북/카카오_프렌즈_컬러링북.cpp | #include <vector>
#include <iostream>
using namespace std;
int X[] = { 0, 1, 0, -1 };
int Y[] = { -1, 0, 1, 0 };
vector<vector<bool>> visited;
inline int max(int a, int b) { return (((a) > (b)) ? (a) : (b)); }
int dfs(int y, int x, int m, int n, vector<vector<int>> &picture) {
int number = 1;
visited[y][x] = 1;
... | ALGO | 0.99993 | 5.181316 |
0baa2f19-5512-4d89-85c8-2dbdabaf606f | KillerAery/MazeDemo | Maze/Bullet/inc/LinearMath/btThreads.cpp | #include "btThreads.h"
#include "btQuickprof.h"
#include <algorithm> // for min and max
#if BT_USE_OPENMP && BT_THREADSAFE
#include <omp.h>
#endif // #if BT_USE_OPENMP && BT_THREADSAFE
#if BT_USE_PPL && BT_THREADSAFE
// use Microsoft Parallel Patterns Library (installed with Visual Studio 2010 and later)
#include... | TOOL | 0.86412 | 5.541189 |
1603b2cb-68fe-40d7-8c19-9f6436010d34 | NancySilence/GitforLab | ContentMatchThrift20141211/Server/src/CompareArticles.cpp | #include "CompareArticles.h"
#include <limits.h>
#include <vector>
//done
vector<ModifyResult> CompareArticles::GetDiff(string inputArticleA,string inputArticleB)
{
int AIter;
int BIter;
int tempCompare;//Temp distance result between A and B
int MiniDist; //Min Distance from certain B to every A
int MiniAIndex... | ALGO | 0.989858 | 4.769281 |
209bbefc-108a-4d30-9378-ec81a03f5577 | DANIELSMS-CP/competitive-programming | Codeforces/themecp_9/C_Left_and_Right_Houses.cpp | //and in that light, I find deliverance
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
//defines
#define int long long
#define debug(x) cerr << "(" << #x << "=" << x << "," << __LINE__ << ")\n";
#define sz(x) (int... | ALGO | 0.999952 | 5.118598 |
1386743f-ab5c-41bd-a704-5affceb9d3b2 | Trangng61/untitled26 | main.cpp | #include <iostream>
using namespace std;
void lastIndex (int arr[], int n, int key) {
int end = -1;
for (int i = n -1; i >= 0; i--) {
if (arr[i] == key) {
end = i;
break;
}
}
if (end == -1)
cout << "0" << endl;
else
cout << end + 1 << endl;
}... | ALGO | 0.9998 | 5.552186 |
751125ed-9dd6-43a3-8645-3ea14ddfa298 | showmanlee/HowCanISolveThisQuestion | BOJ/17000/17356.cpp | // 욱 제
// https://www.acmicpc.net/problem/17356
#include <iostream>
#include <cmath>
#include <algorithm>
using namespace std;
int main(void) {
cin.tie(NULL);
ios_base::sync_with_stdio(false);
int a, b;
cin >> a >> b;
double m = (b - a) / 400.0;
double res = 1 / (1 + pow(10, m));
cout << res << ... | ALGO | 0.996533 | 3.498461 |
e7b49e31-1bdc-4939-b02e-80ff54b353f0 | Young-workspace/HYU | 2학년/알고리즘 및 문제해결 기법/과제5/PriorityQueue.cpp | #include<stdio.h>
#include<stdlib.h>
#include<iostream>
using namespace std;
int Parent(int index) {return index/2;}
int Left(int index){return index*2;}
int Right(int index){return index*2+1;}
void Swap(int arr[], int a, int b)
{
int tmp;
tmp = arr[a];
arr[a] = arr[b];
arr[b] = tmp;
}
void Max_Heapify(int arr[]... | ALGO | 0.999932 | 3.227029 |
0148a990-913b-42c3-80ec-626a1524299d | quanhouying/CCF-CSP-Answer | 2023/202309-1 坐标变换(其一).cpp | #include <iostream>
using namespace std;
int main()
{
int n, m, dx, dy, x, y;
cin >> n >> m;
dx = dy = 0;
// 将所有的平移累积起来
for (int i = 0; i < n;i++) {
cin >> x >> y;
dx += x;
dy += y;
}
for (int i = 0; i < m;i++) {
cin >> x >> y;
cout << x + dx << ' ' << y + dy << endl;
}
return 0;
}
| ALGO | 0.999954 | 3.39523 |
96e8e2a5-eead-4611-a3b2-da620c1a63e5 | farabie/flutter_dcd_tutor | 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.998762 | 6.786404 |
773c7276-a897-434a-b5b0-6d94771df275 | OonoYouji/Engine | Externals/opencv/sources/modules/objdetect/src/barcode_detector/bardetect.cpp | #include "../precomp.hpp"
#include "bardetect.hpp"
namespace cv {
namespace barcode {
static constexpr float PI = static_cast<float>(CV_PI);
static constexpr float HALF_PI = static_cast<float>(CV_PI / 2);
#define CALCULATE_SUM(ptr, result) \
top_left = static_cast<float>(*((ptr) + left_col + integral_cols * top_r... | ALGO | 0.999584 | 5.184728 |
811106c9-da7b-40b1-9c38-608ebf7e2f1c | kabirgoyal26/D-S-A | 0100-same-tree/0100-same-tree.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.999976 | 6.373824 |
a32f1a92-65d0-4644-8655-b8e3953f317f | nikhabitmo/cpp-labworks-1-sem | labwork-4-nikhabitmo/lib/hamarc.cpp | #include "hamarc.h"
#include <cmath>
static bool isPowerOfTwo(size_t number) {
while (number % 2 == 0 && number) {
number /= 2;
}
return number == 1;
}
void Hamming::countParityBits(std::vector<bool>& vector) {
size_t cur_parity_bit = 1;
while (cur_parity_bit < vector.size()) {
size_t i = cur_parity... | ALGO | 0.998373 | 5.62751 |
9a679246-1a1b-42cc-b48c-af82af5d3c6a | Boomerl/MultiTaskSmartSys | src/utils.cpp | #include "utils.h"
// define magic word
static uint8_t magicWord[8] = {0x02, 0x01, 0x04, 0x03, 0x06, 0x05, 0x08, 0x07};
// mmwave
static std::vector<float> doppler_list = {-2.68, -2.34, -2.01, -1.67, -1.34, -1.0, -0.67, -0.33,
0.0, 0.33, 0.67, 1.0, 1.34, 1.67, 2.01, 2.34};
s... | TOOL | 0.91393 | 4.28141 |
e08fcc1e-86ae-4b80-975d-db6082395f26 | Ashishmaley/LeetCode | 0229-majority-element-ii/0229-majority-element-ii.cpp | class Solution {
public:
vector<int> majorityElement(vector<int>& nums) {
unordered_map<int,int>mp;
for(int i=0;i<nums.size();i++)
{
mp[nums[i]]++;
}
vector<int>ans;
float n = nums.size()/3;
for(auto i:mp){
if(i.second>n){
... | ALGO | 0.999912 | 5.673224 |
0029fcfd-a08f-401b-9b14-542ec396b2fd | mitasingh10332/Questions | replace pi to 3.14.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
void replacepi(string s)
{
if(s.length()==0){return;}
if(s[0]=='p'&& s[1]=='i')
{
cout<<"3.14";
replacepi(s.substr(2));
}
else
{
cout<<s[0];
replacepi(s.substr(1));
}
}
int main() {
replacep... | ALGO | 0.999782 | 3.522436 |
f59ded98-cee1-45af-9cee-25b213c9fe82 | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_233_7.cpp | #include <bits/stdc++.h>
const long long mod = 998244353;
const long long MaxN = 3e5 + 10;
std::vector<long long> v;
std::pair<long long, long long> a[MaxN];
long long n, m, k, ans, c[MaxN], fac[MaxN], inv[MaxN];
long long lowbit(long long x) { return x & (-x); }
long long C(long long n, long long m) {
if (n > m) ret... | ALGO | 0.999977 | 4.687613 |
bd86415a-192a-4abb-ae32-b28acf928dff | ishandutta2007/codeforces | hank55663/normal/912/B.cpp | #include<bits/stdc++.h>
using namespace std;
#define LL long long
#define mp make_pair
#define pb push_back
#define pii pair<int,int>
#define pll pair<LL,LL>
#define x first
#define y second
#define N 131072
#define pi acos(-1)
#define sqr(x) ((x)*(x))
#define pdd pair<double,double>
#define MEMS(x) memset(x,-1,sizeof(... | ALGO | 0.999982 | 3.911341 |
2455f91c-3ea7-4619-b3e5-832b7fb4f2a6 | keshav1999/c_plus_plus_Programming | day1/1,11.cpp | #include<iostream>
#include<cmath>
using namespace std;
int main()
{
int m, n, a;
cout << "Enter a number and the power\n";
cin >> m >> n;
a = pow(m, n);
cout << a;
return 0;
} | ALGO | 0.999885 | 3.846568 |
dac4f3d3-903c-41f9-baaa-9f3dcc8a6677 | Anik-Modak/CompetitiveProgramming | Toph/Weird Graph.BUET.cpp | //Anik_Modak
#include<bits/stdc++.h>
#define MX 100005
#define mod 1000000007
#define ll long long
using namespace std;
int node[MX];
ll fact[MX], inv[MX];
vector<int>adj[MX];
bool vis[MX];
long long bigmod (ll a, ll p)
{
long long res = 1, x = a;
while (p)
{
if ( p & 1 )
{
res... | ALGO | 0.999956 | 4.804038 |
81165761-4481-4d84-ae98-efdb51395d0b | BinaryDSAStore/CodeChefQuestions | December Long 2022/INVESTMENT.cpp | #include <iostream>
using namespace std;
int main()
{
int t{0};
cin >> t;
while (t--)
{
int inv{0}, inf{0};
cin >> inv >> inf;
string ans = inv >= (2 * inf) ? "YES" : "NO";
cout << ans << endl;
}
return 0;
} | ALGO | 0.999629 | 4.931755 |
d5e66c27-27b6-4d34-bdb5-0d5bb2b48179 | salah-mohamed0404/Programming-basics-with-C- | SmallerRow/main.cpp | #include <iostream>
using namespace std;
int main()
{
int n,m,a[100][100];
cin>>n>>m;
for(int i=0; i<n; i++)
for(int j=0; j<m; j++)
cin>>a[i][j];
int q;
cin>>q;
while(q--){
int q,qr1,qr2,res=1;
cin>>qr1>>qr2;
for(int c=0; c<m; c++){
if(... | ALGO | 0.999942 | 3.370996 |
e913ff1a-158e-45c9-98ff-816bb75d3c98 | Mahmood-Darwish/CodeForces-Problem-Solutions | Problems/Dreamoon and Stairs/Dreamoon and Stairs.cpp | #include <iostream>
using namespace std;
int x,n,m,i;
int main()
{
cin>>n>>m;
if(m>n){
cout<<-1;
return 0;
}
for(int i=0;i<=n;i++){
if(i%m==0&&n>=i&&n<=i*2){
cout<<i;
return 0;
}
}
return 0;
} | ALGO | 0.999894 | 3.205025 |
65c1da1b-4c44-4ba7-bde7-72d1960205f4 | evanzhaaa/coding_projects | C++/CCC 2001/CCC 2001 - Problem J2 - Mod Inverse.cpp | #include <iostream>
using namespace std;
bool isinverse(int x, int n, int m)
{
if ((x * n) % m == 1)
return true;
else
return false;
}
int main()
{
int x, m;
cout << "Enter x:" << endl;
cin >> x;
cout << "Enter m:" << endl;
cin >> m;
cout << endl;
for (int i ... | ALGO | 0.99994 | 4.434627 |
268ba536-53dd-4a7a-9a25-5b23c772a44f | Apurba94/10-Years-of_Competitive-Programming-Resources-Collection | TJU/1961 - Sum It Up.cpp | #include <vector>
#include <iostream>
using namespace std;
int t,n,s=0;
vector< vector<int> > u;
vector<int> v;
vector<int> aux;
void b(int a){
if(a>n) return;
if(s==t){
u.push_back(aux);
return;
}
if(s>t) return;
aux.push_back(v[a]);
s+=v[a];
b(a+1);
aux... | ALGO | 0.998617 | 3.886607 |
515740c2-bb4f-42ae-8d80-225e16bd4ee1 | roy7077/POTD-gfg | Deletion and Reverse in Circular Linked List.cpp | class Solution {
public:
// Function to reverse a circular linked list
Node* reverse(Node* head) {
if (!head || !head->next || head->next == head) {
return head; // If list is empty or has only one node, return head
}
Node* prev = NULL;
Node* curr = head;
... | ALGO | 0.999989 | 6.145327 |
cd549bc5-e736-4324-a681-2850280dd905 | DinhHuyKhanh/Codeforces | 1436A.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
int n,m,x,Sum=0;
cin>>n>>m;
for(int i=0;i<n;i++){
cin>>x;
Sum+=x;
}
cout<<(Sum==m?"YES":"NO")<<"\n";
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t;
cin>>t;
while(t--) s... | ALGO | 0.999413 | 4.599608 |
5d099b36-7f38-4087-8620-41f6547e73a0 | ishandutta2007/codeforces | 2222/normal/1616/E.cpp | #include <algorithm>
#include <iostream>
#include <cstdint>
#include <cassert>
#include <vector>
#include <string>
#include <deque>
#include <set>
using namespace std;
struct Summator {
Summator(int n) : f(2 * n), n(n) {}
void add(int i, int64_t v) {
for (i += n; i; i /= 2) f[i] += v;
}
int6... | ALGO | 0.999976 | 5.380613 |
7d73b419-77b9-42c2-bfe9-40ef46d49168 | Jungeun-Park-kr/baekjoonAlgorithm | SSM/2146.cpp | #include <iostream>
#include <cstring>
#include <queue>
#include <utility>
using namespace std;
int length, maxLength = 1000000, region;
queue<pair<int, int>> node;
int map[102][102];
bool visited[102][102];
int dx[4] = { 0,0,1,-1 }, dy[4] = { 1,-1,0,0 };
int howmany;
void regionalize() {
int nexty, nextx;
pair<... | ALGO | 0.999169 | 3.927874 |
43e03c02-bc85-474e-b740-646b8992683d | mynameabhishek/Gym_Fitness_Tracker | cpp.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int T;
cin >> T;
while (T--) {
int n, k;
cin >> n >> k;
vector<int>a(n);
for (int i = 0; i < n; i++) {
cin >> a[i];
}
// 1) Strip of... | ALGO | 0.999806 | 4.563241 |
e66b01f0-c8bf-4dd2-a551-7c0c7462c83e | Gondir33/EducationCppstuff | yandex6/yandex4.cpp | #include <iostream>
bool check(size_t d, size_t w, size_t h, size_t a, size_t b, size_t n) {
size_t n1, n2, n3, n4;
n1 = w / (a + 2 * d);
n2 = h / (b + 2 * d);
n3 = w / (b + 2 * d);
n4 = h / (a + 2 * d);
if (n1 * n2 > n3 * n4)
return n2 * n1 >= n;
else
return n3 * n4 >= n;
}
int main() {
size_t n, a, b,... | ALGO | 0.998998 | 3.855117 |
4fc78e5c-1538-4f97-af74-898323605924 | cxxxin/LeetCode | 55.cpp | #include <iostream>
#include <vector>
using namespace std;
/*
跳跃游戏
给定一个非负整数数组 nums ,你最初位于数组的 第一个下标 。
数组中的每个元素代表你在该位置可以跳跃的最大长度。
判断你是否能够到达最后一个下标。
*/
/*
思路:
倒着走
动态规划:相当于再计算过末位能否到达后,不再重复计算后面
*/
class Solution {
public:
bool canJump(vector<int>& nums) {
int n = nums.size()-1;
for(int i=n-1;i... | ALGO | 0.999978 | 5.45272 |
1b5da553-a767-49a8-9400-74e3ff771c64 | mayankmj/Leetcode-questions | 0338-counting-bits/0338-counting-bits.cpp | class Solution {
public:
vector<int> countBits(int n) {
vector<int>ans(n+1,0);
int count=0;
ans[0]=0;
for(int i=1;i<=n;i++)
{
ans[i]=ans[i/2]+i%2;
}
// reverse(ans.begin(),ans.end());
return ans;
}
}; | ALGO | 0.999995 | 5.781417 |
f191b248-1007-4cb5-91f5-391b80d71522 | ojasvagupta/Leetcode | 2356-largest-combination-with-bitwise-and-greater-than-zero/2356-largest-combination-with-bitwise-and-greater-than-zero.cpp | class Solution {
public:
int largestCombination(vector<int>& candidates) {
int res = 0;
// Iterate over all 32 possible bit positions
for (int bit = 0; bit < 32; ++bit) {
int count = 0;
// Count how many numbers have this bit set to 1
... | ALGO | 0.999346 | 6.733251 |
78d49ba2-dbb2-423e-9631-2f205210fa97 | szefany/acm-icpc | usaco/2013/MAR-2013/gold/necklace.cpp | #include <cstdio>
#include <cstring>
const int N = 10000 + 10;
const int L = 1000 + 10;
const int INF = 1 << 29;
char a[N], b[L];
int next[L];
int dp[N][L];
#define update_min(a, b) if ((a) > (b)) (a) = (b)
int main() {
freopen("necklace.in", "r", stdin);
freopen("necklace.out", "w", stdout);
scanf("%s%s", a + 1... | ALGO | 0.999887 | 3.376784 |
042ddf81-b23a-43dd-baea-32b24aec7807 | eerrjhj/CP-Solutions | CodeForces/GNU C++20 (64)/1686A | Everything Everywhere All But One/158723311.cpp | #pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define debug(x) cout << x << endl;
#define ll long long
#define mod 1000000007
#define pb push_back
#define fs f... | ALGO | 0.999684 | 5.101287 |
3d5c65ca-dc19-4f49-b4f6-2eb6a416cc4c | ishandutta2007/codeforces | fengqiyuka/normal/1707/D.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=2010;
int n,mod;
vector<int> B[N];
int f[N][N],fa[N],Ans[N],sta[N],qz[N][N],qz1[N][N],qz2[N][N];bool bk[N];
void dfs(int x){
bk[x]=false;
for(auto y:B[x])
if(bk[y]){
fa[y]=x;
dfs(y);
}
int tot=0;
for(auto y:B[x])
if(fa[y]=... | ALGO | 0.999974 | 3.983738 |
b038566f-cfb9-4230-8fdb-0fdf99ff4c30 | Nafyaz/my-codes | Codeforces/0014C.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define ff first
#define ss second
pair<pair<ll, ll>, pair<ll, ll> > s[4];
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
ll i, j;
for(i = 0; i < 4; i++)
cin >> s[i].ff.ff >> s[i].ff.ss >> s[i].ss.ff >> s[i].ss.ss;
... | ALGO | 0.999707 | 3.310741 |
6c09be80-f272-4805-89a6-cf89d7002137 | Weisheng-Li/PBR_Final_Project | src/obj.cpp | #include <dirt/obj.h>
#include <dirt/timer.h>
#include <dirt/progress.h>
#include <unordered_map>
#include <fstream>
namespace
{
/// Tokenize a string into a list by splitting at 'delim'
std::vector<std::string> tokenize(const std::string & string, const std::string & delim = ", ", bool includeEmpty = false)
{
st... | TOOL | 0.896604 | 7.210808 |
da8a932a-7b10-409a-a6fd-90e80de1d19e | noob-programmer/Code | Standard Code/Trees/level_order.cpp | #include <bits/stdc++.h>
using namespace std;
class BST
{
public:
int data;
BST *left=NULL;
BST *right=NULL;
BST *root=NULL;
BST *node;
void insert_BST(int data);
//void inorder(BST *);
//BST* search(BST *,int data);
//bool is_BST(BST *,int min,int max);
//int height(BST *);
//int find_min(BST *);
// stack<i... | ALGO | 0.999921 | 4.524144 |
1986240d-c681-48d0-b96b-7474a904b8a3 | RinCloud/TrickCatcher | Datasets/TrickyBugs/GenProgs/dpp_generated_progs_cpp/p03409/p03409_num5_parsed.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct Point {
int x;
int y;
int color;
};
bool comparePoints(Point p1, Point p2) {
if (p1.x == p2.x) {
return p1.y < p2.y;
}
return p1.x < p2.x;
}
int main() {
int n;
cin >> n;
vector<Po... | ALGO | 0.999719 | 5.193466 |
d8c34f8e-51d4-4f05-bae8-1ae946de5dc0 | MingPap/JianZhiOffer | 各种小算法.cpp | //交换两个变量的值
a = a^b;
b = a^b;
a = a^b;
//不用算术实现两个数的加法
int add_no_arithm(int a, int b)
{
if (b == 0)return a;
int sum = a^b; //不管进位求和
int carry = (a&b) << 1; //计算每一位的进位
return add_no_arithm(sum, carry); //递归计算和
}
//写一个接受可变参数的函数实现多个数相加
int add(int num,...)
{
int sum=0;
int index=0... | ALGO | 0.999231 | 3.906188 |
d87cf8b3-f5ef-4c67-965d-1095ad37a09f | sukhoeing/aoapc-book | BeginningAlgorithmContests/exercises/ch6/uva10047.cpp | // UVa10047 The Monocycle
// Rujia Liu
#include<cstdio>
#include<cstring>
#include<queue>
#include<algorithm>
using namespace std;
const int INF = 1000000000;
const int maxr = 25 + 5;
const int maxc = 25 + 5;
int R, C, sr, sc, tr, tc;
char maze[maxr][maxc];
struct State {
int r, c, dir, color;
State(int r, int c,... | ALGO | 0.999644 | 3.423187 |
436ca15b-d7c4-42c2-8b26-824f7f112c5a | rpsingh55/Data-Structures | 199_SuccessorAndPredecessor_bst.cpp | #include <iostream>
using namespace std;
struct Node
{
int key;
struct Node *left;
struct Node *right;
Node(int x){
key = x;
left = NULL;
right = NULL;
}
};
int key=0;
void findPreSuc(Node* root, Node*& pre, Node*& suc, int key);
void insert(struct Node *root,int n1,int n2,char lr)
{
if(... | ALGO | 0.999965 | 3.60488 |
b6dab104-a8e5-486d-97fd-8c190b35d08e | acgessler/blender-assimp | extern/carve/lib/octree.cpp | #if defined(HAVE_CONFIG_H)
# include <carve_config.h>
#endif
#include <carve/octree_decl.hpp>
#include <carve/octree_impl.hpp>
#include <carve/poly_decl.hpp>
namespace carve {
namespace csg {
Octree::Node::Node(const carve::geom3d::Vector &newMin, const carve::geom3d::Vector &newMax) :
parent(NULL), is... | ALGO | 0.998545 | 7.607795 |
d46e5a34-1f73-4142-972c-a6af42cf675a | madhvendrasingh007/LeetCode-GFG | 0217-contains-duplicate/0217-contains-duplicate.cpp | class Solution {
public:
bool containsDuplicate(vector<int>& nums) {
unordered_set<int> seen;
for (int num : nums) {
if (seen.count(num) > 0)
return true;
seen.insert(num);
}
return false;
}
}; | ALGO | 0.998888 | 6.294128 |
0257c09d-c3d4-4359-9916-c0862e6b74c2 | nureesong/samsung_swtest | Pro_New/mincoding/Day04_HashMap/Pb2_인구조사.cpp | // [방법1] (혼혈국가쌍, 인원수)를 해시맵으로 저장 -> O(N * M^2) (N: 사람 수, M: 혼혈국가 수)
// -> 해시맵을 만들어두기만 하면, 쿼리가 여러번 들어와도 조회 O(1)
// 이중 HashMap (188ms 2MB)
// 국가명 2개 연결시 중복 있다고 가정하면 이중 해시맵!
// 단일 HashMap (문자열 concat: 164ms 3MB)
// 국가명 2개 연결시 중복 없다고 가정하는 경우 A+B를 key로 설정
#if 1
#include <iostream>
#include <string>
#include <unordered_map>... | ALGO | 0.99978 | 4.909088 |
0764548f-5485-4347-bd47-239c8593a8b1 | 4C-multiphysics/4C | src/core/linear_solver/src/amgnxn/4C_linear_solver_amgnxn_preconditioner.cpp | #include "4C_linear_solver_amgnxn_preconditioner.hpp"
#include "4C_io_input_parameter_container.hpp"
#include "4C_linalg_blocksparsematrix.hpp"
#include "4C_linalg_utils_sparse_algebra_manipulation.hpp"
#include "4C_linear_solver_amgnxn_vcycle.hpp"
#include "4C_utils_exceptions.hpp"
#include <MueLu_ParameterListInter... | TOOL | 0.989629 | 6.186405 |
d97567a9-12a3-442d-9640-6ed0906d8532 | not-a-dev0/Awesome-Quant-Machine-Learning-Trading | C++/max-points-on-a-line.cpp | // Time: O(n^2)
// Space: O(n)
/**
* Definition for a point.
* struct Point {
* int x;
* int y;
* Point() : x(0), y(0) {}
* Point(int a, int b) : x(a), y(b) {}
* };
*/
class Solution {
public:
int maxPoints(vector<Point>& points) {
int max_points = 0;
for (int i = 0; i < po... | ALGO | 0.999828 | 5.907086 |
2f48ce1b-8500-43cd-9979-3dde410d4a08 | yuanAIhan/leetcode | 100相同的树.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.99998 | 6.709516 |
6f4fd8e6-f9b4-4771-86ad-6dfd1d93a6b0 | asu-crypto/mpsica | thirdparty/win/miracl/miracl_osmt/source/pal_enc.cpp | /*
* PAL_ENC.CPP
*
* Paillier Homomorphic Encryption
* See "Public key Cryptosystems based on Composite Degree Residue Classes",
* Eurocrypt 1999
*
* NOTE: - This PK scheme is "Homomorphic" - E(m1+m2) = E(m1)*E(m2) -
* and probabilistic
*
* This program encrypts a short message to the file cipher.pa... | ALGO | 0.997009 | 4.116068 |
533fae75-89f9-49fa-b1d1-c1b0ffe48bd8 | karalienes/QT | textdetection/decode.cpp | #include <opencv2/imgproc.hpp>
#include <iostream>
using namespace std;
using namespace cv;
//get bounding boxes from predictions
static void decode(const Mat &scores, const Mat &geometry, float scoreThresh,
vector<RotatedRect> &detections, vector<vector<RotatedRect>> &line_detections,
vector<... | ALGO | 0.899459 | 7.148905 |
8a88923a-9c1f-489d-9499-fbfb50abed53 | dl8sd11/online-judge | tioj/1042-km.cpp | #include <bits/stdc++.h>
using namespace std;
int n;
vector<vector<int> > wei;
vector<int> x_vis, y_vis, lx, ly, y_match;
bool dfs (int x) {
if (x_vis[x]) return false;
x_vis[x] = true;
for (int y=0; y<n; y++) {
if (lx[x] + ly[y] == wei[x][y]) {
y_vis[y] = true;
if (y_mat... | ALGO | 0.999454 | 4.167534 |
1b0b5dfa-cac1-40e4-9e99-ab6778d74235 | RohitBishla/LeetCode_Practice | 1335-minimum-difficulty-of-a-job-schedule/1335-minimum-difficulty-of-a-job-schedule.cpp | class Solution {
int helper(int i, vector<int>& jobD, int d, int lastMax, vector<vector<vector<int>>> &dp){
if(i == jobD.size()){
if(d == 0) return jobD[lastMax];
else return -1;
}
if(dp[i][d][lastMax] != -1) return dp[i][d][lastMax];
int a = i;
if(job... | ALGO | 0.999958 | 6.223538 |
517a14b9-e40a-40db-ba05-5969adf55917 | JQ-Z/Interesting_Puzzles | Q03.cpp | #include <iostream>
using namespace std;
int Howmanyfactor(int num)
{
int count = 0;
for(int i = 2; i < num; i++)
if(num % i == 0)count++;
return count;
}
int main()
{
int arr[101] = {0};
arr[1] = 0;
int count;
for(int i = 2; i <= 100; i++)
{
count = Howmanyfactor(i);
if(count % 2 == 0)arr[i] = 1;
els... | ALGO | 0.999642 | 3.411139 |
60405726-4a16-4bca-9fa3-379c2f206bb7 | karakib2k18/Competitive-Programming-DSA-in-CPP | Codeforces/EDU110B.CPP | /*
#Connect with me
LinkedIn: https://www.linkedin.com/in/karakib2k18/
Facebook: https://www.facebook.com/karakib2k18
Codeforces: https://codeforces.com/profile/karakib2k18
Instragram: https://www.instagram.com/kazi_abdur_rakib/
Github: https://github.com/karakib2k18
Portfolio: https://kaziabdurrakib.netlify.app/
*/... | ALGO | 0.999689 | 4.834157 |
16da8a34-22d6-4f15-ac54-06028551c597 | TosakaUCW/CompetitiveProgramming | Old/Luogu/[Luogu P4329] [COCI2006-2007#1] Bond.cpp | #include <stdio.h>
#include <algorithm>
#include <memory.h>
const int N = 20 + 1;
int n;
double c[N][N], f[1 << N];
int read()
{
int x = 0, f = 1;
char ch = getchar();
while ('0' > ch or ch > '9')
f = ch == '-' ? -1 : 1, ch = getchar();
while ('0' <= ch and ch <= '9')
x = x * 10 + ch ... | ALGO | 0.999824 | 3.616367 |
b478a6a3-6e45-4347-a3f5-91e52751c0ce | sumysol1021/MineScape | MineScape/Library/PackageCache/com.unity.ide.visualstudio@2.0.12/Editor/COMIntegration/COMIntegration~/COMIntegration.cpp | #include <iostream>
#include <sstream>
#include <string>
#include <filesystem>
#include <windows.h>
#include <shlwapi.h>
#include "BStrHolder.h"
#include "ComPtr.h"
#include "dte80a.tlh"
constexpr int RETRY_INTERVAL_MS = 150;
constexpr int TIMEOUT_MS = 10000;
// Often a DTE call made to Visual Studio can fail after ... | TOOL | 0.965155 | 6.969462 |
c15c5a37-6c29-4a28-80bb-4d24cdb6bd80 | zouplus/gfbn | src/burn/snd/c352.cpp | /*
c352.c - Namco C352 custom PCM chip emulation
v2.0
By R. Belmont
Rewritten and improved by superctr
Additional code by cync and the hoot development team
Thanks to Cap of VivaNonno for info and The_Author for preliminary reverse-engineering
Chip specs:
32 voices
Supports 8-bit l... | TOOL | 0.938739 | 5.401403 |
2000467f-52cb-4da4-853d-95f6ab84c545 | llvm/clangir | libcxx/test/std/algorithms/alg.sorting/alg.binary.search/lower.bound/lower_bound.pass.cpp | // <algorithm>
// template<ForwardIterator Iter, class T>
// constexpr Iter // constexpr after c++17
// lower_bound(Iter first, Iter last, const T& value);
#include <algorithm>
#include <vector>
#include <cassert>
#include <cstddef>
#include "test_macros.h"
#include "test_iterators.h"
#if TEST_STD_VER > 17
... | TEST | 0.99589 | 7.076389 |
a82c6c1b-55ec-481a-b4ef-afa61bca11bc | ishandutta2007/codeforces | subconscious/normal/1578/K.cpp | #include<bits/stdc++.h>
#define rep(i,n) for(int i=1;i<=n;++i)
#define trav(a,x) for(auto&a:x)
#define all(x) begin(x),end(x)
#define sz(x) (int)(x).size()
#define pb push_back
#define mp make_pair
#define x0 fuckhel
#define y0 fuckoscar
#define x1 fucksub
#define y1 fuckzzy
#define st first
#define nd second
using nam... | ALGO | 0.99882 | 3.194852 |
ee512a0a-7ba4-45da-bcf6-9eb5bc74ca35 | kmjp/procon | leetcode/451-500/461/b.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a)... | ALGO | 0.99988 | 4.991768 |
223de6d3-706f-48e0-8a51-bd177e33d7a2 | mayank3005/LeetCode-Solutions | 0926-flip-string-to-monotone-increasing/0926-flip-string-to-monotone-increasing.cpp | class Solution {
public:
int minFlipsMonoIncr(string str) {
int n = str.length();
vector<vector<int>>dp(n+2, vector<int>(2, -1));
dp[n][0] = 0;
dp[n][1] = 0;
for(int index=n-1;index>=0;index--){
for(int prev = 0;prev<2;prev++){
int res = INT_MAX;
... | ALGO | 0.999982 | 6.262987 |
55a61a63-438b-4272-a6ed-7a287bb9b264 | gabrielrussoc/competitive-programming | codeforces/758d.cpp | #include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
int n;
char k[65];
char s[33];
bool fit(int i, int j) {
char t[33];
int p;
for(p = i; p <= j; p++) t[p-i] = k[p];
t[p-i] = 0;
int a = strlen(t);
int b = strlen(s);
if(a < b) return true;
else if (a... | ALGO | 0.999875 | 4.031184 |
3919e813-d9e6-4177-9333-60aaa67137a5 | dlawotjr1999/CodingTest | Math & String/Math/1065.cpp | #include <iostream>
// Ѽ ϱ
// Ѽ? : X ڸ ̷
int main() {
int N;
int cnt = 99;
std::cin >> N;
if (N < 100)
std::cout << N;
else {
for (int i = 100; i <= N; i++) {
int temp = i;
int digits[3];
for (int j = 0; j < sizeof(digits) / sizeof(int); j++) {
int digit = temp % 10;
digits[(sizeof... | ALGO | 0.999406 | 4.002503 |
3000abd2-b681-4f7a-a956-8c04a9e3e353 | Youngwb/leetcode_cplusplus | 2/Add_Two_Numbers.cpp | #include <iostream>
using namespace std;
// Definition for singly-linked list.
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(nullptr) {}
};
class Solution {
public:
ListNode* addTwoNumbers(ListNode* l1, ListNode* l2) {
ListNode* tmp2=l2;
ListNode* t... | ALGO | 0.999866 | 5.907166 |
1c01613f-b227-408a-a375-4aa88ed21905 | jasperzhong/swift | aten/src/ATen/native/SobolEngineOps.cpp | #include <ATen/ATen.h>
#include <ATen/Dispatch.h>
#include <ATen/NativeFunctions.h>
#include <ATen/native/SobolEngineOpsUtils.h>
#include <vector>
namespace at {
namespace native {
using namespace sobol_utils;
/// This is the core function to draw samples from a `SobolEngine` given
/// its state variables (`sobols... | ALGO | 0.999121 | 7.316289 |
9dd52f40-26e0-4cc8-92a7-c27de634a21e | ishandutta2007/codeforces | ppavic/normal/841/A.cpp | #include <cstdio>
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
const int N = 1e5 + 500;
const int INF = 0x3f3f3f3f;
const int MOD = 1e9 + 7;
int cnt[N],n,k,sol;
string s;
int main(){
cin >> n >> k >> s;
sol = 1;
for(int i = 0;i<s.size();i++){
... | ALGO | 0.999988 | 3.935892 |
89bb7f0c-9be2-4591-adcc-c367809456f3 | silviosanto6605/Compiti-informatica-vacanze-2021 | 34.cpp | #include <iostream>
using namespace std;
int main() {
int a, b, a_iniziale, b_iniziale;
cout << "Inserisci A: ";
cin >> a;
cout << "Inserisci B: ";
cin >> b;
a_iniziale = a;
b_iniziale = b;
while (a != b) {
if (b < a) { /*B Minore */
b = b + b_iniziale;
... | ALGO | 0.999528 | 3.348022 |
d8db3473-683d-426c-9a2c-980a1ef1399f | enkilee/leetcode | .history/beibao01_20200424152353.cpp | /*
* @Author: your name
* @Date: 2020-04-24 15:05:53
* @LastEditTime: 2020-04-24 15:23:52
* @LastEditors: Please set LastEditors
* @Description: 背包问题1
* @FilePath: \leecode\beibao01.cpp
*
有 N 件物品和一个容量是 V 的背包。每件物品只能使用一次。
第 i 件物品的体积是 vi,价值是 wi。
求解将哪些物品装入背包,可使这些物品的总体积不超过背包容量,且总价值最大。
输出最大价值。
输入样例
数量 容积
4 5
体积 价... | ALGO | 0.999998 | 4.949133 |
4980b979-8ea5-4b4e-8e3b-d3a18dc86473 | Tanmay49/Second-Year | SEM2/DSA LAB/Binary Search Tree/cinp.cpp | #include<iostream>
#include<cstring>
using namespace std;
bool correct(string a)
{
bool op=true;
for(int i=0;i<a.length();i++)
{
char ch=a[i];
if(ch>=97 && ch<=122)
{
continue;
}
else
{
op=false;
}
}
return op;
};
int m... | TOOL | 0.920877 | 3.669396 |
3b9e6b58-5dc7-4f63-a238-ed120f51082c | JunHwaPark/Numerical-Analysis | Adaptive_Quadrature_d.cpp | #include <cstdio>
#include <cmath>
long double function(long double x) {
return 4 * x * cos(2 * x) - pow(x - 2, 2);
}
long double simpson(long double start, long double end) {
return (end - start) * (function(start) + 4 * function((start + end) / 2) + function(end)) / 6;
}
long double compute(long double sta... | ALGO | 0.999817 | 4.827514 |
c040e2da-3df1-4800-9a71-70e34070dc32 | kimchan123/algorithm | boj/11729 하노이.cpp | #include <iostream>
#include <vector>
using namespace std;
int N;
vector<pair<int, int>> v;
void func(int N, int from, int by, int to);
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> N;
func(N, 1, 2, 3);
cout << v.size() << "\n";
for (int i = 0; i < v.size(); i++)
cout << v[i].first << ... | ALGO | 0.999715 | 3.74908 |
228d7b9e-9fe4-4511-abcf-a53d94bfe977 | MapleSystem/secure-c | clang/lib/StaticAnalyzer/Core/CoreEngine.cpp | #include "clang/StaticAnalyzer/Core/PathSensitive/CoreEngine.h"
#include "clang/AST/Expr.h"
#include "clang/AST/ExprCXX.h"
#include "clang/AST/Stmt.h"
#include "clang/AST/StmtCXX.h"
#include "clang/Analysis/AnalysisDeclContext.h"
#include "clang/Analysis/CFG.h"
#include "clang/Analysis/ProgramPoint.h"
#include "clang/B... | ALGO | 0.997795 | 7.813391 |
5190bc76-1bd0-4a42-96e5-2dea2da462d5 | ayushag833/CP | TLE Sheet/B_Erase_First_or_Second_Letter.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vl vector<ll>
const int MOD = 1e9 + 7;
const int INF = 1e9;
void solve()
{
int n;
cin >> n;
string s;
cin >> s;
unordered_map<int,... | ALGO | 0.999942 | 5.283749 |
88db64b6-991e-4ecc-a134-279873159143 | jasminenwajei/cwk | src/journey.cpp | #include <cmath>
#include <algorithm>
#include <stdexcept>
#include "geometry.h"
#include "journey.h"
namespace GPS
{
Journey::Journey(std::vector<TimeStampedWaypoint> timeStampedWayPoints) : points{timeStampedWayPoints} {}
// TODO: Stub definition needs implementing
unsigned int Journey::numberOfWaypoints() const... | TOOL | 0.855438 | 5.354375 |
0ef6bde1-16fb-4af9-9cab-4479e0cec5db | l7wei/New_Project | algif5/lzw.cpp | #include "algif.h"
static int
read_code (ALLEGRO_FILE * file, char *buf, int *bit_pos, int bit_size)
{
int i;
int code = 0;
int pos = 1;
for (i = 0; i < bit_size; i++)
{
int byte_pos = (*bit_pos >> 3) & 255;
if (byte_pos == 0)
{
int data_len = al_fgetc (file);
... | ALGO | 0.914634 | 4.181319 |
82492d7e-0655-425f-a395-ec8eabf919aa | fengwenjiao/netstorm | 3rdparty/mkldnn/src/cpu/matmul/gemm_x8s8s32x_matmul.cpp | #include <atomic>
#include <assert.h>
#include <float.h>
#include <math.h>
#include "common/c_types_map.hpp"
#include "common/dnnl_thread.hpp"
#include "common/memory_tracking.hpp"
#include "common/type_helpers.hpp"
#include "common/utils.hpp"
#include "cpu/cpu_primitive.hpp"
#include "cpu/gemm/gemm.hpp"
#include ... | ALGO | 0.882878 | 7.524224 |
88589da6-deb9-40c9-be4b-b413dc61c2cc | DM1930/RED-TEAM-DEV5 | Sprint4final/inifile-cpp-master/examples/custom_type_conversion.cpp |
/* decode_ini_file.cpp
*
* Author: Fabian Meyer
* Created On: 14 Nov 2020
*/
#include <inicpp.h>
#include <iostream>
// the conversion functor must live in the "ini" namespace
namespace ini
{
/** Conversion functor to parse std::vectors from an ini field-
* The generic template can be passed down to th... | TOOL | 0.973933 | 6.496745 |
6ec83a6e-0337-413e-b0b2-0ed8ad2eb3cd | Ryb7532/AtCoder | submissions/abl/c.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define GET_MACRO(_1,_2,_3,NAME,...) NAME
#define rep3(i,s,e) for (int i=(int)s; i<(int)e; i++)
#define rep2(i,n) rep3(i,0,n)
#define rep(...) GET_MACRO(__VA_ARGS__,rep3,rep2)(__VA_ARGS__)
#define rrep3(i,s,e) for (int i=(int)e-... | ALGO | 0.999932 | 4.44478 |
926faaf7-f724-415d-9a33-b051d41da5e7 | haoquachanh/ThermoQC | Device/.pio/libdeps/wemos_d1_uno32/Audio - Adafruit Fork/analyze_peak.cpp | #include "analyze_peak.h"
void AudioAnalyzePeak::update(void)
{
audio_block_t *block;
const int16_t *p, *end;
int32_t min, max;
block = receiveReadOnly();
if (!block) {
return;
}
p = block->data;
end = p + AUDIO_BLOCK_SAMPLES;
min = min_sample;
max = max_sample;
do {
int16_t d=*p++;
// TODO: can we s... | TOOL | 0.914811 | 5.1412 |
26984e34-c459-4b74-8406-e1b24f4edf86 | MariaIdk/OOP-Labs | lab2 (CPP1)/Source.cpp | #include <iostream>
#include <vector>
using namespace std;
class Polynomial {
private:
vector<double> coefficients;
public:
Polynomial(const vector<double>& coeffs) : coefficients(coeffs) {}
double evaluate(double x) const {
double result = 0.0;
for (int i = coefficients.size() - 1; i >= ... | ALGO | 0.965066 | 4.689823 |
0211dca9-a5d6-498b-b788-459f9fef6e99 | SkqLiao/codeforces-edu | Disjoint Sets Union/Step 2/d.cpp | /*
* @date:2021-05-07 12:10:29
* @source:https://codeforces.com/edu/course/2/lesson/7/2/practice/contest/289391/problem/D
*/
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 3e5 + 5;
int N, M;
int Fa[MAXN], Len[MAXN], Add[MAXN];
vector<int> v[MAXN];
int findFa(int x) {
return Fa[x] == x ? x : Fa... | ALGO | 0.999972 | 4.714755 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.