text stringlengths 59 71.4k |
|---|
// megafunction wizard: %LPM_RAM_DQ%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: lpm_ram_dq1.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// =============================... |
/*
Modified from John Loomis, http://www.johnloomis.org/
-------------------------------------------------------------------
-- ASCII HEX TABLE
-- Hex Low Hex Digit
-- Value 0 1 2 3 4 5 6 7 8 9 A B C D E F
------\---------------------------------------------... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2012 by Wilson Snyder.
bit a_finished;
bit b_finished;
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
wire [31:0] o;
wire si = 1'b0;
ExampInst i
... |
#include <bits/stdc++.h> using namespace std; int n, q; int a[200010]; int last[200010]; int x = -1, y = -1, z = -1; stack<int> t; int main() { scanf( %d%d , &n, &q); for (int i = 0; i < n; i++) { scanf( %d , &a[i]); if (a[i] == 0) { z = i; if (i) a[i] = a[i - 1]; ... |
#include <bits/stdc++.h> using namespace std; const long long INF = 1 << 28; const long long LINF = 1ll << 61; string B, N; long long b, pw[10], C; int main() { ios::sync_with_stdio(false); cin >> B >> N >> C; int it = N.size(); for (int i = N.size() - 1; i >= 0; i--) { N[i]--; 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... |
/*
* 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; long long const lim = 1e5 + 5; long long const mod = 1000000007; vector<long long> adj[lim + 5]; long long vis[lim + 5], n; vector<long long> count_edge; long long child[lim + 5]; void all_clear() { count_edge.clear(); for (long long i = 1; i <= lim;... |
#include <bits/stdc++.h> using namespace std; struct par { int x, y, label; par(int _x, int _y, int _label) { x = _x; y = _y; label = _label; } par() {} }; bool operator<(par p1, par p2) { if (p1.x != p2.x) return p1.x < p2.x; return p1.y < p2.y; } int main() { ... |
#include <bits/stdc++.h> using namespace std; const int N = (int)1e5 + 5; long long ans[N]; struct person { int t, s, f, num; void read() { scanf( %d%d%d , &t, &s, &f); } bool operator<(const person &b) const { return t < b.t; } } a[N]; int n, m, X, D, sl, sr; long long T; multiset<pair<long... |
//-------------------------------------------------------------------
//
// COPYRIGHT (C) 2011, VIPcore Group, Fudan University
//
// THIS FILE MAY NOT BE MODIFIED OR REDISTRIBUTED WITHOU... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int t; cin >> t; while (t--) { string s; cin >> s; int zero = 0, one = 0; for (char i : s) if (i == 0 ) zero++; else one++; ... |
#include <bits/stdc++.h> using namespace std; const int INF = (int)2E9; const long long LINF = (long long)9E18; const long double PI = acos(-1.0); const long double EPS = 1E-11; template <typename T> inline T sqr(const T x) { return x * x; } template <typename T> T gcd(T a, T b) { return (b ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 12e4 + 5; struct node { int minn, cnt, lazy, time; long long sum; } tree[maxn << 2]; int n, q; int p[maxn], stk_min[maxn], stk_max[maxn], top_min, top_max; long long ans[maxn]; pair<pair<int, int>, int> querys[maxn]; inline void ad... |
#include <bits/stdc++.h> long long exp(long long x, long long p) { long long ret = 1; while (p > 0) { if (p & 1) { ret = (ret * x) % 1000000007; } p >>= 1; x = (x * x) % 1000000007; } return ret; } signed main() { std::ios::sync_with_stdio(false); std::cin.t... |
#include <bits/stdc++.h> using namespace std; long long n, by, ay; double mxy, l, r, m, D, x1[100005], x2[100005], x[100005], y[100005], mx1, mx2; bool b; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> x[i] >> y[i]; if (y[i] > 0) ay = 1; if (y[i] < 0) by = 1; y[i] ... |
#include <bits/stdc++.h> using namespace std; struct node { long long li, ri; } sum[400000]; long long pmx[400000], nmx[400000]; long long pmi[400000], nmi[400000]; int main() { long long n; memset(pmi, 0x7f7f7f7f, sizeof(pmi)); memset(nmi, 0x7f7f7f7f, sizeof(nmi)); memset(pmx, -0x7f7f7f... |
#include <bits/stdc++.h> using namespace std; inline void read(long long &x) { char ch; bool flag = false; for (ch = getchar(); !isdigit(ch); ch = getchar()) if (ch == - ) flag = true; for (x = 0; isdigit(ch); x = x * 10 + ch - 0 , ch = getchar()) ; x = flag ? -x : x; } inline ... |
#include <bits/stdc++.h> using namespace std; int main() { int a, b, n; cin >> a >> b; n = a + b + 1; for (int i = n - a; i <= n; i++) cout << i << ; for (int i = n - a - 1; i >= 1; i--) cout << i << ; } |
#include <bits/stdc++.h> using namespace std; int main() { int t; scanf( %d , &t); while (t--) { int n, m, arr[303][303]; scanf( %d %d , &n, &m); bool can = true; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { scanf( %d , &arr[i][j]); if (... |
///////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995/2004 Xilinx, Inc.
//
// 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
//
//... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000007; long long m(long long a, long long b) { return (a * b) % mod; } long long d(long long a, long long b) { return (a + b) % mod; } long long pow(long long a, int k) { long long ans = 1; while (k) { if (k & 1) { ... |
/* This module controls the reading and writing of frames to memory and implements a triple buffer system
*/
module tribuf_ctrl(
input fclk,
input rst_n,
//MMIO interface
input start,
input stop,
input [31:0] FRAME_BYTES,
input [31:0] TRIBUF_ADDR,
//Write interface (final renderer)
... |
#include <bits/stdc++.h> using namespace std; const int maxn = 9000020; const int K = 60; const int MOd = 1e9 + 7; int a, b; int nex[maxn][2]; int ar[3020], st[maxn]; int dn[maxn], N; int ans; int add(int a, int b) { a += b; a %= MOd; if (a < 0) return a + MOd; return a; } void d... |
#include <bits/stdc++.h> using namespace std; int val[60]; int n; int grid[2][60]; int mask1[25][1200008 + 1], mask2[25][1200008 + 1]; void solve(int l, int r, int mask[][1200008 + 1]) { memset(mask, -1, sizeof mask); for (int i = 0; i <= 24; i++) for (int j = 0; j < 1200008 + 1; j++) mask[i][... |
#include <bits/stdc++.h> using namespace std; int n, m, cnt, b[1000100], dfn[1000100], low[1000100], q[1000100], tot, top, sccflag[1000100], pre[1000100], nxt[1000100]; int cnt2, cnt3, cntc; int cntans, ans[1000100]; vector<int> p[1000100]; struct edge { int v; edge *next; } pool[2 * 1000100... |
/*
* 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 / 1ns
`define HALT 10'b00_0000_0000
`define EXEC 3'b100
module opc5tb();
reg [15:0] mem [ 65535:0 ];
reg clk, reset_b;
wire [15:0] addr;
wire rnw ;
wire ceb = 1'b0;
wire oeb = !rnw;
wire [15:0] data0 = mem[ addr ];
wire [15:0] data1 ;
// OPC CPU instantiation
opc5cpu dut0_u (.ad... |
`timescale 1ns/1ns
module commutator
(input c,
input [15:0] menc_raw,
input [15:0] stator_offset,
input [31:0] amps_float, // float32 magnitude to modulate
output [47:0] current_targets);
wire [10:0] elec_angle_a, elec_angle_b, elec_angle_c;
d1 #(11) elec_angle_a_r
(.c(c), .d(menc_raw[10:0] + stator... |
#include <bits/stdc++.h> using namespace std; void fail(string s) { cout << s; exit(0); } void fail(int s) { cout << s; exit(0); } int n; int x[5005], y[5005]; int d[5005]; vector<int> v[5005]; int len(int a, int b) { return abs(x[a] - x[b]) + abs(y[a] - y[b]); } int ok = 0; void... |
module altera_edge_detector #(
parameter PULSE_EXT = 0, // 0, 1 = edge detection generate single cycle pulse, >1 = pulse extended for specified clock cycle
parameter EDGE_TYPE = 0, // 0 = falling edge, 1 or else = rising edge
parameter IGNORE_RST_WHILE_BUSY = 0 // 0 = module internal reset will be default whenever ... |
`timescale 1ns / 1ps
// @module
// when timing clock match real clock, start these flow leds
// @input
// power: flow leds logical power
// sig_ring: signal for starting running flow leds
// sig_step: flow speed
// @output
// alarm_light: bind to FPGA board
module flow_led
#(parameter LEN = 5, NUM = 5)
(
input pow... |
#include <bits/stdc++.h> using namespace std; long long n, m, k, g[2010], a[100003], f[2010], ansn, sum1, sum2; bool make[200]; int main() { cin >> n >> m; bool see = false; for (int i = m; i > n; i--) { for (int j = 2; j <= min((long long)100000, n) and !see; j++) if (i % j == 0) { ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 1; const int size = 1 << 8, M = 1e6 + 10; int n, q, w[N], head[N], ne[N], cnt; void add(int f, int t) { w[++cnt] = t; ne[cnt] = head[f]; head[f] = cnt; } int fa[N], a[N], h[N]; void dfs(int x) { for (int i = head[x]; i; i ... |
#include <bits/stdc++.h> using namespace std; bool flag; int n, k, vis[10][105]; char s[10][105]; int judge(int x, int y) { if ((s[x][y] == . || s[x][y] == s ) && (x >= 1 && x <= 3)) return 1; else return 0; } void dfs(int x, int y) { vis[x][y] = 1; if (y >= n - 1) { f... |
#include <bits/stdc++.h> using namespace std; vector<int> mp[105]; int vis[105]; struct node { int fa; int kid; node(int fa, int b) { this->fa = fa; kid = b; } }; bool bfs(int rt, int n) { queue<node> q; q.push(node(-1, rt)); vis[rt] = 1; while (!q.empty()) { ... |
#include <bits/stdc++.h> using namespace std; const int N = 16505; const int inf = 1e9 + 7; char s[N]; int fa[N * 2], rk[N * 2]; bool c[N], p[N]; inline int C(char q) { if (q <= 9 ) return q - 0 ; else return q - A + 10; } int tot; inline int find(int x) { return x == fa[x] ?... |
#include <bits/stdc++.h> using namespace std; int main() { int a1, a2, a3, a4; scanf( %d %d %d %d , &a1, &a2, &a3, &a4); int n = min(min(a1, a4), a3); long long ans = 0; ans += n * 256; a1 -= n; a3 -= n; a4 -= n; int m = min(a1, a2); ans += m * 32; printf( %lld n , ans); ... |
#include <bits/stdc++.h> using namespace std; int n, x, y, z, q, sum; int main() { ios_base::sync_with_stdio(0); for (cin >> n; n; --n) cin >> x >> y >> z >> q, sum += (z - x + 1) * (q - y + 1); cout << sum << n ; return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { double a, b, c, d, k; cin >> a >> b >> c >> d >> k; if (ceil(a / c) + ceil(b / d) > k) { cout << -1 << endl; } else { cout << ceil(a / c) << << ceil(b / d) << endl; ... |
/* -------------------------------------------------------------------------------
* (C)2007 Robert Mullins
* Computer Architecture Group, Computer Laboratory
* University of Cambridge, UK.
* -------------------------------------------------------------------------------
*
* Physical-channel allocation arbiter
... |
#include <bits/stdc++.h> using namespace std; int c[26]; int main() { string s; cin >> s; if (s.length() < 26) { cout << -1; return 0; } int f = 0, h = 0; for (int i = 0; i < 25; i++) { if (s[i] != ? ) { h += (c[s[i] - A ] == 0); c[s[i] - A ]++; }... |
#include <bits/stdc++.h> using namespace std; int N; inline bool check(int x) { long long t = (long long)x * (long long)(x - 1) / 2; if (x & 1) t++; else t += x / 2; return t <= N; } int main() { int M; scanf( %d%d , &N, &M); vector<int> A; for (int i = 0; i < M; 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... |
/*
* Milkymist VJ 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 ... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9; int h, w; vector<vector<int> > f; const int dx[] = {1, 0, -1, 0}; const int dy[] = {0, 1, 0, -1}; bool check(int x, int y) { return 0 <= x && x < w && 0 <= y && y < h && f[y][x]; } vector<vector<int> > was; double sumx, sumy; i... |
#include <bits/stdc++.h> using namespace std; const int N = 21; string s; long long heavy = 0, sol = 0; int main() { cin >> s; for (int i = 0; i < s.size(); i++) { string temp = s.substr(i, 5); if (temp == heavy ) { heavy++; i += 4; } else if (temp == metal ) { ... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int MAXN = 10; const int LCM = 840; const int n = 8; long long w; long long cnt[MAXN], f[MAXN][MAXN * LCM]; int main() { scanf( %lld , &w); for (int i = 1; i <= n; i++) scanf( %lld , &cnt[i]); memset(f, -1, sizeo... |
#include <bits/stdc++.h> using namespace std; int main() { int n = 0; long long moves = 0; cin >> n; vector<long long> arr(n, 0); for (int i = 0; i < n; i++) cin >> arr[i]; long long last = arr[0]; long long min = INT_MAX; bool found = false; for (int i = 1; i < n; i++) { 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... |
// Module for testing the behavior of the scfifo.
module Test_FIFO(
input wire clock,
input wire reset_n,
output reg [31:0] debug_value0,
output reg [31:0] debug_value1,
output reg [31:0] debug_value2
);
reg [31:0] counter;
wire [31:0] step = counter - 32'd50_000_000;
// FIFO being te... |
#include <bits/stdc++.h> using namespace std; long long unorder(int n) { if (n == 0) return 1; if (n == 1) return 0; bool good; long long ans = 0; vector<int> V(n); for (int i = 0; i < n; i++) V[i] = i; do { good = true; for (int i = 0; i < n && good; i++) good = (V[i] != i);... |
#include <bits/stdc++.h> using namespace std; const long long MAX = 105; const long long MAXV = 2e5 + 1; const long long INF = 1e9; bool prime[MAXV]; void sieve() { memset(prime, true, sizeof(prime)); prime[0] = prime[1] = false; for (long long i = 2; i * i < MAXV; i++) { if (prime[i]) { ... |
#include <bits/stdc++.h> long long t[105], s[105]; long long a[105]; int getNumber(long long add) { if (add == 0) return 1; else { int res = -1; for (int i = 2; i <= 101; i++) { long long last = i * (i - 1) * (i - 2) / 6, next = i * (i - 1) * (i + 1) / 6; ... |
#include <bits/stdc++.h> using namespace std; inline int cmp(double x, double y = 0, double tol = 1e-9) { return (x <= y + tol) ? (x + tol < y) ? -1 : 0 : 1; } int main() { int n; double a, d, t0, vm, t_vm, def, last = 0; scanf( %d %lf %lf , &n, &a, &d); def = sqrt(2 * d / a); for (int i... |
#include <bits/stdc++.h> using namespace std; int a[300005]; int b[300005]; int flag; int main() { int n, m; cin >> n >> m; int i = 0, j = 0; for (i = 0; i < m; i++) { cin >> a[i]; cin >> b[i]; j++; } int hh = a[0], ff = b[0]; int cc, fff; int temp = 0; fo... |
module vga(/*AUTOARG*/
// Outputs
hsync, vsync, x, y, ve, newline, newfield,
// Inputs
clk_p, rst
);
input wire clk_p;
input wire rst;
output wire hsync, vsync;
output wire [9:0] x, y; //1023
output wire ve;
output wire newline, newfield;
assign newline = x_i == 0;
assign newfield = y_i == 0;
... |
#include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const double EPS = 1e-10; const int MOD = 1000000007; const int MAXN = 110000; const double PI = acos(-1.0); template <class T> T abs(T x) { return x < 0 ? -x : x; } int num, kase; int flag[22][MAXN]; long long fun() {... |
#include <bits/stdc++.h> using namespace std; int n, m, d; long long din[2][150003]; long long a[303]; long long mx[150003]; long long b[303]; long long t[303]; deque<long long> deq; int main() { cin >> n >> m >> d; t[0] = 0; for (int i = 0; i < m; i++) { cin >> a[i + 1] >> b[i + 1] ... |
`default_nettype none
`timescale 1ns / 1ps
module ram16b(
input [15:0] wdata,
input wen,
input [4:0] waddr,
input wclk,
output [15:0] rdata,
input [4:0] raddr,
input rclk
);
`ifdef synthesis
ram16b_ice40 ram(
.wdata(wdata),
.wen(wen),
.waddr(waddr),
.wclk(wclk),
.rdata(rdata),
.raddr(raddr),
.... |
module L1Cache_top
(
// System clock, reset and stall
input clk_i,
input rst_i,
// to Data Memory interface
input [256-1:0] mem_data_i,
input mem_ack_i,
output [256-1:0] mem_data_o,
output [32-1:0] mem_addr_o,
output mem_enable_o,
output mem_write_o,
// to CPU interface
input [32-1:0] p1... |
module alt_mem_ddrx_ecc_decoder #
( parameter
CFG_DATA_WIDTH = 40,
CFG_ECC_CODE_WIDTH = 8,
CFG_ECC_DEC_REG = 1,
CFG_ECC_RDATA_REG = 0,
CFG_MMR_DRAM_DATA_WIDTH = 7,
CFG_MMR_LOCAL_DATA_WIDTH = 7,
... |
`timescale 1ns / 1ps
module LCD_DISPLAY(LCD_ENABLE, LCD_RW, LCD_DI, LCD_CS1, LCD_CS2, LCD_RST, LCD_DATA, CLEAR, CALLFORPATTERN, PATTERN, reset, clk);
input clk;
input reset;
input [255:0] PATTERN;
output LCD_ENABLE;
output LCD_RW;
output LCD_DI;
output LCD_CS1;
output LCD_CS2;
output LCD_RST;
... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); int T; cin >> T; while (T--) { int n; int number[200005], dis[10] = {0}; char c; cin >> n; for (int a = 1; a <= n; a++) { cin >> c; number[a] = c - 0 ; dis[numbe... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2003-2007 by Wilson Snyder.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
/*verilator public_module*/
input clk;
// ... |
#include <bits/stdc++.h> using namespace std; const int inf = 0x7FFFFFFF; template <class T> T gcd(T a, T b) { return b == 0 ? a : gcd(b, a % b); } template <typename T> T lcm(T a, T b) { return a / gcd(a, b) * b; } template <class T> T big_mod(T n, T p, T m) { if (p == 0) return (T)1; ... |
#include <bits/stdc++.h> using namespace std; int a, b; bool bad(int x, int y) { return abs(x + y) % (2 * a) == 0 || abs(x - y) % (2 * b) == 0; } void reorder(int& x, int& y) { int xx = (x - y) / 2; int yy = (x + y) / 2; x = xx; y = yy; } void norm(int& x, int& y) { if ((x + y) % 2... |
#include <bits/stdc++.h> using namespace std; const int N = 200005; int t[N]; int p[N]; int p2[N]; int main() { std::ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; long long sum = 0; cin >> n; for (int i = 0; i <= n; i++) { cin >> t[i]; sum += t[i]; } ... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; if (n % 2 == 0) { cout << NO << n ; return 0; } int arr[200005] = {0}; deque<int> d; for (int i = 0; i < 2 * n; i++) d.push_back(i + 1); for (i... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); int n; scanf( %d , &n); vector<int> game(n + 1); game[0] = game[1] = game[2] = 0; vector<int> res(n + 1, -1); for (int i = 3; i <= n; i++) { int ok[300001]; memset(ok, 0, sizeof(0)); ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, x = 0, y = 0; cin >> n; int *C = new int[n]; for (int i = 0; i < n; i++) { cin >> C[i]; } for (int j = 0; j < n; j++) { if (j == 0) { y = abs(C[j] - C[j + 1]); x = abs(C[j] - C[n - 1]); } else... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const long long INF = 1e18; const double EPS = 1e-6; const int MAX_N = 500 + 5; int n; int arr[MAX_N]; int memo[MAX_N][MAX_N]; int memo2[MAX_N][MAX_N]; int dp(int l, int r) { if (l == r) return memo[l][r] = arr[l]; if (me... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 2e5 + 10; const int MOD = 998244353; int n, q; long long seg[4 * MAXN], mul[4 * MAXN], plu[4 * MAXN]; set<pair<int, int>> number[MAXN]; void shift(int l, int r, int id) { int mid = l + r >> 1; seg[id << 1] = (seg[id << 1] * mul[id]) % ... |
#include <bits/stdc++.h> using namespace std; const int inf = 1e9; int n; char s[20]; int ans[300100]; vector<int> dep[300100]; int G[300100][26], siz[300100], son[300100]; vector<int *> a; void dfs(int o, int depth) { dep[depth].push_back(o); siz[o] = 1; for (int i = 0; i < 26; ++i) { ... |
#include <bits/stdc++.h> using namespace std; const long double pi = acos(-1); const long long M = 1e9 + 7; const long long N = 5e5; const long long INF = 1e9 + 1; long long n, a[N], x[N], res, ans; int main() { cin >> n; for (int i = 1; i <= n; ++i) { cin >> a[i]; } for (int j = 1; ... |
#include <bits/stdc++.h> using namespace std; inline void read(int &x) { char c; int flag = 1; while ((c = getchar()) < 0 || c > 9 ) if (c == - ) flag *= -1; x = c - 0 ; while ((c = getchar()) >= 0 && c <= 9 ) x = x * 10 + c - 0 ; x *= flag; return; } inline void read(... |
#include <bits/stdc++.h> using namespace std; template <class T> void read(T &x) { x = 0; int f = 1; char ch = getchar(); while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = getchar(); } while (ch >= 0 && ch <= 9 ) x = (x << 3) + (x << 1) + ch - 0 , ch = getcha... |
/**
* 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; vector<int> v[3]; int main() { int n; cin >> n; string s1, s2; cin >> s1 >> s2; int ans1 = 0, ans2 = 0; for (int i = 0; i < s1.size(); i++) { if (s1[i] == a ) { ans1++; } if (s2[i] == a ) { ans1++; } ... |
/**
* 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
//---------------------------------------------------------------------//
// Name: compute_vex_tb.v
// Author: Chris Wynnyk
// Date: 2/3/2008
// Purpose: Test structure for the compute_vex.v module.
//---------------------------------------------------------------------//
module com... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
#include <bits/stdc++.h> using namespace std; struct st { deque<int> q; int cnt[100004]; int use[100004]; int u_s = 0; st() { memset(cnt, 0, sizeof(cnt)); memset(use, 0, sizeof(use)); q.clear(); } void push_back(int x) { q.push_back(x); if (use[x] != u_s) { ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ; int n; cin >> n; if (n == 1 || n == 4 || n == 6 || n == 8 || n == 9 || n == 10 || n == 13 || n == 15) cout << 1 << endl; else cout << 0 << endl; retur... |
// (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 ... |
/*
Copyright (c) 2015 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; const int N = 105; int zy[N][N * N / 2]; bool dp[N][N * N / 2]; deque<int> ans; void dfs(int n, int k) { if (n == 1) { ans.push_back(1); return; } else { if (zy[n][k] > 0) { dfs(n - zy[n][k] + 1, k - zy[n][k]); int sz = ... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 14:06:29 02/27/2016
// Design Name: Register
// Module Name: C:/Users/Ranolazine/Desktop/Lab/lab5/test_Reg_with_reset.v
// Project Name: lab5
// Target Dev... |
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 100010; const ll INF = 1e9 + 69; int n, a[N]; string good; bitset <N> mul; void fuck (int ss, int ee) { int st = ss, en = ee; while (st <= ee and a[st] == 1) ++st; while (en >= ss and a[en] == 1)... |
#include <bits/stdc++.h> using namespace std; int main(void) { int n; bool val = false; cin >> n; char array[n][5]; for (int i = 0; i < n; i++) { cin >> array[i]; } for (int i = 0; i < n; i++) { if (array[i][0] == O & array[i][1] == O ) { val = true; array[... |
// 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 (clk);
input clk;
tpub p1 (.clk(clk), .i(32'd1));
tpub p2 (.clk(clk), .i(32'd2));
i... |
#include <bits/stdc++.h> using namespace std; int n; int a[2513][2513]; bitset<2513> big[2513]; vector<int> comp; vector<pair<int, int> > need[2513 * 2513]; int main() { scanf( %d , &n); for (int i = 0; i < n; i++) for (int j = 0; j < n; j++) { scanf( %d , &a[i][j]); if (i ==... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); long long p, q, i, t, i1 = 0, i2 = 0, mx; char c; cin >> t; long long a[368], b[368]; for (i = 0; i < 368; i++) { a[i] = 0; b[i] = 0; } for (i = 0; i < t; i++) { cin >> c >>... |
#include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; long long answer = 0; for (int i = s.length() - 1; i > 0; i--) { string temp = s.substr(i - 1, 2); if (stoi(temp) % 4 == 0) { answer += i; } } for (int i = 0; i < s.length(); 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; int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); long long n, k; cin >> n >> k; vector<long long> v(n); for (long long &i : v) cin >> i; sort(v.begin(), v.end(), [](long long a, long long b) { return a > b; }); vector<long long>... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of inst_ac_e
//
// Generated
// by: wig
// on: Mon Jun 26 08:25:04 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../../generic.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
// $Aut... |
module top;
reg [8*80-1:0] str;
integer fd, pos, result;
initial begin
fd = $fopen("ivltests/pr1819452.txt","rb");
result = $fgets(str, fd);
while (!$feof(fd)) begin
pos = $ftell(fd);
$display("Found: %5s currently at byte %0d", str[8*10-1:8], pos);
result = $fgets(str, fd);
end... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.