uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
aee4b420-8af8-4a54-92d5-2997f368d354 | im2781975/Algorithm_solved | DP/Coin combination.cpp | //Consider a money system consisting of n coins. Each coin has a positive integer value. Your task is to calculate the number of distinct ways you can produce a money sum x
#include <iostream>
#include <vector>
using namespace std;
int countWays(vector<int>& coins, int n, int x) {
vector<int> dp(x + 1, 0);
dp[... | ALGO | 0.999991 | 5.815978 |
5ce68d15-0d89-4421-b302-924fe4d775bb | LLNL/axom | src/axom/lumberjack/examples/basicExample.cpp | #include "axom/lumberjack.hpp"
#include <mpi.h>
#include <iostream>
//------------------------------------------------------------------------------
int main(int argc, char** argv)
{
// Initialize MPI and get rank and comm size
MPI_Init(&argc, &argv);
int commRank = -1;
MPI_Comm_rank(MPI_COMM_WORLD, &commRan... | TOOL | 0.883614 | 5.900615 |
f64590b9-89e0-4b4f-91ac-c5ac0cbc732e | Omurex/Jothly-Engine | eigen-3.4.0/doc/examples/tut_arithmetic_scalar_mul_div.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace Eigen;
int main()
{
Matrix2d a;
a << 1, 2,
3, 4;
Vector3d v(1,2,3);
std::cout << "a * 2.5 =\n" << a * 2.5 << std::endl;
std::cout << "0.1 * v =\n" << 0.1 * v << std::endl;
std::cout << "Doing v *= 2;" << std::endl;
v *= 2;
std::cout << ... | ALGO | 0.988783 | 3.666278 |
0272f503-8eab-4a68-8bae-1d560163ce76 | alifalhasan/CP-code-vault | Codeforces/Others/2018 ICPC Asia Jakarta Regional Contest/J - Future Generation/189945065.cpp | #pragma GCC optimize("Ofast")
#include <map>
#include <set>
#include <cmath>
#include <deque>
#include <stack>
#include <queue>
#include <bitset>
#include <chrono>
#include <random>
#include <vector>
#include <climits>
#include <cstring>
#include <iomanip>
#include <sstream>
#include <assert.h>
#include <iostream>
#inc... | ALGO | 0.999907 | 3.968924 |
3ae9fc12-1865-4843-a808-f07ba6c377cf | quocanhnguyen402/personal-leetcode-solution | 52-n-queens-ii/52-n-queens-ii.cpp | class Solution {
public:
vector<vector<string>> ans;
vector<string> v;
bool isSafe(int r,int i,int n)
{
for(int j=0;j<n;j++) //checking for the coloumn
if(i!=j and v[r][j]=='Q')
return false;
for(int j=0;j<n;j++) //checking for the row
if(r!=j and ... | ALGO | 0.999746 | 5.883087 |
18ea8ec9-00b0-4e1e-b3a3-7edd986365bb | waqarsqureshi/OOPDS | examples/STL/find_if.cpp | #include <vector>
#include <algorithm>
#include <iostream>
using namespace std;
bool mytest(int n) { return (n>21) && (n <36); };
int main (){
int arr[] = { 12, 3, 17, 8, 34, 56, 9 }; // standard C array
vector<int> v(arr, arr+7); // initialize vector with C array
vector<int>::iterator iter;
iter=... | ALGO | 0.977363 | 3.532101 |
d4d4187d-11e9-4459-9145-533c0f48513f | mmatrosov/FKN2020 | home2/by_user/Багишов Микаил Видадиевич-83084778/A-34404035-gcc_docker2-OK.cpp | #include <iostream>
#include <set>
int main() {
int num;
std::set<int> seen_before;
while (std::cin >> num) {
if (seen_before.insert(num).second) {
std::cout << "NO\n";
} else {
std::cout << "YES\n";
}
}
} | ALGO | 0.999856 | 5.498076 |
106d4b8a-ed4c-49c9-9f3c-02829cf52e10 | Luminous-XF/ACM | Codeforces/Codeforces Round 790 (Div. 4)/CF1676B.cpp | //
// Created by Luminous on 2024/10/11.
// https://codeforces.com/contest/1676/problem/B
//
#pragma GCC optimize(3)
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
const int MAX_N = 50 + 10;
int a[MAX_N];
void solve() {
int n;
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i... | ALGO | 0.999885 | 6.279942 |
87fb0f5e-7c57-4be3-9ae9-864ddcce2ccb | vishalshrivastava16/Data-Structures-Using-CPP | segment_tree/segment_tree_xor_rangequery.cpp | /*
Vishal Shrivastava
i_am_kirito
look up to the sky,keep up(don't let go)
I'll look towards the sky, without any doubt...
never let you go,never let you go.
till the light shines stronger, I go.
*/
#include <bits/stdc++.h>
using namespace std;
#define minpq priority_queue <int, vector<int>, greater<int... | ALGO | 0.99998 | 4.522977 |
b02aeeed-7ccb-4c52-a46d-19d9c817f3c9 | raaslab/MAP-NBV | point_cloud_processing/src/icp.cpp | #include <iostream>
#include <pcl/io/pcd_io.h>
#include <pcl/point_types.h>
#include <pcl/registration/icp.h>
#include <pcl/visualization/cloud_viewer.h>
int main (int argc, char** argv)
{
if(argc != 3)
{
std::cerr << "Expecting input argument: folder #_of_.pcd_files " << std::endl;
return -1;
... | ALGO | 0.958376 | 3.731776 |
b48d06b2-73f1-4207-8079-be5e3aff3c29 | Nowshin1077/Undergrad_ek-er-vhitor-shob | Semester-5/Algorithms/CSE 242 - Lab/Mid/Lab-4(BFS,DFS)/Assignment/Counting_Sort.cpp | // Counting sort in C programming
#include <stdio.h>
void countingSort(int array[], int size)
{
int output[10];
int max = array[0];
for (int i = 1; i < size; i++)
{
if (array[i] > max)
max = array[i];
}
// The size of count must be at least the (max+1) but
// we cannot assign declare it as int c... | ALGO | 0.999997 | 5.456744 |
b0e356bb-fe66-48e1-806f-2e6174dda445 | SMiles02/CompetitiveProgramming | Codeforces/CF 1200 - 1299/CF1203/CF1203E.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int index(int numToFind, std::vector<int> vectorToFindIn) {int len = vectorToFindIn.size();for (int i = 0; i < len; i++){if (vectorToFindIn[i] == numToFind){return i;}}return -1;}
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
int n,ans;
ci... | ALGO | 0.999948 | 3.915971 |
4129b79a-1272-489c-b616-5993171b37ee | phrock/acm | uva/152-Tree's_a_Crowd/1.cpp | #include <cctype>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <algorithm>
#include <bitset>
#include <deque>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string... | ALGO | 0.999511 | 3.823248 |
67361eb0-89d8-467a-aef3-aa2c2849b2a6 | Aishwarya7902/DAILY-LEETCODE-CHALLENGE | 2023/SEPTEMBER/25th Sept__389. Find the Difference Easy.cpp | PROBLEM:https://leetcode.com/problems/find-the-difference/description/?envType=daily-question&envId=2023-09-25
VIDEO: https://www.youtube.com/watch?v=eWoaue1y-Cc
/*
SELF TRY
*/
//u just have to find that extra letter of t
//so idea is simple
//put all letters of s in map
//traverse in t ...if it is in map ..g... | ALGO | 0.999924 | 6.69732 |
453b82d8-9099-4960-a73b-2fb16976dc76 | wumpusn/programming_contest | atcoder/ABC/abc044/b.cpp | #include<bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < (n); ++i)
typedef long long ll;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1;} return 0;}
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1;} return 0;}
const ll INF = 1LL << 60... | ALGO | 0.999993 | 3.75614 |
e2553bed-9249-4fec-95e3-cbde8bd5e650 | DaffaNofiansyah/PEMROGRAMAN | UTS/4.cpp | #include <bits/stdc++.h>
using namespace std;
class murid
{
string nama, kelamin;
double ipk;
public:
murid()
{
nama = kelamin = "";
ipk = 0;
}
void set(string nm, string klm, double ipkk)
{
nama = nm;
kelamin = klm;
ipk = ipkk;
}
double ... | ALGO | 0.980027 | 3.504174 |
45667b30-ed2c-49b1-971e-19f0e87d541b | hmwang2002/Algorithm-Learning | leetcode/leetcode-648.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution
{
struct Trie
{
vector<Trie *> children;
bool isEnd;
Trie() : children(26, nullptr), isEnd(false) {}
};
string searchPrefix(Trie *root, string &s)
{
Trie *cur = root;
string res;
for (char... | ALGO | 0.999922 | 5.740649 |
45fd0c20-8209-4e01-88a8-a2ffb2058a7b | N330s/comProg | bid.cpp | #include <iostream>
#include <map>
#include <set>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int n;
map <string, map<string, int>> table;
map <string, set<string>> result;
map<string, vector<string>> bid;
map<string, int> price;
vector<string> allbid;
cin >> n... | ALGO | 0.996165 | 3.943441 |
3390b5de-86f4-42d3-b949-f08c1a7ad1aa | ThePixelMoon/OpenMod | src/game/server/tf/bot/behavior/medic/tf_bot_medic_retreat.cpp | #include "cbase.h"
#include "tf_player.h"
#include "tf_gamerules.h"
#include "tf_weapon_medigun.h"
#include "bot/tf_bot.h"
#include "bot/behavior/medic/tf_bot_medic_retreat.h"
#include "nav_mesh.h"
extern ConVar tf_bot_path_lookahead_range;
extern ConVar tf_bot_medic_follow_range;
//---------------------------------... | TOOL | 0.976372 | 5.501616 |
bb20feac-6d60-486d-8091-e9ea585c9430 | pranavjawale01/cp.exe | LeetCode/0752-open-the-lock/0752-open-the-lock.cpp | class Solution {
public:
void fillNeighbors(queue<string>& que, string& curr, unordered_set<string>& dead) {
for(int i = 0; i<4; i++) {
char ch = curr[i];
char dec = ch=='0' ? '9' : ch-1;
char inc = ch=='9' ? '0' : ch+1;
curr[i] = dec;
if(!dead... | ALGO | 0.999936 | 6.33225 |
d351797f-e2a4-4d64-86e8-2d1587785790 | qmqsyz/libcxx-build | llvm-project/libcxx/test/std/algorithms/alg.sorting/alg.sort/sort/sort.pass.cpp | // <algorithm>
// template<RandomAccessIterator Iter>
// requires ShuffleIterator<Iter>
// && LessThanComparable<Iter::value_type>
// void
// sort(Iter first, Iter last);
#include <algorithm>
#include <iterator>
#include <numeric>
#include <random>
#include <cassert>
#include <vector>
#include <deque>
#... | TEST | 0.991396 | 7.37945 |
1236fd46-d567-4194-94fe-f144c72b1bc8 | sangyx/algorithm | poj/水淹七军.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <cstring>
using namespace std;
int M, N, K, tx, ty, P;
int area[250][250];
int vis[250][250];
vector<int> X, Y;
int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};
struct NODE{
int x, y, h;
};
queue<NODE> q;
bool bfs(){
while(!q.empty()){
... | ALGO | 0.999977 | 4.230194 |
6fbfb681-9b4d-4f64-9f7a-5dd14944748c | viCodexm/LeetCode | 1738-maximal-network-rank/1738-maximal-network-rank.cpp | struct Pair {
int index;
int value;
};
bool PairComparator(const Pair & a, const Pair & b) {
return a.value > b.value;
}
class Solution {
public:
int maximalNetworkRank(int n, vector<vector<int>>& roads) {
vector<int> counts(n);
vector<vector<int>> adj(n, vector<int>(n, 0));
for ... | ALGO | 0.99985 | 5.440524 |
351faca1-83c1-4831-bdde-ce3ced84eb9a | ArdxWe/leetcode | medium/398-Random-Pick-Index.cpp | /*
* Given an integer array nums with possible duplicates, randomly output the
* index of a given target number. You can assume that the given target number
* must exist in the array. Implement the Solution class: Solution(int[] nums)
* Initializes the object with the array nums. int pick(int target) Picks a
* ran... | ALGO | 0.999401 | 7.066718 |
beb32761-b5bd-4498-b3ec-89aab5735cc5 | henilShah110/cppPractice | codeForces/131A.cpp | #include <iostream>
#include <string>
using namespace std ;
int main ()
{
string a;
cin>>a;
int len=a.length(),count=0,c1=0;
for(int i=0;i<len;i++)
if('A'<=a[i] && a[i]<='Z')
count++;
for(int i=1;i<len;i++)
if('A'<=a[i] && a[i]<='Z')
c1++;
if(count==len)
{
for(int i=0;i<len;i++)
if('A'<=a[i... | ALGO | 0.999779 | 4.649587 |
881e7008-664a-4988-b1c7-8cf416fe51a7 | kimhojun2/Algorithm | 프로그래머스/1/161989. 덧칠하기/덧칠하기.cpp | #include <string>
#include <vector>
using namespace std;
int solution(int n, int m, vector<int> section) {
int answer = 0;
int check = 0;
for(int now:section){
if(now>check){
answer++;
check = now+m-1;
}
}
return answer;
} | ALGO | 0.999854 | 5.111595 |
21c2815f-97ac-4b95-b39d-7ebb9cc2d188 | dolly19/Computer-Networks-Assignments | Distance Vector Routing/A2/copy.cpp | #include "node.h"
#include <iostream>
using namespace std;
void printRT(vector<RoutingNode*> nd){
/*Print routing table entries*/
for (int i = 0; i < nd.size(); i++) {
nd[i]->printTable();
}
}
void routingAlgo(vector<RoutingNode*> nd){
int num=nd.size();
while(num--){
for(int i=0;i<nd.size();i++)
n... | ALGO | 0.995752 | 4.003539 |
9035789e-76ed-4f05-901c-6d1c3fd791e3 | xizhonghua/lintcode | Permutation-II.cpp | class Solution {
public:
/**
* @param nums: A list of integers.
* @return: A list of permutations.
*/
vector<vector<int> > permuteUnique(vector<int> nums) {
ans.clear();
cur.clear();
used.clear();
if(nums.size()==0) return vector<vector<int>>();
df... | ALGO | 0.999964 | 6.136025 |
8e1028c2-b5c4-4439-924c-2e1cc24428cb | Pavankalyan0105/DS | Sorting Algos/mergeSort.cpp |
#include<bits/stdc++.h>
// #define ll long long
#define int long long
#define mod 1000000007
using namespace std;
void merge(vector<int>& v , int left , int mid , int right){
int i=left , j= mid+1;
vector<int> leftPart(v.size());
vector<int> rightPart(v.size());
for(i=left;i<=mid;i++){
lef... | ALGO | 0.999985 | 5.015654 |
d219449c-eb45-415f-8bce-a3215064b8e9 | raihanislam-71/Phitron | Data Structure/Module_3/Prefix_sum_and_Binary_search/LeftSum_Array.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >> n;
int a[n];
for (int i = 1; i < n; i++)
{
cin >> a[i];
}
int pre[n];
pre[1] = a[1];
for(int i=2; i<n; i++)
{
pre[i] = a[i] + pre[i-1];
}
for (int i = 0; i < n; i++)
{
... | ALGO | 0.999388 | 3.439786 |
905ff913-93c1-4b83-baac-62d897269b89 | ShivamDhamija/leetcodeQuestions | 0048-rotate-image/0048-rotate-image.cpp | class Solution {
public:
void rotate(vector<vector<int>>& m) {
for(int i=0;i<m.size();i++)
for(int j=i;j<m.size();j++)
swap(m[i][j],m[j][i]);
for(int i=0;i<m.size();i++)
for(int j=0;j<m.size()/2;j++)
swap(m[i][j],m[i][m.size()-1-j]);
}
}; | ALGO | 0.999958 | 5.725764 |
32992581-6f2d-47c5-8ff7-4c141c659dad | ishandutta2007/codeforces | igori/normal/835/A.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <cstring>
#include <cmath>
#include <stdio.h>
#include <time.h>
using namespace std;
#define sqr(z) (z) * (z)
#define ch_NO(x) cout << "NO\n"; x = 1 - x;
#define b_NO cout << "NO\n"; break;
#define r_NO c... | ALGO | 0.999925 | 3.492149 |
9d1d7397-930d-41a6-858f-968d666e3400 | dingningpei/LLM_Semantics | serene-python-client-stp/stp/minizinc/chuffed-rel2onto_20170728/boost_1_87_0/libs/geometry/test/algorithms/disjoint/disjoint_seg_box.cpp | // Boost.Geometry
// Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
// Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
#include <boost/geometry/geometries/box.hpp>
#include <boost/geometry/geometries/point_xy.hpp>
#include <boost/geometry/geometries/geometries.hpp>
#inc... | TEST | 0.976713 | 7.842645 |
71aa7aaa-8979-412f-8e6b-017f24b9b619 | khangmoihocit/DSA | DSA-sublimeText/buoi1_tg_vector_map/bai2_erase_insert.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
vector<int> v;
for (int i=0; i<n; ++i){
int tmp; cin >> tmp;
v.push_back(tmp);
}
int q; cin >> q;
while(q--){
int x; cin >> x;
if (x == 1){
int pos, val; cin >> pos >> val;
if(pos >= 0 && pos <= v.size()){
v.insert(v.be... | ALGO | 0.999847 | 4.497082 |
0f95def4-3fe3-4169-a4eb-d8f5a1f612b5 | HarshJain-sudo/cf-ladder1 | A_Next_Round.cpp | #include <bits/stdc++.h>
using namespace std;
#define max(a, b) (a < b ? b : a)
#define min(a, b) ((a > b) ? b : a)
#define mod 1e9 + 7
#define FOR(a, c) for (int(a) = 0; (a) < (c); (a)++)
#define FORL(a, b, c) for (int(a) = (b); (a) <= (c); (a)++)
#define FORR(a, b, c) for (int(a) = (b); (a) >= (c); (a)--)
#define INF... | ALGO | 0.999941 | 4.102015 |
06d3c765-d4e1-4aaf-bf2e-51672ae178f5 | Nelsonmwaura/Algorithmic-Pseudocode | ESC101 (Introduction to Computing)/Lab Question and Answers/Lab 12/IncDec (Solution).cpp | #include<stdio.h>
#include<stdlib.h>
/*The function find checks the existence of key, the parameter dir is the type of seq(1 for increasing 0 for decreasing)*/
int find(int *arr, int start, int end, int key, int dir)
{
if(start>end) return 0;
int mid=(start+end)/2;
if(arr[mid]==key) return 1;
if(dir==1)... | ALGO | 0.999999 | 4.087944 |
d15e76b2-f0ed-40ac-9869-c011a4883980 | Kartik9077/DSA | 392-is-subsequence/is-subsequence.cpp | class Solution {
public:
bool isSubsequence(string s, string t) {
int i=0;
for(auto it:t){
if(it==s[i])i++;
}
if(i==s.size())return 1;
return 0;
}
}; | ALGO | 0.999936 | 6.110257 |
1c2d1938-a43d-43aa-b452-ece6acb8705a | BGCX067/fall-2010-svn-to-git | fall-2010/data_structure/proj4/main.rand.cpp | // main.cpp
// Main program for testing hash table functions.
// M. Raymer, 2/2007
// Updated: D. C. Wlodarski, 5/2010
// -------------------------------------------------------------------
#include "RandHash.h"
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <list>
#include <string>
using names... | ALGO | 0.977851 | 5.629254 |
3adf9d8a-82da-4e78-9c01-558749fc3937 | byrantwithyou/PhysBAM | Projects/fluids_3d/Burning_Paper/adjust_temperature_16.cpp | using namespace PhysBAM;
// for i in `seq 0 \`cat last_frame\``; do ../adjust_temperature_16 $i; done
template<class T> inline T Adjust_Temperature(const T t,const int frame,const VECTOR<T,3> X)
{
//T a=39./20,b=-1./2400,c=1/3e7;
//T a=1.7,b=-.00043333,c=6.6666e-8;
T a=1.25,b=.0000166667,c=-3.3333333333e-... | DATA | 0.881014 | 4.692924 |
a37d81ef-784d-436d-a0e5-b6b4c22ffd07 | BilalKhan302/go_pride | 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.998784 | 6.761023 |
2f1837ad-9e1e-47e5-89f1-cb10d58e605c | Divyansh3021/Daa_codes | merge_sort.cpp | #include <bits/stdc++.h>
using namespace std;
void merge(int arr[] , int l , int m , int r){
int i , j , k;
int n1 = m-l+1;
int n2 = r-m;
int L[n1] , R[n2];
// copy data to l and r
for (int i = 0; i < n1; i++) L[i] = arr[l+i];
for (int j = 0; j < n2; j++) R[j] = arr[m+1+j];
i = 0 , ... | ALGO | 0.999921 | 4.462087 |
b94dbd60-a001-4352-a382-ace428d45b86 | Tehjasonlam/Codes | c++/Data Struct/lab/lab1/main.cpp | #include "ArgumentManager.h"
#include <cstring>
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
bool isPalindrome(string s, int start = 0) {
int length = s.length();
// If this condition is true, it means that the code has successfully checked
// all the characters in the string up... | TOOL | 0.998423 | 5.172365 |
8ab9ff5c-75a7-4491-afc1-bdfd32dcbf8a | nizarazar/CSC-220-Algorithms- | b-tree.cpp | #include <iostream>
#include <vector>
#include <chrono>
// BTree node
class BTreeNode {
int *keys; // An array of keys
int t; // range for number of keys
BTreeNode **C; // the array for child pointers
int n; // Current number of keys
bool leaf; // Is true when node is leaf. Otherwise fal... | ALGO | 0.999792 | 6.470871 |
4bbd0780-5bf1-4c21-9192-5312cb678c07 | cheng-chi/bulletsim_source | lib/bullet-2.79/Demos/EPAPenDepthDemo/PenetrationTestBullet.cpp |
///contribution by Pierre Terdiman to check penetration depth solvers
///see http://www.continuousphysics.com/Bullet/phpBB2/viewtopic.php?t=638
#ifdef WIN32//for glut.h
#include <windows.h>
#endif
//think different
#if defined(__APPLE__) && !defined (VMDMESA)
#include <OpenGL/gl.h>
#include <OpenGL/glu.h>
#include <... | ALGO | 0.994649 | 5.162695 |
5bb0dce1-09e1-4147-a856-015a092056db | arav12ind/my-cpp-1st-msc | Sai_Aravind_Assign_Sept/greaterof2.cpp | #include<iostream>
int main()
{
std::cout <<"\nEnter two integers : \n";
int a,b;
std::cin>>a>>b;
std::cout<<"The greater value is "<<(a>b?a:b)<<"\n";
return 0;
} | ALGO | 0.979764 | 3.821139 |
1871b306-e554-4a91-85c2-5fbb88b92f2b | ADITYAGABA1322/DSA-using-C---and-C | Atcoder-Educational DP Contest/4.Knapsack1.cpp | // Problem Statement
// There are N items, numbered 1,2,…,N. For each i (1≤i≤N), Item i has a weight of w i and a value of v i .
// Taro has decided to choose some of the N items and carry them home in a knapsack. The capacity of the knapsack is W, which means that the sum of the weights of items taken must be at mos... | ALGO | 1 | 5.734564 |
01e6c1d3-1965-4fae-9d05-1b49886a898c | douglasalves0/cp-notebook | stress-tests/data-structures/FenwickTree2d.cpp | #include "../utilities/template.h"
#include "../../content/data-structures/FenwickTree2d.h"
int main() {
rep(it,0,1000000) {
FT2 ft(12);
vector<tuple<int, int, int>> upd;
int c = rand() % 20;
rep(i,0,c) {
upd.emplace_back(rand() % 12, rand() % 12, rand() % 10 - 5);
}
vector<vi> grid(12, vi(12)), sumt... | TEST | 0.9766 | 3.496465 |
811c7d70-0c95-4860-80ed-a74da819b654 | patelalay231/Leetcode-Problem-Solutions | 0122-best-time-to-buy-and-sell-stock-ii/0122-best-time-to-buy-and-sell-stock-ii.cpp | class Solution {
public:
int helper(vector<int>& prices,int i,bool canBuy,vector<vector<int>>& dp){
if(i == prices.size()){
return 0;
}
if(dp[i][canBuy] != -1) return dp[i][canBuy];
if(canBuy){
int take = -prices[i] + helper(prices,i+1,0,dp);
int n... | ALGO | 0.999944 | 6.088379 |
3a7ce800-8c26-46c8-bfe4-508820b80885 | akshin-kuvshin/smth | Университет/Олимпиады/2024-2025/BSUIR Open XIII (semifinal)/F/F.cpp | // author: Danila "akshin_" Axyonov
#include <iostream>
using namespace std;
using lli = long long int;
#define plli pair<lli, lli>
#define mp(_first, _second) make_pair(_first, _second)
#define pb(_elem) push_back(_elem)
void solve();
int main() {
ios::sync_with_stdio(false);
cin.t... | ALGO | 0.999635 | 3.972001 |
316a9a0b-6ac8-4c51-918c-c6e7a1699dcd | ayan2809/DSA | Submission 4/exp.cpp | // C++ program to sort a stack using an
// auxiliary stack.
#include <bits/stdc++.h>
using namespace std;
// This function return the sorted stack
stack<int> sortStack(stack<int> &input)
{
stack<int> tmpStack;
while (!input.empty())
{
// pop out the first element
int tmp = i... | ALGO | 0.999971 | 5.644969 |
028412dd-56d2-4876-b116-93bc8e6042a1 | lwher/Algorithm-exercise | C++/POJ/POJ 1733.cpp | #include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<cmath>
#define N 6000
int f[N],rank[N],head[N],next[N],st[N],n,m,rear;
inline void init()
{
rear=0;
memset(head,-1,sizeof(head));
for(int i=0;i<N;i++) f[i]=i,rank[i]=0;
}
int insert_hash(int num)
{
int h=num%N;
... | ALGO | 0.999862 | 3.663166 |
93edeae9-04b7-434c-bc04-9f6d716149bb | deepakjoshi0909/Day-38 | Partition List.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* partition(L... | ALGO | 0.999993 | 5.408153 |
16aff528-310d-4865-a7aa-5917be172889 | omeshapasan2/Timely---Flutter-Timetable-App | 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.998733 | 6.76775 |
f1246199-04ab-4deb-9dbb-bb38771bb571 | NaskoIT/SDA_2022-2023 | Homeworks/10_Homework/03_topological_sort.cpp | #include <iostream>
#include <list>
#include <string>
#include <vector>
#include <unordered_set>
#include <unordered_map>
#include <algorithm>
using namespace std;
void topologicalSort(
unordered_set<char> &visitedNodes,
unordered_map<char, vector<char>> &graph,
list<char> &orderedLetters,
... | ALGO | 0.999996 | 6.113936 |
77f7dba0-3dae-469f-b76a-6b205c76751b | SentientPlatypus/Practice | cpp/vpsstring.cpp | #include <string>
using namespace std;
class Solution {
public:
bool checkValidString(string s) {
int leftCount = 0, rightCount = 0;
for (char c : s) {
leftCount += c == '(' ? 1 : -1;
rightCount += c == ')' ? -1 : 1;
if (rightCount < 0) {
... | ALGO | 0.999627 | 6.142188 |
670c1ad3-be10-448c-8bf4-76afe1d750bf | Amalie1003/ODS_example | src/Bid.cpp | #include <algorithm>
#include "Bid.h"
bool is_access = false;
size_t N_pairs = pow(2,10);
size_t insert_pairs = 100;
Bid::Bid() {
std::fill(id.begin(),id.end(),0);
}
Bid::Bid(string value) {
std::fill(id.begin(),id.end(),0);
std::copy(value.begin(), value.end(), id.begin());
}
Bid::~Bid() {
}
Bid::Bid... | TOOL | 0.981714 | 4.206615 |
e0170b9f-b490-49c8-8fff-ceb9c33c7137 | pmathur007/cp | cpp_Codeforces/EduR100/DE100.cpp | #include "bits/stdc++.h"
using namespace std;
int main() {
ios_base::sync_with_stdio(false); cin.tie(nullptr);
int T; cin >> T;
for (int t = 0; t < T; t++) {
int N; cin >> N;
vector<bool> in(2 * N);
for (int i = 0; i < N; i++) {
int bn; cin >> bn;
in[bn - 1]... | ALGO | 0.999554 | 4.87516 |
5ef79ada-026e-451d-a07d-9add0f05a99f | pushprajsinghjadoun/100_Question_for_Placement | 11_two_integer_ref.cpp | #include <iostream>
using namespace std;
void interchange_value(int* a,int *b)
{
int temp = *a;
*a = *b;
*b = temp;
cout<<*a<<" "<<*b<<endl;
}
int main()
{
int a,b;
cin>>a>>b;
interchange_value(&a,&b);
cout<<a<<"|"<<b<<endl;
return 0;
} | ALGO | 0.989412 | 4.613886 |
3f5d9d33-ed87-4574-80ef-a840141abb98 | moinhameed27/Ultimate-DSA | Bit Manipulation/Longest Subarray With Maximum Bitwise AND.cpp | // Leetcode : https://leetcode.com/problems/longest-subarray-with-maximum-bitwise-and/description/
/*
1. The AND of two elements will be <= max(a1, a2).
2. Same Elements will have same AND value.
*/
// [C++]---------------------------------------------------------------------------------------------------------------... | ALGO | 0.999693 | 6.535513 |
b5c12985-787e-465b-aa92-e23741f4f576 | Chefslayer/Translator | classes/Tree.cpp | /**
* @file
* @author Gruppe 2
* @version 1.0
*
* @section DESCRIPTION
*
*This file implements the Tree and the Nodes Classen for a prefix-tree.
*/
#ifndef __TREE_CPP__
#define __TREE_CPP__
#include "Tree.h"
#include <vector>
#include <set>
#include "../includes/Node.h"
#include <iostream>
using namespace st... | ALGO | 0.993161 | 4.652883 |
27fb123a-5cfc-4871-b26c-4b156a5c2361 | elangptra/Mobile_P7_2023 | layout_flutter/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.998368 | 6.761023 |
d482b0e5-57e3-4aaf-867e-e82493e815b1 | Rebsega/Final-Biomechanic-Project | Antropometric.cpp | #include<stdio.h>
#include<iostream>
#include<locale.h>
#include<windows.h>
#include<conio.h>
using namespace std;
int processamento(int compara,int opcao)
{
system("cls");//limpa tela
//Definindo valores
float masc[]={160,183.5,171.5,
36,49,42.8,
133,154.5,143.2,
29,42,35.5,
16,20,18.2};
float fem[... | TOOL | 0.983828 | 3.472171 |
ca8f4360-d774-41dc-a3fb-9a25c8e8bbcf | PratheekB/suv | llvm/clang-tools-extra/clangd/index/Index.cpp | #include "Index.h"
#include "llvm/ADT/StringRef.h"
#include <limits>
namespace clang {
namespace clangd {
void SwapIndex::reset(std::unique_ptr<SymbolIndex> Index) {
// Keep the old index alive, so we don't destroy it under lock (may be slow).
std::shared_ptr<SymbolIndex> Pin;
{
std::lock_guard<std::mutex> ... | TOOL | 0.861743 | 7.697918 |
a5fa9a95-147f-4b8b-957f-4cb767e51884 | Ayushmaan06/Random-CP-PS | B_Minimise_Oneness.cpp | #include <bits/stdc++.h>
#define fast std::ios::sync_with_stdio(false), std::cin.tie(NULL), std::cout.tie(NULL)
#define ll long long
using namespace std;
int main(){
fast;
int t;
cin >> t; // Number of test cases
while (t--) {
int n;
cin >> n; // Length of the binary string
v... | ALGO | 0.999966 | 4.425814 |
ed6f9e8e-2eda-4956-bc29-1be4f3913ee4 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_11359_6.cpp | #include <bits/stdc++.h>
using namespace std;
int a[200005];
int main() {
ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
int n;
cin >> n;
long long cnt = 0;
for (int i = 0; i < n; i++) cin >> a[i];
int x, f;
cin >> x >> f;
for (int i = 0; i < n; i++) {
a[i] -= x;
if (a[i] > 0) {
int... | ALGO | 0.999839 | 3.89233 |
a041f6c0-8ae5-4f66-8db6-114499e6f3eb | navjeetsandhu/cplus-reference | threads/threadSemaphore.cpp | #include <iostream>
#include <thread>
#include <condition_variable>
#include <random>
class Semaphore {
public:
explicit Semaphore (int count_ = 0)
: count(count_) {}
inline void notify() {
std::unique_lock<std::mutex> lock(mtx);
++count;
cv.notify_one();
}
inline void... | TOOL | 0.897513 | 5.81782 |
aef65951-a83d-4a52-ab63-9b12cae1c39a | RolandTeodorowitsch/AlgoritmosEEstruturasDeDadosI | 05-arvores/src/exemplo01.cpp | #include <iostream>
using namespace std;
struct Node {
char info; Node *child1, *child2, *child3;
Node(char i, Node *c1 = nullptr, Node *c2 = nullptr, Node *c3 = nullptr) {
info = i; child1 = c1; child2 = c2; child3 = c3;
cout << "+ Node("<< info << ") criado..." << endl;
}
~Node() { cout << "- No... | ALGO | 0.912891 | 3.328854 |
d49c6f2d-557c-46b1-b456-56263c2c8ef8 | anilpiparaiya/HackerRank-CPP-DSA-Solutions | Algorithms/Implementation/Grading Students.cpp | vector<int> gradingStudents(vector<int> grades) {
vector<int> result;
for(int i=0; i<grades.size(); i++){
int mod = grades[i]%5;
if(mod < 3 || grades[i] < 38) result.push_back(grades[i]);
else{
result.push_back(grades[i] - mod + 5);
}
}
... | ALGO | 0.994482 | 5.722912 |
c1a3ae52-077e-4bbb-b3a9-f9d7047374d1 | koreakk/Online-Judge | boj/Level 4/Level 4-2/25821. Palindromic Primes/Cpp.cpp | #include <iostream>
using namespace std;
using ull = unsigned long long;
ull powmod(__int128 n, __int128 r, __int128 m) {
ull ret = 1;
while (r) {
if (r & 1) {
ret = (ret * n) % m;
}
n = (n * n) % m;
r >>= 1;
}
return (ull)ret;
}
bool miller_rabin_primality_... | ALGO | 0.999791 | 5.304689 |
536b7808-58a8-42f4-8647-12bb339bc117 | twindb/twindb-xtrabackup-80 | boost_1_68_0/libs/geometry/doc/src/examples/geometries/adapted/boost_range/sliced.cpp | // Boost.Geometry (aka GGL, Generic Geometry Library)
// QuickBook Example
//[boost_range_sliced
//` Shows how to use a Boost.Geometry linestring, sliced by Boost.Range adaptor
#include <iostream>
#include <boost/geometry.hpp>
#include <boost/geometry/geometries/linestring.hpp>
#include <boost/geometry/geometries/po... | TOOL | 0.857658 | 4.707787 |
98455187-3ef9-4954-954f-192987bfec63 | izp001/gsoc2011sfm | src/StructureEstimator.cpp |
#include "StructureEstimator.h"
#include "SequenceAnalyzer.h"
#include "PointOfView.h"
#include "PointsToTrack.h"
#include "Camera.h"
namespace OpencvSfM{
using std::vector;
using cv::Ptr;
vector<char> StructureEstimator::computeStructure( unsigned int max_error )
{
vector<char> output_mask;
vector<T... | ALGO | 0.961953 | 4.773416 |
53c70086-297e-464f-90e8-26a1d55f51b4 | mkschreder/kicad | 3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/ctriangle.cpp | /**
* @file ctriangle.cpp
* @brief Implements a triangle ray intersection based on article:
* http://www.flipcode.com/archives/Raytracing_Topics_Techniques-Part_7_Kd-Trees_and_More_Speed.shtml
* by Jacco Bikker, that implement optimizations based on Ingo Wald's thesis.
*/
#include "ctriangle.h"
void CTRIANGLE::... | ALGO | 0.982272 | 7.134691 |
3b98f370-5089-44d5-937d-3473964b031d | vijaykumar0710/Leetcode | 3859-maximum-product-of-two-digits/3859-maximum-product-of-two-digits.cpp | class Solution {
public:
int maxProduct(int n) {
vector<int>vec;
int m=n;
while(m){
vec.push_back(m%10);
m/=10;
}
sort(vec.begin(),vec.end());
int s=vec.size();
return vec[s-1]*vec[s-2];
}
}; | ALGO | 0.999966 | 5.924759 |
e2ea8a8d-f906-45ae-a493-e94c1be50a57 | jianminchen/LeetCode-17 | 338_v1.cpp | /*
338_v1.cpp
Counting Bits
*/
class Solution {
public:
vector<int> countBits(int num) {
vector<int> ret;
for (int i = 0; i <= num; i++) {
int n = i, cnt = 0;
while (n) n = n & (n - 1), cnt++;
ret.push_back(cnt);
}
return ret;
}
}; | ALGO | 0.999873 | 6.156093 |
1e5b86cb-aa3b-4f2c-abe9-2859579a6ace | Mayurpatil729/CPP-LANGUAGE | 1 BASIC PROGRAM CPP/4 TEMPLATES/PAIRS/PAIRS.cpp | // Date :
#include <bits/stdc++.h>
#include <iostream>
using namespace std;
int main()
{
pair<int, int> p = {1, 3};
cout << p.first << " " << p.second;
cout << "\n";
pair<int, pair<int, int>> a = {1, {3, 4}};
cout << p.first << " " << a.second.second << " " << a.second.first;
cout << "\n... | TOOL | 0.973884 | 4.021181 |
cca8a837-a812-4454-bddc-db0de09b49be | ishandutta2007/codeforces | -skyline-/normal/615/E.cpp | #include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#i... | ALGO | 0.999951 | 3.537044 |
21342635-d505-4128-aeb5-cf9e36fcc3b8 | tomn2804/Kanalysis | External Dependencies/boost_1_74_0/libs/compute/example/black_scholes.cpp | #include <cstdlib>
#include <iostream>
#include <boost/compute/command_queue.hpp>
#include <boost/compute/system.hpp>
#include <boost/compute/algorithm/copy_n.hpp>
#include <boost/compute/container/vector.hpp>
#include <boost/compute/utility/source.hpp>
namespace compute = boost::compute;
// return a random float be... | ALGO | 0.995324 | 6.934232 |
acfd032f-67e9-44a7-ac7d-2ca31d14c3d3 | GeorgeLyon/SwiftHDL | mlir/llvm/mlir/lib/Tools/lsp-server-support/Transport.cpp | #include "mlir/Tools/lsp-server-support/Transport.h"
#include "mlir/Tools/lsp-server-support/Logging.h"
#include "mlir/Tools/lsp-server-support/Protocol.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/Support/Errno.h"
#include "llvm/Support/Error.h"
#include <optional>
#include <system_error>
#include <utility>
us... | WEB | 0.891 | 7.792255 |
6792381e-0641-4198-8bce-f2f3094fa000 | heavenMOJANG/ICPC | .history/2024HDU多校/HDU多校2/1011_20240722155840.cpp | #pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3,"Ofast","inline")
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int inf = 0x7fffffff;
typedef deque<int> dic;
const int N = 2e5+10;
char s0[N],s1[N],t0[N],t1[N];
int n,cnt,vis[N],ans,in[N],Map[N];
struct ACM{
int son[2... | ALGO | 0.99999 | 3.909426 |
93d99493-bb4f-4a96-8703-af2a23d6a9f7 | SavkovAndrey/Hard_02 | Hard_02/main.cpp | #include <iomanip>
#include <iostream>
#include <time.h>
#include <chrono>
#include <algorithm>
#include <numeric>
#include <ctime>
using namespace std;
//--------------------- ---------------------------------------
/*
.
, rand.
,
(,
, ).
.
1) . ,
. ,
... | ALGO | 0.999846 | 4.220875 |
f63869af-09af-4dad-b858-b8f6e1cc5bfc | sohag16030/BattleOfBrainOnlineJudgeProject | Project/hoj/media/user 3/soln_Qk1NzBr.cpp | #include<bits/stdc++.h>
using namespace std;
#define sz 1000006
#define EPS 1e-9
#define PI acos(-1.0)
#define INF 10000007
#define LLINF 100000000000000007
#define F first
#define S second
#define pb push_back
#define mk make_pair
#define all(x) x.begin(),x.end()
#define FastIO ios::sync_with_stdio(0);
typedef l... | ALGO | 0.999961 | 3.550777 |
12f59b66-f13d-4e80-82c2-ab114c1a907e | hasnat0006/CP_SOLUTION | Codeforces/Normal Round/Round 900 - 999/Round 934 (Div. 2)/1944A.cpp | //!-----------------------------------------------------!//
//! Author: YUSUF REZA HASNAT !//
//! Created: 16|03|2024 20:40:41 !//
//!-----------------------------------------------------!//
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#def... | ALGO | 0.99993 | 5.075977 |
c996bc76-8c37-4f4e-9beb-ffeae19faf72 | Aquib-Nawaz/CP4-Book | UVa/10408.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
typedef pair<int,int>pi;
int gcd(int a, int b){
if(b==0) return a;
return gcd(b,a%b);
}
vector<int>coprimes[1001];
int help(int x, int i, int n){
return lower_bound(coprimes[i].begin(), coprimes[i].end(), ce... | ALGO | 0.999918 | 4.317948 |
9c5ec28f-5bf2-4771-bdbd-d321013754eb | harsh-srivastv/LeetCode-75 | Level 1/Day 13/1. Two Sum.cpp | // https://leetcode.com/problems/two-sum/
#include<bits/stdc++.h>
using namespace std;
class Solution {
public:
vector<int> twoSum(vector<int>& nums, int target) {
vector<int> ans;
unordered_map<int, int> map;
for(int i=0;i<nums.size();i++){
if(map.find(target-nums[i]) != map.en... | ALGO | 0.999505 | 6.359293 |
113ed0c8-25a2-4859-93e9-3c5cd6c6ca16 | angshn/algorithm | plats/luogu/P3366.cpp | #include <bits/stdc++.h>
#define ll long long int
#define GETA(buf,size) for(int i=0;i<size;i++) cin>>buf[i];
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))
inline int read(){int x=0,f=1;char ch=getchar();while (ch<'0'||ch>'... | ALGO | 0.999975 | 4.192519 |
671582a1-b878-451f-9dfe-c9b22040a8cc | Sudhanwa11/CodSoft-INTERNSHIP | Number guessing game/Number guessing game.cpp | #include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
int main() {
srand ((unsigned int) time(NULL));
int number = (rand() % 100) + 1; // 0-99 + 1 -> 1-100
int guess = 0;
do {
cout << "Enter your guess (1-100): ";
cin >> guess;
if (guess > number) {
... | ALGO | 0.921692 | 3.655931 |
54779679-8356-40f3-ad81-68f14ee72b51 | Yeluorag/ACM-ICPC-Code-Library | Codeforces/Codeforces Round #322 (Div. 2)/A.cpp | #include <algorithm>
#include <iostream>
#include <sstream>
#include <cstring>
#include <cstdio>
#include <vector>
#include <string>
#include <queue>
#include <stack>
#include <cmath>
#include <set>
#include <map>
using namespace std;
typedef long long LL;
#define mem(a, n) memset(a, n, sizeof(a))
#define rep(i, n) fo... | ALGO | 0.999895 | 4.543365 |
90a7fad7-b9fb-466b-920c-bd84212c8f98 | UynUyn2k10103/Algorithm | nham_chu_so.cpp | #include <bits/stdc++.h>
#define fastIO() ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define ll long long
#define fori(i,a,b) for (ll i = a; i < b; i++)
#define forr(i,a,b) for (ll i = a - 1; i >= b; i--)
#define pb push_back
#define mp make_pair
#define F fist
#define S second
using namespace std;
int n;
... | ALGO | 0.999414 | 3.878061 |
e99acf68-ec8e-4cab-b32d-5795311181fd | GitSid-glitch/Competitive_Programming | E_1_Digital_Village_Easy_Version.cpp |
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
const int N = 405;
int n, m, p, s[N], u[N], v[N], w[N], f[N][N], g[N][N], ans[N];
vector<int> e[N];
void dfs(int u, int fa) {
for (int v : e[u]) {
if (v != fa) {
dfs(v, u);
for (... | ALGO | 0.999896 | 4.007519 |
00700fb0-33cb-4a5a-8ac8-5a6e4409754d | saga-blast/Competitive-Programming | LeetCode/Reshape_the_matrix.cpp | class Solution {
public:
vector<vector<int>> matrixReshape(vector<vector<int>>& mat, int r, int c) {
int col = mat.size() , row = mat[0].size();
if((col * row )!= (r * c))
return mat;
vector<vector<int>> v(r , vector<int> (c,0));
for(int i=0;i<r*c;i++){
v[i/... | ALGO | 0.999262 | 6.007455 |
1a6c27ca-2160-465c-b3a8-d4d814e27a53 | falsemand/baekjoon | answer/boj-30088.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll answer, a[1000];
int n;
void solution()
{
cin >> n;
for (int i = 0; i < n; i++)
{
int temp;
cin >> temp;
for (int j = 0; j < temp; j++)
{
int k;
cin >> k;
a[i] += ... | ALGO | 0.999734 | 3.055101 |
7a6749ea-3381-4b22-bb3a-47b96fb6e57e | sarvex/leetcode-powershell | solution/0600-0699/0665.Non-decreasing Array/Solution.cpp | class Solution {
public:
bool checkPossibility(vector<int>& nums) {
int n = nums.size();
for (int i = 0; i < n - 1; ++i) {
int a = nums[i], b = nums[i + 1];
if (a > b) {
nums[i] = b;
if (is_sorted(nums.begin(), nums.end())) {
... | ALGO | 0.999998 | 6.065911 |
e81b59bd-3a03-45fb-8780-3e5137b1c93d | mschlund/FPsolve | c/src/gr_checker.cpp | /*
* gr_checker.cpp
*
* Created on: 04.01.2015
* Author: schlund
*/
#include <cstdlib>
#include <iostream>
#include <string>
#include <vector>
#include <boost/program_options.hpp>
#include "datastructs/matrix.h"
#include "datastructs/equations.h"
#include "polynomials/commutative_polynomial.h"
#include "... | ALGO | 0.984899 | 6.30912 |
21490062-9940-4e09-9b4a-e28e2ac0e2ad | junes7/CPPalgorithm | KOISTUDY/0135.cpp | // 배열 채우기 III
// fill array III
// 한 정수 n을 입력받아서 이차원 배열 n*n을 달팽이 모양으로 채워서
// 출력하는 프로그램을 작성하시오.
// n=3인 예
// 1 2 3
// 8 9 4
// 7 6 5
# include <iostream>
int main(){
int n,i=1,j=0,b,c,r=1,l=0,d[110][110]={};
scanf("%d",&n);
for(c=1;c<=n*n;){
for(b=1;b<=n-l;b++){
j+=r;
d[i][j]=... | ALGO | 0.999789 | 3.929216 |
99fb1456-75f9-4123-a6c3-99417d42300d | gustavofadel/Exercises | URI/2380.cpp | # include <bits/stdc++.h>
using namespace std;
# define _ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
const int MAXN = 1e5 + 10;
char op;
int a, b, k, n, parent[MAXN], rnk[MAXN];
int find (int x) {
if (parent[x] == x) {
return x;
}
return parent[x] = find(parent[x]);
}
int join (... | ALGO | 0.999933 | 4.036544 |
d54a5aaf-21c7-4a40-b6b9-705286f56b6a | lukasstockner/blender | extern/bullet2/src/BulletSoftBody/btSoftRigidCollisionAlgorithm.cpp | #include "btSoftRigidCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h"
#include "BulletCollision/CollisionShapes/btBoxShape.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "btSoftBody.h"
#inc... | ALGO | 0.997432 | 4.0597 |
7834e70e-a400-4114-be3e-c5ec439d8d25 | munraito/made-algo | solutions/W16_geometry/A_point_on_line_segment.cpp | #include <iostream>
using namespace std;
struct Point {
int x;
int y;
Point(const int& x, const int& y): x(x), y(y) {
}
};
class Vector {
public:
int x;
int y;
Vector (Point a, Point b) {
x = b.x - a.x;
y = b.y - a.y;
}
};
int cross_product(Vector a, Vector b) {
re... | ALGO | 0.999941 | 4.026514 |
e2639c81-5e80-4d68-b6bb-5f3a8f2dca1b | NGUAlexZhang/Algorithm | Acwing/基本数据结构/总结/160匹配统计.cpp | #include <bits/stdc++.h>
using namespace std;
char s[250000],t[250000];
int kmp[250000],ans[250000],tot[250000];
int main(){
int n,m,q;
scanf("%d%d%d",&n,&m,&q);
scanf("%s",s+1);
scanf("%s",t+1);
for(int i=2,j=0;i<=m;i++){
while(j&&t[j+1]!=t[i]) j=kmp[j];
if(t[j+1]==t[i]) j++;
... | ALGO | 0.999928 | 3.482921 |
1f0a95a2-f775-47f2-8fa9-38c7d43c1aa0 | tokabe333/OkabeAtcoder | ABC_200to250/ABC_244/C-YamanoteLineGame.cpp | #include <algorithm>
#include <climits>
#include <cmath>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <limits>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector... | ALGO | 0.998866 | 3.496081 |
14da1034-67be-4b7a-8603-2971944cc478 | LeonidVV/vDexNode | src/value.cpp | #include "value.h"
#include "default_types.h"
#include "securedht.h" // print certificate ID
#ifdef OPENDHT_JSONCPP
#include "base64.h"
#endif
namespace dht {
const std::string Query::QUERY_PARSE_ERROR {"Error parsing query."};
Value::Filter bindFilterRaw(FilterRaw raw_filter, void* user_data) {
if (not raw_fi... | TOOL | 0.942271 | 6.548965 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.