uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
f89cef58-acba-4cd3-bba1-e9dcac083825 | AlessanderLCarazas/Ciencia-de-la-Computacion-II---Laboratorio | LAB18_GRUPO_A_20190755_ EJECUTABLE_ALESSANDER_CARAZAS/Ejercicio 4.cpp | #include <iostream>
#include <math.h>
using namespace std;
template<int n>
struct trans_hexadecimal
{
enum
{
value_a = (n%16>=0 && n%16<=9) ? (48+n%16):(55+n%16),
value = value_a + trans_hexadecimal<n/16>::value*100
};
};
template<>
struct trans_hexadecimal<0>
{
enum
{
va... | ALGO | 0.997954 | 4.727096 |
262cff46-4f9d-4c27-adb7-a33a5ff997b8 | roshnimishraa/Leetcoding | 0085-maximal-rectangle/0085-maximal-rectangle.cpp | class Solution {
public:
int largestArea(vector<int>& histogram){
int n=histogram.size(), area=0;
stack<int> s;
for(int i=0; i<n; i++){
while(!s.empty() && histogram[s.top()]>=histogram[i]){
int top = s.top();
s.pop();
... | ALGO | 0.999985 | 6.332135 |
fe9ac786-7812-4577-9342-93854d5474b2 | pi0ne/programming-contest-solutions | by_field/dp/knapsack_v2.cpp | #include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = (int)(0); i < (int)(n); ++i)
#define reps(i, n) for (int i = (int)(1); i <= (int)(n); ++i)
#define rrep(i, n) for (int i = ((int)(n)-1); i >= 0; i--)
#define rreps(i, n) for (int i = ((int)(n)); i > 0; i--)
#define irep(i, m, n) for (int i =... | ALGO | 0.999998 | 4.24323 |
7326a34c-8094-429c-bc19-82dc632bc4e4 | AadityaAwasthy/Competitive-Coding | upsolve/round922_div2/XOR-Distance.cpp | #include<bits/stdc++.h>
using namespace std;
#define iterate(i,n) for(int i = 0 ; i < n ; i++)
#define INF 1e9
#define MOD 1000000007
#define MAXN 1000001
#define endl "\n"
#define deb(x) cout << #x << " = " << x << "\n";
#define arrout(a) for(auto itr : a) cout << itr << " "
#define arrin(a) for(auto& itr : a) cin >> ... | ALGO | 0.999875 | 4.351124 |
2b8102b9-d483-4fa3-adc6-af17427cb37a | alexandraback/datacollection | solutions_5765824346324992_0/C++/atetubou/main.cpp | #include <bits/stdc++.h>
#include <iostream>
#include <vector>
#include <queue>
#include <string>
#include <cstring>
#include <sstream>
#include <set>
#include <map>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
#define rep(i,n) for(int i=0;i<(int)(n);++i)
#define iter(a) __typeof(a.begin())
#define FOR(it... | ALGO | 0.999952 | 3.398514 |
10aee4a8-cd4f-4343-ba1b-598c0d3683b6 | ishandutta2007/codeforces | peti1234/normal/822/C.cpp | #include <bits/stdc++.h>
using namespace std;
int n, m;
long long t[200001];
int p;
int f(int x) {
return x+1;
}
struct cs
{
int k;
bool b;
int h;
int a;
bool operator<(cs x) const
{
return k<x.k || (k==x.k && b<x.b);
}
};
vector<cs> l;
int main()
{
cin >> n >> m;
for (... | ALGO | 0.999907 | 3.995703 |
d418e950-c02f-4939-8c57-a76e127e028e | tos36/atcoder | 148/E.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = 1LL<<60;
//int INF = numeric_limits<int>::max();
int main(int, char**) {
ll n; cin >> n;
ll ret = 0;
if (n%2==1) {
cout << ret << endl;
return 0;
}
n /= 2;
while(n) {
ret += n/5;
n /= 5;
}
c... | ALGO | 0.999965 | 4.477324 |
e7758144-ab53-48a2-9075-10cd40fae0a0 | Alejandro-GDLF/CodeWars | solutions/productOfConsecutiveFibNumbers.cpp | #include <vector>
typedef unsigned long long ull;
class ProdFib
{
public:
static std::vector<ull> productFib(ull prod);
};
std::vector<ull> ProdFib::productFib(ull prod){
ull previous = 0;
ull next = 1;
ull res;
while((res = previous * next) < prod ) {
std::swap(next, previous);
next +=previous;
... | ALGO | 0.999872 | 4.56539 |
c8e929f6-1be4-470f-87e1-ab943c5bcf4d | npnkhoi/Competitive-programming | Contests/QT_PreVOI_19/Day 2/TOUR.cpp | #include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
#define mp make_pair
#define pb push_back
#define REP(i,n) for (int i = 0; i < (n); ++ i)
#define FOR(i,a,b) for (int i = (a); i <= (b); ++ i)
#define FORD(i,b,a) for (int i = (b); i >= (a); -- i)
#define debug(x) cerr << #x << ": " << x ... | ALGO | 0.999514 | 4.038113 |
061b50a3-4814-4c69-8076-16ea88a2607a | VIACHESLAV-ERSHOV/Arrays | Search_1/main.cpp | #include <iostream>
using std::cin;
using std::cout;
using std::endl;
#define tab "\t"
void main()
{
setlocale(LC_ALL, "");
const int n = 10;
int arr[n];
for (int i = 0; i < n; i++)
{
arr[i] = rand() % 5;
}
for (int i = 0; i < n; i++)
{
cout << arr[i] << tab;
}
cout << endl;
// поиск повторений:
for... | ALGO | 0.994879 | 3.811177 |
1e2f6a70-a695-4449-a0b8-922841feff6d | lbenc135/Cpp_codes | Planina/main.cpp | #include <iostream>
#include <cmath>
using namespace std;
int main()
{
int n;
cin >> n;
long long n2=pow(2, n);
cout << (n2+1)*(n2+1);
}
| ALGO | 0.999477 | 4.260126 |
d9f76cf3-1eb9-49d6-bb17-675fc49881ba | mizuirorivi/kyopuro | ABC151proC.cpp | #include<bits/stdc++.h>
using namespace std;
#define ALL(v) (v).begin(),(v).end()
#define REP(i,p,n) for(int i=p;i<(int)(n);++i)
#define rep(i,n) REP(i,0,n)
#define SZ(x) ((int)(x).size())
#define debug(x) cerr << #x << ": " << x << '\n'
typedef long long int Int;
typedef pair<int,int> P;
using ll = long long;
using V... | ALGO | 0.999435 | 3.670503 |
ca2ce1c6-2b4a-4b30-941e-a340e613b358 | sprkrd/UPC-MAI-CIR | cir_project/cirp_vision/src/cirp_vision_alg.cpp | #include "cirp_vision_alg.h"
CirpVisionAlgorithm::CirpVisionAlgorithm(void)
{
pthread_mutex_init(&this->access_,NULL);
}
void CirpVisionAlgorithm::segmentate(const cv::Mat& in, cv::Mat& feedback,
const PointCloud& cl, cirp_vision::CirpDetectedPieces& detected_pieces)
{
segmenter_(in, 0.5);
feedback = segmen... | ALGO | 0.998485 | 4.9227 |
8208c9aa-7297-4353-9add-7183a71735e3 | tesion99/LeetCode | cpp/mergeKLists.cpp | /*
合并 k 个排序链表,返回合并后的排序链表。请分析和描述算法的复杂度。
示例:
输入:
[
1->4->5,
1->3->4,
2->6
]
输出: 1->1->2->3->4->4->5->6
*/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
ListNode* mergeKLis... | ALGO | 0.999891 | 5.626959 |
fd6e7f35-f179-46c4-88aa-66a5c0aab38b | avidanAbitbol/EX2_CPP | CPP_EX1_24-main/Demo.cpp | /*
* Demo program for Exercise 3.
* Author: Benjamin Saldman.
*/
#include "Graph.hpp"
#include "Algorithms.hpp"
using ariel::Algorithms;
#include <iostream>
#include <stdexcept>
#include <vector>
using namespace std;
int main()
{
ariel::Graph g1;
// 3x3 matrix that represents a connected graph.
vector... | ALGO | 0.962971 | 4.562347 |
e62710bd-ce7d-46ae-bf89-581d2ab51e83 | sarvex/leetcode-java | solution/1600-1699/1639.Number of Ways to Form a Target String Given a Dictionary/Solution.cpp | class Solution {
public:
int numWays(vector<string>& words, string target) {
const int mod = 1e9 + 7;
int m = target.size(), n = words[0].size();
vector<vector<int>> cnt(n, vector<int>(26));
for (auto& w : words) {
for (int j = 0; j < n; ++j) {
++cnt[j][w[... | ALGO | 0.999993 | 6.429691 |
cc4ef8bd-2951-4773-8ea5-3eed7d19e9c7 | daniel-ankit/Leetcode | 0817-linked-list-components/0817-linked-list-components.cpp | class Solution {
public:
int numComponents(ListNode* head, vector<int>& nums) {
if(nums.size()==0) return 0;
int count = 0;
map<int, bool>mp;
for(auto x:nums) mp[x] = 0;
while(head)
{
if(mp.find(head->val)!=mp.end() && mp[head->val] == 0)
{
... | ALGO | 0.999981 | 5.773816 |
b1b8208e-eb54-43cc-b78c-8ffe72d7817e | onetimer/onetimer | src/scrypt.cpp | #include "scrypt.h"
#include "util.h"
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <openssl/sha.h>
#if defined(USE_SSE2) && !defined(USE_SSE2_ALWAYS)
#ifdef _MSC_VER
// MSVC 64bit is unable to use inline asm
#include <intrin.h>
#else
// GCC Linux or i686-w64-mingw32
#include <cpuid.h>
#endif
#e... | ALGO | 0.984667 | 4.965306 |
0e6cded5-20f1-4d96-9bf7-7dcc049b2970 | ZTL-UwU/OI | OJ/gdgzoi/primary/practise/2225/2225_8.cpp | #include <iostream>
#include <stdio.h>
#include <math.h>
using namespace std;
typedef long long ll;
const ll MAXN = 10000;
ll a[MAXN];
ll m[MAXN];
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
void exgcd(ll a, ll b, ll &x, ll &y)
{
if (b == 0)
{
x = 1;
y = 0;
return;
}
exg... | ALGO | 0.999974 | 3.508788 |
77392e24-dc2c-4404-b561-40a9fd3e844d | taeokimeng/cpp-practice | bit_manipulation/main.cpp | #include <bitset>
#include <cstdint>
#include <iostream>
std::bitset<4> rotl(std::bitset<4> bits)
{
std::bitset<4> bits_check{0b1000};
// if((bits_check & bits) == 0b1000)
// {
// bits <<= 1;
// bits |= 0b0001;
// }
// else
// {
// bits <<= 1;
// }
// return bi... | ALGO | 0.96763 | 5.7433 |
b2055b3d-d1e8-4345-810e-0f68220a2ea3 | ayushh201/DSA2025 | Sliding Window/anagramOccurence.cpp | #include <bits/stdc++.h>
using namespace std;
class Solution {
public:
bool allZero(vector<int> &counter){
for(int &i:counter){
if(i!=0) return false;
}
return true;
}
int search(string &pat, string &txt) {
int n=txt.length();
int k=pat.length();
... | ALGO | 0.999385 | 5.969004 |
404ea709-a140-44c5-9981-1168a782bcd2 | EyadAimen/reddit-clone | 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 |
55d7126b-b500-4398-b4d0-c52fea4dd903 | Chandu71202/LEETCODE | LinkedLists/82 Remove Duplicates from Sorted List II.cpp | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/
class Solution {
public:
ListNode* deleteDupli... | ALGO | 0.999972 | 5.619766 |
9807ae39-584d-402c-94b6-fa02ddca07b2 | naseem173/cpp-practise | lecture 1/string.cpp | #include<iostream>
#include<algorithm>
using namespace std;
int main(){
// string s ="Hello";
// s="World";
// cout<<s<<endl;
// cout<<s.size()<<endl;
// //concatinate
// s.push_back('w');
// cout<<"Hello "+s+" !"<<endl;
// //insertion
// string z;
// getline(cin, z ,'@');
... | ALGO | 0.986336 | 3.337595 |
5f566d2a-c1db-4532-b76b-c23ebdd4b341 | KiddFrog/riibiitCam | opencv/opencv-master/modules/gapi/src/streaming/onevpl/cfg_params_parser.cpp | #include <stdio.h>
#include <algorithm>
#include <sstream>
#include "streaming/onevpl/cfg_params_parser.hpp"
#include "streaming/onevpl/utils.hpp"
#include "logger.hpp"
#ifdef HAVE_ONEVPL
namespace cv {
namespace gapi {
namespace wip {
namespace onevpl {
template <>
struct ParamCreator<CfgParam> {
template<type... | CONFIG | 0.929606 | 6.356777 |
3cec68a4-ccfc-4907-8635-15c6f99e47f9 | TheVTV/pliki-matura | CR35/CR35/z3.cpp | #include <bits/stdc++.h>
using namespace std;
int tab[750];
int lz[750];
int lk[750];
int np[750][2] = { 0 };
bool czyP(int n) {
for (int i = 2; i * i < n; i++) {
if (n % i == 0) return false;
}
return true;
}
bool czyPali(int n) {
string a, b;
a = to_string(n);
b = to_string(n);
... | ALGO | 0.997404 | 3.130369 |
b8f1172b-bc60-4efb-b64f-df913a3ac565 | HONGJICAI/LeetCode | cpp/416.cpp | // 1-13ms.cpp
class Solution {
public:
bool canPartition(vector<int> &nums) {
bitset<10001> bits(1);
int sum = 0, n = nums.size();
for (auto i : nums) {
sum += i;
bits |= bits << i;
}
if ((sum & 1) == 1)
return 0;
return bits[sum / 2];
}
};
// 2-29ms.cpp
class Solution2 {
p... | ALGO | 0.999927 | 5.720969 |
9db95b4b-95db-4d4e-9e07-345ae3a04313 | fafa1899/BuildCppDependency | Source/proj-9.4.1/src/projections/tobmerc.cpp |
#include <float.h>
#include <math.h>
#include "proj.h"
#include "proj_internal.h"
#include <math.h>
PROJ_HEAD(tobmerc, "Tobler-Mercator") "\n\tCyl, Sph";
static PJ_XY tobmerc_s_forward(PJ_LP lp, PJ *P) { /* Spheroidal, forward */
PJ_XY xy = {0.0, 0.0};
double cosphi;
if (fabs(lp.phi) >= M_HALFPI) {
... | ALGO | 0.984361 | 6.189405 |
ac0a86b9-1104-4c4d-98a9-41d285ecd696 | ducphanduyagentp/vbox-svn | src/VBox/Runtime/generic/semxroads-generic.cpp | /* $Id$ */
/** @file
* IPRT Testcase - RTSemXRoads, generic implementation.
*/
/*********************************************************************************************************************************
* Header Files ... | TEST | 0.892349 | 6.409857 |
84099611-1147-4033-a542-0addd2adfd07 | gtkn/atcoder | ABC_275_E_2.cpp | //title
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
#define rep(i,n) for (ll i = 0; i < (n); ++i)
#define rep1(i,n) for (ll i = 1; i <= (n); ++i)
#define repr(i,n) for (ll i = (n)-1; i >= 0; --i)
#define rep1r(i,n) for (ll i = (n); i > 0; --i)
#define bit(n,k) ((n>>k)&1... | ALGO | 0.999953 | 4.079639 |
81ba1cc5-566a-422c-8b85-14ab3290140c | geyan3566/mfem_dgd | examples/superlu/ex1p.cpp | // MFEM Example 1 - Parallel Version
// SuperLU Modification
//
// Compile with: make ex1p
//
// Sample runs: mpirun -np 4 ex1p -m ../../data/square-disc.mesh
// mpirun -np 4 ex1p -m ../../data/star.mesh
// mpirun -np 4 ex1p -m ../../data/st... | ALGO | 0.998883 | 4.94149 |
03de9e8a-c243-4c8d-918f-19e8867c1f8c | sr4saurabh/CSESsolutions | CSES-SEARCHING AND SORTING/CSESsubarraysums1and2both.cpp | /*--ILRS-- sr4saurabh */
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define popb pop_back
#define mp make_pair
#define ve vector
#define vii vector < int >
#define vll vector < ll >
#define pii pair < int , int >
#define pll pair < ll , ll >
#define vpl vector < pll... | ALGO | 0.999957 | 3.982998 |
450f41ba-bc83-4fbb-a66c-4b9a4346b3d9 | UFAPE-Dev/Solar-System | ext/assimp/code/Common/SGSpatialSort.cpp | /** @file Implementation of the helper class to quickly find
vertices close to a given position. Special implementation for
the 3ds loader handling smooth groups correctly */
#include <assimp/SGSpatialSort.h>
using namespace Assimp;
// --------------------------------------------------------------------------------... | ALGO | 0.998921 | 7.007978 |
fac49fcb-9108-4e16-a519-cc1095c19421 | Architkumar29082001/leetcode-solutions | FizzBuzz.cpp | /*
Code
Testcase
Testcase
Result
412. Fizz Buzz
Solved
Easy
Topics
Companies
Given an integer n, return a string array answer (1-indexed) where:
answer[i] == "FizzBuzz" if i is divisible by 3 and 5.
answer[i] == "Fizz" if i is divisible by 3.
answer[i] == "Buzz" if i is divisible by 5.
answer[i] == i (as a string) ... | ALGO | 0.999711 | 6.824521 |
4d585500-6658-49af-b184-9fd30d25212c | yipan12/ProjectClassroomUas | 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 |
c5a046bb-b942-45c7-8ed7-f2f3d07deca7 | succculent/201FinalProject | Virus/lldb/packages/Python/lldbsuite/test/functionalities/data-formatter/data-formatter-stl/libcxx/bitset/main.cpp | #include <bitset>
#include <stdio.h>
template<std::size_t N>
void fill(std::bitset<N> &b) {
b.set();
b[0] = b[1] = false;
for (std::size_t i = 2; i < N; ++i) {
for (std::size_t j = 2*i; j < N; j+=i)
b[j] = false;
}
}
template<std::size_t N>
void by_ref_and_ptr(std::bitset<N> &ref, std::bitset<N> *pt... | TOOL | 0.944126 | 3.790956 |
47beacd9-b616-49ad-87c2-9600a44dae5a | y-aut/AtCoder | src/abc/300/d.cpp | #include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
// clang-format off
/* accelration */
// 高速バイナリ生成
#pragma GCC target("avx")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
// cin cout の結びつけ解除, stdioと同期しない(入出力非同期化)
// cとstdの入出力を混在させるとバグるので注意
struct Fast {Fas... | ALGO | 0.999775 | 5.137631 |
baf7ed05-6c55-402c-b32b-17e9e7c3a49c | someoneAlready/Summer-Code | Invitation/Nanjing/8.cpp | #include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cctype>
#include <ctime>
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
#include <set>
#include <map>
#include <stack>
using namespace std;
typedef vector<int> vi;
typedef map<int,int> mii... | ALGO | 0.999769 | 3.527208 |
f28a3d1b-6f95-40f3-85f6-6633e4b6d44e | aishakandeell/cs2labproject | fns.cpp | #include "fns.h"
#include <vector>
#include <string>
using namespace std;
fns::fns() {}
int fns::getIndex(vector<string> v, string un)
{
auto iter = find(v.begin(), v.end(), un);
if (iter != v.end())
{
int index = iter - v.begin();
return index;
}
else {
return -1;
}
}... | TOOL | 0.978607 | 4.682024 |
8361690d-fd46-4d0e-a888-451764179089 | merelydust/PAT-Advanced-Level | 真题模拟/1036 Boys vs Girls.cpp | #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
struct stu {
string name, id;
char gender;
int grade;
};
bool toSmall(stu a, stu b) {
return a.grade > b.grade;
}
bool toBig(stu a, stu b) {
return a.grade < b.grade;
}
int main() {
int n; cin >>... | ALGO | 0.998583 | 5.106023 |
95e1bca6-80f6-4dd1-9776-ee8989631049 | Nicu-Ducal/Competitive-Programming | C++/Codeforces/problem1328B.cpp | #include <bits/stdc++.h>
#define pb push_back
#define fi first
#define se second
typedef unsigned long long ul;
typedef long long ll;
using namespace std;
int main(){
ios_base::sync_with_stdio(0); cin.tie(); cout.tie();
ll t;
cin >> t;
while(t--){
ll n, k;
cin >> n >> k;
ll p1,... | ALGO | 0.999614 | 3.616993 |
20ecce4a-767a-44ab-9a44-6de03f5c457d | ioncoincore/ion-bitbucket | src/pos/checks.cpp | #include "chain.h"
#include "chainparams.h"
#include "checks.h"
#include "util.h"
#include "validation.h"
#include "xion/xionchain.h"
#include "xion/xionmodule.h"
#include "xion/zerocoindb.h"
bool IsBlockHashInChain(const uint256& hashBlock)
{
if (hashBlock == uint256() || !mapBlockIndex.count(hashBlock))
... | ALGO | 0.912165 | 5.55696 |
c644f9ff-6673-403a-9520-dee405d07d45 | Saurav-sanu/Leetcode | 0045-jump-game-ii/0045-jump-game-ii.cpp | class Solution {
public:
int jump(vector<int>& nums) {
int jmp=0;
int left=0,right=0;
while(right<nums.size()-1){
int farthest=0;
for(int index=left;index<=right;index++){
farthest=max(farthest,nums[index]+index);
}
left=right+1... | ALGO | 0.999992 | 5.941517 |
25780d92-fcef-425d-81fa-f01bffdfbd3f | AdilRas/Kattis | freefood.cpp | #include<bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define pb push_back
#define LSB(x) ((x)&(-x))
typedef long long ll;
typedef vector<int> vi;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
vi days(366, 0);
int n; cin >> n;
while(n--) {
int a, b;
cin >> a >> b... | ALGO | 0.999877 | 3.858534 |
b582347e-3f97-4d80-8e43-2a089c2e7cd5 | chyntiaclaudiaa/Lab-AP-5 | pertemuan6_ArrayVector/tugas/no2.cpp | #include <iostream>
#include <vector>
#include <cmath>
#include <iomanip>
using namespace std;
// Fungsi untuk menghitung efisiensi dari suatu peran
double HitungEfisiensi(vector<int>& peran) {
double efisiensi = sqrt(pow(peran[0], 2) + pow(peran[1], 2) + pow(peran[2], 2));
return efisiensi;
}
// Fungsi unt... | ALGO | 0.999927 | 6.030505 |
58819fc9-a4f9-4c80-9ece-a57ef4c7a785 | olveryu/CSCI1730-system-programming | Yan-Zhenyu-lab02/number.cpp |
#include<iostream>
#include<string>
#include<iomanip>
#include<cstdlib>
using std::cout;
using std::cin;
using std::endl;
using std::string;
//--------------------------------------------------------------
//function to regonize what kind of string will print
//-------------------------------------------------------... | ALGO | 0.94669 | 5.447464 |
2cb52d6b-2e7f-47d4-832a-4bdca4a7ebeb | juanplopes/euler-plus | 008.cpp | #include <iostream>
#define ull unsigned long long
using namespace std;
int main() {
int cases, n, k; cin >> cases;
while(cin >> n >> k) {
string s;
cin >> s;
int maxx = 0;
for(int i=0; i<s.size()-k; i++) {
int prod = 1;
for(int j=0; j<k; j++)
... | ALGO | 0.999819 | 3.649465 |
ffa24c01-6d47-4005-937c-178e20a97d09 | beshambher/Software-Testing | Inputs/C++ files/Greater in Two.cpp | #include<iostream>
using namespace std;
int main()
{
int a, b, c;
cout<<"Enter the two numbers (between 1-100): ";
cin>>a>>b;
cout<<endl;
if((a>0)&&(a<101)&&(b>0)&&(b<101)) {
if(a>b) {
c=a;
}
else {
c=b;
}
cout<<"Greater in "<<a<<" and "<<b<<" is "<<c<<endl;
}
else {
cout<<"Inputs out... | ALGO | 0.98165 | 3.102692 |
5eb2f144-32ca-4816-ab78-efdc0f73da05 | matszpk/native-boinc-for-android | src/boinc-6.12.38/lib/unix_util.cpp | #include "unix_util.h"
// Note. This already has an ifdef around it. If it is causing problem
// then HAVE_SETENV should be defined in your configuration files.
#ifndef HAVE_SETENV
#include <vector>
#include <cstring>
#include <cerrno>
#include <cstdlib>
static std::vector<char *> envstrings;
// In theory setenv()... | TOOL | 0.85032 | 5.684321 |
cbe23d56-362e-4e03-85d8-c069bfe5a295 | hugginse/CppPrimerPlus | C++ Primer Plus第6版中文版源代码/Chapter 8/strquote.cpp | // strquote.cpp -- different designs
#include <iostream>
#include <string>
using namespace std;
string version1(const string & s1, const string & s2);
const string & version2(string & s1, const string & s2); // has side effect
const string & version3(string & s1, const string & s2); // bad design
int main()
{
... | TOOL | 0.856504 | 5.254143 |
5e8ea5d0-8afc-4b81-8f79-50c6d2f4b427 | Cherubin62/gmsh | contrib/Netgen/libsrc/meshing/smoothing2.5.cpp | #include <mystdlib.h>
#include "meshing.hpp"
#include <opti.hpp>
namespace netgen
{
void MeshOptimize2d :: ProjectBoundaryPoints(Array<int> & surfaceindex,
const Array<Point<3>* > & from, Array<Point<3>* > & dest)
{
for(int i=0; i<surfaceindex.Size(); i++)
{
if(surfaceindex[i] >= 0)
{
... | ALGO | 0.996897 | 5.308161 |
3ceab99a-b3fd-4d7a-b7d4-38f5d44aea06 | hewmatt10/Competitive | Data Structures/RMQ.cpp | //range minimum query and range maximum query
#include <bits/stdc++.h>
using namespace std;
const int MM=5e4+3,LOG=16;
int mi[LOG][MM],mx[LOG][MM];
int main() {
cin.tie(0);cout.tie(0);ios_base::sync_with_stdio(0);
int n,q; cin>>n>>q;
for (int i=1;i<=n;i++) {
cin>>mi[0][i]; mx[0][i]=mi[0][i];
}
... | ALGO | 0.999906 | 4.387312 |
77aeead1-e544-405e-ae67-019a21663355 | Ishwarendra/Contests | CODEFORCES_CONTEST/902_Div2/E__good.cpp | #include "bits/stdc++.h"
#ifdef LOCAL
#include "F:\CPP\Debug\debug.h"
#else
#define print(...) 1;
#endif
using i64 = long long;
int main()
{
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int n;
std::cin >> n;
std::vector<int> a(n);
for (int i = 0; i < n; i++)
std::ci... | ALGO | 0.999962 | 4.022564 |
3bbe13cb-6417-40eb-9127-936cf2e99ee5 | MaheswariRajendranDSA/Data-Structures-and-Algorithms | Trees/tree-4/Flatten_a_binary_tree_to_a_linked_list_MORRIS.cpp | #include<bits/stdc++.h>
using namespace std;
class Node{
public:
int data;
Node* left;
Node* right;
Node(int val){
data = val;
left = right = NULL;
}
};
class Solution {
public:
Node *prev = NULL;
void flattenListlistRecursion(Node *root)
{
if(!root) return;
flattenLis... | ALGO | 0.999987 | 5.013746 |
c1a19de4-dfe0-4a90-ae09-b15eadc684a4 | ishandutta2007/codeforces | kmjp/normal/800/A.cpp | #include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;
#undef _P
#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 ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZER... | ALGO | 0.999907 | 3.415696 |
bca22d99-dac3-4367-91c8-55a2fed5ac00 | miank108/CompetitiveProgramming | GeeksForGeeks/PrintElementsOfArray/PrintElementsOfArray.cpp | // PrintElementsOfArray.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int main()
{
int t(0), n(0);
cin >> t;
for (int i = 0; i < t; i++)
{
cin >> n;
int *arr = new int[n];
for (int i = 0; i < n; i++)
{
cin >> arr[i];
}
... | ALGO | 0.981647 | 4.820124 |
d0f423c6-9f69-4350-80ae-127531111d56 | algorithmcardboard/operating-systems | lab3/src/pr_algos/nru.cpp |
class NRU:public AbstractPR{
private:
unsigned int instructionCount;
ifstream* fin;
unsigned int size, ofs;
int* arr;
int getRandomNumber(){
ofs = ofs % size;
int retVal = *(arr + ofs);
ofs++;
return retVal;
}
public:
NRU(vector<pte>* pt, vector<unsigned int>* f... | ALGO | 0.965174 | 3.714756 |
6ab53c4d-a8eb-4608-9a7b-259ac73b998a | deepeshahirwar/Contest_Problems | Codeforces/B_intercept_input.cpp | // codeforces round 988 div. 3
// B.intercepted input
#include<bits/stdc++.h>
using namespace std;
void deepesh7024(){
int n;
cin>>n;
vector<int>a(n);
unordered_map<int, int>m;
int val = n-2;
for(int i=0; i<n; i++){
cin>>a[i];
}
for(int i=0; i<n; i++){
if(val%a[i] == 0 and m[val/a[i]]){
cout<<a... | ALGO | 0.999687 | 3.335346 |
583cc878-c0ba-4001-b191-9151aa7a5c4c | ishandutta2007/codeforces | pavel.savchenkov/normal/522/D.cpp | #include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <set>
#include <map>
#include <utility>
#include <cstdlib>
#include <memory>
#include <queue>
#include <cassert>
#include <cmath>
#include <ctime>
using namespace std;
#define pb push_back
#defin... | ALGO | 0.999989 | 4.515897 |
a179eb15-79f6-4c94-a0fd-fa72f54ab8e7 | CodesbyUnnati/Solutions | Intersection_point_of_2_LL.cpp | // { Driver Code Starts
//
#include <bits/stdc++.h>
using namespace std;
struct Node
{
int data;
Node *next;
Node(int val)
{
data=val;
next=NULL;
}
};
Node* inputList(int size)
{
Node *head, *tail;
int val;
cin>>val;
head = tail = new Node(val);
while... | ALGO | 0.999931 | 4.630661 |
3059f5fb-68a1-4398-be54-98a01487eaf4 | satyamy846/dsa-love-babbar-unacademy | Array/duplicates.cpp | vector<int> duplicates(int arr[], int n) {
// code here
sort(arr,arr+n);
vector <int> ans;
for(int i=0; i<n; i++){
for(int j=i+1; j<n; j++){
if(arr[i]==arr[j]){
ans.push_back(arr[i]);
}
}
}
if(ans... | ALGO | 0.999896 | 4.776628 |
690de82f-8829-47d2-8053-3c398369487b | Acasune/Atcoder | abc046_c.cpp | #include <bits/stdc++.h>
//----***やべーやつら***----
using namespace std;
#define int long long
//----***型定義***----
using ll = long long;
using pll = pair<ll, ll>;
using pdd = pair<double, double>;
typedef long double ld;
typedef pair<int,int> P;
//----***Like a Pythonista***----
#define REP(ii,jj,nn) for (ll ii=jj;ii<(nn... | ALGO | 0.999745 | 3.907421 |
f05e189a-69b4-4a87-a021-0cb173dd8d83 | ParvBudh28/cbcp | deepakAndPrimes.cpp | #include<bits/stdc++.h>
#define int long long
using namespace std;
bitset<100000000> prime;
void fastIO() {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
}
void makeSieve() {
// int count = 1;... | ALGO | 0.999767 | 4.599453 |
15b98bb6-a75c-4d54-b9de-022c7fdf906e | buraindo/ITMO | Algorithms/3 Semester/Lab 3 - Strings/SubstringsCount.cpp | //
// Created by buraindo on 21.12.18.
//
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
const ll MAX = 256;
void buildLCP(const string& s, const vector<int>& suffixArray, vector<int>& lcp) {
int n = s.length();
vector<int> pos(n);
for (int i = 0; i... | ALGO | 0.999927 | 4.151242 |
a34d467c-e6df-4f85-affa-533ba532a6fd | ishandutta2007/codeforces | ilya_msu/normal/442/B.cpp | #define _CRT_SECURE_NO_WARNINGS
#pragma comment(linker, "/STACK:128000000")
#define _USE_MATH_DEFINES
#include<iostream>
#include<vector>
#include<string>
#include<stack>
#include<algorithm>
#include<cmath>
#include<set>
#include<queue>
#include<sstream>
#include<utility>
#include<map>
#include<ctime>
#include<cstdio>
... | ALGO | 0.999915 | 3.659828 |
565e7c5d-3c8c-4687-aa54-36807bc98f2d | 18tejaswini/leetcode | ArrayAndString/BestTimeToBuyAndSellStock.cpp | /*
You are given an array prices where prices[i] is the price of a given stock on the ith day.
You want to maximize your profit by choosing a single day to buy one stock and
choosing a different day in the future to sell that stock.
Return the maximum profit you can achieve from this transaction.
If you cannot achieve ... | ALGO | 0.999476 | 6.537655 |
5358a48e-b460-4527-a2bf-07cadb6d824e | EddyBautista-93/MyApp-Flutter | 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.998693 | 6.797273 |
82f39200-fc2a-4adc-ad29-ec13fa3dee88 | EslamMohey96/socialMVVM | 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 |
38845a24-20f9-40cd-9f1d-0516acaa1c00 | joekernphd/rshell | rshell/src/par.cpp | #include "par.h"
vector<string> Parser::parse(string input){
string::iterator it = input.begin(); // starts iterator at start of string
string toBePushed, comparator; // two temps
vector<string>tokens; // tokenvector
while(it != input.end()) { // while the iterator doesnt hit the end of the string... | TOOL | 0.918279 | 3.377604 |
86a85d55-dd07-46f5-abf3-5a46c43524d4 | premsai-konduru/ardupilot | libraries/AP_TempCalibration/AP_TempCalibration.cpp | /*
temperature calibration library
*/
#include "AP_TempCalibration.h"
#include <stdio.h>
#include <AP_Baro/AP_Baro.h>
extern const AP_HAL::HAL& hal;
#define TCAL_DEBUG 0
#if TCAL_DEBUG
# define debug(fmt, args ...) do {printf("%s:%d: " fmt "\n", __FUNCTION__, __LINE__, ## args); } while(0)
#else
# define debug(... | TOOL | 0.860588 | 3.191301 |
c8f555c5-c8d1-4e9f-ac5c-60f766a44e95 | yqw1212/fuzztruction-llvm11.0.1 | clang-tools-extra/clangd/FuzzyMatch.cpp | #include "FuzzyMatch.h"
#include "llvm/ADT/Optional.h"
#include "llvm/Support/Format.h"
namespace clang {
namespace clangd {
constexpr int FuzzyMatcher::MaxPat;
constexpr int FuzzyMatcher::MaxWord;
static char lower(char C) { return C >= 'A' && C <= 'Z' ? C + ('a' - 'A') : C; }
// A "negative infinity" score that wo... | TOOL | 0.9428 | 4.051769 |
d8a74a87-d3f0-4d2e-a320-68a8e08b72f6 | EmmanuelOoko/CwithClasses | learnCpp/review.cpp | #include <iostream>
#include <vector>
using namespace std;
void vectorManipulation(){
vector<int> myVector(4);
cout << "Enter " << myVector[0] << ": \n";
cin >> myVector[0];
cout << "Enter " << myVector[1] << ": \n";
cin >> myVector[1];
cout << "Enter " << myVector[2] << ": \n";
cin >> m... | ALGO | 0.97494 | 3.86818 |
9c156a9b-0a63-4da6-a803-826b6d43d91e | 113bommy/deepmind_codecontests_refine | cpp_source_filter_file/cpp_train_6400_10.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 5e5 + 20;
vector<pair<int, int> > seg[maxn * 4];
vector<int> prefix_min[maxn * 4];
int a[maxn], nex1[maxn], d[maxn], ans;
map<int, int> mp;
void build(int s, int e, int v) {
if (e - s < 2) {
seg[v].push_back({nex1[s], d[s]});
prefix_min[v].push_ba... | ALGO | 0.999977 | 4.332559 |
eabed637-1092-4b5e-9c89-451af57aeee2 | dhanushbabuk/DSA | Stacks/Medium/2.Immediate_smallest_element.cpp |
#include <iostream>
#include <vector>
using namespace std;
vector<int> nextSmaller(vector<int> &Arr, int N)
{
vector<int> result(N, -1); // Initialize result vector with -1
// BRUTE FROCE METHOD
for (int i = 0; i < N - 1; i++)
{
if (Arr[i] > Arr[i + 1])
{
... | ALGO | 0.999983 | 5.112078 |
aacda687-5fa1-4236-a8d6-908798bfc70d | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_2867_10.cpp | #include <bits/stdc++.h>
using namespace std;
int main() {
int n, k, a, b, c, d;
cin >> n >> k >> a >> b >> c >> d;
if (n == 4 or k < n + 1) {
cout << -1 << endl;
return 0;
}
cout << a << " " << c;
for (int i = 1; i < (int)n + 1; ++i)
if (i != a and i != b and i != c and i != d) cout << " " << i... | ALGO | 0.999825 | 3.098108 |
1c17f5a9-104a-4709-aea4-717dc5a35e6e | sakib3201/My_codes | UVA solve/UVA 10812 Beat the spread/main.cpp | #include <iostream>
using namespace std;
int main()
{
unsigned long long int n,i,s,d,x,y,fi;
scanf("%llu",&n);
for(i=0;i<n;i++)
{
scanf("%llu %llu",&s,&d);
if(s<d||(((s+d)%2)!=0)||((s-d)%2!=0))
printf("impossible\n");
else
{
x=(s+d)/2;
... | ALGO | 0.999881 | 3.652809 |
e3d23db4-f1b3-49b1-a06b-bd5647133e50 | Xuding0829/CompetitiveProgramming | Src/Codeforces/Codeforces Round 846 (Div. 2)/A. Hayato and School.cpp | #include <bits/stdc++.h>
using i64 = long long;
void solve()
{
int n;
std::cin >> n;
std::vector<std::pair<int, int>> odd, even;
for (int i = 0; i < n; i++)
{
int x;
std::cin >> x;
if (x & 1)
odd.push_back({x, i + 1});
else
even.push_back({... | ALGO | 0.999849 | 4.773327 |
ac4a502c-f5b2-4512-9006-702902c4b2af | SangHunHan92/SensorsCalibration | lidar2camera/joint_calib/3rdparty/eigen3/doc/examples/Tutorial_ReductionsVisitorsBroadcasting_broadcast_simple_rowwise.cpp | #include <iostream>
#include <Eigen/Dense>
using namespace std;
int main()
{
Eigen::MatrixXf mat(2,4);
Eigen::VectorXf v(4);
mat << 1, 2, 6, 9,
3, 1, 7, 2;
v << 0,1,2,3;
//add v to each row of m
mat.rowwise() += v.transpose();
std::cout << "Broadcasting result: " << std::... | ALGO | 0.997822 | 4.26067 |
5fef2def-1a6e-4418-8dff-e6410a76c786 | 5ecret99/leetcode | problems/0371-sum-of-two-integers/solution.cpp | class Solution {
public:
int getSum(int a, int b) {
while(b)
{
auto tmp{a};
a^= b;
b = (b & tmp) << 1;
}
return a;
}
};
| ALGO | 0.999949 | 5.481693 |
eb6b85d5-75ba-4a66-8509-ca982f80ab87 | PlasmaControl/FreeMHD | OpenFOAM-v2206/ThirdParty/sources/boost/boost_1_74_0/libs/contract/example/mitchell02/simple_queue.cpp | //[mitchell02_simple_queue
#include <boost/contract.hpp>
#include <boost/optional.hpp>
#include <vector>
#include <cassert>
template<typename T>
class simple_queue
#define BASES private boost::contract::constructor_precondition< \
simple_queue<T> >
: BASES
{
friend class boost::contract::access... | TOOL | 0.853353 | 6.644628 |
01f29222-1b6c-41cd-89d9-a954ca9aaf11 | wukong220/Analyze | msd_fin/paras.cpp | #include "paras.h"
//#include "files.h" //for test
inline bool input(int &x)
{
stringstream ss;
string str;
getline(cin, str);
if (str == "\0")
{
return false;
}
else
{
ss << str;
ss >> x;
return true;
}
//cout << "String: " << x << endl;
}
inline bool input(string &x)
{
stringstream ss;
string ... | TOOL | 0.851466 | 3.09705 |
b2d59aa1-df6b-404e-9325-4ab72664ddf2 | okb-okb/cpp-random-test | sample_1.cpp | #include <iostream>
int main() {
int a, b;
std::cin >> a >> b;
std::cout << a << " " << b << std::endl;
return 0;
}
| ALGO | 0.954011 | 4.490927 |
cdcae7b1-db60-4fd2-a6b5-959fc5eec1bc | Uday-Berad22/GFG-questions | Easy/Move all zeroes to end of array/move-all-zeroes-to-end-of-array.cpp | //{ Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
//User function template for C++
class Solution{
public:
void pushZerosToEnd(int a[], int n) {
// code here
int j=0;
for(int i=0;i<n;i++){
if(a[i]!=0){
a[j]=a[i];
j++;
... | ALGO | 0.999322 | 6.064106 |
ee4d1cda-e6b7-43fa-a321-7e1349f06452 | Splasher1804/Godot_engine_3.4.4_for_ARM64_Windows | thirdparty/bullet/BulletCollision/CollisionShapes/btConvex2dShape.cpp | #include "btConvex2dShape.h"
btConvex2dShape::btConvex2dShape(btConvexShape* convexChildShape) : btConvexShape(), m_childConvexShape(convexChildShape)
{
m_shapeType = CONVEX_2D_SHAPE_PROXYTYPE;
}
btConvex2dShape::~btConvex2dShape()
{
}
btVector3 btConvex2dShape::localGetSupportingVertexWithoutMargin(const btVector3... | ALGO | 0.898501 | 7.572961 |
07fce49c-9719-409e-9a72-b34bc4341c21 | Diyasha22/6Companies30days | Day 1-5 : Company Name : Goldman Sachs/K. Find Missing And Repeating.cpp | // { Driver Code Starts
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
class Solution{
public:
int *findTwoElement(int *arr, int n) {
// code here
int arr2[n+1];
memset(arr2,0,sizeof(arr2));
int *a=new int[2];
a[0]=-1; a[1]=-1;
for(int i=0;i<n;... | ALGO | 0.999974 | 5.325488 |
cb53c1d0-c7bb-4b12-b841-d444eb3cc8e2 | iman1999/acm | UVA/499.cpp | #include <iostream>
#include <string>
using namespace std;
bool letter(char ch)
{
return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z');
}
int main()
{
string s;
while (getline(cin, s))
{
int i = 0, cnt[200] = { 0 };
while (s[i])
{
while (s[i] && !letter(s[i]))
i++;
while (s[i] && letter(s[i])... | ALGO | 0.999474 | 3.66727 |
7bce851b-873b-4848-98b6-b45b88c96ca0 | gucwakj/librs | deps/ode/ode/src/collision_cylinder_sphere.cpp | /*******************************************************************
* *
* cylinder-sphere collider by Christoph Beyer (<EMAIL>) *
* *
* In Cylinder/Sphere-collisions, there are three po... | ALGO | 0.997158 | 5.325126 |
f011887c-b0b4-4292-b8f1-d58222b6b37c | CodingNinja576/cpp_tutorial | learning_cpp_chaicode/loops/task6.cpp | // # 6. Nested Loops
// Challenge:
// // Write a program that brews multiple cups of different types of tea. For each type of tea, brew 3 cups using a nested loop.
#include <iostream>
#include <string>
using namespace std;
int main(){
string teaTypes[5] = {"Oolong tea", "Orange Tea", "Green Tea", "Black Tea", ... | TOOL | 0.892864 | 3.594207 |
b3ba4585-1d43-404f-b572-b311b0ece55f | dgonzalezarbelo/Kattis | trik.cpp | #include <bits/stdc++.h>
#pragma warning (disable : 4996)
using namespace std;
#define rep(i, a, b) for(int i = a; i < b; ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
#define fi first
#define se second
#define mp make_pair
const double EPS = 1e-9;
const double INF = 1e9; //1e18 tambien suele ir ... | ALGO | 0.999956 | 4.076079 |
3e232d38-7fed-4aca-a607-9c0258e10583 | lives-in-virgosupercluster/Codeforces_problem_solving | 1718C.cpp | #include <bits/stdc++.h>
#define ll long long int
#define endl "\n"
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(t--){
ll n;
cin>>n;
ll q;
cin>>q;
vector<ll>v(n,0);
ll j=0;
ll mx=-1;
for(ll i=0;i<n;i++){
cin>>v[i];
... | ALGO | 0.999849 | 3.848615 |
7755cfcc-3c02-417c-9db8-78a66eec6bec | ishandutta2007/codeforces | shayan.p/normal/894/C.cpp | #include<bits/stdc++.h>
#define ll long long
#define pll pair<ll,ll>
#define MP make_pair
#define PB push_back
#define F first
#define S second
using namespace std;
const ll maxn=2000;
ll a[maxn];
int main()
{
ll m;cin>>m;
for(ll i=0;i<m;i++)cin>>a[i];
for(ll i=1;i<m;i++){
if(a[i]%a[0]!=0){
cout<<-1;
return ... | ALGO | 0.999855 | 3.002338 |
1324f1d2-d493-4ba1-bf11-d5f44995f5b5 | karan316/algos | Past Problems/MoveZeroes.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
vector<int> nums = {0, 0, 1};
int zero_count = 0;
for (int i = 0; i != nums.size(); i++)
{
if (nums.at(i) == 0)
{
zero_count++;
}
}
// remove all elements matching with zeroes
nums.erase(std::rem... | ALGO | 0.994278 | 3.392061 |
23cbac8b-38d1-44be-ab46-15b14ca28ee6 | KocsisPatakiSimon/c-hazi | maximum/main.cpp | #include <iostream>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
if(a>b&&a>c){
cout<<a;
}
if(b>a&&b>c){
cout<<b;
}
if(c>a&&c>b){
cout<<c;}
return 0;
}
| ALGO | 0.999821 | 3.808209 |
214d79f4-a5c6-4bd8-8e41-1a50a9a57427 | Gaolious/algorithm | Baekjoon/001000_001999/1043/main.cpp | #include <bits/stdc++.h>
using namespace std;
#define BUFF_LEN (1<<21)
struct _FIN {
char *p;
char buf[BUFF_LEN+1];
int last_read;
bool eof;
_FIN() { p=buf+BUFF_LEN; last_read=0; eof=false;}
char B() {
if ( p - buf >= BUFF_LEN ) last_read = (int)fread(p=buf, 1, BUFF_LEN, stdin);
... | ALGO | 0.999911 | 3.470836 |
d5fdd38f-91b0-4083-be44-295685c8b514 | Khushal41/DSASupreme-1.0- | Week8-Divide&Conquer,TimeComplexityAndSpaceComplexity/Lecture3-BacktrakingLevel3/Q1.cpp | #include <iostream>
#include <vector>
using namespace std;
// By Reference
bool isSafe(int i, int j, int row, int col, int arr[][4], vector<vector<bool>> &visited)
{
// Element inside array && arr ke andar one palce && vsited false chahiye -> true
if (((i >= 0 && i < row) && (j >= 0 && j < col)) &&
(arr... | ALGO | 0.999979 | 5.19624 |
d27a0057-8c39-47ee-b135-14a3c973c11a | JawadKotaichh/Codeforces | Divisions/Div 3/Div 3 1037/A.cpp | #include <bits/stdc++.h>
using namespace std;
int32_t main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int t;
cin >> t;
while (t--)
{
int x;
cin >> x;
string s = to_string(x);
int mini = s[0] - '0';
for (int i = 1; i < s.size(); i++)
{
... | ALGO | 0.9994 | 5.648722 |
d458ef1e-09a1-4972-95ef-71a0d28018b9 | Booooooooooo/wyb---ACM | 数论/L.cpp | #include<stdio.h>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
int n,m,k;
const long long mod=1000000007;
long long a[300005],ni[300005],c[300005],ans[300005];
long long niyuan(long long x)
{
if(x==1)return 1;
return niyuan(mod%x)*(mod-mod/x)%mod;
}
long long quick_mod(long long a... | ALGO | 0.999949 | 3.030873 |
a1714194-7bb9-40f3-8390-51bda423551a | BigNews/Scheme_Interpreter | object/Integer.cpp | #include "Integer.h"
#include "..\debugger\Debugger.h"
#include <iostream>
#include <memory>
namespace ObjectDef
{
Integer::Integer()
{
//construct an Integer with value 0.
capacity = 1; size = 1;
nonnegative = true;
num = new int[capacity];
num[0] = 0;
objType = INTEGER;
//exactness = true;
}
bo... | TOOL | 0.917378 | 4.582633 |
e76f80be-1328-48f9-bd39-856d0425cbd6 | Anikcsejnu/cpp-problem-solving | C++/Algorithm/Subarray/108.cpp | #include<iostream>
using namespace std;
void kadane(int input[], int n, int &x1, int &x2, int &max)
{
int cur, i;
max = 0;
cur = 0;
x1 = x2 = 0;
int lx1, lx2;
lx1 = 0;
for(int i = 0; i<n; i++)
{
cur = cur+input[i];
if(cur > max)
{
max = cur;
... | ALGO | 0.999991 | 3.796994 |
205602de-8b0d-46c9-99ae-e7a2d777f1ea | samhocevar/pimp | src/pimp.cpp | #if HAVE_CONFIG_H
# include "config.h"
#endif
#include <lol/engine.h>
using namespace lol;
/* Image processing kernels */
struct dither : array2d<float>
{
ivec2 base_a, base_b;
// Reduce the lattice base
std::tuple<ivec2, ivec2> reduce_base() const
{
ivec2 new_a(base_a), new_b(base_b);
... | ALGO | 0.970725 | 4.454766 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.