forked from codechefPesuecc/CodeChef-PESUECC-Chapter
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmockData.ts
More file actions
163 lines (138 loc) · 4.01 KB
/
Copy pathmockData.ts
File metadata and controls
163 lines (138 loc) · 4.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
/**
* Editor configuration for the Arena workspace: the supported languages, their
* starter templates, and small formatting helpers. The judge (Piston) and the
* D1-backed leaderboard are live — the standings come from /api/leaderboard, so
* there are no mock solvers here.
*/
export type LanguageId =
| "cpp"
| "python"
| "java"
| "c"
| "csharp"
| "javascript"
| "go"
| "rust"
| "zig";
export const LANGUAGES: { id: LanguageId; label: string }[] = [
{ id: "cpp", label: "C++" },
{ id: "python", label: "Python" },
{ id: "java", label: "Java" },
{ id: "c", label: "C" },
{ id: "csharp", label: "C#" },
{ id: "javascript", label: "JavaScript" },
{ id: "go", label: "Go" },
{ id: "rust", label: "Rust" },
{ id: "zig", label: "Zig" },
];
export function languageLabel(id: LanguageId): string {
return LANGUAGES.find((l) => l.id === id)?.label ?? id;
}
export const STARTER_CODE: Record<LanguageId, string> = {
cpp: `#include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<long long> r(n);
for (auto &x : r) cin >> x;
// TODO: compute the minimum number of candies and print it.
return 0;
}
`,
python: `import sys
def main():
data = sys.stdin.buffer.read().split()
n = int(data[0])
r = list(map(int, data[1:1 + n]))
# TODO: compute the minimum number of candies and print it.
if __name__ == "__main__":
main()
`,
java: `import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine().trim());
StringTokenizer st = new StringTokenizer(br.readLine());
long[] r = new long[n];
for (int i = 0; i < n; i++) r[i] = Long.parseLong(st.nextToken());
// TODO: compute the minimum number of candies and print it.
}
}
`,
c: `#include <stdio.h>
#include <stdlib.h>
int main(void) {
int n;
if (scanf("%d", &n) != 1) return 0;
long long *r = malloc(sizeof(long long) * n);
for (int i = 0; i < n; i++) scanf("%lld", &r[i]);
// TODO: compute the minimum number of candies and print it.
free(r);
return 0;
}
`,
csharp: `using System;
using System.Linq;
class Program {
static void Main() {
int n = int.Parse(Console.ReadLine().Trim());
long[] r = Console.ReadLine()
.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
.Select(long.Parse).ToArray();
// TODO: compute the minimum number of candies and print it.
}
}
`,
javascript: `const data = require("fs").readFileSync(0, "utf8").split(/\\s+/).filter(Boolean);
let idx = 0;
const n = Number(data[idx++]);
const r = data.slice(idx, idx + n).map(Number);
idx += n;
// TODO: compute the minimum number of candies and print it with console.log.
`,
go: `package main
import (
"bufio"
"fmt"
"os"
)
func main() {
reader := bufio.NewReader(os.Stdin)
var n int
fmt.Fscan(reader, &n)
r := make([]int64, n)
for i := 0; i < n; i++ {
fmt.Fscan(reader, &r[i])
}
// TODO: compute the minimum number of candies and print it.
}
`,
rust: `use std::io::{self, Read};
fn main() {
let mut input = String::new();
io::stdin().read_to_string(&mut input).unwrap();
let mut it = input.split_whitespace();
let n: usize = it.next().unwrap().parse().unwrap();
let r: Vec<i64> = (0..n).map(|_| it.next().unwrap().parse().unwrap()).collect();
// TODO: compute the minimum number of candies and print it.
let _ = r;
}
`,
zig: `const std = @import("std");
pub fn main() !void {
const stdout = std.io.getStdOut().writer();
// TODO: read from stdin and print your answer.
try stdout.print("", .{});
}
`,
};
/** mm:ss for a duration in seconds. */
export function formatClock(totalSeconds: number): string {
const s = Math.max(0, Math.floor(totalSeconds));
const m = Math.floor(s / 60);
const rem = s % 60;
return `${String(m).padStart(2, "0")}:${String(rem).padStart(2, "0")}`;
}