text stringlengths 59 71.4k |
|---|
// (C) 1992-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 simulati... |
#include <bits/stdc++.h> using namespace std; const int N = 5; const int M = 1e7 + 1; const long long INF = 1LL << 61; long long a[N], t[N], cost[N]; inline long long bs(long long bytes, long long maxt) { long long res = -1; if (t[0] <= t[2]) { if ((t[0] * bytes) <= maxt) { res = 0; ... |
#include <algorithm> #include <cassert> #include <iostream> #include <queue> #include <vector> using namespace std; typedef long long ll; typedef pair<int, int> Pii; typedef vector<Pii> VPii; typedef vector<int> Vi; typedef vector<Vi> VVi; typedef vector<ll> Vll; typedef vector<Vll> VVll; ... |
/*
* 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; typedef long long int ll; void solve(void); int main(){ int t; cin>>t; while(t--){ solve(); } return 0;} void solve(){ ll n,i; cin>>n; ll a[n+1]; for(i=1;i<=n;i++) {cin>>a[i]; } cout<<3*n<<endl; for(i=1;i<n;i++) { cout<<... |
/*!
btcminer -- BTCMiner for ZTEX USB-FPGA Modules: HDL code: hash pipelines
Copyright (C) 2011 ZTEX GmbH
http://www.ztex.de
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 as
published by the Free Software Foundation... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 04/26/2016 07:00:53 AM
// Design Name:
// Module Name: Adder_Round
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); } template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); } template <typename T> T inf; template <> con... |
#include <bits/stdc++.h> using namespace std; int main() { int n, ans = 0, ans1 = 0, ans2 = 0, tar; cin >> n; tar = n / 3; string s; cin >> s; for (int i = 0; i < n; i++) { int val = s[i] - 0 ; if (val == 0) ans++; else if (val == 1) ans1++; else ... |
/**
* 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; int main() { int n; cin >> n; long long int x = 2; double d; long long int p; for (long long int i = 1; i <= n; i++) { long long int B = i * (i + 1) * (i + 1) - x / i; cout << B << n ; x = i * (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 la... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2006 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc; initial cyc = 0;
reg [6... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
#include <bits/stdc++.h> using namespace std; int key(int x); int main() { int t; cin >> t; int str[t]; for (int u = 0; u < t; u++) { str[u] = key(u); } for (int u = 0; u < t; u++) cout << str[u] << n ; return 0; } int key(int x) { int n, k, d, mini = 1000, m = 0; c... |
#include <bits/stdc++.h> using namespace std; struct node { int num; long long x; } tmp; bool cmp(node a, node b) { return a.x > b.x; } int main() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); int t; vector<node> v; cin >> t; while (t--) { v.clear(); long long... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; string h, v; cin >> h >> v; bool flag = true; if (h[0] == > && v[0] == v ) flag = false; if (h[0] == < && v[m - 1] == v ) flag = false; if (h[n - 1] == > && v[0] == ^ ) flag = false; if (... |
#include <bits/stdc++.h> int a[1005]; int main() { int x, i, j; while (scanf( %d%*c , &x) != EOF) a[x] = 1; bool flag = false; for (i = j = 1; i < 1001; i = ++j) if (a[i]) { for (j = i; a[j]; ++j) ; --j; if (!flag) flag = true; else ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; int e = 0; int d; int a[15], b[15], l[10]; for (int f = 0; f < n; f++) cin >> a[f]; for (int j = 0; j < m; j++) cin >> b[j]; int rr = 0, tt = 0; for (int g = 0; g < n; g++) { if (a[g] < 0 ||... |
#include <bits/stdc++.h> using namespace std; struct Counter { static int k; Counter() { k++; } ~Counter() { k--; } }; int Counter::k = 0; template <typename T> void pr(const string& name, T t) { cout << name << = << t << endl; } template <typename T, typename... Types> void pr(con... |
#include <bits/stdc++.h> using namespace std; int cmp(char a, char b) { return a > b; } int main() { char s[300050]; char str[300050]; char ans[300050]; scanf( %s%s , s, str); int len = strlen(s); sort(s, s + len); sort(str, str + len, cmp); if (len == 1) { printf( %s n , s);... |
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <ctype.h> #include <deque> #include <cstring> #include <set> #include <bitset> #include <map> #include <chrono> #include <random> #include <unordered_map> #include <stdio.h> using namespace std; typ... |
#include <bits/stdc++.h> using namespace std; const int MaxN = 1; int n, sol, counter; bool mark[20]; void check(long long x) { if (x > n) return; if (x != 0) sol++; for (int i = 0; i <= 9; i++) { if (mark[i]) { if (i != 0 || (i == 0 && x != 0)) check(x * 10 + i); } else { ... |
#include <bits/stdc++.h> using namespace std; int dcmp(double a, double b) { return fabs(a - b) <= 0.0000000001 ? 0 : (a > b) ? 1 : -1; } int main() { int x1, y1, x2, y2, r1, r2, R1, R2; cin >> x1 >> y1 >> r1 >> R1 >> x2 >> y2 >> r2 >> R2; double dis = sqrt((y2 - y1) * (y2 - y1) + (x2 - x1) * (x... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5, base = 2333, mod = 20030731; int n, m, a[N], b[N], pw[N], h1[N], h2[N], ans[N]; void init() { pw[0] = 1; for (int i = (1); i <= (n - 1); i++) pw[i] = (long long)base * pw[i - 1] % mod, h1[i] = (((long long)h1[i - 1] * base ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 305; int a[maxn][maxn], b[maxn][maxn]; int main(int argc, char const *argv[]) { int t; scanf( %d , &t); while (t--) { int n, m; scanf( %d %d , &n, &m); for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++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... |
#include <bits/stdc++.h> using namespace std; struct bus { double t, v; double cost, time; }; bus bus[100000]; int main() { int n, a, d; scanf( %d%d%d , &n, &a, &d); double fastest = 0.0; double x, y; for (int i = 0; i < n; i++) { scanf( %lf%lf , &bus[i].t, &bus[i].v); ... |
/*
* 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
/*
Copyright 2015, Google 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
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable l... |
//Copyright (C) 1991-2013 Altera Corporation
//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 from any of the foregoing
//(including device programming or simulation files), and any
//associated documentatio... |
#include <bits/stdc++.h> int R, C; int ER, EC; int SR, SC; char field[1010][1010]; int dist[1010][1010]; int Q[1010 * 1010], Qb, Qe; int dr[4] = {-1, +1, 0, 0}; int dc[4] = {0, 0, -1, +1}; int main(void) { scanf( %d %d , &R, &C); for (int r = 0; r < R; ++r) { scanf( %s , field[r]); ... |
#include <bits/stdc++.h> const int N = (int)3e5 + 2; int n; bool a[N << 1]; int ans, ansl, ansr; inline long long read() { long long x = 0; char ch = getchar(); for (; ch > 9 || ch < 0 ; ch = getchar()) ; for (; ch >= 0 && ch <= 9 ; ch = getchar()) x = (x << 1) + (x << 3) + (... |
#include <bits/stdc++.h> using namespace std; int32_t main() { int n, m; char x; cin >> n >> m; cin >> x; vector<vector<char> > c(n + 1); char gar; vector<char> u1(m + 1, . ); for (int j = 0; j < (n + 1); ++j) c[j] = u1; bool b[n][m]; stack<pair<int, int> > s, t; for (in... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1000010; int n, m, tot, ans; int mx[maxn], mn[maxn], fir[maxn]; struct edge { int a, b, l, r; } p[maxn << 1]; queue<int> q; vector<int> v[maxn]; inline void add(int a, int b, int c, int d) { p[++tot].a = a, p[tot].b = b, p[tot].l =... |
#include <bits/stdc++.h> using namespace std; const int P = 10, N = 1e5 + 10; int inverse(int a, int m) { int m0 = m, t, q; int x0 = 0, x1 = 1; if (m == 1) return 0; while (a > 1) { q = a / m; t = m; m = a % m, a = t; t = x0; x0 = x1 - q * x0; x1 = t; } ... |
#include <bits/stdc++.h> using namespace std; const int INF = 2e9; const long long LINF = 2e18; void inv(bool e); template <typename T> void die(T& a); bool brute, alter; int cnt_tests = 1; const int N = (1 << 17) + 1; int degree[N], xr[N]; int n; void inp() { cin >> n; for (int i = 0; i... |
//
// Copyright (c) 2000 Stephen Williams ()
//
// 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)
// ... |
/**
* bsg_nonsynth_mem_1rw_sync_assoc.v
*
* bsg_mem_1rw_sync implementation using associative array.
*
* This is for simulating arbitrarily large memories.
*
*/
`include "bsg_defines.v"
module bsg_nonsynth_mem_1rw_sync_assoc
#(parameter `BSG_INV_PARAM(width_p)
, parameter `BSG_INV_PARAM(addr_width_p)... |
/* This file is part of JT12.
JT12 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.
JT12 is distributed in the hope tha... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 5; string name[maxn], s; vector<int> G[maxn]; int tot, a[maxn], maxd, dep[maxn]; int dfs(int &p, int d) { maxd = max(maxd, d); int ret = ++tot; dep[ret] = d; while (s[p] != , ) { name[ret].push_back(s[p++]); } ... |
/*
Copyright (c) 2019 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,... |
#include <bits/stdc++.h> using namespace std; int a[105]; int n, k; char s[105]; int main(void) { int i, j, x, y, z; scanf( %d %d , &n, &k); scanf( %s , s); x = 0; for (i = 0; i < s[i]; i++) { a[x++] = s[i] - a + 1; } sort(a, a + n); x = 1; y = a[0]; z = 0; ... |
//Com2DocHDL
/*
:Project
FPGA-Imaging-Library
:Design
FrameController2
:Function
Controlling a frame(block ram etc.), writing or reading with counts.
For controlling a BlockRAM from xilinx.
Give the first output after mul_delay + 2 + ram_read_latency cycles while the input enable.
:Module
Main module
:Version
1.0
... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5; int n, k, cnt[111111], a[111111], mxx, prime[111111], ct, mx[111111], cnr; long long cur, ans, ts, fuck, fk; bool f, fl[111111]; void Init() { for (int i = 2; i <= maxn; i++) { if (!fl[i]) { prime[++ct] = 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... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: iop_fpga.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
/... |
// -*- Mode: Verilog -*-
// Filename : equation_sum.v
// Description : Equation Sum
// Author : Philip Tracton
// Created On : Wed Jan 13 16:03:27 2016
// Last Modified By: Philip Tracton
// Last Modified On: Wed Jan 13 16:03:27 2016
// Update Count : 0
// Status... |
#include <bits/stdc++.h> using namespace std; long long dp[5000010], f[5000010]; int main() { long long t, l, r, i, j, a, b, mod, ans, k = 1, final = 0; mod = 1e9 + 7; scanf( %lld %lld %lld , &t, &l, &r); for (i = 2; i <= r; i++) { if (dp[i] == 0) { for (j = i; j <= r; j += i) ... |
// Copyright (c) 2014 Takashi Toyoshima <>.
// All rights reserved. Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
module SerialTransmitter(
clk_x4,
rst_x,
i_data,
i_valid,
o_tx,
o_busy,
o_error);
input clk_x4;
input r... |
#include <bits/stdc++.h> long long expow(long long a, long long b, long long p) { long long v = 1; for (; b; b >>= 1, a = a * a % p) if (b & 1) v = v * a % p; return v; } long long inv(long long a, long long p) { return expow(a, p - 2, p); } using namespace std; const int N = 1000 + 11; co... |
/**
* 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 ba... |
#include <bits/stdc++.h> using namespace std; using uint = unsigned int; using ll = long long; using ull = unsigned long long; template <class T = ll> constexpr T TEN(int n) { return (n == 0) ? 1 : 10 * TEN<T>(n - 1); } ll calc(string s) { int n = int(s.size()); if (n == 1) { if (s[0] ... |
#include <bits/stdc++.h> using namespace std; int v[1010][1010], v1[1010][1010], tip[100], n, m; char sir[2010][1010], sir1[2010][1010]; void transpune() { for (int i = 1; i < 2 * m; i++) if (i % 2) for (int j = 1; j < n; j++) sir1[i][j] = sir[2 * j][i / 2 + 1]; else for (int j =... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; cin >> s; int a[n], i, j, k, cnt = 1e9, tmp = 0; for (i = 0; i < n; i++) cin >> a[i]; for (i = 0; i < s.size() - 1; i++) { if (s[i] == R && s[i + 1] == L ) { tmp = (a[i + 1] - a[i]) / 2... |
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 10, P = 998244353; const double Pi = acos(-1); inline int read() { int x = 0, f = 1, ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) x = x * 10 + c... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 13:06:52 06/28/2009
// Design Name:
// Module Name: dcm
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// R... |
#include <bits/stdc++.h> using namespace std; const int MOD = 998244353; vector<vector<int>> edges; long long DP[200010]; long long fac[200010]; void solve(const int u, const int p) { DP[u] = 1; int tot = 0; for (auto& e : edges[u]) { if (e != p) { tot++; solve(e, u); ... |
//rgmii-gmii,gmii-139,rx check,rx gen
`timescale 1ns/1ns
module sfp_rx_tx_1000(
clk,
sfp_clk,
reset,
gmii_rx_clk,
gmii_tx_clk,
sfp_rxp,
sfp_txp,
l_link_sfp,
r_act_sfp,
crc_data_valid,//rx data fifo
crc_data,
pkt_usedw,
pkt_valid_wrreq,
... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t; cin >> t; while (t--) { int n, max = 0, count1 = 0; cin >> n; vector<int> v; for (int i = 0; i < n; i++) { int x; cin >> x; ... |
#include <bits/stdc++.h> const int INF = 0x3f3f3f3f; const int MAXN = 1e3 + 10; using namespace std; char str[MAXN][MAXN]; int data[MAXN]; int main() { int n, m; cin >> n >> m; for (int i = 0; i < n; i++) cin >> str[i]; for (int i = 0; i < m; i++) cin >> data[i]; long long ans = 0; f... |
#include <bits/stdc++.h> using namespace std; int n, a[1111][1111]; int main() { scanf( %d , &n); for (int i = 0; i < n - 1; i++) for (int j = 0; j < n - 1; j++) a[i][j] = 1 + (i + j) % (n - 1); for (int i = 0; i < n - 1; i++) a[n - 1][i] = a[i][n - 1] = a[i][i], a[i][i] = 0; for (int ... |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: font.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// =======================... |
#include <bits/stdc++.h> #pragma comment(linker, /stack:200000000 ) #pragma GCC optimize( unroll-loops ) using namespace std; template <class T> inline T bigmod(T p, T e, T M) { long long ret = 1; for (; e > 0; e >>= 1) { if (e & 1) ret = (ret * p) % M; p = (p * p) % M; } return (... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2009-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... |
#include <bits/stdc++.h> using namespace std; char oda[3500]; int y; void PuLe(int x) { int j; j = x; while (oda[j - 1] == . ) { oda[j - 1] = @ ; j--; } if (oda[j - 1] == R ) { if ((x - j) % 2 != 0) oda[x - ((x - j) / 2 + 1)] = . ; } } void PuRi(int x) { int... |
#include <bits/stdc++.h> using namespace std; int main() { int t, n; cin >> t; for (int l = 0; l < t; l++) { cin >> n; int k; k = 0; int c; c = 0; char arr[n][5]; for (int i = 0; i < n; i++) { for (int j = 0; j < 5; j++) { cin >> arr[i][j]; ... |
module constmuldivmod(input [7:0] A, input [5:0] mode, output reg [7:0] Y);
always @* begin
case (mode)
0: Y = A / 8'd0;
1: Y = A % 8'd0;
2: Y = A * 8'd0;
3: Y = A / 8'd1;
4: Y = A % 8'd1;
5: Y = A * 8'd1;
6: Y = A / 8'd2;
7: Y = A % 8'd2;
8: Y = A * 8'd2;
9: Y = A / 8'd4;
10: Y =... |
#include <bits/stdc++.h> #pragma GCC optimize(2) using namespace std; namespace IO_Optimization { inline int read() { int X = 0, w = 0; char ch = 0; while (!isdigit(ch)) { w |= ch == - ; ch = getchar(); } while (isdigit(ch)) { X = (X << 3) + (X << 1) + (ch ^ 48); ch ... |
#include <bits/stdc++.h> using namespace std; using uint = unsigned; using ll = long long; using ull = unsigned long long; using vi = vector<int>; using vvi = vector<vi>; using vl = vector<ll>; using vvl = vector<vl>; using vd = vector<double>; using vvd = vector<vd>; using vs = vector<string>; ... |
//#############################################################################
//# Function: CRC combinatorial encoder wrapper #
//#############################################################################
//# Author: Andreas Olofsson #
... |
// (C) 2001-2015 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated doc... |
#include <bits/stdc++.h> using namespace std; int main() { vector<long long> v; set<long long> myset; set<long long>::iterator it; long long n, k, q, t; map<long long, int> mp; cin >> n >> k; for (long long i = 0; i < n; i++) { scanf( %I64d , &t); v.push_back(t); myset.... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 23:13:57 01/01/2017
// Design Name:
// Module Name: Random
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// ... |
#include <bits/stdc++.h> using namespace std; int main() { long long i, a[3333]; int t, n; cin >> t; while (t--) { cin >> n; for (i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); long long x; x = a[0] * a[n - 1]; int flag = 1, ans = 0; for (i = 0; i < n; 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... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2016/05/24 21:00:31
// Design Name:
// Module Name: D_ff_with_ce_and_synch_reset_behavior_tb
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
/... |
#include <bits/stdc++.h> using namespace std; int arr[10005]; bool readl[10005]; int read_pages(int ini) { int curr = ini; readl[ini] = 1; while (curr != arr[curr]) { curr = arr[curr]; readl[curr] = true; } return curr; } int main() { int n; cin >> n; for (int i =... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; template <class T> inline T bigmod(T p, T e, T M) { if (e == 0) return 1; if (e % 2 == 0) { long long t = bigmod(p, e / 2, M); return (T)((t * t) % M); } return (T)(((long long)bigmod(p, e - 1, M) * (long long)(p)) % M); } template <cla... |
#include <bits/stdc++.h> using namespace std; int main() { string a, b, c; bool yes = true; int length, i; cin >> a >> b; length = a.length(); for (i = 0; i < length; i++) { if (a[i] < b[i]) { yes = false; break; } } if (yes == false) { cout << -1 <<... |
//-------------------------------------------------------------------
//-- mpres_tb.v
//-- Banco de pruebas para los prescalers multiples
//-------------------------------------------------------------------
//-- BQ August 2015. Written by Juan Gonzalez (Obijuan)
//------------------------------------------------------... |
#include <bits/stdc++.h> using namespace std; bool isPrime(int N) { for (int i = 2; i * i <= N; ++i) { if (N % i == 0) return false; } return true; } bool sortinrev(const pair<int, int> &a, const pair<int, int> &b) { return (a.first > b.first); } int gcd(int a, int b) { if (b == 0)... |
#include <bits/stdc++.h> using namespace std; auto start = std::chrono::system_clock::now(); inline void skj() { std::chrono::time_point<std::chrono::system_clock> end; end = std::chrono::system_clock::now(); std::chrono::duration<double> elapsed_seconds = end - start; std::time_t end_time = std::... |
#include <bits/stdc++.h> using namespace std; long long mod = 1000000007; long long max(long long a, long long b) { return a > b ? a : b; } bool r(long long p1, long long p2) { return (p2 < p1); } long long min(long long a, long long b) { return a < b ? a : b; } long long gcd(long long a, long long b) { ... |
module tb;
import "DPI-C" context task c_main();
export "DPI-C" task read;
`include "parameter.v"
// System Signals
reg ACLK;
reg ARESETN;
// Slave Interface Write Address Ports
reg [C_S_AXI_ID_WIDTH-1 : 0] S_AXI_AWID;
reg [C_S_AXI_ADDR_WIDTH-1 : 0] S_AXI_AWADDR;
reg [8-1 ... |
/*
* HIFIFO: Harmon Instruments PCI Express to FIFO
* Copyright (C) 2014 Harmon Instruments, 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
* (a... |
/**
* This is written by Zhiyang Ong
* and Andrew Mattheisen
*/
// Design of the pipe
module pipeline_buffer (in,out,clock,reset);
// Output signal for the design module
output out; // Output data signal
// Input signals for the design module
input in; // Input data signal
input clock; // Input cl... |
/*
* 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 <vector> #include <iostream> #include <algorithm> #include <string> #include <cmath> #include <map> #define ll long long using namespace std; int main() { ll t; cin >> t; while (t--) { ll n, m; cin >> n >> m; string s; vector<ll>... |
#include <bits/stdc++.h> using namespace std; vector<int> graph[200002]; int visited[200002], sub[200002]; int subsize(int root) { visited[root] = 1; for (int child : graph[root]) { if (!visited[child]) sub[root] += subsize(child); } return sub[root]; } void destroy(int root, int par) ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; const int Maxn = 500010; const int inf = 2147483647; const double pi = acos(-1.0); int read() { int x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <=... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, ans, final = 0, play = 0, study = 0, big, small, i, j; cin >> n >> m; int a[n + 1]; for (i = 1; i <= n; i++) { cin >> a[i]; if (a[i] == 1) { study++; } else { play++; } } for (i = 1; ... |
#include <bits/stdc++.h> using namespace std; int main() { char s[3]; cin >> s; int a; char b; b = s[0]; a = s[1]; if ((b == a || b == h ) && (a == 1 || a == 8 )) cout << 3; else if ((b == a || b == h ) && (a > 1 && a < 8 )) cout << 5; else if ((a == 1 |... |
/* wb_cdc. Part of wb_intercon
*
* ISC License
*
* Copyright (C) 2016 Olof Kindgren <>
*
* 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.
*
* ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k, m = 1e9 + 7; cin >> n >> k; int a[100005]; a[0] = 1; for (int i = 1; i < 100005; ++i) { if (i >= k) { a[i] = (a[i - k] + a[i - 1]) % m; } else { a[i] = a[i - 1]; } } for (int i = 1; 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... |
/***************************************************************************************************
** fpga_nes/hw/src/cpu/sprdma.v
*
* Copyright (c) 2012, Brian Bennett
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the fol... |
//========================================================================================
//============================= SCRAMLBER =============================
//========================================================================================
module scrambler #
(
parameter TX_DATA_WI... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.