uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
529b4f67-14bf-4d54-ad38-47ef9018a2cc | mohamedemad-basha/PROBLEM_SOLVING | NEWCOMERS.psu/sheet4/D.cpp | #include<bits/stdc++.h>
using namespace std;
int main(){
string s, b;
cin>>s>>b;
cout<<s+b;
} | ALGO | 0.918534 | 3.000479 |
d93e7ade-56c1-4131-84a8-208a5c658127 | xuyuanxin/notes | algocoding/leetcode/remove_nth_node_from_end_of_list.cpp | /*******************************************************************************
Remove Nth Node From End of List(Easy)
*******************************************************************************
Given a linked list, remove the nth node from the end of list and return its head.
For example,
... | ALGO | 0.99991 | 5.784001 |
f0009fae-ea96-4660-a2b5-d77b2cfc3a78 | ViktoriiaHalik/DiscreteMath | laaaab6.cpp | #include <iostream>
#include <math.h>
using namespace std;
void Print(int* a, int n)
{
static int num = 1;
cout <<"\t\t\t"<< num++ << ": ";
for (int i = 0; i < n; i++) { // вивід комбінацій
cout << a[i] << " ";
}
cout << endl;
}
////////////// лексикографічний порядок //////////... | ALGO | 0.999465 | 3.151697 |
ae484be9-e3bd-4997-9485-1efff5d24a58 | Ardeess/practice | exerc10/ConsoleApplication1/ConsoleApplication1/ConsoleApplication1.cpp | #include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <map>
#include <cctype>
#include <algorithm>
using namespace std;
string findLastWord(const string& str) {
string lastWord;
string currentWord;
for (char ch : str) {
if (isalpha(ch)) {
currentWord += ... | ALGO | 0.998555 | 5.436683 |
0703fd84-c991-4097-9206-1fb9c54fda61 | naxocist/naxocist-cp | CF/2128C.cpp | #include <bits/stdc++.h>
using namespace std;
#define ln '\n'
#define ll long long
#define ld long double
#define all(x) begin(x), end(x)
#define pb emplace_back
int32_t main() {
cin.tie(nullptr)->sync_with_stdio(0);
int t; cin >> t;
while(t--) {
int n; cin >> n;
vector<int> v(n); for(auto &x : v) cin ... | ALGO | 0.999717 | 4.880367 |
751c1539-3601-4f9e-a3fb-3b422a4e3de5 | beckondelve1/itce-team8-2012 | LIA_RAL/LIA_SpkTools/src/FactorAnalysis.cpp | #if !defined(ALIZE_FactorAnalysis_cpp)
#define ALIZE_FactorAnalysis_cpp
#include<FactorAnalysis.h>
#include<iostream>
#include<fstream>
#include<cstdio>
#include<cassert>
#include<cmath>
#include "SuperVectors.h"
#include "RealVector.h"
#if defined(THREAD)
#include <pthread.h>
#endif
using namespace alize;
using name... | ALGO | 0.994028 | 4.584596 |
a2579cd5-c3f5-4923-8d9c-ad83b0784b93 | DCTewi/AlgorithmTemplates | 6.动态规划 - Dynamic Programming/3. 多重背包.cpp | /*
* 多重背包,01背包和完全背包的"结合"
* n种物品, 每种物品有费用w[n],价值v[n],和数量num[n]
* 背包容量m
* 一种解法: 通过将每种物品的数量展开来转换成01背包问题
*/
int k = n + 1;
for (int i = 1; i <= n; i++)
{
for (; num[i] > 1; num[i]--)
{
w[k] = w[i]; v[k] = v[i];
k++;
num[i]--;
}
}
for (int i = 1; i <= k; i++)
{
for (int j = m; j >= 1; j--)
{
if (w[i] <= ... | ALGO | 0.999714 | 3.672243 |
3cf11e6e-c891-4d98-bb6c-8586ff856c56 | Satya-100/GFG-problems | Difficulty: Medium/Dijkstra Algorithm/dijkstra-algorithm.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// User Function Template
class Solution {
public:
// Function to find the shortest distance of all the vertices
// from the source vertex src.
vector<int> dijkstra(vector<vector<pair<int, int>>> &adj, int src) {
... | ALGO | 0.999955 | 5.709669 |
91675c5a-d74f-4fef-af1d-c1e54df3b670 | sagarthecoder/Problem_Solving | UVA_Solution/uva_12583_memory_overflow.cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
int t;cin>>t;
for(int a=1;a<=t;a++)
{
int len,res=0,k;cin>>len>>k;
string x;cin>>x;
int seen[27]={0};
for(int i=1;i<=len;i++)
{
int ch=x[i-1]-'A';
if(seen[ch]!=0)
... | ALGO | 0.999685 | 3.752079 |
9883032a-896c-4d6c-a535-c949cedb5025 | PunnyOz2/POSN-Programming | Com/POSN 1.75/Inversion count(Mergesort).cpp | /*
TASK:
LANG: CPP
AUTHOR: PeaTT~
SCHOOL: CRU
*/
#include<bits/stdc++.h>
using namespace std;
int a[100100],b[100100];
long long ans;
void mergesort(int l,int r){
if(l==r) return ;
int mid=(l+r)/2;
mergesort(l,mid);
mergesort(mid+1,r);
int i=l,j=mid+1,k=l;
while(i<=mid && j<=r){
... | ALGO | 0.999917 | 4.495553 |
1704f766-45cc-417d-af44-91a69496d72c | Soveer-Shah18/cpp_stack_questions | smallest_number_on_left.cpp | //using stack to solve the next smaller element on the left side
#include<iostream>
#include<stack>
#include<vector>
using namespace std;
int main()
{
//given
vector<int>arr = {4,13,11,5,9,7,8,6};
int n = arr.size();
//solving
vector<int> ans(n, -1);
stack<int> st;
for (int i... | ALGO | 0.999999 | 5.077156 |
1dc5be46-84fa-4f72-ab9f-1ac87036669c | JustAG7/Competitive_Programming | Training/VKU Winter Camp 2024/GSPVH/E.cpp | #include<bits/stdc++.h>
using namespace std;
#define fast ios_base::sync_with_stdio(false);cout.tie(NULL);cin.tie(NULL);
#define ll long long
#define pb push_back
#define pf push_front
#define db double
#define X first
#define Y second
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
#define rall... | ALGO | 0.999891 | 3.725368 |
62072154-228a-4fcf-90a6-85ab6305619b | wangtongxue-369/xcpc_Code_file | file/codeforces/USST/wuhan_train/5/F.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define ull unsigned long long
#define INF 0x3f3f3f3f
#define PII pair<ll, ll>
const ll mod = 1e9 + 7;
const ll MAXN = 500005;
const ll base1 = 131;
const ll base2 = 127;
ll _ = 1, n, m, ans = 0, a[MAXN], f[MAXN];
ll k;
ll ask(ll i, ll j, ll x)
{
ll... | ALGO | 0.999969 | 3.818296 |
2e107102-a2d1-41b6-88b4-175bd5374b17 | QbitQuantum/Basics | Исходники/usacdec_fac.cpp | /**
* \brief Apply synthesis filter with zero input to x. The overall filter gain
* is 1.0.
* \param a LPC filter coefficients.
* \param length length of the input/output data vector x.
* \param x input/output vector, where the synthesis filter is applied in place.
*/
static void Syn_filt_zero(const FIXP_LPC a[],... | ALGO | 0.994258 | 4.348764 |
7af6e15f-d3c6-4d23-9627-0dad56e911b0 | sidtechnical/hackerrank | warmup/chocolate-feast/cpp/code.cpp |
#include <iostream>
using namespace std;
int main()
{
int cases, n, c, m, trade, wrappers;
unsigned long total;
cin >> cases;
while (cases--)
{
cin >> n >> c >> m;
// Calculate the number of chocolates that can be bought
// for the given amount of money
... | ALGO | 0.999853 | 3.796126 |
11fa4cf6-a076-47e9-9fcd-1142a34db334 | Mandrenkov/Contests | Kick Start 2014/Round B/D.cpp | #include <bits/stdc++.h>
using namespace std;
// Macros
#ifdef D3BUG
#define cerrd if (D3BUG) cerr
#else
#define cerrd if (false) cerr
#endif
// Types
template <typename T> using vector1D = vector<T>;
template <typename T> using vector2D = vector<vector1D<T>>;
template <typename T> using vector3D = vector<ve... | ALGO | 0.999663 | 5.251434 |
55e73596-4397-4d86-a30c-a263ce2e5c8b | TheSeanParker/C-Primer-PlusPlus-- | chapter 8/7/main.cpp | #include <iostream>
struct debts
{
char name[50];
double amount;
};
template <typename T>
double SumArray(T arr[], int n)
{
using namespace std;
cout << "template A\n";
double sum = 0;
for (int i = 0; i < n; i++)
sum += arr[i];
return (sum);
}
template <typename T>
double SumArray(T * arr[], int n)
{
usin... | ALGO | 0.964096 | 4.586509 |
3cb5c5d6-babe-493e-9883-ec69b3127c21 | avinashsoni9829/interview-sde | SDE SHEET/Day-20/1) Populate Next Right Pointer of a Tree/DFS.cpp | /*
// Definition for a Node.
class Node {
public:
int val;
Node* left;
Node* right;
Node* next;
Node() : val(0), left(NULL), right(NULL), next(NULL) {}
Node(int _val) : val(_val), left(NULL), right(NULL), next(NULL) {}
Node(int _val, Node* _left, Node* _right, Node* _next)
: val(_... | ALGO | 0.999967 | 5.680079 |
f6489a60-a253-4238-8c05-e56a3ff23ca6 | aadityamp01/GFG-30-Days-of-Code | Day6/day6.cpp | // Problem Statement: In Geekland there is a grid of coins of size N x N. You have to
//find the maximum sum of coins in any sub-grid of size K x K.
// Please refer day6 text file for full problem statement.
#include <iostream>
#include <bits/stdc++.h>
#include<vector>
using namespace std;
//User function Template ... | ALGO | 0.999825 | 5.067031 |
e8fbb9ab-1054-4d6c-9d72-9bca96698075 | Yoo0lh/datastrcuture_leetcode_puzzel | leet_code/container_withe_most_water.cpp | #include <iostream>
#include <vector>
using namespace std;
int maxArea(vector<int>& height) {
int area = 0;
for(int i = 0; i < height.size(); i++)
for(int j = i + 1; j < height.size(); j++){
int res = (j - i) * (min(height [i], height[j]));
area = max (area, res);
}
return area ;
}
int trytwo(vector<... | ALGO | 0.999438 | 4.787548 |
74625cc9-ee62-4c49-81f4-fad1799a83fc | yzcmf/Interview | LeetCode-Solutions/C++/smallest-integer-divisible-by-k.cpp | // Time: O(k)
// Space: O(1)
class Solution {
public:
int smallestRepunitDivByK(int K) {
// by observation, K % 2 = 0 or K % 5 = 0, it is impossible
if (K % 2 == 0 || K % 5 == 0) {
return -1;
}
// let f(N) is a N-length integer only containing digit 1
// given K... | ALGO | 0.999901 | 6.005406 |
cadb273a-d8cf-46eb-adcb-b76b20ee2aba | smiglan/OCR-NER-for-medicine-name-from-drug-labels | OCR_font/tesseract/src/ccutil/bitvector.cpp | #include "bitvector.h"
#include <algorithm>
#include <cstring>
#include <tesseract/helpers.h>
#include <tesseract/serialis.h> // for tesseract::Serialize
namespace tesseract {
// Fast lookup table to get the first least significant set bit in a byte.
// For zero, the table has 255, but since it is a special case, m... | ALGO | 0.946974 | 6.563758 |
11bd76dd-3b34-406c-abdf-7406e66953db | VidevichA/algs-4-sem | Перебор/Problem 4. Минимальное число слонов/[OK]755529.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <queue>
#include <stack>
int record1 = 0;
int record2 = 0;
std::vector<std::vector<int>> results1;
std::vector<std::vector<int>> results2;
bool isWhite(int i, int j)
{
if (i % 2 == 0)
{
return j % 2... | ALGO | 0.999932 | 3.091627 |
17100638-277b-40e8-8fe1-d7d308aab6c3 | Parc-Ferme/LeetCode | Pattern 3 - GFG/pattern-3.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution {
public:
void printTriangle(int n) {
// code here
for(int i = 1; i <= n; i++){
for(int j = 1; j <= i; j++){
cout << j << " ";
}
cout << "... | ALGO | 0.999724 | 6.256777 |
59c954f3-fa42-487f-9d8a-282e69cd3e7b | Coder-Colder/ChineseChess-AI | GammaGo_v2.cpp | #include "GammaGo_v2.h"
#include <cmath>
#include <ctime>
#include <random>
#include <cassert>
#include <iostream>
using namespace std;
static default_random_engine e;
static uniform_int_distribution<unsigned> red_no(RedBegin, RedEnd);
static uniform_int_distribution<unsigned> black_no(BlackBegin, BlackEnd);
int UCTN... | ALGO | 0.999645 | 4.140624 |
801b903d-a804-4712-80df-2adff3bfd0be | p2rv/Ch7t7 | Ch7t7/Ch7t7.cpp | //Chapter 7 task 7
// Tnode
// Tnode,
//
#include "Ch7t7.h"
TNode* root=NULL;
TNode* current=NULL;
int treeLength=0;
int main()
{
TNode t2,t3,t4,t5,t6,t7,t1;
t1 = { "aaa",100,0,0 };
t2 = { "bbb",200,0,0 };
t3 = { "ccc",300,0,0 };
t4 = { "ddd",400,0,0 };
t5 = { "eee",500,0,0 };
t6 = { "fff",60... | ALGO | 0.993242 | 3.365183 |
3fd23140-f405-452c-80c2-dbe09d96a917 | yanbcxf/cpp | MyToolKit/NumericalRecipes/recipes/vander.cpp | #include "nr.h"
void NR::vander(Vec_I_DP &x, Vec_O_DP &w, Vec_I_DP &q)
{
int i,j,k;
DP b,s,t,xx;
int n=q.size();
Vec_DP c(n);
if (n == 1) w[0]=q[0];
else {
for (i=0;i<n;i++) c[i]=0.0;
c[n-1] = -x[0];
for (i=1;i<n;i++) {
xx = -x[i];
for (j=(n-1-i);j<(n-1);j++) c[j] += xx*c[j+1];
c[n-1] += xx;
}
... | ALGO | 0.999965 | 3.409026 |
d0c5881c-0f40-4743-937b-654574c71ea8 | geoffrey-anto/leetcode-solutions | 2676-find-the-score-of-all-prefixes-of-an-array/solution.cpp | class Solution {
public:
vector<long long> findPrefixScore(vector<int>& nums) {
vector<long long> ans(nums.size(), 0ll);
int currMax = nums[0];
ans[0] = (long long)nums[0] * 2ll;
for(int i=1; i<nums.size(); i++) {
currMax = max(nums[i], currMax);
ans[i] = ... | ALGO | 0.999962 | 5.125852 |
f25a307f-2431-4ae5-bdb0-cb2d5d7f96ba | zaheersani/C-Language-Programs | ASS1.CPP | #include<stdio.h>
#include<conio.h>
#include<math.h>
/*To make output as;
i=4 i^2=6
i=8 i^2=14
i=12 i^2=22
i=16 i^2=30*/
void main()
{
int i;
clrscr();
for(i=4;i<=16;i=i+4)
{
printf("\ni=%d i^2=%d\n",i,i*2-2);
}
getch();
} | ALGO | 0.974093 | 3.180532 |
79ed335f-5616-4ecc-b9ea-e2b84075cb14 | 764889950/opencv-3.4.5 | modules/core/src/matrix_expressions.cpp | /* ////////////////////////////////////////////////////////////////////
//
// Mat basic operations: Copy, Set
//
// */
#include "precomp.hpp"
namespace cv
{
class MatOp_Identity CV_FINAL : public MatOp
{
public:
MatOp_Identity() {}
virtual ~MatOp_Identity() {}
bool elementWise(const MatExpr& /*expr*/) ... | TOOL | 0.952479 | 7.224 |
4a7e7541-e1b9-4476-a1b2-ad80157bf77f | ducpdx/s1630512PiECppExam | ex1q15a.cpp | #include<iostream>
#include<cmath>
#include<vector>
#include<fstream>
#include<chrono>
#include<iomanip>
void bruteForce(double &n);
void bruteForceM(double &n);
void modTest(double &n);
int main( ){
int i;
//std::vector<double> v = {5,1000};
//std::vector<double> v = {pow(10,3),pow(10,4)};
std::vector<double... | ALGO | 0.998997 | 3.913557 |
48724937-7535-4288-a980-bf4c0381df36 | Arhan13/CPP | Codeforces/Doctor Chef3.cpp | //Template
#include <bits/stdc++.h>
#define endl "\n"
typedef long long ll;
using namespace std;
ll days_counter(ll x, ll value) {
ll counter=0;
while(x<value) {
x = x*2;
counter++;
}
// cout<<counter<<endl;
return counter;
}
int main(){
ios::sync_with_stdio(0);cin.tie(0);
int... | ALGO | 0.99984 | 4.271558 |
b145ef3e-9f13-4a25-8f3a-b639ec118fe1 | vefoto-gates/PasswordGenerator | Password_Generator.cpp | //main concept: making a random selector function and an aaray .Will iterate in that for randomly selecting the characters.
#include <iostream>
#include <cstdlib>
#include <ctime>
using namespace std;
//made an array of all characters that will be used in random password generator.
static const char alphabets[] = "0123... | ALGO | 0.942263 | 3.419702 |
e699b0bb-3220-42f5-994e-e1d27e84c1ea | jorgepsmatos/cft-otb | trackers/MUSTer/mexopencv/src/+cv/cornerSubPix.cpp | /**
* @file cornerSubPix.cpp
* @brief mex interface for cv::cornerSubPix
* @ingroup imgproc
* @author Kota Yamaguchi
* @date 2011
*/
#include "mexopencv.hpp"
using namespace std;
using namespace cv;
/**
* Main entry called from Matlab
* @param nlhs number of left-hand-side arguments
* @param plhs pointers to ... | ALGO | 0.994303 | 6.543427 |
28739685-19d5-44b2-8118-7ae9e9561a52 | NipenPaul/Program-Catagory-Document | Online Judge/UVA/f91_uva_10696.cpp | #include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define Faster ios::sync_with_stdio(false);cin.tie(nullptr);
#define check(x) cout << (#x) << " is " << (x) << endl;
#include <ext/rope>
using namespace __gnu_cxx;
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
typedef tree<int,null... | ALGO | 0.998693 | 4.078764 |
7d8fc884-125c-4558-ac7b-4019b960fa58 | oneapi-src/SYCLomatic | libc/test/src/stdlib/qsort_r_test.cpp | #include "src/stdlib/qsort_r.h"
#include "test/UnitTest/Test.h"
#include "hdr/types/size_t.h"
static int int_compare_count(const void *l, const void *r, void *count_arg) {
int li = *reinterpret_cast<const int *>(l);
int ri = *reinterpret_cast<const int *>(r);
size_t *count = reinterpret_cast<size_t *>(count_ar... | TEST | 0.906029 | 7.446832 |
12b09611-6bd2-4b14-bf97-a0e2095d0f3d | andycervantes/Pueblo-Client | apiutil/unreduce.cpp | /*---------------------------------------------------------------------------
unreduce.c
The Reducing algorithm is actually a combination of two distinct algorithms.
The first algorithm compresses repeated byte sequences, and the second al-
gorithm takes the compressed stream from the first algorithm and appl... | ALGO | 0.999879 | 4.591871 |
3a8629dc-ddb3-4f2f-bad8-89e6df8f8996 | ishandutta2007/codeforces | tzc_wk/normal/808/D.cpp | #include <bits/stdc++.h>
using namespace std;
#define int long long
int n,a[100005],s[100005],sum;
inline bool find(int l,int r,int x){
int L=l,R=r;
while(L<=R){
int mid=(L+R)>>1;
if(s[mid]==x) return 1;
if(s[mid]>x) R=mid-1;
else L=mid+1;
}
return 0;
}
signed main(){
cin>>n;
for(int i=1;i<=n;i++) cin>>... | ALGO | 0.999993 | 3.751993 |
e3660cb3-567a-4f73-9545-43299eb969de | AliHassaanDev/PD03 | Task11(cp).cpp | #include <iostream>
using namespace std;
int main()
{
int age,moved,years;
cout<<"Enter the person's age: ";
cin>>age;
cout<<"Enter the number of times they've moved: ";
cin>>moved;
years=age/(moved+1);
cout<<"Average number of years lived in the same house: "<<years;
} | ALGO | 0.923947 | 3.531995 |
09de7927-2240-4515-9725-3ecad7161b6f | BGCX261/zpr-rozpoznawanie-dzwieku-git | sources/neur/src/baseNeuron.cpp | /**
* @file
* Implementation of Layer class
*
* It represents layer in a neural network
*/
/// Lukasz Rychter
/// Maciej Sikora
#include "stdafx.h"
#include "baseNeuron.h"
#include <math.h>
using namespace neur;
void BaseNeuron::processInput(float inputValue)
{
value_ += inputValue;
}
void BaseNeuron::processLe... | ALGO | 0.865101 | 4.757376 |
1af24ff7-bf78-4fad-9518-a9c6326ef3e4 | HwH-qwq/State-Try-Out-2022 | [前期 1] 线段树平衡树/P5278算术天才⑨与等差数列.cpp | #include<cstdio>
#include<set>
#include<map>
#include<iostream>
#include<algorithm>
using namespace std;
const int N=6e5+50;
inline void rad(int &_){
static char ch;
while(ch=getchar(),ch<'0'||ch>'9');_=ch-48;
while(ch=getchar(),ch<='9'&&ch>='0')_=_*10+ch-48;
}
int gcd(int u,int v){return v?gcd(v,u%v):u;}
i... | ALGO | 0.999991 | 3.876587 |
a3bf9092-5827-4394-91a7-73f7865c24f8 | sinian666/code_102_5 | cpp_副本19/chapter_sorting/merge_sort.cpp | /**
* File: merge_sort.cpp
* Created Time: 2022-11-25
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
/* 合并左子数组和右子数组 */
// 左子数组区间 [left, mid]
// 右子数组区间 [mid + 1, right]
void merge(vector<int> &nums, int left, int mid, int right) {
// 初始化辅助数组
vector<int> tmp(nums.begin() + left, nums.begin() ... | ALGO | 0.999981 | 5.834587 |
c01833f1-f0f7-4261-bc14-a523bcbf8fde | ishandutta2007/codeforces | hs-black/normal/1491/G.cpp | /*
| _ _|
` _x
/ |
/ ?
| |||
| (__)_)
*/
#define OK printf ("Pass on Line #%d\n", __LINE__)
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#define MP make_pair
#define ll long long
#define fi first
#define se second
using namespace std;
template <typename T>
vo... | ALGO | 0.999986 | 3.334172 |
fd4ee6ef-f797-46a3-bbbb-1acc5b1a723d | liwei2088/oi | 计蒜客/00基础语法/01字符串/T1104.cpp | #include <cstring>
#include <iostream>
using namespace std;
string s;
int ch[26];
int main() {
cin >> s;
for (int i = 0; s[i]; i++) ch[s[i] - 'a']++;
for (int i = 0; s[i]; i++)
if (ch[s[i] - 'a'] == 1) {
cout << s[i];
return 0;
}
cout << "no";
return 0;
} | ALGO | 0.999911 | 4.060552 |
4fac8096-97a9-4a45-bab8-0b85169335ee | programming-language-C/my_first_program | my_first_program/my_first_program.cpp | #include <stdio.h>
#include <conio.h>
#include <locale.h>
#include <Windows.h>
int main()
{
SetConsoleCP(1251);
SetConsoleOutputCP(1251);
// Объявить переменные
int a, b, c;
// ввести a и b
printf("Ввести a:\n");
scanf_s("%d", &a);
printf("Ввести b:\n");
scanf_s("%d", &b);
// напечатать c
c = a + b;
printf... | TOOL | 0.98556 | 3.113878 |
7890564e-e5ce-4051-8ed2-b08331572013 | esl-epfl/xheep_matrix_spec | llvm-project/libcxx/test/std/containers/sequences/vector.bool/append_range.pass.cpp | // UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
// ADDITIONAL_COMPILE_FLAGS(has-fconstexpr-steps): -fconstexpr-steps=2000000
// template<container-compatible-range<bool> R>
// constexpr void append_range(R&& rg); // C++23
#include <vector>
#include "../insert_range_sequence_containers.h"
#include "test_macros.h"... | TEST | 0.975891 | 6.831839 |
ed3102b3-6085-42c6-b1d4-12d365735185 | PaukIsUha/optimizing_formating_code | predictions/submissions-aizu-coop-gpt4/Codenet/p02300/517812000/original.cpp | #include <algorithm>
#include <cstdio>
#include <vector>
using namespace std;
class Point {
public:
int x, y;
Point(int a = 0, int b = 0) {
int x = a;
int y = b;
};
bool operator<(const Point &p) const {
return y < p.y || (y == p.y && x < p.x);
}
};
inline bool direct(Point &base, Point &a, Point ... | ALGO | 0.999995 | 4.029998 |
634f71ca-6d69-420e-bd6b-cc793746b0a2 | WETLION/ROKA | BOJ/보석 구매하기.cpp | #include <iostream>
// 2313번 보석 구매하기
using namespace std;
long long n, l, input, ans, ans_l[1001][2];
int main() {
cin >> n;
for(int i = 0; i < n; i++) {
cin >> l;
long long arr[1001][2] = {}, MAX = 0, a = 0, b = 0;
for(int j = 0; j < l; j++) {
cin >> input;
if(!j) {
MAX = arr[j]... | ALGO | 0.999943 | 3.677887 |
42e6773b-7e57-4ea9-a0d8-e9f8c68efb13 | PeiHsiuLu/uva_practice | uva_10055_Hashmat_the_Brave_Warrior.cpp | #include <stdio.h>
#include <stdlib.h>
int main(){
long long int Hashmat;
long long int Enemy;
long long int substraction;
char input[40];
while(fgets(input,sizeof(input),stdin)){
if(input[0]==10){
return 0;
}
sscanf(input,"%lld %lld",&Hashmat,&Enemy);
sub... | ALGO | 0.999684 | 3.380127 |
678e65b1-6380-4d03-8998-99c0001c8b69 | divya-lakhtariya/Assignment | arrayassinding.cpp | #include <stdio.h>
main ()
{
int num[20];
int i, j, a, n;
printf("enter number of elements in an array");
scanf("%d", &n);
printf("Enter the elements");
for (i = 0; i < n; ++i)
scanf("%d", &num[i]);
for (i = 0; i < n; ++i)
{
for (j = i + 1; j < n; ++j)
{
if (num[i] > num[... | ALGO | 0.999892 | 3.172815 |
9a495470-4ed9-4551-94b0-78c47928f530 | eg7409/Data-Structure-I-Leetcode | Day 3/350. Intersection of Two Arrays II.cpp | class Solution {
public:
vector<int> intersect(vector<int>& v1, vector<int>& v2) {
int n = v1.size(), m = v2.size();
vector<int> v;
sort(v1.begin(),v1.end());
sort(v2.begin(),v2.end());
int d = max(v1[n-1]+1,v2[m-1]+1);
vector<int>... | ALGO | 0.999994 | 5.457048 |
8d3ab090-ecc4-4d23-b1cf-59952d4cf02a | alexandraback/datacollection | solutions_2755486_0/C++/keninqc/P3.cpp | #include <vector>
#include <algorithm>
using namespace std;
vector<int> nums;
class SegTreeNode
{
public:
int beginIdx,endIdx;
int minVal;
};
class Query
{
public:
int dayNo;
int begin, end;
int val;
Query(int a, int b, int c, int d) : dayNo(a), begin(b), end(c), val(d) {}
};
bool comp(Query &a, Query &b)
{
... | ALGO | 0.999546 | 3.447935 |
9618e81e-8eac-4bc9-add0-70612314aa2c | chuang0221/leetcode | Binary Tree/101. Symmetric Tree/main.cpp | #include <iostream>
#include <unordered_set>
#include <vector>
#include <string>
using namespace std;
struct TreeNode {
int val;
TreeNode *left;
TreeNode *right;
TreeNode() : val(0), left(nullptr), right(nullptr) {}
TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
TreeNode(int x, Tre... | ALGO | 0.999963 | 6.386445 |
9eedfdef-46ac-4b3b-bdcd-59ec35868c68 | uwgraphics/hierarchicaldd | external_libraries/Physbam/Public_Library/PhysBAM_Rendering/PhysBAM_OpenGL/OpenGL/OPENGL_SYMMETRIC_MATRIX_FIELD_3D.cpp | using namespace PhysBAM;
//#####################################################################
// Function Display
//#####################################################################
template<class T> void OPENGL_SYMMETRIC_MATRIX_FIELD_3D<T>::
Display(const int in_color) const
{
glPushAttrib(GL_LIGHTING_BIT|G... | TOOL | 0.982726 | 5.37201 |
3461c5a6-f10d-4809-806a-5d28ace2cde3 | alwinbennykuzhimullil/CppMastery | C++ Programming Essentials/C++ Basics Crash Course/TicTac.cpp | #include <iostream>
template <typename T, int rows, int cols>
void printArray(T(data)[rows][cols]) {
for (int row = 0; row < rows; row++) {
for (int col = 0; col < cols; col++) {
std::cout << data[row][col] << " ";
}
std::cout << std::endl;
}
}
bool checkForWin(char board[]... | ALGO | 0.998212 | 6.025414 |
abd5c4ee-1e74-438b-8814-eb03955327a5 | allem40306/Competitive-Programming | other/zoj1601.cpp | #pragma GCC optimize(2)
#include <algorithm>
#include <cmath>
#include <cstring>
#include <iomanip>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
typedef long long LL;
const int INF = 1e9;
const int MXN = 1e5 + 5;
const int MXV = 3e5 + 5;
const LL MOD = 10009;
const LL see... | ALGO | 0.999645 | 4.013221 |
3ddf1e76-052f-4558-ad86-a5ca9bed73bb | seanboe/QuadrupedKinematics | src/Kinematics.cpp | #include "Kinematics.h"
#include <Arduino.h>
/*!
* @param legID Leg number. Numbering follows the quadrants of a unit circle.
*/
Kinematics::Kinematics() {};
// *****************Private Functions*****************
/*!
* @brief Returns the index of a motor in the motor list given
* the leg it i... | ALGO | 0.954174 | 5.80835 |
f280590e-fe86-414f-959c-974c996cae75 | kifah-s/Problem_Solving | Gammal_Tech_Academy/2_C++_Programming_Language/Exercises/Pro_345_Map_To_Store_Courses_Program/Map_To_Store_Courses_Program_V1.cpp |
//* Map To Store Courses Program (Version 1).
/*
* Create a program that initializes a map with predefined data representing courses and their corresponding credit hours,
* The program should print the courses and credit hours in ascending order of courses.
! Output:
! Sorted by name:
! Course: B, hours: 45
! Course... | ALGO | 0.997146 | 5.750729 |
fd58fb08-019d-4104-a2a6-55775d98d3a2 | MostafaMohamed2001/C-Data-Structure | .history/hello_20240713095156.cpp | #include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int main(){
int n , a = 0 , d = 0;
cin>>n;
string str;
getline(cin, str);
for (int i = 0; i < n; i++){
// if(str[i] == 'A'){
// a++;
// }else{
// d++;
co... | ALGO | 0.999883 | 3.591923 |
ca969dee-1c93-46b8-9ffe-c840a094d314 | ashik5757/CP | Contest_Practise/contest_1/O.cpp | #include<bits/stdc++.h>
using namespace std;
int main() {
string res[100];
int i = 0;
while(true) {
string s;
getline(cin,s);
if(s=="*")
break;
if(s=="Hajj")
res[i] = "Hajj-e-Akbar";
else if(s=="Umrah")
res[i... | ALGO | 0.989156 | 3.361362 |
17f9ee5a-e1ba-4caa-bf39-69aa85411533 | GambitG667/AL_laba_4_1st_semestre | task_04.cpp | #include <vector>
void sort(std::vector<float>& vector){
bool flag = true;
while(flag){
flag = false;
for(int i{}; i < vector.size()-1; ++i){
float bufer;
if(vector.at(i) < vector.at(i+1)){
flag = true;
bufer = vector.at(i);
... | ALGO | 0.999775 | 4.382864 |
972a03a7-1145-4aaa-ba66-38a470ca82c3 | panda959595/boj_solve1 | boj_solve1/16978.cpp | #include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
long long st[400005];
void update(int index, int s, int e, int i, int num) {
if (i < s || e < i) {
return;
}
if (s == e) {
st[index] = num;
return;
}
int mid = (s + e) / 2;
update(index * 2, s, mid, i, num);
update(index * 2 + ... | ALGO | 0.999941 | 4.210946 |
b1759b33-5a3c-4640-b377-8080584bc652 | CH6832/exploratory-tech-studio | tech-studio-projects/algorithms/statistical-analysis/monte-carlo/cpp/main.cpp | #include <iostream>
#include <random>
/**
* MonteCarlo.cpp
*
* The Monte Carlo method is a statistical technique used to estimate numerical results by random sampling.
* In this implementation, we use the Monte Carlo method to estimate the value of pi by simulating random points
* within a unit square and determi... | ALGO | 0.999835 | 7.03419 |
f58b4749-5a26-41c2-a6c8-ba0e4d2dc464 | Spyabhishek/IneuronPPT-Assignment | Assignment 10 Recursion/Q7.cpp | #include <iostream>
using namespace std;
void permute(string &str, int start, int end)
{
if (start == end)
{
cout << str << " ";
return;
}
for (int i = start; i <= end; i++)
{
swap(str[start], str[i]);
permute(str, start + 1, end);
swap(str[start], str[i]); ... | ALGO | 0.999974 | 6.037735 |
3668569e-f776-4803-8b52-998669fc37e9 | toh-ri/AtCoder | atcoder.jp/abc076/abc076_c/Main.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
string S, T;
cin >> S >> T;
int ss = S.size();
int ts = T.size();
if (ts>ss) {
cout << "UNRESTORABLE" << endl;
return 0;
}
for (int i = ss - ts; i >= 0; i--) {
bool flag = true;
for (int j = 0; j < ... | ALGO | 0.999962 | 4.04626 |
a39d14a7-0045-4799-97f6-c17a9f6971fe | fxb0829/LanQiao | _枚举模拟与排序/_1231_航班时间.cpp | #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
using namespace std;
int get_seconds(int h,int m,int s){
return h*3600 + m * 60 + s;
}
int get_time(){
string line;
getline(cin,line);
if(line.back() != ')') line += "(+0)";
int h1,m1,s1,h2,m2,s2,d;
//sscanf(str,"格式... | ALGO | 0.929967 | 3.337366 |
a6c2fb39-14e8-4531-aeb9-ab1a9863b5dc | CawaAlreadyTaken/UniTN_exercises | 063.recursive_recursive_print_1-n.cpp | #include <iostream>
using namespace std;
void recurs2(int now, int stop);
void recurs1(int now, int stop) {
cout << now << " ";
if (now == stop) {
return;
} else {
recurs2(now+1, stop);
}
}
void recurs2(int now, int stop) {
cout << now << " ";
if (now == stop) {
return;
} else {
recurs1(now+1, stop);... | ALGO | 0.999163 | 4.202101 |
edebf825-da31-44b0-b9cc-beb28d1d903d | squaresLab/BatFix | results/codex/results/python/semantics/program_CHECK_INTEGER_OVERFLOW_MULTIPLICATION.cpp | #include <iostream>
#include <cstdlib>
#include <string>
#include <vector>
#include <fstream>
#include <iomanip>
#include <vector>
#include <map>
#include <unordered_map>
#include <set>
#include <unordered_set>
#include <numeric>
#include <algorithm>
using namespace std;
bool f_gold ( long long a, long long b ) {
if ... | ALGO | 0.995134 | 4.635344 |
a3aecf25-7307-4888-93b6-aac6bb6b4d7a | sarvex/leetcode-prolog | solution/2200-2299/2293.Min Max Game/Solution.cpp | class Solution {
public:
int minMaxGame(vector<int>& nums) {
for (int n = nums.size(); n > 1;) {
n >>= 1;
for (int i = 0; i < n; ++i) {
int a = nums[i << 1], b = nums[i << 1 | 1];
nums[i] = i % 2 == 0 ? min(a, b) : max(a, b);
}
}
... | ALGO | 0.999996 | 5.591139 |
a4ab2fc4-c036-4b17-8e62-c7530d2bd8e7 | manisha1904/6Companies30DaysChallenge | Google/Fruit_into_Baskets.cpp | // Problem Link - https://leetcode.com/problems/fruit-into-baskets/description/
class Solution {
public:
int totalFruit(vector<int>& fruits) {
unordered_map<int,int>mp;
int n = fruits.size();
int i=0,j=0;
for(i=0,j=0;j<n;j++){
mp[fruits[j]]++;
if(mp.size()>2){
mp[... | ALGO | 0.99995 | 6.324293 |
c28e2806-84f5-40b9-9682-77bf67dafaf4 | riyaz28/some-CP-problems | B_Jeff_and_Periods.cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define pb push_back
#define mp make_pair
#define setp(n) cout<<fixed<<setprecision(n)
#define lb lower_bound
#define ub upper_bound
#define mod 1000000007
#define op(x) cout<<x
#define ip(x) ci... | ALGO | 0.999983 | 3.490038 |
c1feccfc-595d-44a5-b286-a8f2c6c664a0 | kmjp/procon | codeforce/751-800/784/c4.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.999171 | 4.247618 |
7f26dc63-f4f9-48e3-89c1-87a8819eef3b | NikolaDucak/neuralnet | neural_net_lib/lib/eigen-3.3.7/bench/perf_monitoring/gemm/gemm.cpp | #include <iostream>
#include <fstream>
#include <vector>
#include <Eigen/Core>
#include "../../BenchTimer.h"
using namespace Eigen;
#ifndef SCALAR
#error SCALAR must be defined
#endif
typedef SCALAR Scalar;
typedef Matrix<Scalar,Dynamic,Dynamic> Mat;
EIGEN_DONT_INLINE
void gemm(const Mat &A, const Mat &B, Mat &C)
{... | TEST | 0.97627 | 5.635058 |
ab75dec8-128c-446c-a497-9a26703c74a7 | VIKASGULIA17/practice | c++/75dayscoding/recursion.cpp | #include<iostream>
using namespace std;
int recursion_trial(){
static int i=5;
if (i<1)return 0;
cout<<"hello World "<<i<<endl;
i--;
recursion_trial();
return 1;
}
int main(){
recursion_trial();
} | ALGO | 0.972901 | 3.092533 |
42875386-ea56-49ea-b51b-2a637779ae46 | ssudharsan93/graduate_program | Spring 2023/CS 5343/assignment1/ListNode.cpp | #include "ListNode.h"
// default constructor
ListNode::ListNode(){
this->val = 0;
this->next = NULL;
}
// constructor with an int value passed in as a parameter.
ListNode::ListNode(int value){
this->val = value;
this->next = NULL;
}
// gets the pointer to the next element
// pointed to by the list no... | ALGO | 0.997897 | 4.321021 |
6a75a9b1-b821-4b57-ba50-d054f2c621de | raincross7/code-similarity | codes/train_code/problem112/problem112_385.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <map>
using namespace std;
class mp
{
public:
struct Node
{
int key;
Node *prev, *next;
};
Node *nil;
mp()
{
nil = (Node *)malloc(sizeof(Node));
nil->next = nil;
nil->prev = nil;
}
... | ALGO | 0.999583 | 3.78927 |
8c0df14b-c91c-4903-98d6-3a4a34cfecf9 | yliu-cs/ACM | CodeForces/CodeForces-1204B.cpp | // Author: Tony5t4rk Time: 2019-08-20 22:43:51
#include <bits/stdc++.h>
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n, l, r;
std::cin >> n >> l >> r;
long long sum = 1, cur = 1;
int idx = 2;
while (idx <= l) {
cur *= 2ll;
sum += cur;
++idx;
}
long long min = ... | ALGO | 0.999479 | 3.20764 |
dc229737-5432-4e85-be7c-d74846e0db7a | DevGithub007/My_Codes | icecream_parlor.cpp | #include<bits/stdc++.h>
using namespace std;
int main()
{
long long t,m,n,i,j;
scanf("%lld",&t);
while(t--)
{
scanf("%lld",&m);
scanf("%lld",&n);
long long a[n+1];
for(i=1;i<=n;i++)
{
scanf("%lld",&a[i]);
}
for(i=1;i<n;i++)
{
for(j=i+1;j<=n;j++)
{
if((a[i]+a[j])==m)
printf("%lld ... | ALGO | 0.99986 | 3.524535 |
82fe28a4-e75d-406e-bc87-1456e5c82f9a | PerMedCoE/2023summerschool-multiscale-material | projects/PhysiBoSS-COVID19_project/2_PhysiCell/examples/PhysiCell_test_DCIS.cpp | /*
*/
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <ctime>
#include <cmath>
#include <omp.h>
#include <fstream>
#include <time.h>
#include "../core/PhysiCell.h"
#include "../modules/PhysiCell_standard_modules.h"
using namespace BioFVM;
using namespace PhysiCell;
int omp_num_threads = 8; // s... | ALGO | 0.997698 | 5.503879 |
6959ef3b-6978-40da-b9f0-5ec4df9b40ad | chiraggulati098/college | 3_semester/dsa/old/2_array_index_deletion.cpp | #include <iostream>
using namespace std;
int main()
{
int a[11] = {0,1,2,3,4,5,6,7,8,9,10},b;
cout<<"original array:\t";
for (int i=0;i<11;i++) {
cout<<a[i]<<"\t";
}
cout<<"\n"<<endl;
cout<<"enter the index you want to delete: ";
cin>>b;
for (int i=0;b+i<11;i++) {
a[b... | ALGO | 0.996424 | 3.298504 |
1d2b3fc9-18b5-4054-9076-c986d991b733 | WizardPenguin/competative-programming | ubuntu/D2_Sage_s_Birthday_hard_version_.cpp | // let's try using binary seach
// guess number of cheap spheres
// then check weather we can make such combination that have that number of cheap sphere
// for that we are going to take largest number and take largest 2 numbers to cover it
// we are going to take k largest number
#pragma GCC optimize("Ofast")
#prag... | ALGO | 0.999994 | 3.883332 |
53f20752-f4d0-4dfa-89a4-addefcbc32ca | shahishree03/codingaDays | Day20/line_trip.cpp | #include<iostream>
int main()
{
int test_cases;
std::cin>>test_cases;
while(test_cases--)
{
int n, x, calculate_max=0, prev_value_i_have=0, store_diff=0;
std::cin>>n>>x;
while(n--)
{
int a;
std::cin>>a;
store_diff= a-pr... | ALGO | 0.9998 | 4.429996 |
40df2ec1-8351-4e31-906e-74b3c48c3f23 | ishandutta2007/codeforces | soschina/normal/1293/C.cpp | #include <cstdio>
using namespace std;
const int MAXN = 2e5 + 1;
bool map[3][MAXN];
int n, q, cnt, x, y;
int main(){
scanf("%d%d", &n, &q);
while(q--){
scanf("%d%d", &x, &y);
map[x][y] ^= 1;
for(int i = -1; i <= 1; i++)
if(y + i > 0 && y + i <= n && map[x ^ 3][y + i])
cnt += map[x][y] ? 1 : -1;
print... | ALGO | 0.999975 | 4.009713 |
4e45c38c-5d7e-4e8c-9eb8-a42592a931ae | u-wyh/luogu-code | P6279.cpp | #include<bits/stdc++.h>
using namespace std;
const int MAXN = 2e5+5;
int n,m;
int cnt;
int fa[MAXN<<1];
int vis[MAXN];
inline int read(){
int x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9'){
if(ch=='-')
f=-1;
ch=getchar();
}
while(ch>='0' && ch<='9')
x=x*10+ch... | ALGO | 0.999967 | 4.246828 |
18b79322-7667-409d-8296-7821fb679e2b | hurairamuzammal/Flutter-Projects-Collection | 5.Stopwatch/Source Code/stopwatch/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.998191 | 6.771107 |
7c510b64-99c2-4778-bb9b-92f17cae3596 | Danielkarlsson91/My-own-projects | Tic tac toe/main.cpp | #include <ctime>
#include <iostream>
// Function declarations
void drawBoard(char *spaces);
void playerMove(char *spaces, char player);
void computerMove(char *spaces, char computer);
bool checkTheWinner(char *spaces, char player, char computer);
bool checkTie(char *spaces);
int main()
{
char playAgain; // Variab... | ALGO | 0.999485 | 7.644375 |
6e10190c-c562-4cfe-8883-f08d8a09eaf3 | adityakumar002216/CP-Geek_for_Geeks | Basic_attempt/Palidrome_array.cpp | class Solution {
public:
int PalinArray(int a[], int n)
{
// code here
int rev=0;
int k=0;
for(int i=0;i<n;i++){
int x=a[i];
int z=x;
rev=0;
while(x){
rev=rev*10+x%10;
x=x/10;
}
if(z==rev)
... | ALGO | 0.999404 | 4.936432 |
90903144-3cc2-4471-b88e-6095d363fe94 | ItsMeShashu/LeetCode-Bucket | 0039-combination-sum/0039-combination-sum.cpp | class Solution {
public:
void func(int idx, vector<int>& candidates, int n, int sum, int target, vector<int>& vec, vector<vector<int>>& result) {
if (idx == n) {
if (sum == target) result.push_back(vec);
return;
}
// INCLUDE..................
if ((sum + candid... | ALGO | 0.999981 | 6.775755 |
d121feff-f440-4157-88ec-05fa2711072b | iamsteven526/master | GDMA_MIMO/GDMA_MIMO/ch_model.cpp | #define _USE_MATH_DEFINES
#include <iostream>
#include <random>
#include "parameters.h"
using namespace std;
random_device seed;
mt19937 generator(seed());
uniform_real_distribution<double> uniform(0, 1);
exponential_distribution<double> exponential(1);
normal_distribution<double> normal(0, 1);
void EnergyProfile(dou... | ALGO | 0.999705 | 3.45761 |
4058aa19-1ddc-4618-a92e-eb4b4e16eb2e | haozihong/leetcode-zh | archive/lc_42. Trapping Rain Water.cpp | // Array, Two Pointer, Dynamic Programming, Stack
// stack 1
class Solution {
public:
int trap(vector<int>& height) {
vector<vector<int>::iterator> st;
int ans = 0;
for (auto it=height.begin(); it!=height.end(); ++it) {
while (!st.empty() && *st.back() <= *it) {
... | ALGO | 0.999992 | 6.675001 |
2b6a6b1e-5cd1-4de1-bb10-63708aa48ac3 | prerit2001/Competitive-Programming | String/Count the Reversals.cpp | // https://practice.geeksforgeeks.org/problems/count-the-reversals0401/1#
int countRev (string s)
{
if(s.size()%2 == 1) return -1;
// your code here
stack<int> ss;
int cnt = 0;
for(auto it : s){
if(it == '{') ss.push(1);
else{
if(ss.empty()) cnt ++,ss.push(1);
... | ALGO | 0.995574 | 4.316323 |
570cb70d-c746-475b-86dd-421c6a86c83e | Mamut2/CSES | Graph Algorithms/Cycle Finding/main.cpp | #include <bits/stdc++.h>
using namespace std;
struct Edge
{
int x, y, w;
};
const long long NMAX = 2501, INF = 1e10;
int n, m, par[NMAX], ok = 1;
long long d[NMAX];
vector<Edge> g;
unordered_set<int> s;
vector<int> res;
int main(){
cin >> n >> m;
for(int i = 0; i < m; i++){
int x, y, w;
... | ALGO | 0.999956 | 3.840284 |
bf9a95d0-ae99-4622-a3e0-bcfee9d7b06e | YONG15/yongtest | algorithm/02-13/sort.cpp | #include <iostream>
#include <algorithm> // <-- 정렬 기능이 포함된 라이브러리 (min, max)
using namespace std;
// 정렬
// -> 특정 집합의 요소들을 특정 기준으로 나열하는것
// 정렬 알고리즘
// STL의 정렬 기능을 그냥 가져다가 쓸것이다.
// --> STL에서 구현된 정렬 알고리즘 = 굉장히 "안정적"
// --> STL에서 만들어진 정렬의 시간복잡도는 "항상" O(NlogN) 보장
// --> C++ >> Intro Sort
// --> heap 정렬, 삽입 정렬, quick 정렬
... | ALGO | 0.996742 | 5.063501 |
e052ec72-3966-48bc-a33f-8fab44e345d0 | hhh020/DSA-CPP | cpp_review/testing_debugging/quadratic_func_root.cpp | // program 1-36
#include <iostream>
#include <cmath>
using std::cout;
// 计算和输出二次方程的根
void outputRoots(const double& a, const double& b, const double& c)
{
double d = b * b - 4 * a * c;
if (d > 0) // 两个实数根
{
double sqrtd = sqrt(d);
cout << "There are two real roots "
<< (-b + ... | ALGO | 0.992044 | 3.824361 |
b6055d56-cabe-4261-9d36-6936b07c0c1e | darkshuige/codecode | c code/动物朋友(dfs.cpp | #include<bits/stdc++.h>
#define jiasu ios::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define INF 0x3f3f3f3f
#define int long long
using namespace std;
const int maxn=1000005;
int a[maxn];
int n,m,cnt=0;
void dfs(int i,int sum)
{
if(i+1<n)
{
if(sum==m)
{
cnt++;
sum=0;
}
// dfs(i+1,sum);
dfs(i+1,sum... | ALGO | 0.999947 | 3.693823 |
484af720-64d2-41a8-b311-b41b52852942 | limited-sky-3Q3q/subgraph_matching | GPU_sim/gpgpu-sim_distribution-master/src/intersim2/main.cpp | // $Id: main.cpp 5487 2013-02-27 08:16:18Z qtedq $
/*main.cpp
*
*The starting point of the network simulator
*-Include all network header files
*-initilize the network
*-initialize the traffic manager and set it to run
*
*
*/
#include <sys/time.h>
#include <string>
#include <cstdlib>
#include <iostream>
#incl... | TOOL | 0.864074 | 4.637435 |
4fb3aed7-3639-442e-b3de-75c20455d2a8 | ishandutta2007/codeforces | alexandr_ts/normal/1327/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
const int INF = 2e9;
const ll MOD = 998244353;
const ld EPS = 1e-9;
const int M = 31;
const int N = 1e6 + 10;
void solve() {
ll n, k;
cin >> n >> k;
if (k % 2 != n % 2) {
cout << "NO\n";
return;
}
if (n >= k * k) {... | ALGO | 0.999882 | 5.439811 |
79205ed1-45d1-492b-a16b-07286d42b098 | jpggg/Insertion_Sort | main.cpp | #include "insertion_sort.h"
int main() {
std::vector<int> source {17,16,15,14,13,13,12,11,10,9,8,7,6,5,4,3,2,1};
std::cout << "Size of source: " << source.size() << std::endl;
std::cout << "Insertion sort initiated.\nIterations: " << insertion_sort(source) << std::endl;
std::cout << "Size of sorted so... | ALGO | 0.999011 | 4.938145 |
7a4a527f-8a3c-4d99-afe3-48c575e4caf9 | RajibTheKing/ACMProgramming | UVA/01. Accepted/12893 Countit.cpp | #include <stdio.h>
int num[1000006];
long long rec(long long n)
{
if(n==0) return 0;
if(n==1) return 1;
if(n==2) return 1;
return rec(n/2 ) + n%2;
}
int main()
{
long long i,n,cas;
scanf("%lld",&cas);
while(cas--)
{
scanf("%lld",&n);
printf("%lld\n",rec(n));
}
r... | ALGO | 0.999971 | 4.074442 |
4720c99a-0445-4740-9271-7fabc0824f2a | jacob-zhoupeng/thinkincpp | ch16/Recycle.cpp | //: C16:Recycle.cpp
// Containers & polymorphism
#include <fstream>
#include <cstdlib>
#include <ctime>
#include "TStack.h"
using namespace std;
ofstream out("recycle.out");
enum TrashType {
AluminumT, PaperT, GlassT
};
class Trash {
public:
Trash(float Wt) : Weight(Wt) {
// Empty body
}
v... | TOOL | 0.947441 | 5.996488 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.