text
stringlengths
59
71.4k
#include <bits/stdc++.h> using namespace std; long long i, j, k, m, n, p, s, t, x, a[100005]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); for (cin >> t; t--;) { cin >> n >> x; for (i = p = 0; i < n; i++) { cin >> a[i]; if (a[i] == x) p = 1; ...
#include <bits/stdc++.h> using namespace std; int a[10][10]; int main() { int n; scanf( %d , &n); for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { scanf( %d , &a[i][j]); } } for (int k = 0; k < n; ++k) { for (int i = 0; i < n; ++i) { for (int j = 0;...
#include <bits/stdc++.h> using namespace std; void solve() { long long int n, q, x, y, cnt = 0; cin >> n >> q; vector<vector<long long int>> dp(3, vector<long long int>(n + 2, 0)); while (q--) { cin >> x >> y; if (dp[x][y] == 0) { cnt += (dp[3 - x][y] == 1); cnt += (dp[3 ...
#include <bits/stdc++.h> using namespace std; /* * * * * * * * * * */ #define mp make_pair typedef long long ll; typedef long double ld; typedef pair<int, int> pii; /* * * * * * * * * * */ /* * * * Too many mind, no mind. * * */ bool can(int med, int k, vector <int> &a) { int ...
#include <bits/stdc++.h> using namespace std; long long t, fact[405], inv[405], dp[405][405], ans[405], n, dp2[405]; long long p; long long exp(long long x, long long k) { if (k == 0) return 1; if (k % 2 == 1) return x * exp(x, k - 1) % p; long long y = exp(x, k / 2); return y * y % p; } int...
#include <bits/stdc++.h> using namespace std; const int N = 505; const long long inf = 1e18; inline int read() { int x = 0; char c = getchar(); while (!isdigit(c)) c = getchar(); while (isdigit(c)) x = (x << 3) + (x << 1) + (c ^ 48), c = getchar(); return x; } int n, m, now; long 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 law...
#include <bits/stdc++.h> using namespace std; int A1, A2, A3, A4; int main() { int i; scanf( %d%d%d%d , &A1, &A2, &A3, &A4); if (abs(A3 - A4) > 1) printf( -1 ); else { if (A3 == A4) { if ((((A1) > (A2) ? (A1) : (A2)) - A3 - 1 < 0) || (((A1) < (A2) ? (A1) : (A2)) < 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; struct node { int active; set<int> prev, next; node() : active(1) {} }; int main() { int n, k, m, i, j; int a, b; cin >> n >> m; int cnt = 1; set<int> sh; set<int>::iterator it; for (i = 0; i < n; i++) sh.insert(i); node* ...
/***************************************************************************** * File : processing_system7_bfm_v2_0_arb_wr.v * * Date : 2012-11 * * Description : Module that arbitrates between 2 write requests from 2 ports. * *****************************************************************************/ module ...
#include <bits/stdc++.h> using namespace std; long long GCD(long long a, long long b) { return (a % b) == 0 ? b : GCD(b, a % b); } long long mod(long long x) { return ((x % 998244353 + 998244353) % 998244353); } bool cmp(const pair<int, int> &left, const pair<int, int> &right) { return left.first > ri...
module eb_fifo_ctrl #( parameter DEPTHMO = 4'd15, parameter DEPTHLOG2MO = 3 ) ( input t_0_req, output t_0_ack, output reg i_0_req, input i_0_ack, output reg [DEPTHLOG2MO : 0] wr_ptr, output wire [DEPTHLOG2MO : 0] rd_ptr, output wen,...
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved. // -------------------------------------------------------------------------------- // Tool Version: Vivado v.2014.1 (lin64) Build 881834 Fri Apr 4 14:00:25 MDT 2014 // Date : Thu May 8 22:23:41 2014 // Host : macbook running 64-bit Arch Linux // ...
// (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...
Require Import AutoSep. (** * Always-0 *) Definition always0S res : spec := SPEC reserving res PRE[_] Emp POST[R] [| R = 0 |]. Definition always0 := bmodule "always0" {{ bfunction "main"("f") [always0S 2] "f" <-- Lambda() [always0S 0] Return 0 end;; "f" <-- ICall "f"() [PRE[_, R] [| R =...
#include <bits/stdc++.h> using namespace std; int n; map<string, int> mid, pid; std::vector<string> hostname; vector<int> a[100000]; char s[1000]; int m_total = 0, p_total = 0; int b[100000]; std::vector<std::vector<int> > ans; bool cmp(int i, int j) { return a[i] < a[j]; } int main(int argc, char...
`define Swc_NOP 4'h0 `define Swc_LD0 4'h1 `define Swc_LD1 4'h2 `define Swc_LD2 4'h3 `define Swc_COU 4'h4 `define Swc_COD 4'h5 `define Swc_CCU 4'h6 `define Swc_CCD 4'h7 `define Swc_CCS 4'h8 `define Swc_State_Reset 2'h0 `define Swc_State_Ready 2'h1 `define Swc_State_Error 2'h2 module Swc(clock,reset,inst,inst_en,counte...
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1); const int N = 1005; int cnt[N]; bitset<N> dp; int n, m; int idx[N]; int par[N]; int xx[N]; bool vis[N]; int find(int x) { if (par[x] == x) return x; return par[x] = find(par[x]); } int main() { for (int i = 0...
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long n, m, i, a, b, sum = 0; cin >> n >> m; long long arr[n + 1]; for (i = 1; i <= n; i++) { cin >> arr[i]; } for (i = 0; i < m; i++) { cin >> a >> b; ...
#include <bits/stdc++.h> using namespace std; int main() { int n; scanf( %d , &n); long long int arr[100]; for (int i = 0; i < n; i++) cin >> arr[i]; long long int cnt[5]; long long int p[5]; for (int i = 0; i < 5; i++) cin >> p[i]; long long int min = 1000000009; for (int i = 0;...
`timescale 1ns / 1ps module control_ascci( input clk, input top_ascci, input top_col, input new_string, input done, output reg add_dirram, output reg reset_dirram, output reg add_col, output reg reset_col, output reg add_ascci, output reg reset_ascci, output reg init, output reg leer_rom, output reg le...
`timescale 1ns / 1ps ////////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 16:53:07 07/01/2014 // Design Name: // Module Name: cheat // Project Name: // Target Devices: // Tool versions: // Description: // // Dependencies: // // Revision: //...
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int a[n]; for (int x = 0; x < n; x++) { cin >> a[x]; } for (int i = 0; i < n; ++i) { for (int j = 0; j < n; ++j) { for (int k = 0; k < n; ++k) { if (a[i] == a[j] + a[k] && (i != j && j !...
#include <bits/stdc++.h> using namespace std; int deg[10000 + 10]; int main() { int n; cin >> n; for (int i = 1; i < n; i++) { int a, b; cin >> a >> b; deg[a - 1]++, deg[b - 1]++; } int ans = 0; for (int i = 0; i < n; i++) ans += deg[i] * (deg[i] - 1) / 2; cout << ans...
#include <bits/stdc++.h> using namespace std; long long power(long long x, long long y, long long p) { long long res = 1; x = x % p; while (y > 0) { if (y & 1) res = (res * x) % p; y = y >> 1; x = (x * x) % p; } return res; } int main() { ios_base::sync_with_stdio(false...
#include <bits/stdc++.h> int main() { int n; scanf( %d , &n); int ans; ans = n / 2 + 1; printf( %d n , ans); return 0; }
#include <bits/stdc++.h> using namespace std; int cnt[2]; int main() { int n, k, m; scanf( %d%d , &n, &k); for (int i = 0; i < n; i++) { scanf( %d , &m); cnt[m % 2]++; } int r = n - k; if (r == 0) { if (cnt[1] % 2 == 1) puts( Stannis ); else puts( Da...
#include <bits/stdc++.h> using namespace std; const int MAX = 1e6 + 2; int pos[MAX], a[MAX]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n, c = 0, k; cin >> n; for (int i = 1; i < n + 1; i++) cin >> k, a[k] = i, pos[i] = k; for (int i = 1; i < n + 1; i++) { if...
// -*- verilog -*- // // USRP - Universal Software Radio Peripheral // // Copyright (C) 2003,2004 Matt Ettus // Copyright (C) 2007 Corgan Enterprises 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 S...
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long dx[4] = {-1, 1, 0, 0}; const long long dy[4] = {0, 0, -1, 1}; const long long MAX = 5e3 + 5; long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); } long long n, m, ans, k, Q; string sec...
#include <bits/stdc++.h> using namespace std; const int MAX = 2e5 + 10; const double eps = 1e-6; const double mod = 1e9 + 7; struct num { int v, i; } b[MAX]; bool cmp(const num &x, const num &y) { return x.v > y.v; } bool cmp1(const num &x, const num &y) { return x.i < y.i; } int main() { int ...
/** * 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 gcd(int x, int y) { if (y == 0) return x; else return gcd(y, x % y); } int lcm(int x, int y) { return x / gcd(x, y) * y; } int binpow(int a, int p) { if (!p) return 1; int g = binpow(a, p >> 1); if (p % 2 == 0) return (g *...
#include <bits/stdc++.h> using namespace std; long long find_seat(char c) { if (c == a ) return 4; if (c == b ) return 5; if (c == c ) return 6; if (c == d ) return 3; if (c == e ) return 2; if (c == f ) return 1; } int main() { long long one, two, a, b, d, n, i, res; char ...
/* Copyright 2018 Nuclei System Technology, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except i...
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) #pragma GCC target( avx2 ) using namespace std; long long one = 1; const long long INF = 1e18; const long long MOD = 1e9 + 7; const long long N = 2e5; vector<vector<long long> > c, gr; vector<long long> res; bool flag = 1; long long dfs1(long lon...
#include <bits/stdc++.h> using namespace std; string generateString(int a) { string s = ; for (int i = 0; i < a; i++) { char x = a + i; s = s + x; } return s; } string wrapAround(string s, int b, int c) { int x = c - b; for (int i = 0; i < x; i++) { s += s[i % b]; ...
/////////////////////////////////////////////////////////////////////////////// // tx_queue.v. Derived from NetFPGA project. // vim:set shiftwidth=3 softtabstop=3 expandtab: // $Id: tx_queue.v 2080 2007-08-02 17:19:29Z grg $ // // Module: tx_queue.v // Project: NF2.1 // Description: Instantiates the speed matching FIFO...
//Legal Notice: (C)2013 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...
//======================================================= // This code is generated by Terasic System Builder //======================================================= module DE1_SOC( //////////// CLOCK ////////// input CLOCK_50, input CLOCK2_50, input CLOCK3_50, input...
#include <bits/stdc++.h> using namespace std; const int maxn = 5e5 + 5; int size[maxn], dep[maxn], val[maxn], dfn[maxn], hson[maxn], ans[maxn], rnk[maxn]; int cnt[(1 << 22) + 4]; struct EDGE { int to, next; char c; } edge[maxn << 1]; int head[maxn], tot, num; void addedge(int u, int v, cha...
#include <bits/stdc++.h> using namespace std; int maxn, n, t, x; int main() { cin >> n; for (int i = 1; i <= n; i++) { int in1, in2; cin >> in1 >> in2; x -= in1 - t; if (x < 0) x = 0; x += in2; maxn = max(maxn, x); t = in1; } cout << t + x << << maxn; ...
#include <bits/stdc++.h> int main(int argc, char** argv) { int32_t num_queries; std::cin >> num_queries; for (int32_t i = 0; i < num_queries; i++) { int32_t num_sticks; std::cin >> num_sticks; if (num_sticks == 2) std::cout << 2 << std::endl; else if (num_sticks % 2 == 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...
// DESCRIPTION: Verilator: Verilog Test module // // This file ONLY is placed under the Creative Commons Public Domain, for // any use, without warranty, 2020 Wilson Snyder. // SPDX-License-Identifier: CC0-1.0 `define stop $stop `define checkh(gotv,expv) do if ((gotv) !== (expv)) begin $write("%%Error: %s:%0d: got='h...
/* * Milkymist SoC * Copyright (C) 2007, 2008, 2009 Sebastien Bourdeauducq * * 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, version 3 of the License. * * This program is distributed in ...
#include <bits/stdc++.h> using namespace std; int Max() { return -1000000007; } int Min() { return 1000000007; } template <typename... Args> int Max(int a, Args... args) { return max(a, Max(args...)); } template <typename... Args> int Min(int a, Args... args) { return min(a, Min(args...)); } ...
#include <bits/stdc++.h> using namespace std; int main() { int A[3] = {0}; int num; cin >> num; long ip; while (num--) { cin >> ip; if (ip % 3 == 0) A[0]++; else if (ip % 3 == 1) A[1]++; else if (ip % 3 == 2) A[2]++; } cout << A[0] / 2 + mi...
#include <bits/stdc++.h> using namespace std; int a[100007], b[100007], c[100007]; int main() { ios_base::sync_with_stdio(false); int n; cin >> n; for (int i = 1; i < n + 1; i++) cin >> a[i]; for (int i = 1; i < n + 1; i++) { if (a[i] > a[i - 1]) b[i] = b[i - 1] + 1; else ...
`default_nettype none module CPU(clk,rst,start, ReadData,MemAck,WriteData,MemAddr,MemEnable,MemWrite); input clk,rst,start,MemAck; input [255:0] ReadData; output MemEnable,MemWrite; output [255:0] WriteData; output [31:0] MemAddr; wire [31:0] InstrAddr,NextPC,NextPC_IF,Instr; Adder Add_PC( .data0 (InstrAddr),...
#include <bits/stdc++.h> using namespace std; bool done1[33][2][2], done2[33][2][2], done3[33][2][2]; long long memo1[33][2][2], memo2[33][2][2], memo3[33][2][2]; long long lim; int n; long long dp1(int, int, int); long long dp2(int, int, int); long long dp3(int, int, int); long long dp1(int i, int s1...
#include <bits/stdc++.h> using namespace std; void err(istream_iterator<string> it) {} template <typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cout << *it << = << a << n ; err(++it, args...); } const int M = 1e9 + 7, N = 2e5 + 5; int main() { io...
#include <bits/stdc++.h> using namespace std; int Number[12][12]; int Next[110]; double dp[110]; int main() { for (int i = 1; i <= 10; i++) for (int j = 1; j <= 10; j++) Number[i][j] = (10 - i) * 10 + (i % 2 == 0 ? j : 11 - j); for (int i = 1; i <= 10; i++) { for (int j = 1; j <= 1...
#include <bits/stdc++.h> using namespace std; const int nsz = 1e5, ksz = 8, msksz = (1 << ksz) - 1, inf = 0x3f3f3f3f; bool vis[nsz + 5]; int n, m, k, full, p[nsz + 5], q[ksz + 5], dp[2][msksz + 5], ans; struct event { int pos, id, st; event(int pos = 0, int id = 0, int st = 0) { this->pos = pos,...
#include <bits/stdc++.h> using namespace std; const int PI = acos(-1); const int MAXN = 1e6; unsigned long long comb(unsigned long long n, unsigned long long k) { if (k > n) return 0; unsigned long long u = 1; for (unsigned long long i = 1; i <= k; i++) { u *= n--; u /= i; } retu...
//================================================================================================== // Filename : tb_FPU_PIPELINED_FPADDSUB2_vector_testing.v // Created On : 2016-09-27 18:38:13 // Last Modified : 2016-10-10 15:30:54 // Revision : // Author : Jorge Sequeira Rojas // Company ...
#include <bits/stdc++.h> using namespace std; inline bool cmin(int &x, int y) { return x > y ? x = y, 1 : 0; } inline bool cmax(int &x, int y) { return x < y ? x = y, 1 : 0; } const int _ = 1e5 + 55; int N, x; long long ans(0); priority_queue<int> A, B; int main() { scanf( %d , &N); for (int i(1...
// A parameterized, inferable, true dual-port, dual-clock block RAM in Verilog. // Thanks to Dan Strother - http://danstrother.com/2010/09/11/inferring-rams-in-fpgas/ module dp_ram #( parameter DATA = 16, parameter ADDR = 10 ) ( // Port A input wire a_clk, input wire ...
/** * Copyright 2020 The SkyWater PDK Authors * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * https://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable la...
#include <bits/stdc++.h> using namespace std; const int N = 1e3 + 10; const long double inf = 1e9 + 10; bool use(long double &f, long double w, long double a); int a[N], b[N]; int main() { int n, m; cin >> n >> m; for (int i = 1; i <= n; ++i) { cin >> a[i]; } for (int i = 1; i <= n...
#include <bits/stdc++.h> using namespace std; pair<int, int> temp[102][102]; int ans[102][102]; int main() { int n, m, q; cin >> n >> m >> q; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { temp[i][j].first = i; temp[i][j].second = j; } } while (q--)...
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; double a; int ans = 0; vector<int> v; int n, m; cin >> n; int ara1[n]; for (int i = 0; i < n; i++) cin >> ara1[i]; cin >> m; int ara2[m]; for (i...
#include <bits/stdc++.h> using namespace std; const int N = 100010, M = N * 2, mod = 1e9 + 7; const double PI = acos(-1.0), eps = 1e-6; int T, n, m, k, c1, c2; int a[N * 10], b[N], tot, cnt[N], s[N * 10], ans; map<int, int> mp; vector<int> v; string g[N * 10]; signed main() { ios::sync_with_stdio(...
#include <bits/stdc++.h> #pragma GCC optimize(2) using namespace std; long long n, m, a[200010], dp[200010][2]; vector<pair<long long, long long> > allseg, okseg; vector<long long> hvseg[200010]; void solve() { long long i, j, l, r, mn, dx, dy; scanf( %lld%lld , &n, &m); a[0] = -1000000000000; ...
/** * 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 x, y; vector<long long> cnt; vector<char> sol; bool ok; void solve(long long x, long long y) { if (!x) { if (y == 1) ok = 1; return; } if (!y) { if (x == 1) ok = 1; return; } if (x == y) { if (x == 1) o...
/* * .--------------. .----------------. .------------. * | .------------. | .--------------. | .----------. | * | | ____ ____ | | | ____ ____ | | | ______ | | * | ||_ || _|| | ||_ \ / _||...
#include <bits/stdc++.h> using namespace std; const int mx = 110, Mod = 1e6 + 3; int C, W, H; struct Matrix { int val[mx][mx]; int n; Matrix(int _n = mx, int _base = 0) { n = _n; for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) val[i][j] = (i == j ? _base : 0); } i...
#include <bits/stdc++.h> using namespace std; template <typename _T> inline void read(_T &f) { f = 0; _T fu = 1; char c = getchar(); while (c < 0 || c > 9 ) { if (c == - ) { fu = -1; } c = getchar(); } while (c >= 0 && c <= 9 ) { f = (f << 3) + (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 la...
#include <bits/stdc++.h> using namespace std; set<int> S; void dfs(int Cur, int dgt, int x, int y) { if (dgt == 11) return; if (Cur > 0) S.insert(Cur); dfs(Cur * 10 + x, dgt + 1, x, y); dfs(Cur * 10 + y, dgt + 1, x, y); return; } int main() { int n, Ans = 0; cin >> n; S.insert(...
#include <bits/stdc++.h> #pragma warning(disable : 4996) int main() { int n, k; scanf( %d %d , &n, &k); int cnt = 0, a[100]; for (int i = 0; i < n; i++) { scanf( %d , &a[i]); } for (int i = 0; i < n; i++) { if (a[i] >= a[k - 1] && a[i] > 0) cnt++; } printf( %d , cnt); ...
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const long long MOD = 1e9 + 6; const long long inf = 2e18; const int maxn = 200005; const int maxa = 300005; long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; } long long powmod(long long a, long long b) {...
#include <bits/stdc++.h> using namespace std; const long long inf = (long long)1e18; int n, q; int v[111111], c[111111]; long long first[111111]; long long calc(long long a, long long b) { int m1 = 0, m2 = 0; for (int i = 1; i <= n; ++i) first[i] = -inf; first[0] = 0; for (int i = 0; i < n; ...
// (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 ...
#include <bits/stdc++.h> using namespace std; vector<bool> trust; vector<int> massive(int** mas, int num) { vector<int> mase; int nume = num; int nume1; while (nume != 0) { nume1 = nume; nume = mas[nume - 1][0]; } mase.push_back(0); while (nume1 != 0) { mase.push_back...
/** * 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...
module Mod_Teste( output [6:0] HEX0, output [6:0] HEX1, output [6:0] HEX2, output [6:0] HEX3, output [6:0] HEX4, output [6:0] HEX5, output [6:0] HEX6, output [6:0] HEX7, output [8:0] LEDG, output [17:0] LEDR, output LCD_ON, output LCD_BLON, output LCD_RW, output LCD_EN, output LCD_RS, inout [35:0] GPIO_...
//////////////////////////////////////////////////////////////////////////////////// // 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 N = 100001; int main(void) { char arr1[N] = {0}; char arr2[N] = {0}; char str1[2] = {0}, str2[2] = {0}; scanf( %[^ n]s , arr1); scanf( %[^ n]s , arr2); if (strlen(arr1) != strlen(arr2)) { cout << NO n ; return 0; } ...
// (C) 2001-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 simulation // files), and any associated doc...
#include <bits/stdc++.h> using namespace std; int n, m; pair<int, int> t[500050]; bitset<2020> P[2020], B[2020]; void solve() { scanf( %d%d , &n, &m); for (int i = 0; i < m; i++) { int x, y; scanf( %d%d , &x, &y); t[i] = pair<int, int>(x, y); P[x][y] = 1; } for (int i =...
#include <bits/stdc++.h> using namespace std; int mas[1010][1010]; int main() { int N, K; cin >> N >> K; for (int i = 1; i <= N; i++) { int k = 0; for (int j = 1; j <= N; j++) { if (k == K) break; else if (i == j) continue; else if (mas[j][i] || ...
/* * Chain 4 memory interface for VGA * Copyright (C) 2010 Zeus Gomez Marmolejo <> * * This file is part of the Zet processor. This processor is free * hardware; you can redistribute it and/or modify it under the terms of * the GNU General Public License as published by the Free Software * Foundation; eit...
// *************************************************************************** // *************************************************************************** // Copyright 2014 - 2017 (c) Analog Devices, Inc. All rights reserved. // // In this HDL repository, there are many different and unique modules, consisting // of...
// megafunction wizard: %LPM_FIFO+% // GENERATION: STANDARD // VERSION: WM1.0 // MODULE: scfifo // ============================================================ // File Name: fifo_32x128.v // Megafunction Name(s): // scfifo // ============================================================ // ***************...
#include <bits/stdc++.h> using namespace std; const int maxn = 66; long long n, k, a[maxn], d[maxn][maxn]; int main(void) { cin >> n >> k; for (int i = 1; i <= n; ++i) { cin >> a[i]; a[i] += a[i - 1]; } long long rt = 0; for (int i = 55; i >= 0; --i) { rt += ((1LL * 1) << i...
#include <bits/stdc++.h> using namespace std; int nf, ne, ns, rf, re, rs, df, de; double disf, dise, diss; int num[22]; double f[22][22][22]; double ans; double valf[22], vale[22]; inline double cover(double l1, double r1, double l2, double r2) { return max(0.0, min(r1, r2) - max(l1, l2)); } voi...
#include <bits/stdc++.h> int a[12] = {0, 4, 10, 20, 35, 56, 83, 116, 155, 198, 244, 292}; int main() { long long n; scanf( %lld , &n); printf( %lld n , (n < 12) ? a[n] : 292 + (n - 11) * 49); return 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...
#include <bits/stdc++.h> #pragma comment(linker, /STACK:20000000 ) using namespace std; const long long mod = 1000000007; const double eps = 1e-7; const long long INF = 1000000000000000; int main() { string s; cin >> s; int x = -1, k = 0; for (int(i) = (0); (i) < (s.size()); ++(i)) { ...
/// /// I2C Controller /// -------------- /// module I2C_Controller ( input CLOCK, input RESET, input [31:0] I2C_DATA,//DATA:[SLAVE_ADDR,SUB_ADDR,DATA] input GO, //GO transfor output I2C_SCLK, //I2C CLOCK inout I2C_SDAT, //I2C DATA output reg END, //END transfor ...
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, c, d, e, f; cin >> a >> b >> c >> d >> e >> f; long long int minbcd; minbcd = min(b, min(c, d)); long long int cnt; cnt = minbcd * f; long long int x; x = d - minbcd; cnt = cnt + (min(x, a) * e); l...
#include <bits/stdc++.h> using namespace std; string str; string l; map<string, int> m; string Greedy_Solve() { string res = ; for (int i = 0; i < l.length(); i += 10) { str = l.substr(i, 10); res += m[str] + 0 ; } return res; } int main() { cin >> l; for (int i = 0;...
#include <bits/stdc++.h> using namespace std; const int maxn = 300100; int head[maxn], nxt[maxn << 1], ver[maxn << 1], tot; void addedge(int a, int b) { nxt[++tot] = head[a]; ver[tot] = b; head[a] = tot; nxt[++tot] = head[b]; ver[tot] = a; head[b] = tot; } int f[maxn], getlen; void...
/************************************************************************** Async Fifo -parameter P_N Queue data vector width Example : DATA[3:0] is P_N=4 -parameter P_DEPTH Queue entry depth Example P_DEPTH 16 is P_DEPTH=16 -parameter P_DEPTH_N Queue entry depth n size Example PARAMETER_DEPTH16 is 4 -SDF S...
#include <bits/stdc++.h> using namespace std; const int M = 1e2 + 10; long long int n, m, x, y, cnt[M][M], ask, mx, mn = 1e18; void go(long long int k, long long int i, long long int j, long long int dir) { if (k == 0) return; cnt[i][j]++; if (j < m) go(k - 1, i, j + 1, dir); else if (dir ...
#include <bits/stdc++.h> using namespace std; int main() { int a, b, l, r, start; cin >> a >> b >> l >> r; if (a == 3 && b == 1 && l == 4 && r == 10) { cout << 4 << endl; return 0; } if (r - l + 1 > 48) { if (a > b) cout << 2 * a - b; else cout << 1 + a; ...
#include <bits/stdc++.h> using namespace std; int mark[100005]; long long msum[100005]; long long sum[100005]; int c[100005]; long long cs; int main() { long long ans = 0; int i, n, m, x; scanf( %d%d , &n, &m); for (i = 1; i <= n; ++i) scanf( %d , &c[i]); for (i = 1; i <= m; ++i) { ...