text stringlengths 59 71.4k |
|---|
// Copyright (c) 2000-2012 Bluespec, Inc.
// 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, pub... |
// Library - static, Cell - th34w32, View - schematic
// LAST TIME SAVED: May 23 17:24:37 2014
// NETLIST TIME: May 23 17:36:37 2014
`timescale 1ns / 1ns
module th34w32 ( y, a, b, c, d );
output y;
input a, b, c, d;
specify
specparam CDS_LIBNAME = "static";
specparam CDS_CELLNAME = "th34w32";
spec... |
#include <bits/stdc++.h> using namespace std; vector<long long> adj[205]; bool vis[205]; long long dp[205]; void dfs(long long v) { vis[v] = true; for (long long first : adj[v]) { if (!vis[first]) { dfs(first); dp[v] = max(dp[first] + 1, dp[v]); } } } signed main() ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; int len = s.size(); bool flag = false; for (int i = 0; i < len - 1; i++) { if ((s[i] != a && s[i] != e && s[i] != i && s[i] != o && s[i] != u )) { if (s[i] == n ) continue;... |
#include <bits/stdc++.h> const double eps = 1e-9; using namespace std; double f[2050], p[2050], q[2050]; int fa[2050], fb[2050]; int n, a, b; void calc(double w1, double w2) { for (int i = 1; i <= n; i++) { f[i] = f[i - 1]; fa[i] = fa[i - 1]; fb[i] = fb[i - 1]; if (f[i - 1] + p[i... |
#include <bits/stdc++.h> using namespace std; template <class T> void _R(T &x) { cin >> x; } void _R(int &x) { scanf( %d , &x); } void _R(int64_t &x) { scanf( %lld , &x); } void _R(double &x) { scanf( %lf , &x); } void _R(char &x) { scanf( %c , &x); } void _R(char *x) { scanf( %s , x); } void R... |
#include <bits/stdc++.h> using namespace std; long long powr(long long a, long long b) { long long res = 1; while (b) { if (b % 2 == 1) res = res * a % 1000000007; a = a * a % 1000000007; b /= 2; } return res; } int main() { int p, k; cin >> p >> k; vector<int> g[p]... |
`timescale 1ns/1ps
module tb_Oper_Start_In (); /* this is automatically generated */
parameter PERIOD = 10;
reg clk;
reg rst;
// clock
initial begin
clk = 0;
forever #5 clk = ~clk;
end
// reset
initial begin
rst = 0;
#6
rst = 1;
repeat (6) @(posedge clk);
rst = 0;
end... |
/*
* 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... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2009-2010 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... |
#include <bits/stdc++.h> using namespace std; using vi = vector<int>; using vvi = vector<vi>; using ii = pair<int, int>; using vii = vector<ii>; using l = long long; using vl = vector<l>; using vvl = vector<vl>; using ll = pair<l, l>; using vll = vector<ll>; using vvll = vector<vll>; using lu = ... |
module var23_multi (A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, valid);
input A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W;
output valid;
wire [8:0] min_value = 9'd120;
wire [8:0] max_weight = 9'd60;
wire [8:0] max_volume = 9'd60;
wire [8:0] total_v... |
/*#pragma GCC target ( avx2 ) #pragma GCC optimization ( O3 ) #pragma GCC optimization ( unroll-loops ) */ #include<bits/stdc++.h> using namespace std; void __print(int x) {cerr << x;} void __print(long x) {cerr << x;} void __print(long long x) {cerr << x;} void __print(unsigned x) {cerr << x;} v... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long n, i, j, k, l, m, b, t, sum, sum1, flag, max1, min1; cin >> n >> m; long long a[n + 1]; for (i = 1; i <= n; i++) { cin >> a[i]; } sum = 0; long long pre[100... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 06/13/2017 05:18:39 PM
// Design Name:
// Module Name: SHA1_out
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// R... |
//Legal Notice: (C)2017 Altera Corporation. All rights reserved. Your
//use of Altera Corporation's design tools, logic functions and other
//software and tools, and its AMPP partner logic functions, and any
//output files any of the foregoing (including device programming or
//simulation files), and any associated do... |
#include <bits/stdc++.h> using namespace std; vector<int> v[100005]; vector<pair<int, int> > asdf; int n; int m; int cnt[100005]; vector<int> nxt[100005]; void build(int at, int num) { if (cnt[at] > 2) return; if (num == m) { while ((int)asdf.size()) { printf( %d %d n , 1 + asdf.ba... |
// ============================================================================
// 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 long long MOD = 1e9 + 7; struct Fib { long long a, b; Fib operator+(const Fib& o) const { return {(a + o.a) % MOD, (b + o.b) % MOD}; } }; struct FibOp { long long a, b, c, d; FibOp operator()(const FibOp& o) const { FibOp res ... |
#include <bits/stdc++.h> using namespace std; const int maxn = int(5e5) + 100; int n, m; vector<pair<int, int> > out[maxn]; int fa[maxn]; long long f[maxn], g[maxn], a[maxn]; void read() { scanf( %d%d , &n, &m); for (int i = 1; i <= n; ++i) out[i].clear(); for (int i = 1; i < n; ++i) { i... |
//
// bsg_wormhole_concentrator.v
//
// 08/2019
//
// This is an adapter between 1 concentrated wormhole link and N unconcentrated wormhole links.
// Extra bits (cid) are used in wormhole header to indicate wormhole packet destination.
//
// From implementation perspective this is a simplified version bsg_worm... |
#include <bits/stdc++.h> using namespace std; int p[100009], a[100009], pos[100009], m, n, ri[100009], le[100009]; set<pair<int, int>> st; inline bool cmp(const int& A, const int& B) { return p[A] < p[B]; } int getdis(int x, int y) { if (x == y) return 1000000000; int d = (p[y] - p[x] + m) % m; if... |
#include <bits/stdc++.h> using namespace std; vector<int> row, col, A; vector<pair<pair<int, int>, int> > mat; int grid[111][111]; void shift_up(int c, int n, int m) { int i, temp; temp = grid[n][c]; for (i = n; i > 1; i--) grid[i][c] = grid[i - 1][c]; grid[1][c] = temp; } void shift_left(... |
//
// Copyright (c) 2001 Stephan Boettcher <>
//
// 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)
//... |
#include <bits/stdc++.h> using namespace std; int main() { int n, rej = 0; cin >> n; vector<int> a(n); for (size_t i = 0; i < n; i++) cin >> a[i]; sort(a.begin(), a.end()); for (int i = 0; i < n; i++) if (a[i] == a[0] || a[i] == a[n - 1]) rej++; cout << n - rej; } |
#include <bits/stdc++.h> using namespace std; inline long toInt(string s) { long v; istringstream sin(s); sin >> v; return v; } template <class T> inline string toString(T x) { ostringstream sout; sout << x; return sout.str(); } template <class T> inline T sqr(T x) { retu... |
/*
* 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... |
/*
Distributed under the MIT license.
Copyright (c) 2015 Dave McCoy ()
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, mo... |
`timescale 1ns/10ps
module top;
reg pass;
real rise, fall, delay, base, diff;
reg in, ctl;
wire out, outif0;
buf #(rise, fall) dut(out, in);
bufif0 #(rise, fall) dutif0(outif0, in, ctl);
// Check that the buffer output has the correct value and changed at the
// correct time.
always @(out) begin
... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100007, dx[8] = {1, 1, 1, 0, 0, -1, -1, -1}, dy[8] = {1, 0, -1, 1, -1, 1, 0, -1}; int xs, ys, xt, yt, n, r[maxn], a[maxn], b[maxn], d[maxn] = {}, cnt = 0; bool vis[maxn] = {}; vector<int> row, col[maxn]; vector<pair<int, int> > seg[m... |
#include <bits/stdc++.h> using namespace std; static const int MXN = 20000 + 2; const int mod = 998244353; long long dis[MXN]; struct CostFlow { static const long long INF = 102938475610293847LL; struct Edge { int v, r; long long f, c; Edge(int a, int b, int _c, int d) : v(a), r(b), ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 10; char a[N], b[N]; int n, T; int ans[N * 2], ct, rev; int rt, ch[N][2], fa[N], tg[N], col[N], sz[N]; int get(int x) { return ch[fa[x]][1] == x; } void pushdown(int x) { swap(ch[x][0], ch[x][1]), col[ch[x][0]] ^= 1, col[ch[x][1]] ^= ... |
#include <bits/stdc++.h> using namespace std; int SET(int N, int pos) { return N = N | (1 << pos); } int RESET(int N, int pos) { return N = N & ~(1 << pos); } bool CHECK(int N, int pos) { return (bool)(N & (1 << pos)); } template <typename T> inline T __lcm(T a, T b) { return (a * b) / __gcd(a, b); } ... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int MOD = 1e9 + 7; const int MAXN = 3e5 + 5; const double PI = acos(-1); long long a[MAXN][2]; long long dp[MAXN][2][2]; int main(void) { int n, x; scanf( %d%d , &n, &x); for (int i = 1; i <= n; i++) { scan... |
#include <bits/stdc++.h> using namespace std; const int M = 6e5 + 10, P = 490019; const double PI = acos(-1.0); int a[M << 1], b[M << 1], c[M << 1], pw[M], inv[M], C[M << 1], oo, n, m, cc, r[M << 1], N, l; struct cp { double x, y; cp(double _x = 0, double _y = 0) : x(_x), y(_y) {} } p[M << 1],... |
`timescale 1ns / 1ps
`include "../src/axis_scaler.v"
module test();
localparam RANDOMOUTPUT = 1;
localparam RANDOMINPUT = 1;
localparam integer C_REALDATA = 1;
localparam integer C_PIXEL_WIDTH = (C_REALDATA ? 8 : 16);
localparam integer C_SH_WIDTH = 12;
localparam integer C_SW_WIDTH = 12;
localparam i... |
#include <bits/stdc++.h> using namespace std; const long long OO = 1e8; const double EPS = (1e-7); vector<vector<int> > readAdjList() { int n, e; scanf( %d%d , &n, &e); vector<vector<int> > adjList(n + 1); for (int i = 0; i < (e); i++) { int u, v; scanf( %d%d , &u, &v); adjList... |
/*
* 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 double eps = 1e-10; const int inf = 1000000009; int i, j, k, m, n, l; int ans; int f(int n, int m) { return n < m ? (n + (n % 2) * (m - 1)) / 2 : f(n - m, 2 * m); } int main() { cin >> n; cout << (n < 2 ? 0 : f(n - 2, 2)) << endl; retur... |
//Control circuit
`include "verilog/riscv_instr_defines.v"
module control
(
input wire[2:0] instr_funct3_ctl_i,
input wire[6:0] instr_funct7_ctl_i,
input wire[6:0] instr_opcode_ctl_i,
input wire is_r_type_ctl_i,
input wire is_i_type... |
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; while (t--) { long long int minu = 1, temp = 0, n, ans = 0; cin >> n; ans = ((n) * (n + 1)) / 2; while (minu <= n) { temp += minu; minu *= 2; } ans -= (2 * temp); ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, d; cin >> n >> d; int in[n]; vector<pair<int, int>> c; in[0] = in[n - 1] = 0; for (int i = 1; i < n - 1; i++) cin >> in[i]; for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; c.push_back({x, y}); ... |
#include <bits/stdc++.h> char s[1000010]; int max_pos_by_allowed_and_len[1 << 20][21]; constexpr int full = (1 << 20) - 1; template <typename T> void mx(T& x, T y) { x = (x > y ? x : y); } void update(const int* __restrict__ a, int* __restrict__ b) { for (int i = 0; i < 21; i += 7) { mx(b[i ... |
#include <bits/stdc++.h> using namespace std; int unibit[60] = {0}; long long a[200005]; long long unia[200005] = {0}; int main() { int n, k, x; cin >> n >> k >> x; long long orr = 0; for (int i = 1; i <= n; i++) { cin >> a[i]; orr |= a[i]; long long b = a[i]; for (int ... |
/**
* 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... |
// FP16 Regular/Relaxed version.
// TODO: Implement overflow/underflow.
module FP16RMulS0Of2(
input clk,
input rst,
input [15:0] arg_0,
input [15:0] arg_1,
output ret_0,
output [4:0] ret_1,
output [4:0] ret_2,
output [11:0] ret_3);
wire s0;
wire s1;
wire [4:0] ... |
#include <bits/stdc++.h> using namespace std; const int inf = 1e9 + 239; int n, m, k; vector<set<int>> row; vector<set<int>> column; vector<set<int>> row_free; vector<set<int>> column_free; int get_row_left(int i, int to, int from) { auto it = row[i].lower_bound(from); if (it == row[i].begin()) ... |
/*
* Copyright (c) 2011-2012 Travis Geiselbrecht
*
* 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, m... |
#include <bits/stdc++.h> using namespace std; const int N = 110; const int M = 10010; int n, m; char mat[N][M]; int dir[2] = {-1, 1}; long long solve() { long long ans = 0; int x = 0, y = 0, d = 1; bool isLeft = true, isRight = true; int pos[2] = {0, 0}; while (true) { if (!isLef... |
#include <bits/stdc++.h> using namespace std; const int N = 51; const int mod = (int)1e9 + 7; long long dp0[N][N]; long long dp1[N][N]; long long C[N][N]; inline long long modpow(long long x, long long p) { long long res = 1; while (p) { if (p & 1) res = res * x % mod; x = x * x % mod;... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const bool debugger1 = 0; const bool debugger2 = 0; const bool debugger3 = 0; const bool debugger4 = 0; const bool debugger5 = 0; const long long MOD = 1e9 + 7, P = 1e9 + 7; long long n; long long sca, scb; std::vector<pa... |
/**
* $Id: red_pitaya_pid_block.v -01-21 11:40:39Z matej.oblak $
*
* @brief Red Pitaya PID controller.
*
* @Author Matej Oblak
*
* (c) Red Pitaya http://www.redpitaya.com
*
* This part of code is written in Verilog hardware description language (HDL).
* Please visit http://en.wikipedia.org/wiki/Verilog
* fo... |
#include <bits/stdc++.h> using namespace std; struct info_t { int x, y, i; }; int main() { int n, m; scanf( %d %d , &n, &m); vector<info_t> from(m), to(m); vector<vector<int>> answer_from, answer_to; auto solve = [&](vector<info_t> &info, vector<vector<int>> &answer) { for (int i =... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast , unroll-loops ) using namespace std; const long long inf = 1ll << 60; const long long iinf = 2147483647; const long long mod = 998244353; const long long maxn = 1e3 + 5; long long pw(long long x, long long p) { long long ret = 1; while (p > 0)... |
#include <bits/stdc++.h> using namespace std; int main() { long long x, d; while (~scanf( %lld%lld , &x, &d)) { vector<pair<long long, int> > counts; long long sum = 0; long long num = 1; while (x > 0) { long long two = 1; int count = 0; while (two - 1 <= x) t... |
#include <bits/stdc++.h> using namespace std; int main() { int n, temp, sum = 0; cin >> n; int arr[n]; memset(arr, 0, sizeof(arr)); for (int i = 0; i < n; i++) { cin >> arr[i]; sum += arr[i]; if (i == 0) temp = arr[0]; else if (arr[i] > temp) temp = arr[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; long long n, m, k, ans, last, d, x, y, a, b; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } void exgcd(long long a, long long b, long long& d, long long& x, long long& y) { if (!b) { x = 1, y = 0, d = a; } else { exgcd(... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2004 Xilinx, Inc.
//
// 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
//
//... |
//////////////////////////////////////////////////////////////////
////
////
//// AES CORE BLOCK
////
////
////
//// This file is part of the APB to I2C project
////
//// http://www.opencores.org/cores/apbi2c/
////
////
////
//// Description
////
//// Implementation of APB IP core according to
////
//... |
`timescale 1ns/1ns
module udp_outbound_chain
(input clk_50,
input clk_100,
input [7:0] rxd,
input rxdv,
input rxlast,
output [7:0] txd,
output txdv,
output [15:0] hop_count,
output [7:0] submsg_rxd,
output submsg_rxdv,
output submsg_rxlast);
udp_outbound_chain_r... |
#include <bits/stdc++.h> using namespace std; template <class T> T max(T a, T b, T c) { return max(a, max(b, c)); } template <class T> T min(T a, T b, T c) { return min(a, min(b, c)); } const double PI = 2.0 * acos(0.0); const int mx[] = {0, 1, 0, -1}; const int my[] = {-1, 0, 1, 0}; int c... |
/*
Copyright (c) 2014-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; const int N = 5010 + 10; const int mod = 1e9 + 7; char s[N]; char t[N]; int d[N][N]; int main() { int n, m; cin >> n >> m; scanf( %s%s , s + 1, t + 1); int ans = 0; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { ... |
#include <bits/stdc++.h> using namespace std; struct team { string nam; int pt, diff, get; } T[55]; int n; void gao(string s, int pt, int diff, int get) { for (int i = 0; i < n; i++) { if (s == T[i].nam) { T[i].pt += pt; T[i].diff += diff; T[i].get += get; bre... |
/**
* 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> int a[200010]; int main() { long long ans = 0; int m = 0, n; scanf( %d n , &n); for (int i = 1; i <= n; i++) { int a1, b1, a2, b2; scanf( %d%d%d%d n , &a1, &b1, &a2, &b2); if (a1 + b1 >= a2 + b2) { a[++m] = a1 + b1; a[++m] = a2 + b2; ... |
// Stupid first CPU.
module SimpleCPU(clk, rst, cur_ins);
// Definitions.
parameter REG_SET_SIZE = 16;
parameter WORD_SIZE = 32;
// Instruction opcodes.
parameter OP_NOP = 32'b00000000000000000000000000000000;
parameter OP_INC = 32'b00000000000000000000000000000001;
parameter OP_DEC = 3... |
// Code your design here
module serializer(
clk, //clock to send serialized data on out line
reset, //reset counter to 0 on high
enable, //serialize while enable on high
in,
complete, //deserialized data
out //serialized data
);
parameter BITS = 32; //size of serializer
parameter BITS_COUNTER ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 18:34:30 10/12/2013
// Design Name:
// Module Name: Logica_Barra
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
... |
#include <bits/stdc++.h> using namespace std; int dp[2005][2005] = {0}; long long int n, t, m, h, l, r; int check(int v) { return v >= l && v <= r; } void solve() { cin >> n >> h >> l >> r; vector<int> v; for (int i = 0; i < n; i++) { cin >> t; v.push_back(t); } for (int i = 0;... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, i; cin >> n; i = 1; while (n % i == 0) { i = i * 3; } cout << n / i + 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 law... |
`default_nettype none
module dsp_system_top;
wire clk;
wire reset;
wire [15:0] io_data_out;
wire io_wr_strb;
wire [15:0] io_data_in;
wire [7:0] io_addr_out;
wire io_rd_strb;
wire [15:0] pm_addr;
wire [31:0] pm_data;
wire [15:0] dm0_addr;
wire [15:0] dm0_datai;
wire [15:0] dm0_datao;
wire dm0_wr_en;
wire [15... |
//////////////////////////////////////////////////////////////////////////////
/// Copyright (c) 2012, Jahanzeb Ahmad
/// All rights reserved.
///
/// Redistribution and use in source and binary forms, with or without modification,
/// are permitted provided that the following conditions are met:
///
/// * Redistribu... |
module lab5_top(CLK, SW, KEY, RESET_N, LEDR, HEX5, HEX4, HEX3, HEX2, HEX1, HEX0);
input CLK;
input [9:0] SW;
input [3:0] KEY;
input RESET_N;
output [9:0] LEDR;
output [6:0] HEX5;
output [6:0] HEX4;
output [6:0] HEX3;
output [6:0] HEX2;
output [6:0] HEX1;
output [6:0] H... |
module note2dds_5st_gen(clk, note, adder);
input wire clk;
input wire [6:0] note;
output [31:0] adder;
(* romstyle = "logic" *) reg [31:0] table_values;
reg [4:0] addr_reg;
wire [3:0] diap = (note < 12) ? 4'd00 :
(note < 24) ? 4'd01 :
(note < 36) ? 4'd02 :
(note < 48) ? 4'd03 :
... |
#include <bits/stdc++.h> using namespace std; const long long N = 100005, INF = 1e18; void solve() { long long n, ans = 0, max = 0; cin >> n; ans = n / 2; cout << ans << n ; for (long long i = (long long)0; i < ans - 1; i++) { cout << 2 ; } if (n % 2 == 0) cout << 2 << ... |
`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 time base for each unit, ranging from seconds
* to femtoseconds, and must be:... |
#include <bits/stdc++.h> #pragma optimize( SEX_ON_THE_BEACH ) #pragma GCC optimize( unroll-loops ) #pragma GCC optimize( O3 ) #pragma GCC optimize( fast-math ) using ll = long long int; using ull = long long int; using dd = double; using ldd = long double; namespace Hashes { const int mod197 = 1e9 +... |
/**
* 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... |
//==================================================================================================
// Filename : musb_hazard_unit.v
// Created On : 2014-09-26 20:26:08
// Last Modified : 2015-05-31 22:58:43
// Revision : 1.0
// Author : Angel Terrones
// Company : Universidad Simón Bol... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2014.4
// Copyright (C) 2014 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1ns/1p... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(); cout.tie(); int n, m; cin >> n >> m; if (n == m) { cout << n << endl; return 0; } cout << 2 << endl; } |
// DEFINES
`define WIDTH 8 // Bit width
`define DEPTH 4 // Bit depth
module dpram(clock,
wren1,
wren2,
reset_n,
value_out,
value_out2,
value_in,
value_in2
);
// SIGNAL DECLARATIONS
input clock;
inpu... |
#include <bits/stdc++.h> using namespace std; int main() { std::ios::sync_with_stdio(false); std::cin.tie(0); int a, b, c; cin >> a >> b >> c; int s = 0; int min = a < b ? a : b; int max = a > b ? a : b; s += min; if (c > (max + min)) s += (max + min); else s += c... |
#include <bits/stdc++.h> int ma[100005]; int main() { int n, k; scanf( %d%d , &n, &k); for (int i = 1; i <= k + 1; i++) { if (i & 1) printf( %d , i / 2 + 1); else printf( %d , k + 2 - i / 2); } int s = (k + 1) / 2 + 1; int e = k + 2 - (k + 1) / 2; for (int i... |
#include <bits/stdc++.h> using namespace std; struct P { long long x; long long y; bool operator<(const P &a) const { return y > a.y; } }; vector<long long> v[3]; int a, c, i, b, n, m, k, d; long long o[1333331]; int l[1111111]; int j[1111115]; int e[1111111]; int dx[10] = {0, 1, 0, -1, ... |
#include <bits/stdc++.h> using namespace std; long long a[200005]; set<long long> ns; long long p2[100]; int main() { int n, i, j; int cnt = 0; long long t = 1; while (t < 2000000000) { cnt++; p2[cnt] = t; t *= 2; } cin >> n; for (i = 1; i <= n; i++) { scanf... |
#include <bits/stdc++.h> using namespace std; bool spj(set<int>& s) { vector<int> v{s.begin(), s.end()}; return (v[2] == 3 * v[0] && v[1] == 2 * v[0]); } int main() { int n; scanf( %d , &n); vector<int> result; for (int i = n, factor = 1; i != 0; i /= 2, factor *= 2) { if (i == 3) ... |
#include <bits/stdc++.h> using namespace std; int n; char grid[101][101]; bool rw[101], cl[101]; int main() { bool f, r = 0, c = 0; int cnt; scanf( %d , &n); for (int i = 0; i < n; ++i) { scanf( %s , grid[i]); f = 1; for (int j = 0; j < n; ++j) { f &= (grid[i][j] == ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 5010, inf = 0x7fffffff; bool has[maxn][maxn], flag = 0; int sum[maxn][maxn], n, m, l[10], r[10], req; long long ans; void init() { for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) sum[i][j] = sum[i - 1][j] ... |
#include <bits/stdc++.h> using namespace std; long long int max(long long int a, long long int b) { if (a >= b) return a; else return b; } long long int min(long long int a, long long int b) { if (a >= b) return b; else return a; } long long int diff(long long int a, ... |
#include <bits/stdc++.h> using namespace std; template <class T> inline void remax(T& A, T B) { if (A < B) A = B; } template <class T> inline void remin(T& A, T B) { if (A > B) A = B; } string ToString(long long num) { string ret; do { ret += ((num % 10) + 0 ); num /= 10; ... |
/*********************************************************************
* SYNOPSYS CONFIDENTIAL *
* *
* This is an unpublished, proprietary work of Synopsys, Inc., and *
* is fully protected under copyrigh... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5, INF = 0x3f3f3f3f; int a[maxn]; int last[maxn]; int main() { int n; while (cin >> n) { memset(last, INF, sizeof(last)); for (int i = 0; i < n; i++) { cin >> a[i]; last[a[i]] = i; } sort(last,... |
#include <bits/stdc++.h> using namespace std; bool gone[1000000]; int n; int ord[1000000], put[1000000]; int main() { scanf( %i , &n); for (int(a) = 0; (a) < (n); (a)++) scanf( %i , ord + a); for (int(a) = 0; (a) < (n); (a)++) scanf( %i , put + a); int i = 0; for (int(a) = 0; (a) < (n); (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 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.