text
stringlengths
59
71.4k
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2012 by Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 bit a_finished; bit b_finished; module t (/*AUTOARG*/ // Inputs clk ); input clk; wire [31...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
//----------------------------------------------------------------------------- // Copyright (C) 2009 OutputLogic.com // This source file may be used and distributed without restriction // provided that this copyright statement is not removed from the file // and that any derivative work contains the original copyright...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a; for (int i = 0; i < n; i++) { int x; cin >> x; a.push_back(x); } sort(a.begin(), a.end()); int l = 0; int r = n - 1; for (int i = 0; i < n; i++) { if (i % 2) { ...
module Decoder#(parameter DATA_BITS = 8, PARITY_BITS = 4)( DataParity_in_12p, DataParity_valid_12p,reset_b,clk, Data_out_14p, EDACerr1_14p,EDACerr2_14p); // declare the local parameters and signals localparam k = DATA_BITS; localparam r = PARITY_BITS; input wire clk...
`include "constants.vh" /* clear valid when dpen set valid when wrrfen */ `default_nettype none module rrf( input wire clk, input wire reset, input wire [`RRF_SEL-1:0] rs1_1tag, input wire [`RRF_SEL-1:0] rs2_1tag, input wire [`RRF_SEL-1:0] rs1_2tag, input wire [`RRF_S...
#include <bits/stdc++.h> using namespace std; int b[200100]; int l[200100], r[200100]; int main(){ int T; scanf( %d , &T); int tot = T; int num = 0; while (T--){ num++; int N, K, M; scanf( %d%d%d , &N, &K, &M); for (int i = 1; i <= M; i++) scanf( %d...
#include <bits/stdc++.h> using namespace std; int n, m; char arr[55][55]; int dp[55][55][55][55]; int f(int ind, int let, int dig, int sim) { if (ind == n) { if (let && dig && sim) return 0; else return 1e9; } if (dp[ind][let][dig][sim] != -1) return dp[ind][let][dig][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...
//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 : Tue Mar 8 16:35:05 2016 //Host : lubuntu running 64-bit Ubuntu 15.04 //Command ...
// 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 15:55:33 2017 // Host : GILAMONSTER running 64-bit major release (...
#include <bits/stdc++.h> using namespace std; int main() { long long s, x; cin >> s >> x; long long ans = __builtin_popcountll(x); ans = 1LL << ans; if (s == x) ans -= 2; for (int i = 0; i < 60; i++) { if (x & (1LL << i)) s -= 1LL << i; } for (int i = 0; i < 60; i++) { in...
#include <bits/stdc++.h> using namespace std; int main() { double h, l; scanf( %lf %lf , &h, &l); printf( %lf n , (l * l - h * h) / (2 * h * 1.0)); return 0; }
module testmux(); # (parameter WIDTH = 32) ( input wire [2:0] /* synopsys enum cur_info */ sel, input wire [WIDTH-1:0] a, output reg [WIDTH-1:0] out ); endmodule module top_test(); /*AUTOWIRE*/ // Beginning of automatic wires (for undeclared instantiated-module outputs) wire ...
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const int maxn = 1e5 + 15; const int maxm = 1e6 + 15; const int mod = 1e9 + 7; struct Edge { int to, next; } edge[maxm]; int head[maxn], dfn[maxn], bccno[maxn], low[maxn]; int ecnt, cnt, bcnt; void add(int u, int v) { ...
#include <bits/stdc++.h> using namespace std; string to_string(bool b) { return (b ? true : false ); } template <size_t N> string to_string(bitset<N> v) { string res = ; for (size_t i = 0; i < N; i++) { res += static_cast<char>( 0 + v[i]); } return res; } template <typename A> ...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 2016/06/08 21:20:19 // Design Name: // Module Name: timing_signal_generator_tb // Project Name: // Target Devices: // Tool Versions: // Description: // // Dependen...
// Test bench for the restricted 27x27 bit multiplier. (The // restriction is that if the most significant bit of opa is set to // one the three least significant bits of opa must be zero.) This // enables us to design a 27x27 bit multiplier using only two DSP48E1 // multipliers and one LUT based adder outside the DSP...
module ledDriver /*#( parameter NUM_LEDS = 60 )*/(input clk, input reset, output reg led, input data, input lastBit, input start, output finish, output read); //Generate the pulse width modulated output signal //Running at 20MHz, a High pulse of 8 cycles and 17 low cycles produces a 0, //16 cycles of high and 9 l...
#include <bits/stdc++.h> using namespace std; const double Pi = 3.14159265358979323; int main() { ios_base::sync_with_stdio(0); cin.tie(); double x0, y0, v, T, n, x, y, r; vector<tuple<double, double> > c; cin >> x0 >> y0 >> v >> T; T = v * T * 1.0; cin >> n; while (n--) { ci...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
// Copyright (c) 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...
#include <bits/stdc++.h> using namespace std; int times[50] = {0}; int graph[50][50] = {0}; void findMissing(int n, int &temp1, int &temp2) { bool condition = false; for (int i = 0; i < n; i++) { if (times[i] != (n - 1)) { if (condition) temp2 = i; else { temp1 ...
/** * 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 = 1e5 + 4; int a[NMAX]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; int mn = 1e9 + 4; for (int i = 0; i < n; ++i) { cin >> a[i]; mn = min(mn, a[i]); } vector<int> res;...
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016 // Date : Mon Feb 13 12:46:39 2017 // Host : WK117 running 64-bit major release (build ...
/** * 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; mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count()); mt19937 rnf(2106); const int N = 100005; int n, m, k; vector<int> a[N]; vector<int> v[2]; void dfs0(int x, int p, int z) { v[z].push_back(x); for (int i = 0; i < a[x].size(); ++i) {...
#include <bits/stdc++.h> using namespace std; struct segtree { int n; vector<long long> tree; void init(int s) { n = s; tree.resize(4 * s); } long long qry(int i, int j) { return qry(i, j, 1, 0, n - 1); } void upd(int i, long long v) { upd(i, v, 1, 0, n - 1); } long long qry(...
#include <bits/stdc++.h> using namespace std; long long n; bool use[100000 + 10], b[100000 + 10]; int a[100000 + 10], Now; int Ans; int L[100000 + 10], R[100000 + 10], CNT = 0; int main() { int Cnt = 0; scanf( %I64d , &n); for (long long i = 3; i <= n; i += 2) { if (b[i]) continue; ...
`timescale 1ns / 1ps //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 19:52:55 10/29/2013 // Design Name: Clock_Divider // Module Name: C:/Users/Fabian/Documents/GitHub/taller-diseno-digital/Proyecto Final/proyecto-final/clock48_test.v ...
// 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 : Fri Oct 27 10:20:39 2017 // Host : Juice-Laptop running 64-bit major relea...
`timescale 1ns / 1ps module uart_rx #( parameter DBIT = 8, // Number of data bits to receive SB_TICK = 16 // Number of ticks for the stop bit. 16 ticks=1 stop bit, 24=1.5 and 32=2. ) ( input wire clk, input wire reset, input wire data_in, input wire s_tick, output reg rx_done_ti...
#include <bits/stdc++.h> using namespace std; double eps(1e-10); int sign(const double& x) { return (x > eps) - (x + eps < 0); } bool equal(const double& x, const double& y) { return x + eps > y && y + eps > x; } struct Point { double x, y, z; Point() {} Point(const double& x, const double& ...
// 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 Mar 28 05:22:49 2017 // Host : DESKTOP-B1QME94 running 64-bit major releas...
#include <bits/stdc++.h> using namespace std; int n, m, l; int pre[200010], other[200010], last[100010]; int flag[100010]; void connect(int x, int y) { pre[++l] = last[x]; last[x] = l; other[l] = y; } int dfs(int x, int fa) { flag[x] = 1; int cur(0); for (int p = last[x]; p; p = pr...
`include "common.vh" `timescale 1ns/10ps module Reg(input clk, upZ, output signed[31:0] valZ, valX, valY, input[3:0] idxZ, idxX, idxY, input signed[31:0] nextZ, nextP); reg[31:0] store[0:14]; integer k; initial for (k = 0; k < 15; k = k + 1) store[k] = 0; assign valX = &idxX ? nextP : stor...
// $Id: c_interleave.v 5188 2012-08-30 00:31:31Z dub $ /* Copyright (c) 2007-2012, Trustees of The Leland Stanford Junior University All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: Redistributions...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; inline long long getint() { long long _x = 0, _tmp = 1; char _tc = getchar(); while ((_tc < 0 || _tc > 9 ) && _tc != - ) _tc = getchar(); if (_tc == - ) _tc = getchar(), _tmp = -1; while (_tc >= 0 && _tc <= 9 ) _x...
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e5 + 100; const int MAXM = 15; int N, Q, M; int log2(int v) { int r = 1; while (v >>= 1) r++; return r; } int a[MAXN]; int t[2][MAXN]; struct ST { int v[3 * MAXN][2][MAXM]; int l[3 * MAXN], r[3 * MAXN]; bool lz[3 *...
#include <bits/stdc++.h> using namespace std; const int Maxn = 400000 + 10; struct Point { long long x, y; Point operator+(const Point &A) { return (Point){x + A.x, y + A.y}; } Point operator-(const Point &A) { return (Point){x - A.x, y - A.y}; } } P[Maxn]; int n, A[Maxn], cnt; long long sum[Max...
/* * 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; int n; int A[3005][5], dp[3005][3]; int solve(int x, bool a) { int &r = dp[x][a]; if (r != -1) return r; if (x == n) { if (a == 0) { return r = A[x][1]; } else { return r = A[x][2]; } } if (a == 0) { return...
#include <bits/stdc++.h> using namespace std; const int inf = 1000000000; struct sTree { int pl, pr; int val, cnt, debt; } tree[4000009]; int treeSize; int NewNode(int LL, int RR) { int cur = ++treeSize; tree[cur].cnt = RR - LL + 1; return cur; } void CalcDebt(int LL, int RR, int cur...
#include <bits/stdc++.h> using namespace std; const int Mod = 1e9 + 9; int Pow(int x, int e) { int ret = 1; while (e) { if (e & 1) ret = 1ll * ret * x % Mod; x = 1ll * x * x % Mod; e >>= 1; } return ret; } const int N = 1e5 + 10; char S[N]; int main() { int n, a, b, k...
module ITU_656_Decoder( // TV Decoder Input iTD_DATA, // Position Output oTV_X, oTV_Y, oTV_Cont, // YUV 4:2:2 Output oYCbCr, oDVAL, // Control Signals iSwap_CbCr, iSkip, iRST_N, iCLK_27 ); input [7:0] iTD_DATA; input iSwap_CbCr...
#include <bits/stdc++.h> using namespace std; int a[200000], b[200000]; set<pair<int, int>> se; set<pair<int, int>>::iterator t; int main() { int n, m, d; cin >> n >> m >> d; for (int i = 0; i < n; i++) { cin >> a[i]; se.insert(make_pair(a[i], i)); } int cnt = 0, pos; while...
/** * 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; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n, k; cin >> n >> k; long long a[n + 2][n + 2], i, j; string s; memset(a, 0, sizeof(a)); for (i = 1; i <= n; i++) { cin >> s; for (j = 1...
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 500; const int INF = 1e7 + 500; const int MOD = 1e9 + 7; const int LOG = 18; const double EPS = 1e-9; const double PI = 3.1415926535; vector<pair<int, int> > P; long double L = INF, R = -INF, M1, M2; long double dist(long double x0...
// (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...
/** * 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 N = 1010; int h[N], e[2 * N], ne[2 * N], w[2 * N], idx; int dist[N][N]; int n, m, k; bool st[N]; pair<int, int> q[N]; void add(int a, int b, int c) { e[idx] = b; ne[idx] = h[a]; w[idx] = c; h[a] = idx++; } priority_queue<pair<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> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(NULL); int n, m; cin >> n >> m; vector<char> A(n * 2); for (int i = 0; i < n * 2; i++) cin >> A[i]; vector<vector<pair<int, int> > > table(n * 2, vector<pair<int, int> >(20)); for (int i = 0; ...
#include <bits/stdc++.h> using namespace std; int N, Q; vector<vector<int>> V; map<pair<int, int>, int> M; int ret[101010]; template <int um> class UF { public: vector<int> par, rank; vector<vector<int>> hist; UF() { par = rank = vector<int>(um, 0); for (int i = 0; i < um; 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...
/* * 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...
// file: clk25_2_X.v // // (c) Copyright 2008 - 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...
// ============================================================================ // Copyright (c) 2010 // ============================================================================ // // Permission: // // // // Disclaimer: // // This VHDL/Verilog or C/C++ source code is intended as a design reference // which...
#include <bits/stdc++.h> using namespace std; const int INF = 1000000000; const int MAXN = 30005; int lst[MAXN], N; bool ok(vector<int> &v) { if ((int)v.size() <= 2) return true; for (int i = (int)v.size() - 2; i >= max(1, (int)v.size() - 5); i--) if (v[i + 1] - v[i] != v[1] - v[0]) return false...
// Accellera Standard V2.3 Open Verification Library (OVL). // Accellera Copyright (c) 2005-2008. All rights reserved. `ifdef OVL_ASSERT_ON reg first_req; wire xzcheck_enable; always @ (posedge clk) begin if (`OVL_RESET_SIGNAL != 1'b0) begin if((first_req ^ first_req) == 1'b0) begin if (req) ...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, m = 0; cin >> n; while (n--) { int x, y; cin >> x >> y; m = max(m, x + y); } cout << m; return 0; }
`include "constants.vh" `include "alu_ops.vh" //`default_nettype none module exunit_ldst ( input wire clk, input wire reset, input wire [`DATA_LEN-1:0] ex_src1, input wire [`DATA_LEN-1:0] ex_src2, input wire [`ADDR_LEN-1:0] pc, input wire [`DATA_LEN-1:0] imm, input wire dstva...
#include <bits/stdc++.h> using namespace std; long long mod = 1000000007; int clean(vector<pair<int, int> > &I) { for (int i = 0; i < (int)I.size(); i++) { swap(I[i].first, I[i].second); I[i].second *= -1; } sort(begin(I), end(I)); for (int i = 0; i < (int)I.size(); i++) { I[i].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; struct ter { int cx, cy, dir, pt, rem; ter(){}; ter(int _cx, int _cy, int _dir, int _pt, int _rem) : cx(_cx), cy(_cy), dir(_dir), pt(_pt), rem(_rem){}; }; const int dx[] = {0, 1, 1, 1, 0, -1, -1, -1}; const int dy[] = {1, 1, 0, -1, -1, -1, 0, 1...
module ddr2_ctrl_input( sys_rst_n, ddr2_clk, local_init_done, local_ready, local_address, local_read_req, local_write_req, local_wdata, local_be, local_size, local_burstbegin, um2ddr_wrclk, um2ddr_wrreq, um2ddr_data, um2ddr_ready, um2ddr_command_wrreq, um2ddr_command, rd_ddr2_size, rd_ddr2_size_wrreq, read_permit )...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 13:06:08 04/16/207 // Design Name: // Module Name: BinaryExponentiation // Project Name: // Target Devices: // Tool versions: // Description: // // Dependen...
#include <bits/stdc++.h> using namespace std; string start[1791791]; string fin[1791791]; pair<int, int> diffs[1791791]; int is_in(string a, string b) { string s = a + # + b; int n = (int)s.length(); vector<int> pi(n); for (int i = 1; i < n; ++i) { int j = pi[i - 1]; while (j > 0...
#include <bits/stdc++.h> using namespace std; int T, n, s, t; int main() { cin >> T; while (T--) { cin >> n >> s >> t; cout << max(1, max(n - s + 1, n - t + 1)) << endl; } return 0; }
#include <bits/stdc++.h> using namespace std; FILE *in = stdin; class node { public: long long sum[5], hnode; node() { sum[0] = sum[1] = sum[2] = sum[3] = sum[4] = hnode = 0; return; } node(int x) { for (int q = 0; q < 5; q++) { sum[q] = 0; } sum[0] = x; ...
#include <bits/stdc++.h> using namespace std; signed main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); ; long long n; cin >> n; vector<long long> l(n + 5), r(n + 5); for (long long i = 1; i < n + 1; ++i) cin >> l[i]; for (long long i = 1; i < n + 1; ++i) cin >> r[i];...
//////////////////////////////////////////////////////////////////////////////// // Copyright (c) 1995-2013 Xilinx, Inc. All rights reserved. //////////////////////////////////////////////////////////////////////////////// // ____ ____ // / /\/ / // /___/ \ / Vendor: Xilinx // \ \ \/ Version : ...
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1); const double eps = 1e-8; const int maxn = 1e6 + 5; const int maxm = 3e4 + 5; const long long mod = 1e9 + 7; const long long inf = 0x3f3f3f3f; const int _inf = -1e9 + 7; inline int scan() { int m = 0; char c = getchar(); ...
#include <bits/stdc++.h> using namespace std; int a[404040]; inline void solve() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , a + i); int N = 0; for (int i = 1, j = 1; i <= n; i = j) { for (; j <= n && a[i] == a[j]; j++) ; a[++N] = j - i; } int...
// ==================================================================== // 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> using namespace std; int main() { std::ios_base::sync_with_stdio(false); vector<long long int> v; long long int n, i; cin >> n; if (n == 1) { cout << 1; return 0; } for (long long int i = 1; i * i <= n; ++i) { if (n % i == 0) { if (i * i...
#include <bits/stdc++.h> using namespace std; int n; bool f, a[(int)1e6 + 9]; int main() { cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; for (int i = 1; i < (n == 3 ? 2 : (n >> 1)); i++) { if (n % i == 0) { for (int j = 0; j < i; j++) { if (!a[j]) continue; int...
// ============================================================================= // COPYRIGHT NOTICE // Copyright 2006 (c) Lattice Semiconductor Corporation // ALL RIGHTS RESERVED // This confidential and proprietary software may be used only as authorised by // a licensing agreement from Latt...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed into the Public Domain, for any use, // without warranty, 2012 by Wilson Snyder. // bug511 module t (/*AUTOARG*/ // Inputs clk ); input clk; wire [7:0] au; wire [7:0] as; Test1 test1 (.au); Test2 test2 (.as); //...
/* * PicoSoC - A simple example SoC using PicoRV32 * * Copyright (C) 2017 Clifford Wolf <> * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies...
/* * Milkymist SoC * Copyright (C) 2007, 2008, 2009, 2010 Sebastien Bourdeauducq * adjusted to FML 8x16 by Zeus Gomez Marmolejo <> * updated to include Direct Cache Bus by Charley Picker <> * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public Lic...
module spiral_0( i_data, o_data_36, o_data_83 ); // ******************************************** // // INPUT / OUTPUT DECLARATION // ...
#include <bits/stdc++.h> using namespace std; int n, maxx; vector<int> v, cnt; map<int, int> ma; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; maxx = min(2, n); v.resize(n + 1); cnt.resize(100001); for (int i = 1; i <= n; i++) { cin >> v[i]; ...
#include <bits/stdc++.h> using namespace std; int n; int arr[1005]; int res[1005]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i = 0; i < n; ++i) cin >> arr[i]; sort(arr, arr + n); int ini = 0, fin = n - 1, idx = 0; while (ini <= fin) { res[idx] ...
// ------------------------------------------------------------- // // Generated Architecture Declaration for rtl of avfb_chip_tb // // Generated // by: wig // on: Tue Apr 18 07:50:26 2006 // cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -nodelta ../../bugver.xls // // !!! Do not edit this file! Autogenerated by MIX ...
/* Copyright (c) 2021 Alex Forencich Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute,...
// ========== Copyright Header Begin ========================================== // // OpenSPARC T1 Processor File: scdata_rep.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/or...
/* ---------------------------------------------------------------------------------- Copyright (c) 2013-2014 Embedded and Network Computing Lab. Open SSD Project Hanyang University All rights reserved. ---------------------------------------------------------------------------------- Redistribution and use ...
/** * This is written by Zhiyang Ong * and Andrew Mattheisen */ `timescale 1ns/100ps /** * `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 time bas...
/** * 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; int n, k, op; string tes; int main() { cin >> n >> k >> ws >> tes; op = 0; for (int i = 1; i < n; i++) if (tes.substr(0, i) == tes.substr(n - i, i)) op = i; cout << tes; tes = tes.substr(op, tes.length()); for (int i = 1; i < k; i++) co...
#include <bits/stdc++.h> using namespace std; using DO = double; using LL = long long; using VI = vector<LL>; const int N = 5e5 + 10; int head[N], nxt[N << 1], to[N << 1]; LL wei[N << 1]; int E; void init(int n) { for (int i = 1; i <= n; i++) { head[i] = -1; } E = 0; } void add(i...
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cout << name << : << arg1 << n ; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, , ); ...