Tsukihjy/testcase / testcase-data /Ours /clean_wrong_code.py
Tsukihjy's picture
download
raw
5.03 kB
# import re
# def remove_freopen_and_online_judge(code: str) -> str:
# # 删除 #ifndef ONLINE_JUDGE 和 #endif 之间的所有内容
# cleaned_code = re.sub(r'#ifndef ONLINE_JUDGE.*?#endif\\n?', '', code, flags=re.DOTALL)
# # 删除包含 'freopen' 的行
# cleaned_code = re.sub(r'^\\s*.*freopen.*\\n', '', cleaned_code, flags=re.MULTILINE)
# return cleaned_code
# import json
# tcb_v8 = json.load(open("/home/i-luoxianzhen/data/TestCase-Gen/data/Ours/TestcaseBench-v8.json", "r", encoding="utf-8"))
# for item in tcb_v8:
# for wrong_code in item['wrong_code']:
# wrong_code['code'] = remove_freopen_and_online_judge(wrong_code['code'])
# json.dump(tcb_v8, open(f"/home/i-luoxianzhen/data/TestCase-Gen/data/Ours/TestcaseBench-v9.json", "w", encoding="utf-8"), indent=4, ensure_ascii=False)
# ques = """
# ## Problem Description
# Little Q is someone who loves to study, and he often goes to Wikipedia to learn about computer science.
# Just now, Little Q was studying a series of bitwise operators, and the bitwise XOR operator $\oplus$ had a great impact on him. The bitwise XOR operator is a binary operator. It has the commutative property, meaning $i \oplus j = j \oplus i$.
# He discovered that the bitwise XOR can be understood as follows: for the corresponding bits of the numbers involved in the operation, if the bits are the same, the result at that position will be $0$, otherwise it will be $1$. For example: $1(01) \oplus 2(10) = 3(11)$.
# He also realized that bitwise XOR can be understood as performing a bitwise addition without carry for each binary bit of the numbers involved in the operation. For example: $3(11) \oplus 3(11) = 0(00)$.
# Now, Little Q has an undirected tree $T$ with $n$ nodes, numbered from $1$ to $n$, where the weight of node $i$ is $v_i$.
# The value of a tree is the XOR sum of the weights of all its nodes. A connected subtree of tree $T$ is a connected subgraph of $T$, and it is also a tree.
# Little Q wants to play a tree cutting game on this tree, where he will perform the following two operations repeatedly:
# - ``Change x y``, set the weight of node $x$ to $y$.
# - ``Query k``, query how many non-empty connected subtrees of $T$ have a value exactly equal to $k$.
# Little Q loves mathematics and hopes you can quickly answer his questions. Can you write a program to help him?
# ## Input Format
# The first line contains two positive integers $n$, $m$, representing the number of nodes and the upper limit of weights.
# The second line contains $n$ non-negative integers $v_1, v_2, \dots, v_n$, representing the initial weights of each node.
# The next $n-1$ lines each contain two positive integers $a_i$, $b_i$, representing an undirected edge connecting nodes $a_i$ and $b_i$.
# The next line contains a positive integer $q$, representing the number of operations Little Q will perform.
# The following $q$ lines describe each operation.
# ## Output Format
# Output several lines, each containing one integer, answering each query. Since the answer may be large, output the result modulo $10007$.
# ## Sample Input:
# 4 4
# 2 0 1 3
# 1 2
# 1 3
# 1 4
# 12
# Query 0
# Query 1
# Query 2
# Query 3
# Change 1 0
# Change 2 1
# Change 3 3
# Change 4 1
# Query 0
# Query 1
# Query 2
# Query 3
# ## Sample Output:
# 3
# 3
# 2
# 3
# 2
# 4
# 2
# 3
# ## Data Range and Hints
# For $100\%$ of the data, $1 \leq a_i, b_i, x \leq n$, $0 \leq v_i, y, k < m$, and there will be no more than $10000$ modification operations.
# """
# import json
# # 示例数据
# data = {
# "text": ques
# }
# # 将数据写入JSON文件
# with open('/home/i-luoxianzhen/data/TestCase-Gen/data/Ours/output.json', 'w', encoding='utf-8') as file:
# json.dump(data, file, ensure_ascii=False, indent=4)
import json
dict_last = {'#42575. 「USACO 2023.2 Platinum」Problem Setting': 0, '#2152. 「SCOI2005」王室联邦': 0, '#2206. 「HNOI2014」世界树': 0, '#2238. 「CQOI2014」和谐矩阵': 0, '#2426. 「POI2010」工会 Guilds': 0, '#2171. 「POI2011 R3 Day2」程序设计竞赛 Programming Contest': 0, '#2170. 「POI2011 R3 Day2」木棍 Sticks': 0, '#40844. 「USACO 2020.12 Platinum」Spaceship': 0, '#3089. 「BJOI2019」奥术神杖': 0, '#41063. 「联合省选 2021 A | B」图函数': 0, '#3113. 「SDOI2019」热闹的聚会与尴尬的聚会': 1, '#6232. 毒瘤题加强版': 0, '#2693. 「POI2012」比赛路线 Tour de Byteotia': 1, '#2972. 「COCI 2010.04」RESTORAN': 0, '#2266. 「CTSC2017」投': 0, '#2530. 「ZJOI2018」保镖': 0, '#6630. 跳一跳 加强版': 0}
add_data = json.load(open("/home/i-luoxianzhen/data/TestCase-Gen/data/Ours/correct.json", "r", encoding="utf-8"))
solution_list = {}
for k, v in dict_last.items():
if k not in add_data.keys():
print(k)
continue
solution_list[k] = add_data[k][0:8]
json.dump(solution_list, open(f"/home/i-luoxianzhen/data/TestCase-Gen/data/Ours/no_pass_right_code.json", "w", encoding="utf-8"), indent=4, ensure_ascii=False)

Xet Storage Details

Size:
5.03 kB
·
Xet hash:
39abf60c7d98678a662c0d30e70d5c513dfa8861bcf4b79e3ab4ecaa5c1b07e9

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.