text stringlengths 59 71.4k |
|---|
module top (
input wire clk,
input wire rx,
output wire tx,
input wire [15:0] sw,
output wire [15:0] led
);
RAM64X1D #(
.INIT(64'b00000000_00000000_00000000_00000000_00000000_00000000_00000000_00000010)
) ram3 (
.WCLK (clk),
.A5 (sw[5]),
.A4 (sw... |
#include <bits/stdc++.h> using namespace std; struct Query { int p, s, id; bool operator<(const Query &b) const { return (s < b.s); } }; int main() { int n; scanf( %d , &n); vector<int> a(n); for (int i = 0; i < n; ++i) scanf( %d , &a[i]); int m; scanf( %d , &m); vector<Query... |
#include <bits/stdc++.h> using namespace std; int main() { int n, a[3] = {0}; cin >> n; while (n--) { cin >> a[0] >> a[1] >> a[2]; sort(a, a + 3); int ans = 0; if (a[0] > 0) { ans++; a[0]--; } if (a[1] > 0) { ans++; a[1]--; } ... |
/* Creater : ANSHUMAN MISHRA All Losses In this World Are Due To Lack Of Ability. If You Want To Curse Someone , Curse Your Own Weakness */ #include <bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int,int> #define yes cout<< YES n #define no cout<< NO n ... |
//date:2016/3/11
//engineer:ZhaiShaoMin
//module name :regflie
module core_id_regfile(//input
clk,
rst,
raddr1,
raddr2,
rf_write,
waddr,
data,
... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; void solve() { int n, k; cin >> n >> k; string s; cin >> s; set<char> st; for (auto i : s) st.insert(i); if (k > n) { string p = s; char ch = *st.begin(); for (int i = 0; i < k - n; i++) { ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; const int MOD = 1000000007; int bcj[200010], siz[200010]; stack<pii> res; void init(int n) { for (int i = (0); i < (n + 2); i++) bcj[i] = i, siz[i] = 1; } int groot(int n) { return (bcj[n] == n) ? n : g... |
#include <bits/stdc++.h> using namespace std; const long long K = 10000000000LL; vector<long long> L; void init(long long crr) { if (crr > K) return; if (crr != 0) L.push_back(crr); init(crr * 10 + 4); init(crr * 10 + 7); } bool is_lucky(long long x) { if (x == 0) return false; while... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 7, maxm = 35 * maxn; int nxt[maxm][2], tot, a[maxn]; long long ans = 0; void ins(int x) { int now = 0; for (int i = 29; i >= 0; i--) { int go = (x >> i) & 1; if (nxt[now][go] == 0) nxt[now][go] = ++tot; now = nxt[no... |
// Accellera Standard V2.3 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2008. All rights reserved.
`include "std_ovl_defines.h"
`module ovl_memory_async (reset, enable, start_addr, end_addr, ren, raddr, rdata, wen, waddr,
wdata, fire);
parameter severity_level = `OVL... |
/*
* 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; struct cell { bool up, down, right, left; int degree; cell() { up = down = left = right = degree = 0; } void reset() { up = down = left = right = degree = 0; } }; struct qcell { int x, y, degree; qcell() { x = y = -1; degree = 0; ... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } long long lcm(long long a, long long b) { return a / gcd(a, b) * b; } long long n, s1, v1, s2, v2; long long i, j, k, ans, p, q, m, num; inline long long cal_1() { return i * v1 + (n ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int t = 1; while (t--) { string s; cin >> s; long long int a, b; cin >> a >> b; long long int n = s.length(); vector<long long int> v1(n... |
#include <bits/stdc++.h> using namespace std; inline char gc() { static char buf[1 << 14], *p1 = buf, *p2 = buf; return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 1 << 14, stdin), p1 == p2) ? EOF : *p1++; } inline long long read(long long &x) { x = 0; bool f = 1; ... |
#include <bits/stdc++.h> using namespace std; int dp[2010][2010]; int main() { int n, h, i; scanf( %d%d , &n, &h); dp[0][0] = 1; for (i = 1; i <= n; i++) { int x; scanf( %d , &x); x = h - x; if (x < 0) { printf( 0 n ); return 0; } if (x >= 1) { ... |
#include <bits/stdc++.h> using namespace std; const int INF = 1000000000 + 5; const int N = 2e5 + 5; const long long oo = 1e18 + 5; const long long mod = 998244353; int a[N], b[N]; int mul(int a, int b) { return 1ll * a * b % mod; } void solve() { int n, k; cin >> n >> k; vector<int> pos(n +... |
#include <bits/stdc++.h> int main() { int n, m, a, b, t; while (scanf( %d%d%d%d , &n, &m, &a, &b) != EOF) { if (b == n) b = (n - 1) / m * m + m; a--; b--; if (a > b) while (1) ; if (a / m == b / m || m == 1) t = 1; else if (a % m == 0) { if... |
#include <bits/stdc++.h> using namespace std; vector<int> vec, ves; int main() { int n, m, f = 0, w = 0; bool p = false, t = false; cin >> n; for (int i = 0; i < n; i++) { cin >> m; if (m == 0) t = true; for (int j = 0; j < vec.size(); j++) { p = false; if (m == v... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 13:07:09 11/04/2015
// Design Name:
// Module Name: KeyBoardControler
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependenci... |
#include <bits/stdc++.h> using namespace std; int ans[200005]; int roots[105]; struct node { int l, r; } tree[200005 * 20]; int cnt = 0; void build(int &x, int pos, int l, int r) { if (!x) x = ++cnt; if (l == r) return; int mid = (l + r) >> 1; if (pos <= mid) build(tree[x].l, pos... |
/**
* 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; bool cmp(double a, double b) { return a > b; } int n; double a[110], x, sum, ans; int main() { scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %lf , &a[i]); sort(a, a + n, cmp); ans = 0; for (int i = 1; i <= n; i++) { sum = 0; f... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
// Generator : SpinalHDL v1.1.5 git head : 0310b2489a097f2b9de5535e02192d9ddd2764ae
// Date : 02/12/2018, 10:37:58
// Component : AsyncReceiver
module Fifo (
input [7:0] io_dataIn,
output [7:0] io_dataOut,
input io_read,
input io_write,
output io_full,
outp... |
#include <bits/stdc++.h> using namespace std; int prime(int n) { if (n == 1) { return 0; } for (int i = 2; i * i <= n; i++) { if (n % i == 0) { return 0; } } return 1; } int main() { int n; cin >> n; int cnt = n; while (!prime(cnt)) { cnt++; ... |
#include <bits/stdc++.h> using namespace std; int n, m; int main() { cin.tie(0); ios_base::sync_with_stdio(0); cin >> n >> m; int finalPos[4 * n]; memset(finalPos, -1, sizeof(finalPos)); for (int i = (2 * n) + 1, j = 0; i <= m; i++, j += 2) { finalPos[j] = i; } for (int i = 1... |
#include <bits/stdc++.h> using namespace std; int dx[10] = {1, -1, 0, 0}; int dy[10] = {0, 0, 1, -1}; const long long mod = 1e9 + 7; long long cur; long long tich = 1; vector<int> G[300005]; int n, h, m; int a[105][105]; int b[105][105]; int ans; int main() { cin >> n >> m; for (int i = ... |
/////////////////////////////////////////////////////////////
// Created by: Synopsys DC Ultra(TM) in wire load mode
// Version : L-2016.03-SP3
// Date : Sun Nov 20 02:52:15 2016
/////////////////////////////////////////////////////////////
module GDA_St_N8_M8_P3 ( in1, in2, res );
input [7:0] in1;
input [... |
`include "constants.vh"
`include "alu_ops.vh"
`default_nettype none
module exunit_alu
(
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,
... |
/**
* 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 main() { int a, b, c; while (~scanf( %d%d%d , &a, &b, &c)) { int max = 999999999; int a1 = (c + b) + a; max = max < a1 ? max : a1; int a2 = 2 * (c + b); max = max < a2 ? max : a2; int b1 = (c + a) * 2; max = max < b1 ? max : b1; int ... |
#include <bits/stdc++.h> int main() { int n, m, i, a; int f[105] = {0}; scanf( %d%d , &n, &m); while (m--) { scanf( %d , &a); for (i = a; i <= n; i++) if (f[i] == 0) f[i] = a; } for (i = 1; i < n; i++) printf( %d , f[i]); printf( %d n , f[n]); return 0; } |
#include <bits/stdc++.h> using namespace std; constexpr int N = 3e3 + 1; int a[N], dp[N][N], nxt[N], prv[N], lst[N]; int main() { cin.tie(0), ios::sync_with_stdio(0); int t, n; cin >> t; while (t--) { cin >> n; for (int i = 0; i < n; ++i) { cin >> a[i], --a[i]; } ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2016/06/11 20:22:04
// Design Name:
// Module Name: fb_count
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revi... |
#include <bits/stdc++.h> using namespace std; const int sz = 5005; const int mod = 998244353; long long int n, a[sz], b[sz], dp[15][1005][1005], c[sz], d[sz], m, c0, d0; long long int dipi(int i, int cnt, int rem) { if (rem > n) return -100000; if (i > m) return 0; if (~dp[i][cnt][rem]) return dp[... |
#include <bits/stdc++.h> using namespace std; long long res = 1; long long countn = 1; void solve(long long a[], long long n) { if (n == 0) { res = max(countn, res); cout << res; } else if (a[n] >= a[n - 1]) { countn++; solve(a, n - 1); } else { res = max(countn, res); ... |
//*****************************************************************************
// (c) Copyright 2009 - 2013 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
/... |
/*
* 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 inf = 1000000007; int d[210][210][510][2]; short vis[210][210][510][2]; int q, n, k, b, cas; int nex[210][22], out[210]; int fal[210]; int s[210]; int dp(int pos, int len, int w, int m) { w = min(w, k + 5); if (vis[pos][len][w][m] == cas)... |
#include <bits/stdc++.h> using namespace std; void mohammed() { ios::sync_with_stdio(0); ios_base::sync_with_stdio(0); cin.tie(0), cout.tie(0); } int main() { mohammed(); int n, x, y; cin >> n; map<int, int> mp; map<int, int>::iterator it; for (int i = 0; i < n; i++) { ... |
#include <bits/stdc++.h> using namespace std; int trie[64 * 100005][2], uni; inline long long int bin_to_int(vector<long long int> vt) { long long int ans = 0, hudai = 1; while (vt.size()) { ans += (hudai * vt[vt.size() - 1]); hudai *= 2; vt.pop_back(); } return ans; } inline... |
/**
* 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; long long int n, k; vector<long long int> v[100005]; vector<long long int> res; long long int ares[100005]; long long int was[100005]; int dfs(long long int ind, long long int c) { if (c > 100005) { return -1; } if (ares[ind]) return 1; i... |
#include <bits/stdc++.h> using namespace std; int main() { double eps = 1e-12; double y1, y2, yw, xb, yb, r; cin >> y1 >> y2 >> yw >> xb >> yb >> r; double yk = yw - r; double yt = y1 + r; double d1 = yk - yt; double d2 = yk - yb; double xk = xb * d1 / (d2 + d1); double A = yt - ... |
#include <bits/stdc++.h> using namespace std; int main() { int i, j, m, k, t, cs, n, mx, v; scanf( %d , &n), scanf( %d , &m); int cnt = 0, ppl = 0; for (i = 1; i <= n; i++) { scanf( %d , &v); if (ppl + v <= m) ppl += v; else { cnt++; ppl = v; } } ... |
#include <bits/stdc++.h> using namespace std; using lint = long long; bool has(int s, int x) { int i = s / 50 % 475; for (int ii = (0); ii < int(25); ++ii) { i = (i * 96 + 42) % 475; if (i + 26 == x) { return true; } } return false; } void solve(istream& cin, ostream&... |
`timescale 1 ns / 1 ns
//////////////////////////////////////////////////////////////////////////////////
// Company: Rehkopf
// Engineer: Rehkopf
//
// Create Date: 01:13:46 05/09/2009
// Design Name:
// Module Name: address
// Project Name:
// Target Devices:
// Tool versions:
// Description: Address logic w/ 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; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int TESTS = 1; while (TESTS--) { vector<pair<int, int>> v; int i, a, b, index = 0, dp[1000005] = {0}, ans = INT_MIN, n; cin >> n; for (long long int i = 0... |
#include <bits/stdc++.h> using namespace std; int n, q, step[1000000]; long long a[2 * 1000000], pref[2 * 1000000 + 1]; int calcLen(int strt) { int curr = strt, res = 0; while (curr < strt + n) curr += step[curr % n], res++; return res; } int main() { ios::sync_with_stdio(0); cin.tie(0);... |
//------------------------------------------------------------------
// Dual port memory (one read and one write port, same width)
//------------------------------------------------------------------
module dp_ram #(
parameter adr_width = 13,
parameter dat_width = 16,
parameter mem_file_name = "none"
) (
... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////
//
// This file is part of Descrypt Ztex Bruteforcer
// Copyright (C) 2014 Alexey Osipov <giftsungiv3n at gmail dot com>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of ... |
#include <bits/stdc++.h> using namespace std; map<string, int> a; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; while (n--) { int temp_val; string temp_s; cin >> temp_val >> temp_s; sort(temp_s.begin(), temp_s.end()); if (a[te... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:100000000000000 ) using namespace std; int n; double a[500001], b[500001], p, q; string st; double calc(double y1) { double y2 = 1.; for (int i = 0; i < n; i++) { y2 = min(y2, (1. - (a[i] * y1)) / b[i]); } double ret = p * y1 + q... |
`timescale 1ns / 100ps
module sasc_brg(/*AUTOARG*/
// Outputs
sio_ce, sio_ce_x4,
// Inputs
clk, arst_n
);
output sio_ce; // baud rate
output sio_ce_x4; // baud rate x 4
input clk;
input arst_n;
reg sio_ce;
reg sio_c... |
////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2014, University of British Columbia (UBC); All rights reserved. //
// //
// Redistribution and use in source and binary forms, w... |
// Arbitrary-sized RAM.
//
// Both Lattice and Synopsis do not seem
// to be capable of infering cascaded BRAMs
// out-of-the-box, hence the mess below.
module ram #(
parameter WIDTH = 16,
parameter ADDR_WIDTH = 8
) (
input [WIDTH - 1:0] din,
input wire [ADDR_WIDTH - 1:0] addr,
input wire write_en,
input c... |
#include <bits/stdc++.h> using namespace std; int main() { cin.sync_with_stdio(0); int t; cin >> t; string p, h; while (t--) { cin >> p >> h; int n = p.size(); int cnt[26]; memset(cnt, 0, sizeof cnt); for (int i = 0; i < n; i++) cnt[p[i] - a ]++; int m = h.si... |
`timescale 1ns / 1ps
// UART wants the LSB first
// RX modified to accept 40 MHz clock and receive at 115200 bps
// Note 40e6 / 115200 = and 347.2 / 2 = 173.6 ~= 174 cycles
// For 460800
// 40e6 / 460800 = 86.8 and 86.8 / 2 =~= 43
// For 230400
// 40e6 / 230400 = 173.6 and 173.6/2 = 86.8
// Modified for 460800 ... |
/**
* 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) 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... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: scfifo
// ============================================================
// File Name: fifo_144x256.v
// Megafunction Name(s):
// scfifo
//
// Simulation Library Files(s):
// altera_mf
// ==============================... |
#include <bits/stdc++.h> using namespace std; long long n, memo[100001]; vector<long long> a; long long x; long long rek(int pos) { long long &ret = memo[pos]; if (ret != -1) return ret; ret = rek(pos - 1) + 20; x = upper_bound(a.begin(), a.end(), a[pos] - 90) - a.begin(); if (x) ret... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast,no-stack-protector,unroll-loops,fast-math ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4.1,sse4.2,avx,avx2,popcnt,tune=native ) using namespace std; int n, m, k, ct[200010], cnt; vector<pair<int, int> > e[200010]; vector<int> mp[200010]; char bf... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long N; cin >> N; vector<long long> V; long long Sum = N; for (long long i = 0; i < N; i++) { long long X; cin >> X; V.push_back(X); } long long L = ... |
#include <bits/stdc++.h> using namespace std; long long power(long long a, long long n, long long lelo) { if (n == 0) return 1; if (n == 1) return a; if (n == 2) return (a * a) % lelo; if (n % 2) return (a * power(a, n - 1, lelo)) % lelo; else return power(power(a, n / 2, lelo), 2, l... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// are... |
#include <bits/stdc++.h> using namespace std; int t, pos, ans; string s; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> t; while (t--) { cin >> s; ans = pos = 0; s += R ; for (int i = 0; i < s.size(); i++) { if (s[i] == R ) { ... |
module nh_lcd_command (
input rst,
input clk,
output [31:0] debug,
//Control Signals
input i_cmd_write_stb,
input i_cmd_read_stb,
input [7:0] i_cmd_data,
output reg [7:0] o_cmd_data,
input i_enable,
input ... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2018 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
//
/... |
#include <bits/stdc++.h> using namespace std; int main() { int n, r = 0; cin >> n; string s; cin >> s; for (int i = 0; i < n - 1; i++) { if (s[i] == s[i + 1]) r++; } cout << r; return 0; } |
#include <bits/stdc++.h> using namespace std; template <typename T> inline bool chkmin(T &a, const T &b) { return b < a ? a = b, 1 : 0; } template <typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; } const int oo = 0x3f3f3f3f; const int maxn = 1000100; int n; ... |
#include <bits/stdc++.h> using namespace std; int n, cnt, a[2010], b[2010], bel[2010], ans[2010 * 2010 / 2][2]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); for (int i = 1; i <= n; i++) { scanf( %d , &b[i]); bel[b[i]] = i; } for (int i = 1; i <= n;... |
#include <bits/stdc++.h> using namespace std; int main() { vector<int> vec1, vec2, vec3; int n, sz; cin >> n; for (int i = 1; i <= n; ++i) { int x; cin >> x; if (x == 1) vec1.push_back(i); else if (x == 2) vec2.push_back(i); else vec3.push_back(i... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; string l = 312931303130313130313031 ; string input = ; string s = 312831303130313130313031 ; string s1 = s + s + s; string s2 = l + s + s; string s3 = s + l + s; string s4 = s + s + l; l... |
//
// Module: Dummy switch to debug verification environment
// Author: Lianghao Yuan
// Email:
// Date: 06/25/2015
// Copyright (C) 2015 Lianghao Yuan
//
// Usage: change the name of this file to switch.v. Notice, this is
// just a simple file to test the overall connection as well as driver /
// receiver be... |
#include <bits/stdc++.h> using namespace std; int pow(int a, int k) { if (k == 0) return 1; int r = pow(a, k / 2); if (k % 2 == 0) return r * r; return r * r * a; } int main() { int n, ans = 1; scanf( %d , &n); for (int i = 1; (pow(2, i) - 1) * pow(2, i - 1) <= n; i++) { int v ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2013.
// SPDX-License-Identifier: CC0-1.0
module t
(
input logic clk,
input logic daten,
input logic [8:0] datval,
output logic signed [3:0][3:0][35:0] datao
... |
module Abc_TEST ();
/*AUTOWIRE*/
// Beginning of automatic wires (for undeclared instantiated-module outputs)
logic [5:0] [31:0] abc; // From u_Def of Def.v
// End of automatics
Abc #(
.No1 (6),
/*AUTOINSTPARAM*/
// Parame... |
// Code your testbench here
// or browse Examples
module tb_cpu;
reg clk;
wire [31:0] addr;
wire[31:0] instruction;
wire[1:0] cu_regdst;
wire cu_jump, cu_branch, cu_memread;
wire [1:0] cu_memtoreg;
wire[1:0] cu_aluop;
wire cu_memwrite, cu_aluscr, cu_regwrite;
wire[4:0] mux1_regwrite;
... |
(* -*- coding: utf-8 -*- *)
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2011 *)
(* \VV/ ********************************************************... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, a, b, x1, y1, x2, y2, d1, d2, r1 = 10000000000000000, r2 = 10000000000000000, ans; ans = r2; r1 *= -1; r2 = r1; vector<pair<long long, pair<long long, long long> > > v1, v2; ... |
#include <bits/stdc++.h> using namespace std; void fun() { int n, k; cin >> n >> k; map<string, int> m; string s; string a[n]; for (int i = 0; i < n; i++) { cin >> s; a[i] = s; m[s]++; } int c = 0; for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++... |
/**
* bsg_serial_in_parallel_out_dynamic.v
*
* Paul Gao 06/2019
*
*/
`include "bsg_defines.v"
module bsg_serial_in_parallel_out_dynamic
#(parameter `BSG_INV_PARAM(width_p )
,parameter `BSG_INV_PARAM(max_els_p )
,parameter lg_max_els_lp = `BSG_SAFE_... |
#include <bits/stdc++.h> using namespace std; void input(long long ara[], long long n) { for (long long i = 0; i < n; i++) cin >> ara[i]; } void output(long long ara[], long long n) { for (long long i = 0; i < n; i++) cout << ara[i] << ; } long long mx1(long long ara[], long long n) { long lo... |
#include <bits/stdc++.h> using namespace std; const int M = 1e9 + 7; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; int ans = 1; for (int i = 2; i <= n; ++i) { ans = 1LL * ans * i % M; } int two = 1; for (int i = 1; i < n; ++i) { t... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; const long long INFLL = 2e18; const int MOD = 1e8 + 7; const int N = 4e5 + 10; int fx[8] = {+0, +0, +1, -1, +1, +1, -1, -1}; int fy[8] = {+1, -1, +0, +0, +1, -1, +1, -1}; int timer; int used[N]; int tin[N], low[N]; char bridge; v... |
///////////////////////////////////////////////////////////////////////////////
//
// File name: axi_protocol_converter_v2_1_7_b2s_wr_cmd_fsm.v
//
///////////////////////////////////////////////////////////////////////////////
`timescale 1ps/1ps
`default_nettype none
(* DowngradeIPIdentifiedWarnings="yes" *)
module a... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of inst_ecc_e
//
// Generated
// by: wig
// on: Mon Apr 10 13:27:22 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -nodelta ../../bitsplice.xls
//
// !!! Do not edit this file! Autogenerated by MIX... |
#include <bits/stdc++.h> using namespace std; const int INF = INT_MAX; const long long INFL = LLONG_MAX; int N, M, X[1000], a, b, c; int main() { ios_base::sync_with_stdio(0); cout.precision(15); cin >> N >> M; for (int(i) = 1; (i) <= (N); (i)++) cin >> X[i]; long double answer = 0; fo... |
//==============================================================================
// File: $URL: svn+ssh:///public/Projects/GateLib/branches/dev/Publications/Tutorials/Publications/EECS150/Labs/ChipScopeSerial/Framework/Reverse.v $
// Version: $Revision: 26904 $
// Author: Greg Gibeling (http://www.gdgib.com)
// Copyr... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 5; const double eps = 1e-8; const int INF = 0x3f3f3f3f; const int mod = 1e9 + 7; const int seed = 131; int n, a[maxn], q; struct node { int l, r, sum, lazy; } Q[maxn << 2]; void build(int rt, int l, int r) { Q[rt].l = l, Q[... |
/**
* 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 <typename T> ostream& operator<<(ostream& stream, const pair<T, T>& p) { return stream << ( << p.first << , << p.second << ) ; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int T; cin >> T; while (T--) { ... |
#include <bits/stdc++.h> int main(int argc, char const *argv[]) { int n, a, b; while (scanf( %d%d%d , &n, &a, &b) != EOF) printf( %d n , (n - a) < (b + 1) ? (n - a) : (b + 1)); return 0; } |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: ccx_arb_srcq.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/... |
#include <bits/stdc++.h> using namespace std; int main() { char c[51]; int n; scanf( %s , c); scanf( %d , &n); for (int i = 0; i < strlen(c); i++) { if (c[i] < a ) c[i] += a - A ; if (c[i] < 97 + n) c[i] += A - a ; } printf( %s , c); return 0; } |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx ) using namespace std; const int MAXN = 1e3 + 3; int n; bool dp[MAXN][10]; string s; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> s; n = (int)s.length(); s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.