text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int s0, t0, t1, n, m, Next[500000 + 5]; char s[500000 + 5], t[500000 + 5]; void GetNext() { Next[0] = -1; int j = 0, k = -1; while (j < m) { if (!~k || t[j] == t[k]) Next[++j] = ++k; else k = Next[k]; } } int main() { ... |
#include <cstdio> #include <iostream> #include <cstring> #include <queue> using namespace std; const int M = 2005; const int inf = 0x3f3f3f3f; #define int long long int read() { int x=0,f=1;char c; while((c=getchar())< 0 || c> 9 ) {if(c== - ) f=-1;} while(c>= 0 && c<= 9 ) {x=(x<<3)+(x<<1)+(... |
#include <bits/stdc++.h> using namespace std; char s[200005]; int alph[26]; int main() { scanf( %s , &s); for (int i = 0; s[i]; i++) alph[s[i] - a ]++; for (int i = 0; i < 26; i++) for (int j = 26 - 1; j > i; j--) if (alph[i] & 1) if (alph[j] & 1) alph[i]++, alph[j]--; i... |
#include <bits/stdc++.h> using namespace std; priority_queue<int> lott; int main() { long long int xm, find = 0; cin >> xm; lott.push(100); lott.push(20); lott.push(10); lott.push(5); lott.push(1); while (xm) { while (lott.top() <= xm) { find++; xm -= lott.top... |
// Copyright 1986-2016 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2016.4 (win64) Build Wed Dec 14 22:35:39 MST 2016
// Date : Tue Jun 06 01:40:38 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int x[n], y[n]; for (int i = 0; i < n; i++) cin >> x[i]; for (int i = 0; i < n; i++) cin >> y[i]; int de = 0, in = 0; for (int i = 0; i < n; i++) { if (x[i] > y[i]) de = de + x[i] - y[i]; if (y[i] > x... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2012 by Iztok Jeras.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
parameter SIZE = 8;
integer cnt = 0;
logic [SIZE-1:... |
#include <bits/stdc++.h> using namespace std; inline int ni() { int a; scanf( %d , &a); return a; } const int max_n = 5000; char s1[max_n + 1], s2[max_n + 1], res[max_n + 1]; int digits[26], minuses[26]; bool check(int from, int code, int n, int m) { bool ok = true, founded = false; di... |
// $Id: channel.v 1853 2010-03-24 03:06:21Z 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 source... |
#include <bits/stdc++.h> using namespace std; const int N = 300 * 1000 + 13; int n; long long a[N], b[N]; void solve() { scanf( %d , &n); for (int i = 0; i < int(n); ++i) scanf( %lld%lld , &a[i], &b[i]); long long ans = 0, mn = 1e18; for (int i = 0; i < int(n); ++i) { int ni = (i + 1) % ... |
module ula_testbench();
// faz o include dos parameters das instrucoes
`include "params_proc.v"
// contador de testes a serem feitos
integer testes;
// declaracao das input e output da ula
reg signed [OPCODE_WIDTH-1:0] opcode;
reg signed [DATA_WIDTH-1:0] data1, data2;
wire signed [DATA_WIDTH-1:0] out;
wire [4:0] rf... |
#include<bits/stdc++.h> using namespace std; typedef long long ll; const int MAXN=1e9+1; const ll mod=1e9+7; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n,m,k; cin>>n>>m>>k; int hori[n][m-1]; for(int i=0;i<n;i++){ for... |
#include <bits/stdc++.h> using namespace std; const int N = 100005; int n, l; int cnt[N]; long long sum[N]; int main() { cin >> n >> l; for (int i = 1; i < n; i++) { cin >> cnt[i]; sum[i] = sum[i - 1] + cnt[i]; } long long ans = 2e18; for (int i = l; i < n; i++) { ans =... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2012 by Wilson Snyder.
module t (/*AUTOARG*/
// Inputs
clk
);
input clk;
integer cyc=0;
reg [63:0] crc;
reg [63:0] sum;
// Take CRC data and apply to test... |
`timescale 1ns/1ns
module uart_tx#(
parameter integer WIDTH = 12
)
(
input PCLK,
input RESET,
input [7:0] DATA_TX_I,
input [11:0] WORK_FR,
input START,
output TX_O,
output reg READY_TX
);
localparam [11:0] TX_IDLE = 12'b0000_0000_0000,
TX_START = 12'b0000_0000_0001, ... |
/******************************************************************************
* License Agreement *
* *
* Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. *
... |
/**
* 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... |
`include "define.h"
//Feb.25.2005 Verilog2001 Style
//Jan.20.2005 implict event list
//Jun.14.2004 Initial Version
//Jul.4.2004 sensibity list bug fix
//Jul.5.2004 less area version
//Apr.14.2005 Stratix 2 workaround Quartus 4.1/4.2
module substruct (input [31:0] a,b,
output [31:0] c);
assign c=a+~b+1;//N... |
/**
* 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: Adam LLC
// Engineer: Adam Michael
//
// Create Date: 18:17:58 09/26/2015
// Design Name: Multiplication controller
// Module Name: Controller
////////////////////////////////////////////////... |
#include <bits/stdc++.h> using namespace std; const int mod = 998244353; const int INF = 1e9 + 7; const int N = 1010; const double pi = 3.1415926; int n; int t[110], d[110], p[110], pre[2010], now[2010], sum[2010], good[2010]; int dp[2010]; vector<int> v[2010]; struct node { int t; int d; ... |
#include <bits/stdc++.h> using namespace std; int n, mz; char tmp; bool t[51][51]; bool m[51][51]; int mel, skm; bool atr; bool state; void apstaig(int x, int y) { int i, j, z; for (i = x; i <= mz; i++) { if (t[i][y] == false) break; else { m[i][y] = !state; ... |
#include <bits/stdc++.h> using namespace std; int n, m, s, k, a[2010], b[2010], nxt[2010], sum[2010], dp[2010][2010]; inline int read() { int s = 0, w = 1; char c = getchar(); for (; !isdigit(c); c = getchar()) if (c == - ) w = -1; for (; isdigit(c); c = getchar()) s = (s << 1) + (s << 3) +... |
#include <bits/stdc++.h> using namespace std; void _dbg(string) { cout << endl; } template <class H, class... T> void _dbg(string s, H h, T... t) { int l = s.find( , ); cout << s.substr(0, l) << = << h << , ; _dbg(s.substr(l + 1), t...); } template <class T, class U> ostream &operator<<(... |
#include <bits/stdc++.h> using namespace std; struct ufds { int n; vector<int> p, s; ufds(int n = 0) : n(n), p(n), s(n, 1) { for (int i = 0; i < n; i++) p[i] = i; } int findSet(int i) { return p[i] == i ? i : (p[i] = findSet(p[i])); } bool inSameSet(int i, int j) { return findSet(i) ==... |
#include <bits/stdc++.h> using namespace std; char s[302][302]; int main() { ios_base::sync_with_stdio(0); cin.tie(nullptr); int n, p; cin >> n >> p; int a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } sort(a, a + n); vector<int> ans; for (int i = 1; i < 2003; i++)... |
#include <bits/stdc++.h> #include <vector> #include <set> #include <string> #include <map> #include <cmath> #include <algorithm> typedef long long int ll; #define f first #define s second #define vi vector<int> #define ld long double #define pb push_back #define mp make_pair #define pii pair... |
#include <bits/stdc++.h> using namespace std; vector<pair<int, int>> P; bool used[111]; int pos; bool ok(int T) { if (T == pos) return true; used[T] = true; for (int i = 0; i < P.size(); i++) { if (used[i] == false) { if (P[T].first > P[i].first && P[T].first < P[i].second || ... |
/**
* 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... |
// datamaster.v
`timescale 1ns / 100ps
`define ADDR_PTR 0
`define ADDR_LEN 1
`define ADDR_CTRL 2
`define ADDR_STAT 2
module datamaster
(
input clk,
input reset,
// control port (avalon slave)
input [3:0]ctrl_address,
input ctrl_write,
input [31:0]ctrl_writedata,
input ... |
#include <bits/stdc++.h> int main() { int n, y[27] = {}, i, c = 0; char x[100001]; scanf( %d %s , &n, x); for (i = 0; i < n; i++) if (!y[x[i] - 97]) { y[x[i] - 97]++; c++; } if (n <= 26) printf( %d , n - c); else printf( -1 ); } |
#include bits/stdc++.h using namespace std; using ll = long long; using pii = pair<int,int>; vector<tuple<int,int,int>> edges; void add(int x, int y, int z) { edges.push_back({x,y,z}); } int solve(int l, int r) { if (l > 1) { int k = solve(1,r-l+1); add(k,k+1,l-1); ... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; long long int i, j, a, b, ans; for (i = 1; i <= t; i++) { cin >> a >> b; ans = 0; while ((a + b + ans * (ans + 1) / 2) % 2 != 0 || (a + b + ans * (ans + 1) / 2) < 2 * max(a, b)) { ans++... |
// 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;
reg pose... |
/**
* 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, typename U> inline void smin(T &a, U b) { if (a > b) a = b; } template <typename T, typename U> inline void smax(T &a, U b) { if (a < b) a = b; } template <typename T> inline void gn(T &first) { char c, sg = 0; while (... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100010; int n, a[maxn], deep[maxn], head[maxn], to[maxn * 2], nextt[maxn * 2], tot = 1, ans[maxn], anss; void add(int x, int y) { to[tot] = y; nextt[tot] = head[x]; head[x] = tot++; } void dfs(int u, int fa) { deep[u] = dee... |
#include <bits/stdc++.h> using namespace std; int n, m, l, r, x, ans[300300], tree[4 * 300300]; void build(int node, int st, int en) { if (st == en) { tree[node] = 1; return; } build((node << 1), st, (st + en) / 2); build((node << 1) + 1, ((st + en) / 2) + 1, en); tree[node] = tree... |
#include <bits/stdc++.h> using namespace std; int32_t main() { long long t; cin >> t; while (t--) { long long n; cin >> n; long long a[n]; set<long long> s; for (long long i = 0; i < n; i++) { cin >> a[i]; s.insert(a[i]); } cout << s.size() << ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; long long sum1 = 0, sum2 = 0; long temp; for (int i = 0; i < n; i++) { cin >> temp; sum1 += temp; } for (int i = 0; i < n - 1; i++) { cin >> temp; sum2 += temp; } cout << sum1 - su... |
#include <bits/stdc++.h> using namespace std; const int M = 100010; long long MAX = 0; vector<int> maxs; vector<int> A[M]; map<pair<int, int>, int> mep; map<pair<int, int>, int> tmpmep; map<int, vector<pair<int, int> > > edges; int weight[M]; int parent[M]; int compsize[M]; int visited[M]; int... |
#include <bits/stdc++.h> using namespace std; int get() { int x = 0; char s = getchar(); while (s < 0 || s > 9 ) s = getchar(); while (s >= 0 && s <= 9 ) x = (x << 3) + (x << 1) + (s ^ 48), s = getchar(); return x; } int Min(const int x, const int y) { if (x < y) return x; ... |
//*****************************************************************************
// DISCLAIMER OF LIABILITY
//
// This file contains proprietary and confidential information of
// Xilinx, Inc. ("Xilinx"), that is distributed under a license
// from Xilinx, and may be used, copied and/or disclosed only
// pursuant to the... |
// (c) Copyright 1995-2016 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 ... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2014.4
// Copyright (C) 2014 Xilinx Inc. All rights reserved.
//
// ==============================================================
`timescale 1ns/1ps
... |
`timescale 1 ns / 1 ps
module user_io_axi_conv #
(
parameter UIO_PORTS_WIDTH = 128,
parameter RQ_AXI_FIFO_DEPTH = 64,
parameter RS_AXI_FIFO_DEPTH = 64
)(
input clk,
input clk_per,
input reset,
input reset_per,
// AXI Connections
output [7:0] o_s_axi_tx_tkeep,
output [63:... |
// megafunction wizard: %ROM: 2-PORT%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: jump_ram.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ===============... |
#include <bits/stdc++.h> using namespace std; long long mas[200100], k, s = 0, d; long long n, p = 1, del = 0, a, b, c; unsigned long long inf = (unsigned long long)1000000000 * 1000000000 * (long long)10; int main() { cin >> n >> k; for (int i = 1; i <= n; i++) scanf( %I64d , &mas[i]); for ... |
#include <bits/stdc++.h> using namespace std; struct Node { int x, y, t; Node(int x = -1, int y = -1, int t = 0) : x(x), y(y) {} }; Node a[1005]; string G[1005]; int row[1005], col[1005]; int main() { int n, m; cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> G[i]; G[i]... |
/*------------------------------------------------------------------------------
* This code was generated by Spiral Multiplier Block Generator, www.spiral.net
* Copyright (c) 2006, Carnegie Mellon University
* All rights reserved.
* The code is distributed under a BSD style license
* (see http://www.opensource.or... |
/**
* 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: 2016/06/11 16:03:48
// Design Name:
// Module Name: lab4_1
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revisi... |
/**
* 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 SoC
* Copyright (C) 2007, 2008, 2009, 2010, 2011 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 dis... |
/**
* 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 mod = 1e9 + 7; const int N = 2e5 + 555; int n, m, q, z; pair<long long, int> a[N]; int qt[N]; long long ql[N], qr[N]; long long ans[N]; vector<pair<int, int> > ed[N]; long long bl[N], br[N], arin[N]; int f[N * 20]; const int iu = 18; ... |
/**
* 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> inline T bigmod(T p, T e, T M) { long long int ret = 1; for (; e > 0; e >>= 1) { if (e & 1) ret = (ret * p) % M; p = (p * p) % M; } return (T)ret; } template <class T> inline T gcd(T a, T b) { if (b == 0) return... |
#include <bits/stdc++.h> using namespace std; const int INF = 1e9 + 10; int main() { ios_base ::sync_with_stdio(false), cout.tie(0), cin.tie(0); int n, cnt = 0; cin >> n; int sv = n; while (n--) { int x, y; cin >> x >> y; if (x < 0) ++cnt; } cout << (min(cnt, sv - cnt... |
// UC Berkeley CS251
// Spring 2018
// Arya Reais-Parsi ()
// Stage #3: Write-back unit.
`include "const.vh"
module WriteBackStage #(
)(
input clk, reset,
input wire [2:0] s3_rdata_sel,
input wire [1:0] byte_select,
input wire [`CPU_DATA_BITS-1:0] s3_rdata,
output reg [`CPU_DATA_BITS-1:0] s3_rdata_out
);... |
#include <bits/stdc++.h> using namespace std; vector<int> tree[300001]; int cento[300001]; int sub[300001]; int maxCh[300001]; int n, q; void dfs(int u, int p = -1) { sub[u] = 1; maxCh[u] = 0; for (int j = 0; j < tree[u].size(); ++j) { int v = tree[u][j]; if (v == p) continue; ... |
#include <bits/stdc++.h> using namespace std; int64_t n; vector<int64_t> adj[100001]; int64_t ss[100001]; void dfs(int64_t no, int64_t par = -1) { ss[no] = 1; for (auto j : adj[no]) { if (j == par) { continue; } dfs(j, no); ss[no] += ss[j]; } } vector<int64_t> o... |
// This slightly convoluted module used to cause an argument-size
// mismatch in the call to the function extend_data
module test (c);
parameter MAX_SIZE = 32;
input c;
reg [MAX_SIZE-1:0] d,
e,
f;
reg [7:0] g;
wire h;
always @(posedge h or negedge c)
if (~c)
f <= #2 {MAX_SIZE{1'b0}};
else
... |
/******************************************************************************
* License Agreement *
* *
* Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. *
... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of inst_t_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 !!!
// $Auth... |
module fifo_address_gray_pipelined (
input m_axis_aclk,
input m_axis_aresetn,
input m_axis_ready,
output reg m_axis_valid,
output [C_ADDRESS_WIDTH-1:0] m_axis_raddr_next,
input s_axis_aclk,
input s_axis_aresetn,
output reg s_axis_ready,
input s_axis_valid,
output reg s_axis_empty,
output [C_ADDRESS_WIDTH-1... |
// ==============================================================
// RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2017.1
// Copyright (C) 1986-2017 Xilinx, Inc. All Rights Reserved.
//
// ===========================================================
`timescale 1 ns / 1 ps
... |
/*
Legal Notice: (C)2009 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 assoc... |
// Copyright (C) 2013 Simon Que
//
// This file is part of DuinoCube.
//
// DuinoCube 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 ... |
#include <bits/stdc++.h> using namespace std; long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); } const int MAXN = 1000; int n; char s[MAXN + 1]; int solve() { int ret = n; for (int i = (0); i < (n); ++i) if (s[i] == 1 || s[n - i - 1] == 1 ) ret = max(ret, 2 * (n ... |
#include <bits/stdc++.h> using namespace std; long long n, m, x, y, a, l, w, z, ss, t, k, e, c, total, nnn, yes, mx = 531, mn = -1, r, xx, yy, last, cas; map<string, int> wow; int main() { string s; cin >> s; wow[s] = 1; x = 1; l = s.size(); for (int i = 0; i < l; i++) { char... |
#include <bits/stdc++.h> using namespace std; const int N = 1005; const int mod = 1e9 + 7; int n, m; int c[N][N], fac[N], f[N][N][2][2], dp[N], g[N]; void Init() { scanf( %d%d , &n, &m); c[0][0] = 1; for (int i = 1; i <= n; i++) { c[i][0] = 1; for (int j = 1; j <= i; j++) { c... |
#include <bits/stdc++.h> using namespace std; struct p { int L, R, U, D; } point[5005], pos[5005]; string g[5005]; void DEL(int x) { pos[pos[x].D].U = pos[x].U; pos[pos[x].U].D = pos[x].D; pos[pos[x].R].L = pos[x].L; pos[pos[x].L].R = pos[x].R; } int main() { int m, n, i, j, l, sx,... |
/*
* Copyright (c) 2000 Yasuhisa Kato <>
*
* 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> template <class T> void rd(T &x) { x = 0; int f = 1; char c; while (!isdigit(c = getchar())) if (c == - ) f = -1; do { x = (x << 3) + (x << 1) + (c ^ 48); } while (isdigit(c = getchar())); x *= f; } using namespace std; const int N = 1e5 + 5; ... |
#include <bits/stdc++.h> using namespace std; bool p[10000001]; long h[10000001]; struct S { long a, c; } s[1000000]; int n; int k; long a[1000001]; int binl(int x) { if (x == 2) return 0; if (x > s[k - 1].a) return -1; int mid = (0 + k - 1) / 2; int l = 0, r = k - 1; while (l ... |
#include <bits/stdc++.h> using namespace std; int main() { string second; cin >> second; map<string, string> mp1; for (int i = 0; i < 10; i++) { string s1; cin >> s1; mp1[s1] = to_string(i); } string p = ; string ans = ; for (int i = 0; i < second.length(); i++)... |
#include <bits/stdc++.h> using namespace std; const long double eps = 1e-13; int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, m; cin >> n >> m; int k = n / m; vector<int> v(n); vector<vector<int>> d(m); for (int i = 0; i < (int)(n); ++i) { ci... |
#include <bits/stdc++.h> using namespace std; const int mod = 99999997; const int mmax = 200010; const double eps = 1e-8; const double pi = acos(-1.0); const int inf = 0x3fffffff; int a[200010], b[200010]; int main() { int n, m, sa, sb; int cnt1, cnt2, df; while (cin >> n) { for (int i... |
#include <bits/stdc++.h> using namespace std; void run(); int main() { ios::sync_with_stdio(0); cout.precision(10); run(); } struct vec2 { int x, y, sum; vec2 *c, *rgb; inline bool operator<(vec2 const &a) const { return x < a.x or x == a.x and y < a.y; } }; int yc[100000... |
/**
* 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) 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)
// ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; const int MAXN = 100010; int N; int A[MAXN]; int main() { ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0); cin >> N; for (int i = 0; i < N; i++) { cin >> A[i]; } ll ans = 0; for (int i = 0; i < N; i++) { ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 21; int cnt, u; int sz[1 << MAXN], g[1 << MAXN], p[1 << MAXN]; long long int f[1 << MAXN], h[1 << MAXN]; inline long long int read() { register long long int num = 0, neg = 1; register char ch = getchar(); while (!isdigit(ch) && ch !... |
#include <bits/stdc++.h> using namespace std; const int mx = 1e3 + 100, M = 1e9 + 7; long long int n, m, d[mx][mx]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; d[0][0] = 1; for (int i = 1; i < mx; i++) { d[i][0] = 1; for (int j = 1; j < i + 1... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n = 0; cin >> n; string s; cin >> s; int pos = 0; vector<int> v(n); int flag = 1; for (int i = 0; i < n; i++) { cin >> v[i]; } for... |
/**
* 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() { int n; cin >> n; int arr[n]; for (int i = 1; i <= n; i++) cin >> arr[i]; int ans = 0, ct0 = 0, ct1; for (int i = 1; i <= n; i++) { if (arr[i] == 1) { ct1 = 0; for (int j = i; j <= n; j++) { if (arr[j] ... |
`include "defines.v"
`timescale 1ns/1ps
module openmips_min_sopc_tb();
reg CLOCK_50;
reg rst;
integer file_output;
initial begin
file_output = $fopen("D:/Computer Architecture/My-CPU/TestResult/beq.txt");
CLOCK_50 = 1'b0;
forever #10 CLOCK_50 = ~CLOCK_50;
end
initial beg... |
module antiDroopIIR_16 (
input clk,
input trig,
input signed [15:0] din,
input signed [6:0] tapWeight,
input accClr_en,
//input oflowClr,
(* shreg_extract = "no" *) output reg oflowDetect = 1'd0,
output reg signed [15:0] dout = 16'sd0);
parameter IIR_scale = 15; // define the scaling factor for the IIR multipl... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e6 + 10; long long int inf = -1e15; long long int seg[maxn << 2], lazy[maxn << 2]; int n, m, p; vector<long long int> espadas, armaduras; vector<pair<int, int> > monstros[maxn]; void update(int x, long long int val) { seg[x] += val; ... |
#include <bits/stdc++.h> using namespace std; const int inf = 0x3f3f3f3f; const double eps = 1e-6; int modpow(int x, int y, int md) { if (y == 0) return 1; int ret = modpow(x, y >> 1, md); ret = (long long)ret * ret % md; if (y & 1) ret = (long long)ret * x % md; return ret; } int n, q, ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; struct Node { int a, px, ori, c; } node[N]; int n, l, r; bool cmp_px(Node &a, Node &b) { return a.px < b.px; } bool cmp_ori(Node &a, Node &b) { return a.ori < b.ori; } int main() { cin >> n >> l >> r; int t; for (int i ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 1e5 + 7; int a[MAXN], n, p, lim = 0; bool check(int val) { for (int i = 1; i <= n; ++i) if (val + i - 1 < a[i]) return 0; return 1; } bool valid(int val) { int sta = 0; for (int i = 0; i < n; ++i) { while (sta + 1 <= ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, lam, mx = 0, c = 0; cin >> n; vector<int> cand(n); for (int i = 0; i < n; i++) { cin >> cand[i]; if (mx < cand[i]) mx = cand[i]; } for (int i = 0; i < n; i++) if (mx == cand[i]) c++; int x = lam = cand[0]... |
#include <bits/stdc++.h> using namespace std; struct point { double x, y; point operator-(point A) { return (point){x - A.x, y - A.y}; } double operator*(point A) { return x * A.y - y * A.x; } double dis() { return sqrt(x * x + y * y); } } a[1005][1005], t[1005], E[1005]; int n, vis[1005][1005];... |
/**
* 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; set<pair<int, pair<int, int> > > l, u; set<pair<int, pair<int, int> > >::iterator itu, itl; const int INF = 1000 * 1000 * 1000LL + 10; int main() { int n, q, a, b, ll, lm, lt, uu, um, ut; char c; long long ans; cin >> n >> q; for (int i = 0; i ... |
#include <bits/stdc++.h> using namespace std; void err(istream_iterator<string> it) {} template <typename T, typename... Args> void err(istream_iterator<string> it, T a, Args... args) { cout << *it << = << a << n ; err(++it, args...); } const int MOD = 1e9 + 7, N = 2e5 + 5, B = 32; vector<in... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.