text
stringlengths
59
71.4k
module FORWARDINGTEST; reg [15:0] one, two; reg one_A, one_B, two_A, two_B; wire [15:0] outA, outB; wire forwarda, forwardb; Forwarding fw (one, two, one_A, one_B, two_A, two_B, forwarda, forwardb, outA, outB); initial begin $dumpfile("ForwadingTest.vcd"); $dumpvars(0, F...
/* * 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 gcd(int x, int y) { if (y == 0) return x; return gcd(y, x % y); } int main() { int n; cin >> n; int ansx = 0, ansy = 0; for (int i = 1; i < n; i++) { int j = n - i; if (j <= i) break; if (gcd(i, j) != 1) continue; ...
/* * The MIT License (MIT) * * Copyright (c) 2015 Stefan Wendler * * 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 us...
#include <bits/stdc++.h> const long long MAX_N = 450 + 100; const long long MOD = 1e9 + 7; using namespace std; int main() { int n, k; cin >> n >> k; cout << 3 * n + min(k - 1, n - k); return 0; }
`default_nettype none `timescale 1ns/1ns `define simulation module tb_ptr(); wire clk, reset; clock clock(clk, reset); reg write = 0; reg [31:0] writedata = 0; reg iobus_iob_poweron = 1; reg iobus_iob_reset = 0; reg iobus_datao_clear = 0; reg iobus_datao_set = 0; reg iobus_cono_clear = 0; reg iobus_cono_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 law...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 18:33:10 02/22/2015 // Design Name: // Module Name: mult_k // Project Name: // Target Devices: // Tool versions: // Description: // // Dependen...
#include <bits/stdc++.h> int main() { int x, y; scanf( %d %d , &x, &y); printf( %d , (x * y - 1) / (y - 1)); }
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: IIT Roorkee // Engineers: Rohith Asrk, Nitin Sethi, Sri Vathsa, Shashwat Kumar // // Create Date: 12:37:36 05/01/2017 // Design Name: main // Module Name: main_test // Project Name: FPGA Implement...
#include <bits/stdc++.h> using namespace std; static inline void canhazfast() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); } template <typename T> T gcd(T a, T b) { return b == 0 ? a : gcd(b, a % b); } template <typename T> T extgcd(T a, T b, T &x, T &y) { ...
/** * 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...
// Accellera Standard V2.5 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2010. All rights reserved. //------------------------------------------------------------------------------ // SHARED CODE //------------------------------------------------------------------------------ // No shared code for ...
`include "../../network_params.h" module np_matrix_mult( input clock, input reset, input [`FFN_IN_BITWIDTH:0] feature_pixel, input [`FFN_IN_BITWIDTH:0] weight, input [`FFN_OUT_BITWIDTH:0] bias, input en, // input [`NUM_MM_BUFFER-1:0] frame_rdy, assume frame is ready //output reg [`NUM_MM_BUFFER-1:0...
`timescale 1ns / 1ps module control_test(); reg power, start, weight_ch, mode_ch, clk; wire [2:0]state, nextstate, weight_ch_light; wire start_pause_light, water_in_light, parameter TIME = 1000, DELAY = 10; controler CONTROLER ( .power(power), .start_pause(start), .wei...
#include <bits/stdc++.h> using namespace std; int a[100000 + 5], nxt[100000 + 5], lst[100000 + 5], fi[100000 + 5]; int cnt, root[100000 + 5]; struct node { int sum, ls, rs; } t[100000 * 43 + 5]; int build(int l, int r) { int id = ++cnt; if (l == r) { t[id].sum = fi[l]; return id; ...
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 7; const int MX = 1e9 + 7; const long long int INF = 1e18 + 9LL; int n, k, r; bool spec[N]; vector<int> G[N]; int id[N]; queue<int> Q; int rep[N]; int tr[N], add[N]; set<pair<int, int> > S[N]; int lvl[N]; int jump[18][N]; in...
//========================================== // Function : Code Gray counter. // Coder : Alex Claros F. // Date : 15/May/2005. //======================================= module GrayCounter #(parameter COUNTER_WIDTH = 4) (output reg [COUNTER_WIDTH-1:0] GrayCount_out, //'Gray' code count output. ...
#include <bits/stdc++.h> using namespace std; vector<int> s[200050 * 4]; pair<int, int> li[200050]; int n, m, st, qu[200050][3], fa[200050], sg[200050]; inline int Read() { int x = 0; char y; bool z = 0; do y = getchar(), z |= y == - ; while (y < 0 || y > 9 ); do x = x * 10 + y - ...
#include <bits/stdc++.h> using namespace std; const double PI{3.1415926535897932384626433832795}; const int MOD{static_cast<int>(1e9 + 7)}; const double EPS{1e-9}; template <typename T> T ModAdd(const T &a, const T &b, const int &mod = MOD) { return ((a) % mod + (a) % mod) % mod; } template <typenam...
#include <bits/stdc++.h> int main() { std::ios_base::sync_with_stdio(false); int n; std::cin >> n; std::vector<std::vector<bool> > g(n, std::vector<bool>(n, 0)); for (int row = 0; row < n; row++) { std::string s; std::cin >> s; for (int col = 0; col < s.size(); col++) { g...
/** * The ps2 protocol is here http://www.computer-engineering.org/ps2protocol/ * * "...you should modify/sample the Data line in the middle of each cell. * I.e. 15 - 25 microseconds after the appropriate clock transition..." */ module ps2clock ( input clk, input i_clock, output o_clock ); ...
#include <bits/stdc++.h> using namespace std; int n, k, i, j, mas[50077], fix[50077], dom, a[50077]; int main() { cin >> n; for (k = 1; k <= n; k++) cin >> a[k]; for (k = 1; k <= n; k++) { dom = a[k]; for (j = 1; j <= n; j++) mas[a[j]] = 0; for (i = k; i <= n; i++) { mas[a[i]...
//Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. //-------------------------------------------------------------------------------- //Tool Version: Vivado v.2014.4 (lin64) Build Tue Nov 18 16:47:07 MST 2014 //Date : Sat Mar 12 20:35:14 2016 //Host : ubuntu-desktop running 64-bit Ubuntu 14.04.4 LTS...
// ==================================================================== // Bashkiria-2M FPGA REPLICA // // Copyright (C) 2010 Dmitry Tselikov // // This core is distributed under modified BSD license. // For complete licensing information see LICENSE.TXT. // ---------------------------...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:16777216 ) using namespace std; struct pt { double x, y, z; }; pt operator+(const pt& a, const pt& b) { pt p = {a.x + b.x, a.y + b.y, a.z + b.z}; return p; } pt operator-(const pt& a, const pt& b) { pt p = {a.x - b.x, a.y - b.y, a.z ...
#include <bits/stdc++.h> using namespace std; int32_t main() { ios::sync_with_stdio(false); cin.tie(0); long long n; cin >> n; vector<long long> a(n), b(n), idxs(n + 1), ans(n, n); multiset<long long> s1, s2; for (long long i = 0; i < n; i++) { cin >> a[i]; idxs[a[i]] = i; ...
// bsg_fifo_1r1w_small_unhardened // *** Renamed from bsg_fifo_1r1w_small *** // // bsg_fifo with 1 read and 1 write, using // 1-write 1-async-read register file implementation. // // used for smaller fifos. // // input handshake protocol (based on ready_THEN_valid_p parameter): // valid-and-ready or // ready-t...
#include <bits/stdc++.h> using namespace std; const int MAXN = 5e5 + 5; struct edge { int next, v; } e[MAXN << 1]; int n, q, root, cnt, head[MAXN], dep[MAXN], anc[MAXN][30]; void addEdge(int x, int y) { e[++cnt].v = y; e[cnt].next = head[x]; head[x] = cnt; } void dfs(int x) { for (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...
#include <bits/stdc++.h> const long long mod = 1e9 + 7; const int N = 1e5 + 20; using namespace std; int main() { int n, s[N], m; s[0] = 0; cin >> n; for (int i = (1); i <= (n); i++) { cin >> m; s[i] = s[i - 1] + m; } cin >> m; for (int i = (1); i <= (m); i++) { int...
#include <bits/stdc++.h> using namespace std; int n, a[100100], a1[100100], a2[100100]; int main() { while (scanf( %d , &n) != -1) { int ans1 = -1, ans2 = -1; for (int i = 0; i < n; i++) scanf( %d , a + i); for (int i = 0; i < n - 1; i++) scanf( %d , a1 + i); for (int i = 0; i < n - 2;...
// // 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...
module io1_sub (/*AUTOARG*/); /*AUTOWIRE*/ // Beginning of automatic wires (for undeclared instantiated-module outputs) wire [w-1:0] pin; // To/From MD31_pad of autoinst_lopaz_srpad.v wire [2*w-1:0] pin_in; // From MD31_pad of autoinst_lopaz_srpad.v, ... wire templated; // To/From MD31_pad of au...
#include <bits/stdc++.h> using namespace std; int d[101][51][201][2] = {0}; bool used[101][51][201][2] = {false}; int n; int sz; string commands; int rec(int cur, int left, int pos, int dir) { if (cur == sz) { d[cur][left][100 + pos][(dir + 1) % 2] = abs(pos); used[cur][left][100 + pos][(d...
#include <bits/stdc++.h> int main() { long long int n, m, i, ans = 0, cish, h, sd = 0, c; int q, j; scanf( %d , &q); int a[10][10] = {{0}, {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}, {2, 4, 6, 8, 0}, {3, 6, 9, 2, 5, 8, 1, 4, 7, 0}, ...
#include <bits/stdc++.h> int n, m; int d[250000]; int h[250000]; int c[250000]; int r[250000]; int diferencias[160000]; int a[401]; bool sirve(int v, int idCamion) { int litros = v; int cantRecargas = r[idCamion]; for (int i = d[idCamion] + 1; i <= h[idCamion]; i++) { if (v < a[i] - a[...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<pair<int, int> > v; for (int i = (int)0; i < (int)(n); i++) { int second = 0; int a; for (int j = (int)0; j < (int)(4); j++) { cin >> a; second += a; } v.push_back(make_pa...
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n, c, l = 0, t, ans = 0; cin >> n >> c; for (int i = 0; i < n; i++) { cin >> t; if (l) { long long x = min(t, c - l); ...
#include <bits/stdc++.h> using namespace std; int n, m, dx, dy; int a[1000001]; int cnt[1000000] = {}; bool vis[1000000] = {}; inline int gcd(int a, int b) { while (b) a %= b, swap(a, b); return a; } int main() { ios_base::sync_with_stdio(false); cin >> n >> m >> dx >> dy; int g = gc...
/* *-------------------------------------------------------------- * This module converts a counter value N into a reset value * for an 8-bit LFSR. The count is initialized by "reset" high * or "start" transition high. When the count is valid, it is * latched into "dp" and the signal "done" is raised to indicat...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL), cout.tie(NULL); int n, t, num, x; long long int ans; cin >> n; vector<int> vect; vect.push_back(0); for (int i = 0; i < n; ++i) { cin >> x; vect.push_back(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...
/* * 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...
/* * 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 MAX_L = 20; const long long MOD = 1e9 + 7; const long long INF = 1e9 + 7; int p = 100000007; template <typename T> void scan(T &x) { x = 0; bool neg = 0; register T c = getchar(); if (c == - ) neg = 1, c = getchar(); while ((c < ...
#include <bits/stdc++.h> inline long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } inline void sub(long long &a, long long b) { a -= b; if (a < 0) a += 1000000007; } inline void add(long long &a, long long b) { a += b; if (a >= 1000000007) a -= 1000000007; } template <...
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize( Ofast,no-stack-protector,unroll-loops,fast-math ) long long comb(long long n, long long r) { if (r < 0 || r > n) return 0; if ((n - r) < r) r = n - r; long long vec = 1; for (long long i = n; i > n - r; --i) { vec = vec * i;...
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n, a[100001], b[100001], flag = 1; cin >> n; vector<int> v(2, 0); for (int i = 0; i < n; i++) cin >> a[i]; for (int j = 0; j < n; j++) cin >> b[j]; for (int i = 0; i < n; i++...
// mkBiasWorker.v // Copyright (c) 2009 Atomic Rules LLC - ALL RIGHTS RESERVED // Verilog module to take the place of mkBiasWorker.v and instance the VHDL biasWorker // The same module interface signature as Verilog... module mkBiasWorker4B( CLK, RST_N, wci_s_req, wci_s_resp, wci_s_SThreadBusy, wci_s_SFl...
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const int maxn = 1e5 + 10; int main() { ios::sync_with_stdio(0), cin.tie(0), cout.tie(0); int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; ++i) cin >> a[i]; int ans = 0; vector<int> b(n); for (i...
`timescale 1 ns / 1 ps `include "opl3_fpga_v1_0_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 S_AXI_MAX_BURST_LENGTH 1 `define S_A...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 12:47:32 11/06/2013 // Design Name: // Module Name: i2s_out // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // //...
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 100; const int mod = 1e9 + 7; mt19937 rng(chrono::high_resolution_clock::now().time_since_epoch().count()); int q, n = 1000000; long long seg[maxn * 4], lazy[maxn * 4]; void build(int id = 1, int l = 1, int r = n) { if (l == r) { ...
#include <bits/stdc++.h> using namespace std; int read() { int x = 0; int f = 1, ch = getchar(); for (; !isdigit(ch) && ch != EOF; ch = getchar()) if (ch == - ) f = -1; for (; isdigit(ch); ch = getchar()) x = (x << 3) + (x << 1) + (ch ^ 0 ); return x * f; } const int N = 500005; 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...
// MBT September 6, 2014 // // This implements the subset of the MURN ring // protocol that is supported by the GF28 chip. // // The protocol was designed by UCSC's Jose Renau // and Rigo Dicochea in 2011. // // Omitted: Power Enable/Disable // // `include "bsg_defines.v" `ifndef FSB_LEGACY `include "bsg_fsb_pkg.v" ...
// -- (c) Copyright 2010 - 2011 Xilinx, Inc. All rights reserved. // -- // -- This file contains confidential and proprietary information // -- of Xilinx, Inc. and is protected under U.S. and // -- international copyright and other intellectual property // -- laws. // -- // -- DISCLAIMER // -- This disclaimer is not 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...
// Library - static, Cell - th33, View - schematic // LAST TIME SAVED: May 23 16:52:47 2014 // NETLIST TIME: May 23 16:53:06 2014 `timescale 1ns / 1ns module th33 ( y, a, b, c ); output y; input a, b, c; specify specparam CDS_LIBNAME = "static"; specparam CDS_CELLNAME = "th33"; specparam CDS_VIEWN...
#include <bits/stdc++.h> using namespace std; struct __timestamper {}; int main() { int n; scanf( %d , &n); vector<int> l(n), r(n); for (int i = 0; i < n; i++) scanf( %d%d , &l[i], &r[i]); double ans = 0; for (int i = 1; i <= 10000; i++) { double prob[3]; prob[0] = 1; pro...
// Library - static, Cell - th33r, View - schematic // LAST TIME SAVED: May 23 16:54:28 2014 // NETLIST TIME: May 23 16:54:34 2014 `timescale 1ns / 1ns module th33r ( y, a, b, c, rsb ); output y; input a, b, c, rsb; specify specparam CDS_LIBNAME = "static"; specparam CDS_CELLNAME = "th33r"; specpa...
#include <bits/stdc++.h> using namespace std; const int maxn = 200000 + 10; long long a[maxn], b[maxn], c[maxn]; int num[64]; int n; int main() { ios::sync_with_stdio(false); cin >> n; for (int i = 0; i < n; i++) cin >> b[i]; for (int i = 0; i < n; i++) cin >> c[i]; long long sum = 0; ...
#include <bits/stdc++.h> using namespace std; const int N = int(2e5) + 9; int main() { int t; cin >> t; while (t--) { string s; cin >> s; int n = s.size(); int m1 = 0, m2 = 0; bool on = false; int n1 = 0, n0 = 0, N1 = 0, N0 = 0; for (int i = 0; i < n; i++) { ...
#include <bits/stdc++.h> using namespace std; long long mod = 1e9 + 7; const int N = 3e5 + 7; long long arr[N]; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); long long n, m, k; cin >> n >> m >> k; long long mn = INT_MAX; for (int i = 0; i < n; i++) { cin >> arr[...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 21:38:32 03/13/2015 // Design Name: // Module Name: serializer // Project Name: // Target Devices: // Tool versions: // Description: // // Depe...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 2016/06/06 19:20:24 // Design Name: // Module Name: Moore_FSM // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // // Rev...
// 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 15:29:01 2017 // Host : GILAMONSTER running 64-bit major release (...
/* -- ============================================================================ -- FILE : bus_arbiter.v -- SYNOPSIS : ƒoƒXƒA[ƒrƒ^ -- ---------------------------------------------------------------------------- -- Revision Date Coding_by Comment -- 1.0.0 2011/06/27 suito V‹Kì¬ -- ===============...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, s, a, b, c, d; cin >> n >> s; d = s; for (int i = 0; i < n; i++) { cin >> a >> b; c = a + b; d = max(c, d); } cout << d; }
/* * 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 n; cin >> n; long long int g = 0; pair<int, int> A[1000], B[1000]; for (int i = 1; i <= n; i++) { cin >> A[i].first >> A[i].second; cin >> B[i].first >> B[i].second; g += (((B[i].first - A[i].first) + 1) * ((B[i].se...
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; long long ar[n]; long long br[n]; for (auto x = 0; x < n; x++) { cin >> ar[x]; br[x] = ar[x]; } sort(br, br + n); long long m; cin >> m; while (m--) { long long pos, k; s...
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,sse3,sse4,popcnt,abm,mmx ) using namespace std; const int MX = 1e9 + 1; const int Imp = -1; const int N = 1e6 + 5; const int M = 1e6 + 5; const long long INF = 1e18 + 1; int n, k; string s; set<char> st; int...
#include <bits/stdc++.h> using namespace std; const double eps = 1e-8; bool check(int n, int l, int v1, int v2, int k, double mid) { double t0 = (l - v2 * mid) / (v1 - v2); if (t0 < -eps) return 0; double tb = mid - t0; if (tb < -eps) return 0; double tback = (v2 - v1) * tb / (v2 + v1) + tb; ...
#include <bits/stdc++.h> using namespace std; typedef pair<int, int> P; const int OO = 1e18; const int md = 1e9 + 7; int X[] = {0, 0, 1, -1}, Y[] = {1, -1, 0, 0}; void fast() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); } int dp[int(1e4 + 4)], t = 0, x, y, z, n, q, g[int(1e4 + 4)]...
#include <bits/stdc++.h> using namespace std; struct Seg { int sa, ea, sb, eb; } p[200005]; int cmp(Seg &a, Seg &b) { if (a.ea != b.ea) return a.ea < b.ea; else return a.sa < b.sa; } int n, mx[4 * 200005], mi[4 * 200005]; void creat(int l, int r, int k) { if (l == r) { mx...
#include <bits/stdc++.h> template <typename T> inline void read(T &x) { x = 0; char c = getchar(); while (!isdigit(c)) c = getchar(); while (isdigit(c)) x = x * 10 + (c ^ 48), c = getchar(); } using namespace std; int t; int pri[4001000], pcnt; bool depri[35001000]; inline void init() { ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; char arr[1001][1001]; long long int used[1001][1001]; long long int ans[1001][1001]; long long int n, m; long long int inf = 1e18; long long int p = 1e9 + 7; long long int phi(long long int n) { long long int result = n; for (long long int i = 2; i *...
#include <bits/stdc++.h> using namespace std; const int N = 100005; int head[N], Next[N], ver[N], tot; inline void add(int u, int v) { ver[++tot] = v, Next[tot] = head[u], head[u] = tot; } int pa[N][25], top[N], son[N], dep[N], ans, n, L; long long sum[N], w[N], S; inline void init(int u) { for ...
////////////////////////////////////////////////////////////////////// //// //// //// can_crc.v //// //// //// //// ...
#include <bits/stdc++.h> using namespace std; bool debug; const int inf = 1e9 + 5; const long long INF = (long long)inf * inf; const int nax = 1e6 + 5; const int D = 2; const long long MM = 1000 * 1000 * 1000; const long long m[5] = {MM + 7, MM + 9, MM + 21, MM + 33, 333333361LL}; char sl[nax]; long...
//----------------------------------------------------------------------------- // The way that we connect things in low-frequency simulation mode. In this // case just pass everything through to the ARM, which can bit-bang this // (because it is so slow). // // Jonathan Westhues, April 2006 //-------------------------...
#include <bits/stdc++.h> int main() { int i, j = 1, x, k = 0; int c, y; int ar[1000]; char str[500]; scanf( %s , str); for (i = 0; str[i] != 0 ; i++) { x = isdigit(str[i]); if (x != 0) { ar[j] = str[i]; j++; k++; } } int pass; for (pass =...
//=========================================================== // UCR's CS179J Nintendo Entertainment System - FPGA Emulator // ---------------------------------------------------------- // _ __ _____ ______ _______ // / \ / / / ___/ / ____/ | ____| // / \ / / / ...
// test_simulation_techmap_buf_test.v module f1_test(input in, output out); assign out = in; endmodule // test_simulation_techmap_inv_test.v module f2_test(input in, output out); assign out = ~in; endmodule // test_simulation_techmap_mux_0_test.v module f3_test(input [1:0] in, input select, output reg out); always ...
/** * 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() { long long i = 1, n; string s[] = { Sheldon , Leonard , Penny , Rajesh , Howard }; cin >> n; if (n <= 5) { cout << s[n - 1]; return 0; } while (((1 << i) - 1) * 5 <= n) i++; i--; i = (1 << i); n -= (i - 1) ...
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using uint = unsigned int; using ull = unsigned long long; using ii = pair<int, int>; using pli = pair<ll, int>; using vi = vector<int>; using vll = vector<ll>; using pll = pair<ll, ll>; using pil = pair<in...
// Copyright 1986-2018 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2018.2 (win64) Build Thu Jun 14 20:03:12 MDT 2018 // Date : Tue Sep 17 19:44:37 2019 // Host : varun-laptop running 64-bit Service Pac...
// megafunction wizard: %RAM: 2-PORT% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: altsyncram // ============================================================ // File Name: IMG_BUFFER.v // Megafunction Name(s): // altsyncram // // Simulation Library Files(s): // altera_mf // =================...
#include <bits/stdc++.h> using namespace std; const int max_n = 1500; const int max_m = 1500; const int inv = numeric_limits<int>::max(); int n, m; char G[max_n][max_m]; int si, sj; int di[max_n][max_m][4]; int dj[max_n][max_m][4]; int asz[max_n][max_m] = {0}; int vsti[max_n][max_m]; int vstj[ma...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 2016/06/06 20:23:23 // Design Name: // Module Name: Mealy_FSM_ROM // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependencies: // //...
#include <bits/stdc++.h> using namespace std; int count(string &s) { int p = 0; for (int i = 0; i < s.length(); i++) { if (s[i] == 1 ) p++; } return p; } int main() { string a, b; cin >> a >> b; int x, y; x = count(a); y = count(b); if (x >= y || (x + 1 == y && x %...
#include <bits/stdc++.h> using namespace std; const long double Eps = 1e-8; char what[27] = A??????HI???M?O????TUVWXY? ; char str[100005]; void input() { scanf( %s , str); } bool good() { int N = strlen(str); for (int i = 0; i < N; i++) { if (str[i] != what[str[N - i - 1] - A ]) return false...
// ------------------------------------------------------------- // // File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\velocityControlHdl\velocityControlHdl_Complex_Multiply.v // Created: 2014-08-25 21:11:09 // // Generated by MATLAB 8.2 and HDL Coder 3.3 // // --------------------------------------------------...
/** * 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 mod = 1e9 + 7; const int N = 1e6 + 5; int n, cnt[3], dp[N], sum = 1; int add(int x, int y) { return (1ll * x + 1ll * y) % mod; } int mul(int x, int y) { return (1ll * x * 1ll * y) % mod; } int del(int x, int y) { return ((1ll * x - 1ll * y) % mod + m...