text stringlengths 59 71.4k |
|---|
#include <bits/stdc++.h> const int maxn = 3e5 + 5; using namespace std; long long n, m; int main() { scanf( %d%d , &n, &m); if (min(n, m) == 1) { long long t = max(n, m); long long ti = t / 6, res = t % 6; printf( %lld n , ti * 6 + max(0ll, res - 3) * 2); return 0; } if (... |
#include <bits/stdc++.h> using namespace std; using ll = long long; long double r, v; long double eps = 1e-8; const long double mpi = acos(-1.0); inline long double dist(long double theta) { return 2.0L * r * (sin(theta) + theta); } inline double ti(long double theta, long long ni) { return 2.0L... |
#include <bits/stdc++.h> using namespace std; const double PI = acos(-1.0); const int INF = 1000000000; const int MOD = 1000000007; long long b(long long a, long long n, long long mod) { if (n == 0) { return 1; } if (n == 1) { return a % mod; } long long t = b(a, n / 2, mod); ... |
`timescale 1ns / 1ps
`include "Defintions.v"
`define LOOP1 8'd8
`define LOOP2 8'd5
module ROM
(
input wire[15:0] iAddress,
output reg [27:0] oInstruction
);
`define LABEL_LOOP 8'd2
`define LABEL_LOOP1 8'd9
`define LABEL_LOOP2 8'd16
`define LABEL_LOOP3 8'd23
`define LABEL_LOOP4 8'd30
`define L... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 5; int read() { int s = 0; char c = getchar(), lc = + ; while (c < 0 || 9 < c) lc = c, c = getchar(); while ( 0 <= c && c <= 9 ) s = s * 10 + c - 0 , c = getchar(); return lc == - ? -s : s; } void write(int x) { ... |
/**
* 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... |
// megafunction wizard: %RAM: 2-PORT%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: altsyncram
// ============================================================
// File Name: upd77c25_pgmrom.v
// Megafunction Name(s):
// altsyncram
//
// Simulation Library Files(s):
// altera_mf
// ========================... |
#include <bits/stdc++.h> using namespace std; long long a[1003]; int main() { long long n, s; cin >> n >> s; long long miner = 0x3f3f3f3f3f3f3f3f; long long sumer = 0; for (long long i = 0; i < n; i++) { cin >> a[i]; sumer += a[i]; miner = min(miner, a[i]); } if (sume... |
#include <bits/stdc++.h> using namespace std; const int N = 1e3 + 5; char s[N]; int n, f[N], mk[N], cnt[N]; vector<int> p; void init() { for (int i = 2; i < N; i++) if (!mk[i]) { p.push_back(i); for (int j = i + i; j < N; j += i) mk[j] = true; } } int main() { scanf( ... |
/**
* testbench.v
*
*/
module testbench();
localparam width_p = 32;
localparam ring_width_p = width_p*2 + 3;
localparam rom_addr_width_p = 32;
logic clk;
logic reset;
bsg_nonsynth_clock_gen #(
.cycle_time_p(10)
) clock_gen (
.o(clk)
);
bsg_nonsynth_reset_gen #(
.reset_cycles_lo_p(4)
,.reset_cycles_hi_... |
// 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 : Thu May 18 23:18:58 2017
// Host : GILAMONSTER running 64-bit major release (... |
#include <bits/stdc++.h> using namespace std; int main() { string s1, s2; int flag = 0, f = 0; cin >> s1 >> s2; int l = s1.length(); for (int i = 0; i < l; i++) { if (s1[i] < a ) { s1[i] += 32; } if (s2[i] < a ) s2[i] += 32; if (s1[i] != s2[i]) { f = i; ... |
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 12:14:13 05/10/2015
// Design Name:
// Module Name: Expansion
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Depen... |
// Copyright 1986-2014 Xilinx, Inc. All Rights Reserved.
// --------------------------------------------------------------------------------
// Tool Version: Vivado v.2014.4 (lin64) Build Tue Nov 18 16:48:31 MST 2014
// Date : Tue Feb 10 12:36:17 2015
// Host : austin_workstation_1 running 64-bit Fedora ... |
#include <bits/stdc++.h> using namespace std; int n, mnPre[(100005)], mxPre[(100005)], mnSuf[(100005)], mxSuf[(100005)]; pair<int, int> a[2][(100005)]; long long solve(int ax) { sort(a[ax] + 1, a[ax] + 1 + n); for (int i = 1; i <= n; ++i) { mnPre[i] = min(mnPre[i - 1], a[ax][i].second); mxPr... |
/*
* 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> struct sur { int c1, c2, c3, c4; inline bool colsame() { return c1 == c3 && c2 == c4 && c1 != c2; } inline bool same() { return c1 == c2 && c2 == c3 && c3 == c4; } inline void right_rotate() { int t = c4; c4 = c2; c2 = c1; c1 = c3; c3 = t; r... |
// DESCRIPTION: Verilator: Verilog Test module
//
// This file ONLY is placed under the Creative Commons Public Domain, for
// any use, without warranty, 2020 Yossi Nivin.
// SPDX-License-Identifier: CC0-1.0
module t(/*AUTOARG*/
// Inputs
clk
);
input clk;
reg [15:0] in16;
reg [31:0] in32;
reg [6... |
#include <bits/stdc++.h> using namespace std; const long long mod = 1000000009; long long poww(long long base, long long power) { long long ret = 1; for (long long i = 0; i < power; i++) { ret *= base; ret %= mod; } return ret; } int main() { long long ans; long long n, m; ... |
#include <bits/stdc++.h> using namespace std; namespace GR1 { vector<int> solve(int N, int num_exact_matches, int num_common, const vector<int>& B) { vector<queue<int> > pos(N + 2); for (int i = 0, _n = (N); i < _n; ++i) { int b = B[i]; pos[b].push(i); } int missing... |
/**
* 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... |
// Test implicit casts during procedural non-blocking assignments.
module implicit_cast();
real src_r;
bit unsigned [7:0] src_u2;
bit signed [7:0] src_s2;
logic unsigned [7:0] src_u4;
logic signed [7:0] src_s4;
logic unsigned [7:0] src_ux;
logic signed [7:0] src_sx;
real ... |
/*
* Milkymist VJ SoC
* Copyright (C) 2007, 2008, 2009, 2010 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 distri... |
// ==============================================================
// File generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and SystemC
// Version: 2016.2
// Copyright (C) 1986-2016 Xilinx, Inc. All Rights Reserved.
//
// ==============================================================
`timescale 1ns/1ps
... |
/*
* 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> int main(void) { int m, n; char a[100001], b[100001]; scanf( %s , a); scanf( %s , b); n = strlen(a); m = strlen(b); if (n == m) { if (strcmp(a, b) == 0) printf( -1 ); else printf( %d , m); } else if (n > m) { printf( %d , n); ... |
#include <bits/stdc++.h> using namespace std; int n, m; vector<pair<int, int> > adj[100005]; int dp[300005]; int x[300005]; int main() { ios_base::sync_with_stdio(0); int i, j; cin >> n >> m; while (m--) { int u, v, e; cin >> u >> v >> e; adj[e].push_back(make_pair(u, v)); ... |
#include <bits/stdc++.h> using namespace std; int n, tb[100], w1, w2, l = 1; int main() { scanf( %d , &n); for (int i = 0; i < n / 2; i++) scanf( %d , &tb[i]); sort(tb, tb + n / 2); for (int i = 0; i < n / 2; i++) { w1 += abs(tb[i] - l); l += 2; } l = 2; for (int i = 0; i <... |
#include <bits/stdc++.h> using namespace std; const int N = 2e5 + 10; int a[N]; long long sum[N]; int main() { int n; scanf( %d , &n); for (int i = 1; i <= n; i++) scanf( %d , a + i); sort(a + 1, a + n + 1); for (int i = 1; i <= n; i++) sum[i] = sum[i - 1] + a[i]; long long ans_sum = 0... |
#include <bits/stdc++.h> using namespace std; const int mod = 998244353; int c[80][80], m; struct tree { int n, ans[80], f[80][5000], g[80][5000]; int root, sum, siz[5000], w[5000], a[5000], tot; bool vis[5000]; vector<int> v[5000]; inline void getrt(int x, int fa) { siz[x] = 1; ... |
#include <bits/stdc++.h> using namespace std; void solve() { int n; cin >> n; vector<pair<int, bool>> v(2 * n); for (int i = 0; i < 2 * n; i++) cin >> v[i].first, v[i].second = true; long long ans = 0, cc = 0; for (int i = 0; i < 2 * n; i++) { if (!v[i].second) continue; cc = 0; ... |
#include <bits/stdc++.h> #pragma comment(linker, /STACK:1000000000 ) #pragma GCC optimize( Ofast,no-stack-protector ) using namespace std; const int maxn = (int)2e5 + 10; vector<int> ed[maxn]; int t[maxn], h[maxn]; long long dp[maxn][2]; void go(int v, int p) { vector<pair<long long, int> > g; ... |
#include <bits/stdc++.h> using namespace std; const long double PI = acos(-1); const long long MOD = 1000000007; const long long FMOD = 998244353; long long cnt1, cnt2, x, y; bool isSafe(long long mid) { long long div1 = mid / x; long long div2 = mid / y; long long div3 = mid / (x * y); long... |
//////////////////////////////////////////////////////////////////////
//// ////
//// Generic Single-Port Synchronous RAM ////
//// ////
//// This file is part of memory li... |
/*
* Copyright 2012, Homer Hsing <>
*
* 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 agreed to ... |
#include <bits/stdc++.h> using namespace std; const int maxn = 1000010; int n, x, tot = 0, Ans = 0, prime[maxn]; bool isprime[maxn]; map<int, int> sg, st; void init() { memset(isprime, true, sizeof(isprime)); isprime[1] = false; for (int i = 2; i < maxn; i++) { if (isprime[i]) prime[++tot]... |
module iir (clk, reset, start, din, params, dout, ready,iir_start,iir_done);
input clk, reset, start;
input [7:0] din;
input [15:0] params;
output [7:0] dout;
reg [7:0] dout;
output ready;
reg ready;
reg temp_ready;
reg [6:0] finite_counter;
wire count0;
input iir_start;
output iir_done;
wire iir_done;
reg del_count0;
... |
////////////////////////////////////////////////////////////////////////////////
// Copyright (c) 1995-2013 Xilinx, Inc. All rights reserved.
////////////////////////////////////////////////////////////////////////////////
// ____ ____
// / /\/ /
// /___/ \ / Vendor: Xilinx
// \ \ \/ Version : ... |
///////////////////////////////////////////////////////////////////////////////
// $Id$
//
// Module: vlan_remover.v
// Project: NF2.1 OpenFlow Switch
// Author: Jad Naous <>
// Description: removes the VLAN info if existing and puts it in a module header.
///////////////////////////////////////////////////////////////... |
/**
* 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> t mag(t a) { return a > 0 ? a : -a; } template <class T> T cdiv(T num, T den) { return (num / den) + (num % den > 0); } std::ifstream term( /dev/tty ); std::string tempstring; using ll = int_fast64_t; using ii = pair<ll, ll>;... |
#include <bits/stdc++.h> using namespace std; vector<long long> a; int main() { long long t; cin >> t; for (long long ind = 0; ind < t; ++ind) { long long n, k; cin >> n >> k; string s; cin >> s; a.clear(); a.resize(26, 0); long long num = n / k, ans = 0; ... |
#include <bits/stdc++.h> using namespace std; int a[110][110]; int main() { int n, m, i, j; while (~scanf( %d %d , &n, &m)) { for (i = 0; i < n; i++) for (j = 0; j < m; j++) scanf( %d , &a[i]); if (n & 1) { cout << n << endl; continue; } int vis; for (... |
#include <bits/stdc++.h> using namespace std; int main() { long long n, b; cin >> n >> b; long long a[n + 1]; for (int i = 0; i < n; ++i) { cin >> a[i]; } a[n] = b; sort(a, a + n + 1); if (a[0] == b) { cout << a[n - 1] - a[0]; } else { if (a[n] == b) { c... |
#include <bits/stdc++.h> using namespace std; #define rep(i, a, b) for(int i=a; i<=b; i++) #define repd(i, a, b) for(int i=a; i>=b; i--) #define vi vector<int> #define vll vector<long long> #define pii pair<int,int> #define pll pair<long long,long long> #define pb push_back #define fr first #define ... |
#include <bits/stdc++.h> using namespace std; int tipo[100000 + 5]; int main() { int n, x, y, z, m; cin >> n >> m; memset(tipo, -1, sizeof(tipo)); for (int i = 0; i < m; ++i) { cin >> x >> y >> z; x--, y--, z--; bool enc = 0; if (tipo[x] != -1) { enc = 1; ti... |
/**
* 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; bool pd[5005][5005]; char str[5005]; int n; bool vis[5050]; bool dfs(int u, int lst) { vis[u] = 1; for (int i = 1; i <= n; ++i) { if (!pd[u][i]) continue; if (lst != -1 && pd[i][lst]) { printf( %d %d %d n , lst, u, i); return ... |
/*
Copyright (c) 2014-2018 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, distri... |
#include <bits/stdc++.h> using namespace std; char A[5] = { a , e , i , o , u }; int main() { int k; cin >> k; int rol = 0, col = 0; for (int i = 5; i <= sqrt(k); ++i) { if ((k % i == 0) && (k / i >= 5)) { rol = i; col = k / i; break; } } if (rol == ... |
#include <bits/stdc++.h> using namespace std; bool check(char s) { if (s == A || s == H || s == I || s == M || s == O || s == T || s == U || s == V || s == W || s == X || s == Y ) return true; else return false; } int main() { int n, i, x, p; bool ans = t... |
`include "Global_Macros.v"
module Write_Back(
clk_i,
rst_i,
gbl_stl_i,
wait_to_fill_pipe_i,
control_signal_i,
p_i,
dat_i,
eff_adr_i,
mem_stl_i,
a_o,
x_o,
y_o,
mem_w_enb_o,
mem_w_cnt_o,
mem_w_adr_o,
mem_w_dat_o
`ifdef DEBUG
,debug_o
`... |
#include <bits/stdc++.h> using namespace std; const long long maxF = (long long)1e9 * 1e9; const int maxn = 100, maxm = 100, maxlen = maxn + maxm + 1; int n, m, len, map[maxn + 5][maxm + 5], pri[maxlen], cir[maxlen]; long long dp[maxlen][(maxlen >> 1) + 1], k; long long cal() { memset(dp, 0, sizeof(dp))... |
#include <bits/stdc++.h> using namespace std; int n; vector<int> edge[200010]; int dp[200010][2][2]; int leaf[200010]; void dfsLeaf(int u) { if (edge[u].size() == 0) { leaf[u] = 1; return; } for (int i = 0; i < edge[u].size(); ++i) { int v = edge[u][i]; dfsLeaf(v); ... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, m; cin >> n >> m; long long int arr[n]; vector<long long int> a, onsum, offsum; for (long long int i = 0; i < n; i++) { cin >> arr[i]; } a.push_back(arr[0]); for (long long int i = 1; i < n; i++) { ... |
#include<bits/stdc++.h> #define PI acos(-1.0) #define eps 1e-8 #define fi first #define se second #define m_p make_pair //#define int long long #define IOS ios::sync_with_stdio(false),cin.tie(0),cout.tie(0) using namespace std; typedef long long ll; typedef unsigned int uint; const double E_num ... |
#include <bits/stdc++.h> using namespace std; char v[2100][2100]; int n, m; int sumx[2100][2100]; int sumy[2100][2100]; long long ans1, ans2, ans3, cima, baixo; int main() { bool ok; scanf( %d %d , &n, &m); for (int i = 0; i < n; ++i) scanf( %s , v[i]); for (int i = 0; i < n; ++i) { ... |
#include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; template <typename T> inline void read(T &x) { char c; bool nega = 0; while ((!isdigit(c = getchar())) && (c != - )) ; if (c == - ) { nega = 1; c = getchar(); } x = c - 48; ... |
///////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2014 Francis Bruno, All Rights Reserved
//
// 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... |
#include <bits/stdc++.h> #pragma comment(linker, /stack:200000000 ) #pragma GCC optimize( Ofast ) #pragma GCC target( sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native ) using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); long long n, k; cin >> n >> k; vec... |
//======================================================================
//
// tb_blake2.v
// -----------
// Testbench for the Blake2 top level wrapper.
//
//
// Copyright (c) 2013, Secworks Sweden AB
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or
// without modification, are p... |
`timescale 1ns / 100ps
module sasc_brg(/*AUTOARG*/
// Outputs
sio_ce, sio_ce_x4,
// Inputs
clk, arst_n
);
output sio_ce; // baud rate
output sio_ce_x4; // baud rate x 4
input clk;
input arst_n;
reg sio_ce;
reg sio_c... |
Require Import Algebra OwnTacts Equal.
(* Natural numbers is is the simplest inductive type. *)
(* For a type to be natural numbers is has to have the following properties (The Peano Axioms) : *)
(* 1 : forall n in N, *)
(* There should exi... |
#include <bits/stdc++.h> using namespace std; void fastio() { ios_base::sync_with_stdio(0); cin.tie(0); } int main() { fastio(); long long int n; cin >> n; long long int ans = 0; long long int a[n]; for (int i = 0; i < n; i++) cin >> a[i]; for (long long int i = 0; i < n; i +... |
#include <bits/stdc++.h> using namespace std; int main(int argc, char const *argv[]) { int t, n, m, x = 0, y = 0, flag = 0, cnt = 0, sum = 0, sum1 = 0, sum0 = 0, flag1 = 0; int a1, a2, a3, b1, b2, b3; vector<int> d; cin >> t; int a[t]; for (int i = 0; i < t; i++) { cin... |
/*
* Titor - Preshift - Prepares signals for input into the butterfly unit
* Copyright (C) 2012 Sean Ryan Moore
*
* 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 ... |
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int r, g, b; cin >> r >> g >> b; int a[3] = {r, g, b}; int i = 0; while (a[0] > 0 || a[1] > 0 || a[2] > 0) { if (a[i % 3] > 0) a[i % 3] -= 2; i++; } cout << 30 ... |
/**
* 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... |
//
// 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... |
/*
* Zero delay memory module for Zet
* Copyright (C) 2008-2010 Zeus Gomez Marmolejo <>
*
* This file is part of the Zet processor. This processor is free
* hardware; you can redistribute it and/or modify it under the terms of
* the GNU General Public License as published by the Free Software
* Foundation... |
// megafunction wizard: %FIFO%VBB%
// GENERATION: STANDARD
// VERSION: WM1.0
// MODULE: dcfifo
// ============================================================
// File Name: fifo_57x64.v
// Megafunction Name(s):
// dcfifo
//
// Simulation Library Files(s):
// altera_mf
// ========================================... |
#include <bits/stdc++.h> using namespace std; long long n, nn = 0, nm = 0, dr[5069], dh[10069], pd[5069], pr[5069], fq[10069], sbt[10069], sm = 0, z = 1e18; vector<pair<long long, long long>> fz[5069], al[10069]; pair<long long, long long> sk[5069]; vector<long long> pst[5069]; bitset<10069> ... |
#include <bits/stdc++.h> using namespace std; const int N = 1e5 + 100; int n, par[N], up[N], h[N], max_h[N]; vector<int> child[N], vec, ans; void dfs(int v = 0) { for (int u : child[v]) { h[u] = max_h[u] = h[v] + 1; dfs(u); max_h[v] = max(max_h[v], max_h[u]); } sort(child[v].begi... |
/*
* Copyright (c) 2001 Stephan Boettcher <>
*
* 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)
*... |
/*
* 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; const int MAXN = 100005; int BIT[4][11][MAXN * 2], n; void add(int BIT[], int p, int x) { for (int i = p; i <= n; i += ((i) & (-(i)))) BIT[i] += x; } int ask(int BIT[], int p) { int res = 0; for (int i = p; i; i -= ((i) & (-(i)))) res += BIT[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 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; if ((n - 1) * n / 2 <= k) { cout << no solution << endl; return 0; } long x, y; x = y = 0; while (n--) { cout << x << << y++ << endl; } return 0; } |
/*
* 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() { int t; cin >> t; while (t--) { int n; cin >> n; for (int i = 1; i <= n; i++) cout << i << ; cout << endl; } return 0; } |
module taxi_top (reset, pulse, clk,
price_seg1, price_seg2, price_seg3,
wait_time_seg1, wait_time_seg2,
mileage_seg1, mileage_seg2, mileage_seg3);
input reset;
input pulse,clk;
output [6:0] price_seg1, price_seg2, price_seg3,
wait_time_seg1, wait_time_seg2,
mileage_seg1, mileage_seg2, mileage_seg3;
//8 segmen... |
#include <bits/stdc++.h> const int N = 1e6 + 10; const int M = 9699690; const int mod = 1e9 + 7, Gi = 332748118; const int inf = 0x3f3f3f3f; const long long INF = 0x3f3f3f3f3f3f3f3fll; const int SIZE = 1 << 21; char ibuf[SIZE], *iS, *iT; using std::pair; template <class T> void read(T &x) { x = ... |
#include <bits/stdc++.h> using namespace std; long long modpow(long long a, long long b, long long mod = (long long)(1e9 + 7)) { if (!b) return 1; a %= mod; return modpow(a * a % mod, b / 2, mod) * (b & 1 ? a : 1) % mod; } mt19937 rng(chrono::steady_clock::now().time_since_epoch()... |
//--------------------------------------------------------------------------------
//
// data_align.v
// Copyright (C) 2011 Ian Davis
//
// 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... |
#include <bits/stdc++.h> using namespace std; const long long MOD = 998244353; long long qpow(long long x, long long y) { long long ret = 1; while (y) { if (y & 1) ret = ret * x % MOD; y >>= 1; x = x * x % MOD; } return ret % MOD; } int main() { long long n, sum = 0, C = ... |
/// date:2016/3/5 3/6 am: 10:57 done!
/// engineer:ZhaiShaoMIn
/// module function:because there are two kinds of uploadregs to
/// OUT_rep: inst_cache ,data_cache and memory, so we need to determine which can be writed into OUT_rep.
module arbiter_for_OUT_rep(//input
clk,
... |
#include <bits/stdc++.h> using namespace std; const int inf = (int)1e9 + 7; const int N = (int)3e5 + 4; const int M = 1001; int n, k; int a[6]; double ans; void f(int s) { if (s == k) { for (int i = 0; i < n; ++i) { for (int j = i + 1; j < n; ++j) { if (a[i] > a[j]) { ... |
// Author: Adam Nunez,
// Copyright (C) 2015 Adam Nunez
//
// 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.
//
//... |
/* -------------------------------------------------------------------------------
* (C)2007 Robert Mullins
* Computer Architecture Group, Computer Laboratory
* University of Cambridge, UK.
* -------------------------------------------------------------------------------
*
* FIFO
* ====
*
* Implementation not... |
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> v(n); multiset<int> list; for (int i = 0; i < n; i++) { cin >> v[i]; } for (int i = 0; i < n; i++) { int x; cin >> x; list.insert(x); } for (int i = 0; i < n; ++i) { ... |
#include <bits/stdc++.h> using namespace std; int n, q, k; struct node { int c[2], fa, siz, tot; int val, id, mid, mv; bool rev; node() { rev = false; } } t[600010]; void maintain(int rt) { t[rt].siz = t[t[rt].c[0]].siz + t[t[rt].c[1]].siz + t[rt].tot; t[rt].mid = t[rt].id; t[rt].m... |
/*
* Copyright (c) 2000 Stephen Williams ()
*
* 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; int get(int x) { int cnt = 0; while (x >= 10) { int sum = 0; while (x) { sum += x % 10; x /= 10; } cnt++; x = sum; } return cnt; } int main() { string s; cin >> s; if (s.size() == 1) cou... |
#include <bits/stdc++.h> using namespace std; int main() { long long int n, r; cin >> n >> r; if (r <= (n + 1) / 2) { cout << (2 * r - 1) << endl; } else { r -= (n + 1) / 2; cout << 2 * r << endl; } return 0; } |
/*
* 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... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.