text stringlengths 59 71.4k |
|---|
module linked_fifo(rst, clk, push, push_fifo, pop, pop_fifo, d, q, empty, full, count, almost_full);
parameter WIDTH = 8;
parameter DEPTH = 32;
parameter FIFOS = 8;
parameter LOG2_FIFOS = log2(FIFOS-1);
parameter LOG2_DEPTH = log2(DEPTH-1);
parameter FIFO_COUNT = FIFOS;
input rst;
input ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2003 by Wilson Snyder.
module t (clk);
input clk;
reg [43:0] mi;
reg [5:0] index;
integer indexi;
reg read;
initial begin
// Static
mi = 44'b... |
module top (
input clk,
input [15:0] wdata,
output [15:0] rdata,
input [7:0] addr
);
SB_RAM40_4K #(
.WRITE_MODE(0),
.READ_MODE(0)
) ram (
.RDATA(rdata),
.RADDR(addr),
.RCLK(clk),
.RCLKE(1'b1),
.RE(1'b1),
.WADDR(addr),
.WCLK(clk),
.WCLKE(1'b1),
.WDATA(wdata),
.WE(1'b1),
.MASK(16'b0)
);
... |
#include <bits/stdc++.h> using namespace std; const int D[8][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}, {1, -1}, {-1, 1}, {-1, -1}, {1, 1}}; int N, M, K, f[600005], F[3005][6005], b[600005], tot; int find(int x) { return x == f[x] ? x : f[x] = find(f[x]); } bool can(int& x, int& y) { ... |
module qsys_serial_host(
// Qsys serial interface
output reg sdo,
input sdi,
input clk,
input sle,
output reg srdy,
input reset,
// Qsys bus interface
output rso_MRST_reset,
output cso_MCLK_clk,
output reg[31:0]avm_M1_writedata,
... |
#include <bits/stdc++.h> using namespace std; struct S { int dist, u, v; S(int dd, int uu, int vv) { dist = dd; u = uu; v = vv; } bool operator<(const S& a) const { if (dist != a.dist) return dist < a.dist; return u < a.u; } bool operator>(const S& a) const { ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n; cin >> n; vector<pair<int, int>> v(n); for (auto &x : v) cin >> x.first >> x.second; if (is_sorted(v.rbegin(), v.rend())) { bool ok = true; for (auto x : v) if ... |
#include <bits/stdc++.h> using namespace std; int n, m; int a[307][307]; inline bool check(const int& i, const int& j) { return i >= 0 && i < n && j >= 0 && j < m; } int cnt_neighbors(const int& i, const int& j) { int res = 0; if (check(i - 1, j)) res++; if (check(i, j + 1)) res++; if (c... |
//
// Copyright 2011 Ettus Research 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
// (at your option) any later version.
//
// This program is dis... |
/**
* 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 = 105; const int mod = 1e9 + 7; long long n, m, x; long long dp[2][320][320][2]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); if (fopen( A.inp , r )) { freopen( test.inp , r , stdin); freopen( test.out , w , s... |
module sw_reset
#(
parameter WIDTH=32,
parameter LOG2_RESET_CYCLES=8
)
(
input clk,
input resetn,
// Slave port
input slave_address, // Word address
input [WIDTH-1:0] slave_writedata,
input slave_read,
input slave_write,
input [WIDTH/8-1:0] slave_byteenable,
output slave_readdata,
o... |
#include <bits/stdc++.h> using namespace std; const int N = 205; char str[20][N]; int n, m, des; int dp[20][2]; int call(int flr, int side) { if (flr == des) { if (side == 0) { int p = 0; for (int i = 1; i <= m; i++) if (str[flr][i] == 1 ) p = i; return p; ... |
/*------------------------------------------------------------------------------
* This code was generated by Spiral Multiplier Block Generator, www.spiral.net
* Copyright (c) 2006, Carnegie Mellon University
* All rights reserved.
* The code is distributed under a BSD style license
* (see http://www.opensource.or... |
//
// Copyright 2011 Ettus Research 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
// (at your option) any later version.
//
// This program is dis... |
#include <bits/stdc++.h> using namespace std; char name[110][3000], text[110][3000]; int name_len[110], text_len[110]; bool found[110][110], dp[110][110]; int pre[110][110]; int chosen[110]; void variable_init() { memset(found, 0, sizeof found); memset(dp, 0, sizeof dp); } int main() { int... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer: Muhammad Ijaz
//
// Create Date: 05/09/2017 07:54:56 PM
// Design Name:
// Module Name: DECODING_STAGE
// Project Name: RISC-V
// Target Devices:
// Tool Versions:
// D... |
//-----------------------------------------------------------------------------
// setbit.v
//-----------------------------------------------------------------------------
//- (C) D. Cuartielles for Arduino, December 2015
//- GPLv3 License
//- based on previous work by Obijuan for BQ
//---------------------------------... |
#include <bits/stdc++.h> using namespace std; int main() { long long b, r, g, w, i, j = 0, p = 0, n, m, s1, s2; cin >> n >> m >> s1 >> s2; if (s2 == 2) { cout << s1 << << s2 << endl; cout << 1 << << s2 << endl; for (i = 1; i <= n; i++) { if (i % 2 == 1) { ... |
//////////////////////////////////////////////////////////////////////
//// ////
//// eth_maccontrol.v ////
//// ////
//// This file is part of the Ether... |
// ###########################################################################
// # MEMORY TRANSACTION TRANSLATOR
// #
// # This block uses the upper 12 bits [31:20] of a memory address as an index
// # to read an entry from a table.
// #
// # Writes are done from the register config interface
// #
// # The table can ... |
#include <bits/stdc++.h> using namespace std; int main() { long int a, b, c; cin >> a >> b >> c; a = abs(a) + abs(b); if (a > c) cout << NO << endl; else { if ((c - a) % 2 == 0) cout << YES << endl; else cout << NO << endl; } } |
#include <bits/stdc++.h> using namespace std; const long long inf = 1e15; const long double pi = 3.141592; const long long mod1 = 1e9 + 7; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } int main() { int n; cin >> n; vector<int> d(n + 1); set<int> set; int x = 1, y = 1; int m... |
module autolisp_top (/*AUTOARG*/);
/* autolisp_inst AUTO_TEMPLATE (
.\(.*\)A (\1_@"(eval tense)"_A),
.\(.*\)B (\1_@"(eval tense)"_B),
);
*/
/* AUTO_LISP(setq tense "is") */
autolisp_inst AUTOLISP_INST_I0
(/*AUTOINST*/
// Outputs
.result (result),
// Inputs
.portA ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; const long long INF = 1e18 + 5; const int MAXN = 1e6; const int base = 317; const long long bs = 1e5 + 1; const long long mod = 998244353; struct node { node *left, *right; int val; node(node* l = NULL, node* r = NULL, int ... |
#include <bits/stdc++.h> using namespace std; const int M = 10005; vector<int> g[M]; int main() { int n; scanf( %d , &n); for (int i = 0; i < n - 1; i++) { int a, b; scanf( %d %d , &a, &b); g[a].push_back(b); g[b].push_back(a); } int ans = 0; for (int i = 1; i <= ... |
#include <bits/stdc++.h> using namespace std; void solve() { long long n; cin >> n; vector<vector<long long>> adj(n + 1, vector<long long>(n + 1, 0)); for (long long i = 1; i <= n; i++) { for (long long j = 1; j <= n; j++) { cin >> adj[i][j]; } } vector<long long> del(n +... |
#include <bits/stdc++.h> using namespace std; void solve(long long int input) { long long int n; cin >> n; double a[n], b[n]; for (long long int i = 0; i < n; i++) cin >> a[i]; for (long long int i = 0; i < n; i++) cin >> b[i]; map<long double, long long int> mp; long long int ans = 0; ... |
#include <bits/stdc++.h> using namespace std; const long long INF = (long long)4e18 + 7; inline void minimize(long long &x, const long long &y) { if (x > y) x = y; } struct help { int x, s, r; help() { x = s = r = 0; } void input(void) { x = s = r = 0; int k; scanf( %d%d%d , ... |
#include <bits/stdc++.h> using namespace std; double t, k, d, start = 0, sum = 0; int main() { scanf( %lf%lf%lf , &k, &d, &t); if ((long long)k % (long long)d == 0) printf( %.1f n , t); else if (k >= t) printf( %.1f n , t); else { if (k > d) { long long a = k / d; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s = to_string(n); int m = s.size(); vector<int> v; for (int i = 9 * m; i >= 0; i--) { int j = n - i; int sum = 0; for (sum = 0; j > 0; j /= 10) sum += j % 10; if (sum == i) v.push_back(... |
/*
* This module is made for use in bsg_cams, managing the valids and tags for each entry.
* We separate v_rs and tags so that we can support reset with minimal hardware.
* This module does not protect against setting multiple entries to the same value -- this must be
* prevented at a higher protocol level, if desi... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, k, num; cin >> n >> k; num = (n) * (n - 1) / 2; if (num <= k) cout << no solution << endl; else for (int i = 1; i <= n; i++) cout << 1 << << i << endl; } |
/**
# XcvrSpi #
Simple SPI transceiver with FIFOs. 8 bit interface, but continously clocks out
data. CS stays asserted until TX FIFO is empty.
*/
///////////////////////////////////////////////////////////////////////////
// MODULE DECLARATION
/////////////////////////////////////////////////////////////////////////... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; long long int a[100]; for (int i = 0; i < n; i++) { cin >> a[i]; } int m = a[0]; for (int i = 1; i < n; i++) { if (a[i] > m) { m = a[i]; } } int o = 0; for (int i = 0; i < n;... |
#include <bits/stdc++.h> using namespace std; long long int mod = 998244353; long long int expo(long long int base, long long int exponent, long long int mod) { long long int ans = 1; while (exponent != 0) { if (exponent & 1) ans = (1LL * ans * base) % mod; base = (1LL * b... |
#include <bits/stdc++.h> int min(int a, int b) { return (a < b ? a : b); } int max(int a, int b) { return (a > b ? a : b); } int main() { char a[10], b[10]; int x, y; scanf( %s n%s , a, b); if (strcmp(a, sunday ) == 0) x = 0; else if (strcmp(a, monday ) == 0) x = 1; else if (... |
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2016-2020 NUDT, Inc. All rights reserved.
////////////////////////////////////////////////////////////////////////////////
//Vendor: NUDT
//Version: 0.1
//Filename: parser.v
//Target Device: Altera
//Dscription:
... |
/*
* 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 binSearch(int *a, int n, int x) { int l = 0; int r = n - 1; while (l < r) { int mid = (l + r) / 2; if (a[mid] == x) return mid; else if (a[mid] < x) l = mid + 1; else r = mid - 1; } return -1; } ... |
// DESCRIPTION: Verilator: Interface parameter getter
//
// A test of the import parameter used with modport
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2015 by Todd Strader
// SPDX-License-Identifier: CC0-1.0
interface test_if #(parameter integer FOO = 1);
// Interface... |
#include <bits/stdc++.h> const int INF_INT = 0x3f3f3f3f; const long long INF_LL = 0x7f7f7f7f; const int MOD = 1e9 + 7; const double eps = 1e-10; const double pi = acos(-1); using namespace std; int n; int a[30]; int vis[30]; bool dfs(int root, int cnt, int son) { if (root == n + 1) return true; ... |
/*******************************************************************************
* This file is owned and controlled by Xilinx and must be used *
* solely for design, simulation, implementation and creation of *
* design files limited to Xilinx devices or technologies. Use ... |
#include <bits/stdc++.h> int n, m; int f[2000010], mx, mn = (int)1e7; short check(int x) { int i; for (i = x; i <= mx; i += x) if (f[i + x - 1] >= i && f[i + x - 1] - i > m) return 0; return 1; } int main() { int i, x; scanf( %d%d , &n, &m); for (i = 1; i <= n; i++) { scanf... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Mon Feb 13 12:47:50 2017
// Host : WK117 running 64-bit major release (build ... |
/**
* 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) 2008 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; either version 3, or (at your option) an... |
#include <bits/stdc++.h> const long long N = 200005; long long hi, ls, n, X[N], t, A[N], bk[N]; using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cin >> n >> t; for (int i = 0; i < n; ++i) { cin >> A[i]; } for (int i = 0; i < n; ++i) { cin >> X[i... |
// Accellera Standard V2.3 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2008. All rights reserved.
`include "std_ovl_defines.h"
`module ovl_value (clock, reset, enable, test_expr, vals, disallow, fire);
parameter severity_level = `OVL_SEVERITY_DEFAULT;
parameter num_values = 1;
parame... |
#include <bits/stdc++.h> using namespace std; long long m; long long p(long long x) { long long kmx = 0; while ((kmx * kmx * kmx) <= x) kmx++; kmx--; long long ret = 0; for (long long i = 2; i <= kmx; i++) ret += x / (i * i * i); return ret; } int main() { ios_base::sync_with_stdio... |
module Project(
input clock,
input reset
);
wire [15:0] IF_Output;
wire [7:0] PC_Out;
wire [15:0] ID_Input;
wire [15:0] ID_Alusrc1;
wire [15:0] ID_Alusrc2;
wire [15:0] ID_Memwritedata;
wire [3:0] ID_Alucmd;
wire [2:0] ID_Rfwritebackdest;
wire IDJump;
wire IDBranch;
w... |
module Top_Show(clk, change, Reset, String, RS, RW, EN, StringDisplay, MsbOD);
input clk;
input change, Reset;
input [76:0] String;
output [6:0] StringDisplay;
output RS, RW, EN;
output MsbOD;
wire [76:0] w_Regin;
wire [6:0] w_D;
wire [2:0] w_scrinit;
... |
///////////////////////////////////////////////////////
// Copyright (c) 1995/2006 Xilinx Inc.
// All Right Reserved.
///////////////////////////////////////////////////////
//
// ____ ___
// / /\/ /
// /___/ \ / Vendor : Xilinx
// \ \ \/ Version : 13.i (O.51)
// \ \ Des... |
#include <bits/stdc++.h> using namespace std; int main() { int i, n, k, j; cin >> n >> k; for (i = 0; i < n; i++) { for (j = 0; j < n; j++) if (i == j) cout << k << ; else cout << 0 << ; cout << n ; } } |
// ***************************************************************************
// ***************************************************************************
// 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 n, m, hd, el; char s[1000]; struct E { char tag; int p[26]; } e[1000000]; void ins() { int i, j, k, l; for (i = 0, l = hd; s[i]; i++) { if (!e[l].p[s[i] - a ]) e[l].p[s[i] - a ] = el++; l = e[l].p[s[i] - a ]; } } void d... |
#include <bits/stdc++.h> using namespace std; void solve() { long long n, i, x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; cout << (x2 - x1) * (y2 - y1) + 1 << n ; } int main() { std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long tt; cin >> tt; while (... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); int n; cin >> n; int nums[n]; for (int i = 0; i < n; i++) { cin >> nums[i]; } int ans = 0; int maxi = 0; int mini = 1e9; for (int i = 0; i < n; i++) { maxi = max(ma... |
`timescale 1ns / 1ns
module gentest;
reg [7:0] a=0, b=0;
wire co;
wire [7:0] result;
adder work(a, b, 1'b0, result, co);
integer cc;
initial begin
for (cc=0; cc<10; cc=cc+1) begin
a=a+1;
#10;
$display("%d %d %d", a, b, result);
b=result;
end
if (b==55) $display("PASSED");
else $display("FAIL");
end
end... |
#include <bits/stdc++.h> using namespace std; int main() { int test; cin >> test; while (test--) { int n, m; cin >> n >> m; string S; cin >> S; vector<int> P(m); vector<int> cnt(n); for (int i = 0; i < m; i++) { cin >> P[i]; cnt[0]++; cnt... |
// PentEvo project (c) NedoPC 2008-2009
//
// state: | RD1 | RD2 | RD3 | RD4 | WR1 | WR2 | WR3 | WR4 | RFSH1 | RFSH2 | RFSH3 | RFSH4 |
// clk: ___/```\___/```\___/```\___/```\___/```\___/```\___/```\___/```\___/```\___/```\___/```\___/```\___/```\___/```\__
// | READ CY... |
// --------------------------------------------------------------------
// Copyright (c) 2007 by Terasic Technologies Inc.
// --------------------------------------------------------------------
//
// Permission:
//
// Terasic grants permission to use and modify this code for use
// in synthesis for all Terasic De... |
#include <bits/stdc++.h> using namespace std; int modInverse(int a, int m); int gcd(int a, int b); int power(int x, unsigned int y, unsigned int m); void pairsort(int a[], int b[], int n); int logint(int x, int y); int gcd(int a, int b) { if (a == 0) return b; return gcd(b % a, a); } int power... |
#include <bits/stdc++.h> using namespace std; void getre() { int x = 0; printf( %d n , 1 / x); } void gettle() { int res = 1; while (1) res <<= 1; printf( %d n , res); } template <typename T, typename S> inline bool upmin(T &a, const S &b) { return a > b ? a = b, 1 : 0; } templ... |
/**
* 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( O3 ) using namespace std; template <class c> struct rge { c b, e; }; template <class c> rge<c> range(c h, c n) { return {h, n}; } template <class c> auto dud(c* r) -> decltype(cerr << *r); template <class c> char dud(...); struct muu { ... |
/**
* 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) 2015 The Connectal Project
// 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,... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Tue May 30 22:27:54 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; vector<long long> all; void backtrack(long long x, int cnt4, int cnt7) { if (x > 1e10) return; if (cnt4 == cnt7) all.push_back(x); long long nxt = x * 10 + 4; backtrack(nxt, cnt4 + 1, cnt7); nxt = x * 10 + 7; backtrack(nxt, cnt4, cnt7 + 1); }... |
// DESCRIPTION: Verilator: Check initialisation of cloned clock variables
//
// This tests issue 1327 (Strange initialisation behaviour with
// "VinpClk" cloned clock variables)
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2018 by Rupert Swarbrick (Argon Design).
// bug1327... |
/*
In this test a single IOBUF is controlled by switches. There is also one
input (connected to a LED) and one oputput (controlled by a switch) that.
can be used for verification of 3-state I/O.
This test requires a physical jumper to be installed on the Basys3 board.
Depending on which pins are connected we have diff... |
/**
* 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... |
// 74181 4-bit ALU
module alu181(
input [3:0] a, b,
input m,
input c_,
input [3:0] s,
output [3:0] f,
output g, p,
output co_,
output eq
);
wire [3:0] s0 = {4{s[0]}};
wire [3:0] s1 = {4{s[1]}};
wire [3:0] s2 = {4{s[2]}};
wire [3:0] s3 = {4{s[3]}};
wire [3:0] u = ~((a) | (b & s0) | (~b & s1)); // 3 ands
... |
#include <bits/stdc++.h> int main() { char g[100]; scanf( %s , g); for (int w = 0; g[w] != 0 ; w++) { if (g[w] >= 65 && g[w] <= 90) g[w] = g[w] + 32; } for (int w = 0; g[w] != 0 ; w++) { if (!(g[w] == a || g[w] == e || g[w] == i || g[w] == o || g[w] == u || g[... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { string s; cin >> s; if (s.size() % 2) cout << NO n ; else { string word1 = , word2 = ; for (int i = 0; i < s.size() / 2; i++) word1 += s[i]; for (int i =... |
#include <bits/stdc++.h> using namespace std; ifstream in( input.txt ); ofstream out( output.txt ); int main() { vector<int> a; int n, x; cin >> n >> x; a.resize(100001); vector<int> b; for (int i = 0; i < n; i++) { int t; cin >> t; a[t]++; b.push_back(t); } ... |
#include <bits/stdc++.h> using namespace std; const int INF = 1000000000; const int prime = 9241; const long double pi = acos(-1.); int in[100005]; int masks[1000005]; bool used[1 << 22]; int main() { int n, m, d; scanf( %d%d%d , &n, &m, &d); for (int i = 0; i < m; i++) { int s; ... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx ) #pragma GCC optimize( unroll-loops ) using namespace std; template <typename T1, typename T2> inline void chkmin(T1 &first, T2 second) { if (first > second) first = second; } template... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d, case1, case2, case3, case4; cin >> a >> b >> c >> d; case1 = abs(pow(a, 2) + pow(b, 2) - pow(c, 2)) - 2 * a * b; case2 = abs(pow(a, 2) + pow(b, 2) - pow(d, 2)) - 2 * b * a; case3 = abs(pow(a, 2) + pow(c, 2) - pow(d, 2)) -... |
#include <bits/stdc++.h> using namespace std; int vis[100005], tick = 0; vector<int> G[100005]; int a[200001], b[200005]; int main() { int n, m, h, t; scanf( %d%d%d%d , &n, &m, &h, &t); for (int i = 1; i <= m; ++i) { int u, v; scanf( %d%d , &u, &v); G[u].push_back(v); G[v].... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2014.1
// Copyright (C) 2014 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1 ns / 1 ps
m... |
/*
Copyright (c) 2015-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... |
module top(input clk, stb, di, output do);
localparam integer DIN_N = 256;
localparam integer DOUT_N = 256;
reg [DIN_N-1:0] din;
wire [DOUT_N-1:0] dout;
reg [DIN_N-1:0] din_shr;
reg [DOUT_N-1:0] dout_shr;
always @(posedge clk) begin
din_shr <= {din_shr, di};
dout_shr <= {dout_shr, din_shr[DIN_N-1]};
if ... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Mon Jan 23 19:11:23 MST 2017
// Date : Fri Oct 27 00:02:33 2017
// Host : Juice-Laptop running 64-bit major relea... |
#include <bits/stdc++.h> using namespace std; template <typename T> void read(T& x) { x = 0; int fl = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) fl = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) { x = (x << 1) + (x << 3) + ch - 0 ; ... |
#include <bits/stdc++.h> using namespace std; #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) #pragma GCC optimize( -ffloat-store ) #pragma GCC optimize( -fno-defer-pop ) long long int power(long long int a, long long int b, long long int m) { if (b == 0) return 1; if (b == 1) ret... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); string s; cin >> s; for (int i = 0; i < (int)s.size(); i++) { if (s[i] == . ) cout << 0 ; else { if (s[i + 1] == . ) cout << 1 ; else ... |
#include <bits/stdc++.h> using namespace std; const int N = 1000 + 10, M = 2000 + 10; int n, m, s, t; int h[N], ecnt, nxt[M], v[M]; bool mp[N][N]; int dis[2][N], ans; void _add(int x, int y) { nxt[++ecnt] = h[x]; v[ecnt] = y; h[x] = ecnt; mp[x][y] = 1; } queue<int> que; void dijkstra... |
#include <bits/stdc++.h> using namespace std; int dx[] = {1, -1, 0, 0}; int dy[] = {0, 0, 1, -1}; int dx2[] = {1, -1, 0, 0, -1, 1, -1, 1}; int dy2[] = {0, 0, 1, -1, 1, -1, -1, 1}; int read() { int x; scanf( %d , &x); return x; } int ans[100005]; int a[100005]; int used[1000001]; int ma... |
#include <bits/stdc++.h> using namespace std; int mod = (int)1e9 + 7; struct matrix { int A[2][2] = {0}; matrix operator*(matrix B) { matrix C; for (int i = 0; i < 2; i++) for (int j = 0; j < 2; j++) for (int k = 0; k < 2; k++) C[i][j] = (C[i][j] + 1ll * A[i][k] *... |
// Problem: A. Dungeon // Contest: Codeforces - Educational Codeforces Round 100 (Rated for Div. 2) // URL: https://codeforces.com/problemset/problem/1463/A // Memory Limit: 256 MB // Time Limit: 2000 ms // // Powered by CP Editor (https://cpeditor.org) #include<bits/stdc++.h> using namespace std; ... |
/**
* 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; void solve(); int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int times = 1; cin >> times; for (int i = 0; i < times; i++) { solve(); cout << n ; } return 0; } long long a, b, c, d, e, f, g, h; lo... |
#include <bits/stdc++.h> using namespace std; int n, m; char matr[1010][1010]; int dx[] = {-1, 0, 1, 0}; int dy[] = {0, -1, 0, 1}; bool Field(int x, int y) { if (x < 1 || x > n) return false; if (y < 1 || y > m) return false; return true; } int color[1010][1010]; int ans[1010][1010]; int... |
#include <bits/stdc++.h> #pragma GCC optimize( O2 ) using namespace std; using pii = pair<int, int>; using pll = pair<long long, long long>; using vb = vector<bool>; using vi = vector<int>; using vl = vector<long long>; using vvb = vector<vector<bool>>; using vvi = vector<vector<int>>; using vvl = v... |
/////////////////////////////////////////////////////////////////////////
// Copyright (c) 2008 Xilinx, Inc. All rights reserved.
//
// XILINX CONFIDENTIAL PROPERTY
// This document contains proprietary information which is
// protected by copyright. All rights are reserved. This notice
... |
/*
* 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 MAX = 1005; char ch[MAX]; int ans[MAX]; int main() { int n; scanf( %d%s , &n, ch); ans[0] = 1; for (int i = 1; i < n; i++) { if (ch[i - 1] == = ) ans[i] = ans[i - 1]; else if (ch[i - 1] == L ) { ans[i] = 1; ... |
#include <bits/stdc++.h> using namespace std; const int iinf = 1e9 + 7; const int oo = 0x3f3f3f3f; const long long linf = 1ll << 60; const double dinf = 1e60; template <typename T> inline void scf(T &x) { bool f = 0; x = 0; char c = getchar(); while ((c < 0 || c > 9 ) && c != - ) c = g... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.