text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma ) #pragma GCC optimize( unroll-loops ) using namespace std; long long MOD = 998244353; double eps = 1e-12; void solve() { long long n; cin >> n; for (long long i = 0;... |
#include <bits/stdc++.h> using namespace std; inline long long read() { char c = getchar(); long long f = 1, x = 0; while (c < 0 || c > 9 ) { if (c == - ) f = -1; c = getchar(); } while (c >= 0 && c <= 9 ) { x = (x << 1) + (x << 3) + (c ^ 0 ); c = getchar(); }... |
#include <bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int N = 5e5 + 3, M = 2e5 + 3; int MOD; string s, t, ts; int n, m, pw[N], hs[N], ht, Z[N + M]; bool check_prime(int x) { for (int i = 2; i * i <= x; ++i) { if (x % i == 0) retu... |
#include <bits/stdc++.h> using namespace std; int main() { int test; scanf( %d , &test); while (test--) { int fuck; string str; scanf( %d , &fuck); cin >> str; string ans = ; for (auto &x : str) { if ((x - 0 ) % 2 == 1) { ans += x; if (a... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); int n, m; cin >> n >> m; int ver[n + 1]; ver[n] = 1e9; for (int i = 0; i < n; i++) cin >> ver[i]; int hor[m]; for (int i = 0; i < m; i++) { int x1, x2, y; cin >> x1 >> x2 >> y; if (x... |
#include <bits/stdc++.h> using namespace std; bool f[1005]; vector<int> x[1005]; vector<int> y[1005]; int dx[4] = {1, 1, -1, -1}; int dy[4] = {1, -1, 1, -1}; int main() { for (int i = 1; i <= 1000; i++) { for (int j = 1; j <= 1000; j++) { int p = i * i + j * j; int u = (int)(sqrt... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// a... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 05/26/2016 07:28:40 AM
// Design Name:
// Module Name: LZD
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revi... |
#include <bits/stdc++.h> using namespace std; const int N = (int)1e5 + 113; const double eps = 1e-7; struct pt { long double x, y; int ind; pt(long double x = 0, long double y = 0, int ind = 0) : x(x), y(y), ind(ind) {} }; long double dist(pt a, pt b) { return (a.x - b.x) * (a.x - b.... |
// -- (c) Copyright 2010 - 2011 Xilinx, Inc. All rights reserved.
// --
// -- This file contains confidential and proprietary information
// -- of Xilinx, Inc. and is protected under U.S. and
// -- international copyright and other intellectual property
// -- laws.
// --
// -- DISCLAIMER
// -- This disclaimer is not a... |
#include <bits/stdc++.h> using namespace std; int main() { int n, s, idx; cin >> n >> s; s--; int a[n], b[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { cin >> b[i]; } if (a[0] == 1) { for (int i = 0; i < n; i++) { if (i =... |
module ISERDESE2 (/*AUTOARG*/
// Outputs
O, Q1, Q2, Q3, Q4, Q5, Q6, Q7, Q8, SHIFTOUT1, SHIFTOUT2,
// Inputs
BITSLIP, CE1, CE2, CLK, CLKB, CLKDIV, CLKDIVP, D, DDLY,
DYNCLKDIVSEL, DYNCLKSEL, OCLK, OCLKB, OFB, RST, SHIFTIN1, SHIFTIN2
);
parameter DATA_RATE = 0; // "DDR" or "SDR"
parameter ... |
#include <bits/stdc++.h> using namespace std; const long long N_MAX = 1123; const long long MOD = 998244353; long long w; long long h; long long result = 1; int main() { ios_base::sync_with_stdio(0); cin >> w; cin >> h; for (long long i = 1; i <= w; i++) { for (long long j = 1; j <= ... |
#include <bits/stdc++.h> using namespace std; inline long long read() { long long s = 0, w = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) w = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) s = s * 10 + ch - 0 , ch = getchar(); return s * w; } c... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2004 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
reg [255:0] a;
reg [60:0] divisor;
reg [60:0] qq;
reg [60:0] rq;
reg sign... |
#include <bits/stdc++.h> using namespace std; int n, A, B; long long toi(string s) { istringstream is(s); long long x; is >> x; return x; } string tos(long long t) { stringstream st; st << t; return st.str(); } long long F[1000005], FP[1000005]; bool f(long long x) { whil... |
#include <bits/stdc++.h> using namespace std; int n; bool isValid(int x1, int y1, int x2, int y2) { return x1 <= x2 && y1 <= y2; } int ask(int x1, int y1, int x2, int y2) { int ret = 0; cout << ? << x1 << << y1 << << x2 << << y2 << n ; cout.flush(); cin >> ret; return ret; ... |
#include <bits/stdc++.h> using namespace std; int add(int _a, int _b) { _a = (_a + 1000000007) % 1000000007; _b = (_b + 1000000007) % 1000000007; return (_a + _b) % 1000000007; } int mul(int _a, int _b) { _a = (_a + 1000000007) % 1000000007; _b = (_b + 1000000007) % 1000000007; return ((... |
/**
* 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... |
/**
* 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; char board[500][500]; int n, m, k; int w = 0, e = 0; int t; bool used[500][500]; bool inBound(int a, int b) { return (a >= 0 && a < n && b >= 0 && b < m); } bool dfs(int a, int b) { if (t == 0) return false; bool check = true; used[a][b] = true; ... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int a[30]; bool mark[N]; bool dp[30][1000]; int n; void update() { dp[0][0] = 1; for (int i = 1; i <= n; i++) for (int j = 0; j < 1000; j++) { dp[i][j] = dp[i - 1][j]; if (j >= a[i] && !mark[i]) dp[i][j] |= ... |
#include <bits/stdc++.h> int main() { int days, time, count, free; int x = 0; scanf( %d , &days); scanf( %d , &time); int busyTime[days]; for (x = 0; x < days; x++) { scanf( %d , &busyTime[x]); } count = 0; while (time > 0) { free = 86400 - busyTime[count]; time -... |
/*
* 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; const int MAXN = 2e6 + 666; struct palindromic_tree { int len[MAXN], link[MAXN], cnt[MAXN]; char s[MAXN]; vector<pair<char, int>> to[MAXN]; int n, last, sz; void clear() { fill(to, to + MAXN, vector<pair<char, int>>()); memset(len, 0, s... |
/**
* 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... |
// Generated by FIR Compiler 9.0 [Altera, IP Toolbench 1.3.0 Build 132]
// ************************************************************
// THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
// ************************************************************
// Copyright (C) 1991-2015 Altera Corporation
// Any meg... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
#include <bits/stdc++.h> using namespace std; const int MAX = (1 << 22) + 5; int full, n, m; bool v[MAX], b[MAX], h[MAX]; void dfsans(int now); void dfs(int now) { if (v[now]) return; v[now] = true; if (h[now]) dfsans(now); for (int i = 0; i < n; i++) { if (!(now & (1 << i))) continue;... |
#include <bits/stdc++.h> int main() { int N; std::cin >> N; std::set<std::pair<int, int>> doubled; std::set<std::pair<int, int>> pending; int to_double = 0; int l_doubled = 0; int64_t total_damage = 0; int t; int d; for (int i = 0; i < N; i++) { std::cin >> t; std::... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; if (n % 4 == 1 || n % 4 == 2) cout << 1; else cout << 0; } |
// file: DemoInterconnect_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 ... |
//-----------------------------------------------------------------------------
// (c) Copyright 2012 - 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 proper... |
#include <bits/stdc++.h> using namespace std; const long long mxn = 5e3 + 100; long long dp[25][mxn]; long long arr[mxn]; long long n, k; bool Check(long long id, long long lo, long long hi, long long rtk) { while (lo <= hi) { long long mid = (lo + hi) / 2; if (dp[id][mid] > rtk) hi ... |
#include <bits/stdc++.h> using namespace std; const int MAX = 1e5 + 9; int n, v[MAX]; int main() { ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0); cin >> n; for (int i = 0, x; i < n; i++) cin >> x, v[x % n] = i; for (int i = 0, x; i < n; i++) cin >> x, cout << v[x % n] + 1 << ; }... |
#include <bits/stdc++.h> using namespace std; int main() { int n; while (cin >> n) { long long ans = 0; for (int i = 0; i <= 8 && i <= n; i++) { for (int j = 0; j <= (i == 0 ? 8 : 4) && i + j <= n; j++) { ans += n + 1 - i - j; } } cout << ans << endl; } ... |
/*
* 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; struct CC { long long x1, x2, y1, y2; }; CC jiao(CC a, CC b) { CC c1; c1.x1 = max(a.x1, b.x1); c1.y1 = max(a.y1, b.y1); c1.x2 = min(a.x2, b.x2); c1.y2 = min(a.y2, b.y2); return c1; } int main() { CC w, b1, b2; cin >> w.x1 >> w... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); string cad; cin >> cad; map<char, int> M; for (int i = 0; i < cad.size(); i++) M[cad[i]]++; int xx = M[ x ]; int yy = M[ y ]; int ans = max(xx, yy) - min(xx, yy); if (max(xx, yy) == M[ x ]) ... |
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017
// Date : Tue Sep 19 09:39:36 2017
// Host : DarkCube running 64-bit major release ... |
// megafunction wizard: %RAM: 2-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: COMMAND_PAGE.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ===========================... |
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017
// Date : Wed Sep 20 21:10:33 2017
// Host : EffulgentTome running 64-bit major rele... |
// (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... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2008-2008 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc = 0;
reg [63:0] cr... |
// -*- 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... |
/*
* 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; bool mul_overflow(long long a, long long b) { return (a > (LLONG_MAX / b)); } bool add_overflow(long long a, long long b) { return (a > (LLONG_MAX - b)); } const int N = 1e6 + 5; int n; long double a[N][3]; bool sol(long double mid) { long double l = -1e8,... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long int n; cin >> n; int cnt = 0; while (n > 1) { if (n % 5 == 0) { n = (4 * n) / 5; cnt++; continue; } else if (n % 3 == 0) { n... |
module opicorv32_mul_wrap (
pcpi_rs2,
pcpi_rs1,
pcpi_insn,
pcpi_valid,
resetn,
clk,
pcpi_wr,
pcpi_rd,
pcpi_wait,
pcpi_ready
);
input [31:0] pcpi_rs2;
input [31:0] pcpi_rs1;
input [31:0] pcpi_insn;
input pcpi_valid;
input resetn;
input clk;
output pcpi... |
#include <bits/stdc++.h> #pragma GCC optimize( O3 ) using namespace std; const long long MOD = 1e9 + 7; long long a[200012]; long long in[200021], out[200012]; void solve() { long long n, m, i, j, c, sum; i = j = c = sum = 0; cin >> n; for (i = 0; i < n; ++i) { cin >> a[i]; --a[i... |
#include <bits/stdc++.h> void start(int *ST, int *END, int n, char *A) { int i, kol_vo = 0; for (i = n; i > 0; i--) { if (A[i] == A && END[0] == -1) { kol_vo++; END[0] = i; } if (A[i] == B && END[1] == -1) END[1] = i; kol_vo++; ; if (A[i] == C && END[2... |
// (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 ... |
// ghrd_10as066n2_avlmm_pr_freeze_bridge_1.v
// Generated using ACDS version 17.1 240
`timescale 1 ps / 1 ps
module ghrd_10as066n2_avlmm_pr_freeze_bridge_1 (
input wire clock, // clock.clk
input wire freeze_conduit_freeze, // freeze_conduit.... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2010-2011 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 pro... |
/*
* 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... |
module tx(output wire ALERT_TransmitSOP_MessageFailed,
output wire ALERT_TransmitSuccessful,
output wire MessageID_mismatch,
output wire SOP_mismatch,
output wire MessageID_SOP_match,
output wire [7:0] TRANSMIT_BYTE_COUNT,
output wire [7:0] TRANSMIT_HEADER_LOW,
output wire [7:0] TRANSMIT_HEA... |
#include <bits/stdc++.h> using namespace std; const int INF = numeric_limits<int>::max(); const long long LLINF = numeric_limits<long long>::max(); const unsigned long long ULLINF = numeric_limits<unsigned long long>::max(); const double PI = acos(-1.0); int sz = 1; vector<int> compressed; vector<pair<i... |
/*
* Copyright (c) 2000 Stephen Williams ()
*
* This source code is free software; you can redistribute it
* and/or modify it in source code form under the terms of the GNU
* General Public License as published by the Free Software
* Foundation; either version 2 of the License, or (at your option)
* ... |
module STRUCT_NEURAL_TEST;
reg [16:1]
inputA,
inputB,
c111,
c112,
c121,
c122,
c211,
c212,
c221,
c222,
b11,
b12,
b21,
b22;
wire [16:1]
out1,
out2;
STRUCT_NEURAL sn(
inputA,
inputB,
c111,
c112,
c121,
c122,
c211,
c212,
c... |
#include <bits/stdc++.h> using namespace std; const long long inf = 1000000007; const int N = 105; int n, m, k, nl, d[N][N], ok; struct point { int x, y; point(){}; point(int x, int y) : x(x), y(y) {} }; string a[N]; vector<point> l[N * N]; int s[N * N], p[N * N]; void input() { cin ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 21:35:55 11/19/2013
// Design Name:
// Module Name: sounds_bank
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
/... |
#include <bits/stdc++.h> using namespace std; void rwFile() { freopen( INP.inp , r , stdin); freopen( OUT.out , w , stdout); } void solveC_VanyaAndScales() { long long w, m; cin >> w >> m; if (w == 2) { cout << YES ; return; } int able = 1; while (m) { long l... |
`timescale 1 ns / 1 ps
module axis_bram_writer #
(
parameter integer AXIS_TDATA_WIDTH = 32,
parameter integer BRAM_DATA_WIDTH = 32,
parameter integer BRAM_ADDR_WIDTH = 10
)
(
// System signals
input wire aclk,
input wire aresetn,
output wire [BRAM_ADDR_... |
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> std::pair<T, U> operator+(const std::pair<T, U>& l, const std::pair<T, U>& r) { return {l.first + r.first, l.second + r.second}; } typedef void (*callback_function)(void); const long long ZERO = 0LL; const long long INF64 ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100000 + 10; struct node { int x, h; int num; int ans; }; node a[maxn]; int ans[maxn]; stack<int> s; int n; void init() { cin >> n; for (int i = 1; i <= n; i++) { a[i].num = i; cin >> a[i].x >> a[i].h; }... |
/*
* 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: clock_divider.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 is no... |
`timescale 1 ns / 1 ps
module axis_decimator #
(
parameter integer AXIS_TDATA_WIDTH = 32
)
(
// System signals
input wire aclk,
input wire aresetn,
// I2S signals
inout wire [3:0] gpio_data,
// ALEX signals
input wire ... |
#include <bits/stdc++.h> using namespace std; long long ccw(pair<int, int> a, pair<int, int> b, pair<int, int> c) { int dx1 = b.first - a.first; int dy1 = b.second - a.second; int dx2 = c.first - a.first; int dy2 = c.second - a.second; return 1ll * dx1 * dy2 - 1ll * dy1 * dx2; } long long di... |
#include <bits/stdc++.h> using namespace std; using ll = long long; bool judge(string& s, string& t) { auto f = [](string& x, vector<int>& cnt) { ll res = 0; for (char c : x) { int v = c - a ; for (int i = v + 1; i < 26; i++) res += cnt[i]; cnt[v]++; } return r... |
#include <bits/stdc++.h> const int inf = 1 << 30; const long long INF = 1ll << 61; using namespace std; const int MOD = 1000000; int n; int nnum[500000 + 55]; int vis[1000000 + 55]; int flag[1000000 + 55]; vector<int> G; void init() { memset(flag, 0, sizeof(flag)); memset(nnum, 0, sizeof(nnu... |
#include <bits/stdc++.h> using namespace std; double n, m, k, r; double f(int x, int y) { x++; y++; return (min(n + 1, x + r) - max((double)x, r)) * (min(m + 1, y + r) - max((double)y, r)); } int main() { cin >> n >> m >> r >> k; double ans = 0; double nbpos = (n - r + 1) * ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, count = 0, i, flag = 1; cin >> n; char s[n + 1], c; cin >> s; int l = 0, r = 0; l++; for (i = 1; i < n; i++) { c = s[i]; if (c == s[0]) l++; else r++; if (r > l && flag == 1) { ... |
`timescale 1ns/1ps
//changed to synchrounous reset
module y86_seq(
input clk,
input rst,
output [31:0] bus_A,
input [31:0] bus_in,
output [31:0] bus_out,
output bus_WE, bus_RE,
output [7:0] current_opcode);
// global control
reg [5:1] full;
wire [4:0] ue={ full[4:1], full[5] };
always @(pose... |
#include <bits/stdc++.h> using namespace std; template <class T> inline void read(T &x) { x = 0; char c = getchar(); int f = 1; while (!isdigit(c)) { if (c == - ) f = -1; c = getchar(); } while (isdigit(c)) { x = x * 10 + c - 0 ; c = getchar(); } x *= f; ... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, d; cin >> a >> b >> c >> d; if (d > 2 * c || 2 * d < c || d >= b) { printf( -1 n ); return 0; } int tmp = max(c, d); cout << max(d * 2 + 2, a) << endl; cout << max(d * 2 + 1, b) << endl; cout << tmp <... |
#include <bits/stdc++.h> using namespace std; struct Aho { Aho *son[26]; Aho *fail; int cntstr, faildp; Aho() { for (int i = 0; i < 26; ++i) son[i] = NULL; fail = NULL; cntstr = 0; faildp = -1; } }; void insert(Aho *x, int i, const string &str) { if (i < str.size(... |
#include <bits/stdc++.h> using namespace std; long long parse(string s) { long long k = 1, ret = 0; for (int i = 0; i < s.size(); i++) ret += k * (long long)(s[s.size() - i - 1] - 0 ), k *= 4; return ret; } string change(string s) { string ret = s; for (int i = 0; i < ret.size(); i++)... |
#include <bits/stdc++.h> using namespace std; void dbvar() { cerr << ] << endl; } template <class H, class... T> void dbvar(H h, T... t) { cerr << to_string(h); if (sizeof...(t)) cerr << , ; dbvar(t...); } const int INF = (int)(1e9); const long long int INFL = (long long int)(1e18); cons... |
/* Note : helluva implementation. Link : Boka hoye gelum... */ #include bits/stdc++.h #define sp << #define el << n #define S second #define F first #define pb push_back #define all(ar) ar.begin(),ar.end() #define pii... |
/**
* 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; inline int init() { int now = 0, ju = 1; char c; bool flag = false; while (1) { c = getchar(); if (c == - ) ju = -1; else if (c >= 0 && c <= 9 ) { now = now * 10 + c - 0 ; flag = true; } else if (flag)... |
#include <bits/stdc++.h> using namespace std; const int inf = 1e9; const int MOD = 1e9 + 7; const int N = 0, BAR = 1e6, LIM = 5e6; int x, y, n; int main() { scanf( %d , &n); int xa = inf, xb = -inf, ya = inf, yb = -inf; while (n--) { scanf( %d%d , &x, &y); x += BAR, y += BAR; x... |
#include <bits/stdc++.h> using namespace std; vector<vector<int>> tr; int n; int mx_bits = 40; int ind = 0; long long xor_sum = 0; long long ans; vector<long long> v; void insert_tr(long long num) { int node = 0; for (int i = (int)mx_bits; i >= (int)0; --i) { bool bit = ((num >> i) & 1) ... |
/**
* 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 (c) 2013-2014
Embedded and Network Computing Lab.
Open SSD Project
Hanyang University
All rights reserved.
----------------------------------------------------------------------------------
Redistribution and use ... |
/**
* 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 long long Size = 501; const long long mod = 1e9 + 7; long long a[Size], num[Size]; bool vis[Size]; long long f[Size], d[Size]; long long dp[Size][Size]; inline long long min(long long a, long long b) { return a < b ? a : b; } inline long long max(lon... |
#include <bits/stdc++.h> int m, n, s; int main() { scanf( %d%d , &n, &m); int ans = 0; for (int i = 0; i <= 40; i++) for (int j = 0; j <= 40; j++) { if (i * i + j == n && j * j + i == m) ans++; } printf( %d n , ans); } |
module DramReaderBuf(
input fclk,
input rst_n,
//AXI port
output M2S_AXI_ACLK,
//
output reg M2S_AXI_ARVALID,
input M2S_AXI_ARREADY,
output reg [31:0] M2S_AXI_ARADDR,
output [1:0] M2S_AXI_ARBURST,
output [3:0] M2S_AXI_ARLEN,
output [1:0] M2S_AXI_ARSIZE,
//
i... |
#include <bits/stdc++.h> using namespace std; template <typename T> istream& operator>>(istream& is, vector<T>& v) { for (T& x : v) is >> x; return is; } template <typename T> ostream& operator<<(ostream& os, const vector<T>& v) { for (int i = 0; i < (int)v.size(); i++) { os << v[i] << (i ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e6 + 10; string rs; int pre[maxn]; void matchprefix() { int n = rs.length(); pre[0] = 0; int k = 0; for (int i = 1; i < n; i++) { while (k > 0 && rs[k] != rs[i]) k = pre[k - 1]; if (rs[k] == rs[i]) k++; pre[i] = ... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, t, c, i, x, suma, resultado; cin >> n >> t >> c; suma = 0; resultado = 0; for (i = 0; i < n; i++) { cin >> x; if (x > t) suma = 0; else suma++; if (suma >= c) resultado++; } ... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c, x, y, z; cin >> a >> b >> c >> x >> y >> z; int a1, b1, c1, a2, b2, c2, m = 0, n = 0; if (a > x) { if (abs(a - x) >= 2) { if ((a - x) % 2 == 0) m = m + a - x; else m = m + a - x - 1; ... |
// Asynchronous load and store register
module register # (parameter N = 8)
(input clk,
input [N-1:0] in,
output reg [N-1:0] out,
input load,
input clear
);
always @ (posedge clk or posedge clear)
if (clear) out <= 0;
else if (load) out <= in;
else out <= in;
endmodule
// Asynchronous... |
module mix(/*AUTOARG*/
// Outputs
OA, OB, OC,
// Inputs
a, b, c, clk, shift
);
input [31:0] a, b, c;
output [31:0] OA, OB, OC;
input clk;
input [4:0] shift;
assign OA = (a - c) ^ ( (c << shift) | (c >> (32 - shift)) );
assign OC = c + b;
assign OB = b;
endmodule
mo... |
#include <bits/stdc++.h> using namespace std; class Solution { public: int count(vector<int>& pieces, int p) { int n = pieces.size(); preprocess(n); vector<vector<vector<int>>> cur( n + 1, vector<vector<int>>(n + 1, vector<int>(n + 1, 0))); vector<vector<vector<int>>> nxt( ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 2005; const char vow[] = { a , e , i , o , u , y }; char str[maxn]; bool check(char ch) { for (int i = 0; i < 6; ++i) { if (ch == vow[i]) return true; } return false; } int main() { int n; while (~scanf( %d , &n)... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.