text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const int N = 600005; int n, m, l, r, ma, a[N], f[N][22]; int main() { scanf( %d%d , &n, &m); for (int i = 1; i <= n; i++) { scanf( %d%d , &l, &r); a[l] = max(a[l], r); ma = max(ma, r); } for (int i = 1; i <= ma; i++) a[i] = max(a[i... |
#include <bits/stdc++.h> using namespace std; const int N = 2020; vector<tuple<int, int, int> > edges; vector<int> g[N]; vector<int> back_edge[N]; bool global; int num[N], low[N], low2[N], cnt, pai[N], pw[N], aux[N], prev_pai[N], prev_pw[N], sobe[N], prev_sobe[N]; int edg_used, edg_u, edg_v, edg_w... |
`timescale 1ns / 1ps
module DataMemory(
output reg [31:0] ReadData,
output reg [31:0] DATO1,
output reg [31:0] DATO2,
output reg [31:0] RESULTADO,
input [31:0] Address,
input [31:0] WriteData,
input [31:0] MouseData,
input MouseEnable,
input WriteEnable,
input CLK
);
reg [31:0] block... |
#include <bits/stdc++.h> using namespace std; const int N = 15; long long Get_Num(int num[], int b, int n) { long long number = 0; long long in = 1; for (int i = n - 1; i >= 0; i--) { number += num[i] * in; in = in * b; } return number; } int main() { int x[N], y[N]; in... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
//
// Copyright 2011-2012 Ettus Research LLC
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program i... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Thu May 18 23:19:00 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; int myrand(int m) { return (rand() * (1 << 15) + rand()) % m; } int main() { srand(time(0)); int n, ind, x; cin >> n >> ind >> x; --ind; vector<int> left(n); vector<bool> vis(n, 0); for (int i = 0; i < n; ++i) left[i] = i; vis[ind] = 1;... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; using i64 = long long; constexpr int MAX = 400010; constexpr int MOD = 1000000007; i64 fac[MAX], inv[MAX]; int l[MAX], r[MAX], x[MAX], cnt[MAX]; i64 ModPow(i64 a, i64 b, i64 p = MOD) { i64 ret = 1; for (a %= p; b; b >>= 1) { if (b & 1) ret = ret ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 10; const double pi = acos(-1.0); struct Complex { double x, y; Complex(double x = 0.0, double y = 0.0) { this->x = x; this->y = y; } Complex operator-(const Complex &b) const { return Complex(x - b.x, y - b.y); ... |
#include <bits/stdc++.h> using namespace std; const long long mxn = 1e5 + 7; int main() { int n, a[mxn], q, l[mxn], r[mxn], x; cin >> n; for (int i = 1; i <= n; i++) { cin >> a[i]; } for (int i = 1; i <= n; i++) { if (i == 1) { l[i] = 1; r[i] = a[i]; } else { ... |
//======================================================================
//
// sha3.v
// --------
// Top level wrapper for the SHA-3 hash function core providing
// a simple memory like interface with 32 bit data access.
//
//
// Author: Joachim Strombergson
// Copyright (c) 2015, Assured AB
// All rights reserved.
//
... |
#include <bits/stdc++.h> using namespace std; struct Solve { bool mark[(int)(3e5 + 10)]; vector<pair<int, int>> ed[(int)(3e5 + 10)]; vector<int> mtch; int n, m, T; void go() { T = 0; input(); find_mx_match(); if (T >= 2 * n) prnt_match(); else prnt_i... |
#include <bits/stdc++.h> using namespace std; using ll = long long; template <class t, class u> void chmax(t& first, u second) { if (first < second) first = second; } template <class t, class u> void chmin(t& first, u second) { if (second < first) first = second; } template <class t> using v... |
#include <bits/stdc++.h> using namespace std; [[maybe_unused]] const int MAX = INT32_MAX, MIN = -INT32_MAX, maxInd = 1E6 + 1E5 + 1; [[maybe_unused]] bool directed = true, end_now = false; bool possible = false; int n, k; struct node_data_structure { int pre = 0, post = 0; ... |
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2014 Francis Bruno, All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Found... |
#include <bits/stdc++.h> using namespace std; int Int() { int x; scanf( %d , &x); return x; } long long Long() { long long x; scanf( %lld , &x); return x; } void err(istream_iterator<string> it) { cout << endl; } template <typename T, typename... Args> void err(istream_iterator<s... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f, mod = 1000000007; const long long INF = 0x3f3f3f3f3f3f3f3fLL; const double pi = acosl(-1.), eps = 1e-9; inline int power(int a, int b, int m = mod, int ans = 1) { for (; b; b >>= 1, a = 1LL * a * a % m) if (b & 1) ans = 1LL * ... |
`include "../RF/reg_file.v"
module test;
reg [4:0] readReg1, readReg2, writeReg;
reg [31:0] writeData;
reg regWrite, clk;
wire [31:0] readData1, readData2;
reg_file rf(.readReg1(readReg1),
.readReg2(readReg2),
.writeReg(writeReg),
.writeData(writeData),
.regWrite(regWrite),
.clk(clk),
... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; pair<long long, int> arr[N]; long long t[4 * N] = {}; inline void update(int v, int vl, int vr, int pos, long long val) { if (vl == vr) { t[v] = val; return; } int vm = vl + (vr - vl) / 2; if (pos <= vm) upd... |
#include <bits/stdc++.h> using namespace std; const long long int mod = 998244353; vector<long long int> roots; long long int powermod(long long int a, long long int n, long long int p) { long long int ans = 1; while (n > 0) { if (n & 1) ans = (ans * a) % p; n >>= 1; a = a * a % p; ... |
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > marks(200002); vector<pair<int, int> > marksbyy(200002); vector<vector<int> > partials(2005, vector<int>(2005)); vector<vector<int> > inpart(2005, vector<int>(2005)); int n; void fillpart() { sort(marks.begin() + 1, marks.begin() + ... |
#include <bits/stdc++.h> using namespace std; int frd[2110][2110], rev[2110][2110]; vector<int> v; int main() { int a, b, c, d, e, i, j, p, q, mx, mx1, len; string x, y; cin >> x >> y; a = x.length(); b = y.length(); x = % + x; y = * + y; for (i = b; i >= 1; i--) { for ... |
#include <bits/stdc++.h> using namespace std; int n, m, k; int arr[600][600] = {}; int visited[600][600] = {}; void dfs(int, int); int main() { cin >> n >> m >> k; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { char t; cin >> t; if (t == . ) { ar... |
//#############################################################################
//# Purpose: SPI Master Transmit Fifo #
//#############################################################################
//# Author: Andreas Olofsson #
... |
#include <bits/stdc++.h> using namespace std; int n, m; int a[105][105]; int main() { scanf( %d %d , &n, &m); if (n + m == 3 or n + m == 4) printf( -1 n ); else { int num = 2; if (n >= m) { for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) { if... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: bw_io_hstl_drv.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute it an... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 06/17/2017 10:33:49 AM
// Design Name:
// Module Name: Small Program Top
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies: ... |
#include <bits/stdc++.h> using namespace std; using ull = unsigned long long; const int kMod = 1e9 + 7; mt19937_64 rng(time(0)); struct SegTree { struct Node { ull dp = 0; int l = 0, r = 0; ull hash = 0; }; int n; vector<Node> T; vector<ull> rnd; SegTree(int n) : n(n)... |
`timescale 100 ps / 100 ps
module tb_magnitude();
reg clk;
initial clk = 0;
always #10000 clk = ~clk;
wire [11:0] mag1, mag2;
reg [11:0] Y0, Y1, Y2, Y3;
magnitude magnitude_inst(.Y0(Y0), .Y1(Y1), .Y2(Y2), .Y3(Y3), .mag1(mag1), .mag2(mag2));
initial begin
@(posedge clk);
Y0 <= 12'b111111111101;
Y1 ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; const long long inf = (1ll << 60); int n, m, k, cnt, a, b, v[N], p[N], ta[N], tb[N], td[N], ca[N << 2], cb[N << 2], cd[N << 2], flag[N], pa, pb, pc, pd; long long A[N], B[N], C[N], D[N], co[N], sum, ans = inf; int read() { int x ... |
module ram ( input [15:0] din, output [15:0] dout, input[10:0] address, input rnw, input clk, input cs_b);
// parameter MEM_INIT_FILE = "opc5monitor.init";
//
// reg [15:0] ram [0:2047];
// reg [15:0] dout;
//
// initial begin
// if (MEM_INIT_FILE != "") begin
// $readmemh(MEM_INIT_FILE, ram);
// ... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; int y[N], pos[N]; int main() { int n, m, t = 0, ans = 0, cnt = 0; scanf( %d %d , &n, &m); for (int i = 1; i <= n; i++) scanf( %d , &y[i]); for (int i = 1; i <= m; i++) { int y1, y2, x; scanf( %d %d %d , &y1, &y2, &... |
#include <bits/stdc++.h> using namespace std; struct pony { long long s, m, r, t; } ponys[100005]; bool cmp(pony &x, pony &y) { return x.t < y.t; } struct node { long long l, r, latest; long long *sm, *sr, *t; } nodes[100005 << 4]; void build(long long ord, long long l, long long r) { node... |
#include <bits/stdc++.h> using namespace std; int a[26]; char s[100001]; int gcd(int a, int b) { if (a % b == 0) { return b; } else { return gcd(b, a % b); } } int main() { int n, ans, sum = 0, c = 0, i, j, k, l; scanf( %d , &n); for (i = 0; i < n; i++) { scanf( %d ... |
#include <bits/stdc++.h> using namespace std; struct MinCostFlow { struct Edge { int t; int f; int c; Edge *next, *rev; Edge(int _t, int _f, int _c, Edge* _next) : t(_t), f(_f), c(_c), next(_next) {} }; vector<Edge*> E; int addV() { E.push_back((Edge*)0)... |
#include <bits/stdc++.h> using namespace std; int main() { long long q = 0; vector<long long> a; a.push_back(0); for (long long i = 0; i < 4; i++) { long long te; cin >> te; a.push_back(te); } string s; cin >> s; for (long long i = 0; i < s.size(); i++) { q +=... |
/*
* .--------------. .----------------. .------------.
* | .------------. | .--------------. | .----------. |
* | | ____ ____ | | | ____ ____ | | | ______ | |
* | ||_ || _|| | ||_ \ / _||... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; array<int, N> a; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, k; cin >> n >> k; for (int i = 0; i < n; i++) cin >> a[i]; long long ans = 0; long long power = 1; while (abs(power) < 1e15) { ... |
// Copyright 1986-1999, 2001-2013 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2013.4 (lin64) Build 353583 Mon Dec 9 17:26:26 MST 2013
// Date : Thu Mar 20 00:59:05 2014
// Host : macbook running 64-bit Arc... |
/**
* This is written by Zhiyang Ong
* and Andrew Mattheisen
*/
`timescale 1ns/100ps
/**
* `timescale time_unit base / precision base
*
* -Specifies the time units and precision for delays:
* -time_unit is the amount of time a delay of 1 represents.
* The time unit must be 1 10 or 100
* -base is the time ba... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; typedef int64_t g; g n,p[269420],v=1e9+7,T,r,i,k,s; map<g,g> l; int main(){ cin>>T; while(T--){ cin>>n; l.clear(); for(i=0,s=0,p[0]=1,l[0]=1;++i<=n;){ cin>>k; p[i]=(p[i-1]*2+v-p[l[s]-1])%v; l[s]=i; s+=k; }cout<<p[n]<<endl; } } |
#include <bits/stdc++.h> using namespace std; const int M = 2e5 + 10; const int inf = 0x3f3f3f3f; const long long mod = 1e9 + 7; const int bit = 32; const double pi = acos(-1.0); int a[M]; int dfs(int k, int l, int r) { if (l > r) return 0; if (k < 0) return 1; int mid = r; int t = 1 << ... |
#include <bits/stdc++.h> using namespace std; int arr[2505][2505], sum[2505][2505], n, m; int get_sum(int x1, int y1, int x2, int y2) { x2 = min(x2, n); y2 = min(y2, m); assert(x1 <= x2); assert(y1 <= y2); return sum[x2][y2] - sum[x2][y1 - 1] - sum[x1 - 1][y2] + sum[x1 - 1][y1 - 1]; } int ... |
// Accellera Standard V2.5 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2010. All rights reserved.
`include "std_ovl_defines.h"
`module ovl_increment (clock, reset, enable, test_expr, fire);
parameter severity_level = `OVL_SEVERITY_DEFAULT;
parameter width = 1;
parameter value ... |
/**
* This is written by Zhiyang Ong
* and Andrew Mattheisen
* for EE577b Troy WideWord Processor Project
*/
`timescale 1ns/10ps
/**
* `timescale time_unit base / precision base
*
* -Specifies the time units and precision for delays:
* -time_unit is the amount of time a delay of 1 represents.
* The time uni... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date:
// Design Name:
// Module Name: GDA_St_N16_M4_P4
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; int ile(long long int a) { int ans = 0; while (a) { if (a % 2 == 1) ans++; a /= 2; } return ans; } int main() { int n; cin >> n; long long int* a; a = new long long int[n]; for (int i = 0; i < n; i++) { cin >> a[... |
#include <bits/stdc++.h> using namespace std; template <class A, class B> A cvt(B x) { stringstream ss; ss << x; A y; ss >> y; return y; } int n, a, b, t; string s; int solve() { int tb = 0; vector<int> tm; for (int k = n; k >= 1; k--) { tb += a; if (s[k - 1] !=... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19:26:59 08/23/2015
// Design Name: binary_to_BCD_ten_bit
// Module Name: D:/Digilent/Data/Xilinx/Projects/ISE_12_4/Binary_to_BCD_Ten_Bit/binary_to_BCD_ten_bit_tb.v
/... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; char str[1000005]; int ar[1000005]; void solve() { int n = (int)strlen(str + 1), i, j, ans = 0; memset(ar, 0, sizeof(ar)); str[0] = 0 ; for (i = n; i >= 0; i--) { if (str[i] == 1 ) { j = i; while (str[j] == 1 ) --j; i... |
#include <bits/stdc++.h> using namespace std; struct mat { double a[3][3]; mat() { for (int i = (int)(0); i <= (int)(2); ++i) for (int j = (int)(0); j <= (int)(2); ++j) a[i][j] = 0; } mat operator*(const mat &b) const { mat c; for (int i = (int)(0); i <= (int)(2); ++i) ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, x, p, m = 0; stack<int> s; cin >> n; p = n % 2; for (int i = 0; i < n; i++) { cin >> x; m = max(x, m); if (!s.empty() && s.top() < x) cout << NO , exit(0)... |
#include <bits/stdc++.h> using namespace std; void start() { ios_base::sync_with_stdio(false); cin.tie(NULL); } long long ans = INT_MAX; void solve(long long a, long long b, long long k, long long steps) { if (a == 1 && b == 1) { ans = min(ans, steps); return; } if (a - b > 0) ... |
#include <bits/stdc++.h> using namespace std; queue<pair<int, int> > q; int n, s[3][7005], f[3][7005], k[3], dd[3][7005]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (int i = 1; i <= 2; i++) { cin >> k[i]; for (int j = 1; j <= k[i]; j++) cin >> s[... |
`include "Definition.v"
module ReadWrite#
(
parameter[ 3 : 0 ]ReadState = 0, // read raw data operation
parameter[ 3 : 0 ]ProcessState = 1, // color correction
parameter[ 3 : 0 ]WriteState = 2
)
(
input Clock,
input Reset,
input[ `size_char - 1 : 0 ]R,
input[ `size_char - 1 : 0 ]G,
input[ `size_char ... |
module data_gen_submodule (
//input
input clk ,
input reset_n ,
//output
output [11:0] Data_A ,
output [11:0] Data_B ,
output [11:0] Data_C ,
output ... |
#include <bits/stdc++.h> using namespace std; const int N = 100010; set<pair<int, int> > s, e; long long dp[N]; int l[N], r[N]; struct Point { int x, h, k; bool f; } p[2 * N]; struct temp { int h, k; } q[N]; int m; bool cmp1(const temp &a, const temp &b) { return a.h > b.h; } bool cm... |
/*
* yosys -- Yosys Open SYnthesis Suite
*
* Copyright (C) 2012 Clifford Wolf <>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* T... |
// ZX-Evo Base Configuration (c) NedoPC 2008,2009,2010,2011,2012,2013,2014
//
// 'PFD' design based on ZEK code
/*
This file is part of ZX-Evo Base Configuration firmware.
ZX-Evo Base Configuration firmware is free software:
you can redistribute it and/or modify it under the terms of
the GNU General P... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, m, c0, d0; cin >> n >> m >> c0 >> d0; long long a[m + 4], b[m + 5], c[m + 5], d[m + 5]; for (int i = 1; i <= m; i++) { cin >> a[i] >> b[i] >> c[i] >> d[i]; a[i] /= b[i]; } c[0] = c0; a[0] = 1005; long... |
#include <bits/stdc++.h> using namespace std; int main() { long long t, n, i, j, k; double p, q, m; cin >> n >> m; p = pow(1.000000011, m); q = n * p; printf( %.12lf , q); return 0; } |
#include <bits/stdc++.h> using namespace std; int t = 1; void solve() { long long n, i, k, s = 0, b; cin >> n >> k; long long a[n]; for (i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); b = a[0]; for (i = 1; i < n; i++) { long long c = (k - a[i]) / b; if (c > 0... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC optimize( no-stack-protector ) #pragma GCC optimize( unroll-loops ) #pragma GCC optimize( fast-math ) #pragma GCC target( sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native ) using namespace std; template <typename T> void uin(T &a, T b) { ... |
// (C) 2001-2014 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated doc... |
#include <bits/stdc++.h> using namespace std; const int maxk = 51; struct matrix { bool e[maxk][maxk]; int sz; void print() { for (int i = 0, _n = (sz); i < _n; i++) { for (int j = 0, _n = (sz); j < _n; j++) { printf( %d , e[i][j]); } printf( n ); } ... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:200000000 ) using namespace std; template <typename T> inline T Abs(T x) { return (x >= 0) ? x : -x; } template <typename T> inline T sqr(T x) { return x * x; } template <typename T> string toStr(T x) { stringstream st; st << x... |
module fan_motor_driver(
// Qsys bus interface
input rsi_MRST_reset,
input csi_MCLK_clk,
input [31:0] avs_ctrl_writedata,
output [31:0] avs_ctrl_readdata,
input [3:0] avs_ctrl_byteenable,
input [2:0] avs_ctrl_address,
input avs_ctrl_write,
input avs_ctrl_read,
output ... |
#include <bits/stdc++.h> using namespace std; struct __timestamper {}; struct change { int s, t, u; }; vector<long long> solve(vector<int> a, vector<change> b) { long long sum = 0; for (auto x : a) sum += x; vector<long long> ans; int n = a.size(); vector<int> cntr(n); auto change_... |
#include <bits/stdc++.h> using namespace std; int d, n, x, ans; int main() { cin >> d; cin >> n; for (int i = 0; i < n - 1; i++) { cin >> x; ans += d - x; } cin >> x; cout << ans; return 0; } |
#include <bits/stdc++.h> using namespace std; unsigned long long tcc, n, m; int main() { scanf( %lld , &tcc); while (tcc--) { scanf( %lld %lld , &n, &m); unsigned long long sum = 0, m2 = m, t = 10; while (t-- && m2 <= n) { sum += m2 % 10; m2 += m; } m2 = m * 1... |
#include <bits/stdc++.h> using namespace std; int b[1100000], a[1100000], pre[1100000]; int main() { int n, m, k, i, j, s, cnt, len = 0, max = 0; long long ans = 0; scanf( %d%d%d , &n, &m, &k); for (i = 1; i <= m; ++i) { scanf( %d , &s); b[s] = 1; } b[n] = 1; for (i = 1; i ... |
#include <bits/stdc++.h> using namespace std; long long MOD = 1e9 + 7; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; int t; cin >> t; while (t != 0) { t--; int n, k, l = -1, r = -1; cin >> n >> k; int c = k + 1, z, res = 0; ... |
#include <bits/stdc++.h> using namespace std; int32_t main() { ios::sync_with_stdio(false); long long n; cin >> n; set<long long> s = {-2, -1}; vector<long long> arr(n, 0); while (n--) { long long x; cin >> x; --x; if ((*prev(s.end())) > x && (*prev(prev(s.end()))) < ... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) using namespace std; const long long Mod = 1000000007LL, INF = 1e9, LINF = 1e18; const long double Pi = 3.141592653589793116, EPS = 1e-9, Gold = ((1 + sqrt(5)) / 2); long long keymod[] = {1000000007LL, 1000000009LL, 1000000021LL, 10000... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); int n; cin >> n; int s[n]; int m[n]; string st; cin >> st; for (int i = 0; i < n; i++) s[i] = st[i] - 0 ; cin >> st; for (int i = 0; i < n; i++) m[i] = st[i] - 0 ; ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
module neopixels(
input CLOCK_50,
input [1:0] KEY,
output data
);
reg r_data;
reg [3:0] state_reg;
reg [3:0] state_set = 4'b0;
reg [7:0] timer_0 = 7'b0;
reg [7:0] timer_0_compare = 7'd40; // 0.8us
reg timer_0_run = 1'b0;
reg timer_0_match = 1'b0;
... |
/*------------------------------------------------------------------------------
* This code was generated by Spiral Multiplier Block Generator, www.spiral.net
* Copyright (c) 2006, Carnegie Mellon University
* All rights reserved.
* The code is distributed under a BSD style license
* (see http://www.opensource.or... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2009-2011 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property... |
#include <bits/stdc++.h> using namespace std; using ll = long long; ll mod = 1e9 + 7; ll bpow(ll a, ll b, ll m) { a %= m; ll res = 1; while (b > 0) { if (b & 1) res = res * a % m; a = a * a % m; b >>= 1; } return res; } bool cmp(vector<ll> v1, vector<ll> v2) { return v1... |
#include <bits/stdc++.h> using namespace std; const int N = 666; const double eps = 1e-10; int n, m, K, cnt, sz; int id[N], nod[N], cur[N]; double deg[N], g[N][N]; bool trap[N]; double v[N][N]; struct node { double vec[N]; } vv[N]; struct mat { double v[166][166]; mat() { memset(v, 0, ... |
module multistage_interconnect_network(clk, push, d_in, valid, d_out, control);
parameter WIDTH = 64;
parameter IN_PORTS = 16;
parameter PIPELINE_STAGES = 5;
parameter OUT_PORTS = IN_PORTS;
parameter ADDR_WIDTH_PORTS = log2(OUT_PORTS-1); //TODO: max
input clk;
input [0:IN_PORTS-1] push;
... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
// (C) 2001-2017 Intel Corporation. All rights reserved.
// Your use of Intel Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files from any of the foregoing (including device programming or simulation
// files), and any associated ... |
module aaa (/*AUTOARG*/
// Outputs
y1, y0, u1, u0,
// Inputs
y3, y2
);
/*AUTOOUTPUT*/
// Beginning of automatic outputs (from unused autoinst outputs)
output u0; // From bbb of bbb.v
output u1; // From bbb of bbb.v
output y0; // From bbb of ... |
#include <bits/stdc++.h> using namespace std; mt19937 rang(chrono::high_resolution_clock::now().time_since_epoch().count()); const long double PI = 3.141592653589793; const long long INF = 9223372036854775807ll; const long long mod = 1e9 + 7; const int N = 1e5 + 5; long long tree[4 * N + 10]; long long ... |
#include <bits/stdc++.h> using namespace std; void PrintVector(vector<int> v2, string s) { cout << s; for (int i = 0; i < v2.size(); i++) cout << v2[i] << ; cout << endl; } void PrintVector(vector<int> v2) { for (int i = 0; i < v2.size(); i++) cout << v2[i] << ; cout << endl; } int... |
#include <bits/stdc++.h> using namespace std; namespace fastIO { bool IOerror = 0; inline char nc() { static char buf[100000], *p1 = buf + 100000, *pend = buf + 100000; if (p1 == pend) { p1 = buf; pend = buf + fread(buf, 1, 100000, stdin); if (pend == p1) { IOerror = 1; ... |
#include <bits/stdc++.h> inline long long read() { long long x = 0, f = 1; char c = getchar(); for (; c > 9 || c < 0 ; c = getchar()) { if (c == - ) f = -1; } for (; c >= 0 && c <= 9 ; c = getchar()) { x = x * 10 + c - 0 ; } return x * f; } int dp[18][(1 << 18)][2][... |
#include <bits/stdc++.h> using namespace std; template <typename T> T in() { char ch; T n = 0; bool ng = false; while (1) { ch = getchar(); if (ch == - ) { ng = true; ch = getchar(); break; } if (ch >= 0 && ch <= 9 ) break; } while (1) { ... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2010-2011 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual pro... |
#include <bits/stdc++.h> using namespace std; const int maxn = 305; int n, m; class Point { public: long long x, y; Point() : x(0), y(0) {} Point(long long _x, long long _y) : x(_x), y(_y) {} void read() { scanf( %lld%lld , &x, &y); } Point operator+(const Point &o) const { return Point(x... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.