text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const int mod = 1e9 + 7; const int maxn = 3e3 + 555; struct node { long long x, y, v; bool operator<(const node& n) const { if (x != n.x) return x < n.x; else return y < n.y; } }; long long pre[maxn][maxn]; node ori[maxn... |
#include <bits/stdc++.h> using namespace std; int main() { char s1[50], s2[50]; cin >> s1 >> s2; long long left = 0, right = 0, mid = 0, l; l = strlen(s1); for (long long i = 0; i < l; i++) if (s1[i] == | ) { mid = i; break; } left = mid; right = l - (mid + 1... |
//Legal Notice: (C)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
//simulation files), and any associated do... |
//---------------------------------------------------------------------//
// Name: addrgen.v
// Author: Chris Wynnyk
// Date: 2/3/2008
// Purpose: Generates addresses.
//---------------------------------------------------------------------//
module addrdecode(
clk,
addr_in,
bank0_addr,
bank1_addr... |
// Copyright 2017 Google LLC
//
// 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 29.06.2017 23:55:46
// Design Name:
// Module Name: instructionfetch
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
// ... |
`timescale 1ns / 1ps
module SHDCluster #(parameter DNA_DATA_WIDTH = 128, NUM_PES = 8) (
input clk,
input rst,
//Scheduler Interface
input[DNA_DATA_WIDTH - 1:0] dna_in,
input[DNA_DATA_WIDTH*NUM_PES - 1:0] dna_ref_in,
input dna_valid_in,
output dna_rd_en,
... |
module test
(output reg a,
output reg b,
input wire [1:0] sel,
input wire d
/* */);
always @* begin
b = d;
case (sel)
0:
begin
a = 0;
b = 1;
end
1:
begin
a = 1;
//b = 0; // Pick up input from d instead.
end
default:
begin
a = d... |
/**
* 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 q; cin >> q; while (q--) { vector<vector<int> > grid; int h, w; cin >> h >> w; grid.assign(h, vector<int>(w, 0)); for (int i = 0; i < h; i++) { for (int j = 0; j < w; j++) { scanf( %d , &grid[i... |
#include <bits/stdc++.h> using ll = long long; using namespace std; int n, k, a[110]; int main() { ios::sync_with_stdio(false); cin >> n >> k; for (int i = 0; i < k; ++i) cin >> a[i]; vector<int> s; for (int i = 1; i <= n; ++i) s.push_back(i); int curr_leader = 0; for (int i = 0; i <... |
#include <bits/stdc++.h> long long mod = 1e9 + 7, mod2 = 998244353; const int N = int(3e5) + 999; using namespace std; long long fac[10000000]; long long gcd(long long x, long long y) { if (y == 0) return x; return gcd(y, x % y); } long long fexp(long long a, long long b, long long m) { long l... |
/*
* 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 n, m; long long mypow(int n, int m) { long long ans = 1, a = 3; while (n > 0) { if (n & 1) ans = ans * a % m; a = a * a % m; n >>= 1; } return ans; } int main() { while (~scanf( %d%d , &n, &m)) { long long ans = mypo... |
// (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 ... |
/*
* 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 (c) 2001 Stephan Boettcher <>
*
* 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)
*... |
#include <bits/stdc++.h> using namespace std; multiset<long long> buckets[30]; long long bsum[30]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int q, tot = 0; cin >> q; while (q--) { char c; long long x; cin >> c >> x; int p = 31 - __builtin_clz(x), ans = 0... |
#include <bits/stdc++.h> using namespace std; int present(int *lib, int k, int x) { int i; for (i = 0; i < k; i++) { if (lib[i] == x) return 1; } return 0; } int findMax(int *lib, int k, queue<int> *q, int n) { int i, max = -1, maxi = 0; for (i = 0; i < k; i++) { if (q[lib[i]... |
#include <bits/stdc++.h> using namespace std; const int N = 100005; vector<pair<int, int>> adj[N], fish[N]; int n, m, now, depth[N]; struct node_t { int x, d, v; node_t(int x, int d, int v, int t = 0) : x(x - d * t), d(d), v(v) {} bool operator<(const node_t &b) const { int p = x + now * d, ... |
// 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;
reg [40:0] quad; initial quad = 41'ha_bbbb_cccc;
reg [80:0] wide; initial wide = 81'habc_1234_5678_1234_5678;
reg [8:0] nine; initial nine =... |
/**
* 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> #define testCase int T; cin>>T; while(T--) #define int long long #define Endl endl using namespace std; /* */ const int N = 1e5+13, LMAX = 3e18 + 13, IMAX = 1e9 + 5, mod = 1e9 + 7; //998244353; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(nu... |
#include <bits/stdc++.h> int main() { long long a, b; scanf( %I64d %I64d , &a, &b); printf( %I64d n , (6LL * a - 1LL) * b); for (long long i = 1; i <= a; i++) { printf( %I64d %I64d %I64d %I64d n , (6LL * i - 5LL) * b, (6LL * i - 4LL) * b, (6LL * i - 3LL) * b, (6LL * i - 1LL) * b); ... |
// 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", ... |
// Computer_System_Video_In_Subsystem_avalon_st_adapter_001.v
// This file was auto-generated from altera_avalon_st_adapter_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 16.1 196
`timescale 1 ps / 1 ps
module Computer_System_Video_In_Subsystem_avalon_st_adapter_001... |
#include <bits/stdc++.h> using namespace std; const int N = 200010; long long a[N], b[N], p[N], money; int top, n, m, ans, st[N]; vector<long long> v[N]; priority_queue<long long> q; void get_sale_day() { for (int i = 1; i <= n; ++i) { while (top && a[i] >= a[st[top]]) --top; st[++top] = i... |
/* lab3_part5.v - 16-bit latch
*
* Copyright (c) 2014, Artem Tovbin <arty99 at gmail dot com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed ... |
/*
* 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> long long z; int l, r, i, j, k, ans; short p; std::vector<short> prm; std::vector<int> to; short dp[3000111]; bool done[3000111]; void dfs(long long now, char cnt) { to.push_back(now); for (; cnt < prm.size() && now * prm[cnt] <= r; ++cnt) dfs(now * prm[cnt], cnt);... |
#include <bits/stdc++.h> using namespace std; mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count() * ((uint64_t) new char | 1)); int K, N; vector<int> A, B, Z; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> K; N = 1 << K; Z.resize(N); ... |
/*
* 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 n, l, r, x, res = 0; vector<int> subset; void search(int k, const vector<int>& v) { if (k == n) { long long count = accumulate(subset.begin(), subset.end(), 0); if (count >= l && count <= r && (subset.back() - subset.front()) >= x) ++res;... |
#include <bits/stdc++.h> using namespace std; const int N = 2005; bool vis[N]; pair<int, int> pt[N]; int dp[N]; int main() { memset(dp, 0x3f, sizeof(dp)); int a, m, n; cin >> a >> n >> m; for (int i = 1; i <= n; i++) { int l, r; scanf( %d %d , &l, &r); for (int j = l + 1; j... |
#include <bits/stdc++.h> using namespace std; template <typename... T> void err(istream_iterator<string> it) {} template <typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cerr << *it << = << a << , ; err(++it, args...); } const long long inf = 1LL << 60;... |
//
// 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 (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... |
#include <bits/stdc++.h> using namespace std; map<long long, long long> mp; string s; long long n, m, k, ans; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); srand(time(0)); cin >> n; vector<long long> a(n + 1, 0); for (long long i = 1; i <= n; ++i) cin >> a[i];... |
module LZC #(
parameter width = 8,
parameter word = 4
)(
input wire CLK,
input wire RST_N,
input wire MODE,
input wire IVALID,
input wire [width-1:0] DATA,
output reg OVALID,
output reg [8:0] ZEROS
);
parameter INPUT = 1'b0;
parameter OUTPUT = 1'b1;
integer i;
wire have_one;
reg state, state_next;
reg... |
/*
* 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; int main() { int n, x, y, sum = 0; cin >> n >> x >> y; sum = (n * y) / 100; if ((n * y) % 100 != 0) { sum += 1; } if (sum <= x) cout << 0; else cout << abs(sum - x); return 0; } |
// (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 la... |
Require Import Coq.Setoids.Setoid.
Require Import Coq.Classes.Morphisms.
Require Import Coq.Arith.Arith_base.
(***
*** Domains (which are just pre-orders with a fancy name)
***)
Class DomainOrder (A:Type) : Type :=
approx : relation A.
(* Notation for approx *)
Notation "x '<<<' y" := (approx x y) (at level 80... |
/*
for a elctric speed control, we will be generationg
1 - 1.5MS plus width: rolling speed from -max to 0, 0.1ms as 1 step
1.5 - 2MS plus width: rolling speed from 0 to +max
the pwm period is 18--22ms here we defined it as 20MS, 50 HZ
*/
module quadpwm(rst_n, freq_clk, enable, mode, led);
input rst_n;
input f... |
// Copyright 1986-2015 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2015.4 (lin64) Build Wed Nov 18 09:44:32 MST 2015
// Date : Thu Aug 25 17:34:14 2016
// Host : fpgaserv running 64-bit Ubuntu 14.04.4 LTS
... |
#include <bits/stdc++.h> using namespace std; struct node { int left, right, size; } t[600000]; int n; int a[200005], b[200005], sa[200005], sb[200005], s[200005], ans[200005]; int readint() { int x = 0, f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; int c, v0, v1, a, l; cin >> c >> v0 >> v1 >> a >> l; int ans = 1; c -= min(v0, v1); int p = 0; while (c > 0) { v0 = v0 + a; p = min(v0, v1... |
#include <bits/stdc++.h> using namespace std; long long int BinSea(vector<long long int>& a, long long int low, long long int high, long long int n) { long long int ct = high; long long int ans = high; while (low <= high) { long long int mid = low + ((high - low) / 2); ... |
/**
* 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 t, d, ct, q, ans, l, m, r, n, mx, mn, i, j, k, x, y, z, s; char ch; string ss = , str = ; long long a[200003], b[200003]; int main() { ios_base::sync_with_stdio(false), cin.tie(nullptr); s = k = d = l = mx = m = mn = r = q = i = j = z = x =... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2000; int n, i, j; char s[maxn]; long long F[maxn][maxn]; long long P[maxn]; int main() { scanf( %d , &n); scanf( %s , s); P[1] = 1; for (i = 2; i <= 18; ++i) P[i] = 10LL * P[i - 1]; memset(F, 0, sizeof F); for (i = 0; ... |
#include <bits/stdc++.h> using namespace std; set<int> s[100005]; int color[100005]; int main() { int n, m; while (~scanf( %d%d , &n, &m)) { int i, j, tmp = 0; int u, v, ans; for (i = 1; i <= n; i++) scanf( %d , &color[i]); for (j = 0; j < m; j++) { scanf( %d%d , &u, &v);... |
#include <bits/stdc++.h> using namespace std; vector<set<int> > arr; long long res = 0; void dfs(int vertex, int prev, int level) { for (int v : arr[vertex]) { if (v == prev) { continue; } if (level == 2) { res++; continue; } else { dfs(v, vertex, leve... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> a; int cnt = 0; int sum = 0; for (int i = 0; i < 2 * n - 1; ++i) { int x; cin >> x; a.push_back(abs(x)); if (x < 0) cnt++; sum += abs(x); } cnt %= n; queue<int> q... |
// ----------------------------------------------------------------------
// Copyright (c) 2015, The Regents of the University of California All
// rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:... |
// megafunction wizard: %ROM: 1-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: Apod.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ===================... |
#include <bits/stdc++.h> int main() { char p[1000001]; int n, m, y2; int y1 = -1; long long ans = 1; scanf( %d %d , &n, &m); scanf( %s , p); int plen = strlen(p); for (int i = 0; i < m; ++i) { scanf( %d , &y2); if (-1 == y1) { n -= plen; } else if (y2 - y1 < p... |
/**
* This file is part of pyBAR.
*
* pyBAR 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 Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* pyBAR is distributed 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... |
/*
* 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> int temp[500000], a[500000], indices[500000], increments[500000], previous_appearance[500000], numbers_equal_c[500000]; void mergesort(int Array[], int indices[], int first, int last) { if (first == last) return; int middle = (first + last) / 2; mergesort(Array, indices, f... |
#include <bits/stdc++.h> static const int MaxSize = 1e5; int tree[4 * MaxSize][2]; static void build(std::vector<int> &v, int vertex, int tl, int tr) { if (tl == tr) tree[vertex][0] = v[tl]; else { int tm = (tl + tr) / 2; build(v, 2 * vertex + 1, tl, tm + 0); build(v, 2 * vertex + ... |
/**
* 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; struct Lem { int m, v, id; bool operator<(Lem b) const { return m < b.m || (m == b.m && v < b.v); } }; int n, k, h; Lem a[(100000 + 10)]; bool can(double t) { int j = k; for (int i(n - 1), _l(0); i >= _l; --i) { if (j > 0 && (double)j * h /... |
#include <bits/stdc++.h> using namespace std; int times, used[200010], t[200010], first[200010], last[200010], d[200010], n, a[200010]; vector<vector<int> > g(200010); void dfs(int v, int pr) { used[v] = 1; first[v] = ++times; d[v] = d[pr] + 1; for (int i = 0; i < g[v].size(); i++) { ... |
#include <bits/stdc++.h> FILE *in = stdin, *out = stdout; using namespace std; int n; vector<int> son[5005]; int tot; vector<int> edge[5005]; int dy[5005][2][5005]; int leaf[5005]; int visit[5005]; void input() { fscanf(in, %d , &n); for (int i = (1); i <= (n - 1); i++) { int x, y; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; scanf( %d%d , &n, &m); if (n < 2) printf( %d n , n); else if (n / 2 < m) printf( %d n , m - 1); else printf( %d n , m + 1); } |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); string s; cin >> s; long long int a = 0, b = 0, c = 0; for (int i = 0; i < s.length(); i++) { if (i > 0 && s[i - 1] == v && s[i] == v ) { a++; ... |
// ============================================================================
module iserdes_idelay_histogram #
(
parameter UART_PRESCALER = 868, // UART prescaler
parameter ISERDES_MODE = "DDR",
parameter ISERDES_WIDTH = 8
)
(
// Closk & reset
input wire CLK,
input wire RST,
// UART
input wire UART_RX,
outp... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); int n, k; cin >> n >> k; vector<pair<int, pair<int, int> > > ans; int v[4][n]; for (int i = 0; i < 4; ++i) { for (int j = 0; j < n; ++j) { cin >> v[i][j]; } } for (int i = 1; ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); long long n = 0, m = 0, mn = 0, mx = 0, l = 1, r = 0, k = 0, j = 1, i = 0, ans = 0; cin >> n; vector<int> a(n); for (auto &x : a) cin >> x; bool got = true; while (got) { ... |
#include <bits/stdc++.h> using namespace std; const int N = (int)2e5 + 50, LOGN = 17; const int INF = (int)1e9; int n, k; int ord[N], in[N], tim = 0; char las[N]; int lc[N], rc[N]; int res[N]; string str; void dfs(int v) { if (lc[v] != -1) dfs(lc[v]); ord[tim] = v; in[v] = tim++; if ... |
#include <bits/stdc++.h> using namespace std; vector<vector<int>> dg, og; vector<bool> vist; vector<int> dist; void bfs(int begin) { vist[begin] = true; dist[begin] = 0; queue<int> pq; pq.push(begin); while (!pq.empty()) { int a = pq.front(); pq.pop(); for (int i = 0; i <... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:41:14 04/19/2014
// Design Name:
// Module Name: Image_viewer_top
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
/... |
module hi_sniffer(
ck_1356meg,
pwr_lo, pwr_hi, pwr_oe1, pwr_oe2, pwr_oe3, pwr_oe4,
adc_d, adc_clk,
ssp_frame, ssp_din, ssp_clk
);
input ck_1356meg;
output pwr_lo, pwr_hi, pwr_oe1, pwr_oe2, pwr_oe3, pwr_oe4;
input [7:0] adc_d;
output adc_clk;
output ssp_frame, ssp_din, ssp_clk;
// We... |
#include <bits/stdc++.h> using namespace std; class Graph { long long n; vector<long long> f, par, ans, sz, depth, value, size, fst, to, next; long long l; void swapUtil(long long &, long long &); long long getP(long long); long long dfsUtil(long long); void setDFS(); void setsz(); ... |
//****************************************************************************************************
//*----------------Copyright (c) 2016 C-L-G.FPGA1988.Roger Wang. All rights reserved------------------
//
// -- It to be define --
// -- ... |
/**
* 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 law... |
#include <bits/stdc++.h> using namespace std; stack<int> s; int a[(int)(1e+6) * 5]; bool b[(int)(1e+6) * 5]; int main() { ios_base::sync_with_stdio(0); int n, i, t, x; cin >> n; for (i = 1; i <= n; i++) cin >> a[i]; cin >> t; while (t > 0) cin >> x, b[x] = 1, t--; for (i = n; i > 0... |
// megafunction wizard: %RAM: 2-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: dac_buf.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ================================... |
#include <bits/stdc++.h> using namespace std; int a[3]; int main() { cin >> a[0] >> a[1] >> a[2]; sort(a + 0, a + 3); int res = 0; while ((a[0] + a[1]) <= a[2]) { a[0]++; res++; } cout << res; } |
`timescale 1ns/10ps
module vga_pll_0002(
// interface 'refclk'
input wire refclk,
// interface 'reset'
input wire rst,
// interface 'outclk0'
output wire outclk_0,
// interface 'locked'
output wire locked
);
altera_pll #(
.fractional_vco_multiplier("false"),
.reference_clock_frequency("50.0 MHz"),
... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; int n; cin >> n; if (n & 1) { vector<int> v1, v2; bool flag = true; for (int i = 1; i <= 2 * n; i++) { if (flag) { v1.push_back(i); ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, r1 = -1, p1 = -1, p2 = INT_MAX, x, a, b; cin >> n; while (n--) cin >> x, r1 = max(r1, x); cin >> n; while (n--) cin >> x, p1 = max(p1, x); cin >> n; while (n--) cin >> x, p2... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 20:07:05 10/11/2015
// Design Name:
// Module Name: UART_fifo_interface
// Project Name:
// Target Devices:
// Tool versions:
// Description:
... |
#include <bits/stdc++.h> using namespace std; const int maxn = 5e3 + 5, mum = 1e9 + 7; int Pow(int A, long long B) { int num = 1; while (B) { if (B & 1) num = 1LL * num * A % mum; A = 1LL * A * A % mum; B >>= 1; } return num; } int main() { ios::sync_with_stdio(0), cin.ti... |
// DESCRIPTION: Example pli file for vpassert program
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2000-2012 by Wilson Snyder.
`timescale 1ns/1ns
module pli;
// A module called PLI is required, to contain the error counts
// This is required with the vpassert --nostop op... |
#include <bits/stdc++.h> using namespace std; int M = 1e9; int ask(int x, int y) { cout << ? << x << << y << endl; cin >> x; return x; } int main() { int s = ask(1, 1), k; int u, v, l = 1, r = M, mid; while (r > l + 1) { mid = l + r >> 1; k = ask(1, mid); if (k... |
#include <bits/stdc++.h> using namespace std; int n; int a[101]; int res = 0; void solve() { for (int i = 2; i < n; ++i) { if (a[i] == 0) { if (a[i - 1] == 1 && a[i + 1] == 1 && a[i + 2] == 0 && a[i + 3] == 1 && i - 1 > 0) { a[i + 1] = 0; ++res; i +=... |
#include <bits/stdc++.h> using namespace std; bool F[2001][2001]; bool D[2001][2001]; int C[2001]; vector<int> V[2001]; int n; void f(int v, int c) { if (C[v]) return; C[v] = c; V[c].push_back(v); for (int i = 1; i <= n; ++i) if (F[v][i]) f(i, c); } int main() { ios_base::syn... |
#include<bits/stdc++.h> using namespace std; #define FOR(i, j, k) for(int i = j; i <= k; i++) #define ROF(i, j, k) for(int i = j; i >= k; i--) #define PB push_back #define MEM(n, val) memset((n), val, sizeof(n)) #define FastIO ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); #define F first #... |
#include <bits/stdc++.h> using namespace std; const long long MOD = (long long)1e9 + 7; const int N = 1e5 + 5, inf = 1e9 + 5; long long add(long long x, long long y) { x += y; if (x >= MOD) return x - MOD; return x; } long long sub(long long x, long long y) { x -= y; if (x < 0) return x ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, t; cin >> n >> t; long long dp[n + 3][2 * t + 3][5]; for (int i = 1; i <= 4; i++) { dp[n][2 * t - 1][i] = 1; for (int j = 0; j < 2 * t - 1; j++) { dp[n][j][i] = 0; } for (int j = 1; j <= n; j++) { ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 100100; int N; long long K; int ar[MAXN]; int main() { cin >> N >> K; for (int i = 0; i < N; i++) cin >> ar[i]; --K; sort(ar, ar + N); for (int i = 0; i < N;) { int cur = i; int cnt = 0; while (i < N && ar[i... |
#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 ; cons... |
/**
* 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 = 1e9 + 5; const int MOD = 1000000007; int a[300005]; int main() { int n, p; cin >> n >> p; for (int i = 1; i <= n; i++) cin >> a[i]; while (p--) { int l, r, x; cin >> l >> r >> x; int lar = r - x; int num = a[... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.