uuid string | repo_name string | relative_path string | content string | category string | algo_rel_score float64 | quality_score float64 |
|---|---|---|---|---|---|---|
7b1f55dd-2555-4203-8c30-06bca3b93bb6 | vfolunin/archives-solutions | ACMP/792.cpp | #include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
using namespace std;
int digitSum(int n, int base) {
int res = 0;
while (n >= base) {
res += n % base;
n /= base;
}
return res + n;
}
int main() {
freopen("input.txt", "r", stdin);
freopen("output.txt"... | ALGO | 0.999632 | 4.30239 |
9ed32948-f15a-4a4c-bcd2-31164086a4e4 | TemMears/Laba_1 | лабапервая/Array.cpp | #include <stdio.h>
#include "Array.h"
void del(int* arr, int index, int& len) { //tp|y|y |u}u~
len--;
for (int i = index; i < len; i++) {
arr[i] = arr[i + 1];
}
}
void pushArr(int* arr, int* arr2, int index, int value, int& len) {
arr2[index] = value;
for (int i = 0; i < index; i++) {
... | ALGO | 0.989007 | 3.612601 |
7cd8a0d2-d3c2-4e82-b74b-1e3bc6eeb33d | gabrielrussoc/competitive-programming | kattis/zanzibar.cpp | #include <bits/stdc++.h>
#define pb push_back
using namespace std;
typedef long long ll;
int t;
ll last, at;
int main() {
scanf("%d", &t);
while(t--) {
last = -1;
ll ans = 0;
while(scanf("%lld", &at) && at != 0) {
if(last != -1) {
if(at > 2ll*last)
... | ALGO | 0.999829 | 3.505161 |
9af840a4-e154-4d1c-8ca0-abf385ace410 | Xrvitd/C_code | 拦截导弹11.cpp | #include<iostream>
#include<cstdio>
using namespace std;
int ans,n,a[100001],f[100001];
int main()
{
while(cin>>n)
{
for(int i=1;i<=n;i++)
cin>>a[i];
f[1]=a[1]; f[0]=0; ans=1;
for(int i=2;i<=n;i++)
if(a[i]>f[ans]) { ans++; f[ans]=a[i]; }
else
for(int j=ans;j>=1;j--)
if(f[j]>=a[i]&&f[j-1]<a[i])
... | ALGO | 0.999957 | 3.355729 |
3e9b1eb0-5bcc-46c2-9b04-df25ee70a80a | VolumetricBio/prusa3d-Slic3r | src/igl/piecewise_constant_winding_number.cpp | template <
typename DerivedF,
typename DeriveduE,
typename uE2EType>
IGL_INLINE bool igl::piecewise_constant_winding_number(
const Eigen::MatrixBase<DerivedF>& F,
const Eigen::MatrixBase<DeriveduE>& uE,
const std::vector<std::vector<uE2EType> >& uE2E)
{
const size_t num_faces = F.rows();
const size_t nu... | TOOL | 0.987513 | 6.570156 |
9b9401b5-f62d-494d-8fcc-d2ad5b6cc94d | NTU-CSIE-DSA/hw3-DynamicSpectrumArtistry | gen/gen_list.cpp | #include "testlib.h"
#include <climits>
#include <cassert>
#include <set>
#include <queue>
#include <utility>
using namespace std;
int main(int argc, char* argv[]) { // gen_dag MAX_V mode, 1 is singly and 2 is doubly
registerGen(argc, argv, 1);
assert(argc == 3);
int V = atoi(argv[1]);
int mode = atoi... | ALGO | 0.969998 | 3.764525 |
40903dd3-7a56-4fcc-8565-27c0d73fd752 | Shirehya/CS-CODE | 4-Design and Analysis of Algorithms/3-Dynamic Programming/2@Matrix_Chain_Multiplication.cpp | #include <bits/stdc++.h>
using namespace std;
void minMulti(int* p,int n,int** m,int** s)
{
for(int i=0;i<n;i++) m[i][i]=0;
for(int l=1;l<n;l++)
{
for(int i=0;i<n-l;i++)
{
int j=i+l;
m[i][j]=INT_MAX;
for(int k=i;k<j;k++)
{
int q=m[i][k]+m[k+1][j]+p[i]*p[k+1... | ALGO | 0.999875 | 3.648724 |
5574cc42-a025-479c-b77f-2274b55fa2ef | shadab375/important-interview-questions | binary search tree/two-sum-in-bst.cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode() : val(0), left(nullptr), right(nullptr) {}
* TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
* TreeNode(int x, TreeNode *left, TreeNode *right) : val(x), l... | ALGO | 0.999991 | 5.981794 |
147559d3-7d2d-497a-964a-d3c8dd10dbda | naxocist/POSN-IPST | beta/tumso17_macrosoft.cpp | #include <bits/stdc++.h>
using namespace std;
using ll = long long int;
using T = tuple<ll, int, int>;
const int N = 1e5 + 3;
ll dist[3][N], mat[3][N];
int main() {
int n; scanf("%d", &n);
for(int i=0; i<3; ++i) {
for(int j=0; j<n; ++j) scanf("%lld", &mat[i][j]), dist[i][j] = 2e18;
}
priori... | ALGO | 0.999886 | 3.64239 |
4e228728-2e7e-40d4-98b8-62de7c4ff6e3 | splucs/Competitive-Programming | Leetcode/3423.cpp | class Solution {
private:
inline int abs(int x) {
return x < 0 ? -x : x;
}
public:
int maxAdjacentDistance(vector<int>& nums) {
int prev = nums.back();
int ans = 0;
for (int num : nums) {
ans = max(ans, abs(num - prev));
prev = num;
}
r... | ALGO | 0.999909 | 5.88025 |
be015d2d-a88d-40f6-959a-d690f78ead46 | mrboorger/TEST | 1.cpp | #include <iostream>
int main() {
long double x = 0;
long double y = 0;
std::cout << "Enter x and y" << std::endl;
std::cin >> x >> y;
if (x == y * y) {
std::cout << "Error. Division by zero" << std::endl;
} else {
std::cout << "The expression is equal to "
<< (3 + x * x - y * y * y) *... | ALGO | 0.998892 | 4.046934 |
61d902d9-5903-4c7d-878a-244063633c01 | lds217/lds | LUYENCODE & JUNK/bai1b.cpp | #include <iostream>
#include <math.h>
using namespace std;
int main()
{
float n;
cin>>n;
float temp=n;
if(sqrt(n)==round(sqrt(n)))
cout<<n<<" la sao chinh phuong";
else
while(sqrt(temp)!=round(sqrt(temp)))
temp++;
cout<<temp;
system("p... | ALGO | 0.998604 | 3.005178 |
393a72a7-f499-47a4-98e2-67f5cec547c4 | uditamujumdar/LeetCode | 3165-find-indices-with-index-and-value-difference-i/find-indices-with-index-and-value-difference-i.cpp | class Solution {
public:
vector<int> findIndices(vector<int>& nums, int indexDiff, int valueDiff) {
int n=nums.size();
vector<int>ans(2, -1);
for(int i=0;i<n;i++){
for(int j=i;j<n;j++){
if(abs(i-j)>=indexDiff && abs(nums[i]-nums[j])>=valueDiff){
... | ALGO | 0.999995 | 5.631025 |
9de2d614-37ac-4f0f-802c-f7fa80af9fa2 | AndroidBBQ/android10 | frameworks/av/media/libstagefright/codecs/amrnb/common/src/norm_l.cpp | /*
Pathname: ./gsm-amr/c/src/norm_l.c
------------------------------------------------------------------------------
REVISION HISTORY
Description: Created separate file for the norm_l function. Sync'ed up
with the current template and fixed tabs.
Description: Updated module description to be the same a... | ALGO | 0.999018 | 6.369458 |
94ba1cbf-416c-4640-aa3b-355f36e3ac9e | ifejibola/CPP_DataStructures_Algorithms | reverseInPlace.cpp | /**
*
* Write a function that takes a string and reverses the letter in-place
*
*/
#include <string>
void reverseInPlace(std::string &str)
{
// base case
if (str.empty())
{
return;
};
size_t leftIndex = 0, rightIndex = str.length() - 1;
// walk down the middle
while (leftIndex ... | ALGO | 0.992034 | 6.312518 |
d257cc58-6d85-4286-8971-d94283ca1dbf | motonobu-t/algorithm | VisualC++/Chap6/Rei42/Rei42/Rei42.cpp | // Rei42.cpp : R\[ AvP[ṼGg |Cg`܂B
//
#include "stdafx.h"
/*
* -------------------------------
* QT̔z\ *
* -------------------------------
*/
#include <stdio.h>
#include <string.h>
#define nil -1
#define MaxSize 100
struct tnode {
int left; /* ւ̃|C^ */
char name[12];
int right; ... | ALGO | 0.999265 | 3.643863 |
99d186b6-8073-48c1-8416-6b10fdce3b44 | HarshitP147/DSA-CPP | Algorithms/Sorting/MergeSort.cpp | #include <iostream>
#include "./displayArray.h"
using namespace std;
void merge(int arr[],int mid,int left,int right){
// get the size of the two arrays
int n1 = mid - left + 1;
int n2 = right - mid ;
int arr1[n1],arr2[n2];
for(int i=0;i<n1;i++){
arr1[i] = arr[left+i];
}
for(int j=0;j<n2;j++){
arr2[j] = ... | ALGO | 0.999996 | 5.174339 |
d43b3d1c-af96-4984-98df-1296f4fc8baa | acnq/grind_75 | 02grind 75/week2/04_409.longest-palindrome.cpp | /*
* @lc app=leetcode.cn id=409 lang=cpp
* @lcpr version=30204
*
* [409] 最长回文串
*/
// @lcpr-template-start
using namespace std;
#include <algorithm>
#include <array>
#include <bitset>
#include <climits>
#include <deque>
#include <functional>
#include <iostream>
#include <list>
#include <queue>
#include <stack>
#in... | ALGO | 0.999969 | 6.388579 |
059acd0e-9841-4542-87aa-c3f19776c2ec | Padm0069/Leetcode-DSA | 494-target-sum/494-target-sum.cpp | //This question is same as number of subsets with given difference
class Solution{
public:
int countSubsets(vector<int>& nums, int n, int M)
{
int t[n+1][M+1];
for(int i=0; i<=n; i++)
{
for(int j=0; j<=M; j++)
{
if(i==0)
t[i][... | ALGO | 0.999992 | 5.548285 |
b0b4499e-3394-491e-92fd-cb5dabb7d3f4 | UrjasweeChatterjee/fcm-test | 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 |
c58b6312-4ccf-45d9-96b5-0111bc089cf6 | zoubs/AssemblyLanguage | 实验代码/汇编除法指令转乘法指令算法.cpp | #include <stdio.h>
typedef unsigned int uint32;
typedef unsigned long long uint64;
#define is2exp(x) (((x - 1) & x) == 0)//xǷΪ2
uint32 log2x(uint32 x)
{
//log2(x) , x>0
//Сڵx2ΪĶ
int e;
for (e = 31; e >= 0; e--) {
if ((int)x < 0) return e;
x <<= 1;
}
return -1;
}
int main()
{ //64λıڱвûȷֵãunit64 ... | ALGO | 0.99874 | 3.258487 |
29da962c-c497-41c8-9a4e-1738e9c70824 | Sagarbha1991/com.example.trilinos | packages/shylu/tacho/core/example/deprecated/tri_solve_unblocked.cpp | #include <Kokkos_Core.hpp>
#include <Kokkos_TaskPolicy.hpp>
#include <impl/Kokkos_Serial_TaskPolicy.hpp>
#include <Kokkos_Qthread.hpp>
#include <Qthread/Kokkos_Qthread_TaskPolicy.hpp>
#include <Kokkos_Threads.hpp>
#include <Threads/Kokkos_Threads_TaskPolicy.hpp>
#include "util.hpp"
#include "graph_helper_scotch.hpp... | ALGO | 0.994319 | 3.89589 |
2d8ee2a8-5fc0-4d56-8064-f718a03859fd | imPrincePandey/array-repo | BasicProblem/problem4.cpp | #include<iostream>
using namespace std;
bool isPrime(int n){
if(n<=1){
return false;
}
for(int i=2;i*i<=n;i++){
if(n%i==0){
return false;
}
}
return true;
}
int main(){
int n;
cout <<"please enter the no__";
cin>>n;
if(isPrime(n)){
cout<<... | ALGO | 0.999698 | 3.29427 |
14353e6b-c2a5-4405-9798-baed7db6e2e8 | aanchalsaini0007/DS-A-assignments | Day_03/3.cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
int arr[n];
for(int i=0;i<n;i++)
cin>>arr[i];
vector<int> v;
for(int i=0;i<n;i++)
{
int freq=arr[2*i];
int value=arr[2*i+1];
if(binary_search(arr,arr+n,freq))
{
if(b... | ALGO | 0.999957 | 3.240323 |
249d6e4a-fc14-4cb5-a433-8bf10b809c5a | AlexandruOlteanu/Range-Minimum-Query-Project | SegmentTree.cpp | #include <bits/stdc++.h>
#include "algo.h"
using namespace std;
typedef long long ll;
const int maxn = 1e6 + 2;
template<typename A>
struct SegmentTree{
vector<A> array;
vector<A> tree;
SegmentTree(int n){
array.resize(n + 1);
tree.resize(4 * (n + 1) + 1);
}
A func(A a, A b){
... | ALGO | 0.999892 | 5.683753 |
5a57830e-4c69-447c-aa9a-566b8fcfcd82 | Algorithm-Artisan-Sandip/LeetCode_Solved_Questions | 633-sum-of-square-numbers/sum-of-square-numbers.cpp | class Solution {
public:
bool judgeSquareSum(int c) {
long left = 0;
long right = static_cast<long>(sqrt(c));
while (left <= right) {
long curr_sum = left * left + right * right;
if (curr_sum == c) return true;
if (curr_sum < c) left++;
el... | ALGO | 0.999965 | 5.570653 |
34ca6067-eceb-4a9f-a458-96c0e4e284bd | aospX/platform_external_llvm | lib/CodeGen/StackSlotColoring.cpp | #define DEBUG_TYPE "stackcoloring"
#include "VirtRegMap.h"
#include "llvm/Function.h"
#include "llvm/Module.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/CodeGen/LiveIntervalAnalysis.h"
#include "llvm/CodeGen/LiveStackAnalysis.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineInstrBuilder... | ALGO | 0.928072 | 6.28439 |
db51b63b-0691-43a9-b5ad-3df2e61ae2c8 | leontalukdar/Codeforces | 558B/main.cpp | #include <iostream>
#include <fstream>
#include <sstream>
#include <math.h>
#include <algorithm>
#include <string>
#include <map>
#include <set>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <queue>
#include <stack>
#include <cstring>
#include <ctype.h>
using namespace std;
typedef long long int l... | ALGO | 0.999922 | 3.32168 |
af063fb0-4918-492f-a2b9-a3f6b26ecf20 | ishandutta2007/codeforces | lanpang/normal/1167/F.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long LL;
const int maxn = 5e5+10;
const LL mod = 1e9+7;
const double eps = 1e-9;
int n , tr1[maxn*4] , tr2[maxn*4] , tp;
LL ans , s1 , s2;
struct mmp{
int x , i;
bool operator < (const mmp &op) const{
return x < op.x;
}
}a[maxn];
void putin1(int num , in... | ALGO | 0.999947 | 3.770705 |
4cbce6b6-4169-4ba9-b5bb-bbf03f0c9884 | ImanSafadr/OOP-Codes | 145.cpp | #include <iostream>
#include <string.h>
#include <stdlib.h>
using namespace std;
/*class String
{
private:
string str;
public:
String():str(""){}
String(string s):str(s){}
void getstr()
{
cout<<"Enter String ";
getline(cin,str);
}
... | ALGO | 0.992489 | 3.315207 |
3387fe95-5b00-483a-a0c1-b7788325a614 | ishandutta2007/codeforces | fallac/normal/1599/G.cpp | #include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
typedef long long ll;
typedef pair<ll, ll> point;
const double INF = 1e18;
vector<point> P;
ll ccw(point a, point b, point c)
{
return (c.y-b.y)*(b.x-a.x) - (b.y-a.y)*(c.x-b.x);
}
double dist(point a, point b)
{
return sqrt((double... | ALGO | 0.999982 | 3.946689 |
bbf9156e-d005-485c-8adb-a3fba38495f7 | raincross7/code-similarity | codes/train_code/problem496/problem496_427.cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
long long N, K;
cin >> N >> K;
vector<long long> H(N);
for (long long i = 0; i < N; i++)
cin >> H[i];
sort(H.begin(), H.end(), greater<>());
long long ans = 0;
for (long long i = 0; i < N; i++, K--) {
if (K <= 0)... | ALGO | 0.999956 | 3.713233 |
0ebe120d-a5bd-47ea-a2b2-0b65948d52ea | hitesh11tahiliani/DSA-Leetcode | 0907-sum-of-subarray-minimums/0907-sum-of-subarray-minimums.cpp | class Solution {
public:
int sumSubarrayMins(vector<int>& A) {
int n = A.size();
int MOD = 1e9 + 7;
vector<int> left(n), right(n);
// Left Stack
stack<int>Left_st;
Left_st.push(0);
left[0] = 1; // distance = 1
for(int i=1; i<n; i++)
{
... | ALGO | 0.999993 | 5.798025 |
2ee37515-d9f9-4b2d-a626-82ce279f656e | raiaqt/kattis-submissions | TemperatureConfusion.cpp | #include <cstdio>
long gcd(long n, long d) {
while (d != 0) {
long temp = d;
d = n % d;
n = temp;
}
return n;
}
void solve() {
char input[40];
scanf("%s", input);
long a = 0;
long b = 0;
bool negative;
int i = 0;
if (input[i] == '-') {
... | ALGO | 0.999392 | 4.754574 |
cc29da9d-f1d3-4609-ad5f-c2bfd66c0765 | sinian666/code_86_6 | cpp_副本27/chapter_backtracking/preorder_traversal_ii_compact.cpp | /**
* File: preorder_traversal_ii_compact.cpp
* Created Time: 2023-04-16
* Author: Krahets (<EMAIL>)
*/
#include "../utils/common.hpp"
vector<TreeNode *> path;
vector<vector<TreeNode *>> res;
/* 前序遍历:例题二 */
static void preOrder(TreeNode *root) {
if (root == nullptr) {
return;
}
// 尝试
path... | ALGO | 0.999863 | 5.640807 |
1d260588-27e6-4b6f-ab7d-c353f73e65da | alexandraback/datacollection | solutions_5658282861527040_0/C++/gconeice/B.cpp | #include <cstdio>
#include <cstdlib>
#include <algorithm>
using namespace std;
int T;
int a,b,k;
int main()
{
freopen("B.in","r",stdin);
freopen("B.out","w",stdout);
scanf("%d",&T);
for (int ii=1;ii<=T;ii++)
{
scanf("%d%d%d",&a,&b,&k);
int ans=0;
for (int i=0;i<a;i++)
for (int j=0;j<b;... | ALGO | 0.997869 | 3.500341 |
07b1d0a5-6c26-449d-a6fc-05db39f992c5 | Moeen35245/dsa | Recursion/recursiveFact.cpp | /*Write a recursive function
that takes a number as an
input and returns the
factorial of that number.*/
#include <iostream>
using namespace std;
int fact(int n)
{
if (n == 1 || n == 0)
return 1;
return n * fact(n - 1);
}
int main()
{
int n;
cin >> n;
cout << fact(n);
return 0;
} | ALGO | 0.999867 | 5.334526 |
cbe9d4b6-3333-4964-be46-e5234f0d6e88 | youssef4140/problemSolving | 3-practice/nextRound.cpp | #include <iostream>
using namespace std;
int main()
{
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
int prices[n];
for (int i = 0; i < n; ++i) {
cin >> prices[i];
}
int badDays = 0;
int minPrice = prices[n - 1];
for (int i = n ... | ALGO | 0.999265 | 4.598481 |
959d5dbf-21c7-402e-8c73-257f24798bf6 | ChanJoon/mpcc | qp_solver/qpoases/SRC/Utils.cpp | /**
* \file SRC/Utils.cpp
* \author Hans Joachim Ferreau, Eckhard Arnold
* \version 1.3embedded
* \date 2007-2008
*
* Implementation of some inlined utilities for working with the different QProblem
* classes.
*/
#include <math.h>
#if defined(__WIN32__) || defined(WIN32)
#include <windows.h>
#elif defined(... | TOOL | 0.919521 | 6.017424 |
ea6d3df1-6dd6-4928-a0f8-19f56fb697d6 | ivanavd11/-Introduction_to_programming | Practicum by plamena-ilieva/Pract01/task_11.cpp | #include <iostream>
int main()
{
int n;
std::cin >> n;
if (n / 10 <10)
{
std::cout << n ;
}
else
{
std::cout << n%10;
}
return 0;
} | ALGO | 0.994 | 3.9651 |
d4e90cf3-8b3a-4e9a-bcd6-d59bdb5630f3 | mananb77/cs184-star-sim | ext/nanogui/ext/eigen/doc/examples/Tutorial_BlockOperations_block_assignment.cpp | #include <Eigen/Dense>
#include <iostream>
using namespace std;
using namespace Eigen;
int main()
{
Array22f m;
m << 1,2,
3,4;
Array44f a = Array44f::Constant(0.6);
cout << "Here is the array a:" << endl << a << endl << endl;
a.block<2,2>(1,1) = m;
cout << "Here is now a with m copied into its cent... | ALGO | 0.961686 | 3.331377 |
e9db27e6-90aa-4569-b93b-eac836526b76 | anishlc31/cpp | pointers and function/macros.cpp | #include<iostream>
#define mul(a,b)a*b;
#define div(a,b)a/b;
using namespace std;
int main(){
int x=2,y=3;
cout<<mul(x,y);
} | ALGO | 0.997113 | 3.239696 |
5fce1f2c-2be3-477e-886d-a410fc104da7 | chapel-lang/chapel | third-party/llvm/llvm-src/lib/Transforms/Utils/MatrixUtils.cpp | #include "llvm/Transforms/Utils/MatrixUtils.h"
#include "llvm/Analysis/DomTreeUpdater.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Type.h"
using namespace llvm;
BasicBlock *TileInfo::CreateLoop(BasicBlock *Prehe... | ALGO | 0.952502 | 8.014977 |
6a94fc70-191c-4d85-a3f7-cb4e5d06a9cb | MohammadAminRashid/Plants-vs-Zombies | src/pea.cpp | #include "pea.hpp"
#include <iostream>
#include <string>
#include <vector>
#include <SFML/Graphics.hpp>
using namespace std;
using namespace sf;
NormalPea::NormalPea(Vector2f pos)
{
position = pos;
texture.loadFromFile("files/images/NormalPea.png");
sprite.setTexture(texture);
damage = specify_number... | TOOL | 0.850564 | 3.751879 |
3bdd0213-12f9-468e-b672-db607888efd0 | KangPuding/Code-Test | 프로그래머스/3/42884. 단속카메라/단속카메라.cpp | #include <string>
#include <vector>
#include <algorithm>
using namespace std;
int solution(vector<vector<int>> routes) {
sort(routes.begin(), routes.end(), [](const vector<int>& a, const vector<int>& b)
{
return a[1] < b[1];
});
int nCamera = -30001;
int nCount = 0;
fo... | ALGO | 0.993045 | 5.486764 |
879831b3-3698-427b-a6dc-472212cd621a | Qipu1220/BaiTapMang1Chieu | 23520493_23521082_23521462_23521604_23521672_BT03/Bai110/Bai110.cpp | #include <iostream>
#include <iomanip>
#include <cstdlib>
#include <ctime>
using namespace std;
void nhap(int a[], int& n);
void xuat(int a[], int n);
bool ktNguyenTo(int n);
int LonNhat(int a[], int n);
int TimGiaTri(int a[], int n);
int main()
{
int b[100];
int k;
nhap(b, k);
cout << "Mang ban dau: \n";
xuat(b,... | ALGO | 0.997231 | 3.510934 |
4833d84b-da3f-420a-9e91-78052a7b35ae | rjk13637110731/Cplusplus-Language-Learn-Note | Calculator.cpp | #include <iostream>
using namespace std;
#include <string>
//分别使用普通和多态实现计算器
//1.普通写法实现计算器
class Calculator {
public:
int getResult(string oper) {
if (oper == "+") {
return m_Num1 + m_Num2;
}else if (oper == "-") {
return m_Num1 - m_Num2;
}else if (oper == "*") {
return m_Num1 * m_Num2;
}
//如果想扩展新的... | TOOL | 0.982357 | 4.485188 |
5951a07e-aadb-44d9-ba52-7f2d4c22cd42 | viswana/algorithms-datastructs | problems/epi/Recursion/NextPermutation.cpp | #include <iostream>
#include <vector>
using namespace std;
vector<int> nextpermutation(vector<int> i) {
vector<int> result;
int j = i.size()-1;
for (; j > 0 && i[j-1] >= i[j]; --j);
if (!j) return result;
int k = j;
for (; k < i.size() && i[k] > i[j-1]; ++k);
int temp = i[k-1];
i[k-1] = i[j-1];
i[j-1... | ALGO | 0.99996 | 3.996573 |
1c92cd21-29ef-4b9f-a1d9-388bd11989e8 | ArtiGaund/Leetcode | 2742-painting-the-walls/2742-painting-the-walls.cpp | class Solution {
public:
int paintWalls(vector<int>& cost, vector<int>& time) {
int n=cost.size();
vector<int> dp(n+1,0);
vector<int> prev(n+1,(int)1e9);
prev[0]=0;
for(int i=n-1;i>=0;i--)
{
dp=vector(n+1,0);
for(int remain=1;remain<=n;remain++... | ALGO | 0.999847 | 5.772865 |
62888c11-0987-4b1d-a337-226c65c56b42 | ishandutta2007/codeforces | yashchandnani/normal/349/B.cpp | #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef long double ld;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;
const int INF = 1e9 + 7;
const int MOD = 1e9 + ... | ALGO | 0.999974 | 3.317505 |
ed07f4d5-c240-48ad-bc95-e609beabb78c | ksw0518/Laminar | Laminar/Bit.cpp | #include "Bit.h"
#include <cstdint>
uint64_t set_occupancy(int index, int bits_in_mask, uint64_t attack_mask)
{
uint64_t occupancy = 0;
for (int count = 0; count < bits_in_mask; count++)
{
int square = get_ls1b(attack_mask);
Pop_bit(attack_mask, square);
if ((index & (1 << count)) ... | ALGO | 0.99257 | 4.565848 |
e990fa60-d983-48d1-8b89-b9c107475c75 | liruicrecky/leetcodec-- | 162.寻找峰值.cpp | // @before-stub-for-debug-begin
#include <bits/stdc++.h>
using namespace std;
// @before-stub-for-debug-end
/*
* @lc app=leetcode.cn id=162 lang=cpp
*
* [162] 寻找峰值
*/
// @lc code=start
class Solution {
public:
int findPeakElement(vector<int> &nums) {
int l = 0, r = nums.size() - 1;
while (l... | ALGO | 0.999798 | 5.478867 |
07b43635-2cd7-42f9-a9d0-87e28fbdd614 | hcm1206/Algorithm_Study_Archive | solvedac_ranma/week42/22235.cpp | #include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <map>
using namespace std;
int main() {
cin.tie(NULL);
ios_base::sync_with_stdio(false);
string moran_str;
cin >> moran_str;
string tmp_str = "";
int now_time = 0;
int mul = 3600;
for (int i = 0; i < 8; ++i) {
if (moran_... | ALGO | 0.999018 | 4.949511 |
2e32a95e-4506-4ee4-a90c-69680daab5ef | chausner/sgbust | src/core/Polynom.cpp | #include "core/Polynom.h"
#include <cmath>
#include <regex>
#include <sstream>
#include <stdexcept>
#include <utility>
namespace sgbust
{
Polynom::Polynom(std::initializer_list<int> coefficients) : coefficients(coefficients)
{
}
Polynom::Polynom(std::string_view str)
{
static const std::r... | TOOL | 0.971708 | 5.924521 |
43283057-c2f3-4a0a-91ea-0f789ca8682e | Badhansen/LeetCode-Solutions | 703-kth-largest-element-in-a-stream/703-kth-largest-element-in-a-stream.cpp | static bool _foo = ios::sync_with_stdio(false);
static ostream* _bar = cin.tie(NULL);
class KthLargest {
public:
priority_queue<int, vector<int>, greater<int> > qt;
int K;
KthLargest(int k, vector<int>& nums) {
K = k;
for(int i = 0; i < nums.size(); i++){
qt.push(nums[i]);
... | ALGO | 0.999966 | 5.210213 |
40c26c7d-94eb-4ef4-9f71-dd0a0fcab7c2 | wenbin-lin/PathFinding | dwastarsearch.cpp | #include "dwastarsearch.h"
DWAStarSearch::DWAStarSearch(Map _map, Index _origin, Index _destination)
: SearchProblem(_map, _origin, _destination)
{
}
bool DWAStarSearch::findPath(){
std::priority_queue<Node4AStar*, std::vector<Node4AStar*> ,CmpAStar> q;
std::stack<Node4AStar*> trashCollector;
std::vec... | ALGO | 0.999403 | 4.287234 |
e23bca9d-6d5d-4885-a0fa-647b3b567c16 | Hackeries/CP | Questions/B/BlankSpace.cpp | #include<bits/stdc++.h>
using namespace std;
int solve(){
int n;cin >> n;
vector<int>v(n);
for(int i=0;i<v.size();++i){
cin >> v[i];
}
int len = 0;
int ans = 0;
for(int i=0;i<v.size();++i){
if(v[i] == 0){
len=len+1;
}
else{
ans = max(... | ALGO | 0.999769 | 5.259064 |
22d9af0c-579a-4623-89bf-af82c06a6a92 | mr-jestin-roy/LeetCode-TaskList | LeetCode/Miscellaneous/all indices of a number.cpp | // CPP program to find all indices of a number
#include <bits/stdc++.h>
using namespace std;
// A recursive function to find all
// indices of a number
int AllIndexesRecursive(int input[], int size,
int x, int output[])
{
// If an empty array comes
// to the function, then
// retur... | ALGO | 0.999969 | 5.43167 |
3f8d115b-bcff-4257-99d0-1860a521bef2 | Gin101/CS101 | luogu/P7113.cpp | #include <iostream>
#include <queue>
#include <vector>
#include <algorithm>
#include <stdio.h>
using namespace std;
int n = 0;
int top = 0;
const int maxN = 1e5 + 1;
int deg[maxN] = {0};
int id[maxN] = {0};
long long a[maxN] = {0};
long long b[maxN] = {0};
vector<int> e[maxN];
queue<int> q;
void gtps(void) {
for... | ALGO | 0.999969 | 3.50518 |
b81e5a29-965d-4c19-8a70-932b98607f72 | abhishek18124/PPCPPJanuary2024 | Lecture 20/004_2DArrays_MatrixTranspose.cpp | /*
Constraints :
0 < m, n <= 10
*/
#include<iostream>
using namespace std;
// #swaps = (n^2 - n) / 2 ~ n^2
// time spent on a single swap is const. i.e. O(1)
// total time = # swaps * time spent on 1 swap ~ n^2.c ~ O(n^2)
void transpose(int mat[][10], int n) {
for (int i = 0; i <= n - 2; i++) {
for (int j... | ALGO | 0.999329 | 4.625702 |
b9b40f27-7a77-43e0-b30f-c50c81b8331d | Jangveersoothe/CF | robin_in_town.cpp | #include<bits/stdc++.h>
using namespace std;
const long long INF =1e18;
bool midpointVal(int n,vector<int>& ar, int totSum, int x){
vector<int>newAr=ar;
newAr[n-1]+=x;
int newSum=totSum+x;
double newAvg=newSum/(2.0*n);
int countBelow=0;
for(int i=0;i<n;i++){
if(newAvg>newAr[i]){
... | ALGO | 0.999864 | 5.054907 |
a877b792-41c6-4691-8ffe-ec275c422a2f | VinayKatare/Codeforces-Submissions | 141 A Amusing Joke.cpp | // http://codeforces.com/contest/141/problem/A
#include<iostream>
#include<math.h>
#include<cstring>
#include<cctype>
#include<cstdlib>
#include<string>
#include<algorithm>
using namespace std;
string srt(string s){
int i,j,l;
char c;
l=s.size();
for(i=0;i<l;i++)
for(j=0;j<l-i-1;j++){
if(s[j]>s[j+1]){
... | ALGO | 0.999986 | 3.280463 |
45ca2083-4f7f-4932-bbe8-2ac9e41c914c | hnahtneyugn/Data-Structures-and-Algorithms | DSA/DS/Hashing/SeparateChaining.cpp | #include <iostream>
#include <vector>
using namespace std;
class HashTable{
private:
int tablesize;
vector<vector<int>> table;
public:
// initializer list
HashTable(int size) : tablesize(size), table(size) {}
// find the result of the hash function
int hashFunction(int x) {
return (x... | ALGO | 0.999289 | 6.004659 |
d9f22353-f7d8-4091-bd1e-976850db0a89 | raincross7/code-similarity | codes/train_code/problem480/problem480_387.cpp | #include <bits/stdc++.h>
#define MAXN 100000
#define inf LONG_MAX
using namespace std;
long long d[MAXN];
bool mark[MAXN];
void dijkstra(vector<pair<int,int>> *adj, int v, int n){
fill(d,d + n, inf);
fill(mark, mark + n, false);
d[v] = 0;
int u;
priority_queue<pair<int,int>,vector<pair<int,int> >, less<pair<int,in... | ALGO | 0.999906 | 4.404338 |
01c12f92-952a-46e2-867a-daf3d43a1fbb | moonflower-Bai/OIcode | 考试/20220728/B.cpp | #include <bits/stdc++.h>
using namespace std;
const int qwe = 1e6 + 5;
int n;
vector<int> e[qwe];
int dfn[qwe], low[qwe], cnt = 0, ans = 0;
void init()
{
cnt = ans = 0;
for (int i = 1; i <= n; i++)
{
e[i].clear();
}
memset(dfn, 0, sizeof(dfn));
memset(low, 0, sizeof(low));
}
int main()
{... | ALGO | 0.999803 | 4.133646 |
afa2ab9d-dabd-4af4-881c-7961102aa355 | mohsin-ali9900/PF-Labs-PD | week7lab/task5.cpp | #include <iostream>
#include <windows.h>
using namespace std;
int checkdigits(int);
main()
{
int num;
cout<<"Enter the number : ";
cin>>num;
int result=checkdigits(num);
cout<<result;
}
int checkdigits(int num)
{
int rem=0;
int sum=0;
while(num!=0)
{
rem = num%10;
... | ALGO | 0.998928 | 3.69866 |
ef0d8e34-5e6b-42b2-bef6-4907ccf9a722 | riddhi7890/OPPs-Practical | Assignment 1/14_FirstN_EvenNo.cpp | // 43.Write a C++ program to print the first N even numbers using a for loop.
#include <iostream>
using namespace std;
int main()
{
int n;
cout << "Enter the value of n: ";
cin >> n;
cout << "First " << n << " even numbers are "<<endl;
for (int i = 1; i <= n; i++)
{
cout << 2 * i << " "... | ALGO | 0.990479 | 4.554235 |
9503000a-074f-4726-97e7-522977787e87 | en30/online-judge | aoj/DSL_1_A.cpp | #include <bits/stdc++.h>
#include "../include/template"
#include "../include/union_find_tree.hpp"
int main() {
int n, q;
cin >> n >> q;
UnionFindTree uft(n);
for (int i = 0; i < q; i++) {
int c, x, y;
cin >> c >> x >> y;
if (c == 0) {
uft.unite(x, y);
continue;
}
cout << uft.s... | ALGO | 0.999872 | 5.01381 |
ad776d30-823e-4bd5-9f6e-20396b91f253 | sayandeep-adhikary/Leetcode | Transitive closure of a Graph - GFG/transitive-closure-of-a-graph.cpp | //{ Driver Code Starts
// Initial Template for C++
#include <bits/stdc++.h>
using namespace std;
// } Driver Code Ends
// Back-end complete function Template for C++
class Solution{
public:
void dfs(int node, vector<int> &vis , vector<vector<int>> &adj){
vis[node] = 1;
for(auto it : adj[node]){
... | ALGO | 0.999971 | 6.219312 |
1182da0a-86ea-48a1-8ae3-d1acd2ae03ad | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_9375_1.cpp | #include<iostream>
#include<string>
using namespace std;
class Cube{
public:
int f[6];
Cube(){}
void roll_z(){roll(1,2,4,3);}
void roll_y(){roll(0,2,5,3);}
void roll_x(){roll(0,1,5,4);}
void roll(int i,int j,int k, int l){
int t=f[i];f[i]=f[j];f[j]=f[k];f[k]=f[l];f[l]=t;
}
void move(char ch){
... | ALGO | 0.999965 | 3.784332 |
07bf7380-3eab-4216-bdb1-705dec1e4220 | ishandutta2007/codeforces | gisp_zjz/normal/873/F.cpp | #include<iostream>
#include<algorithm>
#include<cstdlib>
#include<cstdio>
#include<cstring>
#include<vector>
#include<cmath>
#include<complex>
#include<queue>
#define maxn 500020
using namespace std;
typedef long long ll;
struct point{
ll x,y;
};
bool cmp2(point u,point v)
{
return u.x>v.x;
}
char s[maxn],t... | ALGO | 0.999983 | 3.65267 |
6fabeb81-df27-46f2-abe3-6b13f4ba9655 | ishandutta2007/codeforces | burnedchicken/normal/1396/B.cpp | #include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define ull unsigned long long
#define ld long double
#define rep(a) rep1(i,a)
#define rep1(i,a) rep2(i,0,a)
#define rep2(i,b,a) for(int i=(b); i<((int)(a)); i++)
#define rep3(i,b,a) for(int i=(... | ALGO | 0.999367 | 3.698283 |
371b0e3f-b993-49b8-942f-f930f67d2826 | Soulflayer1337/Homework | First_Semester/1/5.cpp | #include <cstdio>
#include <locale.h>
int main()
{
setlocale(LC_ALL, "Russian");
printf(" : ");
int size = 0;
scanf("%d", &size);
size += 10; //
printf(" , : ");
char *str = new char[size];
scanf("%s", str);
int balance = 0;
for (int i = 0; i < size && balance >= 0; i+... | ALGO | 0.999496 | 3.452782 |
921c232e-6930-4103-848a-30b17c06afc6 | jorgehr12345/PrograCompetitiva | dfss/dfs_ultimo_ancestro.cpp | #include <bits/stdc++.h>
#define pb push_back
#define inic ios_base::sync_with_stdio(false);
#define inic2 cin.tie(NULL);
#define inic3 cout.tie(NULL);
using namespace std;
typedef long long ll;
const ll MX=3e5;
bool bo[MX];
pair<ll,ll>pa,pa2,pa3,pa4;
deque<ll>deq,deq2,deq3,deq4;
deque<pair<ll,ll>>dpa,dpa2,dpa3,dpa4;
... | ALGO | 0.999866 | 3.650299 |
65723eeb-bbfc-4bb5-b162-5287a24f900f | Gorchon/Algorithms | hmk_1_3.cpp | //A01254831
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
#include <sstream>
#include <cstdlib>
#include <algorithm>
#include <string>
#include <map>
#include <unordered_map>
using namespace std;
//Basically a struct is a simple way to group together data of different types,
//so we ca... | ALGO | 0.926069 | 4.379286 |
8785d827-2f7d-4d5f-b6fa-6c06e0b9761d | dks0101/Cpp_Algorithm | 1week/가위바위보게임.cpp | #include <iostream>
using namespace std;
int main(){
int t;
cin >> t;
while (t--) {
int n;
cin >> n;
int rock = 0, scissor = 0, paper = 0;
int move;
for (int i = 0; i < n; i++) {
cin >> move;
if (move == 1) scissor++;
else if ... | ALGO | 0.999803 | 4.637148 |
57b01002-590d-494b-8c5f-aeb459693868 | nidhiupman568/C-PLUS-PLUS-PROBLEMS-SOLVED | Minimum Window Substring.cpp | //Solution 01:
class Solution {
public:
string minWindow(string s, string t) {
int m=s.size(), n=t.size();
unordered_map<char, int> mp;
int ans = INT_MAX;
int start = 0;
for(auto x:t)
mp[x]++;
int count = mp.size();
... | ALGO | 0.999992 | 6.525655 |
fb0bfbe3-bb68-46f2-84c8-773f0cdae774 | bhaumik2329/Student-Project-Management | 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 |
fae6fa37-4895-4ca8-8892-9ce2ad1eb1dd | sanketrahangdale2001/Mtech_ProgrammingLab_1stSem | SinglylinkedList.cpp | #include<iostream>
using namespace std;
template < typename T >
class Node {
public: T data;
Node * next;
Node() {
data = 0;
next = NULL;
}
Node(T data) {
this -> data = data;
this -> next = NULL;
}
};
template < t... | ALGO | 0.999459 | 4.257192 |
2fa5a70b-ca4a-4f45-9493-5544761411ea | Vikalp19041999/LeetCode-solutions | Largest Odd Number in String.cpp | class Solution {
public:
string largestOddNumber(string num) {
int pos = num.size() - 1;
while(pos >= 0) {
if((num[pos] - '0')% 2) {
break;
}
pos--;
}
if(pos < 0) {
return "";
}
return num.substr(0, pos +... | ALGO | 0.999881 | 6.21752 |
eff4f548-7f25-4930-917f-f8fe9d787a7a | YIWANFENG/Algorithm-github | TreeTraver.cpp | #include <iostream>
#include <stack>
//ķǵݹ
using namespace std;
typedef struct Node_{
int val;
struct Node_ *right;
struct Node_ *left;
} TreeNode;
void preorderTraversal(TreeNode* root) {
//ǰ
stack<TreeNode*> s;
if (root == NULL)
return;
s.push(root);
while(!s.empty()) {
TreeNo... | ALGO | 0.999995 | 4.369963 |
af88df91-9d1f-4388-9209-511fd92f2ec2 | Asik8/My-Codeforces | Old Codes/C_Showering.cpp | #include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
int main() {
ios::sync_with_stdio(false);
cin.tie(NULL);
ll t;
cin >> t;
while (t--) {
ll n,s,m,c=0;
cin >> n>>s>>m;
vector<pair<ll,ll>> v;
bool f = false;
v.pb({0,0});
... | ALGO | 0.999945 | 3.745729 |
3ec99d2b-178a-440f-a201-1f63f3cb529d | kisuk010203/PS | Contests/SNU/2023/30191.cpp | #include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> p;
int main() {
cin.tie(0);
cout.tie(0);
ios_base::sync_with_stdio(false);
int n;
cin >> n;
string scores;
cin >> scores;
vector<p> block_size;
int cnt = 0;
for (int i = 0; i < n; i++) {
if (i > 0 && sc... | ALGO | 0.999958 | 3.200399 |
98664fc1-3c74-4a69-a8fe-51c10d292c36 | GogoBeer/rN-INCOMING-CALl | src/node/coin.cpp | #include <node/coin.h>
#include <node/context.h>
#include <txmempool.h>
#include <validation.h>
void FindCoins(const NodeContext& node, std::map<COutPoint, Coin>& coins)
{
assert(node.mempool);
assert(node.chainman);
LOCK2(cs_main, node.mempool->cs);
CCoinsViewCache& chain_view = node.chainman->Active... | TOOL | 0.934277 | 6.787049 |
81ad113c-b1f7-423d-9a5e-1bd8db8772d1 | zhushaoben/training | 2019-2020第一学期训练/AtCoder Beginner Contest 142/E.Get Everything.cpp | #include<bits/stdc++.h>
using namespace std;
#define maxn 12
#define maxm 1000
struct Node{
int a,b,x;
}a[maxm];
int f[1<<maxn];
int main(){
int n,m,x,s;scanf("%d%d",&n,&m),s=1<<n;
for(int i=0;i<m;i++){
scanf("%d%d",&a[i].a,&a[i].b);
for(int j=0;j<a[i].b;j++)scanf("%d",&x),a[i].x|=(1<<x);
a[i].x>>=1;
}
for(i... | ALGO | 0.999823 | 3.823694 |
5288dc07-26c9-4b6b-83c8-2ccb4f74acbe | Vaibhav10sept/DSA | BINARY SEARCH/binary-search-upper-bound.cpp | #include<bits/stdc++.h>
using namespace std;
int binarySearch(vector<int> arr, int x) {
int start = 0;
int end = arr.size() - 1;
int ans = arr.size(); //not found to hm arr.size return krege, given in question
while (start <= end) {
int mid = start + (end - start) / 2; //we are not using (start + end) / 2, to pr... | ALGO | 0.999671 | 5.577001 |
85c0812e-de4a-4b44-9b8d-f7c9e38cfad5 | 113bommy/deepmind_codecontests_refine | cpp_gold_filter_file/cpp_train_10681_6.cpp | #include <bits/stdc++.h>
using namespace std;
const int maxn = 510;
const double eps = 1e-6;
int n;
double h, f, x[maxn << 1];
int sgn(double v) {
if (fabs(v) < eps) return 0;
if (v > 0.0)
return 1;
else
return -1;
}
double calc(double x1, double x2) {
double x3 = x1 * (f + h) / (f - h), x4 = x2 * (f + ... | ALGO | 0.999795 | 3.5246 |
04e863b4-1646-482f-9706-c27af2413359 | konadevel/KONA | src/masternode.cpp | #include "masternode.h"
#include "addrman.h"
#include "masternodeman.h"
#include "obfuscation.h"
#include "sync.h"
#include "util.h"
#include <boost/lexical_cast.hpp>
// keep track of the scanning errors I've seen
map<uint256, int> mapSeenMasternodeScanningErrors;
// cache block hashes as we calculate them
std::map<in... | ALGO | 0.989408 | 3.67987 |
91ae38c3-d2ea-4b80-ab56-5c752b1f5e1a | Vansh3503/Array_Code | Water_Store.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main() {
int arr[] = {1, 8, 6, 2, 5, 4, 8, 3, 7};
int n = sizeof(arr) / sizeof(arr[0]);
int maxArea = 0;
// Outer loop: Consider each line as the left side of the container
for (int i = 0; i < n; i++) {
// Inner loop: Consid... | ALGO | 0.999944 | 6.381391 |
1e57c399-634a-4ac4-bf55-47e2f2f76c57 | ishandutta2007/codeforces | sert/normal/559/C.cpp | #include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
using namespace std;
typedef long long ll;
const ll md = 1e9 + 7;
const ll o5 = 716327852;
const int N = 2e5 + 34;
ll f[N], o[N];
ll ans, n, w, h;
ll dp[N];
pair <ll, ll> a[N];
ll c(ll h, ll w) {
return (((f[h + w] * o[h]) % md) * o[w])... | ALGO | 0.999981 | 4.223596 |
93b62c6b-b82d-44d8-8181-dd77be6c4326 | Manishkumar62/CP_with_C-Plus-Plus | Strings/SingleJhon.cpp | // Sample Input 1
// 2
// snehaF
// rajM
// Sample Output 1
// Yes
// No
#include <iostream>
using namespace std;
int main() {
int t;cin>>t;
while(t--){
string s;cin>>s;
int n = s.size();
if(s[n-1]=='F'){
cout<<"Yes"<<endl;
}else{
cout<<"No"<<endl;
... | ALGO | 0.99984 | 4.26566 |
4115d1bd-a9ef-4b65-b972-941f2ff2b01f | sunset1995/ACM_ICPC_prac | ACM-ICPC/Phuket2013/tmp.cpp | #include <cstdio>
using namespace std;
int main(){
int n2 = 0;
for(int i=1 ; i<=100 ; ++i){
int tmp = i;
while( tmp%2 == 0 )
++n2 , tmp/=2;
}
int n2_2 = 0;
for(int i=1 ; (1<<i)<100 ; ++i)
n2_2 += 100 / (i<<i);
printf("%d %d\n",n2,n2_2);
}
| ALGO | 0.998659 | 3.535336 |
7c6e8584-d2cc-4601-9014-4aa731c68028 | kimkyungjae1112/MyClass | MyClass/Main.cpp | #include "MyVector.h"
int main()
{
VECTOR<int> vec;
vec.push_back(60);
vec.push_back(20);
vec.push_back(50);
vec.push_back(20);
vec.push_back(10);
VECTOR<int>::iterator iter = vec.begin();
for (iter; iter != vec.end(); ++iter)
{
cout << *iter << " ";
}
vec._sort();
//Sort(vec.begin(), vec.end());
cout ... | ALGO | 0.968532 | 3.59104 |
b3692b81-acca-4c04-861d-d5964cc34935 | VictorHGH/C-course | 013_Recursividad/001_Ejemplo/main.cpp | // Ejemplo de factorial con recursividad
#include <iostream>
using namespace std;
int factorial(int num) {
if (num == 0) {
return 1;
} else {
return num * factorial(num - 1);
}
}
int main() {
int num;
cout << "Introduce un número: ";
cin >> num;
cout << "El factorial de " << num << " es: " <<... | ALGO | 0.999704 | 5.433246 |
911d1305-5928-48c2-a073-fcc6b18bee2b | bel-sndct/ya | 09 Шаблоны функций/04 Как устроены шаблоны/Задание 1/src/main.cpp | int main() {
const vector<vector<string>> documents = {
{"белый"s, "кот"s, "и"s, "модный"s, "ошейник"s},
{"пушистый"s, "кот"s, "пушистый"s, "хвост"s},
{"ухоженный"s, "пёс"s, "выразительные"s, "глаза"s},
};
const auto& tf_idfs = ComputeTfIdfs(documents, "кот"s);
for (const double ... | ALGO | 0.983661 | 6.05964 |
4efc1dd9-8161-4909-aa63-b3a3de4815f2 | mactavish10/APS-2020 | SQRDSUB.cpp | #include <bits/stdc++.h>
#define int long long int
#define MP make_pair
#define pb push_back
#define rep(i, a, b) for (int i=a; i<b; i++)
#define endl "\n"
#define MAX 100009
using namespace std;
//code from https://www.geeksforgeeks.org/count-sub-arrays-whose-product-is-divisible-by-k/
vector<int> prod ;
int SubAr... | ALGO | 0.999488 | 4.590329 |
6c273e85-e34c-461e-9dd2-1173e821074a | askyx/pg_orca | libgpopt/src/xforms/CXformLeftAntiSemiApply2LeftAntiSemiJoin.cpp | #include "gpopt/xforms/CXformLeftAntiSemiApply2LeftAntiSemiJoin.h"
#include "gpos/base.h"
using namespace gpopt;
//---------------------------------------------------------------------------
// @function:
// CXformLeftAntiSemiApply2LeftAntiSemiJoin::Exfp
//
// @doc:
// Compute xform promise for a given expression ... | ALGO | 0.990878 | 5.160862 |
d5d70ad2-23d7-4cef-899f-518c6ba284ce | ditya17/DSA | Assignment8&9/cavity_map.cpp | vector<string> cavityMap(vector<string> grid) {
string s,t,u;
for (int i = 1;i<grid.size()-1;i++){
s = grid[i];
t = grid[i-1];
u = grid[i+1];
for (long j =1;j<s.size()-1;j++){
if ( (s[j] - '0' > s[j+1] - '0' ) && (s[j] - '0' > s[j-1] - '0' ) && s[j] - '0' > t[j] - '0... | ALGO | 0.999626 | 4.169821 |
67ab2d4e-93a2-45e7-841b-e0156fecdcdc | fyrsta7/LLM_on_ASAC | result_api_backup/en_without_annotation_mzn/deepseek-coder_loop10/The_Escape_of_the_Watchman-3.cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main() {
int M, S, T;
cin >> M >> S >> T;
int max_dis = 0;
int min_time = T;
int mana = M;
for (int t = 1; t <= T; ++t) {
if (mana >= 10) {
max_dis += 60;
mana -= 10;
} else {
... | ALGO | 0.999881 | 3.773497 |
20c6937f-92f8-461b-8b93-25fd1c8327dc | jackspratteridion/git8 | Engine/source/ts/tsMeshFit.cpp | #include "platform/platform.h"
#include "console/consoleTypes.h"
#include "core/resourceManager.h"
#include "ts/tsShapeConstruct.h"
#include "console/engineAPI.h"
// define macros required for ConvexDecomp headers
#if defined( _WIN32 ) && !defined( WIN32 )
#define WIN32
#elif defined( __MACOSX__ ) && !defined( APPLE ... | ALGO | 0.963809 | 5.696894 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.