text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const long long maxn = 1e5 + 7; long long n, q; long long a[maxn]; long long m; map<long long, long long> ma; long long Mod(long long x, long long mod) { if (x < mod) return x; return x % mod + mod; } long long fp(long long a, long long b, long lon... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2010 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t;
integer value = 19;
initial begin
if (value==1) begin end
else if (value==2)... |
#include <bits/stdc++.h> using namespace std; long long int comp(pair<long long int, long long int> a, pair<long long int, long long int> b) { if (a.first != b.first) return a < b; return a.second < b.second; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, c; cin >> a >> b >> c; cout << (a - 1) * (b + c - 1) + b * c << endl; return 0; } |
#include <bits/stdc++.h> int main() { int same = 0, diff = 0; int a, b; scanf( %d %d , &a, &b); while (a != 0 && b != 0) { diff++; a--; b--; } while (a >= 2) { a -= 2; same++; } while (b >= 2) { b -= 2; same++; } printf( %d %d n , diff,... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long i, j, n, a[100001], b[100001], c[100001], d[100001]; cin >> n; for (i = 0; i < n; i++) { cin >> a[i]; b[i] = c[i] = a[i]; } for (i = 0; i < n -... |
#include <bits/stdc++.h> using namespace std; struct qnode { int id; long long val; bool operator<(qnode b) const { return val > b.val; } }; queue<int> qu[200100]; int w[200100], vis[200100], add[200100]; int n, m, Q, opt, x, y, z; long long dis[200100]; priority_queue<qnode> q; vector<pai... |
/************************************************
* *
* Derek Prince *
* ECEN 2350: Digital Logic *
* 2n-bit Comparator on the terasiC DE0 board *
* Altera Cyclone 3 EP3C16F484 *
* ... |
#include <bits/stdc++.h> using namespace std; template <typename T, typename U> inline void smin(T &a, const U &b) { if (a > b) a = b; } template <typename T, typename U> inline void smax(T &a, const U &b) { if (a < b) a = b; } template <class T> inline void gn(T &first) { char c, sg = 0; ... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1000000007; const int MAX = 1000005; int SetBit(int n, int x) { return n | (1 << x); } int ClearBit(int n, int x) { return n & ~(1 << x); } int ToggleBit(int n, int x) { return n ^ (1 << x); } bool CheckBit(int n, int x) { return (bool)(n & (1 ... |
// file: io_clock_gen_600mhz.v
//
// (c) Copyright 2008 - 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... |
/*
* 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 INF = 1e9; const int MX = 3001; map<pair<int, int>, bool> forbidden[MX]; struct Graph { int d[MX][MX]; int parent[MX][MX]; vector<int> adj[MX]; void addEdge(int u, int v) { adj[u].push_back(v); adj[v].push_back(u); } v... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 100; int a[N]; int main() { std::ios::sync_with_stdio(false); int n; cin >> n; for (int i = 0; i < n; ++i) cin >> a[i]; vector<int> nrs; for (int i = 0; i < n; ++i) nrs.push_back(a[i]); for (int i = 1; i < 32; ++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; const int INF = 1000 * 1000 * 1000 + 9; const long long MOD = 1000 * 1000 * 1000 + 7; const double EPS = 1e-9; const int di[] = {-1, 0, 1, 0}; const int dj[] = {0, -1, 0, 1}; const int N = 505; int n, k; int a[N][N]; int b[N][N]; int s[N][N]; int q; ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; using pll = pair<ll, ll>; const ll inf = 1; const ll mod = 1E9; int main() { int n, m; scanf( %d %d , &n, &m); int colors = 1; vector<vector<int> > mset(n, vector<int>()); vector<vector<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; template <typename T> void out(T x) { cout << x << endl; exit(0); } const long long mod = 1e9 + 7; const int maxn = 1e6 + 5; struct Edge { int u, v, w, i; }; int n, m; Edge edge[maxn]; vector<int> g[maxn]; map<int, vector<int>> mp; int ... |
//
// Copyright (c) 1999 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)
// ... |
/*
Copyright (c) 2014 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute,... |
#include <bits/stdc++.h> using namespace std; char s1[1010000]; char s2[1010000]; int main() { scanf( %s , s1); scanf( %s , s2); int len1, len2, i; len1 = strlen(s1); len2 = strlen(s2); int ans; if (len1 - len2) ans = 0; else if (len1 == 1) { if (s1[0] == s2[0]) ... |
#include <bits/stdc++.h> using namespace std; const int N = 100010; int f[256], b[8]; vector<pair<int, int>> a; int main() { int n, m, k; scanf( %d%d%d , &n, &m, &k); for (int i = 1; i <= n; i++) { int l, r; scanf( %d%d , &l, &r); a.push_back({l, i}); a.push_back({r + 1, -i... |
/*******************************************************************************
* This file is owned and controlled by Xilinx and must be used solely *
* for design, simulation, implementation and creation of design files *
* limited to Xilinx devices or technologies. Use with non-Xilinx ... |
#include <bits/stdc++.h> using namespace std; pair<int, int> a[5003]; vector<int> color[5003]; int ans[5003]; int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, k, i, j; cin >> n >> k; for (i = 0; i < n; i++) { cin >> a[i].first; a[i].second = i; ... |
#include <bits/stdc++.h> using namespace std; int n, ans; int a[6][6]; int convert(char c) { if (c == R ) return 1; if (c == G ) return 2; if (c == B ) return 3; if (c == Y ) return 4; if (c == W ) return 5; } void xuly(int state) { int i, j, dem, c1, c2; bool val[10], col[1... |
#include <bits/stdc++.h> using namespace std; char str[25][510]; int g[25][25]; int main() { int n, m, i, j, l1, l2, fuck, temp, k; scanf( %d%d , &n, &m); for (i = 0; i < n; i++) scanf( %s , str[i]); for (i = 0; i < n; i++) { for (j = i + 1; j < n; j++) { temp = 0; l1 = str... |
/**
* 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) 2009-2012 Chris McClelland
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2003 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc; initial cyc=1;
// [16] ... |
//==================================================================================================
// Filename : uart_send.v
// Created On : 2015-05-27 11:13:22
// Last Modified : 2015-05-27 12:46:45
// Revision : 1.0
// Author : Ángel Terrones
// Company : Universidad Simón Bolí... |
#include <bits/stdc++.h> template <class T> void cxk(T& a, T b) { a = a > b ? a : b; } template <class T> void cnk(T& a, T b) { a = a < b ? a : b; } long long gi() { long long x = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) f ^= ch == - , ch = getchar(); while (isdigit(ch)... |
#include <bits/stdc++.h> using namespace std; const int N = 107; const int M = 107 * 26; const int inf = (int)1e9 + 7; const long long base = (long long)1e18; const double pi = acos(-1); const double ep = 1e-18; int dp[107][M]; void solve() { dp[0][0] = 1; for (int i = 1; i < N; i++) { f... |
#include <bits/stdc++.h> using namespace std; int n; vector<int> g[100005]; vector<pair<pair<int, int>, int> > coord; int visited[100005]; long long ans = 1; const long long pmod = 1000000007; long long expsize; set<int> x, y; bool cycle; int mapback[100005]; long long qpmod(long long b, long lo... |
#include <bits/stdc++.h> using namespace std; const int N = 400500; long long A[N]; long long B[N]; inline long long mymod2(long long x) { if (x % 2 == 0) return 0; else return 1; } inline long long mydiv2(long long x) { if (x >= 0) return x / 2; else { if (x % 2 ==... |
#include <bits/stdc++.h> using namespace std; int dp[105][105][205][2]; string s1; int main() { int n; int ans = 0; memset(dp, 0, sizeof(dp)); cin >> s1; cin >> n; dp[0][0][100][0] = 1; for (int i = 1; i <= s1.size(); i++) { for (int j = 0; j <= 100; j++) { for (int k =... |
#include <bits/stdc++.h> using namespace std; void magic(int n) { int cnt = 0; set<vector<vector<int>>> s; vector<pair<int, string>> ans; map<int, int> mp; function<void(vector<vector<int>>)> f = [&](const vector<vector<int>> &x) { if (s.find(x) != s.end()) return; s.insert(x); ... |
#include <bits/stdc++.h> using namespace std; const int N = 5050, b = 53, mod = 1073676287; int n, q, pre[N], suf[N], ans[N], binv[N], dp[N][N]; int mul(int x, int y) { return (x * 1ll * y) % mod; } int add(int x, int y) { return ((x + y) % mod + mod) % mod; } int pw(int b, int p) { if (!p) return 1; ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 100000 + 10; long long A, B, N; long long l, t, m; int main() { cin >> A >> B >> N; for (int i = 1; i <= N; i++) { cin >> l >> t >> m; if (t < A + (l - 1) * B) { cout << -1 << endl; continue; } 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 la... |
/*
* Milkymist VJ SoC fjmem flasher
* Copyright (C) 2010 Michael Walle
*
* 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 the ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 55, dx[4] = {0, 0, -1, 1}, dy[4] = {1, -1, 0, 0}; int n, m, k, dis[MAXN][MAXN], sx, sy, tx, ty; queue<pair<int, int> > S; char mp[MAXN][MAXN]; string ans, res; bool r[27], o; bool isval(int x, int y) { return x < n && y < m && x >= 0 && y >=... |
#include <bits/stdc++.h> using namespace std; const int maxc = 22; const int maxn = (int)5e5; int tin[maxn], tout[maxn], _t = 0, ver[maxn], n; vector<int> g[maxn]; int deep[maxn], maxh[1 << maxc]; unsigned mask[maxn]; int sz[maxn], ans[maxn]; unsigned char s[maxn]; int dfs_size(int v, unsigned m) { ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 2015/09/22 10:47:40
// Design Name:
// Module Name: test_filter
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// R... |
#include <bits/stdc++.h> using namespace std; int m, n; int a[11][11] = {{0, 1, 2}, {1, 0, 2}, {1, 2, 0}, {2, 1, 0}, {2, 0, 1}, {0, 2, 1}, {0, 1, 2}}; int main() { ios::sync_with_stdio(false), cin.tie(0), cout.tie(0); cin >> n >> m; cout << a[n % 6][m] << endl; return 0; } ... |
#include <bits/stdc++.h> using namespace std; void dfs(int i, int j, vector<vector<char>>& grid, vector<vector<char>>& visited) { int n = grid.size(); if (i < 0 || i >= n || j < 0 || j >= n || visited[i][j] || grid[i][j] == 0 ) return; visited[i][j] = 1; dfs(i - 1, j, grid, visited... |
/*
* 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; bool valid(int i, int j, int n, int m) { return i >= 0 && i < n && j >= 0 && j < m; } void solve() { int n, m; int dir[4][2] = {{1, 0}, {0, 1}, {-1, 0}, {0, -1}}; cin >> n >> m; char a[n][m]; for (int i = 0; i < n; i++) { for (int j = 0... |
simulator language=verilog
// This File is part of gnucap-geda
// (C) 2012 Felix Salfelder
// GPLv3 or later
// mapping geda-symbols to actual devices
// "analog" section
module CAPACITOR(1 2);
parameter value=1;
capacitor #(.c(value)) c(1,2);
endmodule
hidemodule CAPACITOR
module POLARIZED_CAPACITOR(p n);
// noth... |
#include <bits/stdc++.h> using namespace std; const int maxx = 200010; unsigned long long t, n; unsigned long long ans = 0, total = 0, sum = 0; unsigned long long a[maxx], b[maxx], bj[maxx]; int main() { scanf( %lld , &t); while (t--) { scanf( %lld , &n); ans = 0, total = 0, sum = 1; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, d, res = 0, a = 0, b; cin >> n >> d; for (int i = 0; i < n; i++) { cin >> b; if (a >= b) { res += ceil((a - b + 1) / (double)d); b += ceil((a - b + 1) / (double)d) * d; } a = b; } cout << re... |
#include <bits/stdc++.h> using namespace std; const long long maxx = 1e9 + 7; bool compare(const pair<long long, long long> &a, const pair<long long, long long> &b) { return a.first > b.first || (a.first == b.first && a.second < b.second); } long long inline power(long long a, long long b, ... |
// megafunction wizard: %In-System Sources and Probes%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsource_probe
// ============================================================
// File Name: hps_reset.v
// Megafunction Name(s):
// altsource_probe
//
// Simulation Library Files(s):
//
// ============... |
#include <bits/stdc++.h> using namespace std; int n, x1, x2, x3, x4; int main() { cin >> n; cout << YES << endl; for (int i = 0; i < n; i++) { cin >> x1 >> x2 >> x3 >> x4; x1 = abs(x1) % 2; x2 = abs(x2) % 2; cout << x1 * 2 + x2 + 1 << endl; } } |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; vector<pair<int, int> > v; while (n--) { int x, y; cin >> x >> y; v.push_back(make_pair(-x, y)); } sort(v.begin(), v.end()); int ind = k - 1; int res = 1; while (ind - 1 >= 0 && ... |
`timescale 1 ns / 1 ps
module hapara_axis_id_generator_v1_0_M00_AXIS #
(
// Users to add parameters here
// User parameters ends
// Do not modify the parameters beyond this line
// Width of S_AXIS address bus. The slave accepts the read and write addresses of width C_M_AXIS_T... |
// megafunction wizard: %RAM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: ram_16x8k.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ==============================... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 132674; const int MOD = 1e9 + 7; int main() { set<int> ar; set<int> to_buy; set<int> to_sell; long long multiplyier = 1; int n; scanf( %d , &n); for (int i = 0; i < n; i++) { int temp; string l; cin >> l... |
#include <bits/stdc++.h> using namespace std; template <typename T1, typename T2> bool mini(T1 &a, T2 b) { if (a > b) { a = b; return true; } return false; } template <typename T1, typename T2> bool maxi(T1 &a, T2 b) { if (a < b) { a = b; return true; } return... |
#include <bits/stdc++.h> using namespace std; int n, m, nrh, nrt, nod1, nod2, d[100006], x, nr1, nr2, nra; vector<int> G[100006]; vector<int> sters; int uz[100006], uz2[100006]; int main() { int i, j, k; cin >> n >> m >> nrh >> nrt; for (i = 1; i <= m; i++) { cin >> nod1 >> nod2; G[n... |
#include <bits/stdc++.h> using namespace std; priority_queue<pair<long long, pair<long long, long long>>> pq; int main() { std::ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); int T = 1; while (T--) { bool flag = true, cond = true; long long n, i, j, x, y, ind, k, m, mn = INT... |
// file: design_1_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 disclaime... |
/**
* 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 Control
#(
parameter DATA_WIDTH = 32,
parameter ID_WIDTH = 7,
parameter INSTRUCTION_WIDTH = 16,
parameter REGISTER_ID = 4,
parameter OFFSET_WIDTH = 12,
parameter CONDITION_WIDTH = 4
)(
input [INSTRUCTION_WIDTH - 1 : 0] Instruction,
input alu_negative, alu_carry, alu_overflow,
... |
`define ADDER_WIDTH 012
`define DUMMY_WIDTH 128
`define 2_LEVEL_ADDER
module adder_tree_top (
clk,
isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0, isum0_1_0_1, isum0_1_1_0, isum0_1_1_1,
sum,
);
input clk;
input [`ADDER_WIDTH+0-1:0] isum0_0_0_0, isum0_0_0_1, isum0_0_1_0, isum0_0_1_1, isum0_1_0_0,... |
// Copyright (c) 2000-2009 Bluespec, Inc.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, pub... |
#include <bits/stdc++.h> using namespace std; const long long int N = 200010; const long long int MOD = 998244353; long long int mod(long long int n) { return (n % MOD + MOD) % MOD; } void solve() { long long int n; cin >> n; long long int a[n]; long long int sum = 0; for (long long int i ... |
#include <bits/stdc++.h> using namespace std; void Ask(int x1, int y1, int x2, int y2, bool rot = false) { if (!rot) { cout << ? << x1 << << y1 << << x2 << << y2 << endl; } else { cout << ? << y1 << << x1 << << y2 << << x2 << endl; } } int Find(int n, bool r... |
module wasca (
altpll_0_areset_conduit_export,
altpll_0_locked_conduit_export,
altpll_0_phasedone_conduit_export,
clk_clk,
clock_116_mhz_clk,
external_sdram_controller_wire_addr,
external_sdram_controller_wire_ba,
external_sdram_controller_wire_cas_n,
external_sdram_controller_wire_cke,
external_sdram_contro... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2007 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
v95 v95 ();
v01 v01 ();
v05 v05 ();
s05 s05 ();
s09 s09 ();
s12 s12 ();
s17 ... |
module arithmetic(value1, value2, arith_control, shift_hex, value_out, flags, EN);
// It is assumed that the logic funcitonal block will be off when not in use
input [31:0] value1, value2;
input [2:0] arith_control;
// arith_control is same as from decode
/* arith_control:
* 3'b000: DEFUALT
* 3'b001:
* 3'b01... |
#include <bits/stdc++.h> using namespace std; bool b[33333]; vector<int> pri; vector<pair<int, int> > fac; int n; void init() { for (int i = 2; i < 33333; ++i) { if (!b[i]) { pri.push_back(i); for (int j = i + i; j < 33333; j += i) { b[j] = false; } } } ... |
#include <bits/stdc++.h> using namespace std; const int N = 3005; const int MOD = 998244353; int f[N][N]; char s[N], t[N]; int main() { scanf( %s %s , s + 1, t + 1); int n = strlen(s + 1), m = strlen(t + 1); for (int l = 1; l <= n; ++l) { for (int r = n; r >= l; --r) { int pos = r ... |
#include <bits/stdc++.h> #define ll long long #define f(n) for(ll i=0;i<n;i++) #define mod 998244353 #define vl vector<ll> #define pb push_back #define mk make_pair #define forn(i, n) for (int i = 0; i < int(n); i++) #define nl n #define IOS ios_base::sync_with_stdio(false); #include <iostrea... |
#include <bits/stdc++.h> using namespace std; vector<pair<long long, string> > v[10020]; int main() { long long n, m; pair<long long, string> p; long long temp; cin >> n >> m; for (int i = 0; i < n; i++) { cin >> p.second; cin >> temp; cin >> p.first; v[temp].push_back(... |
#include <bits/stdc++.h> using namespace std; template <typename A, typename B> string to_string(pair<A, B> p); string to_string(const string&); string to_string(const char* s); string to_string(bool b); template <typename A> string to_string(A v); template <typename A, typename B> string to_string(... |
#include <bits/stdc++.h> struct Solution { int n, k; std::vector<std::vector<int>> as; std::vector<int> pows; int64_t calcPair(int ind1, int ind2) { std::vector<int> left; left.reserve(as[ind1].size()); for (int v : as[ind1]) { left.push_back((int64_t(k - v) * pows[ind2 + 1])... |
#include <bits/stdc++.h> using namespace std; int main() { int t, n; cin >> t; while (t--) { cin >> n; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); int flag = 0; for (int i = 0; i < n - 1; i++) { if ((a[i + 1] - a[i]) > ... |
// Accellera Standard V2.3 Open Verification Library (OVL).
// Accellera Copyright (c) 2005-2008. All rights reserved.
`include "std_ovl_defines.h"
`module ovl_handshake (clock, reset, enable, req, ack, fire);
parameter severity_level = `OVL_SEVERITY_DEFAULT;
parameter min_ack_cycle = 0;
parameter max_ack_cyc... |
/*
Copyright (c) 2014-2018 Alex Forencich
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distri... |
`timescale 1 ns / 1 ps
module axis_lfsr #
(
parameter integer AXIS_TDATA_WIDTH = 64,
parameter HAS_TREADY = "FALSE"
)
(
// System signals
input wire aclk,
input wire aresetn,
// Master side
input wire m_axis_tready,
outpu... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); int n, t, m = 0; cin >> n; vector<int> s; for (int i = 0; i < n; i++) { cin >> t; s.push_back(t); } sort(s.begin(), s.end()); while (true) { t = -1; for (int i = 0; i ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; int ans = 0; cin >> n; string arr[11] = { ABSINTH , BEER , BRANDY , CHAMPAGNE , GIN , RUM , SAKE , TEQUILA , VODKA , WHISKEY , WINE }; for (int i = 0; i < n; i++) { string a; ci... |
// --------------------------------------------------------------------
// Seven Segment readout, 4 digits
// --------------------------------------------------------------------
module SEG7_OUT_4(
input [15:0] iDIG,
output [ 6:0] oSEG0,
output [ 6:0] oSEG1,
output [ 6:0] oSEG2,
output [ 6:0] oSEG3
);
SEG7_OUT1 ... |
/**
* 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; unsigned long long int n, m; int main() { cin >> n; m = (((n - 3) * 3) + ((n - 3) * (n - 4))) + 1; cout << m << endl; } |
#include <bits/stdc++.h> using namespace std; const int maxn = 2e5 + 10; const int inf = 0x3f3f3f3f; const double eps = 1e-8; map<int, int> ma; int n, x, num; int getId(int x) { if (ma.count(x) == 0) { ma[x] = num++; } return ma[x]; } int cnt[maxn]; vector<int> v; int main() { ... |
#include <bits/stdc++.h> #pragma comment(linker, /stack:200000000 ) #pragma GCC optimize( Ofast ) #pragma GCC optimize( unroll-loops ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; const long long inf = numeric_limits<long long>::max() / 2; const long ... |
#include <bits/stdc++.h> using namespace std; char s[300100]; int main() { int n, m; while (~scanf( %d %d n , &n, &m)) { gets(s); int len = strlen(s); int ans = 0; for (int i = 1; i < len; i++) { if (s[i] == . && s[i - 1] == . ) ans++; } char op[3]; int... |
#include <bits/stdc++.h> using namespace std; const unsigned long long O = 2e9; const double E = 1e-9; const double pi = 3.1415926536; int DX[] = {1, -1, 0, 0}; int DY[] = {0, 0, 1, -1}; int main() { int n, m; cin >> n >> m; int out = n * 2 + 1, in = 1; if (m > n * 2) { for (int i = ... |
#include <bits/stdc++.h> using namespace std; template <class X = int> inline X min(X a, X b, X c) { return min(min(a, b), c); } template <class X = int> inline X min(X a, X b, X c, X d) { return min(min(a, b, c), d); } template <class X = int> inline X max(X a, X b, X c) { return max(max(... |
/**
* 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 <iostream> #include <cmath> using namespace std; const int N=2e3+3; int a[N]; int b[N]; int main(){ int n; cin>>n; n<<=1; for(int i=1;i<=n;i++) cin>>a[i]; int ans=n; for(int C=0;C<=1;C++){ for(int j=1;j<=n;j++) b[j]=a[j]; int cnt=0; for(int i=0;... |
// Copyright (c) 2000-2011 Bluespec, Inc.
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2009 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc = 0;
reg [63:0] crc;
... |
#include <bits/stdc++.h> using namespace std; void solve() { long long int n; cin >> n; long long int a[n]; long long int q = 0, p = 0, z = 0; for (int i = 0; i < n; ++i) { cin >> a[i]; if (a[i] < 0) q++; else if (a[i] > 0) p++; else z++; } ... |
#include <bits/stdc++.h> using ul = std::uint32_t; using li = std::int32_t; using ull = std::uint64_t; using ll = std::int64_t; using llf = long double; ul n, m, k; const ul maxn = 2e5; const ul base = 998244353; ul plus(ul a, ul b) { return a + b < base ? a + b : a + b - base; } ul plus(ul a, ul b,... |
/*
* yosys -- Yosys Open SYnthesis Suite
*
* Copyright (C) 2012 Clifford Wolf <>
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* T... |
`timescale 1ns / 1ps
`default_nettype none
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 03:30:06 02/14/2016
// Design Name:
// Module Name: sync_generator_pal_ntsc
// Project Name:
// Target Devices:
// Tool versions:
// ... |
#include <bits/stdc++.h> using namespace std; int n, m, ans, sx, sy, ex, ey, endx = -1, endy = -1; char s[1005][1006]; pair<int, int> xx[1005]; pair<int, int> yy[1005]; bool able(int x, int y) { int nx = sx, ny = sy; while (true) { int nex = nx + x + 1, ney = ny + y + 1; if (nex > endx &... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.