text
stringlengths
59
71.4k
/* * 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 maxn = 200050; int len; char a[maxn]; int main() { while (scanf( %d , &len) != EOF) { scanf( %s , a); int ans = 0; for (int i = 0; i < len; i++) if (a[i] == < ) ans++; else break; for (int ...
#include <bits/stdc++.h> using namespace std; int main() { int i, j, k, n, m, t, l; cin >> t; while (t--) { string s, p, q = abacaba , r; cin >> n >> s; int cnt = 0, cntt = 0; p = s; r = s; for (i = 0; i < n; i++) { int c = 0; for (j = i, k = 0; j < 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; template <class T> inline T checkmin(T &a, T b) { return (a < b) ? a : a = b; } template <class T> inline T checkmax(T &a, T b) { return (a > b) ? a : a = b; } template <class T> T GCD(T a, T b) { if (a < 0) return GCD(-a, b); if (b < 0) re...
#include <bits/stdc++.h> using namespace std; int n, k; vector<bitset<7>> score; vector<bitset<7>> bvec(10); map<unsigned long, int> bmap; bool flag = false; long long ans = 0; vector<string> anss; int ccc = 0; int ans_tab[2001][10][2001]; bool valid(vector<bitset<7>>& s, int cur, int dig, int 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 la...
#include <bits/stdc++.h> using namespace std; const long long INF = 1e9, MOD = INF + 7; long long gcd(long long a, long long b) { return (b ? gcd(b, a % b) : a); } long long power(long long a, long long b) { return (!b ? 1 : power(a, b / 2) * power(a, b / 2) * (b % 2 ? a : 1)); } long long mod(long long...
/** * 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 la...
// *************************************************************************** // *************************************************************************** // Copyright 2013(c) Analog Devices, Inc. // Author: Lars-Peter Clausen <> // // All rights reserved. // // Redistribution and use in source and binary forms, ...
#include <bits/stdc++.h> using namespace std; void ex() { cout << NO n ; exit(0); } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vector<pair<bool, int> > q(2 * n); for (int i = 0; i < 2 * n; ++i) { char t; cin >> t; if (t ==...
#include <bits/stdc++.h> using namespace std; map<char, int> m; char letters[30]; int numbers[30]; int mystring[30]; int ceiling(int top, int bottom) { return (top + bottom - 1) / bottom; } int main() { string s; int n; cin >> s >> n; for (int i = 0; i < (int)s.length(); i++) m[s[i]]++; ...
#include <bits/stdc++.h> using namespace std; using ll = long long; class flow { private: int n; vector<int> head, d, cur; vector<tuple<int, ll, int>> edge; bool bfs(int s, int t) { d.assign(n, -1); queue<int> que; que.push(s); d[s] = 0; while (!que.empty()) { ...
/* * 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 MX = (int)1e6 + 17; const int MOD = (int)1e9 + 7; const long long oo = (long long)1e18 + 7; const int INF = (int)999999999; const int N = (int)1e5 + 17; const int di[4] = {-1, 0, 1, 0}; const int dj[4] = {0, 1, 0, -1}; inline long long IN() { ...
`timescale 1ns / 1ps module Pruebas_Controlador_Gato; // Inputs reg clk; reg reset_all; reg reset_game; reg boton_arriba_reg; reg boton_abajo_reg; reg boton_izq_reg; reg boton_der_reg; reg boton_elige_reg; // Outputs wire [3:0] cuadro; wire [3:0] circulo; wire [3:0] equis; wire [1:0...
#include <bits/stdc++.h> using namespace std; const int MAXN = 5000 + 10, MOD = 1000000007; vector<pair<int, int> > lis[MAXN * 2]; pair<int, int> p[MAXN]; int n, f[MAXN], cnt; bool b[MAXN]; int dis(const pair<int, int> &a, const pair<int, int> &b) { return abs(a.first - b.first) + abs(a.second - b.sec...
#include <bits/stdc++.h> using namespace std; long long read() { char x = getchar(); long long ans = 0, flag = 1; while (!isdigit(x)) if (x == - ) flag = -1, x = getchar(); else x = getchar(); while (isdigit(x)) ans = ans * 10 + x - 0 , x = getchar(); return ans * f...
#include <bits/stdc++.h> using namespace std; template <typename T> ostream &operator<<(ostream &out, const vector<T> &v) { out << { ; for (const T &a : v) out << a << , ; out << } ; return out; } template <typename S, typename T> ostream &operator<<(ostream &out, const pair<S, T> &p) { ...
#include <bits/stdc++.h> #pragma warning(disable : 4996) using namespace std; namespace Xrocks {} using namespace Xrocks; namespace Xrocks { class in { } user_input; class out { } output; in& operator>>(in& X, int& Y) { scanf( %d , &Y); return X; } in& operator>>(in& X, char* Y) { sc...
#include <bits/stdc++.h> using namespace std; const int N = (int)1e6 + 7; const int MOD = (int)1e9 + 7; const long long INF = (long long)1e18 + 7; vector<vector<long long>> a; long long col[N], row[N], trow[N], tcol[N]; long long res; int m, n; long long getrow() { long long ma = trow[1]; long...
/* Teak synthesiser for the Balsa language Copyright (C) 2007-2010 The University of Manchester 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 opti...
#include <bits/stdc++.h> using namespace std; const int inf = 2000000000; static inline int Rint() { struct X { int dig[256]; X() { for (int i = 0 ; i <= 9 ; ++i) dig[i] = 1; dig[ - ] = 1; } }; static X fuck; int s = 1, v = 0, c; for (; !fuck.dig[c = getchar...
#include <bits/stdc++.h> using namespace std; const int mx = 1e5 + 10; long long len, ans, val[26], s[mx]; char str[mx]; map<pair<long long, char>, long long> dp; int main() { for (int i = 0; i < 26; i++) scanf( %I64d , &val[i]); scanf( %s , str); len = strlen(str); s[0] = val[str[0] - 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 la...
#include <bits/stdc++.h> using namespace std; using i64 = long long; const int N = 2e5 + 5; struct Nod { i64 sum; int max_pos, max_pos2; }; Nod pom[N * 4]; int v[N]; int n, q, update_pos, update_val, current_pos; i64 query_sum, peak_sum; static void pom_build(int nod, int l, int r) { if ...
/** * 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 2008 - 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 /...
// 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...
// megafunction wizard: %FIFO% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: dcfifo // ============================================================ // File Name: fifo_301x128.v // Megafunction Name(s): // dcfifo // // Simulation Library Files(s): // altera_mf // ==============================...
// (C) 2001-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 doc...
#include <bits/stdc++.h> using namespace std; vector<string> v; string s; int n; int main() { cin >> n >> s; v.push_back(s); for (int i = 0; i < n; i++) { string s1 = s; if (s[i] != 0) { int kl = 10 - (s[i] - 48); for (int j = 0; j < n; j++) { int zn = s[j] - ...
#include <bits/stdc++.h> using namespace std; const int N = 1e4 + 1, M = 1e9 + 7; int n, dp[N][1 << 3][2]; char s[3][N]; int calc(int r, int msk, bool f) { if (r == n) return f; int &res = dp[r][msk][f]; if (res != -1) return res; int nmsk = msk; for (int i = 0; i < 3; ++i) if (s[i][...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); map<string, long long> m; long long n; cin >> n; for (long long i = 0; i < n; i++) { long long x; string y; cin >> x >> y; sort(y.begin(), y...
#include <bits/stdc++.h> using namespace std; namespace input { const int InputBufferSize = (1 << 24) + 5; char buffer[InputBufferSize], *s, *eof; inline void init() { assert(stdin != NULL); s = buffer; eof = s + fread(buffer, 1, InputBufferSize, stdin); } inline bool read(int& x) { x = 0;...
#include <bits/stdc++.h> using namespace std; using ll = long long; const int NAX = 2e5 + 5, MOD = 1000000007; struct Solution { Solution() {} void solveCase() { set<string> ss; for (size_t i = 0; i <= 100; i += 4) { auto I = to_string(i); ss.insert(I); if (i < 10) { ...
// 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 25 20:55:11 2017 // Host : GILAMONSTER running 64-bit major release (...
`include "mio_regmap.vh" module mio_if (/*AUTOARG*/ // Outputs access_out, packet_out, wait_out, rx_wait_out, tx_access_out, tx_packet_out, // Inputs clk, nreset, amode, emode, lsbfirst, datasize, ctrlmode, dstaddr, wait_in, access_in, packet_in, rx_access_in, rx_packet_in, tx_wait_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...
// HeaderTrailer.v // // Author Beat Meier PSI // Date Nov 10 2014 // module HeaderTrailer ( input Sdat, input CLK, input Trailer_OLD_NEW_0_1, output reg TBM_HEADER, output reg ROC_HEADER, output reg TBM_TRAILER, output reg gate, output sdo ); reg start; reg [4:0]delay; wire veto = delay != 0; re...
/* -- ============================================================================ -- FILE NAME : timer.v -- DESCRIPTION : ƒ^ƒCƒ} -- ---------------------------------------------------------------------------- -- Revision Date Coding_by Comment -- 1.0.0 2011/06/27 suito V‹Kì¬ -- ====================...
#include <bits/stdc++.h> using namespace std; int64_t read() { bool b = 0; int64_t n = 0; char c = getchar(); for (; !(( 0 ) <= (c) && (c) <= ( 9 )); c = getchar()) b = (c == - ); for (; (( 0 ) <= (c) && (c) <= ( 9 )); c = getchar()) n = 10 * n + (c - 0 ); if (b) n = -n; return n; } ...
// (C) 2001-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 simulation // files), and any associated doc...
#include <bits/stdc++.h> using namespace std; int const maxn = 100 * 1000 + 5; int a[maxn]; int b[maxn]; int main() { int t; cin >> t; int n, f1, fm1; for (int i = 0; i < t; i++) { f1 = maxn; fm1 = maxn; cin >> n; for (int j = 0; j < n; j++) { cin >> a[j]; ...
#include <bits/stdc++.h> using namespace std; queue<int> q1, q2, q3, q4, q5, q6; int main() { int n, x, ans = 0; scanf( %d , &n); for (int i = 1; i <= n; i++) { scanf( %d , &x); if (x == 4) q1.push(i); else if (x == 8) q2.push(i); else if (x == 15) q3.pu...
// (C) 2001-2016 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 any of the foregoing (including device programming or simulation // files), and any associated docum...
// file: clk_wiz_0.v // // (c) Copyright 2008 - 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 ...
// Bus selector/mux // select between two buses // depending on which input port // was last active // To be used after an arbitrer module selector_r1_2ph (/*AUTOARG*/ // Outputs dataout, // Inputs r1, a1, r2, a2, datain1, datain2, rstn ); parameter WIDTH = 8; input r1; input a1; input r...
`timescale 1ns / 1ps // // PDP-11 datapath. // module datapath ( input wire clk, // External clock signal input wire reset // External active high reset signal ); // Control. wire [2:0] ctl_reg_src, ctl_reg_dst; // src/dst reg numbers wire [1:0] ctl_alu_input; // alu source ...
#include <bits/stdc++.h> using namespace std; long long gcd(long long x, long long y) { if (y == 0) return x; return gcd(y, x % y); } long long lcm(long long a, long long b) { return a / gcd(a, b) * b; } void XsliferX() { ios::sync_with_stdio(0); ios_base::sync_with_stdio(0); cin.tie(0), c...
/** * 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 1986-2014 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2014.2 (win64) Build 932637 Wed Jun 11 13:33:10 MDT 2014 // Date : Mon Nov 03 20:56:59 2014 // Host : ECE-411-6 running 64-bit Service Pack...
/** * 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 nmax = 110; char s[nmax]; bool pal(int n) { int i; for (i = 0; i <= (n - 1) / 2; i++) if (abs(s[i] - s[n - i - 1]) > 2 || abs(s[i] - s[n - i - 1]) == 1) return 0; return 1; } int main() { int t, n, i; cin >> t; for (i = 1;...
#include <bits/stdc++.h> using namespace std; using ll = long long; const int MAXN = 23; int parseInt() { int d; scanf( %d , &d); ; return d; } int n; int a[MAXN], b[MAXN]; vector<pair<int, int> > v; map<int, int> rang; int main() { cin >> n; for (int i = 0; i < n; ++i) { ...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; int T, n; long long W; pair<long long, int> w[N]; int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); for (cin >> T; T--;) { vector<int> id; cin >> n >> W; long long x = W; for (int i = 1; i <= n...
#include <bits/stdc++.h> using namespace std; bool ps[1111111]; const int mod = 1e9 + 7; int main() { int p, k, c = 0; long long ans = 1; scanf( %d%d , &p, &k); for (int i = 0; i < p; ++i) { if (ps[i]) continue; c++; long long b = i; while (!ps[b]) ps[b] = 1, b = (b * k) ...
#include <bits/stdc++.h> using namespace std; const int maxn = 1E3 + 5; int n; struct line { int x, y, w, num; line(int a = 0, int b = 0, int c = 0, int d = 0) : x(a), y(b), w(c), num(d) {} bool operator<(const line& A) const { return w > A.w; } } a[maxn], b[maxn]; vector<line> ans; inline boo...
`timescale 1 ns / 1 ps module axis_ram_writer # ( parameter integer ADDR_WIDTH = 20, parameter integer AXI_ID_WIDTH = 6, parameter integer AXI_ADDR_WIDTH = 32, parameter integer AXI_DATA_WIDTH = 64, parameter integer AXIS_TDATA_WIDTH = 64 ) ( // System signals input wire aclk, ...
/** * 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 INF = 1E18; const int MAXN = 2000; int l[MAXN]; int r[MAXN]; int a[MAXN]; long long dp[MAXN]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, k; cin >> n >> k; bool poss = true; long long extra = 0...
// Accellera Standard V2.3 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2008. All rights reserved. `include "std_ovl_defines.h" `module ovl_arbiter (clock, reset, enable, reqs, priorities, gnts, fire); parameter severity_level = `OVL_SEVERITY_DEFAULT; parameter width = 2; ...
#include <bits/stdc++.h> using namespace std; template <class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; } template <class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; } template <typename 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 la...
/** * This is written by Zhiyang Ong * and Andrew Mattheisen * * */ `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 unit must be 1 10 or 100 * -base is the ti...
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 7; const long long INFL = 1e18 + 123; const double PI = atan2(0, -1); mt19937 tw(960172); long long rnd(long long x, long long y) { static uniform_int_distribution<long long> d; return d(tw) % (y - x + 1) + x; } bool check(strin...
/* * Copyright (c) 2002 Michael Ruff (mruff @chiaro.com) * * 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 you...
#include<iostream> #include<cstdio> #include<unordered_map> using namespace std; const int N=105; const int MOD=1000000007; int n,q; int c[N]; int b[N]; int sb[N],sc[N]; int l,r; int solve(int x) { static int f[N][N*N],g[N][N*N]; f[0][0]=g[0][0]=1; for(int i=1;i<=n;i++) {...
#include <bits/stdc++.h> using namespace std; int p[100001], w[100001]; vector<pair<int, int>> e[100001]; long long ans[100001], sum; int root(int x) { while (x != p[x]) x = p[x] = p[p[x]]; return x; } void pre(int x, int from) { sum += w[x]; for (auto c : e[x]) if (c.first != from) ...
/* Ragul's FPGA Experiments 2020 * Tested with the EG4S20BG256 FPGA * Learning to generate VGA signalz * * http://tinyvga.com/vga-timing/640x480@60Hz * https://www.youtube.com/watch?v=4enWoVHCykI * https://www.fpga4fun.com/PongGame.html * * ATTRIBUTE IF YOU END UP USING ANY OF MY WORK */ module top( ...
/* * 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> #pragma GCC optimize( Ofast,unroll-loops,no-stack-protector,unsafe-math-optimizations ) #pragma GCC target( avx ) inline int read_char() { static char buf[1 << 16], *ptr = buf, *end_ptr = buf; if (ptr == end_ptr) { int len = fread(buf, 1, sizeof(buf), stdin); i...
module top; reg [31:0] in1, in2; reg [4:0] addr3; reg [31:0] data3; reg chksignal; reg [31:0] in, address; wire [5:0] opcode, funct; wire [31:0] pc, inst; wire [4:0] rs, rt, rd; wire [15:0] addr; wire [31:0] result, Rs, Rt, out, extendaddr, newpc; clkGen CLK(clk); PC pc1(pc,in,clk); instMem IM(inst,pc,...
/** * 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...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 01:36:03 09/06/2013 // Design Name: // Module Name: counter // 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...
/** * 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 int a[100005]; int main() { long long int n, b, k; cin >> k >> b >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } long long int ans = 0; if (b == 0) { for (int i = 0; i < n;) { long long int now = a[i]; l...
// *************************************************************************** // *************************************************************************** // Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved. // // In this HDL repository, there are many different and unique modules, consisting // of...
#include <bits/stdc++.h> long long p = 1e9 + 7, x; using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> x; while (cin >> x) cout << ((((x + 4) / 4) % p) * (((x + 6) / 4) % p)) % p << n ; }
#include <bits/stdc++.h> using namespace std; const int maxn = 100005; int n, len, ct; int a[maxn], tot[maxn], cur[maxn]; long long ans; void solve() { for (int i = 1; i <= n; i++) tot[i] = cur[i] = 0; for (int i = 1; i <= n; i++) tot[a[i]]++; int r = 1; for (int i = 1; i <= (n - 1) / 2; i++...
`timescale 1ns / 1ps // nexys3MIPSSoC is a MIPS implementation originated from COAD projects // Copyright (C) 2014 @Wenri, @dtopn, @Speed // // 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, ...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5; int m; int num[MAXN + 10]; int tree[4 * MAXN + 10]; int prop[4 * MAXN + 10]; void upd(int cn, int b, int e, int l, int r, int x, int p = 0) { if (l <= b && e <= r) { tree[cn] += x + p; prop[cn] += x + p; return; ...
/** * 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...
`timescale 1ns/1ps module tb; `include "useful_tasks.v" // some helper tasks reg rst_async_n; // asynchronous reset reg cm0_a; reg cm0_b; reg mut0_r1; reg mut0_r2; cmuller U_CM0(.z(cm0_z), .a(cm0_a), .b(cm0_b), .rstn(rst_async_) ); ...
/** * 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 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; int main() { int p1, p2, p3, p4, a, b; cin >> p1 >> p2 >> p3 >> p4 >> a >> b; int m = min(min(min(p1, p2), p3), p4); cout << max(0, min(b + 1, m) - a) << endl; return 0; }
#include <bits/stdc++.h> using namespace std; template <typename T> int size(T& a) { return (int)a.size(); } template <typename T> T sqr(T a) { return a * a; } int offset; int f[1000000 * 4 + 10]; int start[27]; int getmask(int l, int r) { int res = 0; for (l += offset, r += offset...
#include <bits/stdc++.h> using namespace std; const int mod = 998244353, maxn = 1e6, MAXN = 1 << 21; int jc[2222222], injc[2222222], n, a, b, s[2222222], t[2222222], l, r, pw[2222222], sz, rev[2222222], cnt; int S[2222222], T[2222222], G[2222222], w[2][2222222], cur, gg[2222222]; long long c[2222222]; ...
#include <bits/stdc++.h> using namespace std; struct segtree { int size = 1; vector<pair<int, int>> v; vector<pair<int, int>> lazy; void init(int n) { while (n > size) { size *= 2; } v.assign(size * 2, {0, -1}); lazy.assign(size * 2, {0, -1}); } void prop(int ...
// // K580VI53 timer implementation // // Copyright (c) 2016 Sorgelig // // // This source file 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) an...
`define bsg_mem_3r1w_sync_macro(words,bits) \ if (els_p == words && width_p == bits) \ begin: macro \ hard_mem_1r1w_d``words``_w``bits``_wrapper \ mem0 \ (.clk_i ( clk_i ) \ ,.r...
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; char s[200000], c[200000]; cin >> s; int x = k / 2, r = k / 2; if (k == n) { cout << s; return 0; } for (int i = 0, j = 0; i < n; ++i) { if (s[i] == ( ) { if (x > 0) c[j++] ...
/////////////////////////////////////////////////////////////////////////////// // // Module: cpci_clock_checker.v // Project: UNET (NF2 User Network FPGA) // Description: // Checks that the core clock and PCI clock are // operating at about the right frequencies. // We ha...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; vector<bool> hero(n); vector<long long> v(n); vector<int> pos_num(n); for (int i = 0; i < m; i++) { int s, h; cin >> s >> h; hero[--s] = 1; ...
module primogen_bench; reg clk = 0; wire rst; reg go = 0; reg [31:0] clk_count = 0; reg [31:0] res_count = 0; reg overflow = 0; wire [15:0] gen_res; wire gen_ready; wire gen_error; por pos_inst( .clk(clk), .rst(rst)); primogen gen( .clk(clk), .go(go), .rst(rst), .res(gen_res), .ready(gen_ready), .e...
/* * 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...