text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 5; template <class T> void read(vector<T> &arr) { for (auto &x : arr) cin >> x; } template <class T> void read(T &x) { cin >> x; } template <class T> void write(vector<T> &arr) { for (auto x : arr) cout << x << ... |
module sgpr_comparator
(/*AUTOARG*/
// Outputs
result,
// Inputs
retired_operand_mask, retired_operand_addr, src1_gpr_info,
src4_gpr_info, dst1_gpr_info, src2_gpr_info, src3_gpr_info,
dst2_gpr_info
);
wire src1_cmp_en, src2_cmp_en, src3_cmp_en, src4_cmp_en,
dst1_cmp_en, dst2_cmp_en;
... |
#include <bits/stdc++.h> using namespace std; long long int q; void solve(long long int x) { for (long long int i = 2; i * i <= x; i++) { if (x % i == 0) { long long int temp = x / i; for (long long int j = 2; j * j <= temp; j++) { if (temp % j == 0) { cout << 1 << ... |
#include <bits/stdc++.h> using namespace std; const int NN = 5050; const int MM = 27272; int a[MM], b[MM]; vector<int> adj[NN]; int main() { int n, m; scanf( %d%d , &n, &m); for (int i = 1; i <= m; i++) { scanf( %d%d , a + i, b + i); adj[a[i]].push_back(b[i]); } int mx = 0; ... |
/*
----------------------------------------------------------------------------------
Copyright (c) 2013-2014
Embedded and Network Computing Lab.
Open SSD Project
Hanyang University
All rights reserved.
----------------------------------------------------------------------------------
Redistribution and use ... |
#include <bits/stdc++.h> using namespace std; const long long MOD = pow(10, 9) + 7; const long long MAX = LONG_LONG_MAX; void solve() { int n; cin >> n; vector<string> a(n, ); for (int i = 0; i < n; i += 1) cin >> a[i]; for (int i = 0; i < n; i += 1) { for (int j = 0; j < n; j += 1) ... |
#include <bits/stdc++.h> using namespace std; int a[] = {0, 1, 1, 1, 2, 1, 2, 1, 5, 2, 2, 1, 5, 1, 2, 1, 14, 1, 5, 1, 5, 2, 2, 1, 15, 2, 2, 5, 4, 1, 4, 1, 51, 1, 2, 1, 14, 1, 2, 2, 14, 1, 6, 1, 4, 2, 2, 1, 52, 2, 5, 1, 5, 1, 15, 2, 13, 2, 2, 1, 13, 1, 2, 4,... |
/**
* 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 inf = 200000000; struct Point { int x, y; Point(int _x, int _y) { x = _x; y = _y; } }; bool operator<(const Point a, const Point b) { return a.x < b.x; } long long solve(vector<Point> v) { int n = (int)v.size(); vector<i... |
#include <bits/stdc++.h> int gcd(int a, int b) { int r; while (b != 0) { r = a % b; a = b; b = r; } return a; } int main() { int n, m; int deg1, deg2; scanf( %d %d , &n, &m); for (int i = 0, a; i <= n; i++) { scanf( %d , &a); if (i == 0) deg1 = 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; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long int n, m, i; cin >> n >> m; long long int arr[n + 5]; map<long long int, long long int> ma; queue<long long int> q; for (i = 0; i < n; i++) { cin >> arr[i]... |
//////////////////////////////////////////////////////////////////////
//// ////
//// ROM ////
//// ////
//// Author(s): ... |
#include <bits/stdc++.h> using namespace std; template <typename T> using V = vector<T>; const long long int mod = 1000000007; struct sb { size_t c, ind; unsigned long long int a, b; }; bool cmp(sb a, sb b) { return a.c < b.c; } struct s { unsigned long long int sub; size_t lastsub; ... |
#include <bits/stdc++.h> using namespace std; void err(istream_iterator<string> it) { cerr << endl; } template <typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cerr << *it << = << a << , ; err(++it, args...); } namespace fastIO { bool IOerror = 0; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int v = 0; map<int, int> s; for (int i = 19; s.size() < 10010; i += 9) { int kk = i; int c = 0; while (kk > 0) { c += kk % 10; kk /= 10; } if (c == 10) s[v++] = i; } ... |
#include <bits/stdc++.h> using namespace std; int Ans, Cap[55][55], From[55], K, N, T[55]; vector<int> E[55]; bool dijkstra() { priority_queue<pair<int, int>, vector<pair<int, int>>, greater<pair<int, int>>> q; vector<int> d(55, 1005); d[1] = 0; q.push(make_pair(0, 1))... |
#include <bits/stdc++.h> using namespace std; const int N = 105; char arr[N], dp[N][N * N], ndp[N][N * N]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n; cin >> n; int sz = 0; for (int i = 0; i < n; i++) { int x; cin >> x; arr[x... |
`timescale 1ns/1ps
module search_engine(
clk,
reset,
key_valid,
key,
bv_valid,
bv,
localbus_cs_n,
localbus_rd_wr,
localbus_data,
localbus_ale,
localbus_ack_n,
localbus_data_out
);
input clk;
input reset;
input key_valid;
input [26:0]key;
output bv_valid;
output[35:0]bv;
input lo... |
/**
* 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 INF = 0x3f3f3f3f; const int MAX = 1123; int ans[MAX]; int main() { int n; cin >> n; memset(ans, INF, sizeof(ans)); for (int i = 0; i < 10; i++) { vector<int> data1, data2; for (int j = 1; j <= n; j++) { if (j & (1 << i... |
// ***************************************************************************
// ***************************************************************************
// 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... |
// file: MIPS_CPU_clk_wiz_0_0.v
//
// (c) Copyright 2008 - 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
// laws.
//
// DISCLAIMER
// This disclaime... |
/**
* This is written by Zhiyang Ong
* and Andrew Mattheisen
*/
`timescale 1ns/100ps
/**
* `timescale time_unit base / precision base
*
* -Specifies the time units and precision for delays:
* -time_unit is the amount of time a delay of 1 represents.
* The time unit must be 1 10 or 100
* -base is the time bas... |
//*****************************************************************************
// DISCLAIMER OF LIABILITY
//
// This file contains proprietary and confidential information of
// Xilinx, Inc. ("Xilinx"), that is distributed under a license
// from Xilinx, and may be used, copied and/or disclosed only
// pursuant to the... |
// DEFINES
`define BITS 32 // Bit width of the operands
module dscg(clock,
reset,
cos,
one,
s1,
s2,
s1_out,
s2_out
);
// SIGNAL DECLARATIONS
input clock;
input reset;
input [`BITS-1:0] cos;
input [`BITS-1:0] one;
input [`BITS-1:0] s1;
input [`BITS-1:0] s2;
output [`BITS-1:0] s1_out;
outp... |
/**
* 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... |
//==================================================================================================
// Filename : Comparators.v
// Created On : 2016-09-22 10:07:30
// Last Modified : 2016-09-22 14:51:38
// Revision :
// Author : Jorge Sequeira Rojas
// Company : Instituto Tecnologico de... |
module qa_contents
#(
parameter WIDTH = 32,
parameter MWIDTH = 1
)
(
input wire clk,
input wire rst_n,
input wire [WIDTH-1:0] in_data,
input wire in_nd,
input wire [MWIDTH-1:0] in_m,
// Takes input messages to set ... |
#include <bits/stdc++.h> using namespace std; const int inf = (int)1e9; const int mod = inf + 7; const double eps = 1e-9; const double pi = acos(-1.0); long double a, b, c, d; pair<long double, long double> get(pair<long double, long double> a, pair<long double, long d... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2013.4
// Copyright (C) 2013 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1 ns / 1 ps
m... |
#include <bits/stdc++.h> using namespace std; const int LOG = 22; int32_t main() { ios::sync_with_stdio(false); int n; cin >> n; vector<int> tab(n); vector<int> dp(1 << LOG); vector<pair<int, int> > samples(1 << LOG, {-1, -1}); auto update = [&](int a, int i) { if (i == -1) retur... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int ans = 0; int temp; stack<int> st; for (int i = 0; i < n; ++i) { cin >> temp; while (!st.empty() && st.top() < temp) { ans = max(ans, (st.top() ^ temp)); st.pop(); } if (!st... |
// (C) 1992-2014 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... |
/*
* 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... |
/*
Andrew Mattheisen
Zhiyang Ong
EE-577b 2007 fall
VITERBI DECODER
spd module
@modified by Zhiyang Ong on November 1, 2007
The output out signal must be of the data type reg
I had to reallocate this data-type reg.
Correction: It is relabelled to the wire data type since
it is not used again, or explicitl... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2016 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
//
// Special cases of "string parameters" :
// This table compares obtain results from big-3 simulators to... |
// megafunction wizard: %RAM: 2-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: COMMAND_RAM.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ========================... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); string s; int n; while (cin >> n) { cin >> s; int gold = 0, cnt = 0, prev = 0, ans = 0; for (auto ch : s) { if (ch == G ) gold++, cnt++; ... |
#include <bits/stdc++.h> using namespace std; long long cnt, ans, i, j, temp, flag; string s, heavy = heavy , metal = metal ; int main() { cin >> s; for (i = 0; i < s.length(); i++) { temp = i; flag = 0; for (j = 0; j < 5; j++) { if (s[temp] == heavy[j]) ++temp; ... |
// megafunction wizard: %ROM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: ohat.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ===================================... |
#include <bits/stdc++.h> using namespace std; int res; int tox[] = {0, 0, 1, -1}; int toy[] = {1, -1, 0, 0}; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr), cout.tie(nullptr); string s; cin >> s; while (s.back() == 0 ) s.erase(s.size() - 1, 1), res++; while (s != 1 )... |
#include <bits/stdc++.h> using namespace std; long long f[110][2][2]; int ans[110]; int n; long long k; long long calc(long long x, long long a, long long b) { if (f[x][a][b] != -1) return f[x][a][b]; f[x][a][b] = 0; int y = n - x + 1; if (x > y) return f[x][a][b] = 1; for (int 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 la... |
#include <bits/stdc++.h> using namespace std; vector<long long> a; bool valido; vector<vector<long long>> adj; long long d; void dfs(long long u, long long p = 0) { if (!valido) return; for (long long v : adj[u]) if (v != p) dfs(v, u); if (a[u] % d == 0) { a[p]++; } else { ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2019 by Wilson Snyder.
// bug1475
module t (/*AUTOARG*/
// Outputs
ID_45, IDa_f4c,
// Inputs
clk, ID_d9f, IDa_657, ID_477
);
input clk;
output reg ID_45;
input... |
/**
* 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; int x[20005], y[20005], c[20005], ans[20005], LOC; bool cmp(const int &u, const int &v) { return (x[u] - x[LOC]) * (y[v] - y[LOC]) - (y[u] - y[LOC]) * (x[v] - x[LOC]) < 0; } void solve(int l, int r) { if (l > r) return; int loc = l;... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:17:42 07/10/2015
// Design Name:
// Module Name: Test
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Re... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2014 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
`define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h%x exp='h%x\n", ... |
#include <bits/stdc++.h> using namespace std; const int n = 3; long long r, g, b; void reset() { if (r >= g) swap(r, g); if (r >= b) swap(r, b); if (g >= b) swap(g, b); } int main() { while (cin >> r >> g >> b) { reset(); if ((r + g) * 2 <= b) cout << r + g << endl; ... |
/**
* $Id: axi_slave.v -01-21 11:40:39Z matej.oblak $
*
* @brief Red Pitaya symplified AXI slave.
*
* @Author Matej Oblak
*
* (c) Red Pitaya http://www.redpitaya.com
*
* This part of code is written in Verilog hardware description language (HDL).
* Please visit http://en.wikipedia.org/wiki/Verilog
* for mor... |
/*
* 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 t, n; cin >> t; while (t--) { cin >> n; int a = 0, b = 0, k = 2; for (int i = 0; i < n / 2 - 1; i++) { a += k; k *= 2; } for (int i = 0; i < n / 2; i++) { b += k; k *= 2; } ... |
/*
* .--------------. .----------------. .------------.
* | .------------. | .--------------. | .----------. |
* | | ____ ____ | | | ____ ____ | | | ______ | |
* | ||_ || _|| | ||_ \ / _||... |
/////////////////////////////////////////////////////////////////////
//// ////
//// JPEG Run-Length Encoder, intermediate results ////
//// ////
//// - Translate DC and AC coeff. into:... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10:28:04 05/12/2015
// Design Name:
// Module Name: sbox_perm
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depen... |
#include <bits/stdc++.h> using namespace std; const long long NMAX = 300000 + 5; const long long inf = 922337203685477580LL; vector<vector<pair<long long, long long> > > g(NMAX); vector<vector<int> > id(NMAX); long long dis[NMAX]; long long last[NMAX]; long long a[NMAX]; int main() { int n, m; ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 3e5 + 5, mod = 1e9 + 7; int koszt[31], tmp[31]; int main() { int a, b, c, d, e, f, g, z, k, n, m, q; scanf( %d , &n); for (a = 1; a <= 30; a++) koszt[a] = 1000000000; while (n--) { scanf( %d , &a); if (a == 1000) { ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 10; int n, m; int long long dp[maxn]; vector<pair<int long long, int long long>> veci[maxn]; set<pair<int long long, int long long>> st; bool mark[maxn]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0... |
// Test system function calls in constant functions
module constfunc6();
function [7:0] clog2(input [7:0] a);
clog2 = $clog2(a);
endfunction
function real log10(input [7:0] a);
log10 = $log10(a);
endfunction
function real sqrt(input real a);
sqrt = $sqrt(a);
endfunction
function real pow_i(input [7:0] a, inpu... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; const int M = 20; struct edge1 { int v, w; }; struct edge2 { int u, v, w; } e[N]; struct qry { int u, w, id; } q[N]; vector<edge1> G[N]; int n, m, c, a[N], dep[N], ans1[N], ans2[N], f[N][M], g[N][M]; void add(int u,... |
/**
* 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() { double n, m; while (cin >> m >> n) { double res = 0; for (double i = 1; i <= m; i++) { res += i * (pow(i / m, n) - pow((i - 1) / m, n)); } cout << res << endl; } return 0; } |
// hps_design_SMP_CORE_hps_io.v
// This file was auto-generated from altera_hps_io_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 15.0 145
`timescale 1 ps / 1 ps
module hps_design_SMP_CORE_hps_io (
output wire [12:0] mem_a, // memory.mem_a
output wire [2:0... |
// (C) 2001-2016 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... |
/*----------------------------------------------------------------------
*
* module description here
*
*---------------------------------------------------------------------*/
module foo
(/*AUTOARG*/
// Outputs
result_0, result_1,
// Inputs
clk, reset, enable_a
);
//-------------------------------... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } struct KMP { int n, at; string s; vector<int> nxt; vector<int> nxtdiff; void init(int _n) { n = _n, at = 0, s = string(n, ? ), nxt = nxtdiff = vector<int>(n + 1, ... |
#include <bits/stdc++.h> using namespace std; inline void read(register int *n) { register char c; *n = 0; do { c = getchar(); } while (c < 0 || c > 9 ); do { *n = c - 0 + *n * 10; c = getchar(); } while (c >= 0 && c <= 9 ); } long long C[2048][2048], fac[100000... |
#include <bits/stdc++.h> using namespace std; vector<set<int> > g; vector<int> ans; vector<bool> used; void dfs(int v, int p) { used[v] = true; ans.push_back(v); for (set<int>::iterator i = g[v].begin(); i != g[v].end(); i++) { if (!used[*i] && g[*i].count(p)) dfs(*i, v); } } int mai... |
//////////////////////////////////////////////////////////////////////
//// ////
//// uart_transmitter.v ////
//// ////
//// ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2 * 1000 + 5; const long long INF = 1000ll * 1000 * 1000 * 1000 * 1000 * 1000; int n, k, dp[maxn], a[maxn]; bool check(long long x) { for (int i = 1; i <= n; i++) { dp[i] = i - 1; for (int j = 1; j < i; j++) { if (abs(a[i] ... |
#include <bits/stdc++.h> using LL = int64_t; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; std::cin >> n; std::vector<int> a(n); for (int &i : a) std::cin >> i; std::sort(a.begin(), a.end()); int maxa = a.back(); std::vector<std::vector<int>> mx(max... |
#include <bits/stdc++.h> using namespace std; const long long N = 101; long long n; pair<long long, long long> a[N]; signed main() { ios_base::sync_with_stdio(0); cin.tie(0); cin >> n; for (long long i = 0; i < n; ++i) cin >> a[i].first >> a[i].second; long long p; cin >> p; for (l... |
#include <bits/stdc++.h> #pragma comment(linker, /stack:256000000 ) using namespace std; const int INF = 1000000000; const long long LINF = 4000000000000000000LL; const double eps = 1e-9; void prepare() {} struct Chat { string name, text; unsigned int hname; set<unsigned int> words; vecto... |
#include <bits/stdc++.h> using namespace std; int a[300001]; int f[300001]; vector<int> g[33]; map<vector<int>, int> mp; vector<pair<vector<int>, int> > v; vector<int> cur; int br = 0; int n; void F(int pos, int mask) { if (pos == br) { v.push_back({cur, mask}); return; } F(p... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long n1, long long n2) { if (!n1) return n2; if (!n2) return n1; if (n1 % n2 == 0) return n2; return gcd(n2, n1 % n2); } long long powmod(long long base, long long exponent) { base %= 1000000007; long long ans = 1; whil... |
#include <bits/stdc++.h> using namespace std; int n, x[1500][1500], y[1500][1500], vis[1510][1500]; char ans[1500][1500]; struct node { int x, y; }; int dx[] = {0, 0, 1, -1}; int dy[] = {1, -1, 0, 0}; vector<node> a; int main() { cin >> n; for (int i = 1; i <= n; i++) { for (int 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; long long n, t, twoc, onec, opt, old; int main() { cin >> n; cin >> t; if (t == 1) onec++; else twoc++; old = t; for (int i = 1; i < n; i++) { cin >> t; if (t == 1) { if (old == 2) onec = 1; els... |
#include <bits/stdc++.h> using namespace std; constexpr long long INF = 2e18; constexpr long long MOD = 1e9 + 7; constexpr long long MAXN = 2e5 + 3; struct Matrix { static constexpr long long MOD = 1e9 + 7; static constexpr long long MAXN = 200, MAXM = 200; array<array<long long, MAXM>, MAXN> mat ... |
#include <bits/stdc++.h> using namespace std; int md = 1e9 + 7; int __gcd(int a, int b) { if (b == 0) return a; return __gcd(b, a % b); } int poww(int a, int b) { int res = 1; while (b) { if (b & 1) { res *= a; res %= md; } a *= a; a %= md; b >>= 1... |
#include <bits/stdc++.h> using namespace std; int cmp(string s1, string s2) { if (s1 == rock && s2 == scissors ) return 1; if (s1 == scissors && s2 == paper ) return 1; if (s1 == paper && s2 == rock ) return 1; return 0; } int main() { string s1, s2, s3; cin >> s1 >> s2 >> s3; ... |
#include <bits/stdc++.h> using namespace std; char comp[200005]; vector<pair<int, int> > edge[200005]; vector<int> father[200005]; vector<string> ans; int dis[200005], n, k; queue<pair<int, int> > q; void dfs(int u) { if (ans.size() >= k) return; if (u == n + 1) { ans.push_back(comp + 1); ... |
#include <bits/stdc++.h> using namespace std; int main(void) { int i; char n[100010], m; stack<char> s; scanf( %s , n); for (i = 0; n[i] != 0; i++) { if (s.empty()) { s.push(n[i]); } else { m = s.top(); if (m == n[i]) s.pop(); else ... |
// Copyright (c) 2014, Segiusz 'q3k' Bazanski <>
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this l... |
//////////////////////////////////////////////////////////////////////
// Created by Actel SmartDesign Tue Apr 29 08:58:52 2014
// Testbench Template
// This is a basic testbench that instantiates your design with basic
// clock and reset pins connected. If your design has special
// clock/reset or testbench driver r... |
//****************************************************************************************************
//*---------------Copyright (c) 2016 C-L-G.FPGA1988.lichangbeiju. All rights reserved-----------------
//
// -- It to be define --
// -- ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using db = double; using str = string; using pi = pair<int, int>; using pl = pair<ll, ll>; using pd = pair<db, db>; using vi = vector<int>; using vb = vector<bool>; using vl = vector<ll>; using vd = vecto... |
// $Id: rtr_flit_type_check.v 5188 2012-08-30 00:31:31Z dub $
/*
Copyright (c) 2007-2012, Trustees of The Leland Stanford Junior University
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistri... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n <= 2) cout << -1 ; else if (n == 3) cout << 210 ; else { int mod = 1; for (int i = 1; i < n; ++i) mod = (mod * 10) % 210; if (n > 3) cout << 1 ; for (int i = 0; i < n - 4; ++i... |
/////////////////////////////////////////////////////////////////////
//// ////
//// JPEG Encoder Unit ////
//// ////
//// Author: Richard Herveille ... |
#include <bits/stdc++.h> using namespace std; int read() { int tot = 0, fh = 1; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) fh = -1; c = getchar(); } while (c >= 0 && c <= 9 ) { tot = tot * 10 + c - 0 ; c = getchar(); } return tot * fh; } ... |
#include <bits/stdc++.h> using namespace std; bool visit[4]; long long dfs(vector<long long> &v, vector<char> &chars) { long long res = LLONG_MAX; if (v.size() == 1) { return v.front(); } for (int i = 0; i < v.size() - 1; i++) { for (int j = i + 1; j < v.size(); j++) { vector<l... |
#include <bits/stdc++.h> using namespace std; vector<string> v; int main() { string x, y; int cnt = 0; char temp; int n; cin >> n; n = n + n - 1; for (int i = 0; i < n; i++) { cin >> x; if (x == ** ) continue; cin >> y; x += y; sort(v.begin(), v.end()); ... |
// megafunction wizard: %RAM: 2-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: win_ram.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ================================... |
`timescale 1ns/100ps
/**
* `timescale time_unit base / precision base
*
* -Specifies the time units and precision for delays:
* -time_unit is the amount of time a delay of 1 represents.
* The time unit must be 1 10 or 100
* -base is the time base for each unit, ranging from seconds
* to femtoseconds, and must be... |
`timescale 1ns / 1ps
module arbiter(
// I-Port
input [63:0] idat_i,
input [63:0] iadr_i,
input iwe_i,
input icyc_i,
input istb_i,
input [1:0] isiz_i,
input isigned_i,
output iack_o,
output [63:0] idat_o,
// D-Port
input [63:0] ddat_i,
input [63:0] dadr_i,
input dwe_i,
input dcyc_i,
input dstb_... |
#include <bits/stdc++.h> using namespace std; vector<int> g[5000]; int n, m; int c[100][100]; char t[100][100]; bool used[100][100]; char clr[5000]; bool valid(int i, int j) { return (0 <= i && i < n && 0 <= j && j < m); }; int di[4] = {-1, 1, 0, 0}; int dj[4] = {0, 0, -1, 1}; void dfs(int i, int ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.