text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); int n; cin >> n; int a[2 * n], ans = 0; for (int i = 0; i <= 2 * n - 1; i++) cin >> a[i]; for (int i = 0; i < 2 * n; i += 2) { int j = i + 1; while (a[j] != a[i]) j++; ans += j - i - 1; ... |
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11:10:50 05/23/2014
// Design Name: CPU_top
// Module Name: E://pipelinecpu/test.v
// Project Name: pipelinecpu
// Target Device:
// Tool versions:
// Descriptio... |
// part of NeoGS project (c) 2007-2008 NedoPC
//
// memmap is memory mapper for NGS. Physical memory divided in 16kb pages.
// At (a15=0,a14=0) there is always zero page of MEM, at (a15=0,a14=1) there is
// always third page of RAM, at (a15=1,a14=0) there is page of MEM determined by
// mode_pg0 input bus, at (a15... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: bw_clk_cl_sctag_cmp.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute ... |
#include <bits/stdc++.h> using namespace std; int main() { int w; w = 1; while (w--) { int n, maxi = -1, b = 0; vector<int> s, t[10]; bool f1 = true, f = false; cin >> n; while (n > 0) { int x = n % 10; s.push_back(x); maxi = max(maxi, x); 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... |
/**
* 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 Max = 2e5 + 10; int n, k; int v, u; vector<int> stl[Max]; struct node { long long cou; long long huo; node() { cou = huo = 0; } } point[Max]; int vis[Max]; long long tot = 0; void dfs(int idex, int cou) { vis[idex] = 1; poin... |
/*
*
* Clock, reset generation unit for Atlys board
*
* Implements clock generation according to design defines
*
` */
`include "orpsoc-defines.v"
module clkgen
(
// Main clocks in, depending on board
input sys_clk_pad_i,
// Asynchronous, active low reset in
input rst_n_pad_i,
// Input reset - throu... |
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2014.2 (win64) Build 932637 Wed Jun 11 13:33:10 MDT 2014
// Date : Tue Sep 16 21:34:47 2014
// Host : ECE-411-6 running 64-bit Service Pack... |
// ----------------------------------------------------------------------
// Copyright (c) 2015, The Regents of the University of California All
// rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:... |
#include <bits/stdc++.h> using namespace std; ifstream fin( test.in ); double i, j, sens, k, o, ta, tb, pasi, p, d, pl, haur, n; int a, b, t, f, c; int main() { cin >> a >> b >> t >> f >> c; k = 1000; ta = a / k; tb = b / k; p = a * t; sens = 1; while (p < c) { n = 0; w... |
#include <bits/stdc++.h> using namespace std; const int inf = 1 << 30; char buf[1000]; string nextLine(int length = 100) { cin.getline(buf, length); string s(buf); return s; } string next(int length = 100) { string tmp; cin >> tmp; return tmp; } int nextInt() { int tmp; s... |
#include <bits/stdc++.h> using namespace std; const int N = 2e3 + 10, H = 2e5 + 10, MOD = 1e9 + 7; struct node { int x, y; } a[N]; long long fac[H], inv[H], f[N]; int h, w, n; long long popow(long long x, int y) { long long t = x, re = 1; while (y) { if (y & 1) re = re * t % MOD; t... |
/**
* 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() { string s; cin >> s; int num = 0, num1, num2; for (int i = 0; i < s.size(); i++) { if (s[i] == A ) { num1 = 0; for (int j = 0; j < i; j++) if (s[j] == Q ) num1++; num2 = 0; for (int j = i + 1;... |
/**
* Copyright 2020 The SkyWater PDK Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable la... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of inst_ecb_e
//
// Generated
// by: wig
// on: Mon Apr 10 13:27:22 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl -nodelta ../../bitsplice.xls
//
// !!! Do not edit this file! Autogenerated by MIX... |
// -*- Mode: Verilog -*-
// Filename : test_00.v
// Description : Simple ADXL362 Test Case to bring environment to life
// Author : Philip Tracton
// Created On : Thu Jun 23 11:36:12 2016
// Last Modified By: Philip Tracton
// Last Modified On: Thu Jun 23 11:36:12 2... |
module top;
real q_tst [$];
real q_tmp [$];
real elem;
integer idx;
bit passed;
task automatic check_size(integer size,
string fname,
integer lineno);
if (q_tst.size !== size) begin
$display("%s:%0d: Failed: queue size != %0d (%0d)",
... |
/**
* 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
/////////////////////////////////////////////////////////////////
// Module Name: mux_vector
/////////////////////////////////////////////////////////////////
module mux_vector #(parameter C_SIZE = 4 , DELAY = 3, C_NUM_CHANNELS=2)(
input wire [C_SIZE-1:0] a,
input wire [C_SIZE-1:0] b,
inpu... |
`timescale 1ns / 1ps
/*
* File : uart_clock.v
* Creator(s) : Grant Ayers ()
*
* Modification History:
* Rev Date Initials Description of Change
* 1.0 24-May-2010 GEA Initial design.
*
* Standards/Formatting:
* Verilog 2001, 4 soft tab, wide column.
*
* Descript... |
`timescale 1ns/1ps
`include "test.svh"
module tb_Top ();
parameter WIDTH = 8, DEPTH = 32 , DEPTH2 = 2*DEPTH;
parameter clk_period = 2;
parameter half_period = 1;
//parameter SIZE = 3 ;
`define SIZE = DEPTH
/*integer [7:0] A [2:0][2:0];
integer [7:0] B [2:0][2:0];
integer [7:0] C [2:0][2:0];*/
byte unsigned A[DEPTH... |
#include <bits/stdc++.h> using namespace std; const int N = 500000; const int M = 70; const int C = 300; const int MOD = 1e9 + 7; struct Point { int x[5]; Point() { for (int i = 0; i < 5; i++) x[i] = 0; } }; int n; Point a[N]; vector<int> res; Point diff(const Point &a, const Poi... |
// ========== Copyright Header Begin ==========================================
//
// OpenSPARC T1 Processor File: pcx_buf_pdr_odd.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute it a... |
/**
* 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 Header Begin ==========================================
//
// OpenSPARC T1 Processor File: fpu_out_dp.v
// Copyright (c) 2006 Sun Microsystems, Inc. All Rights Reserved.
// DO NOT ALTER OR REMOVE COPYRIGHT NOTICES.
//
// The above named program is free software; you can redistribute it and/or... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int ans = 0; for (int i = 0; i < n; i++) { int val; cin >> val; if (val >= 0) ans += val; else ans -= val; } cout << ans << 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 la... |
#include <bits/stdc++.h> using namespace std; long long n, yu, one, sum, cnt = 3; long long ans[4]; long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); } int main() { scanf( %I64d , &n); if (!(n % 3)) printf( 1 1 %I64d , n - 2); else printf( 1 2 %I64d , n - 3); ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 100086; int z[maxn], n, m, num, order[maxn][2], last[maxn], ans[maxn], len, in[maxn]; bool flag, ok[maxn]; char s[2]; int main() { scanf( %d %d , &n, &m); for (int i = 1; i <= m; i++) { scanf( %s , s); scanf( %d , &num); ... |
`include "common.vh"
`timescale 1ns/10ps
module Top();
reg clk = 1;
reg rhalt = 1;
reg reset = 1;
always #(`CLOCKPERIOD / 2) clk = ~clk;
wire halt = 0;
// rhalt and reset timing should be independent of each other, and
// do indeed appear to be so.
initial #(1 * 4 * `CLOCKPERIOD) rh... |
// 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; struct BIT { vector<pair<int, int> > f; void init() { f.push_back(make_pair(-1e9, 0)); f.push_back(make_pair(0, 0)); f.push_back(make_pair(1e9, 0)); sort(f.begin(), f.end()); } void update(int i, int val, bool fake = 0) { if... |
/*
* 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... |
module top;
reg a;
reg q, d;
event foo;
real rl;
int ar [];
int start = 0;
int stop = 1;
int step = 1;
int done = 0;
task a_task;
real trl;
event tevt;
reg tvr;
$display("user task");
endtask
always_comb begin: blk_name
event int1, int2;
real intrl;
q <= d;
-> f... |
#include <bits/stdc++.h> using namespace std; int main() { int t; double x, sum = 0; cin >> t; for (int i = 1; i <= t; i++) { cin >> x; sum += x; } cout << (sum / t) << n ; return 0; } |
#include <bits/stdc++.h> using namespace std; long long power(long long x, long long n) { long long ans = 1; for (int i = 1; i <= n; i++) ans *= x; return ans; } long long gcd(long long x, long long y) { return (x % y == 0) ? y : gcd(y, x % y); } long long n, l, r; int main() { cin >> ... |
#include <bits/stdc++.h> using namespace std; int n, m; bool cmp(pair<int, int> a, pair<int, int> b) { if (a.first != b.first) return a.first > b.first; return a.second < b.second; } bool cmp2(pair<int, int> a, pair<int, int> b) { return a.second < b.second; } int main() { ios_base::sync_with_st... |
#include <bits/stdc++.h> using namespace std; long long n, k; int l, MOD; map<long long, int> mp; int fib(long long n) { if (mp.count(n)) return mp[n]; if (n & 1) return mp[n] = 1LL * fib(n / 2) * (fib(n / 2 - 1) + fib(n / 2 + 1)) % MOD; return mp[n] = (1LL * fib(n / 2) * fib(n / 2) + ... |
/*
* Copyright 2020-2022 F4PGA 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
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... |
//////////////////////////////////////////////////////////////////////////////////
// DCFIFO_36x16_DR for Cosmos OpenSSD
// Copyright (c) 2015 Hanyang University ENC Lab.
// Contributed by Kibin Park <>
// Yong Ho Song <>
//
// This file is part of Cosmos OpenSSD.
//
// Cosmos OpenSSD is free software; y... |
#include <bits/stdc++.h> using namespace std; template <typename Arg1> void __f(const char* name, Arg1&& arg1) { cerr << name << : << arg1 << std::endl; } template <typename Arg1, typename... Args> void __f(const char* names, Arg1&& arg1, Args&&... args) { const char* comma = strchr(names + 1, ... |
#include <bits/stdc++.h> using namespace std; const long long sz = 2e6 + 5, mod = 1e9 + 9; long long t, n, m, k, q; const long long inf = 3e18; long long dx[] = {1, 0, -1, 0}; long long dy[] = {0, 1, 0, -1}; bool vis[sz]; vector<vector<long long> > gr(sz); vector<long long> cnt(sz, 0); void DFS(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... |
// ***************************************************************************
// ***************************************************************************
// Copyright 2011 (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; const int Mod = 1000000000 + 7; const int MAXK = 1000000; int power(int x, int k) { int ret = 1; while (k) { if (k & 1) ret = 1LL * ret * x % Mod; x = 1LL * x * x % Mod; k >>= 1; } return ret; } int n, k, ans; int f[MAXK + 10]... |
/**
* 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... |
//-----------------------------------------------------------------------------
// Title : MIPS Single-Cycle Control Unit
// Project : ECE 313 - Computer Organization
//-----------------------------------------------------------------------------
// File : control_single.v
// Author : John... |
//////////////////////////////////////////////////////////////////////////////////
// NPhy_Toggle_Top_DDR100 for Cosmos OpenSSD
// Copyright (c) 2015 Hanyang University ENC Lab.
// Contributed by Ilyong Jung <>
// Yong Ho Song <>
//
// This file is part of Cosmos OpenSSD.
//
// Cosmos OpenSSD is free sof... |
#include <bits/stdc++.h> using namespace std; pair<int, int> a[100005]; int n, t, v[100005], c[100005]; int main() { cin >> n; for (int i = 0; i < n - 1; ++i) cin >> a[i].first >> a[i].second; for (int i = 0; i < n; ++i) cin >> c[i + 1]; for (int i = 0; i < n - 1; ++i) { if (c[a[i].first] ... |
#include <bits/stdc++.h> using namespace std; inline int add(int a, int b, int c) { a += b; if (a >= c) a -= c; else if (a < 0) a += c; return a; } inline int mul(int a, int b, int c) { return (long long)a * b % c; } int pow(int a, long long b, int c) { int res = 1; for (; ... |
`default_nettype none
module pulse_control(
input clk,
input RS232_Rx,
output RS232_Tx,
output [31:0] per,
output [15:0] p1wid,
output [15:0] del,
output [15:0] p2wid,
output [7:0] nut_w,
output [15:0] nut_d,
// output [6:0] pr_att,
// output [6:0] po_att,
output [7:0] cp,
output [7:0] p_... |
#include <bits/stdc++.h> using namespace std; long long n, m, k; long long ans; int main() { cin >> n >> m >> k; if (k > n + m - 2) { cout << -1 << endl; return 0; } if (k > n - 1) { long long x = k; x -= (n - 1); ans = m / (x + 1); } else ans = n / (k + 1... |
#include <bits/stdc++.h> using namespace std; int a[51][51], b[51][51]; int main() { int n, m; cin >> n >> m; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { cin >> a[i][j]; } } for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { cin >>... |
#include <bits/stdc++.h> using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); long long int t; cin >> t; while (t--) { long long int a[3]; cin >> a[0] >> a[1] >> a[2]; sort(a, a + 3, greater<long long int>()); if (a[0]... |
#include <bits/stdc++.h> const int maxn = 5e5 + 5; std::vector<std::pair<int, int>> G[maxn]; std::vector<std::tuple<int, int, int>> q[maxn]; int in[maxn], out[maxn], id[maxn], tot, n, m; long long dis[maxn], ans[maxn]; struct SegTree { long long sum[maxn << 2], lazy[maxn << 2]; void pushdown(int o) ... |
// megafunction wizard: %FIFO%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo_mixed_widths
// ============================================================
// File Name: rxlengthfifo_128x13.v
// Megafunction Name(s):
// dcfifo_mixed_widths
//
// Simulation Library Files(s):
// altera_mf
... |
/*
* 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; int n; struct hdm { int first, second, id; hdm(){}; hdm(int first, int second, int id) : first(first), second(second), id(id){}; }; vector<hdm> v1, v2; bool cmp1(hdm A, hdm B) { return (A.second < B.second); } bool cmp2(hdm A, hdm B) { return (A.fi... |
#include <bits/stdc++.h> using namespace std; long long powmod(long long a, long long b) { long long res = 1; a %= 1000000007; for (; b; b >>= 1) { if (b & 1) res = res * a % 1000000007; a = a * a % 1000000007; } return res; } template <typename T> inline bool chkmin(T &a, cons... |
///////////////////////////////////////////////////////
// Copyright (c) 2009 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
//
// http://www.apache.org... |
#include <bits/stdc++.h> #pragma GCC optimize(3) #pragma GCC optimize(2) using namespace std; int n, r; bool dp[666][666]; int fang[666][666]; pair<int, int> ku[666]; void dfs(int x, int y) { if (x == y) cout << () ; else if (fang[x][y] == -1) { cout << ( ; dfs(x + 1, y); ... |
#include <bits/stdc++.h> char *fs, *ft, buf[1 << 20]; inline int read() { int x = 0, f = 1; char ch = (fs == ft && (ft = (fs = buf) + fread(buf, 1, 1 << 20, stdin), fs == ft)) ? 0 : *fs++; ; while (ch < 0 || ch > 9 ) { if (ch == - ) f = -1; ch = (fs ==... |
module DoubleRegisters(
clk,
bus_in, bus_out1, bus_out2,
num1, num2,
cs_h_in, cs_l_in, cs_16_in,
cs_h_out1, cs_l_out1, cs_16_out1,
cs_h_out2, cs_l_out2, cs_16_out2);
input [15:0] bus_in;
output reg [15:0] bus_out1, bus_out2;
input [1:0] num1, num2;
input c... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 1e9 + 7; const long long INF = 1e9 + 9; const long long N = 500500; char s[4][4]; long long dot, cross, nought, first_wins, second_wins; long long first_win_rows, first_win_col, second_win_row, second_win_col; long long total; signed ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 3e5 + 10; int N; int A[MAXN]; int B[MAXN]; int ans[MAXN]; bool is_permutation() { sort(B + 1, B + 1 + N); for (int i = 1; i <= N; ++i) if (B[i] != i) return false; return true; } void solve(bool has... |
#include <bits/stdc++.h> using namespace std; int n, m; int l[200000], r[200000], p[200001]; vector<int> beg[200001], ed[200001]; map<unsigned long long, unsigned long long> cnt, sum; unsigned long long h[200000], all; mt19937_64 mt(time(0)); int main() { scanf( %d%d , &n, &m); all = 0; for ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 200005; int a[maxn]; int main() { int n; scanf( %d , &n); for (int i = 0; i < n * 2; i++) scanf( %d , &a[i]); sort(a, a + n * 2); long long area = 1ll * (a[n - 1] - a[0]) * (a[n * 2 - 1] - a[n]); for (int i = 1; i < n; i++) {... |
// ==================================================================
// >>>>>>>>>>>>>>>>>>>>>>> COPYRIGHT NOTICE <<<<<<<<<<<<<<<<<<<<<<<<<
// ------------------------------------------------------------------
// Copyright (c) 2006-2011 by Lattice Semiconductor Corporation
// ALL RIGHTS RESERVED
// -------... |
#include <bits/stdc++.h> using namespace std; const int N = 3e5 + 6; namespace AC { int tot, tr[N][26]; int fail[N]; int cnt[N]; int sid[N]; int next[N]; bool vis[N]; int isend[N]; int in[N]; int val[N]; int victim[N]; queue<int> q; void init() { memset(fail, 0, sizeof(fail)); mems... |
#include <bits/stdc++.h> using namespace std; const int maxn = 3e5 + 123; const int mod = 1e9 + 9; int n; long long k, d; int a[maxn]; int m; int L[maxn]; long long t[maxn * 4]; long long ad[maxn * 4]; void build(int v, int l, int r) { ad[v] = 0; t[v] = 0; if (l == r) { } else { ... |
/*
-- ============================================================================
-- FILE NAME : id_reg.v
-- DESCRIPTION : ID¥¹¥Æ©`¥¸¥Ñ¥¤¥×¥é¥¤¥ó¥ì¥¸¥¹¥¿
-- ----------------------------------------------------------------------------
-- Revision Date Coding_by Comment
-- 1.0.0 2011/06/27 suito ÐÂÒ×÷³... |
#include <bits/stdc++.h> using namespace std; const double pi = acos(-1.0); const long long MAX = 2e9 + 7; const long long mod = 1e9 + 7; const long long maxn = 1e3 + 7; int n; string s[maxn]; set<string> ss; int jude(string s) { set<char> q; int a = s.size(); for (int i = 0; i < s.size();... |
#include <bits/stdc++.h> using namespace std; struct point{ public: int x, y; }; bool cmpx(point a, point b){ return a.x<b.x; } bool cmpy(point a, point b){ return a.y<b.y; } int main(){ int t, i, j, x1, x2, y1, y2, d; point ptsx[4], ptsy[4]; cin>>t; ... |
#include <bits/stdc++.h> using namespace std; long long N, L, W; vector<long long> neg, pos; long long INF32 = 0x7fffffff; inline long long div_floor(long long a, long long b) { if (b == 0) return (a > 0 ? +INF32 : -INF32); if (a % b < 0) a -= (b + a % b); return a / b; } int main() { cin ... |
#include <bits/stdc++.h> using namespace std; int n, m, Q; set<int> cut[2]; map<int, int> mx[2]; long long getmx() { map<int, int>::iterator it; it = mx[0].end(); it--; int u = (*it).first; it = mx[1].end(); it--; int v = (*it).first; return 1ll * u * v; } void Insert(int t... |
#include <bits/stdc++.h> using namespace std; long long j, k, s, l, m, n, t, d; long long e[111][33333], a, b, i, p, c; map<string, long long> y; string q, r, w; int main() { cin >> n >> a >> b >> c; n *= 2; for (i = 0; i <= a; i++) { for (j = 0; j <= b; j++) { k = n - i - 2 * j; ... |
/**
* 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> #pragma comment(linker, /STACK:256000000 ) using namespace std; const int maxN = 2000; const int S_CNT = 9; const int M_CNT = 25; const int DIST = 60 * 60; int n, m; int a[maxN][maxN]; int t[maxN][maxN]; int used[maxN][maxN]; int rc[maxN][maxN]; int is_in(int x, int y) ... |
module system (
input clk100,
output led1,
output led2,
output led3,
output led4,
input sw1_1,
input sw1_2,
input sw2_1,
inpu... |
/* FIFOs with a variety of interfaces.
*
* Copyright (c) 2016, Stephen Longfield, stephenlongfield.com
*
* 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 Licens... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 10:08:31 04/18/2014
// Design Name:
// Module Name: CPU_top
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
//... |
#include <bits/stdc++.h> using namespace std; int main() { { long long int i, j, k, y, n, x, m, a, b, ans = 0, sum = 0, cnt = 0; long long int c, mx = 0; string s, z, taj = YES ; cin >> s; map<char, long long int> mp; n = s.size(); for (i = 0; i < n; i++) mp[s[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 MOD = 1.e9 + 7; const int MAXN = 1000000; int fact[MAXN + 5], inv[MAXN + 5]; int lgput(int a, int b) { int ans = 1; for (; b; b >>= 1) { if (b & 1) ans = 1LL * ans * a % MOD; a = 1LL * a * a % MOD; } return ans; } void pre... |
/*
Copyright (c) 2017 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,... |
// ---------------------------------------------------------------------------
// -- --
// -- (C) 2016-2022 Revanth Kamaraj (krevanth) --
// -- --
// ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 22:45:15 09/30/2016
// Design Name:
// Module Name: painter_chooser
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, ans = 0; cin >> n; long long a[n + 1]; vector<long long> last; last.push_back(-1); for (int i = 0; i < n; i++) { cin >> a[i]; if (i > 0 && a[i] <= a[i - 1]) last.push_back(i - 1); } last.push_back(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 law... |
#include <bits/stdc++.h> using namespace std; long long C(int a, int b) { long long ans = 1; for (int i = 0; i < b; ++i) ans *= (a - i), ans /= (i + 1); return ans; } int main() { int n; while (cin >> n) cout << C(n + 4, 5) * C(n + 2, 3) << endl; } |
#include <bits/stdc++.h> using namespace std; long long int a, b, c, d; int main() { cin >> a >> b >> c >> d; if (a + 8 * c >= b) cout << 0 ; else if (c > d) { int num = b - a - 8 * c, den = 12 * (c - d); cout << (num + den - 1) / den; } else cout << -1 ; return 0; ... |
#include <bits/stdc++.h> using namespace std; const int N = 200005; int n, a, b, k, pr[N], seq[N]; char s[200005]; int main() { scanf( %d%d%d%d , &n, &a, &b, &k); scanf( %s , s + 1); int len = strlen(s + 1), lst = 0, cur = 0; for (int i = 1; i <= len; ++i) { if (s[i] == 1 ) { cu... |
// soc_system.v
// Generated using ACDS version 16.1 196
`timescale 1 ps / 1 ps
module soc_system (
input wire clk_clk, // clk.clk
input wire [28:0] hps_0_f2h_sdram0_data_address, // hps_0_f2h_sdram0_data.address
input wire [7:0] hps_0_f2h_sdram0_da... |
#include <bits/stdc++.h> using namespace std; long long int bit[1000010] = {0}; long long int get_sum(int i) { long long int ans = 0; while (i > 0) { ans += bit[i]; i -= i & (-i); } return ans; } void update(int i, int n) { while (i <= n) { bit[i] += 1; i += i & (-i... |
#include<bits/stdc++.h> using namespace std; struct _field { bool white = false; }; int mod = 998244353; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #ifndef ONLINE_JUDGE freopen( input.txt , r , stdin); //freopen( a.out , w ,std... |
/**
* 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; typedef long long ll; typedef long double lf; typedef unsigned long long ull; typedef pair<ll,int>P; const int inf = 0x7f7f7f7f; const ll INF = 1e16; const int N = 2e5+10; const ull base = 131; const ll mod = 1e9+7; const double PI = acos(-1.0); cons... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.