text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> using namespace std; int a[102]; int b[102]; int main() { int n, m; cin >> n >> m; int num = 0; for (int i = 1; i <= m; i++) { int q = 0; for (int j = 1; j <= n; j++) { cin >> a[j]; q = max(q, a[j]); } for (int l = 1; l <= n; l++) ... |
/* fopen2 - test $fopen and $fclose system tasks */
module fopen2;
integer fp1, fp2, fp3, fp4;
integer dfp;
reg error;
reg [31:0] foo;
initial begin
error = 0;
fp1 = $fopen("work/fopen2.out1");
checkfp(fp1);
dfp = fp1|1;
$fdisplay(dfp, "fp1=%d", fp1);
fp2 = $fopen(... |
#include <bits/stdc++.h> using namespace std; int main() { int n, p, q, ans = 0; cin >> n; for (int i = 0; i < n; i++) { cin >> p; cin >> q; if (q - p >= 2) ans++; } cout << ans << endl; } |
#include <bits/stdc++.h> using namespace std; int gcd(int x, int y) { if (y == 0) return x; return gcd(y, x % y); } int lcm(int x, int y) { return x * y / gcd(x, y); } string in; int check(string s) { int ret = 0; while (true) { bool beforem = s[0] == M ; bool changed = false; ... |
`default_nettype none
`timescale 1ns / 1ps
`include "asserts.vh"
`include "xrs.vh"
module xrs_tb();
reg [11:0] story_to;
reg fault_to;
reg clk_i;
reg [2:0] rwe_i;
reg [4:0] ra_i, rb_i, rd_i;
reg [63:0] rdat_i;
wire [63:0] rdata_o, rdatb_o;
`STANDARD_FAULT
`DEFASSERT(rdata, 63, o)
`DEFASSERT(rdatb, 63,... |
#include <bits/stdc++.h> using namespace std; int main() { long long int a, b, rem; cin >> a >> b; long long int count = 0; a = max(a, b); b = min(a, b); while (a != b && b != 0) { count += a / b; a = a % b; a = a + b; b = a - b; a = a - b; } cout << cou... |
#include <bits/stdc++.h> using namespace std; const int oo = 0x3f3f3f3f; const int max0 = 1e7; const int maxm = 400; const int maxabs = 101; const int max1 = 1e3; bool a[(maxabs << 1) + 5][(maxabs << 1) + 5] = {{0}}; int pre[(max1 << 1) + 5][(max1 << 1) + 5] = {{0}}; int n, ax, ay, bx, by; int walk[... |
#include <bits/stdc++.h> using namespace std; int main() { int n, a[100010], i, x, val; cin >> n >> x; int cnt[100010] = {0}; int cnt2[100010] = {0}; for (i = 0; i < n; i++) { cin >> a[i]; cnt[a[i]]++; } for (i = 0; i < 100010; i++) { if (cnt[i] > 1) { cout << ... |
/**
* 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... |
// (C) 2001-2013 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 associated doc... |
#include <bits/stdc++.h> using namespace std; int read() { int x = 0, f = 1; char ch = getchar(); while (ch - 0 < 0 || ch - 0 > 9) { if (ch == - ) f = -1; ch = getchar(); } while (ch - 0 >= 0 && ch - 0 <= 9) { x = x * 10 + ch - 0 ; ch = getchar(); } retu... |
/**
* 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; void solve() { string n; cin >> n; vector<string> vec; int si = n.size(); for (int i = 0; i < si; i++) { if (n[i] == 0 ) continue; string s = ; s += n[i]; for (int j = i + 1; j < si; j++) { s += 0 ; } v... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base ::sync_with_stdio(0); long long int n; cin >> n; cout << 1 << ; n--; for (int i = 1; i <= 2; i++) { if ((n - i) % 3 != 0) { cout << i << << n - i; break; } } } |
/******************************************************************************
* License Agreement *
* *
* Copyright (c) 1991-2012 Altera Corporation, San Jose, California, USA. ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); int test; cin >> test; while (test--) { int n; cin >> n; for (int i = 0; i < n; i++) { cout << 8 << ; } cout << endl; } return 0; } |
#include <bits/stdc++.h> using namespace std; #define int long long const int MAX = 1e6 + 7; int num[MAX]; signed main() { int T; cin >> T; while (T--) { int N, u, v; cin >> N >> u >> v; for (int i = 1; i <= N; i++) { cin >> num[i]; } int canget = 0; int flag = 0... |
//Copyright 1986-2014 Xilinx, Inc. All Rights Reserved.
//--------------------------------------------------------------------------------
//Tool Version: Vivado v.2014.4 (lin64) Build Tue Nov 18 16:47:07 MST 2014
//Date : Mon Mar 14 19:31:48 2016
//Host : ubuntu-desktop running 64-bit Ubuntu 14.04.4 LTS... |
#include <bits/stdc++.h> using namespace std; const long long INF = 999999999999999999; const double PI = acos(-1.0); void stop() { exit(0); } long long A[200005]; int main() { ios::sync_with_stdio(false); long long n; cin >> n; for (long long i = 0; i < n; i++) { cin >> A[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... |
/*
* Copyright (C) 2011 Kiel Friedt
*
* 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 p... |
#include <bits/stdc++.h> using namespace std; struct milk { int x, num; bool operator<(const milk &mm) const { return x < mm.x; } } b[1000010]; int a[1000010], n, m, k; bool ok(int p2) { int p1 = 1, now = 0; while (p1 <= n || p2 <= m) { if ((p1 <= n && a[p1] < now) || (p2 <= m && b[p2].x... |
#include <bits/stdc++.h> using namespace std; long long int a[1000005]; int main() { long long int i, j, k, l, n, m; cin >> n >> m; if (n / m < 3) { cout << -1; return 0; } j = 1; long long int f = 0; long long int x, y; x = 1, y = n - 1; while (y - x >= 4 && j < 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... |
/****************************************************
SIM Memory Model
with byte & half_word access controller
Version : 1.0.0
1.0.0 : 2014/07/05 Basic Mode
Memory Model
Little Endian
Ex :
data = 0x01234567
-Load
load_word[0] = 0x01234567
load_hf_word[0] = 0x0123
load_byte[0] = 0x01
-Store
store_... |
`timescale 1ns / 1ps
module EXMEM
(
// Input
input Clk,
input Reset,
input [31:0] PCIn,
input [2:0] WBIn,
input [1:0] MIn,
input [31:0] ALUResultIn,
// input ALUZeroIn,
input [31:0] MemDataIn,
input [4:0] DstMuxIn,
// Output
output reg... |
#include <bits/stdc++.h> using namespace std; int n; map<string, int> m; string s; string pr[109]; int darab[109][26]; int main() { ios::sync_with_stdio(false); cin.tie(0); cin >> n; cout << ? << 1 << << n << endl; for (int i = 1; i <= (n * (n + 1)) / 2; i++) { cin >> s; ... |
#include <bits/stdc++.h> using namespace std; const int Maxn = 100010; int ans = -1, ansd, a[Maxn], b[Maxn], n, m; inline int Pow(int x, int y, int mod) { int s = 1; for (; y; y >>= 1, x = 1ll * x * x % mod) if (y & 1) s = 1ll * s * x % mod; return s; } inline bool find(int *a, int n, int ... |
//*****************************************************************************
// (c) Copyright 2008-2009 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
// ... |
#include <bits/stdc++.h> using namespace std; const int MAXN = 100005; int n, m, far[MAXN], a[MAXN]; struct LCT { int fa[MAXN], ch[MAXN][2]; int s[MAXN], xs[MAXN]; long long xs2[MAXN], sum[MAXN], ans[MAXN], xans[MAXN]; bool isroot(int x) { return ch[fa[x]][0] != x && ch[fa[x]][1] != x; } int... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1e5 + 5; const int mod = 1e9 + 7; char str[maxn]; long long qp(long long a, long long b) { long long ret = 1; while (b) { if (b & 1) ret = ret * a % mod; a = a * a % mod; b >>= 1; } return ret; } long long inv... |
module regfile_16x32b_4rd_2wr(input wire clk,
input wire rst,
input wire [3:0] rdport1_ctrl_add,
output wire [31:0] rdport1_data_out,
input wire [3:0] rdport2_ct... |
#include <bits/stdc++.h> using namespace std; int n, m; long long int dp[503][5030]; long long int cnt[100100]; long long int fav[100100]; int t[550]; int used[100100]; long long int h[15]; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); cin >> n >> m; for (int i = 0; i < n... |
#include <bits/stdc++.h> using namespace std; const int MX = 505, mod = 998244353; int n, m; vector<int> c, pos[MX]; long long mem[2 * MX][2 * MX]; bool isValid(int a, int b) { if (a != pos[c[a]][0] && a != pos[c[a]].back()) return 0; if (b != pos[c[b]][0] && b != pos[c[b]].back()) return 0; for... |
#include <bits/stdc++.h> using namespace std; int main() { int n, m; cin >> n >> m; vector<set<int> > v(n); vector<set<int> > w(n); for (int i = 0; i < m; i++) { int a, b; cin >> a >> b; a--; b--; if (a > b) v[a].insert(b); else v[b].insert(a);... |
#include <bits/stdc++.h> using namespace std; int main() { long double n, k; cin >> n >> k; string s; cin >> s; set<string, greater<string> > st; queue<string> stk; stk.push(s); while (k && !stk.empty()) { string temp = stk.front(); stk.pop(); if (st.find(temp) == s... |
#include <bits/stdc++.h> using namespace std; priority_queue<int, vector<int>, greater<int> > pq; int dp[11][11]; void ini() { int i, j; for (int i = 0; i < 11; i++) for (j = 0; j <= max(i, 10); j++) { if (i == 0) dp[i][j] = 0; else if (i == j || j == 0) dp[i][j... |
#include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); ; int t; cin >> t; while (t--) { int n, m; cin >> n >> m; string a; cin >> a; int arr[n + 5]; set<int> st; int mark[n + 5]; memset(... |
/**
* 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 packet_builder #(parameter NUM_CHAN = 2)(
// System
input rxclk,
input reset,
input [31:0] timestamp_clock,
input [3:0] channels,
// ADC side
input [15:0]chan_fifodata,
input [NUM_CHAN:0]chan_empty,
input [9:0]chan_usedw,
output reg [3:0]rd_select,
output reg chan_rdreq,
... |
/*
* 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, cnt, a[220000]; long long sum; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); for (int l = 1; l <= n; l++) { sum = a[l + 1]; for (int r = l + 2; r <= n; r++) { if (a[l] < a[r]) { sum +=... |
#include <bits/stdc++.h> int main() { long long n, m, i; scanf( %lld%lld , &n, &m); printf( YES n ); for (i = n; i < m; i += 2) printf( %lld %lld n , i, i + 1); printf( n ); return 0; } |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 06/17/2017 06:06:47 PM
// Design Name:
// Module Name: tb
// Project Name:
// Target Devices:
// Tool Versions:
// Description:
//
// Dependencies:
//
// Revisio... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; const double PI = acos(-1.0); const int EPS = (1e-10); const int N = 1e5 * 2 + 10; const int inf = 1e9 * 2 + 10; const ll INF = 1e18 * 2 + 10; const int MOD = 1e9 + 7; int nx... |
#include <bits/stdc++.h> using namespace std; const int N = 666; const int inf = 1e9; struct edge { int pr; int to; int cap; } e[111111]; int tot = 1, la[N]; void clr() { tot = 1; memset(la, 0, sizeof(la)); } void adde(int x, int y, int z) { e[++tot].pr = la[x]; la[x] = tot... |
/*
Teak synthesiser for the Balsa language
Copyright (C) 2007-2010 The University of Manchester
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 opti... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); long long t, n, h, i, j, x, y, z, k, e, m; string s; cin >> n >> m; x = 0; for (i = 1; i <= n; i++) { y = i / 5; z = (i + m) / 5; x += (z - y); } cout << x; return 0; ... |
`ifndef _MEM_ACCESS
`define _MEM_ACCESS
`include "../misc/mux.v"
`include "../misc/plus_one.v"
`include "../memory/data_mem.v"
module mem_access(IRfrompipe4, IRfrompipe5, RAFromPipe, ALUOut, RAMemSelectInput, wASelectInput, MemData, DataInSelect, WriteMem, RAFromPipeInc, SignalC
, Rfout1, Rfout2, mem_wb_CCR_wri... |
`timescale 1ns / 1ps
/*
Copyright 2015, Google 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/licenses/LICENSE-2.0
Unless required by applicable l... |
#include <bits/stdc++.h> using namespace std; const int N = 85; double l[N], r[N], ans[N][N], ago[N], now[N], dp[N][N]; int main() { vector<double> g; int n; scanf( %d , &n); for (int i = 1; i <= n; ++i) { scanf( %lf%lf , &l[i], &r[i]); g.push_back(l[i]), g.push_back(r[i]); } ... |
#include <bits/stdc++.h> using namespace std; int f[10001]; int main() { int a, b = -99999, c = 0; cin >> a; for (int i = 1; i <= a; i++) cin >> f[i]; for (int i = 1; i <= a; i++) b = max(b, f[i]); for (int i = 1; i <= a; i++) c += (b - f[i]); cout << c << endl; return 0; } |
`timescale 1 ns / 1 ps
`default_nettype none
`define WIDTH 16
module j1a(input wire clk,
input wire resetq,
output wire uart0_wr,
output wire uart0_rd,
output wire [7:0] uart_w,
input wire uart0_valid,
input wire [7:0] uart0_data
);
wire io_rd, io_wr... |
#include <bits/stdc++.h> using namespace std; const int MAX_N = 1e2 + 10; const long long mod = 1e9 + 7; const long long INF = 1e9; inline long long bpow(long long t, long long n) { long long ans = 1; while (n > 0) { if (n & 1) ans = (ans * t) % mod; t = (t * t) % mod, n >>= 1; } r... |
#include <bits/stdc++.h> using namespace std; char getc() { char c = getchar(); while ((c < A || c > Z ) && (c < a || c > z ) && (c < 0 || c > 9 )) c = getchar(); return c; } int gcd(int n, int m) { return m == 0 ? n : gcd(m, n % m); } int read() { int x = 0, f = 1; char c =... |
#include <bits/stdc++.h> using namespace std; const int N = 105; int freq[N]; int main() { ios::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m; for (int i = 0; i < m; i++) { int type; cin >> type; freq[type]++; } int start = 1, end = 100; while (sta... |
// (C) 2001-2015 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 associated doc... |
// DEFINES
`define BITS 8 // Bit width of the operands
`define B2TS 16 // Bit width of the operands
`define USEAND 0 // No available documentation provides for macros without values so we use 0
module bm_base_multiply(clock,
reset_n,
a_in,
b_in,
c_in,
d_in,
e_in,
f_in,
out0,
out2,
... |
#include <bits/stdc++.h> using namespace std; const int N = 1e6 + 5; const long long M = (long long)1e9 + 7; int Int() { int x; scanf( %d , &x); return x; } long long Long() { long long x; scanf( %lld , &x); return x; } void Char(char *ch) { scanf( %s , ch); } template <typenam... |
#include <bits/stdc++.h> using namespace std; long long int a[200005]; vector<long long int> g[200005]; vector<long long int> c[200005]; multiset<long long int> st[200005]; long long int idx[200005], toAdd[200005], ans[200005]; void mergeTree(long long int id1, long long int id2) { multiset<long long ... |
// DESCRIPTION: Verilator: Verilog Test module
//
// Copyright 2009 by Wilson Snyder. This program is free software; you can
// redistribute it and/or modify it under the terms of either the GNU
// Lesser General Public License Version 3 or the Perl Artistic License
// Version 2.0.
module t ();
sub a (.inst(1));
... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1e9 + 7; int main() { char s1[15], s2[15], s3[15]; int p[15]; scanf( %s%s , s1, s2); int len = strlen(s1); int pos = 0; for (int i = 0; i < len; i++) { if (s1[i] == + ) pos++; else pos--; }... |
#include <bits/stdc++.h> using namespace std; int n, ans, dp[105], a[105]; int main() { scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , &a[i]); if (n % 2 == 0 || n == 1) { printf( -1 ); return 0; } for (int i = n; i >= 2; i--) { ans += max(a[i], a[i - 1]); a[(... |
/*
** Copyright (C) 2015 Klaus Rudolph <>
**
** 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 2 of the License, or
** (at your option) any later version.
**
** This program ... |
// -------------------------------------------------------------
//
// Generated Architecture Declaration for rtl of ent_ab
//
// Generated
// by: wig
// on: Tue Jun 27 05:12:12 2006
// cmd: /cygdrive/h/work/eclipse/MIX/mix_0.pl ../verilog.xls
//
// !!! Do not edit this file! Autogenerated by MIX !!!
// $Author: w... |
#include <bits/stdc++.h> using namespace std; int i, j, n; void write(int X) { if (X < 0) putchar( - ), X = -X; if (X > 9) write(X / 10); putchar(X % 10 | 48); } void print(int k) { int h; for (h = 1; h <= (4); h++) { write(((i - 1) << 2) + h); putchar( ); write(((j - 1... |
#include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { long long int n, m; cin >> n >> m; long long int s = 0, x, y, i, j; vector<long long int> a, b; for (i = 0; i < n; i++) { cin >> x; if (x < 0) a.push_back(x);... |
#include <bits/stdc++.h> using namespace std; int main() { int k; scanf( %d , &k); if (k % 2 == 1) { printf( -1 n ); return 0; } char a[k][k]; memset(a, 0, sizeof(a)); for (int layer = 0; layer < k / 2; layer++) { char c; if (layer % 2) c = w ; else... |
#include <bits/stdc++.h> using namespace std; const int max_n = 2e5 + 10; int n, temp; vector<int> ans; int main() { ios_base::sync_with_stdio(false), cin.tie(0); cin >> n; for (int i = 0; i < n; i++) { cin >> temp; int pos = lower_bound(ans.begin(), ans.end(), temp) - ans.begin(); ... |
#include <bits/stdc++.h> using namespace std; inline int read() { int x = 0; bool f = false; char ch = getchar(); while (!isdigit(ch)) { f |= ch == - ; ch = getchar(); } while (isdigit(ch)) { x = (x << 3) + (x << 1) + (ch ^ 48); ch = getchar(); } return f ? -... |
//-----------------------------------------------------------------------------
//
// (c) Copyright 2010-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
... |
/**
* 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... |
//==================================================================================================
// Filename : FSM_input_enable.v
// Created On : 2016-09-21 00:26:00
// Last Modified : 2016-09-25 21:37:40
// Revision :
// Author : Jorge Sequeira Rojas
// Company : Instituto Tecnologi... |
#include <bits/stdc++.h> using namespace std; int inf = 1000000000, mxx, mxy, mnx = inf, mny = inf, n, m, i, j, r = 0, x[2000001], y[2000001]; char a[3001][3001], c[3001][3001]; bool ok(int mxx, int mxy, int mnx, int mny) { for (int i = 0; i < r; i++) if (x[i] < mnx || x[i] > mxx || y[i] < mny |... |
/**
* 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... |
// megafunction wizard: %RAM: 1-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: ram_for_test.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ===============... |
#include <bits/stdc++.h> using namespace std; void solve() { vector<pair<long long, long long>> ar(4); for (long long i = 1; i <= 3; i++) { long long a, b; cin >> a >> b; ar[i] = {a, b}; } sort(ar.begin() + 1, ar.end()); set<pair<long long, long long>> ans; for (long long i... |
// Copyright 1986-2017 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2017.2 (win64) Build Thu Jun 15 18:39:09 MDT 2017
// Date : Fri Sep 22 22:04:02 2017
// Host : DarkCube running 64-bit major release ... |
#include <bits/stdc++.h> using namespace std; long long int a, b, c, d, n, ans = 0; int main() { cin >> a; cin >> b; cin >> c; cin >> d; if ((a + b > c && a + c > b && b + c > a) || (a + b > d && a + d > b && b + d > a) || (a + d > c && a + c > d && d + c > a) || (d + b... |
//////////////////////////////////////////////////////////////////////
//// ////
//// uart_sync_flops.v ////
//// ////
//// ... |
module erx_remap (/*AUTOARG*/
// Outputs
emesh_access_out, emesh_packet_out,
// Inputs
clk, emesh_access_in, emesh_packet_in, remap_mode, remap_sel,
remap_pattern, remap_base
);
parameter AW = 32;
parameter DW = 32;
parameter PW = 104;
parameter ID = 12'h808;
//Clock/reset
input... |
#include <bits/stdc++.h> using namespace std; const int MAXM = 2e5 + 3, MAXN = 2e5 + 3, MAXQ = 2e5 + 3, MAXC = 2e5 + 3, ADD = 1 << 18; int n, m, q; int edge_from[MAXM << 1], edge_to[MAXM << 1], edge_nex[MAXM << 1]; int cntm = 1, head[MAXN]; void link(int from, int to) { edge_from[++cntm] = f... |
//
// Copyright 2012 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 main() { int x, y; cin >> x >> y; if (((x < y) ? x : y) % 2) cout << Akshat ; else cout << Malvika ; return 0; } |
#include <bits/stdc++.h> using namespace std; int main() { int n, a, b; cin >> n >> a >> b; if (b) b = (b / abs(b)) * (abs(b) % n); if (!b) { cout << a; return 0; } if (b > 0) { int i, cnt = 0; for (i = a; cnt != b; (i != n) ? (i++) : i = 1) { cnt++; } ... |
/**
* 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 void remax(T& A, T B) { if (A < B) A = B; } template <class T> inline void remin(T& A, T B) { if (A > B) A = B; } string ToString(long long num) { string ret; do { ret += ((num % 10) + 0 ); num /= 10; ... |
#include <bits/stdc++.h> using namespace std; int inf = INT_MAX >> 1; double PI = 3.1415926535897932384626433832795; set<vector<char> > st; int ans = 0; void rotX(vector<char> &c); void rotY(vector<char> &c); void solve(string s) { vector<char> c(6); for (int i = 0; i < s.size(); i++) c[i] = s[i... |
#include <bits/stdc++.h> using namespace std; const int MAX = 2e5; int main() { int n; cin >> n; int f = 0, z = 0; for (int i = 0; i < n; i++) { int val; scanf( %d , &val); if (val == 5) f++; else z++; } int mx = 0; for (int i = 0; i <= f; i++) ... |
#include <bits/stdc++.h> using namespace std; int n, m; int num[105]; int a[105][105], sum[105][105], mx[105][105]; int f[105][10005]; int main() { cin >> n >> m; for (int i = 1; i <= n; i++) { cin >> num[i]; for (int j = 1; j <= num[i]; j++) { cin >> a[i][j]; sum[i][j] =... |
#include <bits/stdc++.h> using namespace std; int arr[100005], lazy[4 * 100005], num, value; bool flag; struct Node { int maxi, mini, one, two; } tree[4 * 100005]; Node merge(Node a, Node b) { Node temp; int num = max(a.maxi, b.maxi); temp.maxi = num, temp.one = num == a.maxi ? a.one : b.one... |
/**
* 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 MAXN = 500005; int n, m, u[MAXN], v[MAXN]; bool cho[MAXN], sel[MAXN]; void solve() { int ans = 0; scanf( %d%d , &n, &m); for (int i = 1; i <= m; i++) { scanf( %d%d , &u[i], &v[i]); if (!cho[u[i]] && !cho[v[i]]) { sel[i] = ... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 7; long long sumb, sumc; int n, a[N], b[N], c[N], cnt[30]; bool check() { for (int i = 0; i < n; i++) { for (int j = 0; j < 30; j++) { if (a[i] & 1 << j) cnt[j]++; } } for (int i = 0; i < n; i++) { long lon... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// UART Module
// Paul Mumby 2012
//////////////////////////////////////////////////////////////////////////////////
module uart(
clk,
rx_pin,
tx_pin,
rx_byte,
tx_byte,
rx_data_ready,
tx_start,
rx_bus... |
`timescale 1ns / 1ps
//`define DATA_PATTERN_0 16'hA635
//`define DATA_PATTERN_1 16'h59CA // inverse of DATA_PATTERN_0
`define DATA_PATTERN_0 16'h35A9
`define DATA_PATTERN_1 16'hCA56 // inverse of DATA_PATTERN_0
`define MRAM_LATENCY 10
module MRAM_RW(
input CLKM,
input RST,
input start,
output done_... |
/**
* 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 MAXN = 5e3 + 3; map<int, int> mapa; vector<int> v; int mw[103030]; int main() { int n, m, a, maxi = 0; scanf( %d %d , &n, &m); for (int i = (int)0; i < (int)n; i++) { scanf( %d , &a); mapa[a] = 1; mw[i] = a; if (maxi... |
/**
* 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.