uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
3278bf72-f710-49f9-b905-fb69fa8e6f30 | AdsonFS/beecrowd-codes | codes/1055.cpp | #include <bits/stdc++.h>
using namespace std;
#define REP(i, a, b) for(int i = (a); i <= (b); i++)
#define PER(i, a, b) for(int i = (a); i >= (b); i--)
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define debug(x) cerr << #x << " = " << x << endl;
#define SET(c, v) memset(c, v, sizeof c)
#define pi 3.1415926535... | ALGO | 0.999757 | 3.787298 |
ddb4b541-1650-4c3f-9cc9-7a402ee36498 | bakhangildin/spidermonkey | other-licenses/7zstub/src/CPP/7zip/Bundles/LzmaSpec/LzmaSpec.cpp | /* LzmaSpec.cpp -- LZMA Reference Decoder
2015-06-14 : Igor Pavlov : Public domain */
// This code implements LZMA file decoding according to LZMA specification.
// This code is not optimized for speed.
#include <stdio.h>
#ifdef _MSC_VER
#pragma warning(disable : 4710) // function not inlined
#pragma warning(dis... | TOOL | 0.985581 | 6.693278 |
98daa8f0-2866-42d9-a1e1-c922a6414e12 | deepin-community/llvm-toolchain-19 | libc/src/stdfix/roundulr.cpp | #include "roundulr.h"
#include "src/__support/common.h"
#include "src/__support/fixed_point/fx_bits.h"
#include "src/__support/macros/config.h"
namespace LIBC_NAMESPACE_DECL {
LLVM_LIBC_FUNCTION(unsigned long fract, roundulr,
(unsigned long fract x, int n)) {
return fixed_point::round(x, n);
}
}... | ALGO | 0.98898 | 6.542975 |
d55ac4ad-0b5a-4a57-b40e-4fe7fa0384e7 | ayushcodes01/cpp | ap.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cout<<"Enter n :";
cin>>n;
for(int i=1;i<=n;i++){
if(n%i==0) cout<<i<<" ";
cout<<"Risk is always better than regret" ;
}
} | ALGO | 0.99791 | 3.357865 |
f3d651bc-e4d1-4897-a240-d76acd396cf0 | Zimse12345/Code | Codeforces_Contest/CF1833/A.cpp | #include <bits/stdc++.h>
// #define int long long
using namespace std;
const int N = 1.01e6;
int T, vis[300][300], ans, n;
char s[N];
signed main()
{
cin >> T;
while (T--)
{
cin >> n;
scanf("%s", s + 1);
ans = 0;
for (int i = 1; i < n; i++)
{
if (!vis[s[... | ALGO | 0.999542 | 4.191611 |
64b94ada-3739-4829-ac25-e7226acc9c3e | eyangch/competitive-programming | Codeforces/1269/d.cpp | #include <bits/stdc++.h>
#define endl "\n"
#define eat cin
#define moo cout
#define int long long
using namespace std;
int N, a[300000];
int32_t main(){
eat.tie(0) -> sync_with_stdio(0);
eat >> N;
for(int i = 0; i < N; i++){
eat >> a[i];
}
int x = 0, y = 0;
for(int i = 0; i < N; i++){... | ALGO | 0.999969 | 4.175463 |
584f41c8-9ab7-48e0-b324-030058fca644 | ishandutta2007/codeforces | eric_hooo/normal/1687/A.cpp | #include <bits/stdc++.h>
using namespace std;
int a[200010];
long long S[200010];
int main() {
int T; scanf("%d", &T);
while (T--) {
int n, k; scanf("%d%d", &n, &k);
for (int i = 1; i <= n; i++) {
scanf("%d", &a[i]);
S[i] = S[i - 1] + a[i];
}
long long ans = 0;
for (int i = 1; i <= n; i++) {
int ... | ALGO | 0.999854 | 3.949121 |
fe246af0-499e-4531-a2b2-cc06cb125964 | morris821028/UVa | volume107/10762 - Treasure Castle.cpp | #include <bits/stdc++.h>
using namespace std;
const int MAXN = 5005;
const int INF = 0x3f3f3f3f;
struct Pt {
int x, y;
Pt() {}
Pt(int x, int y):x(x), y(y) {}
void read() {
scanf("%d %d", &x, &y);
}
bool operator<(const Pt &o) const {
if (x != o.x) return x < o.x;
return y < o.y;
}
} pt[MAXN], gt[MAXN], ... | ALGO | 0.999878 | 4.07775 |
d9287b68-c058-4442-a7cc-fff5ae433b5d | jesuswr/cp-codes-and-problems | B.grow_the_tree.cpp | #include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <algorithm>
#include <math.h>
#include <string>
#include <cstring>
#include <set>
#include <map>
#include <unordered_map>
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<int,pair<int,int>> piii;
typedef... | ALGO | 0.999869 | 3.868471 |
45e7b505-1bbd-497e-8a58-daedb14e44a2 | heturing/FSPA | libcxx/test/std/algorithms/alg.modifying.operations/alg.unique/unique_copy.pass.cpp | // <algorithm>
// template<InputIterator InIter, class OutIter>
// requires OutputIterator<OutIter, RvalueOf<InIter::value_type>::type>
// && EqualityComparable<InIter::value_type>
// && HasAssign<InIter::value_type, InIter::reference>
// && Constructible<InIter::value_type, InIter::reference... | TEST | 0.972632 | 6.522912 |
6dba6b5b-91e0-4f69-9213-5c8e57f21076 | lightning830/cpp | 158/d.cpp | #include<iostream>
#include<list>
#include<string>
#define rep(i, n) for(int i = 0; i < (n); i++)
using namespace std;
int main(){
list<char> S;
string s;
cin >> s;
const char* cstr = s.c_str();
while(*cstr != '\0'){
S.push_back(*cstr);
cstr++;
}
int q;
cin >> q;
in... | ALGO | 0.999791 | 4.032441 |
5467c5a1-d8e8-40cc-b2e1-566fd47afb96 | ermine27/competitive-programming | src/atcoder/abc/257/257-b.cpp | #include <bits/stdc++.h>
using namespace std;
#define reps(i,s,n) for(int i = (int)(s); i < (int)(n); ++i)
#define rep(i,n) reps(i,0,n)
#define repf(i,n) reps(i,1,n+1)
using vi = vector<int>;
int main(){
int n, k, q;
cin >> n >> k >> q;
vi m(n+1);
rep(i, k){
int ai;
cin >> ai;
... | ALGO | 0.999928 | 3.136296 |
41f760e3-86e7-4331-a54a-f1310f31adc9 | Chin-Z/Code-of-White-Book | 入门经典/书籍相关资料/ch7/524.cpp | #include<cstdio>
#include<algorithm>
using namespace std;
int is_prime(int x) {
for(int i = 2; i*i <= x; i++)
if(x % i == 0) return 0;
return 1;
}
int main() {
int n, A[50], isp[50];
scanf("%d", &n);
for(int i = 2; i <= n*2; i++) isp[i] = is_prime(i);
for(int i = 0; i < n; i++) A[i] = i+1;
do {
... | ALGO | 0.999971 | 3.730958 |
3b038f30-6447-4559-a282-98fc9435c0b4 | CliffLinTw/gamer_non-uniform_AMR | src/Particle/Par_PredictPos.cpp | #include "GAMER.h"
#ifdef PARTICLE
//-------------------------------------------------------------------------------------------------------
// Function : Par_PredictPos
// Description : Predict particle position to a target time
//
// Note : 1. Skip particles with time < 0.0
// --> The... | ALGO | 0.99969 | 5.470662 |
32378ec0-85d4-45d3-8fcc-d488451f12d9 | sheikhDipta003/CSE-108-BUET | C++ Practice_Home/Term Final/7.cpp | # include <iostream>
using namespace std;
class ListItem{
int item;
ListItem *next;
public:
ListItem(int arg){item = arg; next = NULL;}
int getItem(){return item;}
void setNext(ListItem *n){next = n;}
ListItem* getNext(){return next;}
};
class List{
public:
ListItem *head;
ListItem *ta... | TOOL | 0.962658 | 4.537217 |
a04cb5c2-f2c1-4583-abe3-de795b1f4f8e | YourFavoriteCode/DeformationModel | rotations.cpp | // This is an open source non-commercial project. Dear PVS-Studio, please check it.
// PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
#include "stdafx.h"
#include <fstream>
#include "rotations.h"
#include "params.h"
#include "fragment.h"
#include "distributions.h"
namespace model
{
void R... | ALGO | 0.965459 | 3.332881 |
2ca05ca4-ac89-4e9c-ae7f-2745872ab565 | KulwinderSingh04/Data-Structures | 2060-merge-bsts-to-create-single-bst/merge-bsts-to-create-single-bst.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.999961 | 5.862804 |
614d51b2-a18c-48d9-b1b3-af76a3c71ade | Chiragadve/leetcode-submission | 3279-alice-and-bob-playing-flower-game/alice-and-bob-playing-flower-game.cpp | class Solution {
public:
long long flowerGame(int n, int m) {
long long Odd_n = ceil((n+1)/2);
long long Even_n = n/2;
long long Odd_m = ceil((m+1)/2);
long long Even_m = m/2;
return (Odd_n * Even_m) + (Odd_m * Even_n);
}
}; | ALGO | 0.999921 | 5.566071 |
b46a01fb-125b-4856-b555-06d3ee12f0c8 | ishandutta2007/codeforces | betaveros/normal/569/B.cpp | #include <cstdio>
#include <cassert>
using namespace std;
int n;
const int N = 100008;
bool seen[N];
int res[N];
int x;
int cnt;
int main() {
scanf("%d", &n);
for (int i = 0; i < n; i++) {
scanf("%d", &res[i]);
if (res[i] > n || seen[res[i]]) {
res[i] = 0;
} else {
seen[res[i]] = true;
}
}
int nxt = 1... | ALGO | 0.99999 | 3.640328 |
395136b9-89ce-4fb0-9954-8fd34a15d961 | HoneyCoding/Algorithm-Code | BOJ/3273.cpp | // https://www.acmicpc.net/problem/3273
// BOJ 3273번 - 두 수의 합
#include <iostream>
using namespace std;
int n;
int list[100006] = {0};
int chk[2000006] = {0};
int x;
int main(void) {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> n;
for(int i=0; i<n; i++) {
cin >> list[i];
ch... | ALGO | 0.999971 | 4.885103 |
e57fa81b-24de-4e9e-a5d4-f3c573ab98f1 | Jinedl/C_Cpp_tasks | С++/c7t1.cpp | template<typename T>
typename T::value_type process(const T &a)
{
typename T::value_type ans = typename T::value_type();
int count = a.size() >= 5 ? 3 : (a.size() + 1) / 2;
auto iter = a.end();
for (int i = 0; i < count; i++) {
iter--;
ans += *iter;
iter--;
}
return ans;
... | ALGO | 0.999384 | 4.800011 |
b06608a1-bcd7-4d1a-a64d-c9cf90ba0501 | kajori2000sardar/lab5_141 | lab5_q19.cpp | //include library
#include<iostream>
using namespace std;
//create main
int main()
{
//declare variables
int p,c,b,m,cs,per;
//ask for the marks of five subjects
cout<<"Enter the marks of five subjects";
//take the marks of the five subjects as input
cin>>p>>c>>m>>cs>>b;
//calculate the percentage of the pr... | TOOL | 0.91841 | 3.802271 |
66a18f4b-0c22-438d-a143-8709755cdac7 | saffy-embedded-22-study/Study | 이용은/a형기출/week04_도로건설(민코딩알탑).cpp | #include <iostream>
#include <algorithm>
#include <queue>
using namespace std;
int N, M;
int MAP[1000][1000];
int dist[1000][1000];
struct Node {
int y, x, cost;
bool operator <(Node next)const {
if (cost < next.cost) return false;
if (cost > next.cost) return true;
return false;
}
};
void input();
int Dijstr... | ALGO | 0.999973 | 4.645681 |
fe29fd9f-1a87-4f1c-ac54-40551fcc74dc | tudelft3d/3D_Urban_Mesh_Annotator | CGAL/examples/Boolean_set_operations_2/simple_join_intersect.cpp | /*! \file simple_join_intersect.cpp
* Computing the union and the intersection of two simple polygons.
*/
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Boolean_set_operations_2.h>
#include <list>
typedef CGAL::Exact_predicates_exact_constructions_kernel Kernel;
typedef Kernel::Point_2... | ALGO | 0.985682 | 5.921857 |
94dd9f16-3d25-4835-86af-9a5bed8022e8 | bitcoin-dev-tools/benchcoin-testing | src/mapport.cpp | #include <mapport.h>
#include <clientversion.h>
#include <common/netif.h>
#include <common/pcp.h>
#include <common/system.h>
#include <logging.h>
#include <net.h>
#include <netaddress.h>
#include <netbase.h>
#include <random.h>
#include <util/thread.h>
#include <util/threadinterrupt.h>
#include <atomic>
#include <cas... | TOOL | 0.870741 | 7.474108 |
7602f163-c5a5-42d2-b6a4-ad41d7b01776 | pavelRyumin/Task7.7 | main.cpp | #include <iostream>
using namespace std;
const int f = 256;
bool pal(char t[f], int c) {
if (c == (strlen(t) - 1) / 2) {
return true;
}
else {
if (t[c] == t[strlen(t) - c - 1]) {
pal(t, c + 1);
}
else {
return false;
}
}
}
int main() {
char t[f... | ALGO | 0.999795 | 4.059143 |
13f70327-bca7-4d1e-9af2-2206e5559287 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_1012_11.cpp | #include <bits/stdc++.h>
using namespace std;
void write(int x) {
if (x < 0) {
putchar('-');
x = -x;
}
if (x > 9) write(x / 10);
putchar(x % 10 + '0');
}
int read() {
int d = 0, w = 1;
char c = getchar();
for (; c < '0' || c > '9'; c = getchar())
if (c == '-') w = -1;
for (; c >= '0' && c <=... | ALGO | 0.999893 | 3.102924 |
9239ea5c-f458-432e-a59c-92b7b085f118 | andrsvb/LP-pract | ej4.cpp | #include <string.h>
#include <iostream>
using std::cout;
using std::cin;
//4.1
struct elemento {
int a;
int n;
elemento *sig;
elemento *ant;
};
typedef struct elemento *polinomio;
//4.2
void insertar(polinomio &poli, elemento *nuevo) {
elemento *t = poli;
//4.3
if (poli == NULL) {
poli = nuevo;
} else if (p... | ALGO | 0.997746 | 3.791499 |
cfe97cc6-f163-4c3f-8186-ad330ddb0fce | Sayantan-dev1003/LeetCodeStreak | Day134_KthSmallestProductOf2SortedArrays.cpp | class Solution {
public:
long long kthSmallestProduct(vector<int>& nums1, vector<int>& nums2,long long k) {
vector<int> A1;
vector<int> A2;
vector<int> B1;
vector<int> B2;
seperate(nums1, A1, A2);
seperate(nums2, B1, B2);
const long negCount = A1.size() * B2... | ALGO | 0.999986 | 5.507966 |
442986a5-c59c-4cf3-ba37-249c6a0b6b1b | HEltim7/cpcode | NowCoder/挑战赛/挑战67/点分治.cpp | #include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
#define endl '\n'
using LL=long long;
constexpr int N=2e5+10;
vector<int> adj[N];
vector<pair<int,int>> edg[N];
bool del[N];
int sz[N],centroid[2];
void get_centroid(int u,int fa,int tot) {
int maxx=0;
sz[u]=1;
for(int v:adj[u... | ALGO | 0.999751 | 5.592154 |
8deff45a-9a97-43c2-87c3-cc5a5d571b61 | ductai05/fun-cses | Introductory Problems/Increasing Array.cpp | #include<iostream>
using namespace std;
int main(){
int n; cin >> n;
int *a = new int[n];
for (int i = 0; i < n; i++) cin >> a[i];
int max_now = a[0];
long long ans = 0;
for (int i = 0; i < n; i++){
max_now = max(max_now, a[i]);
ans += max_now - a[i];
}
cout << a... | ALGO | 0.99984 | 3.663463 |
9d5db361-b6a8-4b3e-a6b5-04872f9b7bab | ashhadimam07/Codeforces | sort the array/main.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
{
cin>>arr[i];
}
int l=0;
int r=0;
for(int i=0;i<n-1;i++)
{
if(arr[i]>arr[i+1])
{
l=i;
break;
}
}
for(int i=n-... | ALGO | 0.999983 | 3.612209 |
ee86ae68-89f8-4513-b971-291589f61309 | iagozag/competitive_programming | contests/cf/group/trem/c0/c.cpp | #include <bits/stdc++.h>
using namespace std;
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define rep(i,x,n) for(auto i=x;i<n;i++)
#define repr(i,n,x) for(auto i=n;i>=x;i--)
#define forr(x, v) for(auto& x: v)
#define all(a) (a).begin(), (a).end()
#define endl '\n'
#define ff first
#define ss second
#define eb e... | ALGO | 0.999997 | 4.413509 |
b4f8f90e-ddc1-4b65-a951-d76faef777e9 | miank108/CompetitiveProgramming | LeetCode/MaximumProductOfTwoElementsInAnArray/MaximumProductOfTwoElementsInAnArray.cpp | // MaximumProductOfTwoElementsInAnArray.cpp
#include "pch.h"
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int maxProduct(vector<int>& nums) {
if (nums.size() >= 2)
{
sort(nums.begin(), nums.end());
}
int size = nums.size();
int num1 = nums[size - 1];
int num2 = nums[size ... | ALGO | 0.999915 | 4.692489 |
7f783bb7-6e7a-4032-9c09-a0a56050daea | yoonje/dev-note | datastructure/STL/List/list5.cpp | #include<iostream>
#include<list>
using namespace std;
int main()
{
list<int> list1;
list1.push_back(10);
list1.push_back(20);
list1.push_back(30);
list<int>::iterator iter = list1.begin();
while(iter != list1.end()){
cout << "erase:" << list1.front() << endl;
list1.eras... | TOOL | 0.876924 | 3.896879 |
b13c77eb-b800-4c7d-bc02-266359a4ccf0 | gauravk268/Competitive_Coding | HackerRank/OPC_Feb2020/cake.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
int main() {
int T;
cin>>T;
while(T--){
int N, K, i, j, size;
cin>>N>>K;
long long int arr[N], result=0, result1=0;
for(i=0; i<N; i++)
... | ALGO | 0.999953 | 4.679048 |
0d3267e9-86d2-4509-a01d-309253fe49cd | eKhars/Product_List_app2 | 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 |
d51dd9a3-eacf-4648-a22a-745248b38c50 | nazeer-18/Dsa-with-Cpp | codes/set_intro.cpp | #include<bits/stdc++.h>
#define ll long long
#define loop(i,n) for(int i = 0; i < n; i++)
#define loop1(i,n) for(int i = 1; i <= n; i++)
using namespace std;
int main()
{
// set<int,greater<int>> s;
unordered_set<int> s;
s.insert(1);
s.insert(6);
s.insert(2);
s.insert(5);
s.insert(6);
fo... | ALGO | 0.996857 | 3.100338 |
2170d05a-ff1d-4cdf-977f-813ce5d77ad0 | mini-jongrok/PS | saseo/programmers/level1/내적.cpp | #include <vector>
using namespace std;
int solution(vector<int> a, vector<int> b) {
int answer = 0;
int idx = 0;
while (idx < a.size())
{
answer += a[idx] * b[idx];
idx++;
}
return answer;
} | ALGO | 0.999917 | 4.91805 |
ab49abf4-5352-44fa-ad1b-daaf39c0c7f2 | saif-gitreps/Algorithms | Dynamic-Programming/Find-Minimum-time-to-reach-last-room-I.cpp | class Solution {
// weird problem
public:
int const mx = 1e9;
int kev(int i, int j, vector<vector<int>>& a, int n, int m) {
if (i == n-1 && j == m-1) {
return 0;
}
if (i == n || j == m) {
return mx;
}
int val = 0;
if (i == 0 && j == 0) {
... | ALGO | 0.999794 | 5.712455 |
8e8b8ae5-b0e2-4169-9feb-36c9f8ad051f | joseph-garni/SU2-GSOC-GPU | Common/src/toolboxes/C1DInterpolation.cpp | #include "../../include/toolboxes/C1DInterpolation.hpp"
#include "../../include/linear_algebra/blas_structure.hpp"
#include <iostream>
#include <fstream>
#include <cmath>
using namespace std;
su2double CAkimaInterpolation::EvaluateSpline(su2double Point_Interp) const {
const auto i = lower_bound(Point_Interp);
... | ALGO | 0.994687 | 5.564231 |
dd845a93-fe03-4b17-ae36-72f47f46b517 | DragonKrissash/TLE | Practice/1200/B_Battle_Cows.cpp | #include <bits/stdc++.h>
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <algorithm>
#include <cmath>
#include <vector>
#include <cassert>
#include <array>
#include <string>
#include <cstring>
#include <chrono>
using namespace std;
using namespace std::chrono;
#define nl '\n'
#define int long long
#d... | ALGO | 0.999863 | 3.638821 |
47595a62-f807-4977-bd84-6782d976d1e1 | BSU2015gr09/Gressky | First semester/6. Stack.cpp | #include <iostream>
#include <clocale>
using namespace std;
int const N = 10000;
int stack[N];
int top = 0;
void push(int num) {
if (stack[0] == 0) {// Т.е. я не смогу в стек помещать нули???? Что за странный стек )))))
stack[top] = num;
top++;
}
else {
for (int i = top; i >= 0; i--) { stack[i + 1] = stack[i];... | ALGO | 0.985733 | 3.78543 |
78bae0d5-bea4-473b-924e-7c45c555a0e3 | busebd12/InterviewPreparation | LeetCode/C++/General/Medium/MaximumPointsInAnArcheryCompetition/solution.cpp | #include <limits>
#include <vector>
using namespace std;
class Solution
{
private:
int maxScore=numeric_limits<int>::min();
public:
vector<int> maximumBobPoints(int numArrows, vector<int> & aliceArrows)
{
vector<int> result;
int n=aliceArrows... | ALGO | 0.999959 | 4.76427 |
2423d515-4607-4861-9246-6c66da497557 | kbernardino20/MRBR_Ken | namer/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.997642 | 6.76073 |
ac7725f7-9064-4023-a563-7e6d3c5e1864 | FrancoMariotti/Taller_de_programacion1 | templates1.cpp | /* Definir la rutina PRIMERO_PRIMOS de forma que ordene los elementos recibidos de la siguiente manera: Primero los primos y luego el resto,
* y dentro de * esa clasificación, por orden ascendente. Ejemplo: Si recibe los elementos 1,6,7,2,9,4,3 debe devolver 1,3,7,2,4,6,9
* std:list<T> PRIMERO_PRIMOS(std:list<T> &Lis... | ALGO | 0.998982 | 4.828309 |
047b27bd-622a-4fb6-8743-877c56869180 | sisi0808/atcoder-env | abc/277/b.cpp | #include <bits/stdc++.h>
/* ACLのライブラリを追加*/
#include <atcoder/all>
using namespace atcoder;
#define fio() \
cin.tie(nullptr); \
ios::sync_with_stdio(false);
using namespace std;
#define rep(i, n) for(int i = 0; i < int(n); ++i)
#define rrep(i, n, m) for(int i = n; i >= m; --i)
#define repp(i, n, m) for(... | ALGO | 0.999383 | 4.890871 |
52394b4c-b854-4b1d-be12-6cf6e3f82d57 | suryawanshishantanu6/Programs | $CN/group a/socket/3Trign/server.cpp | #include<stdio.h>
#include<sys/socket.h>
#include<netinet/in.h>
#include<string.h>
#include<arpa/inet.h>
#include<math.h>
int main()
{
int welcomeSocket,newSocket;
char buffer[20];
double angle, dsine,dcos,dtan;
int ch;
double res;
int nos[2];
struct sockaddr_in serverAddr;
struct sockaddr_storage serve... | WEB | 0.921771 | 3.335309 |
12b4e257-7a29-46a0-93bf-6ce1f33c4e49 | zhangty019/S3_DeformFDM | ShapeLab/Fabrication.cpp | #include <Eigen/Eigen>
#include <Eigen/PardisoSupport>
#include "Fabrication.h"
#include "GLKGeometry.h"
void Fabrication::initial(QMeshPatch* tetModel, PolygenMesh* isoLayerSet, QMeshPatch* nozzle) {
m_tetModel = tetModel;
m_isoLayerSet = isoLayerSet;
m_nozzle = nozzle;
m_tetModel->drawOverhangSurface = false;... | TOOL | 0.998125 | 4.002155 |
a0a908d3-2673-40b1-a8a2-a6549cdd69f6 | Kuuro-neko/TP-Donnees-multimedia | Partie image/TP3/filtre_flou2.cpp | /**
* @file filtre_flou2.cpp
* @brief Filtre l'image en niveaux de gris ImageIn.pgm avec un filtre flou et écrit le résultat dans ImageOut.pgm
*
* Flou par moyenne des 8 pixels voisins
*/
#include <stdio.h>
#include "../lib/image_ppm.h"
int main(int argc, char* argv[]) {
char cNomImgLue[250], cNomImgEcrite[... | TOOL | 0.9884 | 4.12639 |
08af891b-1d15-4c59-90e7-71225229edb9 | tw20000807/not_basic_cup | game/solution/bru.cpp | #include "game.h"
#include <algorithm>
#include <cassert>
#include <vector>
#include <iostream>
using namespace std;
vector< vector< int > > dp;
vector< int > s;
int game_start(int x, int y, const std::vector<int> S){
--x, --y;
s = S;
dp = vector< vector< int > > (x + 1,vector< int >(y + 1));
for(int i = 0; i <... | ALGO | 0.99998 | 4.200912 |
5473012d-273c-475d-8f54-9683c97d09c1 | dklee0501/Lobster | homomorphic_evaluation/ntl-11.3.2/src/CheckPCLMUL.cpp | #include <NTL/ctools.h>
#include <cstdlib>
#include <wmmintrin.h>
#include <iostream>
#if (!defined(__GNUC__) || !defined(__x86_64__) || !defined(__AVX__))
#error "PCLMUL not supported"
#endif
#if (NTL_BITS_PER_LONG != 64)
#error "PCLMUL not supported"
#endif
// NOTE: gcc and clang define __PCLMUL__, but icc does n... | ALGO | 0.914517 | 4.084678 |
f585d341-19b8-4b7c-8e0e-fc2591add440 | wadrych/MAST-solver | aids3/main.cpp | #include "TreeBuilder.h"
#include "MASTSolver.h"
RootedTree** create_trees(int amount_of_trees);
int main() {
int amount_of_trees = 0;
std::cin >> amount_of_trees;
RootedTree** forest = create_trees(amount_of_trees);
for(int i = 0; i < amount_of_trees;i++) {
for(int j=i+1; j<amount_of_trees;j++) {
MASTSol... | ALGO | 0.91805 | 4.180764 |
70d8242a-be86-4693-981f-19d6b42f4e54 | ML-UCV/ML-CodeBert-DistinctSolutions | Raw Dataset/ctc/tarjan/train/185c333f-7f2e-4910-aead-d00f09682845.cpp | #include <bits/stdc++.h>
using namespace std;
const int NMAX = 100005;
ifstream fin("ctc.in");
ofstream fout("ctc.out");
int lowlink[NMAX];
int ids[NMAX];
bool inStack[NMAX];
int groupCounter = 1;
int n, m;
vector<int> graf[NMAX];
stack<int> stac;
vector<vector<int>> components;
void ctc(int node)
{
... | ALGO | 0.999945 | 5.185017 |
b2814d38-c731-4bd4-bb83-4622d1542b4d | ManishTirkey/Cpp_files | containers/Array/iterators/begin_end.cpp | #include <iostream>
#include <array>
using namespace std;
void display(array<int, 5> arr)
{
for (auto num = arr.begin(); num != arr.end(); num++)
{
cout << *num << ", ";
}
cout << endl;
}
int main(int argc, char const *argv[])
{
array<int, 5> arr = {1, 2, 3, 4, 5};
cout << "numbers are... | TOOL | 0.93689 | 3.770974 |
665468af-67ca-4384-9b71-8aa392c40352 | TejasAdhikari/2-Data-Structures | Lec 05 - Stacks/18_Nearest_Greater_Element.cpp | // Video Link: https://www.youtube.com/watch?v=sgelJuvX1bU
/* PROBLEM:
Given an array, print the Next Greater Element (NGE) for every element.
The Next greater Element for an element x is the first greater element
on the right side of x in array. Elements for which no greater element
exist, conside... | ALGO | 0.999579 | 5.35089 |
f0855ace-047b-4e71-9ff4-f609be908c06 | Yeonji-Lim/ps-log | FARM/Regular_Member_Test/1.cpp | /* #1 팩토리얼 구하기 */
#include <iostream>
using namespace std;
int factorial(int n){
if(n <= 1 ) return 1;
return n * factorial(n-1);
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int n;
cin >> n;
cout << factorial(n) << endl;
return 0;
} | ALGO | 0.999978 | 5.352359 |
71e32f97-c443-4222-8ecf-518bf858f407 | backengineering/llvm-msvc | libcxx/test/std/containers/associative/multiset/lower_bound.pass.cpp | // <set>
// class multiset
// iterator lower_bound(const key_type& k);
// const_iterator lower_bound(const key_type& k) const;
#include <set>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
#include "private_constructor.h"
int main(int, char**)
{
{
typedef int V;
ty... | TEST | 0.965372 | 4.698154 |
572bd22f-9d06-4050-9f92-4bb7ae200ccb | trietgaming/personal-CP-trainning-memories | USACO/Gold/searching_for_substrings.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
using lll = __int128;
const string FNAME = "";
const int INF = 1e9 + 7;
//const int MAXN =;
struct HashString {
lll MOD = (1LL << 61) - 1;
lll BASE = 1e9+7;
vector<lll> pows, prefix_hashes;
ll n;
HashString(stri... | ALGO | 0.999927 | 4.163039 |
9255ce08-228d-47d5-98cc-fc935f2ce156 | Pseudo-iitian/DailyCodes | 2481_leetcode.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int numberOfCuts(int n) {
if(n==1){
return 0;
}
if(n%2==0){
return (n/2);
}
else{
return n;
}
}
};
int main(){
// 4 -> parta and b is cuts required
So... | ALGO | 0.999918 | 5.111263 |
cd21aa68-bb93-4d2d-914c-1d1d76cb19df | ishandutta2007/codeforces | marcin_smu/normal/1528/A.cpp | #pragma GCC optimize("O3")
#include <bits/stdc++.h>
// #include <ext/pb_ds/assoc_container.hpp>
// using namespace __gnu_pbds;
// gp_hash_table<int, int> mapka;
using namespace std;
#define PB push_back
#define MP make_pair
#define LL long long
#define int LL
#define FOR(i,a,b) for(int i = (a); i <= (b); i++)
#define ... | ALGO | 0.999803 | 4.332974 |
1cd3f562-ce8b-4789-b745-82f5bd0e040a | Neroysq/ACM | Model/km.cpp | #include <stdio.h>
#include <memory.h>
#include <stdlib.h>
const int nmax = 2000, oo = ~0U >> 1;
int w[nmax + 18][nmax + 18], n, ans = 0, slack[nmax + 18];
int lx[nmax + 18], ly[nmax + 18], q[nmax + 18];
bool ss[nmax + 18], tt[nmax + 18];
int x[nmax + 18], y[nmax + 18], pre[nmax + 18];
int bfs(int s)
{
int h = 0... | ALGO | 0.999851 | 3.260433 |
beaeeb25-b51c-45ed-9f51-bb5193cdf5de | connornguyxn/competitive-programming | archive/cpp/lqdoj_c23_durian.cpp | #if DEBUG
#include "lib/include/debug.h"
#define TASK "test"
#else
#include <bits/stdc++.h>
#define TASK "durian"
#endif
using namespace std;
#define ll long long
#define ull unsigned long long
#define pii pair<int, int>
#define pll pair<long long, long long>
#define fi first
#define se second
#define s... | ALGO | 0.99921 | 3.765744 |
4044a2ff-fdfb-454b-b873-450ab333d785 | imtyaz-17/Codeforces | 1/17A.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n(0), k(0);
scanf("%d %d", &n, &k);
bool *prime = new bool[n + 1];
prime[0] = prime[1] = 0;
for (int k = 2; k <= n; k++)
{
prime[k] = 1;
}
for (int k = 2; k <= sqrt(n) + 1; k++)
{
if (!prime[k])
... | ALGO | 0.999992 | 4.310917 |
1608e810-c763-488a-a756-170cab3f8663 | teerthpatel0408/Leetcode | 0154-find-minimum-in-rotated-sorted-array-ii/0154-find-minimum-in-rotated-sorted-array-ii.cpp | class Solution {
public:
int findMin(vector<int>& nums) {
int left=0;
int right=nums.size()-1;
while(left<right){
int mid=(left+right)/2;
if(nums[mid]>nums[right]){
left=mid+1;
}
else if(nums[mid]<nums[left]){
... | ALGO | 0.999984 | 5.897989 |
f0b4906f-0121-4703-be3c-327e378bc70f | TakeyukiHarayama/AtCoder | ABC160/B/main.cpp | #include <iostream>
using namespace std;
int main(int argc, const char *argv[]) {
int x, a, b;
cin >> x;
a = (x / 500);
b = x - a * 500;
cout << a * 1000 + (b / 5) * 5 << endl;
return 0;
}
| ALGO | 0.99797 | 3.905417 |
86d50b39-e6cb-430a-a267-b2c07a76a46f | ugogon/gaussStylization | libigl/include/igl/heat_geodesics.cpp | #include "heat_geodesics.h"
#include "grad.h"
#include "doublearea.h"
#include "cotmatrix.h"
#include "intrinsic_delaunay_cotmatrix.h"
#include "massmatrix.h"
#include "massmatrix_intrinsic.h"
#include "grad_intrinsic.h"
#include "boundary_facets.h"
#include "unique.h"
#include "slice.h"
#include "avg_edge_length.h"
t... | ALGO | 0.999865 | 6.973621 |
0998979f-1b96-4764-a640-5556b057f088 | Soham007-op/user-s_input | 5-HalfPyramid_after_180.cpp | #include<iostream>
using namespace std;
int main(){
int n;
cin>>n;
for(int i=1; i<=n; i++){
for(int j=1; j<=n; j++){
if(j<=n-i){
cout<<" ";
}
else{
cout<<"*";
}
}
cout<<endl;
}
return 0;
}
| ALGO | 0.999908 | 3.765177 |
c2704b1b-0fb9-4da7-9edb-6b6566e348c0 | Dris-ti/CodeForces_Solution | 492A_Vanya_and_Cubes.cpp | #include <iostream>
using namespace std;
int main()
{
int n, sum = 0, cnt = 0, ttl = 0;
cin >> n;
if(n == 1)
{
cout << 1;
return 0;
}
int i = 0;
while(ttl < n)
{
i++;
sum += i;
ttl += sum;
}
if(ttl == n)
{
cout << i;
}
... | ALGO | 0.999773 | 3.973539 |
d8ba5435-5c46-4fe5-824a-6cc925fef5ea | oVeron0615/baekjoon | boj_old/baekjoon_10986.cpp | #include <iostream>
using namespace std;
long long psum[1000000], mod[1000];
int main()
{
ios::sync_with_stdio(false);
cin.tie(NULL);
int N, M; cin >> N >> M;
for (int i{ 1 }; i <= N; i++)
{
int Ai; cin >> Ai;
psum[i] = psum[i - 1] + Ai;
mod[psum[i] % M]++;
}
long long ans{ 0 };
for (int i{ 0 }; i <... | ALGO | 0.999991 | 4.382307 |
885cb0e8-cf18-4b8b-827a-1aea880394d4 | snehah7/Cpp-for-Game-Developers | Module 3/C++GameDevelopmentCookbook_Code/Chapter9/Source/bullet3-2.83.7/src/BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp | #include "btSphereTriangleCollisionAlgorithm.h"
#include "BulletCollision/CollisionDispatch/btCollisionDispatcher.h"
#include "BulletCollision/CollisionShapes/btSphereShape.h"
#include "BulletCollision/CollisionDispatch/btCollisionObject.h"
#include "SphereTriangleDetector.h"
#include "BulletCollision/CollisionDispatch... | ALGO | 0.997011 | 6.826073 |
96742561-c363-48f6-ba4f-d7a330541c68 | zhangchunbao515/leetcode | leetcode-08/LC173.cpp | /**
* Definition for binary tree
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class BSTIterator {
public:
stack<TreeNode*> st;
BSTIterator(TreeNode *root) {
findLeft(root);
}
void findLeft(TreeNode* root) {
wh... | ALGO | 0.999994 | 6.077514 |
4806a726-aac4-4e37-93f5-2eef36da10d9 | tiandaochouqin1/leetcode | 41-50/JumpGame/jumpGame.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution{
public:
int jump(vector<int> &nums)
{
int res=0,n=nums.size(),last=0,cur=0;
for(int i=0;i<n-1;++i)
{
cur=max(cur,i+nums[i]);
if(i==last)
{
... | ALGO | 0.999966 | 5.281416 |
ae7c81cd-4d37-4e37-966b-415f6049bf9b | docRoy-Dipta/HackerRank | absoluteDifference.cpp | /*Insert two value, the program will give
output positive value everytime. like: |3-5|=2*/
#include <bits/stdc++.h>
#include<cmath>
using namespace std;
int main(){
int a, b;
cin >> a >> b;
int x = a - b;
int r = abs(x);
cout << r;
return 0;
}
| ALGO | 0.999862 | 3.703279 |
41c3bc0c-29e6-4056-b2a5-c5ff9e563fac | SoldierDown/vtk | ThirdParty/libproj/vtklibproj/src/param.cpp | /* put parameters in linked list and retrieve */
#include <ctype.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "proj.h"
#include "proj_internal.h"
static void unquote_string(char* param_str) {
size_t len = strlen(param_str);
// Remove leading and terminating spac... | TOOL | 0.982591 | 6.062653 |
782dabfc-03db-4e88-ab8d-debf5b13c8ab | andrefakhoury/competitive-programming | problems/solutions/GEMA/GEMA Tree/1/A.cpp | #include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL_PC
// #define debug(args...) { cout.flush(); fflush(stdout); fprintf(stderr, args); }
#else
#define debug(args...) ; /* */
#endif
#define pb push_back
#define eb emplace_back
#define mk make_pair
#define fi first
#define se second
using ll = long long;
usin... | ALGO | 0.999809 | 4.953149 |
d405f60c-9033-4419-a9d9-3d97f0c0b794 | psycho-pomp/LeetCode | 1658-minimum-operations-to-reduce-x-to-zero/1658-minimum-operations-to-reduce-x-to-zero.cpp | class Solution {
public:
int minOperations(vector<int>& nums, int x) {
int n=nums.size();
int target=accumulate(nums.begin(),nums.end(),0)-x;
if(target<0) return -1;
if(target==0) return n;
int currSum=0,start=0;
int ans=INT_MAX;
for(int i=0;i<n;){
... | ALGO | 0.999971 | 5.830545 |
3991586d-4509-469a-8a2f-fc2a34a8f0fa | Kamrul101/cpp_practice | SlidingWindow/subArrayDistinctValuesCSES.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define MOD 1000000007
#define mem(a,b) memset(a, b, sizeof(a) )
const int mx =2e5+123;
ll a[mx];
int main() {
optimize();
int n... | ALGO | 0.999948 | 4.233001 |
1c7ade72-abf4-492c-bf86-e65883c5931a | senior-kapitoshka/Solutions | cpp/design_a_simple_automaton.cpp | #include <array>
class Automaton
{
private:
std::array<bool,3>q{true,false,false};
public:
Automaton()=default;
bool read_commands(const std::vector<char>& com){
std::for_each(com.begin(),com.end(),[this](auto& c){
if(q[0]==true && c=='1'){
q[0]=false;
q[1]=true;
}else if(q[1]==tr... | ALGO | 0.999595 | 5.837428 |
f5f091c6-4937-46b6-8e0d-12b6642bd931 | acoop867/O | 4610C_tuning-2023-09-25T21-41-44/src/main.cpp | /*----------------------------------------------------------------------------*/
/* */
/* Module: main.cpp */
/* Author: C:\Users\Student ... | ALGO | 0.976737 | 5.175355 |
f48faca3-2881-4f1d-bbce-a65d56f3705a | sarvex/leetcode-assembly | solution/1900-1999/1903.Largest Odd Number in String/Solution.cpp | class Solution {
public:
string largestOddNumber(string num) {
for (int i = num.size() - 1; i >= 0; --i) {
int c = num[i] - '0';
if ((c & 1) == 1) {
return num.substr(0, i + 1);
}
}
return "";
}
}; | ALGO | 0.999938 | 6.17732 |
9e1cfeb5-493c-43e5-b269-1b51089c3673 | nimashoghi/gem5 | src/systemc/tests/systemc/misc/sim_tests/biquad/biquad2/delay_line.cpp | /*****************************************************************************
delay_line.cpp --
Original Author: Martin Janssen, Synopsys, Inc., 2002-02-15
*****************************************************************************/
/*************************************************************************... | ALGO | 0.95321 | 5.936704 |
fd2a8c57-fa4a-4df4-9315-f269d9e71151 | lymph12138/ComputerScience | PAT/Advanced_level/1045_Favorite_Color_Stripe.cpp | /*
Eva is trying to make her own color stripe out of a given one.
She would like to keep only her favorite colors in her favorite order by cutting off those unwanted pieces
and sewing the remaining parts together to form her favorite color stripe.
It is said that a normal human eye can distinguish about less than 200 ... | ALGO | 0.999821 | 3.612533 |
f4f00050-d505-429c-b29c-4bf59b6a6563 | jiantao88/HaronyRN | react_native_openharmony/src/main/cpp/third-party/boost/libs/compute/example/vector_addition.cpp | #include <iostream>
#include <boost/compute/algorithm/copy.hpp>
#include <boost/compute/algorithm/transform.hpp>
#include <boost/compute/container/vector.hpp>
#include <boost/compute/functional/operator.hpp>
namespace compute = boost::compute;
// this example demonstrates how to use Boost.Compute's STL
// implementa... | ALGO | 0.998197 | 5.972317 |
9caa9097-e9c8-4504-87f1-ced182f366c9 | tipa16384/harcourt_applets | LESLET/LESLET/frames2.cpp | int main()
{
// according to a 1967 census, these were the number of people
// who described themselves as short, tall, or just right.
int tall = 12306; // number of tall people
int short = 16092; // number of short people
int average = 5; // number of content people
// total population is the sum of all these... | ALGO | 0.971008 | 4.179261 |
46d13657-ca4c-4adf-96e1-c1fa19795679 | sapjv/SAPJV_Codes | Graph-Theory/Topological Sort for Directed Acyclic Graph ( DAG ).cpp | /*
##### Topological Sort for Directed Acyclic Graph #####
Note : Acyclic means no cycle in the graph
Introduction : A topological sort or topological ordering of a directed graph is a linear
ordering of its vertices such that for every directed edge uv from vertex u to vertex v, u
comes before v in the ordering... | ALGO | 0.999997 | 5.695369 |
3e83c545-07c1-4b53-ba26-70a0906c29bb | sumukhmarathe/RISCV-Spectre-Attack-and-Defense | gem5/src/systemc/tests/systemc/misc/v1.0/dash3/speed.cpp | /*****************************************************************************
speed.cpp -- Definition of the speedometer.
Original Author: Ali Dasdan, Synopsys, Inc.
*****************************************************************************/
/*************************************************************... | ALGO | 0.858884 | 6.06311 |
39888887-2d9b-4485-9470-2027d32d2a1c | walysonEsqueci2023/SENAI-EXERCICIOS | ex 5.cpp | #include <stdio.h>
int main() {
char nome[50];
float preco, novo_preco;
printf("Digite o nome da mercadoria: ");
scanf("%s", nome);
printf("Digite o preço da mercadoria: R$ ");
scanf("%f", &preco);
if (preco < 1000) {
novo_preco = preco * 1.05; // Aumento de 5%
} ... | TOOL | 0.958215 | 5.219572 |
ee30ec9b-69f8-4460-8258-e37d1ccb7150 | raincross7/code-similarity | codes/train_code/problem068/problem068_362.cpp | #include <iostream>
using namespace std;
int main() {
ios::sync_with_stdio(false);
int x=100000, n;
cin >> n;
for(int i=0;i<n;i++){
x *= 1.05;
if(x%1000 == 0) ;
else x = (x/1000)*1000 + 1000;
}
cout << x << endl;
return 0;
} | ALGO | 0.999775 | 3.093498 |
4e24fabe-e21e-4c47-bb1d-ae6f06037ac8 | Ritwiksrivastava0809/C-tutorial | array13.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
cin>>n;
char arr[n+1];
cin>>arr;
bool check = 1;
for(int i=0; i<n; i++)
{
if(arr[i] == arr[n-1-i])
{
check=0;
break;
}
}
if(check==true)
{
cou... | ALGO | 0.999912 | 4.125757 |
bdf52a90-aad6-45e9-ab77-38233c356d7c | renhaofan/Source-Archive | OpenCV/opencv_contrib-3.4.5/modules/aruco/samples/detect_markers.cpp | #include <opencv2/highgui.hpp>
#include <opencv2/aruco.hpp>
#include <iostream>
using namespace std;
using namespace cv;
namespace {
const char* about = "Basic marker detection";
const char* keys =
"{d | | dictionary: DICT_4X4_50=0, DICT_4X4_100=1, DICT_4X4_250=2,"
"DICT_4X4_1000=3, DICT... | TOOL | 0.993319 | 6.902818 |
8e93a437-9ca2-4bad-aafb-273924985d83 | AkashSingh3031/The-Complete-FAANG-Preparation | 1]. DSA + CP/1]. DSA/4]. Striver Series/30 Days of SDE Sheet/C++/01]. Day-1 (Arrays)/Interviewbit/1]. Set Matrix Zeros.cpp | void Solution::setZeroes(vector<vector<int>> &matrix) {
// Do not write main() function.
// Do not read input, instead use the arguments to the function.
// Do not print the output, instead return values as specified
// Still have a doubt. Checkout www.interviewbit.com/pages/sample_codes/ for more detai... | ALGO | 0.99842 | 5.437907 |
72b53ffa-a5a6-497a-b5ae-46645feaf640 | Alikhizar142/Data-Strcutures | Tree.cpp | #include <iostream>
using namespace std;
struct node{
int info;
node* left;
node* right;
node(int info){
this->left = NULL;
this->right = NULL;
this->info = info;
}
};
class TREE{
public:
node* root;
node* newNode;
int height;
int leafHeight;
bool isBalanced;
bool firstNode;
int counter... | ALGO | 0.999589 | 4.485637 |
6065ac8f-7fc5-4070-805c-4200f157849e | rmit-s3624420-TruongGiang-Le/capstone_toolbot | mir_dwb_critics/src/path_progress.cpp | #include <mir_dwb_critics/path_progress.h>
#include <nav_grid/coordinate_conversion.h>
#include <pluginlib/class_list_macros.h>
#include <nav_2d_utils/path_ops.h>
#include <vector>
namespace mir_dwb_critics {
bool PathProgressCritic::prepare(const geometry_msgs::Pose2D &pose, const nav_2d_msgs::Twist2D &vel,
... | ALGO | 0.981402 | 6.002113 |
391b7be4-fdec-494f-9da6-61fb99498453 | lsh0805/BOJ | solved/BOJ1761.cpp | #include <stdio.h>
#include <algorithm>
#include <vector>
#include <utility>
using namespace std;
typedef pair<int, int> P;
const int MAX_D = 17;
int N, M, parent[40001][MAX_D], dist[40001][MAX_D], a, b, c, visited[40001], depth[40001];
vector<P> adj[40001];
void makeTree(int curr, int cnt){
depth[curr] = cnt;
... | ALGO | 0.999986 | 4.554614 |
e3204b61-afff-4e76-9e9e-eb844ecaf1da | ishandutta2007/codeforces | realcomplex/normal/680/B.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,a;
scanf("%i %i",&n,&a);
int arr[n];
for(int j = 0;j<n;j++)scanf("%i",&arr[j]);
a--;
int ans = arr[a];
for(int j = 1;j<=n;j++){
if(a-j>=0&&a+j<n)ans+=(arr[a-j]==1&&arr[a+j]==1)*2;
else{
if(a-j<0&&a+j<n){
ans += arr[a+j];
}
if(a+j>... | ALGO | 0.999974 | 3.865187 |
d79f907d-d80a-45ed-aed3-6312a4d445b6 | salah-mohamed0404/Programming-basics-with-C- | D_CaseOfZerosAndOnes/main.cpp | #include <iostream>
using namespace std;
int main()
{
int a;
cin>>a;
string s;
cin>>s;
int cnt1{0},cnt0{0};
for(int i=0; i<s.size(); i++){
if(s[i]=='1')
cnt1++;
else
cnt0++;
}
cout<<abs(cnt1-cnt0);
return 0;
}
| ALGO | 0.999888 | 3.897633 |
f371f553-0f05-4a63-928b-1ff191e822fa | Kyabc/triC | slides/number-theory/2_fastpow.cpp | long long fastpow(long long x, long long n) {
long long ans = 1;
while (n > 0) {
if (n % 2 == 1) ans *= x;
x *= x;
n /= 2;
}
return ans;
}
#include <iostream>
int main() {
long long n = 2;
long long x = 10;
std::cout << fastpow(n, x) << std::endl;
return 0;
} | ALGO | 0.999926 | 5.38334 |
e3b71e5b-efc0-46ab-8796-f73e913646d9 | 2022-Tux-Algorithm-study/TuxParkAlgorithm | 2022.07.30.SAT/10817.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(void)
{
vector <int> v(3);
cin >> v[0] >> v[1] >> v[2];
sort(v.begin(),v.end());
cout << v[1] << "\n";
return 0;
} | ALGO | 0.999484 | 3.507054 |
cdc69281-1f09-4c6c-ba95-b900547f331f | zhuminjie/OpenSeesPy | SRC/analysis/algorithm/equiSolnAlgo/accelerator/MillerAccelerator.cpp | // $Revision: 1.1 $
// $Date: 2008-12-03 23:44:54 $
// $Source: /usr/local/cvs/OpenSees/SRC/analysis/algorithm/equiSolnAlgo/accelerator/MillerAccelerator.cpp,v $
// Written: MHS
// Created: April 2002
// Description: This file contains the class ... | ALGO | 0.999043 | 5.52481 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.