text
stringlengths
59
71.4k
`timescale 1 ns / 1 ps module axis_pulse_height_analyzer # ( parameter integer AXIS_TDATA_WIDTH = 16, parameter AXIS_TDATA_SIGNED = "FALSE", parameter integer CNTR_WIDTH = 16 ) ( // System signals input wire aclk, input wire aresetn, input ...
`timescale 1ns / 100ps module ee201_debouncer(CLK, RESET, PB, DPB, SCEN, MCEN, CCEN); //inputs input CLK, RESET; input PB; //outputs output DPB; output SCEN, MCEN, CCEN; //parameters parameter N_dc = 7; (* fsm_encoding = "user" *) reg [5:0] state; // other items not controlledd by the special atribute reg [N_dc-1:...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: bw_io_impctl_clkgen.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 ...
#include <bits/stdc++.h> using namespace std; int n, l[1000005], dp[1000005][2][2]; char s[1000005]; void Calc(int k) { if (s[k] == 0 ) dp[k][0][0] = 1; else if (s[k] == 1 ) dp[k][1][1] = 1; else { dp[k][1][0] = 1; dp[k][0][1] = 1; } } void Change(int x, int L, int ...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; long long ans = 0; for (int i = 1; i < min(b, c); i++) { ans += a; a++; } ans *= 2; for (int i = min(b, c); i <= max(b, c); i++) { ans += a; } cout << ans << endl; re...
// (C) 1992-2015 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 simulati...
#include <bits/stdc++.h> using namespace std; int32_t main() { long long n; cin >> n; vector<long long> v(n); for (long long i = 0; i < n; i++) { cin >> v[i]; } sort(v.begin(), v.end()); long long count = 0; while (v.size() > 0) { count++; long long num = v[0]; ...
#include <bits/stdc++.h> using namespace std; const int N = 1000005; struct Node { int left, right; long long sum; } L[N << 2]; void bulid(int step, int l, int r) { L[step].left = l; L[step].right = r; L[step].sum = 0; if (l == r) return; int m = (l + r) >> 1; bulid(step << 1, ...
////////////////////////////////////////////////////////////////////// //// //// //// eth_clockgen.v //// //// //// //// This file is part of the E...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: iobdg_dbg_porta.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 a...
#include <bits/stdc++.h> using namespace std; int rbq[505][505]; int score[505]; int main() { int n, m, q; while (~scanf( %d%d%d , &n, &m, &q)) { for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { scanf( %d , &rbq[i][j]); } } for (int i = 1; i <= n;...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2010 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 module t (/*AUTOARG*/); /*AUTOWIRE*/ // Beginning of automatic wires (for undeclared instantiated-m...
/** * 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; int n, co[200010], to[200010]; int cnt = 0; int dfn[200010], low[200010]; int scc_cnt; int sccno[200010]; int nt[200010], va[200010]; stack<int> S; void dfs(int u) { dfn[u] = low[u] = ++cnt; S.push(u); int v = to[u]; if (dfn[v] == 0) { ...
#include <bits/stdc++.h> using namespace std; int n, m, k, x, y; int main() { scanf( %d%d%d , &n, &m, &k); for (int i = 1; i <= k; i++) { scanf( %d%d , &x, &y); if (x <= 5 || (n - x + 1) <= 5 || y <= 5 || (m - y + 1) <= 5) return printf( YES n ), 0; } printf( NO n ); }
#include <bits/stdc++.h> using namespace std; const long long int mod = 1e9 + 7; bool sortbysec(const pair<int, int>& a, const pair<int, int>& b) { return (a.second < b.second); } long long int modpower(long long int a, long long int b, long long int c) { long long int res = 1; while (b) { i...
// stereo volume control // channel 1&2 --> left // channel 0&3 --> right module paula_audio_mixer ( input clk, //bus clock input clk7_en, input [7:0] sample0, //sample 0 input input [7:0] sample1, //sample 1 input input [7:0] sample2, //sample 2 input input [7:0] sample3, //sampl...
#include <bits/stdc++.h> using namespace std; int main() { int n = ({ int x; scanf( %d , &x); x; }); string s; cin >> s; string ans = no ; for (int d = (1); d < (30); d += (1)) { for (int i = (0); i < (n); i += (1)) { int g = 1; for (int j = (0); j < ...
#include <bits/stdc++.h> using namespace std; int main() { int n, k, sum = 0; cin >> n >> k; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int j = 0; j < k; j++) { int c1 = 0, c2 = 0; for (int i = j; i < n; i += k) { if (a[i] == 1) c1++; ...
`timescale 1ns / 1ps ///////////////////////////////////////////////////////////////////////////////////// // Company: Digilent Inc. // Engineer: Andrew Skreen // Josh Sackos // // Create Date: 07/26/2012 // Module Name: SPIcomponent // Project Name: PmodACL_Demo // Target Devices: Nexys3 // Tool versions:...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; char s; int d = 1, j = 1; for (int i = 1; i <= n; i++) { cin >> s; j -= 1; if (j == 0) { cout << s; d += 1; ...
#include <bits/stdc++.h> using namespace std; vector<double> E[100010]; int color[100010]; int seen[100010]; set<int> sets[100010]; void dfs(int u) { for (int i = 0; i < E[u].size(); ++i) { int v = E[u][i]; if (color[u] != color[v]) sets[color[u]].insert(color[v]); if (!seen[v]) { ...
#include <bits/stdc++.h> using namespace std; template <class T1, class T2> inline istream& operator>>(istream& fin, pair<T1, T2>& pr) { fin >> pr.first >> pr.second; return fin; } template <class T0, class T1, class T2> inline istream& operator>>(istream& fin, tuple<T0, T1, T2>& t) { fin >> get...
/* * Titor - General purpose synchronous memory * Copyright (C) 2012,2013 Sean Ryan Moore * * 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 ...
/* Model for xilinx async fifo*/ module fifo_async_104x32 (/*AUTOARG*/ // Outputs full, prog_full, almost_full, dout, empty, valid, // Inputs wr_rst, rd_rst, wr_clk, rd_clk, wr_en, din, rd_en ); parameter DW = 104;//104 wide parameter DEPTH = 16; // //########## //# RESET/CLO...
#include <bits/stdc++.h> using namespace std; map<int, vector<pair<int, int> > > mp; int n, tt; int arr[300000]; int main() { cin >> n; for (int i = 1; i <= n; i++) cin >> arr[i]; for (int r = 1; r <= n; r++) { long long sum = 0; for (int l = r; l >= 1; l--) { sum += arr[l]; ...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; const int MOD = 1e9 + 7; const long long M = 1e18; long long qpow(long long a, long long b, long long m) { long long ans = 1; while (b) { if (b & 1) ans = (ans * a) % m; b /= 2; a = (a * a) % m; } return ans...
#include <bits/stdc++.h> const double PI = acos(-1.0); int main() { double n, r; scanf( %lf%lf , &n, &r); double p1 = PI / n, p2 = PI / (2 * n), p3 = PI - p1 - p2; double l3 = r, l2 = l3 / sin(p3) * sin(p2); double s = l3 * l2 * sin(p1); printf( %.15f n , n * s); return 0; }
#include <bits/stdc++.h> using namespace std; const int dx[8] = {0, -1, 0, 1, 1, -1, -1, 1}; const int dy[8] = {-1, 0, 1, 0, -1, -1, 1, 1}; const long long mod = 1000000007; const int base = 311; const int N = 6e5 + 5; map<long long, vector<pair<int, int>>> e; int n, m; long long a[N]; vector<int> d...
`ifndef SDIO_DEFINES `define SDIO_DEFINES `define SDIO_STATE_RESET 0 `define SDIO_STATE_ACTIVE 1 `define SDIO_C_BIT_TXRX_DIR 1 `define SDIO_C_BIT_CMD_START 2 `define SDIO_C_BIT_CMD_END 7 `define SDIO_C_BIT_ARG_START 8 `define SDIO_C_BIT_ARG_END 39 `define SDIO_C_BIT_CRC_START 40 `d...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: pcx_buf_pdl_even.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 ...
// // Copyright 2011 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 is dis...
#include <bits/stdc++.h> using namespace std; template <class T> inline void read(T& a) { char c = getchar(); int f = 1; a = 0; for (; c > 9 || c < 0 ; c = getchar()) if (c == - ) f = -1; for (; c <= 9 && c >= 0 ; c = getchar()) a = a * 10 + c - 48; a *= f; } const int o =...
// 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 : Mon Feb 27 19:26:51 2017 // Host : GILAMONSTER running 64-bit major release (...
/** * 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 N = 501; int n, m, a[N]; bool dp[2][N][N]; vector<int> sol; int main() { scanf( %d%d , &n, &m); for (int i = 0; i < n; ++i) scanf( %d , &a[i]); dp[0][0][0] = dp[0][a[0]][0] = dp[0][a[0]][a[0]] = true; int at = 0; for (int i = 1; i <...
module drv_bus_req( input clk_sys, input ready, input r, input w, input in, input [0:7] a1, input [0:15] a2, input [0:15] a3, input zw, output reg zg, input ans_any, output dw, output dr, output din, output dpn, output [0:3] dnb, output [0:15] dad, output [0:15] ddt ); // registered data input/outpu...
#include <iostream> #include <cmath> #include <vector> #include <algorithm> #include <set> #include <cstdio> #include <map> #include <queue> #include <ctime> #include <iomanip> #include <stack> #include <assert.h> #include <unordered_map> using namespace std; #define F first ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 100005; const int MOD = 1000000007; int N; int a[MAXN]; vector<int> ch[MAXN]; int dp[MAXN][2]; inline int add(int x, int y) { x += y; if (x >= MOD) x -= MOD; return x; } inline int mul(int x, int y) { return (long long)x * y ...
// `define ASYNC_RESET module fsm_test(clk, reset, button_a, button_b, red_a, green_a, red_b, green_b); input clk, reset, button_a, button_b; output reg red_a, green_a, red_b, green_b; (* gentb_constant = 0 *) wire reset; integer state; reg [3:0] cnt; `ifdef ASYNC_RESET always @(posedge clk, posedge reset) `else ...
#include <bits/stdc++.h> using namespace std; mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count()); void setIO(string name) { ios_base::sync_with_stdio(false); cin.tie(nullptr); cin.exceptions(istream::failbit); } const int inf = 0x3f3f3f3f, mod = 1e9 + 7, maxn = 1e5 + 5; ...
/** * 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 (c) 2015 Wladimir J. van der Laan // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. /* Very simple interface to PMOD SPI. Serial port accepts bytes in the * form: * 0001zzzz Followed by z+1 bytes. Transfer data ...
/** * 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; int n, f, r[4]; char names[4][16] = { Gryffindor , Hufflepuff , Ravenclaw , Slytherin }; int main() { scanf( %d , &n); vector<vector<int> > v; v.push_back(vector<int>(4)); for (int k = 0; k < (int)(n); k++) { char op; scanf( %c , &op)...
#include <bits/stdc++.h> using namespace std; const long long INF = (long long)1e16; const int N = 900300; const int K = 40; int n; long long a[N]; long long sum[N]; long long dp[N][2]; int par[N][2][3]; int intPoint[N]; int m; vector<int> ans; long long getCost(int L, int R, int f1, int f2) {...
#include <bits/stdc++.h> using namespace std; template <class T> inline void remax(T& A, T B) { if (A < B) A = B; } template <class T> inline void remin(T& A, T B) { if (A > B) A = B; } string ToString(long long num) { string ret; do { ret += ((num % 10) + 0 ); num /= 10; ...
/** * bsg_cache_dma_to_wormhole.v * * This module interfaces bsg_cache_dma to a wormhole link. * dma_pkts come in two flavors: * - Write packets send a wormhole header flit, then an address flit, then N data flits (the * evicted data) * - Read packets send a womrhole header flit, then...
#include <bits/stdc++.h> using namespace std; int a[1000002], b[4000000], intialsum[1000003]; int q(int ind) { int sum = 0; while (ind > 0) { sum += b[ind]; ind -= ind & (-ind); } return sum; } void u(int ind, int n, int val) { while (ind <= n) { b[ind] += val; ind ...
/* Copyright 2010 David Fritz, Brian Gordon, Wira Mulia 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. ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e6 + 10; typedef struct Item { long long v; int id; Item(long long a, int b) { v = a; id = b; } bool operator<(const Item &rhs) const { return v < rhs.v; } } Item; typedef struct Node { vector<int> p; vecto...
/** * 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; namespace io { inline char nc() { static char buf[100000], *p1 = buf, *p2 = buf; return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2) ? EOF : *p1++; } template <class I> inline void fr(I &num) { ...
#include <bits/stdc++.h> using namespace std; long long H[200005]; int a[200005]; long long c[200005 << 2]; long long s[200005 << 2]; long long lz[200005 << 2]; vector<int> v[200005]; int u; int yl, yr; void build(int o, int l, int r) { if (l == r) { lz[o] = l; c[o] = l; s[o] =...
#include <bits/stdc++.h> using namespace std; const int dx[8] = {-2, -2, -1, -1, 1, 1, 2, 2}; const int dy[8] = {-1, 1, -2, 2, -2, 2, -1, 1}; int n, m; int xw, yw, xb, yb; int xtw, ytw, xtb, ytb; deque<pair<int, int>> ww, wb, bw, bb; int dist[1000][1000], parx[1000][1000], pary[1000][1000]; int crap; ...
/* * 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...
//Legal Notice: (C)2016 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 do...
#include <bits/stdc++.h> using namespace std; int ben[11]; int n, k; int mem[505][505 * 11]; int arr[505 * 505]; int freqFav[100005]; int freqCards[100005]; int solve(int num, int rem) { if (rem == 0 || num == 0) return 0; int &ret = mem[num][rem]; if (~ret) return ret; for (int i = 0; i...
#include <bits/stdc++.h> using namespace std; int dist[2 * 100000 + 2 + 5], N, K; vector<int> G[2 * 100000 + 2 + 5]; void addedge(const string &wall, const string &wall2, int i, int offs) { int here = i + offs, there = i + N - offs; if (wall[i] == X ) return; if (i != 0 && wall[i - 1] != X ) G[her...
#include <bits/stdc++.h> using namespace std; int n, a[1005] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15...
//========================================================================= //MIDO `timescale 1 ps / 1 ps module top_mido( input reset, input clk, //-----------------------------------mdio ½Ó¿Ú--------------------------------- output mdc,//Êä³ö¸øÍⲿоƬµÄʱÖÓ inout mdio, output [3:0] port_link ); /***********...
/* * downloaded from http://electrosofts.com/verilog/fifo.html * only changed names and defines */ `include "fifo.v" `define DATA_WIDTH 8 `define ADDR_WIDTH 8 module fifo_test(); reg clk, rst, wr_en, rd_en ; reg[`DATA_WIDTH-1:0] buf_in; reg[`DATA_WIDTH-1:0] tempdata; wire [`DATA_WIDTH-1:0] buf_out; wire [`ADDR_WID...
#include <bits/stdc++.h> using namespace std; const int N = 100010; const long long INF = 1LL << 55; struct Tree { Tree *nex[26]; vector<int> G[2]; int deep; Tree() { for (int i = 0; i < 26; i++) nex[i] = NULL; deep = 0; } }; Tree *tree; void Insert(char *s, int u, int id) ...
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017 // Date : Fri Sep 22 23:01:14 2017 // Host : DarkCube running 64-bit major release ...
#include <bits/stdc++.h> using namespace std; long long N = 0, M, K; long long MOD = 998244353; string S, S1; struct st { long long x, i; }; bool operator<(const st& a, const st& b) { if (a.x == b.x) return a.i < b.i; return a.x < b.x; } long long gcd(long long a, long long b) { while ...
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f, N = 3.1e5; int n, m, dis[N], fm[N]; vector<int> vec[N]; void bfs() { memset(dis, 0x3f, sizeof(dis)); queue<int> q; q.push(1); dis[1] = 0; while (!q.empty()) { int u = q.front(); q.pop(); for (int v ...
module lc3_pipeline_stage4( input reset, input clk, input stall, input [5:0] state, input [19:0] I_DR, input [1:0] I_WBtype, input [2:0] I_Memtype, input [15:0] I_Res, output [19:0] O_DR, output reg [1:0] O_WBtype, output [15:0] O_Res, input [15:0] memdata, output [15:0] m...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long int t; t = 1; while (t--) { long long int n, c1 = 0, c2 = 0, x; cin >> n; while (n--) { cin >> x; if (x == 1) c1++; else ...
#include <bits/stdc++.h> using namespace std; int mult(int a, int b) { return ((long long)a * b) % 1000000007; } int binaryPow(int n, int p) { int acc = 1; while (p) { if (p & 1) acc = mult(acc, n); n = mult(n, n); p >>= 1; } return acc; } int modularInv(int n) { return binar...
/** * 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> const int N = 2e5 + 5; using namespace std; vector<int> G[N]; long long b[N]; int vis[N]; long long ans[N]; long long flag = 1; void dfs(int x, int fa) { long long minn = 0x3f3f3f3f; if (b[x] == -1) { for (int i = 0; i < G[x].size(); i++) { int g = G[x][i];...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); int n, w; cin >> n >> w; vector<int> a(n), b(n); for (int& v : a) cin >> v; for (int& v : b) cin >> v; double l = 0, r = 2e9; for (int t = 0; t < 500; t++) { double m = (l + r) / 2; do...
#include <bits/stdc++.h> using namespace std; void setIO(string name = ) { ios_base::sync_with_stdio(0); cin.tie(0); if (!name.empty()) { freopen((name + .in ).c_str(), r , stdin); freopen((name + .out ).c_str(), w , stdout); } } long long calc(long long a, long long b) { retur...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 15:40:18 03/10/2016 // Design Name: // Module Name: Decodificador // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: ...
#include <bits/stdc++.h> #pragma optimize( SEX_ON_THE_BEACH ) #pragma GCC optimize( unroll-loops ) #pragma GCC optimize( O3 ) #pragma GCC optimize( Ofast ) #pragma GCC optimize( fast-math ) #pragma GCC optimize( no-stack-protector ) #pragma GCC target( sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native ) us...
#include <bits/stdc++.h> using namespace std; const int N = 5e5 + 5; int n = 5e5, f[N], s[N]; vector<int> v[N]; int q, a[N], c[N]; int main() { int i, j, t; long long ans; for (i = 1; i <= n; i = i + 1) { if (i == 1) f[i] = 1; for (j = i; j <= n; j = j + i) { v[j].push_back(i...
module SensorFSM ( input Reset_n_i, input Clk_i, input In0_i, input In1_i, input In2_i, input In3_i, input In4_i, input In5_i, input In6_i, input In7_i, input In8_i, input In9_i, output Out0_o, output Out1_o, output Out2_o, output Out3_o, output Out4_o, output Out5_o, output Out6_o...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:64000000 ) using namespace std; inline unsigned long long gcd(unsigned long long a, unsigned long long b) { if (a < b) { a ^= b; b ^= a; a ^= b; }; return (a > b) ? gcd(a - b, b) : a; } inline int abs(int x) { return x > 0 ...
/* * cpu.v * The Brainfuck Processor * * Copyright (C) 2013 James Cowgill * * 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 la...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; const int inf = 1e9; int main() { long long n, m, grt = 0, eq = 0, less = 0, i; cin >> n >> m; for (i = 0; i < n; i++) { long long temp; cin >> temp; if (temp == m) eq++; else if (temp < m) ...
#include <bits/stdc++.h> using namespace std; int n, a[101]; void scan() { scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %d , &a[i]); sort(a, a + n); } void out() { int ans = 0, k = 0, c; while (1) { c = 0; for (int i = 0; i < n; i++) { if (a[i] != -1) { ...
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 2; const int M = 1e9 + 7; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector<int> v(n); for (int i = 0; i < n; i++) cin >> v[i]; vector<int> pre(n, 1); for (int i = 1; i...
/* Copyright 2018 Nuclei System Technology, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except i...
#include <bits/stdc++.h> #pragma comment(linker, /stack:200000000 ) #pragma GCC optimize( Ofast,no-stack-protector ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) #pragma GCC optimize( unroll-loops ) const int MAX = 2e3 + 10; const int MOD = 1e9 + 7; using namespace std; ...
#include <bits/stdc++.h> using namespace std; const long long INF = (1e9) + 7; const long long C = (1 << (17)); vector<vector<long long> > up, sum; vector<long long> cost, maxw, d; long long LOG = 20; void push(long long v, long long x) { cost.push_back(x); maxw.push_back(x); d.push_back(0); ...
#include <iostream> #include<bits/stdc++.h> #include<vector> #define fo(i,n) for(long long i=0;i<n;i++) #define ll long long int #define inf 999999999999999999 #define pb push_back #define fi first #define se second #define vi vector<ll> #define vii vector<vector<ll>> #define pi pair<ll,ll> #def...
#include <bits/stdc++.h> template <typename Arg1> void ZZ(const char* name, Arg1&& arg1) { std::cout << name << = << arg1 << std::endl; } template <typename Arg1, typename... Args> void ZZ(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, , ); std::cout.w...
#include <bits/stdc++.h> using namespace std; using ll = int64_t; using u64 = uint64_t; using u32 = uint32_t; struct Node { int idx; Node *left = nullptr, *right = nullptr; }; int depth(Node* v) { if (!v) return 0; return max(depth(v->left), depth(v->right)) + 1; } int main() { ios...
#include <bits/stdc++.h> const int MAXN = 200000 + 10; const int INF = 0x7fffffff; using namespace std; struct EDGE { int u, v, w; bool operator<(const EDGE &b) const { return w > b.w; } }; int fa[MAXN + MAXN]; int n, m, vis[MAXN]; int Min[MAXN]; vector<EDGE> edge; int Find(int x) { return f...
#include <bits/stdc++.h> using namespace std; const int Nmax = 100000 + 10; int n; int nr[Nmax]; char s[Nmax], ans[Nmax]; bool ok(int L, int R) { int i, sum; if (L > R) return 0; for (i = 1; i <= n; ++i) nr[i] = s[i] - 0 ; if (L == 1 && nr[R] == 0) return 0; if (L == 2 && nr[1] != 1) re...
`timescale 1ns / 1ps /* * File : IDEX_Stage.v * Project : University of Utah, XUM Project MIPS32 core * Creator(s) : Grant Ayers () * * Modification History: * Rev Date Initials Description of Change * 1.0 9-Jun-2011 GEA Initial design. * 2.0 26-Jul-2012 GEA Ma...
/* Copyright (c) 2021 Alex Forencich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute,...
#include <bits/stdc++.h> using namespace std; long long int gcd(long long int a, long long int b) { if (b == 0) return a; else return gcd(b, a % b); } int main() { long long int n, x, ans, ans1, y; cin >> y; n = (long long int)sqrt((double)y); for (long long int i = n; i > 0;...
// niosii_mm_interconnect_0_avalon_st_adapter_005.v // This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes // will probably be lost. // // Generated using ACDS version 15.1 185 `timescale 1 ps / 1 ps module niosii_mm_interconnect_0_avalon_st_adapter_005 #( parameter inBi...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int a, b, c, d; int n; cin >> a >> b >> c >> d >> n; vector<int> v(n); for (int i = 0; i < n; i++) { cin >> v[i]; } cout << YES n ; int row = max(b, d); ...
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << : << arg1 << n ; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, , ); ...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 3, P = 998244353; int fc[N], ifc[N]; int qp(int a, int b) { int r = 1; for (; b; b >>= 1, a = a * 1ll * a % P) if (b & 1) r = r * 1ll * a % P; return r; } int main() { int n, m = 0, i, j, k, l, o, s = 0; scanf( %d%d%...
module dcache_top ( // System clock, reset and stall clk_i, rst_i, // to Data Memory interface mem_data_i, mem_ack_i, mem_data_o, mem_addr_o, mem_enable_o, mem_write_o, // to CPU interface p1_data_i, p1_addr_i, p1_MemRead_i, p1_MemWrite_i, p1_data_o, p1_stall_o ); // // System...
module prometheus_fx3_stream_out( input rst_n, input clk_100, input stream_out_mode_selected, input i_gpif_in_ch1_rdy_d, input i_gpif_out_ch1_rdy_d, input [31:0]stream_out_data_from_fx3, output o_gpif_re_n_stream_out_, output o_gpif_oe_n_stream_out_ ); reg [2:0]current_stream_out_state; reg [2:0]next_st...
// Author: Adam Nunez, // Copyright (C) 2015 Adam Nunez // // 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 2 // of the License, or (at your option) any later version. // //...