text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> const int maxn = 100020, INF = 1 << 29; int n; struct rec { int n, x; } a[maxn]; int al[maxn], ar[maxn]; struct SBT { int root, tot; int d[maxn], l[maxn], r[maxn], s[maxn]; SBT() { s[0] = root = tot = 0; } void prt(int x, int *a, int &w) { if (!x) return; ... |
#include <bits/stdc++.h> using namespace std; inline long long read() { long long s = 0; bool f = 0; char ch = ; while (!isdigit(ch)) { f |= (ch == - ); ch = getchar(); } while (isdigit(ch)) { s = (s << 3) + (s << 1) + (ch ^ 48); ch = getchar(); } return (... |
/*
Text Mode Memory
Screen Memory is 16kB, and is organized into 128-bit cells.
Change: Expand to 64kB.
Also has a 2kB fixed font.
*/
module ModTxtMemW(clock, reset,
pixCellIx, cellData,
fontGlyph, fontData,
busAddr, busData, busOE, busWR, busOK);
/* verilator lint_off UNUSED */
input clock;
input reset;
inpu... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 17:35:40 03/23/2016
// Design Name:
// Module Name: sumcomp4s
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depen... |
/**
* 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 argc, char *argv[]) { int n, i, a, b, c, d; long int s; scanf( %d , &n); s = 0; for (i = 1; i <= n; i++) { scanf( %d %d %d %d , &a, &b, &c, &d); s = s + (1 + abs(a - c)) * (1 + abs(b - d)); } printf( %ld , s); return 0; } |
/*
########################################################################
Generic small FIFO using distributed memory
Caution: There is no protection against overflow or underflow,
driving logic should avoid wen on full or ren on empty.
###############################################################... |
#include <bits/stdc++.h> using namespace std; char s[10]; int v[10][10]; int dx[4] = {-2, -2, 2, 2}, dy[4] = {2, -2, 2, -2}; int sx, sy, ex, ey; int mark[10][10]; int ans; void dfs(int curx, int cury, int curnum) { for (int i = 0; i < 4; i++) { int tempx = curx + dx[i]; int tempy = cury ... |
#include <bits/stdc++.h> using namespace std; int n, m; vector<string> checkWorks(vector<vector<bool>> arr) { vector<int> row = vector<int>(n, 2); vector<int> col = vector<int>(m, 2); row[0] = 0; for (int j = 0; j < m; j++) { col[j] = arr[0][j]; } bool works = true; for (int i = ... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline T read(register T& t) { register T f = 1; register char ch = getchar(); t = 0; while (ch < 0 || ch > 9 ) { if (ch == - ) f = -f; ch = getchar(); } while (ch >= 0 && ch <= 9 ) t = t * 10 + ch - 0 ... |
#include <bits/stdc++.h> using namespace std; bool debug = 0; int n, m, k; int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0}; string direc = RDLU ; long long ln, lk, lm; void etp(bool f = 0) { puts(f ? YES : NO ); exit(0); } void addmod(int &x, int y, int mod = 1000000007) { assert(y >=... |
// Model of FIFO in Altera
module fifo_1c_2k ( data, wrreq, rdreq, rdclk, wrclk, aclr, q,
rdfull, rdempty, rdusedw, wrfull, wrempty, wrusedw);
parameter width = 32;
parameter depth = 2048;
//`define rd_req 0; // Set this to 0 for rd_ack, 1 for rd_req
input [31:0] data;
input wrreq;
in... |
#include <bits/stdc++.h> using namespace std; template <class T, class U> inline ostream& operator<<(ostream& os, const pair<T, U>& p) { os << p.first << << p.second; return os; } template <class T, class U> inline istream& operator>>(istream& os, pair<T, U>& p) { os >> p.first >> p.second; ... |
/* $Id: fasm_dpsram.v,v 1.3 2008/06/05 20:51:56 sybreon Exp $
**
** FASM MEMORY LIBRARY
** Copyright (C) 2004-2009 Shawn Tan <>
** All rights reserved.
**
** FASM is free software: you can redistribute it and/or modify it
** under the terms of the GNU Lesser General Public License as
** published by the Free Software ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 500 + 10; int R, C; char pic[maxn][maxn]; bool vis[maxn][maxn]; int sr, sc, er, ec; const int dr[] = {-1, 0, 1, 0}; const int dc[] = {0, 1, 0, -1}; bool ok(int r, int c) { return r >= 1 && r <= R && c >= 1 && c <= C; } struct Node { ... |
#include <bits/stdc++.h> using namespace std; int n, a[5005], dp[5005], b[5005]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); dp[0] = 0; for (int i = 1; i <= n; i++) { int p = i, s = a[i]; while (p > 0 && s < b[p - 1]) { s += a[p - 1]; ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
/***************************************************************************************************
** fpga_nes/hw/src/cmn/fifo/fifo.v
*
* Copyright (c) 2012, Brian Bennett
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 20:35:24 06/11/2013
// Design Name:
// Module Name: SevenSeg
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
/... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2008 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc = 0;
reg [63:0] crc;
... |
//#############################################################################
//# Function: Carry Save Adder (4:2) #
//#############################################################################
//# Author: Andreas Olofsson #
... |
//bipolar stepper
/*
Distributed under the MIT license.
Copyright (c) 2011 Dave McCoy ()
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 right... |
//----------------------------------------------------------------------------
module machine( inc_pc, load_acc, load_pc, rd,wr, load_ir,
datactl_ena, halt, clk1, zero, ena, opcode );
output inc_pc, load_acc, load_pc, rd, wr, load_ir;
output datactl_ena, halt;
input clk1, zero, ena;
input [2:0] opcode;
reg in... |
/**
* 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... |
/////////////////////////////////////////////////////////////////////
//// ////
//// Non-restoring signed by unsigned divider ////
//// Uses the non-restoring unsigned by unsigned divider ////
//// ... |
#include <bits/stdc++.h> #define ll long long #define sz(x) ((int) (x).size()) #define all(x) (x).begin(), (x).end() #define vi vector<int> #define pii pair<int, int> #define rep(i, a, b) for(int i = (a); i < (b); i++) using namespace std; template<typename T> using minpq = priority_queue<T, vec... |
#include <bits/stdc++.h> using namespace std; using namespace chrono; void _print(long long t) { cerr << t; } void _print(int t) { cerr << t; } void _print(string t) { cerr << t; } void _print(char t) { cerr << t; } void _print(long double t) { cerr << t; } void _print(double t) { cerr << t; } void _p... |
// (C) 1992-2015 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulati... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, m, k, i, j, x, y, z, c, f, t, s, p; cin >> k >> n >> s >> p; if (n % s == 0) { z = (n / s) * k; if (z % p == 0) { cout << z / p << endl; } else { cout << z / p + 1 << endl; } } else { ... |
`timescale 1ns/10ps
(* FASM_PARAMS="INV.BA1=XAS1;INV.BA2=XAS2;INV.BB1=XBS1;INV.BB2=XBS2" *)
(* MODEL_NAME="T_FRAG" *) // This is intentional!
(* whitebox *)
module B_FRAG (TBS, XAB, XSL, XA1, XA2, XB1, XB2, XZ);
// This is assumed to be connected to const1 in the techmap
input wire TBS;
input wire XAB;
... |
#include <bits/stdc++.h> using namespace std; template <class T> void dbs(string str, T t) { cerr << str << : << t << n ; } template <class T, class... S> void dbs(string str, T t, S... s) { long long idx = str.find( , ); cerr << str.substr(0, idx) << : << t << , ; dbs(str.substr... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a = -2147483647, b = 0; for (int i = 0; i < n - 1; ++i) { int x; cin >> x; a = max(a, x); } cin >> b; a = max(a, b); cout << (int)(a ^ b); } |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:39:03 10/18/2015
// Design Name:
// Module Name: uart
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Re... |
// Copyright (C) 1991-2011 Altera Corporation
// Your use of Altera Corporation's design tools, logic functions
// and other software and tools, and its AMPP partner logic
// functions, and any output files from any of the foregoing
// (including device programming or simulation files), and any
// associated docume... |
/*
* 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> #define ll long long #define rep(A,B,C) for(A=B;A<C;++A) #define pii pair<int,int> #define pll pair<ll,ll> #define fi first #define se second #define all(A) A.begin(),A.end() using namespace std; ///////////////////////////////////////////////////// #define vv vec... |
(** * Extraction: Extracting ML from Coq *)
(* $Date: 2013-01-16 22:29:57 -0500 (Wed, 16 Jan 2013) $ *)
(** * Basic Extraction *)
(** In its simplest form, program extraction from Coq is completely straightforward. *)
(** First we say what language we want to extract into. Options are OCaml (the
most mature),... |
(************************************************************************)
(* v * The Coq Proof Assistant / The Coq Development Team *)
(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2012 *)
(* \VV/ **************************************************************)
(* // * Th... |
// Library - static, Cell - th44, View - schematic
// LAST TIME SAVED: May 23 17:56:46 2014
// NETLIST TIME: May 23 17:57:07 2014
`timescale 1ns / 1ns
module th44 ( y, a, b, c, d );
output y;
input a, b, c, d;
specify
specparam CDS_LIBNAME = "static";
specparam CDS_CELLNAME = "th44";
specparam CDS... |
/**
* 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 = 1e5; int n, q; int all; int pre[2 * MaxN + 5], last[MaxN + 5], other[2 * MaxN + 5]; int node[MaxN + 5]; int father[MaxN + 5]; int gcd(int x, int y) { if (y == 0) return x; else return gcd(y, x % y); } void build(int x... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const int maxn = 611111; long long num[maxn]; namespace SAM { int trans[maxn][30], par[maxn], len[maxn], tot, last; long long cnt[maxn][3]; inline int NewNode() { memset(trans[tot], 0, sizeof(trans[tot])); return tot++; } ... |
#include <bits/stdc++.h> using namespace std; char a[1001], b[1001]; int main() { int sa, sb, i, j, ta = 0, tb = 0; cin >> a >> b; sa = strlen(a); sb = strlen(b); for ((i) = 0; (i) < (sa); (i)++) if (a[i] == 1 ) ta++; for ((i) = 0; (i) < (sb); (i)++) if (b[i] == 1 ) tb++; ... |
`timescale 1ns / 1ps
module intr_filter #
(
parameter integer C_NUMBER = 8,
parameter integer C_FILTER_CNT = 8
) (
input clk,
input resetn,
input wire intr_in0,
input wire intr_in1,
input wire intr_in2,
input wire intr_in3,
input wire intr_in4,
input wire intr_in5,
input wire intr_in6,
input wire intr_in7... |
#include <bits/stdc++.h> using namespace std; vector<long long> f(21); long long fact(long long x) { return f[x]; } long long solve(long long k) { vector<long long> cnt(21), less(21); long long d = 1, den = 1, num = 1, den1 = 1, num1 = 0; while (k > 0) { d += 1; cnt[k % d] += 1; k ... |
#include <bits/stdc++.h> using namespace std; char buf[1000][1005]; int main() { int N; scanf( %d , &N); int T[N]; pair<int, int> T2[N]; for (int i = 0; i < (N); i++) { scanf( %d , &T[i]); T2[i].first = T[i]; T2[i].second = i; } sort(T2, T2 + N); if (T2[0].first =... |
#include <bits/stdc++.h> using namespace std; const string str = VC ; const int maxn = 300; char s[2]; int l, n, m; char buf[maxn]; int alpha[26]; vector<int> G[maxn * 2]; bool mark[maxn * 2]; int stk[maxn * 2], top; bool dfs(int u) { if (s[u & 1] == 0) return false; if (mark[u ^ 1]) retu... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; const int maxn = 403; int n, m; int a[maxn][maxn]; void read() { cin >> n >> m; for (int i = 1; i <= n; i++) for (int j = 1; j <= m; j++) cin >> a[i][j]; } int min_r[maxn]; long long s[maxn * maxn][7]; int find_fi... |
`timescale 1us/100ns
module testbench ();
initial begin
$dumpfile("testbench.vcd");
$dumpvars(0, testbench);
end
reg [0:0] clk = 0;
reg [0:0] resetn = 0;
initial begin
// pull reset if available
resetn = 0;
repeat(10) #1 clk = !clk;
// release reset if available
resetn = 1;
forever #1 clk = !... |
// (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 ... |
// file: clk_wiz_v3_3_tb.v
//
// (c) Copyright 2008 - 2011 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is ... |
#include <bits/stdc++.h> using namespace std; const int INF32 = 0x3f3f3f3f; const double EPS = 1.0e-8; const double PI = acos(-1.0); struct Point { double x, y; Point(double _x = 0, double _y = 0) { x = _x; y = _y; } friend Point operator+(const Point &a, const Point &b) { 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... |
/*
########################################################################
ELINK CONFIGURATION REGISTER FILE
########################################################################
*/
module ecfg (/*AUTOARG*/
// Outputs
soft_reset, mi_dout, ecfg_tx_enable, ecfg_tx_mmu_enable,
ecfg_tx_gpio_enable, ecfg... |
#include <bits/stdc++.h> using namespace std; int number_of_usb; int file_size; int usb_required = 0; int summing = 0; int temp; int main() { cin >> number_of_usb; cin >> file_size; int usb_sizes[number_of_usb]; for (int i = 0; i < number_of_usb; i++) { cin >> usb_sizes[i]; } ... |
#include <bits/stdc++.h> using namespace std; const int N = 5010; const int inf = 1e9; const int mo = 1e9 + 7; int s[N], num[N][N], ans[N], gra[N][N]; int main() { int n, m; cin >> n >> m; for (auto i = (1); i <= (n); ++i) { cin >> s[i]; } memset(num, 0, sizeof(num)); memset(gr... |
/**
* 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) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps / 1ps
`include "utils/bus_to_ip.v"
`include "gpio/gpio_core.v"
`include "gpio/... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { string a, b, c; cin >> a >> b >> c; int n = a.length(); int count = 0; for (int i = 0; i < n; i++) { if (c[i] == a[i] || c[i] == b[i]) continue; else { ... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const long long mod = 1e9 + 7; const int N = 10005; int f[N][2005]; int main() { int _; scanf( %d , &_); for (int j = 1; j <= 1000; j++) { f[0][j] = INF; } while (_--) { int n; scanf( %d , &n); ... |
module Final_Lock_sm(clock, reset, program, b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, correctLed, incorrectLed);
input clock;
input reset;
input program;
input b0, b1, b2, b3, b4, b5, b6, b7, b8, b9;
output reg correctLed, incorrectLed;
reg [4:0] state, next_state;
reg [9:0] num1, num2, num3, num4;
parameter... |
// Copyright (c) 2000-2012 Bluespec, Inc.
// 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, pub... |
/**
* 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... |
// DeBounce_v.v
//////////////////////// Button Debounceer ///////////////////////////////////////
//***********************************************************************
// FileName: DeBounce_v.v
// FPGA: MachXO2 7000HE
// IDE: Diamond 2.0.1
//
// HDL IS PROVIDED "AS IS." DIGI-KEY EXPRESSLY DISCLAIMS ANY
// WARRA... |
/*
* 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 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Sun Apr 09 07:04:02 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; long long const mod = 1e9 + 7; long long const long_max = LONG_LONG_MAX; int interact(int i, int j) { cout << ? << i + 1 << << j + 1 << n ; ; cout.flush(); int x; cin >> x; return x; } void solve() { int n; cin >> n; ... |
#include <bits/stdc++.h> using namespace std; int main() { long long a, b, i, j, n, t, m; cin >> t; while (t--) { string s; cin >> s; n = s.size(); vector<long long> ans; long long count = 0; for (i = 0; i < n; i++) { if (s[i] == 1 ) count++; ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = (1 << 20) + 10; const double PI = acos(-1); double dp[MAXN]; int N; double L, R; double x[22], y[22], a[22]; int main() { memset(dp, 0, sizeof(dp)); scanf( %d%lf%lf , &N, &L, &R); for (int ni = 0; ni < N; ni++) { scanf( %lf... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Programmed By: Ashwith Jerome Rego
// Pin Description:
// CLKIN : Input clock. Must be 100MHz
// RST : Active high module reset.
// BAUD : Baud rate select. The following are th... |
#include <bits/stdc++.h> using namespace std; int a[1000]; int main() { long long p; int k; cin >> p >> k; int kol = 0; while (p > 0) { a[kol] = kol % 2 ? (k - p % k) % k : p % k; p = (kol % 2 ? (p + k - 1) : p) / k; kol++; } if (kol % 2 == 0) { a[kol++] = 1; ... |
// tuner_2.v - real -> complex tuner V2
// 07-17-16 E. Brombaugh
module tuner_2 #(
parameter dsz = 10,
fsz = 26,
psz = 12
)
(
input clk, reset,
input signed [dsz-1:0] in,
input [fsz-1:0] frq,
input ns_ena,
output signed [dsz-1:0] i_out, q_out
);
// phase accumula... |
// (C) 2001-2011 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; #pragma comment(linker, /STACK:1024000000,1024000000 ) const double pi = 2.0 * asin(1.0), eps = 1e-12; const int maxn = 2100, maxm = 1100000, inf = 0x3f3f3f3f; char ch[maxn][maxn]; int ans[maxn]; int main() { int n, m, i, j, l, x; while (scanf( %d%d%d... |
#include <bits/stdc++.h> template <typename T> inline bool chkmin(T &a, T b) { return b < a ? a = b, true : false; } template <typename T> inline bool chkmax(T &a, T b) { return b > a ? a = b, true : false; } template <class T> inline T read(T &x) { int sign = 1; char c = getchar_unlocke... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int cnt[N], steps[N], vis[N]; void solve() { int n, res = INT_MAX, x, y; cin >> n; for (int i = 1; i < n + 1; i++) { cin >> x; queue<pair<int, int>> q; q.push({x, 0}); while (!q.empty()) { x = q.fron... |
#include <bits/stdc++.h> using namespace std; int n, h, x[2010], fall[2][2010]; double p, dp[2010][2010][2][2]; double solve(int l, int r, int fl, int fr) { if (l > r) return 0; if (dp[l][r][fl][fr] != -1) return dp[l][r][fl][fr]; dp[l][r][fl][fr] = 0; double res = 0; int nl = min(r, l + fal... |
/**
* 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 a, b, c, d; cin >> a >> b; cin >> c >> d; cout << max(abs(c - a), abs(b - d)); } |
//=======================================================
// ECE3400 Fall 2017
// Lab 3: Template top-level module
//
// Top-level skeleton from Terasic
// Modified by Claire Chen for ECE3400 Fall 2017
//=======================================================
`define ONE_SEC 25000000
module DE0_NANO(
... |
#include <bits/stdc++.h> using namespace std; int b, ans, r; bool x; int main() { cin >> b; while (!x) { b++; ans++; r = abs(b); if ((r - 8) % 10 == 0 && r != 0) x = 1; r /= 10; if ((r - 8) % 10 == 0 && r != 0) x = 1; r /= 10; if ((r - 8) % 10 == 0 && r !=... |
#include <bits/stdc++.h> using namespace std; bool comp(const pair<int, int> &a, const pair<int, int> &b) { if (a.first == b.first) return a.second < b.second; return a.first < b.first; } bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) { if (a.second == b.second) return b.first > a.... |
//
// Designed by Qiang Wu
//
`timescale 1ns/1ps
`include "NF_2.1_defines.v"
`include "reg_defines_reference_router.v"
`include "registers.v"
module flow_classification
(// --- data path interface
output [63:0] out_data0,
output [15:0] out_pkt_route0,
output out_wr0,
output reg out_req0,
input out_a... |
// -- (c) Copyright 2011 - 2012 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... |
////////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2012, Ameer M. Abdelhadi; . All rights reserved. //
// //
// Redistribution and use in source and binary forms, with or with... |
#include <bits/stdc++.h> using namespace std; const int maxN = 2000005; vector<long long> open[maxN]; vector<pair<long long, long long> > box; long long a[maxN], b[maxN], p[maxN]; priority_queue<long long> demolished; bool cmp(long long a, long long b) { return p[a] < p[b]; } int main() { long long ... |
#include <bits/stdc++.h> int main(void) { int w = 1; int h = 1; int n = 0; scanf( %d , &n); for (int i = 0; i < n; i++) { char op[10] = {0}; scanf( %s , op); if (strcmp(op, UL ) == 0 || strcmp(op, DR ) == 0) w++; else if (strcmp(op, UR ) == 0 || strcmp(op, DL ) ... |
#include <bits/stdc++.h> using namespace std; long long modpow(long long a, long long b, long long mod = (long long)(1e9 + 7)) { if (!b) return 1; a %= mod; return modpow(a * a % mod, b / 2, mod) * (b & 1 ? a : 1) % mod; } mt19937 rng(chrono::steady_clock::now().time_since_epoch()... |
#include <bits/stdc++.h> using namespace std; struct ako { int b2, c2, d; ako(int B = -1, int C = -1, int D = -1) : b2(B), c2(C), d(D) {} }; const int minb = -2000, maxb = 4000, maxa = 1005; ako vis[maxb - minb + 79][maxa]; int main() { ios::sync_with_stdio(false); cin.tie(0); int 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... |
`define NUM_MAPPERS 64
module user_logic(
input i_pcie_clk, //250Mhz
input i_ddr_clk, //200Mhz
input i_user_clk, //configurable
input i_rst,
//reg i/f
input [31:0] i_user_data,
input [19:0] i_user_addr,
input ... |
module gift_control(
input clock, reset, enable, hit,
// The gift position
input [9:0] in_x, in_y,
output reg [2:0] kind,
output reg [9:0] x, y,
output reg active,
// control signal
output reg paddle_size, paddle_speed, give_ball, ball_speed, ball_size, ball_display, get_shot, drop_block
);
`include "def.v"
lo... |
#include <bits/stdc++.h> using namespace std; const int maxn = 300005; pair<int, int> pa[maxn]; int main() { int n, a, b; scanf( %d%d%d , &n, &a, &b); for (int i = 0; i < n; ++i) { scanf( %d , &pa[i].first); pa[i].second = i + 1; } sort(pa, pa + n); for (int i = 0; i < n; ++i... |
// Copyright (C) 2020-2021 The SymbiFlow Authors.
//
// Use of this source code is governed by a ISC-style
// license that can be found in the LICENSE file or at
// https://opensource.org/licenses/ISC
//
// SPDX-License-Identifier:ISC
module top (
input clk,
input cpu_reset,
input data_in,
output [5:0... |
#include <bits/stdc++.h> using namespace std; template <typename T1> void print_list(const T1& a) { cerr << a << endl; } template <typename T1, typename T2> void print_list(const T1& a, const T2& b) { cerr << a << << b << endl; } template <typename T1, typename T2, typename T3> void print_... |
/*
* 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... |
// DeBounce_v.v
//////////////////////// Button Debounceer ///////////////////////////////////////
//***********************************************************************
// FileName: DeBounce_v.v
// FPGA: MachXO2 7000HE
// IDE: Diamond 2.0.1
//
// HDL IS PROVIDED "AS IS." DIGI-KEY EXPRESSLY DISCLAIMS ANY
// WARRAN... |
`timescale 1ns/1ns
module sch ();
// generated by HDL Direct 16.5-S048 (v16-5-13DK) 9/23/2013
// on Fri Jan 22 17:08:23 2016
// from usb2iterface_lib/SCH/sch_1
// begin instances
\atsam3u1cb-au page1_i1 (.gnd1(/* unconnected */),
.gnd2(/* unconnected */),
.gnd3(/* unconnected */),
.gndana(/* unconnected */)... |
/**
* 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.