text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int mb[3], cd[3]; int mn[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; bool chk() { if (mb[1] > 12) return 0; int i, j, k, tm; tm = mn[mb[1]]; if (mb[1] == 2 && !(mb[2] & 3)) tm++; if (tm < mb[0]) return 0; for (i = mb[2]; i < cd[2... |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: dec_table.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ==============================... |
/*
* This program demonstrates non-constant part selects
* applied to a signal value.
*/
module main;
wire [31:0] foo = 32'h76543210;
reg [3:0] tmp;
reg [3:0] idx;
initial begin
#1 /* Wait for initial assignments to settle. */ ;
if (foo[0 +: 4] !== 4'h0) begin
$display("FAILED -- %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... |
// Accellera Standard V2.3 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2008. All rights reserved.
`ifdef OVL_ASSERT_ON
wire xzcheck_enable;
`ifdef OVL_XCHECK_OFF
assign xzcheck_enable = 1'b0;
`else
`ifdef OVL_IMPLICIT_XCHECK_OFF
assign xzcheck_enable = 1'b0;
`else
assign xzcheck... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11:26:26 05/17/2016
// Design Name:
// Module Name: Driver_bus_bidireccional
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dep... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cout.setf(ios::fixed); cout.precision(20); int n; cin >> n; if (n == 5) return 0 * puts( 1 ); cout << n % 3 + 1 << n ; return 0; } |
#include <bits/stdc++.h> using namespace std; int n, tot, m, l, r, len; char c; int po[400005], ha[400005], ys[400005], fi[400005], la[400005]; int s[400005], id[400005], t[400005], sum[400005], it[400005]; struct pi { int num, hai; }; pi find(int li, int ri) { int f1 = 0, f2 = 0, lp = li, rp = ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100; char ch[maxn][maxn]; int main() { int n; scanf( %d , &n); for (int i = 0; i <= n + 1; i++) { for (int j = 0; j <= n + 1; j++) { ch[i][j] = # ; } } for (int i = 1; i <= n; i++) { getchar(); fo... |
module sequence_detector_fsm(data_out, state, reset, data_in, clk);
output data_out;
output reg [2:0] state; // Matching progress.
input reset, data_in, clk;
// For data_out.
parameter FOUND = 1'b1,
NOT_FOUND = 1'b0;
// For state.
parameter S0 = 3'd0,
S1 = 3'd1,
S2 = 3'd2,
... |
#include <bits/stdc++.h> using namespace std; const long double pi = 3.1415926535897932384626433; const long long inf = 1e18; const long long mod = 1e9 + 7; void solve() { long long n; cin >> n; vector<long long> a(n); vector<vector<long long> > cnt(100001); long long me = 0; for (long... |
`timescale 1ns/1ps
/*
This file contains analog / mixed signal cells, or other things that are not possible to fully model
in behavioral Verilog.
It also contains some stuff like oscillators that use non-synthesizeable constructs such as delays.
TODO: do we want a third file for those cells?
*/
module GP_ABUF(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; const int N = 1e6 + 15, OO = 1e6 + 3; int n, q, t1, t2; int inv[N], y[15], de[15]; long long MOD(long long a, long long b) { a %= b; if (a < 0) a += b; return a; } void rangeInv(long long m) { inv[1] = 1; for (long long i = 2; i < m; ++i) i... |
#include <bits/stdc++.h> using namespace std; const int pri[26] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, -1}; const long long mo[5] = {223092870ll, 2756205443ll, 907383479ll, 42600829ll, 97ll}; long l... |
#include <bits/stdc++.h> using namespace std; long long dis(long long x1, long long x2, long long y1, long long y2) { return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2); } int main() { int n; cin >> n; long long x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; long long x[n + 1], y[n + 1];... |
#include <bits/stdc++.h> using namespace std; namespace FGF { int n, m; const int N = 2e5 + 5; const double eps = 1e-10; struct Node { double x, t; } a[N]; double sum, ans; bool cmp(Node u, Node v) { return u.t < v.t; } void work() { scanf( %d%d , &n, &m); for (int i = 1; i <= n; i++) sc... |
/*
* 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() { int k, l, m, n, i, j, d, fucked = 0; cin >> k >> l >> m >> n >> d; int p[100010]; if (k == 1 || l == 1 || m == 1 || n == 1) { cout << d; } else { for (i = 1; i <= d; i++) { if (i % (k) == 0 || i % (l) == 0 || i % (m) ... |
#include <bits/stdc++.h> const double eps = 1e-10, pi = acos(-1.0); const int maxS = 1e2 + 10; const int maxS2 = 5e4 + 10; const unsigned long long MOD = 1e9 + 7; using namespace std; struct point { int x, y, z; }; int n, m, i, j, k, x, y, z, T, ii, t, l, r, pos; int tot = 0, cnt = 0, ans = 0, sum... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1e18; long long prime[16] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53}; long long n, ans; void DFS(int x, int limit, long long num, long long cnt) { if (cnt > n) return; if (cnt == n && n... |
#include <bits/stdc++.h> using namespace std; int main() { int ans, h, r; double tmp; scanf( %d%d , &r, &h); ans = h / r * 2; tmp = h % r; if (r / 2.0 - tmp > 1e-8) ans++; else if (sqrt(3) / 2 * r - tmp > 1e-8) ans += 2; else ans += 3; printf( %d , ans); ret... |
#include <bits/stdc++.h> using namespace std; const int INF = 2000000000; struct pkt { int k, r; }; struct prze { int k, r1, r2; }; bool porownanie(pkt a, pkt b) { if (a.k < b.k) return true; if (a.k > b.k) return false; if (a.r < b.r) return true; return false; } int main() { ... |
/* Atari on an FPGA
Masters of Engineering Project
Cornell University, 2007
Daniel Beer
RIOT.v
Redesign of the MOS 6532 chip. Provides RAM, I/O and timers to the Atari.
*/
`timescale 1ns / 1ps
`include "riot.vh"
module RIOT(A, // Address bus input
Din, // Data bus input
Dout, // Data bus output
CS,... |
#include <bits/stdc++.h> using namespace std; long long ans; int main() { vector<int> a(3); for (size_t i = 0; i < 3; i++) { cin >> a[i]; } sort(a.begin(), a.end()); cout << ((a[1] + a[0] > a[2]) ? 0 : (-a[1] - a[0] + a[2] + 1)); } |
//////////////////////////////////////////////////////////////////////////////
//
// Xilinx, Inc. 2010 www.xilinx.com
//
// XAPPxxx
//
//////////////////////////////////////////////////////////////////////////////
//
// File name : dvi_decoder.v
//
// Description : Spartan-6 DVI decoder to... |
#include <bits/stdc++.h> using namespace std; int main() { int n; char tmp[11]; deque<string> dq; set<string> st; scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %s , &tmp); dq.push_front(tmp); } for (deque<string>::iterator i = dq.begin(); i != dq.end(); i++) { ... |
// "multidimensional-a.v"
// @vcs-flags@ -P pli.tab -sverilog
// -sverilog to support multidimensional arrays
`timescale 1ps / 1ps
`include "multidimensional-reverse.v-wrap"
// wrapper needs repack_arrays=1 workaround
`include "clkgen.v"
//---------------------------------------------------------------------------... |
`ifndef MEMORY_V
`define MEMORY_V
`define MEM_CMD_WIDTH 1
`define MEM_CMD_READ 1'b0
`define MEM_CMD_WRITE 1'b1
module memory#(
parameter ADDRESS_WIDTH=32,
parameter DATA_WIDTH=32,
parameter SIZE = 1024*1024,
parameter READ_DELAY = 22,
parameter WRITE_DELAY = 15
)(
input clk,
input reset,
input [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... |
#include <bits/stdc++.h> using namespace std; char s[110000]; char res[110000]; int main() { scanf( %s , s); int resLen = 0; int last = 0; int index = 0; for (int i = 0; i < 110000; i++) res[i] = 0; for (char c = z ; c >= a ; c--) for (int i = index; s[i]; i++) if (s[i] =... |
#include <bits/stdc++.h> using namespace std; void sll(long long &x) { register char c = getchar(); x = 0; int neg = 0; for (; ((c < 48 || c > 57) && c != - ); c = getchar()) ; if (c == - ) { neg = 1; c = getchar(); } for (; c > 47 && c < 58; c = getchar()) { 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... |
#include <bits/stdc++.h> template <class T> T Min(const T &a, const T &b) { return a < b ? a : b; } template <class T> T Max(const T &a, const T &b) { return a > b ? a : b; } template <class T> bool Chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; } template <class T> bool Chkma... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e3 + 10; int tim[maxn]; int ans[30][30]; set<int> q; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; for (int i = 0; i < n * n; i++) { int t; cin >> t; q.insert(t); tim[t]++; ... |
/**
* 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... |
// ==============================================================
// 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 la... |
#include <bits/stdc++.h> using namespace std; int n, m, a[3010][6010], fa[18010000]; int dx[9] = {-1, -1, -1, 0, 0, 1, 1, 1}, dy[9] = {-1, 0, 1, -1, 1, -1, 0, 1}; inline int read() { int x = 0, f = 0; char ch = getchar(); while (!isdigit(ch)) f = ch == - , ch = getchar(); while (isdigit(ch)) x ... |
#include <bits/stdc++.h> using namespace std; const int M = 102, T = 1000 * 1000 * 1000 + 7; int a[2600][M]; bool mrk[2600][M]; string s; int ff(long long sum, int n) { if (sum < 0) return 0; if (mrk[sum][n]) return a[sum][n]; if (sum > 25 && n == 1) return 0; if (sum <= 25 && n == 1) return... |
/**
* 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> const int inf = 2e9; using namespace std; int dp[505][505], change[505][505]; pair<int, int> parent[505][505]; string second; int calc(int l, int r) { int ans = 0; while (l < r) { if (second[l] != second[r]) ans++; l++; r--; } return ans; } void... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2016/05/30 20:05:42
// Design Name:
// Module Name: Mealy_FSM_tb
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// ... |
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; while (t--) { long long int n, k, x, y; cin >> n >> k; if (n > k) { x = k * (k + 1); x = x / 2; cout << x << endl; } else { y = n - 1; x = y * (y + 1); ... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// 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 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 law... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, arr[100], k; set<int> todo; cin >> n >> k; for (int i = 0; i < n; i++) { cin >> arr[i]; k += arr[i]; for (long long x = 1; x * x <= arr[i]; x++) { todo.insert(x); todo.insert(arr[i] / 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... |
/**
* 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> #pragma GCC optimize(3) using namespace std; const long long INF = 2e18; const int maxn = 1e6 + 6; const int mod = 1e9 + 6; const double eps = 1e-15; inline bool read(long long &num) { char in; bool IsN = false; in = getchar(); if (in == EOF) return false; whil... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 06/29/2016 07:18:32 PM
// Design Name:
// Module Name: Priority_Encoder
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k, m; cin >> n >> k; m = n * (n - 1) / 2; if ((double)k > ((double)n - 1) / 2) { cout << -1; return 0; } else { cout << k * n << endl; for (int i = 1; i <= n; ++i) { for (int j = 0; j < k; ++j) { ... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline T BigMod(T b, T p, T m) { if (p == 0) return 1; if (p % 2 == 0) { T s = BigMod(b, p / 2, m); return ((s % m) * (s % m)) % m; } return ((b % m) * (BigMod(b, p - 1, m) % m)) % m; } template <typename T> inli... |
// soc_system_hps_0.v
// This file was auto-generated from altera_hps_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 16.1 196
`timescale 1 ps / 1 ps
module soc_system_hps_0 #(
parameter F2S_Width = 0,
parameter S2F_Width = 0
) (
output wire h2f_rst_n, ... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved.
//
// In this HDL repository, there are many different and unique modules, consisting
// of... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:26:17 03/17/2015
// Design Name:
// Module Name: alt_ctl
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
//... |
// (c) Copyright 1995-2017 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is not a license and does not grant ... |
module finished_wf
(/*AUTOARG*/
// Outputs
fetchwave_wf_done_en, fetchwave_wf_done_wf_id,
max_instr_inflight_array,
// Inputs
clk, rst, f_decode_wfid, f_sgpr_alu_wr_done_wfid,
f_vgpr_alu_wr_done_wfid, alu_wfid, f_salu_branch_wfid, f_decode_valid,
f_decode_wf_halt, f_vgpr_alu_wr_done, f_sgpr_alu_w... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 03/13/2016 05:51:29 PM
// Design Name:
// Module Name: Testbench_Barrel_Shifter
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Depende... |
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef string ss ; typedef pair<int, int> pi; typedef pair<ll,ll> pl; typedef vector<int> vi; typedef vector<ll> vl; #define mp make_pair #define pb push_back void solve(){ ll n,k=0,... |
/**
* 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... |
//-----------------------------------------------------------------
// AltOR32
// Alternative Lightweight OpenRisc
// V2.0
// Ultra-Embedded.com
// Copyright 2011 - 2013
//
// Email:
//
// ... |
#include <bits/stdc++.h> using namespace std; const int INF = 1000 * 1000 * 1000; vector<int> g[100100]; int deg[100100]; bool vis[100100]; void dfs(int v) { vis[v] = true; for (int to : g[v]) if (!vis[to]) { dfs(to); } } int main() { int N, M; scanf( %d%d , &N, &M); ... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-8; const int maxn = 100000 + 10; struct Point { double x, y; Point() {} Point(double x, double y) : x(x), y(y) {} } inter; struct Line { int a, b, c, id; Line() {} Line(int a, int b, int c, int id) : a(a), b(b), c(c)... |
#include <bits/stdc++.h> using namespace std; inline int read() { int X = 0, w = 1; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) w = -1; c = getchar(); } while (c >= 0 && c <= 9 ) X = X * 10 + c - 0 , c = getchar(); return X * w; } const int N = 100 + 10... |
#include <bits/stdc++.h> using namespace std; long long a[10]; long long ans = 0; void DFS(long long n, long long u, long long r[10]) { if (n == 10) { long long sum = 1; for (long long i = 2; i <= u; i++) sum *= i; for (long long i = 1; i < 10; i++) for (long long j = 2; j <= r[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 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 long long INF = 1e15; const int MOD = 1e9 + 7; const double EPS = 1e-9; const double PI = acos(-1.0); mt19937 rng((int)chrono::steady_clock::now().time_since_epoch().count()); const int N = 105; pair<long long, long long> e[N]; long long n, m, a[N]; ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; for (int j1 = 0; j1 < t; j1++) { long long int n; cin >> n; long long int arr[n]; long long int sum1 = 0; long long int sum2 = 0; for (int j = 0; j < (n / 2); j++) { arr[j] = ((2 * 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; const int Maxn = 1000 + 10; const int INF = 0x7f7f7f7f; const double eps = 1e-8; const double pi = 3.1415926535897932384626433832795; double p[Maxn], f[Maxn][Maxn]; long long L[Maxn], R[Maxn]; inline long long power(int a, int b) { long long ans = 1; ... |
#include <bits/stdc++.h> using namespace std; inline char nc() { return getchar(); static char buf[100000], *l = buf, *r = buf; return l == r && (r = (l = buf) + fread(buf, 1, 100000, stdin), l == r) ? EOF : *l++; } template <class T> void read(T &x) { x = 0; ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100000 + 10; int n, m, q, v[maxn], lp[maxn]; vector<int> e[maxn], t[maxn]; vector<long long> ps[maxn]; int mx, argmx; void dfs(int id, int p, int d, int cpn) { if (cpn) v[id] = cpn; lp[id] = max(lp[id], d); if (d > mx) { mx =... |
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; string res = ; if (s.find( . ) == string::npos) { s += . ; } int d = s.find( . ); int i = d - 1; int c = 0; while (i >= 0) { if (s[i] != - ) res = s[i] + res; c++; if (c == ... |
`timescale 1ns / 1ps
`include "../src/mutex_buffer.v"
module test_mutex_buffer(
);
localparam RANDOMOUTPUT = 1;
localparam RANDOMINPUT = 1;
reg[11:0] ori_height = 320;
reg[11:0] ori_width = 240;
reg[11:0] w_left = 3;
reg[11:0] w_top = 3;
reg[11:0] w_width = 5;
reg[11:0] w_height = 6;
reg resetn;
... |
#include <bits/stdc++.h> using namespace std; template <typename...> static inline int getchar_unlocked(void) { return getchar(); } template <typename...> static inline void putchar_unlocked(int c) { putchar(c); } void reader(int& x) { int k, m = 0; x = 0; for (;;) { (k) = getc... |
#include <bits/stdc++.h> using namespace std; clock_t time_p = clock(); void ktj() { time_p = clock() - time_p; cerr << Time elapsed : << (float)(time_p) / CLOCKS_PER_SEC << n ; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long n, i, j, k; ... |
#include<bits/stdc++.h> #define int long long int #define pb push_back #define all(x) (x).begin(), (x).end() using namespace std; int solve(int a,int b) { if(a<=0) return 0; return min(1+solve(a/b,b), 2+solve(a/(b+1),b+1)); } signed main() { ios_base::sync_with_stdio(false);cin... |
/**
* 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... |
//`define SKIP_MIXER
module dmix_top #(
parameter NUM_SPDIF_IN = 1,
parameter NUM_CH = 2,
parameter NUM_CH_LOG2 = 1,
parameter NUM_RATE = 5,
parameter VOL_WIDTH = 32
)(
input wire clk245760_pad,
input wire rst,
input wire [0:(NUM_SPDIF_IN-1)] spdif_i,
// I2S to DAC
output... |
#include <bits/stdc++.h> using namespace std; char rep; void query(long long x, long long y) { cout << ? << x << << y << endl; cin >> rep; return; } void solve() { long long x = 0; long long y = 1; while (true) { query(x, y); if (rep == x ) { break; } ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 1e4; int a[maxn], mod; int b[maxn]; int n; int pow(int a, int b) { if (b == 1) return a; int t = pow(a, b >> 1); t = 1LL * t * t % mod; if (b & 1) t = 1LL * t * a % mod; return t; } int ny(int a) { return pow(a, mod... |
/****************************************************************************************
*
* File Name: mobile_ddr_mcp.v
*
* Dependencies: mobile_ddr.v, mobile_ddr_parameters.vh
*
* Description: Micron MOBILE DDR SDRAM multi-chip package model
*
* Disclaimer This software code and all associated documentati... |
#include <bits/stdc++.h> using namespace std; const int maxn = 110; int n, m, z; int mapp[maxn][maxn][maxn]; bool vis[maxn][maxn][maxn]; string s; int main() { int ans = 0, num; memset(vis, false, sizeof(vis)); memset(mapp, 0, sizeof(mapp)); scanf( %d%d%d , &n, &m, &z); for (int i = 1;... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; const double pi = acos(-1); const int inf = 1 << 30; const int mod = 1e9 + 9; struct point { int x, flag; bool operator<(const point &a) const { return flag > a.flag; } } s, q; bool check(long long a[], int n, long long h, ... |
#include <bits/stdc++.h> using namespace std; int a[1005], b[1005]; int main() { int n; string s, ss; cin >> n >> s >> ss; for (int i = 0; i < n; i++) { a[i] = s[i] - 0 ; b[i] = ss[i] - 0 ; } sort(a, a + n); sort(b, b + n); int sum1 = 0, sum2 = 0; for (int i = 0, ... |
#include <bits/stdc++.h> using namespace std; using uint = unsigned int; using ll = long long; using ull = unsigned long long; using pii = pair<int, int>; using pll = pair<ll, ll>; template <typename T1, typename T2> ostream &operator<<(ostream &out, const pair<T1, T2> &item) { out << ( << item.fi... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2005 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (clk);
input clk;
reg [2:0] a;
reg [2:0] b;
reg q;
f6 f6 (/*AUTOINST*/
... |
#include <bits/stdc++.h> using namespace std; const int N = 100005; int n; long long a[N], b[N]; int f[N][2]; long long WIN(long long x, long long y) { assert(x <= y); if (y & 1) return !(x & 1); if (x * 2 > y) return x & 1; if (x * 4 > y) return 1; return WIN(x, y / 4); } long long ... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:268435456 ) using namespace std; template <typename T1, typename T2> istream& operator>>(istream& in, pair<T1, T2>& t) { return in >> t.first >> t.second; } template <typename T1, typename T2> ostream& operator<<(ostream& out, pair<T1, T2>& t) {... |
/*
* 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 maxl = 200005; int T, n, mk, seq[maxl]; char s[maxl]; inline char read() { char ch = getchar(); while (ch != < && ch != > ) ch = getchar(); return ch; } int main() { scanf( %d , &T); while (T--) { scanf( %d , &n); m... |
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1); const double eps = 1e-9; const int inf = 2000000000; const long long infLL = 9000000000000000000; inline bool checkBit(long long n, int i) { return n & (1LL << i); } inline long long setBit(long long n, int i) { return n | (1LL ... |
module DMA(
clock , // clock
reset , // Active high, syn reset
req_0 , // Request 0
req_1 , // Request 1
gnt_0 , // Grant 0
gnt_1
);
input clock,reset,req_0,req_1;
output gnt_0,gnt_1;
wire clock,reset,req_0,req_1;
reg gnt_0,gnt_1;
parameter SIZE = 3
;
parameter ST_STO... |
/* AUTHOR: lz.askey CREATED: 23.07.2021 13:57:23 LANG: C++11 */ #include <assert.h> #include <algorithm> #include <bitset> #include <cmath> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <iostream> #include <iterator> #include <map> #include <new> ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v(n); for (int i = 0; i < n; i++) { cin >> v[i]; } v.insert(v.begin(), 0); for (int i = 1; i <= n; i++) { v[i] += v[i - 1]; } int ans = 0; int l, r; cin >> l >> r; if (... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty.
// SPDX-License-Identifier: CC0-1.0
module some_module (
input wrclk
);
logic [ 1 : 0 ] some_state;
logic [1:0] some_other_state;
always @(posedge wrclk)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.