uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
a668a617-9682-4b88-b1f9-0a382e45b8aa | Ankerrrr/dataStruct | 10_28/one/main.cpp | #include "./poly.hpp"
#include <iostream>
#include <string>
using namespace std;
int main() {
poly a, b;
// string inpA, inpB;
cout << "input poly A" << endl;
a.input();
cout << "\ninput poly B" << endl;
b.input();
cout << "\nthis is A:" << endl;
a.print();
cout << "\nthis is B:" << endl;
b.print... | ALGO | 0.941116 | 4.01755 |
7aa69bb1-5f9c-419d-9749-99c83f90f752 | rifkiam/mk-strukdat | semester 3/strukdat/seslab2/soal2/soal2.cpp | #include <iostream>
using namespace std;
typedef struct Node
{
int id;
int urgency;
struct Node *next;
} pasien;
typedef struct queue
{
pasien *_top;
unsigned _size;
} antrian_prioritas;
void pqueue_init(antrian_prioritas *pqueue)
{
pqueue->_top = NULL;
pqueue->_size = 0;
}
bool pqueue_i... | ALGO | 0.997774 | 3.86591 |
df4d034a-cf8c-4020-adf6-de04fef7b9f2 | ishandutta2007/codeforces | ivan100sic/normal/1354/D.cpp | // Retired?
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long unsigned long ull;
typedef double long ld;
const int maxn = 1 << 20;
int b[2*maxn];
void add(int x, int v) {
x += maxn;
while (x > 0) {
b[x] += v;
x >>= 1;
}
}
int ordstat(int x, int k) {
if (x >= maxn)
return x -... | ALGO | 0.999911 | 4.327136 |
bab17f80-c868-41b8-a69c-3dff61d4d76f | HKalsule/Cpp_ConceptualUnderstading | or_operator.cpp | #include <iostream>
using namespace std;
int main()
{
int Int1;
int count=0;
cout << "Enter The Number :" << endl;
cin >> Int1;
while (Int1|=0)
{
if (Int1&1)
{
count ++;
}
Int1>>=1;
}
cout << (Int1) << endl;
return 0;
}
| ALGO | 0.999187 | 4.064207 |
ec6daf27-7e3f-4585-90f5-42a3802bb6d1 | carlabferreira/ProjetoJoguinhosTerminal | 2048/2048.cpp | /*
Jogo 2048
Início em 20/08/2021
*/
// string a;
// int *a = new int[30];
// delete a;
// cin >> a;
// cout << nome;
/*USADO PARA ALEATORIO:
srand(time(NULL));
while(i <= rand() % tamanho) {
fgets(linha, sizeof(linha), arquivo);
i++;
*/
#include <iostream>
#include <time.h>
#include <... | ALGO | 0.98203 | 4.160207 |
3372c704-c744-4f24-82c0-6b2f1e63776b | Minkaspr/Dev-CPP | Ejercicios/03_Sentencia-if-3.cpp | /*
Realice un programa que lea un valor entero y determine
si se trata de un numero par o impar
*/
#include <iostream>
using namespace std;
int main(){
int num;
cout<<"Digite un numero (positivo): " && cin>>num;
if(num == 0){
cout<<"El numero es cero"<<endl;
} else if (num%2 == 0){
cout<<"El numero es par"<<end... | ALGO | 0.977131 | 3.690487 |
f2751413-0311-492b-85d0-1950a50c3213 | jjpprrrr/frameworks_av | media/codecs/amrnb/enc/src/levinson.cpp | /*
------------------------------------------------------------------------------
Pathname: ./audio/gsm-amr/c/src/levinson.c
Funtions: Levinson_init
Levinson_reset
Levinson_exit
Levinson
------------------------------------------------------------------------------
MODULE DESCRIPTI... | ALGO | 0.998772 | 6.290952 |
110406ef-c6b8-414c-bfea-7462b6a84980 | Um-ded/problem-solving | Codeforces Codes/120.Prob276A(Lunch Rush).cpp | #include <bits/stdc++.h>
#define ss " "
#define endl "\n"
#define pb push_back
#define pi acos(-1.0)
#define ars greater<int>()
#define vi vector<int>
#define vvi vector<vector<int> >
#define flush cin.ignore(numeric_limits<streamsize>::max(),'\n... | ALGO | 0.999917 | 3.772273 |
0bb95dba-6bc1-4c0a-8f16-71f8d6d35360 | Huchangzhi/oi-wiki | graph/graph-matching/code/general-match/general-match_2.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 505, p = (int)1e9 + 7;
int qpow(int a, int b) {
int ans = 1;
while (b) {
if (b & 1) ans = (long long)ans * a % p;
a = (long long)a * a % p;
b >>= 1;
}
return ans;
}
int A[maxn][maxn], B[maxn][maxn], t[maxn][maxn], id[maxn];
// 高斯消元 O... | ALGO | 0.999995 | 4.198274 |
b354aee3-e32a-466d-9a26-709efa68a539 | MayankKunal/LeetCodeproblems | 1435-xor-queries-of-a-subarray/xor-queries-of-a-subarray.cpp | class Solution {
public:
vector<int> xorQueries(vector<int>& arr, vector<vector<int>>& queries) {
int n=arr.size();
vector<int>xorPrefix(n);
int ans=0;
for(int i=0;i<n;i++)
{
ans^=arr[i];
xorPrefix[i]=ans;
}
vector<int>re... | ALGO | 0.999982 | 5.841824 |
75ceae44-1a0e-4409-a1f3-96d539334784 | AmitPrasad212003/C-C-code_Program | lecture6.cpp | #include<iostream>
#include<math.h>
using namespace std;
int main()
{
int n;
cout<<"Enter the n : ";
cin>>n;
// decimal to Binary
// int ans=0;
// int i=0;
// while(n!=0)
// {
// int bit =n&1;
// ans=(bit *pow(10,i))+ans;
// n=n>>1;
// i++;
// }
// cout<<"Answer is : "<<ans<<endl;
int ans=0;
int i=0;
while... | ALGO | 0.999126 | 4.129809 |
2649123c-8f80-4fa6-856d-bdb2da5526b9 | melonattacker/atcoder | contests/ABC/ABC139/b.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int main() {
int A, B;
cin >> A >> B;
int i = 0;
int amount = 1;
while(true) {
if(amount >= B) break;
i++;
amount += A - 1;
}
cout << i << endl;
return 0;
} | ALGO | 0.999899 | 3.551387 |
1c650b4f-3444-45fc-8b63-c6ac351192bf | waiwai444/oj | uva/10576 - Y2K Accounting Bug/10576.cpp | #include <stdio.h>
int main()
{
int s, d, m;
while(scanf("%d%d", &s, &d) != EOF)
{
if(4*s < d)
m = 10*s-2*d;
else if(3*s < 2*d)
m = 8*s-4*d;
else if(2*s < 3*d)
m = 6*s-6*d;
else if(s < 4*d)
m = 3*s-9*d;
else
m = -12*d;
if(m >= 0)
printf("%d\n", m);
else
printf("Deficit\n");
}
re... | ALGO | 0.999581 | 3.395484 |
48854e9d-6ac9-4cfe-8b70-3ae9e72a278c | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_9441_5.cpp | #include <bits/stdc++.h>
using namespace std;
int MOD = 1e9 + 7;
const long double E = 1e-9;
unsigned char ccc;
bool _minus = false;
template <typename T>
inline T sqr(T t) {
return (t * t);
}
inline void read(long long &n) {
n = 0;
_minus = false;
while (true) {
ccc = getchar();
if (ccc == ' ' || ccc =... | ALGO | 0.99999 | 4.12743 |
eeaabdc3-6df0-4a16-89e3-c823b7f5c960 | Fatnaoui/CP-Recursion | problems/16-ClassAssignment.cpp | #include <iostream>
using namespace std;
void find_digits(int i,int n,int &ans,int pre){
if(i > n){
ans++;
return ;
}
if(pre == 0){
find_digits(i+1,n,ans,1);
}
find_digits(i+1,n,ans,0);
return ;
}
int main() {
int t; cin>>t;
int k = 1;
while(t--){
in... | ALGO | 0.998328 | 4.172878 |
c0567e8a-04a2-4712-9b23-1875016b8e78 | TIES-Lab/QCEC | extern/qfr/extern/zx/extern/boost/multiprecision/example/scoped_precision_example.cpp | #include <iostream>
#include <boost/math/special_functions/relative_difference.hpp>
#include <boost/math/special_functions/next.hpp>
#include <boost/multiprecision/mpfr.hpp>
#include <boost/multiprecision/debug_adaptor.hpp>
//[scoped_precision_1
/*`
All our precision changing examples are based around `mpfr_float`.
H... | ALGO | 0.999062 | 6.89005 |
de810e83-df42-4828-9dcb-7ee4e6c011b5 | alicyber99/OOPS | Lab 02/Q4.cpp | #include <iostream>
using namespace std;
void swapStrings(string &a, string &b) {
string temp = a;
a = b;
b = temp;
}
void bubbleSort(string arr[], int n) {
for (int i = 0; i < n - 1; i++) {
for (int j = 0; j < n - i - 1; j++) {
if (arr[j] > arr[j + 1]) {
swapString... | ALGO | 0.999797 | 5.77283 |
2ed1eb95-f8a4-4c4c-8591-1d028b31e000 | davidchai21/leetcode-solutions | 451 Sort Characters By Frequency/SortCharactersByFrequency.cpp | class Solution {
public:
string frequencySort(string s) {
unordered_map<char, int> m;
string res="";
for (char a:s) m[a]++;
vector<string> r(s.size()+1,"");
for (auto i:m)
{
r[i.second].append(i.second,i.first);
}
for (int i=s.size();i>=0;i... | ALGO | 0.99997 | 5.985856 |
dd6a5b5b-4528-4777-8906-5912a9f8eca7 | SifenTesfa/Prime_Number_Finder | eratosthenes_tbb.cpp | //
// Created by Selin Yıldırım on 20.07.2021.
//
#include "tbb/tbb.h"
#include <iostream>
#include <stdlib.h> /* atoi */
#include <cstring>
#include <numeric>
#include <chrono>
#include <ctime>
#include <cmath>
using namespace tbb;
using namespace std;
class ApplySieve {
int *const arr;
const int k;
publ... | ALGO | 0.999216 | 5.445841 |
e6735cee-7c6a-4b47-a4f2-27c72a840e18 | vbonnici/grafe-sim | analysis/data/p02260/s866793297.cpp | #include<iostream>
using namespace std;
void show(int* A, int N);
int selectionSort(int* A, int N) {
int Count = 0;
for (int i = 0; i < N; ++i) {
int minj = i;
for (int j = i; j < N ; ++j) {
if (A[j] < A[minj]) {
minj = j;
}
}
if (minj != i) {
int C = A[i];
A[i] = A[minj];
A[minj] = C;
... | ALGO | 0.999765 | 4.178741 |
fb5918cd-c7ab-4965-96d4-1edce753f18a | johngarrett/llvm-research | libcxx/test/std/containers/sequences/vector/vector.modifiers/emplace_extra.pass.cpp | // UNSUPPORTED: c++98, c++03
// <vector>
// template <class... Args> iterator emplace(const_iterator pos, Args&&... args);
#include <vector>
#include <cassert>
#include "test_macros.h"
#include "min_allocator.h"
#include "asan_testing.h"
int main(int, char**)
{
{
std::vector<int> v;
v.reserve(3... | TEST | 0.970179 | 5.811338 |
64c09b1d-c999-48eb-9354-ae54cea94c34 | muskan588p/Data-Structures-and-Algorithms | 0443-string-compression/0443-string-compression.cpp | class Solution {
public:
int compress(vector<char>& chars) {
int n=chars.size();
int idx=0;
for(int i=0;i<n;i++){
char ch=chars[i];
int count=0;
while(i<n && chars[i] == ch){
count++;
i++;
}
if(count... | ALGO | 0.999988 | 6.471561 |
0aec5ab9-51f5-4c19-8865-2340e3af77de | namangarg2002/leetcode | 966-binary-subarrays-with-sum/binary-subarrays-with-sum.cpp | class Solution {
public:
int numSubarraysWithSum(vector<int>& nums, int goal) {
int s = 0;
int e = 0;
int sum = 0;
int prefixZero = 0;
int count = 0;
while(e<nums.size()){
sum = sum + nums[e];
// minimize
while(s < e && (sum > goa... | ALGO | 0.999975 | 6.140146 |
6927f989-9faa-49f0-855e-47ae5f93a05d | raincross7/code-similarity | codes/train_code/problem409/problem409_304.cpp | #include <algorithm>
#include <vector>
#include <string>
#include <iostream>
#include <sstream>
#include <map>
int main(void)
{
while (true) {
int n;
std::cin >> n;
if (n == 0) break;
std::map<char, char> table;
for (int i = 0; i < n; i++) {
char c1, c2;
std::cin >> c1 >> c2;
t... | ALGO | 0.999764 | 4.371289 |
a1353cfa-143f-4490-bf90-7e5258cb5f37 | kdmkjm/coding_test | realize/4_1.cpp | /*
여행 계획서가 주어졌을 떄 여행가 A가 최종적으로 도착할 지점의 좌표를 출력하는 프로그램을 작성하시오.
- 입력 조건
첫째 줄에 공간의 크기를 나타내는 N이 주어진다.(1<=N<=100)
둘째 줄에 여행가 A가 이동할 계획서 내용이 주어진다.(1<=이동 횟수<=100)
- 출력 조건
첫째 줄에 여행가 A가 최종적으로 도착할 지점의 좌표(X,Y)를 공백으로 구분하여 출력한다.
입력예시
5
R R R U D D
출력예시
3 4
*/
#include <iostream>
#include <string>
using namespace std;
// 변수 선언
in... | ALGO | 0.999564 | 4.84557 |
7bee0316-7014-4cac-a125-2b825a72957e | surpise/Problem-Solving | 프로그래머스/unrated/181850. 정수 부분/정수 부분.cpp | #include <string>
#include <vector>
using namespace std;
int solution(double flo) {
int answer = (int)flo;
return answer;
} | ALGO | 0.990025 | 3.538126 |
b32a5eb2-050d-4782-8773-30f7834b4f3c | ishandutta2007/codeforces | intothenight/normal/1677/D.cpp | #include <bits/stdc++.h>
using namespace std;
#if __cplusplus > 201703L
#include <ranges>
using namespace numbers;
#endif
template<typename T>
struct modular_base{
using Type = typename decay<decltype(T::value)>::type;
template<class U>
static vector<modular_base<T>> precalc_power(U base, size_t SZ){
vector<modul... | ALGO | 0.999859 | 3.769977 |
a5976076-e247-4674-8b50-c932401dbc47 | UjalaSingh/DSA | tree/pre_iterative.cpp | #include <iostream>
#include <stack>
#include<queue>
using namespace std;
class node
{
public:
int data;
node *left;
node *right;
node(int data)
{
this->data = data;
this->left = NULL;
right = NULL;
}
};
node *build()
{
int data;
cin >> data;
node *root = new ... | ALGO | 0.999864 | 3.898113 |
e1f6a44a-6f9a-4b37-aeaf-be09dd733cee | jmcsuite/SolvingPercebe | Material/BusquedaCompleta/11565_iter_prunning/A.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main () {
ios::sync_with_stdio(0);
cin.tie(0);
ll T; cin >> T;
while(T--) {
ll A,B,C; cin >> A >> B >> C;
bool ans = false;
for (int i = -100; i <= 100; i++) {
for (int j = i+1; j <= 100; j++) {
... | ALGO | 0.999954 | 4.681443 |
2efbb25d-8718-492b-9650-693b2ca2506b | sarvex/leetcode-elvish | solution/1700-1799/1701.Average Waiting Time/Solution.cpp | class Solution {
public:
double averageWaitingTime(vector<vector<int>>& customers) {
double tot = 0;
int t = 0;
for (auto& e : customers) {
int a = e[0], b = e[1];
t = max(t, a) + b;
tot += t - a;
}
return tot / customers.size();
}
}; | ALGO | 0.999896 | 6.038772 |
7d5dc6cb-8103-42ff-93fb-c25e9e376884 | CatalinFrancu/nerdvana | graphs/strongly-connected-components/scc-naive.cpp | // Strongly connected components in O(V * E).
// Run a DFS from every node and build a reachability matrix.
#include <stdio.h>
#define MAX_NODES 1'000
bool adj[MAX_NODES][MAX_NODES]; // adjacency matrix
bool r[MAX_NODES][MAX_NODES]; // reachability matrix
bool marked[MAX_NODES];
int nodes;
// Runs a DFS from root.... | ALGO | 0.999957 | 5.71541 |
4cbee7bf-58b8-423a-8dd1-c1f0cb867d86 | sormo/algorithm | dynamic/knapsack.cpp | #include "dynamic.h"
#include <vector>
#include <string>
#include <fstream>
#include <cassert>
#include <sstream>
#include <iostream>
#include <algorithm>
#include <iomanip>
// knapsack problem
// compute maximal sum of values of knapelems, which's sum of weights are lesser than W
// compute subset of array of knapele... | ALGO | 0.999731 | 4.794927 |
eb77e47b-2b76-4e86-bb11-7c9063455e37 | raincross7/code-similarity | codes/train_code/problem319/problem319_131.cpp | #include "bits/stdc++.h"
#include "math.h"
using namespace std;
typedef long long ll;
typedef vector<ll> vll;
typedef vector<vll> vvll;
typedef vector<bool> vb;
typedef vector<vb> vvb;
typedef vector<int> vin;
typedef pair<ll,ll> P;
typedef vector<P> vp;
#define rep(i,a,b) for(ll i=(a);i<(b);++i)
#define drep(i,a,b) ... | ALGO | 0.999466 | 3.25031 |
8527d890-5b44-4d2e-bcf2-638c9826796e | jh-ji/PS | 특정문자제거하기.cpp | #include <string>
#include <vector>
using namespace std;
string solution(string my_string, string letter) {
string answer = "";
int k = 0;
for (int i = 0;i < my_string.length();i++) {
if (my_string[i] == letter[0]) {
continue;
}
answer += my_string[i];
}
return ... | ALGO | 0.99935 | 4.430369 |
a29b608e-420f-41cd-bcba-e71e5784a1ea | Vencinthiaa/Tugas_Networking | 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.998859 | 6.785645 |
7d03aaf2-a5b0-452a-bb75-f461e0559edd | minSsan/algorithm | baekjoon/동적계획법/1915.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main() {
int n, m;
cin >> n >> m;
char grid[n][m];
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
cin >> grid[i][j];
}
}
int dp[n][m]; // i, j 지점까지의 최대 정사각형 한 변 길이
fill(dp[0], dp[0]... | ALGO | 0.999759 | 4.786003 |
9fbeb616-c47a-4dda-ad3b-8a1240b6f9f9 | KrishnaPuri-git/CPP-DSA | binary tree/sumOfkthOrderelems.cpp | // #include<bits/stdc++.h>
// using namespace std;
// struct Node{
// int data;
// struct Node* left;
// struct Node* right;
// Node(int val){
// data =val;
// left = NULL;
// right = NULL;
// }
// };
// int sumAtKlvl(Node* root, int k){
// if(root == NULL){
// ... | ALGO | 0.999754 | 4.484894 |
b327fd81-6e96-4782-a9cf-7dcc5edf7e35 | abrhamkg/point2mesh | Manifold/3rd/igl/count.cpp | template <typename XType, typename SType>
IGL_INLINE void igl::count(
const Eigen::SparseMatrix<XType>& X,
const int dim,
Eigen::SparseVector<SType>& S)
{
// dim must be 2 or 1
assert(dim == 1 || dim == 2);
// Get size of input
int m = X.rows();
int n = X.cols();
// resize output
if(dim==1)
{
... | ALGO | 0.981814 | 5.298262 |
ed70fa50-a330-4ed3-8cf9-b8026728a5af | TanYongF/algorithm | Leetcode/力扣日常/482.cpp | #include <iostream>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <string>
#include <cstring>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <climits>
#include <vector>
#include <iostream>
#include <bitset>... | ALGO | 0.999579 | 4.419025 |
a7b1069d-fd5f-45c0-a7a6-3c95dcc2719e | studentOss/dsl | DSA1withRepl.cpp | #include <iostream>
#include <cstring>
using namespace std;
class HashFunction {
typedef struct hash {
long key;
char name[100];
} hash;
hash h[100];
public:
HashFunction();
void insert();
void display();
long find(long);
void Delete(long);
};
HashFunction::HashFunctio... | ALGO | 0.998778 | 5.297715 |
d7c00323-4139-4fb5-8fd0-bb9d02c54df1 | manikanta2901/ubuntu | .history/codingChallenges/cpp/Codechef/longChallenges/Year2021/January/BlackJack_20210108193124.cpp | #include<bits/stdc++.h>
#include<vector>
#include<iostream>
#include<cmath>
#include<algorithm>
#include<iterator>
#include<string>
#include<map>
#define vv vector
#define F first
#define S second
#define MP make_pair
#define EXECUTE_FASTER ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define printM... | ALGO | 0.999979 | 3.644675 |
b10f528a-e32e-4c8a-b655-801d6c8b7cc5 | doubley318/LeetCode | Cpp/145.二叉树的后序遍历.cpp | /*
* @lc app=leetcode.cn id=145 lang=cpp
*
* [145] 二叉树的后序遍历
*/
// @lc code=start
/**
* 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),... | ALGO | 0.999846 | 6.358509 |
a93e46d6-d509-447d-9493-e4f6fcb331d3 | JianZJ-75/demo1 | Code/2023第二次考核/1011.cpp | #include <bits/stdc++.h>
#define ll long long
#define dd double
#define endl '\n'
#define rep(i, a, b) for (ll i = a; i <= b; i++)
#define rrep(i, a, b) for (ll i = a; i >= b; i--)
const int M = 1e9 + 7;
using namespace std;
struct P
{
ll a;
ll b;
ll ok = 0;
ll sum;
ll index;
};
bool cmp1(P a, P ... | ALGO | 0.999969 | 3.097773 |
3277cb03-d127-40ac-8e92-30a29bb9f4d0 | AkshayRamakrishnann/oneAPI_With_SYCL | DirectProgramming/C++SYCL/Jupyter/oneapi-essentials-training/09_SYCL_Buffers_And_Accessors_Indepth/src/host_accessor_init.cpp | #include <sycl/sycl.hpp>
#include <algorithm>
#include <iostream>
using namespace sycl;
int main() {
constexpr size_t N = 1024;
// Set up queue on any available device
queue q;
// Create buffers of size N
buffer<int> in_buf{N}, out_buf{N};
// Use host accessors to initialize the data
{ // CRITICAL: B... | ALGO | 0.879448 | 4.270949 |
23a337df-50ee-46ff-949e-abe6cbe47727 | ankishb/Algorithm-DS-Problems | implement_power_function.cpp | int Solution::pow(int x, int n, int d) {
if(x == 0) return 0;
if(n == 0) return 1%d;
bool neg = (x < 0 && n%2 == 1) ? true : false;
x = abs(x);
long long int ans = 1, xs = x;
while(n != 0){
if(n%2 == 1){
ans = (ans*x)%d;
n--;
}
else{
... | ALGO | 0.999826 | 6.097072 |
06bea2ba-3246-47d3-8989-c36b718f8f59 | ishandutta2007/codeforces | aqt/normal/768/F.cpp |
// Problem : F. Barrels and boxes
// Contest : Divide by Zero 2017 and Codeforces Round #399 (Div. 1 + Div. 2, combined)
// URL : https://codeforces.com/contest/768/problem/F
// Memory Limit : 256 MB
// Time Limit : 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)
#include <bits/stdc++.h>
using... | ALGO | 0.999886 | 4.296288 |
7c2f6191-acb2-4cfd-ad39-cf65ffb50a43 | ishandutta2007/codeforces | yukimaru/normal/851/A.cpp | /*************************************************************************
> File Name: 851_A.cpp
> Author: yuki
> ###################
> Mail: ###################
> Created Time: Wed 06 Sep 2017 06:39:54 PM CST
************************************************************************/
#include<ios... | ALGO | 0.999932 | 3.265758 |
fff067e2-30fb-46cf-a146-11efb7cdd76c | x1314aq/dsa | luogu/1396.cpp | //
// 1396 营救
//
#include <bits/stdc++.h>
using namespace std;
struct edge {
int to, w, next;
} g[40005];
int head[10005];
int cnt;
static inline void add(int u, int v, int w) {
cnt++;
g[cnt].to = v;
g[cnt].w = w;
g[cnt].next = head[u];
head[u] = cnt;
}
int n, m, s, t;
int dist[10005];
stat... | ALGO | 0.999959 | 4.687948 |
3f8e2132-e413-499b-b824-3577be110557 | rogJohn01/Leetcode_Practice | 867-transpose-matrix/867-transpose-matrix.cpp | class Solution {
public:
vector<vector<int>> transpose(vector<vector<int>>& mat) {
int M = mat.size() , N = mat[0].size();
vector<vector<int>> ans(N, vector<int>(M,0));
for (int j =0; j < N; j++)
for (int i =0 ; i < M; i++)
ans[j][i] = mat[i][j];
return ... | ALGO | 0.999976 | 6.342707 |
5383ff99-70e3-438b-8678-efa8aa3aaaa7 | replatutum/ITU-Algo-Projects-24 | HW1-code/src/main.cpp | #include "tweet.h"
#include <chrono>
int main(){
std::string inputFilePath = "./data/sizes/tweets50k.csv";
// std::string outputFilePath = "./data/new.csv";
std::vector<Tweet> tweets;
tweets = readTweetsFromFile(inputFilePath);
mergeSort(tweets, 0, tweets.size()-1, "tweetID");
long long key = 1773335;
... | ALGO | 0.990777 | 5.768268 |
ba24b057-b974-4ac0-9e77-02cba83a15de | njustzsm/leetCode | 160. Intersection of Two Linked Lists/源.cpp | #include<iostream>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
ListNode *getIntersectionNode(ListNode *headA, ListNode *headB)
{
if (headA == NULL || headB == NULL)return NULL;
int sumA = 0, sumB = 0;
ListNode*node = headA;
while (node!=NULL)... | ALGO | 0.999237 | 4.545374 |
ac0e4340-00d8-4fec-a93a-72ba933d6eef | muhammadabdullah15/c-plus-plus-resources | Queue.cpp | #include <iostream>
using namespace std;
class Queue
{
private:
struct node
{
int data;
node *next;
};
node *head;
node *rear;
public:
Queue()
{
head = NULL;
rear = NULL;
}
void enque(int value)
{
node *ptrNew = new node, *ptrTemp = hea... | TOOL | 0.888338 | 4.175108 |
65990d40-0863-4fd5-9813-a2ad1bfae3af | ninishu/LLVM-CFI | source_code/lib/CodeGen/MachineSSAUpdater.cpp | #include "llvm/CodeGen/MachineSSAUpdater.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/Support/AlignOf.h"
#include "llvm/Support/Allocator.h"
#include "... | TOOL | 0.97513 | 7.908915 |
0c036107-703d-47bc-83bb-d901e2979622 | Rajesh351/Leetcodeall | 2465-shifting-letters-ii/2465-shifting-letters-ii.cpp | class Solution {
public:
string shiftingLetters(string s, vector<vector<int>>& shifts) {
int n = s.size();
vector<int> shift(n + 1, 0); // Prefix sum array for net shifts
// Accumulate the net shifts
for (auto& shift_op : shifts) {
int to = shift_op[0];
int from = ... | ALGO | 0.999955 | 6.914633 |
0f9c597f-9eb4-4291-968d-9271d0f8a214 | usmhkoy39/ACM | 动态规划/背包DP/完全背包.cpp | #include <bits/stdc++.h>
using namespace std;
int v[1005], w[1005];
int f[1005];
void cptbag()
{
int N, T;
cin >> N >> T;
for(int i = 1;i <= N; i++)
cin >> v[i] >> w[i];
for(int i = 1;i <= N; i++)
{
for(int j = 0;j <= T; j++)
{
if(j - v[i] >= 0)
... | ALGO | 0.999993 | 4.217117 |
d5a581ad-2cda-49dd-a7dc-0278480a0ee1 | kishanrajput23/Programming-Resources | DSA CODES IN CPP/LINKED LIST DELETING ELEMENT AT A GIVEN INDEX.cpp | #include <bits/stdc++.h>
using namespace std;
// A linked list node
class Node{
public:
int data;
Node* next;
};
// void deleteNode(Node** head_ref)
// {
// Node * ptr = (*head_ref);
// (*head_ref) = (*head_ref)->next;
// free(ptr);
// }
// void deleteNode(Node** head_ref, int value)
// {
// ... | ALGO | 0.999891 | 5.028879 |
f7a6ce77-1184-4c92-9d3b-83ada9fe323b | dimkashelk/spbspu-labs-2022-aap-904-a | tellez.aron/I2/sumIndices.cpp | #include "sumIndices.h"
#include <limits>
size_t getSumOfIndices(const int *arr, size_t size)
{
if (size == 0)
{
return 0;
}
int min = std::numeric_limits< int >::max();
int max = std::numeric_limits< int >::min();
size_t min_index = 0;
size_t max_index = 0;
for (size_t i = 0; i < size; i++)
{
... | ALGO | 0.998715 | 5.982311 |
5490d24a-486d-423a-93ad-fa2a56e11116 | subhasish/Algo | 12.HashTable/07.SmallestCoveringOnline.cpp | /*
* 07.SmallestCoveringOnline.cpp
*
* Problem: Same as previous problem of smallest covering:
* Consider the digest of a page returned by a search engine. It is the more or less smallest text that cover all query words.
* Similarly, write a program that takes an Stream of string (input text) and a set of st... | ALGO | 0.999957 | 5.004079 |
935e8beb-282f-4674-9ea6-3bc26482be21 | Patrikpcm/Hacker_Rank | Problem Solving/grading_students.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<int> gradingStudents(vector<int> grades) {
vector<int> new_grades;
vector<int>::iterator it;
for(it=grades.begin(); it<grades.end(); it++){
if(*it>=38){
int n = *it;
while((n%5) != 0){
n++;
... | ALGO | 0.999404 | 4.581264 |
1a610398-f59b-4ce5-bc6c-8fa1f89c6f45 | chiralcentre/Kattis | ameriskur.cpp | #include <bits/stdc++.h>
using namespace std;
double n;
int main() {
scanf("%lf",&n);
printf("%lf\n",n * 0.09144);
return 0;
} | ALGO | 0.998995 | 3.111252 |
e8306e46-a83c-4b51-a6f9-9641b6749815 | ChanekarSankalp/cs_theory | A_excitingbets.cpp | #include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll gcd(ll a, ll b){return b==0?a:gcd(b,a%b);}
ll min(ll a, ll b){return a<b?a:b;}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(t--){
ll a,b;
cin>>a>>b;
ll ans=abs(a-b);
... | ALGO | 0.99997 | 4.591658 |
5ebd877b-2d80-466d-9830-be74d48ad445 | becastal/maratona | biblioteca/string/GeralSufixArray.cpp | #include <bits/stdc++.h>
#define f first
#define s second
#define _ ios_base::sync_with_stdio(0);cin.tie(0);
#define endl '\n'
#define dbg(x) cout << #x << " = " << x << endl
typedef long long ll;
const int INF = 0x3f3f3f3f;
const ll LINF = 0x3f3f3f3f3f3f3f3fll;
using namespace std;
// Estrutura para armazenar informa... | ALGO | 0.998581 | 4.056553 |
6e1ed5d4-0058-4af9-bb46-35b4e7e75bca | renping0535/02393-Programming-CPP | week2/w2_Gaussian_Sum.cpp | #include <iostream>
using namespace std;
int main()
{
int n;
int sum = 0;
cin >> n;
while(n>0)
{
sum = sum+n;
n = n-1;
}
cout << sum;
return 0;
}
| ALGO | 0.999706 | 3.929518 |
225e30ba-a669-4d3a-8ec1-ad2ddc1ed846 | mayank3005/LeetCode-Solutions | 2477-minimum-fuel-cost-to-report-to-the-capital/2477-minimum-fuel-cost-to-report-to-the-capital.cpp | class Solution {
public:
long long ans=0;
int dfs(int src,int par,vector<int> adj[],int seats){
int child=0;
for(auto it:adj[src]){
if(it==par) continue;
child+=dfs(it,src,adj,seats);
}
child++;
if(src) ans+=ceil(1.0*child/seats)... | ALGO | 0.999838 | 5.786615 |
82d02e59-fa86-448b-93df-1062518915df | real-world-system-design/Interview_prep | matrix/inti.cpp | #include<iostream>
#include<vector>
using namespace std;
int main() {
vector<vector<int > >v
{
{1, 2, 3},
{4, 5, 6},
{7, 8, 9},
};
for(int i=0;i< v.size(); i++) {
for(int j =0; j< v[i].size(); j++) {
cout<< v[i][j]<< " ";
}
cout<<endl;
}
cout<<endl;
cout<<v.size()<<endl;
cout<<v[0].size();
r... | ALGO | 0.974283 | 3.452169 |
642ecc13-f8a5-4d57-8475-08b9406ca70d | mohiuddinsizan/DSA | DSA/Graphs/buildingRoads.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 1e5+5;
vector<int> adjacent[N];
bool visited[N];
void bfs(int i){
queue<int> q;
q.push(i);
visited[i] = true;
while(!q.empty()){
int p = q.front();
q.pop();
for(int x : adjacent[p]){
if(!visited[x]){
... | ALGO | 0.999985 | 3.841434 |
9848d2f3-ef2b-4f7a-9ab3-9e8663c03f2a | GHLee96/baekjoon | 1987_알파벳.cpp | #include <iostream>
#include <queue>
#include <vector>
using namespace std;
int R, C;
vector<vector<char>> map;
vector<vector<int>> visit;
int dr[4] = {0, 0, 1, -1};
int dc[4] = {1, -1, 0, 0};
int max_cnt = 0;
struct info {
int r, c, route, cnt;
};
bool is_map(info a) {
if (a.r >= 0 && a.r < R && a.c >= 0 &... | ALGO | 0.999628 | 4.888933 |
9e486320-6253-4c36-99a7-04f54c44736f | AlexSlayer69/LeetCode-Solutions- | 0567-permutation-in-string/0567-permutation-in-string.cpp | class Solution {
public:
bool checkInclusion(string s1, string s2) {
unordered_map<char, int>mp, mp2;
for(auto it : s1) mp2[it]++;
int i = 0, j = 0, k = s1.size(), n = s2.size();
while(j < n){
mp[s2[j]]++;
j++;
if(j - i == k){
if... | ALGO | 0.999944 | 6.310149 |
21479046-e59f-49cb-8dc6-084b967b7f79 | cpplover52/Password-Encryptor | cplusplusoop/main.cpp | #include <iostream>
#include <vector>
#include <string>
class Password {
private:
std::string passwordText, startPasswordText,encryptedText,decryptedText;
std::vector<int> primeNumbers;
std::string primeText, normalText;
int passwordLength;
void findPrimes() {
for (int i = 2; i <= passwordLength; i++) {
bo... | ALGO | 0.996918 | 3.682941 |
12e214b4-817c-423b-a8e3-b885f6c9b2f9 | mmxsrup/procon | aoj/v13/a.cpp | #include <iostream>
#include <string>
#include <algorithm>
#include <functional>
#include <vector>
#include <bitset>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)
#define reps(i,f,n) for(int i=(f);i<(n);i++)
int main(void){
int... | ALGO | 0.999161 | 3.410028 |
52d17eaf-8d95-415a-bc79-8fc24e4b0ad0 | vikmokut/Problem-Solving | c++/w3s/DSA/sort_algorithms/insertion_sort_2.cpp | // Online C++ compiler to run C++ program online
#include <iostream>
int main() {
int arr[] = {45, 23, 43, 6, 45, 32, 12, 1};
int arrLen = sizeof(arr) / sizeof(*arr);
for (int i = 1; i < arrLen; i++) {
int sortValue = arr[i];
for (int j = i - 1; j >= 0; j--) {
if ( arr[j+1]... | ALGO | 0.999895 | 4.35001 |
66294e60-b643-433b-aee8-86323b9908c3 | YinWenAtBIT/LeetCode | First Missing Positive/version_1.cpp | class Solution {
public:
int firstMissingPositive(vector<int>& A) {
int tmp;
int n = A.size();
for (int i = 0; i < n; i++) {
while (A[i] != i + 1) {
if (A[i] <= 0 || A[i] > n || A[i] == A[ A[i] - 1 ]) {
break;
}
... | ALGO | 0.999838 | 5.072081 |
74211e37-e20e-4b64-9463-b384026f886e | Seungchan0325/baekjoon | solutions/12865_7.cpp | #include <iostream>
using namespace std;
int n, k, w[101], v[101], dp[100001];
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
cin>>n>>k;
for(register int i=0; i<n; i++) {
cin>>w[i]>>v[i];
for(register int j=k; j>=w[i]; j--) {
dp[j] ... | ALGO | 0.999994 | 3.876956 |
7a90a9ca-4b11-46c9-b806-27ffab709923 | lduguid/core | dep/src/g3dlite/Box2D.cpp | /**
@file Box.cpp
Box class
@maintainer Morgan McGuire, http://graphics.cs.williams.edu
@created 2001-06-02
@edited 2008-12-27
*/
#include "G3D/Box2D.h"
#include "G3D/CoordinateFrame.h"
#include "G3D/Rect2D.h"
namespace G3D {
bool Box2D::overlaps1Way(const Box2D& other) const {
for (int a = 0; a < 2... | ALGO | 0.897535 | 7.251505 |
8680231f-8567-48f2-ba9d-e82b52217b03 | AlexiaChen/Adrasteia | desktop-programming/interesting-demo/Sorts/CombSort/CombSort.cpp | // CombSort.cpp : ̨Ӧóڵ㡣
//
#include <graphics.h>
const int SCREEN_WIDTH = 1280; // X-axis.
const int SCREEN_HEIGHT = 600; // Y-axis.
typedef struct _DATA{
int top_x;
int top_y;
int value_t; //real data for sorting
}data_t;
static data_t data[SCREEN_WIDTH];
void comb_sort(data_t* seq, int size)
{
... | ALGO | 0.999815 | 5.154375 |
d7e078f1-ae44-41b1-80c3-446526c0ef08 | iamtanong/2110104_comprog | grader/05_String/05_String_12.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
string sum = "0";
while(1) {
string num; cin >> num;
if(num == "END") break;
int k=0;
if(num.length() > sum.length()) {
int len = num.length()-sum.length();
string s = "";
while(len--... | ALGO | 0.999917 | 4.459678 |
2b5fcee8-54e3-4c9f-b49b-87de5805003e | shreeja26/DSA-Questions | pattern/ques-9.cpp | #include <iostream>
using namespace std;
int main() {
cout << "\n";
int n;
cin >> n;
char c = 64+n;
for(int i=0; i<n; i++){
for(int j=0; j<i; j++){
cout << " ";
}
cout << c;
for(int j=n*2; j>2*i+3; j--){
cout << " ";
}
if(i!=n-1... | ALGO | 0.999621 | 3.054545 |
54ec4bd6-e30e-4630-874e-37b0321d0a57 | greenfox-zerda-sparta/Fruzsi555 | week-02/day-1/22/22.cpp | #include <iostream>
#include <string>
using namespace std;
int main() {
int ac = 8;
int time = 120;
string out = "";
// if ac is dividable by 4
// and time is not more than 200
// set out to 'check'
// if time is more than 200
// set out to 'Time out'
// otherwise set out to 'Run Forest Run!'
if ( ac%4==0 ... | ALGO | 0.97295 | 4.091924 |
4c3d60db-0502-4d41-9f7f-92a527584737 | ZiKuanJasonCheng/data-structures-code-practice | DP/MoneyExchangeProblem2.cpp | # include <iostream>
# include <vector>
using namespace std;
/*
Given a set of denominations and an amount, find out number of least notes to be exchanged,
as well as its combination of denominations
*/
int sum(int arr[], int size) {
int result = 0;
for (int i=0; i<size; i++) {
result += arr[... | ALGO | 0.999805 | 5.306436 |
df9b260a-2c07-47b0-bb25-1631699c40cf | gpgp2006/ProjetoGrafosRedes | main.cpp | #include <iostream>
#include <queue>
#include <stack>
#include "grafo.cpp"
#include "grafo.h"
using namespace std;
int main() {
Grafo g;
g.num_vertices = 5;
adicionarAresta(g, 0, 1, 15);
adicionarAresta(g, 0, 2, 20);
adicionarAresta(g, 0, 3, 15);
adicionarAresta(g, 1, 2, 5);
adicionarArest... | ALGO | 0.997631 | 4.850468 |
458fa546-3ec9-4cbf-ba09-4976f55cc872 | aritra741/Competitive-Programming | Toph/PowerPuffGirls.cpp | #include <bits/stdc++.h>
#define ll long long
#define vi vector<int>
#define MX (1 << 19)
#define OR 0
#define AND 1
#define XOR 2
#define mx 200007
#define mod 1000000009
using namespace std;
ll qpow( ll x, ll y )
{
ll res = 1;
while (y > 0)
{
if (y & 1)
res = (res * x) % mod;
x = (x * x) % mod;
y >>= 1;... | ALGO | 0.999952 | 3.755632 |
33d256be-ef2f-4bf8-91c3-e5450a514396 | fi-content2-games-platform/FIcontent.Gaming.Enabler.SLAMflex | libSLAMflex - android project/jni/slower_corner_9.cpp | #include "fast_corner.h"
#include "prototypes.h"
namespace CVD
{
void fast_corner_detect_9(const BasicImage<byte>& i, std::vector<ImageRef>& corners, int b)
{
fast_corner_detect_plain_9(i, corners, b);
}
}
| ALGO | 0.993923 | 6.170636 |
ccea14ca-57fb-4115-8d03-baf87d0935b8 | seanmeaney/glsl-debug | mesa-glsl/mesa/glsl/loop_controls.cpp | #include <limits.h>
#include "main/compiler.h"
#include "glsl_types.h"
#include "loop_analysis.h"
#include "ir_hierarchical_visitor.h"
/**
* Find an initializer of a variable outside a loop
*
* Works backwards from the loop to find the pre-loop value of the variable.
* This is used, for example, to find the initia... | ALGO | 0.999415 | 7.804931 |
88636640-39c8-4533-8100-ddf9b9711efc | hjiang13/LLMs-in-IR | POJ-104/52/2931.cpp | #include <iostream>
using namespace std;
int main()
{
int n,t,m,a[200],i,j,k;
cin>>n>>m;
for (i=0; i<n; i++)
cin>>a[i];
while (m>0)
{
t=a[n-1];
for (j=n-1; j>0; j--)
a[j]=a[j-1];
a[0]=t; m--;
}
cout<<a[0];
for (k=1; k<n; k++)
cout<<" "<<a[k];
return 0;
} | ALGO | 0.999997 | 3.117936 |
11ac58fd-71b3-4b57-92d3-bf09aeda97ac | shokuyansh/codeforces | 58A.cpp | #include<iostream>
#include<string>
using namespace std;
int main()
{
string s;
cin>>s;
char hello[]={'h','e','l','l','o'};
int counter=0;
for(auto c:s)
{
if(c==hello[counter])
{
counter++;
}
}
if(counter==5)
cout<<"YES";
else
... | ALGO | 0.999908 | 3.624754 |
c31e8a6f-450e-4351-ae94-f9a8ee3b1997 | ishandutta2007/codeforces | ecnerwala/normal/384/B.cpp | #include<iostream>
using namespace std;
int N, M, K;
int main() {
cin >> N >> M >> K;
cout << (M * (M - 1) / 2) << '\n';
for(int i = 0; i < M; i++) {
for(int j = 1; j <= M - 1 - i; j++) {
if(K) cout << j + 1 << ' ' << j << '\n';
else cout << j << ' ' << j + 1 << '\n';
}
}
return 0;
} | ALGO | 0.999878 | 3.340523 |
f3388ecb-5c78-46ec-9659-7d8ba8090682 | DontKillMe-Pls/8lb | 8lb_6_main.cpp | #include <iostream>
#include <cmath>
using namespace std;
bool TrialDivision (uint32_t n){
if (n < 2)
return false;
if (n < 4)
return true;
if ((n & 1) == 0)
return false;
for (uint32_t i = 3; i <= (uint32_t) sqrt(n); i += 2)
if (n % i == 0)
return false;... | ALGO | 0.996293 | 3.391335 |
9ef1f87e-c54b-402c-9274-91159694b8af | Anmolawasthi117/Dsa_using_C- | strings2/warmupProblem.cpp | #include<iostream>
#include<vector>
#include<bits/stdc++.h>
using namespace std;
int main(){
string str;
getline(cin,str);
int count = 0;
for(int i=0; i<str.length(); i++){
if(str[i] != str[i+1] && str[i] != str[i-1] ){
count++;
}
}
cout<<count;
return ... | ALGO | 0.999842 | 3.95976 |
9726cca9-fdcb-4168-abab-5725c70e3ef5 | itisameerkhan/GeeksForGeeks | Nth Fibonacci Number/solution1.cpp | #include<bits/stdc++.h>
using namespace std;
class Solution {
public:
int nthFibonacci(int n){
int dp[n+1];
dp[0] = 0;
dp[1] = 1;
for(int i=2;i<=n;i++) {
dp[i] = (dp[i-1] + dp[i-2]) % 1000000007;
cout<<dp[i]<<endl;
}
return dp[n];
}
};
i... | ALGO | 0.999979 | 4.973676 |
c3c0174b-0a35-4f8b-af09-845f0baf1dd6 | MohammadElsharqawy/CompetitiveProgramming | codeforces/61/D.cpp |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll ;
const int N=1000003;
int mx=0;
int n;
vector<pair<int,int>>adj[N];
void dfs(int node ,int p,int d){
if(d > mx){
mx=d;
}
for(pair<int,int>v:adj[node]){
if(v.first==p) continue;
dfs(v.first,node,d+v.second);
}
... | ALGO | 0.998685 | 3.761189 |
ee00a83a-5484-4ade-bfcf-6b19b9962eff | kushpo357/DSA_practice | GFG_POTD/wildcard_pattern_matching.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
/*You are required to complete this method*/
bool solve(int i, int j, string &pat, string &str, const int &n, const int &m, vector<vector<int>> &dp)
{
if(i == n && j == m) retu... | ALGO | 0.999932 | 5.534231 |
5ce057e3-8f60-418f-bbcd-d4b8efc4d644 | trgtam-thanh-2k4/Leetcode | 2216-delete-the-middle-node-of-a-linked-list/delete-the-middle-node-of-a-linked-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:
int countNode(ListNod... | ALGO | 0.999812 | 6.05517 |
02b4707b-149f-43ca-ab34-d5f1e1d34e75 | ndbaolam/Algorithms | DSA/GenerationAlgo/bai1.cpp | #include<bits/stdc++.h>
using namespace std;
using ll = long long;
void sinh(string a, int n)
{
int i;
for(i=n-1;i>=0,a[i]=='1';i--)
a[i]='0';
if(i!=-1)
{
a[i]='1';
cout << a;
}
else
for(int i=0;i<n;i++) cout << 0;
}
int main()
{
string a; cin >> a;
sinh(a, (int)a.length());
return 0;
} | ALGO | 0.999984 | 4.065412 |
1e734eff-ddef-4922-9b6a-f85d14ed4d89 | derivada/cpprac | codeforces/rounds/r923/d.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define ll long long // 64 bits
#define ld long double // 80 bits
#define PI 3.1415926535897932384626433832795l
typedef vector<int> vi;
typedef pair<int, int> pi;
typed... | ALGO | 0.99972 | 4.24468 |
09260bf1-61f3-4dc6-974c-77b677f3d332 | vanitas-23/Daily_progress | 3455-minimum-length-of-string-after-operations/minimum-length-of-string-after-operations.cpp | class Solution {
public:
int minimumLength(string s) {
vector<int>arr(26);
for(char c:s)
arr[c-'a']++;
int ans=0;
for(int i=0;i<26;i++)
{
if(arr[i]==0) continue;
if(arr[i]%2)
ans++;
else
ans+=2;
}
... | ALGO | 0.999922 | 5.479718 |
5b53aa7d-c063-410d-9f5a-77bb9814efdf | yousuf-cse-bd/StandardTemplateLibrary | STL_Vector3.cpp | /**
* @file STL_Vector3.cpp
* @author Md. Yousuf Ali (<EMAIL>)
* @brief Converting from Fahrenheit to Centigrade Scale
* @version 0.1
* @date 2023-03-28
* @since TuesDay; 10:24 AM
* @copyright Copyright (c) 2023
* @institute: Dept. of CSE, Varendra University, Rajshahi, Bangladesh
*/
#include <iostream>
#incl... | TOOL | 0.956045 | 4.48142 |
f5033c2a-d436-47c4-8089-8ac47b85c7e4 | shivankar-p/codeforces | ladder/B_Color_the_Fence.cpp | #include<bits/stdc++.h>
using namespace std;
#define fo(i,n) for(i=0;i<n;i++)
#define Fo(i,k,n) for(i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define int long long
#define mod 1000000007
#define vi vector<int>
#define f first
#define s second
#define pb push_back
int mfun(int i, int m)
{
if(i < 0) retur... | ALGO | 0.999934 | 3.773959 |
b53986af-f373-43d8-8c8c-81c95d83bd12 | rohan2371/InterviewPrep_DSA | Heap/Reorganize String.cpp | /*
LeetCode link : https://leetcode.com/problems/reorganize-string/
*/
// Approach 1 : using max_heap -> priority_queue
// t.c : o(k * log(k)) or worst case t.c : o(n*log(n))
class Solution {
public:
typedef pair<int,char>p;
string reorganizeString(string s) {
int n = s.length();
vector<in... | ALGO | 0.99997 | 6.011362 |
6b840d91-2c6a-46f5-bc09-db1c469a32b5 | Cmput416F21/PyGlueTokenizer | CodeGen-main/data/transcoder_evaluation_gfg/cpp/MAXIMUM_PRODUCT_SUBSET_ARRAY.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <bits/stdc++.h>
using namespace std;
int f_gold ( int a [ ], int n ) {
if ( n == 1 ) return a [ 0 ];
int max_neg = INT_MIN;
int count_neg = 0, count_zero = 0;
int prod = 1;
for ( int i = 0... | ALGO | 0.999696 | 5.20043 |
ea5040c5-f2bb-4126-bf63-55324dcf0671 | yousuf-cse-bd/RandomCodes | DigitFrequencyHRUsingSwitchCase.cpp | /**
* @file DigitFrequencyHRUsingSwitchCase.cpp
* @author your name (<EMAIL>)
* @brief
* @version 0.1
* @date 2022-06-16
*
* @copyright Copyright (c) 2022
*
*/
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
/* code */
char num[1000];
cin>>num;
unsigned in... | ALGO | 0.998466 | 3.870419 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.