text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> #pragma warning(disable : 4996) using namespace std; using LL = int64_t; using pii = pair<int, int>; const double PI = 2 * asin(1); int g_n; string g_s; vector<int> vi_in; vector<LL> vll_sum; void pretreat() {} void input() { vi_in.clear(), vi_in.resize(g_n + 1); v... |
/**
* 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 = 1000005; const long long MOD = 1000000007; long long n, k; long long pre[MAXN], suf[MAXN], fac[MAXN], ifac[MAXN]; inline long long quick_pow(long long x, long long k) { long long res = 1; while (k) { if (k & 1) (res *= x) %= MOD; ... |
/**
* 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); long long int n, i, sum = 0; cin >> n; long long int a[n]; for (i = 0; i < n; i++) { cin >> a[i]; sum = sum + a[i]; } sort(a, a + n); i = 0; while (1) { ... |
#include <bits/stdc++.h> using namespace std; const int NN = (1 << 15); int pre[NN], suf[NN]; map<string, int> mp; int main() { int n; cin >> n; for (int i = 1, x; i <= n; i++) { cin >> x; pre[i] = x >> 15; suf[i] = x & (NN - 1); } for (int i = 0; i < NN; i++) { str... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int a, b; cin >> a >> b; int s[6] = {a, b, b - a, -a, -b, a - b}; int n; cin >> n; cout << (s[(n - 1) % 6] % (long long)1000000007 + (long long)1000000007) % ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int n; cin >> n; for (int i = 1; i <= n; i++) { cout << 1 ; } cout << n ; } } |
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; while (t--) { long long int n; cin >> n; long long int a[n]; set<long long int> s; for (long long int i = 0; i < n; i++) { cin >> a[i]; s.insert(a[i]); } cout <... |
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-8; const int MAXN = 10005; const int INF = 1111111111; struct Node { int id, val; bool operator<(const Node& a) const { if (a.val == val) return a.id < id; return a.val < val; } }; int du[100]; int n, p, tot, fg;... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; long long dp[100005][2]; string a, b; int main() { int K; while (cin >> a >> b) { cin >> K; memset(dp, 0, sizeof(dp)); if (a == b) dp[0][1] = 1; else dp[0][0] = 1; int cnt = 0,... |
// (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; const int mxn = 3e5 + 5; const long long MOD = 1e9 + 7; const int BASE = 100000000; const int INF = 1e9 + 8; long long g[mxn], cnt[mxn], a[mxn]; void up_g(int x, const long long &val) { while (x < mxn) { g[x] += val; x += x & (-x); } } ... |
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 10, size = 1 << 20, mod = 998244353; template <class o> void qr(o &x) { char c = getchar(); x = 0; int f = 1; while (!isdigit(c)) { if (c == - ) f = -1; c = getchar(); } while (isdigit(c)) x = x * 10 + c - 0 ... |
#include <bits/stdc++.h> #pragma GCC optimize(2) using namespace std; inline long long read() { char c = getchar(); long long x = 0; bool f = 0; for (; !isdigit(c); c = getchar()) f ^= !(c ^ 45); for (; isdigit(c); c = getchar()) x = (x << 1) + (x << 3) + (c ^ 48); if (f) x = -x; retur... |
/**
* 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... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 16:34:43 11/10/2015
// Design Name:
// Module Name: clk_generator
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies: ... |
/*
* 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... |
////////////////////////////////////////////////////////////////
// File: td_detect.v
// Author: Tersaic, modified by BBB
// Source: TD_Detect.v
// About: Removed PAL and NTSC outputs. Minor syntax changes.
////////////////////////////////////////////////////////////////
module td_detect
(
output oTD_Stable,... |
`timescale 1ns / 1ns
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 12/06/2013 06:51:42 PM
// Design Name:
// Module Name: main
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revis... |
/*
* Copyright (c) 2000 Steven Wilson ()
*
* 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)
* ... |
// file: tres_relojes.v
//
// (c) Copyright 2008 - 2010 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... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: sparc_ifu_sscan.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute it a... |
#include <bits/stdc++.h> using namespace std; int main() { string a, b; cin >> a >> b; string s = ; sort(b.rbegin(), b.rend()); if (a.size() > b.size()) s = b.substr(0, a.size()); else s = b; for (int i = 0; i < a.size(); i++) { if (a[i] == 9 ) continue; ... |
#include <bits/stdc++.h> using namespace std; int main() { int q; cin >> q; long long int x = 0; vector<long long int> sum = {}; vector<long long int> val = {}; for (int i = 0; i < (int)q; i++) { int op; cin >> op; if (op == 1) { cin >> x; sum.push_back(((su... |
#include <bits/stdc++.h> using namespace std; int const N = 100000; int n; int ans; char digits[8][8]; int ten[8]; bitset<N> isprime; int sum[8]; struct Integer { int i, j, x; Integer(int i, int j, int x) : i(i), j(j), x(x) {} operator int() { return x; } Integer(int x = 0) : x(x), i(-... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; template <class T> T mceil(T a, T b) { if (a % b == 0) return a / b; else return a / b + 1; } const long long int M = 1e9 + 7; const long long int N = 2e5 + 5; const long long int inf = 9e18; int main() { ios_base ::sync_with_stdio(fa... |
module smallfifo16x(input rst,
input clk_in,
input [15:0] fifo_in,
input fifo_en,
output fifo_full,
input clk_out,
output [15:0] fifo_out,
output fifo_empty,
input fifo_rd);
vga_fifo_dc#(.AWIDTH(4),.DWIDTH(16))
fifo0(... |
// fpgaTop_nf10.v - A proxy fpga top-level to hold OPED.v
// Copyright (c) 2010,2011 Atomic Rules LLC - ALL RIGHTS RESERVED
//
// The purpose of this module is to "stand in" for the real NetFPGA-10G as
// OPED is developed. This file would not normally be needed for any normal
// NETFPGA-10G build. It is useful for st... |
/**
* ------------------------------------------------------------
* Copyright (c) All rights reserved
* SiLab, Institute of Physics, University of Bonn
* ------------------------------------------------------------
*/
`timescale 1ps/1ps
`default_nettype none
module rbcp_to_bus (
input wire BUS_RS... |
/**
* 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... |
/////////////////////////////////////////////////////////////////////
//// ////
//// WISHBONE AC 97 Controller ////
//// Interrupt Logic ////
//// ... |
#include <bits/stdc++.h> const int MaxN = 100000, inf = 0x3f3f3f3f; inline void read(int &ans) { ans = 0; char c = getchar(); while (c < 0 || c > 9 ) c = getchar(); while (c >= 0 && c <= 9 ) ans = ans * 10 + c - 48, c = getchar(); return; } int n, P; struct Node { int pos, t; ... |
#include <bits/stdc++.h> using namespace std; pair<int, int> point[100]; double ang[100]; double dp[10000000]; int i, j, k, N, M, K, l, r; void clear() {} void init() { scanf( %d%d%d , &N, &l, &r); for (i = 0; i <= N - 1; i++) { int first; scanf( %d%d%d , &point[i].first, &point[i].sec... |
#include <bits/stdc++.h> using namespace std; int main() { long long int t; cin >> t; while (t--) { long long int n, i, j, b, c, a; cin >> a >> b >> c; long long int y = a + b + c; y--; cout << y << endl; } } |
#include <bits/stdc++.h> using namespace std; const double EPS = 1e-4; const long double PI = acos((long double)-1.0); const long long int MOD = 1e9 + 7; long long int powmod(long long int a, long long int b, long long int mod) { long long int res = 1; a %= mod; for (; b; b >>= 1) { if (b & ... |
/*
* Copyright (c) 2002 Simon Denman
*
* 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)
* any ... |
/**
* 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... |
// $Id: c_encoder.v 1534 2009-09-16 16:10:23Z dub $
/*
Copyright (c) 2007-2009, Trustees of The Leland Stanford Junior University
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
Redistributions of sour... |
#include <bits/stdc++.h> using namespace std; long long n, k, x, ans; long long findX(long long R) { if (R < 0) return 0; return (R * (R + 1)) / 2; } int main() { scanf( %lld %lld , &n, &k); x = 0; for (int i = 1; i <= n - 1; i++) { if (findX(i - 1) <= k) x = i; } if (findX(x... |
#include <bits/stdc++.h> using namespace std; int main() { int n, cnt, flag = 0; cin >> n; int a, b, c = 0; for (int i = 1; i <= n; i++) { cin >> a >> b; if (b - a >= 2) ++c; } cout << c << endl; } |
#include <bits/stdc++.h> using namespace std; long long bin(long long x, long long n) { long long res = 1; x %= 1000000007; while (n) { if (n & 1) res = (res * x) % 1000000007; x = (x * x) % 1000000007; n >>= 1; } return res; } const long long MXN = 2e5 + 1; vector<long l... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2009-2010 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... |
#include <bits/stdc++.h> using namespace std; int n, i, j, m, k, l, h, g, ye, a, b, rez; int p[300005], f[300005], ct[300005]; int v[300005], nv; bool comp(int x, int y) { return f[x] < f[y]; } int main() { cin >> n >> m; for (i = 1; i <= n; i++) cin >> p[i], f[p[i]] = i; ye = p[n]; for (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... |
//Legal Notice: (C)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 do... |
#include <bits/stdc++.h> using namespace std; int main() { unsigned long long A, B; cin >> A >> B; if (A < B) { puts( -1 ); return 0; } if ((A - B) % 2 != 0) { puts( -1 ); return 0; } unsigned long long C = (A - B) / 2; unsigned long long X = 0, Y = 0; for... |
`timescale 1ns / 1ps
// Copyright (C) 2008 Schuyler Eldridge, Boston University
//
// 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.
//
// This program is distr... |
`define RegBankP8_NOP 4'h0
`define RegBankP8_LD0 4'h1
`define RegBankP8_LD1 4'h2
`define RegBankP8_LD2 4'h3
`define RegBankP8_LD3 4'h4
`define RegBankP8_LD4 4'h5
`define RegBankP8_LD5 4'h6
`define RegBankP8_LD6 4'h7
`define RegBankP8_LD7 4'h8
`define RegBankP8_State_Reset 2'h0
`define RegBankP8_State_Ready 2'h1
`defin... |
//////////////////////////////////////////////////////////////////
// //
// Co-processor module for Amber 25 Core //
// //
// This file is part of the Amber project ... |
//////////////////////////////////////////////////////////////////////////////////
// LFSR8 for Cosmos OpenSSD
// Copyright (c) 2015 Hanyang University ENC Lab.
// Contributed by Kibin Park <>
// Yong Ho Song <>
//
// This file is part of Cosmos OpenSSD.
//
// Cosmos OpenSSD is free software; you can red... |
#include <bits/stdc++.h> using namespace std; int n; int a[500007]; int l[500007]; int r[500007]; long long ans = 0; pair<int, int> p[500007]; void input() { scanf( %d , &n); int i; for (i = 0; i < n; i++) { scanf( %d , &a[i]); p[i].first = a[i]; p[i].second = i; } ... |
#include <bits/stdc++.h> using namespace std; struct node { char name[20]; int id; int num; } a[100005]; bool cmp(node x, node y) { if (x.id == y.id) return x.num > y.num; return x.id < y.id; } int main() { int n, m; while (cin >> n >> m) { for (int i = 0; i < n; i++) { ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, z; cin >> n >> m; z = 0; int* a = new int[n + 1]; int* s = new int[n + 1]; for (int i = 1; i <= n; i++) cin >> a[i]; s[1] = a[1]; s[0] = 0; for (int i = 2; i <= n; i++) s[i] = a[i] + s[i - 1]; for (int i = 1... |
module test1 ( wire2, wire4 );
output [3:0] wire2;
output [16:0] wire4;
endmodule
// msg2099
module test_top;
/*AUTOWIRE*/
// Beginning of automatic wires (for undeclared instantiated-module outputs)
wire eq; // From test_rcv of test1.v
wire not_eq; // From test_foo of test1.v
... |
#include <bits/stdc++.h> #pragma GCC optimize( -O2 ) using namespace std; void err(istream_iterator<string> it) { cerr << endl; } template <typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cerr << *it << = << a << t ; err(++it, args...); } template <ty... |
#include <bits/stdc++.h> using namespace std; int h; int seq[200010]; int par[200010]; int cur, cur_par, rem = -1, rem_par; int main() { scanf( %d , &(h)); for (int i = 0; i < h + 1; i++) scanf( %d , &(seq[i])); cur_par = 1; cur = 1; for (int i = 0; i < h; i++) { if (rem == -1 && s... |
#include <bits/stdc++.h> using std::pair; using std::vector; vector<int64_t> ReadInput(std::istream& in_stream = std::cin); void WriteAnswer(size_t min, size_t max, std::ostream& out_stream = std::cout); pair<size_t, size_t> GetRange(const vector<int64_t>& input); int main() { std::ios_base::sync_with_s... |
#include <bits/stdc++.h> using namespace std; const long long MAXN = 300050; const long long LINF = 0x3f3f3f3f3f3f3f3f; map<int, int> odd, even; int buf[MAXN], pre[MAXN]; int main() { ios::sync_with_stdio(false); long long n; cin >> n; for (long long i = 1; i <= n; i++) { cin >> buf[i]... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; scanf( %d%d , &n, &m); long long x = 1; long long a = 1; for (int i = 1; i <= m; i++) a = (a << 1) % 1000000009; for (int i = 1; i <= n; i++) { a--; x = x % 1000000009 * (a + 1000000009) % 1000000009; } ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, t, x, y; int ar = 0; int al = 0; int br = 0; int bl = 0; cin >> n; for (int i = 0; n > i; i++) { cin >> t; cin >> x; cin >> y; if (t == 1) { ar += x; al += y; } else { ... |
#include <bits/stdc++.h> using namespace std; int n, a[2][300004]; long long sf[2][300004]; long long ca[2][300004]; int w33ha() { memset(sf, 0, sizeof(sf)); memset(ca, 0, sizeof(ca)); for (int t = 0; t <= 1; t++) for (int i = 1; i <= n; i++) scanf( %d , &a[t][i]); for (int t = 0; t <= 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 law... |
//=======================================================
// This code is generated by Terasic System Builder
//=======================================================
module VGA_TEST(
//////////// CLOCK //////////
CLOCK_50, // BANK 4
CLOCK2_50, // BANK 7
CLOCK3_50, // BANK 3A
//////////// KEY (Active Low)... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: spc_pcx_buf.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute it and/o... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int l, r; cin >> l >> r; cout << l << << 2 * l << endl; } } |
// AWP (coprocessor, 32-bit fixed point and 48-bit floating point arithmetic)
module awp(
input clk_sys,
input [0:15] w,
input r02,
input r03,
input pufa,
input [7:9] ir,
input nrf,
input mode,
input step,
input efp,
input got,
input ldstate,
input ok$,
input oken,
input zw,
output [0:15] zp, // bus
o... |
#include <bits/stdc++.h> using namespace std; int n, i = 1, ans = 0; int main() { cin >> n; while (n > 0) { if (n % 2 == 1) { ans++; n -= 1; } n /= 2; } cout << ans << endl; } |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 5; int gcd(int a, int b) { return b ? gcd(b, a % b) : a; } void slove() { int n, m, k; cin >> n >> m >> k; int ls = 0; if (n % 2) { n--, ls += m / 2; } if (m % 2) m--; int flag = 1; if (ls > k) flag = 0; ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 200010; vector<int> g[maxn + 1]; int father[maxn + 1], a[maxn + 1]; int f[maxn + 1], fup[maxn + 1]; int n, K; int result; int ge[maxn + 1], upge[maxn + 1]; int MIN; void init() { int i, x, y; scanf( %d%d , &n, &K); for (i = 1... |
module nios (
clk50_clk,
io_ack,
io_rdata,
io_read,
io_wdata,
io_write,
io_address,
io_irq,
mem32_address,
mem32_direction,
mem32_byte_en,
mem32_wdata,
mem32_request,
mem32_tag,
mem32_dack_tag,
mem32_rdata,
mem32_rack,
mem32_rack_tag,
memory_mem_a,
memory_mem_ba,
memory_mem_ck,
memory_mem_ck_n,
... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; double general_sum, sum; general_sum = sum = 0; int i = 0; int j = 0; cin >> n >> k; vector<int> a(n); double w = n - k + 1; for (i; i < w; i++) { if (i == 0) { for (j; j < k; j++) { cin ... |
/*
* 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... |
// MBT 7/7/2016
//
// 2 read-port, 1 write-port ram
//
// reads are synchronous
//
// although we could merge this with normal bsg_mem_1r1w
// and select with a parameter, we do not do this because
// it's typically a very big change to the instantiating code
// to move to/from sync/async, and we want to reflect this.
... |
//----------------------------------------------------------------------------
// Copyright (C) 2001 Authors
//
// This source file may be used and distributed without restriction provided
// that this copyright statement is not removed from the file and that any
// derivative work contains the original copyright notic... |
/**
* 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 N = 1e6; const long long INF = 1e18; const long long mod = 1e9 + 7; long long y; long long n, m; vector<long long> v; void rec(long long x) { if (x > m) { return; } if (x == m) { cout << YES << endl; y = 1; ... |
#include <bits/stdc++.h> using namespace std; map<string, int> mp; int main() { int n, m; string s; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> s; mp[s] = 1; } int con = 0; for (int i = 0; i < m; i++) { cin >> s; if (mp[s] == 1) { con++; } ... |
#include <bits/stdc++.h> using namespace std; set<pair<long long, long long> > st; const long long INF = 1 << 30; const long long N = 100005; long long p[N], n, m; long long nxt[N], pre[N]; long long a[N], x[N]; inline long long read() { long long x = 0, f = 1; char ch = getchar(); while (ch... |
module sync_merge (/*AUTOARG*/
// Outputs
a1, a2, r0,
// Inputs
r1, r2, a0, reset_n
);
input r1;
output a1;
input r2;
output a2;
output r0;
input a0;
input reset_n; // To U_SYNC_R1 of dualffsync.v, ...
/*AUTOINPUT*/
/*AUTOOUTPUT*/
/*AUTOREG*/
/*AUTOWI... |
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1.0); const double EPS = 1e-6; int main() { { ; }; int n; scanf( %d , &n); vector<pair<int, int> > V(n); int totalW = 0; for (int i = 0; i < n; i++) { scanf( %d %d , &V[i].first, &V[i].second); totalW += V[... |
/**
* 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 tmp, n, tr[100005 * 30][2], cnt; inline void insert(int x) { int p = 0, d; for (int i = 29; i >= 0; --i) { d = (x >> i) & 1; if (tr[p][d]) p = tr[p][d]; else { tr[p][d] = ++cnt; p = cnt; memset(tr[p], 0, si... |
#include <bits/stdc++.h> using namespace std; const int N = 510; const int INF = 0x3f3f3f3f; const int MOD = (int)1e9 + 7; int n; long long ans; void dfs(int a, int b, int c) { if (a == n) { ++ans; return; } for (int i = 0; i < n; ++i) { if (b & (1 << i)) continue; if (... |
#include <bits/stdc++.h> #pragma GCC target( avx ) #pragma GCC optimize( O3 ) #pragma GCC optimize( unroll-loops ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using std::cin; using std::cout; using std::lower_bound; using std::string; using std::upper_bound; using 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 law... |
#include <bits/stdc++.h> using namespace std; int32_t main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); ; long long tc = 1; cin >> tc; while (tc--) { long long n; cin >> n; set<long long> st; for (long long i = 0; i < n; i++) { long long... |
// Accellera Standard V2.5 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2010. All rights reserved.
`include "std_ovl_defines.h"
`module ovl_implication (clock, reset, enable, antecedent_expr, consequent_expr, fire);
parameter severity_level = `OVL_SEVERITY_DEFAULT;
parameter property_type = ... |
#include <bits/stdc++.h> using namespace std; struct interval { int start; int end; }; int main() { int p, q, l, r; cin >> p >> q >> l >> r; struct interval Z[p]; for (int i = 0; i < p; i++) { cin >> Z[i].start >> Z[i].end; } struct interval X[q]; for (int i = 0; i < q;... |
#include <bits/stdc++.h> #pragma GCC optimize( Ofast ) #pragma GCC target( avx,avx2,fma ) using namespace std; long long gcd(long long a, long long b) { if (b == 0) return a; return gcd(b, a % b); } long long lcm(long long a, long long b) { return a * b / (gcd(a, b)); } void solve() { long lon... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; unsigned long long preLef[N], preRig[N], sum[N], a[N]; map<unsigned long long, unsigned long long> f, g; int n, m; unsigned long long Rand() { return (unsigned long long)rand() * rand() * rand() + (unsigned long long)rand()... |
`include "macro.v"
module ram(
input wire clock,
input wire chip_enable,
input wire operation,
input wire[`INST_ADDR_BUS] addr,
input wire[`BYTE_SEL_BUS] select_signal,
input wire[`INST_DATA_BUS] ... |
#include <bits/stdc++.h> static const int MAXN = 2e5 + 4; static const int MAXK = 2e5 + 3; static int n, k; static std::pair<int, int> p[MAXN]; static int idx[MAXN]; static std::vector<int> q[MAXN]; static int ans[MAXN]; int main() { scanf( %d%d , &n, &k); for (int i = 0; i < n; ++i) { sca... |
/***************************************************************************************************
** fpga_nes/hw/src/cmn/vga_sync/vga_sync.v
*
* Copyright (c) 2012, Brian Bennett
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided t... |
// megafunction wizard: %LPM_COUNTER%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: LPM_COUNTER
// ============================================================
// File Name: COUNTER.v
// Megafunction Name(s):
// LPM_COUNTER
//
// Simulation Library Files(s):
// lpm
// ================================... |
//////////////////////////////////////////////////////////////////////
//// ////
//// CLK_SWITCH.v ////
//// ////
//// This file is part of the Eth... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.