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, 2010 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
`define STRINGIFY(x) `"x`"
module t (/*AUTOARG*/
// Outputs
out,
// Inputs
in
);
input... |
/*
* 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 Header Begin ==========================================
//
// OpenSPARC T1 Processor File: ccx2mb.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
// ... |
#include <bits/stdc++.h> #pragma comment(linker, /stack:100000000 ) using namespace std; const int N = 155; const int INF = 1000000000; struct Edge { int to, flow, cap, cost; Edge() {} Edge(int to, int flow, int cap, int cost) : to(to), flow(flow), cap(cap), cost(cost) {} }; vector<Ed... |
// --------------------------------------------------------------------
// Copyright (c) 2010 by Terasic Technologies Inc.
// --------------------------------------------------------------------
//
// Permission:
//
// Terasic grants permission to use and modify this code for use
// in synthesis for all Ter... |
#include <bits/stdc++.h> using namespace std; vector<int> d; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, u; cin >> n >> u; d.resize(n); for (int i = 0; i < n; i++) { cin >> d[i]; } double ans = -1.0; for (int k = 2; k < n; k++) { ... |
/* -------------------------------------------------------------------------------
* (C)2012 Korotkyi Ievgen
* National Technical University of Ukraine "Kiev Polytechnic Institute"
* -------------------------------------------------------------------------------
*
* Uniform random traffic testbench
*
* Instanti... |
/*
* Milkymist VJ SoC
* Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* This program is distributed ... |
/*
This code was adapted from
http://danstrother.com/2010/09/11/inferring-rams-in-fpgas/
*/
//A parameterized inverable, dual-clock block ram
`timescale 1ns/1ps
module dpb #(
parameter DATA_WIDTH = 32,
parameter ADDR_WIDTH = 10,
parameter MEM_FILE = "NOTHING",
parameter MEM_FILE_LENGTH = 0,
parameter... |
#include <bits/stdc++.h> using namespace std; vector<int> tree[500001]; bool intree[500001]; vector<int> tmp(0); bool isleaf(int node) { if (tree[node].size() == 1 && intree[(tree[node])[0]]) return true; return false; } void DFS(int lvl, int node) { intree[node] = true; if (isleaf(node)) ... |
/**
* 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 2018 Nuclei System Technology, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except 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... |
#include <bits/stdc++.h> using namespace std; int pot(int n) { if (n == (n & -n)) return n; return (n - (n & -n)); } int main() { int n, b, p; cin >> n >> b >> p; int ans1 = 0, ans2 = p * n; while (n != 1) { int d = pot(n); int e = n - d; n -= (d / 2); ans1 += (d ... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.3 (win64) Build Mon Oct 10 19:07:27 MDT 2016
// Date : Thu Sep 28 11:48:22 2017
// Host : vldmr-PC running 64-bit Service Pack 1 ... |
module ARM(input clk,input reset,input [31:0] inst,input [31:0]ReadData,output [31:0] DataAdr ,
output [31:0] WriteData,
output Write_Enable,output reg [31:0] PC);
wire[3:0] ALUFlags;
wire PCSrc,MemtoReg,MemWrite;
wire [1:0]ALUControl;
wire ALUSrc;
wire [1:0]ImmSrc;
wi... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr); int t; cin >> t; while (t--) { int n; cin >> n; for (int pw = 2; pw < 30; ++pw) { int val = (1 << pw) - 1; if (n % val == 0) { cout... |
#include <bits/stdc++.h> using namespace std; uint64_t rnd_data = 0xDEADBEEFDULL; inline void my_srand(int seed) { rnd_data = ((uint64_t)seed << 16) | 0x330E; } inline int my_rand() { rnd_data = rnd_data * 0x5DEECE66DULL + 0xB; return (rnd_data >> 17) & 0x7FFFFFFF; } template <typename T> void my_... |
`include "register_file.v"
module test;
reg clk_reg = 1'b0;
wire clk;
assign clk = clk_reg;
always #5 clk_reg <= ~clk_reg;
reg write = 1'b0;
wire[31:0] r_out[1:0];
wire[4:0] r_ctrl[1:0];
reg[4:0] r_ctrl_reg[1:0];
assign r_ctrl[0] = r_ctrl_reg[0];
assign r_ctrl[1] = r_ctrl... |
// DESCRIPTION: Verilator: Verilog Test module
//
// A test of the +1364-1995ext+ and +systemverilogext+ flags.
//
// This source code contains constructs that are valid in SystemVerilog 2009
// but not in Verilog 1995. So it should fail if we set the language to be
// Verilog 1995, but not SystemVerilog 2009.
//
// Co... |
// STD 10-30-16
//
// Synchronous 1-port ram with byte masking
// Only one read or one write may be done per cycle.
//
module bsg_mem_1rw_sync_mask_write_byte
#(parameter `BSG_INV_PARAM(els_p )
,parameter `BSG_INV_PARAM(data_width_p )
,parameter addr_width_lp = `BSG_SAFE_CLOG2(els_p)
,parameter write_mask_width... |
#include <bits/stdc++.h> using namespace std; vector<string> split(const string& s, char c) { vector<string> v; stringstream ss(s); string x; while (getline(ss, x, c)) v.push_back(move(x)); return move(v); } void err(vector<string>::iterator it) {} template <typename T, typename... Args> ... |
#include <bits/stdc++.h> using namespace std; long long a[100005][2]; int dp[100005][3]; enum direction { n, l, r, }; int main() { int N; cin >> N; for (size_t i = 1; i <= N; i++) { cin >> a[i][0] >> a[i][1]; dp[i][n] = dp[i][l] = dp[i][r] = 0; } a[0][0] = -1e18; ... |
#include <bits/stdc++.h> int dp[2][1005]; int main() { char start[2 * 1005], end[1005]; int i, j, k, K; while (scanf( %s %s %d , start, end, &K) != EOF) { memset(dp, 0, sizeof(dp)); int n = strlen(start); for (i = n; i < 2 * n; i++) start[i] = start[i - n]; dp[0][0] = 1; in... |
#include <bits/stdc++.h> using namespace std; const int M = 2e6 + 2e5; const int N = M >> 1; const int MX = 2e6; const int D = 1e6; double L[M], R[M]; int g[M]; struct pnt { int x, y; void input() { scanf( %d %d , &x, &y); } } p[N]; int n; double ans; int main() { scanf( %d , &n); ... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; long long f[5020][5020], a[5020], powk[5020], ans, ans2, invn; int n, k; inline long long power(long long x, long long y) { long long res = 1; while (y) { if (y & 1) res = res * x % mod; x = x * x % mod; y >... |
//---------------------------------------------------------------------//
// Name: addrgen.v
// Author: Chris Wynnyk
// Date: 2/3/2008
// Purpose: Generates addresses.
//---------------------------------------------------------------------//
module addrgen(
clk,
nrst,
start,
n,
wraddr,
wren,
... |
#include <bits/stdc++.h> using namespace std; const int size = 110000, mod = 1000000007, inf = 0x3f3f3f3f; const double pi = acos(-1.0); int month[13] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; int nex[2][4] = {0, 1, 0, -1, 1, 0, -1, 0}; long long cal(long long a, int n) { long long s = 1 % ... |
#include <bits/stdc++.h> 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 *= 10, _x += (_tc - 0 ), _t... |
#include <bits/stdc++.h> using namespace std; const int MOD = (int)1e9 + 7; const int FFTMOD = 119 << 23 | 1; const int INF = (int)1e9 + 23111992; const long long LINF = (long long)1e18 + 23111992; const long double PI = acos((long double)-1); const long double EPS = 1e-9; inline long long gcd(long long... |
/*
ORSoC GFX accelerator core
Copyright 2012, ORSoC, Per Lenander, Anton Fosselius.
INTERPOLATION MODULE - DIVIDER
This file is part of orgfx.
orgfx is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, ei... |
#include <bits/stdc++.h> using namespace std; long long ans1, ans2; int n; char s[111111]; long long a[111111], pa[111111], b[111111], pb[111111]; inline long long get(long long x, int first) { long long t = first, ans = 0; while (t <= x) { ans += (x + 1 - t); t += 2; } return an... |
#include <bits/stdc++.h> #pragma GCC optimize( O2 ) #pragma GCC optimize( Ofast ) #pragma GCC optimize( O3 ) using namespace std; const int N = 1e6 + 5; int n, p = 1, pa[N]; int ch[N][26]; vector<int> cnt[N][2]; vector<pair<int, int> > as; long long ans; inline void dfs(int u, int dep) { for (... |
#include <bits/stdc++.h> using namespace std; int l[300005], r[300005]; int main() { int n; scanf( %d , &n); int lm = -1, rm = 0x3f3f3f3f; int ansl = 0, ansr = 0; for (int i = 1; i <= n; i++) { scanf( %d%d , &l[i], &r[i]); if (l[i] > lm) { ansl = i; lm = l[i]; ... |
#include <bits/stdc++.h> using namespace std; int f[1100000], p[1100000], n, m, a[110], b[30], c[30]; char cc; bool cmp(int a, int b) { return a > b; } void init() { scanf( %d , &n); for (int i = (1); i <= (n); ++i) scanf( %d , &a[i]); sort(a + 1, a + 1 + n, cmp); scanf( %d n , &n); for (i... |
/*
* Milkymist SoC
* Copyright (C) 2007, 2008, 2009, 2010, 2011 Sebastien Bourdeauducq
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* This program is dis... |
#include <bits/stdc++.h> using namespace std; long long R[10 << 10][1 << 10]; int A[10 << 10]; int n, m, g, r; int main() { cin >> n >> m; int i, j; for (i = (0); i < (m); ++i) cin >> A[i]; cin >> g >> r; sort(A, A + m); for (i = (0); i < (m); ++i) for (j = (0); j < (g + 1); ++j)... |
/**
* 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: 15:13:38 12/14/2015
// Design Name: uart_rx
// Module Name: H:/Firmware/font5_base_new/font5_base/font5-firmware/UART_RX_TB.v
// Project Name: font5_base
// Target D... |
`default_nettype none
module scheduler2_allocate_rsv_station #(
parameter P_ALU2_PRIORITY_LEVEL = 4'h0
)(
//Register
input wire iORDER_LOCK,
input wire iORDER_0_VALID,
input wire iORDER_0_EX_SYS_REG,
input wire iORDER_0_EX_SYS_LDST,
input wire iORDER_0_EX_LOGIC,
input wire iORDER_0_EX_SHIFT,
in... |
#include <bits/stdc++.h> using namespace std; template <typename T> bool chkmax(T &x, T y) { return x < y ? x = y, true : false; } template <typename T> bool chkmin(T &x, T y) { return x > y ? x = y, true : false; } int readint() { int x = 0, f = 1; char ch = getchar(); while (ch < ... |
// (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... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, cc = 0; cin >> a >> b >> c; if (a < 0 || b < 2 || c < 4) cout << 0 << endl; else { while (a >= 1 && b >= 2 && c >= 4) { cc++; a--; b -= 2; c -= 4; } cout << cc * 7 << endl;... |
// (C) 1992-2014 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 simulati... |
/*
Copyright (c) 2015-2018 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, distri... |
#include <bits/stdc++.h> using namespace std; int main() { int l, d, v, g, r, tmu; double tm, tmod; scanf( %d%d%d%d%d , &l, &d, &v, &g, &r); tmu = (int)((long double)(d / v) / (g + r)); tmod = (double)d / v - tmu * (g + r); if (tmod < g) tm = (double)l / v; else tm = (double)... |
/*
* FrameWriter.v
*
* Created on: 09/10/2012
* Author: Lord_Rafa
*/
`timescale 1ns / 1ps
module FrameWriter (
input clk,
input rst,
input [23:0] din_data,
input din_valid,
output wire din_ready,
input wire din_sop,
input wire din_eop,
output wire [DATA_WIDTH-1:0] data_fifo_... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; map<string, string> mp; set<string> s; for (int i = 0; i < n; i++) { string old, edg; cin >> old >> edg; mp[old] = edg; s.insert(edg); } map<string, string>::iterator p; p = mp.begin()... |
/*******************************************************************************
* This file is owned and controlled by Xilinx and must be used solely *
* for design, simulation, implementation and creation of design files *
* limited to Xilinx devices or technologies. Use with non-Xilinx ... |
`timescale 1ns / 1ps
// The Arithmetic/Logic Unit (ALU) is responsible for performing the arithmetic
// and bitwise logical operations the computer depends upon to calculate
// everything from effective addresses for looking stuff up in memory, all the
// way to medical imaging. (OK, the latter might have some help f... |
module D_posedge_async(output Q, Qn, input clr_l, pre_l, D, clk);
wire [3:0]n_out; /* level 1 nand outputs */
/* level 1 nands */
nand lnand0(n_out[0], pre_l, n_out[1], n_out[3]),
lnand1(n_out[1], n_out[0], clk, clr_l),
lnand2(n_out[2], n_out[1], clk, n_out[3]),
lnand3(n_out[3], D, n_out[2], clr_l);
/* lev... |
#include <bits/stdc++.h> using namespace std; int n, Q; string s[200200]; int ep[200200]; int len[200200]; struct data { int to, nxt; } mp[400400]; int head[200200], cnt; void link(int x, int y) { mp[++cnt].to = y; mp[cnt].nxt = head[x]; head[x] = cnt; } int id[200200], clk; int ... |
#include <bits/stdc++.h> const int N = 123456; int arr[N], i, j; using namespace std; int main() { long long n, k, a, b, ans1 = 0, ans2 = 0, ans = 0; scanf( %lld %lld , &n, &k); scanf( %lld %lld , &a, &b); ans1 = (n - 1) * a; if (k == 1) return cout << ans1 << endl, 0; while (n != 0 && n... |
/*
* 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; void main2() { long long int n, m, sum = 0, t = INT_MAX, temp, r = 0; cin >> n >> m; for (long long int i = 0; i < n; i++) { for (long long int j = 0; j < m; j++) { cin >> temp; if (temp < 0) r++; sum += abs(temp); t = m... |
/**
* 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, k; cin >> n; int a[n][2]; for (int i = 0; i < n; ++i) cin >> a[i][0] >> a[i][1]; cin >> k; for (int i = 0; i < n; ++i) { if (a[i][0] <= k && k <= a[i][1]) { cout << n - i; return 0; } } } |
// megafunction wizard: %ROM: 1-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: Test_Line.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ==============... |
#include <bits/stdc++.h> using namespace std; int main() { char ch; int n, cnt = 0; long long x, a; scanf( %d%I64d , &n, &x); for (int i = 0; i < n; i++) { while (isspace(ch = getchar())) ; scanf( %I64d , &a); if (ch == + ) x += a; else { if (x < ... |
#include <bits/stdc++.h> int main() { long long b; scanf( %lld , &b); long long flag = 0; for (long long i = 1; i < sqrt(b); i++) if (b % i == 0) flag = flag + 1; flag = 2 * flag; long long a = sqrt(b); if (a * a == b) flag = flag + 1; printf( %lld , flag); } |
#include <bits/stdc++.h> using namespace std; int a[300005], b[300005]; int main() { int i, k, t, x, y, n, q, num1, num2; string s; scanf( %d , &t); for (i = 0; i < t; i++) { scanf( %d %d , &n, &q); cin >> s; s = + s; for (k = 0; k <= n; k++) a[k] = b[k] = 0; if (... |
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); const double eps = 1e-11; const int INFINITE = 0x3f3f3f3f; template <class T> inline void checkmin(T &a, T b) { if (b < a) a = b; } template <class T> inline void checkmax(T &a, T b) { if (b > a) a = b; } template ... |
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); void run() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); } int32_t main() { run(); vector<long long> dp((long long)(3e6), 0); dp[3] = 4; for (long long i = ... |
#include <bits/stdc++.h> using namespace std; char b[1000001]; int main() { int n, i, c = 0, k = 0, f1 = 0; long int z = 0; cin >> n; int a[n]; for (i = 0; i < n; i++) { cin >> a[i]; if (a[i] == 0) c++; } while (c != n) { if (k == 0) { for (i = 0; i < n; i++) ... |
// (c) Copyright 1995-2016 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is not a license and does not grant ... |
/*
* 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; string s[1005]; long long int M[1005][1005], T[1005][1005]; queue<pair<long long int, long long int> > q; long long int xr[] = {0, 0, -1, 1}; long long int xc[] = {-1, 1, 0, 0}; int main() { ios_base::sync_with_stdio(false); cout.tie(0); cin.tie(0)... |
#include <bits/stdc++.h> using namespace std; template <class T, class V> T power(T t, V v) { T second = 1; while (v--) second *= t; return second; } void _print(long long t) { cerr << t; } void _print(int t) { cerr << t; } void _print(string t) { cerr << t; } void _print(char t) { cerr << t... |
`timescale 1ns / 1ps
//File Name: VGA7SegDisplay.v
//Author: Chris Miller
//Date: April, 2015
//Purpose: Generate seven-segment display with pixels on VGA display
//input:
// (digitXPosition, digitYPosition): upper left corner of the display
// (xpos, ypos): screen position where pixel digitpixel is located
// digit:... |
//-------------------------------------------------------------------
//
// COPYRIGHT (C) 2011, VIPcore Group, Fudan University
//
// THIS FILE MAY NOT BE MODIFIED OR REDISTRIBUTED WI... |
/****************************************************************************
* Copyright (c) 2009 by Focus Robotics. All rights reserved.
*
* This program is an unpublished work fully protected by the United States
* copyright laws and is considered a trade secret belonging to the copyright
* holder. No part of ... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; long long n, a[100010]; int main() { long long n, mx = 0, sum = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; if (a[i] > mx) mx = a[i]; sum += a[i]; } long long s = (sum + n - 2) / (n - 1... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int n; cin >> n; vector<int> x(n); vector<int> p(n); for (int i = (0); i < ((n)); ++i) { cin >> x[i]; --x[i]; p[x[i]] = i; } int const MAX_SUM = 100001; vector<int> prim... |
/**
* 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 bool ylmin(T &a, T b) { return a < b ? 0 : (a = b, 1); } template <class T> inline bool ylmax(T &a, T b) { return a > b ? 0 : (a = b, 1); } template <class T> inline T abs(T x) { return x < 0 ? -x : x; } inline cha... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; const int MAX = 5000001; unsigned int arr[MAX], P[MAX]; void sieve() { unsigned int i, j, t, k; arr[0] = arr[1] = 0; for (i = 2; i < MAX; i++) arr[i] = i; for (i = 4; i < MAX; i += 2) arr[i] = 2; for (i = 3; i * i <=... |
module x;
reg [31:0] mb_reg_output;
// 16 registers max, register 15 is always the version number, so 15 are useable
// NOTE: number_interface_regs must be the maximum (or 16 in this case) to get the version register
parameter NUMBER_INTERFACE_REGS = 16;
parameter MB_R... |
#include <bits/stdc++.h> using namespace std; vector<vector<pair<int, char> > > adj(201); int dp[101][101][26][2]; bool solve(int i, int j, char round, bool turn) { if (dp[i][j][(int)(round - a )][turn] != -1) return dp[i][j][(int)(round - a )][turn]; int ret = 0; if (!turn) { for (int... |
/////////////////////////////////////////////////////////////////////
//// ////
//// WISHBONE revB.2 compliant I2C Master controller Top-level ////
//// ////
//// ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; const ll MOD = 1e9 + 7; void dfs(int node, vector<vector<pair<int, int>>>& adj, vector<bool>& vu, ll& cnt) { for (auto& p : adj[node]) { if (!vu[p.first] and p.second == 0) { vu[p.first] = true; ++cnt; ... |
#include <bits/stdc++.h> using namespace std; template <typename float_t> struct _complex_ { float_t x, y; _complex_<float_t>(float_t _x = 0, float_t _y = 0) : x(_x), y(_y) {} float_t real() const { return x; } void real(float_t _x) { x = _x; } float_t imag() const { return y; } void imag(... |
#include <bits/stdc++.h> using namespace std; using cd = complex<double>; const double PI = acos(-1); int reverse(int num, int lg_n) { int res = 0; for (int i = 0; i < lg_n; i++) { if (num & (1 << i)) res |= 1 << (lg_n - 1 - i); } return res; } void fft(vector<cd> &a, bool invert) { ... |
#include <bits/stdc++.h> using namespace std; vector<int> s; vector<vector<int> > t; bool sortFunc(vector<int> a, vector<int> b) { if (a.size() == 0) return false; if (b.size() == 0) return true; return a.size() < b.size(); } int main() { cin.sync_with_stdio(false); cin.tie(0); int n... |
#include <bits/stdc++.h> int a[5005]; int solve(int i, int j) { int k, vans, hans, mini, s, t; vans = j - i + 1; mini = a[i]; for (k = i + 1; k <= j; k++) if (mini > a[k]) mini = a[k]; hans = mini; for (k = i; k <= j; k++) a[k] -= mini; hans = mini; for (k = i; k <= j;) { ... |
#include <bits/stdc++.h> #pragma GCC optimize( unroll-loops,no-stack-protector ) #pragma GCC target( sse,sse2,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; const int MOD = 1e9 + 7; const int INF32 = 1 << 30; const long long INF64 = 1LL << 60; const long double pi = acos(-1); long long... |
#include <bits/stdc++.h> using namespace std; int t, num[30], ans; char s[100005]; int main() { cin >> t; while (t--) { ans = 0; memset(num, 0, sizeof(num)); scanf( %s , s + 1); int len = strlen(s + 1); for (int i = 1; i <= len; i++) { num[s[i] - A + 1]++; }... |
/**
* 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
`include "Defintions.v"
`define LOOP1 8'd8
`define LOOP2 8'd5
module ROM
(
input wire[15:0] iAddress,
output reg [27:0] oInstruction
);
always @ ( iAddress )
begin
case (iAddress)
0: oInstruction = { `NOP ,24'd4000 };
1: oInstruction = { `STO , `R7,16'b0001 };
2: oInstruction = { ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; struct Data { int u, v, w; Data() {} Data(int x, int y, int z) : u(x), v(y), w(z) {} }; int n; vector<Data> edge, ans; vector<int> neighbor[N]; void dfs(int u, int par, vector<int> &leaf) { if (neighbor[u].size() == 1) ... |
/**
* 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; const int64_t MOD = 998244353; const int64_t N = 2e5 + 5; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); int64_t mpow(int64_t x, int64_t y) { if (y == 0) return 1; int64_t temp = mpow(x, y / 2); temp *= temp; temp %= MOD; ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 7; const int inf = INT_MAX; const long long inff = 1e18; const int mod = 1e9 + 7; long long a[50]; int32_t main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); a[0] = 0; for (long long i = 1; i <= 31; i++) { ... |
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2014 Francis Bruno, All Rights Reserved
//
// This program is free software; you can redistribute it and/or modify it
// under the terms of the GNU General Public License as published by the Free
// Software Found... |
#include <bits/stdc++.h> using namespace std; long long int chr[1000006]; long long int freq[1000006]; long long int Z[2000006]; void Zalgo(int end) { int l = 1, r = 1; for (int i = 2; i < end; ++i) { if (r > i) { int pre = Z[i - l + 1]; if (pre + i < r) { Z[i] = pre; ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2016/06/16 11:09:41
// Design Name:
// Module Name: Chip_Decoder
// 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... |
#include <bits/stdc++.h> using namespace std; const int N = 205; int n; char s[N]; bool ck(int l, int r) { int a = 0, b = 0, c = 0, d = 0; for (int i = l; i <= r; i++) { if (s[i] == U ) a++; else if (s[i] == D ) b++; else if (s[i] == L ) c++; else ... |
// ----------------------------------------------------------------------
// Copyright (c) 2016, The Regents of the University of California All
// rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, t, x, y; long long pos_ji, pos_ou; while (~scanf( %lld%lld , &n, &t)) { while (t--) { scanf( %lld%lld , &x, &y); long long ji = n / 2 * n + (n + 1) / 2 + 1; long long ou = n / 2 * n + 1; pos_ji ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.