text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const double pi = 3.141592653589793238462643383; int main() { { int n, m, k, t; cin >> n >> m >> k >> t; set<int> s; ; for (long long i = 0; i < k; i++) { int a, b; cin >> a >> b; int id = (a - 1) * m + b; ... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, m; cin >> n >> m; if (m == 0) { cout << YES << endl; return 0; } vector<long long int> v(m); for (long long int i = 0; i < m; cin >> v[i++]) ; sort(v.begin(), v.end()); if (v[0] == 1 || v[... |
module top;
reg q1, q2, q3, q4, q5, q6, q7, d;
reg clk;
reg [5:4] rst;
integer i;
// The compiler should warn that clk is missing an edge keyword.
always_ff @(clk) begin
q1 <= d;
end
// The compiler should warn that rst is missing an edge keyword.
always_ff @(posedge clk or rst[4]) begin
if ... |
`define bsg_and_macro(bits) \
if (harden_p && (width_p==bits)) \
begin: macro \
bsg_rp_tsmc_250_AND2X1_b``bits and_gate (.i0(a_i),.i1(b_i),.o); \
end
module bsg_and #(parameter `BSG_INV_PARAM(width_p)
, parameter harden_p=... |
#include <bits/stdc++.h> using namespace std; double PI = acos(-1.0); long long mod = 998244353; struct custom_hash { static uint64_t splitmix64(uint64_t x) { x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; return x ^ (x >>... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; char ch[n]; ch[n] = 0 ; int a[n][2]; for (int i = 0; i < n; i++) { cin >> a[i][0] >> a[i][1]; } int suma = 0; int sumg = 0; for (int i = 0; i < n; i++) { if (((a[i][0] + suma) - sumg) <=... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); int depth; cin >> depth; int n = (1 << (depth + 1)) - 1; vector<int> pre(n + 1, 0), add(n + 1, 0); for (int i = 2; i <= n; ++i) { cin >> pre[i]; } vector<int> way(n + 1, 0); for (int i ... |
//****************************************************************************************************
//*---------------Copyright (c) 2016 C-L-G.FPGA1988.lichangbeiju. All rights reserved-----------------
//
// -- It to be define --
// -- ... |
/*********************************************************************
* SYNOPSYS CONFIDENTIAL *
* *
* This is an unpublished, proprietary work of Synopsys, Inc., and *
* is fully protected under copyrigh... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company: Rose-Hulman Institute of Technology
// Engineer: Adam Michael
// Date: 10/15/2015
// Summary: The overall top module for Lab 4 Part 2
////////////////////////////////////////////////////////////////... |
#include <bits/stdc++.h> using namespace std; const int maxn = 300010, maxlg = 18; struct edge { int to, nxt; long long val; }; edge G[maxn << 1], G2[maxn]; int head[maxn], cnt; int head2[maxn], cnt2; struct node { int u; long long d; inline bool operator<(const node &rhs) const { re... |
`ifdef __ICARUS__
`define SUPPORT_CONST_OUT_OF_RANGE_IN_IVTEST
`endif
module top;
reg pass = 1'b1;
wire [3:0] part_idx_up, part_idx_down, part_sel;
wire [3:0] ps_array [1:0];
// Check the positive indexed part select.
// assign part_idx_up[-1+:2] = 2'b01; // We do not currently support this!
assign part_... |
#include <bits/stdc++.h> int i, j, m, n, s, t, x, y; int a[1000][1000], b[1000][1000], c[1000], d[1000]; int main() { while (~scanf( %d%d%d , &n, &x, &y)) { for (i = 0; i < 1000; i++) for (j = 0; j < 1000; j++) { a[i][j] = 0; b[i][j] = 0; } for (i = 1; i <= n; 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 la... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int n; cin >> n; vector<long long int> v; for (long long int i = 0; i < n; i++) { long long int x; cin >> x; v.push_back(x); } l... |
#include <bits/stdc++.h> using namespace std; int read() { int a = 0; char c = getchar(); while (!isdigit(c)) c = getchar(); while (isdigit(c)) { a = a * 10 + c - 48; c = getchar(); } return a; } const double pi = acos(-1); struct comp { double x, y; comp(double _x ... |
#include <bits/stdc++.h> using namespace std; long long f(long long x) { long long res; res = x * x; return res; } void solve() { long long a[3]; cin >> a[0] >> a[1] >> a[2]; sort(a, a + 3); long long d; d = (long long)(sqrt(f(a[2]) + f(a[1] - a[0]))); d = d + 1; cout << ... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; struct edge { int u, v, w; bool operator < (const edge &oth) const { return w < oth.w; } } e[N << 1]; int n, m, x, mn = INT_MAX; long long ans, rem; struct disjoint_sets_union { int fa[N]; int Query(int p) { ... |
/*
* 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 law... |
#include <bits/stdc++.h> int main() { long long int a, i, j, k = 1; scanf( %lld , &a); for (i = 1; i <= a; i++) { k = k * 2; } k = 2 * (k - 1); printf( %lld n , k); return 0; } |
module unpack_unsigned #(
parameter N = 64
)
(
input [ 0:M-1] in,
output reg [ N-1: 0] out,
output reg [$clog2(MB)-1: 0] len
);
localparam MB = N/7+1;
localparam M = MB*8;
integer i;
reg [MB-1:0] gl, ub, ho;
always @* begin
for(i=0; i<=MB-1; i=i+1) begin
gl [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... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 00:45:31 11/17/2015
// Design Name:
// Module Name: SPI_interface
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies: ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); int n; cin >> n; string second; cin >> second; for (int i = 0; i < (int)n; i++) { if (i < n - 2 && second[i] == o && second[i + 1] == g && second[i + 2] == o ) { cout << *** ; ... |
#include <bits/stdc++.h> using namespace std; vector<long long> a; int main() { int n; cin >> n; for (long long x, y, z, i = 1; i <= n; i++) { cin >> x >> y >> z; long long l = 0; if (x % 2 == 1) { l = y; x--; long long h = min(x * y, x / 2 * z); l = l... |
#include <bits/stdc++.h> using namespace std; int n, k, p[1000001]; long long ans; int main() { scanf( %d%d , &n, &k); if (k == 1) { printf( 3 ); return 0; } for (int i = 1; i <= n; i++) p[i] = i; for (int i = 2; i <= n; i++) if (p[i] == i) for (int j = i; j <= n; j... |
#include <bits/stdc++.h> using namespace std; vector<int> p; bool first[5000] = {0}; void gen() { p.push_back(0); for (int i = 2; i <= 500; i++) { if (!first[i]) { p.push_back(i); for (int j = 2 * i; j <= 500; j += i) { first[j] = 1; } } } } bool isp... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int mod = 1e9 + 7; const int maxn = 1e6 + 10; int n, k, cnt[maxn], a[maxn], L[maxn], R[maxn]; stack<pair<int, int> > stk; int main() { scanf( %d , &n); ; scanf( %d , &k); ; for (int i = 1; i <= n; i++) scan... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100005; int dp[maxn], ans; const int inf = 1e9; int a1, a2, adfds, fd; vector<int> edge[maxn]; int n, m, d, num[maxn], fuck; void dfs1(int u, int fa) { int i; for (i = 0; i < (int)edge[u].size(); i++) { int v = edge[u][i]; ... |
/***********************************************************************************************************************
* Copyright (C) 2016 Andrew Zonenberg and contributors *
* ... |
#include <bits/stdc++.h> using namespace std; inline long long read() { long long data = 0, w = 1; char ch = 0; while (ch != - && (ch < 0 || ch > 9 )) ch = getchar(); if (ch == - ) w = -1, ch = getchar(); while (ch >= 0 && ch <= 9 ) data = data * 10 + ch - 0 , ch = getchar(); retur... |
#include <bits/stdc++.h> using namespace std; void CountTriangles(vector<int> A) { int n = A.size(); sort(A.begin(), A.end()); int count = 0; for (int i = n - 1; i >= 1; i--) { int l = 0, r = i - 1; while (l < r) { if (A[l] + A[r] > A[i]) { count += r - l; r--... |
/*
Onboard devices:
$00 RW - 8 leds
$01 RW - High 7seg led
$02 RW - Low 7seg led
$03 RW - 0RGB0RGB 2 leds
$04 R- - SSSSKKKK switches and keys
Timer:
$08 RW - IRQ | IEN | XXX | XXX | XXX | XXX | XXX | RUN
$09 RW - Prescaler 24-16 bits
$0A RW - Prescaler 15-8 bits
$0B RW - Prescaler 7-0 bits
... |
#include <bits/stdc++.h> using namespace std; int forbidInd; int A[100000 + 10]; long long int memo[60][60][60]; long long int solve(int i, int k, int x) { if (k < 0 || x < 0) return 0; if (i == 0) { if (x == 0 && k == 0) return 1; if (k == 1 && x == A[i] && forbidInd != 0) return ... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
module i2c_core #(
parameter ABUSWIDTH ... |
module cross_bar(rst, clk, wr_en, d, full, valid, q, stall, almost_full);
parameter WIDTH = 8;
parameter IN_PORTS = 8;
parameter OUT_PORTS = IN_PORTS;
parameter FIFO_DEPTH = 32;
parameter IN_PORTS_ADDR_WIDTH = log2(IN_PORTS-1);
parameter OUT_PORTS_ADDR_WIDTH = log2(OUT_PORTS-1);
parameter OU... |
// file: system_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 disclaimer... |
#include <bits/stdc++.h> using namespace std; long long M = 1e9 + 7; long long power(long long a, long long p) { if (p == 0) return 1; long long ans = power(a, p / 2); ans = (ans * ans) % M; if (p % 2) ans = (ans * a) % M; return ans; } int nC2(int n) { return (n * (n - 1)) / 2; } int fa... |
// (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; long long n, m, k, d[5][2][100][100], kk; int a[100][100]; bool was[100][100], done = false, was2[100][100][2][5]; string s; int main() { cin >> n >> k; for (int i = 0; i < n; i++) { cin >> s; m = s.length(); for (int j = 0; j < m; j++)... |
#include <bits/stdc++.h> using namespace std; const long long N = 1e5 + 10; const long long M = 1e12; const long long MOD = 1e9 + 7; const long long INF = 1e18; const long long inf = -1e18; int n, arr[5], m; vector<int> vec, verr; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL), c... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Thu Jun 01 02:22:05 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; int N, P; bool can = false; string word; int main() { scanf( %d%d , &N, &P); cin >> word; if (P == 1) { cout << NO n ; return 0; } else if (P == 2) { if (N == 1) { if (word == a ) cout << b n ; else ... |
#include <bits/stdc++.h> using namespace std; int main() { int sum = 0, n; scanf( %d , &n); for (int i = 1; i <= n; i++) { sum += (n - i) * (i - 1) + i; } printf( %d n , sum); } |
//*****************************************************************************
// 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... |
#include <bits/stdc++.h> using namespace std; long long spf[101]; long long arr[100001]; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long n; cin >> n; long long sum = 0; for (int i = 0; i < n; i++) { cin >> arr[i]; sum += arr[i]; } ... |
#include <bits/stdc++.h> using namespace std; const long long N = 2 * 1e5 + 100; long long n, m, k, w, a[N], d[N], p[N], fa[N], vi[N]; long long tot, first[N], nxt[N * 2], point[N * 2], len[N * 2]; priority_queue<pair<long long, long long>, vector<pair<long long, long long> >, greater<pair<lo... |
/**
\file "inverters-watch.v"
Chain a bunch of inverters between VPI/VCS and prsim, shoelacing.
$Id: inverters-watch.v,v 1.2 2010/04/06 00:08:34 fang Exp $
Thanks to Ilya Ganusov for contributing this test.
*/
`timescale 1ns/1ps
`include "clkgen.v"
module timeunit;
initial $timeformat(-9,1," ns",9);
endmodule... |
module register_file(input clk,input we3,
input [3:0]a1,input [3:0]a2,input [3:0]a3,
input [31:0] wd3,input [31:0] r15,
output [31:0]rd1 ,output[31:0] rd2
);
reg[31:0] mem[0:15];
always@(posedge ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, a[100000], p[100000], i, ans = 0, price = INT_MAX; scanf( %d , &n); for (i = 0; i < n; i++) scanf( %d %d , &a[i], &p[i]); for (i = 0; i < n; i++) { price = min(price, p[i]); ans += (a[i] * price); } printf( %d , an... |
// (c) Copyright 2012 Xilinx, Inc. All rights reserved.
//
// This file contains confidential and proprietary information
// of Xilinx, Inc. and is protected under U.S. and
// international copyright and other intellectual property
// laws.
//
// DISCLAIMER
// This disclaimer is not a license and does not grant ... |
// part of NeoGS project (c) 2007-2008 NedoPC
//
// sound_main is the main sound module: it incorporates data storage (512b memory), from which
// it reads data, prepares it through sound_mulacc and sends to sound_dac. It incorporates in itself
// sound_dac, so it has outs to the DAC.
// clock is ordinary 24 MHz cloc... |
/**
* 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 chmax(T& a, const T& b) { if (a < b) a = b; } template <typename T> void chmin(T& a, const T& b) { if (a > b) a = b; } int N, M; long long dp[3001][3001]; const long long INF = 1e17; int main() { cin.tie(0); i... |
#include <bits/stdc++.h> using namespace std; const bool testing = false; pair<long long, long long> d[100000]; int nf[100000], nb[100000]; pair<long long, long long> getmid(int a, int b) { long long y = d[b].second - d[a].second; long long x = d[b].first - d[a].first; pair<long long, long long> r... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5, M = 5; int cc[N][M], sz[N], k; long long ret[N], sum = 0; vector<int> adj[N]; long long dfs(int x, int p) { int t, v, j, u, i; sz[x] = 1; long long R = 0, temp; for (i = 0; i < adj[x].size(); ++i) { u = adj[x][i]; ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 5e5 + 5; int a[maxn], n, k; long long sum; long long judge1(int m) { long long ans = 0; for (int i = 1; a[i] < m && i <= n; i++) { ans += m - a[i]; } return ans; } long long judge2(int m) { long long ans = 0; for ... |
module SimpleMmuTest;
`include "Framework.v"
reg reset;
reg clk;
reg [31:0] addrA;
reg [31:0] addrB;
reg writeEnable = 0;
reg [7:0] dataIn;
reg requestA;
reg requestB;
wire [7:0] outA;
wire [7:0] outB;
wire busyA;
wire busyB;
wire [15:0] displayIn = 0;
wire [31:0] displayAddr;
wire displayWE;
... |
/**
* 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> /* #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> // Including */ using namespace std; //using namespace __gnu_pbds; //typedefs typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<vi> vvi; typ... |
/**
* 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... |
`default_nettype none
`timescale 1ns / 1ps
// The receiver core provides a ITU V.4-compatible bit-serial interface.
// The receiver is broadly broken up into three parts: the Wishbone B4
// slave interface, the transmitter, and the receiver.
//
// This module defines the V.4-compatible receiver.
//
// Note that if bo... |
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; const int n = s.length() + 5; int arr[n]; memset(arr, 0, sizeof arr); int m, l, r; for (int i = 0; i < s.length(); i++) { if (s[i] == s[i + 1]) { arr[i + 2]++; } arr[i + 1] += arr[i];... |
#include <bits/stdc++.h> using namespace std; char str[11][11]; int f[8][20][20]; int dx[] = {0, 1, -1, -1, 1, 1, 0, -1}, dy[] = {-1, -1, -1, 0, 0, 1, 1, 1}; bool check() { memset(f, 0, sizeof f); for (int i = 1; i <= 10; i++) for (int j = 1; j <= 10; j++) { if (str[i][j] != X ) continu... |
`include "defines.vh"
/**
* @module max_comparator
* @author sabertazimi
* @email
* @brief find line that has max reference count
* @input cntX reference count of lineX
* @output lru_line line that has max reference count(lru line)
*/
module max_comparator
(
input [`BTB_LINE_SIZE-1:0] cnt0,
input [`BTB... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 2005, MOD = 998244353; char ch[MAXN]; long long cnt[MAXN], dp[MAXN][MAXN]; long long KSM(long long a, long long t) { long long ans = 1; while (t) { if (t & 1) ans = ans * a % MOD; t >>= 1; a = a * a % MOD; } retur... |
/*------------------------------------------------------------------------------
* This code was generated by Spiral Multiplier Block Generator, www.spiral.net
* Copyright (c) 2006, Carnegie Mellon University
* All rights reserved.
* The code is distributed under a BSD style license
* (see http://www.opensource.or... |
#include <bits/stdc++.h> using namespace std; class DSU { public: vector<int> parent; int total_components; DSU(int n) { parent.resize(n + 1); for (int i = 1; i <= n; i++) { parent[i] = i; } total_components = n; } int get(int x) { if (parent[x] == x) { ... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:102400000,102400000 ) using namespace std; const int maxn = 1e3 + 10; const int inf = 0x7fffffff; const long long INF = 9E18; const int mod = 1e9 + 7; const long long mod2 = 1e9 + 9; const double eps = 1e-7; const double pi = acos(-1.0); templ... |
#include <bits/stdc++.h> using namespace std; int N, K, T, to[25]; long double prob[25], dp[2000100], val[25], ans[25]; bool v[2000100]; long double calc(int mask) { if (v[mask]) return dp[mask]; v[mask] = 1; int i; long double tot = 0; for (i = 0; i < N; i++) if (mask & (1 << i)) to... |
#include <bits/stdc++.h> using namespace std; int main() { int n; while (scanf( %d , &n) != EOF) { for (int i = 0; i <= n; i++) { int space = (n - i) * 2; for (int j = 0; j < space; j++) printf( ); if (!i) printf( %d n , 0); else { for (int j = 0; ... |
// (C) 2001-2011 Altera Corporation. All rights reserved.
// Your use of Altera Corporation's design tools, logic functions and other
// software and tools, and its AMPP partner logic functions, and any output
// files any of the foregoing (including device programming or simulation
// files), and any associated doc... |
#include <bits/stdc++.h> using namespace std; void flash() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } void solve() { long long n; cin >> n; vector<long long> v(n); long long sm = 0; long long mx = 0; for (long long i = 0; i < n; i++) { cin >> v... |
#include <bits/stdc++.h> using namespace std; const double eps = 1e-7; double L, R, m1, m2, a, b, l; double calc(double alp) { return a * sin(alp) + b * cos(alp) - l * sin(alp) * cos(alp); } int main() { scanf( %lf%lf%lf , &a, &b, &l); if (a > b) swap(a, b); if (l <= b) { printf( %.8lf... |
#include <bits/stdc++.h> using namespace std; template <class T> using VV = vector<vector<T>>; template <class T> inline bool SMIN(T &l, const T &r) { return l < r ? l = r, 1 : 0; } template <class T> inline bool SMAX(T &l, const T &r) { return l > r ? l = r, 1 : 0; } const string yes = YES... |
#include <bits/stdc++.h> using namespace std; struct query { int k, pos, ind; } queries[200005]; struct arr { int val, ind; } a[200005]; long long n, q, cnt, res[200005], fw[200005], it[4 * 200005], len, b[200005]; bool cmp(arr a, arr b) { if (a.val != b.val) return a.val > b.val; return 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... |
#include <bits/stdc++.h> using namespace std; int main() { string str; cin >> str; int ans(0); for (int i = 0; i < str.size(); ++i) if (str[i] != str[str.size() - 1 - i]) ++ans; if (ans == 2 || (ans == 0 && str.size() % 2 == 1)) cout << YES << endl; else cout << NO << e... |
/*
* 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 ... |
module avr_interface #(
parameter CLK_RATE = 50000000,
parameter SERIAL_BAUD_RATE = 500000
)(
input clk,
input rst,
// cclk, or configuration clock is used when the FPGA is begin configured.
// The AVR will hold cclk high when it has finished initializing.
// It is important not to driv... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:55:17 05/31/2016
// Design Name:
// Module Name: prueba_lectura_config_reloj
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// ... |
#include <bits/stdc++.h> using namespace std; namespace MCMF { const int N = 1e6; const long long inf = 1e18; struct node { int to, next, v, cap; } edge[N]; int st[2000], cnt, S, T, n; int d[N], from[2000]; int can_flow[2000]; long long dis[2000]; bool bz[N]; void init(int s, int t, int nn) ... |
/**
* 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... |
// -*- verilog -*-
//
// USRP - Universal Software Radio Peripheral
//
// Copyright (C) 2003 Matt Ettus
//
// 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 2 of the License... |
#include <bits/stdc++.h> using namespace std; inline bool EQ(double a, double b) { return fabs(a - b) < 1e-9; } inline int gcd(int a, int b) { if (b == 0) return a; return gcd(b, a % b); } template <typename T> string to_str(T str) { stringstream stream; stream << str; return stream.str(... |
`timescale 1ns / 1ps
`default_nettype none
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 01:35:26 02/07/2014
// Design Name:
// Module Name: dp_memory
// Project Name:
// Target Devices:
// Tool versions:
// Description:
/... |
#include <bits/stdc++.h> using namespace std; pair<long long int, pair<int, bool> > p[200005 << 1]; long long int a[200005], tree[200005 << 2][2]; long long int get(int n, int b, int e, int i, int j, bool c) { if (i > j || j < b || e < i) return 0; if (i <= b && j >= e) return tree[n][c]; int l, r, ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; ll n, m; cin >> n >> m; std::vector<int> a(n + 2); n = n + 2; a[0] = 0; a[n - 1] = m; for (int i = 1; i <= n; i++) cin >> a[i]; ll v[... |
#include <bits/stdc++.h> using namespace std; int dp[50004][8]; int main() { int m, n; cin >> m >> n; for (int i = 1; i <= m; i++) { for (int j = 1; j <= n; j++) cin >> dp[i][j]; } for (int i = 1; i <= m; i++) dp[i][1] += dp[i - 1][1]; for (int i = 1; i <= n; i++) dp[1][i] += dp[1][i... |
module top;
reg a, q, qb;
reg pass;
always_comb q = a !== 1'bx;
always_comb qb = a === 1'bx;
initial begin
pass = 1'b1;
#0;
// This second delay is needed for vlog95 since it uses #0 to create
// the T0 trigger. vvp also needs it since it puts the event in the
// inactive queue just lik... |
#include <bits/stdc++.h> using namespace std; vector<pair<int, int> > v[100000]; int f[100000]; int d[100000]; void dfs(int x) { int i; for (i = 0; i < v[x].size(); i++) { if (f[v[x][i].first] == 0) { d[v[x][i].first] = d[x] + v[x][i].second; f[v[x][i].first] = 1; dfs(v[x... |
#include <bits/stdc++.h> using namespace std; char dirs[100001]; int todo[4]; int main() { int n, fx, fy, tx, ty; string wind; cin >> n >> fx >> fy >> tx >> ty >> wind; memcpy(dirs, wind.c_str(), n); memset(todo, 0, sizeof(todo)); if (fx < tx) todo[0] = tx - fx; if (fy < ty) todo[3] ... |
`timescale 1ns / 1ps
module MGIA(
input CLK_I_50MHZ,
input RST_I,
output CLK_O_25MHZ,
output HSYNC_O,
output VSYNC_O,
output [2:0] RED_O,
output [2:0] GRN_O,
output [2:1] BLU_O,
output [13:1] MGIA_ADR_O,
input [15:0] MGIA_DAT_I,
output MGIA_CYC_O,
output MGIA_STB_O,
inpu... |
/*
Bank of GPRs.
00..0F: R0..R15
10..1F: CS0..CS15
20..2F: F0L..F15L
30..3F: F16L..F31L
/ 40..4F: R0H..R15H
40..47: R0_B..R7_B
48..4F: Reserved
50..5F: CC0..CC15
60..6F: F0H..F15H
70..7F: F16H..F31H
Special Cases (Handled Externally)
58: Opcode D
59: Opcode S
5A: Opcode T
5C: Opcode PC4A2 (Op PC+4 aligned to 2-byt... |
#include <bits/stdc++.h> using namespace std; char s[200010]; int a[200010]; int ans[50]; int n, k, x; void init() { cin >> n >> k; for (int i = 1; i <= n; i++) cin >> s[i]; for (int i = 1; i <= n; i++) a[i] = (int)s[i] - a + 1; a[++n] = 30; for (int i = 1; i <= 26; i++) { int l;... |
#include <bits/stdc++.h> using namespace std; int main() { long long n; cin >> n; if (n % 2 == 0) { cout << 2; } else cout << 1; } |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; const long long mod1 = 998244353; const double pie = 3.1415926535; unsigned long long power(unsigned long long x, unsigned long long y) { if (y == 0) return 1; else { if (y % 2 == 0) return power(x * x, y ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.