text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int v[100005]; stack<pair<int, int> > S; vector<pair<int, int> > Q; int main() { int N; scanf( %d , &N); for (int i = 0; i < N; i++) scanf( %d , &v[i]); ++N; v[N] = 0; for (int i = 0; i < N; i++) { int a = v[i]; if (S.empty() &&... |
#include <bits/stdc++.h> using namespace std; int main() { int n, s, i, h, m; cin >> n >> s; int a[110]; a[0] = 0; for (i = 1; i <= n; i++) { cin >> h >> m; a[i] = h * 60 + m; } if (a[1] - a[0] - 1 >= s) { cout << 0 0 ; return 0; } for (i = 2; i <= n; i++... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e5 + 10; long long a[MAXN], dp[MAXN]; int main() { long long n, ans = 0; cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = n - 2; i >= 0; i--) { dp[i] = dp[i + 1]; if (a[i + 1] == 0) dp[i]++; } for ... |
// RS-232 TX module
// (c) fpga4fun.com KNJN LLC - 2003, 2004, 2005, 2006
//`define DEBUG // in DEBUG mode, we output one bit per clock cycle (useful for faster simulations)
module async_transmitter(clk, TxD_start, TxD_data, TxD, TxD_busy);
input clk, TxD_start;
input [7:0] TxD_data;
output TxD, TxD_busy;
... |
module \$_DFFE_PN0P_ (input D, C, R, E, output Q);
SLE _TECHMAP_REPLACE_ (.D(D), .CLK(C), .EN(E), .ALn(R), .ADn(1'b1), .SLn(1'b1), .SD(1'b0), .LAT(1'b0), .Q(Q));
endmodule
module \$_DFFE_PN1P_ (input D, C, R, E, output Q);
SLE _TECHMAP_REPLACE_ (.D(D), .CLK(C), .EN(E), .ALn(R), .ADn(1'b0), .SLn(1'b1), .SD(1'b0), .... |
// zukonit14 - Kunal Raut #include<bits/stdc++.h> using namespace std; // #include ext/pb_ds/assoc_container.hpp // #include ext/pb_ds/tree_policy.hpp // using namespace __gnu_pbds; // template<class T> // using oset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_updat... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo
// ============================================================
// File Name: Sdram_WR_FIFO.v
// Megafunction Name(s):
// dcfifo
// ============================================================
// ****************************... |
/*
* 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... |
/**
* 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... |
//
// Generated by Bluespec Compiler (build 0fccbb13)
//
//
// Ports:
// Name I/O size props
// result_valid O 1
// result_value O 128 reg
// CLK I 1 clock
// RST_N I 1 reset
// put_args_x_is_s... |
#include <bits/stdc++.h> using namespace std; int arr[3000000]; long long fadd[3000000]; long long carry[3000000]; long long tot[3000000]; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; for (int i = 0; i < n; i++) cin >> arr[i]; int nsize = 2 * n + 1; for (int i = 0; i <... |
/**
* 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 = 1010; const long long INF = 1e9 + 19; const int LOG = 11; int n, m; int a[N][N]; int b[N][N]; int pref[N][N]; short table[LOG][LOG][N][N]; int deg[N]; void read() { scanf( %d%d , &n, &m); for (int i = 0; i < n; i++) for (int... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) using namespace std; using pii = pair<int, int>; const int MOD = 1e9 + 7, N = 2e3 + 10; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n; cin >> n; vector<pair<long l... |
#include <bits/stdc++.h> using namespace std; struct bottle { int number; double len; double lento; double diflen; } a[100005], b[100005]; int cmp(bottle a, bottle b) { if (a.diflen > b.diflen) return 1; return 0; } int main() { double x1, y1, x2, y2, c1, c2, x, y; scanf( %lf... |
// (c) Copyright 2013 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
// laws.
//
// DISCLAIMER
// This disclaimer is not a license and does not grant any
/... |
#include <bits/stdc++.h> using namespace std; const int MAX = 2e5 + 5; int parent[MAX]; int depth[MAX]; int get(int a) { while (a != parent[a]) a = parent[a]; return a; } void join(int a, int b) { a = get(a); b = get(b); if (a == b) return; if (depth[a] > depth[b]) swap(a, b); ... |
#include <bits/stdc++.h> using namespace std; long long n, k, a[600000], L, R, r, t, l, f; long long s; bool ok(long long x) { long long r = 0; for (long long i = 0; i < n; i++) if (a[i] > x) r += (a[i] - x); if (r <= t) return 1; return 0; } bool ok1(long long x) { long long r = 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 law... |
/*
* 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... |
`timescale 1ns / 1ps
/********************************************************************
* TEST BENCH FOR PROTECTION CELLS *
********************************************************************
* Laboratory : Robotics and Embedded System Technology
* Engineer : Hanjara Cah... |
/*
* Copyright (c) 2002 Stephen Williams ()
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form 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)
* ... |
#include <bits/stdc++.h> #pragma GCC optimize( -O3 ) using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); } const int inf = INT_MAX / 2; const long long infl = 1LL << 60; template <class T> bool chmax(T &a, const T &b) { if (a < b) { a... |
/*
* 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> long int temp, i, j, k, T; long int ABS(int test) { if (test < 0) return test * -1; else return test; } int x8[] = {1, 1, 0, -1, -1, -1, 0, 1}; int y8[] = {0, 1, 1, 1, 0, -1, -1, -1}; int x4[] = {1, 0, -1, 0}; int y4[] = {0, 1, 0, -1}; long int arr[1000000]; ... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 500 * 1000 + 10; vector<int> adj[MAX_N], vec[MAX_N]; int n, m, cnt; queue<int> q; set<int> s; void readInput() { int n, m; cin >> n >> m; for (int i = 0; i < m; i++) { int u, v; cin >> u >> v; u--, v--; adj... |
// ----------------------------------------------------------------------
// Copyright (c) 2015, The Regents of the University of California All
// rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:... |
// soc_design_niosII_core.v
// This file was auto-generated from altera_nios2_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 16.0 211
`timescale 1 ps / 1 ps
module soc_design_niosII_core (
input wire clk, // ... |
#include <bits/stdc++.h> using namespace std; int main() { long n, m, i, j, mn, mx; scanf( %ld %ld , &n, &m); long a[n][m]; for (i = 0; i < n; i++) { for (j = 0; j < m; j++) { scanf( %ld , &a[i][j]); } } mx = 0; for (i = 0; i < n; i++) { mn = LONG_MAX; for... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:32:43 09/11/2015
// Design Name: WB_intercon
// Module Name: Z:/share/ISE/CPUFly/tests/WB_intercon_test.v
// Project Name: CPUFly
// Target Device:
/... |
#include <bits/stdc++.h> using namespace std; long long modex(long long a, long long p, long long m) { if (!p) return 1; if (p & 1) return a * modex(a, p - 1, m) % m; long long v = modex(a, p >> 1, m); return v * v % m; } namespace fft { struct cpx { double r, i; cpx(double r = 0, doub... |
#include <bits/stdc++.h> const int N = 4e6 + 10; int idx[N], rank[N]; struct Point { int x, y; } A[N], Line[N]; inline double slope(Point a) { return double(A[a.x].y - A[a.y].y) / double(A[a.x].x - A[a.y].x); } inline long long area(Point A, Point B, Point C) { return fabs(1LL * (A.x - C.x) * ... |
/**
* 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... |
/*****************************************************************************
* File : processing_system7_bfm_v2_0_regc.v
*
* Date : 2012-11
*
* Description : Controller for Register Map Memory
*
*****************************************************************************/
module processing_system7_bfm_v2_0_r... |
#include <bits/stdc++.h> using namespace std; const int MAXn = 2e5 + 3; const long long INF = 1e15 + 1; long long t[4 * MAXn], sum[MAXn], lazy[4 * MAXn]; int id[MAXn]; void Build(int v, int l, int r) { lazy[v] = 0; if (l == r) { t[v] = sum[l]; return; } int mid = (r + l) / 2; ... |
#include <bits/stdc++.h> using namespace std; using namespace std::chrono; long long fac[1000006]; inline long long exp(long long x, long long n) { long long r = 1; x = x; while (n) { if (n % 2) r = (r * x) % 10000000000000007; x = (x * x) % 10000000000000007; n = n / 2; } ... |
///////////////////////////////////////////////////////////////////////////////
//
// 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... |
//////////////////////////////////////////////////////////////////////////////////
// Company: RMIT University
// Engineer: Matthew Myungha Kim
// ,
//
// Create Date: 16:54:00 06/03/2014
// Design Name: signal_gen
// Module Name: signal_gen
// Project Name: Streaming Media on Null Convention Logic
// Desc... |
// (C) 2001-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 doc... |
/*
* 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... |
/**
* 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 long long MOD = 1e9 + 7; int n, m, num[40][40], len = 0, stat[20], sv[20], ans = 0; bool vis[10][10], vis2[10][10], usedr[10], have = false; string s[40]; vector<pair<int, int> > coo[400]; vector<int> pr[20]; bool stane = false; bool check(int pos) {... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2009 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc=0;
reg [63:0] crc;
reg [63:0] sum;
// verilator lint_off LITENDIAN
... |
// Copyright 2020-2022 F4PGA 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... |
#include <bits/stdc++.h> using namespace std; constexpr int kN = int(2E5 + 10), kInf = int(1E9 + 10), kC = int(1E6 + 10); struct seg_tree { long long int val[kN << 2], flag[kN << 2]; void init() { memset(val, 0, sizeof(val)); memset(flag, 0, sizeof(flag)); return; } void addtag(i... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
module fei4_rx_core #(
parameter DSIZE =... |
/*
* Milkymist SoC
* Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq
*
* 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, version 3 of the License.
*
* This program is distributed in ... |
/*------------------------------------------------------------------------------
* 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... |
#include <bits/stdc++.h> using namespace std; const long long int mod = 1e9 + 7; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long int n, k; cin >> n >> k; long long int ans = 1; while (k % 2 == 0) { k = k / 2; ans++; } cout << an... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int fre[26] = {0}; for (int i = 0; i < n; i++) { fre[s[i] - a ] = fre[s[i] - a ] + 1; } string ans = ; for (int i = 0; i < 26; i++) { for (int j = 0; j < fre[i]; j++) {... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: ccx_arb_atomq.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 and... |
// Accellera Standard V2.3 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2008. All rights reserved.
`include "std_ovl_defines.h"
`module ovl_change (clock, reset, enable, start_event, test_expr, fire);
parameter severity_level = `OVL_SEVERITY_DEFAULT;
parameter width = 1;
... |
/*
*
* Copyright (c) 2013
*
*
*
* 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 distributed in the ... |
#include <bits/stdc++.h> using namespace std; long long n, k, ans = 34343434; vector<long long> a; vector<long long> b; int main() { cin >> n; for (int i = 0; i < n; i++) { long long x, y; cin >> x >> y; if (x == 1) a.push_back(y); else b.push_back(y); } ... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; while (n) { if (n % 10 != 1 && n % 100 != 14 && n % 1000 != 144) { cout << NO ; return 0; } n /= 10; } cout << YES ; return 0; } |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: bw_io_ddr_rptr_d.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 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 long long int N = 100001; bool ok; long long int n, q; long long int trie[6 * N][5], done[6 * N]; long long int nxt = 1; string s; void insert(string s) { long long int node = 0; for (char c : s) { if (trie[node][c - a ] == 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... |
`default_nettype none
`define CLKFBOUT_MULT 2
// ============================================================================
module top
(
input wire clk,
input wire rst,
input wire [7:0] sw,
output wire [9:0] led,
inout wire io
);
localparam DATA_WIDTH = `DATA_WIDTH_DEFINE;
localparam DATA_RATE = `DATA_RATE... |
#include <bits/stdc++.h> using namespace std; int mod = 998244353; long long a[300001]; long long n, m, k; int b[300001]; void solve() { cin >> n; for (int i = 0; i < n; ++i) { int x; cin >> x; a[x]++; b[a[x]] += a[x]; k = (b[a[x]] >= i && b[a[x]] != n) ? b[a[x]] : k; ... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, k; bool odd = false, even = false; cin >> n >> k; if (n & 1) { if (k > (n / 2 + 1)) { even = true; k -= (n / 2 + 1); } else odd = true; } else { if (k > n / 2) { even = true;... |
#include <bits/stdc++.h> using namespace std; int main() { int n, t, c = 1; cin >> n >> t; int mn = INT_MAX; for (int i = 1; i <= n; i++) { int s, d; cin >> s >> d; while (s < t) { s += d; } if (s < mn) { mn = s; c = i; } } cout << ... |
#include <bits/stdc++.h> using namespace std; const int mxn = 1e5 + 5; int n, a[mxn], c[mxn]; bool vis[mxn]; int main() { scanf( %d , &n); for (int(i) = (int)(1); (i) <= (int)(n); ++(i)) scanf( %d , a + i); int cnt = 0; for (int(i) = (int)(n); (i) >= (int)(1); --(i)) { c[i] = c[i + 1] + ... |
#include <bits/stdc++.h> using namespace std; const long long MAX = -1000000000000000000; const long long MIN = 1000000000000000000; const long long inf = 1000000000; const long long KOK = 100000; const long long LOG = 30; const long long li = 500005; const long long mod = 1000000007; int n, m, b[li],... |
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); using ll = long long; template <typename T> void DEBUG(string label, T value) { cerr << [ << label << = << value << ] n ; } map<string, int> encode; map<int, string> decode; in... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, m; cin >> n >> m; for (long long i = 1; i <= n; i++) { long long s, f, t; cin >> s >> f >> t; if (s == f) { cout << t << endl; } else if (s < f) { long long t1 = s - 1; while (t1 < t) ... |
#include <bits/stdc++.h> using namespace std; const int N = 200005; int n; int A[N]; int main() { int t; scanf( %d , &t); while (t--) { scanf( %d , &n); n *= 2; for (int i = 1; i <= n; i++) { scanf( %d , &A[i]); } sort(A + 1, A + 1 + n); n /= 2; pr... |
#include <bits/stdc++.h> using namespace std; long long int T, n; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; cin >> T; while (T--) { cin >> n; set<long long int> chk_div; vector<long long int> g; for (long long int i = 0, u; i < n; i++) cin >> ... |
#include <bits/stdc++.h> using namespace std; char c[1005], s[55], t[55]; int ns[55], nt[55]; int tos[55][30], tot[55][30]; int lenc, lens, lent; int dp[1005][55][55]; void init() { lenc = strlen(c + 1), lens = strlen(s + 1), lent = strlen(t + 1); ns[1] = 0, nt[1] = 0; for (int i = 2, j = 0; i... |
#include <bits/stdc++.h> using namespace std; int main() { static int n; static int a[300010], b[300010]; scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d%d , &a[i], &b[i]); int cnt[2] = {}; for (int i = 1; i <= n; i++) { if (a[i] < b[i]) cnt[0]++; else cnt... |
/*
* 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> int main() { int i, cnt1 = 0, l, diff, a, c, fck; scanf( %d%d , &a, &c); l = a; diff = 0; while (l > 0) { if (l % 3) diff += (3 - (l % 3)) * pow(3, cnt1); l /= 3; cnt1++; } cnt1 = 0; l = 0; while (c || diff) { fck = c + diff; l... |
// 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 : Tue Sep 19 00:30:31 2017
// Host : DarkCube running 64-bit major release ... |
//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 associate... |
module spmc_sd_card(
//*** Connections to SpartanMC Core (do not change) ***
input wire clk_peri, //System-Clock
input wire [17:0] do_peri, //Data Bus from MC
output [17:0] di_peri, //Data Bus to MC
input wire [9:0] addr_p... |
#include <bits/stdc++.h> using namespace std; using ll = long long int; using dd = double; using pii = pair<int, int>; using pll = pair<ll, ll>; ll INFLL = (ll)2e18, MOD = 1e9 + 7; const int INF = 0x6f6f6f6f; vector<vector<ll>> adj; vector<int> vis; int dx8[] = {0, 1, 1, 1, 0, -1, -1, -1}, dy8[] = {... |
/*
* 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... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10:57:32 09/24/2013
// Design Name: Debounce
// Module Name: C:/Users/Fabian/Documents/GitHub/taller-diseno-digital/Lab3/laboratorio3/test_debounce.v
// Project Name:... |
#include <bits/stdc++.h> using namespace std; char orz[500001]; int gg[500001]; int t; int main() { cin >> t; while (t--) { int n, q; scanf( %d%d , &n, &q); scanf( %s , orz + 1); int rrr = 1; for (int i = 1; i <= n; i++) { if (orz[i] == + ) gg[i] = gg[i... |
#include <bits/stdc++.h> using namespace std; bool debug = false; int n, m, k; int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1}; long long ln, lk, lm; int a[10]; bool v[9], vv[9]; bool walk(int x) { v[x] = 1; if (a[x] == 1 || vv[a[x]]) return vv[x] = 1; if (v[a[x]]) return 0; return vv[x... |
#include <bits/stdc++.h> int n, k, a[100001], is[100001], i, j, sum, ans; int main() { scanf( %d %d , &n, &k); for (i = 0; i < n; i++) scanf( %d , &a[i]); for (i = 0; i < n; i++) scanf( %d , &is[i]); for (i = 0; i < k; i++) sum += a[i]; for (i = k; i < n; i++) if (is[i]) sum += a[i]; a... |
#include <bits/stdc++.h> char gb[65536], pb[65536], *gp = gb + 65536, *pp = pb, a[2][2005], s[2005]; int _5[65], n = 0, m = 0, f[2][2005][2005]; long long seed[2005]; inline void add(int &x, int y) { x += y; if (x >= 1e9 + 7) x -= 1e9 + 7; } inline int gline(char *b) { char c = getchar(); in... |
#include <bits/stdc++.h> using namespace std; map<int, map<int, int> > m; long long int lol(long long int a, long long int r) { if (a >= 0 && r <= 0) return a; if (a <= 0 && r >= 0) return a; return a % r; } int main() { long long int a, b; cin >> a >> b; string s; cin >> s; lo... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); int n, k; cin >> n >> k; string s; cin >> s; string ss = s; int iter = 0; int total = 0; while (true) { int cnt = 0; for (int i = 1; i < n; i++) if (s[i - 1] == R && s[i]... |
// Generated by altmemphy 11.0 [Altera, IP Toolbench 1.3.0 Build 208]
// ************************************************************
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
// ************************************************************
// Copyright (C) 1991-2011 Altera Corporation
// Any megafuncti... |
`include "hglobal.v"
`default_nettype none
`define NS_NUM_TEST 12
`define NS_SEL_HALFBYTE(ii) ii*4 +: 4
module test_top
#(parameter
PSZ=`NS_PACKET_SIZE,
ASZ=`NS_ADDRESS_SIZE,
DSZ=`NS_DATA_SIZE,
RSZ=`NS_REDUN_SIZE
)(
input i_clk,
input i_Switch_1,
input i_Switch_2,
input i_Switch_3,
input... |
#include <bits/stdc++.h> using namespace std; long long a[1000005] = {1, 1}, b[1000005], num; long long x2, ans = 100000000; void init() { long long i, j; for (i = 2; i <= 1000000; i++) { if (a[i]) continue; for (j = i * i; j <= 1000000; j += i) a[j] = 1; } for (i = 1; i <= 1000000; ... |
`timescale 1 ns / 1 ps
`include "axi_i2s_adi_v1_2_tb_include.vh"
// lite_response Type Defines
`define RESPONSE_OKAY 2'b00
`define RESPONSE_EXOKAY 2'b01
`define RESP_BUS_WIDTH 2
`define BURST_TYPE_INCR 2'b01
`define BURST_TYPE_WRAP 2'b10
// AMBA AXI4 Lite Range Constants
`define S00_AXI_MAX_BURST_LENGTH 1
`define... |
#include <bits/stdc++.h> using namespace std; long long mod = 1e9 + 7; int inf = 1e9; double eps = 1e-6; int main() { int n, k; cin >> n >> k; vector<int> a; for (int i = 0; i < n; i++) { int t; cin >> t; a.push_back(t); } if (k == 1) { int ans = a[0]; for... |
/**
* @module alu
* @author sabertazimi
* @email
* @param DATA_WIDTH data width
* @input srcA A port data
* @input srcB B port data
* @input aluop operation code
* @output aluout calculation result
* @output zero equal flag
* @output of signed overflow flag
* @output uof unsigned overflow flag
*/
module al... |
//////////////////////////////////////////////////////////////////////
//// ////
//// or1200_fpu_pre_norm_addsub ////
//// ////
//// This file is part of the OpenR... |
/**
* 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 dp[550005]; int main() { int n, d, c, i, j, x, flog; scanf( %d %d , &n, &d); dp[0] = 1; for (i = 0; i < n; i++) { scanf( %d , &c); for (j = 500000; j >= c; j--) { dp[j] |= dp[j - c]; } } int day = 0; x = 0; ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date:
// Design Name:
// Module Name: GDA_St_N8_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 la... |
// (c) Copyright 1995-2015 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
// laws.
//
// DISCLAIMER
// This disclaimer is not a license and does not grant ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 200001, MOD = 1000000007; int n, l, r; long long one = 0, two = 0, zero = 0, dp[MAXN][3]; int main() { cin >> n >> l >> r; for (; l % 3 != 0 && l <= r; l++) if (l % 3 == 1) one++; else if (l % 3 == 2) two++; ... |
#include <bits/stdc++.h> using namespace std; void solve(); int main() { ios_base::sync_with_stdio(0); cin.tie(0); solve(); return 0; } long long ar[3]; void solve() { long long x, y, ans = 0; cin >> x >> y; ar[0] = ar[1] = ar[2] = y; while (ar[0] < x || ar[1] < x || ar[2] < ... |
`timescale 1 ns / 1 ps
module axis_interpolator #
(
parameter integer AXIS_TDATA_WIDTH = 32,
parameter integer CNTR_WIDTH = 32
)
(
// System signals
input wire aclk,
input wire aresetn,
input wire [CNTR_WIDTH-1:0] cfg_data,
// Slave side
output ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.