text stringlengths 59 71.4k |
|---|
/*
* 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 long long N = 300100, MOD = 1e9 + 7; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } int main() { ios::sync_with_stdio(0); cout.tie(0); cin.tie(0); int n; cin >> n; vector<int> arr(n); int odd = 0, even = 0... |
#include <bits/stdc++.h> using namespace std; bool comp(pair<long long int, long long int> &a, pair<long long int, long long int> &b) { if (a.first == b.first) return a.second < b.second; return a.first > b.first; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); lo... |
////////////////////////////////////////////////////////////////////////////////
//
// Filename: skidbuffer.v
// {{{
// Project: wbuart32, a full featured UART with simulator
//
// Purpose: A basic SKID buffer.
//
// Skid buffers are required for high throughput AXI code, since the AXI
// specification requires that a... |
module scaler_2d # (
parameter integer C_SH_WIDTH = 10,
parameter integer C_SW_WIDTH = 10,
parameter integer C_MH_WIDTH = 10,
parameter integer C_MW_WIDTH = 10,
parameter integer C_LINE_BMP = 4 ,
parameter integer C_LINE_BID = 2 ,
parameter integer C_LINE_IDX = 0 , /// 0 or C_SH_WIDTH
param... |
/*
* 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... |
// picdram stands for PIC "Data" RAM.
//
//
// Synchronous Data RAM, 8 bits wide, N words deep.
//
// ** Must support SYNCHRONOUS WRITEs and ASYNCHRONOUS READs **
// This is so that we can do a Read/Modify/Write in one cycle which
// is required to do something like this:
//
// incf 0x20, f // M[20] <= M[... |
module fsm(clock,reset,start, a, b, contBETval, initCount, countVal, ab_result);
input reset, clock, start;
input signed [3:0] a,b;
input contBETval; //count bigger or equal than val
output reg initCount; //init counter
output reg [2:0] countVal;
output reg [1:0] currentState; //mudaDisplay = currentState
output reg si... |
#include <bits/stdc++.h> using namespace std; signed main() { char opr[40]; while ((~scanf( %s , opr)) && opr[0] == s ) { int x = 0, y = 1; while (1) { printf( ? %d %d n , x, y); fflush(stdout); char ans[20]; scanf( %s , ans); if (ans[0] == x ) break; ... |
#include <bits/stdc++.h> using namespace std; int dx[8] = {1, -1, 0, 0, 1, -1, 1, -1}; int dy[8] = {0, 0, -1, 1, 1, -1, -1, 1}; int n, k, f; vector<int> v; int main(void) { scanf( %d%d , &n, &k); for (int i = 0; i < n; i++) { scanf( %d , &f); v.push_back(f); } long long ans = 0; ... |
#include <bits/stdc++.h> using namespace std; template <typename T> void read(T &x) { x = 0; char ch = getchar(); long long fh = 1; while (ch < 0 || ch > 9 ) { if (ch == - ) fh = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) x = x * 10 + ch - 0 , ch = getchar(); ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 00:37:59 02/11/2016
// Design Name:
// Module Name: fifo_wrapper
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// De... |
#include <bits/stdc++.h> using namespace std; const int N = 100010; int inf = 1e9; int mod = 1e9 + 7; const int M = 20; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; cin >> s; int n = (int)s.length(); int dp[(1 << M)]; memset(dp, 0, sizeof(d... |
`timescale 1ns / 1ps
module timer_tb();
reg [31:0]clk, sum_count;
reg start, power, count_start_flag;
wire [31:0]count;
wire count_end_flag;
parameter DELAY = 10;
parameter TIME = 1000;
timer DUT (
.clk_src(clk),
.switch_power(power),
.switch_en(start),... |
/**
* 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... |
/*
* MBus Copyright 2015 Regents of the University of Michigan
*
* 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 ... |
/*
* Copyright (c) 1999 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)
* ... |
#include <bits/stdc++.h> using namespace std; int main() { int S, C = 1; cin >> S; int *N = new int[S]; for (int i = 0; i < S; i++) cin >> N[i]; sort(N, N + S); for (int i = 0; i < S; i++) if (N[i] >= C) C++; cout << C; } |
#include <bits/stdc++.h> using namespace std; long long MOD = 998244353; double eps = 1e-12; void solve() { long long n, x; cin >> n >> x; int a; map<int, int> mr; map<int, int> mc; for (int i = 0; i < n; i++) { for (int j = 0; j < x; j++) { cin >> a; if (a) { ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using pi = pair<int, int>; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); cout << setprecision(15) << fixed; int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; sort(a.be... |
// wasca_mm_interconnect_0_avalon_st_adapter_003.v
// This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 15.1 193
`timescale 1 ps / 1 ps
module wasca_mm_interconnect_0_avalon_st_adapter_003 #(
parameter inBits... |
#include <bits/stdc++.h> using namespace std; template <class U, class V> ostream& operator<<(ostream& os, const pair<U, V>& p) { os << ( << p.first << , << p.second << ) ; return os; } template <class U, class V> istream& operator>>(istream& in, pair<U, V>& p) { in >> p.first >> p.second;... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; long long int f[100010], n, a[100010]; const long long int inf = 2000000000000; int main() { long long int i, j, k; scanf( %I64d , &n); for (i = 1; i <= n; i++) { scanf( %I64d , &a[i]); } f[0] = 0; sort(a + 1, a + 1 + n); for (i = 1... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2015.4
// Copyright (C) 2015 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1 ns / 1 ps
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 law... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; priority_queue<pair<int, int> > neg; priority_queue<pair<int, int>, vector<pair<int, int> >, greater<pair<int, int> > > pos; cin >> n; int x, a; ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// Copyright 2009 by Wilson Snyder. This program is free software; you can
// redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License
// Version 2.0.
`ifdef VCS
`define NO_TIME
`endif
`... |
#include <bits/stdc++.h> using namespace std; int main() { cin.sync_with_stdio(false), cin.tie(nullptr); int tests; cin >> tests; while (tests--) { int n, k; string s; cin >> n >> k >> s; const int need = n / k; vector<vector<int>> counts(k, vector<int>(26, 0)); f... |
#include <bits/stdc++.h> using namespace std; template <typename T> void rd(T& x) { int f = 0, c; while (!isdigit(c = getchar())) f ^= !(c ^ 45); x = (c & 15); while (isdigit(c = getchar())) x = x * 10 + (c & 15); if (f) x = -x; } template <typename T> void pt(T x, int c = -1) { if (... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; inline long long read() { long long k = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { k = k * 10 + ch - 0 ; ... |
#include <bits/stdc++.h> using std::cin; using std::cout; using std::vector; using std::swap; int main() { int t; cin >> t; while (t--) { int n, x; cin >> n >> x; vector<int> a(n); for (auto& it : a) cin >> it; int cnt = 0; for (int i = 0; i < n && !is_sorted(a.begin... |
#include <bits/stdc++.h> using namespace std; void solve() { int a = 1, l = -1, r = -1; string s; for (int i = 1; i <= 30; i++) { cout << ? << (1 << i) << << (1 << (i - 1)) << endl; cin >> s; if (s == x ) { continue; } else { l = (1 << (i - 1)) + 1; ... |
#include <bits/stdc++.h> using namespace std; int n, a, b, t, k, x[(int)1e6], i; int main() { cin >> n; for (i = 0; i < n; i++) cin >> x[i]; sort(x, x + n), n = unique(x, x + n) - x; cin >> a >> b; while (a > b) { k = a - 1; for (i = 0; i < n; i++) if (a - a % x[i] < b) ... |
/**
* 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 1 ns / 10 ps
module dpram_simple(clock,
address_a, wrdata_a, wren_a, rddata_a,
address_b, wrdata_b, wren_b, rddata_b);
parameter DATA_WIDTH = 8;
parameter ADDR_WIDTH = 7;
parameter INIT_FILE = "somefile"; // No .mif!
parameter DEBUG = 0;
input ... |
#include <bits/stdc++.h> using namespace std; long long cou = 0, ans = 0, mx = INT_MIN, mn = INT_MAX, sum = 0, modu = 1e9 + 7; vector<vector<int>> from, to; vector<bool> visited(1e3, false); void dfs(int t) { visited[t] = true; for (int c = 0; c < from[t].size(); c++) { if (!visited[from[t][c]])... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, k, sum; while (cin >> n >> k) { for (int i = k; i >= 1; i--) { sum = ((n * k) / (i)) + i; if ((sum / k) * (sum % k) == n) { break; } } cout << sum << endl; } return 0; } ... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 20:30:22 03/02/2016
// Design Name: Register
// Module Name: C:/Users/Ranolazine/Desktop/Lab/lab6/test_reg_edge_read.v
// Project Name: lab6
// Target Devi... |
#include <bits/stdc++.h> using namespace std; struct edge { int v, u, w; edge() {} edge(int v, int u, int w) : v(v), u(u), w(w) {} }; const int N = 2e5 + 7; vector<pair<int, bool>> g[N]; vector<pair<int, int>> gg[N]; vector<edge> glob_ans; int color[N]; void init(int n) { for (int i = ... |
#include <bits/stdc++.h> using namespace std; string s, s1, s2, s3; int sa[300010][20], lcp[300010], rnk[300010], root[300010], cnt[300010][4], col[300010], n; pair<pair<int, int>, int> q[300010]; pair<int, pair<int, int> > lcp_pair[300010]; vector<long long> ansvec; long long ans, mod = 1e9 + 7; ... |
/*
* 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; struct point { int x, y; } q[1010 * 1010 * 4]; struct node { int next, now; } d[1010 * 1010 * 2]; int c_c[1010], c_r[1010]; int dis[1010 * 1010]; bool vis[1010 * 1010], use_r[1010], use_c[1010]; int n, m; void add_edge_col(int u, int v, int i) { ... |
// (C) 2001-2017 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 from any of the foregoing (including device programming or simulation
// files), and any associated ... |
/*
* 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)
* ... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2014 Xilinx, Inc.
// All Right Reserved.
///////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor : Xilinx
// \ \ \/ Vers... |
/**
* 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; class Solution { public: Solution(int _n) : N(_n) {} void guess(long long n, int k) { long long l = 1; long long r = n; int M = min(4LL * k, n); mt19937_64 gen(chrono::steady_clock::now().time_since_epoch().count()); string ans; ... |
/*
* Copyright 2012, Homer Hsing <>
*
* 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 law or agreed to ... |
`timescale 1ns/1ps
module tb;
`include "useful_tasks.v" // some helper tasks
reg rst_async_n; // asynchronous reset
wire req0, req1, req2;
wire ack0, ack1, ack2;
reg req0_reg;
assign req0 = req0_reg;
wire [7:0] data0;
reg [7:0] data0_reg;
wire [7:0] data1;
wire [7:0] data2;
wire [7:... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This test case is used for testing a modeule parameterized with a typed
// localparam.
//
// We find Verilator appears to mis-evaluate the parameter WIDTH as -16 when
// used in the test module to set the value of MSB. A number of warnings and
// errors follow, start... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100005; int n, p1l, p1r, p2l, p2r; string s, t, ans; int main() { ios_base::sync_with_stdio(false); cin >> s >> t; sort(s.begin(), s.end()); sort(t.begin(), t.end()); ans.resize(s.length(), 0); p1l = 0; p2r = (int)s.len... |
#include <bits/stdc++.h> using namespace std; namespace IO { void setIn(string s) { freopen(s.c_str(), r , stdin); } void setOut(string s) { freopen(s.c_str(), w , stdout); } void setIO(string s = ) { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin.exceptions(cin.failbit); ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 01/01/2017 10:56:26 AM
// Design Name:
// Module Name: paraPortAlloc_st2
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies: ... |
// (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; long long a[10] = {}; int fac[13] = {1}; inline void p(vector<int> q, vector<int> w, int cnt, long long pr) { if (q.size() == 0) { a[cnt] += pr; return; } int qq = q[q.size() - 1], ww = w[w.size() - 1]; q.pop_back(); w.pop_back(); ... |
/**
* 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 triple { int first; int second; int third; void set(int a, int b, int c) { first = a; second = b; third = c; } }; triple t[53][53][8] = {0}; int table[53][53] = {0}; void f(int a, int b, int c) { if (table[a][b] =... |
#include <bits/stdc++.h> using namespace std; int A[55], ctos, lleno; long long D[52][52][52][52]; double res = 0, suma; int main() { scanf( %d , &ctos); for (int i = 1; i <= ctos; i++) { scanf( %d , &A[i]); suma += A[i]; } scanf( %d , &lleno); for (int quien = 1; quien <= ctos... |
/**
* 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... |
/**
* 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 maxn = 400010; int c[maxn]; int ans[maxn]; void upd(int n, int k) { n++; while (n < maxn) c[n] += k, n += n & (-n); } int get(int n) { n++; int ans = 0; while (n) ans += c[n], n -= n & (-n); return ans; } int BS(int n) { ... |
#include <bits/stdc++.h> using namespace std; const long long N = 200200, M = 110, K = 30030, Inf = 1e17; void Max(long long &x, long long y) { x = max(x, y); } long long dp[4 * K]; long long a[M], b[M]; vector<pair<long long, long long>> p, neg; bool cmp(pair<long long, long long> p1, pair<long long, lon... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; int arr[200007]; map<int, bool> vis; queue<int> q; for (int i = 1; i <= n; i++) { cin >> arr[i]; if (vis[arr[i]]) continue; vis[arr[i]] = true; if (q.size() == k) { vis[q.front... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2016 by Wilson Snyder
`define check(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: Wrong parameter value", `__FILE__,`__LINE__); $stop; end while(0);
module t;
... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e4 + 5; int dp[53][maxn], mxp[53][maxn], mxs[53][maxn], n, m, a[53][maxn], k, sum[53][maxn], h1, h2, t1, t2; pair<int, int> q1[maxn], q2[maxn]; int main() { scanf( %d%d%d , &n, &m, &k); for (int i = 1; i <= n; ++i) for (int j ... |
module binary_multiplier(
input clock, reset, start,
input [7:0] multiplicand, multiplier,
output [15:0] product,
output Ready
);
wire Load_regs, Decr_P, Add_regs, Shift_regs, Nothing, Zero, Q0;
controller_bm m0(clock, reset, start, Nothing, Zero, Q0, Ready, Load_regs, Decr_P, Add_regs, Shift_regs);
datapath_bm m1(... |
/*
* Add / substract unit for Zet
* Copyright (C) 2008-2010 Zeus Gomez Marmolejo <>
*
* This file is part of the Zet processor. This processor is free
* hardware; you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by the Free Software
* Foundation; ei... |
// Copyright 2010 Altera Corporation. All rights reserved.
// Altera products are protected under numerous U.S. and foreign patents,
// maskwork rights, copyrights and other intellectual property laws.
//
// This reference design file, and your use thereof, is subject to and governed
// by the terms and condi... |
#include <bits/stdc++.h> #pragma GCC optimize(2) #pragma GCC optimize(3) #pragma GCC optimize( Ofast ) #pragma GCC optimize( inline ) #pragma GCC optimize( -fgcse ) #pragma GCC optimize( -fgcse-lm ) #pragma GCC optimize( -fipa-sra ) #pragma GCC optimize( -ftree-pre ) #pragma GCC optimize( -ftree-vrp )... |
#include <bits/stdc++.h> using namespace std; template <typename A, typename B> string to_string(pair<A, B> p); template <typename A, typename B, typename C> string to_string(tuple<A, B, C> p); template <typename A, typename B, typename C, typename D> string to_string(tuple<A, B, C, D> p); string to_str... |
#include <bits/stdc++.h> clock_t t = clock(); namespace my_std { using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); template <typename T> inline T rnd(T l, T r) { return uniform_int_distribution<T>(l, r)(rng); } template <typename T> inline bool chkmax(T& x, ... |
/**
* 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... |
//
// scandoubler.v
//
// Copyright (c) 2015 Till Harbaum <>
// Copyright (c) 2017 Sorgelig
//
// This source file 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
//... |
#include <bits/stdc++.h> using namespace std; struct vertex { map<char, int> next, go; int p, link; char pch; vector<int> leaf; unordered_set<int> visited; vertex(int p = -1, char pch = -1) : p(p), pch(pch), link(-1) {} }; vector<vertex> t; void aho_init() { t.clear(); t.push_b... |
module fmrv32im_intel_cram
#(
parameter MEM_FILE = ""
)
(
input [9:0] address_a,
input [9:0] address_b,
input [3:0] byteena_b,
input clock_a,
input clock_b,
input [31:0] data_a,
input [31:0] data_b,
input wren_a,
input wren_b,
output [31:0] q_a,
output [31:0] q_b
);
/*
`ifndef ALTERA_RESE... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 100; int n, m, k; long long sum[maxn], dp[maxn]; int d[maxn]; pair<int, int> p[maxn]; int main() { ios::sync_with_stdio(false); cin.tie(0); int cnt = 0; while (cnt <= 1e9) { ++cnt; } cin >> n >> m >> k; ... |
/**
* 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 mod = 1e9 + 7; const long long N = 100011; void solve() { long long n, ans = 0; cin >> n; pair<long long, long long> a[n + 17]; multiset<long long> s; for (long long i = 1; i <= n; i++) cin >> a[i].first; for (long long i = 1; i <= ... |
#include <bits/stdc++.h> using namespace std; template <typename T1, typename T2> istream& operator>>(istream& in, pair<T1, T2>& a) { in >> a.first >> a.second; return in; } template <typename T1, typename T2> ostream& operator<<(ostream& out, pair<T1, T2> a) { out << a.first << << a.second;... |
#include <bits/stdc++.h> using namespace std; const long double PI = 3.1415926535897932384626433832795; template <typename S, typename T> ostream& operator<<(ostream& out, pair<S, T> const& p) { out << ( << p.first << , << p.second << ) ; return out; } template <typename T> ostream& operator... |
#include <bits/stdc++.h> using namespace std; int main() { int n, i, flag = 0; int a[5005]; cin >> n; for (i = 1; i <= n; i++) { cin >> a[i]; } for (i = 1; i <= n; i++) { if (a[a[a[i]]] == i) { cout << YES ; return 0; } } cout << NO ; } |
#include <bits/stdc++.h> using namespace std; int main() { int i, j, w, h; char a[101][101]; cin >> w >> h; for (i = 0; i < h; i++) { for (j = 0; j < w; j++) { char x; cin >> x; a[j][i] = x; } } for (j = 0; j < w; j++) { for (int k = 0; k < 2; k++) {... |
/**
* 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... |
// $Id: c_matrix_arbiter.v 5188 2012-08-30 00:31:31Z dub $
/*
Copyright (c) 2007-2012, Trustees of The Leland Stanford Junior University
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistribut... |
#include <bits/stdc++.h> struct point { long x; long y; long z; }; const long maxn = 5001; const double inf = 2000000000; const double eps = 1.0e-8; point a[maxn]; double nnew, min; long n, q, choice1, choice2; double d[maxn]; double sqr(double x) { return (x * x); } double dist(point ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 2; long long n, m; long long a[N], b[N]; long long f(long long x) { long long res = 0; for (long long(i) = (0); (i) < (n); (i)++) { if (a[i] < x) res += llabs(a[i] - x); } for (long long(i) = (0); (i) < (m); (i)++) { ... |
/*
- This is a material implementd for google summer of code 2017.
- I built this module to be more familiar with the design required, start edit, re-implement the whole thing
- The mentor feedback would really help me getting more and more clear vision about this project
----------------------------------------------... |
#include <bits/stdc++.h> using namespace std; const int N = 105, M = N * N * N; int n, pos, l, r, i, j, k, f[N][N][N], h, t, q[M][3], ans; inline void ext(int x, int y, int z, int d) { if (y > z) return; if (y > l || z < r) return; if (x < y || x > z) return; if (~f[x][y][z]) return; f[x][y]... |
#include <bits/stdc++.h> using namespace std; int n, k, a; vector<int> v, ck; vector<int> has(1000002, 0); bool check(int x) { for (int i = 0; i < x; ++i) { ck[i] = 0; } int res = 0; for (int i = 0; i < n; ++i) { int d = v[i] % x; if (ck[d]) res++; ck[d]++; } re... |
/**
* 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... |
#pragma GCC optimize ( O3 ) #include <bits/stdc++.h> using namespace std; typedef long long ll; #define endl n const ll DIM = 607; const ll INF = 1E18; vector<pair<int,ll> > G[DIM]; ll dist[DIM],mod[DIM*4]; bool vis[DIM]; struct node{ ll dist; int x,y; }; const bool operator > ... |
// megafunction wizard: %RAM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: sync_spram_40W_256D.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ====================... |
#include <bits/stdc++.h> using namespace std; const int N = int(3e5), mod = int(1e9) + 7, block = 316; int n, m, q; vector<int> g[N], comp[N], heavy, di[N]; int root[N], cur, sz[N], d[N], dr[N], d1[N], d2[N]; bool used[N]; bool h[N]; long double ans[N], fans[N]; vector<pair<int, int> > qu[N]; void d... |
#include <bits/stdc++.h> int main() { long long n, p; scanf( %I64d , &n); if (n % 2 == 0 && n != 0) p = n + 1; else p = (n + 1) / 2; printf( %I64d , p); return 0; } |
#include <bits/stdc++.h> int a[2 * 1000010]; int main() { int n, l, t, i, j, nn, k, left; scanf( %d%d%d , &n, &l, &t); nn = 2 * n; for (i = 0; i < n; i++) scanf( %d , &a[i]); for (i = n; i < nn; i++) a[i] = l + a[i - n]; k = 2 * t / l; left = 2 * t - k * l; double ans = 1.0 * (n - 1)... |
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > ans; pair<int, int> ar1[2100]; int ar2[2100]; int n, x; long long anss = 0; void findPlace(int i); int main() { cin >> n; for (int i = 1; i <= n; i++) { cin >> x; ar1[i].first = x; } for (int i = 1; i <= n;... |
/*
Copyright (c) 2014 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,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.