text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; char a[101][101]; int n, i, j; int main() { cin >> n; for (i = 0; i < n; i++) { for (j = 0; j < n; j++) cin >> a[i][j]; } for (i = 0; i < n - 2; i++) { if (a[i][0] == # ) { cout << NO << endl; return 0; } fo... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x7f7f7f7f; void setup() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.precision(15); } struct seg_tree { struct node { int val; node(int _val = 0x7f7f7f7f) { val = _val; } node operator+(co... |
/*
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,... |
#include <bits/stdc++.h> using namespace std; int GLL(long long& x) { return scanf( %lld , &x); } int GI(int& x) { return scanf( %d , &x); } int m, n; long long add(long long x, long long y) { x += y; if (x >= m) x -= m; return x; } long long sub(long long x, long long y) { x -= y; if ... |
//#############################################################################
//# Purpose: Stretches a pulse by DW+1 clock cycles #
//# Adds one cycle latency #
//#############################################################################
... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); int n; string s; cin >> n >> s; int steps0 = 0; int steps1 = 0; for (int i = 0; i < n; ++i) { steps0 += ((s[i] - 0 ) != (i % 2)); steps1 += ((s[i] - 0 ) == (i % 2)); ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2010 by Wilson Snyder.
typedef enum { EN_ZERO,
EN_ONE
} En_t;
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
// Insure that we can declare a type w... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n; cin >> n; long long int sum1 = (n * (n + 1)) / 2; if (sum1 % 2 == 0) { cout << 0 << endl; } else { cout << 1 << endl; } } |
#include <bits/stdc++.h> using namespace std; template <class T> __inline__ __attribute__((always_inline)) T read() { T x = 0, w = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == - ) w = -w; for (; isdigit(c); c = getchar()) x = x * 10 + c - 0 ; return x * w; } t... |
#include <bits/stdc++.h> using namespace std; struct debugger { template <typename T> debugger& operator,(const T& v) { cerr << v << ; return *this; } } dbg; char ibuf[4096]; int ipt = 4096; int readUInt() { while (ipt < 4096 && ibuf[ipt] < 0 ) ipt++; if (ipt == 4096) { ... |
#include <bits/stdc++.h> using namespace std; const int INF = 2147483647; const int N = 2005; int z, n, k, c, i, ind, tab[N]; char t[N]; string s; vector<pair<int, int> > v; void sett(int val, int ind) { if (tab[ind] == val) return; int i = ind + 1; while (tab[i] != val) i++; v.push_back... |
#include <bits/stdc++.h> using namespace std; vector<int> g[100002]; int find(int v, int* parent) { if (parent[v] == v) { return v; } return find(parent[v], parent); } int vis[100002]; int dp[100002]; void dfs(int u) { vis[u] = 1; for (int i = 0; i < g[u].size(); i++) { int... |
/*
* This demonstrates a basic dynamic array
*/
module main;
string foo[];
int idx;
string tmp;
initial begin
if (foo.size() != 0) begin
$display("FAILED -- foo.size()=%0d, s.b. 0", foo.size());
$finish;
end
foo = new[10];
if (foo.size() != 10) begin
$display("FAILED -- f... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; int num[10010]; int dp[1 << 18]; int bad[1 << 18]; int g[100][100]; int tmp[1 << 18]; string s; int get(int l, int r) { int t = 0; for (int i = l; i <= r; ++i) { t |= 1 << (s[i] - a ); } return t; } int main() { int n, p; s... |
#include <bits/stdc++.h> using namespace std; template <class T> T abs(T x) { return x > 0 ? x : (-x); } template <class T> T sqr(T x) { return x * x; } const int maxn = 57; char ty[maxn][maxn]; bool allow[300]; int d[maxn][maxn]; int f[maxn][maxn]; int n, m, k; int sx, sy, fx, fy; ... |
#include <bits/stdc++.h> using namespace std; inline long long minOf(long long x, long long y) { return (x < y ? x : y); } inline long long maxOf(long long x, long long y) { return (x > y ? x : y); } char arr[50000000], *ptr; long long ret; string str; inline long long get_int() { bool isNeg = false; ... |
/**
* 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... |
//*****************************************************************************
// (c) Copyright 2009 - 2013 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
/... |
#include<bits/stdc++.h> using namespace std; #define endl n int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin>>t; while(t--) { long long int n,i,j,k,l; cin>>n>>k; if(k==1) { cout<< 1 <<endl; co... |
#include <bits/stdc++.h> const long long inf = 1000000000; const long long inf64 = inf * inf; const double pi = acos(-1.0); long long Abs(long long x) { return (x >= 0 ? x : -x); } using namespace std; bool solve() { int n; cin >> n; vector<vector<long long> > mat(n, vector<long long>(n)); v... |
// (c) Copyright 1995-2016 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 ... |
// iverilog -y .. -o tb-DataBuffer.vvp tb-DataBuffer.v
// vvp tb-DataBuffer.vvp
`timescale 1ns/1ns
module tb;
localparam W = 8;
localparam CYC = 10;
reg clk, rst;
reg idata_vld;
wire idata_rdy;
reg [W-1:0] idata;
wire odata_vld;
reg odata_rdy;
wire [W-1:0] odata;
DataBuffer#(W... |
/*
* 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 q, x; cin >> q >> x; long long n = q; long long a[n]; map<long long, long long> m; long long min = 0; map<long long, long long> f; for (long long i = 0; i < n; i++) { cin >> a[i]; long long mod = a[i] % ... |
//
// Copyright (c) 1999 Thomas Coonan ()
//
// 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)
// ... |
module PLLE2_ADV #(
parameter BANDWIDTH = "OPTIMIZED",
parameter integer CLKFBOUT_MULT = 5,
parameter real CLKFBOUT_PHASE = 0.000,
parameter real CLKIN1_PERIOD = 0.000,
parameter real CLKIN2_PERIOD = 0.000,
parameter integer CLKOUT0_DIVIDE = 1,
parameter real CLKOUT0_DUTY_CYCLE = 0.500,
parameter real... |
/******************************************************************************
* License Agreement *
* *
* Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. *
... |
/**
* 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 2013(c) Analog Devices, Inc.
// Author: Lars-Peter Clausen <>
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, ... |
#include <bits/stdc++.h> using namespace std; const int N = 6e5 + 8; const int T = 2e5 + 2; int n, b[N], t[N]; template <typename _Tp> inline void IN(_Tp& x) { char ch; bool flag = 0; x = 0; while (ch = getchar(), !isdigit(ch)) if (ch == - ) flag = 1; while (isdigit(ch)) x = x * 1... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Case Western Reserve University
// Engineer: Matt McConnell
//
// Create Date: 20:17:00 09/05/2017
// Project Name: EECS301 Digital Design
// Design Name: Lab #3 Project
// Module Name: ... |
#include <bits/stdc++.h> using namespace std; int dx[] = {0, 0, +1, -1}; int dy[] = {+1, -1, 0, 0}; inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; } int biton(int N, int pos) { return N = N | (1 << pos); } int bitoff(int N, int pos) { return N = N & ~(1 << pos); } bool check(int N, int po... |
#include <bits/stdc++.h> int main(void) { int a[101]; int b, c, d, i, j, count = 0, num, number; scanf( %d %d , &b, &c); for (i = 0; i < b; i++) { scanf( %d , &a[i]); } for (i = 0; i < b - 1; i++) { for (j = i + 1; j < b; j++) { if (a[i] > a[j]) { d = a[i]; ... |
// daq_dma32_debug.v
`timescale 1 ns / 1 ps
/*
register set:
offset | bits | name |access| description
-------+------+-----------+------+--------------------------------
0 | 30:0 | mem_base | R/W |memory base byte address
4 | 25:0 | mem_size | R/W |memory size in words (16 bit)
... |
/*
* 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; #pragma comment(linker, /STACK:16777216 ) const int fin = 111110; struct T { int cnt, val, l, r, mx, y, ans; T() : cnt(0), val(-1), l(fin), r(fin), mx(-1000000000), y(-1), ans(-1) {} }; T a[111111]; void upd(int v) { a[v].cnt = 1 + a[a[v].r].cnt +... |
/*
* 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; double tick() { static clock_t oldt, newt = clock(); double diff = 1.0 * (newt - oldt) / CLOCKS_PER_SEC; oldt = newt; return diff; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); long long a[4][4] = {0}; long long k; ... |
#include <bits/stdc++.h> using namespace std; const int iinf = 1e9 + 7; const long long linf = 1ll << 60; const double dinf = 1e10; template <typename T> inline void scf(T &x) { bool f = 0; x = 0; char c = getchar(); while ((c < 0 || c > 9 ) && c != - ) c = getchar(); if (c == - ) {... |
///////////////////////////////////////////////////////////////////////////////
// debounce # (
// .pCLKS(32'd 1_000_000) // number of clocks to count before signal is "stable"
// ) debounce_inst (
// .iCLK(), .iRESET(), .oSIG(), .iSIG()
// );
///////////////////////////////////////////////////////////////////... |
#include <bits/stdc++.h> using namespace std; template <class T> void in(T &x) { x = 0; bool f = 0; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) f = 1; c = getchar(); } while ( 0 <= c && c <= 9 ) { x = (x << 3) + (x << 1) + (c ^ 48); c = getchar(... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1e15; long long arr[100003]; int main() { int n; scanf( %d , &n); for (int i = 0; i < n; i++) scanf( %lld , &arr[i]); if (n == 1 || n == 2) printf( 0 n ); else { long long res = INF; for (int i = -1; i <= 1... |
//==============================================================================
// Copyright (C) John-Philip Taylor
//
//
// This file is part of a library
//
// This 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 Fre... |
#include <bits/stdc++.h> using namespace std; const int N = 2000; vector<array<int, 2>> que; int degree[N][N], n, m; string grid[N]; bool valid(int i, int j) { return i >= 0 && i < n && j >= 0 && j < m && grid[i][j] == . ; } void update(int i, int j) { if (i >= 0 && i < n && j >= 0 && j < m) { ... |
#include <bits/stdc++.h> using namespace std; const long long MOD = (long long)1e9 + 7; const long double PI = 3.141592653589793238462643383279502884197; priority_queue<int, vector<int>, greater<int> > pq; vector<int> v; int cnt[512]; pair<int, int> vec[512]; pair<int, int> sec[512]; int main() { ... |
#include <bits/stdc++.h> using namespace std; const int N = 305, Q = (int)2e6 + 50; struct Qry { int x, y, c; void read() { cin >> x >> y >> c; x--, y--; } } qry[Q]; int n, m, q; int mp[N][N]; int f[N * N]; int dx[] = {0, 0, -1, 1}, dy[] = {1, -1, 0, 0}; int ch[Q], off[Q]; in... |
// NeoGeo logic definition (simulation only)
// Copyright (C) 2018 Sean Gonsalves
//
// 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) an... |
/**
* 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... |
// DESCRIPTION: Verilator: Verilog Test module
//
// Use this file as a template for submitting bugs, etc.
// This module takes a single clock input, and should either
// $write("*-* All Finished *-*\n");
// $finish;
// on success, or $stop.
//
// The code as shown applies a random vector to the Test
// modul... |
#include <bits/stdc++.h> using namespace std; const int MOD = pow(10, 9) + 7; int main() { ios_base::sync_with_stdio(false); int k; cin >> k; string s; cin >> s; int n = s.length(); int l = 0, r = 0; long long ans = 0LL; long long count1 = 0; while (l < 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 law... |
/******************************************************************************
* License Agreement *
* *
* Copyright (c) 1991-2009 Altera Corporation, San Jose, California, USA. ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100000 + 10; int n; int main() { scanf( %d , &n); if (n <= 8) { int a = 2; int b = (n) / a; int c = (n) % a; for (int i = 1; i <= n;) { if (c > 0) { printf( %d , c); c--; i++; ... |
#include <bits/stdc++.h> using namespace std; void solve(); int main(int argc, const char** argv) { int t = 1; cin >> t; while (bool(t--)) { solve(); cout << n ; } } void solve() { vector<int> v(3); int s = 0; for (int i = 0; i < 3; i++) { cin >> v[i]; s +... |
#include <bits/stdc++.h> using namespace std; const long long M = 998244353; long long f[300005]; vector<long long> m1[300005], m2[300005]; int32_t main() { std::ios::sync_with_stdio(0); std::cin.tie(0); ; long long n; cin >> n; for (long long i = 0; i < n; i++) { long long x, y;... |
// ZX-Evo Base Configuration (c) NedoPC 2008,2009,2010,2011,2012,2013,2014
//
// reset generator
/*
This file is part of ZX-Evo Base Configuration firmware.
ZX-Evo Base Configuration firmware is free software:
you can redistribute it and/or modify it under the terms of
the GNU General Public... |
//
// 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... |
//////////////////////////////////////////////////////////////////////////////////
// AXI4MasterInterfaceReadChannel for Cosmos OpenSSD
// Copyright (c) 2015 Hanyang University ENC Lab.
// Contributed by Kibin Park <>
// Yong Ho Song <>
//
// This file is part of Cosmos OpenSSD.
//
// Cosmos OpenSSD is f... |
`timescale 1ns / 1ps
`define intN 8
`define addrN 8
`include "primitives.v"
`include "io_stream_read_array.v"
`include "array.v"
module io_stream_read_array_tb;
`wire(Array, (`addrN, `intN), arr);
`reg(stream, `intN, sIn);
`wire(stream, `intN, sOut);
assign sOut_ready = out_ready;
`testbench(io_s... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Xilinx
// Engineer: dtysky
//
// Create Date: 2015/01/19 09:26:57
// Design Name: INST_MEM
// Module Name: INST_MEM
// Project Name: MIPS_CPU
// Target Devices:
// Tool Versions:
// Description:
//
/... |
// megafunction wizard: %ALTTEMP_SENSE%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: ALTTEMP_SENSE
// ============================================================
// File Name: temp_sense.v
// Megafunction Name(s):
// ALTTEMP_SENSE
//
// Simulation Library Files(s):
//
// ==================... |
#include <bits/stdc++.h> using namespace std; bool q[2][1001]; short qf[3][1001], an[1001][1001][50][2]; inline short gt(int l, int r, int p) { return qf[p][r] - qf[p][l - 1]; } int main() { int n, p, k; scanf( %d%d%d , &n, &p, &k); for (int i = 0; i < (int)(2); ++i) { int t; scanf( %d... |
#include <bits/stdc++.h> using ll = long long; const ll maxn = 1234; const ll inf = 1e9 + 7; int main(int argc, char *argv[]) { ll n, m, a[maxn]; std::cin >> n >> m; ll cur = 0, maxx = 0, minn = 0; for (int i = 0; i < n; i++) { std::cin >> a[i]; cur += a[i]; maxx = std::max(max... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( avx,avx2,fma,sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; long long MOD = 1e9 + 7; long long k; vector<long long> v, w, num; vector<pair<long long, pair<long long, long long> > > zp; vect... |
#include <bits/stdc++.h> int main() { int n, x = 0; char arra[10]; scanf( %d , &n); for (int i = 0; i < n; i++) { scanf( %s , arra); if (arra[0] == + || arra[1] == + ) x = x + 1; else if (arra[0] == - || arra[1] == - ) x = x - 1; } printf( %d n , x); }... |
#include <bits/stdc++.h> using namespace std; char buf[25]; const int maxn = 1000010; int a[maxn * 2], b[maxn * 2]; int n, m, x, y, t, mx; int read() { int x = 0, f = 0; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = 1; ch = getchar(); } while (ch >= ... |
#include <bits/stdc++.h> using namespace std; const int mxn = 2e5 + 5; long long a[1001][1001]; int main() { int t; cin >> t; while (t--) { int n, m; cin >> n >> m; for (int i = 1; i <= n; ++i) { for (int j = 1; j <= m; ++j) { cin >> a[i][j]; if ((i + j)... |
#include<bits/stdc++.h> // #define int long long #define ld long double #define fi first #define se second #define vll vector<int> #define pii pair<int,int> #define pb push_back #define sz(v) (int)(v).size() #define inf (int)(1e8) #define md (int)(1e9+7) #define all(v) (v).begin(),(v).end() #def... |
/*
* 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 N = 300100; int arr[N]; #pragma warning(disable : 6031) #pragma warning(disable : 4996) int t, n; bool c1[N], c2[N]; int main() { scanf( %d , &t); while (t--) { scanf( %d , &n); bool f1 = 1, f2 = 1; bool f3 = 1; for ... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; template <typename T> void maxtt(T& t1, T t2) { t1 = max(t1, t2); } template <typename T> void mintt(T& t1, T t2) { t1 = min(t1, t2); } bool debug = 0; int n, m, k; int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0}; string direc = URDL ; long... |
/**
* 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 MAX_N = 1001; int dp2[MAX_N][MAX_N], dp5[MAX_N][MAX_N]; int n; string findPath(int (*p)[MAX_N]) { int i = n - 1, j = n - 1; string path = ; while (i != 0 && j != 0) { if (p[i - 1][j] > p[i][j - 1]) { path.insert(0, R ); ... |
#include <bits/stdc++.h> using namespace std; const int mod = 1051131; const int Inv2 = (mod + 1) >> 1; inline void setIO(string a) {} long long Power; int m, s, n, nn; int a[(1 << 25) + 23]; void work(int n, int p, int q) { if (n == 1) { int &An = a[1]; (p += q) %= mod; for (long ... |
//------------------------------------------------------------------------------
// (c) Copyright 2013-2015 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 pr... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3fffffff; const int SINF = 0x7fffffff; const long long LINF = 0x3fffffffffffffff; const long long SLINF = 0x7fffffffffffffff; const int MAXN = 2007; int n, m; vector<int> es[MAXN]; bitset<MAXN> bs[MAXN]; bool hv[MAXN]; int dp[MAXN]; ... |
////////////////////////////////////////////////////////////////////-
// Design unit: Control Unit (Module)
// :
// File name : cu.v
// :
// Description: Control Unit of Vending Machine
// :
// Limitations: None
// :
// System : Verilog
// :
// Author : 1.... |
#include <bits/stdc++.h> using namespace std; long long int power_mod(long long int a, long long int x) { if (x == 0) return 1; long long int y = power_mod(a, x / 2); long long int ans = (y * y) % 1000000007; if (x % 2) ans = (ans * a) % 1000000007; return ans; } long long int inv(long long ... |
`timescale 1ns/1ns
module dm( addr, wd, be, clk, rd ) ;
input [12:2] addr ; // address bus
input [31:0] wd ;
// 32-bit input data
input [3:0] be ;
// memory write enable
input clk ;
// clock
output [31:0] rd ; // 32-bit memory output
reg [31:0] _dm[2047:0] ;
always @(posedge c... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 19:26:11 07/23/2010
// Design Name:
// Module Name: dac_test
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 10; struct Node { int is, id, x; bool operator<(const Node &a) const { if (x != a.x) return x < a.x; else return is < a.is; } }; int a[maxn * 4], s[maxn], p[maxn], inc[maxn], b[maxn], treea[maxn * 4], ... |
extern "C" int ScheduleWavefront();
extern "C" void DescheduleWavefront(int cuid, int wfTag);
extern "C" int getTotalWavefronts();
extern "C" int getCuId();
//extern "C" int getWgId();
//extern "C" int getWfId();
extern "C" int getWfTag();
extern "C" int getWfCnt();
extern "C" int getWfNumThrds();
extern "C" int getVre... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 03/31/2014 07:10:33 PM
// Design Name:
// Module Name: led_controller_sim
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:... |
#include <bits/stdc++.h> using namespace std; int n, k; int cheak(int x) { int sum = x; while (x) { sum += x / k; x /= k; } if (sum >= n) return 1; return 0; } int main() { scanf( %d%d , &n, &k); int head = 1, tail = n; while (head <= tail) { int mid = (head +... |
/*
* Copyright (c) 1998-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... |
// -- (c) Copyright 2008 - 2014 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... |
`include "elink_constants.v"
module etx_io (/*AUTOARG*/
// Outputs
txo_lclk_p, txo_lclk_n, txo_frame_p, txo_frame_n, txo_data_p,
txo_data_n, tx_io_wait, tx_wr_wait, tx_rd_wait,
// Inputs
reset, etx90_reset, tx_lclk, tx_lclk90, txi_wr_wait_p, txi_wr_wait_n,
txi_rd_wait_p, txi_rd_wait_n, tx_packet, tx_... |
//Copyright 1986-2014 Xilinx, Inc. All Rights Reserved.
//--------------------------------------------------------------------------------
//Tool Version: Vivado v.2014.4 (lin64) Build Tue Nov 18 16:48:31 MST 2014
//Date : Wed Sep 30 14:31:49 2015
//Host : rcswrka27 running 64-bit Ubuntu 10.04.4 LTS
//Co... |
#include <bits/stdc++.h> using namespace std; int mdc(int a, int b) { return !b ? a : mdc(b, a % b); } int main() { int n, m, x, y, a, b, p, d, x1, y1, x2, y2; cin >> n >> m >> x >> y >> a >> b; d = mdc(a, b); a /= d; b /= d; p = min(n / a, m / b); a *= p; b *= p; if (x + a / 2... |
#include <bits/stdc++.h> using namespace std; const int Maxn = 3e5 + 10; const int lim = 1000; int prime[Maxn], M[Maxn], H[Maxn], cnt; bool vis[Maxn]; struct node { int v, c, l; } a[Maxn]; int cmp(node A, node B) { return A.l < B.l; } int n, k; int main() { int cnt = 0; vis[0] = vis[1] =... |
module Computer(
output [COUNTER_WIDTH-1:0] COUNTER_bus,
output [WORD_WIDTH-1:0] ADDR_bus,
output [WORD_WIDTH-1:0] DATA_bus,
input CLK,
input RST
);
parameter WORD_WIDTH = 16;
parameter DR_WIDTH = 3;
parameter SB_WIDTH = DR_WIDTH;
parameter SA_WIDTH = DR_WIDTH;
parameter OPCODE_WIDTH = 7;
parameter CNTRL_WIDTH =... |
#include <bits/stdc++.h> using namespace std; int main() { unsigned int n, c, i, ans = 1, arr[100001]; cin >> n >> c; for (i = 0; i < n; i++) { cin >> arr[i]; } for (i = 1; i < n; i++) { if (arr[i] - arr[i - 1] <= c) ans++; else ans = 1; } cout << ans; ... |
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > q[500005]; int n, m, tot, nms, ans[500005], dep[500005], ms[500005], sz[500005], t[500005][30], a[500005], hd[500005], to[500005], nxt[500005]; char ch[500005]; int read() { int x = 0, fl = 1; char ch = getchar(); while (c... |
//wishbone_arbiter.v
/*
Distributed under the MIT licesnse.
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 r... |
#include <bits/stdc++.h> using namespace std; long long i, j, k, n, m, x, y, T, ans, mx, mi, cas, num, len; bool flag; long long a[105]; const int mod = 1000000007; typedef struct matrixnod { long long m[105][105]; } matrix; matrix mat(matrix a, matrix b) { matrix c; for (long long i = 0; 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.