uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
73804a82-1e00-4ad2-8d64-cedf24726d88 | fantasydreams/findwork | bazelProject/leetcode/List/61.RotateList.cpp | #include "61.RotateList.h"
#include "linkcomm.h"
#include <cstddef>
int getListLen(ListNode* head) {
int ans = 0;
while(head) {
++ans;
head = head->next;
}
return ans;
}
ListNode* getListKthNode(ListNode* head, int k) {
k-=1;
while(head && k > 0) {
head = head->nex... | ALGO | 0.999816 | 5.390265 |
332904c9-9c23-440e-a86f-a79e56188377 | kgm423423/c | Workspace/과제/과제190(블로그).cpp | #include <stdio.h> //fin
#include <queue>
using namespace std;
int main()
{
int i;
int n,m;
int sum = 0;
int maxSum;
int sumCount = 1;
queue<int> q;
scanf("%d %d", &n, &m);
//迭 Է¹ޱ
int arr[n];
for(i=0;i<n;i++)
scanf("%d", &arr[i]);
//⺻ Է
for(i=0;i<m;i++... | ALGO | 0.999965 | 3.316544 |
7491b2db-5dbe-45ca-a650-ed04477b46e5 | CarryMachineGun/Syracuse_U | 21fall/21f_CIS554_cpp/HW/HW_1/bubbleSortTest.cpp | #include <iostream>
void printArray(int arr[], int size){
int i;
for (i = 0; i < size; i++)
std::cout << arr[i] << " ";
std::cout << std::endl;
return;
}
void bubbleSort(int arr[], int size){
int dummy = 0;
for(int i = size - 1 ; i >=0; i--){
for(int j = 0; j < i; j++){
... | ALGO | 0.998728 | 4.649509 |
65d7e2f0-42b3-4251-899f-59c9990a1cfc | big-quantum/all_code | code/苹果和虫子.cpp | #include<bits/stdc++.h>
using namespace std;
int n,x,y;
int main(){
cin >> n >> x >> y;
cout << ( n * x - y ) / x << endl;
return 0;
}
| ALGO | 0.998144 | 3.271936 |
07ae9191-efb8-43ee-bba2-0f595baef14d | shreyxnsh/flutter-template-code | 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.9988 | 6.76073 |
957b92ed-3ec9-4e5a-94f8-fb173e8666f3 | Ruki2626/Data-Structure-and-Algorithm | code jam 3_1/My_program.cpp | #include <iostream>
#include <queue>
using namespace std;
int main() {
int tc;
cin >> tc;
for(int i=0;i<tc;i++) {
int n,k;
std::priority_queue<int> loc;
cin >> n >> k;
int j=1, ls, rs;
int curr = n;
while(j<=k && curr>0) {
if(!loc.empty()) {... | ALGO | 0.999915 | 4.251713 |
9ba52ade-1851-4a6e-bac7-07d21a527b6a | thloc2905/thanhloc.github.io | Programming Skills/DefusetheBomb.cpp | #include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
vector<int> decrypt(vector<int>& code, int k) {
int n = code.size();
vector<int>resul(n,0);
if( k == 0){
return resul;
}
for(int i = 0 ; i< n;i++){
... | ALGO | 0.999997 | 4.306173 |
7f26a467-0558-446e-a513-8ead76fc7ca9 | rcedgar/newick | src/fixft.cpp | #include "myutils.h"
#include "newickparser2.h"
#include "tree2.h"
uint NewickParser2::FixFT()
{
if (IsBinary())
return 0;
vector<vector<uint> > Edges;
GetNonParentEdges(Edges);
const uint NodeCount = GetNodeCount();
asserta(SIZE(Edges) == NodeCount);
asserta(m_Root < NodeCount);
uint DupeCount = 0;
vecto... | DATA | 0.853868 | 4.943945 |
e48565e2-a4ff-41eb-935b-ff80ea1d1405 | ishandutta2007/codeforces | brunovsky/normal/1625/C.cpp | #include <bits/stdc++.h>
#ifdef LOCAL
#include "code/formatting.hpp"
#else
#define debug(...) (void)0
#endif
using namespace std;
void setmin(int64_t& a, int64_t b) { a = min(a, b); }
int main() {
ios::sync_with_stdio(false), cin.tie(nullptr);
int N, L, K;
cin >> N >> L >> K;
vector<int> d(N + 1), a(... | ALGO | 0.999781 | 3.613598 |
60f8fae5-23ee-49d7-907d-07c206cd3e80 | linkeLi0421/no-remove-no-reorder | llvm/lib/ProfileData/ProfileSummaryBuilder.cpp | #include "llvm/IR/Attributes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Type.h"
#include "llvm/ProfileData/InstrProf.h"
#include "llvm/ProfileData/ProfileCommon.h"
#include "llvm/ProfileData/SampleProf.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CommandLine.h"
usin... | TOOL | 0.920905 | 7.817976 |
9e931d5e-8ce6-4aa5-8df3-7bf1ae16ae9c | Articulated19/ultra-vision_18 | lane-obj-detection.cpp | #include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
using namespace std;
Point GetWrappedPoint(Mat M, const Point& p);
void calcHugh(Mat gIPM, Mat mFram, Mat Ipm, Mat IpmInv);
vector<Mat> applIPM (Mat raw, Mat frame);
VideoWriter video;
#define VIDEO_INPUT "/home/qwe/aprojs/kand... | ALGO | 0.996987 | 3.717677 |
7365f554-97a0-42a5-ba5a-bcfd2b4a4a48 | MohamedLemine43175820/user_app | windows/runner/utils.cpp | #include "utils.h"
#include <flutter_windows.h>
#include <io.h>
#include <stdio.h>
#include <windows.h>
#include <iostream>
void CreateAndAttachConsole() {
if (::AllocConsole()) {
FILE *unused;
if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
_dup2(_fileno(stdout), 1);
}
if (freopen_s(&unuse... | TOOL | 0.998733 | 6.76775 |
9d2f9633-8ee6-401f-89bd-7dc243cc106a | dflorezs/competitive_programming | omegaUp/introduction_to_programming/5_bubulu_cuantos_instructores_hay/bubulu_cuantos_instructores_hay.cpp | #include <iostream>
#include <string>
using namespace std;
void solve(string str);
int main(){
string input;
getline(cin, input);
solve(input);
return 0;
}
void solve(string str){
int count = 1;
for (int i = 0; i < str.length(); i++) if (str[i] == ' ') count ++;
cout<<count;
}
| ALGO | 0.999093 | 3.536115 |
2b4613bc-d278-48fc-bb8e-8238ee0dbfb0 | charlierance/Highway_Path_Planner | src/Eigen-3.3/doc/examples/Tutorial_BlockOperations_vector.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
int main()
{
Eigen::ArrayXf v(6);
v << 1, 2, 3, 4, 5, 6;
cout << "v.head(3) =" << endl << v.head(3) << endl << endl;
cout << "v.tail<3>() = " << endl << v.tail<3>() << endl << endl;
v.segment(1,4) *= 2;
cout << "after 'v.segment(1,4) *= 2', v... | ALGO | 0.991054 | 3.081962 |
b0b2bd5c-0875-48ce-87b9-35dc805fa486 | BDAKOREA98/DX_2023_ABD | 2023_windowApi/Algorythm/DFS.cpp | #include <iostream>
#include <vector>
#include <list>
#include <unordered_map>
#include <map>
#include <algorithm>
#include <stack>
#include <deque>
#include <queue>
using namespace std;
vector <vector<bool>> adjacent;
vector<bool> visited;
void CreateGraph() {
adjacent = vector<vector<bool>>(7, vector<bool>(7, fal... | ALGO | 0.999841 | 3.499077 |
fec08dbe-481d-40ff-9c9a-0c17dbdf0f2b | nandrehetan/CP-Solutions | CodeForces/GNU C++17/598A | Tricky Sum/174285347.cpp | #include <bits/stdc++.h>
#include<math.h>
using namespace std;
#define ll long long
#define ASCII_SIZE 256
//Hetan Nandre's code
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
#ifndef ONLINE_JUDGE
// for getting input from input.txt
freopen("input.txt", "r", stdin);
// for writing output... | ALGO | 0.999883 | 5.130814 |
da013265-7233-4cd5-801d-9401d04602cd | echoct21/BoidsAlgorithm | Source/Flocking/FlockingManager.cpp | #include "FlockingManager.h"
#include "Agent.h"
#include "Math/Vector.h"
#include <cmath>
#define AGENT_COUNT 10
void UFlockingManager::Init( UWorld *world, UStaticMeshComponent *mesh ) {
UE_LOG(LogTemp, Warning, TEXT("MANAGER INIT"));
World = world;
float incr = (PI * 2.f) / AGENT_COUNT;
for( int i = 0; i < A... | ALGO | 0.973338 | 4.473889 |
100b66d5-d48a-4345-83fc-c0dd2c22fda7 | alexandraback/datacollection | solutions_5765824346324992_0/C++/IwfWcf/b.cpp | #include <stdio.h>
#include <stdint.h>
#include <algorithm>
using namespace std;
uint64_t gcd(uint64_t a, uint64_t b)
{
uint64_t max = std::max(a, b);
uint64_t min = std::min(a, b);
if (max % min != 0)
{
return gcd(min, max % min);
}
return min;
}
int main()
{
int t;
scanf("%d... | ALGO | 0.999974 | 3.582298 |
b67e981e-431d-4cb3-9733-546d2bcf5c48 | brucelevis/leetcode | Integer to Roman .cpp | #include <iostream>
#include <map>
using namespace std;
//ҪǴǰǴӺǰ
//
#if 1
class Solution {
public:
string intToRoman(int num) {
map<int,string> mp;
mp[1] = "I"; mp[5] = "V";
mp[10] = "X"; mp[50] = "L";
mp[100] = "C"; mp[500] = "D";
mp[1000] = "M";
string ret;... | ALGO | 0.999564 | 5.214257 |
2bcdf15a-5120-4b35-85ea-8e225a24786e | samuelzq/code_for_OI_lesson | 043 数组(二)/init.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
// 使用初始化列表初始化 vector
vector<int> vec = {1, 2, 3, 4, 5};
// 输出 vector 元素
for (int i = 0; i < vec.size(); ++i) {
cout << vec[i] << " "; // 输出:1 2 3 4 5
}
return 0;
}
| ALGO | 0.971869 | 4.126639 |
c3089e79-263f-4ea9-9bbe-776c0420d7f6 | jpc9330/dragonfly-clean | system/src/LinearRegression.cpp | /*
* LinearRegression.cpp
*
* Created on: Sep 15, 2021
* Author: cbothra
*/
#include "LinearRegression.h"
#include <stdio.h>
#include <algorithm>
#include <fstream>
#include <functional>
#include <iostream>
#include <numeric>
#include <random>
#include <gflags/gflags.h>
#include "Util.h"
DEFINE_int32(Ra... | DATA | 0.89861 | 5.836254 |
ed403b4c-5186-4499-a9b5-9ea59d938d0a | pramodkumar5921/DSA | C. Rumor.cpp | #include<bits/stdc++.h>
using namespace std;
long long dfs(vector<long long>&vis,unordered_map<long long,vector<long long>>&mp,long long node,vector<long long >&arr){
long long ans=arr[node-1];
vis[node]=1;
for(auto child:mp[node]){
if(vis[child]==0){
ans = min(ans,dfs(vis,mp,child,arr))... | ALGO | 0.999915 | 3.899806 |
0d47255c-a187-4438-ab7f-30bd8c535077 | CHNG7/Apriori-and-FP-growth-algorithm | DM_ass1/assignment_1/rule_mining_apriori.cpp | #include <bits/stdc++.h>
#include "apriori.h"
#include "input_reader.h"
#include "test1.h"
#include "outputWriter.h"
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int support,confidence;
cout<<"enter support and confidence "<<endl;
cin>>support>>confidence;
input_reader inp("gr... | DATA | 0.942041 | 4.239444 |
4ced0cf8-12fd-4cef-9c38-6fad8bdfe37f | ArjavPurohit02/Assignment_M4 | Templates/1_swap the two values using template.cpp | /*Write a program of to swap the two values using template*/
#include <iostream>
// Template function to swap two values of any type
template <typename T>
void swapValues(T& a, T& b) {
T temp = a;
a = b;
b = temp;
}
int main() {
int int1 = 5, int2 = 10;
double double1 = 3.14, double2 = 6.28;
... | ALGO | 0.999143 | 6.244028 |
8184c6b0-a3e0-4f21-a9d2-ef0f3137c043 | basnetsoyuj/competitive-programming | leetcode/1329. Sort the Matrix Diagonally/main.cpp | #include <bits/stdc++.h>
using namespace std;
// O(n^2 log n) time
// O(n) space
class Solution
{
public:
vector<vector<int>> diagonalSort(vector<vector<int>> &mat)
{
priority_queue<int> pq;
for (int i = 0; i < mat.size(); i++)
sort(mat, i, 0, pq);
for (int i = 1; i < mat... | ALGO | 0.999964 | 5.356272 |
62b2e345-16b0-4dda-8adb-963534c7795a | Altudy/Solution-Chanwoo | SW_Academy/SW_9280.cpp | /* #lev2 #큐 #구현 */
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <string>
#include <deque>
#include <map>
#include <iomanip>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstdint>
#include <cstring>
//#pragma warning(disable:4996)
using namespace std;
/** Ty... | ALGO | 0.999871 | 3.743089 |
fc58a941-b356-4081-b878-370b45d8f3b4 | daocrossover/Leetcode-Cpp | 215. Kth Largest Element in an Array/Solution1.cpp | // 215. Kth Largest Element in an Array
// Description:
// Given an integer array nums and an integer k, return the kth largest element in the array.
// Note that it is the kth largest element in the sorted order, not the kth distinct element.
// Example 1:
// Input: nums = [3,2,1,5,6,4], k = 2
// Output: 5
// Exampl... | ALGO | 0.999991 | 6.020939 |
eb504fda-30a8-4c88-b789-46635844f3eb | KaranSaharan91/CSES_Problem_Sets | Array_Description.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
ll mod = 1e9+7;
ll helper(vector<int> &arr, int id, int pr, int m, vector<vector<ll> >&dp){
if(id == arr.size())return 1;
if(pr != -1 and dp[id][pr] != -1)return dp[id][pr];
if(arr[id] == 0){
if(pr == -1){
ll ans = 0;
... | ALGO | 0.999998 | 4.342762 |
249ee590-8768-41ac-bfb6-2c1e291d6c04 | rootkonda/LeetCode | 503. Next Greater Element II.cpp | /*
Given a circular array (the next element of the last element is the first element of the array), print the Next Greater Number for every element. The Next Greater Number of a number x is the first greater number to its traversing-order next in the array, which means you could search circularly to find its next great... | ALGO | 0.999971 | 5.301502 |
b4102e29-c350-41c4-ace9-4c58a2d79109 | tde-nico/cses | sorting_and_searching/apartments/main.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int N, M, K;
cin >> N >> M >> K;
vector<int> n(N);
for (int i = 0; i < N; ++i)
cin >> n[i];
vector<int> m(M);
for (int i = 0; i < M; ++i)
cin >> m[i];
sort(n.begin(), n.end());
sort(m.begin(), m.end());
int cnt = 0, i = 0, j = 0;
while (i < N ... | ALGO | 0.999959 | 3.638675 |
f70ff38f-264c-482b-85ab-4614f69f0afb | EmanuelButoiGit/hacker-rank-c-solutions | C++ problems/Preprocessor Solution.cpp | /* Enter your macros here */
#define INF 10000
#define foreach(v, i) for(int i=0; i<v.size(); i++)
#define FUNCTION(name, op) void name(int& a, int b) { if (b op a) a = b; }
#define io(v) cin>>v
#define toStr(Result) "Result ="
#include <iostream>
#include <vector>
using namespace std;
#if !defined toStr || !defined... | ALGO | 0.999952 | 4.275344 |
7b2c9ec5-cb58-4c43-8124-40b7bfbce9d3 | jay256/codechef | cpp_algo/bst.cpp | #include<iostream>
#include<cstdlib>
#define NULL 0
template<class T>
class TreeNode{
friend class BSTree;
private:
TreeNode *lChild,*rChild;
T data, int leftSize;
};
template<class T>
class BSTree{
private:
TreeNode *tree;
TreeNode *Search(TreeNode *t, T x);
public:
BSTree(){
tree=NULL;
}
~BSTre... | ALGO | 0.999156 | 3.476904 |
9f1b9de9-2989-4e82-8bdf-28509e2f5d46 | sarvex/leetcode-bash | solution/1100-1199/1177.Can Make Palindrome from Substring/Solution.cpp | class Solution {
public:
vector<bool> canMakePaliQueries(string s, vector<vector<int>>& queries) {
int n = s.size();
int cnt[n + 1][26];
memset(cnt, 0, sizeof cnt);
for (int i = 1; i <= n; ++i) {
int j = s[i - 1] - 'a';
for (int k = 0; k < 26; ++k) {
... | ALGO | 0.999976 | 6.100263 |
c7d5332c-233f-4fe8-851e-195bd23c0bcf | ApexScorpion/C-primer | section1/exercises/section1.5.cpp | /*Exercise 1.5: We wrote the output in one large statement.
Rewrite the program to use
a separate statement to print each operand
*/
#include <iostream>
int main()
{
std::cout << "Enter two numbers:" << std::endl;
int v1 = 0, v2 = 0;
std::cin >> v1 >> v2;
std::cout << "The product of ";
std::cout ... | TOOL | 0.990942 | 5.481355 |
0592e8f9-305b-426b-85b4-ebff230d0bdd | High-Quality-Coffee/CODEUP_BASIC_C | 1097_30165206(AC).cpp | //#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
//#include <cmath>
using namespace std;
int main() {
int n, x, y;
int ar[19][19] = {};
for (int i = 0; i < 19; i++) {
for (int j = 0; j < 19; j++) {
cin >> ar[i][j];
}
}
cin >> n;
for (int i = 0; i < n; i++) {
cin >> x >> y;
for (int a = 0... | ALGO | 0.999489 | 3.212485 |
04a9f222-a086-47c8-9d38-6495c73a7eb3 | grzegorz2047/UAMRepo | PPR/ppr24.cpp | #include <iostream>
#include <math.h>
using namespace std;
int pitagC(int a, int b){
return ceil(sqrt(pow(a,2) + pow(b,2)));
}
int main(){
int tries = 0;
cin>> tries;
for(int i= 0; i < tries; i++ ){
int a, b, c = 0;
cin>>a>>b;
c = pitagC(a,b);
cout << c<< " ";
double min = f;
if(s < ... | ALGO | 0.999366 | 3.567622 |
cea484ce-c2d8-4f86-832c-9c793f896f9d | raincross7/code-similarity | codes/train_code/problem266/problem266_142.cpp | # include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define pii pair<ll,ll>
typedef long long ll;
ll n,p,arr[55],memo[55][1005];
ll f(ll idx,ll sum){
if(idx==n+1){
if(sum==p) return 1;
return 0;
}
if(memo[idx][sum]!=-1) ... | ALGO | 0.999995 | 3.436827 |
9aba1b87-f77b-4e5d-bd6f-cd9c21bc7303 | InwooLeeme/Algorithm | Boj/1339.cpp | #pragma GCC target("avx,avx2,fma")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
#include <ext/rope>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
using namespace std;
using name... | ALGO | 0.999778 | 4.890534 |
a96b4187-db03-4260-a80b-d0f584b252e3 | AymanYouss/Competitive-Programming | cses/increasingarray.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
int a[200005];
for (int i=0;i<n;++i){
cin >> a[i];
}
long long res = 0;
for (int i=0;i<n-1;++i){
if (a[i]>a[i+1]){
res += a[i] - a[i+1];
a[i+1] = a[i];
}
}
... | ALGO | 0.999936 | 3.722705 |
682708f9-c150-4e7d-b107-9dc60c633f4c | DWWC-22BCSKPIT-901/day-4-assignment-MuskanSaii | day4/easy1.cpp | #include <iostream>
#include <queue>
using namespace std;
int countStudents(vector<int>& students, vector<int>& sandwiches) {
queue<int> studentQueue, sandwichQueue;
int count = 0;
for (int student : students) {
studentQueue.push(student);
}
for (int sandwich : sandwiches) {
sandwic... | ALGO | 0.999984 | 5.505812 |
1e51b982-6fbb-49b8-b583-77ac04558d05 | matumoto1234/cp-crawler | AtCoder/arc110/arc110_b/18592341.cpp | // detail: https://atcoder.jp/contests/arc110/submissions/18592341
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
//#include <boost/multiprecision/cpp_int.hpp>
using namespace std;
using ll = long long;
//using ll = boost::multiprecision::cpp_int;
ll llpow(ll a,ll e){
if(e==0){
retu... | ALGO | 0.999856 | 4.711761 |
d0aa5230-4f35-486f-a67b-477c23fae1f8 | aaakshit/Leetcode-solutions | 53-maximum-subarray/53-maximum-subarray.cpp | class Solution {
public:
int maxSubArray(vector<int>& nums) {
int sum=0,mx=INT_MIN;
for(int i=0;i<nums.size();i++){
sum+=nums[i];
mx=max(mx,sum);
if(sum<0)
sum=0;
}
return mx;
}
}; | ALGO | 0.99997 | 6.227445 |
43193294-079a-410b-b28b-65fe6eba57b9 | ash-al1/Osprey | src/FFTProcessor.cpp | #include "FFTProcessor.h"
#include <pffft.h>
#include <iostream>
#include <cmath>
#include <algorithm>
#include <cstring>
FFTProcessor::FFTProcessor(int fft_size)
: setup_(nullptr)
, fft_size_(fft_size) {
// Initialize PFFFT for real to complex forward FFT
setup_ = pffft_new_setup(fft_size, PFFFT... | ALGO | 0.964073 | 6.156538 |
e6b55ebf-0a85-450b-97dc-f601010e9110 | khemendra08/CPP-Practice | Array/four_sum.cpp | #include<iostream>
#include<vector>
using namespace std;
int main(){
vector<int>arr{10,20,30,40,50,60};
int sum = 100;
for(int i=0; i<arr.size(); i++){
int element1 = arr[i];
for(int j=i+1; j<arr.size(); j++){
int element2 = arr[i];
for(int k=j+1; k<arr.size(); k+... | ALGO | 0.999542 | 3.407125 |
404faabe-c487-4319-b1ac-d696a72232e6 | whchung/llvm-project-9110 | libcxx/test/std/algorithms/alg.nonmodifying/alg.count/count.pass.cpp | // <algorithm>
// template<InputIterator Iter, class T>
// requires HasEqualTo<Iter::value_type, T>
// constexpr Iter::difference_type // constexpr after C++17
// count(Iter first, Iter last, const T& value);
#include <algorithm>
#include <cassert>
#include "test_macros.h"
#include "test_iterators.h"
#if TE... | TEST | 0.94988 | 6.994045 |
aba3722c-c960-43c1-b853-8fee4e38032b | jzplp/Cpp-Primer-Answer | Chapter-1/1.18.cpp | #include<iostream>
int main()
{
int currVal = 0, val = 0;
if(std::cin >> currVal)
{
int cnt = 1;
while(std::cin >> val)
{
if(val == currVal)
++cnt;
else {
std::cout << currVal << " occurs " << cnt << " times"<<std::endl;
currVal = val;
cnt = 1;
}
}
std::cout << currVal << " occurs... | ALGO | 0.999795 | 3.486181 |
960970df-e98d-44cf-855e-b1141491e8fd | oxygen-hunter/Flashboom | data/big-vul-100/add_attention_code/Phi/top0-100/shortest-cycle-in-a-graph-Solution.findShortestCycle/177781_DoS_Exec_Code_Overflow.cpp | void GfxImageColorMap::getGrayLine(Guchar *in, Guchar *out, int length) {
int i, j;
Guchar *inp, *tmp_line;
switch (colorSpace->getMode()) {
case csIndexed:
case csSeparation:
tmp_line = (Guchar *) gmalloc (length * nComps2);
for (i = 0; i < length; i++) {
for (j = 0; j < nComps2; j++) {
... | ALGO | 0.998322 | 4.160441 |
7910f5a0-646b-478c-a955-b6957e3637bf | wjwhhhhhh/ACM_ | 杭电多校/Hello_World_3_Pro_Max.cpp | //#pragma GCC optimize(3,"Ofast","inline")
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using ui64 = unsigned long long;
const i64 M = 1e9 + 7, N = 5e4 + 10;
;
string a = "helowrd";
string mod = " helloworld";
vector<int> mp[128];
string ab;
vector<i64> p(7);
long long qmi(long long k, long long... | ALGO | 0.99978 | 4.176924 |
b4b91ddd-ba8e-42f9-920a-1adac49f1ee5 | JaksaVucicevic/ImagAxis | source/HirschFye_old.cpp | #include "HirschFye.h"
#include "Input.h"
#include "routines.h"
#include <cmath>
#include <cstdlib>
#include <cstdio>
HirschFye::HirschFye()
{
Defaults();
}
HirschFye::HirschFye( const char * ParamsFN )
{
Defaults();
}
HirschFye::~HirschFye()
{
ReleaseMemory();
ReleaseFields();
}
void HirschFye::Defaults()... | ALGO | 0.999622 | 3.861519 |
7d33b605-b2e7-4d58-807a-4ec2e9fce651 | Gabriel-Sembenelli/cp | solved problems/CSES/CSES_1682_FlightRoutesCheck.cpp | /*
https://usaco.guide/silver/graph-traversal#problem-cses-1682
Directed Graphs, Strongly Connected Components.
I used Kosaraju's algorithm for SCCs (Strongly Connected Components).
If there is only 1 SSC, print YES,
else, print two vertices in different SCCs.
*/
#include <bits/stdc++.h>
using namespace std;
#define... | ALGO | 0.999974 | 4.5044 |
7e0c8d5c-ff36-4170-8ec7-9a08233c7e4b | sjtu-imperishable-night/code-library | Template/Template of Other Teams/Spear-of-Longinus/template/template_limited/source/data-structure/Treap.cpp | #include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
#define sz(x) (x?x->siz:0)
struct Treap{
struct node{
int key,val;
int siz,s;
node *c[2];
node(int v=0){
val=v;
key=rand();
siz=1,s=1;
c[0]=c[1]=0;
}
void rz(){siz=s;if(c[0])siz+=c[0]->siz;if(c[1])siz+=c[1]->siz;}
}pool[maxn]... | ALGO | 0.99993 | 3.903857 |
bed540a1-67f1-41f8-8a33-8379798c5a1d | myaimer/Recovery-puzzle | frameworks/js-bindings/cocos2d-x/cocos/math/MathUtil.cpp | #include "MathUtil.h"
#include "base/ccMacros.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID)
#include <cpu-features.h>
#endif
//#define USE_NEON32 : neon 32 code will be used
//#define USE_NEON64 : neon 64 code will be used
//#define INCLUDE_NEON32 : neon 32 code included
//#define INCLUDE_NEON64... | TOOL | 0.93859 | 6.26493 |
0613f174-83b5-4802-89c4-7953a1a74b6b | ICUlizhi/Data-Structure-and-Algorithm-A-of-pku | 普通班往年上机题解/24c.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
using ll = long long;
int n;
struct Point {
ll x, y;
} p[maxn];
ll c0[maxn], d0[maxn];
int c[maxn], d[maxn];
ll t[maxn];
inline int lowbit(int x) {return x & -x;}
void add(int x, int v) {
for (; x <= n; x += lowbit(x))
t[x] +=... | ALGO | 0.999917 | 4.148554 |
09665512-7e2a-45aa-a653-3a52d289946c | SutterCaine/legacy-SKIDOO | src/sync.cpp | #include "sync.h"
#include "util.h"
#include <boost/foreach.hpp>
#ifdef DEBUG_LOCKCONTENTION
void PrintLockContention(const char* pszName, const char* pszFile, int nLine)
{
printf("LOCKCONTENTION: %s\n", pszName);
printf("Locker: %s:%d\n", pszFile, nLine);
}
#endif /* DEBUG_LOCKCONTENTION */
#ifdef DEBUG_LOC... | TOOL | 0.97413 | 5.7469 |
b3934cd6-f63c-4272-9526-7f6468e318e1 | Redleaf23477/ojcodes | atcoder/abc259/A.cpp | #include <bits/stdc++.h>
using namespace std;
using LL = long long int;
void solve() {
int N, M, X, T, D; cin >> N >> M >> X >> T >> D;
if (M >= X) {
cout << T << "\n";
} else {
cout << T - D * (X - M) << "\n";
}
}
int main() {
ios::sync_with_stdio(false); cin.tie(0);
// int T;... | ALGO | 0.999661 | 4.367253 |
27025457-e645-4a03-a3ef-c952a64f2573 | necoarcreator/cpp-classes | LIFO_FIFO/lifolifo/Stack.cpp | #include "Stack.h"
#include <iostream>
#include <vector>
using namespace std;
Stack::Stack() : size(0), A{}
{
cout << "Warning: the stack is empty!\n";
}
Stack::Stack(vector<int> inpt) : A(inpt), size(A.size())
{
print();
}
void Stack::push(int arg)
{
A.push_back(... | TOOL | 0.947702 | 4.323953 |
37693fb6-76d6-4038-aefb-83060d7a300b | PatelManav/Codeforces_Backup | 1311A.cpp | /*May The Force Be With Me*/
#include <bits/stdc++.h>
#include <stdio.h>
#include <ctype.h>
#define ll long long
#define MOD 1000000007
#define endl "\n"
#define vll vector<long long>
#define pll pair<long long, long long>
#define all(c) c.begin(),c.end()
#define pb push_back
#define f first
#define s second
#define in... | ALGO | 0.999872 | 4.111498 |
7be456e9-cb13-418a-b132-ff7998c999ef | Tarrasch/gamla-po-uppgifter | Kattis/Nyckelringen2.cpp | #include <iostream>
#include <string.h>
using namespace std;
char ring[61];
int nycklar;
int main(int argc, char** argv)
{
cin >> ring;
ring="ABCCBABCDBDEBBABCA";
nycklar= strlen(ring);
nyckeltyper=0;
bool typer[6]={0,0,0,0,0,0};
for(int i=0;i<nycklar;i++)
if(!typer['F'-ring[i]]){
typer['F'-ring[i... | ALGO | 0.999861 | 3.332277 |
c99ada01-2fe5-46d7-beb4-5c46e7d32797 | seb-fenton/C-Compiler | include/ast/ast_expression_nodes.cpp | #include "ast_expression_nodes.hpp"
#include "context.hpp"
//primary_expression
void primary_expression::printMips(compilerContext& ctx, std::ostream& stream){
if(ctx.funcCall){
stream << "jal " << identifier << std::endl;
}else if(!((*ctx.currentBindings())[identifier].global)){
if(ctx.getAdd... | ALGO | 0.978308 | 5.851227 |
bae156a0-79e2-42ad-aa48-38c91c905130 | RaghavShah01/DSA | Recursion/binarySearch.cpp | #include<iostream>
using namespace std;
int BinarySearch(int a[],int si,int ei,int x){
if(si>ei){
return -1;
}
int mid = (si+ei)/2;
if(a[mid]==x){
return mid;
}
if(a[mid]>x){
return BinarySearch(a,si,mid-1,x);
}
if(a[mid]<x){
return BinarySearch(a,mid+1,ei,x);
}
}
int main()
{
int n;
cin>>n;
... | ALGO | 0.999931 | 5.74583 |
29ac2bce-7927-47bf-9829-a1158b18bf70 | limatiagocorreia/mars_tourism | 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.99887 | 6.783439 |
04180af1-0100-406a-a246-c3622d96027e | alexvelea/FMI-stuff | OOP-proiect/diff_test_a.cpp | #include <iostream>
using namespace std;
int main() {
int a, b; cin >> a >> b;
int result = 0;
for (int i = 0; i < a; i += 1) {
for (int j = 0; j < b; j += 1) {
result += 1;
}
}
cout << result << '\n';
return 0;
} | ALGO | 0.974418 | 4.018128 |
6f3773f2-0b45-40cb-859a-001f0045b072 | FelixMatrixx/23521215_23521704_23521494_23521821_23521208_23521327_BT03 | Bai024/Bai024.cpp | #include<iostream>
#include<iomanip>
using namespace std;
void Nhap(double[], int&);
void Xuat(double[], int);
void Lietke(double[], int);
int main()
{
int n;
double a[100];
Nhap(a, n);
Lietke(a, n);
return 0;
}
void Nhap(double a[], int& n)
{
cout << "Nhap n ";
cin >> n;
for (int i = 0; i < n; i++)
{
cout... | ALGO | 0.999979 | 3.055826 |
3a102051-c0a1-48e1-b673-416d96963a03 | choina/c_sharp_winforms | SPOJ/Stos i arytmetyka/main.cpp | #include <iostream>
#include <stack>
using namespace std;
stack <int> stos;
int a;
int b;
char c;
int x,y;
int wynik;
int powt;
int main()
{
cin >> powt;
for(int i=0;i<powt;i++)
{
cin >> a;
if(a==1)
{
cin >> b;
stos.push(b);
}
else if(a!=1)
{
... | ALGO | 0.997618 | 3.480541 |
60645074-9be5-4fea-a510-364f30d4dda4 | dominicnsg/AEDS-I-Estudos | Listas/Unidade 7 - OO Exercícios/Unidade 7 - OO Exercícios Classe/main3.cpp | #include <iostream>
#include <string>
using namespace std;
class Car
{
double tanque = 0;
double consumo = 15;
double distancia = 0;
// const double capacidadeTanque = 50.0; // Capacidade máxima do tanque
public:
// Car() : tanque(0), distancia(0) {}
/*
Car()
{
tanque=0;
... | TOOL | 0.851645 | 5.718865 |
52007083-cd72-44b6-992e-b0ffe15c4083 | r-lyeh-archived/moon9 | deps/spatial/bullet/btRaycastCallback.cpp | //#include <stdio.h>
#include "btConvexShape.h"
#include "btTriangleShape.h"
#include "btSubSimplexConvexCast.h"
#include "btGjkConvexCast.h"
#include "btContinuousConvexCollision.h"
#include "btGjkEpaPenetrationDepthSolver.h"
#include "btRaycastCallback.h"
btTriangleRaycastCallback::btTriangleRaycastCallback(const b... | ALGO | 0.995439 | 6.446692 |
71fd764d-f781-40a1-ae50-f5c8ef705f32 | wenliangsun/LeetCode | 并查集/冗余连接II.cpp | #include <bits/stdc++.h>
using namespace std;
/**
* 题目685:冗余连接II
*/
class Solution {
public:
vector<int> p; // 根节点集合
/**
* 并查集
* 分三种情况,无环但有一个结点的入度为2,有环且环中节点的入度为2,有环但入度都为1
*/
vector<int> findRedundantDirectedConnection(vector<vector<int>>& edges) {
int n = edges.size();
... | ALGO | 0.999919 | 5.354193 |
4e1c0749-2534-4b27-8e82-68ddbdff472f | SIM-TU-Darmstadt/mbslib | src/mbslib/elements/rigidbody/RigidLink.cpp | /**
* \file mbslib/elements/rigidbody/RigidLink.cpp
* Definition of mbslib::RigidLink
*/
#include <Eigen/Geometry>
#include <mbslib/elements/rigidbody/RigidLink.hpp>
#include <mbslib/utility/internalTests.hpp>
#include <mbslib/utility/mathtools.hpp>
using namespace mbslib;
RigidLink::RigidLink(MbsObject & pred, c... | TOOL | 0.894864 | 7.813046 |
c3c8d48b-b3a5-4201-9b91-51eda1fe95e1 | TCGBench/TCGBench | data/human_performance_code/human_performance_code_noip/P1059/ac_5.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
int n,num[100],list[100],count=0,tag;
cin>>n;
for(int i=0;i<n;i++){
cin>>num[i];
}
memset(list,0,sizeof(list));
for(int i=0;i<n;i++){
tag=0;
for(int j=0;j<=count;j++){
if(num[i]==list[j]){
... | ALGO | 0.999999 | 3.796079 |
6ee6bddc-7286-4c78-b571-d269897a8ba5 | androidfans/DataStructAndAlgorithm | BinarySearchTree.cpp | #include "DataStructAndAlgorithm.h"
#include "BinarySearchTree.h"
BinarySearchTreeNode::BinarySearchTreeNode(int _data) : data(_data), lchild(nullptr), rchild(nullptr) {}
BinarySearchTree::BinarySearchTree() : root(nullptr){}
bool BinarySearchTree::insert(int element) {
if (root == nullptr)
{
root = new BinaryS... | ALGO | 0.999654 | 4.025955 |
aa93de03-a2bf-4f73-9406-38747d7f241e | cduckling/Competitive-Programming | Codeforces/earnorunlock.cpp | #include <iostream>
#include <vector>
#include <set>
#include <map>
#include <unordered_map>
#include <queue>
#include <stack>
#include <algorithm>
#include <numeric>
#include <bitset>
using namespace std;
#pragma GCC optimize("Ofast,unroll-loops")
#pragma GCC target("avx2,popcnt,lzcnt,abm,bmi,bmi2,fma,tune=native")
... | ALGO | 0.99925 | 4.274969 |
a72e3b6a-ed93-4352-8c90-79697376e13d | ADITYAGABA1322/Daily-LeetCode-Challenge-Solution | 3617-find-the-original-typed-string-i/3617-find-the-original-typed-string-i.cpp | class Solution {
public:
int possibleStringCount(string word) {
int n = word.size() , cnt = 1;
for(int i=0; i<n-1; i++){
// pass string now would which is repeatinug and repeat atmost once means so go thorugh the string find of pairs posible and return it
if(word[i] == w... | ALGO | 0.999881 | 5.961891 |
1f7f2153-8e10-4383-8e7c-a04e3a06032f | bubbleShaker/atcoder_library | abc/379/b.cpp | #include <bits/stdc++.h>
using namespace std;
int main(){
int n,k;
cin>>n>>k;
string s;
cin>>s;
int cnt=0;
int ans=0;
for(int i=0;i<n;i++){
if(s[i]=='X'){
ans+=cnt/k;
cnt=0;
}
if(s[i]=='O'){
cnt++;
}
}
ans+=cnt/k;
cout<<ans<<endl;
return 0;
} | ALGO | 0.999571 | 4.008976 |
d45e5315-821d-4450-8b43-e7b1be7e8672 | ishandutta2007/codeforces | anz/normal/1156/C.cpp | #include <iostream>
#include <cstdio>
#include <algorithm>
#include <vector>
#include <queue>
#include <cstring>
#include <string>
#include <map>
#include <deque>
#include <set>
#include <unordered_map>
#include <bitset>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
ll gcd(ll a, ll b)
{
whi... | ALGO | 0.999969 | 3.985287 |
dfa7fa27-f512-44d9-9459-51513f061e33 | AbhishekTiwari0812/hackerrank_problems | del.cpp | #include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
typedef long long int lli;
/* This function calculates (a^b)%MOD */
long long pow(int a, int b, int MOD){
long long x=1,y=a;
while(b > 0) {
if(b%2 == 1)
{
x=(x*y);
... | ALGO | 0.999972 | 4.304433 |
d4f4c4c9-287a-4467-9667-391d1331e9fa | leonldy/Calabash | XVIII Open Cup named after E.V. Pankratiev. Eastern Grand Prix/D.cpp | #include <bits/stdc++.h>
#define MAXN 100005
#define INF 1000000000
#define MOD 1000000007
#define F first
#define S second
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
string str;
vector<bool> v;
int main()
{
cin>>str;
int n=str.size();
bool f=true;
v.resize(n);
for(int i=n-... | ALGO | 0.999663 | 4.084395 |
8a398679-b89d-4d26-b750-a783ea1d550d | Aychoumane/AI_for_games | tp1-breakthrough/heuris_player.cpp | #include <cstdio>
#include <cstdlib>
#include <string.h>
#include <iostream>
#include <string>
#include "mybt.h"
bt_t B;
int boardwidth = 0;
int boardheight = 0;
bool white_turn = true;
#ifndef VERBOSE_RAND_PLAYER
#define VERBOSE_RAND_PLAYER
bool verbose = true;
bool showboard_at_each_move = true;
#endif
void help()... | ALGO | 0.908706 | 3.762473 |
7245aae1-ff15-4ed9-acdc-ea66e55c991a | suspenss/ACM | Misc/aoapc-section2/basicDataStructure/luoguP1305.cpp | #include <iostream>
#include <unordered_map>
#include <string>
std::unordered_map<char, char> l, r;
int T;
void dfs_pre_order(char root) {
std::cout << root;
if (l.count(root)) dfs_pre_order(l[root]);
if (r.count(root)) dfs_pre_order(r[root]);
}
int main () {
std::cin >> T;
char root, u;
std::string buf;
std:... | ALGO | 0.999711 | 4.071954 |
9e0d73fc-9387-4aa7-a13c-da1ccb218779 | DionysiosB/CodeForces | 1500-1599/1541B-PleasantPairs.cpp | #include <cstdio>
#include <vector>
#include <algorithm>
typedef long long ll;
int main(){
ll t; scanf("%lld", &t);
while(t--){
ll n; scanf("%lld", &n);
std::vector<std::pair<ll, ll> > a(n);
for(ll p = 0; p < n; p++){scanf("%lld", &a[p].first); a[p].second = p + 1;}
sort(a.begi... | ALGO | 0.99906 | 3.530098 |
8ff4c3c2-3a36-4420-bcdd-012b1b33710c | Juanca0399/Progra_Datos_2 | Nodo_RN.cpp | #include <iostream>
#include <string>
using namespace std;
class NodoRN {
public:
int valor;
string str;
bool isRed;
NodoRN *Hizq, *Hder, *padre, *tio;
NodoRN(int num, string cliente, NodoRN *der = NULL, NodoRN *izq = NULL, NodoRN *sig=NULL, NodoRN *ant=NULL):
Hizq(izq), Hder(der), valor(... | ALGO | 0.999521 | 4.4751 |
35640a1e-b489-4e33-8eb5-75b15a4df695 | oeddyo/algorithm | for_google/quick_sort.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int partition(int A[], int left, int right){
int pivot = rand()%(right-left)+left;
swap(A[pivot], A[left]);
pivot = left;
int i = left, j = right-1;
while(1){
while(A[i]<=A[pivot]) i++;
... | ALGO | 0.99914 | 4.30812 |
6a30a8ce-0abd-4ef5-b03c-352a1e7cd28c | openharmony/third_party_skia | third_party/externals/icu/source/tools/genrb/genrb.cpp | #include <fstream>
#include <iostream>
#include <list>
#include <string>
#include <assert.h>
#include "genrb.h"
#include "unicode/localpointer.h"
#include "unicode/uclean.h"
#include "unicode/utf16.h"
#include "charstr.h"
#include "cmemory.h"
#include "filterrb.h"
#include "reslist.h"
#include "ucmndata.h" /* TODO: f... | TOOL | 0.886141 | 5.305131 |
3a481768-973b-4991-9880-3afd4acfef70 | Johnson-Lsx/Programming-practice | week3-牛顿法和高斯法/第二关/提交版.cpp | #include<vector>
#include<string>
#include<cmath>
#include<iostream>
#include<iomanip>
#include<sstream>
#include<unordered_map>
#include<algorithm>
using namespace std;
class LinearEquations
{
private:
vector<string> equation;
vector<double> ans;//存储答案
vector<double> B;//记录常数项
vector<vector<double>> matrix;//记录最终系... | ALGO | 0.999786 | 3.415653 |
8a2036b2-daee-4886-bf0f-2e6adf3a6e9a | preetikumari5/DSA | insertElement.cpp | // leetcode 35
#include<bits/stdc++.h>
using namespace std;
int main()
{
vector<int> a{1,3,5,6};
int l = a.size();
int k;
cin>>k;
int p;
for(int i=0;i<l;i++)
{
if(a[i]==k) p=i;
else if(a[l-1]<k) p=l;
else if(i<l-1 && (a[i]<k && a[i+1]>k)) p = i+1;
}
cou... | ALGO | 0.999942 | 4.222821 |
4d96431f-bc90-4852-aa50-e329de0f4c64 | VashchilkoAV/MPI | task6/main_6.cpp | #include <cstdio>
#include <cmath>
#include <omp.h>
#include <assert.h>
#define PORTO_START 0.1e-4 //integrate from, double
#define PORTO_FINISH 1 //integrate to, double
#define PORTO_DOTS_PER_Half_a_PERIOD 16384
//PORTO is name of my project, nothing more
double integrated_fun(double x){
return 1/x*sin(1/x);
}
... | ALGO | 0.999676 | 4.270533 |
47a80fb8-e4ca-473f-b5bc-27e7827ad6e9 | MNoman-ijaz/nomi | Data Structure code/21F-9513_Task1_lab12(ds).cpp | #include <iostream>
using namespace std;
class UndirecGraph
{
private:
int N;
int M;
int** arr; // 2D array for the adjacency matrix
public:
// Constructor to initialize
UndirecGraph(int n, int m) : N(n), M(m)
{
arr = new int*[N];
for (int i = 0; i < N; i++) {
arr[i] = new int[N];
for (int j = 0; j ... | ALGO | 0.999654 | 5.80885 |
e173f794-2fc6-4515-ac1e-e6d2833e653a | ishandutta2007/codeforces | samjia2000/normal/1017/H.cpp | #include<iostream>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<set>
#include<bitset>
#include<map>
#define fo(i,a,b) for(int i=a;i<=b;i++)
#define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
typedef long long LL;
typedef double db;
int get(){
char ch;
while(ch=getchar(... | ALGO | 0.999677 | 3.982976 |
5689bfeb-752c-44bb-90fc-aafa3004a81e | khalid4747/CS-2200-Lab02-DataStructures | CS-2200-Lab02/show9.cpp | //--------------------------------------------------------------------
// Laboratory 9 show9.cpp
/*!-------------------------------------------------------------------
\file
\brief Printing the structure
Linked implementation of the showStructure operation for the
Binary Search Tree ADT
*/
//-... | ALGO | 0.998616 | 5.893652 |
3e0fc23e-caa2-452e-9c50-7786b7f8464c | avinashw50w/ds_algo | Leetcode/Medium/376. Wiggle Subsequence.cpp | /*A wiggle sequence is a sequence where the differences between successive numbers strictly alternate between positive and negative. The first difference (if one exists) may be either positive or negative. A sequence with one element and a sequence with two non-equal elements are trivially wiggle sequences.
For exampl... | ALGO | 0.999944 | 5.550907 |
c1410ee3-388c-4ebf-9bbe-fc204f0fae8a | Shutok/WingsEMU | src/server/scripts/EasternKingdoms/undercity.cpp | /* ScriptData
SDName: Undercity
SD%Complete: 95
SDComment: Quest support: 6628, 9180(post-event).
SDCategory: Undercity
EndScriptData */
/* ContentData
npc_lady_sylvanas_windrunner
npc_highborne_lamenter
npc_parqual_fintallas
EndContentData */
#include "ScriptPCH.h"
/*######
## npc_lady_sylvanas_windrunner
######*/
... | TOOL | 0.854582 | 6.069105 |
4f4aaa9c-4304-44b0-a7c8-442b2b9a6aa4 | Awaisgardezi0457/Beginner-To-Advanced-C-plus-plus-Course | C++/Chapter1/9.cpp | // Increment and Decrement Operators:
#include <iostream>
using namespace std;
int main()
{int x;
x=4;
cout<<x<<endl;
cout<<x++<<endl;//post increment(it means first use the value of x then increment)
cout<<x<<endl;// this increases a value in 1.
x=4;
cout<<x<<endl;
cout<<++x<<endl;//pre-increment(first increment tha... | ALGO | 0.995433 | 3.631128 |
70b048fc-0f9f-421c-9112-c5988bf871b2 | Sinking-Stone/LearningNotes | Algorithm of Notes/ch03/codeup1934.cpp | #include<stdio.h>
int main(){
int num,search,flag=0;
scanf("%d",&num);
int a[num];
for(int i=0;i<num;i++){
scanf("%d",&a[i]);
}
scanf("%d",&search);
for(int i=0;i<num;i++){
if(search==a[i]) {
printf("%d",i);
flag=1;
break;
}
}
if(flag==0) printf("-1");
return 0;
}
| ALGO | 0.999859 | 4.090486 |
2fb1970c-5d20-4dc7-9d77-0becd75e5281 | dragan224/bubblecup | round 1/Sauron's Army.cpp | #include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
const int mod = 1e9 + 7;
const int maxN = 502;
int n;
long long dp[maxN];
int main() {
cin >> n;
dp[0] = 1;
dp[1] = 1;
for (long long i = 2; i <= n; i++) {
dp[i] = i*dp[i-1] + (i-1)*dp[i-2];
dp[i] %= mod;
//cout << dp[i... | ALGO | 0.999987 | 4.893717 |
fa5ceebf-5311-4491-a532-4933093cbc5b | piash76/UVA | uva524 - Prime Ring Problem.cpp |
///Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
#define ll long long
#define pll pair<ll,ll>
#define ff first
#define ss second
#define mp make_pair
#define pb push_back
#define cy cout<<"YES"<<endl
#define cn cout<<"NO"<<endl
using namespace std;
vector<int> v;
int n;
int vis[18];
bool is_p... | ALGO | 0.999838 | 3.835856 |
c329a9e5-a65d-4056-90e5-04900593dccd | TomiValero/Practicas-en-C | TP4/14.cpp | //Ejercicio:
//Autor:
//Fecha:
//Comentario:
# include<iostream>
# include<cstdlib>
using namespace std;
int main(){
int num;
int primerimp;
int segundoimp;
int cont, pos1, pos2;
bool a=true, b=false;
cout<<"Ingrese un numero: ";
cin>>num;
while(num!=0){
cont++;
if(a==... | ALGO | 0.999532 | 3.366332 |
71a22097-ca89-4a2c-bb24-d295e4e21fd6 | songzhuoran/rram-compression | caffe/src/caffe/solvers/adam_solver.cpp | #include <vector>
#include "caffe/sgd_solvers.hpp"
namespace caffe {
template <typename Dtype>
void AdamSolver<Dtype>::AdamPreSolve() {
// Add the extra history entries for Adam after those from
// SGDSolver::PreSolve
const vector<Blob<Dtype>*>& net_params = this->net_->learnable_params();
for (int i = 0; i ... | ALGO | 0.984898 | 7.613853 |
a9fbc713-f87a-4dc9-bdad-aa2f5ae570c6 | PhataPoster/algorithm | kruskal's.cpp | #include <bits/stdc++.h>
using namespace std;
bool cmp(vector<int> &a, vector<int> &b)
{
return a[2] < b[2];
}
void displayinput(vector<vector<int>> &v)
{
for (int i = 0; i < v.size(); i++)
{
cout << v[i][0] << " " << v[i][1] << " " << v[i][2] << endl;
}
}
int main()
{
int node, edge;
... | ALGO | 0.999896 | 4.563934 |
e81ae32c-9d60-4260-b145-d51e71398e42 | dccatmeow/leetcode | PBST_levelTraverse.cpp | // C++ implementation to check if the given array
// can represent Level Order Traversal of Binary
// Search Tree
#include <bits/stdc++.h>
using namespace std;
// to store details of a node like
// node's data, 'min' and 'max' to obtain the
// range of values where node's left and
// right child's should lie
str... | ALGO | 0.999986 | 5.749561 |
d5253f2f-216a-46fc-8aa4-59c9a4429a9c | sukenori/Competitive_Programming-Solved_Code | AtCoder/AtCoder_Beginner_Contest/300/300/C.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
int h,w; cin>>h>>w;
string c[h];
int n=min(h,w);
int s[n+1]{};
for(int i=0;i<h;i++)cin>>c[i];
for (int p=0;p<h-1+w-1;p++){
int cnt=0;
for(int i=0; i<max(h,w);i++){
int j=p-i;
if(0<=i&&i<h&&0<=j&&j<w&&c[i][j]=='.'){
if(cnt>1)s[cnt/2]+=1; cnt=0;}
if(0<=i&&i<h&... | ALGO | 0.999968 | 3.439658 |
b8b103fb-f494-4e64-ae5f-fc335b0e80be | stoyan-vr/CPP-Exercises | chapter_03/Exercise03_29.cpp | #include <iostream>
using namespace std;
int main()
{
cout << "Enter three points for p0, p1, and p2: ";
double x0, y0, x1, y1, x2, y2;
cin >> x0 >> y0 >> x1 >> y1 >> x2 >> y2;
double status = (x1 - x0) * (y2 - y0) - (x2 - x0) * (y1 - y0);
if (status > 0)
cout << "p2 is on the left side of the line" << endl... | ALGO | 0.999848 | 4.285667 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.