text stringlengths 59 71.4k |
|---|
`timescale 1ns / 1ps
module ad7390 #
(
parameter integer CLK_DIV = 250,
parameter integer DAC_WIDTH = 12,
parameter integer AXI_WIDTH = 16
)
(
input wire aclk,
input wire aresetn,
output reg s_axis_tready,
input wire [AXI_WIDTH-1:0] s... |
#include <bits/stdc++.h> using namespace std; long long mc[1 << 20]; list<int> th; struct f { long long x, k, m, ms[20]; } fs[100]; bool kcomp(f a, f b) { return a.k < b.k; } int main() { ios::sync_with_stdio(false); cin.tie(0); long long n, m, b; cin >> n >> m >> b; for (int i = 0... |
#include <bits/stdc++.h> using namespace std; pair<pair<int, int>, int> e[100010]; int parent[100010]; int Rank[100010]; int sz[100010]; vector<int> v[100010]; bool mark[100010]; bool mark1[100010]; int color[100010]; vector<int> out[2]; bool success[2]; int cnt[2]; int n, m; int find(int cu... |
#include <bits/stdc++.h> using namespace std; const int N = 100004; int n, m, c = 0; char s[24][24]; set<unsigned long long> st, ns; bool fun(int x, int y) { st.clear(); for (int i = 0; i < n; i += x) for (int j = 0; j < m; j += y) { ns.clear(); unsigned long long sum = 0; ... |
/// date:2016/3/9
/// engineer: ZhaiShaoMin
module m_rep_upload(//input
clk,
rst,
m_flits_rep,
v_m_flits_rep,
flits_max,
en_flits_max,
rep_fifo_rdy,
... |
/**
* 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, a, b; int M[256 + 1]; int main() { scanf( %d %d %d , &n, &a, &b); if (a & 1) a++; if (b & 1) b++; int round = 1; for (;;) { a /= 2; b /= 2; if (a == b) break; round++; if (a & 1) a++; if (b & 1) b++; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; long long int a[n + 2]; vector<long long int> pre(n + 2); for (int i = 1; i <= n; i++) { cin >> a[i]; } sort(a + 1, a + n + 1); for (int i = 1; i <= n; i++) { pre[i] = pre[i - 1] + a[i]; ... |
#include <bits/stdc++.h> using namespace std; const long long MAXN = (long long)1e5 + 10; vector<long long> G[MAXN]; pair<long long, long long> p; vector<long long> v; long long n, x, y, k, ans, sum, flag; string s; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> x >> y; ... |
//Register File
module regfile (
clk, // Clock
x, //External Input
ld, //Whether or not to load destination register from extenral input
d, //Destination register
sa, //1st Source Register
sb, // 2nd Source Register
a, // Output a
b // Output b
);
parameter n = 16; //n bits per register
parameter k = 4; //2^k register... |
#include <bits/stdc++.h> using namespace std; char arr[50][50]; int main() { int n, m; cin >> n >> m; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) { if ((i % 2 == 0 || ((i % 4 == 1 && j == m - 1) || (i % 4 == 3 && j == 0)))) arr[i][j] = # ; else... |
module Counter_TV1 #(
parameter Width = 16
) (
(* intersynth_port = "Reset_n_i" *)
input Reset_n_i,
(* intersynth_port = "Clk_i" *)
input Clk_i,
(* intersynth_conntype = "Bit" *)
input ResetSig_i,
(* intersynth_conntype = "Bit" *)
input Preset_i,
(* intersynth_conntype = "Bit" *)
input Enable_i,
... |
#include <bits/stdc++.h> static const int MAXN = 2e5 + 10; int n, m; std::pair<int, int> p[MAXN]; int x_idx[MAXN], x[MAXN]; int a_i, l_i; inline int solve_query(int u, int len) { while (true) { int last_len = len; int p = std::upper_bound(x, x + n, x[u] + len) - x - 1; len -= (x[p] - x... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long t; double n; cin >> t; while (t--) { cin >> n; if (n * n - 4 * n < 0) { cout << N << endl; continue; } if (n == 0) { double ... |
#include <bits/stdc++.h> using namespace std; string a, b; int main() { int n; while (cin >> n) { cin >> a >> b; long long ans = 0; long long x = 0, y = 0, p = 0, q = 0; for (int i = 0; i < n; i++) if (b[i] == 1 ) a[i] == 0 ? x++ : y++; for (int i = 0; i < n; i++) ... |
//////////////////////////////////////////////////////////////////////
//// ////
//// TxfifoBI.v ////
//// ////
//// This file is part of the usbhos... |
/***************************************************************************************************
** fpga_nes/hw/src/cpu/apu/apu.v
*
* Copyright (c) 2012, Brian Bennett
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the fo... |
#include <bits/stdc++.h> using namespace std; int n; struct node { int s, r, no; } xx[500001], dance[500001], fire[500001]; bool cmp(node x, node y) { return x.s > y.s || (x.s == y.s && x.r > y.r); } int S[500001]; int ans[500001]; int mal = 0; int k; int q; bool yes[500001]; double eps = 1e... |
#include <bits/stdc++.h> const int maxn = 50; using namespace std; long long n, k, M; int a[maxn + 5], b[maxn * maxn]; void ok() { long long ans = 0, cot = 0, tot = 0, cnt = 0, sum = 0; sort(a + 1, a + k + 1); for (int i = 1; i <= k; i++) cot += a[i]; for (int i = 0; i <= n; i++) { tot =... |
#include <bits/stdc++.h> using namespace std; int n, k; struct trie { int cnt, whole; trie *next[26]; trie() { cnt = 0; for (int i = 0; i < 26; ++i) next[i] = NULL; } } *root = new trie(); void ins(char *s) { trie *p = root; for (int i = 0; s[i]; ++i) { int c = s[i] -... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-8; const double pi = acos(-1.0); template <class T> long long chkmin(T &a, T b) { return a > b ? a = b, 1 : 0; } template <class T> long long chkmax(T &a, T b) { return a < b ? a = b, 1 : 0; } template <class T> T sqr(T a)... |
`timescale 1ps/1ps
//Overivew
//========
//This file contains the verilog primitives produced by VPR's
//post-synthesis netlist writer.
//
//If you wish to do back-annotated timing simulation you will need
//to link with this file during simulation.
//
//To ensure currect result when performing back-annoatation with
/... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
module fifo_32_to_8 #(
parameter DEPTH... |
/**
* 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 main() { string s, r; cin >> s; int k, l, x, n; cin >> k; l = s.length(); if (l % k != 0) { cout << NO n ; return 0; } x = l / k; for (int i = 0; i < l; i += x) { r = s.substr(i, x); n = r.length() - 1; ... |
#include <bits/stdc++.h> using namespace std; const int N = 1000010; int f[N]; void init() { for (int i = 1; i <= N; i++) { f[i] = f[i - 1] + i * 2 + (i - 1); if (f[i] >= 1e9) { break; } } } int Find(int x) { int l = 0, r = 25820; while (l < r) { int mid = (l ... |
`include "assert.vh"
`include "cpu.vh"
module cpu_tb();
reg clk = 0;
//
// ROM
//
localparam MEM_ADDR = 6;
localparam MEM_EXTRA = 4;
localparam STACK_DEPTH = 7;
reg [ MEM_ADDR :0] mem_addr;
reg [ MEM_EXTRA-1:0] mem_extra;
reg [ MEM_ADDR :0] rom_lower_bound = 0;
reg ... |
/**
* 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 main() { int n; cin >> n; vector<int> arr(n); for (auto &i : arr) cin >> i; int maxx = 0; for (auto i : arr) maxx = max(maxx, i); cout << (maxx xor arr.back()); return 0; } |
`timescale 1 ns / 1 ps
// BRAM PORTA input
// BRAM PORTB input
// BRAM PORTC output
module bram_switch #
(
parameter integer BRAM_DATA_WIDTH = 32,
parameter integer BRAM_ADDR_WIDTH = 15 // 2^11 = 2048 positions
)
(
// System signals
input wire switch,
// BRAM PORT A
input w... |
#include <bits/stdc++.h> using namespace std; long long abs(long long, long long); double dis(long long x1, long long y1, long long x2, long long y2) { double d = (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2); d = sqrt(d * 1.0); return d; } void solve() { long long w, h; cin >> w >> h; ... |
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int max_n = 1e5 + 5; string q[max_n]; int dig[10][2]; int main() { string s; cin >> s; int n; scanf( %d , &n); for (int i = 1; i <= n; i++) cin >> q[i]; for (int i = 0; i <= 9; i++) { dig[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; int N; int K[1010]; pair<int, int> nex[1010][2520]; int P, Q; int num[1010][2520]; int vis[1010][2520]; class SCC { public: static const int MV = 1010 * 2520; vector<vector<int> > SC; int NV, GR[MV]; private: vector<int> E[MV], RE[MV... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0), cout.tie(0); cin.tie(0), cout.tie(0); ; long long int a, b, t, n, m, k, i, j, l, sum = 0, sum1 = 0, ans = 0; vector<long long int> v; cin >> n; for (i = 0; i < n; i++) { cin... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3F3F3F3F; const long long INF_LL = 0x3F3F3F3F3F3F3F3FLL; const int N = 4e5 + 50; bool check(const string &s, const string &t) { int match = 0; for (int i = 0; i < s.size() && match < t.size(); ++i) { if (s[i] == t[match]) ++match; ... |
#include <bits/stdc++.h> class big_integer { public: big_integer(int32_t v) { if (v >= base) { data_.push_back(v % base); data_.push_back(v / base); } else { data_.push_back(v); } } void inc() { int32_t carry = 1; size_t ptr = 0; while (carry ... |
/*
* 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... |
/* This file is part of JT12.
JT12 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.
JT12 program is distribute... |
/**
* 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 a[1001]; int main() { int n; scanf( %d , &n); int m = n; int pos = 0; int k = 1; while (true) { if (a[pos] == 0) m--; if (m == 0) { printf( YES n ); return 0; } a[pos] = 1; if (pos == (pos + k) ... |
#include <bits/stdc++.h> using namespace std; int n, a[300]; int main() { cin >> n; for (int i = 0; i < 2 * n; i++) { cin >> a[i]; } sort(a, a + 2 * n); if (a[n - 1] != a[n]) cout << YES << endl; else cout << NO << endl; } |
#include <bits/stdc++.h> using namespace std; const int N = 112345; vector<int> v[N]; int read() { int x; scanf( %d , &x); return x; } int cnt[N]; bool used[N]; bool t[N]; bool never[N]; int main() { int n, m, i, j, x, y; n = read(); for (i = 2; i <= n; i++) { x = read(... |
`include "../network_params.h"
module pipeline_tb();
reg clock;
reg reset;
reg [`SCREEN_X_BITWIDTH:0] screen_x;
reg [`SCREEN_Y_BITWIDTH:0] screen_y;
wire [`CAMERA_PIXEL_BITWIDTH:0] pixel;
wire [`RECT_OUT_BITWIDTH:0] rect1;
wire [`RECT_OUT_BITWIDTH:0] rect2;
wire [`RECT_OUT_BITWIDTH:0] rect3;
wire [`RECT_OUT_BITWIDTH... |
// 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 : Sun Jun 04 23:06:45 2017
// Host : GILAMONSTER running 64-bit major release (... |
//Legal Notice: (C)2013 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; bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) { return (a.second < b.second); } int main() { int t, n, x; cin >> n; vector<pair<int, int>> arr; vector<int> arr2(n + 2, 0); set<int, greater<int>> st; for (int i = 1; i <=... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; k = min(k, 26); string s = ab ; for (int i = 0; i < k - 2; i++) { s += char(99 + i); } string s1 = ; for (int i = 0; i < n / k; i++) { s1 += s; } for (int i = 0; i < n % k; i++)... |
`default_nettype none
`timescale 1ns / 1ps
`include "asserts.vh"
`include "sia.vh"
// The sia_wb core provides a Wishbone B.4 pipelined compatible slave
// port to allow bus masters to talk to the SIA's receiver and transmitter.
// Additional status bits are exposed beyond those defined by Wishbone,
// providing supp... |
#include <bits/stdc++.h> using namespace std; int dp1[101010] = {0}, dp2[101010] = {0}; int main() { cin.sync_with_stdio(0); cin.tie(0); int n; cin >> n; int h[101010]; for (int i = 0; i < n; i++) cin >> h[i]; dp1[0] = 1; for (int i = 1; i < n - 1; i++) { dp1[i] = dp1[i - 1] ... |
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016-2020 NUDT, Inc. All rights reserved.
////////////////////////////////////////////////////////////////////////////////
//Vendor: NUDT
//Version: 0.1
//Filename: UM.v
//Target Device: Altera
//Dscription:
// ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a(n), b(n), pa(n), pb(n); for (int i = 0; i < n; ++i) { cin >> a[i]; --a[i]; pa[a[i]] = i; } for (int i = 0; i < n; ++i) { cin >> b[i]; --b[i]; pb[b[i]] = i; } ... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { if (a == 0) return b; else if (b == 0) return a; else { a = a % b; return gcd(b, a); } } int main() { int n; int sum = 0, odd = 0; scanf( %d , &n); int t; for (int ... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; struct node { int a; int b; int sum; }; int n, q; int nblock; node nums[300315]; int acum = 0; ... |
// Filename: receive.v
// Author: Danny Dutton
// Date: 03/23/15
// Version: 1
// Description: Module that receives a 10-bit bus which is fed into a register.
// This data is also fed into a 9-bit parity generator. The ODD ouput
// is compared to the 10th data bit which is an even parity bit.
... |
//#############################################################################
//# Function: Clock domain crossing FIFO #
//#############################################################################
//# Author: Andreas Olofsson #
... |
#include <bits/stdc++.h> using namespace std; const int N = 61; const int K = 22222; const int M = K + K + 5; int n, m; int a[N], b[N]; long long m1[M], m2[M]; int main() { scanf( %d %d , &n, &m); for (int i = 0; i < n; i++) scanf( %d , &a[i]); for (int i = 0; i < m; i++) scanf( %d , &b[i]);... |
`default_nettype none
`timescale 1ns / 1ps
/***********************************************************************************************************************
* *
* ANTIKERNEL v0.1 ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; const int maxn = 2e5 + 10; int a[maxn]; char s[maxn]; const char *t = LR ; int main() { int n; cin >> n; for (int i = 0; i < n; i++) scanf( %d , &a[i]); sort(a, a + n); scanf( %s , 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; long long n, m, a, b, x, cnt, ans; deque<long long> V; map<long long, long long> mp; long long arr[1000001]; int main() { cin >> n >> a >> b; for (int i = 1; i <= n; i++) { cin >> arr[i]; } sort(arr + 1, arr + n + 1); ans = (n - a) + 1;... |
#include <bits/stdc++.h> using namespace std; const int maxn = 30; int n, k; long long s, ans, a[maxn], fac[maxn]; map<long long, long long> mp[maxn]; void dfs1(int x, int usd, long long now) { if (x == n / 2 + 1) { if (mp[usd].find(now) == mp[usd].end()) mp[usd].insert(make_pair(now, 1));... |
#include <bits/stdc++.h> using namespace std; int main() { int matrix[5][5]; for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { cin >> matrix[i][j]; } } int row = 0; int col = 0; for (int i = 0; i < 5; i++) { for (int j = 0; j < 5; j++) { if (matrix... |
#include <bits/stdc++.h> using namespace std; const long double EPS = 1e-9; long long Power(long long a, long long b) { if (b == 0) return 1; long long p = Power(a, b / 2); p = (p * p); if (b & 1) { p = (p * a); } return p; } long long Gcd(long long a, long long b) { if (b ==... |
#include <bits/stdc++.h> using namespace std; vector<int> split, ans; int a[300002]; int p[300002][3]; long long max(long long a, long long b) { return a >= b ? a : b; } long long min(long long a, long long b) { return a <= b ? a : b; } int main() { int n, i, j, l, r; scanf( %d , &n); for (i =... |
#include <bits/stdc++.h> using namespace std; void solve() { long long n; long long a[2]; cin >> a[0] >> a[1]; sort(a, a + 2); n = 2 * a[0]; if (n < a[1]) { n = a[1]; } n *= n; cout << n << endl; } int main() { int t; cin >> t; while (t--) { solve(); ... |
`timescale 1ns / 1ps
module dewater_mode_tb();
reg [31:0]clk;
wire [31:0]dewater_count;
wire [1:0]state;
reg start, power, dewater_start;
reg [2:0]weight;
wire dewater_end_sign, water_out_light, dewatering_light;
wire [2:0]water_level;
parameter TIME = 1000;
dewater_mode DEWAT... |
#include <bits/stdc++.h> using namespace std; const long long int MAX = -1000000000000000000; const long long int MIN = 1000000000000000000; const long long int inf = 1000000000000000000; const long long int KOK = 100000; const long long int LOG = 30; const long long int li = 105; const long long int mo... |
`timescale 1 ns / 1 ps
module spoonPacketDecoder(
input reset,
input clk,
input [63:0] data,
input push_in,
input ramIn,
output [63:0] value,
output [31:0] column,
output [31:0] row,
output push_out,
output stall);
reg [255:0] buffer;
reg [5:0] count, next_count;
reg... |
#include<bits/stdc++.h> #define fo(i,a,b) for(int i=a;i<=b;i++) #define gc (p1==p2&&(p2=(p1=fr)+fread(fr,1,1<<20,stdin))==p1?EOF:*p1++) #define fl fwrite(fw,1,p3-fw,stdout),p3=fw char ch,fr[1<<21],*p1=fr,*p2=fr,fw[1<<21],*p3=fw; void rd(int&x) { while(!isdigit(ch=gc));x=ch-48; while( isdigit(ch=gc)) 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 law... |
// Copyright (c) 2016 CERN
// Maciej Suminski <>
//
// 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)
// any late... |
module dut(/*AUTOARG*/
// Outputs
dut_active, clkout, wait_out, access_out, packet_out,
// Inputs
clk1, clk2, nreset, vdd, vss, access_in, packet_in, wait_in
);
parameter N = 1;
parameter PW = 104;
//clock, reset
input clk1;
input clk2;
input nr... |
#include <bits/stdc++.h> using namespace std; signed main() { long long t; cin >> t; while (t--) { long long a, b; cin >> a >> b; if (a == b) { if (a == 0) cout << 0 << n ; else cout << 1 << n ; } else if ((a + b) % 2) cout << -1 <<... |
#include <bits/stdc++.h> using namespace std; const int Maxn = 65536 + 10; int n, deg[Maxn], s[Maxn]; vector<pair<int, int> > ans; set<pair<int, int> > mys; int main() { scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %d%d , °[i], &s[i]); mys.insert(make_pair(deg[i], i)); } ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, k; cin >> n >> k; int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; if (n > 1) sort(a, a + n); int cont = 0; if (k == n) { cout << a[k - 1] << n ; } els... |
// This is written by Zhiyang Ong
// and Andrew Mattheisen
// for EE577b Troy WideWord Processor Project
module pipe3(dataOut_in, dataOut_out, wbyteen_in, wbyteen_out,
regwren_in, regwren_out, rwraddrd_in, rwraddrd_out,
reginmuxop_in, reginmuxop_out, aluOut_in, aluOut_out,
instruction_in, instruction_out,... |
//====================================================================
// bsg_idiv_iterative_controller.v
// 11/14/2016,
//====================================================================
//
// The controller of bsg_idiv_iterative module.
// Code refactored based on Sam Larser's work
`include "bsg_defines.v"
mod... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e6 + 7; const int INF = 0x7fffffff; long long c[maxn], s[maxn]; long long a[maxn], num[maxn]; int main() { long long n, x, y; while (cin >> n >> x >> y) { long long ans = n * x; memset(num, 0, sizeof(num)); for (int i ... |
#include <bits/stdc++.h> using namespace std; int main() { string s; getline(cin, s); long long n = s.length(), i = n - 1; while (1) { if ((s[i] >= 65 && s[i] <= 91) || (s[i] >= 97 && s[i] <= 122)) { if (s[i] == a || s[i] == y || s[i] == e || s[i] == i || s[i] == o... |
#include <bits/stdc++.h> using namespace std; const int maxn = 7e3 + 11; int n; vector<int> s[2]; const int loose = 0; const int win = 1; bool vis[2][maxn][2]; int deg[maxn][2]; int32_t main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> n; for (int k, i = 0; i < 2; 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 law... |
module Seven_seg(clk, reset, DAT_I, STB, DAT_O, ACK, WE, Segment, AN, debug_data_hold);
input clk, reset;
input [31: 0] DAT_I;
input STB;
input WE;
output reg [3: 0] AN;
output [7: 0] Segment;
output [31: 0] DAT_O;
output ACK;
output [15: 0] debug_data_hold;
reg [7: 0] digit_seg... |
`timescale 1ns / 1ps
module IDEX
(
// Input
input Clk,
input Reset,
input [31:0] PCIn,
input [31:0] DataIn1,
input [31:0] DataIn2,
input [4:0] rsIn,
input [31:0] ImmediateIn,
input [4:0] rtIn,
input [2:0] WBIn,
input [1:0] MIn,
input... |
#include <bits/stdc++.h> using namespace std; int main() { string start, end; cin >> start >> end; string srev = start; reverse(srev.begin(), srev.end()); vector<int> vs[26], vr[26]; int slen = start.length(); for (int i = 0; i < slen; i++) { vs[start[i] - a ].push_back(i); ... |
#include <bits/stdc++.h> #define rep(i, a, b) for (int i = a; i <= b; i++) #define per(i, a, b) for (int i = a; i >= b; i--) using namespace std; typedef unsigned long long ull; typedef pair <int, int> pii; typedef long long ll; template <typename T> inline void read(T &f) { f = 0; T fu = 1;... |
`include "xorGate.v"
module xorGateTest ();
// localize variables
wire [31:0] busADD;
wire [31:0] busA, busB;
// declare an instance of the module
xorGate xorGate (busADD, busA, busB);
// Running the GUI part of simulation
xorGatetester tester (busADD, busA, busB);
// file for gtkwave
initial
begin
$dum... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:16777216 ) using namespace std; const long double pi = acos(-1.0); const long double eps = 1e-6; const int INF = 1E9; const int MAXN = 5111; struct node { pair<int, int> key; int pr, cnt; node *l, *r; node(pair<int, int> _key) { ... |
/*============================================================================
This Verilog source file is part of the Berkeley HardFloat IEEE Floating-Point
Arithmetic Package, Release 1, by John R. Hauser.
Copyright 2019 The Regents of the University of California. All rights
reserved.
Redistribution an... |
/**
* 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 main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long n, i; cin >> n; long long a[n + 1]; for (i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); long long ans = 0, sum = 0; for (i = 0; i < n; i++) { if (sum <= a[... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin>>t; while(t--) { long long int n; cin>>n; long long int sum=0; for(int i=0;i<n;i++) { long long int a; cin>>a; sum+=a; ... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017
// Date : Tue Apr 18 23:15:14 2017
// Host : DESKTOP-I9J3TQJ running 64-bit major re... |
// megafunction wizard: %RAM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: RAMB16_S4_altera.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ===========... |
// ZX-Evo Base Configuration (c) NedoPC 2008,2009,2010,2011,2012,2013,2014
//
// wait generator for Z80
/*
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 ... |
// USED ONLY TO SELECT VC BLOCKED STATUS
// OPTIMISE FOR XY ROUTING
/* autovdoc@
*
* component@ unary_select_pair
* what@ A sort of mux!
* authors@ Robert Mullins
* date@ 5.3.04
* revised@ 5.3.04
* description@
*
* Takes two unary (one-hot) encoded select signals and selects one bit of the input.
*
* Imp... |
/*
* 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> class Solver { public: Solver() = default; void read() { int n; std::cin >> n; int left = 0; int right = 0; for (int i = 0; i < n; ++i) { int x, y; std::cin >> x >> y; if (x < 0) left++; else right++;... |
#include <bits/stdc++.h> template <typename T> bool ckmax(T& a, const T& b) { return b > a ? a = b, 1 : 0; } template <typename T> bool ckmin(T& a, const T& b) { return b < a ? a = b, 1 : 0; } const int MV = 1e5 + 10; const int MM = 1e5 + 10; const int MG = 450; const int INF = 0x3f3f3f3f; ... |
#include <bits/stdc++.h> using namespace std; const int MX = 300000; int n, arr[MX], bit[MX], ans = 0, lis; void update(int x, int V) { while (x <= n) { bit[x] = max(bit[x], V); x += x & -x; } } int get(int x) { int ret = 0; while (x > 0) { ret = max(ret, bit[x]); x -... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.