uuid stringlengths 36 36 | repo_name stringlengths 5 123 | relative_path stringlengths 5 4k | content stringlengths 33 2.85M | category stringclasses 6
values | algo_rel_score float64 0.85 1 | quality_score float64 3 8.76 |
|---|---|---|---|---|---|---|
02b1a893-a380-4ce3-9121-3973614ab321 | Rutuza/Coding-Blocks-practice-questions | Practice/GaneshaPattern.cpp |
#include <iostream>
using namespace std;
int main(){
int num;
cin>>num;
num=num-1;
int mid= (num)/2;
for(int i =0;i<=num;i++)
{
for(int j =0;j<=num;j++)
{
if((i==0 && i<=mid) || j==0 || i==num || j==num || i==mid || j==mid)
{
cout<<"... | ALGO | 0.999975 | 3.637398 |
9a0e7265-eee2-4abe-aada-e5938ec4f9e3 | YuyuchenW/LeetCodeRecord | 445.两数相加-ii.cpp | /*
* @lc app=leetcode.cn id=445 lang=cpp
*
* [445] 两数相加 II
*/
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) {}
};
// @lc code=start
/**
* Definition for singly-link... | ALGO | 0.999803 | 6.695282 |
6b39efd6-2875-4750-a4eb-368e53050cf6 | makerbase-mks/Mks-Robin-Nano-Marlin2.0-Firmware | Marlin/src/gcode/probe/G38.cpp | #include "../../inc/MarlinConfig.h"
#if ENABLED(G38_PROBE_TARGET)
#include "../gcode.h"
#include "../../module/endstops.h"
#include "../../module/motion.h"
#include "../../module/stepper.h"
#include "../../module/probe.h"
inline void G38_single_probe(const uint8_t move_value) {
endstops.enable(true);
G38_move =... | ALGO | 0.957396 | 7.682211 |
46ec22ab-1d10-4889-bdea-63b8998e52aa | SinghVikram97/Interview-Prep | Heaps/2. (VIMP) Kth Largest Element in Array.cpp |
Brute Force- O(nlogn)
SORT THE ARRAY AND RETURN THE KTH ELEMENT
https://drive.google.com/open?id=1WC2KnvqTyH3ZM1IbLy3pZmd5rtTUpr2l
class Solution {
public:
int findKthLargest(vector<int>& nums, int k) {
priority_queue<int> pq;
for(int i=0;i<nums.size();i++){
pq.... | ALGO | 0.999985 | 5.293648 |
513cf1d6-5f9f-41c0-be5f-634192cb8878 | Abhibhab/Abhibhab_Leetcode | Check whether K-th bit is set or not - GFG/check-whether-kth-bit-is-set-or-not.cpp | //{ Driver Code Starts
//Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function Template for C++
class Solution
{
public:
// Function to check if Kth bit is set or not.
bool checkKthBit(int n, int k)
{
// Your code here
// It can b... | ALGO | 0.999024 | 5.886707 |
aa1bee03-7bfa-4e11-b058-b4934dbfe67d | ATRi111/ClipAlgorithm | ClipAlgorithm/ClipAlgorithm.cpp | #include"ClipAlgorithm.h"
using namespace std;
#pragma region ClipAlgorithm
TestAnswer* ClipAlgorithm::Run(TestCase* t,Stopwatch* timer)
{
TestCase_Clip* clip = dynamic_cast<TestCase_Clip*>(t);
Vector2 p1 = clip->p1;
Vector2 p2 = clip->p2;
if (timer)
timer->Start();
bool valid = Clip(clip->xMin, clip->xMax, cli... | TEST | 0.967385 | 5.559788 |
f9f75ab1-29c4-4f18-b6f4-25edcf41e4e6 | hoangkiet1906/C-- | Heap/Ass13-1.cpp | #include <iostream>
#include <algorithm>
using namespace std;
void heapify(int A[], int n, int i){
int l = 2*i + 1;
int r = 2*i + 2;
int large = i;
if(l < n && A[l] > A[i])
large = l;
if(r < n && A[r] > A[large])
large = r;
if(large != i){
swap(A[i], A[large]);
h... | ALGO | 0.999796 | 3.74639 |
857dd559-c539-4a8c-98f1-ddbc21e14c60 | Ronibaidhya/Introduction_to_Algorithms | MODULE_10.5_practice/Labyrinth.cpp | //https://cses.fi/problemset/task/1193
#include <bits/stdc++.h>
using namespace std;
char a[1005][1005];
bool vis[1005][1005];
int dis[1005][1005];
pair<int,int> par[1005][1005];
vector<pair<int, int>> d = {{0, 1}, {0, -1}, {-1, 0}, {1, 0}};
int n, m;
bool valid(int i, int j)
{
if (i < 0 || i >= n || j < 0 || j >=... | ALGO | 0.999982 | 4.474892 |
06347517-501c-4584-804e-d6f65bd36ee4 | DreadVectorStudios/DistributedUnrealEngine | Engine/Plugins/Experimental/ControlRig/Source/ControlRig/Private/Units/Highlevel/Hierarchy/RigUnit_CCDIK.cpp | #include "RigUnit_CCDIK.h"
#include "Units/RigUnitContext.h"
FRigUnit_CCDIK_Execute()
{
if (Context.State == EControlRigState::Init)
{
WorkData.CachedItems.Reset();
return;
}
FRigElementKeyCollection Items;
if(WorkData.CachedItems.Num() == 0)
{
Items = FRigElementKeyCollection::MakeFromChain(
Context.H... | ALGO | 0.951415 | 6.686673 |
c88b2901-4532-4878-b05c-a0d477a7ecb6 | Largexim/infixToPostfix | main.cpp | #include <iostream>
#include "List.h"
#include <SFML/Graphics.hpp>
List split(const string&);
bool priorityCheck(string&, string&);
List postfixMaker(List&);
float calculator(List&);
float fCalculator(List,float);
int main() {
int menu = 0;
while(menu!=-1){
cout<<"1)Draw a Function.\n2)Change to postfix... | TOOL | 0.957733 | 4.088695 |
cd719547-7e01-4c56-b78c-85367d5c3afd | Aaronyg/Tars | cpp/servant/libservant/Communicator.cpp | #include "util/tc_file.h"
#include "servant/Communicator.h"
#include "servant/StatReport.h"
#include "servant/TarsLogger.h"
namespace tars
{
//////////////////////////////////////////////////////////////////////////////////////////////
string ClientConfig::LocalIp = "127.0.0.1";
string ClientConfig::ModuleName = "u... | TOOL | 0.87992 | 5.740614 |
ffb2e129-8da4-4151-81ed-99d4a2a0399c | Salil3105/DAA | A3.cpp | /*3 - Find Maximum and Minimum elements from an array of integers using Divide and
Conquer Approach.*/
#include <iostream>
#include <climits>
#include <chrono>
using namespace std;
using namespace std::chrono;
void MinMax(int arr[], int low, int high, int &min, int &max)
{
if (low == high)
{
if (max <... | ALGO | 0.998782 | 5.12831 |
ad2516bd-007c-44af-b9f5-ea382d31a93c | uniqss/leetcodecpp | 0054/54_SpiralMatrix.cpp | #include "../inc.h"
class Solution {
public:
vector<int> spiralOrder(vector<vector<int>>& matrix) {}
};
void test(vector<vector<int>>&& matrix, const vector<int>& expect) {
save4print(matrix);
assert_eq_ret(expect, Solution().spiralOrder(matrix));
}
int main() {
test({{3}, {2}}, {3, 2});
test(... | ALGO | 0.999958 | 6.213332 |
4d7c0f52-073f-4d0c-aa9d-95c3459f5089 | hzfsls/leetcode-supercrawl | data/0542.01-matrix/code_snippets/sol.cpp | class Solution {
public:
vector<vector<int>> updateMatrix(vector<vector<int>>& mat) {
}
}; | ALGO | 0.99992 | 6.102642 |
f7347883-cd85-49cf-9054-ba12fc5611c5 | itish-agarwal/CP-submissions | Atcoder/C++ (GCC 9.2.1)/abc192_e/20301969.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
int ceil(int a, int b) {
return (a + b - 1) / b;
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n, m, x, y;
cin >> n >> m >> x >> y;
vector<vector<int>> g[n+1];
while(m--) {
int a, b, t, k;
cin >> a >> b >> t >> k... | ALGO | 0.999931 | 4.191805 |
fe8569e8-f6cd-4414-becb-2e191b5a22dc | mervekaya/CPP-Homeworks | Homework-7/111044035HW07_main.cpp | /*
*
* Created by sort1 KAYA on 19/12/2013
* ID : 111044035
*
* This program has one base class and two derived class.
* This classes remove element,add element,find number of element in class
* Also this classes have overloading +,+=,% operators.User can access elements
* of list like nameObje.at(5).
*
*/
... | TOOL | 0.884512 | 4.465905 |
ed0d56d8-3bc0-426a-a1fc-3c89857af826 | peterjinweigu/Competitive-Programming-Solutions | USACO/nocows.cpp.cpp | // Source: https://usaco.guide/general/io
#include <bits/stdc++.h>
using namespace std;
#define MAXN 200010
typedef long long ll;
#define MOD 9901
/*
ID: petergu1
TASK: nocows
LANG: C++14
*/
int dp[110][210];
int solve(int k, int n) {
if (dp[k][n] != -1) return dp[k][n];
if (k == 0 && n != 0) ret... | ALGO | 0.99992 | 4.388888 |
e446b004-a4b6-46fa-9778-9f56370a6126 | ishandutta2007/codeforces | brobat/normal/1646/A.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
#define forn(i, a, n) for (int i = a; i < n; i++)
const int MAXN = 200100;
const int MOD = 1000000007;
const int INF = 9100000000000000000;
const double EPS = 1E-7;
void solve() {
int n, s;
cin >> n >> s;
cout << s/(n *... | ALGO | 0.997552 | 3.669893 |
9922d6fa-b552-4065-a1a5-3845dce76873 | Jwasik/randomOS | randomOS/VirtualMemory.cpp | #include "VirtualMemory.h"
uint8_t VirtualMemory::insertProgram(std::pair<int, std::vector<Page>> program) {
for (auto &p : swapFile)
if (p.first == program.first) return 96;
if (program.second.empty()) return 97;
swapFile.insert(program);
return 0;
}
uint8_t VirtualMemory::updateQueue(int frameNumber) {
if (f... | TOOL | 0.914787 | 3.718376 |
47263d07-a4fa-4f5f-b2c8-d3736a2ea6bc | Nghia03092004/Competitive-Programming | Codeforces/Hủy diệt số học/Số nguyên tố đối xứng.cpp | #include<bits/stdc++.h>
using namespace std;
const int N = 2e7 + 10;
bool prime[N];
void sieve() {
for (int i = 1; i <= N; i++)
prime[i] = true;
prime[1] = false;
for (int i = 2; i <= sqrt(N); i++)
if (prime[i])
for (int j = i*i; j <= N; j += i)
prime[j] = false;
}
bool check(int n) {
if (prime[... | ALGO | 0.99935 | 5.789587 |
24b9f9b9-c4d3-492f-9d15-99163e057640 | Tasin44/DSA | Linked List/Basics/2.Linked_list_traversal.cpp |
#include <bits/stdc++.h>
using namespace std;
class Node {
public:
int data;
Node* next;
// Constructor with one parameter
Node(int data1) {
data = data1;
next = nullptr;
}
};
Node* convet_arr_to_llist(vector<int> arr)
{
Node* head = new Node{arr[0]};
Node* mover = head... | ALGO | 0.99986 | 5.196586 |
789ec391-0014-4f79-8a31-7fe9477baea2 | aryaman0098/codes | cpp/leetcode/91.decode-ways.cpp | /*
* @lc app=leetcode id=91 lang=cpp
*
* [91] Decode Ways
*/
// @lc code=start
#include<bits/stdc++.h>
using namespace std;
class Solution {
private:
unordered_map<int, int> u;
public:
int numDecodings(string s) {
int n = s.length();
function<int(int)> numWays = [&](int index) {
... | ALGO | 0.999859 | 6.82382 |
4548825c-fa1a-4453-94e1-0df9ebe5eb2c | raincross7/code-similarity | codes/train_code/problem455/problem455_492.cpp | #include<bits/stdc++.h>
#define all(v) v.begin(),v.end()
using namespace std;
typedef long long ll;
const ll INF=1000000010;
const ll MOD=1000000007;
const ll LINF=4000000000000000000;
const long double EPS=1e-9;
typedef pair<int,int> P;
int main(){
int n;cin>>n;
ll ans=0;
int s=2;
for(int i=0;i<n;i++){... | ALGO | 0.999799 | 3.139618 |
cbdb43ad-d852-4884-9c17-2c46519d20f4 | takanori1815/c-bennkyou | atcoder/ABC239/b.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
int main() {
ll x;
cin >> x;
if (x < 0 and x % 10 != 0) {
cout << x / 10 - 1 << "\n";
} else {
cout << x / 10 << "\n";
}
} | ALGO | 0.999385 | 4.064292 |
40cb3045-8410-4bae-98b0-d0736036a7a1 | Akatsuki008/C | Single Operation Part 1.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int t, n, i;
string s;
cin>>t;
while(t--)
{
cin>>n>>s;
for(i=1; i<n; i++)
{
if(s[i]=='1'){
break;
}
}
cout<<i<<endl;
}
}
| ALGO | 0.999796 | 3.349098 |
32b736ff-0736-42be-a214-2cd76bc928c0 | zty111/OI | zty-Contest/zty-Exercise/luogu/P1081/P1081.cpp | #include <bits/stdc++.h>
using namespace std;
const int u = 100010;
long long a[u][18][2], b[u][18][2], ansA, ansB, A, B;
int f[u][18][2], ans, n, m, t, i, h[u], g[u], go[u][2], l, k, j, x0, x, y;
struct rec{
int x, y;
bool operator < (rec b) const {
return y < b.y;
}
};
set<rec> s;
set<rec>::iterat... | ALGO | 0.999932 | 3.906339 |
30d16c67-1434-4782-b617-836c7fdbd23b | CristiFiodorov/POO_FII_Fiodorov_A4 | Lab4/main.cpp | #include <iostream>
#include "Sort.h"
int main()
{
char str[] = "10,2,5,3,1,8,9,100";
Sort s{str};
s.QuickSort(true);
s.Print();
return 0;
} | ALGO | 0.997352 | 4.672978 |
1ffa94d2-378f-4273-807b-0e91538a08eb | Pavan-B-N/DSA-with-C_plus_plus | Binary Search/BitonicArray.cpp | // A bitonic sequence is a sequence of numbers that is first strictly increasing then after a point decreasig
/*
Bitonic array is also known as mountain array
arr={1,3,5,7,5,3,1}
find the peak index of bitonic or mountain array
https://leetcode.com/problems/find-peak-element/
*/
#include <iostream>
using namespace st... | ALGO | 0.999927 | 5.930217 |
5ec3aa15-d2f1-4b05-aeaf-d7bd06797285 | sjnaj/.leetcode | 1116.打印零与奇偶数.cpp | /*
* @lc app=leetcode.cn id=1116 lang=cpp
*
* [1116] 打印零与奇偶数
*/
#include <mutex>
#include <condition_variable>
#include <atomic>
#include <functional>
#include <thread>
#include <iostream>
#include <semaphore.h>
using namespace std;
// @lc code=start
class ZeroEvenOdd
{
sem_t sem_z, sem_o, sem_e;
atomic<int... | ALGO | 0.998156 | 5.955066 |
62fbff78-59c7-4c7e-8411-d6b74db9d98a | kimbyeonghak/C | 중첩반복4.cpp | #include<stdio.h>
int main(){
for(int i=5;i>0;i--){
for(int j=i;j>0;j--){
printf("%2d",j);
}
printf("\n");
}
}
| ALGO | 0.998723 | 3.130762 |
a0b6e720-825f-4b86-99a4-26d60f2a93a0 | edionu97/Algorithms-DataStructures-ContestsSolutions | Campion.ro/sudoku.cpp | #include <iostream>
#include <fstream>
using namespace std;
ifstream f("sudoku.in");
ofstream g("sudoku.out");
struct BestPoz
{int b[10],nre;
}v[10];
int a[10][10],ok,lev[10],n;
void ReadData()
{for(int i=1;i<=9;i++)
{for(int j=1;j<=9;j++)
{char ch;
f>>ch;
a[i][j]=int(ch)-48;
if(!a[i][j])v[i].b[++v[i].nre]... | ALGO | 0.999837 | 3.838672 |
3bea2ff1-3312-490c-b50a-dca900d2b539 | vinit11890/Dsa_lab | binary_search_tree.cpp |
#include <iostream>
#include<stack>
using namespace std;
struct btree
{
btree *lc;
int data;
btree *rc;
};
class bst
{
btree *root;
int n;
public:
bst()
{
root = NULL;
}
btree *create()
{
btree *node;
cout<< "Enter number of nodes:- ";
cin>> n;
for (int i = 0; i< n; i++)
... | ALGO | 0.999946 | 3.865461 |
3bb9ac52-f868-4df9-b0ef-4faae4e9f221 | JasonShin10/DailyAlgorithm | Broute-force/BaekJoon_15686*.cpp | #include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
#include <map>
#include <queue>
#include <string>
#include <math.h>
#include <cstring>
#include <stack>
using namespace std;
int N, M;
int arr[51][51] = {};
vector<vector<int>> chickenList;
vector<pair<int, int>> chickenPos;
vector<pair<int, i... | ALGO | 0.999914 | 4.177494 |
31bc7369-6b41-4b36-b2f0-115666811a4f | ishandutta2007/codeforces | enjapma/normal/1566/B.cpp | #include <bits/stdc++.h>
using namespace std;
// using mint = long double;
// using mint = atcoder::modint998244353;
// using mint = atcoder::modint1000000007;
typedef long long ll;
typedef pair<ll, ll> P;
typedef pair<ll, P> T;
typedef pair<ll, vector<ll>> Pd;
const ll INF = 3e18;
const ll fact_table = 3000050;
/... | ALGO | 0.999972 | 4.385504 |
1c547457-3416-4637-b4ae-f7813f6b88b7 | ahmedezzat1/IEEE-ZSB-Technical-Rookies-22 | Task3/problem_2_Between Two Sets/sol.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl '\n'
#define all(v) v.begin(),v.end()
#define rall(v) v.rbegin(),v.rend()
#define loop(n) for(int i = 0; i < (n); i++)
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
void file() {
#ifndef ONLINE_JUDGE
freope... | ALGO | 0.999912 | 4.06546 |
6a143b08-b80d-4a0f-a72d-efa34af5720b | lihongzheshuai/yummy-code | gesp/2/luogu/P1426.cpp | #include <iostream>
using namespace std;
int main() {
double s, x;
cin >> s >> x;
double t = 0;
double ans = 0;
for (int i = 1;; i++) {
if (ans >= s - x) {
if (ans + t * 0.98 > s + x) {
cout << "n";
return 0;
} else {
co... | ALGO | 0.999866 | 3.508069 |
e9f19fb8-e18f-422a-8391-016a97ca780f | jiaqiwang969/onelab-source | getdp-git-source/Kernel/EigenSolve_SLEPC.cpp | #include "GetDPConfig.h"
#if defined(HAVE_SLEPC)
// SLEPc interface for solving eigenvalue problems
//
// SLEPc can solve both linear and quadratic eigenvalue
// problems. SLEPc options can be specified in the .petscrc file, or
// directly on the command line.
//
// For example, to use MUMPs for a linear evp:
// -e... | TOOL | 0.992489 | 4.90764 |
5ef900c4-459c-4286-b613-4a3b004dd1d4 | ishandutta2007/codeforces | erray/normal/1588/C.cpp | // author: erray
#include <bits/stdc++.h>
#ifdef DEBUG
#include "debug.h"
#else
#define debug(...) void(37)
#define here void(37)
#endif
using namespace std;
template<typename T, typename F = function<T(const T&, const T&)>>
struct SparseTable {
vector<vector<T>> a;
vector<int> logs;
int n;
F op;
SparseTab... | ALGO | 0.999956 | 4.697935 |
632ac6d5-df86-42fe-8a56-9ce50414d32a | ishandutta2007/codeforces | tourist/normal/866/C.cpp | /**
* author: tourist
* created: 30.09.2017 20:16:50
**/
#include <bits/stdc++.h>
using namespace std;
const int N = 55;
const int MAX = 12345;
int a[N], b[N], p[N], sum_b[N];
double f[N][MAX];
int main() {
int n, r;
scanf("%d %d", &n, &r);
for (int i = 0; i < n; i++) {
scanf("%d %d %d", a... | ALGO | 0.99974 | 3.60931 |
1f9c8172-93e7-4dd3-8eba-f669c58ca1f5 | bornengineer/dsa-code | Recursion DSA/one_subseqeunces_with_given_sum.cpp | #include<bits/stdc++.h>
using namespace std;
void print (vector<int> &ds){
for(auto i : ds){ cout << i <<" ";}
cout << endl;
}
bool subseqeunces_with_given_sum(int idx, vector<int>&ds, int s, vector<int>& nums, int n, int sum){
if(idx==n){
if(s == sum){
print(ds);
return tr... | ALGO | 0.999867 | 4.775161 |
48685eb5-c837-4094-bdd4-85f246d7d07b | raincross7/code-similarity | codes/train_code/problem141/problem141_472.cpp | #include <algorithm>
#include <iostream>
#include <cstdio>
#include <map>
#include <numeric>
#include <set>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <string.h>
using namespace std;
#define ISEQ(c) (c).begin(), (c).end()
typedef long long ll;
int main() {
set<char> left;
lef... | ALGO | 0.99878 | 3.577258 |
6f3ebe65-4f41-48e5-a26a-cf919289dcd3 | raincross7/code-similarity | codes/train_code/problem207/problem207_140.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int H,W;
cin >> H >> W;
vector<vector<char>> data(H, vector<char>(W));
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
cin >> data.at(i).at(j);
}
}
for (int i = 0; i < H; i++) {
for (int j = 0; j < W; j++) {
... | ALGO | 0.999995 | 5.078017 |
82268552-9c7c-4921-9c63-45b6680e3054 | vivekmsit/CarND-Path-Planning-Project | src/Eigen-3.3/bench/sparse_product.cpp |
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.005 -DSIZE=10000 && ./a.out
//g++ -O3 -g0 -DNDEBUG sparse_product.cpp -I.. -I/home/gael/Coding/LinearAlgebra/mtl4/ -DDENSITY=0.05 -DSIZE=2000 && ./a.out
// -DNOGMM -DNOMTL -DCSPARSE
// -I /home/gael/Coding/LinearAlgebr... | ALGO | 0.979837 | 4.164869 |
8f340bd6-1cf9-4287-bdbc-02b81937dfc0 | Arushichaudhry24/Computer-Architecture-Project | project2/casim-csce614/tools/pin-2.14-71313-gcc.4.4.7-linux/source/tools/MemTrace/memtrace_threadpool.cpp | /*
*
* This tool collects an address trace of instructions that access memory
* by filling a per-thread buffer. Each memory access of an instruction is recorded
* as a MEMREF in the buffer (see MEMREF below).
*
* We do TRACE based instrumentation. At the top of the TRACE, we allocate
* the maximum amount of spa... | TOOL | 0.983008 | 6.190358 |
7212ebbb-8bad-4d68-867f-18dd20b571da | juuso-oskari/VisualSLAM | libs/opencv/modules/core/src/arithm.cpp | /* ////////////////////////////////////////////////////////////////////
//
// Arithmetic and logical operations: +, -, *, /, &, |, ^, ~, abs ...
//
// */
#include "precomp.hpp"
#include "opencl_kernels_core.hpp"
namespace cv
{
/****************************************************************************************... | TOOL | 0.967689 | 3.567141 |
e7d6675b-b036-4237-b7ba-d0a30adbde2d | abubakaristiak/CSE-Fundamentals | Introduction to C++ for DSA/Week 02- (Class and String)/Module - 07/_05_sort_using_built_in_function.cpp | #include<bits/stdc++.h>
#include<limits.h>
using namespace std;
class Student
{
public:
string name;
int roll;
int marks;
};
bool cmp(Student a, Student b){
// if(a.marks >= b.marks)
// return true;
// else
// return false;
//shortcut
// return a.marks >= b.marks;
if(a.... | ALGO | 0.999821 | 4.114266 |
535cd8f3-e7ad-47e8-b9c0-b5eb49a769a5 | absolutePi/Competitive_Programming | POSN/USACO/stuck_in_a_rut.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define all(A) A.begin(), A.end()
#define pb push_back
#define sz size
#define f first
#define s second
bool stopped[1002];
bool cmp(pair<pair<int,int>,int> a,pair<pair<int,int>,int> b){
if(a.f.s!=b.f.s){return a.f.s<b.f.s;}
return a.f.f<b.f... | ALGO | 0.999934 | 3.58831 |
02e4bd88-dd43-4ec9-8115-955de1b4fe85 | singhisking123/ProgramSnippets | leetcode/buy_and_sell_stock.cpp | #include <bits/stdc++.h>
using namespace std;
// for every stock either we buy or sell=>we can sell only when when we have a stock
// we can have only one stock at a time first we have to sell then we can buy again
// so there will be two state either we buy or we sell
// let's say initailly we have zero money
// thin... | ALGO | 0.999116 | 5.002351 |
b10aa83d-745f-4117-91aa-9e08c77b3243 | act1lazi0N/cPlusPlusInThePass | Pro Test/TOP SECRET!/New folder/Code/PARITY.cpp | #include<iostream>
using namespace std;
int main()
{
freopen("PARITY.INP","r",stdin);
freopen("PARITY.OUT","w",stdout);
int t;cin>>t;
for(int i=0;i<t;i++)
{
cin>>n;
}
}
| ALGO | 0.99955 | 3.847375 |
91c9ebda-dd7e-4539-afbb-38dae04653db | AugustineChang/LearningDoc | TestCpp/LeetCode/GenerateBrackets.cpp | #include <vector>
#include <string>
#include <iostream>
using namespace std;
class GenerateBrackets
{
public:
vector<string> generateParenthesis( int n )
{
string emptyStr;
vector<string> output;
generateRecursively( 0, n, emptyStr, 2 * n, output );
return output;
}
private:
void generateRecursively( ... | ALGO | 0.998939 | 5.788326 |
b1e73744-d417-4915-8344-76cb6be85631 | robertwyb/Computer-graphic-assignments | computer-graphics-meshes/libigl/include/igl/boundary_loop.cpp | template <typename DerivedF, typename Index>
IGL_INLINE void igl::boundary_loop(
const Eigen::PlainObjectBase<DerivedF> & F,
std::vector<std::vector<Index> >& L)
{
using namespace std;
using namespace Eigen;
if(F.rows() == 0)
return;
VectorXd Vdummy(F.maxCoeff()+1,1);
DerivedF TT,TTi;
vector<s... | ALGO | 0.996986 | 6.131008 |
4e8200b9-f498-4175-8eb6-42d12f555fcf | sultancodess/leetcode- | C++/non-negative-integers-without-consecutive-ones.cpp | // Time: O(1)
// Space: O(1)
class Solution {
public:
int findIntegers(int num) {
vector<int> dp(32);
dp[0] = 1;
dp[1] = 2;
for (int i = 2; i < dp.size(); ++i) {
dp[i] = dp[i - 1] + dp[i - 2];
}
int result = 0, prev_bit = 0;
for (int i = 30; i >=... | ALGO | 0.999705 | 5.890428 |
4a18b422-7601-4606-8a48-93b4afc8d522 | ishandutta2007/codeforces | never_giveup/normal/635/D.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 2e6;
struct tree{
int va, vb;
};
tree q[maxn];
int a, b, n, zap;
void upd(int v, int l, int r, int k, int val){
if (l == r){
q[v].va = min(val + q[v].va, a);
q[v].vb = min(val + q[v].vb, b);
retur... | ALGO | 0.999639 | 3.757715 |
fba26494-d067-4457-847d-1d3672d24269 | ericisma/mongoDB | src/mongo/db/commands/dbcommands_d.cpp | #include <boost/optional/optional.hpp>
#include <cstring>
#include <memory>
#include <string>
#include <utility>
#include "mongo/base/error_codes.h"
#include "mongo/base/status.h"
#include "mongo/base/status_with.h"
#include "mongo/base/string_data.h"
#include "mongo/bson/bsonelement.h"
#include "mongo/bson/bsonmisc.h... | TOOL | 0.852944 | 7.905969 |
82c44d7f-66c6-4ad4-8951-b87bf1534d30 | ishandutta2007/codeforces | kotatsugame/normal/1679/F.cpp | #include<iostream>
using namespace std;
#include<iostream>
#include<utility>
template<int m>
struct modint{
unsigned int x;
constexpr modint()noexcept:x(){}
template<typename T>
constexpr modint(T x_)noexcept:x((x_%=m)<0?x_+m:x_){}
constexpr unsigned int val()const noexcept{return x;}
constexpr modint&operator++(... | ALGO | 0.999899 | 4.572496 |
dbfea70a-0cae-43a0-bdfe-7efae45b78e4 | dungpv133/CPP-PTIT | CP01011.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int test;
cin >> test;
while(test--)
{
int n;
cin >> n;
int a[n + 9];
for(int i = 0; i < n; i++)
{
cin >> a[i];
}
sort(a, a + n);
int min = 1000000000;
for(int i = 0; i < n; i++)
{
for(int j = i + 1; j < n; j++)
{
int temp ... | ALGO | 0.999931 | 3.63382 |
f7846536-94ef-4256-91ce-b1c26ba543c8 | ysaicll/mysql-8.0.3-rc | extra/yassl/taocrypt/src/rabbit.cpp | #include "runtime.hpp"
#include "rabbit.hpp"
namespace TaoCrypt {
#define U32V(x) (word32)(x)
#ifdef BIG_ENDIAN_ORDER
#define LITTLE32(x) ByteReverse((word32)x)
#else
#define LITTLE32(x) (x)
#endif
// local
namespace {
/* Square a 32-bit unsigned integer to obtain the 64-bit result and return */
/* the up... | ALGO | 0.999654 | 6.157917 |
37e0041f-a81c-48d0-b7e2-c65dd2a8094c | mdrakibulislam-official/urionlinejudge-Solved-problem | URI-1828.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string a,b;
int n,i;
cin>>n;
for(i=0; i<n; i++){
cin>>a>>b;
if(a==b){
cout<<"Caso #"<<i+1<<": De novo!"<<endl;}
else if(a=="tesoura" && b=="papel"){
cout<<"Caso #"<<i+1<<": Bazinga!"<<endl;}
else if(a=="papel" && b=="pedra"){
cout<<"Caso #"<<i+1<<": Bazi... | ALGO | 0.999621 | 3.870289 |
be10d0d5-8e70-4782-a7bf-1af1798d66bf | sky-bro/AC | leetcode.com/0575 Distribute Candies/main.cpp | #include <iostream>
#include <unordered_set>
#include <vector>
using namespace std;
class Solution {
public:
int distributeCandies(vector<int>& candies) {
unordered_set<int> st(candies.begin(), candies.end());
return min(st.size(), candies.size() / 2);
}
}; | ALGO | 0.999224 | 6.008405 |
23f843df-2d0c-4dbd-8b07-3a63a4042c9e | FitriaNovarina/struktur-data | Queue/23081010121_Fitria Novarina_Queue.cpp | #include <stdio.h>
#include <conio.h>
#include <stdlib.h>
// Structure Definitions
struct node
{
int data;
struct node *next;
};
typedef struct node node;
struct queue
{
int count;
node *front;
node *rear;
};
typedef struct queue queue;
// Function Implementations
queue createQueue(void)
{
q... | ALGO | 0.97818 | 5.202552 |
c97b3346-ec15-4ff1-9703-a8d77cae8045 | shelltdf/osgall | prebuild/proj-6.1.1/src/projections/bonne.cpp | #define PJ_LIB__
#include <errno.h>
#include "proj.h"
#include "proj_internal.h"
#include "proj_math.h"
PROJ_HEAD(bonne, "Bonne (Werner lat_1=90)")
"\n\tConic Sph&Ell\n\tlat_1=";
#define EPS10 1e-10
namespace { // anonymous namespace
struct pj_opaque {
double phi1;
double cphi1;
double am1;
doub... | ALGO | 0.98899 | 6.316487 |
3f798458-5b8b-4c1d-95d9-5a21d0724b76 | tonyqua/CppBookTasks | chapter1/task16_17.cpp | #include <iostream>
#include <cmath>
const int size = 10;
void squareOfNaturalNumbers() {
int arr[size];
for (int i = 0; i < 10; ++i) {
arr[i] = pow(i, 2);
}
for (int c = 0; c < 10; ++c) {
std::cout << arr[c] << " ";
}
}
void squareOfTwos() {
int arr[size];
for (int i = 0; i < 10; ++i) {
arr[i] = pow(2... | TOOL | 0.954579 | 4.283284 |
3ffbc429-9cf6-40ce-b067-7265d118ecd8 | PhillipDiCarlo/The-Corruptor | ASRC Systems Simulation Driver/boost_1_74_0/libs/spirit/example/karma/calc2_ast_rpn.cpp | ///////////////////////////////////////////////////////////////////////////////
//
// A Calculator example demonstrating generation of AST which gets dumped into
// a reverse polish notation afterwards.
//
// [ JDG April 28, 2008 ]
// [ HK April 28, 2008 ]
//
////////////////////////////////////////////////////////... | TOOL | 0.953074 | 7.72917 |
2c07d92c-a9a6-4b28-bdee-080bed8f5c6a | kmjp/procon | yuki/2701-2800/2774.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define FORR2(x,y,arr) for(auto& [x,y]:arr)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define ... | ALGO | 0.999829 | 3.212358 |
8c39dc5e-69d6-4725-a8eb-76449f138eb3 | PedroVSD/Maratona | Expressões.cpp | #include <iostream>
#include <stack>
#include <string>
using namespace std;
int main(void){
string expressao;
stack<char> pilha;
cin >> expressao;
for (char c : expressao){
if (c == '(' || c == '[' || c == '{'){
pilha.push(c);
} else if (c == ')' || c == ']' || c == '}'){... | ALGO | 0.999704 | 4.646848 |
a37ba631-dd74-441b-8086-0dccfcda349f | LordGuilberGS/js-symbolic-executor | cvc3/src/search/search_sat.cpp | /*****************************************************************************/
/*****************************************************************************/
#include "search_sat.h"
#ifdef DPLL_BASIC
#include "dpllt_basic.h"
#endif
#include "dpllt_minisat.h"
#include "theory_core.h"
#include "eval_exception.h"
#inc... | ALGO | 0.999853 | 6.24721 |
56f7a74f-02a4-4230-b64e-39139466706a | avinashkkumar/cdsa | cpppractice/star.cpp | #include <iostream>
#include <string>
using namespace std;
int main(){
int n{50};
string s;
for(int i = 1 ; i <= n ; i++ )
{
s="";
for(int k = 0 ; k < (n-i); k++){
s = s + " ";
}
for(int j = 0 ; j < i ; j++){
s = s + "*" ;
}
fo... | ALGO | 0.999971 | 3.493404 |
a7200893-3759-4a4b-8f68-84d3989e2817 | bhushanmarathe/C-And-DSA | Graphs/TopologicalSortUsingDFS.cpp | #include <bits/stdc++.h>
void toposort(int node, vector<bool> &visited, stack<int> &s, unordered_map<int, list<int>> &adjlist)
{
visited[node] = 1;
for (auto neighbour : adjlist[node])
{
if (!visited[neighbour])
{
toposort(neighbour, visited, s, adjlist);
}
}
s... | ALGO | 0.999995 | 5.00816 |
dc50833e-0ac6-493f-b215-ec2ee40d8d79 | ArthurCarmo/mini-cas | script/polynomials/t_monomial_pow.cpp | #include "../../src/include/mini-cas"
#include <cstdlib>
#include <sstream>
using namespace std;
int main(){
stringstream out;
monomial mono(num_q(2), 'x', 1, "z", 3, 'y', 2);
monomial unity(num_q(1), 'x', 2, 'y', 4);
monomial x('x');
out << (mono^num_z(5));
if(out.str() != "32*x^5*y^10*z^15")
exit(EXIT_FA... | ALGO | 0.936868 | 4.400228 |
a91a2002-8147-413b-b65b-5ca38896e334 | Jabed27/C-datastructure-and-algorithm | BFS & DFS/170104054.cpp | #include<bits/stdc++.h>
using namespace std;
int color[1000];
vector<int>v[1000];
stack<int>q;
void DFS(int source){
int a;
color[source] = 1;
for(int i =0;i<v[source].size();i++){
a = v[source].at(i);
if(color[a]==0){
DFS(a);
}
}
q.push(source);
}
int main... | ALGO | 0.999957 | 4.461824 |
86b62a70-2048-4d0f-b8e4-c9e6eb17cc83 | Dishant2001/DSA_Practice | Binary_Search_Trees/delete_node.cpp | //3 possibilities
//Node to be delete is:
//1. Leaf Node(root node or not a root)
//2. Has left
//3. Has only right(root node or not a root)
TreeNode* father(TreeNode* root, TreeNode* q){
TreeNode* p=root;
while(p!=NULL)
{
if(p->left==q||p->right==q)
return p;
... | ALGO | 0.999983 | 4.512704 |
3ffed68a-9736-46e7-8079-b74f4221e15f | KarlsruheMIS/KaMIS | app/online_mis.cpp | /**
* online_mis.cpp
* Purpose: Main program for the online reduction algorithm.
*
*****************************************************************************/
#include <argtable3.h>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include "data_structure/graph_access.h"
#include "data_structure/mis_... | ALGO | 0.956061 | 5.33519 |
bc6f919d-7c04-4824-8fbd-9a815b8ea436 | alps-jbnu/25ALPStudy | 2025-1/Intermediate/zunhyeok/two_pointer/BOJ-2283.cpp | #include <bits/stdc++.h>
using namespace std;
int arr1[1001];
int arr2[1001];
int cnb[1000001];
int main() {
int n, k, max_index = 0;
cin >> n >> k;
for (int i = 0; i < n; i++) {
cin >> arr1[i] >> arr2[i];
max_index = max(arr2[i], max_index);
}
for (int i = 0; i < n; i++) {
for (int j = arr1[i]; j < arr2[i... | ALGO | 0.999993 | 4.175203 |
74565452-9081-4fa9-9e3f-3aea9df4e7fc | cjsoft/inasdfz | d0701/7.1/source/成都七中-tangyuhao/data.cpp | #include <cstdio>
#include <algorithm>
using namespace std;
#define mod 998244353
int n,m,k,t[10][10],T,a[10009],l,r,x,ans,type,s[10];
int main(){
freopen("data.in","r",stdin);
freopen("data.out","w",stdout);
scanf("%d",&T);
while(T--){
scanf("%d%d%d",&n,&k,&m);
for (int i=1;i<=n;i++){
scanf("%d",&a[i]);
... | ALGO | 0.999472 | 4.177235 |
1ed26ecb-7eb4-4a0e-b6cf-bd05522368ae | alexandraback/datacollection | solutions_5639104758808576_1/C++/yajun/A.cpp | # include <stdio.h>
const int maxn = 1005;
int S;
char s[maxn];
# define testin freopen("A-large.in", "r", stdin)
# define testout freopen("out.txt", "w", stdout)
int main()
{
testin;
testout;
int T;
scanf("%d", &T);
for (int ica = 1; ica <= T; ++ica) {
scanf("%d%s", &S, s);
int... | ALGO | 0.998931 | 3.80001 |
e5c10bb2-0aa1-4942-aad0-8ac696358778 | klotte/boost | src/boost_1_44_0/libs/fusion/example/performance/inner_product.cpp | #include <boost/array.hpp>
#include <boost/timer.hpp>
#include <boost/fusion/algorithm/iteration/accumulate.hpp>
#include <boost/fusion/algorithm/transformation/transform.hpp>
#include <boost/fusion/container/vector.hpp>
#include <boost/fusion/algorithm/transformation/zip.hpp>
#include <boost/fusion/sequence/intrinsic... | TEST | 0.996137 | 6.233133 |
ef0bfcdb-5667-484c-8b14-eba53e0a8315 | Anirudh257/Leetcode_Solutions | 1312-minimum-insertion-steps-to-make-a-string-palindrome/striver_space_optimized_bottom_up_dp_approach.cpp | // Preserve palindromic part and just repeat the non-palindromic part.
// Time complexity: O(n^2), Space complexity: O(n)
class Solution {
public:
int minInsertions(string s) {
int len = s.length();
return len - lps(s);
}
private:
int lps(string& s) {
int len = s.length();
s... | ALGO | 0.999997 | 6.550732 |
8e2d803d-891d-4e39-bd8c-56d19b406c9f | THU-DSP-LAB/llvm-project | bolt/lib/Passes/LoopInversionPass.cpp | #include "bolt/Passes/LoopInversionPass.h"
#include "bolt/Core/ParallelUtilities.h"
using namespace llvm;
namespace opts {
extern cl::OptionCategory BoltCategory;
extern cl::opt<bolt::ReorderBasicBlocks::LayoutType> ReorderBlocks;
static cl::opt<bool> LoopReorder(
"loop-inversion-opt",
cl::desc("reorder unc... | ALGO | 0.988765 | 7.73289 |
0537e504-5f1b-4f6a-8e7c-2cbc65fe292f | ishandutta2007/codeforces | a_g/normal/1702/G2.cpp | #include <bits/stdc++.h>
using namespace std;
const int N = 2e5+7;
const int K = 20;
vector<int> G[N];
int depth[N], tin[N], tout[N];
int par[N][K];
int timer = 0;
void dfs(int v, int p) {
par[v][0] = p;
for (int i = 1; i < K; i++) {
par[v][i] = par[par[v][i-1]][i-1];
}
tin[v] = timer++;
for (int u: G[v... | ALGO | 0.999993 | 4.661806 |
a03d203a-6c83-492c-a34a-0a14bcd9f0de | tushar-kamra/Data-Structures-and-Algorithms | cpp/graph/directedGraph.cpp | #include<iostream>
#include<vector>
using namespace std ;
class Edge {
public :
int v = 0 ;
int w = 0 ;
Edge(int v, int w){
this->v = v ;
this->w = w ;
}
};
vector<vector<Edge*>> graph(7, vector<Edge*>()) ;
void addEdge(int u, int v, int w){
if(u<0 || ... | ALGO | 0.998686 | 4.726888 |
ad4ee723-548d-4341-acec-bc7b698dd1e2 | iosphere/libspatialite-android | jni/geos-3.5.0/src/operation/predicate/SegmentIntersectionTester.cpp | #include <geos/operation/predicate/SegmentIntersectionTester.h>
#include <geos/geom/LineString.h>
#include <geos/geom/CoordinateSequence.h>
#include <geos/algorithm/LineIntersector.h>
using namespace geos::geom;
namespace geos {
namespace operation {
namespace predicate {
bool
SegmentIntersectionTester::hasIntersect... | TEST | 0.967218 | 6.861271 |
07af0a11-403c-43ab-afe4-6c07cbe3af9b | Abhinav7076/My-Codes | LeetCode-Solutions-master/C++/reverse-substrings-between-each-pair-of-parentheses.cpp | // Time: O(n)
// Space: O(n)
class Solution {
public:
string reverseParentheses(string s) {
vector<int> stk;
unordered_map<int, int> lookup;
for (int i = 0; i < s.length(); ++i) {
if (s[i] == '(') {
stk.emplace_back(i);
} else if (s[i] == ')') {
... | ALGO | 0.999966 | 6.165928 |
20a27bbd-7d5b-48db-84c7-e06291d49d8a | 1092772959/search_engine | index_builder_reordering.cpp | //
// Created by xiuwenli on 12/18/21.
//
#include <iostream>
#include <string>
#include <fstream>
#include "component/CoreBuilder.h"
#include "component/doc_reordering/BlandfordBlelloch.h"
#include <gflags/gflags.h>
DEFINE_int32(encode_mode, 0,
"Default encoding format for intermediate files, 0 for bina... | DATA | 0.888786 | 5.332129 |
36088b63-0ec8-4f97-9e41-6cd78e1a221d | april211/SDUSTOJ_CPP_2020 | FHY/Homework/H_11/ProblemA分数类的输出.cpp | #include <bits/stdc++.h>
using namespace std;
class Fract
{
protected:
int n$, m$;
public:
Fract(int n, int m) : n$(n), m$(m)
{
if(m$ < 0){ m$ *= -1, n$ *= -1;}
int gcd, num1 = abs(n$), num2 = abs(m$);
gcd = __gcd(num1, num2);
n$ /= gcd, m$ /= gcd;
}
operator double(... | ALGO | 0.998893 | 4.815457 |
548b2ca6-463c-4cb5-a5a0-84089db8f4ab | fidus58/philos | philos/main.cpp | #include <thread>
#include <vector>
#include <chrono>
#include <iostream>
std::mutex forks[5];
void philo(int i) {
for (int n=0; n<10;++n) {
forks[ i ].lock();
std::cout<<"fork "<<i<<" locked\n";
std::this_thread::sleep_for(std::chrono::milliseconds(10));
forks[(i+1)%5].lock();... | TOOL | 0.98558 | 3.97642 |
bf9ea612-d9f0-4766-b0d0-09d63b528c1d | abracren/ski | frameworks/js-bindings/cocos2d-x/cocos/math/Vec2.cpp | #include "math/Vec2.h"
#include "math/MathUtil.h"
#include "base/ccMacros.h"
NS_CC_MATH_BEGIN
// returns true if segment A-B intersects with segment C-D. S->E is the ovderlap part
bool isOneDimensionSegmentOverlap(float A, float B, float C, float D, float *S, float * E)
{
float ABmin = std::min(A, B);
float A... | TOOL | 0.957714 | 7.016965 |
306c5d54-3fed-425f-bc94-3f70a54036fc | XAlearnerer/LeetCode | Tree/102.BinaryTreeLevelOrderTravseval_二叉树层次遍历.cpp | //
// Created by zhao on 18-12-21.
//
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode(int x) : val(x), left(NULL), right(NULL) {}
};
class Solution2 {
public:
vector<vector<int>> levelOrder(TreeNode*... | ALGO | 0.999679 | 6.125249 |
5261f7d4-3cde-47b1-8887-aa5a412089e7 | Bulrock/Flutter_BG_Processes | 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 |
6e6ad466-19a8-43dd-affc-a263d8b4a599 | sinian666/codes_41_15 | cpp_副本6/chapter_tree/binary_tree.cpp | /**
* File: binary_tree.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* Driver Code */
int main() {
/* 初始化二叉树 */
// 初始化节点
TreeNode *n1 = new TreeNode(1);
TreeNode *n2 = new TreeNode(2);
TreeNode *n3 = new TreeNode(3);
TreeNode *n4 = new TreeN... | ALGO | 0.995519 | 5.482699 |
fdeaf11c-ba25-45a1-b549-aeadafb62f47 | vaibhavv96321/DS_Algo_Cpp | String(Q47-Q89)/Q52.cpp | #include<iostream>
#include<string.h>
using namespace std;
int main()
{
char ch[100],ch1[100],ch2[100];
cout<<"enter string : ";
gets(ch);
int t=strlen(ch);
cout<<"Enter another string :";
gets(ch1);
int s=strlen(ch1);
cout<<"enter final string :";
gets(ch2);
int u=strlen(ch2);
... | ALGO | 0.999544 | 3.299477 |
9d682386-6c8f-4002-9804-fa2316b47e6f | GutnikElina/OAIP | lab_3/zad/zad_1_3.4/zad_1_3(4).cpp | #include<stdio.h>
#include<locale.h>
#include<math.h>
int main()
{
setlocale(LC_ALL, "Rus");
int n, m, B=1, i=0;
printf(" m: ");
scanf_s("%d.", &m);
printf(" n: ");
scanf_s("%d.", &n);
while (i <= n)
{
B *= (m + i);
++i;
}
printf(" : %d.\n", B);
return 0;
}
/*B=m*(m+1)*...*(m+n)*/ | ALGO | 0.999848 | 3.342837 |
2ce4c7ff-a795-403c-b1e3-2226d650b722 | Alvee78/Codeforces | CodeForces/1000/B_Points_on_Plane.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
int main(){
long long int n,t,c;
cin>>t;
while (t--)
{
cin>>n;
c=sqrt(n-1ll)+2;
while(c*c>=n){
c--;
}
cout<<c<<endl;
}
return 0;
} | ALGO | 0.999783 | 4.10893 |
3d739b01-5476-413f-bf33-70f0a6eeba86 | himanshu111203/Leetcode | 2D Array/3446. Sort Matrix by Diagnols (Medium).cpp | class Solution {
public:
vector<vector<int>> sortMatrix(vector<vector<int>>& grid) {
int n=grid.size();
for(int i=n-2;i>=1;i--){
vector<int>arr;
int a=0,b=i;
while(b<n){
arr.push_back(grid[a++][b++]);
}
sort(arr.begin(),arr.... | ALGO | 0.999998 | 5.911289 |
c2515bb5-cc57-4f9d-98f0-d5800a93664d | LeKSuS-04/Competitive-Programming | UVa-problems/314.cpp | /* UVa 314 - Robot */
// https://onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=677&page=show_problem&problem=250
// Date: 2021-08-29 09:03:34
// Runtime: 0.020
// Verdict: AC
#include <iostream>
#include <queue>
#include <tuple>
#include <vector>
using namespace std;
const int INF = 1e9;
const in... | ALGO | 0.998978 | 4.831928 |
1cb81fe3-f514-4484-ba86-396b852429d3 | areian13/PS_BOJ | 4. Platinum/Platinum 4/[P4] 03679 단순 다각형.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#define FastIO ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr)
using namespace std;
struct Point
{
int x, y, i;
static int CCW(const Point& a, const Point& b, const Point& c)
{
long long ccw = (long long)(b.x - a.x)... | ALGO | 0.999991 | 4.683394 |
b356dc15-19b0-4245-bf98-1a7b0c2374c8 | Mlagithub/CppStudy | template/terminalExpr/main.cpp |
#include "matrix.h"
#include <iostream>
#include <ctime>
using namespace std;
int main(void){
Matrix<double, 1, 3> em;
Matrix<double, 3, 1> fm;
Matrix<double, 1, 3> gm;
Matrix<double, 3, 1> km;
float count = 1;
for(auto it=em.begin(), jt=fm.begin(), kt=gm.begin(), pt=km.begin();
... | ALGO | 0.994203 | 3.081668 |
6fde96ed-4eab-4b1f-bf5d-87f26cb83df7 | metahashorg/v8_vm | third_party/icu/source/tools/toolutil/udbgutil.cpp | #include "udbgutil.h"
#include <string.h>
#include "ustr_imp.h"
#include "cmemory.h"
#include "cstring.h"
#include "putilimp.h"
#include "unicode/ulocdata.h"
#include "unicode/ucnv.h"
#include "unicode/unistr.h"
#include "cstr.h"
/*
To add a new enum type
(For example: UShoeSize with values USHOE_WIDE=0, USHOE_... | TOOL | 0.873497 | 4.940895 |
8850ae98-f61e-44f1-820c-08c324acf709 | Saltykub/CP | Atcoder/Dp contest/vacation.cpp | #include<bits/stdc++.h>
#define ll long long
#define st first
#define pii pair<ll,ll>
#define nd second
#define pb push_back
using namespace std;
bool CASE = false;
void solve (){
int n;
cin >> n;
vector<vector<int>> v(n,vector<int>(3)), dp(n,vector<int>(3,0));
for(int i = 0; i < n ;i++)for(int j = 0; j <... | ALGO | 0.999838 | 4.172198 |
93cefb39-390c-4865-82d4-b9805cb03248 | harmonh/CS-Projects | Intro to CS/Assignments/exercise_5_2.cpp | /*********************************************************************************
**Program: exercise_5_2.cpp
**Author: Holly Harmon
**Description: From Exercise Set 5, Question 2. This program excepts two strings
from the user and tells them if the strings are the same or not.
**Input: User inputs two strings.
**Out... | ALGO | 0.993738 | 5.497648 |
0cf046bc-cde2-4c07-8a2e-4b1b2b580591 | bmjones92/Kattis | Solutions/chess/chess.cpp | /**
* Solution to the "Chess" problem on Kattis.
* @author Brendan Jones
*/
#include <cmath>
#include <cstdint>
#include <iostream>
#include <vector>
/* The possible colors of each tile. */
enum class Color {
Black,
White
};
/* The row and column of a tile. */
struct Tile {
uint8_t col;
uint8_t row... | ALGO | 0.999544 | 5.378532 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.