text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; const double eps = 1e-8; const double pi = acos(-1.0); const int INF = 0x3f3f3f3f; const long long inf = (((long long)1) << 61) + 5; const int N = 100005; int f[N]; int g[N]; int a[N]; int bit[N]; int ans[N]; int sum1(int x) { int ans = 0; fo... |
#include <bits/stdc++.h> using namespace std; int main() { int a[105], ma = 0, mi = 110, maxi, mini, tc; cin >> tc; for (int i = 0; i < tc; i++) { cin >> a[i]; if (a[i] > ma) { ma = a[i]; maxi = i; } if (a[i] <= mi) { mi = a[i]; mini = i; } ... |
#include <bits/stdc++.h> int pprime[1010] = {0}; int prime[1010]; int total; void Getprime() { int i, j; for (i = 2; i * i <= 1010; i++) { if (!pprime[i]) { for (j = i; j * i <= 1010; j++) pprime[j * i] = 1; } } total = 0; for (i = 2; i <= 1010; i++) if (!pprime[i])... |
#include <bits/stdc++.h> using namespace std; int main() { long long a, b; cin >> a >> b; long long ships = 0; while (a != 0 && b != 0) { if (b > a) { ships += b / a; b = b % a; } else { ships += a / b; a = a % b; } } cout << ships << endl; ... |
/*
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law... |
`timescale 1ns/1ps
`define prop_delay (0.1)
module AND2 (o, a, b);
output o;
input a, b;
and #(`prop_delay,`prop_delay) (o, a, b);
endmodule
module AND3 (o, a, b, c);
output o;
input a, b, c;
and #(`prop_delay,`prop_delay) (o, a, b, c);
endmodule
module NAND2 (o, a, b);
output o;
inp... |
#include <bits/stdc++.h> using namespace std; int n, a, b, ans; int main() { scanf( %d %d %d , &n, &a, &b); if (b < 0) { for (int i = b; i < 0; i++) { a--; if (a == 0) { a = n; } } ans = a; } else { for (int i = 0; i < b; i++) { a++; ... |
//-----------------------------------------------------------------------------
// Pretend to be an ISO 14443 tag. We will do this by alternately short-
// circuiting and open-circuiting the antenna coil, with the tri-state
// pins.
//
// We communicate over the SSP, as a bitstream (i.e., might as well be
// unframed,... |
#include <bits/stdc++.h> using namespace std; int main() { std::ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); long long f = 0, j, q = 1, i, n; while (q--) { long long y, k = 1, x, M, s; cin >> n >> M >> s >> f; unordered_map<int, pair<int, int> > m; for (i = ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2003-2007 by Wilson Snyder.
`define zednkw 200
module BreadAddrDP (zfghtn, cjtmau, vipmpg, knquim, kqxkkr);
input zfghtn;
input [4:0] cjtmau;
input vipmpg;
input [7:0] knquim;
input... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, m; cin >> n >> m; long long int x[n][m], y[n][m], a[n][m], b[n], c[m], i, j, ans = 0, ans1 = 0, d[n], e[m]; for (i = 0; i < n; i++) { long long int min = 9... |
#include <bits/stdc++.h> using namespace std; inline int Rint() { int x; scanf( %d , &x); return x; } const int MOD = 1e9 + 7; const int MAXN = 1e5 + 10; int alll(char* str_a, char* str_b, int n) { int ret = 1; for (int i = 0; i < n; ++i) { if (str_a[i] == ? ) ret = ret * 10ll % M... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; int t; cin >> t; while (t--) { long long n, k; cin >> n >> k; long long a[n]; for (int i = 0; i < n; i++) { cin >> a[i]; } if (k... |
/**
* 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 = 1000000007; const long long INF64 = 2000000000000000007; const int eps = 10e-6; long long solve(vector<int> one, vector<int> two, vector<int> three) { long long min_w = INF64; for (auto x : one) { long long b = x; auto a = lower... |
#include <bits/stdc++.h> using namespace std; char buf[1 << 21], *p1 = buf, *p2 = buf; template <class T> void read(T &x) { x = 0; int c = getchar(); int flag = 0; while (c < 0 || c > 9 ) flag |= (c == - ), c = getchar(); while (c >= 0 && c <= 9 ) x = (x << 3) + (x << 1) + (c ^ ... |
`timescale 1ns/1ps
`default_nettype none
`ifndef VCDFILE
`define VCDFILE "testbench_error_output_logic_tb.vcd"
`endif
module test;
`include "../../../../library/tbassert.v"
localparam ADDR_WIDTH = 10;
localparam DATA_WIDTH = 1;
reg [0:0] rst = 1'b0;
reg [0:0] clk = 1'b0;
reg [0:0] loop_complete = 1'b0;
reg [0:0] ... |
/*******************************************************************************
* 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 ... |
/**
* 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, k; cin >> n >> k; for (int i = 0; i < n; ++i) { for (int x = 0; x < n; ++x) if (i == x) cout << k << ; else cout << 0 << ; cout << endl; } } |
/*
This file is part of avgai.
avgai 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, or
(at your option) any later version.
avgai is distributed in the hope that it... |
// (C) 1992-2014 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 simulati... |
/**
* 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; double EPS = 1e-9; int INF = 1 << 30; long long INFL = 1LL << 60; int main() { int n; cin >> n; string w; cin >> w; int ile = 0; for (int i = 1; i < n; i += 2) { if (w[i] == a && w[i - 1] == a ) { w[i] = b ; ile++;... |
#include <bits/stdc++.h> using namespace std; inline int read() { int f = 0, num; char ch; while (ch = getchar(), !isdigit(ch)) if (ch == - ) f = 1; num = ch - 0 ; while (ch = getchar(), isdigit(ch)) num = num * 10 + ch - 0 ; return f ? -num : num; } const int N = 103; char s[... |
#include <bits/stdc++.h> using namespace std; int main() { int i, j, k, n, m; while (cin >> n >> k) { if (n * (n - 1) / 2 <= k) { puts( no solution ); } else { for (i = 0; i < n; i++) printf( 0 %d n , i); } } return 0; } |
// BF2HW
// Copyright (C) 2017 Christian Fibich
//
// 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, or
// (at your option) any later version.
//
// Toplevel ... |
#include <bits/stdc++.h> using namespace std; int ed; int l[360360 + 1], qd[8405400 + 1], qn[8405400 + 1]; int q[360360 + 1]; void bd(int first, int second) { qd[++ed] = second; qn[ed] = l[first]; l[first] = ed; } inline void bfs(int st, long long v[]) { for (int i = (0); i < (360360 + 1);... |
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); int pal(string s) { int i = 0, j = s.length() - 1; while (i < j) { if (s[i] != s[j]) return 0; i++; j--; } return 1; } int main() { ios_base::sync_with_stdio(false); string str, tp, s; cin... |
#include <bits/stdc++.h> using namespace std; const int maxn = 5e5 + 5; int c[maxn]; int p[64], q[64]; int l[maxn]; int ans[maxn]; vector<int> g[maxn]; int main() { ios_base::sync_with_stdio(0); int n; cin >> n; for (int i = 1; i <= n; i++) cin >> c[i]; int Q; cin >> Q; for (... |
#include <bits/stdc++.h> using namespace std; struct pi { int x, y, t; double p; } pp[1005]; double dp[1005]; int cmp(pi a, pi b) { return a.t < b.t; } double get(int a, int b) { return sqrt(pow(pp[a].x - pp[b].x, 2.0) + pow(pp[a].y - pp[b].y, 2.0)); } int main() { int i, j, n; cin >... |
#include <bits/stdc++.h> using namespace std; const int t = 1111; bitset<t> a[t], q[t]; int x[t], y[t]; char s[t]; void cl(int l, int r, int u, int d) { int i; for (i = l; i <= r; i++) q[i][u] = q[i][d] = 1; for (i = u; i <= d; i++) q[l][i] = q[r][i] = 1; } int main() { int n, m, i, j, c... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; void solve() { int n, k; cin >> n >> k; vector<int> a(n * k); for (auto &it : a) cin >> it; reverse(a.begin(), a.end()); long long ans = 0; int mid = n / 2, cnt = 0; for (int i = mid; i < (int)a.size() && cnt++ ... |
#include <bits/stdc++.h> using namespace std; template <class T> inline void read(T &x) { x = 0; char c = getchar(); while (!isdigit(c)) c = getchar(); while (isdigit(c)) x = x * 10 + (c & 15), c = getchar(); } const int P = 998244353; int n, m; char c[500001]; struct matrix { int n,... |
// -------------------------------------------------------------
//
// File Name: hdl_prj\hdlsrc\controllerPeripheralHdlAdi\controllerHdl\controllerHdl_Encoder_To_Position_And_Velocity.v
// Created: 2014-09-08 14:12:04
//
// Generated by MATLAB 8.2 and HDL Coder 3.3
//
// --------------------------------------------... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5; int p[N + 10], a[N + 10], pos[N + 10]; struct seg { int l, r, min; } t[N * 4 + 10]; int nxt[N + 10][20]; int get(int x, int n) { int ans = x, cnt = 0; while (n) { if (n & 1) ans = nxt[ans][cnt]; if (ans >= 0x7f7f7f7f)... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 100010; bool operator<(pair<int, int> lhs, pair<int, int> rhs) { return (lhs.first != rhs.first) ? (lhs.first < rhs.first) : (lhs.second < rhs.second); } set<pair<int, int> > inqUp, inqDown, pendUp, pendDown... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:256000000 ) using namespace std; const int INF = (int)1e9 + 7; const long long LINF = (long long)9e18 + 7; const long long P1 = 353251; const long long P2 = 239017; const long long MOD = 1e9 + 7; const long long MOD1 = 1e9 + 7; const long long M... |
/**
* 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 2011 Ettus Research LLC
//
// 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, or
// (at your option) any later version.
//
// This program is dis... |
#include <bits/stdc++.h> using namespace std; int n, c, d; const int maxn = 3456789; const long double PI = acos((long double)(-1.0)); const long double eps = 1e-18; long double ang[maxn]; int main() { while (cin >> n >> c >> d) { for (int i = 0; i < (n); i++) { int r, w; scanf( ... |
`begin_keywords "1364-2005"
`timescale 1ns / 1ns
module gentest;
reg [7:0] a=0, b=0;
wire co;
wire [7:0] result;
adder work(a, b, 1'b0, result, co);
integer cc;
initial begin
for (cc=0; cc<10; cc=cc+1) begin
a=a+1;
#10;
$display("%d %d %d", a, b, result);
b=result;
end
if (b==55) $display("PASSED");
els... |
#include <bits/stdc++.h> using namespace std; const int N = 5e5 + 50, inf = 1e9; int n, m, be[N], f[N], cnt, sub[N], SUB[N], vfa[N], q[N * 2], l, r; bool vis[N], tp[N]; vector<int> e[N], v[N], vv; void cmax(int &x, int y) { y > x ? x = y : 0; } void dfs1(int x) { vis[x] = 1; if (f[x]) e[x].erase(f... |
// file: SystemClockUnit_tb.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 ... |
module step_ex_st(clk, rst_, ena_, rdy_,
mem_we_, abus, dbus,
r0_dout, r1_dout);
input clk;
input rst_;
input ena_;
output rdy_;
output mem_we_;
output[7:0] abus;
output[7:0] dbus;
input[7:0] r0_dout, r1_dout;
reg rdy_en;
assign rdy_ = rdy_en ? 1'b0 : 1'bZ;
reg mem_w... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; long long n, i; long long a[102]; long long dp[102][102][2]; signed main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); long long t; cin >> t; while (t--) { cin >> n; string s[2]; ci... |
#include <bits/stdc++.h> using namespace std; template <typename T> inline T fetch() { T ret; cin >> ret; return ret; } template <typename T> inline vector<T> fetch_vec(long long sz) { vector<T> ret(sz); for (auto& it : ret) cin >> it; return ret; } template <typename T> inline... |
module cross_bar_tb;
reg rst, clk;
reg [0:7] wr_en;
reg [63:0] d;
wire [0:7] full;
wire [0:7] valid;
wire [63:0] q;
reg [0:7] stall;
wire [0:7] almost_full;
cross_bar #(8, 8)dut(rst, clk, wr_en, d, full, valid, q, stall, almost_full);
wire [7:0] internal_q [0:7];
initial be... |
// Computer_System_VGA_Subsystem_VGA_PLL.v
// This file was auto-generated from altera_up_avalon_video_pll_hw.tcl. If you edit it your changes
// will probably be lost.
//
// Generated using ACDS version 16.1 196
`timescale 1 ps / 1 ps
module Computer_System_VGA_Subsystem_VGA_PLL (
input wire ref_clk_clk, ... |
//wishbone_interconnect.v
/*
Distributed under the MIT licesnse.
Copyright (c) 2011 Dave McCoy ()
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 ... |
module InBuff #(parameter WIDTH = 16)(
input clk,
input [WIDTH-1:0] in,
output reg [WIDTH-1:0] out,
input read,
input clkdiv,
output reg outclk,
output toread);
reg [WIDTH-1:0] inbuf [20:0];
reg [6:0] i;
reg [15:0] counter = 0;
reg oldread = 0;
reg [6:0] bufpointer = 0;
assign toread = (bufpointer ... |
// Copyright (c) 2000-2012 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 int maxn = 1e5 + 777; vector<int> G[maxn]; map<int, int> savesiz[maxn]; int siz[maxn]; vector<int> ans; int n; void dfs(int s, int fa) { siz[s] = 1; int cnt = 0; for (int d : G[s]) { if (d == fa) continue; dfs(d, s); saves... |
#include <bits/stdc++.h> using namespace std; inline long long max2(long long a, long long int b) { return (a) > (b) ? (a) : (b); } inline long long max3(long long a, long long b, long long c) { return (a) > (b) ? ((a) > (c) ? (a) : (c)) : ((b) > (c) ? (b) : (c)); } inline long long min2(long long a... |
#include <bits/stdc++.h> using namespace std; int main() { int T, cas = 0; scanf( %d , &T); while (cas++ < T) { int sum = 0, s[251], maxi = 0; for (int i = 1; i <= 250; i++) { scanf( %d , s + i); sum += s[i]; maxi = max(s[i], maxi); } double aver = sum / 2... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, piles[100000], q; cin >> n; cin >> q; piles[0] = q; for (int i = int(1); i < int(n); i++) { cin >> q; piles[i] = piles[i - 1] + q; } cin >> m; for (int i = int(0); i < int(m); i++) { cin >> q; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, k; cin >> n >> k; if (n % k == 0) cout << n + k << endl; else cout << n + (k - n % k); return 0; } |
#include <bits/stdc++.h> using namespace std; signed main() { long long n; cin >> n; long long p[n + 1]; p[1] = -1; for (long long i = 2; i <= n; i++) cin >> p[i]; vector<long long> ans; long long x = n; while (p[x] != -1) { ans.push_back(p[x]); x = p[x]; } revers... |
/*
* 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... |
/*
* 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... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, m, i, j, k, l, t; cin >> t; while (t--) { cin >> n; vector<int> a(n); for (i = 0; i < n; i++) { cin >> a[i]; } k = 1; long long total = 0; for (i = 0; i < n; i++) { if (k % 2... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m, i, l[3], k[3], z = 0, j; cin >> n >> m; char a[n][m]; for (i = 0; i < n; i++) { for (j = 0; j < m; j++) { cin >> a[i][j]; if (a[i][j] == * ) { k[z] = i + 1; l[z] = j + 1; z++; ... |
#include <bits/stdc++.h> using namespace std; int main() { int n, h, a, ans = 0; cin >> n >> h; for (int i = 0; i < n; i++) { cin >> a; int add = 1; if (a > h) add++; ans += add; } cout << ans; return 0; } |
#include <bits/stdc++.h> using namespace std; const long long MOD = 998244353; long long mul(long long a, long long b) { return (a * b) % MOD; } long long bin_pow(long long a, long long p) { if (p == 0) return 1; long long ans = bin_pow(mul(a, a), p / 2); if (p % 2) ans = mul(ans, a); return ans... |
/*******************************************************************************
* 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 ... |
/*
* 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... |
/*
* 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 double mm = 0; int xs[4]; int ys[4]; int mxs[4]; int mys[4]; int used[1001][1001]; long double di(int x1, int y1, int x2, int y2) { return sqrt(abs((long double)x1 - (long double)x2) * abs((long double)x1 - (long double)x2) + ... |
#include <bits/stdc++.h> using namespace std; template <class c> struct rge { c b, e; }; template <class c> rge<c> range(c i, c j) { return rge<c>{i, j}; } template <class c> auto dud(c* x) -> decltype(cerr << *x, 0); template <class c> char dud(...); struct debug { template <class c... |
#include <bits/stdc++.h> using namespace std; const int mxn = 1e6 + 3; struct node { int v, i, j, id; } a[mxn]; int n, m, r[mxn], c[mxn], f[mxn], v[mxn], o[mxn]; int cmp(node a, node b) { return a.v < b.v; } int fffa(int x) { return f[x] == x ? x : f[x] = fffa(f[x]); } int main() { scanf( %d%d ,... |
//======================================================================
//
// fpga_entropy.v
// --------------
// Top level wrapper for the fpga entropy generator core.
//
//
// Author: Joachim Strombergson
// Copyright (c) 2014, Secworks Sweden AB
//
// Redistribution and use in source and binary forms, with or
// ... |
#include <bits/stdc++.h> using namespace std; const int N = 3 * 1e5 + 5; int main() { int t; cin >> t; double a[1005], b[1005]; for (int i = 1; i <= t; ++i) { int d; cin >> d; if (d < 4 && d > 0) { a[i] = -1; b[i] = -1; continue; } double discr... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); ; int n, i, j, k, c, v, l = 1, r = 1, maxm = 0, minm; cin >> n; int A[n]; string s; cin >> s; for (i = 0; i < n; i++) A[i] = 0; for (i = 0; i < n; i++) { for (j =... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; int sum = accumulate(a.begin(), a.end(), 0); vector<vector<int>> dp(n + 1, vector<int>(2, -1)); function... |
#include <bits/stdc++.h> using namespace std; const long long MAXN = 4e5 + 47, mod = 1e9 + 7, inf = 1e9 + 7; long long n, m; vector<long long> val; void read() { cin >> n; val.resize(n); for (long long i = 0; i < n; ++i) cin >> val[i]; } vector<long long> fenw(MAXN, 0); void update(long long... |
// An asynchronous generic memory wrapper around a synchronous memory
module async_mem (/*AUTOARG*/
// Outputs
ack, dout,
// Inputs
req, addr, din, we
);
parameter ACCESS_TIME = 10;
parameter SIZE = 1024;
parameter ADDR_WIDTH = 12;
parameter filename = "code.hex";
localparam COL_WIDTH ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; const int mx = (1 << 30) - 1; int n, m; struct node { vector<pair<int, int> > p; void cal(int a, int b) { int res = a ^ b; for (int i = 0; i < 30; i++) { int t = res ^ (1 << i) ^ (res & ((1 << i) - 1)); if... |
#include <bits/stdc++.h> using namespace std; vector<int> lefts[2000000], rights[2000000]; vector<pair<pair<int, int>, bool>> lws; int maxleft[2000000]; int maxright[2000000]; int minright[2000000]; vector<int> ans; bool fail = false; int n; int dfs(int v, int needed) { int cur = v; if (maxl... |
#include <bits/stdc++.h> using namespace std; const int MOD = 1e9 + 7; const int SIZE = 1e6 + 10; using namespace std; struct E { int k, c; E() {} E(int _k, int _c) : k(_k), c(_c) {} } es[4200010]; struct Flow { int n, m, dis[500010]; int qq[500010], qr, ql; vector<int> e[500010]; ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed into the Public Domain, for any use,
// without warranty, 2019 by Driss Hafdi.
// SPDX-License-Identifier: CC0-1.0
module t (/*AUTOARG*/);
initial begin
if (getUnpacked($c("0")) != "0") $stop;
if (getUnpacked($c("1")) != "1") ... |
module top (
);
// Both RAMB18 in the same tile
(* KEEP, DONT_TOUCH, LOC="RAMB18_X0Y25" *)
RAMB18E1 #(
.RAM_MODE("SDP"),
.READ_WIDTH_A(36),
.READ_WIDTH_B(0),
.WRITE_MODE_A("READ_FIRST"),
.WRITE_MODE_B("READ_FIRST"),
.WRITE_WIDTH_A(0),
.WRITE_WIDTH_B(36)
) RAMB18E1_BOTH_X1 (
.EN... |
/**
* 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) 2015, Microsoft Corporation
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 code ... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; string s; getline(cin, s); for (int i = 0; i < n; i++) { getline(cin, s); if (s.length() >= 5) { if ((s.substr(0, 5) == miao. ) && (s.substr(s.length() - 5, 5) != lala. )) cout... |
module opc5system ( input clk, input[7:0] sw, output[7:0] led, input rxd, output txd,
output [6:0] seg, output [3:0] an, input select);
// CLKSPEED is the main clock speed
parameter CLKSPEED = 32000000;
// BAUD is the desired serial baud rate
parameter BAUD = 115200;
// RAMSIZE ... |
#include <bits/stdc++.h> using namespace std; char W[1000 + 10]; int N[1000 + 10]; int main() { int n, m; scanf( %d%d%s , &n, &m, W); for (int i = 0; i < n; ++i) (N[i] = W[i] - a ); bool fixed = false; for (int i = n - 1; i >= 0; --i) { while (true) { N[i]++; if (N[i] ... |
#include <bits/stdc++.h> using namespace std; const int N = 1001; int a[N][N], LR[N][N], RR[N][N], LC[N][N], RC[N][N]; int main() { int n, m; cin >> n >> m; for (int i = 1; i <= n; ++i) { vector<int> v; for (int j = 1; j <= m; ++j) { cin >> a[i][j]; v.push_back(a[i][j]); ... |
#include <bits/stdc++.h> using namespace std; inline void speed() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } int compare(pair<long long int, long long int> a, pair<long long int, long long int> b) { return a.first > b.first; } int main() { speed();... |
#include <bits/stdc++.h> using namespace std; const double PI = 3.1415926535897932384626433; const long long mod = 1000000007; const int INF = 0x3f3f3f3f; const double eps = 1e-8; template <class T> T gcd(T a, T b) { if (!b) return a; return gcd(b, a % b); } const int maxn = 1e5 + 10; vector... |
#include <bits/stdc++.h> using namespace std; int a[1010]; int main() { int n, i; cin >> n; for (i = 0; i < n; i++) cin >> a[i]; sort(a, a + n); int ans = 0; int x; for (int i = 0; i < n; i++) { x = 1; if (a[i] >= 0) { ans++; for (int j = i + 1; j < n; j++) ... |
`default_nettype none
module gci_std_display_request_controller #(
parameter P_AREA_H = 640,
parameter P_AREA_V = 480,
parameter P_AREAA_HV_N = 19,
parameter P_MEM_ADDR_N = 23
)(
input wire iCLOCK,
input wire inRESET,
//BUS
input wire iRQ_VALID,
output wire oRQ_BUSY,
input wire [P_MEM_ADDR_N-1:0]... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2013(c) Analog Devices, Inc.
//
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification,
// ar... |
#include <bits/stdc++.h> using namespace std; char s[1005]; long long t, ans = 0; int x, l; int main() { scanf( %s , s); int len = strlen(s); for (int i = 0; i < len; i++) { if (isalpha(s[i])) { if (t) { if (l == 2) ans += t; else ans += t ... |
#include <bits/stdc++.h> using namespace std; int n, m; set<string> a, b, c; void solve() { cin >> n >> m; for (int i = 1; i <= n; i++) { string s; cin >> s; a.insert(s); } for (int i = 1; i <= m; i++) { string s; cin >> s; if (a.count(s)) c.insert(s); b... |
//+FHDR------------------------------------------------------------------------
//Copyright (c) 2013 Latin Group American Integhrated Circuit, Inc. All rights reserved
//GLADIC Open Source RTL
//-----------------------------------------------------------------------------
//FILE NAME :
//DEPARTMENT : IC Design / Veri... |
/* ****************************************************************************
This Source Code Form is subject to the terms of the
Open Hardware Description License, v. 1.0. If a copy
of the OHDL was not distributed with this file, You
can obtain one at http://juliusbaxter.net/ohdl/ohdl.txt
Description: L... |
/*
Copyright (c) 2016 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,... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.