uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
deb3fb06-c73a-4c5c-a418-92c5513ea7f3 | raincross7/code-similarity | codes/train_code/problem465/problem465_70.cpp | #include<iostream>
#include<vector>
#include<algorithm>
#include <bitset>
using namespace std;
bool ok(vector<int> &v,int g){
bitset<32000> cur;
cur[16000] = 1;
//cout << cur <<endl;
for(int i=0;i<v.size();++i){
cur = ((cur << v[i]) | (cur >> v[i]));
}
// cout << cur <<endl;
// cout << cur[8000+g] <<endl;
retu... | ALGO | 0.999981 | 3.458358 |
c1b034be-0065-411e-a696-4d09947c7250 | tejas1995/SPOJ-solutions | a2oj/2B/CF233.cpp | //http://codeforces.com/problemset/problem/233/B
#include <iostream>
#include <math.h>
using namespace std;
typedef unsigned long long int uLong;
int s(int n)
{
int sum = 0;
while(n > 0)
{
sum += n%10;
n /= 10;
}
return sum;
}
int main()
{
uLong n;
cin >> n;
uLong minTest = (sqrt(n) >= 91) ? sqrt(n)-90 ... | ALGO | 0.999955 | 4.23981 |
0fabb9bc-8fef-4d04-9e83-146066dd6d6d | inhahe/scribbles3 | scraps/source.2.cpp | void plotPixel(SDL_Renderer* renderer, int x1, int y1, int x2, int y2)
{
int dx, dy, decide;
dx = abs(x2 - x1);
dy = abs(y2 - y1);
decide = (dx > dy) ? 0 : 1;
// If slope is less than one
// pk is initial decision making parameter
// Note:x1&y1,x2&y2, dx&dy values are interchanged
// and passed in p... | ALGO | 0.957233 | 4.507908 |
1db81cc7-e92d-4cc3-aa9b-dba7500a5ea3 | WOONBE/C__Algorithm | Tree/Tree.cpp | //
// Created by 김헌우 on 2023/07/26.
//
#include <bits/stdc++.h>
using namespace std;
const int MXN = 510;
vector<int> adj[MXN];
bool vis[MXN], isTree;
int n, m, u, v, tc, trees;
void dfs(int cur, int prev) {
for (int nxt : adj[cur]) {
if (nxt == prev) // next가 부모(prev)일 경우 건너뜀
continue;
... | ALGO | 0.999862 | 6.143979 |
4d8a1e46-456a-4d54-b210-69d9370bc8cb | utsxvrai/litcod | Count number of hops - GFG/count-number-of-hops.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution
{
public:
//Function to count the number of ways in which frog can reach the top.
long long countWays(int n)
{
// your code here
long long mod = 1000000007;
vecto... | ALGO | 0.999991 | 5.804931 |
fc349fd8-71ea-4979-9ecf-aa09a970b852 | raincross7/code-similarity | codes/train_code/problem457/problem457_491.cpp | #include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <complex>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <regex>
#include <set>
#... | ALGO | 0.999938 | 3.527727 |
6cebb8bc-88b3-4913-a816-8cc85dd63bcf | freezer-glp/leetcode-submit | src/Move Zeroes.cpp | /*Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements.
For example, given nums = [0, 1, 0, 3, 12], after calling your function, nums should be [1, 3, 12, 0, 0].
Note:
You must do this in-place without making a copy of the array.
Minimize... | ALGO | 0.999851 | 6.329619 |
9af2ec24-b739-4b8a-b2c5-a2c0e7cbe282 | mamtapanda088/BAAP-OF-DSA-SERIES | Conditional1/profitloss.cpp | #include<iostream>
using namespace std;
int main (){
int cp,sp;
cout<<"Enter cost price:";
cin>>cp;
cout<<"Enter selling price:";
cin>>sp;
if(cp>sp){
cout<<"Its a loss"<<cp-sp;
}
else{
cout<<"Its a profit:"<<sp-cp;
}
return 0;
} | ALGO | 0.985397 | 3.462921 |
addc7139-a6fb-4ff7-bd37-92ba76d18303 | Neight99/SJTU_DataStructure_A | homework8/4189.cpp | #include <iostream>
using namespace std;
const int maxN = 1e5 + 100;
struct Node {
int data;
Node *next;
Node(int d = 0, Node *n = 0) : data(d), next(n) {}
};
Node son[maxN] = {0};
int father[maxN] = {0}, Size[maxN] = {0}, ans[maxN] = {};
bool isNode[maxN] = {0};
int DFS(int, int);
int main() {
i... | ALGO | 0.999985 | 4.801087 |
cdde15c3-c299-481d-a2e1-dc4d65545ee0 | TheHarshal30/CPP-DSA-CP | Codeforces & Leetcode/DreamoonandStairs.cpp | /* Code by Harshal Rudra(harshal_3073)*/
#include<bits/stdc++.h>
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL)
#define rep(i,n) for(int i=0;i<n;i++)
#define ll long long int
#define all(x) (x).begin(), (x).end()
#define pb push_back
#define vll vector<ll>
#define tt ll t; cin>>t; while(t--)
#define timeta... | ALGO | 0.999989 | 3.3449 |
742eb090-2900-4a3e-8516-c3b3c9d36bc3 | sambu-sairaju/Assiut-University-Training-Newcomers | Sheet5_Functions/E.Swap.cpp | #include <bits/stdc++.h>
using namespace std;
void Swap(int *x, int *y)
{
int temp = *x;
*x = *y;
*y = temp;
return;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int x, y;
... | ALGO | 0.999853 | 4.500993 |
71380ab6-7ecf-4764-bf01-aa1861ade7c8 | Achal-Aggarwal/entire-src | c++/clmbstr.cpp | //sg
#include <stdio.h>
typedef unsigned int LL;
LL fibo[1000000], res[1000000];
int bitCount(unsigned int u)
{
unsigned int uCount;
uCount = u
- ((u >> 1) & 033333333333)
- ((u >> 2) & 011111111111);
return
((uCount + (uCount >> 3... | ALGO | 0.999315 | 3.813776 |
2121e6d1-0ff7-4e76-ae86-694f6e0d689f | JaskiratKourA3-29/JaskiratKour-2023a1r029-cpplLab | area1.cpp | /* write a program to print the area of the rectangle by creating a class name 'Area' having two fuctions
first named as 'setDim' takes the lengthy and breadth of rectangle as parameters and the second fuction named as getarea returns
the area of rectangle . length and breadth of the rectangle are entered through ke... | TOOL | 0.858054 | 4.524478 |
a1ae678d-ab0b-4a31-ab47-d611bead329d | junybike/leetcode-daily | 2024_Nov/1652_Defuse_the_Bomb.cpp | // 2024 Nov 18
class Solution {
public:
vector<int> decrypt(vector<int>& code, int k)
{
int n = code.size(); // the size of vector 'code'
vector<int> ans(n, 0); // the vector containing decrypted code.
if (k == 0) return ans; // If k is 0, the decrypted code is all 0
... | ALGO | 0.99997 | 6.061638 |
a422daeb-1fa3-4f57-9d18-211737f10ca8 | mohamed3omar/Problem-Solving | Assiut_contest sheet lev3(arrays)/Matrix.cpp | #include<iostream>
using namespace std;
int main()
{
int n ;
cin>> n;
int arr[n][n];
for (int i = 0; i < n; i++)
{
for (int j = 0; j < n; j++)
{
cin>> arr[i][j];
}
}
int sum1 = 0 ;
int sum2 = 0 ;
for (int i = 0; i < n; i++)
{
... | ALGO | 0.999997 | 3.656823 |
9dd371cf-1b03-42f4-b2a8-d7e47e572b42 | CLDP/ACM-ICPC | World-Finals/2012 - Warsaw/B.cpp | #include <iostream>
#include <vector>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdio>
using namespace std;
const double PI = acos(-1.0);
int n;
long double y[100], x[100];
long double f(long double a) {
long double ans = 0, xx = a;
for (int i = 0; i <= 2 * n; ++i) {
ans += ... | ALGO | 0.999639 | 3.480645 |
79e562e7-44ee-4a87-b37f-c9a50446417a | Natolu24/Hanabi_Game | ai_players.cpp | #include "players.hpp"
// return the cards of current player
std::vector<Card>& getCurrentPlayerCards(GameSystem& gameSys)
{
switch(Player(gameSys.wichPlayerTurn))
{
case Player::P0:
return gameSys.p0;
break;
case Player::P1:
return gameSys.p1;
br... | ALGO | 0.884262 | 4.365418 |
e318b0c7-ed10-49f6-bfa1-768a5382ce73 | Ginakira/Code-Archive | Leetcode/LeetCode374.cpp | // 猜数字大小
// Forward declaration of guess API.
// @param num, your guess
// @return -1 if my number is lower, 1 if my number is higher, otherwise return
// 0
int guess(int num);
// 标准二分法 4ms
class Solution {
public:
int guessNumber(int n) {
int left = 1, right = n, mid;
while (left < right) {
... | ALGO | 0.999982 | 5.793143 |
a3049e29-c916-4909-a664-f204256e0de0 | dkdkdsa/Data_Structure | RNFYRHWK/특별한 배낭.cpp | #include<iostream>
using namespace std;
int arr[101][100001] = {};
int w[101] = {}, v[101] = {};
int main() {
int k, n;
cin >> n >> k;
for (int i = 0; i < n; i++) {
cin >> w[i + 1] >> v[i + 1];
}
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= k; j++) {
if (j - w[i] >= 0)
arr[i][j] = max(a... | ALGO | 0.999985 | 3.608564 |
93fde716-5883-45d1-af9f-961c1295ae16 | DenisTDR/ListeSimpluInlantuite | ListeSimpluInlantuite/List.cpp | #include <stdio.h>
#include <stdlib.h>
#include <functional>
#include "List.h"
void addNodeToListAtEnd(ListNode *first,ListNode *toAdd) {
auto getLastElementOfList = [&](ListNode *node) {
return node->next == NULL;
};
ListNode *lastElement = listNodeRespects(first, getLastElementOfList);
lastElement->next = toA... | TOOL | 0.998962 | 4.685239 |
91e4fb52-f135-4a0a-bc3f-8fdf7f2ffae1 | Meetpatil03/Certificate_IDCard_Generator | certificate_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.998498 | 6.76073 |
2e3e8848-165c-43b7-b962-b9039b7b8eea | zetrfvg/Algorithm | 杂题/力扣/2460. 对数组执行操作.cpp | class Solution {
public:
vector<int> applyOperations(vector<int>& nums) {
int n=nums.size();
for(int i=0,j=0;i<n;i++){
if(i<n-1&&nums[i]==nums[i+1]) nums[i]*=2,nums[i+1]=0;
if(nums[i]) swap(nums[i],nums[j++]);
}
return nums;
}
};
| ALGO | 0.999993 | 5.330188 |
62ec8458-4618-4105-b19e-79a09ce76194 | runtimehub-com/algorithms-cpp-runtime | version.20240212.2dadbf73f/main/cpp/backtracking/nqueen_print_all_solutions.cpp | /**
* @file
* @brief [Eight Queens](https://en.wikipedia.org/wiki/Eight_queens_puzzle)
* puzzle, printing all solutions
*
* @author [Himani Negi](https://github.com/Himani2000)
* @author [David Leal](https://github.com/Panquesito7)
*
*/
#include <array> /// for std::array
#include <iostream> /// for IO ope... | ALGO | 0.999666 | 5.856637 |
b5d6510b-8d49-4c05-afc8-233b150a12e4 | ehnryx/acm | codeforces/1312/g.cpp | //#pragma GCC optimize("O3")
//#pragma GCC target("sse4,avx2,abm,fma")
#include <bits/stdc++.h>
using namespace std;
#define _USE_MATH_DEFINES
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template <typename T>
using ordered_set = tree<T, null_type, less<T>, ... | ALGO | 0.999972 | 4.547138 |
fea14d9f-9e2f-493b-83b7-6c4151a45df7 | aswaunni/Cpp-Progamming-Questions | Code Forces/CIRCLEGAME.cpp | /*
Aujasvit and the Circle Game Problem Code: CIRCLEGAME
Aujasvit just came up with a new game to play with his friends. N people stand in a circle, each assigned an index from 1 to N in clockwise order. Then the following operation is done N−1 times.
The person with the lowest index holds a coin.
Then, the coin then... | ALGO | 0.999979 | 4.558652 |
2bbf4483-41d6-4a1a-9191-2d4ab95a8023 | VishalJx/100-Days-of-Code | Day 62/LongestCommonPrefix.cpp | #include <bits/stdc++.h>
using namespace std;
/*Approach using loops*/
// string longestCommonPrefix(vector<string>&arr, int n){
// string ans = "";
// //traverse all characters of the first string
// for(int i=0; i<arr[0].length(); i++){
// char curr = arr[0][i];
// bool match = true;
//... | ALGO | 0.999865 | 4.796951 |
b985220a-b247-4dde-9e71-9253fd672f4f | pexa/core | src/algo/sponge.cpp | /**
* A simple implementation of Blake2b's internal permutation
* in the form of a sponge.
*
* Author: The Lyra PHC team (http://www.lyra-kdf.net/) -- 2014.
*
* This software is hereby placed in the public domain.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, I... | ALGO | 0.999644 | 5.036673 |
f7ba333d-d1cf-4669-8f05-b155a6a1ab0c | Algorithm-Study-SSAFY/Algorithm_CPP | jang/20240213/지역구나누기.cpp | //지역구 나누기
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int N, total, answer;
int arr[9][9];
int person[9];
bool team[9];
bool done[9];
void DFScheck(int a) {
done[a] = true;
for (int i = 1; i <= N; i++) {
if (arr[a][i] == 1 && !team[i] && !done[i]) {
DFScheck(i);
}
}
}
bo... | ALGO | 0.999953 | 4.381659 |
39de3c6d-b161-470e-8644-cec7eac5fd42 | Johniel/contests | atcoder/abc063/A/main.cpp | // atcoder/abc063/A/main.cpp
// author: @___Johniel
// github: https://github.com/johniel/
#include <bits/stdc++.h>
#define each(i, c) for (auto& i : c)
#define unless(cond) if (!(cond))
using namespace std;
typedef long long int lli;
typedef unsigned long long ull;
typedef complex<double> point;
template<typename... | ALGO | 0.99581 | 3.931855 |
118c01f8-51ea-43ed-869d-a949d284b869 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_10072_0.cpp | #include <bits/stdc++.h>
using namespace std;
const long long MAX = 1 << 18, N = 1e6 + 10, MOD = 998244353;
long long n;
long long silnia[N];
long long odsilnia[N];
long long pot3[N], pot1[N];
long long qpow(long long a, long long b) {
if (b == 0)
return 1;
else if (b % 2 == 1)
return (a * qpow(a, b - 1)) %... | ALGO | 0.999988 | 4.18608 |
6129e70f-4306-41f1-a80b-4adb18d5e7ce | nucleargezi/acm-icpc | problemset/ZR 2024 Summer B (Categorical)/day1/数位 DP [-5 -6 -7]/04_AT_arc_086_f.cpp | #include "MeIoN_Lib/MeIoN_all.hpp"
#include "MeIoN_Lib/math/mod/modint.hpp"
void before() {}
// #define tests
using mint = modint<mod17>;
NAME MeIoN_is_UMP45() {
LL(n, k);
VEC(ll, a, n);
sort(a);
map<vector<ll>, ll> dp;
dp[a] = 0;
map<vector<ll>, map<ll, ll>> c;
meion f = [](const ve... | ALGO | 0.999956 | 4.444471 |
cea733ad-c235-48c7-adec-af8d01fc8775 | WangYbd02/homework | data structure/Huffman Tree.cpp | //Huffman_Tree 1.0
//默认节点权值为非负整数
#include <iostream>
using namespace std;
typedef int Type; //节点权值类型
class Node //节点
{
public:
Type weight;
Node* left;
Node* right;
};
class MinHeap; //小顶堆的声明(友元类)
class Stack; //栈的声明
class Huffman_Tree
{
friend class MinHeap;
private:
Node* root;
public:
Huffman_Tree... | ALGO | 0.999986 | 3.851998 |
ac82b986-7c22-4775-ae35-fee4f6c632cd | Mortadelo24/leet-code-solutions | 80/cpp-solution.cpp | class Solution {
public:
int removeDuplicates(vector<int>& nums) {
if(nums.size() < 2)return nums.size();
int last = 1;
for(int i = 2; i < nums.size(); i++){
if(nums[last-1]!=nums[i]) nums[++last]=nums[i];
}
return last + 1;
}
}; | ALGO | 0.999905 | 6.198917 |
90a481ac-344a-4204-8a11-7891d775870f | Atul-Jawa/leetcode_codes | 1029.cpp | //2 city scheduling
//greedy problem
bool compare(vector<int>& a,vector<int>& b)
{
return a[0]-a[1]<b[0]-b[1];
}
class Solution {
public:
int twoCitySchedCost(vector<vector<int>>& costs) {
sort(costs.begin(),costs.end(),compare);
int sum=0;
for(int i=0;i<costs.size()/2;i++)
{
... | ALGO | 0.999985 | 5.822986 |
0c5489ca-449b-420c-a476-af041fde5ada | raghava-03/csir-11-nitt | week 3/week 3/odd numbers.cpp | //odd numbers from 1 to 100
#include<stdio.h>
int main()
{ int i=1;
for(i=1;i<100;i=i+2)
{ printf("%d\t",i);
}
return 0;
}
| ALGO | 0.972172 | 3.063589 |
7bf5a273-7d26-41cb-96a3-dfd8badfe52b | mattiasgustavsson/steem-crt | 3rdparty/ArchiveAccess/CPP/7zip/Compress/ZlibDecoder.cpp | // ZlibDecoder.cpp
#include "StdAfx.h"
#include "../Common/StreamUtils.h"
#include "ZlibDecoder.h"
namespace NCompress {
namespace NZlib {
#define DEFLATE_TRY_BEGIN try {
#define DEFLATE_TRY_END } catch(...) { return S_FALSE; }
#define ADLER_MOD 65521
#define ADLER_LOOP_MAX 5550
UInt32 Adler32_Update(UInt32 adle... | TOOL | 0.853427 | 6.931832 |
b1add193-afb1-48f2-8dc6-2a0e5bce45f9 | QianQNanami/JSOI-WC25 | TG/judger/source/WC25-483/kangaroo.cpp | #include <iostream>
#include <algorithm>
using namespace std;
#define int long long
const int N = 5e4;
int num[N + 5];
int n, ans;
signed main()
{
freopen("kangaroo.in", "r", stdin);
freopen("kangaroo.out", "w", stdout);
scanf("%lld", &n);
for (int i = 1; i <= n; i++)
scanf("%lld", &num[i]);
sort(num + 1... | ALGO | 0.999933 | 3.827597 |
c9ba9188-8303-4549-84d9-02a76eae5862 | mortany/xray-17 | 3rd party/nvidia-texture-tools/src/nvmath/Fitting.cpp | // This code is in the public domain -- Ignacio Castaño <<EMAIL>>
#include "Fitting.h"
#include "Vector.inl"
#include "Plane.inl"
#include "nvcore/Array.inl"
#include "nvcore/Utils.h" // max, swap
#include <float.h> // FLT_MAX
//#include <vector>
#include <string.h>
using namespace nv;
// @@ Move to EigenSolver.h
... | ALGO | 0.99978 | 6.055668 |
74b36240-0b3e-44dd-922b-047459b040f1 | arnavjain2710/DSA-LAB-WORK | LAB 4/l4_p2.cpp | #include <iostream>
using namespace std;
const int TABLE_SIZE = 10;
int hashTable[TABLE_SIZE];
void initializeHashTable()
{
for (int i = 0; i < TABLE_SIZE; ++i)
{
hashTable[i] = -1;
}
}
int hashFunction(int key)
{
return key % TABLE_SIZE;
}
void insert(int value)
{
int index = hashFunct... | ALGO | 0.999782 | 5.783748 |
5fa133bc-5950-4349-8abe-fee9ff8e6ad4 | IlyaBisec/HoAE_Evolution_Engine | 3dlib/ode/ode/src/dCylinder.cpp | #include <ode/ode.h>
#include "ode/dCylinder.h"
// given a pointer `p' to a dContactGeom, return the dContactGeom at
// p + skip bytes.
#pragma warning ( disable : 4244 )
struct dxCylinder { // cylinder
dReal radius,lz; // radius, length along y axis //
};
int dCylinderClassUser = -1;
#define NUMC_MASK (0xffff)
... | ALGO | 0.98078 | 3.799738 |
736d9d0e-a33d-4ec0-a27f-9b49b338f96e | eggag32/Competitive-Programming | Codeforces/Distinct Digits.cpp | #pragma GCC optimize ("O3")
#pragma GCC target ("sse4")
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef pair<int, int> pi;
#define debug(x) cerr << #x << ": " << x << endl;
#define debug2(x, y) debug(x) debug(y);
#define repn(i, a, b) for(int i... | ALGO | 0.999773 | 3.772349 |
9fc62fe7-e650-4c1a-ab2e-473caca2c126 | littlebugyang/CPP_practice | leetcode/solution/518. Coin Change 2.cpp | #include <vector>
using namespace std;
class Solution
{
public:
int change(int amount, vector<int> &coins)
{
int count = 0;
vector<vector<int>> dp(coins.size() + 1, vector<int>(amount + 1, 0));
for (int i = 0; i <= coins.size(); ++i)
dp[i][0] = 1;
for (int i = 1; ... | ALGO | 0.999948 | 5.618897 |
663c6084-616a-4546-8c97-264910120f78 | LuizMiguelSR/Estudos-Fatec_PG | 2SEM/Estrutura de Dados/Aula09/Ex02.cpp | #include <iostream>
using namespace std;
void quicksort(int valores[], int inicio, int fim){
int i, j, pivo, aux;
i = inicio;
j = fim-1;
pivo = valores[(inicio + fim) / 2];
while(i <= j){
while(valores[i] < pivo && i < fim){
i++;
}
while(valores[j] > pivo && j > inicio){
j--;
}
if(i <= j){
aux ... | ALGO | 0.999818 | 5.23211 |
795db915-6b28-4502-aa56-2c7884b0bb7e | ZhangYu-zjut/PAT_Code | PAT/PAT_Basic Level/1056/main.cpp | #include <iostream>
#include <stdio.h>
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
int num[10];
int number[100];
int main(int argc, char** argv) {
int n;
scanf("%d",&n);
int i,j;
for(i=0;i<n;i++)
{
scanf("%d",&num[i]);
}
int k=0;
for(i=0;i<n;i++)
{
f... | ALGO | 0.999601 | 3.41961 |
bda0e051-689c-4e15-a81c-4acab9b1e146 | Tchy258/t2-gpu | src/cpu_parallel_example.cpp | #include "game_of_life_parallel.hpp"
#include<iostream>
#include<thread>
#include<chrono>
int main(int argc, char** argv) {
std::cout << "Test del juego de la vida con implementación paralela en CPU\n";
GameOfLifeParallel game = GameOfLifeParallel();
game.initializeRandom();
int iterations = atoi(argv[... | ALGO | 0.996606 | 4.555937 |
45ee0a42-9323-40dc-83ca-d9982e3fcbca | ishandutta2007/codeforces | 0wuming0/normal/1569/A.cpp | #include"bits/stdc++.h"
using namespace std;
char s[1005];
int a[1005];
int main()
{
int t;
cin>>t;
while(t--)
{
int n;
scanf("%d",&n);
scanf("%s",s+1);
map<int,int>mp;
mp[0]=1;
for(int i=1;i<=n;i++)
{
if(s[i]=='a')
{
... | ALGO | 0.999593 | 3.159225 |
e3d42948-29e9-4b38-81b5-a2ab451125ff | Nalime/cp-library | math/crt.cpp | // References:
// AtCoder Library
// https://codeforces.com/blog/entry/61290
// consider changing ll to i128
pair<ll, ll> crt(const vector<ll> &r, const vector<ll> &m) {
ll r0 = 0, m0 = 1;
for (int i = 0; i < int(r.size()); i++) {
ll m1 = m[i], r1 = r[i] % m1;
if (r1 < 0) r1 += m1;
aut... | ALGO | 0.999876 | 5.444725 |
a5887af6-a959-4e8c-863b-ee7fd7ee986d | nguyenthinga-0206/do-hoa-don-gian | Eclipse_Bresenham.cpp | //#include <math.h>
#include <winbgim.h>
void plot(int xc, int yc, int x, int y)
{
putpixel(xc+x,yc+y,15);
putpixel(xc-x,yc+y,15);
putpixel(xc-x,yc-y,15);
putpixel(xc+x,yc-y,15);
delay(10);
}
void Eclipse(int xc, int yc, int a, int b)
{
float p,a2,b2;
int x,y;
a2 = a*a;
b2 = b*b;
//Ve nhanh thu nhat tu... | ALGO | 0.996685 | 3.131026 |
03ac1343-8e84-41b4-b2e7-74a18fe756ec | Mohito-p/DSA | Backtracking/N_Queens.cpp | class Solution {
public:
vector<vector<string>> solutions;
vector<vector<char>> grid;
bool canPlace(int row, int col, int n) {
// Check column
for (int i = row - 1; i >= 0; i--) {
if (grid[i][col] == 'Q') return false;
}
... | ALGO | 0.999683 | 6.095581 |
e2d3beb8-e9b1-461e-9704-786e2115d6b4 | Tarequl-islam/Programming-competition | Exp/practice/Untitled11.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
int a, b, c;
cin>>a>>b;
if(a%b==0){
cout<<0<<endl;
}
else{
c=a/b;
cout<<(b*(c+1))-a<<endl;
}
}
return 0;
}
| ALGO | 0.999809 | 3.487121 |
018a1d6f-1124-4f0f-9ab5-68ff421e4f32 | SeungGwan123/Programmers | 프로그래머스/3/67258. [카카오 인턴] 보석 쇼핑/[카카오 인턴] 보석 쇼핑.cpp | #include <string>
#include <vector>
#include <bits/stdc++.h>
using namespace std;
vector<int> solution(vector<string> gems) {
vector<int> answer;
vector<string> gem = gems;
sort(gem.begin(),gem.end());
gem.erase(unique(gem.begin(),gem.end()),gem.end());
int num = gem.size();
int small = 100001;... | ALGO | 0.999693 | 5.17029 |
36b9bd2b-fe93-4fb9-a6a7-5fe72b4538ee | StrawHatWess/Competitive-Programming-Solutions | Dmoj/PROBLEMSET/TLE '17 Contest 8 P3 - Curious Numbers.cpp | #pragma GCC optimize("O3")
#include <bits/stdc++.h>
using namespace std;
#define boost ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0)
typedef string str;
typedef long long ll;
#define int ll
typedef double db;
typedef long double ld;
typedef pair<int,int> pi;
#define fi first
#define se second
typedef vec... | ALGO | 0.999507 | 4.306248 |
dd329b30-89f0-4948-856a-996462942918 | mrzzzrm/Deliberation | Source/Deliberation/Core/Math/Morton.cpp | #include <Deliberation/Core/Math/Morton.h>
#include <bitset>
#include <sstream>
#include <Deliberation/Core/StreamUtils.h>
namespace deliberation
{
std::string Morton2D::toString() const
{
std::stringstream stream;
stream << "(" << std::to_string(m_key) << " / "
<< std::bitset<32>(m_key).to_string... | TOOL | 0.850678 | 6.850517 |
6c56b596-7580-4d0b-9bfc-31a362a71f7a | FlashSnail/NetEase | NetEaseOnlineTest/NetEaseOnlineTest/NetEaseOnlineTest.cpp | // NetEaseOnlineTest.cpp : ̨Ӧóڵ㡣
//
#include "stdafx.h"
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
long long n = 0, k = 0;
cin >> n >> k;
vector<int> link;
int element;
int first;
for (int i = 0; i < n; i++)
{
cin >> element;
link.pus... | ALGO | 0.999954 | 3.624809 |
74c6a360-c109-4f21-88ed-d4cb55487276 | roufujjaman/Algorithm | 01_Divide & Conquer/01_Merge Two Sorted Arrays.cpp | #include<bits/stdc++.h>
using namespace std;
void mergeArrays(int arr1[], int arr2[], int n1, int n2, int arr[]) // O(n + m)
{
int j = 0, k = 0;
int size = n1 + n2;
for (int i = 0; i < size; i++)
{
if(arr1[j] < arr2[k]) arr[i] = arr1[j++];
else arr[i] = arr2[k++];
}
}
int main()
{
... | ALGO | 0.999989 | 3.788971 |
620fcf5b-dd23-4887-a050-47e015079882 | UpCoder/Leetcode | SubarraySumEqualsK.cpp | //
// Created by Liang on 2019-07-09.
//
#include <vector>
#include <iostream>
#include <unordered_map>
using namespace std;
class Solution {
public:
int subarraySum(vector<int>& nums, int k) {
int size = nums.size();
if(size == 0)
return 0;
int count = 0;
unordered_map<i... | ALGO | 0.999709 | 5.600476 |
37d6d6f2-53be-4861-a896-eb2ebc627dc4 | techbire/LeetcodeSolutions | 0622-design-circular-queue/0622-design-circular-queue.cpp | class MyCircularQueue {
public:
int f; //front
int b; //back
int s; //curr size
int c; //capacity;
vector<int>arr;
MyCircularQueue(int k) {
f=0;b=0;s=0;c=k;
vector<int>v(k);
arr=v;
}
bool enQueue(int val) { //push
if(s==c)r... | ALGO | 0.999091 | 5.628597 |
7e00ca6e-d36c-43fc-b2f6-df00405b6f67 | joelrandria/maths_tp2_final | FourierTransform/FourierTransform.cpp | #include "FourierTransform.h"
#include <stdexcept>
#include <stdio.h>
void FourierTransform::transform(const ComplexVector& signalValues, ComplexVector& spectralValues)
{
int valueCount;
int rangeStart;
int rangeEnd;
Complex sum;
if (signalValues.size() != spectralValues.size())
throw st... | ALGO | 0.927473 | 5.217415 |
2415d828-3b32-47fd-88c3-fd3f77f74df9 | xgervilla/IDI | Examen/Model/model.cpp | #define __MODEL__DEF__ 1
#include "model.h"
#include <fstream>
#include <sstream>
#include <iostream>
#include <cmath>
#include <cassert>
using namespace std;
// === Local stuff:
static int material = 1;
static void loadMTL(std::string filename);
static int findMat(string material);
static void omplenormals(vector<Face... | TOOL | 0.85482 | 5.094295 |
b56ef077-6561-48e3-97d0-a3d002d24af9 | MiquelVillarroya/Programming-II_Project-I | Programming II/2.Classes/2(4) - ClassFriendship/main.cpp | #include <iostream>
using namespace std;
class Rectangle {
private:
int x, y;
public:
Rectangle() : x(0), y(0) {}
Rectangle(int x, int y) {
this->x = x;
this->y = y;
}
friend void Transpose(Rectangle* rect);
void GetRect() {
cout << x << " " << y << endl;
}
friend Rectangle operator+=( Rectangle& rect, ... | ALGO | 0.971728 | 4.336187 |
c0bd1de3-3b82-4c89-868f-201880bad755 | DevashishPathrabe/Hackerrank | HackerRank Solutions/10 Days of Statistics/Day 6 The Central Limit Theorem I/Day 6 The Central Limit Theorem I.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
double normal_cdf(double x, double mu, double sigma){
double z = (x - mu)/(sigma*sqrt(2));
return (1 + erf(z))/2;
}
int main() {
/* Enter your code here. Read input from ... | ALGO | 0.999818 | 3.906056 |
02d28d57-bf72-4dfd-a76e-2a5b56fdb87a | OpenXRay/xray-soc-history | xr_3da/xrCDB/Opcode12/OPC_AABBCollider.cpp | ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////... | ALGO | 0.991473 | 7.629152 |
ce27b284-7178-4748-b1e4-4bb73faa1b00 | HotDogEnemy/cpp-labfile-programs | q28.cpp | #include <iostream>
using namespace std;
class First;
class Second;
class First {
int num;
public:
First () {
cout << "Enter value for num (class: First): ";
cin >> num;
}
void show_larger(Second& obj2);
};
class Second {
int num;
public:
Seco... | ALGO | 0.972317 | 3.637397 |
c85ed6bb-552b-4ce2-bf21-5a23e6b835e1 | cadets/freebsd | contrib/llvm-project/llvm/lib/IR/InlineAsm.cpp | #include "llvm/IR/InlineAsm.h"
#include "ConstantsContext.h"
#include "LLVMContextImpl.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/LLVMContext.h"
#include "llvm/IR/Value.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Errc.h"
#inc... | TOOL | 0.850853 | 6.906229 |
70874cbf-2865-4e73-9d5b-d7e79f41ded1 | netduino/netmf | DeviceCode/pal/OpenSSL/OpenSSL_1_0_0/crypto/bf/bfspeed.cpp | /* crypto/bf/bfspeed.c */
/* 11-Sep-92 Andrew Daviel Support for Silicon Graphics IRIX added */
/* 06-Apr-92 Luke Brennan Support for VMS and add extra signal calls */
#if !defined(OPENSSL_SYS_MSDOS) && (!defined(OPENSSL_SYS_VMS) || defined(__DECC)) && !defined(OPENSSL_SYS_MACOSX)
#define TIMES
#endif
#include ... | ALGO | 0.955796 | 5.924971 |
436a0017-a72c-4ba8-aca2-9c3590226ad5 | gyurim/codingtest | temp.cpp | #include <iostream>
#include <vector>
using namespace std;
struct Node {
int x, y, cost;
Node(int x, int y, int cost) : x(x), y(y), cost(cost) {}
bool operator < (const Node& other) const {
return cost < other.cost;
}
};
int main() {
vector<Node> v;
v.push_back(Node(1, 1, 5));
v.p... | ALGO | 0.998583 | 4.415109 |
78fda419-4317-4e4f-ac96-dcb14ad73494 | sukantadutta123/C-codes-with-DSA | GcdOfArray.cpp | #include <iostream>
#include <vector>
using namespace std;
// Function to calculate the Greatest Common Divisor (GCD)
int gcd(int a, int b) {
while (b != 0) {
int temp = b;
b = a % b;
a = temp;
}
return a;
}
// Function to calculate the Least Common Multiple (LCM)
int lcm(int a, int... | ALGO | 0.99994 | 6.972919 |
63acd9c6-1499-43c0-8ba7-8a954fead17e | Harsh-Agrawal-425/Primality_testing | Samples_Testing_For_MR_and_AKS/Parallel_Samples_Testing/parallel_primality.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <random>
#include <chrono>
#include <gmp.h>
#include <NTL/ZZ.h>
#include <sstream>
#include <string>
#include <cmath>
#include <stdio.h>
#include <time.h>
#include <mpi.h>
#include <math.h>
#include <NTL/ZZ.h>
#include <NTL/RR.h>
#include <NTL/ZZ_pE.h>
... | ALGO | 0.997963 | 4.828116 |
d4928190-9ef2-4838-b994-76f2fc96864d | Mrjingfu/DefendSheepViliage | test123/libs/Box2D/Dynamics/Joints/b2WeldJoint.cpp | #include <Box2D/Dynamics/Joints/b2WeldJoint.h>
#include <Box2D/Dynamics/b2Body.h>
#include <Box2D/Dynamics/b2TimeStep.h>
// Point-to-point constraint
// C = p2 - p1
// Cdot = v2 - v1
// = v2 + cross(w2, r2) - v1 - cross(w1, r1)
// J = [-I -r1_skew I r2_skew ]
// Identity used:
// w k % (rx i + ry j) = w * (-ry i ... | ALGO | 0.981485 | 6.753515 |
4975a279-ee65-4ed9-86e1-bf2be31743a7 | bhavyagoel/LeetCode | 7. March'22/199-binary-tree-right-side-view/199-binary-tree-right-side-view.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.99993 | 6.234446 |
0509765c-ec94-40a8-846b-b4afb5e88c62 | yn521/LAMMPS_ASPHERE_YN | lib/atc/WeakEquationElectronMomentum.cpp | #include "WeakEquationElectronMomentum.h"
#include "Material.h"
#include "LammpsInterface.h"
namespace ATC {
//==============================================================
// Class WeakEquationElectronMomentum
//==============================================================
//-------------------------------------... | ALGO | 0.96676 | 5.436375 |
487cbb5f-39d3-46cd-a4f7-b1bb4cae6790 | MMwaveOctomap/OctomapROS | pcl-master/surface/src/on_nurbs/fitting_curve_2d_asdm.cpp | #include <pcl/surface/on_nurbs/fitting_curve_2d_asdm.h>
#include <stdexcept>
using namespace pcl;
using namespace on_nurbs;
FittingCurve2dASDM::FittingCurve2dASDM (int order, NurbsDataCurve2d *data) :
FittingCurve2dAPDM (order, data)
{
}
FittingCurve2dASDM::FittingCurve2dASDM (NurbsDataCurve2d *data, const ON_Nurb... | ALGO | 0.999892 | 5.979467 |
24fce3f4-09c3-438a-bca5-2625ed7310da | JeffLegendPower/cp-codes | codeforces/Adventurers div1 C/C_Adventurers.cpp | // https://codeforces.com/contest/2046/problem/C
#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;
#define ll long long
#define plli pair<ll, int>
#define pll pair<ll, ll>
#define pii pair<int, int>
// Usage: FOR(i,... | ALGO | 0.999963 | 5.02196 |
6374a657-03d3-412a-91a9-03943eda64a7 | Probatio-Diabolica/problems | Fundamental_Algos/Sliding window/Q3.cpp | #include<iostream>
#include<vector>
void minimumNumber(std::vector<int> &vec, int block)
{
int min,current=vec[0],window=block-1;
for(size_t i =1;i<block;i++)
{
current-=vec[i];
}
min=current;
for(size_t i=1;i<vec.size()-block+1;i++)
{
current-=vec[block+1]+vec[i-1];
}
... | ALGO | 0.999882 | 5.067481 |
d31012f9-6aa8-43c0-b288-12333025b1c2 | NitinVadadoriyaa/CodeForces | 19-3-d.cpp | #include <iostream>
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define mod 1e9 + 7
//ctrl + space to run exsiting file.
int main() {
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#else
#endif
int t;
cin >> t;
while (... | ALGO | 0.999162 | 4.200538 |
c48fcd6d-9e8a-4026-a5d6-b48353cd10fe | Xu-Jack11/ACM-Learning | CodeForces/Round 989 Div.1.2/2034B.cpp | #include <bits/stdc++.h>
using namespace std;
void solve()
{
int n, m, k;
cin >> n >> m >> k;
string s;
cin >> s;
int p = 0;
int tmp = 0;
int cnt = 0;
int ans=0;
while (p < s.size())
{
if (tmp)
{
tmp--;
p++;
continue;
}... | ALGO | 0.999859 | 4.393902 |
57069e8a-a045-47cf-b8b5-e6d602d37421 | shishirRsiam/CSE-Fundamentals-With-Phitron | 3. Data Stracture/Module 7.5/practice_1_two_head.cpp | #include<bits/stdc++.h>
using namespace std;
class Node
{
public:
int vall;
Node* next;
Node(int vall)
{
this->vall=vall;
this->next=NULL;
}
};
void insert_tail(Node* &head,Node* &tail,int vall)
{
Node* newnode = new Node(vall);
if(head==NULL)
{
head = newnod... | ALGO | 0.999314 | 3.725128 |
a499328f-120a-4d77-b132-51155a9ca98b | syedfahadshah-f7/OS | Labs/Lab 2/Post Lab/task4.cpp | #include<iostream>
#include<vector>
#include<cstdlib>
using namespace std;
int main(int argc, char* argv[]) {
int sum = 0, avg = 0;
for(int i = 1; i < argc; i++) {
sum += atoi(argv[i]);
}
if (argc > 1) {
avg = sum / (argc - 1);
}
cout << "Sum of Array: " << sum << endl;... | TOOL | 0.95741 | 4.335408 |
817ad946-51a3-4509-8565-67864da5be78 | Sudhakar17/udacity_cpp | Lesson-9/01_overloading.cpp | #include<iostream>
// C++ allows us to 'overload' the same function name as long as
// the variable types in the function inputs are different
int findSmaller(int input1, int input2);
float findSmaller(float input1, float input2);
char findSmaller(char input1, char input2);
int main()
{
int a = 5;
int b = 4;... | ALGO | 0.996506 | 4.580828 |
a3c2e733-69a8-40f9-b329-db092fd3b688 | ishandutta2007/codeforces | igorfardoc/normal/1436/C.cpp | #include<bits/stdc++.h>
using namespace std;
int mod = 1000000007;
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n, x, pos;
cin >> n >> x >> pos;
vector<int> fact(10000);
fact[0] = 1;
for(int i = 1; i < 10000; i++)
{
fact[i] = ((long long)fact[i - 1... | ALGO | 0.999994 | 4.002851 |
58700aad-0035-4d56-b4d6-8176096d38ee | Kenshin2438/CP-Code-Collection | tutorial/2023CSUST校赛/I.cpp | #include <bits/stdc++.h>
using namespace std;
template <uint32_t mod> struct m32 {
static_assert(mod < (1U << 31), "Modulus error!");
using u32 = uint32_t;
using u64 = uint64_t;
using i64 = int64_t;
u32 v = 0;
template <typename T> u32 norm(T v) {
return static_cast<u32>((v %= mod) < 0 ? mod + v : v)... | ALGO | 0.999955 | 4.557884 |
aae1fcb7-2433-4d25-b407-164f10d3004a | AyushPandey1502/LeetCode-Questions | 1715-split-a-string-into-the-max-number-of-unique-substrings/1715-split-a-string-into-the-max-number-of-unique-substrings.cpp | class Solution {
public:
int maxUniqueSplit(string s) {
unordered_set<string> set;
return backtrack(s, 0, set);
}
int backtrack(string s, int start, unordered_set<string>& set) {
if (start == s.size()) {
return 0;
}
int maxSplits = 0;
string curr... | ALGO | 0.999989 | 6.19164 |
6b1afec6-c81b-4e9e-af33-2ad0ae4f9710 | Ivls16/Labs2Sem | LabWork8/Task2/heap.cpp | #include "heap.h"
heapA::heapA(int n) {
arr = new int[n];
}
heapA::~heapA() {
delete[] arr;
}
void heapA::push_to_arr(int value) {
arr[n++] = value;
}
void heapA::pop_arr() {
n--;
}
void heapA::add(int value) {
push_to_arr(value);
shift_up(n - 1);
}
int heapA::pop() {
if (!n) {
... | ALGO | 0.99934 | 4.711051 |
6f5c6585-e7cc-4930-bbc0-deaa01567d9e | Akash-Raj-ST/Competitive-Programming | Top 150 interview(leetcode)/Array_String/45.cpp | class Solution {
public:
int jump(vector<int>& nums) {
int l=0,r=0;
int count = 0;
if(nums.size()==1) return 0;
while(l<nums.size() && r<nums.size()){
int high = r;
for(int j=l;j<=r;j++){
if(j+nums[j]>high){
high = j+nums... | ALGO | 0.999995 | 5.84111 |
d09f1f29-981a-45ee-8473-9a76631b0b8b | Rizwankhan0001/Leetcode | 0082-remove-duplicates-from-sorted-list-ii/0082-remove-duplicates-from-sorted-list-ii.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* deleteDupli... | ALGO | 0.999962 | 5.658265 |
c8a07f8f-27e8-494b-b2cb-b7291ada0e15 | gwroblew/detectXSSlib | tools/xssscan/xssscan.cpp | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <map>
#include "detectxsslib.h"
std::string g_url;
std::string g_file;
bool g_filemode = false;
bool g_replacehost = false;
bool g_deduplicate = false;
bool g_showrule = false;
bool g_showtokens = false;
bool g_listxss = true;
typed... | TOOL | 0.951756 | 3.840839 |
b609f181-d0a0-41f5-9dd7-cfa099b6d48c | shubpl7/CrackingTheCode | LastFight/MSOA/oa1.cpp | //Min Deletions To Obtain String in Right Format
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define PB push_back
typedef vector<int> VI;
typedef vector<VI> VVI;
bool solution(vector<string> &B) {
int N = B.size();
int M = B[0].length();
vector<vector<char>> grid(N, vector<char>(M));
... | ALGO | 0.994426 | 3.637715 |
b7b0eaed-0f51-49bf-8a72-2b257144e5e9 | ashishkr45/100-days-of-code | Week 1/2.5 Deci-Octal.cpp | #include <iostream>
using namespace std;
int converttoOCTAL(int n);
int main()
{
int n;
cout << "Enter a number: ";
cin >> n;
cout << "Conversion to Decimal is: " << endl;
cout << converttoOCTAL(n);
return 0;
}
int converttoOCTAL(int n)
{
int x = 1;
int ans = 0;
while (x <= n)... | ALGO | 0.986533 | 4.892289 |
9555ecef-89d6-4fe7-aab5-9cdb763439d1 | D3coy/Cpp | if_f.cpp | #include <iostream>
using namespace std;
int main()
{
int a, b;
cout << "Введите первое число: ";
cin >> a;
cout << "Введите второе число: ";
cin >> b;
if(a < b)
{
cout << "Первое число меньше второго.";
}
else if (a == b)
{
cout << "Первое число равно второму.";
}
else if (a > b)
{
cout << "П... | ALGO | 0.997834 | 3.247461 |
88a53e5e-1afa-4ba9-a5b1-a4c2ce830d50 | ankit2306/code | balloonBurst.cpp | #include<bits/stdc++.h>
using namespace std;
void shootBalloon(int score,int i,bool shot[],int arr[],int numShot,int n,int *maxScore,int order[],int storeOrder[])
{
// cout<<"Function evoked"<<endl;
shot[i]=true;
order[numShot-1]=arr[i];
// cout<<(int)shot[i];
// cout<<" "<<order[numShot-1]<<endl;
... | ALGO | 0.999996 | 3.890743 |
8c26d18a-2e8c-4ad8-a771-5955bc66d779 | ishandutta2007/codeforces | ftiasch/normal/121/B.cpp | #include <cstdio>
#include <cstring>
using namespace std;
const int N = 111111;
int n, k;
char s[N];
int main () {
scanf("%d%d%s", &n, &k, s);
int ind = 0;
while (k && ind + 1 < n) {
while (ind + 1 < n
&& (s[ind] != '4' || s[ind + 1] != '7')) {
ind ++;
}
... | ALGO | 0.999852 | 4.010039 |
6d2c0a93-a6ba-4863-bcde-f5ab05039aeb | Sakshamchawla19/DSA | 23_LinkedLists/ChallengesLinkedLists/10LinkedList_ReverseRecursive_Data.cpp | //Linked List - Reverse a Linked List (Recursive, Data)
#include <iostream>
using namespace std;
class node{
public:
int data;
node* next;
//constructor
node(int d){
data = d;
next = NULL;
}
};
void insertAtTail(node*&head, int data){
if(head == NULL){
head = new nod... | ALGO | 0.999995 | 5.49191 |
fcde67d5-dba4-44a7-8850-5224929db696 | Mohit-106/DSA_Level_2 | HashmapHeap/44_InsertDeleteGetRandomDuploicate.cpp | // class RandomizedCollection
// {
// public:
// unordered_map<int, set<int>> mp;
// vector<int> v;
// RandomizedCollection()
// {
// }
// bool insert(int val)
// {
// v.push_back(val);
// int idx = v.size() - 1;
// mp[val].insert(idx);
// return mp[val].si... | TOOL | 0.935286 | 4.560558 |
e702f496-2600-427a-9164-d903108d1723 | zeroplusone/AlgorithmPractice | Leetcode/973. K Closest Points to Origin-2.cpp | class Solution {
public:
vector<vector<int>> kClosest(vector<vector<int>>& points, int k) {
pair<double, vector<int>> p;
auto cmp = [](pair<double, vector<int>> p1, pair<double, vector<int>> p2) {
return p1.first<p2.first;
};
priority_queue<pair<double, vector<in... | ALGO | 0.999999 | 6.161086 |
d9e86abd-7b3a-4688-98c2-cf354d0629f9 | javagovindsharma/leetscode | solution/2100-2199/2147.Number of Ways to Divide a Long Corridor/Solution2.cpp | class Solution {
public:
int numberOfWays(string corridor) {
const int mod = 1e9 + 7;
long long ans = 1;
int cnt = 0, last = 0;
for (int i = 0; i < corridor.length(); ++i) {
if (corridor[i] == 'S') {
if (++cnt > 2 && cnt % 2) {
ans = an... | ALGO | 0.99991 | 5.876536 |
567b43b4-4d86-4538-96bd-e2617e9ce783 | cvbwerjkl/YandexAlTrain | 2023/15b.cpp | /*
Лайнландия представляет из себя одномерный мир, являющийся прямой, на котором располагаются N городов, последовательно пронумерованных от 0 до N - 1 . Направление в сторону от первого города к нулевому названо западным, а в обратную — восточным.
Когда в Лайнландии неожиданно начался кризис, все были жители мира ст... | ALGO | 0.999994 | 3.610331 |
c1ca8381-713f-47c0-85a1-046d7e202c4a | Harsh-D-2004/LB | Practice/program33.cpp | #include<iostream>
using namespace std;
class Pattern
{
private:
int iRow;
int iCol;
public:
Pattern(int X , int Y)
{
iRow = X;
iCol = Y;
}
void Display()
{
int i = 0;
int j = 0;
for(i = 1... | ALGO | 0.998831 | 4.223238 |
b438fe33-8163-4c6f-a976-e29da8e670c2 | sojournerd/HackerRankSolutions | DataStructures/LinkedList/DoublyLinkedInsert.cpp | /*
Insert Node in a doubly sorted linked list
After each insertion, the list should be sorted
Node is defined as
struct Node
{
int data;
Node *next;
Node *prev;
}
*/
Node* SortedInsert(Node *head,int data)
{
// Complete this function
// Do not write the main method.
... | ALGO | 0.999986 | 5.034418 |
91b0b6b4-52aa-4fd9-b26a-95a331a8736d | juliovelc/CP | codeforces/team-olympiad.cpp | #include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> math, prog, pe;
int student;
for (int i = 0; i < n; i++) {
cin >> student;
switch (student) {
case 1:
prog.push_back(i + 1);
break;
case 2:
math.push_back(i + 1);
bre... | ALGO | 0.99939 | 3.643529 |
f2819773-fed4-4c7a-925c-cd3f9561a7eb | Lincito-31/Preseleccion | CSES/Problem Set/Graph Algorithms/Course Schedule.cpp | #include <bits/stdc++.h>
#define ALL(x) x.begin(),x.end()
#define REV(x) x.rbegin(),x.rend()
using namespace std;
typedef long long ll;
int n,m,a,b,deg[100000];
vector<int> graph[100000],ord;
queue<int> now;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
cin >> n >> m;
while(m--){
... | ALGO | 0.999995 | 4.45519 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.